briyah 2.0.3 → 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 (371) hide show
  1. package/README.md +43 -7
  2. package/data/common/config/LICENSE-model-prices.md +65 -0
  3. package/data/common/config/model_prices.json +47443 -46295
  4. package/data/common/prompts/narrator/create_story.prompt +2 -0
  5. package/dist-sdk/server/src/ai/LLM/anthropic.service.d.ts +103 -0
  6. package/dist-sdk/server/src/ai/LLM/anthropic.service.js +173 -2
  7. package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +172 -3
  8. package/dist-sdk/server/src/ai/LLM/base-ai.service.js +241 -5
  9. package/dist-sdk/server/src/ai/LLM/comfyui-client.d.ts +26 -0
  10. package/dist-sdk/server/src/ai/LLM/comfyui-client.js +25 -0
  11. package/dist-sdk/server/src/ai/LLM/comfyui-workflow.d.ts +54 -0
  12. package/dist-sdk/server/src/ai/LLM/comfyui-workflow.js +59 -1
  13. package/dist-sdk/server/src/ai/LLM/comfyui.service.d.ts +21 -1
  14. package/dist-sdk/server/src/ai/LLM/comfyui.service.js +25 -1
  15. package/dist-sdk/server/src/ai/LLM/deepseek.service.d.ts +52 -0
  16. package/dist-sdk/server/src/ai/LLM/deepseek.service.js +102 -3
  17. package/dist-sdk/server/src/ai/LLM/fal.service.d.ts +25 -0
  18. package/dist-sdk/server/src/ai/LLM/fal.service.js +55 -1
  19. package/dist-sdk/server/src/ai/LLM/googleai.service.d.ts +19 -0
  20. package/dist-sdk/server/src/ai/LLM/googleai.service.js +42 -1
  21. package/dist-sdk/server/src/ai/LLM/grok.service.d.ts +22 -0
  22. package/dist-sdk/server/src/ai/LLM/grok.service.js +54 -2
  23. package/dist-sdk/server/src/ai/LLM/mock.service.js +31 -4
  24. package/dist-sdk/server/src/ai/LLM/openai.service.d.ts +30 -0
  25. package/dist-sdk/server/src/ai/LLM/openai.service.js +80 -2
  26. package/dist-sdk/server/src/ai/LLM/self-hosted.service.d.ts +21 -0
  27. package/dist-sdk/server/src/ai/LLM/self-hosted.service.js +44 -2
  28. package/dist-sdk/server/src/ai/LLM/together.service.d.ts +30 -0
  29. package/dist-sdk/server/src/ai/LLM/together.service.js +60 -2
  30. package/dist-sdk/server/src/ai/agent-config.d.ts +15 -0
  31. package/dist-sdk/server/src/ai/agent-factory.d.ts +16 -0
  32. package/dist-sdk/server/src/ai/agent-factory.js +20 -0
  33. package/dist-sdk/server/src/ai/agent-message.service.d.ts +30 -0
  34. package/dist-sdk/server/src/ai/agent-message.service.js +30 -0
  35. package/dist-sdk/server/src/ai/agent-store.service.d.ts +80 -0
  36. package/dist-sdk/server/src/ai/agent-store.service.js +166 -5
  37. package/dist-sdk/server/src/ai/agent.d.ts +196 -0
  38. package/dist-sdk/server/src/ai/agent.js +224 -11
  39. package/dist-sdk/server/src/ai/ai-debug-logger.d.ts +18 -0
  40. package/dist-sdk/server/src/ai/ai-debug-logger.js +19 -0
  41. package/dist-sdk/server/src/ai/ai-factory.service.d.ts +9 -0
  42. package/dist-sdk/server/src/ai/ai-factory.service.js +9 -0
  43. package/dist-sdk/server/src/ai/artifact.service.d.ts +131 -0
  44. package/dist-sdk/server/src/ai/artifact.service.js +148 -3
  45. package/dist-sdk/server/src/ai/attached-file.service.d.ts +87 -0
  46. package/dist-sdk/server/src/ai/attached-file.service.js +105 -0
  47. package/dist-sdk/server/src/ai/model_prices.d.ts +30 -0
  48. package/dist-sdk/server/src/ai/model_prices.js +91 -5
  49. package/dist-sdk/server/src/ai/pack-artifacts.d.ts +84 -0
  50. package/dist-sdk/server/src/ai/pack-artifacts.js +168 -0
  51. package/dist-sdk/server/src/ai/published-agents.service.d.ts +25 -0
  52. package/dist-sdk/server/src/ai/published-agents.service.js +30 -3
  53. package/dist-sdk/server/src/app/balance-message.service.d.ts +24 -0
  54. package/dist-sdk/server/src/app/balance-message.service.js +24 -0
  55. package/dist-sdk/server/src/app/balance.module.d.ts +4 -0
  56. package/dist-sdk/server/src/app/balance.module.js +4 -0
  57. package/dist-sdk/server/src/app/balance.service.d.ts +37 -0
  58. package/dist-sdk/server/src/app/balance.service.js +54 -0
  59. package/dist-sdk/server/src/app/stripe.controller.d.ts +21 -0
  60. package/dist-sdk/server/src/app/stripe.controller.js +35 -0
  61. package/dist-sdk/server/src/app/stripe.service.d.ts +43 -0
  62. package/dist-sdk/server/src/app/stripe.service.js +62 -0
  63. package/dist-sdk/server/src/app/transaction.service.d.ts +27 -0
  64. package/dist-sdk/server/src/app/transaction.service.js +36 -0
  65. package/dist-sdk/server/src/app/user-service-factory.d.ts +8 -0
  66. package/dist-sdk/server/src/app/user-service-factory.js +38 -1
  67. package/dist-sdk/server/src/app/user-service-manager.d.ts +27 -0
  68. package/dist-sdk/server/src/app/user-service-manager.js +43 -0
  69. package/dist-sdk/server/src/app.controller.d.ts +87 -0
  70. package/dist-sdk/server/src/app.controller.js +272 -12
  71. package/dist-sdk/server/src/app.module.js +28 -6
  72. package/dist-sdk/server/src/app.service.d.ts +1661 -0
  73. package/dist-sdk/server/src/app.service.js +1837 -4
  74. package/dist-sdk/server/src/auth/agent-access.decorator.d.ts +17 -0
  75. package/dist-sdk/server/src/auth/agent-access.decorator.js +17 -0
  76. package/dist-sdk/server/src/auth/auth.controller.js +46 -0
  77. package/dist-sdk/server/src/auth/auth.module.js +3 -2
  78. package/dist-sdk/server/src/auth/auth.service.d.ts +33 -0
  79. package/dist-sdk/server/src/auth/auth.service.js +39 -3
  80. package/dist-sdk/server/src/auth/jwt-auth.guard.js +18 -0
  81. package/dist-sdk/server/src/auth/jwt.strategy.js +2 -2
  82. package/dist-sdk/server/src/auth/owner-only.decorator.d.ts +9 -0
  83. package/dist-sdk/server/src/auth/owner-only.decorator.js +9 -0
  84. package/dist-sdk/server/src/auth/phone-validation.service.d.ts +25 -0
  85. package/dist-sdk/server/src/auth/phone-validation.service.js +30 -0
  86. package/dist-sdk/server/src/auth/rate-limit.service.d.ts +19 -0
  87. package/dist-sdk/server/src/auth/rate-limit.service.js +24 -0
  88. package/dist-sdk/server/src/auth/room-access.decorator.d.ts +8 -0
  89. package/dist-sdk/server/src/auth/room-access.decorator.js +8 -0
  90. package/dist-sdk/server/src/auth/scopes.decorator.d.ts +7 -0
  91. package/dist-sdk/server/src/auth/scopes.decorator.js +7 -0
  92. package/dist-sdk/server/src/auth/scopes.guard.d.ts +16 -0
  93. package/dist-sdk/server/src/auth/scopes.guard.js +30 -0
  94. package/dist-sdk/server/src/auth/session.guard.d.ts +4 -0
  95. package/dist-sdk/server/src/auth/session.guard.js +8 -0
  96. package/dist-sdk/server/src/auth/twilio.service.d.ts +27 -0
  97. package/dist-sdk/server/src/auth/twilio.service.js +30 -4
  98. package/dist-sdk/server/src/auth/users.service.d.ts +30 -0
  99. package/dist-sdk/server/src/auth/users.service.js +42 -0
  100. package/dist-sdk/server/src/common/errors.d.ts +20 -0
  101. package/dist-sdk/server/src/common/errors.js +21 -0
  102. package/dist-sdk/server/src/config/env-config.d.ts +7 -0
  103. package/dist-sdk/server/src/config/prompt-resolver.d.ts +180 -0
  104. package/dist-sdk/server/src/config/prompt-resolver.js +182 -0
  105. package/dist-sdk/server/src/config/user-config.service.d.ts +59 -0
  106. package/dist-sdk/server/src/config/user-config.service.js +57 -0
  107. package/dist-sdk/server/src/config/user-paths.service.d.ts +61 -0
  108. package/dist-sdk/server/src/config/user-paths.service.js +67 -0
  109. package/dist-sdk/server/src/documents/pdf-conversion.d.ts +121 -1
  110. package/dist-sdk/server/src/documents/pdf-conversion.js +94 -0
  111. package/dist-sdk/server/src/packs/pack-instantiation.service.d.ts +98 -0
  112. package/dist-sdk/server/src/packs/pack-instantiation.service.js +99 -0
  113. package/dist-sdk/server/src/packs/pack-manifest.d.ts +100 -0
  114. package/dist-sdk/server/src/packs/pack-manifest.js +58 -0
  115. package/dist-sdk/server/src/packs/pack.service.d.ts +99 -1
  116. package/dist-sdk/server/src/packs/pack.service.js +98 -1
  117. package/dist-sdk/server/src/room/artifact-store.service.d.ts +27 -0
  118. package/dist-sdk/server/src/room/artifact-store.service.js +49 -3
  119. package/dist-sdk/server/src/room/artifact.d.ts +18 -0
  120. package/dist-sdk/server/src/room/message.d.ts +64 -0
  121. package/dist-sdk/server/src/room/message.js +77 -2
  122. package/dist-sdk/server/src/room/nickname.d.ts +26 -0
  123. package/dist-sdk/server/src/room/nickname.js +26 -0
  124. package/dist-sdk/server/src/room/published-rooms.service.js +2 -0
  125. package/dist-sdk/server/src/room/room-config.d.ts +26 -0
  126. package/dist-sdk/server/src/room/room-factory.d.ts +12 -0
  127. package/dist-sdk/server/src/room/room-factory.js +14 -0
  128. package/dist-sdk/server/src/room/room-message.service.d.ts +28 -0
  129. package/dist-sdk/server/src/room/room-message.service.js +28 -0
  130. package/dist-sdk/server/src/room/room-store.service.d.ts +176 -0
  131. package/dist-sdk/server/src/room/room-store.service.js +238 -5
  132. package/dist-sdk/server/src/room/room.d.ts +878 -0
  133. package/dist-sdk/server/src/room/room.js +1291 -23
  134. package/dist-sdk/server/src/rpg/rpg-models.d.ts +50 -0
  135. package/dist-sdk/server/src/rpg/rpg-models.js +53 -0
  136. package/dist-sdk/server/src/rpg/rpg-roster.d.ts +37 -0
  137. package/dist-sdk/server/src/rpg/rpg-roster.js +37 -0
  138. package/dist-sdk/server/src/rpg/rpg.service.d.ts +87 -0
  139. package/dist-sdk/server/src/rpg/rpg.service.js +103 -0
  140. package/dist-sdk/server/src/sdk/briyah-config.d.ts +57 -0
  141. package/dist-sdk/server/src/sdk/briyah-config.js +17 -0
  142. package/dist-sdk/server/src/sdk/briyah.d.ts +228 -0
  143. package/dist-sdk/server/src/sdk/briyah.js +285 -7
  144. package/dist-sdk/server/src/sdk/index.js +23 -0
  145. package/dist-sdk/server/src/shared/shared.module.d.ts +8 -0
  146. package/dist-sdk/server/src/shared/shared.module.js +13 -5
  147. package/dist-sdk/server/src/story/story-message.service.d.ts +43 -0
  148. package/dist-sdk/server/src/story/story-message.service.js +43 -0
  149. package/dist-sdk/server/src/story/story-progress.service.d.ts +23 -0
  150. package/dist-sdk/server/src/story/story-progress.service.js +23 -0
  151. package/dist-sdk/server/src/story/story-store.service.d.ts +92 -0
  152. package/dist-sdk/server/src/story/story-store.service.js +136 -1
  153. package/dist-sdk/server/src/story/story.service.d.ts +398 -0
  154. package/dist-sdk/server/src/story/story.service.js +829 -25
  155. package/dist-sdk/server/src/tools/core/index.d.ts +22 -0
  156. package/dist-sdk/server/src/tools/core/index.js +22 -0
  157. package/dist-sdk/server/src/tools/core/rename.tool.d.ts +8 -0
  158. package/dist-sdk/server/src/tools/core/rename.tool.js +11 -0
  159. package/dist-sdk/server/src/tools/native-tool-registry.service.d.ts +22 -0
  160. package/dist-sdk/server/src/tools/native-tool-registry.service.js +22 -0
  161. package/dist-sdk/server/src/tools/native-tool.types.d.ts +176 -0
  162. package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.d.ts +29 -0
  163. package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.js +29 -0
  164. package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.d.ts +46 -0
  165. package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.js +40 -0
  166. package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.d.ts +33 -0
  167. package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.js +19 -0
  168. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.d.ts +37 -0
  169. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.d.ts +17 -0
  170. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.js +17 -0
  171. package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.js +27 -0
  172. package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.d.ts +36 -0
  173. package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.js +32 -0
  174. package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.d.ts +32 -0
  175. package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.d.ts +13 -0
  176. package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.js +13 -0
  177. package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.js +18 -0
  178. package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.d.ts +54 -0
  179. package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.d.ts +13 -0
  180. package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.js +13 -0
  181. package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.js +20 -0
  182. package/dist-sdk/server/src/tools/packs/dnd5e/data/races.d.ts +36 -0
  183. package/dist-sdk/server/src/tools/packs/dnd5e/data/races.js +18 -0
  184. package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.d.ts +29 -0
  185. package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.d.ts +13 -0
  186. package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.js +13 -0
  187. package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.js +21 -0
  188. package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.d.ts +95 -0
  189. package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.js +66 -2
  190. package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.d.ts +50 -0
  191. package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.js +28 -0
  192. package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.d.ts +92 -0
  193. package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.js +152 -0
  194. package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.d.ts +28 -0
  195. package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.js +29 -0
  196. package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.d.ts +31 -0
  197. package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.js +36 -2
  198. package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.d.ts +261 -0
  199. package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.js +401 -0
  200. package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.d.ts +11 -0
  201. package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.js +11 -0
  202. package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.d.ts +65 -0
  203. package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.js +67 -0
  204. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.d.ts +73 -0
  205. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.js +63 -0
  206. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.d.ts +66 -0
  207. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.js +59 -0
  208. package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.d.ts +54 -0
  209. package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.js +49 -0
  210. package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.d.ts +42 -0
  211. package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.js +59 -0
  212. package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.d.ts +72 -0
  213. package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.js +63 -0
  214. package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.d.ts +57 -0
  215. package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.js +54 -0
  216. package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.d.ts +81 -0
  217. package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.js +85 -0
  218. package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.d.ts +60 -0
  219. package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.js +64 -0
  220. package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.d.ts +169 -0
  221. package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.js +203 -0
  222. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +192 -0
  223. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +144 -0
  224. package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.d.ts +56 -0
  225. package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.js +54 -0
  226. package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.d.ts +65 -0
  227. package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.js +73 -0
  228. package/dist-sdk/server/src/tools/packs/dnd5e/index.d.ts +18 -0
  229. package/dist-sdk/server/src/tools/packs/dnd5e/index.js +18 -0
  230. package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.d.ts +4 -0
  231. package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.js +116 -1
  232. package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.d.ts +14 -0
  233. package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.js +17 -0
  234. package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.d.ts +1 -0
  235. package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.js +35 -1
  236. package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.d.ts +6 -0
  237. package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.js +25 -0
  238. package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.d.ts +7 -0
  239. package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.js +13 -0
  240. package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.d.ts +8 -0
  241. package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.js +55 -0
  242. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +164 -0
  243. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +188 -1
  244. package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.d.ts +1 -0
  245. package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +116 -0
  246. package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.d.ts +13 -0
  247. package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.js +18 -0
  248. package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.d.ts +1 -0
  249. package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.js +23 -0
  250. package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.d.ts +1 -0
  251. package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.js +35 -0
  252. package/dist-sdk/server/src/tools/packs/index.d.ts +49 -0
  253. package/dist-sdk/server/src/tools/packs/index.js +66 -0
  254. package/dist-sdk/server/src/tools/shared/coerce.d.ts +95 -0
  255. package/dist-sdk/server/src/tools/shared/coerce.js +98 -0
  256. package/dist-sdk/server/src/tools/tool-execution.service.d.ts +73 -0
  257. package/dist-sdk/server/src/tools/tool-execution.service.js +74 -0
  258. package/dist-sdk/server/src/tools/tool-store.service.d.ts +11 -0
  259. package/dist-sdk/server/src/tools/tool-store.service.js +13 -1
  260. package/dist-sdk/shared/types/app.types.d.ts +285 -13
  261. package/dist-sdk/shared/types/app.types.js +3 -0
  262. package/package.json +167 -168
  263. package/data/common/config/random_words.txt +0 -2241
  264. package/data/common/story_ideas/biblical.json +0 -122
  265. package/data/common/story_ideas/fantasy.json +0 -82
  266. package/data/common/story_ideas/historical_fiction.json +0 -82
  267. package/data/common/story_ideas/science_fiction.json +0 -82
  268. package/docs/.nojekyll +0 -1
  269. package/docs/assets/hierarchy.js +0 -1
  270. package/docs/assets/highlight.css +0 -113
  271. package/docs/assets/icons.js +0 -18
  272. package/docs/assets/icons.svg +0 -1
  273. package/docs/assets/main.js +0 -60
  274. package/docs/assets/navigation.js +0 -1
  275. package/docs/assets/search.js +0 -1
  276. package/docs/assets/style.css +0 -1648
  277. package/docs/classes/Agent.html +0 -801
  278. package/docs/classes/Briyah.html +0 -296
  279. package/docs/classes/BriyahConfigService.html +0 -119
  280. package/docs/classes/NativeToolRegistry.html +0 -166
  281. package/docs/classes/PackInstantiationService.html +0 -157
  282. package/docs/classes/PackService.html +0 -247
  283. package/docs/classes/Room.html +0 -1434
  284. package/docs/classes/RoomMessage.html +0 -290
  285. package/docs/enums/MessageAction.html +0 -136
  286. package/docs/functions/availableToolPacks.html +0 -41
  287. package/docs/functions/buildMarkdown.html +0 -54
  288. package/docs/functions/dnd5eTools.html +0 -44
  289. package/docs/functions/installToolPacks.html +0 -51
  290. package/docs/functions/pageMarker.html +0 -45
  291. package/docs/functions/registerToolPacks.html +0 -54
  292. package/docs/functions/splitMarkdownIntoPages.html +0 -51
  293. package/docs/functions/stripWrappingFence.html +0 -52
  294. package/docs/hierarchy.html +0 -46
  295. package/docs/index.html +0 -595
  296. package/docs/interfaces/AgentCreationOptions.html +0 -125
  297. package/docs/interfaces/AgentInfo.html +0 -218
  298. package/docs/interfaces/AgentMessagesResponse.html +0 -74
  299. package/docs/interfaces/AppService.html +0 -3340
  300. package/docs/interfaces/Artifact.html +0 -95
  301. package/docs/interfaces/ArtifactMetadata.html +0 -112
  302. package/docs/interfaces/ArtifactWriteOptions.html +0 -90
  303. package/docs/interfaces/AttachDocumentResponse.html +0 -62
  304. package/docs/interfaces/BriyahConfigOptions.html +0 -124
  305. package/docs/interfaces/ChapterInfo.html +0 -62
  306. package/docs/interfaces/Character.html +0 -86
  307. package/docs/interfaces/ConversionAgent.html +0 -78
  308. package/docs/interfaces/CreateAgentResponse.html +0 -56
  309. package/docs/interfaces/CreateRoomResponse.html +0 -62
  310. package/docs/interfaces/CreateStoryResponse.html +0 -56
  311. package/docs/interfaces/FileList.html +0 -56
  312. package/docs/interfaces/FileMetadata.html +0 -89
  313. package/docs/interfaces/IConfigService.html +0 -79
  314. package/docs/interfaces/InstantiateModels.html +0 -64
  315. package/docs/interfaces/InstantiateRoomResult.html +0 -70
  316. package/docs/interfaces/LoadedPack.html +0 -131
  317. package/docs/interfaces/LoggingOptions.html +0 -92
  318. package/docs/interfaces/Message.html +0 -84
  319. package/docs/interfaces/ModelChoice.html +0 -73
  320. package/docs/interfaces/ModelInfo.html +0 -74
  321. package/docs/interfaces/NativeToolDefinition.html +0 -107
  322. package/docs/interfaces/PackAgentTemplate.html +0 -101
  323. package/docs/interfaces/PackRoomTemplate.html +0 -108
  324. package/docs/interfaces/PackView.html +0 -172
  325. package/docs/interfaces/PdfConversionOptions.html +0 -102
  326. package/docs/interfaces/PdfConversionResult.html +0 -97
  327. package/docs/interfaces/PdfMarkdownOptions.html +0 -198
  328. package/docs/interfaces/PdfMarkdownResult.html +0 -106
  329. package/docs/interfaces/PdfPageMarkdown.html +0 -94
  330. package/docs/interfaces/PreparedPromptResponse.html +0 -62
  331. package/docs/interfaces/ProcessTextResponse.html +0 -86
  332. package/docs/interfaces/PromptFile.html +0 -70
  333. package/docs/interfaces/PromptFileContent.html +0 -76
  334. package/docs/interfaces/PromptFilesResponse.html +0 -56
  335. package/docs/interfaces/PromptFolder.html +0 -80
  336. package/docs/interfaces/PromptFolderDefaults.html +0 -155
  337. package/docs/interfaces/PromptFolderDefaultsResponse.html +0 -79
  338. package/docs/interfaces/PromptFoldersResponse.html +0 -56
  339. package/docs/interfaces/RoomDetails.html +0 -151
  340. package/docs/interfaces/RoomErrorUpdate.html +0 -82
  341. package/docs/interfaces/RoomInfo.html +0 -88
  342. package/docs/interfaces/RoomMessageUpdate.html +0 -113
  343. package/docs/interfaces/RoomMessagesResponse.html +0 -62
  344. package/docs/interfaces/SendMessageResult.html +0 -62
  345. package/docs/interfaces/StoryErrorEvent.html +0 -84
  346. package/docs/interfaces/StoryIdea.html +0 -74
  347. package/docs/interfaces/StoryInfo.html +0 -198
  348. package/docs/interfaces/StoryIntroduceCharacterEvent.html +0 -79
  349. package/docs/interfaces/StoryProgressChapterEvent.html +0 -72
  350. package/docs/interfaces/StoryState.html +0 -108
  351. package/docs/interfaces/StoryStateEvent.html +0 -76
  352. package/docs/interfaces/ToolArtifact.html +0 -85
  353. package/docs/interfaces/ToolCaller.html +0 -77
  354. package/docs/interfaces/ToolDefinition.html +0 -80
  355. package/docs/interfaces/ToolHelpers.html +0 -105
  356. package/docs/interfaces/ToolPackDocuments.html +0 -100
  357. package/docs/interfaces/ToolParameter.html +0 -74
  358. package/docs/interfaces/ToolRoomAccess.html +0 -260
  359. package/docs/interfaces/ToolSummary.html +0 -74
  360. package/docs/interfaces/ToolsResponse.html +0 -68
  361. package/docs/interfaces/Transaction.html +0 -104
  362. package/docs/interfaces/TransactionHistoryResponse.html +0 -62
  363. package/docs/modules.html +0 -53
  364. package/docs/types/PackOrigin.html +0 -34
  365. package/docs/types/PromptScope.html +0 -34
  366. package/docs/types/RoomTurnMode.html +0 -42
  367. package/docs/types/RoomUpdate.html +0 -36
  368. package/docs/types/RosterOverrides.html +0 -42
  369. package/docs/types/ToolContext.html +0 -40
  370. package/docs/types/ToolRunResult.html +0 -34
  371. package/src/tools/packs/dnd5e/README.md +0 -867
