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,13 +1,13 @@
1
- import { appendLogEntry } from "../core/log.js";
2
- import { comparableText, sameName, sameWord } from "../core/text.js";
3
- import { formatCounter, readCounter } from "../counters/index.js";
4
- import { endsAtTurn, formatEffect, formatEnd, keeperOf, readEffects } from "../effects/index.js";
5
- import { concernsPlayer, isDeclaredUncounted, isEmptyField, systemFirstFix, writePage } from "../pages/index.js";
6
- import { minutesBetween, readGameDate } from "../time/index.js";
1
+ import { appendLogEntry } from "../../core/log.js";
2
+ import { comparableText, sameName, sameWord } from "../../core/text.js";
3
+ import { formatCounter, readCounter } from "../../counters/index.js";
4
+ import { endsAtTurn, formatEffect, formatEnd, keeperOf, readEffects } from "../../effects/index.js";
5
+ import { concernsPlayer, isDeclaredUncounted, isEmptyField, systemFirstFix, writePage } from "../../pages/index.js";
6
+ import { minutesBetween, readGameDate } from "../../time/index.js";
7
7
  import { effectiveFields, effectsField, effectsOf, valuesChanged, withEffects } from "./effect-layer.js";
8
- import { copyPage, updateScene } from "./game-scene.js";
9
- import { newDatedLogEntry } from "./game-time.js";
10
8
  import { shortList } from "./notes.js";
9
+ import { copyPage, updateScene } from "./scene.js";
10
+ import { newDatedLogEntry } from "./time.js";
11
11
  import { computedField, directBonuses } from "./worked-out.js";
12
12
  /**
13
13
  * Writes a holder's effects; the field goes when none is left. What a current has above its written maximum that the maximum, as these effects leave it, no
@@ -29,17 +29,6 @@ export function saveEffects(root, context, world, holder, effects) {
29
29
  }
30
30
  return page;
31
31
  }
32
- /** The counters a page writes above their written maximum and above the maximum it reads with these effects, brought down to it, no lower than the written one (FOR-6). */
33
- function currentsAsRead(world, page, effects) {
34
- const read = effectiveFields(world, withEffects(page, effects));
35
- return Object.fromEntries(Object.entries(page.fields).flatMap(([field, value]) => {
36
- const written = readCounter(value);
37
- const now = isDeclaredUncounted(world, field) ? undefined : readCounter(read[field]);
38
- // Only what is above the written maximum, which only an effect allows, as Aid's: a form that lowers the maximum leaves the page's own (FOR-6).
39
- const excess = written?.max !== undefined && now?.max !== undefined && written.value > written.max && written.value > now.max;
40
- return written?.max === undefined || now?.max === undefined || !excess ? [] : [[field, String(formatCounter({ value: Math.max(now.max, written.max), max: written.max }))]];
41
- }));
42
- }
43
32
  /** An effects field that does not read is never written over: what was written by hand would be lost (EFF-12). */
44
33
  export function checkEffectsReadable(page) {
45
34
  const read = readEffects(effectsField(page));
@@ -184,6 +173,17 @@ export function effectProblems(world, scene, now, occasions, sceneProblem) {
184
173
  });
185
174
  });
186
175
  }
176
+ /** The counters a page writes above their written maximum and above the maximum it reads with these effects, brought down to it, no lower than the written one (FOR-6). */
177
+ function currentsAsRead(world, page, effects) {
178
+ const read = effectiveFields(world, withEffects(page, effects));
179
+ return Object.fromEntries(Object.entries(page.fields).flatMap(([field, value]) => {
180
+ const written = readCounter(value);
181
+ const now = isDeclaredUncounted(world, field) ? undefined : readCounter(read[field]);
182
+ // Only what is above the written maximum, which only an effect allows, as Aid's: a form that lowers the maximum leaves the page's own (FOR-6).
183
+ const excess = written?.max !== undefined && now?.max !== undefined && written.value > written.max && written.value > now.max;
184
+ return written?.max === undefined || now?.max === undefined || !excess ? [] : [[field, String(formatCounter({ value: Math.max(now.max, written.max), max: written.max }))]];
185
+ }));
186
+ }
187
187
  /** A value an effect gives to a field the game system works out, as ac written before the system did: it does not count (FOR-7). */
