rpg-engine 0.5.0 → 0.6.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.
Files changed (218) hide show
  1. package/dist/campaign/settings.d.ts +1 -0
  2. package/dist/campaign/settings.js +6 -5
  3. package/dist/command-line.js +12 -5
  4. package/dist/commands/advance.js +1 -1
  5. package/dist/commands/ask.d.ts +1 -1
  6. package/dist/commands/ask.js +66 -24
  7. package/dist/commands/change.js +28 -17
  8. package/dist/commands/config.d.ts +1 -1
  9. package/dist/commands/config.js +67 -21
  10. package/dist/commands/effect.js +42 -23
  11. package/dist/commands/find.js +1 -1
  12. package/dist/commands/game-adventures.js +2 -2
  13. package/dist/commands/game-catalog.d.ts +13 -0
  14. package/dist/commands/game-catalog.js +26 -2
  15. package/dist/commands/game-checks.js +23 -21
  16. package/dist/commands/{game-hit-dice.d.ts → game-dice-pool.d.ts} +3 -3
  17. package/dist/commands/{game-hit-dice.js → game-dice-pool.js} +7 -7
  18. package/dist/commands/game-effects.d.ts +12 -4
  19. package/dist/commands/game-effects.js +21 -13
  20. package/dist/commands/game-examples.d.ts +22 -0
  21. package/dist/commands/game-examples.js +72 -0
  22. package/dist/commands/game-extension-list.d.ts +31 -3
  23. package/dist/commands/game-extension-list.js +83 -7
  24. package/dist/commands/game-images.d.ts +1 -1
  25. package/dist/commands/game-images.js +3 -2
  26. package/dist/commands/game-library.d.ts +3 -0
  27. package/dist/commands/game-library.js +2 -2
  28. package/dist/commands/game-mode.js +1 -1
  29. package/dist/commands/game-package-code.d.ts +87 -0
  30. package/dist/commands/game-package-code.js +648 -0
  31. package/dist/commands/game-package-hooks.d.ts +37 -0
  32. package/dist/commands/game-package-hooks.js +116 -0
  33. package/dist/commands/game-recipes.js +2 -2
  34. package/dist/commands/game-reminders.d.ts +5 -2
  35. package/dist/commands/game-reminders.js +7 -4
  36. package/dist/commands/game-rules.d.ts +4 -1
  37. package/dist/commands/game-rules.js +7 -1
  38. package/dist/commands/game-upkeep.js +3 -3
  39. package/dist/commands/game-view-place.d.ts +8 -20
  40. package/dist/commands/game-view-place.js +16 -35
  41. package/dist/commands/game-widgets.d.ts +39 -10
  42. package/dist/commands/game-widgets.js +138 -35
  43. package/dist/commands/game-world.d.ts +17 -0
  44. package/dist/commands/game-world.js +70 -12
  45. package/dist/commands/image.js +1 -1
  46. package/dist/commands/init.js +2 -2
  47. package/dist/commands/mode.d.ts +1 -1
  48. package/dist/commands/package.d.ts +8 -0
  49. package/dist/commands/package.js +81 -24
  50. package/dist/commands/progression.d.ts +2 -0
  51. package/dist/commands/progression.js +7 -2
  52. package/dist/commands/roll.d.ts +2 -0
  53. package/dist/commands/roll.js +50 -24
  54. package/dist/commands/rules.js +6 -4
  55. package/dist/commands/scene.d.ts +1 -1
  56. package/dist/commands/scene.js +13 -10
  57. package/dist/commands/sheet.js +10 -1
  58. package/dist/commands/status.d.ts +1 -0
  59. package/dist/commands/status.js +14 -4
  60. package/dist/commands/trade.js +6 -4
  61. package/dist/commands/translate.js +2 -2
  62. package/dist/commands/travel.js +1 -1
  63. package/dist/commands/validate.js +2 -2
  64. package/dist/commands/view.d.ts +8 -4
  65. package/dist/commands/view.js +7 -6
  66. package/dist/commands/worked-out.js +11 -5
  67. package/dist/commands/write.d.ts +8 -1
  68. package/dist/commands/write.js +84 -25
  69. package/dist/core/command-reference.js +3 -2
  70. package/dist/core/consents.d.ts +18 -0
  71. package/dist/core/consents.js +93 -0
  72. package/dist/core/context.d.ts +51 -29
  73. package/dist/core/context.js +3 -1
  74. package/dist/core/examples.d.ts +25 -0
  75. package/dist/core/examples.js +19 -0
  76. package/dist/{extensions/api.d.ts → core/package-api.d.ts} +134 -32
  77. package/dist/core/package-declarations.d.ts +102 -0
  78. package/dist/core/package-declarations.js +81 -0
  79. package/dist/core/registry.d.ts +2 -0
  80. package/dist/core/text.d.ts +5 -0
  81. package/dist/core/text.js +12 -0
  82. package/dist/dashboard/acts.js +31 -24
  83. package/dist/dashboard/address.js +4 -1
  84. package/dist/dashboard/api.js +54 -0
  85. package/dist/dashboard/app.js +140 -96
  86. package/dist/dashboard/ask-card.js +76 -25
  87. package/dist/dashboard/asked-dice.js +57 -0
  88. package/dist/dashboard/dice/tray.js +3 -3
  89. package/dist/dashboard/extension-widgets.js +104 -10
  90. package/dist/dashboard/i18n/ar.json +25 -29
  91. package/dist/dashboard/i18n/cs.json +25 -29
  92. package/dist/dashboard/i18n/da.json +25 -29
  93. package/dist/dashboard/i18n/de.json +25 -29
  94. package/dist/dashboard/i18n/el.json +25 -29
  95. package/dist/dashboard/i18n/es.json +25 -29
  96. package/dist/dashboard/i18n/fi.json +25 -29
  97. package/dist/dashboard/i18n/fr.json +25 -29
  98. package/dist/dashboard/i18n/he.json +25 -29
  99. package/dist/dashboard/i18n/hi.json +25 -29
  100. package/dist/dashboard/i18n/hu.json +25 -29
  101. package/dist/dashboard/i18n/is.json +25 -29
  102. package/dist/dashboard/i18n/it.json +25 -29
  103. package/dist/dashboard/i18n/ja.json +25 -29
  104. package/dist/dashboard/i18n/ko.json +25 -29
  105. package/dist/dashboard/i18n/nb.json +25 -29
  106. package/dist/dashboard/i18n/nl.json +25 -29
  107. package/dist/dashboard/i18n/pl.json +25 -29
  108. package/dist/dashboard/i18n/pt.json +25 -29
  109. package/dist/dashboard/i18n/ro.json +25 -29
  110. package/dist/dashboard/i18n/ru.json +25 -29
  111. package/dist/dashboard/i18n/sv.json +25 -29
  112. package/dist/dashboard/i18n/tr.json +25 -29
  113. package/dist/dashboard/i18n/uk.json +25 -29
  114. package/dist/dashboard/i18n/zh.json +25 -29
  115. package/dist/dashboard/icons.js +4 -1
  116. package/dist/dashboard/kit.js +35 -0
  117. package/dist/dashboard/labels.js +1 -0
  118. package/dist/dashboard/pack-card.js +7 -2
  119. package/dist/dashboard/package-page.js +50 -0
  120. package/dist/dashboard/packages.js +172 -23
  121. package/dist/dashboard/page-code.js +248 -0
  122. package/dist/dashboard/party.js +13 -14
  123. package/dist/dashboard/people.js +4 -0
  124. package/dist/dashboard/person-panel.js +110 -0
  125. package/dist/dashboard/place-map-view.js +11 -6
  126. package/dist/dashboard/scene.js +12 -9
  127. package/dist/dashboard/settings.js +55 -9
  128. package/dist/dashboard/sheet.js +21 -13
  129. package/dist/dashboard/status.js +69 -15
  130. package/dist/dashboard/style.css +592 -825
  131. package/dist/dashboard/top.js +75 -25
  132. package/dist/dashboard/turns.js +34 -13
  133. package/dist/dashboard/widgets.js +9 -2
  134. package/dist/dashboard-server.js +189 -10
  135. package/dist/dice/roll-dice.js +1 -1
  136. package/dist/effects/effect.d.ts +7 -4
  137. package/dist/effects/effect.js +12 -9
  138. package/dist/extensions/engine.d.ts +4 -0
  139. package/dist/extensions/engine.js +74 -0
  140. package/dist/extensions/extension.d.ts +25 -37
  141. package/dist/extensions/extension.js +26 -48
  142. package/dist/extensions/index.d.ts +3 -2
  143. package/dist/extensions/index.js +4 -1
  144. package/dist/extensions/packages.d.ts +6 -0
  145. package/dist/extensions/packages.js +100 -11
  146. package/dist/index.d.ts +1 -3
  147. package/dist/mcp-server.js +51 -14
  148. package/dist/page-words.d.ts +4 -0
  149. package/dist/page-words.js +4 -4
  150. package/dist/page.d.ts +218 -0
  151. package/dist/page.js +2 -0
  152. package/dist/pages/load.d.ts +7 -1
  153. package/dist/pages/load.js +10 -5
  154. package/dist/pages/page-file.js +1 -1
  155. package/dist/pages/stack-writes.js +5 -4
  156. package/dist/pages/world.d.ts +8 -0
  157. package/dist/pages/world.js +9 -2
  158. package/dist/systems/game-system.d.ts +52 -26
  159. package/dist/systems/game-system.js +141 -42
  160. package/dist/systems/index.d.ts +3 -3
  161. package/dist/systems/index.js +3 -3
  162. package/dist/systems/system-code.d.ts +29 -88
  163. package/dist/systems/system-code.js +68 -23
  164. package/dist/systems/words.d.ts +2 -0
  165. package/dist/systems/words.js +11 -0
  166. package/dist/testing.d.ts +20 -5
  167. package/dist/testing.js +49 -14
  168. package/instructions/combat.md +2 -2
  169. package/instructions/core.md +2 -2
  170. package/instructions/dashboard.md +2 -2
  171. package/instructions/mentor-tutorial.md +1 -1
  172. package/instructions/play.md +3 -3
  173. package/instructions/setup.md +1 -1
  174. package/package.json +10 -2
  175. package/systems/5e/LICENSE.md +13 -3
  176. package/systems/5e/dist/dying.js +83 -16
  177. package/systems/5e/dist/index.js +2 -2
  178. package/systems/5e/dist/page-style.js +634 -0
  179. package/systems/5e/dist/page.js +166 -0
  180. package/systems/5e/dist/shown.js +23 -0
  181. package/systems/5e/instructions/combat.md +1 -0
  182. package/systems/5e/package.json +4 -2
  183. package/systems/5e/system.yaml +37 -9
  184. package/systems/5e/versions/srd-5.1/system.yaml +2 -0
  185. package/systems/5e/words/ar.yaml +30 -0
  186. package/systems/5e/words/cs.yaml +30 -0
  187. package/systems/5e/words/da.yaml +30 -0
  188. package/systems/5e/words/de.yaml +30 -0
  189. package/systems/5e/words/el.yaml +30 -0
  190. package/systems/5e/words/es.yaml +30 -0
  191. package/systems/5e/words/fi.yaml +30 -0
  192. package/systems/5e/words/fr.yaml +30 -0
  193. package/systems/5e/words/he.yaml +30 -0
  194. package/systems/5e/words/hi.yaml +30 -0
  195. package/systems/5e/words/hu.yaml +30 -0
  196. package/systems/5e/words/is.yaml +30 -0
  197. package/systems/5e/words/it.yaml +30 -0
  198. package/systems/5e/words/ja.yaml +30 -0
  199. package/systems/5e/words/ko.yaml +30 -0
  200. package/systems/5e/words/nb.yaml +30 -0
  201. package/systems/5e/words/nl.yaml +30 -0
  202. package/systems/5e/words/pl.yaml +30 -0
  203. package/systems/5e/words/pt.yaml +30 -0
  204. package/systems/5e/words/ro.yaml +30 -0
  205. package/systems/5e/words/ru.yaml +30 -0
  206. package/systems/5e/words/sv.yaml +30 -0
  207. package/systems/5e/words/tr.yaml +30 -0
  208. package/systems/5e/words/uk.yaml +30 -0
  209. package/systems/5e/words/zh.yaml +30 -0
  210. package/dist/commands/game-extensions.d.ts +0 -34
  211. package/dist/commands/game-extensions.js +0 -407
  212. package/dist/commands/game-system-code.d.ts +0 -33
  213. package/dist/commands/game-system-code.js +0 -188
  214. package/dist/dashboard/death-save.js +0 -67
  215. package/dist/dashboard/dying.js +0 -46
  216. package/dist/dashboard/save-outcome.js +0 -42
  217. package/dist/dashboard/spend.js +0 -115
  218. /package/dist/{extensions/api.js → core/package-api.js} +0 -0
