briyah 2.0.2 → 2.0.4

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 (477) hide show
  1. package/LICENSE +216 -0
  2. package/README.md +43 -7
  3. package/data/common/config/LICENSE-model-prices.md +65 -0
  4. package/data/common/config/markup +1 -1
  5. package/data/common/config/model_prices.json +47443 -46295
  6. package/data/common/prompts/narrator/create_story.prompt +2 -0
  7. package/data/packs/dnd5e/agents/player.json +11 -11
  8. package/data/packs/dnd5e/prompts/character_creator/defaults_config.json +21 -20
  9. package/data/packs/dnd5e/prompts/character_creator/perceive.prompt +19 -12
  10. package/data/packs/dnd5e/prompts/dnd_player/perceive.prompt +10 -6
  11. package/dist-sdk/server/src/ai/LLM/anthropic.service.d.ts +103 -0
  12. package/dist-sdk/server/src/ai/LLM/anthropic.service.js +173 -2
  13. package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +172 -3
  14. package/dist-sdk/server/src/ai/LLM/base-ai.service.js +241 -5
  15. package/dist-sdk/server/src/ai/LLM/comfyui-client.d.ts +26 -0
  16. package/dist-sdk/server/src/ai/LLM/comfyui-client.js +25 -0
  17. package/dist-sdk/server/src/ai/LLM/comfyui-workflow.d.ts +54 -0
  18. package/dist-sdk/server/src/ai/LLM/comfyui-workflow.js +59 -1
  19. package/dist-sdk/server/src/ai/LLM/comfyui.service.d.ts +21 -1
  20. package/dist-sdk/server/src/ai/LLM/comfyui.service.js +25 -1
  21. package/dist-sdk/server/src/ai/LLM/deepseek.service.d.ts +52 -0
  22. package/dist-sdk/server/src/ai/LLM/deepseek.service.js +102 -3
  23. package/dist-sdk/server/src/ai/LLM/fal.service.d.ts +25 -0
  24. package/dist-sdk/server/src/ai/LLM/fal.service.js +55 -1
  25. package/dist-sdk/server/src/ai/LLM/googleai.service.d.ts +19 -0
  26. package/dist-sdk/server/src/ai/LLM/googleai.service.js +42 -1
  27. package/dist-sdk/server/src/ai/LLM/grok.service.d.ts +22 -0
  28. package/dist-sdk/server/src/ai/LLM/grok.service.js +54 -2
  29. package/dist-sdk/server/src/ai/LLM/mock.service.js +31 -4
  30. package/dist-sdk/server/src/ai/LLM/openai.service.d.ts +30 -0
  31. package/dist-sdk/server/src/ai/LLM/openai.service.js +80 -2
  32. package/dist-sdk/server/src/ai/LLM/self-hosted.service.d.ts +21 -0
  33. package/dist-sdk/server/src/ai/LLM/self-hosted.service.js +44 -2
  34. package/dist-sdk/server/src/ai/LLM/together.service.d.ts +30 -0
  35. package/dist-sdk/server/src/ai/LLM/together.service.js +60 -2
  36. package/dist-sdk/server/src/ai/agent-config.d.ts +15 -0
  37. package/dist-sdk/server/src/ai/agent-factory.d.ts +16 -0
  38. package/dist-sdk/server/src/ai/agent-factory.js +20 -0
  39. package/dist-sdk/server/src/ai/agent-message.service.d.ts +30 -0
  40. package/dist-sdk/server/src/ai/agent-message.service.js +30 -0
  41. package/dist-sdk/server/src/ai/agent-store.service.d.ts +80 -0
  42. package/dist-sdk/server/src/ai/agent-store.service.js +166 -5
  43. package/dist-sdk/server/src/ai/agent.d.ts +196 -0
  44. package/dist-sdk/server/src/ai/agent.js +224 -11
  45. package/dist-sdk/server/src/ai/ai-debug-logger.d.ts +18 -0
  46. package/dist-sdk/server/src/ai/ai-debug-logger.js +19 -0
  47. package/dist-sdk/server/src/ai/ai-factory.service.d.ts +9 -0
  48. package/dist-sdk/server/src/ai/ai-factory.service.js +9 -0
  49. package/dist-sdk/server/src/ai/artifact.service.d.ts +131 -0
  50. package/dist-sdk/server/src/ai/artifact.service.js +148 -3
  51. package/dist-sdk/server/src/ai/attached-file.service.d.ts +87 -0
  52. package/dist-sdk/server/src/ai/attached-file.service.js +105 -0
  53. package/dist-sdk/server/src/ai/model_prices.d.ts +30 -0
  54. package/dist-sdk/server/src/ai/model_prices.js +91 -5
  55. package/dist-sdk/server/src/ai/pack-artifacts.d.ts +84 -0
  56. package/dist-sdk/server/src/ai/pack-artifacts.js +168 -0
  57. package/dist-sdk/server/src/ai/published-agents.service.d.ts +25 -0
  58. package/dist-sdk/server/src/ai/published-agents.service.js +30 -3
  59. package/dist-sdk/server/src/app/balance-message.service.d.ts +24 -0
  60. package/dist-sdk/server/src/app/balance-message.service.js +24 -0
  61. package/dist-sdk/server/src/app/balance.module.d.ts +4 -0
  62. package/dist-sdk/server/src/app/balance.module.js +4 -0
  63. package/dist-sdk/server/src/app/balance.service.d.ts +37 -0
  64. package/dist-sdk/server/src/app/balance.service.js +54 -0
  65. package/dist-sdk/server/src/app/stripe.controller.d.ts +21 -0
  66. package/dist-sdk/server/src/app/stripe.controller.js +35 -0
  67. package/dist-sdk/server/src/app/stripe.service.d.ts +43 -0
  68. package/dist-sdk/server/src/app/stripe.service.js +62 -0
  69. package/dist-sdk/server/src/app/transaction.service.d.ts +27 -0
  70. package/dist-sdk/server/src/app/transaction.service.js +36 -0
  71. package/dist-sdk/server/src/app/user-service-factory.d.ts +8 -0
  72. package/dist-sdk/server/src/app/user-service-factory.js +38 -1
  73. package/dist-sdk/server/src/app/user-service-manager.d.ts +27 -0
  74. package/dist-sdk/server/src/app/user-service-manager.js +43 -0
  75. package/dist-sdk/server/src/app.controller.d.ts +87 -0
  76. package/dist-sdk/server/src/app.controller.js +272 -12
  77. package/dist-sdk/server/src/app.module.js +28 -6
  78. package/dist-sdk/server/src/app.service.d.ts +1662 -0
  79. package/dist-sdk/server/src/app.service.js +1862 -6
  80. package/dist-sdk/server/src/auth/agent-access.decorator.d.ts +17 -0
  81. package/dist-sdk/server/src/auth/agent-access.decorator.js +17 -0
  82. package/dist-sdk/server/src/auth/auth.controller.js +46 -0
  83. package/dist-sdk/server/src/auth/auth.module.js +3 -2
  84. package/dist-sdk/server/src/auth/auth.service.d.ts +33 -0
  85. package/dist-sdk/server/src/auth/auth.service.js +39 -3
  86. package/dist-sdk/server/src/auth/jwt-auth.guard.js +18 -0
  87. package/dist-sdk/server/src/auth/jwt.strategy.js +2 -2
  88. package/dist-sdk/server/src/auth/owner-only.decorator.d.ts +9 -0
  89. package/dist-sdk/server/src/auth/owner-only.decorator.js +9 -0
  90. package/dist-sdk/server/src/auth/phone-validation.service.d.ts +25 -0
  91. package/dist-sdk/server/src/auth/phone-validation.service.js +30 -0
  92. package/dist-sdk/server/src/auth/rate-limit.service.d.ts +19 -0
  93. package/dist-sdk/server/src/auth/rate-limit.service.js +24 -0
  94. package/dist-sdk/server/src/auth/room-access.decorator.d.ts +8 -0
  95. package/dist-sdk/server/src/auth/room-access.decorator.js +8 -0
  96. package/dist-sdk/server/src/auth/scopes.decorator.d.ts +7 -0
  97. package/dist-sdk/server/src/auth/scopes.decorator.js +7 -0
  98. package/dist-sdk/server/src/auth/scopes.guard.d.ts +16 -0
  99. package/dist-sdk/server/src/auth/scopes.guard.js +30 -0
  100. package/dist-sdk/server/src/auth/session.guard.d.ts +4 -0
  101. package/dist-sdk/server/src/auth/session.guard.js +8 -0
  102. package/dist-sdk/server/src/auth/twilio.service.d.ts +27 -0
  103. package/dist-sdk/server/src/auth/twilio.service.js +30 -4
  104. package/dist-sdk/server/src/auth/users.service.d.ts +30 -0
  105. package/dist-sdk/server/src/auth/users.service.js +42 -0
  106. package/dist-sdk/server/src/common/errors.d.ts +20 -0
  107. package/dist-sdk/server/src/common/errors.js +21 -0
  108. package/dist-sdk/server/src/config/env-config.d.ts +7 -0
  109. package/dist-sdk/server/src/config/prompt-resolver.d.ts +180 -0
  110. package/dist-sdk/server/src/config/prompt-resolver.js +182 -0
  111. package/dist-sdk/server/src/config/user-config.service.d.ts +59 -0
  112. package/dist-sdk/server/src/config/user-config.service.js +57 -0
  113. package/dist-sdk/server/src/config/user-paths.service.d.ts +61 -0
  114. package/dist-sdk/server/src/config/user-paths.service.js +67 -0
  115. package/dist-sdk/server/src/documents/pdf-conversion.d.ts +121 -1
  116. package/dist-sdk/server/src/documents/pdf-conversion.js +94 -0
  117. package/dist-sdk/server/src/packs/pack-instantiation.service.d.ts +98 -0
  118. package/dist-sdk/server/src/packs/pack-instantiation.service.js +99 -0
  119. package/dist-sdk/server/src/packs/pack-manifest.d.ts +100 -0
  120. package/dist-sdk/server/src/packs/pack-manifest.js +58 -0
  121. package/dist-sdk/server/src/packs/pack.service.d.ts +99 -1
  122. package/dist-sdk/server/src/packs/pack.service.js +98 -1
  123. package/dist-sdk/server/src/room/artifact-store.service.d.ts +27 -0
  124. package/dist-sdk/server/src/room/artifact-store.service.js +49 -3
  125. package/dist-sdk/server/src/room/artifact.d.ts +18 -0
  126. package/dist-sdk/server/src/room/message.d.ts +64 -0
  127. package/dist-sdk/server/src/room/message.js +77 -2
  128. package/dist-sdk/server/src/room/nickname.d.ts +27 -0
  129. package/dist-sdk/server/src/room/nickname.js +41 -0
  130. package/dist-sdk/server/src/room/published-rooms.service.js +2 -0
  131. package/dist-sdk/server/src/room/room-config.d.ts +26 -0
  132. package/dist-sdk/server/src/room/room-factory.d.ts +12 -0
  133. package/dist-sdk/server/src/room/room-factory.js +14 -0
  134. package/dist-sdk/server/src/room/room-message.service.d.ts +28 -0
  135. package/dist-sdk/server/src/room/room-message.service.js +28 -0
  136. package/dist-sdk/server/src/room/room-store.service.d.ts +177 -0
  137. package/dist-sdk/server/src/room/room-store.service.js +242 -5
  138. package/dist-sdk/server/src/room/room.d.ts +906 -1
  139. package/dist-sdk/server/src/room/room.js +1525 -34
  140. package/dist-sdk/server/src/rpg/rpg-models.d.ts +50 -0
  141. package/dist-sdk/server/src/rpg/rpg-models.js +53 -0
  142. package/dist-sdk/server/src/rpg/rpg-roster.d.ts +38 -3
  143. package/dist-sdk/server/src/rpg/rpg-roster.js +49 -49
  144. package/dist-sdk/server/src/rpg/rpg.service.d.ts +87 -0
  145. package/dist-sdk/server/src/rpg/rpg.service.js +108 -5
  146. package/dist-sdk/server/src/sdk/briyah-config.d.ts +57 -0
  147. package/dist-sdk/server/src/sdk/briyah-config.js +17 -0
  148. package/dist-sdk/server/src/sdk/briyah.d.ts +228 -0
  149. package/dist-sdk/server/src/sdk/briyah.js +285 -7
  150. package/dist-sdk/server/src/sdk/index.d.ts +0 -1
  151. package/dist-sdk/server/src/sdk/index.js +24 -3
  152. package/dist-sdk/server/src/shared/shared.module.d.ts +8 -0
  153. package/dist-sdk/server/src/shared/shared.module.js +13 -5
  154. package/dist-sdk/server/src/story/story-message.service.d.ts +43 -0
  155. package/dist-sdk/server/src/story/story-message.service.js +43 -0
  156. package/dist-sdk/server/src/story/story-progress.service.d.ts +23 -0
  157. package/dist-sdk/server/src/story/story-progress.service.js +23 -0
  158. package/dist-sdk/server/src/story/story-store.service.d.ts +92 -0
  159. package/dist-sdk/server/src/story/story-store.service.js +136 -1
  160. package/dist-sdk/server/src/story/story.service.d.ts +398 -0
  161. package/dist-sdk/server/src/story/story.service.js +829 -25
  162. package/dist-sdk/server/src/tools/core/index.d.ts +25 -0
  163. package/dist-sdk/server/src/tools/core/index.js +31 -0
  164. package/dist-sdk/server/src/tools/core/rename.tool.d.ts +10 -0
  165. package/dist-sdk/server/src/tools/core/rename.tool.js +72 -0
  166. package/dist-sdk/server/src/tools/native-tool-registry.service.d.ts +22 -0
  167. package/dist-sdk/server/src/tools/native-tool-registry.service.js +22 -0
  168. package/dist-sdk/server/src/tools/native-tool.types.d.ts +186 -0
  169. package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.d.ts +29 -0
  170. package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.js +29 -0
  171. package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.d.ts +46 -0
  172. package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.js +40 -0
  173. package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.d.ts +33 -0
  174. package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.js +19 -0
  175. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.d.ts +37 -0
  176. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.d.ts +17 -0
  177. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.js +17 -0
  178. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.js +27 -0
  179. package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.d.ts +36 -0
  180. package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.js +32 -0
  181. package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.d.ts +32 -0
  182. package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.d.ts +13 -0
  183. package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.js +13 -0
  184. package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.js +18 -0
  185. package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.d.ts +54 -0
  186. package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.d.ts +13 -0
  187. package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.js +13 -0
  188. package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.js +20 -0
  189. package/dist-sdk/server/src/tools/packs/dnd5e/data/races.d.ts +36 -0
  190. package/dist-sdk/server/src/tools/packs/dnd5e/data/races.js +18 -0
  191. package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.d.ts +29 -0
  192. package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.d.ts +13 -0
  193. package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.js +13 -0
  194. package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.js +21 -0
  195. package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.d.ts +95 -0
  196. package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.js +66 -2
  197. package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.d.ts +50 -0
  198. package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.js +28 -0
  199. package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.d.ts +92 -0
  200. package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.js +152 -0
  201. package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.d.ts +28 -0
  202. package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.js +29 -0
  203. package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.d.ts +31 -0
  204. package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.js +36 -2
  205. package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.d.ts +261 -0
  206. package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.js +401 -0
  207. package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.d.ts +11 -0
  208. package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.js +11 -0
  209. package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.d.ts +65 -0
  210. package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.js +67 -0
  211. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.d.ts +73 -0
  212. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.js +63 -0
  213. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.d.ts +66 -0
  214. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.js +59 -0
  215. package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.d.ts +54 -0
  216. package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.js +49 -0
  217. package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.d.ts +42 -0
  218. package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.js +59 -0
  219. package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.d.ts +72 -0
  220. package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.js +63 -0
  221. package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.d.ts +57 -0
  222. package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.js +54 -0
  223. package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.d.ts +81 -0
  224. package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.js +85 -0
  225. package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.d.ts +60 -0
  226. package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.js +64 -0
  227. package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.d.ts +169 -0
  228. package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.js +203 -0
  229. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +192 -0
  230. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +144 -0
  231. package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.d.ts +56 -0
  232. package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.js +54 -0
  233. package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.d.ts +65 -0
  234. package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.js +73 -0
  235. package/dist-sdk/server/src/tools/packs/dnd5e/index.d.ts +18 -0
  236. package/dist-sdk/server/src/tools/packs/dnd5e/index.js +18 -0
  237. package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.d.ts +4 -0
  238. package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.js +116 -1
  239. package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.d.ts +14 -0
  240. package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.js +17 -0
  241. package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.d.ts +1 -0
  242. package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.js +35 -1
  243. package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.d.ts +6 -0
  244. package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.js +25 -0
  245. package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.d.ts +7 -0
  246. package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.js +13 -0
  247. package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.d.ts +8 -0
  248. package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.js +55 -0
  249. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +164 -0
  250. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +188 -1
  251. package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.d.ts +1 -0
  252. package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +125 -1
  253. package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.d.ts +13 -0
  254. package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.js +18 -0
  255. package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.d.ts +1 -0
  256. package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.js +23 -0
  257. package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.d.ts +1 -0
  258. package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.js +35 -0
  259. package/dist-sdk/server/src/tools/packs/index.d.ts +52 -2
  260. package/dist-sdk/server/src/tools/packs/index.js +83 -9
  261. package/dist-sdk/server/src/tools/shared/coerce.d.ts +95 -0
  262. package/dist-sdk/server/src/tools/shared/coerce.js +98 -0
  263. package/dist-sdk/server/src/tools/tool-execution.service.d.ts +73 -0
  264. package/dist-sdk/server/src/tools/tool-execution.service.js +74 -0
  265. package/dist-sdk/server/src/tools/tool-store.service.d.ts +11 -0
  266. package/dist-sdk/server/src/tools/tool-store.service.js +13 -1
  267. package/dist-sdk/shared/types/app.types.d.ts +285 -14
  268. package/dist-sdk/shared/types/app.types.js +3 -0
  269. package/package.json +167 -139
  270. package/data/common/config/random_words.txt +0 -2241
  271. package/data/common/story_ideas/biblical.json +0 -122
  272. package/data/common/story_ideas/fantasy.json +0 -82
  273. package/data/common/story_ideas/historical_fiction.json +0 -82
  274. package/data/common/story_ideas/science_fiction.json +0 -82
  275. package/data/packs/acts/agents/character-guide.json +0 -6
  276. package/data/packs/acts/agents/discipleship-mentor.json +0 -6
  277. package/data/packs/acts/agents/mentor-coach.json +0 -6
  278. package/data/packs/acts/agents/student.json +0 -13
  279. package/data/packs/acts/agents/table-moderator.json +0 -6
  280. package/data/packs/acts/artifacts/chapter-01-acts-1.md +0 -405
  281. package/data/packs/acts/artifacts/chapter-02-acts-2.md +0 -443
  282. package/data/packs/acts/artifacts/chapter-03-acts-3.md +0 -409
  283. package/data/packs/acts/artifacts/chapter-04-acts-4.md +0 -438
  284. package/data/packs/acts/artifacts/chapter-05-acts-5.md +0 -434
  285. package/data/packs/acts/artifacts/chapter-06-acts-6.md +0 -441
  286. package/data/packs/acts/artifacts/chapter-07-acts-7.md +0 -472
  287. package/data/packs/acts/artifacts/chapter-08-acts-8.md +0 -512
  288. package/data/packs/acts/artifacts/chapter-09-acts-9.md +0 -346
  289. package/data/packs/acts/artifacts/chapter-10-acts-10.md +0 -367
  290. package/data/packs/acts/artifacts/chapter-11-acts-11.md +0 -391
  291. package/data/packs/acts/artifacts/chapter-12-acts-12.md +0 -390
  292. package/data/packs/acts/artifacts/chapter-13-acts-13.md +0 -388
  293. package/data/packs/acts/artifacts/chapter-14-acts-14.md +0 -466
  294. package/data/packs/acts/artifacts/chapter-15-acts-15.md +0 -413
  295. package/data/packs/acts/artifacts/chapter-16-acts-16.md +0 -585
  296. package/data/packs/acts/artifacts/chapter-17-acts-17.md +0 -428
  297. package/data/packs/acts/artifacts/chapter-18-acts-18.md +0 -486
  298. package/data/packs/acts/artifacts/chapter-19-acts-19.md +0 -461
  299. package/data/packs/acts/artifacts/chapter-20-acts-20.md +0 -389
  300. package/data/packs/acts/artifacts/chapter-21-acts-21.md +0 -452
  301. package/data/packs/acts/artifacts/chapter-22-acts-22.md +0 -424
  302. package/data/packs/acts/artifacts/chapter-23-acts-23.md +0 -395
  303. package/data/packs/acts/artifacts/chapter-24-acts-24.md +0 -446
  304. package/data/packs/acts/artifacts/chapter-25-acts-25.md +0 -391
  305. package/data/packs/acts/artifacts/chapter-26-acts-26.md +0 -431
  306. package/data/packs/acts/artifacts/chapter-27-acts-27.md +0 -530
  307. package/data/packs/acts/artifacts/chapter-28-acts-28.md +0 -1871
  308. package/data/packs/acts/artifacts/chapters.manifest.json +0 -170
  309. package/data/packs/acts/artifacts/character_guide-creation.md +0 -112
  310. package/data/packs/acts/artifacts/discipleship_mentor-procedure.md +0 -154
  311. package/data/packs/acts/artifacts/discipleship_mentor-systems.md +0 -72
  312. package/data/packs/acts/artifacts/manifest.json +0 -197
  313. package/data/packs/acts/artifacts/stage-guide.md +0 -94
  314. package/data/packs/acts/pack.json +0 -6
  315. package/data/packs/acts/prompts/acts_player/defaults_config.json +0 -5
  316. package/data/packs/acts/prompts/acts_player/perceive.json +0 -29
  317. package/data/packs/acts/prompts/acts_player/perceive.prompt +0 -87
  318. package/data/packs/acts/prompts/acts_player/system_instruction.prompt +0 -0
  319. package/data/packs/acts/prompts/acts_room_moderator/defaults_config.json +0 -9
  320. package/data/packs/acts/prompts/acts_room_moderator/moderate.json +0 -34
  321. package/data/packs/acts/prompts/acts_room_moderator/moderate.prompt +0 -70
  322. package/data/packs/acts/prompts/acts_room_moderator/system_instruction.prompt +0 -0
  323. package/data/packs/acts/prompts/character_guide/defaults_config.json +0 -18
  324. package/data/packs/acts/prompts/character_guide/perceive.json +0 -29
  325. package/data/packs/acts/prompts/character_guide/perceive.prompt +0 -140
  326. package/data/packs/acts/prompts/character_guide/system_instruction.prompt +0 -0
  327. package/data/packs/acts/prompts/discipleship_mentor/defaults_config.json +0 -23
  328. package/data/packs/acts/prompts/discipleship_mentor/perceive.json +0 -33
  329. package/data/packs/acts/prompts/discipleship_mentor/perceive.prompt +0 -245
  330. package/data/packs/acts/prompts/discipleship_mentor/system_instruction.prompt +0 -0
  331. package/data/packs/acts/prompts/mentor_coach/defaults_config.json +0 -13
  332. package/data/packs/acts/prompts/mentor_coach/perceive.json +0 -29
  333. package/data/packs/acts/prompts/mentor_coach/perceive.prompt +0 -87
  334. package/data/packs/acts/prompts/mentor_coach/system_instruction.prompt +0 -0
  335. package/data/packs/acts/rooms/session.json +0 -14
  336. package/data/packs/acts/rooms/training.json +0 -58
  337. package/dist-sdk/server/src/tools/packs/acts/data/cards.d.ts +0 -53
  338. package/dist-sdk/server/src/tools/packs/acts/data/cards.js +0 -54
  339. package/dist-sdk/server/src/tools/packs/acts/data/character-cards.generated.d.ts +0 -2
  340. package/dist-sdk/server/src/tools/packs/acts/data/character-cards.generated.js +0 -185
  341. package/dist-sdk/server/src/tools/packs/acts/data/encounters.d.ts +0 -12
  342. package/dist-sdk/server/src/tools/packs/acts/data/encounters.js +0 -102
  343. package/dist-sdk/server/src/tools/packs/acts/data/event-cards.generated.d.ts +0 -2
  344. package/dist-sdk/server/src/tools/packs/acts/data/event-cards.generated.js +0 -196
  345. package/dist-sdk/server/src/tools/packs/acts/data/item-cards.generated.d.ts +0 -2
  346. package/dist-sdk/server/src/tools/packs/acts/data/item-cards.generated.js +0 -1311
  347. package/dist-sdk/server/src/tools/packs/acts/engine/cards.d.ts +0 -5
  348. package/dist-sdk/server/src/tools/packs/acts/engine/cards.js +0 -27
  349. package/dist-sdk/server/src/tools/packs/acts/engine/challenge.d.ts +0 -37
  350. package/dist-sdk/server/src/tools/packs/acts/engine/challenge.js +0 -120
  351. package/dist-sdk/server/src/tools/packs/acts/engine/dice.d.ts +0 -20
  352. package/dist-sdk/server/src/tools/packs/acts/engine/dice.js +0 -41
  353. package/dist-sdk/server/src/tools/packs/acts/engine/sheet.d.ts +0 -54
  354. package/dist-sdk/server/src/tools/packs/acts/engine/sheet.js +0 -200
  355. package/dist-sdk/server/src/tools/packs/acts/index.d.ts +0 -2
  356. package/dist-sdk/server/src/tools/packs/acts/index.js +0 -24
  357. package/dist-sdk/server/src/tools/packs/acts/tools/award.tool.d.ts +0 -2
  358. package/dist-sdk/server/src/tools/packs/acts/tools/award.tool.js +0 -184
  359. package/dist-sdk/server/src/tools/packs/acts/tools/challenge.tool.d.ts +0 -2
  360. package/dist-sdk/server/src/tools/packs/acts/tools/challenge.tool.js +0 -107
  361. package/dist-sdk/server/src/tools/packs/acts/tools/chapter.tool.d.ts +0 -3
  362. package/dist-sdk/server/src/tools/packs/acts/tools/chapter.tool.js +0 -146
  363. package/dist-sdk/server/src/tools/packs/acts/tools/check.tool.d.ts +0 -4
  364. package/dist-sdk/server/src/tools/packs/acts/tools/check.tool.js +0 -241
  365. package/dist-sdk/server/src/tools/packs/acts/tools/encounter.tool.d.ts +0 -3
  366. package/dist-sdk/server/src/tools/packs/acts/tools/encounter.tool.js +0 -72
  367. package/dist-sdk/server/src/tools/packs/acts/tools/faith.tool.d.ts +0 -2
  368. package/dist-sdk/server/src/tools/packs/acts/tools/faith.tool.js +0 -75
  369. package/dist-sdk/server/src/tools/packs/acts/tools/shared.d.ts +0 -20
  370. package/dist-sdk/server/src/tools/packs/acts/tools/shared.js +0 -70
  371. package/dist-sdk/server/src/tools/packs/acts/tools/sheet.tools.d.ts +0 -4
  372. package/dist-sdk/server/src/tools/packs/acts/tools/sheet.tools.js +0 -215
  373. package/docs/.nojekyll +0 -1
  374. package/docs/assets/hierarchy.js +0 -1
  375. package/docs/assets/highlight.css +0 -113
  376. package/docs/assets/icons.js +0 -18
  377. package/docs/assets/icons.svg +0 -1
  378. package/docs/assets/main.js +0 -60
  379. package/docs/assets/navigation.js +0 -1
  380. package/docs/assets/search.js +0 -1
  381. package/docs/assets/style.css +0 -1648
  382. package/docs/classes/Agent.html +0 -801
  383. package/docs/classes/Briyah.html +0 -296
  384. package/docs/classes/BriyahConfigService.html +0 -119
  385. package/docs/classes/NativeToolRegistry.html +0 -166
  386. package/docs/classes/PackInstantiationService.html +0 -157
  387. package/docs/classes/PackService.html +0 -247
  388. package/docs/classes/Room.html +0 -1338
  389. package/docs/classes/RoomMessage.html +0 -290
  390. package/docs/enums/MessageAction.html +0 -136
  391. package/docs/functions/actsTools.html +0 -44
  392. package/docs/functions/availableToolPacks.html +0 -41
  393. package/docs/functions/buildMarkdown.html +0 -54
  394. package/docs/functions/dnd5eTools.html +0 -44
  395. package/docs/functions/installToolPacks.html +0 -48
  396. package/docs/functions/pageMarker.html +0 -45
  397. package/docs/functions/registerToolPacks.html +0 -54
  398. package/docs/functions/splitMarkdownIntoPages.html +0 -51
  399. package/docs/functions/stripWrappingFence.html +0 -52
  400. package/docs/hierarchy.html +0 -46
  401. package/docs/index.html +0 -595
  402. package/docs/interfaces/AgentCreationOptions.html +0 -125
  403. package/docs/interfaces/AgentInfo.html +0 -218
  404. package/docs/interfaces/AgentMessagesResponse.html +0 -74
  405. package/docs/interfaces/AppService.html +0 -3337
  406. package/docs/interfaces/Artifact.html +0 -95
  407. package/docs/interfaces/ArtifactMetadata.html +0 -112
  408. package/docs/interfaces/ArtifactWriteOptions.html +0 -90
  409. package/docs/interfaces/AttachDocumentResponse.html +0 -62
  410. package/docs/interfaces/BriyahConfigOptions.html +0 -124
  411. package/docs/interfaces/ChapterInfo.html +0 -62
  412. package/docs/interfaces/Character.html +0 -86
  413. package/docs/interfaces/ConversionAgent.html +0 -78
  414. package/docs/interfaces/CreateAgentResponse.html +0 -56
  415. package/docs/interfaces/CreateRoomResponse.html +0 -62
  416. package/docs/interfaces/CreateStoryResponse.html +0 -56
  417. package/docs/interfaces/FileList.html +0 -56
  418. package/docs/interfaces/FileMetadata.html +0 -89
  419. package/docs/interfaces/IConfigService.html +0 -79
  420. package/docs/interfaces/InstantiateModels.html +0 -64
  421. package/docs/interfaces/InstantiateRoomResult.html +0 -70
  422. package/docs/interfaces/LoadedPack.html +0 -131
  423. package/docs/interfaces/LoggingOptions.html +0 -92
  424. package/docs/interfaces/Message.html +0 -84
  425. package/docs/interfaces/ModelChoice.html +0 -73
  426. package/docs/interfaces/ModelInfo.html +0 -74
  427. package/docs/interfaces/NativeToolDefinition.html +0 -107
  428. package/docs/interfaces/PackAgentTemplate.html +0 -101
  429. package/docs/interfaces/PackRoomTemplate.html +0 -108
  430. package/docs/interfaces/PackView.html +0 -172
  431. package/docs/interfaces/PdfConversionOptions.html +0 -102
  432. package/docs/interfaces/PdfConversionResult.html +0 -97
  433. package/docs/interfaces/PdfMarkdownOptions.html +0 -198
  434. package/docs/interfaces/PdfMarkdownResult.html +0 -106
  435. package/docs/interfaces/PdfPageMarkdown.html +0 -94
  436. package/docs/interfaces/PreparedPromptResponse.html +0 -62
  437. package/docs/interfaces/ProcessTextResponse.html +0 -86
  438. package/docs/interfaces/PromptFile.html +0 -70
  439. package/docs/interfaces/PromptFileContent.html +0 -76
  440. package/docs/interfaces/PromptFilesResponse.html +0 -56
  441. package/docs/interfaces/PromptFolder.html +0 -80
  442. package/docs/interfaces/PromptFolderDefaults.html +0 -155
  443. package/docs/interfaces/PromptFolderDefaultsResponse.html +0 -79
  444. package/docs/interfaces/PromptFoldersResponse.html +0 -56
  445. package/docs/interfaces/RoomDetails.html +0 -151
  446. package/docs/interfaces/RoomErrorUpdate.html +0 -82
  447. package/docs/interfaces/RoomInfo.html +0 -88
  448. package/docs/interfaces/RoomMessageUpdate.html +0 -113
  449. package/docs/interfaces/RoomMessagesResponse.html +0 -62
  450. package/docs/interfaces/SendMessageResult.html +0 -62
  451. package/docs/interfaces/StoryErrorEvent.html +0 -84
  452. package/docs/interfaces/StoryIdea.html +0 -74
  453. package/docs/interfaces/StoryInfo.html +0 -198
  454. package/docs/interfaces/StoryIntroduceCharacterEvent.html +0 -79
  455. package/docs/interfaces/StoryProgressChapterEvent.html +0 -72
  456. package/docs/interfaces/StoryState.html +0 -108
  457. package/docs/interfaces/StoryStateEvent.html +0 -76
  458. package/docs/interfaces/ToolArtifact.html +0 -85
  459. package/docs/interfaces/ToolCaller.html +0 -77
  460. package/docs/interfaces/ToolDefinition.html +0 -80
  461. package/docs/interfaces/ToolHelpers.html +0 -105
  462. package/docs/interfaces/ToolPackDocuments.html +0 -100
  463. package/docs/interfaces/ToolParameter.html +0 -74
  464. package/docs/interfaces/ToolRoomAccess.html +0 -227
  465. package/docs/interfaces/ToolSummary.html +0 -74
  466. package/docs/interfaces/ToolsResponse.html +0 -68
  467. package/docs/interfaces/Transaction.html +0 -104
  468. package/docs/interfaces/TransactionHistoryResponse.html +0 -62
  469. package/docs/modules.html +0 -53
  470. package/docs/types/PackOrigin.html +0 -34
  471. package/docs/types/PromptScope.html +0 -34
  472. package/docs/types/RoomTurnMode.html +0 -42
  473. package/docs/types/RoomUpdate.html +0 -36
  474. package/docs/types/RosterOverrides.html +0 -42
  475. package/docs/types/ToolContext.html +0 -40
  476. package/docs/types/ToolRunResult.html +0 -34
  477. package/src/tools/packs/dnd5e/README.md +0 -867
