briyah 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -8
- 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/config/story_models.json +3 -3
- package/data/common/prompts/illustrator/describe_scene.prompt +4 -4
- package/data/common/prompts/narrator/create_story.prompt +2 -0
- package/data/common/prompts/perceive.prompt +1 -1
- package/data/packs/dnd5e/prompts/battle_master/perceive.prompt +1 -1
- package/data/packs/dnd5e/prompts/campaign_designer/perceive.prompt +1 -1
- package/data/packs/dnd5e/prompts/character_creator/perceive.prompt +795 -787
- package/data/packs/dnd5e/prompts/dungeon_master/defaults_config.json +2 -1
- package/data/packs/dnd5e/prompts/dungeon_master/perceive.prompt +1 -1
- package/data/packs/dnd5e/rooms/campaign.json +18 -15
- package/data/packs/dnd5e/rooms/table.json +17 -16
- package/dist-sdk/server/src/ai/LLM/anthropic.service.d.ts +103 -0
- package/dist-sdk/server/src/ai/LLM/anthropic.service.js +174 -3
- package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +194 -3
- package/dist-sdk/server/src/ai/LLM/base-ai.service.js +299 -19
- package/dist-sdk/server/src/ai/LLM/blank-image.d.ts +36 -0
- package/dist-sdk/server/src/ai/LLM/blank-image.js +80 -0
- 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 +103 -4
- package/dist-sdk/server/src/ai/LLM/fal.service.d.ts +25 -0
- package/dist-sdk/server/src/ai/LLM/fal.service.js +56 -2
- package/dist-sdk/server/src/ai/LLM/googleai.service.d.ts +19 -0
- package/dist-sdk/server/src/ai/LLM/googleai.service.js +43 -2
- package/dist-sdk/server/src/ai/LLM/grok.service.d.ts +22 -0
- package/dist-sdk/server/src/ai/LLM/grok.service.js +55 -3
- 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 +81 -3
- 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 +45 -3
- package/dist-sdk/server/src/ai/LLM/together.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/LLM/together.service.js +61 -3
- package/dist-sdk/server/src/ai/agent-config.d.ts +15 -1
- 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 -7
- package/dist-sdk/server/src/ai/agent.d.ts +197 -2
- package/dist-sdk/server/src/ai/agent.js +225 -14
- 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 +46 -3
- 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 +120 -0
- package/dist-sdk/server/src/app.controller.js +365 -14
- package/dist-sdk/server/src/app.module.js +28 -6
- package/dist-sdk/server/src/app.service.d.ts +1710 -4
- package/dist-sdk/server/src/app.service.js +1938 -20
- 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 +44 -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 +104 -0
- package/dist-sdk/server/src/packs/pack-manifest.d.ts +114 -0
- package/dist-sdk/server/src/packs/pack-manifest.js +69 -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/illustration/illustration.service.d.ts +211 -0
- package/dist-sdk/server/src/room/illustration/illustration.service.js +771 -0
- package/dist-sdk/server/src/room/illustration/illustration.types.d.ts +101 -0
- package/dist-sdk/server/src/room/illustration/illustration.types.js +2 -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 +26 -0
- package/dist-sdk/server/src/room/nickname.js +26 -0
- package/dist-sdk/server/src/room/published-rooms.service.js +2 -0
- package/dist-sdk/server/src/room/room-config.d.ts +84 -1
- package/dist-sdk/server/src/room/room-config.js +19 -0
- package/dist-sdk/server/src/room/room-factory.d.ts +20 -0
- package/dist-sdk/server/src/room/room-factory.js +25 -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 +184 -0
- package/dist-sdk/server/src/room/room-store.service.js +280 -6
- package/dist-sdk/server/src/room/room.d.ts +981 -1
- package/dist-sdk/server/src/room/room.js +1531 -27
- 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 +37 -0
- package/dist-sdk/server/src/rpg/rpg-roster.js +37 -0
- package/dist-sdk/server/src/rpg/rpg.service.d.ts +87 -0
- package/dist-sdk/server/src/rpg/rpg.service.js +108 -1
- 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.js +23 -0
- 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 +366 -9
- package/dist-sdk/server/src/story/story.service.js +825 -374
- package/dist-sdk/server/src/tools/core/illustrate.tool.d.ts +14 -0
- package/dist-sdk/server/src/tools/core/illustrate.tool.js +80 -0
- package/dist-sdk/server/src/tools/core/index.d.ts +22 -0
- package/dist-sdk/server/src/tools/core/index.js +24 -1
- package/dist-sdk/server/src/tools/core/rename.tool.d.ts +8 -0
- package/dist-sdk/server/src/tools/core/rename.tool.js +11 -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 +266 -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 +201 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +149 -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 +194 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +263 -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 +127 -2
- 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 +49 -0
- package/dist-sdk/server/src/tools/packs/index.js +66 -0
- 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 +107 -3
- package/dist-sdk/server/src/tools/tool-execution.service.js +163 -19
- 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 +328 -13
- package/dist-sdk/shared/types/app.types.js +18 -1
- package/package.json +167 -168
- 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/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 -1434
- package/docs/classes/RoomMessage.html +0 -290
- package/docs/enums/MessageAction.html +0 -136
- 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 -51
- 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 -3340
- 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 -260
- 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,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Carrying capacity, and the optional encumbrance variant.
|
|
4
|
+
*
|
|
5
|
+
* Two regimes, and the difference matters. The **base rule** is always in force and
|
|
6
|
+
* is almost never binding — capacity is Strength × 15, "high enough that most
|
|
7
|
+
* characters don't usually have to worry about it" — so the only thing it changes is
|
|
8
|
+
* a speed of 5 feet while dragging something too heavy.
|
|
9
|
+
*
|
|
10
|
+
* The **variant** is opt-in, and turning it on has a consequence the rules state
|
|
11
|
+
* outright: "when you use this variant, ignore the Strength column of the Armor
|
|
12
|
+
* table." So a character playing with encumbrance stops taking the heavy-armour
|
|
13
|
+
* speed penalty and starts taking a weight penalty instead. Applying both would
|
|
14
|
+
* charge them twice for the same plate mail.
|
|
15
|
+
*
|
|
16
|
+
* Pure, with no room access, like the rest of `engine/`.
|
|
17
|
+
*/
|
|
2
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
19
|
exports.itemWeight = itemWeight;
|
|
4
20
|
exports.carriedWeight = carriedWeight;
|
|
@@ -8,6 +24,7 @@ exports.encumbrance = encumbrance;
|
|
|
8
24
|
exports.describeEncumbrance = describeEncumbrance;
|
|
9
25
|
const gear_1 = require("../data/gear");
|
|
10
26
|
const coerce_1 = require("./coerce");
|
|
27
|
+
/** Size categories, for the multiplier a creature's size applies to capacity. */
|
|
11
28
|
const SIZE_FACTOR = {
|
|
12
29
|
tiny: 0.5,
|
|
13
30
|
small: 1,
|
|
@@ -16,6 +33,18 @@ const SIZE_FACTOR = {
|
|
|
16
33
|
huge: 4,
|
|
17
34
|
gargantuan: 8,
|
|
18
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* What one of an item weighs, in pounds.
|
|
38
|
+
*
|
|
39
|
+
* Three lookups, in order, and each earns its place. An exact name; then the same
|
|
40
|
+
* words with a comma swapped round, because the SRD files things for sorting rather
|
|
41
|
+
* than for reading — `Clothes, common` is what a person writes as "common clothes",
|
|
42
|
+
* exactly as `Crossbow, light` is a light crossbow. Then a bundle: the SRD prices
|
|
43
|
+
* ammunition twenty at a time, so `Arrows (20) — 1 lb.` means one arrow weighs a
|
|
44
|
+
* twentieth of a pound and a sheet saying `arrows x40` should come to two.
|
|
45
|
+
* @param name The item as written on the sheet
|
|
46
|
+
* @returns Pounds for one, or null when the SRD never prints a weight for it
|
|
47
|
+
*/
|
|
19
48
|
function itemWeight(name) {
|
|
20
49
|
const key = (0, coerce_1.nameKey)(name || '');
|
|
21
50
|
if (!key)
|
|
@@ -28,6 +57,7 @@ function itemWeight(name) {
|
|
|
28
57
|
if (gear_1.ITEM_WEIGHTS[swapped] !== undefined)
|
|
29
58
|
return gear_1.ITEM_WEIGHTS[swapped];
|
|
30
59
|
}
|
|
60
|
+
// A bundle: an entry of the same name with a trailing count.
|
|
31
61
|
for (const [candidate, weight] of Object.entries(gear_1.ITEM_WEIGHTS)) {
|
|
32
62
|
const bundle = new RegExp(`^${key} (\\d+)$`).exec(candidate);
|
|
33
63
|
if (bundle)
|
|
@@ -35,6 +65,11 @@ function itemWeight(name) {
|
|
|
35
65
|
}
|
|
36
66
|
return null;
|
|
37
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Adds up what the character is carrying.
|
|
70
|
+
* @param state The character
|
|
71
|
+
* @returns The total, and whatever could not be weighed
|
|
72
|
+
*/
|
|
38
73
|
function carriedWeight(state) {
|
|
39
74
|
let pounds = 0;
|
|
40
75
|
const unweighed = [];
|
|
@@ -46,13 +81,23 @@ function carriedWeight(state) {
|
|
|
46
81
|
}
|
|
47
82
|
pounds += each * Math.max(Number(item.q) || 0, 0);
|
|
48
83
|
}
|
|
84
|
+
// Coin has a weight in 5e — fifty pieces to the pound, whatever the metal.
|
|
49
85
|
const coins = Object.values(state.coin || {}).reduce((sum, amount) => sum + Math.max(Number(amount) || 0, 0), 0);
|
|
50
86
|
pounds += coins / 50;
|
|
51
87
|
return { pounds: Math.round(pounds * 100) / 100, unweighed };
|
|
52
88
|
}
|
|
89
|
+
/** The size multiplier a creature's size applies to what it can carry. */
|
|
53
90
|
function sizeFactor(state) {
|
|
54
91
|
return SIZE_FACTOR[String(state.size || 'medium').toLowerCase()] ?? 1;
|
|
55
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* What this character can carry.
|
|
95
|
+
*
|
|
96
|
+
* Size adjusts every figure: "for each size category above Medium, double the
|
|
97
|
+
* creature's carrying capacity ... for a Tiny creature, halve these weights."
|
|
98
|
+
* @param state The character
|
|
99
|
+
* @returns The capacity and the variant's thresholds
|
|
100
|
+
*/
|
|
56
101
|
function carryingCapacity(state) {
|
|
57
102
|
const strength = Math.max(Number(state.abil.str) || 10, 1);
|
|
58
103
|
const factor = sizeFactor(state);
|
|
@@ -63,9 +108,19 @@ function carryingCapacity(state) {
|
|
|
63
108
|
heavilyEncumberedAt: strength * gear_1.HEAVILY_ENCUMBERED_MULTIPLIER * factor,
|
|
64
109
|
};
|
|
65
110
|
}
|
|
111
|
+
/** True when this character plays with the optional encumbrance variant. */
|
|
66
112
|
function usesVariant(state) {
|
|
67
113
|
return state.encumbrance === true;
|
|
68
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Works out the character's encumbrance.
|
|
117
|
+
*
|
|
118
|
+
* Without the variant only one thing bites: carrying more than capacity, which the
|
|
119
|
+
* base rules cover by dropping speed to 5 feet while you drag it. With the variant,
|
|
120
|
+
* the two thresholds apply instead.
|
|
121
|
+
* @param state The character
|
|
122
|
+
* @returns The tier and what it costs
|
|
123
|
+
*/
|
|
69
124
|
function encumbrance(state) {
|
|
70
125
|
const carried = carriedWeight(state);
|
|
71
126
|
const capacity = carryingCapacity(state);
|
|
@@ -73,6 +128,9 @@ function encumbrance(state) {
|
|
|
73
128
|
if (carried.pounds > capacity.capacity) {
|
|
74
129
|
return {
|
|
75
130
|
tier: 'over capacity',
|
|
131
|
+
// "While pushing or dragging weight in excess of your carrying
|
|
132
|
+
// capacity, your speed drops to 5 feet." Expressed as a penalty large
|
|
133
|
+
// enough to floor any speed at 5, which `effectiveSpeed` clamps.
|
|
76
134
|
speedPenalty: Infinity,
|
|
77
135
|
disadvantage: variant,
|
|
78
136
|
carried,
|
|
@@ -119,6 +177,7 @@ function encumbrance(state) {
|
|
|
119
177
|
variant,
|
|
120
178
|
};
|
|
121
179
|
}
|
|
180
|
+
/** A readable line for the sheet and for `read_sheet`. */
|
|
122
181
|
function describeEncumbrance(state) {
|
|
123
182
|
const { tier, carried, capacity, variant } = encumbrance(state);
|
|
124
183
|
const unweighed = carried.unweighed.length > 0
|
|
@@ -1,22 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolving a feat, checking whether a character may take it, and applying it.
|
|
3
|
+
*
|
|
4
|
+
* A feat a character has taken is recorded on the sheet by name, whether or not the
|
|
5
|
+
* SRD carries it. Only a known feat has its prerequisite checked and its grants
|
|
6
|
+
* applied — an unknown one is still recorded, because a character who took Great
|
|
7
|
+
* Weapon Master should not silently have taken nothing.
|
|
8
|
+
*
|
|
9
|
+
* Pure, with no room access, like the rest of `engine/`.
|
|
10
|
+
*/
|
|
1
11
|
import { FeatRules } from '../data/feats';
|
|
2
12
|
import type { SheetState } from './sheet';
|
|
3
13
|
export interface FeatLookup {
|
|
4
14
|
feat?: FeatRules;
|
|
15
|
+
/** Candidate names when a partial name matched several. */
|
|
5
16
|
ambiguous?: string[];
|
|
6
17
|
}
|
|
18
|
+
/** Resets the feat index. Only needed by tests that mutate the table. */
|
|
7
19
|
export declare function resetFeatIndex(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves a feat name against the SRD table.
|
|
22
|
+
* @param name The feat as written
|
|
23
|
+
* @returns The feat, the candidates, or an empty result for one not in the SRD
|
|
24
|
+
*/
|
|
8
25
|
export declare function resolveFeat(name: string): FeatLookup;
|
|
26
|
+
/** Every SRD feat name. */
|
|
9
27
|
export declare function featNames(): string[];
|
|
28
|
+
/** The feats a character has taken, in the order taken. */
|
|
10
29
|
export declare function takenFeats(state: SheetState): string[];
|
|
30
|
+
/** True when the character already has this feat, however it was spelled. */
|
|
11
31
|
export declare function hasFeat(state: SheetState, name: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Why the character cannot take this feat, if they cannot.
|
|
34
|
+
*
|
|
35
|
+
* Only checks what is expressible as a number. A prose prerequisite is returned as
|
|
36
|
+
* a line for the Dungeon Master to judge rather than being guessed at.
|
|
37
|
+
* @param state The character
|
|
38
|
+
* @param feat The feat
|
|
39
|
+
* @returns Blocking reasons, empty when the prerequisite is met
|
|
40
|
+
*/
|
|
12
41
|
export declare function prerequisiteProblems(state: SheetState, feat: FeatRules): string[];
|
|
42
|
+
/** A prose prerequisite the tools cannot check, for the caller to pass on. */
|
|
13
43
|
export declare function prerequisiteNote(feat: FeatRules): string | undefined;
|
|
14
44
|
export interface FeatApplication {
|
|
45
|
+
/** The name recorded on the sheet. */
|
|
15
46
|
name: string;
|
|
47
|
+
/** True when the SRD table knew it and its grants were applied. */
|
|
16
48
|
known: boolean;
|
|
49
|
+
/** What the feat changed, for the caller to report. */
|
|
17
50
|
changes: string[];
|
|
51
|
+
/** Anything the caller still has to do by hand. */
|
|
18
52
|
notes: string[];
|
|
19
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Records a feat on the character and applies whatever it grants.
|
|
56
|
+
*
|
|
57
|
+
* The caller is expected to have checked the prerequisite and the duplicate first;
|
|
58
|
+
* this does the recording. An unknown feat is recorded with a note rather than
|
|
59
|
+
* refused, so a table playing with feats beyond the SRD is not blocked by a table
|
|
60
|
+
* that only has one.
|
|
61
|
+
* @param state The character, mutated in place
|
|
62
|
+
* @param name The feat as the player named it
|
|
63
|
+
* @returns What was recorded and what it changed
|
|
64
|
+
*/
|
|
20
65
|
export declare function applyFeat(state: SheetState, name: string): FeatApplication;
|
|
66
|
+
/**
|
|
67
|
+
* Weapon proficiencies a character's feats grant.
|
|
68
|
+
*
|
|
69
|
+
* Derived rather than stored, the same as class and racial proficiency, so it is
|
|
70
|
+
* consulted whenever an attack line is built.
|
|
71
|
+
* @param state The character
|
|
72
|
+
* @returns Weapon keys, empty when no feat grants any
|
|
73
|
+
*/
|
|
21
74
|
export declare function featWeaponProficiencies(state: SheetState): string[];
|
|
75
|
+
/** Renders a feat as readable markdown, for a rules lookup. */
|
|
22
76
|
export declare function describeFeat(feat: FeatRules): string;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Resolving a feat, checking whether a character may take it, and applying it.
|
|
4
|
+
*
|
|
5
|
+
* A feat a character has taken is recorded on the sheet by name, whether or not the
|
|
6
|
+
* SRD carries it. Only a known feat has its prerequisite checked and its grants
|
|
7
|
+
* applied — an unknown one is still recorded, because a character who took Great
|
|
8
|
+
* Weapon Master should not silently have taken nothing.
|
|
9
|
+
*
|
|
10
|
+
* Pure, with no room access, like the rest of `engine/`.
|
|
11
|
+
*/
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
13
|
exports.resetFeatIndex = resetFeatIndex;
|
|
4
14
|
exports.resolveFeat = resolveFeat;
|
|
@@ -23,9 +33,15 @@ function featIndex() {
|
|
|
23
33
|
}
|
|
24
34
|
return featIndexCache;
|
|
25
35
|
}
|
|
36
|
+
/** Resets the feat index. Only needed by tests that mutate the table. */
|
|
26
37
|
function resetFeatIndex() {
|
|
27
38
|
featIndexCache = null;
|
|
28
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolves a feat name against the SRD table.
|
|
42
|
+
* @param name The feat as written
|
|
43
|
+
* @returns The feat, the candidates, or an empty result for one not in the SRD
|
|
44
|
+
*/
|
|
29
45
|
function resolveFeat(name) {
|
|
30
46
|
const key = (0, coerce_1.nameKey)(name || '');
|
|
31
47
|
if (!key)
|
|
@@ -41,16 +57,28 @@ function resolveFeat(name) {
|
|
|
41
57
|
}
|
|
42
58
|
return {};
|
|
43
59
|
}
|
|
60
|
+
/** Every SRD feat name. */
|
|
44
61
|
function featNames() {
|
|
45
62
|
return Object.values(feats_1.SRD_FEATS).map((feat) => feat.name).sort();
|
|
46
63
|
}
|
|
64
|
+
/** The feats a character has taken, in the order taken. */
|
|
47
65
|
function takenFeats(state) {
|
|
48
66
|
return Array.isArray(state.feats) ? state.feats : [];
|
|
49
67
|
}
|
|
68
|
+
/** True when the character already has this feat, however it was spelled. */
|
|
50
69
|
function hasFeat(state, name) {
|
|
51
70
|
const key = (0, coerce_1.nameKey)(name);
|
|
52
71
|
return takenFeats(state).some((taken) => (0, coerce_1.nameKey)(taken) === key);
|
|
53
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Why the character cannot take this feat, if they cannot.
|
|
75
|
+
*
|
|
76
|
+
* Only checks what is expressible as a number. A prose prerequisite is returned as
|
|
77
|
+
* a line for the Dungeon Master to judge rather than being guessed at.
|
|
78
|
+
* @param state The character
|
|
79
|
+
* @param feat The feat
|
|
80
|
+
* @returns Blocking reasons, empty when the prerequisite is met
|
|
81
|
+
*/
|
|
54
82
|
function prerequisiteProblems(state, feat) {
|
|
55
83
|
const problems = [];
|
|
56
84
|
for (const [ability, minimum] of Object.entries(feat.prerequisite?.abil || {})) {
|
|
@@ -61,9 +89,21 @@ function prerequisiteProblems(state, feat) {
|
|
|
61
89
|
}
|
|
62
90
|
return problems;
|
|
63
91
|
}
|
|
92
|
+
/** A prose prerequisite the tools cannot check, for the caller to pass on. */
|
|
64
93
|
function prerequisiteNote(feat) {
|
|
65
94
|
return feat.prerequisite?.text;
|
|
66
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Records a feat on the character and applies whatever it grants.
|
|
98
|
+
*
|
|
99
|
+
* The caller is expected to have checked the prerequisite and the duplicate first;
|
|
100
|
+
* this does the recording. An unknown feat is recorded with a note rather than
|
|
101
|
+
* refused, so a table playing with feats beyond the SRD is not blocked by a table
|
|
102
|
+
* that only has one.
|
|
103
|
+
* @param state The character, mutated in place
|
|
104
|
+
* @param name The feat as the player named it
|
|
105
|
+
* @returns What was recorded and what it changed
|
|
106
|
+
*/
|
|
67
107
|
function applyFeat(state, name) {
|
|
68
108
|
const { feat } = resolveFeat(name);
|
|
69
109
|
const recorded = feat ? feat.name : name.trim();
|
|
@@ -106,6 +146,14 @@ function applyFeat(state, name) {
|
|
|
106
146
|
}
|
|
107
147
|
return result;
|
|
108
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Weapon proficiencies a character's feats grant.
|
|
151
|
+
*
|
|
152
|
+
* Derived rather than stored, the same as class and racial proficiency, so it is
|
|
153
|
+
* consulted whenever an attack line is built.
|
|
154
|
+
* @param state The character
|
|
155
|
+
* @returns Weapon keys, empty when no feat grants any
|
|
156
|
+
*/
|
|
109
157
|
function featWeaponProficiencies(state) {
|
|
110
158
|
const out = [];
|
|
111
159
|
for (const taken of takenFeats(state)) {
|
|
@@ -114,6 +162,7 @@ function featWeaponProficiencies(state) {
|
|
|
114
162
|
}
|
|
115
163
|
return out;
|
|
116
164
|
}
|
|
165
|
+
/** Renders a feat as readable markdown, for a rules lookup. */
|
|
117
166
|
function describeFeat(feat) {
|
|
118
167
|
const lines = [`## ${feat.name}`];
|
|
119
168
|
const abil = Object.entries(feat.prerequisite?.abil || {})
|
|
@@ -1,7 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning a stat block into a combatant the tools can operate on.
|
|
3
|
+
*
|
|
4
|
+
* A monster gets the same shape a character has, because `check`, `apply_hp`,
|
|
5
|
+
* `conditions` and `spend` all resolve their target by name through `loadSheet` —
|
|
6
|
+
* one shape means every one of them works on a monster with no second code path.
|
|
7
|
+
* `check` in particular compares an attack to armour class, which `roll_dice` cannot
|
|
8
|
+
* do, so a placed monster's attacks are adjudicated by the tool rather than by eye.
|
|
9
|
+
*
|
|
10
|
+
* Pure, with no room access, like the rest of `engine/`.
|
|
11
|
+
*/
|
|
1
12
|
import { MonsterBlock } from '../data/monsters';
|
|
2
13
|
import { SheetState } from './sheet';
|
|
3
14
|
import { Rng } from './dice';
|
|
15
|
+
/** How a group of identical creatures is labelled: Goblin A, Goblin B, ... */
|
|
4
16
|
export declare const FOE_LABELS = "ABCDEFGHIJKL";
|
|
17
|
+
/**
|
|
18
|
+
* Names the members of a group, so the fight has distinct targets.
|
|
19
|
+
* @param blockName The creature's name
|
|
20
|
+
* @param count How many are present
|
|
21
|
+
* @returns One name per creature; a lone creature keeps its plain name
|
|
22
|
+
*/
|
|
5
23
|
export declare function foeNames(blockName: string, count: number): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Rolls one creature's hit points.
|
|
26
|
+
*
|
|
27
|
+
* A group rolls individually so the party cannot infer one creature's remaining
|
|
28
|
+
* total from another's. Without hit dice there is nothing to roll and the block's
|
|
29
|
+
* printed average stands.
|
|
30
|
+
* @param block The creature
|
|
31
|
+
* @param rng The random source
|
|
32
|
+
* @returns The hit point total, never below 1
|
|
33
|
+
*/
|
|
6
34
|
export declare function rollFoeHitPoints(block: MonsterBlock, rng?: Rng): number;
|
|
35
|
+
/**
|
|
36
|
+
* Builds a combatant from a stat block.
|
|
37
|
+
*
|
|
38
|
+
* Most of it is a direct copy: `MonsterAttack` and {@link AttackEntry} are the same
|
|
39
|
+
* shape but for a `reach`/`range` rename. The fields a monster has no answer for are
|
|
40
|
+
* left empty rather than invented — no class, no hit dice, no spell slots, no
|
|
41
|
+
* proficiency bonus. Nothing reads them for a foe.
|
|
42
|
+
*
|
|
43
|
+
* @param block The creature
|
|
44
|
+
* @param name What this particular one is called, e.g. 'Goblin B'
|
|
45
|
+
* @param hp Its rolled hit point total
|
|
46
|
+
* @param owner The agent the sheet belongs to — the one running the fight
|
|
47
|
+
* @returns The combatant's state
|
|
48
|
+
*/
|
|
7
49
|
export declare function buildFoe(block: MonsterBlock, name: string, hp: number, owner?: string): SheetState;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Turning a stat block into a combatant the tools can operate on.
|
|
4
|
+
*
|
|
5
|
+
* A monster gets the same shape a character has, because `check`, `apply_hp`,
|
|
6
|
+
* `conditions` and `spend` all resolve their target by name through `loadSheet` —
|
|
7
|
+
* one shape means every one of them works on a monster with no second code path.
|
|
8
|
+
* `check` in particular compares an attack to armour class, which `roll_dice` cannot
|
|
9
|
+
* do, so a placed monster's attacks are adjudicated by the tool rather than by eye.
|
|
10
|
+
*
|
|
11
|
+
* Pure, with no room access, like the rest of `engine/`.
|
|
12
|
+
*/
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.FOE_LABELS = void 0;
|
|
4
15
|
exports.foeNames = foeNames;
|
|
@@ -7,17 +18,48 @@ exports.buildFoe = buildFoe;
|
|
|
7
18
|
const srd_1 = require("../data/srd");
|
|
8
19
|
const sheet_1 = require("./sheet");
|
|
9
20
|
const dice_1 = require("./dice");
|
|
21
|
+
/** How a group of identical creatures is labelled: Goblin A, Goblin B, ... */
|
|
10
22
|
exports.FOE_LABELS = 'ABCDEFGHIJKL';
|
|
23
|
+
/**
|
|
24
|
+
* Names the members of a group, so the fight has distinct targets.
|
|
25
|
+
* @param blockName The creature's name
|
|
26
|
+
* @param count How many are present
|
|
27
|
+
* @returns One name per creature; a lone creature keeps its plain name
|
|
28
|
+
*/
|
|
11
29
|
function foeNames(blockName, count) {
|
|
12
30
|
if (count <= 1)
|
|
13
31
|
return [blockName];
|
|
14
32
|
return Array.from({ length: count }, (_, i) => `${blockName} ${exports.FOE_LABELS[i]}`);
|
|
15
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Rolls one creature's hit points.
|
|
36
|
+
*
|
|
37
|
+
* A group rolls individually so the party cannot infer one creature's remaining
|
|
38
|
+
* total from another's. Without hit dice there is nothing to roll and the block's
|
|
39
|
+
* printed average stands.
|
|
40
|
+
* @param block The creature
|
|
41
|
+
* @param rng The random source
|
|
42
|
+
* @returns The hit point total, never below 1
|
|
43
|
+
*/
|
|
16
44
|
function rollFoeHitPoints(block, rng = dice_1.defaultRng) {
|
|
17
45
|
if (!block.hpDice)
|
|
18
46
|
return Math.max(block.hp, 1);
|
|
19
47
|
return Math.max((0, dice_1.rollOne)(block.hpDice, rng).total, 1);
|
|
20
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Builds a combatant from a stat block.
|
|
51
|
+
*
|
|
52
|
+
* Most of it is a direct copy: `MonsterAttack` and {@link AttackEntry} are the same
|
|
53
|
+
* shape but for a `reach`/`range` rename. The fields a monster has no answer for are
|
|
54
|
+
* left empty rather than invented — no class, no hit dice, no spell slots, no
|
|
55
|
+
* proficiency bonus. Nothing reads them for a foe.
|
|
56
|
+
*
|
|
57
|
+
* @param block The creature
|
|
58
|
+
* @param name What this particular one is called, e.g. 'Goblin B'
|
|
59
|
+
* @param hp Its rolled hit point total
|
|
60
|
+
* @param owner The agent the sheet belongs to — the one running the fight
|
|
61
|
+
* @returns The combatant's state
|
|
62
|
+
*/
|
|
21
63
|
function buildFoe(block, name, hp, owner) {
|
|
22
64
|
const abil = {};
|
|
23
65
|
for (const ability of srd_1.ABILITIES) {
|
|
@@ -32,8 +74,12 @@ function buildFoe(block, name, hp, owner) {
|
|
|
32
74
|
};
|
|
33
75
|
if (attack.type)
|
|
34
76
|
entry.type = attack.type;
|
|
77
|
+
// A stat block calls it reach; a sheet calls it range. Same thing.
|
|
35
78
|
if (attack.reach)
|
|
36
79
|
entry.range = String(attack.reach);
|
|
80
|
+
// The rider is half the attack. Dropped here, a wolf's bite arrives at the
|
|
81
|
+
// table as damage with no saving throw, and the prone it should have caused
|
|
82
|
+
// is not forgotten by the agent running the fight — it never reached them.
|
|
37
83
|
if (attack.note)
|
|
38
84
|
entry.note = String(attack.note);
|
|
39
85
|
return entry;
|
|
@@ -50,7 +96,11 @@ function buildFoe(block, name, hp, owner) {
|
|
|
50
96
|
name,
|
|
51
97
|
owner,
|
|
52
98
|
foe: true,
|
|
99
|
+
// What it is, so the render and a reader can tell a wight from a wolf.
|
|
53
100
|
race: [block.size, block.kind].filter(Boolean).join(' ') || undefined,
|
|
101
|
+
// No class, and therefore no level, hit dice, proficiency bonus or slots.
|
|
102
|
+
// `recomputeDerived` refuses to touch a foe for this reason: there is
|
|
103
|
+
// nothing to rebuild these from, and trying would overwrite the stat block.
|
|
54
104
|
class: [],
|
|
55
105
|
abil,
|
|
56
106
|
saveProf: [],
|
|
@@ -62,11 +112,15 @@ function buildFoe(block, name, hp, owner) {
|
|
|
62
112
|
hp: { max: Math.max(hp, 1), cur: Math.max(hp, 1), temp: 0 },
|
|
63
113
|
hd: {},
|
|
64
114
|
ac: Number(block.ac) || 10,
|
|
115
|
+
// The block's speed is prose ('30 ft., fly 40 ft.'); the sheet wants a
|
|
116
|
+
// number, so the walking figure is taken and the rest stays in the prose.
|
|
65
117
|
speed: parseWalkingSpeed(block.speed),
|
|
66
118
|
initBonus: Math.floor((abil.dex - 10) / 2),
|
|
67
119
|
slots: {},
|
|
68
120
|
uses: {},
|
|
69
121
|
attacks,
|
|
122
|
+
// Carried because it is what tells a creature allowed a second attack in a
|
|
123
|
+
// round from one that is not, which `check` enforces.
|
|
70
124
|
multiattack: block.multiattack || undefined,
|
|
71
125
|
cond: [],
|
|
72
126
|
exh: 0,
|
|
@@ -80,6 +134,11 @@ function buildFoe(block, name, hp, owner) {
|
|
|
80
134
|
xp: 0,
|
|
81
135
|
};
|
|
82
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* The walking speed out of a stat block's prose.
|
|
139
|
+
* @param speed The block's speed line, e.g. '30 ft., fly 60 ft.'
|
|
140
|
+
* @returns The walking speed in feet, defaulting to 30
|
|
141
|
+
*/
|
|
83
142
|
function parseWalkingSpeed(speed) {
|
|
84
143
|
const match = /^\s*(\d+)\s*ft/i.exec(String(speed || ''));
|
|
85
144
|
return match ? Number(match[1]) : 30;
|
|
@@ -1,21 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The guides: which classes and backgrounds a table allows, and where one lives
|
|
3
|
+
* once it has been handed to the agents who need it.
|
|
4
|
+
*
|
|
5
|
+
* **The files are the list.** A `class-*.md` or `background-*.md` document in the
|
|
6
|
+
* pack's `artifacts/` directory is a class a character may be built as or a
|
|
7
|
+
* background they may take, and there is no second list anywhere agreeing or
|
|
8
|
+
* disagreeing with it — so a table adds one by dropping in a file, and nothing here
|
|
9
|
+
* has to change. That is the reason names are derived from file names rather than
|
|
10
|
+
* read from {@link CLASSES} or {@link BACKGROUNDS}, which carry only what the SRD
|
|
11
|
+
* covers and only the parts a tool computes from.
|
|
12
|
+
*
|
|
13
|
+
* The two kinds differ in what the file has to carry, and that difference is worth
|
|
14
|
+
* keeping straight. A class document is **prose nothing computes from**: the pack
|
|
15
|
+
* derives hit dice, saves and slots itself, and the document holds the features. A
|
|
16
|
+
* background document is prose too, but a background's *grants* — two skills, the
|
|
17
|
+
* equipment package, the coin — are applied by `create_sheet` from
|
|
18
|
+
* `data/backgrounds.ts`, which the SRD's one background is in and a table's own are
|
|
19
|
+
* not. So a dropped-in background is offered, read and shared like any other, and
|
|
20
|
+
* its skills and gear are passed in the spec by the creator, exactly as the SRD's
|
|
21
|
+
* customization rule already has them do.
|
|
22
|
+
*
|
|
23
|
+
* Pure: names in, names out. The room half is {@link shareGuide} in
|
|
24
|
+
* `tools/shared.ts`, and the reading half is `helpers.packDocuments`.
|
|
25
|
+
*/
|
|
26
|
+
/** The pack these documents ship in — the same name as this directory. */
|
|
1
27
|
export declare const DND5E_PACK = "dnd5e";
|
|
28
|
+
/** One kind of guide document: how its files are named, and how a shared one is filed. */
|
|
2
29
|
export interface GuideKind {
|
|
30
|
+
/** What the kind is called, for messages. */
|
|
3
31
|
label: string;
|
|
32
|
+
/** The file-name prefix that marks a document as one of these. */
|
|
4
33
|
prefix: string;
|
|
34
|
+
/** The prefix of the room artifact a shared one is filed under. */
|
|
5
35
|
artifactPrefix: string;
|
|
6
36
|
}
|
|
7
37
|
export declare const CLASS_GUIDE: GuideKind;
|
|
8
38
|
export declare const BACKGROUND_GUIDE: GuideKind;
|
|
39
|
+
/**
|
|
40
|
+
* How much of a guide a tool result carries.
|
|
41
|
+
*
|
|
42
|
+
* The result cap is 16 KB and `truncateResult` replaces an oversized result with a
|
|
43
|
+
* mangled *string* rather than clipping it, destroying the JSON — so a document
|
|
44
|
+
* dropped in by a table has to be bounded here rather than trusted. The shipped
|
|
45
|
+
* class documents run 2.2–5.7 KB, so this only ever binds on somebody's own file,
|
|
46
|
+
* and the shared artifact still holds the whole thing.
|
|
47
|
+
*/
|
|
9
48
|
export declare const MAX_GUIDE_CHARS = 12000;
|
|
49
|
+
/** A guide document, as resolved from the files the pack ships. */
|
|
10
50
|
export interface Guide {
|
|
51
|
+
/** The class or background as a person writes it, e.g. `Wizard`. */
|
|
11
52
|
name: string;
|
|
53
|
+
/** The pack document's file name, e.g. `class-wizard.md`. */
|
|
12
54
|
fileName: string;
|
|
13
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The class or background a document file describes.
|
|
58
|
+
* @param kind Which kind of document it is
|
|
59
|
+
* @param fileName A file name carrying that kind's prefix
|
|
60
|
+
* @returns The name, e.g. `Blood Hunter` for `class-blood-hunter.md`
|
|
61
|
+
*/
|
|
14
62
|
export declare function guideNameFromFile(kind: GuideKind, fileName: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Every class or background the pack has a document for.
|
|
65
|
+
* @param kind Which kind to pick out
|
|
66
|
+
* @param files File names from `helpers.packDocuments.list`
|
|
67
|
+
* @returns One entry per document, in the order the files came in
|
|
68
|
+
*/
|
|
15
69
|
export declare function listGuides(kind: GuideKind, files: readonly string[]): Guide[];
|
|
70
|
+
/** What a name resolved to, with ambiguity reported rather than settled. */
|
|
16
71
|
export interface GuideMatch {
|
|
17
72
|
guide?: Guide;
|
|
73
|
+
/** Set when the name matched several documents; the guide is then absent. */
|
|
18
74
|
ambiguous?: string[];
|
|
19
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Resolves a name against the documents that exist.
|
|
78
|
+
*
|
|
79
|
+
* Loose in the same tiers as every other lookup in the pack, and ambiguity is
|
|
80
|
+
* reported rather than guessed at — picking one of two classes for a player would
|
|
81
|
+
* be a whole character built wrong.
|
|
82
|
+
* @param wanted The name as the model supplied it
|
|
83
|
+
* @param guides Every document of the kind being looked for
|
|
84
|
+
* @returns The match, or the candidates when there is more than one
|
|
85
|
+
*/
|
|
20
86
|
export declare function resolveGuide(wanted: string, guides: readonly Guide[]): GuideMatch;
|
|
87
|
+
/**
|
|
88
|
+
* The room artifact a guide is shared through.
|
|
89
|
+
* @param kind Which kind of document it is
|
|
90
|
+
* @param name The class or background name
|
|
91
|
+
* @returns The artifact name, e.g. `Class: Wizard` or `Background: Acolyte`
|
|
92
|
+
*/
|
|
21
93
|
export declare function guideArtifactName(kind: GuideKind, name: string): string;
|
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The guides: which classes and backgrounds a table allows, and where one lives
|
|
4
|
+
* once it has been handed to the agents who need it.
|
|
5
|
+
*
|
|
6
|
+
* **The files are the list.** A `class-*.md` or `background-*.md` document in the
|
|
7
|
+
* pack's `artifacts/` directory is a class a character may be built as or a
|
|
8
|
+
* background they may take, and there is no second list anywhere agreeing or
|
|
9
|
+
* disagreeing with it — so a table adds one by dropping in a file, and nothing here
|
|
10
|
+
* has to change. That is the reason names are derived from file names rather than
|
|
11
|
+
* read from {@link CLASSES} or {@link BACKGROUNDS}, which carry only what the SRD
|
|
12
|
+
* covers and only the parts a tool computes from.
|
|
13
|
+
*
|
|
14
|
+
* The two kinds differ in what the file has to carry, and that difference is worth
|
|
15
|
+
* keeping straight. A class document is **prose nothing computes from**: the pack
|
|
16
|
+
* derives hit dice, saves and slots itself, and the document holds the features. A
|
|
17
|
+
* background document is prose too, but a background's *grants* — two skills, the
|
|
18
|
+
* equipment package, the coin — are applied by `create_sheet` from
|
|
19
|
+
* `data/backgrounds.ts`, which the SRD's one background is in and a table's own are
|
|
20
|
+
* not. So a dropped-in background is offered, read and shared like any other, and
|
|
21
|
+
* its skills and gear are passed in the spec by the creator, exactly as the SRD's
|
|
22
|
+
* customization rule already has them do.
|
|
23
|
+
*
|
|
24
|
+
* Pure: names in, names out. The room half is {@link shareGuide} in
|
|
25
|
+
* `tools/shared.ts`, and the reading half is `helpers.packDocuments`.
|
|
26
|
+
*/
|
|
2
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
28
|
exports.MAX_GUIDE_CHARS = exports.BACKGROUND_GUIDE = exports.CLASS_GUIDE = exports.DND5E_PACK = void 0;
|
|
4
29
|
exports.guideNameFromFile = guideNameFromFile;
|
|
@@ -7,6 +32,7 @@ exports.resolveGuide = resolveGuide;
|
|
|
7
32
|
exports.guideArtifactName = guideArtifactName;
|
|
8
33
|
const coerce_1 = require("./coerce");
|
|
9
34
|
const sheet_1 = require("./sheet");
|
|
35
|
+
/** The pack these documents ship in — the same name as this directory. */
|
|
10
36
|
exports.DND5E_PACK = 'dnd5e';
|
|
11
37
|
exports.CLASS_GUIDE = {
|
|
12
38
|
label: 'class',
|
|
@@ -18,7 +44,22 @@ exports.BACKGROUND_GUIDE = {
|
|
|
18
44
|
prefix: 'background-',
|
|
19
45
|
artifactPrefix: 'Background: ',
|
|
20
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* How much of a guide a tool result carries.
|
|
49
|
+
*
|
|
50
|
+
* The result cap is 16 KB and `truncateResult` replaces an oversized result with a
|
|
51
|
+
* mangled *string* rather than clipping it, destroying the JSON — so a document
|
|
52
|
+
* dropped in by a table has to be bounded here rather than trusted. The shipped
|
|
53
|
+
* class documents run 2.2–5.7 KB, so this only ever binds on somebody's own file,
|
|
54
|
+
* and the shared artifact still holds the whole thing.
|
|
55
|
+
*/
|
|
21
56
|
exports.MAX_GUIDE_CHARS = 12_000;
|
|
57
|
+
/**
|
|
58
|
+
* The class or background a document file describes.
|
|
59
|
+
* @param kind Which kind of document it is
|
|
60
|
+
* @param fileName A file name carrying that kind's prefix
|
|
61
|
+
* @returns The name, e.g. `Blood Hunter` for `class-blood-hunter.md`
|
|
62
|
+
*/
|
|
22
63
|
function guideNameFromFile(kind, fileName) {
|
|
23
64
|
return (0, sheet_1.titleCase)(fileName
|
|
24
65
|
.slice(kind.prefix.length)
|
|
@@ -26,11 +67,27 @@ function guideNameFromFile(kind, fileName) {
|
|
|
26
67
|
.replace(/[-_]+/g, ' ')
|
|
27
68
|
.trim());
|
|
28
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Every class or background the pack has a document for.
|
|
72
|
+
* @param kind Which kind to pick out
|
|
73
|
+
* @param files File names from `helpers.packDocuments.list`
|
|
74
|
+
* @returns One entry per document, in the order the files came in
|
|
75
|
+
*/
|
|
29
76
|
function listGuides(kind, files) {
|
|
30
77
|
return files
|
|
31
78
|
.filter((file) => file.toLowerCase().startsWith(kind.prefix))
|
|
32
79
|
.map((fileName) => ({ fileName, name: guideNameFromFile(kind, fileName) }));
|
|
33
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Resolves a name against the documents that exist.
|
|
83
|
+
*
|
|
84
|
+
* Loose in the same tiers as every other lookup in the pack, and ambiguity is
|
|
85
|
+
* reported rather than guessed at — picking one of two classes for a player would
|
|
86
|
+
* be a whole character built wrong.
|
|
87
|
+
* @param wanted The name as the model supplied it
|
|
88
|
+
* @param guides Every document of the kind being looked for
|
|
89
|
+
* @returns The match, or the candidates when there is more than one
|
|
90
|
+
*/
|
|
34
91
|
function resolveGuide(wanted, guides) {
|
|
35
92
|
const names = guides.map((guide) => guide.name);
|
|
36
93
|
const matched = (0, coerce_1.matchNames)(wanted, names);
|
|
@@ -40,6 +97,12 @@ function resolveGuide(wanted, guides) {
|
|
|
40
97
|
return { ambiguous: matched };
|
|
41
98
|
return { guide: guides.find((guide) => guide.name === matched[0]) };
|
|
42
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* The room artifact a guide is shared through.
|
|
102
|
+
* @param kind Which kind of document it is
|
|
103
|
+
* @param name The class or background name
|
|
104
|
+
* @returns The artifact name, e.g. `Class: Wizard` or `Background: Acolyte`
|
|
105
|
+
*/
|
|
43
106
|
function guideArtifactName(kind, name) {
|
|
44
107
|
return `${kind.artifactPrefix}${name}`;
|
|
45
108
|
}
|