briyah 1.5.0 → 2.0.1

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 (231) hide show
  1. package/README.md +1272 -994
  2. package/data/common/config/markup +1 -1
  3. package/data/common/prompts/character/progress_character.json +5 -5
  4. package/data/common/prompts/illustrator/describe_scene.json +11 -3
  5. package/data/common/prompts/perceive.json +2 -2
  6. package/data/common/prompts/room_moderator/moderate.json +34 -34
  7. package/data/common/prompts/story_moderator/moderate.json +62 -62
  8. package/data/packs/dnd5e/agents/battle-master.json +6 -0
  9. package/data/packs/dnd5e/agents/campaign-designer.json +6 -0
  10. package/data/packs/dnd5e/agents/character-creator.json +6 -0
  11. package/data/packs/dnd5e/agents/dungeon-master.json +6 -0
  12. package/data/packs/dnd5e/agents/player.json +13 -0
  13. package/data/packs/dnd5e/agents/table-moderator.json +6 -0
  14. package/data/{common/artifacts/dnd5e/dungeon_master-procedure.md → packs/dnd5e/artifacts/battle_master-combat.md} +31 -131
  15. package/data/packs/dnd5e/artifacts/dungeon_master-procedure.md +192 -0
  16. package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/manifest.json +8 -2
  17. package/data/packs/dnd5e/pack.json +6 -0
  18. package/data/packs/dnd5e/prompts/battle_master/defaults_config.json +23 -0
  19. package/data/packs/dnd5e/prompts/battle_master/perceive.json +33 -0
  20. package/data/packs/dnd5e/prompts/battle_master/perceive.prompt +378 -0
  21. package/data/{common → packs/dnd5e}/prompts/character_creator/defaults_config.json +1 -1
  22. package/data/{common → packs/dnd5e}/prompts/character_creator/perceive.prompt +29 -0
  23. package/data/{common → packs/dnd5e}/prompts/dnd_player/perceive.prompt +40 -22
  24. package/data/{common → packs/dnd5e}/prompts/dnd_room_moderator/moderate.json +34 -34
  25. package/data/{common → packs/dnd5e}/prompts/dnd_room_moderator/moderate.prompt +14 -3
  26. package/data/{common → packs/dnd5e}/prompts/dungeon_master/defaults_config.json +1 -0
  27. package/data/{common → packs/dnd5e}/prompts/dungeon_master/perceive.prompt +122 -115
  28. package/data/packs/dnd5e/prompts/dungeon_master/system_instruction.prompt +0 -0
  29. package/data/packs/dnd5e/rooms/table.json +16 -0
  30. package/dist-sdk/server/src/ai/LLM/base-ai.service.js +4 -13
  31. package/dist-sdk/server/src/ai/LLM/deepseek.service.d.ts +2 -1
  32. package/dist-sdk/server/src/ai/LLM/deepseek.service.js +65 -77
  33. package/dist-sdk/server/src/ai/agent-config.d.ts +2 -0
  34. package/dist-sdk/server/src/ai/agent-store.service.js +8 -0
  35. package/dist-sdk/server/src/ai/agent.d.ts +6 -0
  36. package/dist-sdk/server/src/ai/agent.js +25 -2
  37. package/dist-sdk/server/src/ai/artifact.service.d.ts +3 -1
  38. package/dist-sdk/server/src/ai/artifact.service.js +12 -5
  39. package/dist-sdk/server/src/ai/pack-artifacts.d.ts +3 -3
  40. package/dist-sdk/server/src/ai/pack-artifacts.js +21 -15
  41. package/dist-sdk/server/src/app/user-service-factory.js +9 -1
  42. package/dist-sdk/server/src/app.controller.d.ts +11 -11
  43. package/dist-sdk/server/src/app.controller.js +179 -89
  44. package/dist-sdk/server/src/app.service.d.ts +30 -7
  45. package/dist-sdk/server/src/app.service.js +146 -95
  46. package/dist-sdk/server/src/common/errors.d.ts +0 -3
  47. package/dist-sdk/server/src/common/errors.js +1 -11
  48. package/dist-sdk/server/src/config/prompt-resolver.d.ts +41 -0
  49. package/dist-sdk/server/src/config/prompt-resolver.js +196 -0
  50. package/dist-sdk/server/src/config/user-config.service.d.ts +17 -0
  51. package/dist-sdk/server/src/config/user-config.service.js +103 -0
  52. package/dist-sdk/server/src/config/user-paths.service.d.ts +4 -4
  53. package/dist-sdk/server/src/config/user-paths.service.js +12 -16
  54. package/dist-sdk/server/src/packs/pack-instantiation.service.d.ts +36 -0
  55. package/dist-sdk/server/src/packs/pack-instantiation.service.js +165 -0
  56. package/dist-sdk/server/src/packs/pack-manifest.d.ts +52 -0
  57. package/dist-sdk/server/src/packs/pack-manifest.js +256 -0
  58. package/dist-sdk/server/src/packs/pack.service.d.ts +24 -0
  59. package/dist-sdk/server/src/packs/pack.service.js +151 -0
  60. package/dist-sdk/server/src/room/room-config.d.ts +5 -0
  61. package/dist-sdk/server/src/room/room-message.service.d.ts +2 -1
  62. package/dist-sdk/server/src/room/room-message.service.js +3 -2
  63. package/dist-sdk/server/src/room/room-store.service.d.ts +3 -0
  64. package/dist-sdk/server/src/room/room-store.service.js +41 -5
  65. package/dist-sdk/server/src/room/room.d.ts +7 -0
  66. package/dist-sdk/server/src/room/room.js +33 -3
  67. package/dist-sdk/server/src/sdk/briyah.d.ts +2 -0
  68. package/dist-sdk/server/src/sdk/briyah.js +45 -8
  69. package/dist-sdk/server/src/sdk/index.d.ts +7 -2
  70. package/dist-sdk/server/src/sdk/index.js +6 -2
  71. package/dist-sdk/server/src/shared/shared.module.js +0 -3
  72. package/dist-sdk/server/src/story/story.service.d.ts +2 -2
  73. package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.d.ts +17 -0
  74. package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.js +54 -0
  75. package/dist-sdk/server/src/tools/packs/dnd5e/data/races.d.ts +3 -0
  76. package/dist-sdk/server/src/tools/packs/dnd5e/data/races.js +6 -0
  77. package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.d.ts +2 -0
  78. package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.js +4 -0
  79. package/dist-sdk/server/src/tools/packs/dnd5e/engine/backgrounds.d.ts +1 -1
  80. package/dist-sdk/server/src/tools/packs/dnd5e/engine/backgrounds.js +6 -3
  81. package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.d.ts +3 -0
  82. package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.js +45 -5
  83. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.d.ts +27 -0
  84. package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.js +103 -0
  85. package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.d.ts +7 -0
  86. package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.js +83 -0
  87. package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.d.ts +19 -0
  88. package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.js +130 -0
  89. package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.d.ts +2 -1
  90. package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.js +13 -2
  91. package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.d.ts +6 -0
  92. package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.js +16 -0
  93. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +10 -0
  94. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +82 -1
  95. package/dist-sdk/server/src/tools/packs/dnd5e/index.js +2 -0
  96. package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.js +51 -6
  97. package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.js +19 -9
  98. package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.d.ts +2 -0
  99. package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.js +134 -0
  100. package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.js +31 -13
  101. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +2 -0
  102. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +25 -8
  103. package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +70 -4
  104. package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.js +27 -0
  105. package/dist-sdk/server/src/tools/packs/index.d.ts +1 -2
  106. package/dist-sdk/server/src/tools/packs/index.js +5 -11
  107. package/dist-sdk/shared/types/app.types.d.ts +81 -13
  108. package/docs/assets/hierarchy.js +1 -1
  109. package/docs/assets/highlight.css +15 -1
  110. package/docs/assets/icons.js +1 -1
  111. package/docs/assets/icons.svg +1 -1
  112. package/docs/assets/main.js +4 -4
  113. package/docs/assets/navigation.js +1 -1
  114. package/docs/assets/search.js +1 -1
  115. package/docs/assets/style.css +18 -3
  116. package/docs/classes/Agent.html +702 -37
  117. package/docs/classes/Briyah.html +250 -33
  118. package/docs/classes/BriyahConfigService.html +117 -10
  119. package/docs/classes/NativeToolRegistry.html +156 -11
  120. package/docs/classes/PackInstantiationService.html +157 -0
  121. package/docs/classes/PackService.html +247 -0
  122. package/docs/classes/Room.html +1190 -77
  123. package/docs/classes/RoomMessage.html +260 -29
  124. package/docs/enums/MessageAction.html +123 -3
  125. package/docs/functions/availableToolPacks.html +41 -2
  126. package/docs/functions/dnd5eTools.html +42 -3
  127. package/docs/functions/installToolPacks.html +48 -0
  128. package/docs/functions/registerToolPacks.html +54 -6
  129. package/docs/hierarchy.html +42 -1
  130. package/docs/index.html +301 -54
  131. package/docs/interfaces/AgentCreationOptions.html +110 -11
  132. package/docs/interfaces/AgentInfo.html +188 -3
  133. package/docs/interfaces/AgentMessagesResponse.html +71 -2
  134. package/docs/interfaces/AppService.html +2806 -474
  135. package/docs/interfaces/Artifact.html +81 -4
  136. package/docs/interfaces/ArtifactMetadata.html +104 -3
  137. package/docs/interfaces/ArtifactWriteOptions.html +75 -6
  138. package/docs/interfaces/AttachDocumentResponse.html +61 -2
  139. package/docs/interfaces/BriyahConfigOptions.html +107 -10
  140. package/docs/interfaces/ChapterInfo.html +61 -2
  141. package/docs/interfaces/Character.html +81 -2
  142. package/docs/interfaces/CreateAgentResponse.html +56 -2
  143. package/docs/interfaces/CreateRoomResponse.html +61 -2
  144. package/docs/interfaces/CreateStoryResponse.html +56 -2
  145. package/docs/interfaces/FileList.html +56 -2
  146. package/docs/interfaces/FileMetadata.html +84 -3
  147. package/docs/interfaces/IConfigService.html +76 -3
  148. package/docs/interfaces/InstantiateModels.html +64 -0
  149. package/docs/interfaces/InstantiateRoomResult.html +70 -0
  150. package/docs/interfaces/LoadedPack.html +131 -0
  151. package/docs/interfaces/LoggingOptions.html +86 -7
  152. package/docs/interfaces/Message.html +80 -2
  153. package/docs/interfaces/ModelChoice.html +73 -0
  154. package/docs/interfaces/ModelInfo.html +71 -2
  155. package/docs/interfaces/NativeToolDefinition.html +96 -9
  156. package/docs/interfaces/PackAgentTemplate.html +101 -0
  157. package/docs/interfaces/PackRoomTemplate.html +108 -0
  158. package/docs/interfaces/PackView.html +172 -0
  159. package/docs/interfaces/PreparedPromptResponse.html +61 -2
  160. package/docs/interfaces/ProcessTextResponse.html +81 -2
  161. package/docs/interfaces/PromptFile.html +69 -2
  162. package/docs/interfaces/PromptFileContent.html +75 -2
  163. package/docs/interfaces/PromptFilesResponse.html +56 -2
  164. package/docs/interfaces/PromptFolder.html +79 -2
  165. package/docs/interfaces/PromptFolderDefaults.html +136 -5
  166. package/docs/interfaces/PromptFolderDefaultsResponse.html +78 -4
  167. package/docs/interfaces/PromptFoldersResponse.html +56 -2
  168. package/docs/interfaces/RoomDetails.html +133 -4
  169. package/docs/interfaces/RoomErrorUpdate.html +82 -0
  170. package/docs/interfaces/RoomInfo.html +84 -2
  171. package/docs/interfaces/RoomMessageUpdate.html +106 -2
  172. package/docs/interfaces/RoomMessagesResponse.html +61 -2
  173. package/docs/interfaces/SendMessageResult.html +61 -2
  174. package/docs/interfaces/StoryErrorEvent.html +76 -4
  175. package/docs/interfaces/StoryIdea.html +71 -2
  176. package/docs/interfaces/StoryInfo.html +173 -3
  177. package/docs/interfaces/StoryIntroduceCharacterEvent.html +71 -4
  178. package/docs/interfaces/StoryProgressChapterEvent.html +64 -3
  179. package/docs/interfaces/StoryState.html +99 -6
  180. package/docs/interfaces/StoryStateEvent.html +69 -3
  181. package/docs/interfaces/ToolArtifact.html +81 -4
  182. package/docs/interfaces/ToolCaller.html +75 -6
  183. package/docs/interfaces/ToolDefinition.html +76 -2
  184. package/docs/interfaces/ToolHelpers.html +91 -6
  185. package/docs/interfaces/ToolParameter.html +71 -2
  186. package/docs/interfaces/ToolRoomAccess.html +200 -24
  187. package/docs/interfaces/ToolSummary.html +71 -2
  188. package/docs/interfaces/ToolsResponse.html +66 -2
  189. package/docs/interfaces/Transaction.html +96 -2
  190. package/docs/interfaces/TransactionHistoryResponse.html +61 -2
  191. package/docs/modules.html +53 -1
  192. package/docs/types/PackOrigin.html +34 -0
  193. package/docs/types/PromptScope.html +34 -1
  194. package/docs/types/RoomTurnMode.html +36 -2
  195. package/docs/types/RoomUpdate.html +36 -0
  196. package/docs/types/RosterOverrides.html +42 -0
  197. package/docs/types/ToolContext.html +36 -2
  198. package/docs/types/ToolRunResult.html +34 -1
  199. package/package.json +139 -139
  200. package/src/tools/packs/dnd5e/README.md +186 -27
  201. package/dist-sdk/server/src/library/library.service.d.ts +0 -14
  202. package/dist-sdk/server/src/library/library.service.js +0 -165
  203. package/docs/functions/enabledToolPacks.html +0 -2
  204. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/campaign_designer-setting.md +0 -0
  205. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/character_creator-basics.md +0 -0
  206. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-barbarian.md +0 -0
  207. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-bard.md +0 -0
  208. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-cleric.md +0 -0
  209. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-druid.md +0 -0
  210. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-fighter.md +0 -0
  211. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-monk.md +0 -0
  212. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-paladin.md +0 -0
  213. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-ranger.md +0 -0
  214. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-rogue.md +0 -0
  215. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-sorcerer.md +0 -0
  216. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-warlock.md +0 -0
  217. /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-wizard.md +0 -0
  218. /package/data/{common/prompts/campaign_designer → packs/dnd5e/prompts/battle_master}/system_instruction.prompt +0 -0
  219. /package/data/{common → packs/dnd5e}/prompts/campaign_designer/defaults_config.json +0 -0
  220. /package/data/{common → packs/dnd5e}/prompts/campaign_designer/perceive.json +0 -0
  221. /package/data/{common → packs/dnd5e}/prompts/campaign_designer/perceive.prompt +0 -0
  222. /package/data/{common/prompts/character_creator → packs/dnd5e/prompts/campaign_designer}/system_instruction.prompt +0 -0
  223. /package/data/{common → packs/dnd5e}/prompts/character_creator/perceive.json +0 -0
  224. /package/data/{common/prompts/dnd_player → packs/dnd5e/prompts/character_creator}/system_instruction.prompt +0 -0
  225. /package/data/{common → packs/dnd5e}/prompts/dnd_player/defaults_config.json +0 -0
  226. /package/data/{common → packs/dnd5e}/prompts/dnd_player/perceive.json +0 -0
  227. /package/data/{common/prompts/dnd_room_moderator → packs/dnd5e/prompts/dnd_player}/system_instruction.prompt +0 -0
  228. /package/data/{common → packs/dnd5e}/prompts/dnd_room_moderator/defaults_config.json +0 -0
  229. /package/data/{common/prompts/dungeon_master → packs/dnd5e/prompts/dnd_room_moderator}/system_instruction.prompt +0 -0
  230. /package/data/{common → packs/dnd5e}/prompts/dungeon_master/compact_agent.prompt +0 -0
  231. /package/data/{common → packs/dnd5e}/prompts/dungeon_master/perceive.json +0 -0
