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.
- package/README.md +1272 -994
- package/data/common/config/markup +1 -1
- package/data/common/prompts/character/progress_character.json +5 -5
- package/data/common/prompts/illustrator/describe_scene.json +11 -3
- package/data/common/prompts/perceive.json +2 -2
- package/data/common/prompts/room_moderator/moderate.json +34 -34
- package/data/common/prompts/story_moderator/moderate.json +62 -62
- package/data/packs/dnd5e/agents/battle-master.json +6 -0
- package/data/packs/dnd5e/agents/campaign-designer.json +6 -0
- package/data/packs/dnd5e/agents/character-creator.json +6 -0
- package/data/packs/dnd5e/agents/dungeon-master.json +6 -0
- package/data/packs/dnd5e/agents/player.json +13 -0
- package/data/packs/dnd5e/agents/table-moderator.json +6 -0
- package/data/{common/artifacts/dnd5e/dungeon_master-procedure.md → packs/dnd5e/artifacts/battle_master-combat.md} +31 -131
- package/data/packs/dnd5e/artifacts/dungeon_master-procedure.md +192 -0
- package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/manifest.json +8 -2
- package/data/packs/dnd5e/pack.json +6 -0
- package/data/packs/dnd5e/prompts/battle_master/defaults_config.json +23 -0
- package/data/packs/dnd5e/prompts/battle_master/perceive.json +33 -0
- package/data/packs/dnd5e/prompts/battle_master/perceive.prompt +378 -0
- package/data/{common → packs/dnd5e}/prompts/character_creator/defaults_config.json +1 -1
- package/data/{common → packs/dnd5e}/prompts/character_creator/perceive.prompt +29 -0
- package/data/{common → packs/dnd5e}/prompts/dnd_player/perceive.prompt +40 -22
- package/data/{common → packs/dnd5e}/prompts/dnd_room_moderator/moderate.json +34 -34
- package/data/{common → packs/dnd5e}/prompts/dnd_room_moderator/moderate.prompt +14 -3
- package/data/{common → packs/dnd5e}/prompts/dungeon_master/defaults_config.json +1 -0
- package/data/{common → packs/dnd5e}/prompts/dungeon_master/perceive.prompt +122 -115
- package/data/packs/dnd5e/prompts/dungeon_master/system_instruction.prompt +0 -0
- package/data/packs/dnd5e/rooms/table.json +16 -0
- package/dist-sdk/server/src/ai/LLM/base-ai.service.js +4 -13
- package/dist-sdk/server/src/ai/LLM/deepseek.service.d.ts +2 -1
- package/dist-sdk/server/src/ai/LLM/deepseek.service.js +65 -77
- package/dist-sdk/server/src/ai/agent-config.d.ts +2 -0
- package/dist-sdk/server/src/ai/agent-store.service.js +8 -0
- package/dist-sdk/server/src/ai/agent.d.ts +6 -0
- package/dist-sdk/server/src/ai/agent.js +25 -2
- package/dist-sdk/server/src/ai/artifact.service.d.ts +3 -1
- package/dist-sdk/server/src/ai/artifact.service.js +12 -5
- package/dist-sdk/server/src/ai/pack-artifacts.d.ts +3 -3
- package/dist-sdk/server/src/ai/pack-artifacts.js +21 -15
- package/dist-sdk/server/src/app/user-service-factory.js +9 -1
- package/dist-sdk/server/src/app.controller.d.ts +11 -11
- package/dist-sdk/server/src/app.controller.js +179 -89
- package/dist-sdk/server/src/app.service.d.ts +30 -7
- package/dist-sdk/server/src/app.service.js +146 -95
- package/dist-sdk/server/src/common/errors.d.ts +0 -3
- package/dist-sdk/server/src/common/errors.js +1 -11
- package/dist-sdk/server/src/config/prompt-resolver.d.ts +41 -0
- package/dist-sdk/server/src/config/prompt-resolver.js +196 -0
- package/dist-sdk/server/src/config/user-config.service.d.ts +17 -0
- package/dist-sdk/server/src/config/user-config.service.js +103 -0
- package/dist-sdk/server/src/config/user-paths.service.d.ts +4 -4
- package/dist-sdk/server/src/config/user-paths.service.js +12 -16
- package/dist-sdk/server/src/packs/pack-instantiation.service.d.ts +36 -0
- package/dist-sdk/server/src/packs/pack-instantiation.service.js +165 -0
- package/dist-sdk/server/src/packs/pack-manifest.d.ts +52 -0
- package/dist-sdk/server/src/packs/pack-manifest.js +256 -0
- package/dist-sdk/server/src/packs/pack.service.d.ts +24 -0
- package/dist-sdk/server/src/packs/pack.service.js +151 -0
- package/dist-sdk/server/src/room/room-config.d.ts +5 -0
- package/dist-sdk/server/src/room/room-message.service.d.ts +2 -1
- package/dist-sdk/server/src/room/room-message.service.js +3 -2
- package/dist-sdk/server/src/room/room-store.service.d.ts +3 -0
- package/dist-sdk/server/src/room/room-store.service.js +41 -5
- package/dist-sdk/server/src/room/room.d.ts +7 -0
- package/dist-sdk/server/src/room/room.js +33 -3
- package/dist-sdk/server/src/sdk/briyah.d.ts +2 -0
- package/dist-sdk/server/src/sdk/briyah.js +45 -8
- package/dist-sdk/server/src/sdk/index.d.ts +7 -2
- package/dist-sdk/server/src/sdk/index.js +6 -2
- package/dist-sdk/server/src/shared/shared.module.js +0 -3
- package/dist-sdk/server/src/story/story.service.d.ts +2 -2
- package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.d.ts +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.js +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.d.ts +3 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.js +6 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.js +4 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/backgrounds.d.ts +1 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/backgrounds.js +6 -3
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.d.ts +3 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.js +45 -5
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.d.ts +27 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.js +103 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.d.ts +7 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.js +83 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.d.ts +19 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.js +130 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.d.ts +2 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.js +13 -2
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.d.ts +6 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.js +16 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +10 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +82 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/index.js +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.js +51 -6
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.js +19 -9
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.js +134 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.js +31 -13
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +25 -8
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +70 -4
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.js +27 -0
- package/dist-sdk/server/src/tools/packs/index.d.ts +1 -2
- package/dist-sdk/server/src/tools/packs/index.js +5 -11
- package/dist-sdk/shared/types/app.types.d.ts +81 -13
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +15 -1
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +4 -4
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +18 -3
- package/docs/classes/Agent.html +702 -37
- package/docs/classes/Briyah.html +250 -33
- package/docs/classes/BriyahConfigService.html +117 -10
- package/docs/classes/NativeToolRegistry.html +156 -11
- package/docs/classes/PackInstantiationService.html +157 -0
- package/docs/classes/PackService.html +247 -0
- package/docs/classes/Room.html +1190 -77
- package/docs/classes/RoomMessage.html +260 -29
- package/docs/enums/MessageAction.html +123 -3
- package/docs/functions/availableToolPacks.html +41 -2
- package/docs/functions/dnd5eTools.html +42 -3
- package/docs/functions/installToolPacks.html +48 -0
- package/docs/functions/registerToolPacks.html +54 -6
- package/docs/hierarchy.html +42 -1
- package/docs/index.html +301 -54
- package/docs/interfaces/AgentCreationOptions.html +110 -11
- package/docs/interfaces/AgentInfo.html +188 -3
- package/docs/interfaces/AgentMessagesResponse.html +71 -2
- package/docs/interfaces/AppService.html +2806 -474
- package/docs/interfaces/Artifact.html +81 -4
- package/docs/interfaces/ArtifactMetadata.html +104 -3
- package/docs/interfaces/ArtifactWriteOptions.html +75 -6
- package/docs/interfaces/AttachDocumentResponse.html +61 -2
- package/docs/interfaces/BriyahConfigOptions.html +107 -10
- package/docs/interfaces/ChapterInfo.html +61 -2
- package/docs/interfaces/Character.html +81 -2
- package/docs/interfaces/CreateAgentResponse.html +56 -2
- package/docs/interfaces/CreateRoomResponse.html +61 -2
- package/docs/interfaces/CreateStoryResponse.html +56 -2
- package/docs/interfaces/FileList.html +56 -2
- package/docs/interfaces/FileMetadata.html +84 -3
- package/docs/interfaces/IConfigService.html +76 -3
- package/docs/interfaces/InstantiateModels.html +64 -0
- package/docs/interfaces/InstantiateRoomResult.html +70 -0
- package/docs/interfaces/LoadedPack.html +131 -0
- package/docs/interfaces/LoggingOptions.html +86 -7
- package/docs/interfaces/Message.html +80 -2
- package/docs/interfaces/ModelChoice.html +73 -0
- package/docs/interfaces/ModelInfo.html +71 -2
- package/docs/interfaces/NativeToolDefinition.html +96 -9
- package/docs/interfaces/PackAgentTemplate.html +101 -0
- package/docs/interfaces/PackRoomTemplate.html +108 -0
- package/docs/interfaces/PackView.html +172 -0
- package/docs/interfaces/PreparedPromptResponse.html +61 -2
- package/docs/interfaces/ProcessTextResponse.html +81 -2
- package/docs/interfaces/PromptFile.html +69 -2
- package/docs/interfaces/PromptFileContent.html +75 -2
- package/docs/interfaces/PromptFilesResponse.html +56 -2
- package/docs/interfaces/PromptFolder.html +79 -2
- package/docs/interfaces/PromptFolderDefaults.html +136 -5
- package/docs/interfaces/PromptFolderDefaultsResponse.html +78 -4
- package/docs/interfaces/PromptFoldersResponse.html +56 -2
- package/docs/interfaces/RoomDetails.html +133 -4
- package/docs/interfaces/RoomErrorUpdate.html +82 -0
- package/docs/interfaces/RoomInfo.html +84 -2
- package/docs/interfaces/RoomMessageUpdate.html +106 -2
- package/docs/interfaces/RoomMessagesResponse.html +61 -2
- package/docs/interfaces/SendMessageResult.html +61 -2
- package/docs/interfaces/StoryErrorEvent.html +76 -4
- package/docs/interfaces/StoryIdea.html +71 -2
- package/docs/interfaces/StoryInfo.html +173 -3
- package/docs/interfaces/StoryIntroduceCharacterEvent.html +71 -4
- package/docs/interfaces/StoryProgressChapterEvent.html +64 -3
- package/docs/interfaces/StoryState.html +99 -6
- package/docs/interfaces/StoryStateEvent.html +69 -3
- package/docs/interfaces/ToolArtifact.html +81 -4
- package/docs/interfaces/ToolCaller.html +75 -6
- package/docs/interfaces/ToolDefinition.html +76 -2
- package/docs/interfaces/ToolHelpers.html +91 -6
- package/docs/interfaces/ToolParameter.html +71 -2
- package/docs/interfaces/ToolRoomAccess.html +200 -24
- package/docs/interfaces/ToolSummary.html +71 -2
- package/docs/interfaces/ToolsResponse.html +66 -2
- package/docs/interfaces/Transaction.html +96 -2
- package/docs/interfaces/TransactionHistoryResponse.html +61 -2
- package/docs/modules.html +53 -1
- package/docs/types/PackOrigin.html +34 -0
- package/docs/types/PromptScope.html +34 -1
- package/docs/types/RoomTurnMode.html +36 -2
- package/docs/types/RoomUpdate.html +36 -0
- package/docs/types/RosterOverrides.html +42 -0
- package/docs/types/ToolContext.html +36 -2
- package/docs/types/ToolRunResult.html +34 -1
- package/package.json +139 -139
- package/src/tools/packs/dnd5e/README.md +186 -27
- package/dist-sdk/server/src/library/library.service.d.ts +0 -14
- package/dist-sdk/server/src/library/library.service.js +0 -165
- package/docs/functions/enabledToolPacks.html +0 -2
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/campaign_designer-setting.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/character_creator-basics.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-barbarian.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-bard.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-cleric.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-druid.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-fighter.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-monk.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-paladin.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-ranger.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-rogue.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-sorcerer.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-warlock.md +0 -0
- /package/data/{common/artifacts/dnd5e → packs/dnd5e/artifacts}/class-wizard.md +0 -0
- /package/data/{common/prompts/campaign_designer → packs/dnd5e/prompts/battle_master}/system_instruction.prompt +0 -0
- /package/data/{common → packs/dnd5e}/prompts/campaign_designer/defaults_config.json +0 -0
- /package/data/{common → packs/dnd5e}/prompts/campaign_designer/perceive.json +0 -0
- /package/data/{common → packs/dnd5e}/prompts/campaign_designer/perceive.prompt +0 -0
- /package/data/{common/prompts/character_creator → packs/dnd5e/prompts/campaign_designer}/system_instruction.prompt +0 -0
- /package/data/{common → packs/dnd5e}/prompts/character_creator/perceive.json +0 -0
- /package/data/{common/prompts/dnd_player → packs/dnd5e/prompts/character_creator}/system_instruction.prompt +0 -0
- /package/data/{common → packs/dnd5e}/prompts/dnd_player/defaults_config.json +0 -0
- /package/data/{common → packs/dnd5e}/prompts/dnd_player/perceive.json +0 -0
- /package/data/{common/prompts/dnd_room_moderator → packs/dnd5e/prompts/dnd_player}/system_instruction.prompt +0 -0
- /package/data/{common → packs/dnd5e}/prompts/dnd_room_moderator/defaults_config.json +0 -0
- /package/data/{common/prompts/dungeon_master → packs/dnd5e/prompts/dnd_room_moderator}/system_instruction.prompt +0 -0
- /package/data/{common → packs/dnd5e}/prompts/dungeon_master/compact_agent.prompt +0 -0
- /package/data/{common → packs/dnd5e}/prompts/dungeon_master/perceive.json +0 -0
package/package.json
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "briyah",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"private": false,
|
|
6
|
-
"main": "dist-sdk/server/src/sdk/index.js",
|
|
7
|
-
"types": "dist-sdk/server/src/sdk/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist-sdk/",
|
|
10
|
-
"docs/",
|
|
11
|
-
"data/common/
|
|
12
|
-
"data/common/
|
|
13
|
-
"data/common/
|
|
14
|
-
"data/
|
|
15
|
-
"README.md",
|
|
16
|
-
"src/tools/packs/dnd5e/README.md"
|
|
17
|
-
],
|
|
18
|
-
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"import": "./dist-sdk/server/src/sdk/index.js",
|
|
21
|
-
"require": "./dist-sdk/server/src/sdk/index.js",
|
|
22
|
-
"types": "./dist-sdk/server/src/sdk/index.d.ts"
|
|
23
|
-
},
|
|
24
|
-
"./package.json": "./package.json"
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"prebuild": "rimraf dist",
|
|
28
|
-
"build": "nest build",
|
|
29
|
-
"build:sdk": "rimraf dist-sdk && tsc -p tsconfig.build.json",
|
|
30
|
-
"docs": "typedoc",
|
|
31
|
-
"build:local": "npm run build:sdk && npm run docs",
|
|
32
|
-
"prepublishOnly": "npm run build:local",
|
|
33
|
-
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
34
|
-
"start": "nest start",
|
|
35
|
-
"dev": "nest start --watch",
|
|
36
|
-
"start:dev": "nest start --watch",
|
|
37
|
-
"start:debug": "nest start --debug --watch",
|
|
38
|
-
"start:prod": "node dist/main",
|
|
39
|
-
"debug": "nest start --debug",
|
|
40
|
-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
41
|
-
"test": "jest",
|
|
42
|
-
"test:watch": "jest --watch",
|
|
43
|
-
"test:cov": "jest --coverage",
|
|
44
|
-
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
45
|
-
"test:e2e": "jest --silent --detectOpenHandles --config ./test/jest-e2e.json",
|
|
46
|
-
"test:e2e:watch": "jest --config ./test/jest-e2e.json --watch",
|
|
47
|
-
"test:e2e:cheap": "jest --silent --detectOpenHandles --config ./test/jest-e2e.json --testPathIgnorePatterns=\"llm\" --testPathIgnorePatterns=\"conversation\" --testPathIgnorePatterns=\"stories\" --testPathIgnorePatterns=\"sse\" --testPathIgnorePatterns=\"workflow\"",
|
|
48
|
-
"test:e2e:cov": "jest --silent --config ./test/jest-e2e.json --coverage"
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"@ai-sdk/deepseek": "^2.0.
|
|
52
|
-
"@ai-sdk/google": "^3.0.
|
|
53
|
-
"@ai-sdk/openai": "^3.0.
|
|
54
|
-
"@ai-sdk/xai": "^3.0.
|
|
55
|
-
"@anthropic-ai/sdk": "^0.
|
|
56
|
-
"@fal-ai/client": "^1.
|
|
57
|
-
"@google/genai": "^
|
|
58
|
-
"@nestjs/common": "^11.1.
|
|
59
|
-
"@nestjs/config": "^4.0.
|
|
60
|
-
"@nestjs/core": "^11.1.
|
|
61
|
-
"@nestjs/jwt": "^11.0.2",
|
|
62
|
-
"@nestjs/passport": "^11.0.5",
|
|
63
|
-
"@nestjs/platform-express": "^11.1.
|
|
64
|
-
"@nestjs/serve-static": "^5.0.
|
|
65
|
-
"@types/yauzl": "^
|
|
66
|
-
"ai": "^6.0.
|
|
67
|
-
"archiver": "^7.0.1",
|
|
68
|
-
"bcrypt": "^6.0.0",
|
|
69
|
-
"body-parser": "^2.
|
|
70
|
-
"cookie-parser": "^1.4.7",
|
|
71
|
-
"dotenv": "^17.4.
|
|
72
|
-
"handlebars": "^4.7.9",
|
|
73
|
-
"jsonrepair": "^3.
|
|
74
|
-
"multer": "^2.
|
|
75
|
-
"openai": "^
|
|
76
|
-
"passport": "^0.7.0",
|
|
77
|
-
"passport-jwt": "^4.0.1",
|
|
78
|
-
"pdf-data-parser": "^1.2.
|
|
79
|
-
"pdf-lib": "^1.17.1",
|
|
80
|
-
"reflect-metadata": "^0.2.2",
|
|
81
|
-
"rxjs": "^7.8.2",
|
|
82
|
-
"save": "^2.9.0",
|
|
83
|
-
"stripe": "
|
|
84
|
-
"together-ai": "^0.
|
|
85
|
-
"yauzl": "^3.
|
|
86
|
-
"zod": "^4.3
|
|
87
|
-
},
|
|
88
|
-
"devDependencies": {
|
|
89
|
-
"@nestjs/cli": "^11.0.
|
|
90
|
-
"@nestjs/schematics": "^11.0
|
|
91
|
-
"@nestjs/testing": "^11.1.
|
|
92
|
-
"@types/bcrypt": "^6.0.0",
|
|
93
|
-
"@types/cookie-parser": "^1.4.10",
|
|
94
|
-
"@types/eventsource": "^3.0.0",
|
|
95
|
-
"@types/express": "^5.0.6",
|
|
96
|
-
"@types/jest": "^30.0.0",
|
|
97
|
-
"@types/multer": "^2.
|
|
98
|
-
"@types/node": "
|
|
99
|
-
"@types/passport-jwt": "^4.0.1",
|
|
100
|
-
"@types/supertest": "^7.2.
|
|
101
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
102
|
-
"@typescript-eslint/parser": "^8.
|
|
103
|
-
"copyfiles": "^2.4.1",
|
|
104
|
-
"eslint": "^10.
|
|
105
|
-
"eslint-config-prettier": "^10.1.8",
|
|
106
|
-
"eslint-plugin-prettier": "^5.5.
|
|
107
|
-
"eventsource": "^4.1.
|
|
108
|
-
"jest": "^30.
|
|
109
|
-
"prettier": "^3.
|
|
110
|
-
"rimraf": "^6.1.3",
|
|
111
|
-
"sharp": "^0.35.3",
|
|
112
|
-
"source-map-support": "^0.5.21",
|
|
113
|
-
"supertest": "^7.2.2",
|
|
114
|
-
"ts-jest": "^29.4.
|
|
115
|
-
"ts-loader": "^9.
|
|
116
|
-
"ts-node": "^10.9.2",
|
|
117
|
-
"tsc-alias": "^1.
|
|
118
|
-
"tsconfig-paths": "^4.2.0",
|
|
119
|
-
"typedoc": "^0.28.
|
|
120
|
-
"typescript": "^5.
|
|
121
|
-
},
|
|
122
|
-
"jest": {
|
|
123
|
-
"moduleFileExtensions": [
|
|
124
|
-
"ts",
|
|
125
|
-
"js",
|
|
126
|
-
"json"
|
|
127
|
-
],
|
|
128
|
-
"rootDir": "src",
|
|
129
|
-
"testRegex": ".*\\.spec\\.ts$",
|
|
130
|
-
"transform": {
|
|
131
|
-
"^.+\\.(t|j)s$": "ts-jest"
|
|
132
|
-
},
|
|
133
|
-
"collectCoverageFrom": [
|
|
134
|
-
"**/*.(t|j)s"
|
|
135
|
-
],
|
|
136
|
-
"coverageDirectory": "../coverage",
|
|
137
|
-
"testEnvironment": "node"
|
|
138
|
-
}
|
|
139
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "briyah",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Multi-agent AI SDK with interactive storytelling and D&D 5e support.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "dist-sdk/server/src/sdk/index.js",
|
|
7
|
+
"types": "dist-sdk/server/src/sdk/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist-sdk/",
|
|
10
|
+
"docs/",
|
|
11
|
+
"data/common/config",
|
|
12
|
+
"data/common/prompts",
|
|
13
|
+
"data/common/story_ideas",
|
|
14
|
+
"data/packs",
|
|
15
|
+
"README.md",
|
|
16
|
+
"src/tools/packs/dnd5e/README.md"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist-sdk/server/src/sdk/index.js",
|
|
21
|
+
"require": "./dist-sdk/server/src/sdk/index.js",
|
|
22
|
+
"types": "./dist-sdk/server/src/sdk/index.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"prebuild": "rimraf dist",
|
|
28
|
+
"build": "nest build",
|
|
29
|
+
"build:sdk": "rimraf dist-sdk && tsc -p tsconfig.build.json",
|
|
30
|
+
"docs": "typedoc",
|
|
31
|
+
"build:local": "npm run build:sdk && npm run docs",
|
|
32
|
+
"prepublishOnly": "npm run build:local",
|
|
33
|
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
34
|
+
"start": "nest start",
|
|
35
|
+
"dev": "nest start --watch",
|
|
36
|
+
"start:dev": "nest start --watch",
|
|
37
|
+
"start:debug": "nest start --debug --watch",
|
|
38
|
+
"start:prod": "node dist/main",
|
|
39
|
+
"debug": "nest start --debug",
|
|
40
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
41
|
+
"test": "jest",
|
|
42
|
+
"test:watch": "jest --watch",
|
|
43
|
+
"test:cov": "jest --coverage",
|
|
44
|
+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
45
|
+
"test:e2e": "jest --silent --detectOpenHandles --config ./test/jest-e2e.json",
|
|
46
|
+
"test:e2e:watch": "jest --config ./test/jest-e2e.json --watch",
|
|
47
|
+
"test:e2e:cheap": "jest --silent --detectOpenHandles --config ./test/jest-e2e.json --testPathIgnorePatterns=\"llm\" --testPathIgnorePatterns=\"conversation\" --testPathIgnorePatterns=\"stories\" --testPathIgnorePatterns=\"sse\" --testPathIgnorePatterns=\"workflow\"",
|
|
48
|
+
"test:e2e:cov": "jest --silent --config ./test/jest-e2e.json --coverage"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@ai-sdk/deepseek": "^2.0.52",
|
|
52
|
+
"@ai-sdk/google": "^3.0.104",
|
|
53
|
+
"@ai-sdk/openai": "^3.0.91",
|
|
54
|
+
"@ai-sdk/xai": "^3.0.115",
|
|
55
|
+
"@anthropic-ai/sdk": "^0.116.0",
|
|
56
|
+
"@fal-ai/client": "^1.10.1",
|
|
57
|
+
"@google/genai": "^2.16.0",
|
|
58
|
+
"@nestjs/common": "^11.1.28",
|
|
59
|
+
"@nestjs/config": "^4.0.4",
|
|
60
|
+
"@nestjs/core": "^11.1.28",
|
|
61
|
+
"@nestjs/jwt": "^11.0.2",
|
|
62
|
+
"@nestjs/passport": "^11.0.5",
|
|
63
|
+
"@nestjs/platform-express": "^11.1.28",
|
|
64
|
+
"@nestjs/serve-static": "^5.0.5",
|
|
65
|
+
"@types/yauzl": "^3.4.0",
|
|
66
|
+
"ai": "^6.0.246",
|
|
67
|
+
"archiver": "^7.0.1",
|
|
68
|
+
"bcrypt": "^6.0.0",
|
|
69
|
+
"body-parser": "^2.3.0",
|
|
70
|
+
"cookie-parser": "^1.4.7",
|
|
71
|
+
"dotenv": "^17.4.2",
|
|
72
|
+
"handlebars": "^4.7.9",
|
|
73
|
+
"jsonrepair": "^3.15.0",
|
|
74
|
+
"multer": "^2.2.0",
|
|
75
|
+
"openai": "^7.4.0",
|
|
76
|
+
"passport": "^0.7.0",
|
|
77
|
+
"passport-jwt": "^4.0.1",
|
|
78
|
+
"pdf-data-parser": "^1.2.22",
|
|
79
|
+
"pdf-lib": "^1.17.1",
|
|
80
|
+
"reflect-metadata": "^0.2.2",
|
|
81
|
+
"rxjs": "^7.8.2",
|
|
82
|
+
"save": "^2.9.0",
|
|
83
|
+
"stripe": "~22.0.0",
|
|
84
|
+
"together-ai": "^0.47.0",
|
|
85
|
+
"yauzl": "^3.4.0",
|
|
86
|
+
"zod": "^4.4.3"
|
|
87
|
+
},
|
|
88
|
+
"devDependencies": {
|
|
89
|
+
"@nestjs/cli": "^11.0.24",
|
|
90
|
+
"@nestjs/schematics": "^11.1.0",
|
|
91
|
+
"@nestjs/testing": "^11.1.28",
|
|
92
|
+
"@types/bcrypt": "^6.0.0",
|
|
93
|
+
"@types/cookie-parser": "^1.4.10",
|
|
94
|
+
"@types/eventsource": "^3.0.0",
|
|
95
|
+
"@types/express": "^5.0.6",
|
|
96
|
+
"@types/jest": "^30.0.0",
|
|
97
|
+
"@types/multer": "^2.2.0",
|
|
98
|
+
"@types/node": "~24.x",
|
|
99
|
+
"@types/passport-jwt": "^4.0.1",
|
|
100
|
+
"@types/supertest": "^7.2.1",
|
|
101
|
+
"@typescript-eslint/eslint-plugin": "^8.66.0",
|
|
102
|
+
"@typescript-eslint/parser": "^8.66.0",
|
|
103
|
+
"copyfiles": "^2.4.1",
|
|
104
|
+
"eslint": "^10.8.1",
|
|
105
|
+
"eslint-config-prettier": "^10.1.8",
|
|
106
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
107
|
+
"eventsource": "^4.1.1",
|
|
108
|
+
"jest": "^30.4.2",
|
|
109
|
+
"prettier": "^3.9.6",
|
|
110
|
+
"rimraf": "^6.1.3",
|
|
111
|
+
"sharp": "^0.35.3",
|
|
112
|
+
"source-map-support": "^0.5.21",
|
|
113
|
+
"supertest": "^7.2.2",
|
|
114
|
+
"ts-jest": "^29.4.12",
|
|
115
|
+
"ts-loader": "^9.6.2",
|
|
116
|
+
"ts-node": "^10.9.2",
|
|
117
|
+
"tsc-alias": "^1.9.1",
|
|
118
|
+
"tsconfig-paths": "^4.2.0",
|
|
119
|
+
"typedoc": "^0.28.20",
|
|
120
|
+
"typescript": "^5.9.3"
|
|
121
|
+
},
|
|
122
|
+
"jest": {
|
|
123
|
+
"moduleFileExtensions": [
|
|
124
|
+
"ts",
|
|
125
|
+
"js",
|
|
126
|
+
"json"
|
|
127
|
+
],
|
|
128
|
+
"rootDir": "src",
|
|
129
|
+
"testRegex": ".*\\.spec\\.ts$",
|
|
130
|
+
"transform": {
|
|
131
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
132
|
+
},
|
|
133
|
+
"collectCoverageFrom": [
|
|
134
|
+
"**/*.(t|j)s"
|
|
135
|
+
],
|
|
136
|
+
"coverageDirectory": "../coverage",
|
|
137
|
+
"testEnvironment": "node"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
# The 5e
|
|
1
|
+
# The 5e pack
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
arithmetic
|
|
3
|
+
Everything a Briyah room needs to run a fifth-edition tabletop game. There is no D&D
|
|
4
|
+
feature in Briyah: a game is an ordinary room, assembled from agents, prompt folders,
|
|
5
|
+
tool grants and a room leader. This directory holds the *code* — the dice and the
|
|
6
|
+
arithmetic — and the rest of the pack's content sits in `server/data/packs/dnd5e/`:
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
```
|
|
9
|
+
server/data/packs/dnd5e/
|
|
10
|
+
├── pack.json
|
|
11
|
+
├── prompts/ dungeon_master, dnd_player, character_creator,
|
|
12
|
+
│ campaign_designer, battle_master, dnd_room_moderator
|
|
13
|
+
├── artifacts/ 16 documents: combat procedure, the planes, twelve classes
|
|
14
|
+
├── agents/ six agent templates
|
|
15
|
+
└── rooms/ table.json — the whole table in one action
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The two `packs` directories are different things and it is worth keeping them
|
|
19
|
+
straight: `server/src/tools/packs/dnd5e/` is this pack's tool code, compiled into the
|
|
20
|
+
build; `server/data/packs/dnd5e/` is its content, which a user can override per-file.
|
|
21
|
+
|
|
22
|
+
Prompt folders are referenced pack-qualified — `dnd5e:dungeon_master`, not
|
|
23
|
+
`dungeon_master`.
|
|
12
24
|
|
|
13
25
|
Each folder carries a `defaults_config.json`, so selecting it in the create-agent dialog fills
|
|
14
26
|
in that role's name, nickname, description, tool grants and cache TTL. The grant table below is
|
|
@@ -18,10 +30,77 @@ otherwise show up mid-session as an agent that cannot roll.
|
|
|
18
30
|
|
|
19
31
|
| Agent | Prompt folder | Tools it is granted |
|
|
20
32
|
|---|---|---|
|
|
21
|
-
| Dungeon Master | `dungeon_master` | all
|
|
33
|
+
| Dungeon Master | `dungeon_master` | all eighteen |
|
|
22
34
|
| Player | `dnd_player` | none — see [Why players get no tools](#why-players-get-no-tools) |
|
|
23
35
|
| Character creator | `character_creator` | `create_sheet`, `read_sheet`, `patch_sheet`, `level_up`, `roll_dice`, `rules_lookup`, `spell` |
|
|
24
36
|
| Campaign designer | `campaign_designer` | `stat_block`, `magic_item`, `rules_lookup` |
|
|
37
|
+
| Battle Master | `battle_master` | `roll_initiative`, `encounter`, `roll_dice`, `check`, `apply_hp`, `conditions`, `spend`, `read_sheet`, `stat_block`, `spell`, `magic_item`, `rules_lookup` |
|
|
38
|
+
|
|
39
|
+
## Why combat is a separate agent
|
|
40
|
+
|
|
41
|
+
The Dungeon Master is the most expensive agent at the table: it carries the whole campaign
|
|
42
|
+
history plus its procedure document in a cached prefix. A fight is a dozen tool calls of
|
|
43
|
+
bookkeeping, and every one of them re-sends all of that. None of the bookkeeping needs the
|
|
44
|
+
campaign history, and none of the narration needs the combat rules — so they are split along
|
|
45
|
+
the agent boundary rather than tuned.
|
|
46
|
+
|
|
47
|
+
The **Battle Master** runs encounters and nothing else. It holds the combat document, a short
|
|
48
|
+
history window (`maxHistoryMessages: 20`), and should be created on a **cheap model** — it does
|
|
49
|
+
arithmetic and reports outcomes, it does not write prose. The Dungeon Master hands over at the
|
|
50
|
+
moment it would have rolled initiative, stays out of the fight entirely, and picks the story back
|
|
51
|
+
up from a single outcome report.
|
|
52
|
+
|
|
53
|
+
A 20-message window is narrower than a real fight, and that is deliberate: the window's job is to
|
|
54
|
+
stop the second encounter carrying the first. What keeps the *current* encounter intact is the
|
|
55
|
+
room's **history pin**, set automatically when the leader hands a specialist a task, which makes
|
|
56
|
+
trimming keep everything since the handoff. See the `rooms` skill; the pack needs to do nothing
|
|
57
|
+
for it beyond having a window at all.
|
|
58
|
+
|
|
59
|
+
### Monsters are combatants, not prose
|
|
60
|
+
|
|
61
|
+
`stat_block` with **`place: true`** writes each creature as a `Foe: <name>` artifact with its own
|
|
62
|
+
rolled hit points. From then on `check`, `apply_hp`, `conditions` and `spend` all work on it by
|
|
63
|
+
name, because every one of them resolves its target through `loadSheet` — a monster is the same
|
|
64
|
+
shape as a character, with `foe: true`, no class, and its stat block's flat save bonuses in
|
|
65
|
+
`saveBonus`.
|
|
66
|
+
|
|
67
|
+
Three things follow, and each replaces something that went wrong in a played fight:
|
|
68
|
+
|
|
69
|
+
- **`check` compares an attack to armour class.** `roll_dice` returns a number and leaves the
|
|
70
|
+
comparison to whoever reads it; in round one of the first real fight a 15 against AC 16 dealt
|
|
71
|
+
seven damage. A placed monster attacks through `check` with the target's AC in `dc`, and the
|
|
72
|
+
tool answers `passed`.
|
|
73
|
+
- **Hit points are stored, not restated.** They used to live only as arithmetic in the Battle
|
|
74
|
+
Master's `situation` line. Across four rounds that drifted (`25-3 = 19`), then was lost when
|
|
75
|
+
the agent's history window trimmed the early rounds, then was re-read from the stat block —
|
|
76
|
+
restoring the boss to full and erasing three rounds of the party's damage, invisibly.
|
|
77
|
+
- **A monster dies at 0** rather than falling unconscious and rolling death saves.
|
|
78
|
+
|
|
79
|
+
Two invariants worth keeping:
|
|
80
|
+
|
|
81
|
+
- **The `Foe:` prefix is a privacy boundary.** `Party Status` and `read_sheet character: "party"`
|
|
82
|
+
are rebuilt from every `Sheet:` artifact and read by every player. A monster filed under that
|
|
83
|
+
prefix would publish its exact remaining hit points to the table — the one thing the Dungeon
|
|
84
|
+
Master's prompt forbids saying out loud.
|
|
85
|
+
- **`roll_initiative` clears the previous fight's monsters, keeping the ones it names.** Cleared
|
|
86
|
+
on the way in rather than the way out, because a fight ends with a message rather than a tool
|
|
87
|
+
call and the Battle Master did not reliably signal the end at all. Keeping the named ones
|
|
88
|
+
matters just as much: a fight is set up by placing and *then* rolling, so clearing everything
|
|
89
|
+
would delete the combatants placed seconds earlier.
|
|
90
|
+
|
|
91
|
+
This is additive. The DM still grants all eighteen tools, so a table with no Battle Master runs
|
|
92
|
+
exactly as it did before — but its procedure document no longer carries the combat rules, so
|
|
93
|
+
attach `5e · battle_master — combat mechanics` to the DM as well if you run it that way.
|
|
94
|
+
|
|
95
|
+
Two things make the handoff work, and both are prompt-level rather than code-level:
|
|
96
|
+
|
|
97
|
+
- **A non-leader agent can drive turn order.** `Room.selectResponders` resolves a message's
|
|
98
|
+
targets before it falls back to the room leader, so the Battle Master naming a combatant is
|
|
99
|
+
what prompts them. Nothing in the dispatch path cares that it is not the leader.
|
|
100
|
+
- **Players must answer whoever addressed them.** `dnd_player`'s prompt used to hard-code the
|
|
101
|
+
room leader as the reply target. If that regresses, a player answers the DM mid-fight, the DM
|
|
102
|
+
picks up the turn, and combat silently reverts to the old behaviour with no error anywhere.
|
|
103
|
+
`prompt-folders.spec.ts` guards it.
|
|
25
104
|
|
|
26
105
|
## What the pack knows, and what still needs a document
|
|
27
106
|
|
|
@@ -40,18 +119,23 @@ throws, skill list, casting progression, subclass level and ASI levels — but n
|
|
|
40
119
|
Sneak Attack or Channel Divinity do. That, deeper combat procedure, and anything your table
|
|
41
120
|
plays with from outside the SRD are what a rule document is still for.
|
|
42
121
|
|
|
43
|
-
The pack ships
|
|
122
|
+
The pack ships sixteen documents distilled from the SRD for exactly those gaps, in
|
|
44
123
|
`server/data/common/artifacts/dnd5e/` beside a `manifest.json`. **They need no upload**: they appear
|
|
45
124
|
on the Artifacts page as read-only artifacts whenever the pack is enabled, and the create-agent
|
|
46
125
|
dialog pre-ticks the right one as soon as a prompt folder is selected.
|
|
47
126
|
|
|
48
127
|
| Document | For |
|
|
49
128
|
|---|---|
|
|
50
|
-
| `dungeon_master-procedure.md` | The Dungeon Master —
|
|
129
|
+
| `dungeon_master-procedure.md` | The Dungeon Master — DCs, travel, light, objects, traps, resting, downtime |
|
|
130
|
+
| `battle_master-combat.md` | The Battle Master — the round, actions, movement, attacks, damage rulings |
|
|
51
131
|
| `character_creator-basics.md` | The character creator — what the tools answer, and languages |
|
|
52
132
|
| `class-<name>.md` ×12 | Whoever needs that class: the creator building one, the agent playing one |
|
|
53
133
|
| `campaign_designer-setting.md` | The campaign designer — the planes and the SRD pantheons |
|
|
54
134
|
|
|
135
|
+
The DC table and the vision rules are deliberately in **both** procedure documents. They are
|
|
136
|
+
cheap, and each agent hits a wall without them: the Battle Master sets DCs for improvised actions
|
|
137
|
+
and resolves a shove as a contest, and the Dungeon Master needs the same table out of combat.
|
|
138
|
+
|
|
55
139
|
All twelve class documents are pre-ticked on the **character creator**, and nowhere else. It is
|
|
56
140
|
handed players one at a time and cannot know in advance what any of them will pick, so the twelve
|
|
57
141
|
travel together or the build is guessed: a played campaign whose creator carried none of them
|
|
@@ -157,6 +241,34 @@ five, not a category), and uses the two-handed die for a versatile weapon. There
|
|
|
157
241
|
tool: `rules_lookup` answers `topic: "glaive"` and `topic: "chain mail"`, and the pack already
|
|
158
242
|
has as many tools as a five-call turn can chain.
|
|
159
243
|
|
|
244
|
+
**Tools** — the rulebook kind, thieves' tools and artisan's tools — live in `data/kits.ts`,
|
|
245
|
+
named that way because `tools/` next door holds the Briyah tool definitions and a `data/tools.ts`
|
|
246
|
+
beside it would read as the wrong thing. Thirty-nine entries in five categories, hand-written.
|
|
247
|
+
|
|
248
|
+
Tool proficiency is the one proficiency that is **stored** on the sheet, in `toolProf`, rather
|
|
249
|
+
than derived from the class and race the way weapon proficiency is. It has to be: most of it is
|
|
250
|
+
*chosen*. A bard picks three instruments out of ten and a dwarf picks one artisan's tool out of
|
|
251
|
+
three, and there is nothing to derive that from. So `create_sheet` takes the player's picks in
|
|
252
|
+
`spec.tools`, adds what the class, race and background grant outright, and reports the choices
|
|
253
|
+
still owed — a bard who named no instruments is told they owe three. A tool outside the table is
|
|
254
|
+
accepted as written, since the SRD's own background customization rule invites inventing one.
|
|
255
|
+
|
|
256
|
+
The three sources share one *consumed* set, which is the part that is easy to break. Without it a
|
|
257
|
+
dwarf monk — offered an artisan's tool by each — has both choices settled by a single pick and
|
|
258
|
+
quietly loses a proficiency. The race is applied before the class for the same reason: a race
|
|
259
|
+
offers a shortlist and a class offers a whole category, so settling the narrow one first leaves
|
|
260
|
+
the player the wider one to spend.
|
|
261
|
+
|
|
262
|
+
`check` rolls one with `kind: "tool"`. **The ability is the DM's**, because the rules make it so —
|
|
263
|
+
the SRD fixes no ability to a tool and picks one per situation, a Dexterity check to force a lock
|
|
264
|
+
and an Intelligence check to identify a poison. The tool defaults to Dexterity, since traps and
|
|
265
|
+
locks are most of what gets rolled, and every result names the ability it used (`Thieves' tools
|
|
266
|
+
(DEX)`) so a wrong default is visible rather than silent. Proficiency is added only when the
|
|
267
|
+
character has it and doubled from `toolExp`, which is where a rogue's Expertise goes when it is
|
|
268
|
+
spent on thieves' tools rather than on a second skill — `create_sheet` sorts an `expertise` list
|
|
269
|
+
into the skills and the tools rather than dropping what is not a skill. A character without the
|
|
270
|
+
proficiency still rolls and is told no bonus applied: using a tool unproficiently is legal.
|
|
271
|
+
|
|
160
272
|
`syncWeaponAttacks` only ever touches an entry whose name is **exactly** a table weapon.
|
|
161
273
|
"Longsword +1", "Claws" and anything hand-written are left alone — a fuzzy match would mistake
|
|
162
274
|
the first for a plain longsword and quietly strip its bonus.
|
|
@@ -375,8 +487,10 @@ secret, and an explicit list of what was left blank. There is no scene sequence
|
|
|
375
487
|
|
|
376
488
|
Keep the creator in the room afterwards: in directed mode it is never prompted unless
|
|
377
489
|
addressed, so it costs nothing at rest, and the DM calls it back for every level-up. Give it a
|
|
378
|
-
|
|
379
|
-
`hear()` even while it stays silent.
|
|
490
|
+
bounded `maxHistoryMessages` (60) — its history still accumulates public messages through
|
|
491
|
+
`hear()` even while it stays silent. Sixty rather than twenty because an interview with a human
|
|
492
|
+
runs one question per turn and can outgrow a narrow window; the room's history pin protects the
|
|
493
|
+
interview in flight, and the window is the backstop.
|
|
380
494
|
|
|
381
495
|
### Levelling up
|
|
382
496
|
|
|
@@ -403,28 +517,73 @@ granted to the creator and mentioned nowhere.
|
|
|
403
517
|
|
|
404
518
|
## Turning it on
|
|
405
519
|
|
|
520
|
+
Enable **D&D 5th Edition** on the Packs page. That is per user: the tools are registered
|
|
521
|
+
process-wide at boot, and enabling is what makes them grantable to *your* agents and puts
|
|
522
|
+
the pack's prompt folders and documents in your lists. `BRIYAH_TOOL_PACKS` no longer does
|
|
523
|
+
anything.
|
|
524
|
+
|
|
525
|
+
Expand the pack's row and press **Create Room** on the *D&D Table* template, or pick it
|
|
526
|
+
from "Copy an Existing Room" in the Create Room dialog. Either builds the room and its six
|
|
527
|
+
agents in one action, already carrying their prompt folders, tool grants and documents, with
|
|
528
|
+
turn mode **directed** and the Dungeon Master as leader. You are asked for two models: the
|
|
529
|
+
primary one runs the Dungeon Master, and the economy one runs everybody else — see
|
|
530
|
+
[Why combat is a separate agent](#why-combat-is-a-separate-agent) for why that split is the
|
|
531
|
+
point.
|
|
532
|
+
|
|
533
|
+
Disabling the pack later hides its prompts, documents, tools, agents and rooms from your
|
|
534
|
+
pages. It does not stop a room that already exists from working.
|
|
535
|
+
|
|
536
|
+
### From the SDK
|
|
537
|
+
|
|
538
|
+
Two calls, and neither is about tools — the pack's tools are installed when you construct
|
|
539
|
+
`Briyah`, and there is nothing to register:
|
|
540
|
+
|
|
541
|
+
```ts
|
|
542
|
+
const app = briyah.getAppService('user-123');
|
|
543
|
+
|
|
544
|
+
app.packs.setEnabled('dnd5e', true); // per user, and required
|
|
545
|
+
|
|
546
|
+
const { roomId, warnings } = await app.packInstantiation.instantiateRoom(
|
|
547
|
+
'dnd5e',
|
|
548
|
+
'table',
|
|
549
|
+
{
|
|
550
|
+
primary: { aiServiceName: 'Anthropic', aiModel: 'claude-sonnet-5' },
|
|
551
|
+
economy: { aiServiceName: 'Anthropic', aiModel: 'claude-haiku-4-5' },
|
|
552
|
+
},
|
|
553
|
+
'Tuesday Night Game', // optional room name
|
|
554
|
+
{ player: { agentName: 'Homer', agentNickname: 'Homer' } }, // optional per-seat overrides
|
|
555
|
+
);
|
|
406
556
|
```
|
|
407
|
-
BRIYAH_TOOL_PACKS=dnd5e
|
|
408
|
-
```
|
|
409
557
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
558
|
+
That is the same six-agent table the button builds. The fifth argument names any seat by its
|
|
559
|
+
template key — `table_moderator`, `dungeon_master`, `battle_master`, `character_creator`,
|
|
560
|
+
`campaign_designer`, `player` — which is how the person at the keyboard gets their own name
|
|
561
|
+
instead of `PlayerOne`. `warnings` reports anything that did not go to plan without stopping the
|
|
562
|
+
room, such as a document that failed to attach; log it, because a missing document is a
|
|
563
|
+
capability an agent appears to have and does not.
|
|
564
|
+
|
|
565
|
+
**Enable before you build.** A pack-qualified folder (`dnd5e:dungeon_master`) always resolves,
|
|
566
|
+
but a bare `dungeon_master` reaches the pack only once it is enabled, and `instantiateRoom`
|
|
567
|
+
refuses a pack that is off.
|
|
413
568
|
|
|
414
|
-
|
|
569
|
+
To filter or wrap the tool definitions rather than take them all, pass them to the constructor:
|
|
415
570
|
|
|
416
571
|
```ts
|
|
417
|
-
import { dnd5eTools } from 'briyah';
|
|
418
|
-
briyah
|
|
572
|
+
import { Briyah, dnd5eTools } from 'briyah';
|
|
573
|
+
const briyah = new Briyah({ tools: dnd5eTools() });
|
|
419
574
|
```
|
|
420
575
|
|
|
576
|
+
The main README's [Example 11](../../../../README.md#example-11-seating-a-whole-dd-table) has the
|
|
577
|
+
console loop that goes with this, and the by-hand version.
|
|
578
|
+
|
|
421
579
|
## The tools
|
|
422
580
|
|
|
423
581
|
| Tool | What it does |
|
|
424
582
|
|---|---|
|
|
425
583
|
| `roll_dice` | Rolls dice expressions in a labelled, semicolon-separated batch |
|
|
426
|
-
| `roll_initiative` | Rolls a whole encounter's initiative in one call and
|
|
427
|
-
| `
|
|
584
|
+
| `roll_initiative` | Rolls a whole encounter's initiative in one call and starts the `Encounter` state |
|
|
585
|
+
| `encounter` | Reads and advances the fight: the round, whose turn it is, removing a combatant, ending it |
|
|
586
|
+
| `check` | Any d20 test, with modifiers read off the character's sheet; rolls damage for attacks, and tool checks with the ability the DM names |
|
|
428
587
|
| `apply_hp` | Damage, healing, temporary hit points, the dying sequence, death saves |
|
|
429
588
|
| `rest` | Short and long rests, including spending hit dice |
|
|
430
589
|
| `spend` | Spell slots, hit dice, feature uses, item charges |
|
|
@@ -438,7 +597,7 @@ briyah.registerTools(dnd5eTools());
|
|
|
438
597
|
| `stat_block` | Looks up a creature, or defines one for this campaign |
|
|
439
598
|
| `magic_item` | Looks up a magic item, or defines one for this campaign |
|
|
440
599
|
| `spell` | Looks up a spell, or lists what a class can cast |
|
|
441
|
-
| `rules_lookup` | SRD excerpts for conditions, rules, tables and
|
|
600
|
+
| `rules_lookup` | SRD excerpts for conditions, rules, tables, equipment and tools |
|
|
442
601
|
|
|
443
602
|
**Labels on `roll_dice` use `=`, not `:`.** Expressions are semicolon-separated and each may
|
|
444
603
|
carry a name, which is what makes a multi-roll result readable:
|
|
@@ -457,7 +616,7 @@ Suggested grants:
|
|
|
457
616
|
|
|
458
617
|
| Agent | Prompt folder | Tools |
|
|
459
618
|
|---|---|---|
|
|
460
|
-
| Dungeon Master | `dungeon_master` | all
|
|
619
|
+
| Dungeon Master | `dungeon_master` | all eighteen |
|
|
461
620
|
| AI player | `dnd_player` | **none** — see below |
|
|
462
621
|
| Human player | `dnd_player` | none |
|
|
463
622
|
| Character creator | `character_creator` | `create_sheet`, `read_sheet`, `patch_sheet`, `level_up`, `roll_dice`, `rules_lookup`, `spell` |
|
|
@@ -511,7 +670,7 @@ decided and waits for `level_up`.
|
|
|
511
670
|
|---|---|---|
|
|
512
671
|
| `Sheet: <Character>` | that character's agent | The full sheet |
|
|
513
672
|
| `Party Status` | every agent | One line per character: level, hit points, armour class, conditions |
|
|
514
|
-
| `Encounter` | every agent | The
|
|
673
|
+
| `Encounter` | every agent | The round and the initiative order, transient; no monster hit points |
|
|
515
674
|
| `Campaign` | the Dungeon Master (and its author) | The world: factions, places, people, hooks |
|
|
516
675
|
| `Bestiary` | its author only | Creature statistics particular to this campaign |
|
|
517
676
|
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LibraryFile, LibraryPrompt } from '../../../shared/types/app.types';
|
|
2
|
-
export declare class LibraryService {
|
|
3
|
-
private getLibraryDir;
|
|
4
|
-
private assertSafeName;
|
|
5
|
-
private normalizeBaseUrl;
|
|
6
|
-
listLocalPrompts(): LibraryPrompt[];
|
|
7
|
-
listLocalFiles(folder: string): LibraryFile[];
|
|
8
|
-
getLocalFileContent(folder: string, file: string): string;
|
|
9
|
-
private fetchJson;
|
|
10
|
-
listRemotePrompts(baseUrl: string): Promise<LibraryPrompt[]>;
|
|
11
|
-
listRemoteFiles(baseUrl: string, folder: string): Promise<LibraryFile[]>;
|
|
12
|
-
getRemoteFileContent(baseUrl: string, folder: string, file: string): Promise<string>;
|
|
13
|
-
copyFromRemote(baseUrl: string, folder: string, userPromptsDir: string): Promise<void>;
|
|
14
|
-
}
|