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
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Agent } from '../../ai/agent';
|
|
2
|
+
import { ArtifactService } from '../../ai/artifact.service';
|
|
3
|
+
/**
|
|
4
|
+
* The three agents that make a picture. None of them is ever a member of the
|
|
5
|
+
* room they work for: in broadcast turn mode `selectResponders` returns every
|
|
6
|
+
* agent in the room, so a member illustrator would be prompted on every message.
|
|
7
|
+
* They are held by id and driven directly.
|
|
8
|
+
*/
|
|
9
|
+
export interface IllustrationAgentIds {
|
|
10
|
+
illustratorAgentId?: string;
|
|
11
|
+
artistAgentId?: string;
|
|
12
|
+
artistEditAgentId?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The resolved trio, with `artistEdit` absent when the model has no editing variant. */
|
|
15
|
+
export interface IllustrationAgents {
|
|
16
|
+
illustrator: Agent;
|
|
17
|
+
artist: Agent;
|
|
18
|
+
artistEdit: Agent | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Everything the pipeline needs that differs between a story and a plain room.
|
|
22
|
+
*
|
|
23
|
+
* Deliberately a descriptor of plain accessors rather than a `Room` or a
|
|
24
|
+
* `StoryInfo`: the service must not learn what a story is. Same reasoning as
|
|
25
|
+
* `Room.buildToolRoomAccess`, which is a closure so that the tool-facing contract
|
|
26
|
+
* never drags the room graph into it.
|
|
27
|
+
*
|
|
28
|
+
* This indirection is also what makes the extraction safe for existing stories.
|
|
29
|
+
* A story's target reports the directory its images are already in and the
|
|
30
|
+
* `/api/stories/...` URL already baked into its saved message bodies, so nothing
|
|
31
|
+
* moves and no stored transcript goes stale.
|
|
32
|
+
*/
|
|
33
|
+
export interface IllustrationTarget {
|
|
34
|
+
/** storyId or roomId. Used for logging and as the in-flight lock key. */
|
|
35
|
+
readonly key: string;
|
|
36
|
+
/** Agent-name prefix, so the agents read as "<label> - Illustrator". */
|
|
37
|
+
readonly label: string;
|
|
38
|
+
/** Where the three agents persist. */
|
|
39
|
+
readonly agentsDir: string;
|
|
40
|
+
/** Where image bytes live. Story: stories/<id>/artifacts. Room: rooms/<id>/images. */
|
|
41
|
+
readonly artifacts: ArtifactService;
|
|
42
|
+
/** Builds the markdown link for a stored image. */
|
|
43
|
+
imageUrl(artifactId: string): string;
|
|
44
|
+
/** Names the finished image artifact, e.g. `Story image - 7`. */
|
|
45
|
+
imageName(sequence: number): string;
|
|
46
|
+
/** Feeds `describe_character`: a story's scenario, or a room's goal. */
|
|
47
|
+
scenario(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Whether a narrator writes the prose being illustrated.
|
|
50
|
+
*
|
|
51
|
+
* Renders the `{{#if narrator}}` branches of `describe_scene.prompt`. A story
|
|
52
|
+
* has one and its wording is what that prompt was written around; an ordinary
|
|
53
|
+
* room has recent messages and no narration, and being told to read "the most
|
|
54
|
+
* recent narration from the narrator" would send the illustrator looking for
|
|
55
|
+
* something that is not there.
|
|
56
|
+
*/
|
|
57
|
+
readonly narrated: boolean;
|
|
58
|
+
/** The chosen entry in image_models.json. Absent, or "No images", disables. */
|
|
59
|
+
imageModelName(): string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* A text service/model for the illustrator, which writes the image prompt and
|
|
62
|
+
* so must never be the image model — a ComfyUI-backed agent throws on a text
|
|
63
|
+
* prompt. Absent means the caller creates its agents itself, as a story does at
|
|
64
|
+
* creation time; the pipeline then only ever loads them.
|
|
65
|
+
*/
|
|
66
|
+
textModel?(): {
|
|
67
|
+
service: string;
|
|
68
|
+
model: string;
|
|
69
|
+
} | null;
|
|
70
|
+
agentIds(): IllustrationAgentIds;
|
|
71
|
+
/**
|
|
72
|
+
* Persists lazily-created agent ids. A story writes them to `StoryInfo`; a room
|
|
73
|
+
* writes a sidecar beside its images and **never** to `RoomConfig`, because
|
|
74
|
+
* `cloneRoomAsPublished` copies every setting verbatim into each published
|
|
75
|
+
* instance and a template must not share one illustrator's history with them.
|
|
76
|
+
*/
|
|
77
|
+
saveAgentIds(ids: IllustrationAgentIds): void;
|
|
78
|
+
}
|
|
79
|
+
/** One request for a picture. */
|
|
80
|
+
export interface IllustrationRequest {
|
|
81
|
+
/** The scene to draw. Supplied by the caller, never read off the room — the room's
|
|
82
|
+
* `currentSituation` holds the raw preamble, a story's holds the parsed text. */
|
|
83
|
+
situation: string;
|
|
84
|
+
situationTime?: string;
|
|
85
|
+
/** Recent prose to push into the illustrator's rolling history. */
|
|
86
|
+
narration?: string;
|
|
87
|
+
/** An explicit brief from the `illustrate` tool. Absent on the automatic path. */
|
|
88
|
+
brief?: string;
|
|
89
|
+
/** Who or what the caller asked to be shown, by the names the room uses. */
|
|
90
|
+
subjects?: string[];
|
|
91
|
+
/** Nickname of the agent that asked, for logging and the per-turn cap. */
|
|
92
|
+
requestedBy?: string;
|
|
93
|
+
/** Sequence number for `imageName`. A story passes its turn number. */
|
|
94
|
+
sequence?: number;
|
|
95
|
+
/**
|
|
96
|
+
* False on the second pass of the reference recursion. A brand-new setting is
|
|
97
|
+
* drawn as a character-free reference first, then this method runs again to
|
|
98
|
+
* draw the actual scene on top of it; without the flag that would recurse.
|
|
99
|
+
*/
|
|
100
|
+
allowReference?: boolean;
|
|
101
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Message, MessageAction } from '../../../shared/types/app.types';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a message exchanged between conversations in a Room
|
|
4
|
+
*/
|
|
2
5
|
export declare class RoomMessage implements Message {
|
|
3
6
|
sender: string;
|
|
4
7
|
action: MessageAction;
|
|
@@ -9,13 +12,74 @@ export declare class RoomMessage implements Message {
|
|
|
9
12
|
situation?: string;
|
|
10
13
|
changes?: Record<string, any>;
|
|
11
14
|
index?: number;
|
|
15
|
+
/**
|
|
16
|
+
* On a moderator's routing answer: the action the relayed message should carry
|
|
17
|
+
* in the room, rather than staying a MODERATE.
|
|
18
|
+
*
|
|
19
|
+
* A moderated message with no `relayAs` is stored in every recipient's history
|
|
20
|
+
* as `From: <sender>\n<content>` (see Agent.addToConversationHistory), which is
|
|
21
|
+
* what a story character expects and what a room agent that speaks the JSON
|
|
22
|
+
* protocol does not — half its history would model the wrong output format.
|
|
23
|
+
* Naming an action here makes the relayed message an ordinary room message: the
|
|
24
|
+
* right shape in history, and the right badge in the transcript.
|
|
25
|
+
*
|
|
26
|
+
* Only moderators whose `moderate.json` declares the field can produce it, so a
|
|
27
|
+
* moderator that says nothing keeps the original behaviour.
|
|
28
|
+
*/
|
|
12
29
|
relayAs?: MessageAction;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new Message
|
|
32
|
+
*
|
|
33
|
+
* **Every name on a message is an `agentNickname`**, never an `agentName`. The
|
|
34
|
+
* nickname is what the room routes by, what an agent writes into `targets`, and
|
|
35
|
+
* what artifact viewers and the room leader are recorded as. `agentName` is a
|
|
36
|
+
* label — it names the role, carries the room's name as a prefix, and nothing
|
|
37
|
+
* resolves it. The parameters here said otherwise for a long time while every
|
|
38
|
+
* caller passed a nickname.
|
|
39
|
+
*
|
|
40
|
+
* @param sender The agentNickname of the agent sending the message
|
|
41
|
+
* @param content The content of the message
|
|
42
|
+
* @param action The action type of the message
|
|
43
|
+
* @param targets Array of agentNicknames that will receive the message
|
|
44
|
+
* @param name Optional name for PUBLISH and EXECUTE actions
|
|
45
|
+
* @param situation Optional situation update to set the current story situation
|
|
46
|
+
*/
|
|
13
47
|
constructor(sender: string, action: MessageAction, content: string, targets?: string[], name?: string, situation?: string);
|
|
48
|
+
/**
|
|
49
|
+
* Gets the sender of the message
|
|
50
|
+
* @returns The agentNickname of the sender
|
|
51
|
+
*/
|
|
14
52
|
getSender(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the action type of the message
|
|
55
|
+
* @returns The message action
|
|
56
|
+
*/
|
|
15
57
|
getAction(): MessageAction;
|
|
58
|
+
/**
|
|
59
|
+
* Gets the content of the message
|
|
60
|
+
* @returns The message content
|
|
61
|
+
*/
|
|
16
62
|
getContent(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the targets of the message
|
|
65
|
+
* @returns Array of agentNicknames of target conversations
|
|
66
|
+
*/
|
|
17
67
|
getTargets(): string[];
|
|
68
|
+
/**
|
|
69
|
+
* Gets the timestamp when the message was created
|
|
70
|
+
* @returns The message timestamp
|
|
71
|
+
*/
|
|
18
72
|
getTimestamp(): Date;
|
|
73
|
+
/**
|
|
74
|
+
* Checks if an agent is a target of this message (intended recipient)
|
|
75
|
+
* @param agentNickname The agentNickname to check
|
|
76
|
+
* @returns True if the conversation is a target, false otherwise
|
|
77
|
+
*/
|
|
19
78
|
isTarget(agentNickname: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Checks if a conversation can hear this message
|
|
81
|
+
* @param agentNickname The agentNickname to check
|
|
82
|
+
* @returns True if the conversation can hear the message, false otherwise
|
|
83
|
+
*/
|
|
20
84
|
canHear(agentNickname: string): boolean;
|
|
21
85
|
}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RoomMessage = void 0;
|
|
4
4
|
const app_types_1 = require("../../../shared/types/app.types");
|
|
5
|
+
/**
|
|
6
|
+
* Represents a message exchanged between conversations in a Room
|
|
7
|
+
*/
|
|
5
8
|
class RoomMessage {
|
|
6
9
|
sender;
|
|
7
10
|
action;
|
|
@@ -9,10 +12,41 @@ class RoomMessage {
|
|
|
9
12
|
targets;
|
|
10
13
|
timestamp;
|
|
11
14
|
name;
|
|
12
|
-
situation;
|
|
13
|
-
changes;
|
|
15
|
+
situation; // Optional situation update (usually from narrator)
|
|
16
|
+
changes; // Generic story state changes from moderator (e.g. { update_portrait: [...] })
|
|
14
17
|
index;
|
|
18
|
+
/**
|
|
19
|
+
* On a moderator's routing answer: the action the relayed message should carry
|
|
20
|
+
* in the room, rather than staying a MODERATE.
|
|
21
|
+
*
|
|
22
|
+
* A moderated message with no `relayAs` is stored in every recipient's history
|
|
23
|
+
* as `From: <sender>\n<content>` (see Agent.addToConversationHistory), which is
|
|
24
|
+
* what a story character expects and what a room agent that speaks the JSON
|
|
25
|
+
* protocol does not — half its history would model the wrong output format.
|
|
26
|
+
* Naming an action here makes the relayed message an ordinary room message: the
|
|
27
|
+
* right shape in history, and the right badge in the transcript.
|
|
28
|
+
*
|
|
29
|
+
* Only moderators whose `moderate.json` declares the field can produce it, so a
|
|
30
|
+
* moderator that says nothing keeps the original behaviour.
|
|
31
|
+
*/
|
|
15
32
|
relayAs;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new Message
|
|
35
|
+
*
|
|
36
|
+
* **Every name on a message is an `agentNickname`**, never an `agentName`. The
|
|
37
|
+
* nickname is what the room routes by, what an agent writes into `targets`, and
|
|
38
|
+
* what artifact viewers and the room leader are recorded as. `agentName` is a
|
|
39
|
+
* label — it names the role, carries the room's name as a prefix, and nothing
|
|
40
|
+
* resolves it. The parameters here said otherwise for a long time while every
|
|
41
|
+
* caller passed a nickname.
|
|
42
|
+
*
|
|
43
|
+
* @param sender The agentNickname of the agent sending the message
|
|
44
|
+
* @param content The content of the message
|
|
45
|
+
* @param action The action type of the message
|
|
46
|
+
* @param targets Array of agentNicknames that will receive the message
|
|
47
|
+
* @param name Optional name for PUBLISH and EXECUTE actions
|
|
48
|
+
* @param situation Optional situation update to set the current story situation
|
|
49
|
+
*/
|
|
16
50
|
constructor(sender, action = app_types_1.MessageAction.SPEAK, content, targets = [], name, situation) {
|
|
17
51
|
this.sender = sender;
|
|
18
52
|
this.action = action;
|
|
@@ -22,27 +56,57 @@ class RoomMessage {
|
|
|
22
56
|
this.timestamp = new Date();
|
|
23
57
|
this.situation = situation;
|
|
24
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets the sender of the message
|
|
61
|
+
* @returns The agentNickname of the sender
|
|
62
|
+
*/
|
|
25
63
|
getSender() {
|
|
26
64
|
return this.sender;
|
|
27
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Gets the action type of the message
|
|
68
|
+
* @returns The message action
|
|
69
|
+
*/
|
|
28
70
|
getAction() {
|
|
29
71
|
return this.action;
|
|
30
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Gets the content of the message
|
|
75
|
+
* @returns The message content
|
|
76
|
+
*/
|
|
31
77
|
getContent() {
|
|
32
78
|
return this.content;
|
|
33
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Gets the targets of the message
|
|
82
|
+
* @returns Array of agentNicknames of target conversations
|
|
83
|
+
*/
|
|
34
84
|
getTargets() {
|
|
35
85
|
return [...this.targets];
|
|
36
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets the timestamp when the message was created
|
|
89
|
+
* @returns The message timestamp
|
|
90
|
+
*/
|
|
37
91
|
getTimestamp() {
|
|
38
92
|
return this.timestamp;
|
|
39
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Checks if an agent is a target of this message (intended recipient)
|
|
96
|
+
* @param agentNickname The agentNickname to check
|
|
97
|
+
* @returns True if the conversation is a target, false otherwise
|
|
98
|
+
*/
|
|
40
99
|
isTarget(agentNickname) {
|
|
100
|
+
// For SHOUT, everyone is a target
|
|
41
101
|
if (this.action === app_types_1.MessageAction.SHOUT)
|
|
42
102
|
return true;
|
|
103
|
+
// For THINK, only the sender is a target
|
|
43
104
|
if (this.action === app_types_1.MessageAction.THINK) {
|
|
44
105
|
return this.sender === agentNickname;
|
|
45
106
|
}
|
|
107
|
+
// For WHISPER, RELAY, RELAY_SILENT, COMMISSION, and DELIVER, only specific
|
|
108
|
+
// agents are targets (COMMISSION targets the commissioned agents; DELIVER
|
|
109
|
+
// targets the commissioner)
|
|
46
110
|
if (this.action === app_types_1.MessageAction.WHISPER ||
|
|
47
111
|
this.action === app_types_1.MessageAction.RELAY ||
|
|
48
112
|
this.action === app_types_1.MessageAction.RELAY_SILENT ||
|
|
@@ -50,15 +114,22 @@ class RoomMessage {
|
|
|
50
114
|
this.action === app_types_1.MessageAction.DELIVER) {
|
|
51
115
|
return this.targets.includes(agentNickname);
|
|
52
116
|
}
|
|
117
|
+
// For SPEAK with targets, only those in the targets list are targets
|
|
53
118
|
if (this.targets.length > 0) {
|
|
54
119
|
return this.targets.includes(agentNickname);
|
|
55
120
|
}
|
|
56
121
|
return false;
|
|
57
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Checks if a conversation can hear this message
|
|
125
|
+
* @param agentNickname The agentNickname to check
|
|
126
|
+
* @returns True if the conversation can hear the message, false otherwise
|
|
127
|
+
*/
|
|
58
128
|
canHear(agentNickname) {
|
|
59
129
|
if (this.sender === agentNickname) {
|
|
60
130
|
return false;
|
|
61
131
|
}
|
|
132
|
+
// TOOL messages are log-only notices of tool executions; no agent perceives them
|
|
62
133
|
if (this.action === app_types_1.MessageAction.TOOL)
|
|
63
134
|
return false;
|
|
64
135
|
if (this.action === app_types_1.MessageAction.RELAY || this.action === app_types_1.MessageAction.RELAY_SILENT)
|
|
@@ -67,9 +138,13 @@ class RoomMessage {
|
|
|
67
138
|
return this.targets.includes(agentNickname) || this.targets.length === 0;
|
|
68
139
|
if (this.action === app_types_1.MessageAction.EXECUTE)
|
|
69
140
|
return this.targets.includes(agentNickname) || this.targets.length === 0;
|
|
141
|
+
// For WHISPER, only specific targets can hear
|
|
70
142
|
if (this.action === app_types_1.MessageAction.WHISPER) {
|
|
71
143
|
return this.targets.includes(agentNickname);
|
|
72
144
|
}
|
|
145
|
+
// For SPEAK, SHOUT, ADJOURN, COMMISSION, and DELIVER everyone can hear
|
|
146
|
+
// (COMMISSION/DELIVER are public like SPEAK; only the commissioner responds,
|
|
147
|
+
// which the room's commission orchestration enforces)
|
|
73
148
|
return true;
|
|
74
149
|
}
|
|
75
150
|
}
|
|
@@ -1 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What makes two nicknames indistinguishable to the room.
|
|
3
|
+
*
|
|
4
|
+
* A room routes by nickname, and `Room.checkAgentNicknameMatch` is deliberately
|
|
5
|
+
* loose: case-insensitive, and it also accepts a nickname's first word. That
|
|
6
|
+
* looseness is what lets a Dungeon Master write "Thorin" for "Thorin Oakenshield",
|
|
7
|
+
* and it is also what makes two nicknames collide without being equal.
|
|
8
|
+
*
|
|
9
|
+
* Pure, and free of Nest, the filesystem and any domain: it is engine logic that
|
|
10
|
+
* happens to have been written first for the RPG page's roster check, and both the
|
|
11
|
+
* roster and {@link Room.renameAgent} need the same answer.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* True when some name a message could be addressed to would reach both of these.
|
|
15
|
+
*
|
|
16
|
+
* Note the test is not whether the two names match each other — "Thorin
|
|
17
|
+
* Oakenshield" and "Thorin Stonehelm" do not, since the matcher compares one
|
|
18
|
+
* side's first word against the other's whole name. It is whether a *third* string
|
|
19
|
+
* matches both, and "Thorin" matches both. Since the only strings the matcher can
|
|
20
|
+
* match are a full name and a first word, comparing the two names' full/first-word
|
|
21
|
+
* sets settles it.
|
|
22
|
+
*
|
|
23
|
+
* @param a One nickname
|
|
24
|
+
* @param b The other
|
|
25
|
+
* @returns True when a single name could route to either
|
|
26
|
+
*/
|
|
1
27
|
export declare function nicknamesAreAmbiguous(a: string, b: string): boolean;
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What makes two nicknames indistinguishable to the room.
|
|
4
|
+
*
|
|
5
|
+
* A room routes by nickname, and `Room.checkAgentNicknameMatch` is deliberately
|
|
6
|
+
* loose: case-insensitive, and it also accepts a nickname's first word. That
|
|
7
|
+
* looseness is what lets a Dungeon Master write "Thorin" for "Thorin Oakenshield",
|
|
8
|
+
* and it is also what makes two nicknames collide without being equal.
|
|
9
|
+
*
|
|
10
|
+
* Pure, and free of Nest, the filesystem and any domain: it is engine logic that
|
|
11
|
+
* happens to have been written first for the RPG page's roster check, and both the
|
|
12
|
+
* roster and {@link Room.renameAgent} need the same answer.
|
|
13
|
+
*/
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
15
|
exports.nicknamesAreAmbiguous = nicknamesAreAmbiguous;
|
|
16
|
+
/**
|
|
17
|
+
* True when some name a message could be addressed to would reach both of these.
|
|
18
|
+
*
|
|
19
|
+
* Note the test is not whether the two names match each other — "Thorin
|
|
20
|
+
* Oakenshield" and "Thorin Stonehelm" do not, since the matcher compares one
|
|
21
|
+
* side's first word against the other's whole name. It is whether a *third* string
|
|
22
|
+
* matches both, and "Thorin" matches both. Since the only strings the matcher can
|
|
23
|
+
* match are a full name and a first word, comparing the two names' full/first-word
|
|
24
|
+
* sets settles it.
|
|
25
|
+
*
|
|
26
|
+
* @param a One nickname
|
|
27
|
+
* @param b The other
|
|
28
|
+
* @returns True when a single name could route to either
|
|
29
|
+
*/
|
|
4
30
|
function nicknamesAreAmbiguous(a, b) {
|
|
5
31
|
const keys = (name) => {
|
|
6
32
|
const trimmed = (name || '').trim();
|
|
@@ -99,7 +99,9 @@ let PublishedRoomsService = class PublishedRoomsService {
|
|
|
99
99
|
}
|
|
100
100
|
getPublishedRoomsForUser(userId) {
|
|
101
101
|
return (Array.from(this.mapping.entries())
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
102
103
|
.filter(([_roomId, uid]) => uid === userId)
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
103
105
|
.map(([roomId, _uid]) => roomId));
|
|
104
106
|
}
|
|
105
107
|
};
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import { RoomTurnMode } from '../../../shared/types/app.types';
|
|
1
|
+
import { RoomIllustrationMode, RoomTurnMode } from '../../../shared/types/app.types';
|
|
2
|
+
/**
|
|
3
|
+
* The image model that will actually draw for a room, or undefined when none will.
|
|
4
|
+
*
|
|
5
|
+
* Collapses the two ways a room ends up drawing nothing — no model configured
|
|
6
|
+
* anywhere, and the {@link NO_IMAGES} sentinel — into the one answer every caller
|
|
7
|
+
* wants. It exists because `"No images"` is a *truthy string*, so the obvious
|
|
8
|
+
* `if (!room.getImageModel())` reads it as a real model: a room explicitly set to
|
|
9
|
+
* draw nothing would accept illustration requests all day and quietly produce
|
|
10
|
+
* nothing, since the sentinel only resolves to null much later, where the artist
|
|
11
|
+
* agent is built.
|
|
12
|
+
*
|
|
13
|
+
* @param chosen The room's `imageModel`, which may be absent
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveRoomImageModel(chosen?: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Interface for serializable room configuration
|
|
18
|
+
* Note: Artifacts are now stored as individual .artifact files in the room directory
|
|
19
|
+
*/
|
|
2
20
|
export interface RoomConfig {
|
|
3
21
|
id: string;
|
|
4
22
|
name: string;
|
|
@@ -12,9 +30,74 @@ export interface RoomConfig {
|
|
|
12
30
|
createdAt: string;
|
|
13
31
|
isPublished?: boolean;
|
|
14
32
|
templateRoomId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The pack this room is filed under, which decides whether it is listed.
|
|
35
|
+
*
|
|
36
|
+
* Set when the room is built from a pack template, and editable afterwards so a
|
|
37
|
+
* user can file their own room under a pack of their own. Absent means "not
|
|
38
|
+
* filed", and a room naming a pack that is not installed is still listed.
|
|
39
|
+
*
|
|
40
|
+
* Deliberately not `templateRoomId`: that means "published instance", and
|
|
41
|
+
* `getTemplateRooms()` filters anything carrying one out of the Rooms list.
|
|
42
|
+
*/
|
|
15
43
|
pack?: string;
|
|
44
|
+
/** The pack template's key, when this room came from one. */
|
|
16
45
|
packRoomKey?: string;
|
|
46
|
+
/**
|
|
47
|
+
* What a client's Begin button sends into the room.
|
|
48
|
+
*
|
|
49
|
+
* Delivered as a `System` `speak` addressed to the room leader, which takes the
|
|
50
|
+
* first turn. A room is pull-driven — an agent is prompted only when a message
|
|
51
|
+
* arrives — so without this a freshly built room waits for a person to type
|
|
52
|
+
* something before anything happens at all.
|
|
53
|
+
*
|
|
54
|
+
* Absent or blank means the room offers no Begin.
|
|
55
|
+
*/
|
|
56
|
+
beginInstruction?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Which entry in `image_models.json` draws this room's pictures.
|
|
59
|
+
*
|
|
60
|
+
* Absent falls back to `DEFAULT_IMAGE_MODEL`; the {@link NO_IMAGES} sentinel
|
|
61
|
+
* disables illustration for this room alone. Read it through
|
|
62
|
+
* {@link resolveRoomImageModel} rather than testing it for truthiness — the
|
|
63
|
+
* sentinel is a non-empty string.
|
|
64
|
+
*
|
|
65
|
+
* A room created through the dialog is explicitly set to the sentinel, so the
|
|
66
|
+
* fallback now only covers rooms made before that and pack templates that name
|
|
67
|
+
* no model of their own.
|
|
68
|
+
*
|
|
69
|
+
* A setting rather than identity, so it is right that a published instance
|
|
70
|
+
* inherits it. The illustrator and artist *agent ids* deliberately live
|
|
71
|
+
* outside `RoomConfig` for the opposite reason — see the sidecar written by
|
|
72
|
+
* `IllustrationService`.
|
|
73
|
+
*/
|
|
74
|
+
imageModel?: string;
|
|
75
|
+
/**
|
|
76
|
+
* When the room asks for a picture of its own accord.
|
|
77
|
+
*
|
|
78
|
+
* `on-request` (the default) draws only when an agent calls the `illustrate`
|
|
79
|
+
* tool. `auto` also draws whenever the scene changes, which is how stories
|
|
80
|
+
* have always behaved — but it is opt-in for rooms because a game master that
|
|
81
|
+
* restates the situation on every tool call would otherwise buy an image each
|
|
82
|
+
* time. `off` refuses both.
|
|
83
|
+
*/
|
|
84
|
+
illustrationMode?: RoomIllustrationMode;
|
|
17
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Every setting a room carries, without its identity or its content.
|
|
88
|
+
*
|
|
89
|
+
* `RoomConfig` minus `id`, `agentIds`, `messages` and `createdAt` — the four a
|
|
90
|
+
* caller building a room from scratch supplies itself. Used by
|
|
91
|
+
* `RoomStoreService.readRoomSettings` / `applyRoomSettings`, which exist so that
|
|
92
|
+
* only one place has to name them all. `room-settings.spec.ts` pins the
|
|
93
|
+
* relationship, so adding a field to `RoomConfig` fails there until it is carried
|
|
94
|
+
* here too.
|
|
95
|
+
*/
|
|
18
96
|
export type RoomSettingsSnapshot = Omit<RoomConfig, 'id' | 'agentIds' | 'messages' | 'createdAt'> & Required<Pick<RoomConfig, 'roomLeader' | 'turnMode'>> & {
|
|
97
|
+
/** Never undefined here: `Room.getModerator()` normalizes absent to ''. */
|
|
19
98
|
moderator: string;
|
|
99
|
+
/** Never undefined here either — `Room.setBeginInstruction` normalizes. */
|
|
100
|
+
beginInstruction: string;
|
|
101
|
+
/** Never undefined here: `Room.getIllustrationMode()` normalizes absent to 'on-request'. */
|
|
102
|
+
illustrationMode: RoomIllustrationMode;
|
|
20
103
|
};
|
|
@@ -1,2 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRoomImageModel = resolveRoomImageModel;
|
|
4
|
+
const app_types_1 = require("../../../shared/types/app.types");
|
|
5
|
+
/**
|
|
6
|
+
* The image model that will actually draw for a room, or undefined when none will.
|
|
7
|
+
*
|
|
8
|
+
* Collapses the two ways a room ends up drawing nothing — no model configured
|
|
9
|
+
* anywhere, and the {@link NO_IMAGES} sentinel — into the one answer every caller
|
|
10
|
+
* wants. It exists because `"No images"` is a *truthy string*, so the obvious
|
|
11
|
+
* `if (!room.getImageModel())` reads it as a real model: a room explicitly set to
|
|
12
|
+
* draw nothing would accept illustration requests all day and quietly produce
|
|
13
|
+
* nothing, since the sentinel only resolves to null much later, where the artist
|
|
14
|
+
* agent is built.
|
|
15
|
+
*
|
|
16
|
+
* @param chosen The room's `imageModel`, which may be absent
|
|
17
|
+
*/
|
|
18
|
+
function resolveRoomImageModel(chosen) {
|
|
19
|
+
const model = chosen || process.env.DEFAULT_IMAGE_MODEL;
|
|
20
|
+
return !model || model === app_types_1.NO_IMAGES ? undefined : model;
|
|
21
|
+
}
|
|
@@ -2,10 +2,30 @@ import { Room } from './room';
|
|
|
2
2
|
import { RoomStoreService } from './room-store.service';
|
|
3
3
|
import { ToolStoreService } from '../tools/tool-store.service';
|
|
4
4
|
import { ToolExecutionService } from '../tools/tool-execution.service';
|
|
5
|
+
import { IllustrationService } from './illustration/illustration.service';
|
|
6
|
+
/**
|
|
7
|
+
* Factory for creating Room instances
|
|
8
|
+
* Not a singleton - instantiated per-user by UserServiceFactory
|
|
9
|
+
*/
|
|
5
10
|
export declare class RoomFactory {
|
|
6
11
|
private readonly roomStoreService;
|
|
7
12
|
private readonly toolStoreService;
|
|
8
13
|
private readonly toolExecutionService;
|
|
9
14
|
constructor(roomStoreService: RoomStoreService, toolStoreService: ToolStoreService, toolExecutionService: ToolExecutionService);
|
|
15
|
+
/**
|
|
16
|
+
* Draws rooms' pictures. Set after construction rather than injected, because
|
|
17
|
+
* IllustrationService is built alongside this factory's own dependencies.
|
|
18
|
+
*/
|
|
19
|
+
private illustrationService?;
|
|
20
|
+
/** @internal Wires the illustration pipeline onto every room this factory builds. */
|
|
21
|
+
setIllustrationService(illustration: IllustrationService): void;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a room with the specified parameters
|
|
24
|
+
* @param name The room name
|
|
25
|
+
* @param goal The room goal/purpose
|
|
26
|
+
* @param baseRoomDir Optional base room directory (defaults to '')
|
|
27
|
+
* @param storageDir Optional storage directory (defaults to roomStore default)
|
|
28
|
+
* @returns Created Room instance
|
|
29
|
+
*/
|
|
10
30
|
createRoom(name: string, goal: string, baseRoomDir?: string, storageDir?: string): Room;
|
|
11
31
|
}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RoomFactory = void 0;
|
|
4
4
|
const room_1 = require("./room");
|
|
5
|
+
/**
|
|
6
|
+
* Factory for creating Room instances
|
|
7
|
+
* Not a singleton - instantiated per-user by UserServiceFactory
|
|
8
|
+
*/
|
|
5
9
|
class RoomFactory {
|
|
6
10
|
roomStoreService;
|
|
7
11
|
toolStoreService;
|
|
@@ -11,10 +15,31 @@ class RoomFactory {
|
|
|
11
15
|
this.toolStoreService = toolStoreService;
|
|
12
16
|
this.toolExecutionService = toolExecutionService;
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Draws rooms' pictures. Set after construction rather than injected, because
|
|
20
|
+
* IllustrationService is built alongside this factory's own dependencies.
|
|
21
|
+
*/
|
|
22
|
+
illustrationService;
|
|
23
|
+
/** @internal Wires the illustration pipeline onto every room this factory builds. */
|
|
24
|
+
setIllustrationService(illustration) {
|
|
25
|
+
this.illustrationService = illustration;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a room with the specified parameters
|
|
29
|
+
* @param name The room name
|
|
30
|
+
* @param goal The room goal/purpose
|
|
31
|
+
* @param baseRoomDir Optional base room directory (defaults to '')
|
|
32
|
+
* @param storageDir Optional storage directory (defaults to roomStore default)
|
|
33
|
+
* @returns Created Room instance
|
|
34
|
+
*/
|
|
14
35
|
createRoom(name, goal, baseRoomDir = '', storageDir = '') {
|
|
36
|
+
// Use default storage dir if not provided
|
|
15
37
|
const finalStorageDir = storageDir || this.roomStoreService.getDefaultStorageDir();
|
|
38
|
+
// Create room with all dependencies
|
|
16
39
|
const room = new room_1.Room(null, name, goal, baseRoomDir, finalStorageDir, this.roomStoreService);
|
|
17
40
|
room.setToolServices(this.toolStoreService, this.toolExecutionService);
|
|
41
|
+
if (this.illustrationService)
|
|
42
|
+
room.setIllustrationService(this.illustrationService);
|
|
18
43
|
return room;
|
|
19
44
|
}
|
|
20
45
|
}
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import { RoomMessageUpdate } from '../../../shared/types/app.types';
|
|
3
|
+
/**
|
|
4
|
+
* Service to manage Server-Sent Events (SSE) for room message updates
|
|
5
|
+
* Maintains EventEmitters for each room to push real-time updates to connected clients
|
|
6
|
+
*/
|
|
3
7
|
export declare class RoomMessageService {
|
|
4
8
|
private messageEmitters;
|
|
9
|
+
/**
|
|
10
|
+
* Gets or creates an EventEmitter for a specific room
|
|
11
|
+
* @param roomId The room ID
|
|
12
|
+
* @returns EventEmitter for the room
|
|
13
|
+
*/
|
|
5
14
|
getOrCreateEmitter(roomId: string): EventEmitter;
|
|
15
|
+
/**
|
|
16
|
+
* Emits an update event for a room
|
|
17
|
+
* @param roomId The room ID
|
|
18
|
+
* @param roomState The room state update to emit
|
|
19
|
+
*/
|
|
6
20
|
emitUpdate(roomId: string, roomState: RoomMessageUpdate): void;
|
|
21
|
+
/**
|
|
22
|
+
* Emits an error event for a room
|
|
23
|
+
*
|
|
24
|
+
* On the same `'update'` event as {@link emitUpdate}, discriminated by `type`:
|
|
25
|
+
* an EventEmitter throws when an `'error'` event has no listener, which would
|
|
26
|
+
* take down a host that subscribed only to updates.
|
|
27
|
+
*
|
|
28
|
+
* @param roomId The room ID
|
|
29
|
+
* @param error The error that occurred
|
|
30
|
+
*/
|
|
7
31
|
emitError(roomId: string, error: Error): void;
|
|
32
|
+
/**
|
|
33
|
+
* Cleans up the EventEmitter for a room
|
|
34
|
+
* @param roomId The room ID
|
|
35
|
+
*/
|
|
8
36
|
cleanup(roomId: string): void;
|
|
9
37
|
}
|