@@ -133,8 +133,37 @@ LLM call.
133
133
  monster's claws, a weapon you invented.
134
134
  - `rules_lookup` covers equipment too, so you can check what a weapon does before offering
135
135
  it: `rules_lookup` with topic "glaive" or "chain mail".
136
+ - **REQUIRED**: **Ask the player about tool proficiencies, and put what they choose in the
137
+ spec's `tools` list** — `"tools": ["Lute", "Drum", "Flute"]`. Your class document names what
138
+ the class gives: a rogue's thieves' tools and a druid's herbalism kit are granted for you, but
139
+ a bard's *three musical instruments* and a monk's *one artisan's tool or instrument* are the
140
+ player's to pick, and so is a dwarf's choice of smith's tools, brewer's supplies or mason's
141
+ tools. Read the result's `tools.stillToChoose`, the race's `stillToChoose` and the
142
+ background's: each one names a decision nobody has made yet. Go back to the player with it
143
+ rather than leaving it, and add the answer with `patch_sheet` — `{"append": {"toolProf":
144
+ ["Lute"]}}`. A tool the book does not carry is fine; write it as the player said it.
145
+ - A rogue may spend one of their two **Expertise** picks on thieves' tools rather than on
146
+ a second skill. Put it in `expertise` alongside the skills — `"expertise": ["stealth",
147
+ "thieves' tools"]` — and the tool sorts them out. That doubles the proficiency bonus on
148
+ every thieves' tools check, which for a rogue is most of the locks in the campaign.
136
149
  - Use `patch_sheet` to add anything `create_sheet` does not cover, such as a class feature
