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,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);
|
|
@@ -45,11 +46,11 @@ const spells_1 = require("../engine/spells");
|
|
|
45
46
|
const srd_1 = require("../data/srd");
|
|
46
47
|
const sheet_1 = require("../engine/sheet");
|
|
47
48
|
const shared_1 = require("./shared");
|
|
48
|
-
const SPEC_EXAMPLE = '{"class":"Ranger","subclass":"Hunter","level":3,"race":"Wood Elf","background":"Outlander","alignment":"NG","abilities":{"str":10,"dex":16,"con":14,"int":11,"wis":15,"cha":9},"skills":["perception","stealth","survival"],"languages":["Giant"],"equipment":["studded leather","longbow","arrows x40"],"attacks":[{"n":"Longbow","atk":5,"dmg":"1d8+3","type":"piercing"}],"spells":["hunter\'s mark"],"backstory":"Raised by the Emberwood circle."}';
|
|
49
|
+
const SPEC_EXAMPLE = '{"class":"Ranger","subclass":"Hunter","level":3,"race":"Wood Elf","background":"Outlander","alignment":"NG","abilities":{"str":10,"dex":16,"con":14,"int":11,"wis":15,"cha":9},"skills":["perception","stealth","survival"],"languages":["Giant"],"equipment":["studded leather","longbow","arrows x40"],"attacks":[{"n":"Longbow","atk":5,"dmg":"1d8+3","type":"piercing"}],"spells":["hunter\'s mark"],"appearance":"Lean and weather-beaten, copper hair in a long braid, green studded leather, a longbow across her back.","backstory":"Raised by the Emberwood circle."}';
|
|
49
50
|
const SET_EXAMPLE = '{"ac":18,"hp.max":32,"speed":25,"resist":["fire"],"uses.channel_divinity.cur":0}';
|
|
50
51
|
exports.createSheetTool = {
|
|
51
52
|
name: 'create_sheet',
|
|
52
|
-
description: 'Create a character sheet. "character" is the character\'s name. "spec" is a JSON object describing them; only the class is genuinely required and everything else is derived or defaulted. Hit points, armour class, proficiency bonus, saving throws, skill modifiers, spell slots and hit dice are all computed from the 5e rules, so do not work them out yourself. Put tool proficiencies the player *chose* in "tools", e.g. "tools":["Lute","Drum","Flute"] for a bard — the ones their class, race and background grant outright are added for you, and the result says which choices are still owed. Put languages the player *chose* in "languages" — a background\'s and the extra one a race lets them pick — since no tool here knows what a background grants; what the race speaks natively is added for you. Include a "backstory" string to seed the sheet\'s notes section, which later tool calls never overwrite. "owner" is the nickname of the agent who plays this character — set it, because the sheet is made readable to that agent alone, and because it is how the rest of the table is told who they are: the owning agent\'s public description becomes the character\'s name, race and class, replacing whatever placeholder they were created with. The class\'s own rules are shared with that agent at the same time, as a "Class: ..." document they read from then on, so a player always knows their own features. Set "replace" to true to overwrite an existing sheet. Example spec: ' +
|
|
53
|
+
description: 'Create a character sheet. "character" is the character\'s name. "spec" is a JSON object describing them; only the class is genuinely required and everything else is derived or defaulted. Hit points, armour class, proficiency bonus, saving throws, skill modifiers, spell slots and hit dice are all computed from the 5e rules, so do not work them out yourself. Put tool proficiencies the player *chose* in "tools", e.g. "tools":["Lute","Drum","Flute"] for a bard — the ones their class, race and background grant outright are added for you, and the result says which choices are still owed. Put languages the player *chose* in "languages" — a background\'s and the extra one a race lets them pick — since no tool here knows what a background grants; what the race speaks natively is added for you. Include a "backstory" string to seed the sheet\'s notes section, which later tool calls never overwrite. A portrait is drawn automatically and added to the sheet a few minutes later; include an "appearance" string describing what the character looks like — their build, colouring, clothing and what they carry — so the likeness is theirs rather than a guess from their race and class. "owner" is the nickname of the agent who plays this character — set it, because the sheet is made readable to that agent alone, and because it is how the rest of the table is told who they are: the owning agent\'s public description becomes the character\'s name, race and class, replacing whatever placeholder they were created with. The class\'s own rules are shared with that agent at the same time, as a "Class: ..." document they read from then on, so a player always knows their own features. Set "replace" to true to overwrite an existing sheet. Example spec: ' +
|
|
53
54
|
SPEC_EXAMPLE,
|
|
54
55
|
parameters: [
|
|
55
56
|
{ name: 'character', type: 'string', description: "The character's name", required: true },
|
|
@@ -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,12 +96,33 @@ 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.
|
|
96
113
|
const renamed = state.owner ? room.renameAgent(state.owner, state.name) : undefined;
|
|
97
114
|
const guides = shareGuidesForCharacter(room, helpers.packDocuments, state);
|
|
115
|
+
// Asked for after the sheet exists, because the url is written onto that
|
|
116
|
+
// sheet when the drawing finishes — minutes from now, and long after this
|
|
117
|
+
// turn has ended. The identity line goes with the appearance so the
|
|
118
|
+
// illustrator knows it is drawing a wood elf ranger and not a bare list of
|
|
119
|
+
// features.
|
|
120
|
+
const portrait = (0, shared_1.requestPortrait)(helpers, room, state.name, [identity, spec.appearance, spec.backstory].filter(Boolean).join('\n\n'));
|
|
98
121
|
return {
|
|
99
122
|
created: artifactName,
|
|
123
|
+
portrait: portrait.requested
|
|
124
|
+
? 'A portrait is being drawn and will appear on the sheet in a few minutes.'
|
|
125
|
+
: undefined,
|
|
100
126
|
headline: (0, shared_1.sheetHeadline)(state),
|
|
101
127
|
owner: renamed?.renamed ? renamed.to : state.owner,
|
|
102
128
|
publicIdentity: described ? identity : undefined,
|
|
@@ -110,6 +136,9 @@ exports.createSheetTool = {
|
|
|
110
136
|
classGuides: guides.classes.length > 0 ? guides.classes : undefined,
|
|
111
137
|
classesWithoutRules: guides.missingClasses.length > 0 ? guides.missingClasses : undefined,
|
|
112
138
|
spellsOffList: (() => {
|
|
139
|
+
// Reported, never refused: a subclass, a racial trait or an item can
|
|
140
|
+
// all grant a spell off-list, so blocking would be wrong more often
|
|
141
|
+
// than right. Naming it lets a genuine mistake be noticed.
|
|
113
142
|
const off = (0, spells_1.offListSpells)(state, state.spells || []);
|
|
114
143
|
return off.length > 0
|
|
115
144
|
? off.map((entry) => entry.onLists
|
|
@@ -117,6 +146,11 @@ exports.createSheetTool = {
|
|
|
117
146
|
: `${entry.spell} is not an SRD spell`)
|
|
118
147
|
: undefined;
|
|
119
148
|
})(),
|
|
149
|
+
// The name is recorded and nothing else is applied, because a background is
|
|
150
|
+
// a document rather than a table: its skills, languages, gear and coin are
|
|
151
|
+
// read off `rules_lookup` and passed in this same spec. Said on every build
|
|
152
|
+
// rather than only when something looks wrong, since a background whose
|
|
153
|
+
// skills were never passed is invisible on the finished sheet.
|
|
120
154
|
background: state.bg
|
|
121
155
|
? {
|
|
122
156
|
recorded: state.bg,
|
|
@@ -138,6 +172,8 @@ exports.createSheetTool = {
|
|
|
138
172
|
}
|
|
139
173
|
: undefined,
|
|
140
174
|
raceProblems: raceResult.problems.length > 0 ? raceResult.problems : undefined,
|
|
175
|
+
// Every source's tools in one place, because a player choosing them needs
|
|
176
|
+
// the whole picture and the three grants report separately above.
|
|
141
177
|
tools: state.toolProf.length > 0 || classToolResult.outstanding.length > 0
|
|
142
178
|
? {
|
|
143
179
|
proficient: state.toolProf.length > 0 ? state.toolProf : undefined,
|
|
@@ -147,6 +183,10 @@ exports.createSheetTool = {
|
|
|
147
183
|
: undefined,
|
|
148
184
|
}
|
|
149
185
|
: undefined,
|
|
186
|
+
// Reported as a list rather than a count, because nothing here knows how
|
|
187
|
+
// many a character is owed: the race's extras are data, a background's are
|
|
188
|
+
// prose in a document. Showing what landed is what lets a creator check it
|
|
189
|
+
// against the two sources itself.
|
|
150
190
|
languages: state.languages?.length ? state.languages : undefined,
|
|
151
191
|
derived: {
|
|
152
192
|
hitPoints: `${state.hp.cur}/${state.hp.max}`,
|
|
@@ -166,10 +206,34 @@ exports.createSheetTool = {
|
|
|
166
206
|
};
|
|
167
207
|
},
|
|
168
208
|
};
|
|
209
|
+
/**
|
|
210
|
+
* Gives the character's own player the documents for the class and background they
|
|
211
|
+
* just took.
|
|
212
|
+
*
|
|
213
|
+
* Done here rather than left to the creator's next tool call because this is the
|
|
214
|
+
* moment a choice becomes a fact, and because a player who never receives it has no
|
|
215
|
+
* other route to their own features — they hold no tools, and their sheet carries
|
|
216
|
+
* feature *names* rather than what those features do. `class_guide` and
|
|
217
|
+
* `rules_lookup` remain the way the *creator* reads one while a player is still
|
|
218
|
+
* choosing; this is the half that cannot be forgotten.
|
|
219
|
+
*
|
|
220
|
+
* Best effort by construction. A missing document or a deployment with no document
|
|
221
|
+
* access must not fail a sheet that is otherwise built. A **class** with no document
|
|
222
|
+
* is reported, because a class the table has no rules for is a real problem; a
|
|
223
|
+
* **background** with none is not reported here, because a background outside the
|
|
224
|
+
* SRD is ordinary legal play — `create_sheet`'s own `background.stillToChoose`
|
|
225
|
+
* already says its skills and gear are the creator's to supply.
|
|
226
|
+
*
|
|
227
|
+
* @param room The room access
|
|
228
|
+
* @param documents Pack document access, absent from the tool-test panel
|
|
229
|
+
* @param state The character that was just built
|
|
230
|
+
* @returns What was shared, and which classes have no rules here
|
|
231
|
+
*/
|
|
169
232
|
function shareGuidesForCharacter(room, documents, state) {
|
|
170
233
|
const result = { classes: [], missingClasses: [] };
|
|
171
234
|
if (!documents)
|
|
172
235
|
return result;
|
|
236
|
+
// No owner means nobody to give it to; the creator reads them through its lookups.
|
|
173
237
|
const players = state.owner ? [state.owner] : [];
|
|
174
238
|
const share = (kind, wanted) => {
|
|
175
239
|
const guides = (0, guides_1.listGuides)(kind, documents.list(guides_1.DND5E_PACK, kind.prefix));
|
|
@@ -193,6 +257,16 @@ function shareGuidesForCharacter(room, documents, state) {
|
|
|
193
257
|
}
|
|
194
258
|
return result;
|
|
195
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* The one-line identity the rest of the table sees, e.g.
|
|
262
|
+
* `Thorin Ironfoot — Mountain Dwarf Fighter`.
|
|
263
|
+
*
|
|
264
|
+
* Carries only what will not change for the life of the character. Level, hit
|
|
265
|
+
* points and conditions belong in the party summary, which is re-rendered from
|
|
266
|
+
* the sheets and costs nothing to update.
|
|
267
|
+
* @param state The finished character
|
|
268
|
+
* @returns The public identity line
|
|
269
|
+
*/
|
|
196
270
|
function publicIdentity(state) {
|
|
197
271
|
const classes = state.class
|
|
198
272
|
.map((entry) => {
|
|
@@ -203,6 +277,7 @@ function publicIdentity(state) {
|
|
|
203
277
|
const descriptors = [state.race, classes].filter(Boolean).join(' ');
|
|
204
278
|
return descriptors ? `${state.name} — ${descriptors}` : state.name;
|
|
205
279
|
}
|
|
280
|
+
/** Whether an item is armour or a shield, and so affects armour class when worn. */
|
|
206
281
|
function isWorn(itemName) {
|
|
207
282
|
const key = itemName.toLowerCase();
|
|
208
283
|
return /\bshield\b/.test(key) || srd_1.ARMOR[key] !== undefined;
|
|
@@ -256,6 +331,8 @@ exports.readSheetTool = {
|
|
|
256
331
|
if (wants('feats') && (0, feats_1.takenFeats)(state).length > 0) {
|
|
257
332
|
result.feats = (0, feats_1.takenFeats)(state).map((name) => {
|
|
258
333
|
const { feat } = (0, feats_1.resolveFeat)(name);
|
|
334
|
+
// Full text for a feat the SRD carries; the name alone for one from
|
|
335
|
+
// outside it, since there is nothing to quote.
|
|
259
336
|
return feat ? (0, feats_1.describeFeat)(feat) : `${name} (not an SRD feat)`;
|
|
260
337
|
});
|
|
261
338
|
}
|
|
@@ -267,6 +344,8 @@ exports.readSheetTool = {
|
|
|
267
344
|
pushDragLift: load.capacity.pushDragLift,
|
|
268
345
|
tier: load.tier,
|
|
269
346
|
variantInUse: load.variant,
|
|
347
|
+
// Named rather than assumed weightless: the SRD prints no weight
|
|
348
|
+
// for vestments or a holy symbol, so the total is a floor.
|
|
270
349
|
unweighed: load.carried.unweighed.length > 0 ? load.carried.unweighed : undefined,
|
|
271
350
|
thresholds: load.variant
|
|
272
351
|
? {
|
|
@@ -279,6 +358,9 @@ exports.readSheetTool = {
|
|
|
279
358
|
if (wants('background') && state.bg) {
|
|
280
359
|
result.background = {
|
|
281
360
|
name: state.bg,
|
|
361
|
+
// The name is all the sheet holds. A background is a document rather
|
|
362
|
+
// than a table, so what it grants was applied by whoever read it, and
|
|
363
|
+
// its prose is in the `Background: <name>` document.
|
|
282
364
|
note: `Read what it grants with rules_lookup topic "${state.bg}". Anything recorded for this character is in the notes.`,
|
|
283
365
|
};
|
|
284
366
|
}
|
|
@@ -290,6 +372,8 @@ exports.readSheetTool = {
|
|
|
290
372
|
speed: `${rules.effectiveSpeed(state).speed} ft`,
|
|
291
373
|
darkvision: state.darkvision ? `${state.darkvision} ft` : undefined,
|
|
292
374
|
languages: state.languages,
|
|
375
|
+
// Full text here, unlike the sheet render, because this is asked
|
|
376
|
+
// for explicitly rather than carried in a prompt every turn.
|
|
293
377
|
traits: traits.map((trait) => `${trait.n}. ${trait.text}`),
|
|
294
378
|
};
|
|
295
379
|
}
|
|
@@ -315,6 +399,8 @@ exports.readSheetTool = {
|
|
|
315
399
|
.skillNames()
|
|
316
400
|
.map((skill) => [(0, sheet_1.titleCase)(skill), (0, sheet_1.signed)(rules.skillModifier(state, skill))]));
|
|
317
401
|
result.passivePerception = rules.passivePerception(state);
|
|
402
|
+
// Under skills because that is what they are: the other thing a character
|
|
403
|
+
// is proficient at, and the DM asking what someone is good at wants both.
|
|
318
404
|
if (state.toolProf.length > 0)
|
|
319
405
|
result.toolProficiencies = state.toolProf;
|
|
320
406
|
}
|
|
@@ -343,6 +429,7 @@ exports.readSheetTool = {
|
|
|
343
429
|
result.conditions = state.cond.map((c) => ({
|
|
344
430
|
name: c.n,
|
|
345
431
|
duration: c.dur,
|
|
432
|
+
// The DM should not have to look these up to adjudicate.
|
|
346
433
|
effect: srd_1.CONDITIONS[c.n] || 'Not a standard condition; adjudicate as described.',
|
|
347
434
|
}));
|
|
348
435
|
result.exhaustion = {
|
|
@@ -407,6 +494,8 @@ exports.patchSheetTool = {
|
|
|
407
494
|
const sheet = (0, shared_1.loadSheet)(room, character);
|
|
408
495
|
const candidate = (0, character_1.cloneState)(sheet.state);
|
|
409
496
|
const applied = [];
|
|
497
|
+
// Every path is checked before anything is written, so a call that names one
|
|
498
|
+
// bad field changes nothing rather than half-applying.
|
|
410
499
|
const rejected = [...Object.keys(set), ...Object.keys(append)]
|
|
411
500
|
.map((path) => ({ path, problem: pathProblem(candidate, path) }))
|
|
412
501
|
.filter((entry) => entry.problem);
|
|
@@ -431,6 +520,9 @@ exports.patchSheetTool = {
|
|
|
431
520
|
for (const [path, value] of Object.entries(append)) {
|
|
432
521
|
const target = getPath(candidate, path);
|
|
433
522
|
if (!Array.isArray(target)) {
|
|
523
|
+
// A refusal rather than a throw: the caller asked for something the
|
|
524
|
+
// rules of the sheet do not allow, and the useful reply names what
|
|
525
|
+
// it could have done instead.
|
|
434
526
|
return {
|
|
435
527
|
applied: false,
|
|
436
528
|
violation: 'not_a_list',
|
|
@@ -482,9 +574,28 @@ exports.patchSheetTool = {
|
|
|
482
574
|
};
|
|
483
575
|
},
|
|
484
576
|
};
|
|
577
|
+
/** Reads a dotted path out of state. */
|
|
485
578
|
function getPath(state, path) {
|
|
486
579
|
return path.split('.').reduce((node, key) => (node === undefined ? undefined : node[key]), state);
|
|
487
580
|
}
|
|
581
|
+
/**
|
|
582
|
+
* Why a dotted path cannot be written, or '' when it can.
|
|
583
|
+
*
|
|
584
|
+
* Two ways a path can be unwritable, both of which would otherwise pass silently:
|
|
585
|
+
*
|
|
586
|
+
* - **An unknown root.** `SheetState` ends in an index signature so a future field
|
|
587
|
+
* survives an old sheet — which also means a typo like `abilities.wis` would be
|
|
588
|
+
* accepted as a brand new top-level key that nothing reads, and reported as
|
|
589
|
+
* `applied: true`.
|
|
590
|
+
* - **A non-object in the middle.** `race` is a string, so `race.traits` would hang
|
|
591
|
+
* a property off it. Left to {@link setPath} the string is replaced by an object,
|
|
592
|
+
* and the next `resolveRace` calls `.toLowerCase()` on it — a `TypeError` several
|
|
593
|
+
* frames away that says nothing about sheets.
|
|
594
|
+
*
|
|
595
|
+
* @param state The sheet being patched
|
|
596
|
+
* @param path The dotted path the caller asked for
|
|
597
|
+
* @returns A sentence naming the problem, or '' when the path is writable
|
|
598
|
+
*/
|
|
488
599
|
function pathProblem(state, path) {
|
|
489
600
|
const keys = String(path).split('.');
|
|
490
601
|
const root = keys[0];
|
|
@@ -497,6 +608,8 @@ function pathProblem(state, path) {
|
|
|
497
608
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
498
609
|
const value = node[keys[i]];
|
|
499
610
|
if (value === undefined || value === null) {
|
|
611
|
+
// A new nested key under a real field is fine — `uses.rage` is how a
|
|
612
|
+
// feature pool is added.
|
|
500
613
|
return '';
|
|
501
614
|
}
|
|
502
615
|
if (typeof value !== 'object' || Array.isArray(value)) {
|
|
@@ -507,6 +620,13 @@ function pathProblem(state, path) {
|
|
|
507
620
|
}
|
|
508
621
|
return '';
|
|
509
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* Writes a dotted path into state, creating intermediate objects.
|
|
625
|
+
*
|
|
626
|
+
* Only ever called on a path {@link pathProblem} has cleared. The guard below is a
|
|
627
|
+
* backstop for a caller that forgets — silently replacing a non-object with `{}`
|
|
628
|
+
* corrupts the field it was meant to write inside.
|
|
629
|
+
*/
|
|
510
630
|
function setPath(state, path, value) {
|
|
511
631
|
const keys = path.split('.');
|
|
512
632
|
let node = state;
|
|
@@ -521,6 +641,11 @@ function setPath(state, path, value) {
|
|
|
521
641
|
}
|
|
522
642
|
node[keys[keys.length - 1]] = value;
|
|
523
643
|
}
|
|
644
|
+
/**
|
|
645
|
+
* Checks the invariants a sheet must satisfy after a direct edit.
|
|
646
|
+
* @param state The candidate state
|
|
647
|
+
* @returns A description of the first problem, or null when consistent
|
|
648
|
+
*/
|
|
524
649
|
function validate(state) {
|
|
525
650
|
if (!Number.isFinite(state.hp.max) || state.hp.max < 1) {
|
|
526
651
|
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,8 +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';
|
|
2
16
|
import { NativeToolDefinition } from '../native-tool.types';
|
|
3
17
|
import { dnd5eTools } from './dnd5e';
|
|
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
|
+
*/
|
|
6
54
|
export declare function registerPack(registry: NativeToolRegistry, name: string, tools: NativeToolDefinition[]): string[];
|
|
55
|
+
/** The names of the packs that ship with the package. */
|
|
7
56
|
export declare function availableToolPacks(): string[];
|
|
8
57
|
export { dnd5eTools };
|