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
@@ -16,48 +16,25 @@ export const saveModes = ["permadeath", "checkpoint", "free"];
16
16
  /** How closely the rules are followed, apart from difficulty (D-42): the master glosses over them, as they are written, or beyond them. */
17
17
  export const rigors = ["smooth", "rules", "simulation"];
18
18
  /** What each difficulty means in play, from the GDD's table, which status and config give for the chosen one (D-263); fights in the words of a budget of low, moderate and high (D-266). */
19
- export const difficultyMeanings = {
19
+ const difficultyMeanings = {
20
20
  story: "fights low, yet each asks one choice that counts; the plain approach wins at a small cost, the risk falling on goals and allies; foes naive, ignoring the place, quick to flee; "
21
- + "clues obvious, four or more; resources plentiful; random encounters rare; threat clocks slow: one of them a step every other day; you may soften your own rolls",
21
+ + "clues obvious, four or more; resources plentiful; random encounters rare; threat clocks slow: one of them a step every other day; you may soften your own rolls; take-backs granted whenever asked",
22
22
  easy: "fights low to moderate; the plain approach wins at a cost; foes with simple tactics, using the plainest feature of the place; three clues or more; resources generous; "
23
- + "random encounters rare; threat clocks slow: one of them a step every other day",
23
+ + "random encounters rare; threat clocks slow: one of them a step every other day; small take-backs granted gladly",
24
24
  normal: "fights moderate to high; two to four between full rests, with a reason not to rest; the plain approach wins at a real cost, a good choice cheaply; "
25
25
  + "foes with sensible tactics, using the place, normal morale; three clues to every conclusion; resources standard (treasure, supplies, prices); random encounters normal; "
26
- + "threat clocks at their pace: one of them a step each day",
26
+ + "threat clocks at their pace: one of them a step each day; a take-back now and then, when little hangs on it",
27
27
  hard: "fights high and beyond; the plain approach may lose, a good choice wins at a cost; foes smart (focus, control), taking the place first, tenacious; three subtle clues; "
28
- + "resources scarce; random encounters frequent; threat clocks fast: each of them a step each day",
28
+ + "resources scarce; random encounters frequent; threat clocks fast: each of them a step each day; take-backs rare",
29
29
  brutal: "fights far beyond high; the plain approach loses, only good choices win; foes optimized (prepared ground, retreats, ambushes, finishing the fallen), fanatical; "
30
- + "three subtle clues; resources very scarce; random encounters frequent; threat clocks fast: each of them a step each day; rests at their harshest",
30
+ + "three subtle clues; resources very scarce; random encounters frequent; threat clocks fast: each of them a step each day; rests at their harshest; no take-backs",
31
31
  };
32
32
  /** What each rigor means in play (D-42, D-263): what the master counts, which status and config give for the chosen one. */
33
- export const rigorMeanings = {
33
+ const rigorMeanings = {
34
34
  smooth: "you gloss over food and water, light, encumbrance, fatigue and the like: count them only when the story turns on them",
35
35
  rules: "as written: charge with change what is used up; encumbrance, fatigue and the like as the rules say; warn before something runs out, and once it has, the rule applies",
36
36
  simulation: "as rules, and beyond what is written: wear, spoilage, weather and the like",
37
37
  };
38
- /** A rigor's meaning with what the game counts itself said (review of 17 October): a game that counts no food is never promised it. */
39
- function rigorMeaning(rigor, counted) {
40
- const meaning = rigorMeanings[rigor];
41
- const burns = counted?.burning === undefined ? "" : `an effect named after what burns, such as ${counted.burning}, spends it as it is lit`;
42
- if (meaning === undefined || rigor === "simulation" || counted === undefined) {
43
- return meaning;
44
- }
45
- if (rigor === "smooth") {
46
- return burns === "" ? meaning : `${meaning}; a light you put on as an effect, as a ${counted.burning}, still spends one`;
47
- }
48
- const food = counted.upkeep ? "advance spends the day's food outside a settlement; water, lifestyle and wages are yours to charge" : "";
49
- const counts = [food, burns].filter((part) => part !== "").join("; ");
50
- return counts === "" ? meaning : meaning.replace("charge with change what is used up; ", `charge with change what is used up; ${counts}; `);
51
- }
52
- /** How much the master teaches the game, out of the story (D-347): the story alone, a hint now and then, or each rule as it first comes up. */
53
- export const mentorWays = ["off", "hints", "tutorial"];
54
- /** What each way of the mentor means to the master, which config gives for the chosen one, and the player's change of it on the dashboard (D-347). */
55
- export const mentorMeanings = {
56
- off: "the story alone: no tips or explanations of yours, only your answers to what the player asks between brackets",
57
- hints: "a tip of a sentence or two, in brackets, before a choice that matters and when a rule slips by, as the mentor's part of your instructions says; no lessons",
58
- tutorial: "each mechanic explained the first time it comes up, the whole sum of a roll shown, a debrief after fights and at the end of a session, "
59
- + "as the mentor's part of your instructions says",
60
- };
61
38
  /**
62
39
  * What the chosen difficulty, rigor or mentor means, as status and config give it, the rigor with what the game counts itself; undefined for another setting
63
40
  * or a value it does not take.
@@ -70,153 +47,9 @@ export function settingMeaning(name, value, counted) {
70
47
  const own = Object.hasOwn(meanings, name) ? meanings[name] : undefined;
71
48
  return typeof value === "string" && own !== undefined && Object.hasOwn(own, value) ? own[value] : undefined;
72
49
  }
73
- /** Who rolls the player character's dice (D-241): rpg, or the player with their own, telling the values; the master's are always rolled by rpg. */
74
- export const diceWays = ["digital", "physical"];
75
- /** Whether the master's rolls for anyone outside the party are hidden (D-287): behind the screen, unset too, or in view; the party's are always shown. */
76
- export const masterRollWays = ["behind the screen", "in view"];
77
- /**
78
- * Who voices the characters (D-490), where the AI app has subagents: a character as a subagent of its own at key moments, the master chooses (auto); the master
79
- * always; always for the companions and the main characters; always for everyone.
80
- */
81
- export const voiceWays = ["master", "auto", "important", "always"];
82
- export { unitSystems };
83
- /** Which pictures the engine has made, where it can (D-308, D-388, D-420): none, only those the player asks for, or one for each new place, quest and one met. */
84
- export const pictureWays = ["none", "on request", "new elements"];
85
- /** How much the master thinks before each answer, written for each AI app in the campaign's folder (D-462). */
86
- export const efforts = ["low", "medium", "high"];
87
- /** How the companions come (D-76, D-221): none, made in session zero with the player or by the master, or met in play. */
88
- export const companionWays = ["none", "made with the player", "made by the master", "met in play"];
89
- /** How far ahead a world without a written campaign is made (D-80): as it is needed, or all at the start. */
90
- export const preparations = ["on the fly", "all at the start"];
91
- /** How the master writes (D-395): plain, the core's own, literary, pulp or wry; the tone stays in the premise, and an author takes its place. */
92
- export const proseWays = ["plain", "literary", "pulp", "wry"];
93
- /** How the master builds what they invent (D-395): situations, the core's own, arcs, episodes or a mystery; a written adventure keeps its own. */
94
- export const storyWays = ["situations", "arcs", "episodes", "mystery"];
95
- /** The settings with a closed list of values, each with them: those a game system may offer only some of (DAT-16). */
96
- export const closedSettings = {
97
- difficulty: difficulties,
98
- lethality: lethalities,
99
- saves: saveModes,
100
- rigor: rigors,
101
- mentor: mentorWays,
102
- dice: diceWays,
103
- "master-rolls": masterRollWays,
104
- voices: voiceWays,
105
- units: unitSystems,
106
- pictures: pictureWays,
107
- effort: efforts,
108
- companions: companionWays,
109
- preparation: preparations,
110
- prose: proseWays,
111
- story: storyWays,
112
- };
113
- /** The longest text the player's own words of how the master writes may be, by setting (D-395). */
114
- export const styleTextLengths = { author: 80, style: 300 };
115
- /** What each way of writing and of building the story means to the master, which config gives for the chosen one (D-395). */
116
- const styleMeanings = {
117
- prose: {
118
- plain: "short sentences, one concrete detail a thing, as your instructions write",
119
- literary: "more room at the high points, images and subtext, as the prose part of your instructions says",
120
- pulp: "tense action, strong colours, every message ending on a threat or a hook, as the prose part of your instructions says",
121
- wry: "a narrator with a half smile at the world, never at the character, as the prose part of your instructions says",
122
- },
123
- story: {
124
- situations: "a world of factions, threats with their clocks and places with secrets, no main plot, as your instructions write",
125
- arcs: "a central threat that advances by stages, the party's own arcs woven in, as the story part of your instructions says",
126
- episodes: "a story that closes each session, with a thread that comes back, as the story part of your instructions says",
127
- mystery: "every story an investigation, its truth written first in the secrets, as the story part of your instructions says",
128
- },
129
- };
130
- /** An item of a list setting. Written by hand without quotes, "Poisoned: la benda…" is YAML for a pair: it is read as the text it was meant to be (D-179). */
131
- const listItem = z.preprocess((item) => pairText(item) ?? item, z.string().min(1));
132
- /** A list setting; an empty item written by hand, as - "", holds nothing and is left out, so that it never stops the game. */
133
- const listSetting = z.preprocess((items) => (Array.isArray(items) ? items.filter((item) => item !== null && String(item).trim() !== "") : items), z.array(listItem)).nullish();
134
- /** The player's own words in a setting, on one line: a line break in them would be read as a heading of the instructions they go into (D-395). */
135
- function oneLine(most) {
136
- return z.preprocess((value) => (typeof value === "string" ? value.replace(/\s+/g, " ").trim() : value), z.string().min(1).max(most));
137
- }
138
- /** The settings of a campaign, kept in campaign.yaml. Other keys are kept: systems and extensions will add their own. */
139
- export const settingsSchema = z.object({
140
- name: z.string().min(1).describe("name of the campaign"),
141
- language: z.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/, "use a language code such as it, en or pt-BR").optional().describe("language of the game, as a code such as it or en"),
142
- system: z.string().min(1).optional().describe("game system of the campaign: one of those installed"),
143
- mentor: z.enum(mentorWays).optional().describe("how much the master teaches the game, out of the story: off, hints or tutorial; asked as how well the player knows the game: never played (tutorial), a little (hints), well (off)"),
144
- premise: z.string().min(1).optional().describe("without a written campaign: the genre, the tone, a few elements of the world and what the player enjoys most in a game, such as fights, mysteries, talk or exploring, in the player's words"),
145
- preparation: z.enum(preparations).optional().describe("without a written campaign: on the fly (the master makes the world just before it is needed) or all at the start"),
146
- prose: z.enum(proseWays).optional().describe("how the master writes, as the player chose it: plain, literary, pulp or wry; the tone stays in the premise; an author takes its place"),
147
- story: z.enum(storyWays).optional().describe("how the master builds what they invent: situations, arcs, episodes or mystery; a written adventure keeps its own"),
148
- author: oneLine(styleTextLengths.author).optional().describe("an author the master writes like, as the player named them: their way, never their sentences, names or places"),
149
- style: oneLine(styleTextLengths.style).optional().describe("the player's own wishes for how the master writes, in a few words, such as third person, past tense"),
150
- difficulty: z.enum(difficulties).optional().describe(`how hard the world plays: ${difficulties.join(", ")}`),
151
- lethality: z.enum(lethalities).optional().describe("what a fall means: narrative (the character never dies), epic (only when it matters) or dice (the dice decide)"),
152
- saves: z.enum(saveModes).optional().describe("when the game may go back: permadeath (never, but to the start, the campaign starting over), checkpoint (to the last end of a scene, once the player character dies) or free (to any save, and saves when the player asks)"),
153
- rigor: z.enum(rigors).optional().describe("how closely travel, fatigue, food and the like follow the rules: smooth (the master glosses over them), rules (as written) or simulation (beyond them)"),
154
- dice: z.enum(diceWays).optional().describe("the player character's dice: digital (rpg rolls them) or physical (the player rolls their own and tells the values)"),
155
- "master-rolls": z.enum(masterRollWays).optional().describe("the master's rolls for foes and anyone else outside the party: behind the screen (roll hides them, the master telling only the outcome) or in view (roll shows them); "
156
- + "the party's rolls are always shown; unset, behind the screen"),
157
- units: z.enum(unitSystems).optional().describe("the units of measure of the story: metric or imperial"),
158
- voices: z.enum(voiceWays).optional().describe("who voices the characters, where the AI app has subagents, from the master to the characters: master (the master, always), auto (at key moments, as the master chooses, "
159
- + "a character answers as a subagent of its own, knowing only what it knows), important (always a subagent for the companions and the characters with kind main), "
160
- + "always (always a subagent, for everyone); unset, auto"),
161
- companions: z.enum(companionWays).optional().describe("how the companions come: none, made with the player or made by the master in session zero, or met in play"),
162
- // Checked by the time module against the calendar (TIM-8).
163
- "calendar-start": z.string().min(1).optional().describe("when the story starts: day 1 to count only the days, or the day of the world's calendar that is day 1, such as 14 April 1491"),
164
- // new places and new places and quests, as campaigns wrote it before quests and then those met had pictures, are read as the value that took their place (D-388, D-420).
165
- pictures: z.preprocess((value) => (value === "new places" || value === "new places and quests" ? "new elements" : value), z.enum(pictureWays)).optional().describe("the pictures of places, quests and those met the engine has made on this computer, which spend the player's plan, Codex's or Claude's: none, on request (those the player asks for) "
166
- + "or new elements (one for each new place and quest, and for each character and kind of creature the character meets)"),
167
- effort: z.enum(efforts).optional().describe("how much the master thinks before each answer, the player's to choose: low, medium or high, written where Claude Code and Codex read it in the campaign's folder; "
168
- + "unset, each app keeps its own"),
169
- lines: listSetting.describe("what never appears in the game"),
170
- veils: listSetting.describe("what happens only off screen, without details"),
171
- table: listSetting.describe("the table's agreements: what the master promised about how the game is played"),
172
- precedents: listSetting.describe("the rulings made without the text, each starting with the name of the rule in the system's language: Poisoned: …"),
173
- learned: listSetting.describe("the game's mechanics the master has explained, by their names in the system's language: explained again only when the player gets one wrong"),
174
- library: listSetting.describe("the player's library (D-491): folders of their books, or books, by full path, which rules searches after the game system"),
175
- // Checked by the money module (MON-1): coins written wrongly by hand must not stop the other settings from being read.
176
- coins: z.unknown().optional().describe("the coins, for a game with money: each with its value in the smallest coin, such as gp 100, sp 10, cp 1"),
177
- // Checked by the time module (TIM-8): a mistake there never stops the game, whose date stays day N.
178
- calendar: z.unknown().optional().describe("the months of the campaign's own calendar, in place of the real ones and an extension's: months: [{name: January, days: 31, season: winter}, ...]"),
179
- // What the campaign adds to its game system (CAM-1): checked by the systems module when it reads the system with them, so that a mistake there never hides the
180
- // other settings.
181
- fields: z.unknown().optional().describe("fields the campaign adds to its game system, by name with their kind, such as omens: rolls"),
182
- tables: z.unknown().optional().describe("tables the campaign adds to its game system, by name, such as bulwark-dice-by-level: {3: 4, 7: 5, 15: 6}"),
183
- computed: z.unknown().optional().describe("formulas the campaign adds to its game system or puts in place of its own, as a house rule, by field"),
184
- counters: z.unknown().optional().describe("counters the campaign adds to its game system or changes: their limits and what comes back with a rest, by name"),
185
- recipes: z.unknown().optional().describe("what the campaign adds to the rests of its game system, by recipe, such as rest: {set: {bulwark-dice: max}}"),
186
- "status-line": z.unknown().optional().describe("fields the campaign adds to the line of the player character and the companions, such as omens?"),
187
- travel: z.unknown().optional().describe("what the campaign adds to how its game system travels, by key: paces, hours, terrain and kinds of road, such as kinds: {canal: {}}"),
188
- values: z.unknown().optional().describe("names the campaign adds to the closed lists of its game system, by field, such as languages: [Lingua dei Guadi]"),
189
- "condition-icons": z.unknown().optional().describe("the drawings of effects on the dashboard by their names, over the game system's: the d of an SVG path on a grid of 24, such as Benedizione: M12 3v18"),
190
- // Checked against the campaign's extensions when it is written (D-502): one written wrongly by hand leaves the extension's place.
191
- widgets: z.unknown().optional().describe("where the dashboard shows the extensions' widgets, by extension.widget: top, side, scene, sheet, world, journal or off, such as weather.today: side"),
192
- }).loose();
193
- /** The settings that the config command shows and changes. */
194
- export const settingNames = Object.keys(settingsSchema.shape);
195
- /** The settings that hold a list, changed one item at a time; none of them is ever missing in play. */
196
- export const listSettingNames = ["lines", "veils", "table", "precedents", "learned", "library", "status-line"];
197
- /** The settings that hold entries by name, what the campaign adds to its game system (CAM-1): given or removed one entry at a time. */
198
- export const mapSettingNames = ["fields", "tables", "computed", "counters", "recipes", "travel", "values", "condition-icons"];
199
- /** The settings that hold entries by name: what the campaign adds to its game system, and where the dashboard shows the extensions' widgets (D-502). */
200
- export const entrySettingNames = [...mapSettingNames, "widgets"];
201
- /**
202
- * What only the setup asks (D-241, MOD-3, D-347, D-287): how much the master teaches the game, whether the master's rolls are shown, how the companions come,
203
- * when the story starts, and the lines and veils, which "none" answers too.
204
- */
205
- export const setupSettingNames = ["mentor", "master-rolls", "companions", "calendar-start", "lines", "veils"];
206
- /** What the setup asks only of a campaign without a written world (D-79, D-80, MOD-3). */
207
- export const premiseSettingNames = ["premise", "preparation"];
208
- // Settings that only some games have, or that only the setup asks: never asked for in play when missing.
209
- // The pictures: status asks for them once, only where they can be made (D-308).
210
- // How the master writes: the core's own until the player chooses (D-395).
211
- const styleSettingNames = ["prose", "story", "author", "style"];
212
- const optionalSettingNames = ["coins", "pictures", "effort", "voices", "calendar", "calendar-start", ...entrySettingNames, ...setupSettingNames, ...premiseSettingNames, ...styleSettingNames];
213
50
  export function readSettings(root) {
214
51
  return validateSettings(readYamlValues(join(root, campaignFileName), settingsHold));
215
52
  }
216
- /** The coins as campaign.yaml writes them, unchecked and read on their own, so that a mistake in another setting does not hide them; the money module checks them (MON-1). */
217
- export function readCoinsSetting(root) {
218
- return readOneSetting(root, "coins");
219
- }
220
53
  /**
221
54
  * A text setting as campaign.yaml writes it, such as the system or the language, read even when another setting breaks the file: YAML still gives the keys it can (SYS-1).
222
55
  * Undefined when it is missing, not text, or the file cannot be read.
@@ -240,6 +73,7 @@ export function readListSetting(root, name) {
240
73
  return [];
241
74
  }
242
75
  }
76
+ /** One setting as campaign.yaml writes it, unchecked and read on its own, so that a mistake in another does not hide it, as the coins (MON-1). */
243
77
  export function readOneSetting(root, name) {
244
78
  const values = readYamlValues(join(root, campaignFileName), settingsHold);
245
79
  return values !== null && typeof values === "object" ? values[name] : undefined;
@@ -435,6 +269,169 @@ export function checkSettingName(name) {
435
269
  }
436
270
  return name;
437
271
  }
272
+ /** A rigor's meaning with what the game counts itself said (review of 17 October): a game that counts no food is never promised it. */
273
+ function rigorMeaning(rigor, counted) {
274
+ const meaning = rigorMeanings[rigor];
275
+ const burns = counted?.burning === undefined ? "" : `an effect named after what burns, such as ${counted.burning}, spends it as it is lit`;
276
+ if (meaning === undefined || rigor === "simulation" || counted === undefined) {
277
+ return meaning;
278
+ }
279
+ if (rigor === "smooth") {
280
+ return burns === "" ? meaning : `${meaning}; a light you put on as an effect, as a ${counted.burning}, still spends one`;
281
+ }
282
+ const food = counted.upkeep ? "advance spends the day's food outside a settlement; water, lifestyle and wages are yours to charge" : "";
283
+ const counts = [food, burns].filter((part) => part !== "").join("; ");
284
+ return counts === "" ? meaning : meaning.replace("charge with change what is used up; ", `charge with change what is used up; ${counts}; `);
285
+ }
286
+ /** How much the master teaches the game, out of the story (D-347): the story alone, a hint now and then, or each rule as it first comes up. */
287
+ export const mentorWays = ["off", "hints", "tutorial"];
288
+ /** What each way of the mentor means to the master, which config gives for the chosen one, and the player's change of it on the dashboard (D-347). */
289
+ const mentorMeanings = {
290
+ off: "the story alone: no tips or explanations of yours, only your answers to what the player asks between brackets",
291
+ hints: "a tip of a sentence or two, in brackets, before a choice that matters and when a rule slips by, as the mentor's part of your instructions says; no lessons",
292
+ tutorial: "each mechanic explained the first time it comes up, the whole sum of a roll shown, a debrief after fights and at the end of a session, "
293
+ + "as the mentor's part of your instructions says",
294
+ };
295
+ /** Who rolls the player character's dice (D-241): rpg, or the player with their own, telling the values; the master's are always rolled by rpg. */
296
+ export const diceWays = ["digital", "physical"];
297
+ /** Whether the master's rolls for anyone outside the party are hidden (D-287): behind the screen, unset too, or in view; the party's are always shown. */
298
+ export const masterRollWays = ["behind the screen", "in view"];
299
+ /**
300
+ * Who voices the characters (D-490), where the AI app has subagents: a character as a subagent of its own at key moments, the master chooses (auto); the master
301
+ * always; always for the companions and the main characters; always for everyone.
302
+ */
303
+ export const voiceWays = ["master", "auto", "important", "always"];
304
+ export { unitSystems };
305
+ /** Which pictures the engine has made, where it can (D-308, D-388, D-420): none, only those the player asks for, or one for each new place, quest and one met. */
306
+ export const pictureWays = ["none", "on request", "new elements"];
307
+ /** How much the master thinks before each answer, written for each AI app in the campaign's folder (D-462). */
308
+ export const efforts = ["low", "medium", "high"];
309
+ /** How the companions come (D-76, D-221): none, made in session zero with the player or by the master, or met in play. */
310
+ export const companionWays = ["none", "made with the player", "made by the master", "met in play"];
311
+ /** How far ahead a world without a written campaign is made (D-80): as it is needed, or all at the start. */
312
+ export const preparations = ["on the fly", "all at the start"];
313
+ /** How the master writes (D-395): plain, the core's own, literary, pulp or wry; the tone stays in the premise, and an author takes its place. */
314
+ export const proseWays = ["plain", "literary", "pulp", "wry"];
315
+ /** How the master builds what they invent (D-395): situations, the core's own, arcs, episodes or a mystery; a written adventure keeps its own. */
316
+ export const storyWays = ["situations", "arcs", "episodes", "mystery"];
317
+ /** The settings with a closed list of values, each with them: those a game system may offer only some of (DAT-16). */
318
+ export const closedSettings = {
319
+ difficulty: difficulties,
320
+ lethality: lethalities,
321
+ saves: saveModes,
322
+ rigor: rigors,
323
+ mentor: mentorWays,
324
+ dice: diceWays,
325
+ "master-rolls": masterRollWays,
326
+ voices: voiceWays,
327
+ units: unitSystems,
328
+ pictures: pictureWays,
329
+ effort: efforts,
330
+ companions: companionWays,
331
+ preparation: preparations,
332
+ prose: proseWays,
333
+ story: storyWays,
334
+ };
335
+ /** The longest text the player's own words of how the master writes may be, by setting (D-395). */
336
+ export const styleTextLengths = { author: 80, style: 300 };
337
+ /** What each way of writing and of building the story means to the master, which config gives for the chosen one (D-395). */
338
+ const styleMeanings = {
339
+ prose: {
340
+ plain: "short sentences, one concrete detail a thing, as your instructions write",
341
+ literary: "more room at the high points, images and subtext, as the prose part of your instructions says",
342
+ pulp: "tense action, strong colours, every message ending on a threat or a hook, as the prose part of your instructions says",
343
+ wry: "a narrator with a half smile at the world, never at the character, as the prose part of your instructions says",
344
+ },
345
+ story: {
346
+ situations: "a world of factions, threats with their clocks and places with secrets, no main plot, as your instructions write",
347
+ arcs: "a central threat that advances by stages, the party's own arcs woven in, as the story part of your instructions says",
348
+ episodes: "a story that closes each session, with a thread that comes back, as the story part of your instructions says",
349
+ mystery: "every story an investigation, its truth written first in the secrets, as the story part of your instructions says",
350
+ },
351
+ };
352
+ /** An item of a list setting. Written by hand without quotes, "Poisoned: la benda…" is YAML for a pair: it is read as the text it was meant to be (D-179). */
353
+ const listItem = z.preprocess((item) => pairText(item) ?? item, z.string().min(1));
354
+ /** A list setting; an empty item written by hand, as - "", holds nothing and is left out, so that it never stops the game. */
355
+ const listSetting = z.preprocess((items) => (Array.isArray(items) ? items.filter((item) => item !== null && String(item).trim() !== "") : items), z.array(listItem)).nullish();
356
+ /** The player's own words in a setting, on one line: a line break in them would be read as a heading of the instructions they go into (D-395). */
357
+ function oneLine(most) {
358
+ return z.preprocess((value) => (typeof value === "string" ? value.replace(/\s+/g, " ").trim() : value), z.string().min(1).max(most));
359
+ }
360
+ /** The settings of a campaign, kept in campaign.yaml. Other keys are kept: systems and extensions will add their own. */
361
+ export const settingsSchema = z.object({
362
+ name: z.string().min(1).describe("name of the campaign"),
363
+ language: z.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/, "use a language code such as it, en or pt-BR").optional().describe("language of the game, as a code such as it or en"),
364
+ system: z.string().min(1).optional().describe("game system of the campaign: one of those installed"),
365
+ mentor: z.enum(mentorWays).optional().describe("how much the master teaches the game, out of the story: off, hints or tutorial; asked as how well the player knows the game: never played (tutorial), a little (hints), well (off)"),
366
+ premise: z.string().min(1).optional().describe("without a written campaign: the genre, the tone, a few elements of the world and what the player enjoys most in a game, such as fights, mysteries, talk or exploring, in the player's words"),
367
+ preparation: z.enum(preparations).optional().describe("without a written campaign: on the fly (the master makes the world just before it is needed) or all at the start"),
368
+ prose: z.enum(proseWays).optional().describe("how the master writes, as the player chose it: plain, literary, pulp or wry; the tone stays in the premise; an author takes its place"),
369
+ story: z.enum(storyWays).optional().describe("how the master builds what they invent: situations, arcs, episodes or mystery; a written adventure keeps its own"),
370
+ author: oneLine(styleTextLengths.author).optional().describe("an author the master writes like, as the player named them: their way, never their sentences, names or places"),
371
+ style: oneLine(styleTextLengths.style).optional().describe("the player's own wishes for how the master writes, in a few words, such as third person, past tense"),
372
+ difficulty: z.enum(difficulties).optional().describe(`how hard the world plays: ${difficulties.join(", ")}`),
373
+ lethality: z.enum(lethalities).optional().describe("what a fall means: narrative (the character never dies), epic (only when it matters) or dice (the dice decide)"),
374
+ saves: z.enum(saveModes).optional().describe("when the game may go back: permadeath (never, but to the start, the campaign starting over), checkpoint (to the last end of a scene, once the player character dies) or free (to any save, and saves when the player asks)"),
375
+ rigor: z.enum(rigors).optional().describe("how closely travel, fatigue, food and the like follow the rules: smooth (the master glosses over them), rules (as written) or simulation (beyond them)"),
376
+ dice: z.enum(diceWays).optional().describe("the player character's dice: digital (rpg rolls them) or physical (the player rolls their own and tells the values)"),
377
+ "master-rolls": z.enum(masterRollWays).optional().describe("the master's rolls for foes and anyone else outside the party: behind the screen (roll hides them, the master telling only the outcome) or in view (roll shows them); "
378
+ + "the party's rolls are always shown; unset, behind the screen"),
379
+ units: z.enum(unitSystems).optional().describe("the units of measure of the story: metric or imperial"),
380
+ voices: z.enum(voiceWays).optional().describe("who voices the characters, where the AI app has subagents, from the master to the characters: master (the master, always), auto (at key moments, as the master chooses, "
381
+ + "a character answers as a subagent of its own, knowing only what it knows), important (always a subagent for the companions and the characters with kind main), "
382
+ + "always (always a subagent, for everyone); unset, auto"),
383
+ companions: z.enum(companionWays).optional().describe("how the companions come: none, made with the player or made by the master in session zero, or met in play"),
384
+ // Checked by the time module against the calendar (TIM-8).
385
+ "calendar-start": z.string().min(1).optional().describe("when the story starts: day 1 to count only the days, or the day of the world's calendar that is day 1, such as 14 April 1491"),
386
+ // new places and new places and quests, as campaigns wrote it before quests and then those met had pictures, are read as the value that took their place (D-388, D-420).
387
+ pictures: z.preprocess((value) => (value === "new places" || value === "new places and quests" ? "new elements" : value), z.enum(pictureWays)).optional().describe("the pictures of places, quests and those met the engine has made on this computer, which spend the player's plan, Codex's or Claude's: none, on request (those the player asks for) "
388
+ + "or new elements (one for each new place and quest, and for each character and kind of creature the character meets)"),
389
+ effort: z.enum(efforts).optional().describe("how much the master thinks before each answer, the player's to choose: low, medium or high, written where Claude Code and Codex read it in the campaign's folder; "
390
+ + "unset, each app keeps its own"),
391
+ lines: listSetting.describe("what never appears in the game"),
392
+ veils: listSetting.describe("what happens only off screen, without details"),
393
+ table: listSetting.describe("the table's agreements: what the master promised about how the game is played"),
394
+ precedents: listSetting.describe("the rulings made without the text, each starting with the name of the rule in the system's language: Poisoned: …"),
395
+ learned: listSetting.describe("the game's mechanics the master has explained, by their names in the system's language: explained again only when the player gets one wrong"),
396
+ library: listSetting.describe("the player's library (D-491): folders of their books, or books, by full path, which rules searches after the game system"),
397
+ // Checked by the money module (MON-1): coins written wrongly by hand must not stop the other settings from being read.
398
+ coins: z.unknown().optional().describe("the coins, for a game with money: each with its value in the smallest coin, such as gp 100, sp 10, cp 1"),
399
+ // Checked by the time module (TIM-8): a mistake there never stops the game, whose date stays day N.
400
+ calendar: z.unknown().optional().describe("the months of the campaign's own calendar, in place of the real ones and an extension's: months: [{name: January, days: 31, season: winter}, ...]"),
401
+ // What the campaign adds to its game system (CAM-1): checked by the systems module when it reads the system with them, so that a mistake there never hides the
402
+ // other settings.
403
+ fields: z.unknown().optional().describe("fields the campaign adds to its game system, by name with their kind, such as omens: rolls"),
404
+ tables: z.unknown().optional().describe("tables the campaign adds to its game system, by name, such as bulwark-dice-by-level: {3: 4, 7: 5, 15: 6}"),
405
+ computed: z.unknown().optional().describe("formulas the campaign adds to its game system or puts in place of its own, as a house rule, by field"),
406
+ counters: z.unknown().optional().describe("counters the campaign adds to its game system or changes: their limits and what comes back with a rest, by name"),
407
+ recipes: z.unknown().optional().describe("what the campaign adds to the rests of its game system, by recipe, such as rest: {set: {bulwark-dice: max}}"),
408
+ "status-line": z.unknown().optional().describe("fields the campaign adds to the line of the player character and the companions, such as omens?"),
409
+ travel: z.unknown().optional().describe("what the campaign adds to how its game system travels, by key: paces, hours, terrain and kinds of road, such as kinds: {canal: {}}"),
410
+ values: z.unknown().optional().describe("names the campaign adds to the closed lists of its game system, by field, such as languages: [Lingua dei Guadi]"),
411
+ "condition-icons": z.unknown().optional().describe("the drawings of effects on the dashboard by their names, over the game system's: the d of an SVG path on a grid of 24, such as Benedizione: M12 3v18"),
412
+ // Checked against the campaign's extensions when it is written (D-502): one written wrongly by hand leaves the extension's place.
413
+ widgets: z.unknown().optional().describe("where the dashboard shows the extensions' widgets, by extension.widget: top, side, scene, sheet, world, journal or off, such as weather.today: side"),
414
+ }).loose();
415
+ /** The settings that the config command shows and changes. */
416
+ export const settingNames = Object.keys(settingsSchema.shape);
417
+ /** The settings that hold a list, changed one item at a time; none of them is ever missing in play. */
418
+ export const listSettingNames = ["lines", "veils", "table", "precedents", "learned", "library", "status-line"];
419
+ /** The settings that hold entries by name, what the campaign adds to its game system (CAM-1): given or removed one entry at a time. */
420
+ export const mapSettingNames = ["fields", "tables", "computed", "counters", "recipes", "travel", "values", "condition-icons"];
421
+ /** The settings that hold entries by name: what the campaign adds to its game system, and where the dashboard shows the extensions' widgets (D-502). */
422
+ export const entrySettingNames = [...mapSettingNames, "widgets"];
423
+ /**
424
+ * What only the setup asks (D-241, MOD-3, D-347, D-287): how much the master teaches the game, whether the master's rolls are shown, how the companions come,
425
+ * when the story starts, and the lines and veils, which "none" answers too.
426
+ */
427
+ export const setupSettingNames = ["mentor", "master-rolls", "companions", "calendar-start", "lines", "veils"];
428
+ /** What the setup asks only of a campaign without a written world (D-79, D-80, MOD-3). */
429
+ const premiseSettingNames = ["premise", "preparation"];
430
+ // Settings that only some games have, or that only the setup asks: never asked for in play when missing.
431
+ // The pictures: status asks for them once, only where they can be made (D-308).
432
+ // How the master writes: the core's own until the player chooses (D-395).
433
+ const styleSettingNames = ["prose", "story", "author", "style"];
434
+ const optionalSettingNames = ["coins", "pictures", "effort", "voices", "calendar", "calendar-start", ...entrySettingNames, ...setupSettingNames, ...premiseSettingNames, ...styleSettingNames];
438
435
  /** The YAML list of a list setting, edited in place so that its comments stay; created when missing. */
