briyah 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +216 -0
- package/README.md +43 -7
- package/data/common/config/LICENSE-model-prices.md +65 -0
- package/data/common/config/markup +1 -1
- package/data/common/config/model_prices.json +47443 -46295
- package/data/common/prompts/narrator/create_story.prompt +2 -0
- package/data/packs/dnd5e/agents/player.json +11 -11
- package/data/packs/dnd5e/prompts/character_creator/defaults_config.json +21 -20
- package/data/packs/dnd5e/prompts/character_creator/perceive.prompt +19 -12
- package/data/packs/dnd5e/prompts/dnd_player/perceive.prompt +10 -6
- package/dist-sdk/server/src/ai/LLM/anthropic.service.d.ts +103 -0
- package/dist-sdk/server/src/ai/LLM/anthropic.service.js +173 -2
- package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +172 -3
- package/dist-sdk/server/src/ai/LLM/base-ai.service.js +241 -5
- package/dist-sdk/server/src/ai/LLM/comfyui-client.d.ts +26 -0
- package/dist-sdk/server/src/ai/LLM/comfyui-client.js +25 -0
- package/dist-sdk/server/src/ai/LLM/comfyui-workflow.d.ts +54 -0
- package/dist-sdk/server/src/ai/LLM/comfyui-workflow.js +59 -1
- package/dist-sdk/server/src/ai/LLM/comfyui.service.d.ts +21 -1
- package/dist-sdk/server/src/ai/LLM/comfyui.service.js +25 -1
- package/dist-sdk/server/src/ai/LLM/deepseek.service.d.ts +52 -0
- package/dist-sdk/server/src/ai/LLM/deepseek.service.js +102 -3
- package/dist-sdk/server/src/ai/LLM/fal.service.d.ts +25 -0
- package/dist-sdk/server/src/ai/LLM/fal.service.js +55 -1
- package/dist-sdk/server/src/ai/LLM/googleai.service.d.ts +19 -0
- package/dist-sdk/server/src/ai/LLM/googleai.service.js +42 -1
- package/dist-sdk/server/src/ai/LLM/grok.service.d.ts +22 -0
- package/dist-sdk/server/src/ai/LLM/grok.service.js +54 -2
- package/dist-sdk/server/src/ai/LLM/mock.service.js +31 -4
- package/dist-sdk/server/src/ai/LLM/openai.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/LLM/openai.service.js +80 -2
- package/dist-sdk/server/src/ai/LLM/self-hosted.service.d.ts +21 -0
- package/dist-sdk/server/src/ai/LLM/self-hosted.service.js +44 -2
- package/dist-sdk/server/src/ai/LLM/together.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/LLM/together.service.js +60 -2
- package/dist-sdk/server/src/ai/agent-config.d.ts +15 -0
- package/dist-sdk/server/src/ai/agent-factory.d.ts +16 -0
- package/dist-sdk/server/src/ai/agent-factory.js +20 -0
- package/dist-sdk/server/src/ai/agent-message.service.d.ts +30 -0
- package/dist-sdk/server/src/ai/agent-message.service.js +30 -0
- package/dist-sdk/server/src/ai/agent-store.service.d.ts +80 -0
- package/dist-sdk/server/src/ai/agent-store.service.js +166 -5
- package/dist-sdk/server/src/ai/agent.d.ts +196 -0
- package/dist-sdk/server/src/ai/agent.js +224 -11
- package/dist-sdk/server/src/ai/ai-debug-logger.d.ts +18 -0
- package/dist-sdk/server/src/ai/ai-debug-logger.js +19 -0
- package/dist-sdk/server/src/ai/ai-factory.service.d.ts +9 -0
- package/dist-sdk/server/src/ai/ai-factory.service.js +9 -0
- package/dist-sdk/server/src/ai/artifact.service.d.ts +131 -0
- package/dist-sdk/server/src/ai/artifact.service.js +148 -3
- package/dist-sdk/server/src/ai/attached-file.service.d.ts +87 -0
- package/dist-sdk/server/src/ai/attached-file.service.js +105 -0
- package/dist-sdk/server/src/ai/model_prices.d.ts +30 -0
- package/dist-sdk/server/src/ai/model_prices.js +91 -5
- package/dist-sdk/server/src/ai/pack-artifacts.d.ts +84 -0
- package/dist-sdk/server/src/ai/pack-artifacts.js +168 -0
- package/dist-sdk/server/src/ai/published-agents.service.d.ts +25 -0
- package/dist-sdk/server/src/ai/published-agents.service.js +30 -3
- package/dist-sdk/server/src/app/balance-message.service.d.ts +24 -0
- package/dist-sdk/server/src/app/balance-message.service.js +24 -0
- package/dist-sdk/server/src/app/balance.module.d.ts +4 -0
- package/dist-sdk/server/src/app/balance.module.js +4 -0
- package/dist-sdk/server/src/app/balance.service.d.ts +37 -0
- package/dist-sdk/server/src/app/balance.service.js +54 -0
- package/dist-sdk/server/src/app/stripe.controller.d.ts +21 -0
- package/dist-sdk/server/src/app/stripe.controller.js +35 -0
- package/dist-sdk/server/src/app/stripe.service.d.ts +43 -0
- package/dist-sdk/server/src/app/stripe.service.js +62 -0
- package/dist-sdk/server/src/app/transaction.service.d.ts +27 -0
- package/dist-sdk/server/src/app/transaction.service.js +36 -0
- package/dist-sdk/server/src/app/user-service-factory.d.ts +8 -0
- package/dist-sdk/server/src/app/user-service-factory.js +38 -1
- package/dist-sdk/server/src/app/user-service-manager.d.ts +27 -0
- package/dist-sdk/server/src/app/user-service-manager.js +43 -0
- package/dist-sdk/server/src/app.controller.d.ts +87 -0
- package/dist-sdk/server/src/app.controller.js +272 -12
- package/dist-sdk/server/src/app.module.js +28 -6
- package/dist-sdk/server/src/app.service.d.ts +1662 -0
- package/dist-sdk/server/src/app.service.js +1862 -6
- package/dist-sdk/server/src/auth/agent-access.decorator.d.ts +17 -0
- package/dist-sdk/server/src/auth/agent-access.decorator.js +17 -0
- package/dist-sdk/server/src/auth/auth.controller.js +46 -0
- package/dist-sdk/server/src/auth/auth.module.js +3 -2
- package/dist-sdk/server/src/auth/auth.service.d.ts +33 -0
- package/dist-sdk/server/src/auth/auth.service.js +39 -3
- package/dist-sdk/server/src/auth/jwt-auth.guard.js +18 -0
- package/dist-sdk/server/src/auth/jwt.strategy.js +2 -2
- package/dist-sdk/server/src/auth/owner-only.decorator.d.ts +9 -0
- package/dist-sdk/server/src/auth/owner-only.decorator.js +9 -0
- package/dist-sdk/server/src/auth/phone-validation.service.d.ts +25 -0
- package/dist-sdk/server/src/auth/phone-validation.service.js +30 -0
- package/dist-sdk/server/src/auth/rate-limit.service.d.ts +19 -0
- package/dist-sdk/server/src/auth/rate-limit.service.js +24 -0
- package/dist-sdk/server/src/auth/room-access.decorator.d.ts +8 -0
- package/dist-sdk/server/src/auth/room-access.decorator.js +8 -0
- package/dist-sdk/server/src/auth/scopes.decorator.d.ts +7 -0
- package/dist-sdk/server/src/auth/scopes.decorator.js +7 -0
- package/dist-sdk/server/src/auth/scopes.guard.d.ts +16 -0
- package/dist-sdk/server/src/auth/scopes.guard.js +30 -0
- package/dist-sdk/server/src/auth/session.guard.d.ts +4 -0
- package/dist-sdk/server/src/auth/session.guard.js +8 -0
- package/dist-sdk/server/src/auth/twilio.service.d.ts +27 -0
- package/dist-sdk/server/src/auth/twilio.service.js +30 -4
- package/dist-sdk/server/src/auth/users.service.d.ts +30 -0
- package/dist-sdk/server/src/auth/users.service.js +42 -0
- package/dist-sdk/server/src/common/errors.d.ts +20 -0
- package/dist-sdk/server/src/common/errors.js +21 -0
- package/dist-sdk/server/src/config/env-config.d.ts +7 -0
- package/dist-sdk/server/src/config/prompt-resolver.d.ts +180 -0
- package/dist-sdk/server/src/config/prompt-resolver.js +182 -0
- package/dist-sdk/server/src/config/user-config.service.d.ts +59 -0
- package/dist-sdk/server/src/config/user-config.service.js +57 -0
- package/dist-sdk/server/src/config/user-paths.service.d.ts +61 -0
- package/dist-sdk/server/src/config/user-paths.service.js +67 -0
- package/dist-sdk/server/src/documents/pdf-conversion.d.ts +121 -1
- package/dist-sdk/server/src/documents/pdf-conversion.js +94 -0
- package/dist-sdk/server/src/packs/pack-instantiation.service.d.ts +98 -0
- package/dist-sdk/server/src/packs/pack-instantiation.service.js +99 -0
- package/dist-sdk/server/src/packs/pack-manifest.d.ts +100 -0
- package/dist-sdk/server/src/packs/pack-manifest.js +58 -0
- package/dist-sdk/server/src/packs/pack.service.d.ts +99 -1
- package/dist-sdk/server/src/packs/pack.service.js +98 -1
- package/dist-sdk/server/src/room/artifact-store.service.d.ts +27 -0
- package/dist-sdk/server/src/room/artifact-store.service.js +49 -3
- package/dist-sdk/server/src/room/artifact.d.ts +18 -0
- package/dist-sdk/server/src/room/message.d.ts +64 -0
- package/dist-sdk/server/src/room/message.js +77 -2
- package/dist-sdk/server/src/room/nickname.d.ts +27 -0
- package/dist-sdk/server/src/room/nickname.js +41 -0
- package/dist-sdk/server/src/room/published-rooms.service.js +2 -0
- package/dist-sdk/server/src/room/room-config.d.ts +26 -0
- package/dist-sdk/server/src/room/room-factory.d.ts +12 -0
- package/dist-sdk/server/src/room/room-factory.js +14 -0
- package/dist-sdk/server/src/room/room-message.service.d.ts +28 -0
- package/dist-sdk/server/src/room/room-message.service.js +28 -0
- package/dist-sdk/server/src/room/room-store.service.d.ts +177 -0
- package/dist-sdk/server/src/room/room-store.service.js +242 -5
- package/dist-sdk/server/src/room/room.d.ts +906 -1
- package/dist-sdk/server/src/room/room.js +1525 -34
- package/dist-sdk/server/src/rpg/rpg-models.d.ts +50 -0
- package/dist-sdk/server/src/rpg/rpg-models.js +53 -0
- package/dist-sdk/server/src/rpg/rpg-roster.d.ts +38 -3
- package/dist-sdk/server/src/rpg/rpg-roster.js +49 -49
- package/dist-sdk/server/src/rpg/rpg.service.d.ts +87 -0
- package/dist-sdk/server/src/rpg/rpg.service.js +108 -5
- package/dist-sdk/server/src/sdk/briyah-config.d.ts +57 -0
- package/dist-sdk/server/src/sdk/briyah-config.js +17 -0
- package/dist-sdk/server/src/sdk/briyah.d.ts +228 -0
- package/dist-sdk/server/src/sdk/briyah.js +285 -7
- package/dist-sdk/server/src/sdk/index.d.ts +0 -1
- package/dist-sdk/server/src/sdk/index.js +24 -3
- package/dist-sdk/server/src/shared/shared.module.d.ts +8 -0
- package/dist-sdk/server/src/shared/shared.module.js +13 -5
- package/dist-sdk/server/src/story/story-message.service.d.ts +43 -0
- package/dist-sdk/server/src/story/story-message.service.js +43 -0
- package/dist-sdk/server/src/story/story-progress.service.d.ts +23 -0
- package/dist-sdk/server/src/story/story-progress.service.js +23 -0
- package/dist-sdk/server/src/story/story-store.service.d.ts +92 -0
- package/dist-sdk/server/src/story/story-store.service.js +136 -1
- package/dist-sdk/server/src/story/story.service.d.ts +398 -0
- package/dist-sdk/server/src/story/story.service.js +829 -25
- package/dist-sdk/server/src/tools/core/index.d.ts +25 -0
- package/dist-sdk/server/src/tools/core/index.js +31 -0
- package/dist-sdk/server/src/tools/core/rename.tool.d.ts +10 -0
- package/dist-sdk/server/src/tools/core/rename.tool.js +72 -0
- package/dist-sdk/server/src/tools/native-tool-registry.service.d.ts +22 -0
- package/dist-sdk/server/src/tools/native-tool-registry.service.js +22 -0
- package/dist-sdk/server/src/tools/native-tool.types.d.ts +186 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.d.ts +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.js +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.d.ts +46 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/cantrips.js +40 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.d.ts +33 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.js +19 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.d.ts +37 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.d.ts +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.js +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.js +27 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.d.ts +36 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/kits.js +32 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.d.ts +32 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.d.ts +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.js +20 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.d.ts +36 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.d.ts +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.js +21 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.d.ts +95 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.js +66 -2
- package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.d.ts +50 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.js +28 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.d.ts +92 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.js +152 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.d.ts +28 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.js +29 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.d.ts +31 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/cantrips.js +36 -2
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.d.ts +261 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.js +401 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.d.ts +11 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.js +11 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.d.ts +65 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.js +67 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.d.ts +73 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encounter.js +63 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.d.ts +66 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.js +59 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.d.ts +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.js +49 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.d.ts +42 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/foes.js +59 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.d.ts +72 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/guides.js +63 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.d.ts +57 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.js +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.d.ts +81 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/kits.js +85 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.d.ts +60 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.js +64 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.d.ts +169 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.js +203 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +192 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +144 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.d.ts +56 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.js +54 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.d.ts +65 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.js +73 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/index.d.ts +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/index.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.d.ts +4 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.js +116 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.d.ts +14 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/class.tool.js +17 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.js +35 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.d.ts +6 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/encounter.tool.js +25 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.d.ts +7 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.js +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.d.ts +8 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.js +55 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +164 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +188 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +125 -1
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.js +18 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.js +23 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.js +35 -0
- package/dist-sdk/server/src/tools/packs/index.d.ts +52 -2
- package/dist-sdk/server/src/tools/packs/index.js +83 -9
- package/dist-sdk/server/src/tools/shared/coerce.d.ts +95 -0
- package/dist-sdk/server/src/tools/shared/coerce.js +98 -0
- package/dist-sdk/server/src/tools/tool-execution.service.d.ts +73 -0
- package/dist-sdk/server/src/tools/tool-execution.service.js +74 -0
- package/dist-sdk/server/src/tools/tool-store.service.d.ts +11 -0
- package/dist-sdk/server/src/tools/tool-store.service.js +13 -1
- package/dist-sdk/shared/types/app.types.d.ts +285 -14
- package/dist-sdk/shared/types/app.types.js +3 -0
- package/package.json +167 -139
- package/data/common/config/random_words.txt +0 -2241
- package/data/common/story_ideas/biblical.json +0 -122
- package/data/common/story_ideas/fantasy.json +0 -82
- package/data/common/story_ideas/historical_fiction.json +0 -82
- package/data/common/story_ideas/science_fiction.json +0 -82
- package/data/packs/acts/agents/character-guide.json +0 -6
- package/data/packs/acts/agents/discipleship-mentor.json +0 -6
- package/data/packs/acts/agents/mentor-coach.json +0 -6
- package/data/packs/acts/agents/student.json +0 -13
- package/data/packs/acts/agents/table-moderator.json +0 -6
- package/data/packs/acts/artifacts/chapter-01-acts-1.md +0 -405
- package/data/packs/acts/artifacts/chapter-02-acts-2.md +0 -443
- package/data/packs/acts/artifacts/chapter-03-acts-3.md +0 -409
- package/data/packs/acts/artifacts/chapter-04-acts-4.md +0 -438
- package/data/packs/acts/artifacts/chapter-05-acts-5.md +0 -434
- package/data/packs/acts/artifacts/chapter-06-acts-6.md +0 -441
- package/data/packs/acts/artifacts/chapter-07-acts-7.md +0 -472
- package/data/packs/acts/artifacts/chapter-08-acts-8.md +0 -512
- package/data/packs/acts/artifacts/chapter-09-acts-9.md +0 -346
- package/data/packs/acts/artifacts/chapter-10-acts-10.md +0 -367
- package/data/packs/acts/artifacts/chapter-11-acts-11.md +0 -391
- package/data/packs/acts/artifacts/chapter-12-acts-12.md +0 -390
- package/data/packs/acts/artifacts/chapter-13-acts-13.md +0 -388
- package/data/packs/acts/artifacts/chapter-14-acts-14.md +0 -466
- package/data/packs/acts/artifacts/chapter-15-acts-15.md +0 -413
- package/data/packs/acts/artifacts/chapter-16-acts-16.md +0 -585
- package/data/packs/acts/artifacts/chapter-17-acts-17.md +0 -428
- package/data/packs/acts/artifacts/chapter-18-acts-18.md +0 -486
- package/data/packs/acts/artifacts/chapter-19-acts-19.md +0 -461
- package/data/packs/acts/artifacts/chapter-20-acts-20.md +0 -389
- package/data/packs/acts/artifacts/chapter-21-acts-21.md +0 -452
- package/data/packs/acts/artifacts/chapter-22-acts-22.md +0 -424
- package/data/packs/acts/artifacts/chapter-23-acts-23.md +0 -395
- package/data/packs/acts/artifacts/chapter-24-acts-24.md +0 -446
- package/data/packs/acts/artifacts/chapter-25-acts-25.md +0 -391
- package/data/packs/acts/artifacts/chapter-26-acts-26.md +0 -431
- package/data/packs/acts/artifacts/chapter-27-acts-27.md +0 -530
- package/data/packs/acts/artifacts/chapter-28-acts-28.md +0 -1871
- package/data/packs/acts/artifacts/chapters.manifest.json +0 -170
- package/data/packs/acts/artifacts/character_guide-creation.md +0 -112
- package/data/packs/acts/artifacts/discipleship_mentor-procedure.md +0 -154
- package/data/packs/acts/artifacts/discipleship_mentor-systems.md +0 -72
- package/data/packs/acts/artifacts/manifest.json +0 -197
- package/data/packs/acts/artifacts/stage-guide.md +0 -94
- package/data/packs/acts/pack.json +0 -6
- package/data/packs/acts/prompts/acts_player/defaults_config.json +0 -5
- package/data/packs/acts/prompts/acts_player/perceive.json +0 -29
- package/data/packs/acts/prompts/acts_player/perceive.prompt +0 -87
- package/data/packs/acts/prompts/acts_player/system_instruction.prompt +0 -0
- package/data/packs/acts/prompts/acts_room_moderator/defaults_config.json +0 -9
- package/data/packs/acts/prompts/acts_room_moderator/moderate.json +0 -34
- package/data/packs/acts/prompts/acts_room_moderator/moderate.prompt +0 -70
- package/data/packs/acts/prompts/acts_room_moderator/system_instruction.prompt +0 -0
- package/data/packs/acts/prompts/character_guide/defaults_config.json +0 -18
- package/data/packs/acts/prompts/character_guide/perceive.json +0 -29
- package/data/packs/acts/prompts/character_guide/perceive.prompt +0 -140
- package/data/packs/acts/prompts/character_guide/system_instruction.prompt +0 -0
- package/data/packs/acts/prompts/discipleship_mentor/defaults_config.json +0 -23
- package/data/packs/acts/prompts/discipleship_mentor/perceive.json +0 -33
- package/data/packs/acts/prompts/discipleship_mentor/perceive.prompt +0 -245
- package/data/packs/acts/prompts/discipleship_mentor/system_instruction.prompt +0 -0
- package/data/packs/acts/prompts/mentor_coach/defaults_config.json +0 -13
- package/data/packs/acts/prompts/mentor_coach/perceive.json +0 -29
- package/data/packs/acts/prompts/mentor_coach/perceive.prompt +0 -87
- package/data/packs/acts/prompts/mentor_coach/system_instruction.prompt +0 -0
- package/data/packs/acts/rooms/session.json +0 -14
- package/data/packs/acts/rooms/training.json +0 -58
- package/dist-sdk/server/src/tools/packs/acts/data/cards.d.ts +0 -53
- package/dist-sdk/server/src/tools/packs/acts/data/cards.js +0 -54
- package/dist-sdk/server/src/tools/packs/acts/data/character-cards.generated.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/data/character-cards.generated.js +0 -185
- package/dist-sdk/server/src/tools/packs/acts/data/encounters.d.ts +0 -12
- package/dist-sdk/server/src/tools/packs/acts/data/encounters.js +0 -102
- package/dist-sdk/server/src/tools/packs/acts/data/event-cards.generated.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/data/event-cards.generated.js +0 -196
- package/dist-sdk/server/src/tools/packs/acts/data/item-cards.generated.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/data/item-cards.generated.js +0 -1311
- package/dist-sdk/server/src/tools/packs/acts/engine/cards.d.ts +0 -5
- package/dist-sdk/server/src/tools/packs/acts/engine/cards.js +0 -27
- package/dist-sdk/server/src/tools/packs/acts/engine/challenge.d.ts +0 -37
- package/dist-sdk/server/src/tools/packs/acts/engine/challenge.js +0 -120
- package/dist-sdk/server/src/tools/packs/acts/engine/dice.d.ts +0 -20
- package/dist-sdk/server/src/tools/packs/acts/engine/dice.js +0 -41
- package/dist-sdk/server/src/tools/packs/acts/engine/sheet.d.ts +0 -54
- package/dist-sdk/server/src/tools/packs/acts/engine/sheet.js +0 -200
- package/dist-sdk/server/src/tools/packs/acts/index.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/index.js +0 -24
- package/dist-sdk/server/src/tools/packs/acts/tools/award.tool.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/tools/award.tool.js +0 -184
- package/dist-sdk/server/src/tools/packs/acts/tools/challenge.tool.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/tools/challenge.tool.js +0 -107
- package/dist-sdk/server/src/tools/packs/acts/tools/chapter.tool.d.ts +0 -3
- package/dist-sdk/server/src/tools/packs/acts/tools/chapter.tool.js +0 -146
- package/dist-sdk/server/src/tools/packs/acts/tools/check.tool.d.ts +0 -4
- package/dist-sdk/server/src/tools/packs/acts/tools/check.tool.js +0 -241
- package/dist-sdk/server/src/tools/packs/acts/tools/encounter.tool.d.ts +0 -3
- package/dist-sdk/server/src/tools/packs/acts/tools/encounter.tool.js +0 -72
- package/dist-sdk/server/src/tools/packs/acts/tools/faith.tool.d.ts +0 -2
- package/dist-sdk/server/src/tools/packs/acts/tools/faith.tool.js +0 -75
- package/dist-sdk/server/src/tools/packs/acts/tools/shared.d.ts +0 -20
- package/dist-sdk/server/src/tools/packs/acts/tools/shared.js +0 -70
- package/dist-sdk/server/src/tools/packs/acts/tools/sheet.tools.d.ts +0 -4
- package/dist-sdk/server/src/tools/packs/acts/tools/sheet.tools.js +0 -215
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -113
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1648
- package/docs/classes/Agent.html +0 -801
- package/docs/classes/Briyah.html +0 -296
- package/docs/classes/BriyahConfigService.html +0 -119
- package/docs/classes/NativeToolRegistry.html +0 -166
- package/docs/classes/PackInstantiationService.html +0 -157
- package/docs/classes/PackService.html +0 -247
- package/docs/classes/Room.html +0 -1338
- package/docs/classes/RoomMessage.html +0 -290
- package/docs/enums/MessageAction.html +0 -136
- package/docs/functions/actsTools.html +0 -44
- package/docs/functions/availableToolPacks.html +0 -41
- package/docs/functions/buildMarkdown.html +0 -54
- package/docs/functions/dnd5eTools.html +0 -44
- package/docs/functions/installToolPacks.html +0 -48
- package/docs/functions/pageMarker.html +0 -45
- package/docs/functions/registerToolPacks.html +0 -54
- package/docs/functions/splitMarkdownIntoPages.html +0 -51
- package/docs/functions/stripWrappingFence.html +0 -52
- package/docs/hierarchy.html +0 -46
- package/docs/index.html +0 -595
- package/docs/interfaces/AgentCreationOptions.html +0 -125
- package/docs/interfaces/AgentInfo.html +0 -218
- package/docs/interfaces/AgentMessagesResponse.html +0 -74
- package/docs/interfaces/AppService.html +0 -3337
- package/docs/interfaces/Artifact.html +0 -95
- package/docs/interfaces/ArtifactMetadata.html +0 -112
- package/docs/interfaces/ArtifactWriteOptions.html +0 -90
- package/docs/interfaces/AttachDocumentResponse.html +0 -62
- package/docs/interfaces/BriyahConfigOptions.html +0 -124
- package/docs/interfaces/ChapterInfo.html +0 -62
- package/docs/interfaces/Character.html +0 -86
- package/docs/interfaces/ConversionAgent.html +0 -78
- package/docs/interfaces/CreateAgentResponse.html +0 -56
- package/docs/interfaces/CreateRoomResponse.html +0 -62
- package/docs/interfaces/CreateStoryResponse.html +0 -56
- package/docs/interfaces/FileList.html +0 -56
- package/docs/interfaces/FileMetadata.html +0 -89
- package/docs/interfaces/IConfigService.html +0 -79
- package/docs/interfaces/InstantiateModels.html +0 -64
- package/docs/interfaces/InstantiateRoomResult.html +0 -70
- package/docs/interfaces/LoadedPack.html +0 -131
- package/docs/interfaces/LoggingOptions.html +0 -92
- package/docs/interfaces/Message.html +0 -84
- package/docs/interfaces/ModelChoice.html +0 -73
- package/docs/interfaces/ModelInfo.html +0 -74
- package/docs/interfaces/NativeToolDefinition.html +0 -107
- package/docs/interfaces/PackAgentTemplate.html +0 -101
- package/docs/interfaces/PackRoomTemplate.html +0 -108
- package/docs/interfaces/PackView.html +0 -172
- package/docs/interfaces/PdfConversionOptions.html +0 -102
- package/docs/interfaces/PdfConversionResult.html +0 -97
- package/docs/interfaces/PdfMarkdownOptions.html +0 -198
- package/docs/interfaces/PdfMarkdownResult.html +0 -106
- package/docs/interfaces/PdfPageMarkdown.html +0 -94
- package/docs/interfaces/PreparedPromptResponse.html +0 -62
- package/docs/interfaces/ProcessTextResponse.html +0 -86
- package/docs/interfaces/PromptFile.html +0 -70
- package/docs/interfaces/PromptFileContent.html +0 -76
- package/docs/interfaces/PromptFilesResponse.html +0 -56
- package/docs/interfaces/PromptFolder.html +0 -80
- package/docs/interfaces/PromptFolderDefaults.html +0 -155
- package/docs/interfaces/PromptFolderDefaultsResponse.html +0 -79
- package/docs/interfaces/PromptFoldersResponse.html +0 -56
- package/docs/interfaces/RoomDetails.html +0 -151
- package/docs/interfaces/RoomErrorUpdate.html +0 -82
- package/docs/interfaces/RoomInfo.html +0 -88
- package/docs/interfaces/RoomMessageUpdate.html +0 -113
- package/docs/interfaces/RoomMessagesResponse.html +0 -62
- package/docs/interfaces/SendMessageResult.html +0 -62
- package/docs/interfaces/StoryErrorEvent.html +0 -84
- package/docs/interfaces/StoryIdea.html +0 -74
- package/docs/interfaces/StoryInfo.html +0 -198
- package/docs/interfaces/StoryIntroduceCharacterEvent.html +0 -79
- package/docs/interfaces/StoryProgressChapterEvent.html +0 -72
- package/docs/interfaces/StoryState.html +0 -108
- package/docs/interfaces/StoryStateEvent.html +0 -76
- package/docs/interfaces/ToolArtifact.html +0 -85
- package/docs/interfaces/ToolCaller.html +0 -77
- package/docs/interfaces/ToolDefinition.html +0 -80
- package/docs/interfaces/ToolHelpers.html +0 -105
- package/docs/interfaces/ToolPackDocuments.html +0 -100
- package/docs/interfaces/ToolParameter.html +0 -74
- package/docs/interfaces/ToolRoomAccess.html +0 -227
- package/docs/interfaces/ToolSummary.html +0 -74
- package/docs/interfaces/ToolsResponse.html +0 -68
- package/docs/interfaces/Transaction.html +0 -104
- package/docs/interfaces/TransactionHistoryResponse.html +0 -62
- package/docs/modules.html +0 -53
- package/docs/types/PackOrigin.html +0 -34
- package/docs/types/PromptScope.html +0 -34
- package/docs/types/RoomTurnMode.html +0 -42
- package/docs/types/RoomUpdate.html +0 -36
- package/docs/types/RosterOverrides.html +0 -42
- package/docs/types/ToolContext.html +0 -40
- package/docs/types/ToolRunResult.html +0 -34
- package/src/tools/packs/dnd5e/README.md +0 -867
|
@@ -10,6 +10,10 @@ import { StoryInfo, StoryState, Character } from '../../../shared/types/app.type
|
|
|
10
10
|
import { UserPathsService } from '../config/user-paths.service';
|
|
11
11
|
import { ArtifactService } from '../ai/artifact.service';
|
|
12
12
|
import { Readable } from 'stream';
|
|
13
|
+
/**
|
|
14
|
+
* Service handling business logic for stories
|
|
15
|
+
* Works alongside StoryStoreService which handles persistence
|
|
16
|
+
*/
|
|
13
17
|
export declare class StoryService {
|
|
14
18
|
private readonly storyStore;
|
|
15
19
|
private readonly agentStore;
|
|
@@ -22,85 +26,479 @@ export declare class StoryService {
|
|
|
22
26
|
private readonly storyArtifactServices;
|
|
23
27
|
private readonly chaptersInProgress;
|
|
24
28
|
constructor(storyStore: StoryStoreService, agentStore: AgentStoreService, roomStore: RoomStoreService, progressService: StoryProgressService, messageService: StoryMessageService, userPaths: UserPathsService, agentFactory: AgentFactory, roomFactory: RoomFactory);
|
|
29
|
+
/**
|
|
30
|
+
* Gets the progress emitter for a story
|
|
31
|
+
* @param storyId The story ID
|
|
32
|
+
* @returns The event emitter or undefined
|
|
33
|
+
*/
|
|
25
34
|
getProgressEmitter(storyId: string): import("events")<[never]>;
|
|
35
|
+
/**
|
|
36
|
+
* Gets or creates the message emitter for a story
|
|
37
|
+
* @param storyId The story ID
|
|
38
|
+
* @returns The event emitter
|
|
39
|
+
*/
|
|
26
40
|
getMessageEmitter(storyId: string): import("events")<[never]>;
|
|
41
|
+
/**
|
|
42
|
+
* Cleans up the progress emitter for a story
|
|
43
|
+
* @param storyId The story ID
|
|
44
|
+
*/
|
|
27
45
|
cleanupProgressEmitter(storyId: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Cleans up the message emitter for a story
|
|
48
|
+
* @param storyId The story ID
|
|
49
|
+
*/
|
|
28
50
|
cleanupMessageEmitter(storyId: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Gets or creates the artifact service for a story
|
|
53
|
+
* @param storyId The story ID
|
|
54
|
+
* @returns The story-specific artifact service
|
|
55
|
+
*/
|
|
29
56
|
getStoryArtifactService(storyId: string): ArtifactService;
|
|
57
|
+
/**
|
|
58
|
+
* Emits a story state update to connected SSE clients
|
|
59
|
+
* Called by room's onStateChange callback
|
|
60
|
+
* @param storyId The story ID
|
|
61
|
+
*/
|
|
30
62
|
private emitStoryStateUpdate;
|
|
31
63
|
getHumanPrompt(room: Room): string;
|
|
64
|
+
/**
|
|
65
|
+
* Handles errors from room operations and emits them through SSE
|
|
66
|
+
* @param storyId The story ID
|
|
67
|
+
* @param error The error that occurred
|
|
68
|
+
*/
|
|
32
69
|
private handleRoomError;
|
|
70
|
+
/**
|
|
71
|
+
* Picks a random word from the random words file, if there is one.
|
|
72
|
+
*
|
|
73
|
+
* The list is optional and is not published with the package, so an SDK host
|
|
74
|
+
* has no file to read. `create_story.prompt` offers the word as an aid rather
|
|
75
|
+
* than requiring it — "if you need random numbers or words, use these" — so a
|
|
76
|
+
* story created without one is a story the narrator had one fewer prompt from.
|
|
77
|
+
*
|
|
78
|
+
* Absent has to be handled here rather than left to throw: this runs inside
|
|
79
|
+
* {@link createStory}, so a missing file would fail every story creation
|
|
80
|
+
* outright rather than costing the narrator an idea.
|
|
81
|
+
* @returns A random word, or '' when no list is installed
|
|
82
|
+
*/
|
|
33
83
|
private getRandomWord;
|
|
84
|
+
/**
|
|
85
|
+
* Gets the storage directories for a story
|
|
86
|
+
* @param storyId The story ID
|
|
87
|
+
* @returns Object with agentsDir, roomsDir, and artifactsDir paths
|
|
88
|
+
*/
|
|
34
89
|
private getStoryStorageDirs;
|
|
90
|
+
/**
|
|
91
|
+
* Looks up AI service and model from story_models.json using the model identifier
|
|
92
|
+
* @param storyModel The model identifier (e.g., "claude-sonnet-4-5")
|
|
93
|
+
* @returns Object with service and model, or null if not found
|
|
94
|
+
*/
|
|
35
95
|
private getStoryModelConfig;
|
|
36
96
|
private getStoryRoom;
|
|
97
|
+
/**
|
|
98
|
+
* Ensures a story's room and agents are loaded into memory
|
|
99
|
+
* Sets up the state change callback for event-driven updates
|
|
100
|
+
* @param storyId The story ID
|
|
101
|
+
*/
|
|
37
102
|
private ensureStoryLoaded;
|
|
38
103
|
getStoryInfo(storyId: string): Promise<StoryInfo | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Creates a new story with business logic
|
|
106
|
+
* @param name The story name
|
|
107
|
+
* @param idea The story idea or existing story text (if isImport is true)
|
|
108
|
+
* @param userCharacterDesc Description of the character the user will play
|
|
109
|
+
* @param otherCharactersDesc Description of other prominent characters
|
|
110
|
+
* @param illustrateStory True if the story will be illustrated
|
|
111
|
+
* @param storyModel The model identifier (e.g., "claude-sonnet-4-5") from story_models.json
|
|
112
|
+
* @param isImport Flag indicating this is an imported existing story
|
|
113
|
+
* @param imageModelName Name of the image model in data/common/config/image_models.json. Each entry supplies both a generation model (portraits/scene references) and an editing model (story images with reference images).
|
|
114
|
+
* @param skipDetailedPlot When true, generate a simple plot scenario instead of a detailed plot plan with secrets, twists, and events
|
|
115
|
+
* @returns The story information including the generated ID
|
|
116
|
+
*/
|
|
39
117
|
createStory(name: string, idea: string, userCharacterDesc: string, otherCharactersDesc: string, illustrateStory: boolean, storyModel?: string, isImport?: boolean, imageModelName?: string, skipDetailedPlot?: boolean): Promise<StoryInfo>;
|
|
118
|
+
/**
|
|
119
|
+
* Performs the actual story creation work asynchronously
|
|
120
|
+
* This runs in the background after returning the storyId to the client
|
|
121
|
+
*/
|
|
40
122
|
private createStoryAsync;
|
|
41
123
|
generateCharacterPortraits(storyInfo: StoryInfo, room: Room): Promise<void>[];
|
|
42
124
|
generateOpeningSceneImage(storyInfo: StoryInfo, room: Room): Promise<{
|
|
43
125
|
type: string;
|
|
44
126
|
success: boolean;
|
|
45
127
|
}>;
|
|
128
|
+
/**
|
|
129
|
+
* Validates the structure of an imported story directory
|
|
130
|
+
* @param importDir The directory containing the extracted story files
|
|
131
|
+
* @returns Validation result with errors and metadata if valid
|
|
132
|
+
*/
|
|
46
133
|
private validateImportStructure;
|
|
134
|
+
/**
|
|
135
|
+
* Extracts a zip file to a target directory with security checks
|
|
136
|
+
* @param zipBuffer The zip file buffer
|
|
137
|
+
* @param targetDir The directory to extract to
|
|
138
|
+
*/
|
|
47
139
|
private extractZip;
|
|
140
|
+
/**
|
|
141
|
+
* Imports a story from a zip file buffer
|
|
142
|
+
* @param zipBuffer The zip file buffer to import
|
|
143
|
+
* @returns The imported story metadata
|
|
144
|
+
*/
|
|
48
145
|
importStoryFromZip(zipBuffer: Buffer): Promise<StoryInfo>;
|
|
146
|
+
/**
|
|
147
|
+
* Populates agent conversation histories and room messages with imported story text
|
|
148
|
+
*
|
|
149
|
+
* @param room The story room
|
|
150
|
+
* @param storyText The imported story text
|
|
151
|
+
* @param audience Nicknames of the characters present for `storyText`. Characters
|
|
152
|
+
* outside it do not hear it, which is how a chapter can open on a scene only some
|
|
153
|
+
* of the cast are in. Non-character agents (narrator, moderator, illustrator,
|
|
154
|
+
* artist) are always seeded - they work on the whole story, not a scene of it -
|
|
155
|
+
* as is the player's own character, who is reading the text on screen either way.
|
|
156
|
+
* Omit to seed everyone, which is right when the text opens the story and the
|
|
157
|
+
* whole cast is new to it.
|
|
158
|
+
*/
|
|
49
159
|
populateStoryHistory(room: Room, storyText: string, audience?: string[]): void;
|
|
160
|
+
/**
|
|
161
|
+
* Sends a message to the story dialog and gets an AI response
|
|
162
|
+
* @param storyId The story ID
|
|
163
|
+
* @param message The user's message
|
|
164
|
+
* @param action The action type ('say' or 'do')
|
|
165
|
+
* @returns The AI assistant's response
|
|
166
|
+
*/
|
|
167
|
+
/**
|
|
168
|
+
* Gets the current state of a story including room messages and pending status
|
|
169
|
+
* @param storyId The story ID
|
|
170
|
+
* @returns Story state with room messages and pending status
|
|
171
|
+
*/
|
|
50
172
|
getStoryState(storyId: string): Promise<StoryState>;
|
|
173
|
+
/**
|
|
174
|
+
* Lists all characters in the story (excluding narrator)
|
|
175
|
+
* @param storyId The story ID
|
|
176
|
+
* @returns Array of character info
|
|
177
|
+
*/
|
|
51
178
|
listCharacters(storyId: string): Promise<Character[]>;
|
|
179
|
+
/**
|
|
180
|
+
* Gets a character profile artifact content
|
|
181
|
+
* @param storyId The story ID
|
|
182
|
+
* @param characterName The character name
|
|
183
|
+
* @returns The character profile markdown content
|
|
184
|
+
*/
|
|
52
185
|
getCharacter(storyId: string, characterName: string): Promise<string | null>;
|
|
186
|
+
/**
|
|
187
|
+
* Saves a character profile (convenience wrapper for PUBLISH action)
|
|
188
|
+
* @param storyId The story ID
|
|
189
|
+
* @param characterName The character name
|
|
190
|
+
* @param content The updated character profile markdown
|
|
191
|
+
* @returns Success status
|
|
192
|
+
*/
|
|
53
193
|
saveCharacter(storyId: string, characterName: string, content: string): void;
|
|
194
|
+
/**
|
|
195
|
+
* Gets a character's inventory, stored in the owning agent's private context.
|
|
196
|
+
* @param storyId The story ID
|
|
197
|
+
* @param characterName The character name
|
|
198
|
+
* @returns The inventory markdown content, or null if no inventory exists yet
|
|
199
|
+
*/
|
|
54
200
|
getCharacterInventory(storyId: string, characterName: string): Promise<string | null>;
|
|
201
|
+
/**
|
|
202
|
+
* Saves a character's inventory to the owning agent's private context. The
|
|
203
|
+
* inventory stays visible only to the owning character and the Moderator.
|
|
204
|
+
* @param storyId The story ID
|
|
205
|
+
* @param characterName The character name
|
|
206
|
+
* @param content The updated inventory markdown
|
|
207
|
+
*/
|
|
55
208
|
saveCharacterInventory(storyId: string, characterName: string, content: string): Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Gets the plot plan artifact content
|
|
211
|
+
* @param storyId The story ID
|
|
212
|
+
* @returns The plot plan markdown content
|
|
213
|
+
*/
|
|
56
214
|
getPlotPlan(storyId: string): Promise<string>;
|
|
215
|
+
/**
|
|
216
|
+
* Gets the formatted conversation history for an agent in the story
|
|
217
|
+
* @param storyId The story ID
|
|
218
|
+
* @param agentId The agent ID
|
|
219
|
+
* @returns JSON string of the agent's conversation history
|
|
220
|
+
*/
|
|
57
221
|
getAgentHistory(storyId: string, agentId: string): Promise<string>;
|
|
222
|
+
/**
|
|
223
|
+
* Saves the plot plan (convenience wrapper for PUBLISH action)
|
|
224
|
+
* @param storyId The story ID
|
|
225
|
+
* @param content The updated plot plan markdown
|
|
226
|
+
* @returns Success status
|
|
227
|
+
*/
|
|
58
228
|
savePlotPlan(storyId: string, content: string): Promise<void>;
|
|
59
229
|
publishArtifact(storyId: string, name: string, creator: string, body: string, viewers: string[]): Promise<void>;
|
|
60
230
|
respondToStory(storyId: string, content: string): Promise<void>;
|
|
61
231
|
interruptStory(storyId: string): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Introduces a new character into an existing story
|
|
234
|
+
* Creates character agent, updates profile, and notifies narrator
|
|
235
|
+
* @param latestNarration When introduced by the narrator, the narration
|
|
236
|
+
* prose that introduced this character. It isn't logged to the room yet,
|
|
237
|
+
* so it's threaded in to seed the new character's first profile.
|
|
238
|
+
*/
|
|
62
239
|
introduceCharacter(storyId: string, characterName: string, characterDescription: string, storyModel?: string, fromNarratorSuggestion?: boolean, latestNarration?: string): Promise<void>;
|
|
240
|
+
/**
|
|
241
|
+
* Records that user declined to introduce a character
|
|
242
|
+
* @param storyId The story ID
|
|
243
|
+
* @param characterName The character name that was declined
|
|
244
|
+
*/
|
|
63
245
|
declineCharacter(storyId: string, characterName: string): Promise<void>;
|
|
246
|
+
/**
|
|
247
|
+
* Deletes a character agent from a story but preserves the character profile artifact
|
|
248
|
+
* @param storyId The story ID
|
|
249
|
+
* @param characterName The character name to delete
|
|
250
|
+
* @returns Success status and message
|
|
251
|
+
*/
|
|
64
252
|
deleteCharacter(storyId: string, characterName: string): Promise<void>;
|
|
65
253
|
deleteStory(storyId: string): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* Helper function to disable markup and balance checks for story agents
|
|
256
|
+
* Used during story creation, chapter progression, and compaction
|
|
257
|
+
* @param agents Array of agents to disable flags for
|
|
258
|
+
* @param reason Optional reason for logging (e.g., "story creation", "chapter progression")
|
|
259
|
+
*/
|
|
66
260
|
private disableStoryAgentFlags;
|
|
261
|
+
/**
|
|
262
|
+
* Helper function to re-enable markup and balance checks for story agents
|
|
263
|
+
* Used after story creation, chapter progression, and compaction complete
|
|
264
|
+
* @param agents Array of agents to re-enable flags for
|
|
265
|
+
* @param reason Optional reason for logging (e.g., "story creation", "chapter progression")
|
|
266
|
+
*/
|
|
67
267
|
private enableStoryAgentFlags;
|
|
268
|
+
/**
|
|
269
|
+
* Compacts the conversation history for all agents in a story
|
|
270
|
+
* Uses story-specific prompts tailored for narrator (plot events) and characters (relationships)
|
|
271
|
+
* Processes all agents in parallel for better performance
|
|
272
|
+
* @param storyId The story ID
|
|
273
|
+
* @returns Success status, message, and details about compaction
|
|
274
|
+
*/
|
|
68
275
|
compactStory(storyId: string): Promise<{
|
|
69
276
|
success: boolean;
|
|
70
277
|
message?: string;
|
|
71
278
|
details?: any;
|
|
72
279
|
}>;
|
|
280
|
+
/**
|
|
281
|
+
* Progresses a story to the next chapter by:
|
|
282
|
+
* 1. Updating the Plot Plan artifact based on recent story events
|
|
283
|
+
* 2. Updating all Character Profile artifacts based on character development
|
|
284
|
+
* 3. Creating a new chapter folder with the next chapter index
|
|
285
|
+
* 4. Backing up the current room messages to the new chapter folder
|
|
286
|
+
* 5. Compacting the story conversation history in place
|
|
287
|
+
* 6. Clearing all room messages to start fresh for the next chapter
|
|
288
|
+
* @param storyId The story ID
|
|
289
|
+
* @returns Result with success status, chapter index, and compaction details
|
|
290
|
+
*/
|
|
73
291
|
progressStoryToNextChapter(storyId: string): Promise<{
|
|
74
292
|
chapterIndex: number;
|
|
75
293
|
}>;
|
|
294
|
+
/**
|
|
295
|
+
* Reverts the most recent chapter progression. Restores the previous
|
|
296
|
+
* chapter's room messages, artifacts, and agent histories from the
|
|
297
|
+
* `chapters/chapter_N/` backup, then deletes that backup so the story
|
|
298
|
+
* is back to exactly the state it was in before the player clicked
|
|
299
|
+
* Next Chapter.
|
|
300
|
+
*
|
|
301
|
+
* Only valid when the current chapter has not been played yet - i.e.
|
|
302
|
+
* the only room message is the Opening Scene. The endpoint also requires
|
|
303
|
+
* at least one chapter backup to exist.
|
|
304
|
+
*
|
|
305
|
+
* Token counts and cost totals are not rolled back (those tokens were
|
|
306
|
+
* actually consumed), matching `resetStory` semantics.
|
|
307
|
+
*
|
|
308
|
+
* @throws {NotFoundError} If the story or its room does not exist
|
|
309
|
+
* @throws {OperationFailedError} If no previous chapter exists, or the
|
|
310
|
+
* chapter has already been played past the opening scene.
|
|
311
|
+
*/
|
|
76
312
|
revertStoryChapter(storyId: string): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Performs the actual chapter progression work asynchronously
|
|
315
|
+
* Phase 1: Quick opening scene generation (user-visible, 5-10s)
|
|
316
|
+
* Phase 2: Background processing (plot, profiles, compaction, 20-50s)
|
|
317
|
+
*/
|
|
77
318
|
private progressStoryToNextChapterAsync;
|
|
319
|
+
/**
|
|
320
|
+
* Generates the opening scene for a new chapter and a title for the previous chapter
|
|
321
|
+
* Uses create_chapter prompt which returns the title on the first line (with a #
|
|
322
|
+
* prefix), then the same `<time>`/`<situation>` preamble a narration carries, then
|
|
323
|
+
* the opening scene.
|
|
324
|
+
*/
|
|
78
325
|
private generateOpeningScene;
|
|
326
|
+
/**
|
|
327
|
+
* Asks the moderator which characters are present for the opening scene of a
|
|
328
|
+
* new chapter.
|
|
329
|
+
*
|
|
330
|
+
* A chapter opening does not go through the room's message loop - it is written
|
|
331
|
+
* before the chapter exists and seeded straight into history - so nothing has
|
|
332
|
+
* decided its audience. Without this every character hears it, including the ones
|
|
333
|
+
* the narrator left several days' travel away.
|
|
334
|
+
*
|
|
335
|
+
* Requires the room's situation to already be the new chapter's, since that is
|
|
336
|
+
* what the moderator treats as authoritative about who is present.
|
|
337
|
+
*
|
|
338
|
+
* @returns The nicknames who may hear the opening scene, or null if the moderator
|
|
339
|
+
* could not be reached or named nobody - in which case the caller should seed
|
|
340
|
+
* every agent rather than silently narrate to an empty room.
|
|
341
|
+
*/
|
|
79
342
|
private moderateOpeningSceneAudience;
|
|
343
|
+
/**
|
|
344
|
+
* Compacts every agent whose history has outgrown the threshold, in parallel.
|
|
345
|
+
* The threshold and the exemption for windowed agents live on `Agent`, so a
|
|
346
|
+
* story and a room agree on when a history has grown too long.
|
|
347
|
+
* @param agents The agents to consider
|
|
348
|
+
*/
|
|
80
349
|
private compactAgentHistories;
|
|
81
350
|
private extractMarkdownContent;
|
|
82
351
|
private updatePlotPlan;
|
|
352
|
+
/**
|
|
353
|
+
* Stores a character's inventory in the owning agent's private context. The
|
|
354
|
+
* inventory is therefore visible only to that character (injected into its own
|
|
355
|
+
* transient prompt) and, in aggregate, to the Moderator — never to other
|
|
356
|
+
* characters. Storing it on the agent rather than in a room artifact keeps the
|
|
357
|
+
* frequently-changing inventory out of the cached system instructions.
|
|
358
|
+
*
|
|
359
|
+
* @param room The story room
|
|
360
|
+
* @param characterNickname The owning character's nickname
|
|
361
|
+
* @param body Markdown body of the inventory (typically '## Items' and optional '## Conditions' sections)
|
|
362
|
+
*/
|
|
83
363
|
private storeCharacterInventory;
|
|
364
|
+
/**
|
|
365
|
+
* Reads changes.update_inventory off a moderator response and rewrites each
|
|
366
|
+
* named character's stored inventory. Silently no-ops if no updates.
|
|
367
|
+
*
|
|
368
|
+
* @param room The story room
|
|
369
|
+
* @param moderatorMessage The moderator's RoomMessage (with .changes populated)
|
|
370
|
+
*/
|
|
84
371
|
private applyInventoryUpdates;
|
|
372
|
+
/**
|
|
373
|
+
* Helper method to update all character profiles based on story progression
|
|
374
|
+
* Processes all characters in parallel for better performance
|
|
375
|
+
* @param room The story room
|
|
376
|
+
* @param characterAgents Array of character agents (excluding narrator)
|
|
377
|
+
* @returns Update result with details for each character
|
|
378
|
+
*/
|
|
85
379
|
private updateCharacterProfiles;
|
|
380
|
+
/**
|
|
381
|
+
* Looks up image model configuration by name for one variant. Each consolidated
|
|
382
|
+
* entry in image_models.json carries a `generation` block (text-to-image) and an
|
|
383
|
+
* `editing` block (image-to-image); this returns the service/model for the
|
|
384
|
+
* requested variant.
|
|
385
|
+
* @param modelName The name from image_models.json
|
|
386
|
+
* @param variant Which model to resolve: 'generation' or 'editing'
|
|
387
|
+
* @returns {service, model} or null if disabled/not found
|
|
388
|
+
*/
|
|
86
389
|
private getImageModelConfig;
|
|
390
|
+
/**
|
|
391
|
+
* Looks up the image generation properties (API params plus centsPerImage)
|
|
392
|
+
* for an agent's model from image_models.json. This is read fresh at call
|
|
393
|
+
* time rather than stored on the Agent — only the modelName is persisted.
|
|
394
|
+
*
|
|
395
|
+
* @param agent The artist or artistEdit agent
|
|
396
|
+
* @returns The merged imageProperties to pass to generateImage/editImage,
|
|
397
|
+
* or an empty object if the model isn't in image_models.json
|
|
398
|
+
*/
|
|
87
399
|
private getImagePropertiesForAgent;
|
|
400
|
+
/**
|
|
401
|
+
* Creates the artist agent for a story
|
|
402
|
+
* The artist agent is persistent and saved to disk for cost tracking
|
|
403
|
+
* @param storyId The story ID
|
|
404
|
+
* @param storyAgentsDir The story agents directory
|
|
405
|
+
* @param storyArtifactService The story artifact service
|
|
406
|
+
* @param imageModelName The consolidated image model name from image_models.json
|
|
407
|
+
* @param nickname The agent nickname ('Artist' or 'Artist (Edit)')
|
|
408
|
+
* @param variant Which model of the entry to use: 'generation' or 'editing'
|
|
409
|
+
* @returns Artist agent
|
|
410
|
+
*/
|
|
88
411
|
private createArtistAgent;
|
|
412
|
+
/**
|
|
413
|
+
* Generates portrait image for a character
|
|
414
|
+
* @param room The story room
|
|
415
|
+
* @param characterAgent The character agent
|
|
416
|
+
* @param storyId The story ID
|
|
417
|
+
* @returns Promise resolving to the artifact ID of the generated image, or null on failure
|
|
418
|
+
*/
|
|
89
419
|
private generateCharacterPortrait;
|
|
420
|
+
/**
|
|
421
|
+
* Generates a portrait for a character by name + profile, without requiring a character agent.
|
|
422
|
+
* Used for both real characters (delegated from generateCharacterPortrait) and for minor
|
|
423
|
+
* characters named by the illustrator that have no agent backing them.
|
|
424
|
+
*
|
|
425
|
+
* @param storyId The story ID
|
|
426
|
+
* @param characterName The character's display name (used for the Portrait - <name> artifact)
|
|
427
|
+
* @param characterProfile A profile or brief description used to author the visual prompt
|
|
428
|
+
* @param promptAgent Agent used to run describe_character. Defaults to the artist when omitted.
|
|
429
|
+
* @returns Artifact ID of the generated portrait, or null on failure
|
|
430
|
+
*/
|
|
90
431
|
private generatePortraitForName;
|
|
91
432
|
private updateCharacterPortrait;
|
|
433
|
+
/**
|
|
434
|
+
* Generates scene illustrations based on narrator messages
|
|
435
|
+
*/
|
|
92
436
|
private generateSceneIllustration;
|
|
437
|
+
/**
|
|
438
|
+
* Ensures every character named by the illustrator has a Portrait artifact before the
|
|
439
|
+
* story image is generated. Names already present in existingPortraitNames are skipped.
|
|
440
|
+
* Unknown names must have a matching entry in newCharacters (providing briefDescription)
|
|
441
|
+
* — otherwise we cannot generate a portrait and the character is dropped from logging
|
|
442
|
+
* (generateStoryImage's existing fallback will then warn and skip them).
|
|
443
|
+
*/
|
|
93
444
|
private ensureMinorCharacterPortraits;
|
|
445
|
+
/**
|
|
446
|
+
* Generates scene reference image (environment only)
|
|
447
|
+
*/
|
|
94
448
|
private generateSceneReference;
|
|
449
|
+
/**
|
|
450
|
+
* Generates story image (scene + characters)
|
|
451
|
+
*/
|
|
95
452
|
private generateStoryImage;
|
|
453
|
+
/**
|
|
454
|
+
* Parses the narrator's preamble into structured fields. Extracts each
|
|
455
|
+
* tag's inner text (first occurrence, case-insensitive); missing tags
|
|
456
|
+
* are simply omitted from the result.
|
|
457
|
+
*/
|
|
96
458
|
private parseNarratorPreamble;
|
|
459
|
+
/**
|
|
460
|
+
* Updates the story's situation in metadata. Invoked from the Room's
|
|
461
|
+
* situation-update callback with the raw preamble text emitted by the
|
|
462
|
+
* narrator. The Room itself stays story-agnostic and does not interpret
|
|
463
|
+
* the preamble contents - all parsing happens here.
|
|
464
|
+
*
|
|
465
|
+
* @param storyId The story ID
|
|
466
|
+
* @param preamble The raw preamble text captured by the Room
|
|
467
|
+
*/
|
|
97
468
|
private updateStorySituation;
|
|
469
|
+
/**
|
|
470
|
+
* Generates a complete markdown document of the story
|
|
471
|
+
* Includes metadata, all completed chapters, and current chapter in progress
|
|
472
|
+
* @param storyId The story ID
|
|
473
|
+
* @returns The complete story as markdown text
|
|
474
|
+
*/
|
|
98
475
|
generateStoryMarkdown(storyId: string): Promise<string>;
|
|
476
|
+
/**
|
|
477
|
+
* Creates a zip archive of the entire story folder
|
|
478
|
+
* @param storyId The story ID
|
|
479
|
+
* @returns Promise resolving to a readable stream of the zip file
|
|
480
|
+
*/
|
|
99
481
|
exportStoryData(storyId: string): Promise<{
|
|
100
482
|
stream: Readable;
|
|
101
483
|
filename: string;
|
|
102
484
|
}>;
|
|
485
|
+
/**
|
|
486
|
+
* Formats room messages as markdown text
|
|
487
|
+
* @param messages Array of room messages
|
|
488
|
+
* @returns Formatted markdown string
|
|
489
|
+
*/
|
|
103
490
|
private formatMessagesToMarkdown;
|
|
491
|
+
/**
|
|
492
|
+
* Process markdown to add sizing to images for better display
|
|
493
|
+
* Converts  to <img> tags with width constraints
|
|
494
|
+
* @param markdown The markdown string to process
|
|
495
|
+
* @param maxWidth Maximum width for images (default: 600px)
|
|
496
|
+
* @returns Processed markdown with HTML img tags
|
|
497
|
+
*/
|
|
104
498
|
private processImageMarkdown;
|
|
499
|
+
/**
|
|
500
|
+
* Updates the story's total cost by aggregating costs from all agents in the story's room
|
|
501
|
+
* @param storyId The story ID
|
|
502
|
+
*/
|
|
105
503
|
private updateStoryCost;
|
|
106
504
|
}
|