137
150
  with limited uses.
151
+ - **REQUIRED**: **A sheet has a fixed set of fields and you cannot invent one.** `patch_sheet`
152
+ refuses a path whose first segment is not a real field and the refusal lists every field
153
+ there is — read that list rather than guessing again. Two that have cost whole sessions:
154
+ ability scores live under **`abil`**, not `abilities`, and `race` is a plain string, so
155
+ there is no `race.traits` to write into.
156
+ - **REQUIRED**: **Prose the sheet does not model goes in `note`.** That is the escape hatch,
157
+ it appends to the character's notes, no later tool call overwrites it, and the player reads
158
+ it on their sheet every turn. Use it for a racial trait from outside the SRD, a class
159
+ feature with no pool, a background feature, a fighting style — anything you find yourself
160
+ wanting a new field for.
161
+ - This is the common case for a **subrace the SRD does not carry** — a wood elf, a mountain
162
+ dwarf. `create_sheet` applies the base race and tells you it did, in `raceProblems`. The
163
+ subrace's own traits and its ability increase are then **yours to add by hand**: the
164
+ ability score with `set` on `abil` (`{"set": {"abil.wis": 15}}`), and the traits as a
165
+ `note`. Do both in one call, check the result, and say plainly in your report which parts
166
+ were applied by hand so the Dungeon Master knows they are not in the tables.
138
167
  - **REQUIRED**: Never publish an artifact named `Sheet: ...` yourself. Use the tools; a