@@ -1,27 +1,83 @@
1
+ /**
2
+ * Spell lookup, listing and class-list membership.
3
+ *
4
+ * There is deliberately **no campaign spell artifact**, unlike creatures and magic
5
+ * items. Those two need a structured home because the tools compute from them — a
6
+ * creature's attack bonus, an item's contribution to armour class. Nothing computes
7
+ * from a spell: its effect is prose the Dungeon Master adjudicates, so a homebrew
8
+ * spell needs a description in the `Campaign` document and a name on the sheet,
9
+ * both of which already work.
10
+ *
11
+ * Pure, with no room access, like the rest of `engine/`.
12
+ */
1
13
  import { Spell, spellLevelName } from '../data/spells';
2
14
  import type { SheetState } from './sheet';
15
+ /** How many names a listing returns before it asks the caller to narrow. */
3
16
  export declare const SPELL_LIST_CAP = 60;
17
+ /** How many suggestions a failed lookup offers. */
4
18
  export declare const SPELL_NEAR_MATCH_CAP = 8;
5
19
  export interface SpellLookup {
6
20
  spell?: Spell;
21
+ /** Candidate names when a partial name matched several. */
7
22
  ambiguous?: string[];
8
23
  }
24
+ /** Resets the spell index. Only needed by tests that mutate the table. */
9
25
  export declare function resetSpellIndex(): void;
