briyah 2.0.4 → 2.0.5

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 (66) hide show
  1. package/README.md +12 -1
  2. package/data/common/config/markup +1 -1
  3. package/data/common/config/story_models.json +3 -3
  4. package/data/common/prompts/illustrator/describe_scene.prompt +4 -4
  5. package/data/common/prompts/perceive.prompt +1 -1
  6. package/data/packs/dnd5e/prompts/battle_master/perceive.prompt +1 -1
  7. package/data/packs/dnd5e/prompts/campaign_designer/perceive.prompt +1 -1
  8. package/data/packs/dnd5e/prompts/character_creator/perceive.prompt +795 -787
  9. package/data/packs/dnd5e/prompts/dungeon_master/defaults_config.json +2 -1
  10. package/data/packs/dnd5e/prompts/dungeon_master/perceive.prompt +1 -1
  11. package/data/packs/dnd5e/rooms/campaign.json +18 -15
  12. package/data/packs/dnd5e/rooms/table.json +17 -16
  13. package/dist-sdk/server/src/ai/LLM/anthropic.service.js +1 -1
  14. package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +22 -0
  15. package/dist-sdk/server/src/ai/LLM/base-ai.service.js +60 -16
  16. package/dist-sdk/server/src/ai/LLM/blank-image.d.ts +36 -0
  17. package/dist-sdk/server/src/ai/LLM/blank-image.js +80 -0
  18. package/dist-sdk/server/src/ai/LLM/deepseek.service.js +1 -1
  19. package/dist-sdk/server/src/ai/LLM/fal.service.js +1 -1
  20. package/dist-sdk/server/src/ai/LLM/googleai.service.js +1 -1
  21. package/dist-sdk/server/src/ai/LLM/grok.service.js +1 -1
  22. package/dist-sdk/server/src/ai/LLM/openai.service.js +1 -1
  23. package/dist-sdk/server/src/ai/LLM/self-hosted.service.js +1 -1
  24. package/dist-sdk/server/src/ai/LLM/together.service.js +1 -1
  25. package/dist-sdk/server/src/ai/agent-config.d.ts +0 -1
  26. package/dist-sdk/server/src/ai/agent-store.service.js +2 -4
  27. package/dist-sdk/server/src/ai/agent.d.ts +1 -2
  28. package/dist-sdk/server/src/ai/agent.js +1 -3
  29. package/dist-sdk/server/src/app/user-service-factory.js +8 -2
  30. package/dist-sdk/server/src/app.controller.d.ts +33 -0
  31. package/dist-sdk/server/src/app.controller.js +93 -2
  32. package/dist-sdk/server/src/app.service.d.ts +49 -4
  33. package/dist-sdk/server/src/app.service.js +101 -16
  34. package/dist-sdk/server/src/auth/jwt-auth.guard.js +26 -0
  35. package/dist-sdk/server/src/packs/pack-instantiation.service.js +5 -0
  36. package/dist-sdk/server/src/packs/pack-manifest.d.ts +14 -0
  37. package/dist-sdk/server/src/packs/pack-manifest.js +11 -0
  38. package/dist-sdk/server/src/room/illustration/illustration.service.d.ts +211 -0
  39. package/dist-sdk/server/src/room/illustration/illustration.service.js +771 -0
  40. package/dist-sdk/server/src/room/illustration/illustration.types.d.ts +101 -0
  41. package/dist-sdk/server/src/room/illustration/illustration.types.js +2 -0
  42. package/dist-sdk/server/src/room/room-config.d.ts +58 -1
  43. package/dist-sdk/server/src/room/room-config.js +19 -0
  44. package/dist-sdk/server/src/room/room-factory.d.ts +8 -0
  45. package/dist-sdk/server/src/room/room-factory.js +11 -0
  46. package/dist-sdk/server/src/room/room-store.service.d.ts +8 -0
  47. package/dist-sdk/server/src/room/room-store.service.js +43 -2
  48. package/dist-sdk/server/src/room/room.d.ts +103 -1
  49. package/dist-sdk/server/src/room/room.js +240 -4
  50. package/dist-sdk/server/src/rpg/rpg.service.js +5 -1
  51. package/dist-sdk/server/src/story/story.service.d.ts +24 -65
  52. package/dist-sdk/server/src/story/story.service.js +105 -458
  53. package/dist-sdk/server/src/tools/core/illustrate.tool.d.ts +14 -0
  54. package/dist-sdk/server/src/tools/core/illustrate.tool.js +80 -0
  55. package/dist-sdk/server/src/tools/core/index.js +2 -1
  56. package/dist-sdk/server/src/tools/native-tool.types.d.ts +90 -0
  57. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +9 -0
  58. package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +5 -0
  59. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +30 -0
  60. package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +75 -0
  61. package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +11 -2
  62. package/dist-sdk/server/src/tools/tool-execution.service.d.ts +36 -5
  63. package/dist-sdk/server/src/tools/tool-execution.service.js +91 -21
  64. package/dist-sdk/shared/types/app.types.d.ts +43 -0
  65. package/dist-sdk/shared/types/app.types.js +15 -1
  66. package/package.json +1 -1
