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
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RoomMessage = void 0;
4
4
  const app_types_1 = require("../../../shared/types/app.types");
5
+ /**
6
+ * Represents a message exchanged between conversations in a Room
7
+ */
5
8
  class RoomMessage {
6
9
  sender;
7
10
  action;
@@ -9,10 +12,41 @@ class RoomMessage {
9
12
  targets;
10
13
  timestamp;
11
14
  name;
12
- situation;
13
- changes;
15
+ situation; // Optional situation update (usually from narrator)
16
+ changes; // Generic story state changes from moderator (e.g. { update_portrait: [...] })
14
17
  index;
18
+ /**
19
+ * On a moderator's routing answer: the action the relayed message should carry
20
+ * in the room, rather than staying a MODERATE.
21
+ *
22
+ * A moderated message with no `relayAs` is stored in every recipient's history
23
+ * as `From: <sender>\n<content>` (see Agent.addToConversationHistory), which is
24
+ * what a story character expects and what a room agent that speaks the JSON
25
+ * protocol does not — half its history would model the wrong output format.
26
+ * Naming an action here makes the relayed message an ordinary room message: the
27
+ * right shape in history, and the right badge in the transcript.
28
+ *
29
+ * Only moderators whose `moderate.json` declares the field can produce it, so a
30
+ * moderator that says nothing keeps the original behaviour.
31
+ */
15
32
  relayAs;
33
+ /**
34
+ * Creates a new Message
35
+ *
36
+ * **Every name on a message is an `agentNickname`**, never an `agentName`. The
37
+ * nickname is what the room routes by, what an agent writes into `targets`, and
38
+ * what artifact viewers and the room leader are recorded as. `agentName` is a
39
+ * label — it names the role, carries the room's name as a prefix, and nothing
40
+ * resolves it. The parameters here said otherwise for a long time while every
41
+ * caller passed a nickname.
42
+ *
43
+ * @param sender The agentNickname of the agent sending the message
44
+ * @param content The content of the message
45
+ * @param action The action type of the message
46
+ * @param targets Array of agentNicknames that will receive the message
47
+ * @param name Optional name for PUBLISH and EXECUTE actions
48
+ * @param situation Optional situation update to set the current story situation
49
+ */
16
50
  constructor(sender, action = app_types_1.MessageAction.SPEAK, content, targets = [], name, situation) {
17
51
  this.sender = sender;
18
52
  this.action = action;
@@ -22,27 +56,57 @@ class RoomMessage {
22
56
  this.timestamp = new Date();
23
57
  this.situation = situation;
24
58
  }
59
+ /**
60
+ * Gets the sender of the message
61
+ * @returns The agentNickname of the sender
62
+ */
25
63
  getSender() {
26
64
  return this.sender;
27
65
  }
66
+ /**
67
+ * Gets the action type of the message
68
+ * @returns The message action
69
+ */
28
70
  getAction() {
29
71
  return this.action;
30
72
  }
73
+ /**
74
+ * Gets the content of the message
75
+ * @returns The message content
76
+ */
31
77
  getContent() {
32
78
  return this.content;
33
79
  }
80
+ /**
81
+ * Gets the targets of the message
82
+ * @returns Array of agentNicknames of target conversations
83
+ */
34
84
  getTargets() {
35
85
  return [...this.targets];
36
86
  }
87
+ /**
88
+ * Gets the timestamp when the message was created
89
+ * @returns The message timestamp
90
+ */
37
91
  getTimestamp() {
38
92
  return this.timestamp;
39
93
  }
94
+ /**
95
+ * Checks if an agent is a target of this message (intended recipient)
96
+ * @param agentNickname The agentNickname to check
97
+ * @returns True if the conversation is a target, false otherwise
98
+ */
40
99
  isTarget(agentNickname) {
100
+ // For SHOUT, everyone is a target
41
101
  if (this.action === app_types_1.MessageAction.SHOUT)
42
102
  return true;
103
+ // For THINK, only the sender is a target
43
104
  if (this.action === app_types_1.MessageAction.THINK) {
44
105
  return this.sender === agentNickname;
45
106
  }
107
+ // For WHISPER, RELAY, RELAY_SILENT, COMMISSION, and DELIVER, only specific
108
+ // agents are targets (COMMISSION targets the commissioned agents; DELIVER
109
+ // targets the commissioner)
46
110
  if (this.action === app_types_1.MessageAction.WHISPER ||
47
111
  this.action === app_types_1.MessageAction.RELAY ||
48
112
  this.action === app_types_1.MessageAction.RELAY_SILENT ||
@@ -50,15 +114,22 @@ class RoomMessage {
50
114
  this.action === app_types_1.MessageAction.DELIVER) {
51
115
  return this.targets.includes(agentNickname);
52
116
  }
117
+ // For SPEAK with targets, only those in the targets list are targets
53
118
  if (this.targets.length > 0) {
54
119
  return this.targets.includes(agentNickname);
55
120
  }
56
121
  return false;
57
122
  }
123
+ /**
124
+ * Checks if a conversation can hear this message
125
+ * @param agentNickname The agentNickname to check
126
+ * @returns True if the conversation can hear the message, false otherwise
127
+ */
58
128
  canHear(agentNickname) {
59
129
  if (this.sender === agentNickname) {
60
130
  return false;
61
131
  }
132
+ // TOOL messages are log-only notices of tool executions; no agent perceives them
62
133
  if (this.action === app_types_1.MessageAction.TOOL)
63
134
  return false;
64
135
  if (this.action === app_types_1.MessageAction.RELAY || this.action === app_types_1.MessageAction.RELAY_SILENT)
@@ -67,9 +138,13 @@ class RoomMessage {
67
138
  return this.targets.includes(agentNickname) || this.targets.length === 0;
68
139
  if (this.action === app_types_1.MessageAction.EXECUTE)
69
140
  return this.targets.includes(agentNickname) || this.targets.length === 0;
141
+ // For WHISPER, only specific targets can hear
70
142
  if (this.action === app_types_1.MessageAction.WHISPER) {
71
143
  return this.targets.includes(agentNickname);
72
144
  }
145
+ // For SPEAK, SHOUT, ADJOURN, COMMISSION, and DELIVER everyone can hear
146
+ // (COMMISSION/DELIVER are public like SPEAK; only the commissioner responds,
147
+ // which the room's commission orchestration enforces)
73
148
  return true;
74
149
  }
75
150
  }
@@ -1 +1,27 @@
1
+ /**
2
+ * What makes two nicknames indistinguishable to the room.
3
+ *
4
+ * A room routes by nickname, and `Room.checkAgentNicknameMatch` is deliberately
5
+ * loose: case-insensitive, and it also accepts a nickname's first word. That
6
+ * looseness is what lets a Dungeon Master write "Thorin" for "Thorin Oakenshield",
7
+ * and it is also what makes two nicknames collide without being equal.
8
+ *
9
+ * Pure, and free of Nest, the filesystem and any domain: it is engine logic that
10
+ * happens to have been written first for the RPG page's roster check, and both the
11
+ * roster and {@link Room.renameAgent} need the same answer.
12
+ */
13
+ /**
14
+ * True when some name a message could be addressed to would reach both of these.
15
+ *
16
+ * Note the test is not whether the two names match each other — "Thorin
17
+ * Oakenshield" and "Thorin Stonehelm" do not, since the matcher compares one
18
+ * side's first word against the other's whole name. It is whether a *third* string
19
+ * matches both, and "Thorin" matches both. Since the only strings the matcher can
20
+ * match are a full name and a first word, comparing the two names' full/first-word
21
+ * sets settles it.
22
+ *
23
+ * @param a One nickname
24
+ * @param b The other
25
+ * @returns True when a single name could route to either
26
+ */
1
27
  export declare function nicknamesAreAmbiguous(a: string, b: string): boolean;
@@ -1,6 +1,32 @@
1
1
  "use strict";
2
+ /**
3
+ * What makes two nicknames indistinguishable to the room.
4
+ *
5
+ * A room routes by nickname, and `Room.checkAgentNicknameMatch` is deliberately
6
+ * loose: case-insensitive, and it also accepts a nickname's first word. That
7
+ * looseness is what lets a Dungeon Master write "Thorin" for "Thorin Oakenshield",
8
+ * and it is also what makes two nicknames collide without being equal.
9
+ *
10
+ * Pure, and free of Nest, the filesystem and any domain: it is engine logic that
11
+ * happens to have been written first for the RPG page's roster check, and both the
12
+ * roster and {@link Room.renameAgent} need the same answer.
13
+ */
2
14
  Object.defineProperty(exports, "__esModule", { value: true });
3
15
  exports.nicknamesAreAmbiguous = nicknamesAreAmbiguous;
16
+ /**
17
+ * True when some name a message could be addressed to would reach both of these.
18
+ *
19
+ * Note the test is not whether the two names match each other — "Thorin
20
+ * Oakenshield" and "Thorin Stonehelm" do not, since the matcher compares one
21
+ * side's first word against the other's whole name. It is whether a *third* string
22
+ * matches both, and "Thorin" matches both. Since the only strings the matcher can
23
+ * match are a full name and a first word, comparing the two names' full/first-word
24
+ * sets settles it.
25
+ *
26
+ * @param a One nickname
27
+ * @param b The other
28
+ * @returns True when a single name could route to either
29
+ */
4
30
  function nicknamesAreAmbiguous(a, b) {
5
31
  const keys = (name) => {
6
32
  const trimmed = (name || '').trim();
@@ -99,7 +99,9 @@ let PublishedRoomsService = class PublishedRoomsService {
99
99
  }
100
100
  getPublishedRoomsForUser(userId) {
101
101
  return (Array.from(this.mapping.entries())
102
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
102
103
  .filter(([_roomId, uid]) => uid === userId)
104
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
103
105
  .map(([roomId, _uid]) => roomId));
104
106
  }
105
107
  };
@@ -1,4 +1,8 @@
1
1
  import { RoomTurnMode } from '../../../shared/types/app.types';
2
+ /**
3
+ * Interface for serializable room configuration
4
+ * Note: Artifacts are now stored as individual .artifact files in the room directory
5
+ */
2
6
  export interface RoomConfig {
3
7
  id: string;
4
8
  name: string;
@@ -12,9 +16,31 @@ export interface RoomConfig {
12
16
  createdAt: string;
13
17
  isPublished?: boolean;
14
18
  templateRoomId?: string;
19
+ /**
20
+ * The pack this room is filed under, which decides whether it is listed.
21
+ *
22
+ * Set when the room is built from a pack template, and editable afterwards so a
23
+ * user can file their own room under a pack of their own. Absent means "not
24
+ * filed", and a room naming a pack that is not installed is still listed.
25
+ *
26
+ * Deliberately not `templateRoomId`: that means "published instance", and
27
+ * `getTemplateRooms()` filters anything carrying one out of the Rooms list.
28
+ */
15
29
  pack?: string;
30
+ /** The pack template's key, when this room came from one. */
16
31
  packRoomKey?: string;
17
32
  }
33
+ /**
34
+ * Every setting a room carries, without its identity or its content.
35
+ *
36
+ * `RoomConfig` minus `id`, `agentIds`, `messages` and `createdAt` — the four a
37
+ * caller building a room from scratch supplies itself. Used by
38
+ * `RoomStoreService.readRoomSettings` / `applyRoomSettings`, which exist so that
39
+ * only one place has to name them all. `room-settings.spec.ts` pins the
40
+ * relationship, so adding a field to `RoomConfig` fails there until it is carried
41
+ * here too.
42
+ */
18
43
  export type RoomSettingsSnapshot = Omit<RoomConfig, 'id' | 'agentIds' | 'messages' | 'createdAt'> & Required<Pick<RoomConfig, 'roomLeader' | 'turnMode'>> & {
44
+ /** Never undefined here: `Room.getModerator()` normalizes absent to ''. */
19
45
  moderator: string;
20
46
  };
@@ -2,10 +2,22 @@ import { Room } from './room';
2
2
  import { RoomStoreService } from './room-store.service';
3
3
  import { ToolStoreService } from '../tools/tool-store.service';
4
4
  import { ToolExecutionService } from '../tools/tool-execution.service';
5
+ /**
6
+ * Factory for creating Room instances
7
+ * Not a singleton - instantiated per-user by UserServiceFactory
8
+ */
5
9
  export declare class RoomFactory {
6
10
  private readonly roomStoreService;
7
11
  private readonly toolStoreService;
8
12
  private readonly toolExecutionService;
9
13
  constructor(roomStoreService: RoomStoreService, toolStoreService: ToolStoreService, toolExecutionService: ToolExecutionService);
14
+ /**
15
+ * Creates a room with the specified parameters
16
+ * @param name The room name
17
+ * @param goal The room goal/purpose
18
+ * @param baseRoomDir Optional base room directory (defaults to '')
19
+ * @param storageDir Optional storage directory (defaults to roomStore default)
20
+ * @returns Created Room instance
21
+ */
10
22
  createRoom(name: string, goal: string, baseRoomDir?: string, storageDir?: string): Room;
11
23
  }
@@ -2,6 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RoomFactory = void 0;
4
4
  const room_1 = require("./room");
5
+ /**
6
+ * Factory for creating Room instances
7
+ * Not a singleton - instantiated per-user by UserServiceFactory
8
+ */
5
9
  class RoomFactory {
6
10
  roomStoreService;
7
11
  toolStoreService;
@@ -11,8 +15,18 @@ class RoomFactory {
11
15
  this.toolStoreService = toolStoreService;
12
16
  this.toolExecutionService = toolExecutionService;
13
17
  }
18
+ /**
19
+ * Creates a room with the specified parameters
20
+ * @param name The room name
21
+ * @param goal The room goal/purpose
22
+ * @param baseRoomDir Optional base room directory (defaults to '')
23
+ * @param storageDir Optional storage directory (defaults to roomStore default)
24
+ * @returns Created Room instance
25
+ */
14
26
  createRoom(name, goal, baseRoomDir = '', storageDir = '') {
27
+ // Use default storage dir if not provided
15
28
  const finalStorageDir = storageDir || this.roomStoreService.getDefaultStorageDir();
29
+ // Create room with all dependencies
16
30
  const room = new room_1.Room(null, name, goal, baseRoomDir, finalStorageDir, this.roomStoreService);
17
31
  room.setToolServices(this.toolStoreService, this.toolExecutionService);
18
32
  return room;
@@ -1,9 +1,37 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import { RoomMessageUpdate } from '../../../shared/types/app.types';
3
+ /**
4
+ * Service to manage Server-Sent Events (SSE) for room message updates
5
+ * Maintains EventEmitters for each room to push real-time updates to connected clients
6
+ */
3
7
  export declare class RoomMessageService {
4
8
  private messageEmitters;
9
+ /**
10
+ * Gets or creates an EventEmitter for a specific room
11
+ * @param roomId The room ID
12
+ * @returns EventEmitter for the room
13
+ */
5
14
  getOrCreateEmitter(roomId: string): EventEmitter;
15
+ /**
16
+ * Emits an update event for a room
17
+ * @param roomId The room ID
18
+ * @param roomState The room state update to emit
19
+ */
6
20
  emitUpdate(roomId: string, roomState: RoomMessageUpdate): void;
21
+ /**
22
+ * Emits an error event for a room
23
+ *
24
+ * On the same `'update'` event as {@link emitUpdate}, discriminated by `type`:
25
+ * an EventEmitter throws when an `'error'` event has no listener, which would
26
+ * take down a host that subscribed only to updates.
27
+ *
28
+ * @param roomId The room ID
29
+ * @param error The error that occurred
30
+ */
7
31
  emitError(roomId: string, error: Error): void;
32
+ /**
33
+ * Cleans up the EventEmitter for a room
34
+ * @param roomId The room ID
35
+ */
8
36
  cleanup(roomId: string): void;
9
37
  }
@@ -9,18 +9,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.RoomMessageService = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
11
  const events_1 = require("events");
12
+ /**
13
+ * Service to manage Server-Sent Events (SSE) for room message updates
14
+ * Maintains EventEmitters for each room to push real-time updates to connected clients
15
+ */
12
16
  let RoomMessageService = class RoomMessageService {
13
17
  messageEmitters = new Map();
18
+ /**
19
+ * Gets or creates an EventEmitter for a specific room
20
+ * @param roomId The room ID
21
+ * @returns EventEmitter for the room
22
+ */
14
23
  getOrCreateEmitter(roomId) {
15
24
  if (!this.messageEmitters.has(roomId)) {
16
25
  this.messageEmitters.set(roomId, new events_1.EventEmitter());
17
26
  }
18
27
  return this.messageEmitters.get(roomId);
19
28
  }
29
+ /**
30
+ * Emits an update event for a room
31
+ * @param roomId The room ID
32
+ * @param roomState The room state update to emit
33
+ */
20
34
  emitUpdate(roomId, roomState) {
21
35
  const emitter = this.getOrCreateEmitter(roomId);
22
36
  emitter.emit('update', roomState);
23
37
  }
38
+ /**
39
+ * Emits an error event for a room
40
+ *
41
+ * On the same `'update'` event as {@link emitUpdate}, discriminated by `type`:
42
+ * an EventEmitter throws when an `'error'` event has no listener, which would
43
+ * take down a host that subscribed only to updates.
44
+ *
45
+ * @param roomId The room ID
46
+ * @param error The error that occurred
47
+ */
24
48
  emitError(roomId, error) {
25
49
  const emitter = this.getOrCreateEmitter(roomId);
26
50
  const update = {
@@ -31,6 +55,10 @@ let RoomMessageService = class RoomMessageService {
31
55
  };
32
56
  emitter.emit('update', update);
33
57
  }
58
+ /**
59
+ * Cleans up the EventEmitter for a room
60
+ * @param roomId The room ID
61
+ */
34
62
  cleanup(roomId) {
35
63
  const emitter = this.messageEmitters.get(roomId);
36
64
  if (emitter) {
@@ -9,6 +9,15 @@ import { ArtifactStoreService } from './artifact-store.service';
9
9
  import { Artifact } from './artifact';
10
10
  import { ToolStoreService } from '../tools/tool-store.service';
11
11
  import { ToolExecutionService } from '../tools/tool-execution.service';
12
+ /**
13
+ * A service that stores and retrieves Room objects by ID
14
+ * Each room is stored in its own folder (named by GUID) containing:
15
+ * - metadata.json: Room configuration without messages
16
+ * - messages: Plain text file with messages separated by '====' delimiter (allows efficient appending)
17
+ * Rooms load their agents from an adjacent 'agents' directory
18
+ * Supports configurable storage directories (e.g., for story-specific rooms)
19
+ * Uses lazy loading - rooms are loaded from disk on first access
20
+ */
12
21
  export declare class RoomStoreService {
13
22
  private readonly userPaths;
14
23
  private readonly agentStore;
@@ -21,29 +30,196 @@ export declare class RoomStoreService {
21
30
  private loaded;
22
31
  private loadPromise;
23
32
  constructor(userPaths: UserPathsService, agentStore: AgentStoreService, attachedFileService: AttachedFileService, artifactStoreService: ArtifactStoreService, toolStoreService: ToolStoreService, toolExecutionService: ToolExecutionService);
33
+ /**
34
+ * Gets the default storage directory for rooms
35
+ * @returns The default storage directory path
36
+ */
24
37
  getDefaultStorageDir(): string;
38
+ /**
39
+ * Stores a room and returns its unique ID
40
+ * If the room already has an ID in the store, it updates that entry instead
41
+ * @param room The room to store
42
+ * @param storageDir Optional custom storage directory (defaults to server/data/rooms)
43
+ * @returns The unique ID for the room
44
+ */
25
45
  storeRoom(room: Room, storageDir?: string): string;
46
+ /**
47
+ * Retrieves a room by its ID
48
+ * @param id The room ID
49
+ * @returns The room, or null if not found
50
+ */
26
51
  getRoom(id: string): Promise<Room | null>;
52
+ /**
53
+ * Removes a room from the store and deletes its file.
54
+ *
55
+ * The agents the room owns go with it. Ownership is what decides this, not the
56
+ * kind of room: an agent is created for one room and belongs to nothing else,
57
+ * so leaving it behind would leave an agent no page lists and nothing can
58
+ * reach.
59
+ *
60
+ * @param id The room ID
61
+ * @param storageDir Optional custom storage directory (defaults to server/data/rooms)
62
+ * @returns True if the room was found and removed, false otherwise
63
+ */
27
64
  removeRoom(id: string, storageDir?: string): boolean;
65
+ /**
66
+ * Gets all room IDs from the in-memory store
67
+ * @returns Array of room IDs
68
+ */
28
69
  getAllRoomIds(): Promise<string[]>;
70
+ /**
71
+ * Gets the number of rooms in the store
72
+ * @returns The number of rooms
73
+ */
29
74
  getRoomCount(): number;
75
+ /**
76
+ * Clones a room as a published instance with all agents cloned
77
+ * @param templateId The ID of the template room to clone
78
+ * @param publishedName The name for the published instance
79
+ * @param userId The user ID (for tracking purposes)
80
+ * @returns The ID of the newly created published instance
81
+ */
30
82
  cloneRoomAsPublished(templateId: string, publishedName: string, userId: string): Promise<string>;
83
+ /**
84
+ * Reads every setting a room carries, as one object.
85
+ *
86
+ * Deliberately excludes `id`, `agentIds`, `messages` and `createdAt`: those are
87
+ * identity and content rather than settings, and a caller building a room from
88
+ * scratch supplies them itself. `room-settings.spec.ts` asserts this list stays
89
+ * equal to `RoomConfig` minus those four.
90
+ *
91
+ * @param room The room to read
92
+ * @returns Its settings
93
+ */
31
94
  static readRoomSettings(room: Room): RoomSettingsSnapshot;
95
+ /**
96
+ * Applies a settings snapshot to a room — the one place that names them all.
97
+ *
98
+ * Every caller that builds a room from scratch rather than copying one has to
99
+ * set each of these, and there is now more than one such caller. The moderator
100
+ * was missing from the published-clone path for a while and the omission was
101
+ * quiet: `getModeratorAgent()` falls back to the first agent holding a
102
+ * `moderate` prompt, so routing kept working and the only symptom was that
103
+ * agent also being perceived into play as an ordinary participant.
104
+ *
105
+ * **Call this after the agents have arrived.** `roomLeader` and `moderator` are
106
+ * nicknames resolved against the roster, so a room with no agents yet drops
107
+ * both silently.
108
+ *
109
+ * @param room The room to configure, with its agents already in it
110
+ * @param settings The settings to apply
111
+ */
32
112
  static applyRoomSettings(room: Room, settings: RoomSettingsSnapshot): void;
113
+ /**
114
+ * Resolves a stored room-leader value to the nickname Room compares against.
115
+ * Accepts a nickname, an agentName, or a partial nickname, because the leader
116
+ * was historically written from whichever of those the caller had to hand.
117
+ * @param room The room whose agents are the candidates
118
+ * @param stored The leader value read from disk (may be empty or stale)
119
+ * @returns The matching agent's nickname, or '' when nothing matches
120
+ */
33
121
  static resolveLeaderNickname(room: Room, stored: string | undefined): string;
122
+ /**
123
+ * Gets all published instances of a template room
124
+ * @param templateId The ID of the template room
125
+ * @returns Array of published room instances
126
+ */
34
127
  getPublishedInstances(templateId: string): Promise<Room[]>;
128
+ /**
129
+ * Gets every published instance, whichever template it came from.
130
+ *
131
+ * The counterpart to {@link getTemplateRooms}: between them they cover the
132
+ * store, since a room either was cloned from a template or was not.
133
+ * @returns Array of published room instances
134
+ */
135
+ /**
136
+ * Every room in the store, templates and published instances alike.
137
+ *
138
+ * For operations that follow an *agent* rather than a room — renaming one means
139
+ * repointing the artifacts and the leader of every room it sits in, and an agent
140
+ * that is not room-owned may sit in several.
141
+ *
142
+ * @returns Every loaded room
143
+ */
35
144
  getAllRooms(): Promise<Room[]>;
36
145
  getAllPublishedInstances(): Promise<Room[]>;
146
+ /**
147
+ * Ensures default rooms are loaded from disk (lazy loading)
148
+ * Only loads once - subsequent calls are no-op
149
+ * Uses promise memoization to prevent concurrent loads
150
+ */
37
151
  private ensureLoaded;
152
+ /**
153
+ * Gets room details for the rooms a user builds and owns.
154
+ *
155
+ * A published instance is left out. It is a clone reached through the template
156
+ * it belongs to — `getPublishedInstances` lists them, and the Published tab is
157
+ * where they are opened, reset and deleted. Listed alongside its template it is
158
+ * a second room with the same name that behaves differently, which is how a
159
+ * template ends up edited when the instance was meant.
160
+ *
161
+ * @returns Array of room details objects
162
+ */
38
163
  getTemplateRooms(): Promise<RoomInfo[]>;
39
164
  readRoomMessagesFromFileAsync(messagesPath: string): Promise<RoomMessage[]>;
165
+ /**
166
+ * Loads rooms from a specific directory
167
+ * Used for loading story-specific rooms
168
+ * Agents are loaded from the adjacent 'agents' directory
169
+ * @param storageDir The directory to load rooms from
170
+ */
40
171
  loadRoomsFromDirectory(storageDir: string): Promise<void>;
172
+ /**
173
+ * Saves a single room to its own folder with metadata.json and messages file
174
+ * @param room The room to save
175
+ * @param storageDir The directory to save the room in
176
+ */
41
177
  private saveRoomToFile;
178
+ /**
179
+ * Appends a single message to the room's messages file
180
+ * @param roomId The room ID
181
+ * @param message The message to append
182
+ * @param storageDir The directory containing the room folder
183
+ */
42
184
  appendMessageToFile(roomId: string, message: RoomMessage, storageDir: string): void;
185
+ /**
186
+ * Clears all messages from a room (both in-memory and on disk)
187
+ * @param roomId The room ID
188
+ * @param storageDir Optional custom storage directory (defaults to server/data/rooms)
189
+ */
43
190
  clearRoomMessages(roomId: string, storageDir?: string): void;
191
+ /**
192
+ * Saves a single artifact to its own file
193
+ * @param roomId The room ID
194
+ * @param storageDir The directory containing the room folder
195
+ * @param artifact The artifact to save
196
+ */
44
197
  saveArtifactFile(roomId: string, storageDir: string, artifact: Artifact): void;
198
+ /**
199
+ * Deletes a single artifact file
200
+ * @param roomId The room ID
201
+ * @param storageDir The directory containing the room folder
202
+ * @param artifactName The name of the artifact to delete
203
+ * @returns True if the artifact was found and deleted, false otherwise
204
+ */
45
205
  deleteArtifactFile(roomId: string, storageDir: string, artifactName: string): boolean;
206
+ /**
207
+ * Deletes all artifact files for a room
208
+ * @param roomId The room ID
209
+ * @param storageDir The directory containing the room folder
210
+ */
46
211
  deleteAllArtifactFiles(roomId: string, storageDir: string): void;
212
+ /**
213
+ * Loads all artifact files for a room from disk. Used to refresh a Room's
214
+ * in-memory artifacts after the underlying files have been replaced
215
+ * (e.g. when reverting a chapter from backup).
216
+ */
47
217
  loadArtifactFiles(roomId: string, storageDir: string): Artifact[];
218
+ /**
219
+ * Deletes a room's folder and all its contents, along with the agents it owns
220
+ * @param roomId The room ID
221
+ * @param storageDir The directory containing the room folder
222
+ * @param room The room object (for accessing the agents to delete)
223
+ */
48
224
  private deleteRoomFile;
49
225
  }