439
436
  function listNode(document, setting) {
440
437
  const node = document.get(setting, true);
@@ -5,15 +5,15 @@ const args = process.argv.slice(2);
5
5
  // is Claude Code's doorbell for the player's sentences on the dashboard (D-495); everything else is a command.
6
6
  if (args.length === 1 && args[0] === "mcp") {
7
7
  // The server and its SDK load only here: every other command starts faster without them (D-194).
8
- const { startMcpServer } = await import("./mcp-server.js");
8
+ const { startMcpServer } = await import("../server/mcp.js");
9
9
  await startMcpServer();
10
10
  }
11
11
  else if (args[0] === "--read-library") {
12
- const { readLibraryHere } = await import("./library-reader.js");
12
+ const { readLibraryHere } = await import("../commands/shared/library-reader.js");
13
13
  await readLibraryHere();
14
14
  }
15
15
  else if (args.length === 1 && args[0] === "--listen") {
16
- const { listenHere } = await import("./bell-listener.js");
16
+ const { listenHere } = await import("../server/bell-listener.js");
17
17
  await listenHere();
18
18
  }
19
19
  else {
@@ -1,4 +1,4 @@
1
- import { type Context } from "./core/context.ts";
1
+ import { type Context } from "../core/context.ts";
2
2
  export interface CommandLineResult {
3
3
  output: string;
4
4
  exitCode: number;
@@ -1,21 +1,21 @@
1
1
  import { parseArgs } from "node:util";
2
2
  import { z } from "zod";
3
- import { findCampaign } from "./campaign/index.js";
4
- import { loadCampaignCode, packageCommands } from "./commands/game-package-code.js";
5
- import { commands } from "./commands/index.js";
6
- import { systemConfirm } from "./confirm/index.js";
7
- import { defaultContext, packagesFolder } from "./core/context.js";
8
- import { downloadBytes } from "./core/download.js";
9
- import { withExamples } from "./core/examples.js";
10
- import { baseType, isBoolean, isList } from "./core/registry.js";
11
- import { FileStore, withFiles } from "./core/store.js";
12
- import { firstSentence } from "./core/text.js";
13
- import { getVersion } from "./core/version.js";
14
- import { systemPageReader } from "./documents/index.js";
15
- import { npmPackages } from "./extensions/index.js";
16
- import { libraryRunner } from "./library-reader.js";
17
- import { hostPictures, hostReader } from "./pictures/index.js";
18
- import { loadSystemCode } from "./systems/index.js";
3
+ import { findCampaign } from "../campaign/index.js";
4
+ import { commands } from "../commands/index.js";
5
+ import { libraryRunner } from "../commands/shared/library-reader.js";
6
+ import { loadCampaignCode, packageCommands } from "../commands/shared/packages/code.js";
7
+ import { systemConfirm } from "../confirm/index.js";
8
+ import { defaultContext, packagesFolder } from "../core/context.js";
9
+ import { downloadBytes } from "../core/download.js";
10
+ import { withExamples } from "../core/examples.js";
11
+ import { baseType, commandLineFieldProblem, isBoolean, isList } from "../core/registry.js";
12
+ import { FileStore, withFiles } from "../core/store.js";
13
+ import { firstSentence } from "../core/text.js";
14
+ import { getVersion } from "../core/version.js";
15
+ import { systemPageReader } from "../documents/index.js";
16
+ import { hostPictures, hostReader } from "../helpers/index.js";
17
+ import { npmPackages } from "../packages/index.js";
18
+ import { loadSystemCode } from "../systems/index.js";
19
19
  // The one command that exists only on the command line: cli.ts starts the server when it comes alone.
20
20
  const mcpDescription = "Start the MCP server for an AI host. Through it the host uses these commands as tools; the host starts it, with no options.";
21
21
  /** The core's commands that call the hooks of the campaign's packages after their writes (D-514). */
@@ -80,9 +80,10 @@ function readArguments(command, args) {
80
80
  const positionals = command.positionals ?? [];
81
81
  const options = { json: { type: "boolean" } };
82
82
  for (const [name, field] of inputFields(command)) {
83
- // --no-x turns x off: a field named no-x would be lost, as an extension's might be (review of 25 October).
84
- if (name.startsWith("no-")) {
85
- throw new Error(`${command.name} has a field named ${name}, and none may start with no-, which the command line reads as turning ${name.slice(3)} off: rename it.`);
83
+ // A field the command line reads as something else would be lost, as an extension's might be.
84
+ const problem = commandLineFieldProblem(command.name, name, positionals.includes(name));
85
+ if (problem !== undefined) {
86
+ throw new Error(problem);
86
87
  }
87
88
  if (!positionals.includes(name)) {
88
89
  options[name] = { type: isBoolean(field) ? "boolean" : "string", multiple: isList(field) };
@@ -143,7 +144,7 @@ async function campaignCommands(context) {
143
144
  try {
144
145
  return await withFiles(context.files ?? new FileStore(context.systemFolders), async () => {
145
146
  const root = findCampaign(context.folder);
146
- return root === undefined ? [] : (await packageCommands(root, context, commands.map((command) => command.name))).commands;
147
+ return root === undefined ? [] : (await packageCommands(root, context)).commands;
147
148
  });
148
149
  }
149
150
  catch {
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { type TimePassed } from "./game-advance.ts";
2
+ import { type TimePassed } from "./shared/advance.ts";
3
3
  export declare const advance: import("../core/registry.ts").Command<z.ZodObject<{
4
4
  by: z.ZodOptional<z.ZodString>;
5
5
  to: z.ZodOptional<z.ZodString>;
@@ -3,13 +3,13 @@ import { changeState, requireCampaign } from "../campaign/index.js";
3
3
  import { appendLogEntry } from "../core/log.js";
4
4
  import { defineCommand } from "../core/registry.js";
5
5
  import { addDuration, formatDuration, formatGameDate, lastGameDay, minutesBetween, readDuration, readGameDate } from "../time/index.js";
6
- import { calendarText, nextAfter, passedLines, passTime, unreadNotes } from "./game-advance.js";
7
- import { newStateChecks } from "./game-checks.js";
8
- import { dueEvents, dueText, isDated, plannedEvents } from "./game-events.js";
9
- import { timePassedLines } from "./game-package-code.js";
10
- import { newDatedLogEntry, presentDate } from "./game-time.js";
11
- import { campaignWorld } from "./game-world.js";
12
- import { firstInChat } from "./parts.js";
6
+ import { calendarText, nextAfter, passedLines, passTime, unreadNotes } from "./shared/advance.js";
7
+ import { newStateChecks } from "./shared/checks.js";
8
+ import { dueEvents, dueText, isDated, plannedEvents } from "./shared/events.js";
9
+ import { timePassedLines } from "./shared/packages/code.js";
10
+ import { firstInChat } from "./shared/parts.js";
11
+ import { newDatedLogEntry, presentDate } from "./shared/time.js";
12
+ import { campaignWorld } from "./shared/world.js";
13
13
  export const advance = defineCommand({
14
14
  name: "advance",
15
15
  description: "Let time pass in the story, whenever it does, before you narrate it: by a duration or to a later game date. "
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { CardAsked, Context, Rows, Said } from "../core/context.ts";
2
+ import type { CardAsked, Context } from "../core/context.ts";
3
3
  type InWords = {
4
4
  kind: "unanswered" | "unavailable" | "absent" | "physical" | "dice in words";
5
5
  asked: string;
@@ -73,11 +73,4 @@ export declare function tonesOf(given: unknown[] | undefined, faces: number[]):
73
73
  };
74
74
  /** Whether a text is the dice of a check, as 1d20+5 or 1d20+athletics (ASK-2, ASK-12). */
75
75
  export declare function isCheckDice(text: string): boolean;
76
- /**
77
- * The player's answer, on the dashboard's page and in the host's form at once, where both are (ASK-13, D-455): the first answer wins and takes the other
78
- * away; one that never showed, a page not open or a form the host does not show, leaves the other to answer. Neither shown is absent: the master asks in words.
79
- * A form shows `shown` in place of the labels, when they are as many and each its own.
80
- */
81
- export declare function chooseAnswer(context: Context, question: string, title: string, labels: string[], rows?: Rows, shown?: string[]): Promise<Answer>;
82
- type Answer = number | Said | undefined | "unavailable" | "absent";
83
76
  export {};