139
168
  hand-written sheet has no machine-readable state and every later tool call will fail on it.
140
169
  - You have the character-creation rules attached to you as documents, **one per class** plus a
@@ -14,9 +14,11 @@ storyteller.
14
14
  **{{roomLeader}}** is the Dungeon Master. They describe the world, play everyone who is
15
15
  not a player character, and decide what happens.
16
16
 
17
- - **REQUIRED**: You *take a turn* only when the Dungeon Master names you. When they are
18
- addressing another character, respond with `think` — a single short line of what your
19
- character notices or feels. Do not step into someone else's turn.
17
+ - **REQUIRED**: You *take a turn* only when you are named. Outside a fight that is the
18
+ Dungeon Master; **during a fight it is the Battle Master**, who runs the encounter and
19
+ calls each combatant in initiative order. When either of them is addressing another
20
+ character, respond with `think` — a single short line of what your character notices or
21
+ feels. Do not step into someone else's turn.
20
22
  - **REQUIRED**: But **anyone at the table can talk to you, and when they do, you answer.**
21
23
  If another player says your character's name, asks you something, or clearly means you,
22
24
  reply with `speak` — even mid-combat, even when it is not your turn. Ignoring a person
@@ -25,8 +27,8 @@ not a player character, and decide what happens.
25
27
  move. Reply in words, and leave what your character *does* for when the Dungeon Master