26
+ /**
27
+ * Resolves a spell name.
28
+ * @param name The spell as written
29
+ * @returns The spell, the candidates, or an empty result
30
+ */
10
31
  export declare function resolveSpell(name: string): SpellLookup;
11
32
  export interface SpellListing {
12
33
  spells: string[];
13
34
  total: number;
35
+ /** True when the list was capped, so the caller knows to narrow. */
14
36
  truncated?: boolean;
15
37
  forClass?: string;
16
38
  level?: number;
17
39
  }
40
+ /**
41
+ * Lists spells, narrowed by class and level.
42
+ *
43
+ * With 319 spells an unfiltered list is useless — it would be capped at 60 every
44
+ * time. Class and level are separate parameters rather than one text filter because
45
+ * they are how a spell list is actually read: "what 2nd-level spells can a cleric
46
+ * take?" is the question, and answering it needs both.
47
+ * @param forClass A class key, or undefined for every class
48
+ * @param level A spell level, or undefined for every level
49
+ * @param search Optional text to match against the name
50
+ * @returns The names, with a total so the caller knows it was capped
51
+ */
18
52
  export declare function availableSpells(forClass?: string, level?: number, search?: string): SpellListing;
53
+ /**
54
+ * Suggests spells a failed lookup might have meant. Bounded, so a miss never
55
+ * returns the whole table.
56
+ * @param name The name that failed
57
+ * @param limit How many to return
58
+ * @returns The closest names, best first
59
+ */
19
60
  export declare function nearSpells(name: string, limit?: number): string[];