package/README.md CHANGED
@@ -302,13 +302,17 @@ await appService.compactAgentConversation(agentId); // Summarize history into a
302
302
  // agent a message names ('broadcast', the default, asks every agent every time);
303
303
  // moderator is only needed when no agent leads the turn order.
304
304
  const room = await appService.createRoom(
305
- name, goal, agentIds, roomLeader?, turnMode?, moderator?,
305
+ name, goal, agentIds, roomLeader?, turnMode?, moderator?, beginInstruction?,
306
306
  );
307
307
  const rooms = await appService.listRooms();
308
308
  const details = await appService.getRoomDetails(roomId);
309
309
  // action defaults to 'moderate'. Returns {accepted, reason} — a message sent out of
310
310
  // turn is refused, not thrown. `sender` must be an agentNickname.
311
311
  await appService.sendRoomMessage(roomId, content, sender, action?, targets?);
312
+ // Opens a room that nobody has spoken in: sends its beginInstruction as a 'System'
313
+ // 'speak' addressed to the leader. Throws if the room has no instruction, has no
314
+ // agents, or has already begun. See "Starting a room" below.
315
+ await appService.beginRoom(roomId);
312
316
  // Required before subscribing to a room this process did not create.
313
317
  await appService.ensureRoomStateCallback(roomId);
314
318
  const emitter = appService.getRoomMessageEmitter(roomId); // 'update' events
@@ -965,6 +969,13 @@ it and then stops rather than generating a reply, which is what yields the floor
965
969
  **The room message emitter** — the only way to see the conversation as it happens. It fires on
966
970
  every change with the newest message and the room's state.
967
971
 