@@ -1,9 +1,59 @@
1
+ /**
2
+ * Reading `rpg_models.json`, and turning a friendly name into models.
3
+ *
4
+ * The file is the short curated list the create-campaign dialog offers, for two
5
+ * separate choices: the campaign's quality tier, which configures the whole hidden
6
+ * crew, and each AI player's own model. One list serves both because an entry carries
7
+ * both roles.
8
+ *
9
+ * The common-config directory is a parameter rather than read from a service, so a
10
+ * spec can point at a fixture instead of the deployment's real file.
11
+ */
1
12
  import { RpgModelEntry, RpgModelOption } from '../../../shared/types/app.types';
2
13
  import { InstantiateModels } from '../packs/pack-instantiation.service';
14
+ /**
15
+ * The file's entries, or an empty list when it cannot be read.
16
+ *
17
+ * Re-read on every call, as `story_models.json` is, so a host who edits the list does
18
+ * not have to restart the server to see it.
19
+ */
3
20
  export declare function readRpgModels(commonConfigDir: string): RpgModelEntry[];
21
+ /** An entry as the client is offered it: the name, the blurb, and nothing else. */
4
22
  export declare function toRpgModelOption(entry: RpgModelEntry, isDefault: boolean): RpgModelOption;
23
+ /** The whole list, projected, with exactly one entry marked as the default. */
5
24
  export declare function listRpgModelOptions(commonConfigDir: string): RpgModelOption[];