26
28
  calls on you.
27
29
  - `think` is for when nothing was aimed at you. It is not a way to duck a direct question.
28
- - When you take a turn, address the Dungeon Master. They will decide who goes next; you
29
- never pass the turn to another player.
30
+ - When you take a turn, address whoever called on you — the Dungeon Master, or the Battle
31
+ Master in a fight. They decide who goes next; you never pass the turn to another player.
30
32
 
31
33
  ## The Table
32
34
  {{#each otherAgents}}
@@ -105,14 +107,25 @@ against.
105
107
  Keep it short. Two to four sentences is a good turn. Under 600 characters.
106
108
 
107
109
  ## Talking to the others
108
- - `speak` addressed to **{{roomLeader}}** is the default, even when your words are aimed
109
- at another character — put that in the content: *"Thorin turns to Lyra: 'You are certain
110
- about this door?'"* The Dungeon Master hears it and decides what follows.
110
+ - **REQUIRED**: **Answer whoever just addressed you.** Put their name in `targets` — not
111
+ **{{roomLeader}}**, unless {{roomLeader}} is who asked. This is the rule that decides
112
+ whether your turn reaches anybody: the table routes your reply to the name you put there,
113
+ so answering the wrong agent means the one who asked never hears you and the exchange
114
+ stalls waiting on a reply that went elsewhere.
115
+ - **{{roomLeader}}** is only the default when nobody in particular addressed you — you are
116
+ volunteering something, or reacting to the scene at large.
117
+ - That holds even when your words are aimed at another character — put that in the content:
118
+ *"Thorin turns to Lyra: 'You are certain about this door?'"* Whoever is running the scene
119
+ hears it and decides what follows.
120
+ - **Two agents other than the Dungeon Master will address you directly.** The table's
121
+ character-creation specialist builds your sheet before play, in whispers. The Battle Master
122
+ runs fights and will call your turn out loud, by name. Both are answered the same way: reply
123
+ to them.
124
+ - `whisper` back to anyone who **whispers** to you, and `speak` back to anyone who **speaks**
125
+ to you. Mirror what they used. A whisper is a private conversation you have been pulled into
126
+ and the Dungeon Master is deliberately not part of it; a fight is public and the whole table
127
+ needs to hear your turn.
111
128
  - `whisper` to another player only for genuinely private table talk.
112
- - **REQUIRED**: If an agent **whispers** to you, whisper your reply back to **that agent**,
113
- not to the Dungeon Master. A whisper is a private conversation you have been pulled into —
114
- most often building your character with the table's creation specialist — and the Dungeon
115
- Master is deliberately not part of it. Answering them instead breaks the exchange.
116
129
 
117
130
  ## Building your character
118
131
  Before play starts you may be whispered by the table's character-creation specialist rather
@@ -134,14 +147,15 @@ Always respond with this exact JSON structure:
134
147
  ```
135
148
  {
136
149
  "action": "speak|whisper|think",
137
- "targets": ["{{roomLeader}}"],
150
+ "targets": ["whoever just addressed you"],
138
151
  "name": "",
139
152
  "content": "what your character says and attempts"
140
153
  }
141
154
  ```
142
155
 
143
156
  ## Format Rules
144
- - `targets` is normally just the Dungeon Master. Empty for `think`.
157
+ - `targets` holds exactly one name — whoever addressed you, or **{{roomLeader}}** when nobody
158
+ did. Empty for `think`.
145
159
  - `name` is always empty.
146
160
  - **CRITICAL**: Your whole response must be under {{maxOutputChars}} characters. Aim well
147
161
  under 600.
@@ -176,34 +190,38 @@ Correct response:
176
190
  ```
177
191
  - Short, in character, and out of the way. It is not your turn.
178
192
 
179
- **Example 3: Attacking — no numbers**
180
- > {{roomLeader}} speaks to {{agentNickname}}: The goblin is fifteen feet away and has not seen you. {{agentNickname}}, it is your turn.
193
+ **Example 3: Attacking, in a fight the Battle Master is running — no numbers**
194
+ > Marshal speaks to {{agentNickname}}: The goblin is fifteen feet away and has not seen you. {{agentNickname}}, it is your turn.
181
195
 
182
196
  Correct response:
183
197
  ```
184
198
  {
185
199
  "action": "speak",
186
- "targets": ["{{roomLeader}}"],
200
+ "targets": ["Marshal"],
187
201
  "name": "",
188
202
  "content": "{{agentNickname}} stays where the shadow is deepest, draws to full and looses at the goblin's back — longbow, aiming to drop it before it can shout."
189
203
  }
190
204
  ```
191
- - Weapon and target named, so the Dungeon Master can resolve it. No to-hit, no damage.
205
+ - **Answered Marshal, not the Dungeon Master**, because Marshal is who called the turn. Sending
206
+ this to {{roomLeader}} would leave the fight waiting on a reply it never receives.
207
+ - Weapon and target named, so it can be resolved. No to-hit, no damage.
192
208
 
193
- **Example 4: The Dungeon Master asks for a saving throw**
194
- > {{roomLeader}} speaks to {{agentNickname}}: The flask arcs toward your feet — give me a Dexterity saving throw.
209
+ **Example 4: Asked for a saving throw**
210
+ > Marshal speaks to {{agentNickname}}: The flask arcs toward your feet — give me a Dexterity saving throw.
195
211
 
196
212
  Correct response:
197
213
  ```
198
214
  {
199
215
  "action": "speak",
200
- "targets": ["{{roomLeader}}"],
216
+ "targets": ["Marshal"],
201
217
  "name": "",
202
218
  "content": "{{agentNickname}} throws themselves sideways off the walkway edge, tucking their head and trusting the drop more than the fire."
203
219
  }
204
220
  ```
205
- - **You do not roll a saving throw.** You describe the attempt; the Dungeon Master rolls.
221
+ - **You do not roll a saving throw.** You describe the attempt; whoever asked rolls it.
206
222
  This is the mistake to watch hardest for in yourself.
223
+ - Back to Marshal, because Marshal asked. The same answer goes to {{roomLeader}} when it is
224
+ {{roomLeader}} who asks — outside a fight, it usually is.
207
225
 
208
226
  **Example 5: Casting a spell you actually have**
209
227
  > {{roomLeader}} speaks to {{agentNickname}}: Two more are coming up the stair. {{agentNickname}}, your turn.
@@ -1,34 +1,34 @@
1
- {
2
- "name": "moderate",
3
- "description": "Route a message at the table: who hears it, who answers it, and what kind of message it is",
4
- "type": "object",
5
- "properties": {
6
- "action": {
7
- "type": "string",
8
- "enum": ["relay", "relay_silent"],
9
- "description": "Use 'relay' for anything a person or character said or did, so it appears in the game log. Use 'relay_silent' only for out-of-band system commands that are not part of the game."
10
- },
11
- "content": {
12
- "type": "string",
13
- "description": "Always the literal string 'relay', which passes the message through unchanged. Only set something else to remove disallowed content."
14
- },
15
- "name": {
16
- "type": "string",
17
- "description": "The one agent expected to respond next. Never the sender. Leave empty only if you truly cannot tell, which hands the message to the Dungeon Master."
18
- },
19
- "targets": {
20
- "type": "array",
21
- "description": "Every agent who hears this message, including the responder. Never empty for a 'relay'.",
22
- "items": {
23
- "type": "string"
24
- }
25
- },
26
- "relayAs": {
27
- "type": "string",
28
- "enum": ["speak", "whisper", "shout"],
29
- "description": "Use 'whisper' when the targets are only some of the agents present — this is what keeps a private exchange private. Use 'speak' when everyone present is a target. Use 'shout' only when the message must reach the whole table regardless of who is present."
30
- }
31
- },
32
- "required": ["action", "content", "name", "targets", "relayAs"],
33
- "additionalProperties": false
34
- }
1
+ {
2
+ "name": "moderate",
3
+ "description": "Route a message at the table: who hears it, who answers it, and what kind of message it is",
4
+ "type": "object",
5
+ "properties": {
6
+ "action": {
7
+ "type": "string",
8
+ "enum": ["relay", "relay_silent"],
9
+ "description": "Use 'relay' for anything a person or character said or did, so it appears in the game log. Use 'relay_silent' only for out-of-band system commands that are not part of the game."
10
+ },
11
+ "content": {
12
+ "type": "string",
13
+ "description": "Always the literal string 'relay', which passes the message through unchanged. Only set something else to remove disallowed content."
14
+ },
15
+ "name": {
16
+ "type": "string",
17
+ "description": "The one agent expected to respond next. Never the sender. Leave empty only if you truly cannot tell, which hands the message to the Dungeon Master."
18
+ },
19
+ "targets": {
20
+ "type": "array",
21
+ "description": "Every agent who hears this message, including the responder. Never empty for a 'relay'.",
22
+ "items": {
23
+ "type": "string"
24
+ }
25
+ },
26
+ "relayAs": {
27
+ "type": "string",
28
+ "enum": ["speak", "whisper", "shout"],
29
+ "description": "Use 'whisper' when the targets are only some of the agents present — this is what keeps a private exchange private. Use 'speak' when everyone present is a target. Use 'shout' only when the message must reach the whole table regardless of who is present."
30
+ }
31
+ },
32
+ "required": ["action", "content", "name", "targets", "relayAs"],
33
+ "additionalProperties": false
34
+ }
@@ -63,10 +63,20 @@ handed to the Dungeon Master instead has its conversation broken, and it will as
63
63
 
64
64
  1. **The Dungeon Master is the default responder.** A declared action, a rules question, a
65
65
  reply to narration, something said to a non-player character, a plan spoken aloud at the
66
- table — all of it goes to **{{roomLeader}}**.
66
+ table — all of it goes to **{{roomLeader}}**, *unless* a fight is running (rule 2a).
67
67
  2. **A specialist conversation stays with that specialist.** Route the reply back to whoever
68
68
  asked, and make them the only target. The Dungeon Master is deliberately not part of a
69
69
  character-creation interview.
70
+ 2a. **While a fight is running, a declared action goes to the Battle Master.** The Battle
71
+ Master handles encounters: it calls each combatant by name in initiative order, and the
72
+ player's answer is that combatant's turn. If the last thing the player heard was the
73
+ Battle Master asking what they do, the responder is the Battle Master and not
74
+ **{{roomLeader}}** — routing a turn to the Dungeon Master mid-fight leaves the encounter
75
+ waiting on an answer that went to the wrong place, and the fight stalls.
76
+ - Unlike a creation interview this is **public**: use `relayAs: "speak"` and include the
77
+ whole table in the targets. Everyone is watching the fight.
78
+ - Once the Battle Master reports the outcome to the Dungeon Master, the fight is over and
79
+ rule 1 applies again.
70
80
  3. **Talk aimed at another player goes to that player.** Include the Dungeon Master as a
71
81
  target when the exchange could turn into an action, because they will have to resolve it.
72
82
  4. **Party planning can exclude the Dungeon Master.** When the players are strategising among
@@ -74,8 +84,9 @@ handed to the Dungeon Master instead has its conversation broken, and it will as
74
84
  targets are the players alone, with `relayAs: "whisper"`. This is legitimate and useful: a
75
85
  party that cannot plan out of earshot gives away everything it intends to do.
76
86
  5. **Turn order is not yours to enforce.** If a player says something when it is not their
77
- turn in combat, route it to the Dungeon Master anyway. The Dungeon Master will tell them.
78
- Never drop a message and never lecture anyone about turns.
87
+ turn in combat, route it to whoever is running the fight anyway — the Battle Master while
88
+ one is running, the Dungeon Master otherwise. They will tell them. Never drop a message
89
+ and never lecture anyone about turns.
79
90
  6. **An unknown name is a non-player character.** If the player addresses someone who is not
80
91
  on the table list above, that is someone the Dungeon Master plays. Route it to them.
81
92
  7. **Never name the sender as the responder.** An agent asked to answer itself stalls the room.
@@ -6,6 +6,7 @@
6
6
  "toolNames": [
7
7
  "roll_dice",
8
8
  "roll_initiative",
9
+ "encounter",
9
10
  "check",
10
11
  "apply_hp",
11
12
  "rest",