972
+ **Starting a room.** A room is pull-driven: an agent is prompted only when a message arrives,
973
+ so a room nobody has spoken in never moves however complete its configuration. Give the room a
974
+ `beginInstruction` and call `beginRoom(roomId)`, and it goes to the leader as a `'System'`
975
+ `'speak'` — which is how a leader opens a turn-based table without the person having to tell it
976
+ to. The web client offers it as a **Begin** button while the transcript is empty. It refuses a
977
+ room that has already begun, so it is safe to call from several places at once.
978
+
968
979
  ```typescript
969
980
  import { Briyah } from 'briyah';
970
981
  import type { RoomUpdate } from 'briyah';
@@ -1 +1 @@
1
- 23.459793440000034
1
+ 25.0112284
@@ -40,12 +40,12 @@
40
40
  "cost": "3000"
41
41
  },
42
42
  {
43
- "name": "Grok 4.5",
43
+ "name": "Grok 4.6",
44
44
  "description": "",
45
45
  "service": "Grok",
46
- "model": "grok-4.5",
46
+ "model": "grok-4.6",
47
47
  "moderator_service": "Grok",
48
- "moderator_model": "grok-4.5",
48
+ "moderator_model": "grok-4.6",
49
49
  "cost": "300"
50
50
  },
51
51
  {
@@ -1,15 +1,15 @@
1
1
  # Describe Scene
2
2
 
3
3
  **Role:**
4
- You are a participant in a storytelling project whose role is to determine what pictures to produce to go along with the story.
4
+ You are a participant in {{#if narrator}}a storytelling project{{else}}an ongoing conversation{{/if}} whose role is to determine what pictures to produce to go along with {{#if narrator}}the story{{else}}it{{/if}}.
5
5
  You are responsible for describing the pictures that another AI model will render.
6
6
  You are to describe one of two types of images:
7
7
  - A reference scene with just a setting and no characters so that subsequent story images can be based on them
8
8
  - A story image showing the characters interacting within one of the previous described reference scenes
9
- Images are only created when the scene changes or something significant happens, so you must decide if a new image is appropriate at this point in the story.
9
+ Images are only created when the scene changes or something significant happens, so you must decide if a new image is appropriate at this point{{#if narrator}} in the story{{/if}}.
10
10
 
11
11
  **Context:**
12
- - Your message history contains a few of the most recent paragraphs from the story to help you understand the context.
12
+ - Your message history contains a few of the most recent {{#if narrator}}paragraphs from the story{{else}}messages from the room{{/if}} to help you understand the context.
13
13
  - You are also given a **Current Situation**, a list of **Existing Scenes**, and a list of **Characters** that could possibly appear in the scenes.
14
14
 
15
15
  **Characters:**
@@ -18,7 +18,7 @@ Images are only created when the scene changes or something significant happens,
18
18
  {{/each}}
19
19
 
20
20
  **Task:**
21
- - Based on the **Current Situation** and the most recent narration from the narrator, determine the current setting of the story (where the action is happening).
21
+ - Based on the **Current Situation** and the most recent {{#if narrator}}narration from the narrator{{else}}messages in the room{{/if}}, determine the current setting of {{#if narrator}}the story{{else}}the scene{{/if}} (where the action is happening).
22
22
  - If the **Existing Scenes** list already contains such a scene, use the name of that scene (the part before the colon) as the sceneName.
23
23
  - If the scene does not exist, you are to create a new reference scene with a descriptive name describing the new setting in the story.
24
24
  - When creating a new reference scene, you will describe the setting without any characters (so they can be added later).
@@ -115,7 +115,7 @@ You must choose ONE of these actions:
115
115
  {{#each availableTools}}
116
116
  - **{{this.name}}**: {{this.description}}
117
117
  {{#each this.parameters}}
118
- - {{this.name}} ({{this.type}}{{#if this.required}}, required{{/if}}): {{this.description}}
118
+ - {{this.name}} ({{this.type}}{{#if this.required}}, required{{/if}}): {{this.description}}{{#if this.enumText}} Must be exactly one of: {{this.enumText}}.{{/if}}
119
119
  {{/each}}
120
120
  {{/each}}
121
121
  {{/if}}
@@ -178,7 +178,7 @@ the round structure, the action economy, movement and the attack rules.
178
178
  {{#each availableTools}}
179
179
  - **{{this.name}}**: {{this.description}}
180
180
  {{#each this.parameters}}
181
- - {{this.name}} ({{this.type}}{{#if this.required}}, required{{/if}}): {{this.description}}
181
+ - {{this.name}} ({{this.type}}{{#if this.required}}, required{{/if}}): {{this.description}}{{#if this.enumText}} Must be exactly one of: {{this.enumText}}.{{/if}}
182
182
  {{/each}}
183
183
  {{/each}}
184
184
  {{else}}
@@ -78,7 +78,7 @@ Cover, in roughly this order, and stop early if they are giving you enough:
78
78
  {{#each availableTools}}
79
79
  - **{{this.name}}**: {{this.description}}
80
80
  {{#each this.parameters}}
81
- - {{this.name}} ({{this.type}}{{#if this.required}}, required{{/if}}): {{this.description}}
81
+ - {{this.name}} ({{this.type}}{{#if this.required}}, required{{/if}}): {{this.description}}{{#if this.enumText}} Must be exactly one of: {{this.enumText}}.{{/if}}
82
82
  {{/each}}
83
83
  {{/each}}
84
84
  {{/if}}