20
61
  export interface OffListSpell {
21
62
  spell: string;
63
+ /** Absent when the spell is not in the SRD at all. */
22
64
  onLists?: string[];
23
65
  }
66
+ /**
67
+ * Which of these spells are not on any of the character's class lists.
68
+ *
69
+ * **Reported, never refused.** A subclass, a racial trait or a magic item can all
70
+ * grant a spell off-list — a High Elf knows a wizard cantrip whatever its class,
71
+ * and a Tiefling knows *thaumaturgy* — so refusing would be wrong more often than
72
+ * it was right. Naming it lets whoever is building the sheet notice a genuine
73
+ * mistake without blocking a legitimate one.
74
+ * @param state The character
75
+ * @param spells Spell names being added
76
+ * @returns One entry per spell that is not on a list the character has
77
+ */
24
78
  export declare function offListSpells(state: SheetState, spells: string[]): OffListSpell[];
79
+ /** Renders one spell as readable markdown. */
25
80
  export declare function describeSpell(spell: Spell): string;
81
+ /** A one-line summary, for a sheet's spell list. */
26
82
  export declare function summariseSpell(name: string): string;
27
83
  export { spellLevelName };
@@ -1,4 +1,16 @@
1
1
  "use strict";
2
+ /**
3
+ * Spell lookup, listing and class-list membership.
4
+ *
5
+ * There is deliberately **no campaign spell artifact**, unlike creatures and magic
6
+ * items. Those two need a structured home because the tools compute from them — a
7
+ * creature's attack bonus, an item's contribution to armour class. Nothing computes
8
+ * from a spell: its effect is prose the Dungeon Master adjudicates, so a homebrew
9
+ * spell needs a description in the `Campaign` document and a name on the sheet,
10
+ * both of which already work.
11
+ *
12
+ * Pure, with no room access, like the rest of `engine/`.
13
+ */
2
14
  Object.defineProperty(exports, "__esModule", { value: true });