188
188
  function computedValueProblems(world, page, path, effect, endIt) {
189
189
  const fields = effectiveFields(world, page);
@@ -1,4 +1,4 @@
1
- import { type Page, type World } from "../pages/index.ts";
1
+ import { type Page, type World } from "../../pages/index.ts";
2
2
  /** One thing that holds around a page, as outputs name it: "light: dark (Cripta)", "Pioggia battente until day 3, 18:00 (Palude)". */
3
3
  export interface Surrounding {
4
4
  /** What tells it apart from the others: an entry's name, or an effect and its place. */
@@ -1,8 +1,8 @@
1
1
  // What holds around a page (D-153, ENV-2, ENV-3, ENV-5): the environment of the places it is in, with their effects, as outputs tell it.
2
- import { comparableText } from "../core/text.js";
3
- import { environmentAt, formatEnvironmentEntry, placesAround } from "../pages/index.js";
2
+ import { comparableText } from "../../core/text.js";
3
+ import { environmentAt, formatEnvironmentEntry, placesAround } from "../../pages/index.js";
4
4
  import { effectsOf } from "./effect-layer.js";
5
- import { effectText } from "./game-effects.js";
5
+ import { effectText } from "./effects.js";
6
6
  /** What holds at a page, nearest first: its places' environment, each entry with its place, then their effects, each with its end and place. Nothing for no page. */
7
7
  export function surroundings(world, page) {
8
8
  if (page === undefined) {
@@ -1,8 +1,8 @@
1
- import type { Context } from "../core/context.ts";
2
- import type { Problem } from "../core/problem.ts";
3
- import { type Page, type PageType, type World } from "../pages/index.ts";
4
- import { type GameDate } from "../time/index.ts";
5
- import { type TriggerFacts } from "../triggers/index.ts";
1
+ import type { Context } from "../../core/context.ts";
2
+ import type { Problem } from "../../core/problem.ts";
3
+ import { type Page, type PageType, type World } from "../../pages/index.ts";
4
+ import { type GameDate } from "../../time/index.ts";
5
+ import { type TriggerFacts } from "../../triggers/index.ts";
6
6
  /** A planned event of the world, with its game date when the engine can read one. */
7
7
  export interface PlannedEvent {
8
8
  page: Page;
@@ -1,11 +1,11 @@
1
- import { appendLogEntry } from "../core/log.js";
2
- import { comparableText } from "../core/text.js";
3
- import { formatCounter, readCounter } from "../counters/index.js";
4
- import { backlinks, containerFieldOf, isCountedItem, isEmptyField, isInParty, linksIn, locate, newPageFields, pagesWithName, pageWithPath, parsePageReference, standardValues, systemLabel, systemPageNamed, withPage, writePage, } from "../pages/index.js";
5
- import { formatDuration, formatGameDate, minutesBetween, readGameDate } from "../time/index.js";
6
- import { formatTrigger, readTriggers, triggerHolds } from "../triggers/index.js";
7
- import { newDatedLogEntry } from "./game-time.js";
1
+ import { appendLogEntry } from "../../core/log.js";
2
+ import { comparableText } from "../../core/text.js";
3
+ import { formatCounter, readCounter } from "../../counters/index.js";
4
+ import { backlinks, containerFieldOf, isCountedItem, isEmptyField, isInParty, linksIn, locate, newPageFields, pagesWithName, pageWithPath, parsePageReference, standardValues, systemLabel, systemPageNamed, withPage, writePage, } from "../../pages/index.js";
5
+ import { formatDuration, formatGameDate, minutesBetween, readGameDate } from "../../time/index.js";
6
+ import { formatTrigger, readTriggers, triggerHolds } from "../../triggers/index.js";
8
7
  import { shortList } from "./notes.js";
8
+ import { newDatedLogEntry } from "./time.js";
9
9
  /** The planned events: those with a game date first, in order of date, then those without one. */
10
10
  export function plannedEvents(world) {
11
11
  const events = world.pages.filter((page) => isPlannedEvent(page.type, page.fields)).map(plannedEventOf);
@@ -59,7 +59,7 @@ export function dueText(event) {
59
59
  }
60
60
  /** A planned event still to come, with what brings it (EVT-9): "La marcia della Confraternita (clock 2/4, day 3, 06:00, in 1d)", "I servitori si svegliano (when party in Ossario)". */
61
61
  export function plannedText(event, now) {
62
- const clock = eventClock(event.page);
62
+ const clock = clockOf(event.page.fields.clock);
63
63
  const until = now === undefined || event.date === undefined ? 0 : minutesBetween(now, event.date);
64
64
  const triggers = eventTriggers(event.page).map((trigger) => formatTrigger(trigger, false));
65
65
  return withParts(event.page.name, [
@@ -71,9 +71,11 @@ export function plannedText(event, now) {
71
71
  }
72
72
  /** What to do with due events (D-106): seen or heard, a scene; out of sight, off screen; then their status, or a later date. */
73
73
  export function dueAdvice(count) {
74
+ const after = "happened if it went as written, cancelled if it never will; or give it a later date if it is put off or tried again. If what it needs is gone, cancel it, "
75
+ + "or let whoever wanted it try another way; never bend the world back to the written story.";
74
76
  return count === 1
75
- ? "If the characters see or hear it, play it as a scene; if not, it happens off screen, and they will find its traces. Then set its status: happened if it went as written, cancelled if it never will; or give it a later date if it is put off or tried again. If what it needs is gone, cancel it, or let whoever wanted it try another way; never bend the world back to the written story."
76
- : "Play as scenes those the characters see or hear; the others happen off screen, and they will find their traces. Then set each one's status: happened if it went as written, cancelled if it never will; or give it a later date if it is put off or tried again. If what it needs is gone, cancel it, or let whoever wanted it try another way; never bend the world back to the written story.";
77
+ ? `If the characters see or hear it, play it as a scene; if not, it happens off screen, and they will find its traces. Then set its status: ${after}`
78
+ : `Play as scenes those the characters see or hear; the others happen off screen, and they will find their traces. Then set each one's status: ${after}`;
77
79
  }
78
80
  /**
79
81
  * Fires the planned events that a command set off (EVT-4): each gets the present date, unless it has one that has come, and a hidden line in the log.
@@ -162,16 +164,10 @@ export function linkedStoryNotes(world, pages, skipped, now) {
162
164
  return linked.length === 0 ? [] : [`Linked to ${page.name}: ${shortList(linked.map((other) => storyText(other, now)), " · ")}. ${storyAdvice(linked)}`];
163
165
  });
164
166
  }
165
- /** What the master may write of the stories linked to a page: an event's status, date or by; a quest's status, when its story has ended. */
166
- function storyAdvice(linked) {
167
- const events = linked.some((page) => page.type !== "quest") ? "If an event no longer goes as planned, write it: its status, date or by." : "";
168
- const quests = linked.some((page) => page.type === "quest") ? "If the story of a quest has ended, set its status." : "";
169
- return [events, quests].filter((advice) => advice !== "").join(" ");
170
- }
171
167
  /** The clocks of the planned events not due yet, with who carries them (EVT-8, D-135): "La marcia della Confraternita 2/4 (Fratello Odo)". */
172
168
  export function clocksToMove(world, now, facts = worldFacts(world)) {
173
169
  return plannedEvents(world).filter((event) => !isDue(event, now, facts)).flatMap((event) => {
174
- const clock = eventClock(event.page);
170
+ const clock = clockOf(event.page.fields.clock);
175
171
  const makers = linksIn(event.page.fields.by);
176
172
  return clock === undefined ? [] : [`${event.page.name} ${formatCounter(clock)}${makers.length === 0 ? "" : ` (${makers.join(", ")})`}`];
177
173
  });
@@ -219,9 +215,15 @@ export function eventProblems(world) {
219
215
  ];
220
216
  });
221
217
  }
218
+ /** What the master may write of the stories linked to a page: an event's status, date or by; a quest's status, when its story has ended. */
219
+ function storyAdvice(linked) {
220
+ const events = linked.some((page) => page.type !== "quest") ? "If an event no longer goes as planned, write it: its status, date or by." : "";
221
+ const quests = linked.some((page) => page.type === "quest") ? "If the story of a quest has ended, set its status." : "";
222
+ return [events, quests].filter((advice) => advice !== "").join(" ");
223
+ }
222
224
  /** What sets an event off now: its full clock, or the first of its conditions that holds; undefined when nothing does (EVT-2, EVT-3). */
223
225
  function triggerOf(page, facts) {
224
- const clock = eventClock(page);
226
+ const clock = clockOf(page.fields.clock);
225
227
  if (clock !== undefined && clock.value >= clock.max) {
226
228
  return `clock ${formatCounter(clock)}`;
227
229
  }
@@ -291,10 +293,6 @@ function statusOf(page) {
291
293
  }
292
294
  return isEmptyField(page.fields.status) ? String(newPageFields(page.type).status ?? "alive") : String(page.fields.status);
293
295
  }
294
- /** An event's clock: current/max with a maximum of at least 1 (EVT-2); undefined for anything else. */
295
- function eventClock(page) {
296
- return clockOf(page.fields.clock);
297
- }
298
296
  function clockOf(value) {
299
297
  const counter = readCounter(value);
300
298
  return counter?.max !== undefined && counter.max >= 1 ? { value: counter.value, max: counter.max } : undefined;
@@ -1,11 +1,9 @@
1
- import type { Context } from "../core/context.ts";
2
- import { type Examples } from "../core/examples.ts";
3
- import type { Coin } from "../money/index.ts";
4
- import type { GameSystem, SystemWords } from "../systems/index.ts";
1
+ import type { Context } from "../../core/context.ts";
2
+ import { type Examples } from "../../core/examples.ts";
3
+ import type { Coin } from "../../money/index.ts";
4
+ import type { GameSystem } from "../../systems/index.ts";
5
5
  /** The examples for a campaign: its system's names, in its language where the system has words for them; neutral without a campaign or a system. */
6
6
  export declare function campaignExamples(root: string | undefined, context: Context): Examples;
7
- /** The examples a game system gives, with the labels of its words and the campaign's coins. */
8
- export declare function systemExamples(system: GameSystem, words: SystemWords | undefined, coins: Coin[]): Examples;
9
7
  /** A coin and a smaller one of a campaign for an example, as gp and sp, never a rare one; neutral names without them. */
10
8
  export declare function coinExamples(coins: Coin[] | undefined): {
11
9
  coin: string;
@@ -18,5 +16,3 @@ export declare function poolExample(system: GameSystem | undefined): {
18
16
  recipe: string;
19
17
  field: string;
20
18
  };
21
- /** The fields an effect adds to in a game system, those it declares bonuses. */
22
- export declare function bonusFields(system: GameSystem): string[];
@@ -1,10 +1,10 @@
1
1
  // The examples of the commands' descriptions in the names of the campaign's game system (D-518): its counter, its dice, its coins, its turn, its rests and
2
2
  // what an effect adds to; neutral where it names none.
3
- import { readTextSetting } from "../campaign/index.js";
4
- import { neutralExamples } from "../core/examples.js";
5
- import { comparableText } from "../core/text.js";
6
- import { campaignCoins } from "./game-money.js";
7
- import { campaignSystem, systemWordsOf } from "./game-world.js";
3
+ import { readTextSetting } from "../../campaign/index.js";
4
+ import { neutralExamples } from "../../core/examples.js";
5
+ import { comparableText } from "../../core/text.js";
6
+ import { campaignCoins } from "./money.js";
7
+ import { campaignSystem, systemWordsOf } from "./world.js";
8
8
  /** The examples for a campaign: its system's names, in its language where the system has words for them; neutral without a campaign or a system. */
9
9
  export function campaignExamples(root, context) {
10
10
  const system = root === undefined ? undefined : campaignSystem(root, context);
@@ -15,23 +15,6 @@ export function campaignExamples(root, context) {
15
15
  const words = language === undefined ? undefined : systemWordsOf(root, system, language, context);
16
16
  return systemExamples(system, words, campaignCoins(root, context).coins ?? []);
17
17
  }
18
- /** The examples a game system gives, with the labels of its words and the campaign's coins. */
19
- export function systemExamples(system, words, coins) {
20
- const [check, otherCheck] = rolledFields(system);
21
- const checkText = (field) => `${checkLabel(field, words)} ${system.sheetDice[field]}+${field}`;
22
- const uses = Object.keys(system.turnUses).slice(0, 3);
23
- return {
24
- counter: system.damage?.counter ?? system.combat?.track ?? neutralExamples.counter,
25
- roll: check === undefined ? neutralExamples.roll : `${system.sheetDice[check]}+${check}`,
26
- check: check === undefined ? neutralExamples.check : checkText(check),
27
- otherCheck: otherCheck === undefined ? neutralExamples.otherCheck : checkText(otherCheck),
28
- ...coinExamples(coins),
29
- uses: uses.length === 0 ? neutralExamples.uses : uses.join(", "),
30
- rest: restExample(system),
31
- pool: poolExample(system).field,
32
- bonus: bonusExample(system),
33
- };
34
- }
35
18
  /** A coin and a smaller one of a campaign for an example, as gp and sp, never a rare one; neutral names without them. */
36
19
  export function coinExamples(coins) {
37
20
  const [coin, smallCoin] = (coins ?? []).filter((one) => !one.rare).sort((one, other) => other.value - one.value);
@@ -49,8 +32,25 @@ export function poolExample(system) {
49
32
  const field = pool?.endsWith("*") === true ? Object.keys(system?.fields ?? {}).find((name) => name.startsWith(pool.slice(0, -1))) : pool;
50
33
  return recipe === undefined || field === undefined ? { recipe: "breather", field: neutralExamples.pool } : { recipe: recipe.name, field };
51
34
  }
35
+ /** The examples a game system gives, with the labels of its words and the campaign's coins. */
36
+ function systemExamples(system, words, coins) {
37
+ const [check, otherCheck] = rolledFields(system);
38
+ const checkText = (field) => `${checkLabel(field, words)} ${system.sheetDice[field]}+${field}`;
39
+ const uses = Object.keys(system.turnUses).slice(0, 3);
40
+ return {
41
+ counter: system.damage?.counter ?? system.combat?.track ?? neutralExamples.counter,
42
+ roll: check === undefined ? neutralExamples.roll : `${system.sheetDice[check]}+${check}`,
43
+ check: check === undefined ? neutralExamples.check : checkText(check),
44
+ otherCheck: otherCheck === undefined ? neutralExamples.otherCheck : checkText(otherCheck),
45
+ ...coinExamples(coins),
46
+ uses: uses.length === 0 ? neutralExamples.uses : uses.join(", "),
47
+ rest: restExample(system),
48
+ pool: poolExample(system).field,
49
+ bonus: bonusExample(system),
50
+ };
51
+ }
52
52
  /** The fields an effect adds to in a game system, those it declares bonuses. */
53
- export function bonusFields(system) {
53
+ function bonusFields(system) {
54
54
  return Object.entries(system.fields).filter(([, kind]) => kind === "bonus").map(([name]) => name);
55
55
  }
56
56
  /** Two numbers of the sheet rolled with dice, those shown beside no score first, as the saves of the 5e before its ability modifiers. */
@@ -1,5 +1,5 @@
1
- import type { Problem } from "../core/problem.ts";
2
- import { type World } from "../pages/index.ts";
1
+ import type { Problem } from "../../core/problem.ts";
2
+ import { type World } from "../../pages/index.ts";
3
3
  /**
4
4
  * A character's points as the system counts them: its level, the least its level needs, the next level and the points it needs, and the highest level the
5
5
  * points reach beyond its own.
@@ -1,9 +1,9 @@
1
1
  // The experience points of a character (D-205, D-233, PRO-6): how many it lacks for the next level, the least its level needs, and the level they reach that its
2
2
  // classes have not.
3
- import { listItems, numberOf } from "../core/formula.js";
4
- import { comparableText, valueNamed } from "../core/text.js";
5
- import { readCounter } from "../counters/index.js";
6
- import { isInParty } from "../pages/index.js";
3
+ import { listItems, numberOf } from "../../core/formula.js";
4
+ import { comparableText, valueNamed } from "../../core/text.js";
5
+ import { readCounter } from "../../counters/index.js";
6
+ import { isInParty } from "../../pages/index.js";
7
7
  import { effectiveFields } from "./effect-layer.js";
8
8
  /**
9
9
  * The experience of a character with these fields, when the system counts it (PRO-6): the level is the sum of the numbers of the progression's list. Undefined
@@ -13,8 +13,8 @@ export function experienceOf(world, fields) {
13
13
  const progression = world.system?.progression;
14
14
  const rule = progression?.experience;
15
15
  const table = rule === undefined ? undefined : Object.entries(world.system?.formulas?.tables ?? {}).find(([name]) => comparableText(name) === comparableText(rule.table))?.[1];
16
- const points = rule === undefined ? undefined : numberOf(fieldOf(fields, rule.field));
17
- const level = progression === undefined ? 0 : listItems(fieldOf(fields, progression.list)).reduce((total, item) => total + (item.number ?? 0), 0);
16
+ const points = rule === undefined ? undefined : numberOf(valueNamed(fields, rule.field));
17
+ const level = progression === undefined ? 0 : listItems(valueNamed(fields, progression.list)).reduce((total, item) => total + (item.number ?? 0), 0);
18
18
  if (rule === undefined || table === undefined || points === undefined || level === 0) {
19
19
  return undefined;
20
20
  }
@@ -94,8 +94,8 @@ export function experienceProblems(world) {
94
94
  const field = world.system?.progression?.experience?.field;
95
95
  return world.pages.filter(isInParty).flatMap((page) => {
96
96
  const experience = experienceOf(world, effectiveFields(world, page));
97
- const written = experience === undefined ? undefined : readCounter(fieldOf(page.fields, experience.field));
98
- const raw = field === undefined ? undefined : fieldOf(page.fields, field);
97
+ const written = experience === undefined ? undefined : readCounter(valueNamed(page.fields, experience.field));
98
+ const raw = field === undefined ? undefined : valueNamed(page.fields, field);
99
99
  // Points written as text, such as 350 XP, count for nothing.
100
100
  if (field !== undefined && raw !== undefined && raw !== null && readCounter(raw) === undefined) {
101
101
  return [{ path: page.path, message: `${page.name} has ${field} "${String(raw)}", which is no number of points.`, fix: `write ${page.name}, set ${field} as a whole number, such as ${field}=0` }];
@@ -114,6 +114,3 @@ export function experienceProblems(world) {
114
114
  }];
115
115
  });
116
116
  }
117
- function fieldOf(fields, field) {
118
- return valueNamed(fields, field);
119
- }
@@ -1,9 +1,9 @@
1
- import { type Grid, type Square } from "../grid/index.ts";
2
- import { type World } from "../pages/index.ts";
3
- import type { Scene } from "../scene/index.ts";
4
- import type { GameSystem, GridRules } from "../systems/index.ts";
5
- import type { Standing } from "./game-grids.ts";
6
- import type { Measures } from "./game-roads.ts";
1
+ import { type Grid, type Square } from "../../grid/index.ts";
2
+ import { type World } from "../../pages/index.ts";
3
+ import type { Scene } from "../../scene/index.ts";
4
+ import type { GameSystem, GridRules } from "../../systems/index.ts";
5
+ import type { Standing } from "./grids.ts";
6
+ import type { Measures } from "./roads.ts";
7
7
  /** A move on a place's map: who moves, as the place's `at` names them, from where to where, and the others on it as they stood before. */
8
8
  export interface MapMove {
9
9
  grid: Grid;
@@ -1,11 +1,11 @@
1
1
  // What a move on the map of a place tells the master (GRD-4, GRD-5): how far it went by the shortest way, whose side it left on the way and who stands next to
2
2
  // it now; in a fight, on its turn, how far it has moved and what is left of its speed, which the open scene keeps for the turn.
3
- import { formatStep, readFirstLength } from "../core/length.js";
4
- import { comparableText, valueNamed } from "../core/text.js";
5
- import { closedSquare, coveredSquares, isNextTo, shortestWay, squareName } from "../grid/index.js";
6
- import { isEmptyField, isPartyMember } from "../pages/index.js";
3
+ import { formatStep, readFirstLength } from "../../core/length.js";
4
+ import { comparableText, valueNamed } from "../../core/text.js";
5
+ import { closedSquare, coveredSquares, isNextTo, shortestWay, squareName } from "../../grid/index.js";
6
+ import { isEmptyField, isPartyMember } from "../../pages/index.js";
7
7
  import { effectiveFields } from "./effect-layer.js";
8
- import { copyPage } from "./game-scene.js";
8
+ import { copyPage } from "./scene.js";
9
9
  import { signedText, workedFields } from "./worked-out.js";
10
10
  /** The facts of a move on a place's map (GRD-5), as the game's grid counts them; nothing to tell when the game has no grid. */
11
11
  export function moveFacts(world, system, measures, scene, move) {
@@ -1,7 +1,7 @@
1
- import type { Problem } from "../core/problem.ts";
2
- import { type Grid, type Square } from "../grid/index.ts";
3
- import { type MovePlan, type Page, type World } from "../pages/index.ts";
4
- import type { Scene } from "../scene/index.ts";
1
+ import type { Problem } from "../../core/problem.ts";
2
+ import { type Grid, type Square } from "../../grid/index.ts";
3
+ import { type MovePlan, type Page, type World } from "../../pages/index.ts";
4
+ import type { Scene } from "../../scene/index.ts";
5
5
  /** Someone or something on a place's map (GRD-3): the entry of `at` as written, the page or the copy of the open scene it names, and its square. */
6
6
  export interface Standing {
7
7
  entry: string;
@@ -43,10 +43,5 @@ export declare function withSquares(world: World, plan: MovePlan, destination: P
43
43
  export declare function offMapNote(world: World, place: Page | undefined, scene: Scene, names: string[]): string | undefined;
44
44
  /** Takes copies of the open scene off the map of its place (GRD-3), as they leave, or the scene closes or goes elsewhere. */
45
45
  export declare function clearCopies(world: World, scene: Scene, names: string[]): void;
46
- /**
47
- * The square a page enters a place's map by (GRD-3): the open one that leads to where it comes from, the nearest of its containers first; none when no such
48
- * square leads there, or it comes from inside the place itself, as up from its cellar, or put down by one who is there.
49
- */
50
- export declare function doorFrom(world: World, grid: Grid, page: Page, place: Page): Square | undefined;
51
46
  /** What is wrong with the places' maps and with who stands where on them (GRD-2, GRD-3), for validate. */
52
47
  export declare function gridProblems(world: World, scene: Scene | undefined): Problem[];
@@ -1,10 +1,11 @@
1
1
  // The map of a place in play (GRD-1–GRD-3, D-324): its grid from the page's text, who stands where on it as the place's `at` lists them, what of them is
2
2
  // wrong, and the squares a move leaves and takes.
3
- import { rememberedByText } from "../core/memo.js";
4
- import { comparableText } from "../core/text.js";
5
- import { builtIn, closedSquare, firstOpenSquare, mapBlock, readGrid, readSquare, squareName } from "../grid/index.js";
6
- import { squareKinds } from "../map/index.js";
7
- import { environmentAt, links, locate, pagesWithName, parsePageReference, writePage } from "../pages/index.js";
3
+ import { rememberedByText } from "../../core/memo.js";
4
+ import { comparableText } from "../../core/text.js";
5
+ import { builtIn, closedSquare, firstOpenSquare, mapBlock, readGrid, readSquare, squareName } from "../../grid/index.js";
6
+ import { squareKinds } from "../../map/index.js";
7
+ import { environmentAt, links, locate, pagesWithName, parsePageReference, writePage } from "../../pages/index.js";
8
+ import { scenePlace } from "./scene.js";
8
9
  /** The map of a place (GRD-1): its grid, and what of it cannot be read; none for a page that is no place or has no map block. */
9
10
  export function placeGrid(page) {
10
11
  return page.type === "place" ? readMap(page.body) : undefined;
@@ -86,7 +87,7 @@ export function offMapNote(world, place, scene, names) {
86
87
  }
87
88
  /** Takes copies of the open scene off the map of its place (GRD-3), as they leave, or the scene closes or goes elsewhere. */
88
89
  export function clearCopies(world, scene, names) {
89
- const place = scene.place === undefined ? undefined : pagesWithName(world, parsePageReference(scene.place).name)[0];
90
+ const place = scenePlace(world, scene);
90
91
  const gone = new Set(names.map(comparableText));
91
92
  const leaving = place === undefined ? [] : standing(world, place, scene).filter((one) => one.copy !== undefined && gone.has(comparableText(one.copy))).map((one) => one.entry);
92
93
  if (place !== undefined && leaving.length > 0) {
@@ -94,23 +95,12 @@ export function clearCopies(world, scene, names) {
94
95
  writePage(world, place.name, undefined, kept.length === 0 ? { unset: ["at"] } : { set: { at: kept } });
95
96
  }
96
97
  }
97
- /**
98
- * The square a page enters a place's map by (GRD-3): the open one that leads to where it comes from, the nearest of its containers first; none when no such
99
- * square leads there, or it comes from inside the place itself, as up from its cellar, or put down by one who is there.
100
- */
101
- export function doorFrom(world, grid, page, place) {
102
- const holders = locate(world, page).chain;
103
- const inside = holders.findIndex((holder) => holder.path === place.path);
104
- const chain = (inside === -1 ? holders : holders.slice(0, inside)).map((holder) => comparableText(holder.name));
105
- const exits = grid.exits.filter((exit) => chain.includes(comparableText(exit.to)) && closedSquare(grid, exit.square) === undefined);
106
- return exits.sort((first, second) => chain.indexOf(comparableText(first.to)) - chain.indexOf(comparableText(second.to)))[0]?.square;
107
- }
108
98
  /** What is wrong with the places' maps and with who stands where on them (GRD-2, GRD-3), for validate. */
109
99
  export function gridProblems(world, scene) {
110
- const scenePlace = scene?.place === undefined ? undefined : pagesWithName(world, parsePageReference(scene.place).name)[0];
100
+ const placeOfScene = scenePlace(world, scene);
111
101
  return world.pages.filter((page) => page.type === "place" && page.system === undefined).flatMap((place) => {
112
102
  const map = placeGrid(place);
113
- const placed = standing(world, place, scenePlace === place ? scene : undefined);
103
+ const placed = standing(world, place, placeOfScene === place ? scene : undefined);
114
104
  if (map === undefined) {
115
105
  return placed.length === 0 ? [] : [{ path: place.path, message: `${place.name} says who stands where, at, but has no map.`, fix: `write its map in a map block (GRD-1), or unset at` }];
116
106
  }
@@ -127,6 +117,17 @@ export function gridProblems(world, scene) {
127
117
  ];
128
118
  });
129
119
  }
120
+ /**
121
+ * The square a page enters a place's map by (GRD-3): the open one that leads to where it comes from, the nearest of its containers first; none when no such
122
+ * square leads there, or it comes from inside the place itself, as up from its cellar, or put down by one who is there.
123
+ */
124
+ function doorFrom(world, grid, page, place) {
125
+ const holders = locate(world, page).chain;
126
+ const inside = holders.findIndex((holder) => holder.path === place.path);
127
+ const chain = (inside === -1 ? holders : holders.slice(0, inside)).map((holder) => comparableText(holder.name));
128
+ const exits = grid.exits.filter((exit) => chain.includes(comparableText(exit.to)) && closedSquare(grid, exit.square) === undefined);
129
+ return exits.sort((first, second) => chain.indexOf(comparableText(first.to)) - chain.indexOf(comparableText(second.to)))[0]?.square;
130
+ }
130
131
  /** Whether a symbol every map has keeps its own name and drawing, the legend saying nothing of it. */
131
132
  function builtInLook(grid, symbol) {
132
133
  const feature = grid.features.find((one) => one.symbol === symbol);
@@ -1,6 +1,6 @@
1
- import type { Context } from "../core/context.ts";
2
- import type { Problem } from "../core/problem.ts";
3
- import { type Page, type World } from "../pages/index.ts";
1
+ import type { Context } from "../../core/context.ts";
2
+ import type { Problem } from "../../core/problem.ts";
3
+ import { type Page, type World } from "../../pages/index.ts";
4
4
  /**
5
5
  * What the master hears of the places' pictures (D-308, PIC-4): where pictures can be made and the player has not chosen, to ask them once; with new elements, that
6
6
  * the place the party is in, still without a picture, should get one. Nothing otherwise.
@@ -1,10 +1,11 @@
1
+ // The pictures of the world as several commands use them (D-308): what is missing one, where the campaign keeps them, and the file a page's image field names.
1
2
  import { basename } from "node:path";
2
- import { readSettings } from "../campaign/index.js";
3
- import { files } from "../core/store.js";
4
- import { findImage, imageFileName } from "../images/index.js";
5
- import { baseChain, isPartyMember, ownField } from "../pages/index.js";
6
- import { systemContentFolders } from "../systems/index.js";
7
- import { campaignSystem } from "./game-world.js";
3
+ import { readSettings } from "../../campaign/index.js";
4
+ import { files } from "../../core/store.js";
5
+ import { findImage, imageFileName } from "../../images/index.js";
6
+ import { baseChain, isPartyMember, ownField } from "../../pages/index.js";
7
+ import { systemContentFolders } from "../../systems/index.js";
8
+ import { campaignSystem } from "./world.js";
8
9
  /**
9
10
  * What the master hears of the places' pictures (D-308, PIC-4): where pictures can be made and the player has not chosen, to ask them once; with new elements, that
10
11
  * the place the party is in, still without a picture, should get one. Nothing otherwise.
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ /** A list, or one text, as an MCP client may send it. */
3
+ export declare const textList: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
4
+ /** A whole number, as text from a command line or as a number through MCP. */
5
+ export declare const wholeNumber: z.ZodPreprocess<z.ZodNumber, unknown>;
6
+ /** Fields and their values, as field=value strings from a command line or as an object through MCP. */
7
+ export declare const fieldValues: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
8
+ /** The texts of a textList: one text as a list of one, blank ones left out. */
9
+ export declare function textsOf(value: string | string[] | undefined): string[];
@@ -0,0 +1,12 @@
1
+ // The shapes of input several commands take, as a command line and an MCP client send them.
2
+ import { z } from "zod";
3
+ /** A list, or one text, as an MCP client may send it. */
4
+ export const textList = z.union([z.string(), z.array(z.string())]);
5
+ /** A whole number, as text from a command line or as a number through MCP. */
6
+ export const wholeNumber = z.preprocess((value) => (typeof value === "string" && /^[+-]?\d+$/.test(value.trim()) ? Number(value) : value), z.number().int());
7
+ /** Fields and their values, as field=value strings from a command line or as an object through MCP. */
8
+ export const fieldValues = z.union([z.array(z.string()), z.record(z.string(), z.unknown())]);
9
+ /** The texts of a textList: one text as a list of one, blank ones left out. */
10
+ export function textsOf(value) {
11
+ return (value === undefined ? [] : typeof value === "string" ? [value] : value).filter((text) => text.trim() !== "");
12
+ }
@@ -1,7 +1,7 @@
1
- import { type Start } from "../map/index.ts";
2
- import { type Page, type Position, type World } from "../pages/index.ts";
3
- import { type GameDate } from "../time/index.ts";
4
- import { type Measures, type Roads } from "./game-roads.ts";
1
+ import { type Start } from "../../map/index.ts";
2
+ import { type Page, type Position, type World } from "../../pages/index.ts";
3
+ import { type GameDate } from "../../time/index.ts";
4
+ import { type Measures, type Roads } from "./roads.ts";
5
5
  /** Where on a road a journey stopped (TRV-7): the road, its stretch by its place in the road, the ends of the stretch in the way it went, the metres done after `from`. */
6
6
  export interface OnRoad {
7
7
  road: string;
@@ -10,8 +10,6 @@ export interface OnRoad {
10
10
  toward: string;
11
11
  done: number;
12
12
  }
13
- /** How long a stop must last for the hours of travel to start again (TRV-8): a night's rest. */
14
- export declare const restMinutes: number;
15
13
  /** A journey as state.yaml keeps it. */
16
14
  export interface Journey {
17
15
  /** What travels: the travellers, or the vehicle that carries them (TRV-6). */
@@ -1,16 +1,15 @@
1
1
  // A journey under way (D-258, TRV-8, TRV-9, TRV-12), kept in state.yaml under journey: what travels, where to or which way, where it stopped (on a road, or at
2
2
  // a point in the open), the pace, the hours travelled since the last rest.
3
- import { changeStateAt, readStateValues } from "../campaign/index.js";
4
- import { readLength } from "../core/length.js";
5
- import { comparableText } from "../core/text.js";
6
- import { pointAlong } from "../map/index.js";
7
- import { formatPosition, isEmptyField, locate, pagesWithName, parsePageReference, readPosition } from "../pages/index.js";
8
- import { formatDuration, formatGameDate, minutesBetween, readDuration, readGameDate } from "../time/index.js";
9
- import { mapOf } from "./game-maps.js";
10
- import { pointText, positionOf, regionAt } from "./game-positions.js";
11
- import { hoursText, lengthText } from "./game-roads.js";
3
+ import { changeStateAt, readStateValues } from "../../campaign/index.js";
4
+ import { readLength } from "../../core/length.js";
5
+ import { comparableText } from "../../core/text.js";
6
+ import { pointAlong } from "../../map/index.js";
7
+ import { formatPosition, isEmptyField, locate, mapOf, pagesWithName, parsePageReference, readPosition } from "../../pages/index.js";
8
+ import { formatDuration, formatGameDate, minutesBetween, readDuration, readGameDate } from "../../time/index.js";
9
+ import { pointText, positionOf, regionAt } from "./positions.js";
10
+ import { hoursText, lengthText } from "./roads.js";
12
11
  /** How long a stop must last for the hours of travel to start again (TRV-8): a night's rest. */
13
- export const restMinutes = 8 * 60;
12
+ const restMinutes = 8 * 60;
14
13
  /** The journey in state.yaml; none when there is none, or it does not read: then the next travel starts afresh. */
15
14
  export function readJourney(root) {
16
15
  let value;
@@ -154,16 +153,15 @@ export function journeyText(world, roads, journey, measures) {
154
153
  return stopped === undefined ? undefined : `stopped ${region === undefined ? "in the open" : `in ${region}`}, ${pointText(world, stopped, measures, map)}.`;
155
154
  }
156
155
  const onRoad = journey.on === undefined ? undefined : journeyStart(world, roads, journey, movers);
157
- const open = journey.at === undefined ? undefined : journeyPoint(world, journey, movers);
158
- if ((journey.on !== undefined && onRoad === undefined) || (journey.at !== undefined && open === undefined)) {
156
+ if ((journey.on !== undefined && onRoad === undefined) || (journey.at !== undefined && stopped === undefined)) {
159
157
  return undefined;
160
158
  }
161
159
  const goal = journey.to === undefined ? `${journey.heading}${journey.left === undefined ? "" : ` for ${lengthText(journey.left, measures)} more`}` : `to ${journey.to}`;
162
- const region = open === undefined ? undefined : regionAt(world, open, map)?.page.name;
160
+ const region = stopped === undefined ? undefined : regionAt(world, stopped, map)?.page.name;
163
161
  const where = journey.on !== undefined
164
162
  ? `, on ${journey.on.road}, ${lengthText(journey.on.done, measures)} past ${journey.on.from}, toward ${journey.on.toward}`
165
- : open !== undefined
166
- ? `, ${region === undefined ? "in the open" : `in ${region}`}, ${pointText(world, open, measures, map)}`
163
+ : stopped !== undefined
164
+ ? `, ${region === undefined ? "in the open" : `in ${region}`}, ${pointText(world, stopped, measures, map)}`
167
165
  : "";
168
166
  const call = journey.to === undefined ? `travel toward ${journey.heading}` : `travel to ${journey.to}${journey.at === undefined ? "" : ", across"}`;
169
167
  return `${goal}${where}; ${hoursText(journey.travelled)} of travel since the last rest. To go on: ${call}.`;