briyah 2.0.2 → 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.
- package/LICENSE +216 -0
- package/README.md +43 -7
- package/data/common/config/LICENSE-model-prices.md +65 -0
- package/data/common/config/markup +1 -1
- package/data/common/config/model_prices.json +47443 -46295
- package/data/common/prompts/narrator/create_story.prompt +2 -0
- package/data/packs/dnd5e/agents/player.json +11 -11
- package/data/packs/dnd5e/prompts/character_creator/defaults_config.json +21 -20
- package/data/packs/dnd5e/prompts/character_creator/perceive.prompt +19 -12
- package/data/packs/dnd5e/prompts/dnd_player/perceive.prompt +10 -6
- package/dist-sdk/server/src/ai/LLM/anthropic.service.d.ts +103 -0
- package/dist-sdk/server/src/ai/LLM/anthropic.service.js +173 -2
- package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +172 -3
- package/dist-sdk/server/src/ai/LLM/base-ai.service.js +241 -5
- package/dist-sdk/server/src/ai/LLM/comfyui-client.d.ts +26 -0
- package/dist-sdk/server/src/ai/LLM/comfyui-client.js +25 -0
- package/dist-sdk/server/src/ai/LLM/comfyui-workflow.d.ts +54 -0
- package/dist-sdk/server/src/ai/LLM/comfyui-workflow.js +59 -1
- package/dist-sdk/server/src/ai/LLM/comfyui.service.d.ts +21 -1
- package/dist-sdk/server/src/ai/LLM/comfyui.service.js +25 -1
- package/dist-sdk/server/src/ai/LLM/deepseek.service.d.ts +52 -0
- package/dist-sdk/server/src/ai/LLM/deepseek.service.js +102 -3
- package/dist-sdk/server/src/ai/LLM/fal.service.d.ts +25 -0
- package/dist-sdk/server/src/ai/LLM/fal.service.js +55 -1
- package/dist-sdk/server/src/ai/LLM/googleai.service.d.ts +19 -0
- package/dist-sdk/server/src/ai/LLM/googleai.service.js +42 -1
- package/dist-sdk/server/src/ai/LLM/grok.service.d.ts +22 -0
- package/dist-sdk/server/src/ai/LLM/grok.service.js +54 -2
- package/dist-sdk/server/src/ai/LLM/mock.service.js +31 -4
- package/dist-sdk/server/src/ai/LLM/openai.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/LLM/openai.service.js +80 -2
- package/dist-sdk/server/src/ai/LLM/self-hosted.service.d.ts +21 -0
- package/dist-sdk/server/src/ai/LLM/self-hosted.service.js +44 -2
- package/dist-sdk/server/src/ai/LLM/together.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/LLM/together.service.js +60 -2
- package/dist-sdk/server/src/ai/agent-config.d.ts +15 -0
- package/dist-sdk/server/src/ai/agent-factory.d.ts +16 -0
- package/dist-sdk/server/src/ai/agent-factory.js +20 -0
- package/dist-sdk/server/src/ai/agent-message.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/agent-message.service.js +30 -0
- package/dist-sdk/server/src/ai/agent-store.service.d.ts +80 -0
- package/dist-sdk/server/src/ai/agent-store.service.js +166 -5
- package/dist-sdk/server/src/ai/agent.d.ts +196 -0
- package/dist-sdk/server/src/ai/agent.js +224 -11
- package/dist-sdk/server/src/ai/ai-debug-logger.d.ts +18 -0
- package/dist-sdk/server/src/ai/ai-debug-logger.js +19 -0
- package/dist-sdk/server/src/ai/ai-factory.service.d.ts +9 -0
- package/dist-sdk/server/src/ai/ai-factory.service.js +9 -0
- package/dist-sdk/server/src/ai/artifact.service.d.ts +131 -0
- package/dist-sdk/server/src/ai/artifact.service.js +148 -3
- package/dist-sdk/server/src/ai/attached-file.service.d.ts +87 -0
- package/dist-sdk/server/src/ai/attached-file.service.js +105 -0
- package/dist-sdk/server/src/ai/model_prices.d.ts +30 -0
- package/dist-sdk/server/src/ai/model_prices.js +91 -5
- package/dist-sdk/server/src/ai/pack-artifacts.d.ts +84 -0
- package/dist-sdk/server/src/ai/pack-artifacts.js +168 -0
- package/dist-sdk/server/src/ai/published-agents.service.d.ts +25 -0
- package/dist-sdk/server/src/ai/published-agents.service.js +30 -3
- package/dist-sdk/server/src/app/balance-message.service.d.ts +24 -0
- package/dist-sdk/server/src/app/balance-message.service.js +24 -0
- package/dist-sdk/server/src/app/balance.module.d.ts +4 -0
- package/dist-sdk/server/src/app/balance.module.js +4 -0
- package/dist-sdk/server/src/app/balance.service.d.ts +37 -0
- package/dist-sdk/server/src/app/balance.service.js +54 -0
- package/dist-sdk/server/src/app/stripe.controller.d.ts +21 -0
- package/dist-sdk/server/src/app/stripe.controller.js +35 -0
- package/dist-sdk/server/src/app/stripe.service.d.ts +43 -0
- package/dist-sdk/server/src/app/stripe.service.js +62 -0
- package/dist-sdk/server/src/app/transaction.service.d.ts +27 -0
- package/dist-sdk/server/src/app/transaction.service.js +36 -0
- package/dist-sdk/server/src/app/user-service-factory.d.ts +8 -0
- package/dist-sdk/server/src/app/user-service-factory.js +38 -1
- package/dist-sdk/server/src/app/user-service-manager.d.ts +27 -0
- package/dist-sdk/server/src/app/user-service-manager.js +43 -0
- package/dist-sdk/server/src/app.controller.d.ts +87 -0
- package/dist-sdk/server/src/app.controller.js +272 -12
- package/dist-sdk/server/src/app.module.js +28 -6
- package/dist-sdk/server/src/app.service.d.ts +1662 -0
- package/dist-sdk/server/src/app.service.js +1862 -6
- package/dist-sdk/server/src/auth/agent-access.decorator.d.ts +17 -0
- package/dist-sdk/server/src/auth/agent-access.decorator.js +17 -0
- package/dist-sdk/server/src/auth/auth.controller.js +46 -0
- package/dist-sdk/server/src/auth/auth.module.js +3 -2
- package/dist-sdk/server/src/auth/auth.service.d.ts +33 -0
- package/dist-sdk/server/src/auth/auth.service.js +39 -3
- package/dist-sdk/server/src/auth/jwt-auth.guard.js +18 -0
- package/dist-sdk/server/src/auth/jwt.strategy.js +2 -2
- package/dist-sdk/server/src/auth/owner-only.decorator.d.ts +9 -0
- package/dist-sdk/server/src/auth/owner-only.decorator.js +9 -0
- package/dist-sdk/server/src/auth/phone-validation.service.d.ts +25 -0
- package/dist-sdk/server/src/auth/phone-validation.service.js +30 -0
- package/dist-sdk/server/src/auth/rate-limit.service.d.ts +19 -0
- package/dist-sdk/server/src/auth/rate-limit.service.js +24 -0
- package/dist-sdk/server/src/auth/room-access.decorator.d.ts +8 -0
- package/dist-sdk/server/src/auth/room-access.decorator.js +8 -0
- package/dist-sdk/server/src/auth/scopes.decorator.d.ts +7 -0
- package/dist-sdk/server/src/auth/scopes.decorator.js +7 -0
- package/dist-sdk/server/src/auth/scopes.guard.d.ts +16 -0
- package/dist-sdk/server/src/auth/scopes.guard.js +30 -0
- package/dist-sdk/server/src/auth/session.guard.d.ts +4 -0
- package/dist-sdk/server/src/auth/session.guard.js +8 -0
- package/dist-sdk/server/src/auth/twilio.service.d.ts +27 -0
- package/dist-sdk/server/src/auth/twilio.service.js +30 -4
- package/dist-sdk/server/src/auth/users.service.d.ts +30 -0
- package/dist-sdk/server/src/auth/users.service.js +42 -0
- package/dist-sdk/server/src/common/errors.d.ts +20 -0
- package/dist-sdk/server/src/common/errors.js +21 -0
- package/dist-sdk/server/src/config/env-config.d.ts +7 -0
- package/dist-sdk/server/src/config/prompt-resolver.d.ts +180 -0
- package/dist-sdk/server/src/config/prompt-resolver.js +182 -0
- package/dist-sdk/server/src/config/user-config.service.d.ts +59 -0
- package/dist-sdk/server/src/config/user-config.service.js +57 -0
- package/dist-sdk/server/src/config/user-paths.service.d.ts +61 -0
- package/dist-sdk/server/src/config/user-paths.service.js +67 -0
- package/dist-sdk/server/src/documents/pdf-conversion.d.ts +121 -1
- package/dist-sdk/server/src/documents/pdf-conversion.js +94 -0
- package/dist-sdk/server/src/packs/pack-instantiation.service.d.ts +98 -0
- package/dist-sdk/server/src/packs/pack-instantiation.service.js +99 -0
- package/dist-sdk/server/src/packs/pack-manifest.d.ts +100 -0
- package/dist-sdk/server/src/packs/pack-manifest.js +58 -0
- package/dist-sdk/server/src/packs/pack.service.d.ts +99 -1
- package/dist-sdk/server/src/packs/pack.service.js +98 -1
- package/dist-sdk/server/src/room/artifact-store.service.d.ts +27 -0
- package/dist-sdk/server/src/room/artifact-store.service.js +49 -3
- package/dist-sdk/server/src/room/artifact.d.ts +18 -0
- package/dist-sdk/server/src/room/message.d.ts +64 -0
- package/dist-sdk/server/src/room/message.js +77 -2
- package/dist-sdk/server/src/room/nickname.d.ts +27 -0
- package/dist-sdk/server/src/room/nickname.js +41 -0
- package/dist-sdk/server/src/room/published-rooms.service.js +2 -0
- package/dist-sdk/server/src/room/room-config.d.ts +26 -0
- package/dist-sdk/server/src/room/room-factory.d.ts +12 -0
- package/dist-sdk/server/src/room/room-factory.js +14 -0
- package/dist-sdk/server/src/room/room-message.service.d.ts +28 -0
- package/dist-sdk/server/src/room/room-message.service.js +28 -0
- package/dist-sdk/server/src/room/room-store.service.d.ts +177 -0
- package/dist-sdk/server/src/room/room-store.service.js +242 -5
- package/dist-sdk/server/src/room/room.d.ts +906 -1
- package/dist-sdk/server/src/room/room.js +1525 -34
- package/dist-sdk/server/src/rpg/rpg-models.d.ts +50 -0
- package/dist-sdk/server/src/rpg/rpg-models.js +53 -0
- package/dist-sdk/server/src/rpg/rpg-roster.d.ts +38 -3
- package/dist-sdk/server/src/rpg/rpg-roster.js +49 -49
- package/dist-sdk/server/src/rpg/rpg.service.d.ts +87 -0
- package/dist-sdk/server/src/rpg/rpg.service.js +108 -5
- package/dist-sdk/server/src/sdk/briyah-config.d.ts +57 -0
- package/dist-sdk/server/src/sdk/briyah-config.js +17 -0
- package/dist-sdk/server/src/sdk/briyah.d.ts +228 -0
- package/dist-sdk/server/src/sdk/briyah.js +285 -7
- package/dist-sdk/server/src/sdk/index.d.ts +0 -1
- package/dist-sdk/server/src/sdk/index.js +24 -3
- package/dist-sdk/server/src/shared/shared.module.d.ts +8 -0
- package/dist-sdk/server/src/shared/shared.module.js +13 -5
- package/dist-sdk/server/src/story/story-message.service.d.ts +43 -0
- package/dist-sdk/server/src/story/story-message.service.js +43 -0
- package/dist-sdk/server/src/story/story-progress.service.d.ts +23 -0
- package/dist-sdk/server/src/story/story-progress.service.js +23 -0
- package/dist-sdk/server/src/story/story-store.service.d.ts +92 -0
- package/dist-sdk/server/src/story/story-store.service.js +136 -1
- package/dist-sdk/server/src/story/story.service.d.ts +398 -0
- package/dist-sdk/server/src/story/story.service.js +829 -25
- package/dist-sdk/server/src/tools/core/index.d.ts +25 -0
- package/dist-sdk/server/src/tools/core/index.js +31 -0
- package/dist-sdk/server/src/tools/core/rename.tool.d.ts +10 -0
- package/dist-sdk/server/src/tools/core/rename.tool.js +72 -0
- package/dist-sdk/server/src/tools/native-tool-registry.service.d.ts +22 -0
- package/dist-sdk/server/src/tools/native-tool-registry.service.js +22 -0
- package/dist-sdk/server/src/tools/native-tool.types.d.ts +186 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.d.ts +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.js +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.d.ts +46 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.js +40 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.d.ts +33 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.js +19 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.d.ts +37 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.d.ts +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.js +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.js +27 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.d.ts +36 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.js +32 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.d.ts +32 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.d.ts +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.js +20 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.d.ts +36 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.d.ts +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.js +21 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.d.ts +95 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.js +66 -2
- package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.d.ts +50 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.js +28 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.d.ts +92 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.js +152 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.d.ts +28 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.js +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.d.ts +31 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.js +36 -2
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.d.ts +261 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.js +401 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.d.ts +11 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.js +11 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.d.ts +65 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.js +67 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.d.ts +73 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.js +63 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.d.ts +66 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.js +59 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.d.ts +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.js +49 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.d.ts +42 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.js +59 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.d.ts +72 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.js +63 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.d.ts +57 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.js +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.d.ts +81 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.js +85 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.d.ts +60 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.js +64 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.d.ts +169 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.js +203 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +192 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +144 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.d.ts +56 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.js +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.d.ts +65 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.js +73 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/index.d.ts +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/index.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.d.ts +4 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.js +116 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.d.ts +14 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.js +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.js +35 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.d.ts +6 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.js +25 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.d.ts +7 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.d.ts +8 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.js +55 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +164 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +188 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +125 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.js +23 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.js +35 -0
- package/dist-sdk/server/src/tools/packs/index.d.ts +52 -2
- package/dist-sdk/server/src/tools/packs/index.js +83 -9
- package/dist-sdk/server/src/tools/shared/coerce.d.ts +95 -0
- package/dist-sdk/server/src/tools/shared/coerce.js +98 -0
- package/dist-sdk/server/src/tools/tool-execution.service.d.ts +73 -0
- package/dist-sdk/server/src/tools/tool-execution.service.js +74 -0
- package/dist-sdk/server/src/tools/tool-store.service.d.ts +11 -0
- package/dist-sdk/server/src/tools/tool-store.service.js +13 -1
- package/dist-sdk/shared/types/app.types.d.ts +285 -14
- package/dist-sdk/shared/types/app.types.js +3 -0
- package/package.json +167 -139
- package/data/common/config/random_words.txt +0 -2241
- package/data/common/story_ideas/biblical.json +0 -122
- package/data/common/story_ideas/fantasy.json +0 -82
- package/data/common/story_ideas/historical_fiction.json +0 -82
- package/data/common/story_ideas/science_fiction.json +0 -82
- package/data/packs/acts/agents/character-guide.json +0 -6
- package/data/packs/acts/agents/discipleship-mentor.json +0 -6
- package/data/packs/acts/agents/mentor-coach.json +0 -6
- package/data/packs/acts/agents/student.json +0 -13
- package/data/packs/acts/agents/table-moderator.json +0 -6
- package/data/packs/acts/artifacts/chapter-01-acts-1.md +0 -405
- package/data/packs/acts/artifacts/chapter-02-acts-2.md +0 -443
- package/data/packs/acts/artifacts/chapter-03-acts-3.md +0 -409
- package/data/packs/acts/artifacts/chapter-04-acts-4.md +0 -438
- package/data/packs/acts/artifacts/chapter-05-acts-5.md +0 -434
- package/data/packs/acts/artifacts/chapter-06-acts-6.md +0 -441
- package/data/packs/acts/artifacts/chapter-07-acts-7.md +0 -472
- package/data/packs/acts/artifacts/chapter-08-acts-8.md +0 -512
- package/data/packs/acts/artifacts/chapter-09-acts-9.md +0 -346
- package/data/packs/acts/artifacts/chapter-10-acts-10.md +0 -367
- package/data/packs/acts/artifacts/chapter-11-acts-11.md +0 -391
- package/data/packs/acts/artifacts/chapter-12-acts-12.md +0 -390
- package/data/packs/acts/artifacts/chapter-13-acts-13.md +0 -388
- package/data/packs/acts/artifacts/chapter-14-acts-14.md +0 -466
- package/data/packs/acts/artifacts/chapter-15-acts-15.md +0 -413
- package/data/packs/acts/artifacts/chapter-16-acts-16.md +0 -585
- package/data/packs/acts/artifacts/chapter-17-acts-17.md +0 -428
- package/data/packs/acts/artifacts/chapter-18-acts-18.md +0 -486
- package/data/packs/acts/artifacts/chapter-19-acts-19.md +0 -461
- package/data/packs/acts/artifacts/chapter-20-acts-20.md +0 -389
- package/data/packs/acts/artifacts/chapter-21-acts-21.md +0 -452
- package/data/packs/acts/artifacts/chapter-22-acts-22.md +0 -424
- package/data/packs/acts/artifacts/chapter-23-acts-23.md +0 -395
- package/data/packs/acts/artifacts/chapter-24-acts-24.md +0 -446
- package/data/packs/acts/artifacts/chapter-25-acts-25.md +0 -391
- package/data/packs/acts/artifacts/chapter-26-acts-26.md +0 -431
- package/data/packs/acts/artifacts/chapter-27-acts-27.md +0 -530
- package/data/packs/acts/artifacts/chapter-28-acts-28.md +0 -1871
- package/data/packs/acts/artifacts/chapters.manifest.json +0 -170
- package/data/packs/acts/artifacts/character_guide-creation.md +0 -112
- package/data/packs/acts/artifacts/discipleship_mentor-procedure.md +0 -154
- package/data/packs/acts/artifacts/discipleship_mentor-systems.md +0 -72
- package/data/packs/acts/artifacts/manifest.json +0 -197
- package/data/packs/acts/artifacts/stage-guide.md +0 -94
- package/data/packs/acts/pack.json +0 -6
- package/data/packs/acts/prompts/acts_player/defaults_config.json +0 -5
- package/data/packs/acts/prompts/acts_player/perceive.json +0 -29
- package/data/packs/acts/prompts/acts_player/perceive.prompt +0 -87
- package/data/packs/acts/prompts/acts_player/system_instruction.prompt +0 -0
- package/data/packs/acts/prompts/acts_room_moderator/defaults_config.json +0 -9
- package/data/packs/acts/prompts/acts_room_moderator/moderate.json +0 -34
- package/data/packs/acts/prompts/acts_room_moderator/moderate.prompt +0 -70
- package/data/packs/acts/prompts/acts_room_moderator/system_instruction.prompt +0 -0
- package/data/packs/acts/prompts/character_guide/defaults_config.json +0 -18
- package/data/packs/acts/prompts/character_guide/perceive.json +0 -29
- package/data/packs/acts/prompts/character_guide/perceive.prompt +0 -140
- package/data/packs/acts/prompts/character_guide/system_instruction.prompt +0 -0
- package/data/packs/acts/prompts/discipleship_mentor/defaults_config.json +0 -23
- package/data/packs/acts/prompts/discipleship_mentor/perceive.json +0 -33
- package/data/packs/acts/prompts/discipleship_mentor/perceive.prompt +0 -245
- package/data/packs/acts/prompts/discipleship_mentor/system_instruction.prompt +0 -0
- package/data/packs/acts/prompts/mentor_coach/defaults_config.json +0 -13
- package/data/packs/acts/prompts/mentor_coach/perceive.json +0 -29
- package/data/packs/acts/prompts/mentor_coach/perceive.prompt +0 -87
- package/data/packs/acts/prompts/mentor_coach/system_instruction.prompt +0 -0
- package/data/packs/acts/rooms/session.json +0 -14
- package/data/packs/acts/rooms/training.json +0 -58
- package/dist-sdk/server/src/tools/packs/acts/data/cards.d.ts +0 -53
- package/dist-sdk/server/src/tools/packs/acts/data/cards.js +0 -54
- package/dist-sdk/server/src/tools/packs/acts/data/character-cards.generated.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/data/character-cards.generated.js +0 -185
- package/dist-sdk/server/src/tools/packs/acts/data/encounters.d.ts +0 -12
- package/dist-sdk/server/src/tools/packs/acts/data/encounters.js +0 -102
- package/dist-sdk/server/src/tools/packs/acts/data/event-cards.generated.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/data/event-cards.generated.js +0 -196
- package/dist-sdk/server/src/tools/packs/acts/data/item-cards.generated.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/data/item-cards.generated.js +0 -1311
- package/dist-sdk/server/src/tools/packs/acts/engine/cards.d.ts +0 -5
- package/dist-sdk/server/src/tools/packs/acts/engine/cards.js +0 -27
- package/dist-sdk/server/src/tools/packs/acts/engine/challenge.d.ts +0 -37
- package/dist-sdk/server/src/tools/packs/acts/engine/challenge.js +0 -120
- package/dist-sdk/server/src/tools/packs/acts/engine/dice.d.ts +0 -20
- package/dist-sdk/server/src/tools/packs/acts/engine/dice.js +0 -41
- package/dist-sdk/server/src/tools/packs/acts/engine/sheet.d.ts +0 -54
- package/dist-sdk/server/src/tools/packs/acts/engine/sheet.js +0 -200
- package/dist-sdk/server/src/tools/packs/acts/index.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/index.js +0 -24
- package/dist-sdk/server/src/tools/packs/acts/tools/award.tool.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/tools/award.tool.js +0 -184
- package/dist-sdk/server/src/tools/packs/acts/tools/challenge.tool.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/tools/challenge.tool.js +0 -107
- package/dist-sdk/server/src/tools/packs/acts/tools/chapter.tool.d.ts +0 -3
- package/dist-sdk/server/src/tools/packs/acts/tools/chapter.tool.js +0 -146
- package/dist-sdk/server/src/tools/packs/acts/tools/check.tool.d.ts +0 -4
- package/dist-sdk/server/src/tools/packs/acts/tools/check.tool.js +0 -241
- package/dist-sdk/server/src/tools/packs/acts/tools/encounter.tool.d.ts +0 -3
- package/dist-sdk/server/src/tools/packs/acts/tools/encounter.tool.js +0 -72
- package/dist-sdk/server/src/tools/packs/acts/tools/faith.tool.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/tools/faith.tool.js +0 -75
- package/dist-sdk/server/src/tools/packs/acts/tools/shared.d.ts +0 -20
- package/dist-sdk/server/src/tools/packs/acts/tools/shared.js +0 -70
- package/dist-sdk/server/src/tools/packs/acts/tools/sheet.tools.d.ts +0 -4
- package/dist-sdk/server/src/tools/packs/acts/tools/sheet.tools.js +0 -215
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -113
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1648
- package/docs/classes/Agent.html +0 -801
- package/docs/classes/Briyah.html +0 -296
- package/docs/classes/BriyahConfigService.html +0 -119
- package/docs/classes/NativeToolRegistry.html +0 -166
- package/docs/classes/PackInstantiationService.html +0 -157
- package/docs/classes/PackService.html +0 -247
- package/docs/classes/Room.html +0 -1338
- package/docs/classes/RoomMessage.html +0 -290
- package/docs/enums/MessageAction.html +0 -136
- package/docs/functions/actsTools.html +0 -44
- package/docs/functions/availableToolPacks.html +0 -41
- package/docs/functions/buildMarkdown.html +0 -54
- package/docs/functions/dnd5eTools.html +0 -44
- package/docs/functions/installToolPacks.html +0 -48
- package/docs/functions/pageMarker.html +0 -45
- package/docs/functions/registerToolPacks.html +0 -54
- package/docs/functions/splitMarkdownIntoPages.html +0 -51
- package/docs/functions/stripWrappingFence.html +0 -52
- package/docs/hierarchy.html +0 -46
- package/docs/index.html +0 -595
- package/docs/interfaces/AgentCreationOptions.html +0 -125
- package/docs/interfaces/AgentInfo.html +0 -218
- package/docs/interfaces/AgentMessagesResponse.html +0 -74
- package/docs/interfaces/AppService.html +0 -3337
- package/docs/interfaces/Artifact.html +0 -95
- package/docs/interfaces/ArtifactMetadata.html +0 -112
- package/docs/interfaces/ArtifactWriteOptions.html +0 -90
- package/docs/interfaces/AttachDocumentResponse.html +0 -62
- package/docs/interfaces/BriyahConfigOptions.html +0 -124
- package/docs/interfaces/ChapterInfo.html +0 -62
- package/docs/interfaces/Character.html +0 -86
- package/docs/interfaces/ConversionAgent.html +0 -78
- package/docs/interfaces/CreateAgentResponse.html +0 -56
- package/docs/interfaces/CreateRoomResponse.html +0 -62
- package/docs/interfaces/CreateStoryResponse.html +0 -56
- package/docs/interfaces/FileList.html +0 -56
- package/docs/interfaces/FileMetadata.html +0 -89
- package/docs/interfaces/IConfigService.html +0 -79
- package/docs/interfaces/InstantiateModels.html +0 -64
- package/docs/interfaces/InstantiateRoomResult.html +0 -70
- package/docs/interfaces/LoadedPack.html +0 -131
- package/docs/interfaces/LoggingOptions.html +0 -92
- package/docs/interfaces/Message.html +0 -84
- package/docs/interfaces/ModelChoice.html +0 -73
- package/docs/interfaces/ModelInfo.html +0 -74
- package/docs/interfaces/NativeToolDefinition.html +0 -107
- package/docs/interfaces/PackAgentTemplate.html +0 -101
- package/docs/interfaces/PackRoomTemplate.html +0 -108
- package/docs/interfaces/PackView.html +0 -172
- package/docs/interfaces/PdfConversionOptions.html +0 -102
- package/docs/interfaces/PdfConversionResult.html +0 -97
- package/docs/interfaces/PdfMarkdownOptions.html +0 -198
- package/docs/interfaces/PdfMarkdownResult.html +0 -106
- package/docs/interfaces/PdfPageMarkdown.html +0 -94
- package/docs/interfaces/PreparedPromptResponse.html +0 -62
- package/docs/interfaces/ProcessTextResponse.html +0 -86
- package/docs/interfaces/PromptFile.html +0 -70
- package/docs/interfaces/PromptFileContent.html +0 -76
- package/docs/interfaces/PromptFilesResponse.html +0 -56
- package/docs/interfaces/PromptFolder.html +0 -80
- package/docs/interfaces/PromptFolderDefaults.html +0 -155
- package/docs/interfaces/PromptFolderDefaultsResponse.html +0 -79
- package/docs/interfaces/PromptFoldersResponse.html +0 -56
- package/docs/interfaces/RoomDetails.html +0 -151
- package/docs/interfaces/RoomErrorUpdate.html +0 -82
- package/docs/interfaces/RoomInfo.html +0 -88
- package/docs/interfaces/RoomMessageUpdate.html +0 -113
- package/docs/interfaces/RoomMessagesResponse.html +0 -62
- package/docs/interfaces/SendMessageResult.html +0 -62
- package/docs/interfaces/StoryErrorEvent.html +0 -84
- package/docs/interfaces/StoryIdea.html +0 -74
- package/docs/interfaces/StoryInfo.html +0 -198
- package/docs/interfaces/StoryIntroduceCharacterEvent.html +0 -79
- package/docs/interfaces/StoryProgressChapterEvent.html +0 -72
- package/docs/interfaces/StoryState.html +0 -108
- package/docs/interfaces/StoryStateEvent.html +0 -76
- package/docs/interfaces/ToolArtifact.html +0 -85
- package/docs/interfaces/ToolCaller.html +0 -77
- package/docs/interfaces/ToolDefinition.html +0 -80
- package/docs/interfaces/ToolHelpers.html +0 -105
- package/docs/interfaces/ToolPackDocuments.html +0 -100
- package/docs/interfaces/ToolParameter.html +0 -74
- package/docs/interfaces/ToolRoomAccess.html +0 -227
- package/docs/interfaces/ToolSummary.html +0 -74
- package/docs/interfaces/ToolsResponse.html +0 -68
- package/docs/interfaces/Transaction.html +0 -104
- package/docs/interfaces/TransactionHistoryResponse.html +0 -62
- package/docs/modules.html +0 -53
- package/docs/types/PackOrigin.html +0 -34
- package/docs/types/PromptScope.html +0 -34
- package/docs/types/RoomTurnMode.html +0 -42
- package/docs/types/RoomUpdate.html +0 -36
- package/docs/types/RosterOverrides.html +0 -42
- package/docs/types/ToolContext.html +0 -40
- package/docs/types/ToolRunResult.html +0 -34
- package/src/tools/packs/dnd5e/README.md +0 -867
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/** The sheet tools: create a character, read a sheet, and patch it directly. */
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
4
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -80,8 +81,12 @@ exports.createSheetTool = {
|
|
|
80
81
|
const spec = (0, coerce_1.jsonObject)(args.spec, 'spec', SPEC_EXAMPLE);
|
|
81
82
|
const owner = args.owner ? (0, coerce_1.str)(args.owner, 'owner') : undefined;
|
|
82
83
|
const state = (0, character_1.buildCharacter)(name, spec, owner);
|
|
84
|
+
// Read immediately: they describe the build that just happened.
|
|
83
85
|
const raceResult = (0, character_1.lastRaceResult)();
|
|
84
86
|
const classToolResult = (0, character_1.lastClassToolResult)();
|
|
87
|
+
// The spec lists equipment as plain names, so armour and shields are worn
|
|
88
|
+
// automatically — otherwise every new character would start at 10 + Dex
|
|
89
|
+
// and need a second call to fix their armour class.
|
|
85
90
|
for (const item of state.inv) {
|
|
86
91
|
if (isWorn(item.n))
|
|
87
92
|
item.eq = true;
|
|
@@ -91,17 +96,40 @@ exports.createSheetTool = {
|
|
|
91
96
|
const notes = spec.backstory ? `## Backstory\n${spec.backstory}` : '';
|
|
92
97
|
const artifactName = (0, shared_1.writeNewSheet)(room, state, notes, (0, coerce_1.bool)(args.replace));
|
|
93
98
|
(0, shared_1.refreshPartyStatus)(room);
|
|
99
|
+
// Give the owning agent a public identity, so the rest of the table knows
|
|
100
|
+
// who they are rather than reading whatever placeholder they were created
|
|
101
|
+
// with. Done here rather than left to a separate call because the sheet
|
|
102
|
+
// already knows the answer, and because this is the one moment in the game
|
|
103
|
+
// when invalidating everyone's cached prompt is cheap: play has not started.
|
|
104
|
+
// Deliberately carries no level or state — those change, and this must not.
|
|
94
105
|
const identity = publicIdentity(state);
|
|
95
106
|
const described = state.owner ? room.setDescription(state.owner, identity) : false;
|
|
107
|
+
// The room routes by nickname, so the player becomes their character. This is
|
|
108
|
+
// what replaced the old rule that a character had to be called whatever its
|
|
109
|
+
// player was called — a workaround for the room having two names for one
|
|
110
|
+
// person, which cost one campaign about a quarter of its calls. Reported
|
|
111
|
+
// rather than fatal: a refused rename loses a routing convenience, while
|
|
112
|
+
// failing here would throw away a finished character.
|
|
113
|
+
const renamed = state.owner ? room.renameAgent(state.owner, state.name) : undefined;
|
|
96
114
|
const guides = shareGuidesForCharacter(room, helpers.packDocuments, state);
|
|
97
115
|
return {
|
|
98
116
|
created: artifactName,
|
|
99
117
|
headline: (0, shared_1.sheetHeadline)(state),
|
|
100
|
-
owner: state.owner,
|
|
118
|
+
owner: renamed?.renamed ? renamed.to : state.owner,
|
|
101
119
|
publicIdentity: described ? identity : undefined,
|
|
120
|
+
renamedTo: renamed?.renamed ? renamed.to : undefined,
|
|
121
|
+
renameNote: renamed?.renamed
|
|
122
|
+
? `The table now knows this player as "${renamed.to}". Address them by that name from here on.`
|
|
123
|
+
: renamed?.reason === 'ambiguous'
|
|
124
|
+
? `Their agent could NOT be renamed: "${renamed.to}" would be confused with "${renamed.conflictsWith}". ` +
|
|
125
|
+
`Keep addressing them as "${state.owner}", or ask the player for a character name that does not clash.`
|
|
126
|
+
: undefined,
|
|
102
127
|
classGuides: guides.classes.length > 0 ? guides.classes : undefined,
|
|
103
128
|
classesWithoutRules: guides.missingClasses.length > 0 ? guides.missingClasses : undefined,
|
|
104
129
|
spellsOffList: (() => {
|
|
130
|
+
// Reported, never refused: a subclass, a racial trait or an item can
|
|
131
|
+
// all grant a spell off-list, so blocking would be wrong more often
|
|
132
|
+
// than right. Naming it lets a genuine mistake be noticed.
|
|
105
133
|
const off = (0, spells_1.offListSpells)(state, state.spells || []);
|
|
106
134
|
return off.length > 0
|
|
107
135
|
? off.map((entry) => entry.onLists
|
|
@@ -109,6 +137,11 @@ exports.createSheetTool = {
|
|
|
109
137
|
: `${entry.spell} is not an SRD spell`)
|
|
110
138
|
: undefined;
|
|
111
139
|
})(),
|
|
140
|
+
// The name is recorded and nothing else is applied, because a background is
|
|
141
|
+
// a document rather than a table: its skills, languages, gear and coin are
|
|
142
|
+
// read off `rules_lookup` and passed in this same spec. Said on every build
|
|
143
|
+
// rather than only when something looks wrong, since a background whose
|
|
144
|
+
// skills were never passed is invisible on the finished sheet.
|
|
112
145
|
background: state.bg
|
|
113
146
|
? {
|
|
114
147
|
recorded: state.bg,
|
|
@@ -130,6 +163,8 @@ exports.createSheetTool = {
|
|
|
130
163
|
}
|
|
131
164
|
: undefined,
|
|
132
165
|
raceProblems: raceResult.problems.length > 0 ? raceResult.problems : undefined,
|
|
166
|
+
// Every source's tools in one place, because a player choosing them needs
|
|
167
|
+
// the whole picture and the three grants report separately above.
|
|
133
168
|
tools: state.toolProf.length > 0 || classToolResult.outstanding.length > 0
|
|
134
169
|
? {
|
|
135
170
|
proficient: state.toolProf.length > 0 ? state.toolProf : undefined,
|
|
@@ -139,6 +174,10 @@ exports.createSheetTool = {
|
|
|
139
174
|
: undefined,
|
|
140
175
|
}
|
|
141
176
|
: undefined,
|
|
177
|
+
// Reported as a list rather than a count, because nothing here knows how
|
|
178
|
+
// many a character is owed: the race's extras are data, a background's are
|
|
179
|
+
// prose in a document. Showing what landed is what lets a creator check it
|
|
180
|
+
// against the two sources itself.
|
|
142
181
|
languages: state.languages?.length ? state.languages : undefined,
|
|
143
182
|
derived: {
|
|
144
183
|
hitPoints: `${state.hp.cur}/${state.hp.max}`,
|
|
@@ -158,10 +197,34 @@ exports.createSheetTool = {
|
|
|
158
197
|
};
|
|
159
198
|
},
|
|
160
199
|
};
|
|
200
|
+
/**
|
|
201
|
+
* Gives the character's own player the documents for the class and background they
|
|
202
|
+
* just took.
|
|
203
|
+
*
|
|
204
|
+
* Done here rather than left to the creator's next tool call because this is the
|
|
205
|
+
* moment a choice becomes a fact, and because a player who never receives it has no
|
|
206
|
+
* other route to their own features — they hold no tools, and their sheet carries
|
|
207
|
+
* feature *names* rather than what those features do. `class_guide` and
|
|
208
|
+
* `rules_lookup` remain the way the *creator* reads one while a player is still
|
|
209
|
+
* choosing; this is the half that cannot be forgotten.
|
|
210
|
+
*
|
|
211
|
+
* Best effort by construction. A missing document or a deployment with no document
|
|
212
|
+
* access must not fail a sheet that is otherwise built. A **class** with no document
|
|
213
|
+
* is reported, because a class the table has no rules for is a real problem; a
|
|
214
|
+
* **background** with none is not reported here, because a background outside the
|
|
215
|
+
* SRD is ordinary legal play — `create_sheet`'s own `background.stillToChoose`
|
|
216
|
+
* already says its skills and gear are the creator's to supply.
|
|
217
|
+
*
|
|
218
|
+
* @param room The room access
|
|
219
|
+
* @param documents Pack document access, absent from the tool-test panel
|
|
220
|
+
* @param state The character that was just built
|
|
221
|
+
* @returns What was shared, and which classes have no rules here
|
|
222
|
+
*/
|
|
161
223
|
function shareGuidesForCharacter(room, documents, state) {
|
|
162
224
|
const result = { classes: [], missingClasses: [] };
|
|
163
225
|
if (!documents)
|
|
164
226
|
return result;
|
|
227
|
+
// No owner means nobody to give it to; the creator reads them through its lookups.
|
|
165
228
|
const players = state.owner ? [state.owner] : [];
|
|
166
229
|
const share = (kind, wanted) => {
|
|
167
230
|
const guides = (0, guides_1.listGuides)(kind, documents.list(guides_1.DND5E_PACK, kind.prefix));
|
|
@@ -185,6 +248,16 @@ function shareGuidesForCharacter(room, documents, state) {
|
|
|
185
248
|
}
|
|
186
249
|
return result;
|
|
187
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* The one-line identity the rest of the table sees, e.g.
|
|
253
|
+
* `Thorin Ironfoot — Mountain Dwarf Fighter`.
|
|
254
|
+
*
|
|
255
|
+
* Carries only what will not change for the life of the character. Level, hit
|
|
256
|
+
* points and conditions belong in the party summary, which is re-rendered from
|
|
257
|
+
* the sheets and costs nothing to update.
|
|
258
|
+
* @param state The finished character
|
|
259
|
+
* @returns The public identity line
|
|
260
|
+
*/
|
|
188
261
|
function publicIdentity(state) {
|
|
189
262
|
const classes = state.class
|
|
190
263
|
.map((entry) => {
|
|
@@ -195,6 +268,7 @@ function publicIdentity(state) {
|
|
|
195
268
|
const descriptors = [state.race, classes].filter(Boolean).join(' ');
|
|
196
269
|
return descriptors ? `${state.name} — ${descriptors}` : state.name;
|
|
197
270
|
}
|
|
271
|
+
/** Whether an item is armour or a shield, and so affects armour class when worn. */
|
|
198
272
|
function isWorn(itemName) {
|
|
199
273
|
const key = itemName.toLowerCase();
|
|
200
274
|
return /\bshield\b/.test(key) || srd_1.ARMOR[key] !== undefined;
|
|
@@ -248,6 +322,8 @@ exports.readSheetTool = {
|
|
|
248
322
|
if (wants('feats') && (0, feats_1.takenFeats)(state).length > 0) {
|
|
249
323
|
result.feats = (0, feats_1.takenFeats)(state).map((name) => {
|
|
250
324
|
const { feat } = (0, feats_1.resolveFeat)(name);
|
|
325
|
+
// Full text for a feat the SRD carries; the name alone for one from
|
|
326
|
+
// outside it, since there is nothing to quote.
|
|
251
327
|
return feat ? (0, feats_1.describeFeat)(feat) : `${name} (not an SRD feat)`;
|
|
252
328
|
});
|
|
253
329
|
}
|
|
@@ -259,6 +335,8 @@ exports.readSheetTool = {
|
|
|
259
335
|
pushDragLift: load.capacity.pushDragLift,
|
|
260
336
|
tier: load.tier,
|
|
261
337
|
variantInUse: load.variant,
|
|
338
|
+
// Named rather than assumed weightless: the SRD prints no weight
|
|
339
|
+
// for vestments or a holy symbol, so the total is a floor.
|
|
262
340
|
unweighed: load.carried.unweighed.length > 0 ? load.carried.unweighed : undefined,
|
|
263
341
|
thresholds: load.variant
|
|
264
342
|
? {
|
|
@@ -271,6 +349,9 @@ exports.readSheetTool = {
|
|
|
271
349
|
if (wants('background') && state.bg) {
|
|
272
350
|
result.background = {
|
|
273
351
|
name: state.bg,
|
|
352
|
+
// The name is all the sheet holds. A background is a document rather
|
|
353
|
+
// than a table, so what it grants was applied by whoever read it, and
|
|
354
|
+
// its prose is in the `Background: <name>` document.
|
|
274
355
|
note: `Read what it grants with rules_lookup topic "${state.bg}". Anything recorded for this character is in the notes.`,
|
|
275
356
|
};
|
|
276
357
|
}
|
|
@@ -282,6 +363,8 @@ exports.readSheetTool = {
|
|
|
282
363
|
speed: `${rules.effectiveSpeed(state).speed} ft`,
|
|
283
364
|
darkvision: state.darkvision ? `${state.darkvision} ft` : undefined,
|
|
284
365
|
languages: state.languages,
|
|
366
|
+
// Full text here, unlike the sheet render, because this is asked
|
|
367
|
+
// for explicitly rather than carried in a prompt every turn.
|
|
285
368
|
traits: traits.map((trait) => `${trait.n}. ${trait.text}`),
|
|
286
369
|
};
|
|
287
370
|
}
|
|
@@ -307,6 +390,8 @@ exports.readSheetTool = {
|
|
|
307
390
|
.skillNames()
|
|
308
391
|
.map((skill) => [(0, sheet_1.titleCase)(skill), (0, sheet_1.signed)(rules.skillModifier(state, skill))]));
|
|
309
392
|
result.passivePerception = rules.passivePerception(state);
|
|
393
|
+
// Under skills because that is what they are: the other thing a character
|
|
394
|
+
// is proficient at, and the DM asking what someone is good at wants both.
|
|
310
395
|
if (state.toolProf.length > 0)
|
|
311
396
|
result.toolProficiencies = state.toolProf;
|
|
312
397
|
}
|
|
@@ -335,6 +420,7 @@ exports.readSheetTool = {
|
|
|
335
420
|
result.conditions = state.cond.map((c) => ({
|
|
336
421
|
name: c.n,
|
|
337
422
|
duration: c.dur,
|
|
423
|
+
// The DM should not have to look these up to adjudicate.
|
|
338
424
|
effect: srd_1.CONDITIONS[c.n] || 'Not a standard condition; adjudicate as described.',
|
|
339
425
|
}));
|
|
340
426
|
result.exhaustion = {
|
|
@@ -399,6 +485,8 @@ exports.patchSheetTool = {
|
|
|
399
485
|
const sheet = (0, shared_1.loadSheet)(room, character);
|
|
400
486
|
const candidate = (0, character_1.cloneState)(sheet.state);
|
|
401
487
|
const applied = [];
|
|
488
|
+
// Every path is checked before anything is written, so a call that names one
|
|
489
|
+
// bad field changes nothing rather than half-applying.
|
|
402
490
|
const rejected = [...Object.keys(set), ...Object.keys(append)]
|
|
403
491
|
.map((path) => ({ path, problem: pathProblem(candidate, path) }))
|
|
404
492
|
.filter((entry) => entry.problem);
|
|
@@ -423,6 +511,9 @@ exports.patchSheetTool = {
|
|
|
423
511
|
for (const [path, value] of Object.entries(append)) {
|
|
424
512
|
const target = getPath(candidate, path);
|
|
425
513
|
if (!Array.isArray(target)) {
|
|
514
|
+
// A refusal rather than a throw: the caller asked for something the
|
|
515
|
+
// rules of the sheet do not allow, and the useful reply names what
|
|
516
|
+
// it could have done instead.
|
|
426
517
|
return {
|
|
427
518
|
applied: false,
|
|
428
519
|
violation: 'not_a_list',
|
|
@@ -474,9 +565,28 @@ exports.patchSheetTool = {
|
|
|
474
565
|
};
|
|
475
566
|
},
|
|
476
567
|
};
|
|
568
|
+
/** Reads a dotted path out of state. */
|
|
477
569
|
function getPath(state, path) {
|
|
478
570
|
return path.split('.').reduce((node, key) => (node === undefined ? undefined : node[key]), state);
|
|
479
571
|
}
|
|
572
|
+
/**
|
|
573
|
+
* Why a dotted path cannot be written, or '' when it can.
|
|
574
|
+
*
|
|
575
|
+
* Two ways a path can be unwritable, both of which would otherwise pass silently:
|
|
576
|
+
*
|
|
577
|
+
* - **An unknown root.** `SheetState` ends in an index signature so a future field
|
|
578
|
+
* survives an old sheet — which also means a typo like `abilities.wis` would be
|
|
579
|
+
* accepted as a brand new top-level key that nothing reads, and reported as
|
|
580
|
+
* `applied: true`.
|
|
581
|
+
* - **A non-object in the middle.** `race` is a string, so `race.traits` would hang
|
|
582
|
+
* a property off it. Left to {@link setPath} the string is replaced by an object,
|
|
583
|
+
* and the next `resolveRace` calls `.toLowerCase()` on it — a `TypeError` several
|
|
584
|
+
* frames away that says nothing about sheets.
|
|
585
|
+
*
|
|
586
|
+
* @param state The sheet being patched
|
|
587
|
+
* @param path The dotted path the caller asked for
|
|
588
|
+
* @returns A sentence naming the problem, or '' when the path is writable
|
|
589
|
+
*/
|
|
480
590
|
function pathProblem(state, path) {
|
|
481
591
|
const keys = String(path).split('.');
|
|
482
592
|
const root = keys[0];
|
|
@@ -489,6 +599,8 @@ function pathProblem(state, path) {
|
|
|
489
599
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
490
600
|
const value = node[keys[i]];
|
|
491
601
|
if (value === undefined || value === null) {
|
|
602
|
+
// A new nested key under a real field is fine — `uses.rage` is how a
|
|
603
|
+
// feature pool is added.
|
|
492
604
|
return '';
|
|
493
605
|
}
|
|
494
606
|
if (typeof value !== 'object' || Array.isArray(value)) {
|
|
@@ -499,6 +611,13 @@ function pathProblem(state, path) {
|
|
|
499
611
|
}
|
|
500
612
|
return '';
|
|
501
613
|
}
|
|
614
|
+
/**
|
|
615
|
+
* Writes a dotted path into state, creating intermediate objects.
|
|
616
|
+
*
|
|
617
|
+
* Only ever called on a path {@link pathProblem} has cleared. The guard below is a
|
|
618
|
+
* backstop for a caller that forgets — silently replacing a non-object with `{}`
|
|
619
|
+
* corrupts the field it was meant to write inside.
|
|
620
|
+
*/
|
|
502
621
|
function setPath(state, path, value) {
|
|
503
622
|
const keys = path.split('.');
|
|
504
623
|
let node = state;
|
|
@@ -513,6 +632,11 @@ function setPath(state, path, value) {
|
|
|
513
632
|
}
|
|
514
633
|
node[keys[keys.length - 1]] = value;
|
|
515
634
|
}
|
|
635
|
+
/**
|
|
636
|
+
* Checks the invariants a sheet must satisfy after a direct edit.
|
|
637
|
+
* @param state The candidate state
|
|
638
|
+
* @returns A description of the first problem, or null when consistent
|
|
639
|
+
*/
|
|
516
640
|
function validate(state) {
|
|
517
641
|
if (!Number.isFinite(state.hp.max) || state.hp.max < 1) {
|
|
518
642
|
return `Hit point maximum must be at least 1, but would be ${state.hp.max}.`;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `spell` tool: what a spell does, and what a class can take.
|
|
3
|
+
*
|
|
4
|
+
* The last of the three lookups — creatures, items, spells — and the same
|
|
5
|
+
* reasoning as the other two: the Dungeon Master must never invent what a spell
|
|
6
|
+
* does, and "the wizard casts fireball, what happens?" should cost one cheap call
|
|
7
|
+
* rather than a guess or a handoff.
|
|
8
|
+
*
|
|
9
|
+
* Unlike `stat_block` and `magic_item` there is no `define`. Nothing in the pack
|
|
10
|
+
* computes from a spell, so a homebrew one needs prose in the `Campaign` document
|
|
11
|
+
* and a name on the sheet — both of which already work — rather than a fourth
|
|
12
|
+
* campaign artifact holding fields no tool reads.
|
|
13
|
+
*/
|
|
1
14
|
import { NativeToolDefinition } from '../../../native-tool.types';
|
|
2
15
|
export declare const spellTool: NativeToolDefinition;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The `spell` tool: what a spell does, and what a class can take.
|
|
4
|
+
*
|
|
5
|
+
* The last of the three lookups — creatures, items, spells — and the same
|
|
6
|
+
* reasoning as the other two: the Dungeon Master must never invent what a spell
|
|
7
|
+
* does, and "the wizard casts fireball, what happens?" should cost one cheap call
|
|
8
|
+
* rather than a guess or a handoff.
|
|
9
|
+
*
|
|
10
|
+
* Unlike `stat_block` and `magic_item` there is no `define`. Nothing in the pack
|
|
11
|
+
* computes from a spell, so a homebrew one needs prose in the `Campaign` document
|
|
12
|
+
* and a name on the sheet — both of which already work — rather than a fourth
|
|
13
|
+
* campaign artifact holding fields no tool reads.
|
|
14
|
+
*/
|
|
2
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
16
|
exports.spellTool = void 0;
|
|
4
17
|
const coerce_1 = require("../engine/coerce");
|
|
@@ -69,10 +82,14 @@ exports.spellTool = {
|
|
|
69
82
|
spell: resolved.spell.name,
|
|
70
83
|
details: compact(resolved.spell),
|
|
71
84
|
entry: (0, spells_1.describeSpell)(resolved.spell),
|
|
85
|
+
// `entry` is SRD prose, so the attribution travels with it the way
|
|
86
|
+
// `rules_lookup` does. Every spell here is SRD — there is no campaign
|
|
87
|
+
// spell table — so this is unconditional.
|
|
72
88
|
attribution: srd_1.SRD_ATTRIBUTION,
|
|
73
89
|
};
|
|
74
90
|
},
|
|
75
91
|
};
|
|
92
|
+
/** Lists spells for a class and level. */
|
|
76
93
|
function list(args) {
|
|
77
94
|
const forClass = args.for_class ? (0, coerce_1.str)(args.for_class, 'for_class').toLowerCase() : undefined;
|
|
78
95
|
if (forClass && !srd_1.CLASSES[forClass]) {
|
|
@@ -100,6 +117,7 @@ function list(args) {
|
|
|
100
117
|
: 'Pass "for_class" to see only what one class can cast.',
|
|
101
118
|
};
|
|
102
119
|
}
|
|
120
|
+
/** The machine-readable half: what a caller filters or checks by. */
|
|
103
121
|
function compact(spell) {
|
|
104
122
|
return {
|
|
105
123
|
level: spell.level === 0 ? 'cantrip' : spell.level,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/** The tools that change a character's live state: hit points, rests, resources. */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.spendTool = exports.restTool = exports.applyHpTool = void 0;
|
|
4
5
|
const coerce_1 = require("../engine/coerce");
|
|
@@ -166,6 +167,7 @@ exports.restTool = {
|
|
|
166
167
|
};
|
|
167
168
|
},
|
|
168
169
|
};
|
|
170
|
+
/** Parses `Thalia:2; Dorn:1` into a name-to-count plan. */
|
|
169
171
|
function parseHitDicePlan(raw) {
|
|
170
172
|
return (0, coerce_1.list)(raw)
|
|
171
173
|
.map((entry) => {
|
|
@@ -225,6 +227,8 @@ exports.spendTool = {
|
|
|
225
227
|
const amount = args.amount !== undefined && args.amount !== '' ? (0, coerce_1.int)(args.amount, 'amount', 1) : 1;
|
|
226
228
|
const level = args.level !== undefined && args.level !== '' ? (0, coerce_1.int)(args.level, 'level') : undefined;
|
|
227
229
|
const target = args.target ? (0, coerce_1.str)(args.target, 'target') : undefined;
|
|
230
|
+
// No target, and the character is already holding a die of this name: this is
|
|
231
|
+
// the spend that *uses* one rather than one that grants it.
|
|
228
232
|
if (!target && holdsBoon(room, character, resource)) {
|
|
229
233
|
const used = (0, shared_1.mutateSheet)(room, character, (sheet) => (0, character_1.spendBoon)(sheet.state, resource));
|
|
230
234
|
if ((0, character_1.isRefusal)(used.result)) {
|
|
@@ -243,6 +247,8 @@ exports.spendTool = {
|
|
|
243
247
|
if ((0, character_1.isRefusal)(result)) {
|
|
244
248
|
return (0, shared_1.toRefusalResult)(result.refusal, reloadState(room, character));
|
|
245
249
|
}
|
|
250
|
+
// The giver's counter is down; now put the die somewhere it can be used. Done
|
|
251
|
+
// after the spend, so a refused spend hands out nothing.
|
|
246
252
|
let granted;
|
|
247
253
|
if (target && amount > 0) {
|
|
248
254
|
const die = args.die ? (0, coerce_1.str)(args.die, 'die') : boonDie(result.state, resource);
|
|
@@ -256,11 +262,13 @@ exports.spendTool = {
|
|
|
256
262
|
character: result.state.name,
|
|
257
263
|
applied: true,
|
|
258
264
|
summary: granted ? `${result.summary} ${granted}` : result.summary,
|
|
265
|
+
// Carries what spending the use does, for gear that says so.
|
|
259
266
|
details: result.details,
|
|
260
267
|
state: (0, shared_1.liveState)(result.state),
|
|
261
268
|
};
|
|
262
269
|
},
|
|
263
270
|
};
|
|
271
|
+
/** Whether a character is already holding a die of this name, waiting to be spent. */
|
|
264
272
|
function holdsBoon(room, character, resource) {
|
|
265
273
|
try {
|
|
266
274
|
const wanted = resource.trim().toLowerCase();
|
|
@@ -270,6 +278,16 @@ function holdsBoon(room, character, resource) {
|
|
|
270
278
|
return false;
|
|
271
279
|
}
|
|
272
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* The die a resource hands over when the caller does not say which.
|
|
283
|
+
*
|
|
284
|
+
* Bardic Inspiration is the one that scales, and it scales with the *bard's* level
|
|
285
|
+
* rather than the recipient's. Everything else in the SRD that works this way —
|
|
286
|
+
* Bless, Guidance, Resistance — is a d4.
|
|
287
|
+
* @param giver The character spending the resource
|
|
288
|
+
* @param resource What was spent
|
|
289
|
+
* @returns A die expression such as 'd6'
|
|
290
|
+
*/
|
|
273
291
|
function boonDie(giver, resource) {
|
|
274
292
|
if (!resource.trim().toLowerCase().includes('inspiration'))
|
|
275
293
|
return 'd4';
|
|
@@ -283,6 +301,7 @@ function boonDie(giver, resource) {
|
|
|
283
301
|
return 'd8';
|
|
284
302
|
return 'd6';
|
|
285
303
|
}
|
|
304
|
+
/** 'bardic inspiration' becomes 'Bardic Inspiration', so the sheet reads properly. */
|
|
286
305
|
function boonName(resource) {
|
|
287
306
|
return resource
|
|
288
307
|
.trim()
|
|
@@ -290,6 +309,10 @@ function boonName(resource) {
|
|
|
290
309
|
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
291
310
|
.join(' ');
|
|
292
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Reads state back so a refusal can report what the character does still have.
|
|
314
|
+
* A failure here must not mask the refusal itself, so it degrades to no state.
|
|
315
|
+
*/
|
|
293
316
|
function reloadState(room, character) {
|
|
294
317
|
try {
|
|
295
318
|
return (0, shared_1.loadSheet)(room, character).state;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/** Conditions, inventory, experience, levelling, and rules lookup. */
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
4
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -90,6 +91,8 @@ exports.conditionsTool = {
|
|
|
90
91
|
}
|
|
91
92
|
const toAdd = (0, coerce_1.list)(args.add).map(parseCondition);
|
|
92
93
|
const toRemove = (0, coerce_1.list)(args.remove).map((entry) => parseCondition(entry).name);
|
|
94
|
+
// Reject an unknown condition before touching any sheet, so a typo cannot
|
|
95
|
+
// leave half the party updated.
|
|
93
96
|
const unknown = [...toAdd.map((c) => c.name), ...toRemove].filter((name) => srd_1.CONDITIONS[name] === undefined);
|
|
94
97
|
if (unknown.length > 0) {
|
|
95
98
|
throw new Error(`Not a 5e condition: ${unknown.join(', ')}. Valid conditions: ${Object.keys(srd_1.CONDITIONS).join(', ')}.`);
|
|
@@ -155,6 +158,7 @@ exports.conditionsTool = {
|
|
|
155
158
|
};
|
|
156
159
|
},
|
|
157
160
|
};
|
|
161
|
+
/** Splits `frightened:2 rounds` into a name and a duration. */
|
|
158
162
|
function parseCondition(entry) {
|
|
159
163
|
const match = /^(.*?)\s*:\s*(.+)$/.exec(entry.trim());
|
|
160
164
|
if (match)
|
|
@@ -205,6 +209,8 @@ exports.inventoryTool = {
|
|
|
205
209
|
const character = (0, coerce_1.str)(args.character, 'character');
|
|
206
210
|
const transferTo = args.transfer_to ? (0, coerce_1.str)(args.transfer_to, 'transfer_to') : '';
|
|
207
211
|
let transferred = [];
|
|
212
|
+
// Read once, outside the mutation: campaign items answer whether an item
|
|
213
|
+
// needs attunement at all, and `room.update` must not be re-entered.
|
|
208
214
|
const campaignItems = (0, campaign_items_1.parseCampaignItems)(room.get(campaign_items_1.ITEMS_ARTIFACT)?.body);
|
|
209
215
|
const { result } = (0, shared_1.mutateSheet)(room, character, (sheet) => {
|
|
210
216
|
const state = (0, character_1.cloneState)(sheet.state);
|
|
@@ -244,12 +250,17 @@ exports.inventoryTool = {
|
|
|
244
250
|
changes.push(`no longer attuned to ${released.changed.join(', ')}`);
|
|
245
251
|
}
|
|
246
252
|
const attuning = (0, character_1.setAttunement)(state, (0, coerce_1.list)(args.attune), true, (itemName) => Boolean((0, items_1.resolveItem)(itemName, campaignItems).item?.attunement));
|
|
253
|
+
// Exceeding the limit is a rule, so it refuses and says what is attuned
|
|
254
|
+
// rather than throwing — the player picks what to give up.
|
|
247
255
|
if (attuning.refusal)
|
|
248
256
|
return { ok: false, refusal: attuning.refusal };
|
|
249
257
|
if (attuning.changed.length > 0) {
|
|
250
258
|
changes.push(`attuned to ${attuning.changed.join(', ')}`);
|
|
251
259
|
}
|
|
252
260
|
if (attuning.unnecessary.length > 0) {
|
|
261
|
+
// Information, not a failure: the item works without attunement, so
|
|
262
|
+
// nothing is wrong. Kept out of `problems` so it cannot become the
|
|
263
|
+
// sole reason the whole call refuses.
|
|
253
264
|
remarks.push(`needs no attunement, so nothing changed: ${attuning.unnecessary.join(', ')}`);
|
|
254
265
|
}
|
|
255
266
|
for (const name of [...released.missing, ...attuning.missing]) {
|
|
@@ -267,6 +278,10 @@ exports.inventoryTool = {
|
|
|
267
278
|
},
|
|
268
279
|
};
|
|
269
280
|
}
|
|
281
|
+
// Gaining or losing a weapon changes what they can attack with, so the
|
|
282
|
+
// attack list follows the gear. Only entries whose name is exactly a
|
|
283
|
+
// table weapon are touched; a magic weapon or a hand-written line is
|
|
284
|
+
// left alone.
|
|
270
285
|
const weaponChanges = (0, weapons_1.syncWeaponAttacks)(state);
|
|
271
286
|
if (weaponChanges.added.length > 0) {
|
|
272
287
|
changes.push(`can now attack with ${weaponChanges.added.join(', ')}`);
|
|
@@ -284,6 +299,8 @@ exports.inventoryTool = {
|
|
|
284
299
|
if ((0, character_1.isRefusal)(result)) {
|
|
285
300
|
return (0, shared_1.toRefusalResult)(result.refusal);
|
|
286
301
|
}
|
|
302
|
+
// A transfer is two writes rather than one, so the recipient's sheet is
|
|
303
|
+
// only touched once the giver's has actually changed.
|
|
287
304
|
let receivedBy;
|
|
288
305
|
if (transferTo && transferred.length > 0) {
|
|
289
306
|
const known = (0, shared_1.listCharacterNames)(room);
|
|
@@ -417,6 +434,8 @@ exports.awardCoinTool = {
|
|
|
417
434
|
const entries = (0, coerce_1.list)(args.amount);
|
|
418
435
|
if (entries.length === 0)
|
|
419
436
|
throw new Error('No amount given, e.g. "150 gp".');
|
|
437
|
+
// Splitting is the default: a purse found in a chest is one pile, unlike
|
|
438
|
+
// experience, which the rules give to each character.
|
|
420
439
|
const split = args.split === undefined || args.split === '' ? true : (0, coerce_1.bool)(args.split);
|
|
421
440
|
const division = split
|
|
422
441
|
? (0, character_1.divideCoin)(entries, names.length)
|
|
@@ -424,6 +443,8 @@ exports.awardCoinTool = {
|
|
|
424
443
|
if ('refusal' in division && division.refusal) {
|
|
425
444
|
return (0, shared_1.toRefusalResult)(division.refusal);
|
|
426
445
|
}
|
|
446
|
+
// Every share is tested against a copy before any sheet is written. A split
|
|
447
|
+
// cost that half the party can afford must not leave half of them charged.
|
|
427
448
|
for (let i = 0; i < names.length; i++) {
|
|
428
449
|
const sheet = (0, shared_1.loadSheet)(room, names[i]);
|
|
429
450
|
const trial = (0, character_1.adjustCoin)((0, character_1.cloneState)(sheet.state), division.shares[i].entries);
|
|
@@ -531,6 +552,9 @@ exports.rulesLookupTool = {
|
|
|
531
552
|
if (table) {
|
|
532
553
|
return { topic, kind: 'table', ...table, attribution: srd_1.SRD_ATTRIBUTION };
|
|
533
554
|
}
|
|
555
|
+
// Equipment is looked up here rather than through a tool of its own: it is
|
|
556
|
+
// a table like any other, and the pack already has as many tools as a turn
|
|
557
|
+
// can chain.
|
|
534
558
|
const weapon = (0, weapons_1.resolveWeapon)(topic);
|
|
535
559
|
if (weapon.weapon) {
|
|
536
560
|
return {
|
|
@@ -558,6 +582,11 @@ exports.rulesLookupTool = {
|
|
|
558
582
|
attribution: srd_1.SRD_ATTRIBUTION,
|
|
559
583
|
};
|
|
560
584
|
}
|
|
585
|
+
// Backgrounds come from the pack's `background-*.md` documents first and the
|
|
586
|
+
// SRD table second, so a table adds one by dropping in a file. Unlike a class,
|
|
587
|
+
// a background outside the list is still legal play — the SRD's own
|
|
588
|
+
// customization rule says so — which is why the listing is a menu rather than
|
|
589
|
+
// an authority, and why nothing here refuses a name it does not know.
|
|
561
590
|
const documented = (0, guides_1.listGuides)(guides_1.BACKGROUND_GUIDE, helpers.packDocuments?.list(guides_1.DND5E_PACK, guides_1.BACKGROUND_GUIDE.prefix) || []);
|
|
562
591
|
if (topic === 'background' || topic === 'backgrounds') {
|
|
563
592
|
return {
|
|
@@ -594,6 +623,10 @@ exports.rulesLookupTool = {
|
|
|
594
623
|
message: `"${topic}" matches ${background.ambiguous.length} backgrounds. Ask again with the full name.`,
|
|
595
624
|
};
|
|
596
625
|
}
|
|
626
|
+
// Before the feats and the races, because "tools" must reach the rule rather
|
|
627
|
+
// than fall through the loose matchers to something that merely starts with a
|
|
628
|
+
// 't'. The categories are listed with it, since the next question is always
|
|
629
|
+
// which tools there are.
|
|
597
630
|
if (/^(tool|tools|tool proficienc|artisans? tools|gaming set|musical instrument)/.test(topic)) {
|
|
598
631
|
return {
|
|
599
632
|
topic,
|
|
@@ -657,6 +690,7 @@ exports.rulesLookupTool = {
|
|
|
657
690
|
attribution: srd_1.SRD_ATTRIBUTION,
|
|
658
691
|
};
|
|
659
692
|
}
|
|
693
|
+
// Suggest rather than just failing: the model's next call should succeed.
|
|
660
694
|
const suggestions = [
|
|
661
695
|
...Object.keys(srd_1.CONDITIONS),
|
|
662
696
|
...Object.keys(srd_1.RULES_TOPICS),
|
|
@@ -685,6 +719,7 @@ exports.rulesLookupTool = {
|
|
|
685
719
|
};
|
|
686
720
|
},
|
|
687
721
|
};
|
|
722
|
+
/** Renders the numeric tables, which do not fit the prose-excerpt shape. */
|
|
688
723
|
function lookupTable(topic) {
|
|
689
724
|
if (topic.includes('proficiency')) {
|
|
690
725
|
return {
|
|
@@ -1,7 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in tool packs: sets of native tools that ship with Briyah.
|
|
3
|
+
*
|
|
4
|
+
* Registration is process-global, matching how native tools work generally. What
|
|
5
|
+
* used to gate it — `BRIYAH_TOOL_PACKS` — no longer does: a pack's tools are
|
|
6
|
+
* registered at boot and *enablement is per user*, held in their config and
|
|
7
|
+
* applied where tools are listed rather than where they are registered. See
|
|
8
|
+
* `packs/pack.service.ts`.
|
|
9
|
+
*
|
|
10
|
+
* Registering everything is safe because registration alone grants nothing. A
|
|
11
|
+
* tool reaches an agent only through `agent.toolNames`, and
|
|
12
|
+
* `AppService.listNativeToolSummaries` will not offer a tool whose pack the user
|
|
13
|
+
* has not switched on.
|
|
14
|
+
*/
|
|
1
15
|
import { NativeToolRegistry } from '../native-tool-registry.service';
|
|
16
|
+
import { NativeToolDefinition } from '../native-tool.types';
|
|
2
17
|
import { dnd5eTools } from './dnd5e';
|
|
3
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Registers the core tools and every built-in pack's tools.
|
|
20
|
+
*
|
|
21
|
+
* Core first, so a pack that shipped a colliding name would overwrite it loudly
|
|
22
|
+
* through `registerTool`'s warning rather than the other way round. `packs.spec.ts`
|
|
23
|
+
* is what actually stops that happening.
|
|
24
|
+
*
|
|
25
|
+
* @param registry The process-wide native tool registry
|
|
26
|
+
* @returns The names of the tools that were registered
|
|
27
|
+
*/
|
|
4
28
|
export declare function installToolPacks(registry: NativeToolRegistry): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Registers the named tool packs into the native registry.
|
|
31
|
+
*
|
|
32
|
+
* Kept alongside {@link installToolPacks} for an SDK host that wants only some of
|
|
33
|
+
* the built-in packs' tools in its process.
|
|
34
|
+
*
|
|
35
|
+
* @param registry The process-wide native tool registry
|
|
36
|
+
* @param packList A comma-separated list of pack names. Empty or undefined
|
|
37
|
+
* registers nothing.
|
|
38
|
+
* @returns The names of the tools that were registered
|
|
39
|
+
*/
|
|
5
40
|
export declare function registerToolPacks(registry: NativeToolRegistry, packList: string | undefined): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Registers one pack's tools under a name.
|
|
43
|
+
*
|
|
44
|
+
* For a pack that is not in {@link PACKS}: one this repository runs but does not
|
|
45
|
+
* publish, or one an SDK host wrote itself. `main.ts` registers `acts` this way,
|
|
46
|
+
* and `main.ts` is excluded from the SDK build, so the published package has no
|
|
47
|
+
* path to it at all.
|
|
48
|
+
*
|
|
49
|
+
* @param registry The process-wide native tool registry
|
|
50
|
+
* @param name The pack name, stamped on every tool as its group
|
|
51
|
+
* @param tools The pack's tool definitions
|
|
52
|
+
* @returns The names of the tools that were registered
|
|
53
|
+
*/
|
|
54
|
+
export declare function registerPack(registry: NativeToolRegistry, name: string, tools: NativeToolDefinition[]): string[];
|
|
55
|
+
/** The names of the packs that ship with the package. */
|
|
6
56
|
export declare function availableToolPacks(): string[];
|
|
7
|
-
export { dnd5eTools
|
|
57
|
+
export { dnd5eTools };
|