3
15
  exports.spellLevelName = exports.SPELL_NEAR_MATCH_CAP = exports.SPELL_LIST_CAP = void 0;
4
16
  exports.resetSpellIndex = resetSpellIndex;
@@ -12,7 +24,9 @@ const spells_1 = require("../data/spells");
12
24
  Object.defineProperty(exports, "spellLevelName", { enumerable: true, get: function () { return spells_1.spellLevelName; } });
13
25
  const srd_1 = require("../data/srd");
14
26
  const coerce_1 = require("./coerce");
27
+ /** How many names a listing returns before it asks the caller to narrow. */
15
28
  exports.SPELL_LIST_CAP = 60;
29
+ /** How many suggestions a failed lookup offers. */
16
30
  exports.SPELL_NEAR_MATCH_CAP = 8;
17
31
  let spellIndexCache = null;
18
32
  function spellIndex() {
@@ -24,9 +38,15 @@ function spellIndex() {
24
38
  }
25
39
  return spellIndexCache;
26
40
  }
41
+ /** Resets the spell index. Only needed by tests that mutate the table. */
27
42
  function resetSpellIndex() {
28
43
  spellIndexCache = null;
29
44
  }
45
+ /**
46
+ * Resolves a spell name.
47
+ * @param name The spell as written
48
+ * @returns The spell, the candidates, or an empty result
49
+ */
30
50
  function resolveSpell(name) {
31
51
  const key = (0, coerce_1.nameKey)(name || '');
32
52
  if (!key)
@@ -42,6 +62,18 @@ function resolveSpell(name) {
42
62
  }
43
63
  return {};
44
64
  }
