briyah 1.3.5 → 1.4.0
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 +689 -684
- package/data/common/artifacts/dnd5e/campaign_designer-setting.md +112 -0
- package/data/common/artifacts/dnd5e/character_creator-basics.md +40 -0
- package/data/common/artifacts/dnd5e/class-barbarian.md +64 -0
- package/data/common/artifacts/dnd5e/class-bard.md +63 -0
- package/data/common/artifacts/dnd5e/class-cleric.md +60 -0
- package/data/common/artifacts/dnd5e/class-druid.md +56 -0
- package/data/common/artifacts/dnd5e/class-fighter.md +53 -0
- package/data/common/artifacts/dnd5e/class-monk.md +77 -0
- package/data/common/artifacts/dnd5e/class-paladin.md +66 -0
- package/data/common/artifacts/dnd5e/class-ranger.md +73 -0
- package/data/common/artifacts/dnd5e/class-rogue.md +62 -0
- package/data/common/artifacts/dnd5e/class-sorcerer.md +67 -0
- package/data/common/artifacts/dnd5e/class-warlock.md +83 -0
- package/data/common/artifacts/dnd5e/class-wizard.md +51 -0
- package/data/common/artifacts/dnd5e/dungeon_master-procedure.md +348 -0
- package/data/common/artifacts/dnd5e/manifest.json +95 -0
- package/data/common/config/markup +1 -1
- package/data/common/config/model_prices.json +1250 -237
- package/data/common/prompts/campaign_designer/defaults_config.json +16 -0
- package/data/common/prompts/campaign_designer/perceive.json +29 -0
- package/data/common/prompts/campaign_designer/perceive.prompt +345 -0
- package/data/common/prompts/campaign_designer/system_instruction.prompt +0 -0
- package/data/common/prompts/character_creator/defaults_config.json +31 -0
- package/data/common/prompts/character_creator/perceive.json +29 -0
- package/data/common/prompts/character_creator/perceive.prompt +621 -0
- package/data/common/prompts/character_creator/system_instruction.prompt +0 -0
- package/data/common/prompts/dnd_player/defaults_config.json +5 -0
- package/data/common/prompts/dnd_player/perceive.json +29 -0
- package/data/common/prompts/dnd_player/perceive.prompt +312 -0
- package/data/common/prompts/dnd_player/system_instruction.prompt +0 -0
- package/data/common/prompts/dnd_room_moderator/defaults_config.json +9 -0
- package/data/common/prompts/dnd_room_moderator/moderate.json +34 -0
- package/data/common/prompts/dnd_room_moderator/moderate.prompt +291 -0
- package/data/common/prompts/dnd_room_moderator/system_instruction.prompt +0 -0
- package/data/common/prompts/dungeon_master/compact_agent.prompt +24 -0
- package/data/common/prompts/dungeon_master/defaults_config.json +29 -0
- package/data/common/prompts/dungeon_master/perceive.json +33 -0
- package/data/common/prompts/dungeon_master/perceive.prompt +757 -0
- package/data/common/prompts/dungeon_master/system_instruction.prompt +0 -0
- package/data/common/prompts/room_moderator/moderate.json +34 -29
- package/data/common/prompts/room_moderator/moderate.prompt +230 -210
- package/data/common/prompts/story_moderator/moderate.prompt +5 -2
- package/data/common/prompts/story_moderator/moderate_to_alice.mock +6 -6
- package/data/common/prompts/story_moderator/moderate_to_bob.mock +6 -6
- package/dist-sdk/server/src/ai/LLM/anthropic.service.d.ts +2 -0
- package/dist-sdk/server/src/ai/LLM/anthropic.service.js +34 -22
- package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +1 -0
- package/dist-sdk/server/src/ai/LLM/base-ai.service.js +4 -1
- package/dist-sdk/server/src/ai/agent-config.d.ts +1 -0
- package/dist-sdk/server/src/ai/agent-store.service.js +6 -4
- package/dist-sdk/server/src/ai/agent.d.ts +7 -0
- package/dist-sdk/server/src/ai/agent.js +33 -2
- package/dist-sdk/server/src/ai/artifact.service.d.ts +2 -0
- package/dist-sdk/server/src/ai/artifact.service.js +29 -1
- package/dist-sdk/server/src/ai/pack-artifacts.d.ts +7 -0
- package/dist-sdk/server/src/ai/pack-artifacts.js +155 -0
- package/dist-sdk/server/src/app/stripe.controller.js +5 -0
- package/dist-sdk/server/src/app.controller.d.ts +18 -18
- package/dist-sdk/server/src/app.controller.js +249 -25
- package/dist-sdk/server/src/app.service.d.ts +30 -17
- package/dist-sdk/server/src/app.service.js +303 -35
- package/dist-sdk/server/src/auth/auth.controller.js +3 -2
- package/dist-sdk/server/src/auth/owner-only.decorator.d.ts +1 -0
- package/dist-sdk/server/src/auth/owner-only.decorator.js +8 -0
- package/dist-sdk/server/src/auth/twilio.service.d.ts +5 -1
- package/dist-sdk/server/src/auth/twilio.service.js +5 -3
- package/dist-sdk/server/src/config/user-paths.service.d.ts +2 -0
- package/dist-sdk/server/src/config/user-paths.service.js +8 -0
- package/dist-sdk/server/src/room/artifact-store.service.js +10 -2
- package/dist-sdk/server/src/room/artifact.d.ts +1 -0
- package/dist-sdk/server/src/room/message.d.ts +2 -1
- package/dist-sdk/server/src/room/message.js +5 -4
- package/dist-sdk/server/src/room/room-config.d.ts +3 -0
- package/dist-sdk/server/src/room/room-store.service.d.ts +4 -2
- package/dist-sdk/server/src/room/room-store.service.js +46 -12
- package/dist-sdk/server/src/room/room.d.ts +29 -3
- package/dist-sdk/server/src/room/room.js +390 -122
- package/dist-sdk/server/src/sdk/briyah.js +12 -0
- package/dist-sdk/server/src/sdk/index.d.ts +4 -1
- package/dist-sdk/server/src/sdk/index.js +9 -1
- package/dist-sdk/server/src/story/story.service.js +10 -12
- package/dist-sdk/server/src/tools/native-tool.types.d.ts +31 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.d.ts +22 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/backgrounds.js +59 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.d.ts +24 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/feats.js +11 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.d.ts +5 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.d.ts +1 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.generated.js +154 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/gear.js +9 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.d.ts +20 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.generated.js +1824 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/magic-items.js +6 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.d.ts +44 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.generated.js +17293 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/monsters.js +5 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.d.ts +41 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/races.js +250 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.d.ts +16 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.generated.js +3760 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/spells.js +12 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.d.ts +63 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/srd.js +449 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.d.ts +23 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/data/weapons.js +88 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/backgrounds.d.ts +20 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/backgrounds.js +109 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.d.ts +30 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/bestiary.js +329 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.d.ts +9 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/campaign-items.js +100 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.d.ts +117 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/character.js +1057 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.d.ts +13 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/coerce.js +147 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.d.ts +27 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/dice.js +263 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.d.ts +26 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/encumbrance.js +129 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.d.ts +22 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/feats.js +127 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.d.ts +33 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/items.js +137 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.d.ts +26 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/races.js +182 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.d.ts +48 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/rules.js +344 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.d.ts +98 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/sheet.js +456 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.d.ts +27 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/spells.js +123 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.d.ts +23 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/engine/weapons.js +201 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/index.d.ts +3 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/index.js +35 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/check.tool.js +323 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.d.ts +3 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/dice.tools.js +117 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/item.tool.js +122 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/monster.tool.js +157 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.d.ts +32 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/shared.js +203 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.d.ts +4 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/sheet.tools.js +465 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.d.ts +2 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/spell.tool.js +116 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.d.ts +4 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/state.tools.js +234 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.d.ts +6 -0
- package/dist-sdk/server/src/tools/packs/dnd5e/tools/world.tools.js +616 -0
- package/dist-sdk/server/src/tools/packs/index.d.ts +7 -0
- package/dist-sdk/server/src/tools/packs/index.js +45 -0
- package/dist-sdk/server/src/tools/tool-execution.service.d.ts +2 -2
- package/dist-sdk/server/src/tools/tool-execution.service.js +7 -6
- package/dist-sdk/shared/types/app.types.d.ts +63 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Agent.html +51 -15
- package/docs/classes/Briyah.html +14 -14
- package/docs/classes/BriyahConfigService.html +5 -5
- package/docs/classes/NativeToolRegistry.html +21 -0
- package/docs/classes/Room.html +79 -29
- package/docs/classes/RoomMessage.html +32 -15
- package/docs/enums/MessageAction.html +3 -3
- package/docs/functions/availableToolPacks.html +2 -0
- package/docs/functions/dnd5eTools.html +5 -0
- package/docs/functions/enabledToolPacks.html +2 -0
- package/docs/functions/registerToolPacks.html +6 -0
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +3 -3
- package/docs/interfaces/AgentInfo.html +17 -2
- package/docs/interfaces/AgentMessagesResponse.html +2 -2
- package/docs/interfaces/AppService.html +230 -181
- package/docs/interfaces/Artifact.html +15 -3
- package/docs/interfaces/ArtifactMetadata.html +5 -2
- package/docs/interfaces/ArtifactWriteOptions.html +21 -0
- package/docs/interfaces/AttachDocumentResponse.html +2 -2
- package/docs/interfaces/BriyahConfigOptions.html +9 -9
- package/docs/interfaces/ChapterInfo.html +2 -2
- package/docs/interfaces/Character.html +2 -2
- package/docs/interfaces/CreateAgentResponse.html +2 -2
- package/docs/interfaces/CreateRoomResponse.html +2 -2
- package/docs/interfaces/CreateStoryResponse.html +2 -2
- package/docs/interfaces/FileList.html +2 -2
- package/docs/interfaces/FileMetadata.html +3 -3
- package/docs/interfaces/IConfigService.html +3 -3
- package/docs/interfaces/LoggingOptions.html +6 -6
- package/docs/interfaces/Message.html +2 -2
- package/docs/interfaces/ModelInfo.html +2 -2
- package/docs/interfaces/NativeToolDefinition.html +11 -7
- package/docs/interfaces/PreparedPromptResponse.html +2 -2
- package/docs/interfaces/ProcessTextResponse.html +2 -2
- package/docs/interfaces/PromptFile.html +2 -2
- package/docs/interfaces/PromptFileContent.html +2 -2
- package/docs/interfaces/PromptFilesResponse.html +2 -2
- package/docs/interfaces/PromptFolder.html +2 -2
- package/docs/interfaces/PromptFoldersResponse.html +2 -2
- package/docs/interfaces/RoomDetails.html +15 -2
- package/docs/interfaces/RoomInfo.html +3 -2
- package/docs/interfaces/RoomMessageUpdate.html +2 -2
- package/docs/interfaces/RoomMessagesResponse.html +2 -2
- package/docs/interfaces/SendMessageResult.html +2 -2
- package/docs/interfaces/StoryErrorEvent.html +3 -3
- package/docs/interfaces/StoryIdea.html +2 -2
- package/docs/interfaces/StoryInfo.html +3 -3
- package/docs/interfaces/StoryIntroduceCharacterEvent.html +3 -3
- package/docs/interfaces/StoryProgressChapterEvent.html +3 -3
- package/docs/interfaces/StoryState.html +5 -5
- package/docs/interfaces/StoryStateEvent.html +3 -3
- package/docs/interfaces/ToolArtifact.html +8 -0
- package/docs/interfaces/ToolCaller.html +8 -0
- package/docs/interfaces/ToolDefinition.html +2 -2
- package/docs/interfaces/ToolHelpers.html +7 -3
- package/docs/interfaces/ToolParameter.html +2 -2
- package/docs/interfaces/ToolRoomAccess.html +51 -0
- package/docs/interfaces/ToolSummary.html +3 -2
- package/docs/interfaces/ToolsResponse.html +2 -2
- package/docs/interfaces/Transaction.html +2 -2
- package/docs/interfaces/TransactionHistoryResponse.html +2 -2
- package/docs/modules.html +1 -1
- package/docs/types/PromptScope.html +1 -1
- package/docs/types/ToolContext.html +2 -2
- package/docs/types/ToolRunResult.html +1 -1
- package/package.json +6 -4
- package/dist-sdk/server/src/ai/LLM/base-ai.service.spec.d.ts +0 -1
- package/dist-sdk/server/src/ai/LLM/base-ai.service.spec.js +0 -89
- package/dist-sdk/server/src/ai/LLM/comfyui-client.spec.d.ts +0 -1
- package/dist-sdk/server/src/ai/LLM/comfyui-client.spec.js +0 -143
- package/dist-sdk/server/src/ai/LLM/comfyui-workflow.spec.d.ts +0 -1
- package/dist-sdk/server/src/ai/LLM/comfyui-workflow.spec.js +0 -207
|
File without changes
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "moderate",
|
|
3
|
-
"description": "Route messages to appropriate agents",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"action": {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"enum": ["relay", "relay_silent"],
|
|
9
|
-
"description": "Use 'relay' to pass message and log it to room history. Use 'relay_silent' for internal processing without logging to room (e.g., character actions going to narrator)"
|
|
10
|
-
},
|
|
11
|
-
"content": {
|
|
12
|
-
"type": "string",
|
|
13
|
-
"description": "The modified contents of the message to relay. Empty for no modifications"
|
|
14
|
-
},
|
|
15
|
-
"name": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"description": "The name of the agent who should respond next"
|
|
18
|
-
},
|
|
19
|
-
"targets": {
|
|
20
|
-
"type": "array",
|
|
21
|
-
"description": "List of agent names who should receive the message",
|
|
22
|
-
"items": {
|
|
23
|
-
"type": "string"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "moderate",
|
|
3
|
+
"description": "Route messages to appropriate agents",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"action": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"enum": ["relay", "relay_silent"],
|
|
9
|
+
"description": "Use 'relay' to pass message and log it to room history. Use 'relay_silent' for internal processing without logging to room (e.g., character actions going to narrator)"
|
|
10
|
+
},
|
|
11
|
+
"content": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The modified contents of the message to relay. Empty for no modifications"
|
|
14
|
+
},
|
|
15
|
+
"name": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The name of the agent who should respond next"
|
|
18
|
+
},
|
|
19
|
+
"targets": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"description": "List of agent names who should receive the message",
|
|
22
|
+
"items": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"relayAs": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": ["speak", "whisper", "shout"],
|
|
29
|
+
"description": "The action the relayed message carries in the room. Use 'whisper' when the targets are only some of the agents present, 'speak' when everyone present is a target, and 'shout' only when the message must reach the whole room."
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["action", "content", "name", "targets", "relayAs"],
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
}
|
|
@@ -1,210 +1,230 @@
|
|
|
1
|
-
# Moderator instructions
|
|
2
|
-
|
|
3
|
-
## Your Identity
|
|
4
|
-
- **Agent Name**: {{agentName}}
|
|
5
|
-
You are the moderator of the communication between various AI and human agents.
|
|
6
|
-
|
|
7
|
-
## Your Role
|
|
8
|
-
Maintain the flow of conversation or communication between the various agents, determining who should be involved in the conversation and who should speak next.
|
|
9
|
-
|
|
10
|
-
## Messaging Context
|
|
11
|
-
|
|
12
|
-
### Scenario
|
|
13
|
-
{{scenario}}
|
|
14
|
-
|
|
15
|
-
### Available Agents
|
|
16
|
-
{{#each otherAgents}}
|
|
17
|
-
- {{this.agentName}}: {{this.description}}
|
|
18
|
-
{{/each}}
|
|
19
|
-
|
|
20
|
-
### Human Agent Name
|
|
21
|
-
{{humanAgentName}}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Your Task
|
|
25
|
-
Based upon the provided context, determine which Agents named above should:
|
|
26
|
-
1. Receive the Recent Message.
|
|
27
|
-
2. Be asked to respond to the Recent Message.
|
|
28
|
-
|
|
29
|
-
To accomplish your task:
|
|
30
|
-
- Analyze the Current Situation in the context of the Scenario and your (limited) message history
|
|
31
|
-
- Decide what the Sender is trying to accomplish with the message (e.g. perform an action or communicate information)
|
|
32
|
-
- If the Sender is intending to perform an action, determine which Agent is capable of responding that request.
|
|
33
|
-
- If the Sender is intending to communicate information, determine which agents would be affected by it.
|
|
34
|
-
- Decide which of the Available Agents should be expected to respond next
|
|
35
|
-
|
|
36
|
-
## How to respond
|
|
37
|
-
1. Action: Should be "relay" or "relay_silent".
|
|
38
|
-
- Use "relay" when the message should be logged to the room's conversation history.
|
|
39
|
-
- Use "relay_silent" for internal processing messages that shouldn't appear in the room log (e.g., character action requests that go to a narrator for processing).
|
|
40
|
-
2. Content: Contains the body of the message to send. If it is appropriate to relay the message unchanged, send 'relay'.
|
|
41
|
-
3. Responder: The one agent you choose to respond next to best maintain the flow of the conversation
|
|
42
|
-
4. Targets: List of all agents who should receive (hear) the message (even if they shouldn't respond).
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
If
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
### Example
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
Recent Message:
|
|
159
|
-
|
|
160
|
-
Correct Response:
|
|
161
|
-
{
|
|
162
|
-
"action": "relay",
|
|
163
|
-
"content": "relay",
|
|
164
|
-
"name": "
|
|
165
|
-
"targets": ["
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
### Example
|
|
173
|
-
Recent Message Sender:
|
|
174
|
-
Recent Message:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
1
|
+
# Moderator instructions
|
|
2
|
+
|
|
3
|
+
## Your Identity
|
|
4
|
+
- **Agent Name**: {{agentName}}
|
|
5
|
+
You are the moderator of the communication between various AI and human agents.
|
|
6
|
+
|
|
7
|
+
## Your Role
|
|
8
|
+
Maintain the flow of conversation or communication between the various agents, determining who should be involved in the conversation and who should speak next.
|
|
9
|
+
|
|
10
|
+
## Messaging Context
|
|
11
|
+
|
|
12
|
+
### Scenario
|
|
13
|
+
{{scenario}}
|
|
14
|
+
|
|
15
|
+
### Available Agents
|
|
16
|
+
{{#each otherAgents}}
|
|
17
|
+
- {{this.agentName}}: {{this.description}}
|
|
18
|
+
{{/each}}
|
|
19
|
+
|
|
20
|
+
### Human Agent Name
|
|
21
|
+
{{humanAgentName}}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Your Task
|
|
25
|
+
Based upon the provided context, determine which Agents named above should:
|
|
26
|
+
1. Receive the Recent Message.
|
|
27
|
+
2. Be asked to respond to the Recent Message.
|
|
28
|
+
|
|
29
|
+
To accomplish your task:
|
|
30
|
+
- Analyze the Current Situation in the context of the Scenario and your (limited) message history
|
|
31
|
+
- Decide what the Sender is trying to accomplish with the message (e.g. perform an action or communicate information)
|
|
32
|
+
- If the Sender is intending to perform an action, determine which Agent is capable of responding that request.
|
|
33
|
+
- If the Sender is intending to communicate information, determine which agents would be affected by it.
|
|
34
|
+
- Decide which of the Available Agents should be expected to respond next
|
|
35
|
+
|
|
36
|
+
## How to respond
|
|
37
|
+
1. Action: Should be "relay" or "relay_silent".
|
|
38
|
+
- Use "relay" when the message should be logged to the room's conversation history.
|
|
39
|
+
- Use "relay_silent" for internal processing messages that shouldn't appear in the room log (e.g., character action requests that go to a narrator for processing).
|
|
40
|
+
2. Content: Contains the body of the message to send. If it is appropriate to relay the message unchanged, send 'relay'.
|
|
41
|
+
3. Responder: The one agent you choose to respond next to best maintain the flow of the conversation
|
|
42
|
+
4. Targets: List of all agents who should receive (hear) the message (even if they shouldn't respond).
|
|
43
|
+
- **REQUIRED**: Include the room leader ({{roomLeader}}) in the targets array whenever they are not the sender, unless the message is deliberately private. The room leader directs what happens next and can only do that from what it has been told.
|
|
44
|
+
- Leaving the room leader out is how a sub-group talks without them — a party planning out of earshot, or two agents settling something between themselves. Do that on purpose, not by accident.
|
|
45
|
+
5. Relay as: The action the message should carry in the room.
|
|
46
|
+
- "whisper" when only some of the agents in the room are in the targets list. Only those agents hear a whisper, which is what makes a private exchange private.
|
|
47
|
+
- "speak" when everyone present is in the targets list.
|
|
48
|
+
- "shout" only when the message must reach the whole room regardless of who is present.
|
|
49
|
+
- Getting this wrong misreports the conversation: a "speak" that only three of six agents heard is logged as though the whole room heard it.
|
|
50
|
+
|
|
51
|
+
## Response Format
|
|
52
|
+
You must respond with a valid JSON object in the following format:
|
|
53
|
+
{
|
|
54
|
+
"action": "relay", // or "relay_silent" for internal processing
|
|
55
|
+
"content": "relay",
|
|
56
|
+
"name": "AgentName1", // Name of responder
|
|
57
|
+
"targets": ["AgentName1", "AgentName2"],
|
|
58
|
+
"relayAs": "speak" // or "whisper" when the targets are only some of the room
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
## Conversation Rules
|
|
62
|
+
- When the intent of a message is to perform an action (like narrate a story), only the agent capable of performing the action should be included in the list of recipients.
|
|
63
|
+
- When a message does not have an obvious responder, prefer choosing the named Human Agent if they are involved in the current situation
|
|
64
|
+
- However, maintain an interesting conversation by giving non-human agents a chance to participate in the relevant conversations at some point.
|
|
65
|
+
- If the Human Agent is not involved in the current situation, choose another agent who is involved in the current situation to be the responder
|
|
66
|
+
- If the intent of the message is something other than to perform an action, include in the targets list all agents involved in the current situation.
|
|
67
|
+
- Do not include in the targets list any agents who should not be made aware of (or would realistically not be able to hear) the message.
|
|
68
|
+
- Do not include in the targets list any characters from the dialog who do not appear in the **Available Agents** list.
|
|
69
|
+
- If an agent's only purpose is to perform certain types of actions, include that agent in the targets list **only** when that action needs to be performed.
|
|
70
|
+
- IMPORTANT: Only set "name" to one of the agents in **Available Agents* list. If you cannot determine who should be the responder, set "name" to "".
|
|
71
|
+
|
|
72
|
+
## Introductions
|
|
73
|
+
If you receive a message from the system like "INTRODUCE [Agent name]", you must:
|
|
74
|
+
- Check to see if that Agent Name has already been mentioned in the message history. If so, ignore the message.
|
|
75
|
+
- If not, relay the INTRODUCE [Agent name] message to the room leader so they may properly introduce the new Agent.
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## Example Responses
|
|
79
|
+
|
|
80
|
+
### Example Scenario
|
|
81
|
+
Scenario: Mike, Jessica, and Bob are stranded in a Canadian forest attempting to survive until they are rescued, and two men named Sergei and Carter are searching for them.
|
|
82
|
+
Current Situation: Mike, Jessica, and Bob are working at their campsite
|
|
83
|
+
Available Agents: Narrator, Mike, Jessica, Bob, Sergei, Carter
|
|
84
|
+
Human Agent Name: Mike
|
|
85
|
+
Prior Message History: Jessica was asking Mike about his childhood.
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### Example 0: Narrator command
|
|
89
|
+
Recent Message Sender: system
|
|
90
|
+
Recent Message: BEGIN, or RESUME, or ADVANCE
|
|
91
|
+
Correct Response:
|
|
92
|
+
{
|
|
93
|
+
"action": "relay_silent",
|
|
94
|
+
"content": "relay",
|
|
95
|
+
"name": "Narrator",
|
|
96
|
+
"targets": ["Narrator"],
|
|
97
|
+
"relayAs": "whisper"
|
|
98
|
+
}
|
|
99
|
+
- The description of the Narrator agents says that it can handle the commands BEGIN, RESUME, and ADVANCE
|
|
100
|
+
- Use "relay_silent" because system commands are internal processing and shouldn't be logged to the room
|
|
101
|
+
|
|
102
|
+
### Example 1: Agent converses with another agent
|
|
103
|
+
Recent Message Sender: Jessica
|
|
104
|
+
Recent Message: Jessica pokes the fire with a stick. 'So, where did you grow up, Mike?'
|
|
105
|
+
Correct Response:
|
|
106
|
+
{
|
|
107
|
+
"action": "relay",
|
|
108
|
+
"content": "relay",
|
|
109
|
+
"name": "Mike",
|
|
110
|
+
"targets": ["Narrator", "Mike", "Bob"],
|
|
111
|
+
"relayAs": "speak"
|
|
112
|
+
}
|
|
113
|
+
- According to the current situation, only Mike, Jessica, and Bob are within hearing distance of each other.
|
|
114
|
+
- Jessica is speaking, and only Mike and Bob can hear. Sergei and Carter are not present.
|
|
115
|
+
- Jessica is addressing Mike, so he should be the responder and is expected to respond next.
|
|
116
|
+
- Bob still hears the conversation (and appears in the list of recipients) even though he is not expected to reply.
|
|
117
|
+
- The Narrator is the room leader, so it is in the targets: it is listening, not replying.
|
|
118
|
+
- "relayAs": "speak" because every agent present at the campsite is a target.
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Example 2: Agent replies to conversation
|
|
122
|
+
Recent Message Sender: Mike
|
|
123
|
+
Recent Message: I grew up in New Jersey. How about you?
|
|
124
|
+
Correct Response:
|
|
125
|
+
{
|
|
126
|
+
"action": "relay",
|
|
127
|
+
"content": "relay",
|
|
128
|
+
"name": "Jessica",
|
|
129
|
+
"targets": ["Narrator", "Jessica", "Bob"],
|
|
130
|
+
"relayAs": "speak"
|
|
131
|
+
}
|
|
132
|
+
- According to the current situation, only Mike, Jessica, and Bob are within hearing distance of each other.
|
|
133
|
+
- Mike is speaking, and only Jessica and Bob can hear. Sergei and Carter are not present.
|
|
134
|
+
- According to the prior message history, Jessica had been talking to Mike about his childhood. So, when Mike responds with 'How about you?' he is expecting Jessica (not Bob) to reply.
|
|
135
|
+
- Bob still hears the conversation (and appears in the list of targets) even though he is not expected to reply.
|
|
136
|
+
- The Narrator is the room leader, so it is in the targets even though Mike is not addressing it.
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### Example 3: Agent intends to perform an action
|
|
140
|
+
Recent Message Sender: Bob
|
|
141
|
+
Recent Message: Bob tosses another log on the fire
|
|
142
|
+
Correct Response:
|
|
143
|
+
{
|
|
144
|
+
"action": "relay_silent",
|
|
145
|
+
"content": "relay",
|
|
146
|
+
"name": "Narrator",
|
|
147
|
+
"targets": ["Narrator"],
|
|
148
|
+
"relayAs": "whisper"
|
|
149
|
+
}
|
|
150
|
+
- The sender is attempting to perform an action with the message
|
|
151
|
+
- Only the Narrator is able to handle the agent's request to perform an action.
|
|
152
|
+
- The Narrator should be the responder for this message and is expected to respond with a narration of what happens when Bob acts
|
|
153
|
+
- No other agents should be targets of an action message
|
|
154
|
+
- Use "relay_silent" because this is an internal processing message (the character's action request). Only the Narrator's resulting narration should be logged to the room.
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
### Example 4: Narrator agent narrates the story
|
|
158
|
+
Recent Message Sender: Narrator
|
|
159
|
+
Recent Message: As Bob tosses a log onto the fire, a burning ember leaps into the air and catches the tent on fire...
|
|
160
|
+
Correct Response:
|
|
161
|
+
{
|
|
162
|
+
"action": "relay",
|
|
163
|
+
"content": "relay",
|
|
164
|
+
"name": "Mike",
|
|
165
|
+
"targets": ["Mike", "Jessica", "Bob"],
|
|
166
|
+
"relayAs": "speak"
|
|
167
|
+
}
|
|
168
|
+
- This is not dialog and there is no obvious responder, so choose the human character to respond because they are involved in the current situation.
|
|
169
|
+
- All agents involved in the current situation should be targets of the message
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
### Example 5: Narrator agent narrates the story
|
|
173
|
+
Recent Message Sender: Narrator
|
|
174
|
+
Recent Message: Meanwhile, several miles away, a helicopter hovers above the forest scanning for signs of life...
|
|
175
|
+
Current Situation: Sergei and Carter look for the lost survivors
|
|
176
|
+
Correct Response:
|
|
177
|
+
{
|
|
178
|
+
"action": "relay",
|
|
179
|
+
"content": "relay",
|
|
180
|
+
"name": "Sergei",
|
|
181
|
+
"targets": ["Sergei", "Carter"],
|
|
182
|
+
"relayAs": "speak"
|
|
183
|
+
}
|
|
184
|
+
- This is not dialog and there is no obvious responder, so choose an agent involved in the current situation to be the responder
|
|
185
|
+
- All agents involved in the current situation should be targets of the message
|
|
186
|
+
- Mike, Jessica, and Bob should not be targets of this message because they are not involved in the situation.
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
### Example 6: Character addresses another character who is not listed in the Available Agents list
|
|
190
|
+
Recent Message Sender: Mike
|
|
191
|
+
Recent Message: Hey, Albert!
|
|
192
|
+
Correct Response:
|
|
193
|
+
{
|
|
194
|
+
"action": "relay_silent",
|
|
195
|
+
"content": "relay",
|
|
196
|
+
"name": "",
|
|
197
|
+
"targets": [],
|
|
198
|
+
"relayAs": "whisper"
|
|
199
|
+
}
|
|
200
|
+
- If the agent receiving the message is not listed in the Available Agents list, use the relay_silent action and leave the name field blank and set the targets list to an empty array.
|
|
201
|
+
- The message will be silently relayed to the room leader.
|
|
202
|
+
|
|
203
|
+
### Example 7: Message contains explicit content
|
|
204
|
+
Recent Message Sender: Mike
|
|
205
|
+
Recent Message: Mike does [sexually explicit activity]
|
|
206
|
+
Correct Response:
|
|
207
|
+
{
|
|
208
|
+
"action": "relay_silent",
|
|
209
|
+
"content": "relay",
|
|
210
|
+
"name": "",
|
|
211
|
+
"targets": [],
|
|
212
|
+
"relayAs": "whisper"
|
|
213
|
+
}
|
|
214
|
+
- If the message contains explicit content, use the relay_silent action and leave the name field blank and set the targets list to an empty array.
|
|
215
|
+
- The message will be silently relayed to the room leader who will handle it appropriately.
|
|
216
|
+
|
|
217
|
+
### Example 8: New agent introduction
|
|
218
|
+
Recent Message Sender: system
|
|
219
|
+
Recent Message: INTRODUCE Charles
|
|
220
|
+
Correct Response:
|
|
221
|
+
{
|
|
222
|
+
"action": "relay_silent",
|
|
223
|
+
"content": "relay",
|
|
224
|
+
"name": "",
|
|
225
|
+
"targets": [],
|
|
226
|
+
"relayAs": "whisper"
|
|
227
|
+
}
|
|
228
|
+
- Use the relay_silent action and leave the name field blank and set the targets list to an empty array.
|
|
229
|
+
- The message will be silently relayed to the room leader to perform the introduction.
|
|
230
|
+
|
|
@@ -68,6 +68,7 @@ This request will *not* become part of the readable story, only the narrator's r
|
|
|
68
68
|
- If you need to modify the contents of the message to remove disallowed content, set 'content' to the modified message body.
|
|
69
69
|
3. Responder: The one character you choose to respond next to best maintain the flow of the conversation and further the story.
|
|
70
70
|
4. Targets: List of all characters who would realistically be able to hear the message (even if they shouldn't respond).
|
|
71
|
+
- **REQUIRED**: When the message comes from a character, always include the Narrator in the targets array — on every message, even when the Narrator is not the responder, and even when the message is a private exchange between two characters. The Narrator has to narrate what happens next and can only do that from what it has been told; a message it never heard is a hole in the story it cannot see, and it will contradict itself later. (Nothing to do when the Narrator is the sender, and the deliberate empty array described below is the other exception — that hands the message to the Narrator on its own.)
|
|
71
72
|
- When processing a message from the Narrator, the targets array should only include characters who are present for the situation being narrated.
|
|
72
73
|
5. Changes: An object containing any story state changes triggered by this message.
|
|
73
74
|
- `update_portrait`: list the names of any characters whose visible appearance has just changed in a way that should be reflected in their portrait image.
|
|
@@ -171,13 +172,14 @@ Correct Response:
|
|
|
171
172
|
"action": "relay",
|
|
172
173
|
"content": "relay",
|
|
173
174
|
"name": "Mike",
|
|
174
|
-
"targets": ["Mike", "Bob"],
|
|
175
|
+
"targets": ["Narrator", "Mike", "Bob"],
|
|
175
176
|
"changes": { "update_portrait": [] }
|
|
176
177
|
}
|
|
177
178
|
- According to the current situation, only Mike, Jessica, and Bob are within hearing distance of each other.
|
|
178
179
|
- Jessica is speaking, and only Mike and Bob can hear. Sergei and Carter are not present.
|
|
179
180
|
- Jessica is addressing Mike, so he should be the responder and is expected to respond next.
|
|
180
181
|
- Bob still hears the conversation (and appears in the list of recipients) even though he is not expected to reply.
|
|
182
|
+
- The Narrator is in the targets because the message came from a character. It is not the responder here; it is listening, so that it can narrate what follows.
|
|
181
183
|
|
|
182
184
|
|
|
183
185
|
### Example 2: Character replies to conversation
|
|
@@ -188,11 +190,12 @@ Correct Response:
|
|
|
188
190
|
"action": "relay",
|
|
189
191
|
"content": "relay",
|
|
190
192
|
"name": "Jessica",
|
|
191
|
-
"targets": ["Jessica", "Bob"],
|
|
193
|
+
"targets": ["Narrator", "Jessica", "Bob"],
|
|
192
194
|
"changes": { "update_portrait": [] }
|
|
193
195
|
}
|
|
194
196
|
- According to the current situation, only Mike, Jessica, and Bob are within hearing distance of each other.
|
|
195
197
|
- Mike is speaking, and only Jessica and Bob can hear. Sergei and Carter are not present.
|
|
198
|
+
- The Narrator is included because the message came from a character, and it must know what was said.
|
|
196
199
|
- According to the prior message history, Jessica had been talking to Mike about his childhood. So, when Mike responds with 'How about you?' he is expecting Jessica (not Bob) to reply.
|
|
197
200
|
- Bob still hears the conversation (and appears in the list of targets) even though he is not expected to reply.
|
|
198
201
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"action": "relay",
|
|
3
|
-
"content": "relay",
|
|
4
|
-
"name": "Alice",
|
|
5
|
-
"targets": ["Alice", "Bob", "Charlie"]
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"action": "relay",
|
|
3
|
+
"content": "relay",
|
|
4
|
+
"name": "Alice",
|
|
5
|
+
"targets": ["Narrator", "Alice", "Bob", "Charlie"]
|
|
6
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"action": "relay",
|
|
3
|
-
"content": "relay",
|
|
4
|
-
"name": "Bob",
|
|
5
|
-
"targets": ["Bob", "Charlie"]
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"action": "relay",
|
|
3
|
+
"content": "relay",
|
|
4
|
+
"name": "Bob",
|
|
5
|
+
"targets": ["Narrator", "Bob", "Charlie"]
|
|
6
|
+
}
|
|
@@ -23,6 +23,8 @@ export declare class AnthropicAiService extends BaseAiService {
|
|
|
23
23
|
};
|
|
24
24
|
fetchModelsFromApi(): Promise<ModelInfo[]>;
|
|
25
25
|
addToConversationHistory(agent: Agent, message: string, fromSelf?: boolean): void;
|
|
26
|
+
private static trimHeadroom;
|
|
26
27
|
textPrompt(agent: Agent, prompt: string, jsonSchema?: any, saveResponse?: boolean, promptInstructions?: string, cacheConfig?: any, maxOutputChars?: number): Promise<any>;
|
|
28
|
+
private appendRetryExchange;
|
|
27
29
|
private computeMessageCost;
|
|
28
30
|
}
|