25
+ /**
26
+ * The entry a friendly name refers to.
27
+ *
28
+ * An unknown name is refused rather than falling back, because a name the file does
29
+ * not have means the client and the file disagree — and the cost of guessing is a
30
+ * player billed for a model they did not choose.
31
+ *
32
+ * @throws {ValidationError} If no entry has that name
33
+ * @throws {NotFoundError} If the file has no entries at all
34
+ */
6
35
  export declare function resolveRpgModel(commonConfigDir: string, name: string): RpgModelEntry;
36
+ /**
37
+ * The models the hidden crew is built with, from the chosen quality tier.
38
+ *
39
+ * The tier's `model` is the Dungeon Master's — the one `modelRole: 'primary'` agent at
40
+ * the table, and the one whose quality decides whether the game is any good. The
41
+ * economy tier runs the other four, which is the split the dnd5e pack exists for.
42
+ *
43
+ * @param qualityName A friendly name, or absent to take the file's default
44
+ * @throws {ValidationError} If the name is not in the file
45
+ * @throws {NotFoundError} If the file has no entries
46
+ */
7
47
  export declare function resolveCrewModels(commonConfigDir: string, qualityName?: string): InstantiateModels;
48
+ /**
49
+ * The entry to preselect: the one flagged in the file, else the one named by
50
+ * DEFAULT_RPG_MODEL, else the first. Null when the file has no entries.
51
+ */
8
52
  export declare function pickDefaultEntry(entries: RpgModelEntry[]): RpgModelEntry | null;