65
+ /**
66
+ * Lists spells, narrowed by class and level.
67
+ *
68
+ * With 319 spells an unfiltered list is useless — it would be capped at 60 every
69
+ * time. Class and level are separate parameters rather than one text filter because
70
+ * they are how a spell list is actually read: "what 2nd-level spells can a cleric
71
+ * take?" is the question, and answering it needs both.
72
+ * @param forClass A class key, or undefined for every class
73
+ * @param level A spell level, or undefined for every level
74
+ * @param search Optional text to match against the name
75
+ * @returns The names, with a total so the caller knows it was capped
76
+ */
45
77
  function availableSpells(forClass, level, search) {
46
78
  const classKey = forClass ? (0, coerce_1.nameKey)(forClass) : undefined;
47
79
  const needle = (0, coerce_1.nameKey)(search || '');
@@ -59,6 +91,13 @@ function availableSpells(forClass, level, search) {
59
91
  level,
60
92
  };
61
93
  }
94
+ /**
95
+ * Suggests spells a failed lookup might have meant. Bounded, so a miss never
96
+ * returns the whole table.
97
+ * @param name The name that failed
98
+ * @param limit How many to return
99
+ * @returns The closest names, best first
100
+ */
62
101
  function nearSpells(name, limit = exports.SPELL_NEAR_MATCH_CAP) {
63
102
  const words = (0, coerce_1.nameKey)(name).split(' ').filter((word) => word.length > 2);
64
103
  if (words.length === 0)
@@ -73,9 +112,22 @@ function nearSpells(name, limit = exports.SPELL_NEAR_MATCH_CAP) {
73
112
  .slice(0, limit)
74
113
  .map((entry) => entry.name);
75
114
  }
115
+ /** The class keys a character has levels in, for checking a spell list. */
76
116
  function characterClasses(state) {
77
117
  return state.class.map((entry) => entry.c).filter((key) => srd_1.CLASSES[key]);
78
118
  }
119
+ /**
120
+ * Which of these spells are not on any of the character's class lists.
121
+ *
122
+ * **Reported, never refused.** A subclass, a racial trait or a magic item can all
123
+ * grant a spell off-list — a High Elf knows a wizard cantrip whatever its class,
124
+ * and a Tiefling knows *thaumaturgy* — so refusing would be wrong more often than
125
+ * it was right. Naming it lets whoever is building the sheet notice a genuine
126
+ * mistake without blocking a legitimate one.
127
+ * @param state The character
128
+ * @param spells Spell names being added
129
+ * @returns One entry per spell that is not on a list the character has
130
+ */
79
131
  function offListSpells(state, spells) {
80
132
  const mine = characterClasses(state);
81
133
  const out = [];
@@ -91,6 +143,7 @@ function offListSpells(state, spells) {
91
143
  }
92
144
  return out;
93
145
  }
146
+ /** Renders one spell as readable markdown. */
94
147
  function describeSpell(spell) {
95
148
  const descriptor = spell.level === 0
96
149
  ? `${spell.school} cantrip`
@@ -110,6 +163,7 @@ function describeSpell(spell) {
110
163
  }
111
164
  return lines.join('\n');
112
165
  }
166
+ /** A one-line summary, for a sheet's spell list. */
113
167
  function summariseSpell(name) {
114
168
  const { spell } = resolveSpell(name);
115
169
  if (!spell)
@@ -1,23 +1,88 @@
1
+ /**
2
+ * Turns a weapon name into an attack line a character can actually use.
3
+ *
4
+ * This is the module that stops attack bonuses and damage being invented. It is
5
+ * pure and has no room access, like the rest of `engine/`.
6
+ */
1
7
  import type { AttackEntry, SheetState } from './sheet';
2
8
  import { WeaponRules } from '../data/weapons';
9
+ /** The outcome of a weapon lookup, mirroring how creatures resolve. */
3
10
  export interface WeaponLookup {
4
11
  weapon?: WeaponRules;
12
+ /** Candidate names when a partial name matched several. */
5
13
  ambiguous?: string[];
6
14
  }
15
+ /**
16
+ * Resolves a weapon name.
17
+ *
18
+ * Aliases run before the fuzzy tiers so the names people actually type — "hand
19
+ * crossbow" rather than the SRD's "Crossbow, hand" — resolve exactly instead of
20
+ * ambiguously against the three crossbows.
21
+ * @param name The weapon as written
22
+ * @returns The weapon, the candidates, or an empty result
23
+ */
7
24
  export declare function resolveWeapon(name: string): WeaponLookup;
25
+ /** Every weapon name, for a listing or an error message. */
8
26
  export declare function weaponNames(): string[];
27
+ /**
28
+ * Whether the character is proficient with a weapon, across all their classes.
29
+ * @param state The character
30
+ * @param weapon The weapon
31
+ * @returns True when any of their classes grants it
32
+ */
9
33
  export declare function isProficientWith(state: SheetState, weapon: WeaponRules): boolean;
10
34
  export interface AttackOptions {
35
+ /** Use the versatile damage die, for a weapon wielded in two hands. */
11
36
  twoHanded?: boolean;
37
+ /** Throw a thrown melee weapon, which uses the ranged figures. */
12
38
  thrown?: boolean;
39
+ /** A magic weapon's bonus to both the attack roll and the damage. */
13
40
  magicBonus?: number;
41
+ /** Overrides the computed name, for a magic weapon: 'Longsword +1'. */
14
42
  name?: string;
15
43
  }
44
+ /**
45
+ * Builds the attack line for a weapon in this character's hands.
46
+ *
47
+ * Which ability applies is the part worth stating: a melee weapon uses Strength
48
+ * unless it is finesse, in which case the wielder picks the better of Strength and
49
+ * Dexterity; a ranged weapon uses Dexterity. A *thrown melee* weapon keeps its
50
+ * melee ability, which is why a thrown handaxe is Strength and a thrown dagger is
51
+ * not necessarily.
52
+ * @param state The character
53
+ * @param weapon The weapon
54
+ * @param options Wielding choices and any magic bonus
55
+ * @returns The attack entry to store on the sheet
56
+ */
16
57
  export declare function weaponAttack(state: SheetState, weapon: WeaponRules, options?: AttackOptions): AttackEntry;
58
+ /**
59
+ * Builds attack lines for every weapon the character is carrying.
60
+ *
61
+ * A versatile weapon is listed once, two-handed, because that is the higher die
62
+ * and a sheet listing the same weapon twice is noise. A thrown melee weapon is
63
+ * listed once as a melee attack, with `thrown` among its properties so the
64
+ * Dungeon Master knows it can be thrown. Anything the table does not recognise is
65
+ * skipped rather than guessed at.
66
+ * @param state The character
67
+ * @returns One attack entry per recognised weapon carried
68
+ */
17
69
  export declare function deriveAttacks(state: SheetState): AttackEntry[];
70
+ /**
71
+ * Brings the attack list back into step with what the character carries.
72
+ *
73
+ * Deliberately conservative. An entry is only touched when its name is *exactly*
74
+ * a table weapon's name — anything else is left alone, because "Longsword +1",
75
+ * "Claws" and a hand-written line are all things a tool has no business
76
+ * rewriting, and a fuzzy match would happily mistake the first for a plain
77
+ * longsword and strip its bonus.
78
+ * @param state The character, mutated in place
79
+ * @returns What changed, for the tool result
80
+ */
18
81
  export declare function syncWeaponAttacks(state: SheetState): {
19
82
  added: string[];
20
83
  removed: string[];
21
84
  };
85
+ /** Renders a weapon as a readable line, for a rules lookup. */
22
86
  export declare function describeWeapon(weapon: WeaponRules): string;
87
+ /** Resets the weapon index. Only needed by tests that mutate the table. */
23
88
  export declare function resetWeaponIndex(): void;
@@ -1,4 +1,10 @@
1
1
  "use strict";
2
+ /**
3
+ * Turns a weapon name into an attack line a character can actually use.
4
+ *
5
+ * This is the module that stops attack bonuses and damage being invented. It is
6
+ * pure and has no room access, like the rest of `engine/`.
7
+ */
2
8
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
9
  if (k2 === undefined) k2 = k;
4
10
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -56,6 +62,15 @@ function weaponIndex() {
56
62
  }
57
63
  return weaponIndexCache;
58
64
  }
65
+ /**
66
+ * Resolves a weapon name.
67
+ *
68
+ * Aliases run before the fuzzy tiers so the names people actually type — "hand
69
+ * crossbow" rather than the SRD's "Crossbow, hand" — resolve exactly instead of
70
+ * ambiguously against the three crossbows.
71
+ * @param name The weapon as written
72
+ * @returns The weapon, the candidates, or an empty result
73
+ */
59
74
  function resolveWeapon(name) {
60
75
  const key = (0, coerce_1.nameKey)(name || '');
61
76
  if (!key)
@@ -74,11 +89,20 @@ function resolveWeapon(name) {
74
89
  }
75
90
  return {};
76
91
  }
92
+ /** Every weapon name, for a listing or an error message. */
77
93
  function weaponNames() {
78
94
  return Object.values(weapons_1.WEAPONS).map((weapon) => weapon.name).sort();
79
95
  }
96
+ /**
97
+ * Whether the character is proficient with a weapon, across all their classes.
98
+ * @param state The character
99
+ * @param weapon The weapon
100
+ * @returns True when any of their classes grants it
101
+ */
80
102
  function isProficientWith(state, weapon) {
81
103
  const key = (0, coerce_1.nameKey)(weapon.name);
104
+ // A race can grant weapons a class does not: a dwarf wizard is proficient
105
+ // with a warhammer even though the wizard list stops at five weapons.
82
106
  if ((0, races_1.racialWeaponProficiencies)(state).some((named) => (0, coerce_1.nameKey)(named) === key))
83
107
  return true;
84
108
  if ((0, feats_1.featWeaponProficiencies)(state).some((named) => (0, coerce_1.nameKey)(named) === key))
@@ -92,6 +116,19 @@ function isProficientWith(state, weapon) {
92
116
  return proficiency.weapons.some((named) => (0, coerce_1.nameKey)(named) === key);
93
117
  });
94
118
  }
