rpg-engine 0.7.0 → 0.8.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.
Files changed (393) hide show
  1. package/dist/adventures/index.d.ts +1 -1
  2. package/dist/adventures/index.js +1 -1
  3. package/dist/adventures/source.js +13 -13
  4. package/dist/campaign/create-campaign.js +10 -1
  5. package/dist/campaign/host-files.d.ts +2 -1
  6. package/dist/campaign/host-files.js +11 -11
  7. package/dist/campaign/index.d.ts +1 -1
  8. package/dist/campaign/index.js +1 -1
  9. package/dist/campaign/settings.d.ts +55 -64
  10. package/dist/campaign/settings.js +171 -174
  11. package/dist/{cli.js → cli/cli.js} +3 -3
  12. package/dist/{command-line.d.ts → cli/command-line.d.ts} +1 -1
  13. package/dist/{command-line.js → cli/command-line.js} +21 -20
  14. package/dist/commands/advance.d.ts +1 -1
  15. package/dist/commands/advance.js +7 -7
  16. package/dist/commands/ask.d.ts +1 -8
  17. package/dist/commands/ask.js +16 -29
  18. package/dist/commands/{change.d.ts → change/change.d.ts} +2 -2
  19. package/dist/commands/{change.js → change/change.js} +46 -52
  20. package/dist/commands/{game-damage.d.ts → change/damage.d.ts} +2 -2
  21. package/dist/commands/{game-damage.js → change/damage.js} +3 -3
  22. package/dist/commands/{game-recipe-pace.d.ts → change/recipe-pace.d.ts} +2 -2
  23. package/dist/commands/{game-recipe-pace.js → change/recipe-pace.js} +4 -4
  24. package/dist/commands/config.d.ts +4 -4
  25. package/dist/commands/config.js +142 -138
  26. package/dist/commands/effect.d.ts +1 -1
  27. package/dist/commands/effect.js +11 -12
  28. package/dist/commands/find.d.ts +4 -4
  29. package/dist/commands/find.js +2 -2
  30. package/dist/commands/image.js +6 -6
  31. package/dist/commands/{import.d.ts → import/import.d.ts} +2 -2
  32. package/dist/commands/{import.js → import/import.js} +101 -101
  33. package/dist/commands/{game-import.d.ts → import/run.d.ts} +3 -3
  34. package/dist/commands/{game-import.js → import/run.js} +13 -12
  35. package/dist/commands/index.js +7 -7
  36. package/dist/commands/init.js +3 -3
  37. package/dist/commands/install.js +1 -1
  38. package/dist/commands/instructions.js +6 -6
  39. package/dist/commands/mode.d.ts +2 -2
  40. package/dist/commands/mode.js +8 -8
  41. package/dist/commands/mood.js +4 -4
  42. package/dist/commands/move.js +13 -20
  43. package/dist/commands/package.d.ts +2 -2
  44. package/dist/commands/package.js +138 -93
  45. package/dist/commands/rename.js +3 -3
  46. package/dist/commands/reveal.js +29 -18
  47. package/dist/commands/{roll.d.ts → roll/roll.d.ts} +4 -4
  48. package/dist/commands/{roll.js → roll/roll.js} +69 -69
  49. package/dist/commands/{game-tables.d.ts → roll/tables.d.ts} +2 -2
  50. package/dist/commands/{game-tables.js → roll/tables.js} +4 -4
  51. package/dist/commands/rules.d.ts +2 -2
  52. package/dist/commands/rules.js +3 -3
  53. package/dist/commands/save.d.ts +1 -1
  54. package/dist/commands/save.js +18 -18
  55. package/dist/commands/scene.d.ts +4 -4
  56. package/dist/commands/scene.js +31 -28
  57. package/dist/commands/{game-advance.d.ts → shared/advance.d.ts} +4 -4
  58. package/dist/commands/{game-advance.js → shared/advance.js} +27 -27
  59. package/dist/commands/{game-adventures.d.ts → shared/adventures.d.ts} +3 -3
  60. package/dist/commands/{game-adventures.js → shared/adventures.js} +20 -27
  61. package/dist/commands/{game-bonds.d.ts → shared/bonds.d.ts} +3 -3
  62. package/dist/commands/{game-bonds.js → shared/bonds.js} +2 -2
  63. package/dist/commands/{game-checks.d.ts → shared/checks.d.ts} +3 -3
  64. package/dist/commands/{game-checks.js → shared/checks.js} +7 -7
  65. package/dist/commands/{game-dice-pool.d.ts → shared/dice-pool.d.ts} +3 -3
  66. package/dist/commands/{game-dice-pool.js → shared/dice-pool.js} +19 -12
  67. package/dist/commands/{effect-layer.d.ts → shared/effect-layer.d.ts} +2 -2
  68. package/dist/commands/{effect-layer.js → shared/effect-layer.js} +12 -12
  69. package/dist/commands/{game-effects.d.ts → shared/effects.d.ts} +7 -7
  70. package/dist/commands/{game-effects.js → shared/effects.js} +19 -19
  71. package/dist/commands/{game-environment.d.ts → shared/environment.d.ts} +1 -1
  72. package/dist/commands/{game-environment.js → shared/environment.js} +3 -3
  73. package/dist/commands/{game-events.d.ts → shared/events.d.ts} +5 -5
  74. package/dist/commands/{game-events.js → shared/events.js} +20 -22
  75. package/dist/commands/{game-examples.d.ts → shared/examples.d.ts} +4 -8
  76. package/dist/commands/{game-examples.js → shared/examples.js} +23 -23
  77. package/dist/commands/{game-experience.d.ts → shared/experience.d.ts} +2 -2
  78. package/dist/commands/{game-experience.js → shared/experience.js} +8 -11
  79. package/dist/commands/{game-grid-moves.d.ts → shared/grid-moves.d.ts} +6 -6
  80. package/dist/commands/{game-grid-moves.js → shared/grid-moves.js} +5 -5
  81. package/dist/commands/{game-grids.d.ts → shared/grids.d.ts} +4 -9
  82. package/dist/commands/{game-grids.js → shared/grids.js} +20 -19
  83. package/dist/commands/{game-images.d.ts → shared/images.d.ts} +3 -3
  84. package/dist/commands/{game-images.js → shared/images.js} +7 -6
  85. package/dist/commands/shared/inputs.d.ts +9 -0
  86. package/dist/commands/shared/inputs.js +12 -0
  87. package/dist/commands/{game-journey.d.ts → shared/journey.d.ts} +4 -6
  88. package/dist/commands/{game-journey.js → shared/journey.js} +13 -15
  89. package/dist/commands/{game-knowledge.d.ts → shared/knowledge.d.ts} +15 -8
  90. package/dist/commands/{game-knowledge.js → shared/knowledge.js} +42 -42
  91. package/dist/{library-reader.js → commands/shared/library-reader.js} +4 -4
  92. package/dist/commands/{game-library.d.ts → shared/library.d.ts} +7 -4
  93. package/dist/commands/{game-library.js → shared/library.js} +70 -50
  94. package/dist/commands/{game-limits.d.ts → shared/limits.d.ts} +3 -3
  95. package/dist/commands/{game-limits.js → shared/limits.js} +3 -3
  96. package/dist/commands/{game-loot.d.ts → shared/loot.d.ts} +2 -2
  97. package/dist/commands/{game-loot.js → shared/loot.js} +3 -3
  98. package/dist/commands/{game-master-rolls.d.ts → shared/master-rolls.d.ts} +2 -2
  99. package/dist/commands/{game-master-rolls.js → shared/master-rolls.js} +6 -6
  100. package/dist/commands/{game-mode.d.ts → shared/mode.d.ts} +4 -6
  101. package/dist/commands/{game-mode.js → shared/mode.js} +10 -10
  102. package/dist/commands/{game-money.d.ts → shared/money.d.ts} +3 -3
  103. package/dist/commands/{game-money.js → shared/money.js} +4 -4
  104. package/dist/commands/{game-moods.d.ts → shared/moods.d.ts} +3 -3
  105. package/dist/commands/{game-moods.js → shared/moods.js} +3 -3
  106. package/dist/commands/{game-moves.d.ts → shared/moves.d.ts} +2 -2
  107. package/dist/commands/{game-moves.js → shared/moves.js} +5 -5
  108. package/dist/commands/{game-offers.d.ts → shared/offers.d.ts} +3 -3
  109. package/dist/commands/{game-offers.js → shared/offers.js} +9 -12
  110. package/dist/commands/{game-outside.d.ts → shared/outside.d.ts} +3 -3
  111. package/dist/commands/{game-outside.js → shared/outside.js} +9 -9
  112. package/dist/commands/{game-catalog.d.ts → shared/packages/catalog.d.ts} +1 -3
  113. package/dist/commands/{game-catalog.js → shared/packages/catalog.js} +17 -22
  114. package/dist/commands/{game-package-code.d.ts → shared/packages/code.d.ts} +10 -14
  115. package/dist/commands/{game-package-code.js → shared/packages/code.js} +156 -59
  116. package/dist/commands/{game-extension-list.d.ts → shared/packages/extensions.d.ts} +6 -6
  117. package/dist/commands/{game-extension-list.js → shared/packages/extensions.js} +43 -22
  118. package/dist/commands/{game-package-hooks.d.ts → shared/packages/hooks.d.ts} +3 -3
  119. package/dist/commands/{game-package-hooks.js → shared/packages/hooks.js} +3 -3
  120. package/dist/commands/{game-widgets.d.ts → shared/packages/widgets.d.ts} +6 -10
  121. package/dist/commands/{game-widgets.js → shared/packages/widgets.js} +57 -57
  122. package/dist/commands/{page-counters.d.ts → shared/page-counters.d.ts} +3 -3
  123. package/dist/commands/{page-counters.js → shared/page-counters.js} +5 -5
  124. package/dist/{page-words.d.ts → commands/shared/page-words.d.ts} +2 -2
  125. package/dist/{page-words.js → commands/shared/page-words.js} +5 -4
  126. package/dist/commands/{parts.d.ts → shared/parts.d.ts} +3 -3
  127. package/dist/commands/{parts.js → shared/parts.js} +4 -4
  128. package/dist/commands/{game-positions.d.ts → shared/positions.d.ts} +3 -5
  129. package/dist/commands/{game-positions.js → shared/positions.js} +6 -7
  130. package/dist/commands/{problems.d.ts → shared/problems.d.ts} +3 -3
  131. package/dist/commands/{problems.js → shared/problems.js} +21 -22
  132. package/dist/commands/{progression.d.ts → shared/progression.d.ts} +2 -2
  133. package/dist/commands/{progression.js → shared/progression.js} +4 -4
  134. package/dist/commands/{game-quests.d.ts → shared/quests.d.ts} +4 -4
  135. package/dist/commands/{game-quests.js → shared/quests.js} +6 -6
  136. package/dist/commands/{game-recipes.d.ts → shared/recipes.d.ts} +3 -3
  137. package/dist/commands/{game-recipes.js → shared/recipes.js} +3 -3
  138. package/dist/commands/{game-reminders.d.ts → shared/reminders.d.ts} +4 -4
  139. package/dist/commands/{game-reminders.js → shared/reminders.js} +4 -4
  140. package/dist/commands/{game-roads.d.ts → shared/roads.d.ts} +5 -5
  141. package/dist/commands/{game-roads.js → shared/roads.js} +43 -44
  142. package/dist/commands/{game-rules.d.ts → shared/rules.d.ts} +2 -2
  143. package/dist/commands/{game-rules.js → shared/rules.js} +4 -4
  144. package/dist/commands/{game-saves.d.ts → shared/saves.d.ts} +4 -4
  145. package/dist/commands/{game-saves.js → shared/saves.js} +51 -51
  146. package/dist/commands/{game-scene.d.ts → shared/scene.d.ts} +13 -3
  147. package/dist/commands/{game-scene.js → shared/scene.js} +41 -13
  148. package/dist/commands/{sheet.d.ts → shared/sheet.d.ts} +5 -5
  149. package/dist/commands/{sheet.js → shared/sheet.js} +76 -76
  150. package/dist/commands/{game-stacks.d.ts → shared/stacks.d.ts} +2 -9
  151. package/dist/commands/{game-stacks.js → shared/stacks.js} +22 -22
  152. package/dist/commands/{game-theme.d.ts → shared/theme.d.ts} +3 -3
  153. package/dist/commands/{game-theme.js → shared/theme.js} +2 -2
  154. package/dist/commands/{game-thoughts.d.ts → shared/thoughts.d.ts} +2 -4
  155. package/dist/commands/{game-thoughts.js → shared/thoughts.js} +6 -8
  156. package/dist/commands/{game-thresholds.d.ts → shared/thresholds.d.ts} +1 -1
  157. package/dist/commands/{game-thresholds.js → shared/thresholds.js} +4 -4
  158. package/dist/commands/{game-time.d.ts → shared/time.d.ts} +4 -4
  159. package/dist/commands/{game-time.js → shared/time.js} +6 -6
  160. package/dist/commands/{game-turn-uses.d.ts → shared/turn-uses.d.ts} +3 -3
  161. package/dist/commands/{game-turn-uses.js → shared/turn-uses.js} +12 -15
  162. package/dist/commands/{game-upkeep.d.ts → shared/upkeep.d.ts} +3 -3
  163. package/dist/commands/{game-upkeep.js → shared/upkeep.js} +69 -57
  164. package/dist/commands/{game-voices.d.ts → shared/voices.d.ts} +1 -1
  165. package/dist/commands/{game-voices.js → shared/voices.js} +2 -2
  166. package/dist/commands/{worked-out.d.ts → shared/worked-out.d.ts} +3 -8
  167. package/dist/commands/{worked-out.js → shared/worked-out.js} +238 -238
  168. package/dist/commands/{game-world.d.ts → shared/world.d.ts} +5 -14
  169. package/dist/commands/{game-world.js → shared/world.js} +72 -76
  170. package/dist/commands/show.d.ts +1 -1
  171. package/dist/commands/show.js +32 -17
  172. package/dist/commands/status.d.ts +1 -1
  173. package/dist/commands/status.js +28 -28
  174. package/dist/commands/thoughts.js +3 -3
  175. package/dist/commands/trade.js +9 -10
  176. package/dist/commands/translate.d.ts +1 -1
  177. package/dist/commands/translate.js +3 -3
  178. package/dist/commands/{game-open.d.ts → travel/open.d.ts} +3 -3
  179. package/dist/commands/{game-open.js → travel/open.js} +4 -5
  180. package/dist/commands/{route.d.ts → travel/route.d.ts} +1 -1
  181. package/dist/commands/{route.js → travel/route.js} +9 -10
  182. package/dist/commands/{travel.d.ts → travel/travel.d.ts} +2 -2
  183. package/dist/commands/{travel.js → travel/travel.js} +19 -21
  184. package/dist/commands/validate.js +5 -5
  185. package/dist/commands/{game-view-journal.d.ts → view/journal.d.ts} +5 -5
  186. package/dist/commands/{game-view-journal.js → view/journal.js} +5 -5
  187. package/dist/commands/{game-view-map.d.ts → view/map.d.ts} +3 -3
  188. package/dist/commands/{game-view-map.js → view/map.js} +15 -16
  189. package/dist/commands/{game-view-place.d.ts → view/place.d.ts} +6 -6
  190. package/dist/commands/{game-view-place.js → view/place.js} +108 -108
  191. package/dist/commands/{view.d.ts → view/view.d.ts} +16 -16
  192. package/dist/commands/{view.js → view/view.js} +35 -35
  193. package/dist/commands/{game-view-world.d.ts → view/world.d.ts} +4 -4
  194. package/dist/commands/{game-view-world.js → view/world.js} +7 -7
  195. package/dist/commands/{game-here.d.ts → write/here.d.ts} +5 -3
  196. package/dist/commands/{game-here.js → write/here.js} +18 -12
  197. package/dist/commands/{write.d.ts → write/write.d.ts} +6 -6
  198. package/dist/commands/{write.js → write/write.js} +44 -41
  199. package/dist/confirm/confirm.d.ts +2 -0
  200. package/dist/confirm/confirm.js +15 -5
  201. package/dist/core/consents.d.ts +3 -2
  202. package/dist/core/consents.js +43 -4
  203. package/dist/core/context.d.ts +8 -6
  204. package/dist/core/context.js +4 -2
  205. package/dist/core/download.js +16 -5
  206. package/dist/core/files.d.ts +6 -1
  207. package/dist/core/files.js +47 -21
  208. package/dist/core/formula.d.ts +7 -2
  209. package/dist/core/formula.js +63 -66
  210. package/dist/core/instruction-parts.js +1 -1
  211. package/dist/core/mood.d.ts +0 -1
  212. package/dist/core/mood.js +3 -3
  213. package/dist/core/package-api.d.ts +11 -0
  214. package/dist/core/package-api.js +2 -1
  215. package/dist/core/package-declarations.d.ts +9 -9
  216. package/dist/core/package-declarations.js +3 -3
  217. package/dist/core/process-mark.d.ts +8 -0
  218. package/dist/core/process-mark.js +72 -0
  219. package/dist/core/registry.d.ts +5 -0
  220. package/dist/core/registry.js +10 -0
  221. package/dist/core/session-store.d.ts +0 -1
  222. package/dist/core/session-store.js +11 -14
  223. package/dist/core/store.d.ts +4 -0
  224. package/dist/core/store.js +29 -8
  225. package/dist/core/text.d.ts +4 -0
  226. package/dist/core/text.js +11 -2
  227. package/dist/core/yaml-file.js +2 -2
  228. package/dist/dashboard/{acts.js → acts/acts.js} +2 -2
  229. package/dist/dashboard/{act-names.js → acts/names.js} +1 -1
  230. package/dist/dashboard/{act-sheet.js → acts/sheet.js} +3 -3
  231. package/dist/dashboard/{act-strip.js → acts/strip.js} +2 -2
  232. package/dist/dashboard/app.js +13 -13
  233. package/dist/dashboard/asked.js +1 -1
  234. package/dist/dashboard/dice/burn.js +1 -1
  235. package/dist/dashboard/dice/stage.js +1 -1
  236. package/dist/dashboard/{guide-blocks.js → help/blocks.js} +1 -1
  237. package/dist/dashboard/{help.js → help/help.js} +6 -6
  238. package/dist/dashboard/journal.js +1 -1
  239. package/dist/dashboard/kit.js +6 -5
  240. package/dist/dashboard/labels.js +7 -3
  241. package/dist/dashboard/markdown.js +1 -1
  242. package/dist/dashboard/{ask-card.js → packages/ask-card.js} +6 -6
  243. package/dist/dashboard/{package-page.js → packages/package-page.js} +3 -3
  244. package/dist/dashboard/{packages.js → packages/packages.js} +12 -12
  245. package/dist/dashboard/{page-code.js → packages/page-code.js} +4 -4
  246. package/dist/dashboard/{extension-widgets.js → packages/widgets.js} +5 -5
  247. package/dist/dashboard/party.js +1 -1
  248. package/dist/dashboard/person-panel.js +2 -13
  249. package/dist/dashboard/{map-sheet.js → place/map-sheet.js} +4 -4
  250. package/dist/dashboard/{place-map-view.js → place/map-view.js} +11 -11
  251. package/dist/dashboard/scene.js +4 -4
  252. package/dist/dashboard/settings.js +1 -1
  253. package/dist/dashboard/sheet.js +3 -3
  254. package/dist/dashboard/top.js +2 -2
  255. package/dist/dashboard/turns.js +2 -2
  256. package/dist/dashboard/widgets.js +1 -1
  257. package/dist/dashboard/{world-calendar.js → world/calendar.js} +7 -7
  258. package/dist/dashboard/{lore.js → world/known.js} +1 -1
  259. package/dist/dashboard/{world-lore.js → world/lore.js} +9 -9
  260. package/dist/dashboard/{world-map.js → world/map.js} +1 -1
  261. package/dist/dashboard/{world.js → world/world.js} +14 -14
  262. package/dist/dice/evaluate.js +1 -1
  263. package/dist/dice/index.d.ts +2 -2
  264. package/dist/dice/index.js +2 -2
  265. package/dist/dice/notation.d.ts +2 -0
  266. package/dist/dice/notation.js +22 -4
  267. package/dist/documents/markup.js +2 -2
  268. package/dist/documents/read.js +29 -13
  269. package/dist/effects/effect.js +2 -5
  270. package/dist/extensions/extension.js +6 -8
  271. package/dist/extensions/index.d.ts +1 -4
  272. package/dist/extensions/index.js +1 -4
  273. package/dist/extensions/words.js +2 -1
  274. package/dist/{pictures → helpers}/briefs.js +17 -14
  275. package/dist/{pictures → helpers}/claude.js +8 -18
  276. package/dist/{pictures → helpers}/codex.js +3 -15
  277. package/dist/helpers/index.d.ts +7 -0
  278. package/dist/helpers/index.js +9 -0
  279. package/dist/{pictures/helpers.d.ts → helpers/programs.d.ts} +6 -1
  280. package/dist/{pictures/helpers.js → helpers/programs.js} +16 -2
  281. package/dist/images/images.js +7 -5
  282. package/dist/images/index.d.ts +1 -1
  283. package/dist/images/index.js +1 -1
  284. package/dist/importer/index.d.ts +1 -1
  285. package/dist/importer/index.js +1 -1
  286. package/dist/importer/work.d.ts +0 -2
  287. package/dist/importer/work.js +9 -30
  288. package/dist/instructions/index.d.ts +2 -0
  289. package/dist/instructions/index.js +10 -0
  290. package/dist/languages/index.d.ts +1 -1
  291. package/dist/languages/index.js +1 -1
  292. package/dist/languages/language-pack.js +15 -3
  293. package/dist/library/books.js +29 -83
  294. package/dist/{extensions → packages}/engine.d.ts +1 -1
  295. package/dist/{extensions → packages}/engine.js +1 -1
  296. package/dist/packages/index.d.ts +3 -0
  297. package/dist/packages/index.js +4 -0
  298. package/dist/{extensions/packages.d.ts → packages/npm.d.ts} +2 -0
  299. package/dist/{extensions/packages.js → packages/npm.js} +74 -45
  300. package/dist/page.d.ts +9 -11
  301. package/dist/page.js +1 -2
  302. package/dist/pages/check.js +31 -40
  303. package/dist/pages/containers.js +20 -20
  304. package/dist/pages/environment.js +15 -15
  305. package/dist/pages/index.d.ts +9 -9
  306. package/dist/pages/index.js +9 -9
  307. package/dist/pages/inheritance.d.ts +2 -1
  308. package/dist/pages/inheritance.js +24 -24
  309. package/dist/pages/load.js +7 -7
  310. package/dist/pages/maps.d.ts +20 -0
  311. package/dist/pages/maps.js +51 -1
  312. package/dist/pages/markdown.d.ts +2 -0
  313. package/dist/pages/markdown.js +110 -79
  314. package/dist/pages/page-file.d.ts +2 -1
  315. package/dist/pages/page-file.js +31 -29
  316. package/dist/pages/rename-page.d.ts +4 -1
  317. package/dist/pages/rename-page.js +7 -3
  318. package/dist/pages/{stack-entry.d.ts → stacks/entry.d.ts} +0 -2
  319. package/dist/pages/{stack-entry.js → stacks/entry.js} +2 -6
  320. package/dist/pages/{stacks.d.ts → stacks/kinds.d.ts} +8 -1
  321. package/dist/pages/{stacks.js → stacks/kinds.js} +36 -41
  322. package/dist/pages/{stack-writes.d.ts → stacks/writes.d.ts} +2 -2
  323. package/dist/pages/{stack-writes.js → stacks/writes.js} +32 -32
  324. package/dist/pages/system-pages.js +15 -15
  325. package/dist/pages/world.js +25 -19
  326. package/dist/pages/write-page.js +35 -34
  327. package/dist/player-notes/index.d.ts +1 -1
  328. package/dist/player-notes/index.js +1 -1
  329. package/dist/rules/page-search.js +3 -4
  330. package/dist/rules/rule-book.js +1 -1
  331. package/dist/rules/search.js +21 -21
  332. package/dist/rules/shown.js +1 -3
  333. package/dist/saves/saves.d.ts +2 -2
  334. package/dist/saves/saves.js +15 -3
  335. package/dist/{bell-listener.js → server/bell-listener.js} +3 -3
  336. package/dist/server/dashboard/files.d.ts +59 -0
  337. package/dist/server/dashboard/files.js +326 -0
  338. package/dist/server/dashboard/index.d.ts +114 -0
  339. package/dist/server/dashboard/index.js +419 -0
  340. package/dist/server/dashboard/news.d.ts +39 -0
  341. package/dist/server/dashboard/news.js +390 -0
  342. package/dist/server/dashboard/player.d.ts +48 -0
  343. package/dist/server/dashboard/player.js +242 -0
  344. package/dist/server/dashboard/ports.d.ts +10 -0
  345. package/dist/server/dashboard/ports.js +15 -0
  346. package/dist/server/dashboard/writes.d.ts +58 -0
  347. package/dist/server/dashboard/writes.js +492 -0
  348. package/dist/{mcp-server.d.ts → server/mcp.d.ts} +2 -2
  349. package/dist/{mcp-server.js → server/mcp.js} +57 -42
  350. package/dist/systems/game-system.d.ts +5 -3
  351. package/dist/systems/game-system.js +178 -149
  352. package/dist/systems/index.d.ts +1 -1
  353. package/dist/systems/index.js +1 -1
  354. package/dist/{testing.d.ts → testing/index.d.ts} +6 -6
  355. package/dist/{testing.js → testing/index.js} +32 -18
  356. package/dist/{system-checks.js → testing/system-checks.js} +18 -12
  357. package/dist/themes/theme.d.ts +3 -3
  358. package/dist/themes/theme.js +14 -14
  359. package/dist/time/calendar.js +5 -2
  360. package/dist/triggers/trigger.js +5 -8
  361. package/instructions/dashboard-guide.md +2 -1
  362. package/instructions/play.md +1 -1
  363. package/package.json +5 -5
  364. package/dist/commands/game-maps.d.ts +0 -20
  365. package/dist/commands/game-maps.js +0 -51
  366. package/dist/dashboard-server.d.ts +0 -47
  367. package/dist/dashboard-server.js +0 -1830
  368. package/dist/pictures/index.d.ts +0 -7
  369. package/dist/pictures/index.js +0 -9
  370. /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
  371. /package/dist/{library-reader.d.ts → commands/shared/library-reader.d.ts} +0 -0
  372. /package/dist/commands/{notes.d.ts → shared/notes.d.ts} +0 -0
  373. /package/dist/commands/{notes.js → shared/notes.js} +0 -0
  374. /package/dist/dashboard/{guide-markdown.js → help/markdown.js} +0 -0
  375. /package/dist/dashboard/{pack-card.js → packages/card.js} +0 -0
  376. /package/dist/dashboard/{people.js → packages/people.js} +0 -0
  377. /package/dist/dashboard/{place-map.js → place/map.js} +0 -0
  378. /package/dist/dashboard/{calendar.js → world/days.js} +0 -0
  379. /package/dist/{pictures → helpers}/briefs.d.ts +0 -0
  380. /package/dist/{pictures → helpers}/chosen.d.ts +0 -0
  381. /package/dist/{pictures → helpers}/chosen.js +0 -0
  382. /package/dist/{pictures → helpers}/claude.d.ts +0 -0
  383. /package/dist/{pictures → helpers}/codex.d.ts +0 -0
  384. /package/dist/{pictures → helpers}/stop.d.ts +0 -0
  385. /package/dist/{pictures → helpers}/stop.js +0 -0
  386. /package/dist/{pictures → helpers}/svg.d.ts +0 -0
  387. /package/dist/{pictures → helpers}/svg.js +0 -0
  388. /package/dist/{extensions → packages}/tarball.d.ts +0 -0
  389. /package/dist/{extensions → packages}/tarball.js +0 -0
  390. /package/dist/{bell-listener.d.ts → server/bell-listener.d.ts} +0 -0
  391. /package/dist/{player-acts.d.ts → server/player-acts.d.ts} +0 -0
  392. /package/dist/{player-acts.js → server/player-acts.js} +0 -0
  393. /package/dist/{system-checks.d.ts → testing/system-checks.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  // The game systems installed beside the engine (D-27, SYS-1): which they are and what each declares. Their pages are read by the pages module.
2
- export { actVerbs, campaignDataNames, engineOfferings, engineSettingValue, findCampaignSystem, findSystem, heldSettings, installedSystems, offeredEngineValues, playedValueOf, rollName, rulesetSetting, systemContentFolders, systemFileName, systemInFolder, withSettings, } from "./game-system.js";
2
+ export { campaignDataNames, engineOfferings, engineSettingValue, findCampaignSystem, findSystem, heldSettings, installedSystems, offeredEngineValues, playedValueOf, readableSystems, rollName, rulesetSetting, systemContentFolders, systemFileName, systemInFolder, withSettings, } from "./game-system.js";
3
3
  export { givenCode, loadSystemCode, systemApiProblem, systemHasCode, systemPackage, systemPageModule } from "./system-code.js";
4
4
  export { systemFolders } from "./system-folders.js";
5
5
  export { layeredSystemWords, systemWords } from "./words.js";
@@ -1,9 +1,9 @@
1
- import { type ShownWidget } from "./commands/game-widgets.ts";
2
- import type { Context, Player } from "./core/context.ts";
3
- import type { LogEntry } from "./core/log.ts";
4
- export type { ShownWidget } from "./commands/game-widgets.ts";
5
- export type { CardAsked, Context, Player, Rows, Said } from "./core/context.ts";
6
- export type { LogEntry } from "./core/log.ts";
1
+ import { type ShownWidget } from "../commands/shared/packages/widgets.ts";
2
+ import type { Context, Player } from "../core/context.ts";
3
+ import type { LogEntry } from "../core/log.ts";
4
+ export type { ShownWidget } from "../commands/shared/packages/widgets.ts";
5
+ export type { CardAsked, Context, Player, Rows, Said } from "../core/context.ts";
6
+ export type { LogEntry } from "../core/log.ts";
7
7
  export { type SystemChecks, systemChecks } from "./system-checks.ts";
8
8
  /** What a command printed, and its exit code: 0 when it did what it was asked. */
9
9
  export interface Ran {
@@ -7,14 +7,14 @@ import { tmpdir } from "node:os";
7
7
  import { basename, join, resolve } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { stringify } from "yaml";
10
- import { runCommandLine } from "./command-line.js";
11
- import { ask } from "./commands/ask.js";
12
- import { campaignWidgets } from "./commands/game-widgets.js";
13
- import { campaignSystem } from "./commands/game-world.js";
14
- import { SessionStore } from "./core/session-store.js";
15
- import { startDashboard } from "./dashboard-server.js";
16
- import { toolDescriptions } from "./mcp-server.js";
17
- import { loadSystemCode } from "./systems/index.js";
10
+ import { runCommandLine } from "../cli/command-line.js";
11
+ import { ask } from "../commands/ask.js";
12
+ import { campaignWidgets } from "../commands/shared/packages/widgets.js";
13
+ import { campaignSystem } from "../commands/shared/world.js";
14
+ import { SessionStore } from "../core/session-store.js";
15
+ import { startDashboard } from "../server/dashboard/index.js";
16
+ import { toolDescriptions } from "../server/mcp.js";
17
+ import { loadSystemCode } from "../systems/index.js";
18
18
  export { systemChecks } from "./system-checks.js";
19
19
  /**
20
20
  * A campaign in play for a test (D-506): made with init in a temporary folder, its setup done, using these extensions and game systems, each linked from its
@@ -37,7 +37,7 @@ export async function testCampaign(options) {
37
37
  throw error;
38
38
  }
39
39
  // The systems given first, then those the package's repository installs, as a devDependency (@rpgengine/system-5e), then the engine's own.
40
- const systemFolders = [systems, resolve("node_modules"), enginePath("../systems/")];
40
+ const systemFolders = [systems, resolve("node_modules"), enginePath("../../systems/")];
41
41
  let ids = 0;
42
42
  let faces;
43
43
  const context = {
@@ -103,14 +103,21 @@ export async function testCampaign(options) {
103
103
  rmSync(base, { recursive: true, force: true });
104
104
  },
105
105
  };
106
- await campaign.ok("init", "--name", "Test", "--language", options.language ?? "en", "--system", options.system, "--difficulty", "normal", "--lethality", "dice");
107
- if (options.play !== false) {
108
- inPlay(folder);
106
+ try {
107
+ await campaign.ok("init", "--name", "Test", "--language", options.language ?? "en", "--system", options.system, "--difficulty", "normal", "--lethality", "dice");
108
+ if (options.play !== false) {
109
+ inPlay(folder);
110
+ }
111
+ const extensions = Object.fromEntries(linked.filter((one) => !one.system).map((one) => [one.name, one.version]));
112
+ const added = { ...options.settings, ...(linked.length === 0 ? {} : { extensions }) };
113
+ const written = readFileSync(join(folder, "campaign.yaml"), "utf8");
114
+ writeFileSync(join(folder, "campaign.yaml"), Object.keys(added).length === 0 ? written : `${written}${stringify(added)}`);
115
+ }
116
+ catch (error) {
117
+ // A campaign that could not be made leaves nothing behind, its links taken away first.
118
+ await campaign.close();
119
+ throw error;
109
120
  }
110
- const extensions = Object.fromEntries(linked.filter((one) => !one.system).map((one) => [one.name, one.version]));
111
- const added = { ...options.settings, ...(linked.length === 0 ? {} : { extensions }) };
112
- const written = readFileSync(join(folder, "campaign.yaml"), "utf8");
113
- writeFileSync(join(folder, "campaign.yaml"), Object.keys(added).length === 0 ? written : `${written}${stringify(added)}`);
114
121
  return campaign;
115
122
  }
116
123
  /**
@@ -167,7 +174,14 @@ async function testDashboard(context) {
167
174
  let text = "";
168
175
  response.setEncoding("utf8");
169
176
  response.on("data", (chunk) => (text += chunk));
170
- response.on("end", () => done({ status: response.statusCode ?? 0, body: text.trim() === "" ? {} : JSON.parse(text) }));
177
+ response.on("end", () => {
178
+ try {
179
+ done({ status: response.statusCode ?? 0, body: text.trim() === "" ? {} : JSON.parse(text) });
180
+ }
181
+ catch {
182
+ fail(new Error(`${method} ${path} answered ${response.statusCode ?? 0} with no JSON: ${text.trim()}`));
183
+ }
184
+ });
171
185
  });
172
186
  sent.on("error", fail);
173
187
  sent.end(body === undefined ? undefined : JSON.stringify(body));
@@ -187,7 +201,7 @@ async function testDashboard(context) {
187
201
  },
188
202
  };
189
203
  }
190
- /** A path of the engine's package, from this file in src/ or dist/ alike. */
204
+ /** A path of the engine's package, from this file in src/testing/ or dist/testing/ alike. */
191
205
  function enginePath(relative) {
192
206
  return fileURLToPath(new URL(relative, import.meta.url));
193
207
  }
@@ -2,16 +2,16 @@
2
2
  // name once, no bases it lacks, every field declared and of its kind, rules in chapters, the pictures its pages link, where it comes from, and its theme.
3
3
  import { existsSync, readdirSync, readFileSync } from "node:fs";
4
4
  import { basename, join } from "node:path";
5
- import { closedSettings } from "./campaign/index.js";
6
- import { parseRollFormula } from "./core/formula.js";
7
- import { FileStore, withFiles } from "./core/store.js";
8
- import { comparableText } from "./core/text.js";
9
- import { findImage, imageFileName, imagesFolderName } from "./images/index.js";
10
- import { coinsProblem, readCoins } from "./money/index.js";
11
- import { checkWorld, isStandardField, listFieldNames, loadWorld } from "./pages/index.js";
12
- import { isTitled, readRuleBook } from "./rules/index.js";
13
- import { systemInFolder } from "./systems/index.js";
14
- import { readTheme } from "./themes/index.js";
5
+ import { closedSettings } from "../campaign/index.js";
6
+ import { parseRollFormula } from "../core/formula.js";
7
+ import { FileStore, withFiles } from "../core/store.js";
8
+ import { comparableText } from "../core/text.js";
9
+ import { findImage, imageFileName, imagesFolderName } from "../images/index.js";
10
+ import { coinsProblem, readCoins } from "../money/index.js";
11
+ import { checkWorld, isStandardField, listFieldNames, loadWorld } from "../pages/index.js";
12
+ import { isTitled, readRuleBook } from "../rules/index.js";
13
+ import { systemInFolder } from "../systems/index.js";
14
+ import { readTheme } from "../themes/index.js";
15
15
  /** Checks the game system in this folder, the one with its system.yaml, as the engine reads it; it throws when its system.yaml does not read. */
16
16
  export function systemChecks(folder) {
17
17
  const system = systemInFolder(folder, systemName(folder));
@@ -25,7 +25,7 @@ export function systemChecks(folder) {
25
25
  ...(system.attribution === undefined ? {} : { attribution: system.attribution }),
26
26
  unread: [...world.problems, ...checkWorld(world).map((problem) => `${problem.path === undefined ? "" : `${problem.path}: `}${problem.message}`)],
27
27
  names: namesTwice(world.pages.map((page) => page.name)),
28
- unquoted: world.pages.filter((page) => /^[\w-]+: [+-]\d/m.test(readFileSync(join(system.folder, page.path), "utf8"))).map((page) => page.name),
28
+ unquoted: world.pages.filter((page) => /^[\w-]+: [+-]\d/m.test(frontmatterOf(readFileSync(join(system.folder, page.path), "utf8")))).map((page) => page.name),
29
29
  bases: world.pages.filter((page) => {
30
30
  const base = page.fields.creature ?? page.fields.item;
31
31
  return base !== undefined && !world.pages.some((other) => other.name === String(base).replace(/^\[\[|\]\]$/g, ""));
@@ -134,13 +134,19 @@ function undeclaredFields(system, pages) {
134
134
  const declared = new Set(Object.keys(system.fields).map(comparableText));
135
135
  return pages.flatMap((page) => Object.keys(page.fields).filter((field) => !isStandardField(page.type, field) && !declared.has(comparableText(field))).map((field) => `${page.name}: ${field}`));
136
136
  }
137
+ /** A page's frontmatter, between its two lines of ---; "" for a page without one. */
138
+ function frontmatterOf(text) {
139
+ return /^---\r?\n([\s\S]*?)\r?\n---/.exec(text)?.[1] ?? "";
140
+ }
137
141
  /** The pictures its pages link that its images folder lacks, and those it has that no page links. */
138
142
  function pictureProblems(folder, pages) {
139
143
  const linked = new Set(pages.map((page) => imageFileName(page.fields.image)).filter((name) => name !== undefined));
144
+ // A page finds its picture whatever its case, as findImage does.
145
+ const linkedNames = new Set([...linked].map((name) => name.toLowerCase()));
140
146
  const missing = [...linked].filter((name) => withFiles(new FileStore(), () => findImage([folder], name)) === undefined);
141
147
  const images = join(folder, imagesFolderName);
142
148
  const files = existsSync(images) ? readdirSync(images, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => entry.name) : [];
143
- return [...missing.map((name) => `${name}: linked, not in images/`), ...files.filter((name) => !linked.has(name)).map((name) => `${name}: in images/, linked by no page`)];
149
+ return [...missing.map((name) => `${name}: linked, not in images/`), ...files.filter((name) => !linkedNames.has(name.toLowerCase())).map((name) => `${name}: in images/, linked by no page`)];
144
150
  }
145
151
  /** Whether a text reads as a formula, which may begin with dice and end with words, as a weapon's damage (PRO-5). */
146
152
  function readsAsFormula(text) {
@@ -3,13 +3,13 @@ export declare const themeFileName = "theme.yaml";
3
3
  /** The page's icons a theme may draw anew, by their names: the sections, the menu and the top's tools. */
4
4
  export declare const themeIconNames: readonly ["party", "scene", "combat", "journal", "world", "saves", "help", "settings", "about", "packages", "menu"];
5
5
  /** The two looks of the page; a theme gives both. */
6
- export declare const themeModes: readonly ["light", "dark"];
6
+ declare const themeModes: readonly ["light", "dark"];
7
7
  /** One of the two looks of the page. */
8
8
  export type ThemeModeName = (typeof themeModes)[number];
9
9
  /** The colours each mode must give: the page's ground, the cards', lines, text, softer text, the accent, the strong colour and its text, friends and danger. */
10
- export declare const requiredColours: readonly ["paper", "panel", "rule", "ink", "muted", "accent", "gold", "on-gold", "ally", "low"];
10
+ declare const requiredColours: readonly ["paper", "panel", "rule", "ink", "muted", "accent", "gold", "on-gold", "ally", "low"];
11
11
  /** The colours a mode may give, else the page derives them from the others. */
12
- export declare const optionalColours: readonly ["panel-2", "float", "gold-ink", "warn", "on-low"];
12
+ declare const optionalColours: readonly ["panel-2", "float", "gold-ink", "warn", "on-low"];
13
13
  type ColourName = (typeof requiredColours)[number] | (typeof optionalColours)[number];
14
14
  /** A theme as read, its files checked and its derived colours filled in. */
15
15
  export interface Theme {
@@ -10,11 +10,11 @@ export const themeFileName = "theme.yaml";
10
10
  /** The page's icons a theme may draw anew, by their names: the sections, the menu and the top's tools. */
11
11
  export const themeIconNames = ["party", "scene", "combat", "journal", "world", "saves", "help", "settings", "about", "packages", "menu"];
12
12
  /** The two looks of the page; a theme gives both. */
13
- export const themeModes = ["light", "dark"];
13
+ const themeModes = ["light", "dark"];
14
14
  /** The colours each mode must give: the page's ground, the cards', lines, text, softer text, the accent, the strong colour and its text, friends and danger. */
15
- export const requiredColours = ["paper", "panel", "rule", "ink", "muted", "accent", "gold", "on-gold", "ally", "low"];
15
+ const requiredColours = ["paper", "panel", "rule", "ink", "muted", "accent", "gold", "on-gold", "ally", "low"];
16
16
  /** The colours a mode may give, else the page derives them from the others. */
17
- export const optionalColours = ["panel-2", "float", "gold-ink", "warn", "on-low"];
17
+ const optionalColours = ["panel-2", "float", "gold-ink", "warn", "on-low"];
18
18
  /** Reads and checks the theme in this folder: its keys, its files, both modes, the contrast of the colours the page pairs. */
19
19
  export function readTheme(folder) {
20
20
  const path = join(folder, themeFileName);
@@ -118,17 +118,6 @@ export function themeFile(folder, name) {
118
118
  return undefined;
119
119
  }
120
120
  }
121
- /** Whether each part of a file's name is written as the disk has it, capitals too: Windows finds Images/Corner.SVG, Linux does not. */
122
- function writtenAsIs(folder, name) {
123
- let at = folder;
124
- for (const part of name.split(/[\\/]/).filter((one) => one !== "" && one !== ".")) {
125
- if (!readdirSync(at).includes(part)) {
126
- return false;
127
- }
128
- at = join(at, part);
129
- }
130
- return true;
131
- }
132
121
  /** An ornament drawn in one colour, turned for a page that reads right to left: the theme gives one drawing for both modes and both directions. */
133
122
  export function drawnOrnament(svg, ink, mirrored) {
134
123
  const coloured = svg.replaceAll("currentColor", ink);
@@ -145,6 +134,17 @@ export function drawnOrnament(svg, ink, mirrored) {
145
134
  const end = coloured.lastIndexOf("</svg>");
146
135
  return `${coloured.slice(0, start)}<g transform="translate(${across} 0) scale(-1 1)">${coloured.slice(start, end)}</g>${coloured.slice(end)}`;
147
136
  }
137
+ /** Whether each part of a file's name is written as the disk has it, capitals too: Windows finds Images/Corner.SVG, Linux does not. */
138
+ function writtenAsIs(folder, name) {
139
+ let at = folder;
140
+ for (const part of name.split(/[\\/]/).filter((one) => one !== "" && one !== ".")) {
141
+ if (!readdirSync(at).includes(part)) {
142
+ return false;
143
+ }
144
+ at = join(at, part);
145
+ }
146
+ return true;
147
+ }
148
148
  const fontFiles = [".woff2", ".woff", ".ttf", ".otf"];
149
149
  const pictureFiles = [".svg", ".png", ".webp", ".jpg", ".jpeg"];
150
150
  const licenseFiles = [".txt", ".md"];
@@ -45,7 +45,10 @@ export function readCalendarStart(text, calendar) {
45
45
  return undefined;
46
46
  }
47
47
  const match = startPattern.exec(text.trim().replace(/\s+/g, " "));
48
- const month = match === null ? -1 : calendar.months.findIndex((candidate) => comparableText(candidate.name) === comparableText(match[2]));
48
+ const monthNamed = (name) => calendar.months.findIndex((candidate) => comparableText(candidate.name) === comparableText(name));
49
+ // A month named with a number, as Month 3, takes the number when no month has the name without it: then the year is not given.
50
+ const numbered = match !== null && match[3] !== undefined && monthNamed(match[2]) === -1 && monthNamed(`${match[2]} ${match[3]}`) !== -1;
51
+ const month = match === null ? -1 : numbered ? monthNamed(`${match[2]} ${match[3]}`) : monthNamed(match[2]);
49
52
  const names = calendar.months.map((candidate) => candidate.name).join(", ");
50
53
  if (match === null || match[2] === "") {
51
54
  const first = calendar.months[0].name;
@@ -59,7 +62,7 @@ export function readCalendarStart(text, calendar) {
59
62
  if (day < 1 || day > days) {
60
63
  throw new Error(`${name} has days 1 to ${days}, not ${day}: give a day it has.`);
61
64
  }
62
- return match[3] === undefined ? { day, month } : { day, month, year: Number(match[3]) };
65
+ return match[3] === undefined || numbered ? { day, month } : { day, month, year: Number(match[3]) };
63
66
  }
64
67
  /** The day of the calendar that a game day falls on, counting from the start as day 1; after the last month the first comes again, a year later. */
65
68
  export function calendarDay(calendar, start, gameDay) {
@@ -1,4 +1,4 @@
1
- import { comparableText, linkTargetName } from "../core/text.js";
1
+ import { comparableText, linkTargetName, sameWord } from "../core/text.js";
2
2
  const link = String.raw `\[\[[^\]]*\]\]`;
3
3
  const subject = `party|${link}`;
4
4
  const insidePattern = new RegExp(`^(${subject})\\s+in\\s+(${subject})$`, "i");
@@ -45,14 +45,14 @@ export function triggerHolds(trigger, facts) {
45
45
  return facts.statusOf(trigger.page) === trigger.status;
46
46
  }
47
47
  const { what, where } = trigger;
48
- const isMember = (name) => facts.party.some((member) => sameText(member, name));
48
+ const isMember = (name) => facts.party.some((member) => sameWord(member, name));
49
49
  if ("party" in what) {
50
- return "page" in where && facts.isPage(where.page) && facts.party.some((member) => facts.containersOf(member).some((holder) => sameText(holder, where.page)));
50
+ return "page" in where && facts.isPage(where.page) && facts.party.some((member) => facts.containersOf(member).some((holder) => sameWord(holder, where.page)));
51
51
  }
52
52
  if ("party" in where) {
53
53
  return facts.isPage(what.page) && (isMember(what.page) || facts.containersOf(what.page).some(isMember));
54
54
  }
55
- return facts.isPage(where.page) && facts.containersOf(what.page).some((holder) => sameText(holder, where.page));
55
+ return facts.isPage(where.page) && facts.containersOf(what.page).some((holder) => sameWord(holder, where.page));
56
56
  }
57
57
  /** A condition of the form "A in B", once both sides read: nothing is inside itself. */
58
58
  function insideTrigger(written, what, where) {
@@ -62,7 +62,7 @@ function insideTrigger(written, what, where) {
62
62
  if ("problem" in where) {
63
63
  return where;
64
64
  }
65
- if ("party" in what.subject ? "party" in where.subject : "page" in where.subject && sameText(what.subject.page, where.subject.page)) {
65
+ if ("party" in what.subject ? "party" in where.subject : "page" in where.subject && sameWord(what.subject.page, where.subject.page)) {
66
66
  return { problem: `"${written}" can never hold: nothing is inside itself.` };
67
67
  }
68
68
  return { trigger: { kind: "in", what: what.subject, where: where.subject } };
@@ -93,6 +93,3 @@ function notConditionProblem(written) {
93
93
  }
94
94
  return `"${written}" is not a condition: write ${forms}, with the pages as links.`;
95
95
  }
96
- function sameText(first, second) {
97
- return comparableText(first) === comparableText(second);
98
- }
@@ -1,7 +1,8 @@
1
1
  How the player uses their dashboard, to answer in a few words, as part of the game, naming the sections as the page shows them in the player's language:
2
+ - Before play, while the campaign is in its setup, the page has no sections: it is the setup, with the campaign's name to change, the steps Settings, Session zero and Play, and one question at a time as a card, each choice with what it means and the one suggested. A question can be left to you with "You decide", or skipped; lines and veils are the player's alone, and "I'm ready" tells you they are done. What they choose there reaches you at your next call; the premise and the world stay in the chat.
2
3
  - Party: their character's sheet and the companions'. A click on a number of the sheet rolls it for fun, never logged; their rolls and those of yours they may see are in a column beside it.
3
4
  - Scene: where the party is, with its picture and text, its map with who stands where, and the open scene. While a scene goes by turns, as a fight, it shows on top whose turn it is and who comes next, and their character's card beside the map; on other sections a notice leads there on their turn.
4
5
  - Journal: the quests, those followed with their star beside the page; the story by scenes; the companions' diaries; their own notes, which they may share with you.
5
6
  - World: what their character knows of the world, in four tabs: Map, the places they know with distances; Lore, the pages they know; Documents, what they have read; Calendar, the days and what is set on them.
6
- - The icons at the row's end: Saves, to save or go back as the campaign's saves setting allows; Help, how to play with the chat and the page; Settings, the same as `config` (difficulty, dice digital or physical, units, language, pictures, lines and veils, mentor); Packages, the game systems, extensions and languages on this computer, and RPG Engine's own update, which the player makes there, never you; About.
7
+ - The icons at the row's end: Saves, to save or go back as the campaign's saves setting allows; Help, how to play with the chat and the page; Settings, the same as `config` (difficulty, dice digital or physical, units, language, pictures, lines and veils, mentor); Packages, the game systems, extensions and languages on this computer, and RPG Engine's own update, which the player makes there, never you, and in its menu the pages a game system or extension adds; About.
7
8
  - When you call `ask`, the buttons appear on the page too: a click rolls the dice of a check, or with "By hand" a click on the lit row of their sheet or a throw of the tray's dice, and they may write their own words instead; their own dice are the physical setting, and then they give you the faces in the chat. They may also propose changes to their character's story there, which reach you to write with their yes.
@@ -19,7 +19,7 @@ The story is on. Besides the tools above:
19
19
  5. Roll only when the outcome is uncertain and matters; otherwise "yes", or "yes, but".
20
20
  6. What their trade, past or senses would give them needs no roll; a roll adds more, never holds the only clue or way on.
21
21
  7. Before a roll of the character, whoever calls it, say what is at stake either way and which checks fit, with the conditions and effects that change them rolled in, and keep to it.
22
- 8. Then stop: the player says which they roll, or changes their mind. A check they only ask about, such as "[Perception?]", is no roll yet: give its stakes and wait.
22
+ 8. Then stop: the player says which they roll, or changes their mind. After the outcome, a misunderstanding or a mistake of yours is always undone, said in brackets; any other take-back is yours to grant as the difficulty says, never to roll the same check again. A check they only ask about, such as "[Perception?]", is no roll yet: give its stakes and wait.
23
23
  9. With physical dice the player gives their faces; in a fight, the action they declare is enough.
24
24
  10. Show every roll the player sees in brackets, with its numbers, right after the moment it decides, even one they asked to see, and let the story tell the outcome.
25
25
  11. Failure brings a complication or a cost, never a dead end: time, harm, something spent, a worse position, someone alerted, a hard choice. That way may close, never every way; trying again costs something new.
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "rpg-engine",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
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": {
7
- "rpg": "dist/cli.js"
7
+ "rpg": "dist/cli/cli.js"
8
8
  },
9
9
  "main": "./dist/index.js",
10
10
  "types": "./dist/index.d.ts",
11
11
  "rpg-engine": {
12
12
  "kind": "engine",
13
- "api": 6
13
+ "api": 7
14
14
  },
15
15
  "exports": {
16
16
  ".": {
@@ -22,8 +22,8 @@
22
22
  "default": "./dist/page.js"
23
23
  },
24
24
  "./testing": {
25
- "types": "./dist/testing.d.ts",
26
- "default": "./dist/testing.js"
25
+ "types": "./dist/testing/index.d.ts",
26
+ "default": "./dist/testing/index.js"
27
27
  }
28
28
  },
29
29
  "files": [
@@ -1,20 +0,0 @@
1
- import type { Problem } from "../core/problem.ts";
2
- import { type Page, type World } from "../pages/index.ts";
3
- /** A map: the place that holds it, none for the main map; the key of its coordinates; and, when it shares another map's, how and with which place's map. */
4
- export interface PlaceMap {
5
- root?: Page;
6
- /** The root whose coordinates the map uses, by its file; "" for the main map's. */
7
- frame: string;
8
- aligned?: {
9
- how: "under" | "mirror";
10
- of: Page;
11
- };
12
- }
13
- /** The map a page is on (POS-8): that of the nearest place of its chain, itself first, that holds one; else the main map. */
14
- export declare function mapOf(world: World, page: Page): PlaceMap;
15
- /** Which map a page is on, as a key: the file of the place that holds it, "" for the main map. Regions, terrain and the places near hold on one map (POS-6). */
16
- export declare function mapKey(world: World, page: Page): string;
17
- /** Whether two pages share their coordinates (POS-2, POS-4): positions are given and stops placed between them. */
18
- export declare function sameFrame(world: World, first: Page, second: Page): boolean;
19
- /** The places whose map field does not read, or names a place that is not there (POS-8). */
20
- export declare function mapProblems(world: World): Problem[];
@@ -1,51 +0,0 @@
1
- import { locate, pagesWithName, readMapField } from "../pages/index.js";
2
- /** The map a page is on (POS-8): that of the nearest place of its chain, itself first, that holds one; else the main map. */
3
- export function mapOf(world, page) {
4
- let byPage = known.get(world);
5
- if (byPage === undefined) {
6
- byPage = new Map();
7
- known.set(world, byPage);
8
- }
9
- let map = byPage.get(page.path);
10
- if (map === undefined) {
11
- const root = rootOf(world, page);
12
- map = root === undefined ? { frame: "" } : rootMap(world, root, new Set());
13
- byPage.set(page.path, map);
14
- }
15
- return map;
16
- }
17
- /** Which map a page is on, as a key: the file of the place that holds it, "" for the main map. Regions, terrain and the places near hold on one map (POS-6). */
18
- export function mapKey(world, page) {
19
- return mapOf(world, page).root?.path ?? "";
20
- }
21
- /** Whether two pages share their coordinates (POS-2, POS-4): positions are given and stops placed between them. */
22
- export function sameFrame(world, first, second) {
23
- return mapOf(world, first).frame === mapOf(world, second).frame;
24
- }
25
- /** The places whose map field does not read, or names a place that is not there (POS-8). */
26
- export function mapProblems(world) {
27
- return world.pages.filter((page) => page.type === "place" && page.system === undefined && page.fields.map !== undefined).flatMap((page) => {
28
- const field = readMapField(page.fields.map);
29
- if (field === undefined || field.how === "own" || pagesWithName(world, field.of)[0]?.type === "place") {
30
- return [];
31
- }
32
- return [{ path: page.path, message: `${page.name}'s map is ${field.how === "under" ? "under" : "the mirror of"} ${field.of}, which is no place.`, fix: `write ${page.name}, set map to own, or name a place of the map it shares` }];
33
- });
34
- }
35
- const known = new WeakMap();
36
- /** The nearest place of a page's chain, itself first, that holds a map. */
37
- function rootOf(world, page) {
38
- return [page, ...locate(world, page).chain].find((holder) => holder.type === "place" && holder.system === undefined && readMapField(holder.fields.map) !== undefined);
39
- }
40
- /** The map a place holds: its own coordinates, or those of the map of the place it is under or mirrors; a broken or circular alignment keeps its own. */
41
- function rootMap(world, root, seen) {
42
- const field = readMapField(root.fields.map);
43
- const of = field === undefined || field.how === "own" ? undefined : pagesWithName(world, field.of)[0];
44
- if (field === undefined || field.how === "own" || of === undefined || seen.has(root.path)) {
45
- return { root, frame: root.path };
46
- }
47
- seen.add(root.path);
48
- const target = rootOf(world, of);
49
- const frame = target === undefined ? "" : target === root ? root.path : rootMap(world, target, seen).frame;
50
- return { root, frame, aligned: { how: field.how, of } };
51
- }
@@ -1,47 +0,0 @@
1
- import { type Context, type Player } from "./core/context.ts";
2
- import type { SessionStore } from "./core/session-store.ts";
3
- /**
4
- * The ports the dashboard tries in turn, taking the first that is free: the same link from one chat to the next (D-272). Windows may keep ranges of ports
5
- * from boot to boot (netsh int ipv4 show excludedportrange): then the next range, and at last any free port, whose link status gives all the same (D-338).
6
- */
7
- export declare const dashboardPorts: number[];
8
- /**
9
- * The ports for a campaign's dashboard: its own in each range first, worked out from its folder, then the others (D-353). Its link stays the same from one
10
- * chat to the next, as long as no other program holds that port, so that the player can keep it, and a page left open comes back by itself.
11
- */
12
- export declare function campaignPorts(root: string): number[];
13
- /** A dashboard that is running: its link, and how to stop it. */
14
- export interface Dashboard {
15
- url: string;
16
- /** The player through the page: ask's buttons, while a page is open (D-279). */
17
- player: Player;
18
- /**
19
- * What the player did on the page since it was last taken, for the master's next call: the saves, in order (D-359), then each setting as it is now against
20
- * how it was (D-341); and what gives it back when that call never answers.
21
- */
22
- news(): {
23
- lines: string[];
24
- restore(): void;
25
- };
26
- close(): Promise<void>;
27
- }
28
- /** Where the dashboard listens, and the page it serves. */
29
- export interface DashboardOptions {
30
- /** The ports to try, in turn (D-272). */
31
- ports?: number[];
32
- /** The folder of the built page: dist/dashboard. */
33
- page?: string;
34
- /** How long a question waits for a page to come back, after the last one closed: a few seconds; less in the tests. */
35
- pageReturn?: number;
36
- /** How long a question waits on pages that no one sees, before it goes to the form or to words (D-455); less in the tests. */
37
- pageHidden?: number;
38
- /** Codex's queue for the player's sentences (D-495): Codex's own command, else a fake in the tests. */
39
- queue?: CodexQueue;
40
- }
41
- /** Codex's queue: whether this computer has the command, and a message queued in a thread, as the player's own (D-495). */
42
- export interface CodexQueue {
43
- ready(): boolean;
44
- send(thread: string, text: string): Promise<boolean>;
45
- }
46
- /** Serves the dashboard of the campaign of context.folder, on 127.0.0.1 only, at the first of the ports that is free; undefined when none is. */
47
- export declare function startDashboard(context: Context, session: SessionStore, options?: DashboardOptions): Promise<Dashboard | undefined>;