briyah 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -7
- package/data/common/config/LICENSE-model-prices.md +65 -0
- package/data/common/config/model_prices.json +47443 -46295
- package/data/common/prompts/narrator/create_story.prompt +2 -0
- package/dist-sdk/server/src/ai/LLM/anthropic.service.d.ts +103 -0
- package/dist-sdk/server/src/ai/LLM/anthropic.service.js +173 -2
- package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +172 -3
- package/dist-sdk/server/src/ai/LLM/base-ai.service.js +241 -5
- package/dist-sdk/server/src/ai/LLM/comfyui-client.d.ts +26 -0
- package/dist-sdk/server/src/ai/LLM/comfyui-client.js +25 -0
- package/dist-sdk/server/src/ai/LLM/comfyui-workflow.d.ts +54 -0
- package/dist-sdk/server/src/ai/LLM/comfyui-workflow.js +59 -1
- package/dist-sdk/server/src/ai/LLM/comfyui.service.d.ts +21 -1
- package/dist-sdk/server/src/ai/LLM/comfyui.service.js +25 -1
- package/dist-sdk/server/src/ai/LLM/deepseek.service.d.ts +52 -0
- package/dist-sdk/server/src/ai/LLM/deepseek.service.js +102 -3
- package/dist-sdk/server/src/ai/LLM/fal.service.d.ts +25 -0
- package/dist-sdk/server/src/ai/LLM/fal.service.js +55 -1
- package/dist-sdk/server/src/ai/LLM/googleai.service.d.ts +19 -0
- package/dist-sdk/server/src/ai/LLM/googleai.service.js +42 -1
- package/dist-sdk/server/src/ai/LLM/grok.service.d.ts +22 -0
- package/dist-sdk/server/src/ai/LLM/grok.service.js +54 -2
- package/dist-sdk/server/src/ai/LLM/mock.service.js +31 -4
- package/dist-sdk/server/src/ai/LLM/openai.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/LLM/openai.service.js +80 -2
- package/dist-sdk/server/src/ai/LLM/self-hosted.service.d.ts +21 -0
- package/dist-sdk/server/src/ai/LLM/self-hosted.service.js +44 -2
- package/dist-sdk/server/src/ai/LLM/together.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/LLM/together.service.js +60 -2
- package/dist-sdk/server/src/ai/agent-config.d.ts +15 -0
- package/dist-sdk/server/src/ai/agent-factory.d.ts +16 -0
- package/dist-sdk/server/src/ai/agent-factory.js +20 -0
- package/dist-sdk/server/src/ai/agent-message.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/agent-message.service.js +30 -0
- package/dist-sdk/server/src/ai/agent-store.service.d.ts +80 -0
- package/dist-sdk/server/src/ai/agent-store.service.js +166 -5
- package/dist-sdk/server/src/ai/agent.d.ts +196 -0
- package/dist-sdk/server/src/ai/agent.js +224 -11
- package/dist-sdk/server/src/ai/ai-debug-logger.d.ts +18 -0
- package/dist-sdk/server/src/ai/ai-debug-logger.js +19 -0
- package/dist-sdk/server/src/ai/ai-factory.service.d.ts +9 -0
- package/dist-sdk/server/src/ai/ai-factory.service.js +9 -0
- package/dist-sdk/server/src/ai/artifact.service.d.ts +131 -0
- package/dist-sdk/server/src/ai/artifact.service.js +148 -3
- package/dist-sdk/server/src/ai/attached-file.service.d.ts +87 -0
- package/dist-sdk/server/src/ai/attached-file.service.js +105 -0
- package/dist-sdk/server/src/ai/model_prices.d.ts +30 -0
- package/dist-sdk/server/src/ai/model_prices.js +91 -5
- package/dist-sdk/server/src/ai/pack-artifacts.d.ts +84 -0
- package/dist-sdk/server/src/ai/pack-artifacts.js +168 -0
- package/dist-sdk/server/src/ai/published-agents.service.d.ts +25 -0
- package/dist-sdk/server/src/ai/published-agents.service.js +30 -3
- package/dist-sdk/server/src/app/balance-message.service.d.ts +24 -0
- package/dist-sdk/server/src/app/balance-message.service.js +24 -0
- package/dist-sdk/server/src/app/balance.module.d.ts +4 -0
- package/dist-sdk/server/src/app/balance.module.js +4 -0
- package/dist-sdk/server/src/app/balance.service.d.ts +37 -0
- package/dist-sdk/server/src/app/balance.service.js +54 -0
- package/dist-sdk/server/src/app/stripe.controller.d.ts +21 -0
- package/dist-sdk/server/src/app/stripe.controller.js +35 -0
- package/dist-sdk/server/src/app/stripe.service.d.ts +43 -0
- package/dist-sdk/server/src/app/stripe.service.js +62 -0
- package/dist-sdk/server/src/app/transaction.service.d.ts +27 -0
- package/dist-sdk/server/src/app/transaction.service.js +36 -0
- package/dist-sdk/server/src/app/user-service-factory.d.ts +8 -0
- package/dist-sdk/server/src/app/user-service-factory.js +38 -1
- package/dist-sdk/server/src/app/user-service-manager.d.ts +27 -0
- package/dist-sdk/server/src/app/user-service-manager.js +43 -0
- package/dist-sdk/server/src/app.controller.d.ts +87 -0
- package/dist-sdk/server/src/app.controller.js +272 -12
- package/dist-sdk/server/src/app.module.js +28 -6
- package/dist-sdk/server/src/app.service.d.ts +1661 -0
- package/dist-sdk/server/src/app.service.js +1837 -4
- package/dist-sdk/server/src/auth/agent-access.decorator.d.ts +17 -0
- package/dist-sdk/server/src/auth/agent-access.decorator.js +17 -0
- package/dist-sdk/server/src/auth/auth.controller.js +46 -0
- package/dist-sdk/server/src/auth/auth.module.js +3 -2
- package/dist-sdk/server/src/auth/auth.service.d.ts +33 -0
- package/dist-sdk/server/src/auth/auth.service.js +39 -3
- package/dist-sdk/server/src/auth/jwt-auth.guard.js +18 -0
- package/dist-sdk/server/src/auth/jwt.strategy.js +2 -2
- package/dist-sdk/server/src/auth/owner-only.decorator.d.ts +9 -0
- package/dist-sdk/server/src/auth/owner-only.decorator.js +9 -0
- package/dist-sdk/server/src/auth/phone-validation.service.d.ts +25 -0
- package/dist-sdk/server/src/auth/phone-validation.service.js +30 -0
- package/dist-sdk/server/src/auth/rate-limit.service.d.ts +19 -0
- package/dist-sdk/server/src/auth/rate-limit.service.js +24 -0
- package/dist-sdk/server/src/auth/room-access.decorator.d.ts +8 -0
- package/dist-sdk/server/src/auth/room-access.decorator.js +8 -0
- package/dist-sdk/server/src/auth/scopes.decorator.d.ts +7 -0
- package/dist-sdk/server/src/auth/scopes.decorator.js +7 -0
- package/dist-sdk/server/src/auth/scopes.guard.d.ts +16 -0
- package/dist-sdk/server/src/auth/scopes.guard.js +30 -0
- package/dist-sdk/server/src/auth/session.guard.d.ts +4 -0
- package/dist-sdk/server/src/auth/session.guard.js +8 -0
- package/dist-sdk/server/src/auth/twilio.service.d.ts +27 -0
- package/dist-sdk/server/src/auth/twilio.service.js +30 -4
- package/dist-sdk/server/src/auth/users.service.d.ts +30 -0
- package/dist-sdk/server/src/auth/users.service.js +42 -0
- package/dist-sdk/server/src/common/errors.d.ts +20 -0
- package/dist-sdk/server/src/common/errors.js +21 -0
- package/dist-sdk/server/src/config/env-config.d.ts +7 -0
- package/dist-sdk/server/src/config/prompt-resolver.d.ts +180 -0
- package/dist-sdk/server/src/config/prompt-resolver.js +182 -0
- package/dist-sdk/server/src/config/user-config.service.d.ts +59 -0
- package/dist-sdk/server/src/config/user-config.service.js +57 -0
- package/dist-sdk/server/src/config/user-paths.service.d.ts +61 -0
- package/dist-sdk/server/src/config/user-paths.service.js +67 -0
- package/dist-sdk/server/src/documents/pdf-conversion.d.ts +121 -1
- package/dist-sdk/server/src/documents/pdf-conversion.js +94 -0
- package/dist-sdk/server/src/packs/pack-instantiation.service.d.ts +98 -0
- package/dist-sdk/server/src/packs/pack-instantiation.service.js +99 -0
- package/dist-sdk/server/src/packs/pack-manifest.d.ts +100 -0
- package/dist-sdk/server/src/packs/pack-manifest.js +58 -0
- package/dist-sdk/server/src/packs/pack.service.d.ts +99 -1
- package/dist-sdk/server/src/packs/pack.service.js +98 -1
- package/dist-sdk/server/src/room/artifact-store.service.d.ts +27 -0
- package/dist-sdk/server/src/room/artifact-store.service.js +49 -3
- package/dist-sdk/server/src/room/artifact.d.ts +18 -0
- package/dist-sdk/server/src/room/message.d.ts +64 -0
- package/dist-sdk/server/src/room/message.js +77 -2
- package/dist-sdk/server/src/room/nickname.d.ts +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 +26 -0
- package/dist-sdk/server/src/room/room-factory.d.ts +12 -0
- package/dist-sdk/server/src/room/room-factory.js +14 -0
- package/dist-sdk/server/src/room/room-message.service.d.ts +28 -0
- package/dist-sdk/server/src/room/room-message.service.js +28 -0
- package/dist-sdk/server/src/room/room-store.service.d.ts +176 -0
- package/dist-sdk/server/src/room/room-store.service.js +238 -5
- package/dist-sdk/server/src/room/room.d.ts +878 -0
- package/dist-sdk/server/src/room/room.js +1291 -23
- 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 +103 -0
- 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 +398 -0
- package/dist-sdk/server/src/story/story.service.js +829 -25
- package/dist-sdk/server/src/tools/core/index.d.ts +22 -0
- package/dist-sdk/server/src/tools/core/index.js +22 -0
- 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 +176 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.d.ts +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.js +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.d.ts +46 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.js +40 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.d.ts +33 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.js +19 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.d.ts +37 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.d.ts +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.js +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.js +27 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.d.ts +36 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.js +32 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.d.ts +32 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.d.ts +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.js +20 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.d.ts +36 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.d.ts +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.js +21 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.d.ts +95 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.js +66 -2
- package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.d.ts +50 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.js +28 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.d.ts +92 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.js +152 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.d.ts +28 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.js +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.d.ts +31 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.js +36 -2
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.d.ts +261 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.js +401 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.d.ts +11 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.js +11 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.d.ts +65 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.js +67 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.d.ts +73 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.js +63 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.d.ts +66 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.js +59 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.d.ts +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.js +49 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.d.ts +42 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.js +59 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.d.ts +72 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.js +63 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.d.ts +57 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.js +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.d.ts +81 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.js +85 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.d.ts +60 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.js +64 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.d.ts +169 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.js +203 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +192 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +144 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.d.ts +56 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.js +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.d.ts +65 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.js +73 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/index.d.ts +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/index.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.d.ts +4 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.js +116 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.d.ts +14 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.js +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.js +35 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.d.ts +6 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.js +25 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.d.ts +7 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.d.ts +8 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.js +55 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +164 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +188 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +116 -0
- 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 +73 -0
- package/dist-sdk/server/src/tools/tool-execution.service.js +74 -0
- package/dist-sdk/server/src/tools/tool-store.service.d.ts +11 -0
- package/dist-sdk/server/src/tools/tool-store.service.js +13 -1
- package/dist-sdk/shared/types/app.types.d.ts +285 -13
- package/dist-sdk/shared/types/app.types.js +3 -0
- 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,3 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core tools: native tools that belong to the engine rather than to a domain.
|
|
3
|
+
*
|
|
4
|
+
* A pack ships the tools its game needs. These are the ones any pack would want
|
|
5
|
+
* and none should own — capabilities of a room, not of D&D or Acts. They are
|
|
6
|
+
* registered once, alongside the packs, and granted the same way: by name, in an
|
|
7
|
+
* agent's `toolNames`.
|
|
8
|
+
*
|
|
9
|
+
* The reason they cannot simply live in a pack is mechanical. `NativeToolRegistry`
|
|
10
|
+
* is a flat process-global map and `registerTool` overwrites a duplicate name with
|
|
11
|
+
* only a log warning, so two packs shipping `rename_agent` would mean the one
|
|
12
|
+
* registered last silently won for every user of both. `packs.spec.ts` fails on
|
|
13
|
+
* any name claimed twice, core included.
|
|
14
|
+
*/
|
|
1
15
|
import { NativeToolDefinition } from '../native-tool.types';
|
|
16
|
+
/** The name the UI groups these under, in place of a pack name. */
|
|
2
17
|
export declare const CORE_TOOL_GROUP = "core";
|
|
18
|
+
/**
|
|
19
|
+
* Every core tool.
|
|
20
|
+
*
|
|
21
|
+
* A plain array for the same reasons a pack's is: testable without a registry, and
|
|
22
|
+
* an SDK host can register a subset.
|
|
23
|
+
* @returns The tool definitions
|
|
24
|
+
*/
|
|
3
25
|
export declare function coreTools(): NativeToolDefinition[];
|
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Core tools: native tools that belong to the engine rather than to a domain.
|
|
4
|
+
*
|
|
5
|
+
* A pack ships the tools its game needs. These are the ones any pack would want
|
|
6
|
+
* and none should own — capabilities of a room, not of D&D or Acts. They are
|
|
7
|
+
* registered once, alongside the packs, and granted the same way: by name, in an
|
|
8
|
+
* agent's `toolNames`.
|
|
9
|
+
*
|
|
10
|
+
* The reason they cannot simply live in a pack is mechanical. `NativeToolRegistry`
|
|
11
|
+
* is a flat process-global map and `registerTool` overwrites a duplicate name with
|
|
12
|
+
* only a log warning, so two packs shipping `rename_agent` would mean the one
|
|
13
|
+
* registered last silently won for every user of both. `packs.spec.ts` fails on
|
|
14
|
+
* any name claimed twice, core included.
|
|
15
|
+
*/
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.CORE_TOOL_GROUP = void 0;
|
|
4
18
|
exports.coreTools = coreTools;
|
|
5
19
|
const rename_tool_1 = require("./rename.tool");
|
|
20
|
+
/** The name the UI groups these under, in place of a pack name. */
|
|
6
21
|
exports.CORE_TOOL_GROUP = 'core';
|
|
22
|
+
/**
|
|
23
|
+
* Every core tool.
|
|
24
|
+
*
|
|
25
|
+
* A plain array for the same reasons a pack's is: testable without a registry, and
|
|
26
|
+
* an SDK host can register a subset.
|
|
27
|
+
* @returns The tool definitions
|
|
28
|
+
*/
|
|
7
29
|
function coreTools() {
|
|
8
30
|
return [rename_tool_1.renameAgentTool];
|
|
9
31
|
}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `rename_agent` — give an agent the name its character is actually called.
|
|
3
|
+
*
|
|
4
|
+
* Core rather than pack-owned, because two packs cannot both ship a tool of this
|
|
5
|
+
* name: `NativeToolRegistry` is a flat process-global map whose `registerTool`
|
|
6
|
+
* overwrites a duplicate with a log warning, so whichever pack registered last
|
|
7
|
+
* would silently take the name for every user of both.
|
|
8
|
+
*/
|
|
1
9
|
import { NativeToolDefinition } from '../native-tool.types';
|
|
2
10
|
export declare const renameAgentTool: NativeToolDefinition;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `rename_agent` — give an agent the name its character is actually called.
|
|
4
|
+
*
|
|
5
|
+
* Core rather than pack-owned, because two packs cannot both ship a tool of this
|
|
6
|
+
* name: `NativeToolRegistry` is a flat process-global map whose `registerTool`
|
|
7
|
+
* overwrites a duplicate with a log warning, so whichever pack registered last
|
|
8
|
+
* would silently take the name for every user of both.
|
|
9
|
+
*/
|
|
2
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
11
|
exports.renameAgentTool = void 0;
|
|
4
12
|
const coerce_1 = require("../shared/coerce");
|
|
@@ -38,6 +46,9 @@ exports.renameAgentTool = {
|
|
|
38
46
|
'earlier messages still use the old one.',
|
|
39
47
|
};
|
|
40
48
|
}
|
|
49
|
+
// Rules refusals come back successfully with what is legal instead, rather
|
|
50
|
+
// than thrown: a colliding name is a ruling the caller acts on by asking for
|
|
51
|
+
// another, and reads as nothing like "the tool broke".
|
|
41
52
|
if (outcome.reason === 'ambiguous') {
|
|
42
53
|
return {
|
|
43
54
|
applied: false,
|
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
import { NativeToolDefinition } from './native-tool.types';
|
|
2
|
+
/**
|
|
3
|
+
* Process-level registry of native (host-implemented) tools.
|
|
4
|
+
*
|
|
5
|
+
* Native tools are registered once by the host — an SDK consumer via
|
|
6
|
+
* Briyah.registerTool, or the operator in the Nest bootstrap — and are shared
|
|
7
|
+
* across all users. Per-user/tenant isolation is NOT achieved here (a tool is
|
|
8
|
+
* global); it comes from the opaque context threaded to the handler and the
|
|
9
|
+
* existing per-user AppService boundary.
|
|
10
|
+
*/
|
|
2
11
|
export declare class NativeToolRegistry {
|
|
3
12
|
private tools;
|
|
13
|
+
/**
|
|
14
|
+
* Registers (or replaces) a native tool.
|
|
15
|
+
* @param def The native tool definition
|
|
16
|
+
*/
|
|
4
17
|
registerTool(def: NativeToolDefinition): void;
|
|
18
|
+
/**
|
|
19
|
+
* Registers multiple native tools.
|
|
20
|
+
* @param defs The native tool definitions
|
|
21
|
+
*/
|
|
5
22
|
registerTools(defs: NativeToolDefinition[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Removes a native tool.
|
|
25
|
+
* @param name The tool name
|
|
26
|
+
* @returns True if a tool was removed
|
|
27
|
+
*/
|
|
6
28
|
unregisterTool(name: string): boolean;
|
|
7
29
|
getTool(name: string): NativeToolDefinition | undefined;
|
|
8
30
|
has(name: string): boolean;
|
|
@@ -9,8 +9,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.NativeToolRegistry = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const logger_1 = require("../common/logger");
|
|
12
|
+
/**
|
|
13
|
+
* Process-level registry of native (host-implemented) tools.
|
|
14
|
+
*
|
|
15
|
+
* Native tools are registered once by the host — an SDK consumer via
|
|
16
|
+
* Briyah.registerTool, or the operator in the Nest bootstrap — and are shared
|
|
17
|
+
* across all users. Per-user/tenant isolation is NOT achieved here (a tool is
|
|
18
|
+
* global); it comes from the opaque context threaded to the handler and the
|
|
19
|
+
* existing per-user AppService boundary.
|
|
20
|
+
*/
|
|
12
21
|
let NativeToolRegistry = class NativeToolRegistry {
|
|
13
22
|
tools = new Map();
|
|
23
|
+
/**
|
|
24
|
+
* Registers (or replaces) a native tool.
|
|
25
|
+
* @param def The native tool definition
|
|
26
|
+
*/
|
|
14
27
|
registerTool(def) {
|
|
15
28
|
if (!def.name || !/^[a-zA-Z0-9_-]+$/.test(def.name)) {
|
|
16
29
|
throw new Error(`Invalid native tool name "${def.name}": use only letters, numbers, hyphens and underscores`);
|
|
@@ -23,10 +36,19 @@ let NativeToolRegistry = class NativeToolRegistry {
|
|
|
23
36
|
}
|
|
24
37
|
this.tools.set(def.name, def);
|
|
25
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Registers multiple native tools.
|
|
41
|
+
* @param defs The native tool definitions
|
|
42
|
+
*/
|
|
26
43
|
registerTools(defs) {
|
|
27
44
|
for (const def of defs)
|
|
28
45
|
this.registerTool(def);
|
|
29
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Removes a native tool.
|
|
49
|
+
* @param name The tool name
|
|
50
|
+
* @returns True if a tool was removed
|
|
51
|
+
*/
|
|
30
52
|
unregisterTool(name) {
|
|
31
53
|
return this.tools.delete(name);
|
|
32
54
|
}
|
|
@@ -1,58 +1,234 @@
|
|
|
1
1
|
import { ToolParameter } from '../../../shared/types/app.types';
|
|
2
|
+
/** Identifies the agent whose EXECUTE triggered this tool call. */
|
|
2
3
|
export interface ToolCaller {
|
|
4
|
+
/** The calling agent's nickname — the identity used for artifact creator/viewers. */
|
|
3
5
|
nickname: string;
|
|
6
|
+
/** True when a human drives this agent (it never takes an AI turn). */
|
|
4
7
|
isHuman: boolean;
|
|
8
|
+
/** True when the caller is the room leader. */
|
|
5
9
|
isLeader: boolean;
|
|
6
10
|
}
|
|
11
|
+
/** A room artifact as a tool sees it. Mirrors room/artifact.ts with viewers always resolved. */
|
|
7
12
|
export interface ToolArtifact {
|
|
8
13
|
name: string;
|
|
9
14
|
creator: string;
|
|
10
15
|
body: string;
|
|
11
16
|
viewers: string[];
|
|
17
|
+
/** True when the artifact is delivered per-turn rather than cached. */
|
|
12
18
|
transient: boolean;
|
|
13
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* What {@link ToolRoomAccess.renameAgent} did, or why it did nothing.
|
|
22
|
+
*
|
|
23
|
+
* A result rather than a boolean because the reason has to reach the model: a
|
|
24
|
+
* refusal for a name that would collide is a ruling the caller can act on by
|
|
25
|
+
* asking for another name, and is nothing like "no such agent".
|
|
26
|
+
*/
|
|
14
27
|
export interface RenameOutcome {
|
|
15
28
|
renamed: boolean;
|
|
29
|
+
/** The nickname the agent had. */
|
|
16
30
|
from?: string;
|
|
31
|
+
/** The nickname it has now — the first word of the name given. */
|
|
17
32
|
to?: string;
|
|
33
|
+
/** The full name it has now, which may be longer than the nickname. */
|
|
18
34
|
fullName?: string;
|
|
19
35
|
reason?: 'not_found' | 'ambiguous' | 'invalid' | 'unchanged';
|
|
36
|
+
/** For `ambiguous`, the agent the requested name would have collided with. */
|
|
20
37
|
conflictsWith?: string;
|
|
38
|
+
/** How many artifacts had their creator or viewers repointed. */
|
|
21
39
|
artifactsUpdated?: number;
|
|
22
40
|
}
|
|
41
|
+
/** How a tool wants an artifact written. */
|
|
23
42
|
export interface ArtifactWriteOptions {
|
|
43
|
+
/**
|
|
44
|
+
* The agents that may view the artifact. Omit to keep an existing artifact's
|
|
45
|
+
* viewers, or to default a new one to every agent in the room.
|
|
46
|
+
*
|
|
47
|
+
* Viewers matter for cost as well as secrecy: a viewer has the artifact
|
|
48
|
+
* rendered into its cached prompt, so every write invalidates that agent's
|
|
49
|
+
* cache. Scope narrowly and let agents read the rest through tool results.
|
|
50
|
+
*/
|
|
24
51
|
viewers?: string[];
|
|
52
|
+
/**
|
|
53
|
+
* The agent to credit as author. Omit to credit the calling agent. Only
|
|
54
|
+
* honored when the artifact is created, and ignored if it names no agent in
|
|
55
|
+
* the room. Use it when a tool writes on another agent's behalf — the
|
|
56
|
+
* creator counts as a viewer, so authorship decides who pays to see it.
|
|
57
|
+
*/
|
|
25
58
|
creator?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Deliver the artifact in each viewer's **transient** per-turn prompt instead
|
|
61
|
+
* of the cached block. Omit to leave an existing artifact's delivery as it is.
|
|
62
|
+
*
|
|
63
|
+
* An ordinary artifact is cached, so a write throws away every viewer's cached
|
|
64
|
+
* prefix — including their attached documents. A transient one costs nothing
|
|
65
|
+
* to write but is re-sent in full on every one of its viewers' turns. Mark
|
|
66
|
+
* state that is **small and changes constantly**; leave anything large and
|
|
67
|
+
* stable cached.
|
|
68
|
+
*/
|
|
26
69
|
transient?: boolean;
|
|
27
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Read/write access to the artifacts of the room a tool is executing in, plus
|
|
73
|
+
* the identity of the agent that called it. Lets a tool hold durable state that
|
|
74
|
+
* the agents can also read, instead of every tool having to be stateless or
|
|
75
|
+
* reach outside Briyah for storage.
|
|
76
|
+
*
|
|
77
|
+
* Every method is synchronous on purpose. The underlying store is synchronous
|
|
78
|
+
* (Room.publishArtifact -> ArtifactStoreService.saveArtifact -> writeFileSync),
|
|
79
|
+
* so a read-modify-write performed inside a single {@link update} call cannot be
|
|
80
|
+
* interleaved by the event loop. Handlers must therefore use `update` rather
|
|
81
|
+
* than `get` ... await ... `put`: concurrent tool calls do happen, since
|
|
82
|
+
* commissioned agents run their turns under Promise.allSettled.
|
|
83
|
+
*/
|
|
28
84
|
export interface ToolRoomAccess {
|
|
29
85
|
readonly caller: ToolCaller;
|
|
86
|
+
/** Nicknames of every agent in the room, in room order. */
|
|
30
87
|
readonly agentNicknames: string[];
|
|
31
88
|
readonly roomId: string;
|
|
32
89
|
readonly roomName: string;
|
|
90
|
+
/** @returns The named artifact, or undefined. Viewer scoping is not applied. */
|
|
33
91
|
get(name: string): ToolArtifact | undefined;
|
|
92
|
+
/** @returns The names of every artifact in the room, including ones the caller cannot view. */
|
|
34
93
|
list(): string[];
|
|
94
|
+
/**
|
|
95
|
+
* Creates or overwrites an artifact. A new artifact is credited to the
|
|
96
|
+
* calling agent and defaults to being viewable by every agent in the room;
|
|
97
|
+
* an existing one keeps its creator, and keeps its viewers unless new ones
|
|
98
|
+
* are given.
|
|
99
|
+
* @param name The artifact name (the room's primary key for artifacts)
|
|
100
|
+
* @param body The new body; must not be empty
|
|
101
|
+
* @param options Viewers and authorship — see {@link ArtifactWriteOptions}
|
|
102
|
+
* @returns The stored artifact
|
|
103
|
+
* @throws If `body` is empty — that would delete the artifact; use {@link remove}.
|
|
104
|
+
*/
|
|
35
105
|
put(name: string, body: string, options?: ArtifactWriteOptions): ToolArtifact;
|
|
106
|
+
/**
|
|
107
|
+
* Reads, mutates and writes an artifact without yielding to the event loop.
|
|
108
|
+
* @param name The artifact name
|
|
109
|
+
* @param mutate Receives the current artifact (or undefined if absent) and
|
|
110
|
+
* returns the new body, or null to leave the artifact untouched. Must not await.
|
|
111
|
+
* @param options Viewers and authorship — see {@link ArtifactWriteOptions}
|
|
112
|
+
* @returns The stored artifact, or undefined if `mutate` returned null
|
|
113
|
+
*/
|
|
36
114
|
update(name: string, mutate: (current: ToolArtifact | undefined) => string | null, options?: ArtifactWriteOptions): ToolArtifact | undefined;
|
|
115
|
+
/** @returns True if an artifact was found and deleted. */
|
|
37
116
|
remove(name: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Sets how an agent in this room is described to the others.
|
|
119
|
+
*
|
|
120
|
+
* The description is every agent's public identity: it is rendered into the
|
|
121
|
+
* roster of every other agent's *cached* prompt prefix, ahead of their
|
|
122
|
+
* attached documents. So a write invalidates the cached prefix for everyone
|
|
123
|
+
* in the room, and a tool that rewrites a description regularly will cost
|
|
124
|
+
* far more than it looks. Use it for facts that will not change again — who
|
|
125
|
+
* a character is, not what state they are in.
|
|
126
|
+
* @param nickname The agent to describe; must be in this room
|
|
127
|
+
* @param description The new description; trimmed, and capped at 500 characters
|
|
128
|
+
* @returns True if the agent was found and updated
|
|
129
|
+
* @throws If `description` is empty, which would leave the agent unidentifiable
|
|
130
|
+
*/
|
|
38
131
|
setDescription(nickname: string, description: string): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Renames an agent, and everything in the room that named it.
|
|
134
|
+
*
|
|
135
|
+
* A room routes by nickname and nothing else, so an agent whose character is
|
|
136
|
+
* called something different gives every other agent two names for one person:
|
|
137
|
+
* the game master addresses the character, the room has never heard of them,
|
|
138
|
+
* and the message goes nowhere useful. Renaming the agent to its character is
|
|
139
|
+
* how a pack collapses the two back into one name.
|
|
140
|
+
*
|
|
141
|
+
* The artifacts the agent created or can view are repointed with it, which is
|
|
142
|
+
* the part that fails silently otherwise — a player keeps their character sheet
|
|
143
|
+
* only because `viewers` was updated too.
|
|
144
|
+
*
|
|
145
|
+
* As expensive as {@link setDescription} and for the same reason: the roster
|
|
146
|
+
* sits in every agent's *cached* prompt prefix. Do it at character creation,
|
|
147
|
+
* when play has not started, rather than mid-scene.
|
|
148
|
+
*
|
|
149
|
+
* @param nickname The agent to rename, matched the way messages are routed
|
|
150
|
+
* @param newName The character's name; the routing nickname is its first word
|
|
151
|
+
* @returns What happened, including why when nothing did
|
|
152
|
+
*/
|
|
39
153
|
renameAgent(nickname: string, newName: string): RenameOutcome;
|
|
40
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Read access to the documents a pack ships in its `artifacts/` directory.
|
|
157
|
+
*
|
|
158
|
+
* Lets a pack's tools enumerate and read their own reference material instead of
|
|
159
|
+
* an operator having to attach each document to the right agent by hand. The
|
|
160
|
+
* files are the source of truth, so adding one is a file drop with nothing else
|
|
161
|
+
* to edit — which is what the 5e pack's twelve `class-*.md` documents rely on.
|
|
162
|
+
*
|
|
163
|
+
* Read-only, and synchronous for the same reason {@link ToolRoomAccess} is: a
|
|
164
|
+
* tool that reads a document and writes it into an artifact must not yield
|
|
165
|
+
* between the two.
|
|
166
|
+
*/
|
|
41
167
|
export interface ToolPackDocuments {
|
|
168
|
+
/**
|
|
169
|
+
* @param pack The pack whose documents to list, e.g. `dnd5e`
|
|
170
|
+
* @param prefix Keep only file names starting with this, case-insensitively
|
|
171
|
+
* @returns Bare `.md` file names, sorted; empty when the pack ships none
|
|
172
|
+
*/
|
|
42
173
|
list(pack: string, prefix?: string): string[];
|
|
174
|
+
/**
|
|
175
|
+
* @param pack The pack the document belongs to
|
|
176
|
+
* @param fileName A bare file name, as {@link list} returns
|
|
177
|
+
* @returns The document's text, or null when there is no such document
|
|
178
|
+
*/
|
|
43
179
|
read(pack: string, fileName: string): string | null;
|
|
44
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Capabilities Briyah provides to a tool at execution time. Distinct from the
|
|
183
|
+
* opaque {@link ToolContext}: helpers are Briyah-owned (e.g. an abort-wired
|
|
184
|
+
* fetch), context is host-owned.
|
|
185
|
+
*/
|
|
45
186
|
export interface ToolHelpers {
|
|
46
187
|
fetch: typeof fetch;
|
|
188
|
+
/**
|
|
189
|
+
* Access to the room the calling agent is in. Absent when there is no room,
|
|
190
|
+
* which today means the tool-test endpoint. Tools that need it should fail
|
|
191
|
+
* with a clear message rather than dereferencing it.
|
|
192
|
+
*/
|
|
47
193
|
room?: ToolRoomAccess;
|
|
194
|
+
/**
|
|
195
|
+
* The documents installed packs ship. Absent when the host wired no artifact
|
|
196
|
+
* store into the tool execution service, which today means a unit test.
|
|
197
|
+
*/
|
|
48
198
|
packDocuments?: ToolPackDocuments;
|
|
49
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* An opaque, per-invocation value supplied by the host when it starts an
|
|
202
|
+
* interaction (see AppService.sendRoomMessage). Briyah never inspects it — it
|
|
203
|
+
* is threaded verbatim to the tool handler. Hosts use it to scope a tool call
|
|
204
|
+
* to trusted data the LLM cannot influence (e.g. a database handle and the
|
|
205
|
+
* record the user currently has selected).
|
|
206
|
+
*/
|
|
50
207
|
export type ToolContext = unknown;
|
|
208
|
+
/**
|
|
209
|
+
* A tool implemented as a real function by the host process (an SDK consumer or
|
|
210
|
+
* the operator), as opposed to a user-authored ToolDefinition whose code is a
|
|
211
|
+
* stored string. Native tools are trusted, are never persisted, and are
|
|
212
|
+
* registered globally via `Briyah.registerTool`.
|
|
213
|
+
*/
|
|
51
214
|
export interface NativeToolDefinition {
|
|
215
|
+
/** Unique tool name (letters, numbers, hyphens, underscores). Referenced by agent.toolNames. */
|
|
52
216
|
name: string;
|
|
217
|
+
/** Human/LLM-facing description rendered into the agent's prompt. */
|
|
53
218
|
description: string;
|
|
219
|
+
/** Declared parameters the LLM may supply. Do NOT declare tenant-scoping here — use context. */
|
|
54
220
|
parameters: ToolParameter[];
|
|
221
|
+
/**
|
|
222
|
+
* The tool implementation. Receives the LLM-supplied `args`, Briyah's
|
|
223
|
+
* `helpers`, and the host's opaque `context`. Returns a JSON-serializable value.
|
|
224
|
+
*/
|
|
55
225
|
handler: (args: Record<string, any>, helpers: ToolHelpers, context: ToolContext) => Promise<any>;
|
|
226
|
+
/** Per-call timeout in ms (default 30_000, capped at 120_000). */
|
|
56
227
|
timeoutMs?: number;
|
|
228
|
+
/**
|
|
229
|
+
* The name of the tool pack this tool belongs to. Set by
|
|
230
|
+
* {@link registerToolPacks} rather than by the pack's own definitions, and
|
|
231
|
+
* used only to group the tool in the UI — resolution and execution ignore it.
|
|
232
|
+
*/
|
|
57
233
|
group?: string;
|
|
58
234
|
}
|
|
@@ -1 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The background *rule*. There is deliberately no background *table*.
|
|
3
|
+
*
|
|
4
|
+
* A background is the one piece of character creation the SRD hands over entirely.
|
|
5
|
+
* Its *Customizing a Background* rule says in as many words that you may replace the
|
|
6
|
+
* feature, choose any two skills, and choose any two tool proficiencies or
|
|
7
|
+
* languages — so a table inventing "Sailor" is playing by the book, and the SRD's own
|
|
8
|
+
* Acolyte is one example rather than the set of legal answers.
|
|
9
|
+
*
|
|
10
|
+
* So backgrounds are **content, not data**: each one is a `background-<name>.md`
|
|
11
|
+
* document in the pack's `artifacts/` directory, read through `rules_lookup` and
|
|
12
|
+
* shared with the player who takes it, exactly like a class document. A table adds one
|
|
13
|
+
* by dropping in a file. Acolyte ships as one of those files and is not special in any
|
|
14
|
+
* way — nothing here knows its name.
|
|
15
|
+
*
|
|
16
|
+
* The consequence, and it is the whole trade: **nothing about a background is applied
|
|
17
|
+
* automatically.** The two skills, the equipment package and the coin are passed in the
|
|
18
|
+
* `create_sheet` spec by whoever read the document, the same way a class's starting
|
|
19
|
+
* equipment always has been. A table of grants would have to be a table of *twelve*
|
|
20
|
+
* backgrounds to be worth having, and eleven of those are outside CC-BY-4.0 and must
|
|
21
|
+
* not live in `data/` — which is what made the one-entry table an oddity: the SRD's
|
|
22
|
+
* background behaved unlike every background anyone actually plays.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The rules that govern a background, quoted for `rules_lookup`.
|
|
26
|
+
*
|
|
27
|
+
* The customization sentence is the load-bearing one: it is what makes a background
|
|
28
|
+
* this pack ships no document for legal play rather than a houserule.
|
|
29
|
+
*/
|
|
1
30
|
export declare const BACKGROUNDS_RULE = "A background gives two skill proficiencies, often one or more tool proficiencies, sometimes extra languages, a package of starting equipment, and a feature. If a proficiency would duplicate one you already have, take a different one of the same kind. You may customize a background: replace its feature with another, choose any two skills, and choose any two tool proficiencies or languages. If you spend coin on gear instead, you do not take the background equipment package.";
|
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The background *rule*. There is deliberately no background *table*.
|
|
4
|
+
*
|
|
5
|
+
* A background is the one piece of character creation the SRD hands over entirely.
|
|
6
|
+
* Its *Customizing a Background* rule says in as many words that you may replace the
|
|
7
|
+
* feature, choose any two skills, and choose any two tool proficiencies or
|
|
8
|
+
* languages — so a table inventing "Sailor" is playing by the book, and the SRD's own
|
|
9
|
+
* Acolyte is one example rather than the set of legal answers.
|
|
10
|
+
*
|
|
11
|
+
* So backgrounds are **content, not data**: each one is a `background-<name>.md`
|
|
12
|
+
* document in the pack's `artifacts/` directory, read through `rules_lookup` and
|
|
13
|
+
* shared with the player who takes it, exactly like a class document. A table adds one
|
|
14
|
+
* by dropping in a file. Acolyte ships as one of those files and is not special in any
|
|
15
|
+
* way — nothing here knows its name.
|
|
16
|
+
*
|
|
17
|
+
* The consequence, and it is the whole trade: **nothing about a background is applied
|
|
18
|
+
* automatically.** The two skills, the equipment package and the coin are passed in the
|
|
19
|
+
* `create_sheet` spec by whoever read the document, the same way a class's starting
|
|
20
|
+
* equipment always has been. A table of grants would have to be a table of *twelve*
|
|
21
|
+
* backgrounds to be worth having, and eleven of those are outside CC-BY-4.0 and must
|
|
22
|
+
* not live in `data/` — which is what made the one-entry table an oddity: the SRD's
|
|
23
|
+
* background behaved unlike every background anyone actually plays.
|
|
24
|
+
*/
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.BACKGROUNDS_RULE = void 0;
|
|
27
|
+
/**
|
|
28
|
+
* The rules that govern a background, quoted for `rules_lookup`.
|
|
29
|
+
*
|
|
30
|
+
* The customization sentence is the load-bearing one: it is what makes a background
|
|
31
|
+
* this pack ships no document for legal play rather than a houserule.
|
|
32
|
+
*/
|
|
4
33
|
exports.BACKGROUNDS_RULE = 'A background gives two skill proficiencies, often one or more tool proficiencies, sometimes extra languages, a package of starting equipment, and a feature. If a proficiency would duplicate one you already have, take a different one of the same kind. You may customize a background: replace its feature with another, choose any two skills, and choose any two tool proficiencies or languages. If you spend coin on gear instead, you do not take the background equipment package.';
|
|
@@ -1,10 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SRD cantrips that make an attack roll.
|
|
3
|
+
*
|
|
4
|
+
* A deliberately small table beside `spells.ts` rather than fields added to it.
|
|
5
|
+
* `spells.ts` stores a spell's prose and says why: nothing in the pack computes from
|
|
6
|
+
* a spell's effect, because adjudicating "each creature in a 20-foot radius sphere"
|
|
7
|
+
* is the Dungeon Master's job. That decision stands. But an attack-roll cantrip is
|
|
8
|
+
* mechanically a weapon — a bonus, dice, a damage type, a range — and the sheet's
|
|
9
|
+
* `attacks` list is where the tools look for one.
|
|
10
|
+
*
|
|
11
|
+
* Without this a wizard's Fire Bolt is not rollable. `check` searches `attacks`, a
|
|
12
|
+
* cantrip lives in `spells`, and in a played campaign an evoker who chose Fire Bolt
|
|
13
|
+
* at creation was told *"Athena has no attack called \"Fire Bolt\". Listed attacks:
|
|
14
|
+
* Quarterstaff"* in the fight that killed her — she spent the encounter failing to
|
|
15
|
+
* cast her one reliable damage cantrip and ended it taking Disengage.
|
|
16
|
+
*
|
|
17
|
+
* Seven entries, and the list is closed: these are every SRD 5.1 cantrip resolved
|
|
18
|
+
* with an attack roll. A save-based cantrip (sacred flame, poison spray) is not an
|
|
19
|
+
* attack and does not belong here.
|
|
20
|
+
*
|
|
21
|
+
* Licensing is the same as the rest of `data/`: SRD 5.1 under CC-BY-4.0.
|
|
22
|
+
*/
|
|
1
23
|
export interface CantripAttack {
|
|
24
|
+
/** Damage dice at levels 1–4. A die is added at 5th, 11th and 17th. */
|
|
2
25
|
dmg: string;
|
|
3
26
|
type: string;
|
|
4
27
|
range: string;
|
|
28
|
+
/** What the spell does past damage, carried onto the attack as its rider. */
|
|
5
29
|
note?: string;
|
|
30
|
+
/**
|
|
31
|
+
* True when the spell scales by adding beams rather than dice. Each beam is a
|
|
32
|
+
* separate attack roll, so the damage stays as printed however high the level.
|
|
33
|
+
*/
|
|
6
34
|
beams?: boolean;
|
|
7
35
|
}
|
|
36
|
+
/** Every SRD attack-roll cantrip, keyed lowercase. */
|
|
8
37
|
export declare const CANTRIP_ATTACKS: Record<string, CantripAttack>;
|
|
38
|
+
/**
|
|
39
|
+
* How many damage dice a cantrip rolls at a given character level.
|
|
40
|
+
*
|
|
41
|
+
* Character level, not class level: a wizard 3 / cleric 3 casts a cantrip as a 6th
|
|
42
|
+
* level character and gets the 5th-level step.
|
|
43
|
+
* @param characterLevel The total level across all classes
|
|
44
|
+
* @returns The number of dice, 1 through 4
|
|
45
|
+
*/
|
|
9
46
|
export declare function cantripDice(characterLevel: number): number;
|
|
47
|
+
/**
|
|
48
|
+
* The damage expression for a cantrip at a level.
|
|
49
|
+
*
|
|
50
|
+
* A beam cantrip does not scale its dice — it gains beams, each rolled separately —
|
|
51
|
+
* so its printed damage stands at every level.
|
|
52
|
+
* @param cantrip The cantrip
|
|
53
|
+
* @param characterLevel The total level across all classes
|
|
54
|
+
* @returns A dice expression such as `2d10`
|
|
55
|
+
*/
|
|
10
56
|
export declare function cantripDamage(cantrip: CantripAttack, characterLevel: number): string;
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The SRD cantrips that make an attack roll.
|
|
4
|
+
*
|
|
5
|
+
* A deliberately small table beside `spells.ts` rather than fields added to it.
|
|
6
|
+
* `spells.ts` stores a spell's prose and says why: nothing in the pack computes from
|
|
7
|
+
* a spell's effect, because adjudicating "each creature in a 20-foot radius sphere"
|
|
8
|
+
* is the Dungeon Master's job. That decision stands. But an attack-roll cantrip is
|
|
9
|
+
* mechanically a weapon — a bonus, dice, a damage type, a range — and the sheet's
|
|
10
|
+
* `attacks` list is where the tools look for one.
|
|
11
|
+
*
|
|
12
|
+
* Without this a wizard's Fire Bolt is not rollable. `check` searches `attacks`, a
|
|
13
|
+
* cantrip lives in `spells`, and in a played campaign an evoker who chose Fire Bolt
|
|
14
|
+
* at creation was told *"Athena has no attack called \"Fire Bolt\". Listed attacks:
|
|
15
|
+
* Quarterstaff"* in the fight that killed her — she spent the encounter failing to
|
|
16
|
+
* cast her one reliable damage cantrip and ended it taking Disengage.
|
|
17
|
+
*
|
|
18
|
+
* Seven entries, and the list is closed: these are every SRD 5.1 cantrip resolved
|
|
19
|
+
* with an attack roll. A save-based cantrip (sacred flame, poison spray) is not an
|
|
20
|
+
* attack and does not belong here.
|
|
21
|
+
*
|
|
22
|
+
* Licensing is the same as the rest of `data/`: SRD 5.1 under CC-BY-4.0.
|
|
23
|
+
*/
|
|
2
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
25
|
exports.CANTRIP_ATTACKS = void 0;
|
|
4
26
|
exports.cantripDice = cantripDice;
|
|
5
27
|
exports.cantripDamage = cantripDamage;
|
|
28
|
+
/** Every SRD attack-roll cantrip, keyed lowercase. */
|
|
6
29
|
exports.CANTRIP_ATTACKS = {
|
|
7
30
|
'fire bolt': {
|
|
8
31
|
dmg: '1d10',
|
|
@@ -48,6 +71,14 @@ exports.CANTRIP_ATTACKS = {
|
|
|
48
71
|
note: 'One beam at 1st level, and another at 5th, 11th and 17th. Each beam is a separate attack roll, rolled one call at a time or batched together.',
|
|
49
72
|
},
|
|
50
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* How many damage dice a cantrip rolls at a given character level.
|
|
76
|
+
*
|
|
77
|
+
* Character level, not class level: a wizard 3 / cleric 3 casts a cantrip as a 6th
|
|
78
|
+
* level character and gets the 5th-level step.
|
|
79
|
+
* @param characterLevel The total level across all classes
|
|
80
|
+
* @returns The number of dice, 1 through 4
|
|
81
|
+
*/
|
|
51
82
|
function cantripDice(characterLevel) {
|
|
52
83
|
if (characterLevel >= 17)
|
|
53
84
|
return 4;
|
|
@@ -57,6 +88,15 @@ function cantripDice(characterLevel) {
|
|
|
57
88
|
return 2;
|
|
58
89
|
return 1;
|
|
59
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* The damage expression for a cantrip at a level.
|
|
93
|
+
*
|
|
94
|
+
* A beam cantrip does not scale its dice — it gains beams, each rolled separately —
|
|
95
|
+
* so its printed damage stands at every level.
|
|
96
|
+
* @param cantrip The cantrip
|
|
97
|
+
* @param characterLevel The total level across all classes
|
|
98
|
+
* @returns A dice expression such as `2d10`
|
|
99
|
+
*/
|
|
60
100
|
function cantripDamage(cantrip, characterLevel) {
|
|
61
101
|
const match = /^(\d+)d(\d+)$/.exec(cantrip.dmg);
|
|
62
102
|
if (!match)
|
|
@@ -1,14 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feats from the System Reference Document 5.1.
|
|
3
|
+
*
|
|
4
|
+
* There is exactly **one**: Grappler. That is not an oversight in this file — the
|
|
5
|
+
* SRD carries the feats *rule* and a single worked example, and the rest of 5e's
|
|
6
|
+
* feats are outside what Wizards released under CC-BY-4.0, so they must not be
|
|
7
|
+
* added here (see LICENSE-SRD.md).
|
|
8
|
+
*
|
|
9
|
+
* Which makes the shape the point rather than the table. Almost every real table
|
|
10
|
+
* plays with feats beyond this one, so `level_up` accepts a feat by name whether or
|
|
11
|
+
* not it is here: a known feat gets its prerequisite checked and its grants
|
|
12
|
+
* applied, and an unknown one is recorded with a note that `patch_sheet` applies
|
|
13
|
+
* the mechanics. That is the same arrangement class features already have.
|
|
14
|
+
*/
|
|
1
15
|
import { AbilityKey } from './srd';
|
|
2
16
|
export interface FeatPrerequisite {
|
|
17
|
+
/** Minimum ability scores, e.g. { str: 13 }. */
|
|
3
18
|
abil?: Partial<Record<AbilityKey, number>>;
|
|
19
|
+
/** Anything not expressible as a number, for the Dungeon Master to judge. */
|
|
4
20
|
text?: string;
|
|
5
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* What a feat grants that a tool can apply.
|
|
24
|
+
*
|
|
25
|
+
* Deliberately narrow. A feat's interesting half is almost always prose — Grappler's
|
|
26
|
+
* advantage on attacks against a creature you are grappling has no field to live in
|
|
27
|
+
* — and inventing structure for it would mean guessing. Anything not here stays in
|
|
28
|
+
* `text` for the table to apply, which is the same call the magic items make.
|
|
29
|
+
*/
|
|
6
30
|
export interface FeatGrants {
|
|
7
31
|
abil?: Partial<Record<AbilityKey, number>>;
|
|
8
32
|
skills?: string[];
|
|
33
|
+
/** Weapon proficiencies, by `WEAPONS` key. */
|
|
9
34
|
weapons?: string[];
|
|
35
|
+
/** Damage types resisted. */
|
|
10
36
|
resist?: string[];
|
|
37
|
+
/** Feet added to walking speed. */
|
|
11
38
|
speed?: number;
|
|
39
|
+
/** Limited-use features the feat grants, keyed as `uses` entries are. */
|
|
12
40
|
uses?: Record<string, {
|
|
13
41
|
max: number;
|
|
14
42
|
reset: 'short' | 'long';
|
|
@@ -20,5 +48,10 @@ export interface FeatRules {
|
|
|
20
48
|
grants?: FeatGrants;
|
|
21
49
|
text: string;
|
|
22
50
|
}
|
|
51
|
+
/** The feats in SRD 5.1, keyed by lowercase name. */
|
|
23
52
|
export declare const SRD_FEATS: Record<string, FeatRules>;
|
|
53
|
+
/**
|
|
54
|
+
* The rule that governs taking one at all, quoted for `rules_lookup` so the DM can
|
|
55
|
+
* settle the question without the document in front of them.
|
|
56
|
+
*/
|
|
24
57
|
export declare const FEATS_RULE = "At the levels where your class grants an Ability Score Improvement, you may forgo it to take a feat instead \u2014 one or the other, never both. You can take each feat only once unless it says otherwise, and you must meet its prerequisite. Losing the prerequisite suspends the feat until you regain it.";
|