53
+ /**
54
+ * The friendly name an agent's service and model came from, for a roster listing.
55
+ *
56
+ * Absent when the pair is not on the list, which happens when the agent's model was
57
+ * changed from the Agents page. Reported as absent rather than guessed.
58
+ */
9
59
  export declare function friendlyModelName(commonConfigDir: string, service: string, model: string): string | undefined;
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ /**
3
+ * Reading `rpg_models.json`, and turning a friendly name into models.
4
+ *
5
+ * The file is the short curated list the create-campaign dialog offers, for two
6
+ * separate choices: the campaign's quality tier, which configures the whole hidden
7
+ * crew, and each AI player's own model. One list serves both because an entry carries
8
+ * both roles.
9
+ *
10
+ * The common-config directory is a parameter rather than read from a service, so a
11
+ * spec can point at a fixture instead of the deployment's real file.
12
+ */
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -45,6 +56,12 @@ const path = __importStar(require("path"));
45
56
  const errors_1 = require("../common/errors");
46
57
  const logger_1 = require("../common/logger");
47
58
  const RPG_MODELS_FILE = 'rpg_models.json';
59
+ /**
60
+ * The file's entries, or an empty list when it cannot be read.
61
+ *
62
+ * Re-read on every call, as `story_models.json` is, so a host who edits the list does
63
+ * not have to restart the server to see it.
64
+ */
48
65
  function readRpgModels(commonConfigDir) {
49
66
  const filePath = path.join(commonConfigDir, RPG_MODELS_FILE);
50
67
  try {
@@ -56,6 +73,7 @@ function readRpgModels(commonConfigDir) {
56
73
  return [];
57
74
  }
58
75
  }
76
+ /** An entry as the client is offered it: the name, the blurb, and nothing else. */
59
77
  function toRpgModelOption(entry, isDefault) {
60
78
  return {
61
79
  name: entry.name,
@@ -64,11 +82,22 @@ function toRpgModelOption(entry, isDefault) {
64
82
  isDefault,
65
83
  };
66
84
  }
85
+ /** The whole list, projected, with exactly one entry marked as the default. */
67
86
  function listRpgModelOptions(commonConfigDir) {
68
87
  const entries = readRpgModels(commonConfigDir);
69
88
  const preferred = pickDefaultEntry(entries);
70
89
  return entries.map((entry) => toRpgModelOption(entry, entry.name === preferred?.name));
71
90
  }
91
+ /**
92
+ * The entry a friendly name refers to.
93
+ *
94
+ * An unknown name is refused rather than falling back, because a name the file does
95
+ * not have means the client and the file disagree — and the cost of guessing is a
96
+ * player billed for a model they did not choose.
97
+ *
98
+ * @throws {ValidationError} If no entry has that name
99
+ * @throws {NotFoundError} If the file has no entries at all
100
+ */
72
101
  function resolveRpgModel(commonConfigDir, name) {
73
102
  const entries = readRpgModels(commonConfigDir);
74
103
  if (entries.length === 0) {
@@ -82,6 +111,17 @@ function resolveRpgModel(commonConfigDir, name) {
82
111
  }
83
112
  return match;
84
113
  }
114
+ /**
115
+ * The models the hidden crew is built with, from the chosen quality tier.
116
+ *
117
+ * The tier's `model` is the Dungeon Master's — the one `modelRole: 'primary'` agent at
118
+ * the table, and the one whose quality decides whether the game is any good. The
119
+ * economy tier runs the other four, which is the split the dnd5e pack exists for.
120
+ *
121
+ * @param qualityName A friendly name, or absent to take the file's default
122
+ * @throws {ValidationError} If the name is not in the file
123
+ * @throws {NotFoundError} If the file has no entries
124
+ */
85
125
  function resolveCrewModels(commonConfigDir, qualityName) {
86
126
  const entry = qualityName?.trim()
87
127
  ? resolveRpgModel(commonConfigDir, qualityName)
@@ -92,6 +132,8 @@ function resolveCrewModels(commonConfigDir, qualityName) {
92
132
  aiModel: entry.model,
93
133
  smallModelName: entry.small_model,
94
134
  },
135
+ // Built only when the entry names one: absent lets `modelFor` fall back to the
136
+ // primary rather than this module keeping a second copy of that rule.
95
137
  economy: entry.economy_service || entry.economy_model
96
138
  ? {
97
139
  aiServiceName: entry.economy_service ?? entry.service,
@@ -101,6 +143,10 @@ function resolveCrewModels(commonConfigDir, qualityName) {
101
143
  : undefined,
102
144
  };
103
145
  }
146
+ /**
147
+ * The entry to preselect: the one flagged in the file, else the one named by
148
+ * DEFAULT_RPG_MODEL, else the first. Null when the file has no entries.
149
+ */
104
150
  function pickDefaultEntry(entries) {
105
151
  if (entries.length === 0)
106
152
  return null;
@@ -116,6 +162,7 @@ function pickDefaultEntry(entries) {
116
162
  }
117
163
  return entries[0];
118
164
  }
165
+ /** @throws {NotFoundError} If the file has no entries */
119
166
  function requireDefaultEntry(commonConfigDir) {
120
167
  const entry = pickDefaultEntry(readRpgModels(commonConfigDir));
121
168
  if (!entry) {
@@ -123,6 +170,12 @@ function requireDefaultEntry(commonConfigDir) {
123
170
  }
124
171
  return entry;
125
172
  }
173
+ /**
174
+ * The friendly name an agent's service and model came from, for a roster listing.
175
+ *
176
+ * Absent when the pair is not on the list, which happens when the agent's model was
177
+ * changed from the Agents page. Reported as absent rather than guessed.
178
+ */
126
179
  function friendlyModelName(commonConfigDir, service, model) {
127
180
  return readRpgModels(commonConfigDir).find((entry) => entry.service === service && entry.model === model)?.name;
128
181
  }
@@ -1,10 +1,45 @@
1
+ /**
2
+ * What a campaign's party may be, decided before anything is created.
3
+ *
4
+ * Pure on purpose: no filesystem, no Nest, no `AppService`. Every rule here is one
5
+ * the room would otherwise enforce badly or late, and the whole point is to refuse a
6
+ * party the room could not route while refusing costs nothing.
7
+ */
1
8
  import { RpgPlayerRequest } from '../../../shared/types/app.types';
9
+ /** The pack a campaign is built from. */
2
10
  export declare const RPG_PACK = "dnd5e";
11
+ /** The pack's player-less room template — the crew, and no seats. */
3
12
  export declare const RPG_ROOM_KEY = "campaign";
13
+ /** The prompt folder every player is created from, pack-qualified. */
4
14
  export declare const RPG_PLAYER_FOLDER = "dnd5e:dnd_player";
15
+ /** The pack agent template a player is filed under, and the roster discriminator. */
5
16
  export declare const RPG_PLAYER_AGENT_KEY = "player";
17
+ /**
18
+ * How many players one table seats.
19
+ *
20
+ * Not a technical limit — the room does not care. Six is a table, and every player
21
+ * beyond it is another agent perceiving every message.
22
+ */
6
23
  export declare const RPG_MAX_PLAYERS = 6;
7
- export declare const RPG_MAX_CHARACTER_NAME = 40;
8
- export declare const RPG_CREW_NICKNAMES: Readonly<Record<string, string>>;
9
- export declare function nicknamesAreAmbiguous(a: string, b: string): boolean;
24
+ /**
25
+ * The names a party is seated under, in order.
26
+ *
27
+ * A seat is a placeholder, not a character. Players choose a character during
28
+ * character creation and are renamed to it then — which is the only point at which
29
+ * they know what the classes and races on offer are. Generated here rather than
30
+ * asked for, so they are unique by construction and nothing has to be refused.
31
+ */
32
+ export declare const RPG_SEAT_NAMES: readonly ["Player One", "Player Two", "Player Three", "Player Four", "Player Five", "Player Six"];
33
+ /**
34
+ * Refuses a party the room could not seat, before a single agent exists.
35
+ *
36
+ * Much smaller than it was. It used to police character names — length, punctuation,
37
+ * collisions with the crew and with each other — because the party was named here.
38
+ * Now the party is seated under {@link RPG_SEAT_NAMES} and named in the game, so the
39
+ * only collision left is one a player invents at the table, and
40
+ * `Room.renameAgent` refuses that where it happens.
41
+ *
42
+ * @param players The requested party, in seating order
43
+ * @throws {ValidationError} Naming the offending seat and why
44
+ */
10
45
  export declare function assertSeatable(players: RpgPlayerRequest[] | undefined): void;
@@ -1,34 +1,58 @@
1
1
  "use strict";
2
+ /**
3
+ * What a campaign's party may be, decided before anything is created.
4
+ *
5
+ * Pure on purpose: no filesystem, no Nest, no `AppService`. Every rule here is one
6
+ * the room would otherwise enforce badly or late, and the whole point is to refuse a
7
+ * party the room could not route while refusing costs nothing.
8
+ */
2
9
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RPG_CREW_NICKNAMES = exports.RPG_MAX_CHARACTER_NAME = exports.RPG_MAX_PLAYERS = exports.RPG_PLAYER_AGENT_KEY = exports.RPG_PLAYER_FOLDER = exports.RPG_ROOM_KEY = exports.RPG_PACK = void 0;
4
- exports.nicknamesAreAmbiguous = nicknamesAreAmbiguous;
10
+ exports.RPG_SEAT_NAMES = exports.RPG_MAX_PLAYERS = exports.RPG_PLAYER_AGENT_KEY = exports.RPG_PLAYER_FOLDER = exports.RPG_ROOM_KEY = exports.RPG_PACK = void 0;
5
11
  exports.assertSeatable = assertSeatable;
6
12
  const errors_1 = require("../common/errors");
13
+ /** The pack a campaign is built from. */
7
14
  exports.RPG_PACK = 'dnd5e';
15
+ /** The pack's player-less room template — the crew, and no seats. */
8
16
  exports.RPG_ROOM_KEY = 'campaign';
17
+ /** The prompt folder every player is created from, pack-qualified. */
9
18
  exports.RPG_PLAYER_FOLDER = `${exports.RPG_PACK}:dnd_player`;
19
+ /** The pack agent template a player is filed under, and the roster discriminator. */
10
20
  exports.RPG_PLAYER_AGENT_KEY = 'player';
21
+ /**
22
+ * How many players one table seats.
23
+ *
24
+ * Not a technical limit — the room does not care. Six is a table, and every player
25
+ * beyond it is another agent perceiving every message.
26
+ */
11
27
  exports.RPG_MAX_PLAYERS = 6;
12
- exports.RPG_MAX_CHARACTER_NAME = 40;
13
- exports.RPG_CREW_NICKNAMES = {
14
- DM: 'the Dungeon Master',
15
- Marshal: 'the Battle Master',
16
- Creator: 'the Character Creator',
17
- Designer: 'the Campaign Designer',
18
- Moderator: 'the Table Moderator',
19
- };
20
- function nicknamesAreAmbiguous(a, b) {
21
- const keys = (name) => {
22
- const trimmed = name.trim();
23
- return new Set([trimmed.toLowerCase(), trimmed.split(/\s+/)[0].toLowerCase()]);
24
- };
25
- const left = keys(a);
26
- for (const key of keys(b)) {
27
- if (left.has(key))
28
- return true;
29
- }
30
- return false;
31
- }
28
+ /**
29
+ * The names a party is seated under, in order.
30
+ *
31
+ * A seat is a placeholder, not a character. Players choose a character during
32
+ * character creation and are renamed to it then — which is the only point at which
33
+ * they know what the classes and races on offer are. Generated here rather than
34
+ * asked for, so they are unique by construction and nothing has to be refused.
35
+ */
36
+ exports.RPG_SEAT_NAMES = [
37
+ 'Player One',
38
+ 'Player Two',
39
+ 'Player Three',
40
+ 'Player Four',
41
+ 'Player Five',
42
+ 'Player Six',
43
+ ];
44
+ /**
45
+ * Refuses a party the room could not seat, before a single agent exists.
46
+ *
47
+ * Much smaller than it was. It used to police character names — length, punctuation,
48
+ * collisions with the crew and with each other — because the party was named here.
49
+ * Now the party is seated under {@link RPG_SEAT_NAMES} and named in the game, so the
50
+ * only collision left is one a player invents at the table, and
51
+ * `Room.renameAgent` refuses that where it happens.
52
+ *
53
+ * @param players The requested party, in seating order
54
+ * @throws {ValidationError} Naming the offending seat and why
55
+ */
32
56
  function assertSeatable(players) {
33
57
  if (!players || players.length === 0) {
34
58
  throw new errors_1.ValidationError('A campaign needs at least one player.');
@@ -39,33 +63,9 @@ function assertSeatable(players) {
39
63
  if (!players.some((player) => player.isHuman)) {
40
64
  throw new errors_1.ValidationError('At least one player has to be a person.');
41
65
  }
42
- for (const player of players) {
43
- const name = player.characterName?.trim() ?? '';
44
- if (!name) {
45
- throw new errors_1.ValidationError('Every player needs a character name.');
46
- }
47
- if (name.length > exports.RPG_MAX_CHARACTER_NAME) {
48
- throw new errors_1.ValidationError(`"${name}" is too long for a character name (${exports.RPG_MAX_CHARACTER_NAME} characters).`);
49
- }
50
- if (!/[a-z0-9]/i.test(name)) {
51
- throw new errors_1.ValidationError(`"${name}" needs at least one letter or number.`);
52
- }
53
- for (const [nickname, role] of Object.entries(exports.RPG_CREW_NICKNAMES)) {
54
- if (nicknamesAreAmbiguous(name, nickname)) {
55
- throw new errors_1.ValidationError(`"${name}" is too close to "${nickname}", which is ${role}'s name at this table. Pick another.`);
56
- }
57
- }
66
+ players.forEach((player, index) => {
58
67
  if (!player.isHuman && !player.modelName?.trim()) {
59
- throw new errors_1.ValidationError(`AI player "${name}" needs a model.`);
60
- }
61
- }
62
- for (let i = 0; i < players.length; i++) {
63
- for (let j = i + 1; j < players.length; j++) {
64
- const first = players[i].characterName.trim();
65
- const second = players[j].characterName.trim();
66
- if (nicknamesAreAmbiguous(first, second)) {
67
- throw new errors_1.ValidationError(`The table cannot tell "${first}" and "${second}" apart. Give them distinct names.`);
68
- }
68
+ throw new errors_1.ValidationError(`${exports.RPG_SEAT_NAMES[index]} is an AI player and needs a model.`);
69
69
  }
70
- }
70
+ });
71
71
  }
@@ -1,3 +1,27 @@
1
+ /**
2
+ * Campaigns: a streamlined way to start and hold a fifth-edition game.
3
+ *
4
+ * A campaign is not a new kind of thing. It is an ordinary room built from the dnd5e
5
+ * pack's `campaign` template — the Dungeon Master, Battle Master, Character Creator,
6
+ * Campaign Designer and Table Moderator — with a party seated on top and the whole
7
+ * thing published, so the link the party plays through exists from the first moment.
8
+ *
9
+ * ## Why there is no campaign store
10
+ *
11
+ * Everything a campaign is, a room already holds: its roster, its turn mode, its
12
+ * leader and moderator, its artifacts, its transcript and its cost. Which agent is a
13
+ * player is `isControlledByHuman`; a character's personality is `privateContext`; a
14
+ * crew member's role is `packAgentKey`. A store would be a second copy of all of that,
15
+ * and it would drift the moment somebody renamed an agent from the Agents page. So a
16
+ * campaign is discovered by filtering rooms, and its details are derived per request.
17
+ *
18
+ * ## Why every write goes through AppService
19
+ *
20
+ * This service never touches `AgentStoreService` or `RoomStoreService`. It goes
21
+ * through the same `createRoom`, `createRoomAgent` and `deleteRoom` paths the API
22
+ * uses — the same discipline `PackInstantiationService` keeps, and what makes the
23
+ * rollback below correct rather than approximate.
24
+ */
1
25
  import { CreateRpgCampaignRequest, CreateRpgCampaignResponse, RpgCampaignDetails, RpgCampaignInfo, RpgModelOption } from '../../../shared/types/app.types';
2
26
  import { AppService } from '../app.service';
3
27
  import { UserConfigService } from '../config/user-config.service';
@@ -10,20 +34,83 @@ export declare class RpgService {
10
34
  private readonly userPaths;
11
35
  private readonly userId;
12
36
  constructor(app: AppService, packs: PackService, userConfig: UserConfigService, userPaths: UserPathsService, userId: string);
37
+ /** The models a campaign may be built with, as the client is offered them. */
13
38
  listModels(): RpgModelOption[];
39
+ /**
40
+ * Builds a campaign and publishes it.
41
+ *
42
+ * Three phases, one compensating action. Everything that can be known is checked
43
+ * before the first side effect; then the crew; then the party and the publish. Any
44
+ * failure past the first agent deletes the room, which takes its agents with it.
45
+ *
46
+ * Synchronous throughout, unlike story creation: nothing in the dnd5e pack fires a
47
+ * prompt at instantiation, so this is file I/O for a dozen agents. It either
48
+ * returns a campaign that can be played or leaves nothing behind.
49
+ *
50
+ * @param request The campaign's name, quality tier and party
51
+ * @returns The campaign, its public link, and anything that did not go to plan
52
+ * @throws {ValidationError} If the party or the quality tier is not acceptable
53
+ * @throws {NotFoundError} If this deployment does not ship the dnd5e pack
54
+ */
14
55
  createCampaign(request: CreateRpgCampaignRequest): Promise<CreateRpgCampaignResponse>;
56
+ /** Every campaign this user has, newest first. */
15
57
  listCampaigns(): Promise<RpgCampaignInfo[]>;
58
+ /**
59
+ * One campaign, with its party and its crew.
60
+ *
61
+ * Derived on every request rather than cached, so a change made from the Rooms or
62
+ * Agents page — a seventh player, a renamed character — shows up here.
63
+ *
64
+ * @throws {NotFoundError} If there is no such campaign
65
+ */
16
66
  getCampaign(campaignId: string): Promise<RpgCampaignDetails>;
67
+ /**
68
+ * Publishes a campaign that has no live link.
69
+ *
70
+ * Only reachable when an instance was deleted by hand, since creation publishes.
71
+ * It mints a new id, so the old link — if anyone still has it — stops working.
72
+ *
73
+ * @throws {NotFoundError} If there is no such campaign
74
+ * @throws {ValidationError} If the campaign already has a link
75
+ */
17
76
  republishCampaign(campaignId: string): Promise<{
18
77
  instanceId: string;
19
78
  publicPath: string;
20
79
  }>;
80
+ /** Each seat with its model resolved up front. @throws {ValidationError} */
21
81
  private resolveSeats;
82
+ /** The economy tier a human player rides, which is the cheapest seat available. */
22
83
  private economyModel;
84
+ /**
85
+ * Makes sure the pack a campaign is built from is available and on.
86
+ *
87
+ * Enabling it here rather than in `PackInstantiationService`: self-enabling
88
+ * instantiation would change behaviour for every pack to suit one feature. A user
89
+ * on the RPG surface asking for a campaign has unambiguously asked for the dnd5e
90
+ * content, and has no Packs page to be sent to.
91
+ *
92
+ * @throws {NotFoundError} If the deployment does not ship the pack
93
+ */
23
94
  private ensurePackReady;
95
+ /**
96
+ * A room built from the campaign template.
97
+ *
98
+ * Both halves matter: `pack` alone would also match a table built by hand from the
99
+ * Packs page, which has a player seat the RPG page did not create and does not
100
+ * know how to show.
101
+ */
24
102
  private isCampaign;
103
+ /** @throws {NotFoundError} If the room is missing or is not a campaign */
25
104
  private requireCampaign;
105
+ /** The listing shape, including the published link the party plays through. */
26
106
  private summarize;
107
+ /**
108
+ * The party and the crew.
109
+ *
110
+ * Split on the pack template key rather than on `isControlledByHuman`, because an
111
+ * AI player is a player too — it is seated from the same template and shown in the
112
+ * same roster.
113
+ */
27
114
  private splitRoster;
28
115
  private isPlayer;
29
116
  }