119
+ /**
120
+ * Builds the attack line for a weapon in this character's hands.
121
+ *
122
+ * Which ability applies is the part worth stating: a melee weapon uses Strength
123
+ * unless it is finesse, in which case the wielder picks the better of Strength and
124
+ * Dexterity; a ranged weapon uses Dexterity. A *thrown melee* weapon keeps its
125
+ * melee ability, which is why a thrown handaxe is Strength and a thrown dagger is
126
+ * not necessarily.
127
+ * @param state The character
128
+ * @param weapon The weapon
129
+ * @param options Wielding choices and any magic bonus
130
+ * @returns The attack entry to store on the sheet
131
+ */
95
132
  function weaponAttack(state, weapon, options = {}) {
96
133
  const str = rules.abilityModifier(state, 'str');
97
134
  const dex = rules.abilityModifier(state, 'dex');
@@ -107,6 +144,7 @@ function weaponAttack(state, weapon, options = {}) {
107
144
  dmg: damageExpression(dice, ability + magic),
108
145
  type: weapon.type,
109
146
  };
147
+ // Range for anything thrown or fired, reach for a weapon that extends it.
110
148
  const throwing = options.thrown && weapon.props.includes('thrown');
111
149
  if (weapon.kind === 'ranged' || throwing) {
112
150
  if (weapon.range)
@@ -122,6 +160,16 @@ function weaponAttack(state, weapon, options = {}) {
122
160
  entry.props = [...new Set(props)].sort();
123
161
  return entry;
124
162
  }
163
+ /**
164
+ * Combines damage dice with an ability modifier into one rollable expression.
165
+ *
166
+ * A weapon whose damage is a flat number rather than dice — the blowgun's 1 — has
167
+ * to be *summed* rather than suffixed, because `1+2` has no dice for the parser to
168
+ * find while `3` is a legal constant. The net deals none at all.
169
+ * @param dice The weapon's damage dice, a flat number, or '0'
170
+ * @param modifier The ability and magic bonus to add
171
+ * @returns A single expression the dice parser accepts
172
+ */
125
173
  function damageExpression(dice, modifier) {
126
174
  if (dice === '0')
127
175
  return '0';
@@ -131,6 +179,17 @@ function damageExpression(dice, modifier) {
131
179
  return dice;
132
180
  return modifier > 0 ? `${dice}+${modifier}` : `${dice}${modifier}`;
133
181
  }
182
+ /**
183
+ * Builds attack lines for every weapon the character is carrying.
184
+ *
185
+ * A versatile weapon is listed once, two-handed, because that is the higher die
186
+ * and a sheet listing the same weapon twice is noise. A thrown melee weapon is
187
+ * listed once as a melee attack, with `thrown` among its properties so the
188
+ * Dungeon Master knows it can be thrown. Anything the table does not recognise is
189
+ * skipped rather than guessed at.
190
+ * @param state The character
191
+ * @returns One attack entry per recognised weapon carried
192
+ */
134
193
  function deriveAttacks(state) {
135
194
  const seen = new Set();
136
195
  const attacks = [];
@@ -143,6 +202,17 @@ function deriveAttacks(state) {
143
202
  }
144
203
  return attacks;
145
204
  }
205
+ /**
206
+ * Brings the attack list back into step with what the character carries.
207
+ *
208
+ * Deliberately conservative. An entry is only touched when its name is *exactly*
209
+ * a table weapon's name — anything else is left alone, because "Longsword +1",
210
+ * "Claws" and a hand-written line are all things a tool has no business
211
+ * rewriting, and a fuzzy match would happily mistake the first for a plain
212
+ * longsword and strip its bonus.
213
+ * @param state The character, mutated in place
214
+ * @returns What changed, for the tool result
215
+ */
146
216
  function syncWeaponAttacks(state) {
147
217
  const carried = new Map();
148
218
  for (const item of state.inv) {
@@ -161,6 +231,7 @@ function syncWeaponAttacks(state) {
161
231
  continue;
162
232
  }
163
233
  if (carried.has((0, coerce_1.nameKey)(table.name))) {
234
+ // Still carried: recompute, since abilities or proficiency may have moved.
164
235
  kept.push(weaponAttack(state, table, { twoHanded: !!table.versatile }));
165
236
  }
166
237
  else {
@@ -177,6 +248,7 @@ function syncWeaponAttacks(state) {
177
248
  state.attacks = kept;
178
249
  return { added, removed };
179
250
  }
251
+ /** Renders a weapon as a readable line, for a rules lookup. */
180
252
  function describeWeapon(weapon) {
181
253
  const parts = [
182
254
  `**${weapon.name}** — ${weapon.category} ${weapon.kind} weapon`,
@@ -196,6 +268,7 @@ function describeWeapon(weapon) {
196
268
  parts.push(weapon.cost);
197
269
  return parts.join(' | ');
198
270
  }
271
+ /** Resets the weapon index. Only needed by tests that mutate the table. */
199
272
  function resetWeaponIndex() {
200
273
  weaponIndexCache = null;
201
274
  }
@@ -1,3 +1,21 @@
1
+ /**
2
+ * The 5e tool pack: dice, character sheets, and the rules arithmetic a Dungeon
3
+ * Master agent would otherwise have to do in prose.
4
+ *
5
+ * Nothing here is a Briyah feature. The pack is a set of native tools that read
6
+ * and write ordinary room artifacts, so a game is assembled the same way as any
7
+ * other room — agents with prompt folders, tool grants, and a room leader. See
8
+ * README.md for how the pieces fit together.
9
+ *
10
+ * Rules data comes from SRD 5.1 under CC-BY-4.0; see data/LICENSE-SRD.md.
11
+ */
1
12
  import { NativeToolDefinition } from '../../native-tool.types';
13
+ /**
14
+ * Every tool in the pack.
15
+ *
16
+ * Returned as a plain array rather than registered directly so it can be unit
17
+ * tested without a registry, and so an SDK host can register a subset.
18
+ * @returns The tool definitions
19
+ */
2
20
  export declare function dnd5eTools(): NativeToolDefinition[];
3
21
  export { SRD_ATTRIBUTION } from './data/srd';
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ /**
3
+ * The 5e tool pack: dice, character sheets, and the rules arithmetic a Dungeon
4
+ * Master agent would otherwise have to do in prose.
5
+ *
6
+ * Nothing here is a Briyah feature. The pack is a set of native tools that read
7
+ * and write ordinary room artifacts, so a game is assembled the same way as any
8
+ * other room — agents with prompt folders, tool grants, and a room leader. See
9
+ * README.md for how the pieces fit together.
10
+ *
11
+ * Rules data comes from SRD 5.1 under CC-BY-4.0; see data/LICENSE-SRD.md.
12
+ */
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.SRD_ATTRIBUTION = void 0;
4
15
  exports.dnd5eTools = dnd5eTools;
@@ -12,6 +23,13 @@ const encounter_tool_1 = require("./tools/encounter.tool");
12
23
  const monster_tool_1 = require("./tools/monster.tool");
13
24
  const item_tool_1 = require("./tools/item.tool");
14
25
  const spell_tool_1 = require("./tools/spell.tool");
26
+ /**
27
+ * Every tool in the pack.
28
+ *
29
+ * Returned as a plain array rather than registered directly so it can be unit
30
+ * tested without a registry, and so an SDK host can register a subset.
31
+ * @returns The tool definitions
32
+ */
15
33
  function dnd5eTools() {
16
34
  return [
17
35
  dice_tools_1.rollDiceTool,
@@ -1,2 +1,6 @@
1
+ /**
2
+ * The `check` tool: every d20 test a character makes, with the modifiers read off
3
+ * their sheet so no agent has to remember or invent a number.
4
+ */
1
5
  import { NativeToolDefinition } from '../../../native-tool.types';
2
6
  export declare const checkTool: NativeToolDefinition;