@@ -4,7 +4,7 @@ import { createHash, randomUUID } from "node:crypto";
4
4
  import { createServer } from "node:http";
5
5
  import { createRequire } from "node:module";
6
6
  import { connect } from "node:net";
7
- import { basename, extname, join, resolve } from "node:path";
7
+ import { basename, dirname, extname, join, resolve } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { z } from "zod";
10
10
  import { readAdventureZip } from "./adventures/index.js";
@@ -12,22 +12,25 @@ import { findCampaign, readSettings, readTextSetting, requireCampaign, settingNa
12
12
  import { config, playerChangeNews, playerSettingNamed, playerSettings, setupSettingNamed } from "./commands/config.js";
13
13
  import { installAdventure } from "./commands/game-adventures.js";
14
14
  import { catalog } from "./commands/game-catalog.js";
15
- import { campaignExtensions } from "./commands/game-extension-list.js";
15
+ import { campaignPageModules } from "./commands/game-extension-list.js";
16
16
  import { imageFolders } from "./commands/game-images.js";
17
17
  import { playerStory } from "./commands/game-knowledge.js";
18
18
  import { libraryContents, libraryEntries, startLibraryReading, unquoted } from "./commands/game-library.js";
19
19
  import { campaignMode } from "./commands/game-mode.js";
20
+ import { campaignPackages, loadCampaignCode, packageCommands } from "./commands/game-package-code.js";
20
21
  import { exportsFolderName, resetPoints } from "./commands/game-saves.js";
21
- import { campaignWidgets } from "./commands/game-widgets.js";
22
+ import { campaignWidgets, packageWidget } from "./commands/game-widgets.js";
22
23
  import { campaignSystem, campaignWorld } from "./commands/game-world.js";
23
24
  import { importShown } from "./commands/import.js";
24
- import { adventureText, packageCommand, YesRefused } from "./commands/package.js";
25
+ import { adventureText, isInstalledPackage, packageCommand, YesRefused } from "./commands/package.js";
25
26
  import { playerSaveNews, save } from "./commands/save.js";
26
27
  import { view } from "./commands/view.js";
27
28
  import { packagesFolder } from "./core/context.js";
29
+ import { realPath } from "./core/files.js";
28
30
  import { isBoolean } from "./core/registry.js";
29
31
  import { files, isInside, withFiles } from "./core/store.js";
30
32
  import { comparableText } from "./core/text.js";
33
+ import { getVersion, isNewerVersion } from "./core/version.js";
31
34
  import { notationParts } from "./dice/index.js";
32
35
  import { extensionWords, findExtension } from "./extensions/index.js";
33
36
  import { findHiddenImage, findImage } from "./images/index.js";
@@ -115,6 +118,8 @@ const importMap = JSON.stringify({
115
118
  "three": "/vendor/three.module.js",
116
119
  "three/addons/": "/vendor/three/addons/",
117
120
  "@dimforge/rapier3d-compat": "/vendor/rapier.mjs",
121
+ // The kit the extensions' page code is drawn with (D-510).
122
+ "rpg-engine/page": "/kit.js",
118
123
  },
119
124
  });
120
125
  // The page runs only its own files and the import map written in it, known by its hash; and the physics of the dice, which Rapier's module carries as
@@ -140,6 +145,8 @@ const pageHtml = [
140
145
  export async function startDashboard(context, session, options = {}) {
141
146
  // The systems' code, when no MCP server loaded it first, as the dashboard served alone (D-448).
142
147
  context.systemCode ??= await loadSystemCode(context.systemFolders);
148
+ // And the campaign's extensions', whose hooks are called at once too (D-514).
149
+ await withFiles(session, () => loadCampaignCode(context));
143
150
  const root = withFiles(session, () => findCampaign(context.folder)) ?? context.folder;
144
151
  for (const port of options.ports ?? campaignPorts(root)) {
145
152
  // A port another program answers at, even on ::1 or on every address, is its: a browser asking localhost could reach it instead (D-277).
@@ -159,6 +166,7 @@ export async function startDashboard(context, session, options = {}) {
159
166
  pageHidden: options.pageHidden ?? pageHidden,
160
167
  pageIds: new Map(),
161
168
  seen: new Map(),
169
+ declined: new Set(),
162
170
  changed: new Map(),
163
171
  events: [],
164
172
  left: new Set(),
@@ -217,6 +225,8 @@ function listen(server, port) {
217
225
  }
218
226
  // How long the catalog is kept before npm and GitHub are asked again.
219
227
  const catalogLife = 10 * 60 * 1000;
228
+ // The version of rpg-engine this server runs, read as it starts: an update on disk comes only with a new chat (D-515 (3)).
229
+ const runningVersion = getVersion();
220
230
  // How many characters the player's own words may have, in place of a button (ASK-10).
221
231
  const mostSaid = 500;
222
232
  // How long the page waits for the player's click: as long as a host waits for a call that keeps reporting progress, as ask does with a form.
@@ -299,6 +309,10 @@ async function answer(request, response, served) {
299
309
  const url = new URL(request.url ?? "/", own[0]);
300
310
  const path = url.pathname;
301
311
  // The page answers the master's question with a click, and changes the player's settings: what it sends, and only from itself (D-279, D-341).
312
+ if (request.method === "POST" && path === "/api/run" && origin !== undefined) {
313
+ await runForPlayer(request, response, served);
314
+ return;
315
+ }
302
316
  if (request.method === "POST" && path === "/api/answer" && origin !== undefined) {
303
317
  await answerAsked(request, response, served);
304
318
  return;
@@ -361,6 +375,11 @@ async function answer(request, response, served) {
361
375
  await pageWords(request, response, served, url);
362
376
  return;
363
377
  }
378
+ // rpg-engine itself (D-515 (3)): what it is and what npm has, for the page; its update, from the page alone, never by the master.
379
+ if (path === "/api/engine" && (request.method === "GET" || (request.method === "POST" && origin !== undefined))) {
380
+ await engineNow(request, response, served);
381
+ return;
382
+ }
364
383
  if (request.method !== "GET" && request.method !== "HEAD") {
365
384
  send(response, 405, "text/plain; charset=utf-8", "The dashboard only gives what the player may see, and takes a click on what the master asks, the player's settings and their saves.");
366
385
  return;
@@ -388,7 +407,7 @@ async function answer(request, response, served) {
388
407
  words,
389
408
  names,
390
409
  ...rows,
391
- ...(asked.rows?.save === undefined ? {} : { save: asked.rows.save }),
410
+ ...(asked.rows?.forced === true ? { forced: true } : {}),
392
411
  ...(asked.rows?.buttons === undefined ? {} : { buttons: asked.rows.buttons }),
393
412
  ...(asked.rows?.rule === undefined ? {} : { rule: asked.rows.rule }),
394
413
  // Its card, or that one comes, until its widget answers: the page waits for it rather than show the question twice (D-507).
@@ -403,10 +422,21 @@ async function answer(request, response, served) {
403
422
  await packagesNow(response, served, url.searchParams.get("npm") === "true");
404
423
  return;
405
424
  }
425
+ if (path === "/api/modules") {
426
+ const root = findCampaign(served.context.folder);
427
+ await served.session.ready();
428
+ const modules = root === undefined ? [] : withFiles(served.session, () => pageModulesOf(root, served));
429
+ sendJson(response, 200, { modules: modules.map((one) => ({ package: one.package, kind: one.kind, version: one.version, address: one.address, figures: one.figures, ...(one.words === undefined ? {} : { words: one.words }) })) });
430
+ return;
431
+ }
406
432
  if (path === "/api/widgets") {
407
433
  await widgetsNow(response, served);
408
434
  return;
409
435
  }
436
+ if (path === "/api/widget") {
437
+ await widgetForCard(response, served, url.searchParams);
438
+ return;
439
+ }
410
440
  if (path === "/api/library") {
411
441
  await libraryNow(response, served);
412
442
  return;
@@ -441,6 +471,9 @@ async function answer(request, response, served) {
441
471
  else if (path.startsWith("/vendor/")) {
442
472
  sendFile(vendorModule(path.slice("/vendor/".length)), path, request, response, served);
443
473
  }
474
+ else if (path.startsWith("/pkg/")) {
475
+ sendFile(packagePageFile(path.slice("/pkg/".length), served), path, request, response, served);
476
+ }
444
477
  else {
445
478
  sendFile(pageFile(served.page, path), path, request, response, served);
446
479
  }
@@ -496,6 +529,71 @@ function sendFile(file, path, request, response, served) {
496
529
  }
497
530
  sendTagged(request, response, bytes, { "Content-Type": type, "Content-Security-Policy": type.startsWith("image/") ? picturePolicy : securityHeaders["Content-Security-Policy"] });
498
531
  }
532
+ /**
533
+ * A file of a package's page code (D-510, D-511), at pkg/<package>/<version>/<path>: only of the campaign's system or one of its extensions, at the version
534
+ * installed, whose code runs, and only beside its page module, by real paths, links included; a script, a style sheet or a picture. Undefined for anything else.
535
+ */
536
+ function packagePageFile(path, served) {
537
+ let parts;
538
+ try {
539
+ parts = path.split("/").map((part) => decodeURIComponent(part));
540
+ }
541
+ catch {
542
+ return undefined;
543
+ }
544
+ const [name, version, ...rest] = parts;
545
+ const root = findCampaign(served.context.folder);
546
+ const module = root === undefined ? undefined : withFiles(served.session, () => pageModulesOf(root, served).find((one) => one.package === name && one.version === version));
547
+ if (module === undefined || rest.length === 0 || ![".js", ".mjs", ".css", ".svg"].includes(extname(rest.at(-1) ?? ""))) {
548
+ return undefined;
549
+ }
550
+ const folder = realPath(dirname(module.file));
551
+ const file = realPath(resolve(folder, ...rest));
552
+ return isInside(folder, file) ? file : undefined;
553
+ }
554
+ /** The page modules of the campaign's packages whose code runs: its system's and its extensions'. */
555
+ function pageModulesOf(root, served) {
556
+ return campaignPageModules(root, served.context, campaignSystem(root, served.context));
557
+ }
558
+ /**
559
+ * Runs a command of a package the player may run from its page code (D-510, D-514): one the campaign's packages give with player, whose code runs; as the
560
+ * player's, its output among what the master hears at their next call, quoted as another's words.
561
+ */
562
+ async function runForPlayer(request, response, served) {
563
+ const parsed = z.object({ command: z.string().trim().min(1).max(80), input: z.record(z.string(), z.unknown()).optional() }).strict().safeParse(await readBody(request));
564
+ if (!parsed.success) {
565
+ sendJson(response, 400, { error: "Send the command to run and its input: { command, input }." });
566
+ return;
567
+ }
568
+ try {
569
+ await served.session.ready();
570
+ const context = { ...served.context, actor: "player" };
571
+ const { text, readOnly } = await withFiles(served.session, async () => {
572
+ const root = requireCampaign(context.folder);
573
+ const command = (await packageCommands(root, context, [])).commands.find((one) => one.name === parsed.data.command && one.forPlayer === true);
574
+ if (command === undefined) {
575
+ throw new Error(`No package of the campaign gives ${parsed.data.command} to the player: a page runs only the commands its package marks player.`);
576
+ }
577
+ const input = command.input.safeParse(parsed.data.input ?? {});
578
+ if (!input.success) {
579
+ throw new Error(`The input of ${command.name} is not valid: ${input.error.issues.map((issue) => `${issue.path.join(".") || "input"}: ${issue.message}`).join("; ")}.`);
580
+ }
581
+ return { text: command.format(await command.run(input.data, context)), readOnly: command.readOnly === true };
582
+ });
583
+ const quoted = text.split("\n").map((line) => `> ${line}`).join("\n");
584
+ // A command that only reads tells the master nothing (D-514).
585
+ if (readOnly) {
586
+ sendJson(response, 200, { text });
587
+ return;
588
+ }
589
+ served.events.push(`The player, on the dashboard, ran ${parsed.data.command}: it is already done, do not run it again. It said, as its package's words:\n${quoted}`);
590
+ served.notify();
591
+ sendJson(response, 200, { text });
592
+ }
593
+ catch (error) {
594
+ sendJson(response, 400, { error: error instanceof Error ? error.message : String(error) });
595
+ }
596
+ }
499
597
  /** Bytes with a tag of what they hold, read again at each load: the same bytes come back as not modified, as three.js and the dice after the first load. */
500
598
  function sendTagged(request, response, bytes, headers) {
501
599
  const tag = `"${createHash("sha1").update(bytes).digest("base64url")}"`;
@@ -584,8 +682,8 @@ function pagePlayer(served) {
584
682
  const chosen = await put(question, title, [change], signal, { square: true, rows: { who, fields: [] } });
585
683
  return typeof chosen === "number" ? (chosen === 0 ? 0 : undefined) : chosen;
586
684
  },
587
- async spendDice(question, title, done, spending, signal) {
588
- const chosen = await put(question, title, [done], signal, { spending });
685
+ async spendDice(question, title, done, spending, signal, card) {
686
+ const chosen = await put(question, title, [done], signal, { spending, ...(card === undefined ? {} : { rows: { who: spending.shown().who, fields: [], card } }) });
589
687
  // The call stopped, its answer never goes: the dice spent reach the master at the next one, as the player's other news (ASK-14).
590
688
  const told = signal?.aborted === true ? spending.spent() : undefined;
591
689
  if (told !== undefined) {
@@ -823,6 +921,21 @@ function inLanguage(installed, served, language) {
823
921
  }
824
922
  });
825
923
  }
924
+ /** What one widget of a package shows for a card or a page of its page code, for the character it shows (D-514): its data, or nothing. */
925
+ async function widgetForCard(response, served, query) {
926
+ const [owner, name, who] = [query.get("package") ?? "", query.get("widget") ?? "", query.get("who") ?? undefined];
927
+ try {
928
+ await served.session.ready();
929
+ const shows = await withFiles(served.session, async () => {
930
+ const root = findCampaign(served.context.folder);
931
+ return root === undefined ? undefined : await packageWidget(root, served.context, owner, name, who === "" ? undefined : who);
932
+ });
933
+ sendJson(response, 200, shows === undefined ? {} : { shows });
934
+ }
935
+ catch (error) {
936
+ sendJson(response, 400, { error: error instanceof Error ? error.message : String(error) });
937
+ }
938
+ }
826
939
  /** The widgets of the campaign's extensions as the page shows them (D-502): where each stands, and what it shows now; none without a campaign. */
827
940
  async function widgetsNow(response, served) {
828
941
  try {
@@ -848,6 +961,11 @@ async function changePackage(request, response, served) {
848
961
  return;
849
962
  }
850
963
  const { action, name } = parsed.data;
964
+ // The page updates or takes away only what this computer has: it never brings a package new to it, nor its window, by these (D-510).
965
+ if (!isInstalledPackage(served.context, name)) {
966
+ sendJson(response, 400, { error: `${name} is not installed on this computer: add a package from the Packages page, where you choose it.` });
967
+ return;
968
+ }
851
969
  const done = action === "update" ? "updated" : action === "remove" ? "took out of the campaign" : "uninstalled";
852
970
  await packageWork(response, served, name, action, async (context) => {
853
971
  const result = await packageCommand.run(packageCommand.input.parse({ action: action === "update" ? "install" : action, name }), context);
@@ -967,6 +1085,8 @@ async function packageWork(response, served, name, action, work) {
967
1085
  player: undefined,
968
1086
  // Never the terminal: a folder new to the library asks the yes in a window (D-477).
969
1087
  terminal: undefined,
1088
+ // A no in a window holds for the session: a page, or a package's code in it, cannot make the window come back and back (D-510).
1089
+ declined: served.declined,
970
1090
  ...(confirm === undefined ? {} : {
971
1091
  confirm: {
972
1092
  ask: async (title, text, signal, answers) => {
@@ -982,7 +1102,7 @@ async function packageWork(response, served, name, action, work) {
982
1102
  if (done.news !== "") {
983
1103
  served.events.push(done.news);
984
1104
  }
985
- sendJson(response, 202, { kind: done.kind });
1105
+ sendJson(response, 202, { kind: done.kind, ...done.answer });
986
1106
  }
987
1107
  catch (error) {
988
1108
  sendJson(response, 400, { error: error instanceof Error ? error.message : String(error), ...(error instanceof YesRefused ? { code: error.code } : {}) });
@@ -992,6 +1112,65 @@ async function packageWork(response, served, name, action, work) {
992
1112
  served.notify();
993
1113
  }
994
1114
  }
1115
+ /**
1116
+ * rpg-engine itself on the Packages page (D-515 (3)): its version, npm's latest and whether it is newer, and how it is installed, read at each look; its update,
1117
+ * from the page alone, globally with npm as it was installed, a development link or another install told and never touched; then how the chat takes it.
1118
+ */
1119
+ async function engineNow(request, response, served) {
1120
+ const updater = served.context.engine;
1121
+ const version = runningVersion;
1122
+ // Where nothing updates it, as in the demo, its version alone.
1123
+ if (updater === undefined) {
1124
+ sendJson(response, request.method === "GET" ? 200 : 400, request.method === "GET" ? { version } : { error: "Only the game's server, started by the chat, updates rpg-engine." });
1125
+ return;
1126
+ }
1127
+ // What npm installed since this server started comes with a new chat: said apart, never as the version that runs.
1128
+ const onDisk = updater.onDisk();
1129
+ if (request.method === "GET") {
1130
+ const [latest, installed] = await Promise.all([updater.latest(), updater.installed()]);
1131
+ sendJson(response, 200, {
1132
+ version,
1133
+ ...(onDisk === version ? {} : { installed: onDisk }),
1134
+ ...("failed" in latest ? { failed: latest.failed } : { latest: latest.version, update: isNewerVersion(latest.version, onDisk) }),
1135
+ install: installed.how,
1136
+ ...("folder" in installed ? { folder: installed.folder } : {}),
1137
+ ...(served.packageWork === undefined ? {} : { working: served.packageWork }),
1138
+ });
1139
+ return;
1140
+ }
1141
+ const parsed = z.object({ action: z.literal("update") }).strict().safeParse(await readBody(request));
1142
+ if (!parsed.success) {
1143
+ sendJson(response, 400, { error: "Send what to do with rpg-engine: { action: update }." });
1144
+ return;
1145
+ }
1146
+ await packageWork(response, served, "rpg-engine", "engine", async () => {
1147
+ const latest = await updater.latest();
1148
+ if ("failed" in latest) {
1149
+ throw new Error(`${latest.failed}: update it once this computer is online. Nothing changed.`);
1150
+ }
1151
+ if (!isNewerVersion(latest.version, onDisk)) {
1152
+ throw new Error(onDisk === version ? `rpg-engine ${version} is npm's latest: there is nothing to update.` : `rpg-engine ${onDisk} is installed already: it comes with a new chat.`);
1153
+ }
1154
+ const installed = await updater.installed();
1155
+ if (installed.how !== "global") {
1156
+ throw new Error(installed.how === "link"
1157
+ ? `rpg-engine here is a link to the folder ${installed.folder}, made by npm link for its development: update it there, with git pull and npm run build. Nothing changed.`
1158
+ : `rpg-engine runs from ${installed.folder}, not from npm's global folder: update it the way it was installed. Nothing changed.`);
1159
+ }
1160
+ const why = await updater.update(latest.version);
1161
+ if (why !== undefined) {
1162
+ throw new Error(`rpg-engine could not be updated: ${why}. Nothing changed.`);
1163
+ }
1164
+ // The chat goes on with the server it started, and so does this page: the new engine comes with a new chat, or the app opened again.
1165
+ const host = served.context.host?.() ?? "";
1166
+ const restart = /codex|claude-ai|claude desktop/i.test(host) ? "app" : "chat";
1167
+ return {
1168
+ kind: "engine-updated",
1169
+ news: `The player updated rpg-engine from ${version} to ${latest.version} on the dashboard: this chat goes on with ${version}, the new one comes with their next chat. Nothing to do now.`,
1170
+ answer: { version: latest.version, restart },
1171
+ };
1172
+ });
1173
+ }
995
1174
  /** The kind of package a result of package install says it installed. */
996
1175
  function kindOf(result) {
997
1176
  return result === "adventure-installed" ? "adventure" : result === "system-installed" ? "system" : result === "language-installed" ? "language" : "extension";
@@ -1537,7 +1716,7 @@ async function runCommand(name, parameters, response, served) {
1537
1716
  * runs nothing, even an SVG opened by itself.
1538
1717
  */
1539
1718
  function sendImage(name, request, response, served) {
1540
- // An extension's own, which its widgets show, at an address of its own, ext/<extension>/<file>, never mistaken for the campaign's (D-502).
1719
+ // A package's own, which its widgets show, at an address of its own, ext/<package>/<file>, never mistaken for the campaign's (D-502, D-514).
1541
1720
  const [, extensionName, extensionFile] = /^ext\/([^/]+)\/([^/]+)$/.exec(name) ?? [];
1542
1721
  const fileName = decoded(extensionFile ?? name);
1543
1722
  const ownerName = extensionName === undefined ? undefined : decoded(extensionName);
@@ -1547,7 +1726,7 @@ function sendImage(name, request, response, served) {
1547
1726
  return undefined;
1548
1727
  }
1549
1728
  if (extensionName !== undefined) {
1550
- const owner = campaignExtensions(root, served.context).extensions.find((extension) => extension.name === ownerName);
1729
+ const owner = campaignPackages(root, served.context).find((extension) => extension.name === ownerName);
1551
1730
  return owner === undefined ? undefined : findImage([owner.folder], fileName);
1552
1731
  }
1553
1732
  // A stranger's picture comes by a name of its bytes, from the campaign's own (D-420).
@@ -18,7 +18,7 @@ export function rollDice(notation, source) {
18
18
  function rollPhysical(terms, values) {
19
19
  const neededCount = minimumDice(terms);
20
20
  if (values.length < neededCount) {
21
- throw new DiceError(`This roll needs at least ${neededCount} values (${describeDice(terms)}), but ${values.length} were given.`);
21
+ throw new DiceError(`This roll needs at least ${neededCount} values (${describeDice(terms)}), but ${values.length} ${values.length === 1 ? "was" : "were"} given.`);
22
22
  }
23
23
  const faces = physicalFaces(values);
24
24
  const breakdown = evaluateTerms(terms, faces.nextFace);
@@ -44,12 +44,15 @@ export declare function formatEnd(end: EffectEnd): string;
44
44
  export declare function readRounds(text: string): number | undefined;
45
45
  /** Whether a duration is the scene itself: the effect ends when the scene does. */
46
46
  export declare function isSceneDuration(text: string): boolean;
47
- /** The effects with one added, as the newest: an effect with the same name is replaced (EFF-3, EFF-4). */
48
- export declare function withEffect(effects: Effect[], effect: Effect): Effect[];
47
+ /**
48
+ * The effects with one added, as the newest: an effect with the same name is replaced (EFF-3, EFF-4), or with its word in `words`, the game system's in the
49
+ * campaign's language, Prono for Prone (D-403).
50
+ */
51
+ export declare function withEffect(effects: Effect[], effect: Effect, words?: Record<string, string>): Effect[];
49
52
  /** Who keeps an effect alive, by name: [[Lena]] and Lena are the same; undefined when no one does. */
50
53
  export declare function keeperOf(effect: Effect): string | undefined;
51
- /** The effect with this name, ignoring case and how accents are written. */
52
- export declare function effectNamed(effects: Effect[], name: string): Effect | undefined;
54
+ /** The effect with this name, ignoring case and how accents are written, or with its word in `words`, as withEffect reads them. */
55
+ export declare function effectNamed(effects: Effect[], name: string, words?: Record<string, string>): Effect | undefined;
53
56
  /** Whether an effect counted in rounds has ended when the turn passes to `turn` in `round` (EFF-9): at its turn in its round, at the start of its round when that one is no longer in the order, a round later anyway. */
54
57
  export declare function endsAtTurn(end: {
55
58
  round: number;
@@ -1,4 +1,4 @@
1
- import { comparableText } from "../core/text.js";
1
+ import { comparableText, sameWord } from "../core/text.js";
2
2
  // "Scudo della fede (by: [[Lena]], ac: 15) until day 2, 14:20": a name, values in brackets, an end; the brackets and the end may be missing.
3
3
  const linePattern = /^(.+?)(?:\s+\(([^()]*)\))?(?:\s+until\s+(.+))?$/i;
4
4
  const roundPattern = /^round\s+(\d{1,9})\s*,\s*(.+)$/i;
@@ -8,7 +8,7 @@ const sceneEnd = "scene end";
8
8
  export function readEffect(line) {
9
9
  const match = linePattern.exec(line.trim());
10
10
  if (match === null) {
11
- return { problem: `"${line}" is not an effect: write its name, then its values in brackets and its end, such as Scudo della fede (ac: 15) until day 2, 14:20.` };
11
+ return { problem: `"${line}" is not an effect: write its name, then its values in brackets and its end, such as Protezione (armor: 2) until day 2, 14:20.` };
12
12
  }
13
13
  const [, written, valuesText, endText] = match;
14
14
  const values = valuesText === undefined ? [] : readValues(valuesText);
@@ -32,7 +32,7 @@ export function readEffects(value) {
32
32
  }
33
33
  const lines = (Array.isArray(value) ? value : [value]).map(asLine);
34
34
  if (lines.some((line) => line === undefined)) {
35
- return { problem: "effects must be a list of lines of text, such as Scudo della fede (ac: 15) until day 2, 14:20." };
35
+ return { problem: "effects must be a list of lines of text, such as Protezione (armor: 2) until day 2, 14:20." };
36
36
  }
37
37
  const effects = [];
38
38
  for (const line of lines.filter((text) => text.trim() !== "")) {
@@ -67,17 +67,20 @@ export function readRounds(text) {
67
67
  export function isSceneDuration(text) {
68
68
  return comparableText(text.trim()) === "scene";
69
69
  }
70
- /** The effects with one added, as the newest: an effect with the same name is replaced (EFF-3, EFF-4). */
71
- export function withEffect(effects, effect) {
72
- return [...effects.filter((other) => !sameName(other.name, effect.name)), effect];
70
+ /**
71
+ * The effects with one added, as the newest: an effect with the same name is replaced (EFF-3, EFF-4), or with its word in `words`, the game system's in the
72
+ * campaign's language, Prono for Prone (D-403).
73
+ */
74
+ export function withEffect(effects, effect, words) {
75
+ return [...effects.filter((other) => !sameWord(other.name, effect.name, words)), effect];
73
76
  }
74
77
  /** Who keeps an effect alive, by name: [[Lena]] and Lena are the same; undefined when no one does. */
75
78
  export function keeperOf(effect) {
76
79
  return effect.by === undefined ? undefined : pageName(effect.by);
77
80
  }
78
- /** The effect with this name, ignoring case and how accents are written. */
79
- export function effectNamed(effects, name) {
80
- return effects.find((effect) => sameName(effect.name, name));
81
+ /** The effect with this name, ignoring case and how accents are written, or with its word in `words`, as withEffect reads them. */
82
+ export function effectNamed(effects, name, words) {
83
+ return effects.find((effect) => sameWord(effect.name, name, words));
81
84
  }
82
85
  /** Whether an effect counted in rounds has ended when the turn passes to `turn` in `round` (EFF-9): at its turn in its round, at the start of its round when that one is no longer in the order, a round later anyway. */
83
86
  export function endsAtTurn(end, round, turn, order) {
@@ -0,0 +1,4 @@
1
+ import type { EngineUpdater } from "../core/context.ts";
2
+ import { type NpmRun } from "./packages.ts";
3
+ /** rpg-engine on npm, for the engine in this folder, from src/ and dist/ alike its package's own; `run` runs npm, a fake in tests. */
4
+ export declare function npmEngine(folder?: string, run?: (args: string) => Promise<NpmRun>): EngineUpdater;
@@ -0,0 +1,74 @@
1
+ // rpg-engine itself on npm (D-515 (3)): its latest version, how this one is installed, and its update with npm, globally as it was installed; a development
2
+ // link, or any other install, is told and never touched.
3
+ import { lstatSync, readFileSync, realpathSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { npmError, npmErrorCode, runNpm } from "./packages.js";
7
+ const registry = "https://registry.npmjs.org";
8
+ /** rpg-engine on npm, for the engine in this folder, from src/ and dist/ alike its package's own; `run` runs npm, a fake in tests. */
9
+ export function npmEngine(folder = fileURLToPath(new URL("../../", import.meta.url)), run = runNpm) {
10
+ return {
11
+ latest: async () => {
12
+ try {
13
+ const answer = await fetch(`${registry}/rpg-engine/latest`, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(20_000) });
14
+ const read = answer.ok ? await answer.json() : undefined;
15
+ return typeof read?.version === "string" ? { version: read.version } : { failed: `npm's registry answered ${answer.status} ${answer.statusText}` };
16
+ }
17
+ catch (error) {
18
+ return { failed: `npm's registry could not be reached: ${error instanceof Error ? error.message : String(error)}` };
19
+ }
20
+ },
21
+ installed: async () => engineInstall(folder, await run("root -g")),
22
+ onDisk: () => {
23
+ try {
24
+ return JSON.parse(readFileSync(join(folder, "package.json"), "utf8")).version ?? "0.0.0";
25
+ }
26
+ catch {
27
+ return "0.0.0";
28
+ }
29
+ },
30
+ update: async (version) => {
31
+ if (!/^\d+\.\d+\.\d+$/.test(version)) {
32
+ return `${version} is not a version of rpg-engine`;
33
+ }
34
+ const ran = await run(`install -g rpg-engine@${version} --no-audit --no-fund --json --loglevel=error`);
35
+ return ran.code === 0 ? undefined : updateProblem(ran);
36
+ },
37
+ };
38
+ }
39
+ /** How the engine in this folder is installed, by npm's global folder: the package there, a link to this folder, or neither. */
40
+ function engineInstall(folder, root) {
41
+ const own = realFolder(folder);
42
+ if (root.code !== 0 || own === undefined) {
43
+ return { how: "other", folder: own ?? folder };
44
+ }
45
+ const global = join(root.out.trim(), "rpg-engine");
46
+ try {
47
+ const linked = lstatSync(global).isSymbolicLink();
48
+ return realFolder(global) !== own ? { how: "other", folder: own } : linked ? { how: "link", folder: own } : { how: "global" };
49
+ }
50
+ catch {
51
+ return { how: "other", folder: own };
52
+ }
53
+ }
54
+ /** A folder as the file system resolves it, through links; undefined when it is not there. */
55
+ function realFolder(folder) {
56
+ try {
57
+ return realpathSync(folder);
58
+ }
59
+ catch {
60
+ return undefined;
61
+ }
62
+ }
63
+ /** Why npm did not update rpg-engine, with what the player can do. */
64
+ function updateProblem(ran) {
65
+ const code = npmErrorCode(ran);
66
+ // On Windows a file another program holds is refused as EPERM.
67
+ if (code === "EBUSY" || (code === "EPERM" && process.platform === "win32")) {
68
+ return "a file of rpg-engine is in use by another program: close the other chats with RPG Engine, then update it again";
69
+ }
70
+ if (code === "EACCES" || code === "EPERM") {
71
+ return `npm may not write its global folder (${code}): update it in a terminal with npm install -g rpg-engine, as the computer's administrator if it asks`;
72
+ }
73
+ return `npm said: ${npmError(ran)}`;
74
+ }
@@ -1,31 +1,42 @@
1
1
  import { type InstructionPart } from "../core/instruction-parts.ts";
2
+ import { type DeclaredWidget, type FigureSize } from "../core/package-declarations.ts";
2
3
  /** The file that makes a folder an extension of rpg-engine (D-427). */
3
4
  export declare const extensionFileName = "extension.yaml";
4
- /**
5
- * The version of the API an extension's code is given (api.ts), which its package.json names: 2 added the widgets (D-502), 3 its additions to the game system,
6
- * the pages, the scene, writing its own fields and asking the player (D-505). A package made for this one or an older one is read; one made for a newer one is
7
- * refused, as an older rpg-engine refuses this one's.
8
- */
9
- export declare const extensionApi = 3;
10
5
  /** What an extension may add to the campaign's game system in extension.yaml, written as campaign.yaml writes it (CAM-2, D-505). */
11
- export declare const systemAdditionNames: readonly ["fields", "tables", "computed", "counters", "recipes", "values"];
6
+ export declare const systemAdditionNames: readonly ["fields", "tables", "computed", "counters", "recipes", "values", "condition-icons"];
12
7
  /** What an extension adds to the game system, by key, as extension.yaml writes it: the system checks it when it is read with it (CAM-3). */
13
8
  export type SystemAdditions = Partial<Record<(typeof systemAdditionNames)[number], Record<string, unknown>>>;
14
- /** Whether this rpg-engine reads a package made for this version of the API: from 1 up to its own. */
15
- export declare function readsApi(api: number | undefined): boolean;
16
- /** An installed extension (D-28, D-427, D-428): an npm package with an extension.yaml, its parts of the instructions and, when it has some, its code. */
17
- export interface Extension {
9
+ /**
10
+ * A package that brings its code to a campaign (D-513, D-514): one of its extensions, or its game system; the same contract and the same parts, the kind
11
+ * deciding only its role.
12
+ */
13
+ export interface CodePackage {
14
+ kind: "extension" | "system";
18
15
  /** The package's name, as npm and campaign.yaml write it: @rpgengine/weather. */
19
16
  package: string;
20
- /** The name its commands start with: the package's without its scope, weather (D-63). */
17
+ /** The name its commands and widgets start with (D-63): an extension's package's without its scope, weather; a system's as the campaign plays it, 5e. */
21
18
  name: string;
22
19
  version: string;
23
20
  folder: string;
24
21
  title: string;
25
- /** The line the master reads in the list of extensions (D-28). */
26
- about: string;
27
22
  /** The language its texts are written in, as a code such as en. */
28
23
  language: string;
24
+ /** Its icons by name, each the path of an SVG drawn on 24 by 24, as the dashboard strokes it (D-502). */
25
+ icons: Record<string, string>;
26
+ /** Its widgets on the dashboard, in the order written, each where it puts itself (D-502). */
27
+ widgets: DeclaredWidget[];
28
+ /** The file of its code for the dashboard's page, when it has some: the module whose default export draws its figures (D-510). */
29
+ page?: string;
30
+ /** The figures its page code draws, by name, with the room each takes on a wide screen; mirror, turned right to left, as it holds no words (D-510). */
31
+ figures: Record<string, FigureSize>;
32
+ /** Installed from a folder of this computer, which npm links: never verified, whatever its name (D-428). */
33
+ linked: boolean;
34
+ }
35
+ /** An installed extension (D-28, D-427, D-428): an npm package with an extension.yaml, its parts of the instructions and, when it has some, its code. */
36
+ export interface Extension extends CodePackage {
37
+ kind: "extension";
38
+ /** The line the master reads in the list of extensions (D-28). */
39
+ about: string;
29
40
  attribution?: string;
30
41
  /** The game system it needs, when it needs one (D-163). */
31
42
  needs: {
@@ -35,33 +46,10 @@ export interface Extension {
35
46
  calendar?: unknown;
36
47
  /** What it adds to the game system, under the campaign's own additions (CAM-2). */
37
48
  adds: SystemAdditions;
38
- /** Its icons by name, each the path of an SVG drawn on 24 by 24, as the dashboard strokes it (D-502). */
39
- icons: Record<string, string>;
40
- /** Its widgets on the dashboard, in the order written, each where it puts itself (D-502). */
41
- widgets: DeclaredWidget[];
42
49
  /** Its parts of the master's instructions, by name (D-121). */
43
50
  parts: Record<string, InstructionPart>;
44
51
  /** The file of its code, when it has some: the module whose default export gives its commands (D-428). */
45
52
  code?: string;
46
- /** Installed from a folder of this computer, which npm links: never verified, whatever its name (D-428). */
47
- linked: boolean;
48
- }
49
- /** The places of the dashboard a widget may stand in (D-502): a chip in the top, a card in the table's column beside the rolls, or a card in a page. */
50
- export declare const widgetPlaces: readonly ["top", "side", "page"];
51
- /** The pages a widget's card may stand in: the Scene, the sheet, the World and the Journal. */
52
- export declare const widgetPages: readonly ["scene", "sheet", "world", "journal"];
53
- export type WidgetPlace = (typeof widgetPlaces)[number];
54
- export type WidgetPage = (typeof widgetPages)[number];
55
- /** A widget as extension.yaml declares it (D-502): its name, which its code's hook has, its title, its icon, and where it stands, among the cards in order. */
56
- export interface DeclaredWidget {
57
- name: string;
58
- title: string;
59
- icon?: string;
60
- place: WidgetPlace;
61
- /** The page of a card that stands in one. */
62
- page?: WidgetPage;
63
- /** Its order among the cards of its place, the lowest first. */
64
- order: number;
65
53
  }
66
54
  /** The extensions installed in these folders, each a package folder, or a scope's folder of them as npm keeps them (@rpgengine/weather); the first by a name wins. */
67
55
  export declare function installedExtensions(folders: string[]): {