briyah 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -6
- package/data/common/config/image_models.json +160 -97
- package/data/common/config/markup +1 -1
- package/data/common/config/story_models.json +15 -3
- package/data/common/config/story_models_full.json +2 -2
- package/data/common/prompts/character/create_user_character.prompt +3 -12
- package/data/common/prompts/character/introduce_character.json +18 -0
- package/data/common/prompts/character/introduce_character.mock +4 -0
- package/data/common/prompts/character/introduce_character.prompt +58 -0
- package/data/common/prompts/character/perceive.prompt +3 -0
- package/data/common/prompts/character/progress_character.json +8 -4
- package/data/common/prompts/character/progress_character.mock +1 -0
- package/data/common/prompts/character/progress_character.prompt +20 -2
- package/data/common/prompts/character/update_portrait.json +18 -0
- package/data/common/prompts/character/update_portrait.mock +4 -0
- package/data/common/prompts/character/update_portrait.prompt +17 -1
- package/data/common/prompts/narrator/create_simple_plot.json +0 -0
- package/data/common/prompts/narrator/create_simple_plot.mock +13 -0
- package/data/common/prompts/narrator/create_simple_plot.prompt +35 -0
- package/data/common/prompts/narrator/perceive.prompt +12 -9
- package/data/common/prompts/narrator/progress_simple_plot.json +0 -0
- package/data/common/prompts/narrator/progress_simple_plot.mock +13 -0
- package/data/common/prompts/narrator/progress_simple_plot.prompt +40 -0
- package/data/common/prompts/perceive.json +1 -1
- package/data/common/prompts/perceive.prompt +82 -20
- package/data/common/prompts/story_moderator/moderate.json +1 -1
- package/data/common/prompts/story_moderator/moderate.prompt +26 -6
- package/dist-sdk/server/src/ai/LLM/anthropic.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/base-ai.service.d.ts +1 -1
- package/dist-sdk/server/src/ai/LLM/base-ai.service.js +13 -42
- package/dist-sdk/server/src/ai/LLM/deepseek.service.js +9 -0
- package/dist-sdk/server/src/ai/LLM/fal.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/googleai.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/grok.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/openai.service.js +1 -2
- package/dist-sdk/server/src/ai/LLM/together.service.js +1 -2
- package/dist-sdk/server/src/ai/agent-config.d.ts +2 -0
- package/dist-sdk/server/src/ai/agent-store.service.js +8 -0
- package/dist-sdk/server/src/ai/agent.d.ts +2 -0
- package/dist-sdk/server/src/ai/agent.js +2 -0
- package/dist-sdk/server/src/ai/model_prices.js +2 -1
- package/dist-sdk/server/src/app/user-service-factory.js +7 -3
- package/dist-sdk/server/src/app.controller.d.ts +15 -4
- package/dist-sdk/server/src/app.controller.js +171 -5
- package/dist-sdk/server/src/app.service.d.ts +19 -5
- package/dist-sdk/server/src/app.service.js +50 -4
- package/dist-sdk/server/src/room/message.js +5 -1
- package/dist-sdk/server/src/room/room-factory.d.ts +5 -1
- package/dist-sdk/server/src/room/room-factory.js +6 -1
- package/dist-sdk/server/src/room/room-store.service.d.ts +5 -1
- package/dist-sdk/server/src/room/room-store.service.js +13 -2
- package/dist-sdk/server/src/room/room.d.ts +25 -4
- package/dist-sdk/server/src/room/room.js +379 -95
- package/dist-sdk/server/src/sdk/index.d.ts +1 -1
- package/dist-sdk/server/src/story/story.service.d.ts +5 -4
- package/dist-sdk/server/src/story/story.service.js +207 -120
- package/dist-sdk/server/src/tools/tool-execution.service.d.ts +19 -0
- package/dist-sdk/server/src/tools/tool-execution.service.js +100 -0
- package/dist-sdk/server/src/tools/tool-store.service.d.ts +17 -0
- package/dist-sdk/server/src/tools/tool-store.service.js +143 -0
- package/dist-sdk/shared/types/app.types.d.ts +44 -5
- package/dist-sdk/shared/types/app.types.js +3 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +0 -7
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Agent.html +22 -14
- package/docs/classes/Briyah.html +10 -10
- package/docs/classes/BriyahConfigService.html +5 -5
- package/docs/classes/Room.html +32 -26
- package/docs/classes/RoomMessage.html +10 -10
- package/docs/enums/MessageAction.html +6 -3
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +12 -5
- package/docs/interfaces/AgentInfo.html +3 -2
- package/docs/interfaces/AgentMessagesResponse.html +2 -2
- package/docs/interfaces/AppService.html +184 -149
- package/docs/interfaces/Artifact.html +3 -3
- package/docs/interfaces/ArtifactMetadata.html +2 -2
- package/docs/interfaces/AttachDocumentResponse.html +2 -2
- package/docs/interfaces/BriyahConfigOptions.html +7 -7
- 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 -3
- 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 +2 -2
- package/docs/interfaces/RoomInfo.html +2 -2
- package/docs/interfaces/RoomMessagesResponse.html +2 -2
- package/docs/interfaces/StoryErrorEvent.html +3 -3
- package/docs/interfaces/StoryIdea.html +2 -2
- package/docs/interfaces/StoryInfo.html +5 -4
- 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/ToolDefinition.html +6 -0
- package/docs/interfaces/ToolParameter.html +5 -0
- package/docs/interfaces/ToolsResponse.html +2 -0
- 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/ToolRunResult.html +1 -0
- package/package.json +2 -1
|
@@ -59,9 +59,11 @@ class AppService {
|
|
|
59
59
|
transactionService;
|
|
60
60
|
agentFactory;
|
|
61
61
|
roomFactory;
|
|
62
|
+
toolStore;
|
|
63
|
+
toolExecution;
|
|
62
64
|
aiServices;
|
|
63
65
|
userPreferencesFile = 'user-preferences.json';
|
|
64
|
-
constructor(aiFactoryService, agentStore, agentMessageService, roomStore, roomMessageService, userPaths, attachedFileService, artifactService, storyStore, storyService, publishedAgentsService, publishedRoomsService, balanceService, balanceMessageService, transactionService, agentFactory, roomFactory) {
|
|
66
|
+
constructor(aiFactoryService, agentStore, agentMessageService, roomStore, roomMessageService, userPaths, attachedFileService, artifactService, storyStore, storyService, publishedAgentsService, publishedRoomsService, balanceService, balanceMessageService, transactionService, agentFactory, roomFactory, toolStore, toolExecution) {
|
|
65
67
|
this.aiFactoryService = aiFactoryService;
|
|
66
68
|
this.agentStore = agentStore;
|
|
67
69
|
this.agentMessageService = agentMessageService;
|
|
@@ -79,6 +81,8 @@ class AppService {
|
|
|
79
81
|
this.transactionService = transactionService;
|
|
80
82
|
this.agentFactory = agentFactory;
|
|
81
83
|
this.roomFactory = roomFactory;
|
|
84
|
+
this.toolStore = toolStore;
|
|
85
|
+
this.toolExecution = toolExecution;
|
|
82
86
|
this.aiServices = this.aiFactoryService.getAllAiServices();
|
|
83
87
|
}
|
|
84
88
|
getAiServiceNames() {
|
|
@@ -94,7 +98,10 @@ class AppService {
|
|
|
94
98
|
async listImageModels() {
|
|
95
99
|
const imageModelsPath = path.join(this.userPaths.getCommonConfigDir(), 'image_models.json');
|
|
96
100
|
try {
|
|
97
|
-
|
|
101
|
+
const entries = JSON.parse(fs.readFileSync(imageModelsPath, 'utf8'));
|
|
102
|
+
return entries
|
|
103
|
+
.filter((entry) => entry.name && entry.name !== 'No images')
|
|
104
|
+
.map((entry) => ({ name: entry.name, description: entry.description ?? '' }));
|
|
98
105
|
}
|
|
99
106
|
catch (error) {
|
|
100
107
|
logger_1.logger.error(`Image models file could not be read from ${imageModelsPath}: `, error);
|
|
@@ -299,6 +306,7 @@ class AppService {
|
|
|
299
306
|
totalCost: agent.totalCost,
|
|
300
307
|
isPublished: agent.isPublished,
|
|
301
308
|
beginInstruction: agent.beginInstruction,
|
|
309
|
+
toolNames: agent.toolNames,
|
|
302
310
|
});
|
|
303
311
|
}
|
|
304
312
|
}
|
|
@@ -327,6 +335,7 @@ class AppService {
|
|
|
327
335
|
totalCost: agent.totalCost,
|
|
328
336
|
isPublished: agent.isPublished,
|
|
329
337
|
beginInstruction: agent.beginInstruction,
|
|
338
|
+
toolNames: agent.toolNames,
|
|
330
339
|
};
|
|
331
340
|
}
|
|
332
341
|
catch (error) {
|
|
@@ -535,6 +544,7 @@ class AppService {
|
|
|
535
544
|
totalCost: agent.totalCost,
|
|
536
545
|
isPublished: agent.isPublished,
|
|
537
546
|
beginInstruction: agent.beginInstruction,
|
|
547
|
+
toolNames: agent.toolNames,
|
|
538
548
|
}));
|
|
539
549
|
}
|
|
540
550
|
async resetPublishedInstance(instanceId) {
|
|
@@ -570,6 +580,7 @@ class AppService {
|
|
|
570
580
|
totalCost: agent.totalCost,
|
|
571
581
|
isPublished: agent.isPublished,
|
|
572
582
|
beginInstruction: agent.beginInstruction,
|
|
583
|
+
toolNames: agent.toolNames,
|
|
573
584
|
});
|
|
574
585
|
}
|
|
575
586
|
}
|
|
@@ -823,8 +834,36 @@ class AppService {
|
|
|
823
834
|
agent.allowSearch = updates.allowSearch;
|
|
824
835
|
if (updates.beginInstruction !== undefined)
|
|
825
836
|
agent.beginInstruction = updates.beginInstruction;
|
|
837
|
+
if (updates.toolNames !== undefined)
|
|
838
|
+
agent.toolNames = updates.toolNames;
|
|
826
839
|
agent.save();
|
|
827
840
|
}
|
|
841
|
+
async listTools() {
|
|
842
|
+
return this.toolStore.listTools();
|
|
843
|
+
}
|
|
844
|
+
async createTool(tool) {
|
|
845
|
+
const existing = await this.toolStore.getTool(tool.name);
|
|
846
|
+
if (existing) {
|
|
847
|
+
throw new errors_1.OperationFailedError(`Tool "${tool.name}" already exists`);
|
|
848
|
+
}
|
|
849
|
+
return this.toolStore.saveTool(tool);
|
|
850
|
+
}
|
|
851
|
+
async updateTool(name, tool) {
|
|
852
|
+
const existing = await this.toolStore.getTool(name);
|
|
853
|
+
if (!existing) {
|
|
854
|
+
throw new errors_1.NotFoundError(`Tool "${name}" not found`);
|
|
855
|
+
}
|
|
856
|
+
return this.toolStore.saveTool({ ...tool, name });
|
|
857
|
+
}
|
|
858
|
+
async deleteTool(name) {
|
|
859
|
+
const deleted = await this.toolStore.deleteTool(name);
|
|
860
|
+
if (!deleted) {
|
|
861
|
+
throw new errors_1.NotFoundError(`Tool "${name}" not found`);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
async testTool(name, args) {
|
|
865
|
+
return this.toolExecution.test(name, args);
|
|
866
|
+
}
|
|
828
867
|
async listAttachedFiles(agentId) {
|
|
829
868
|
const agent = await this.agentStore.getAgent(agentId);
|
|
830
869
|
if (!agent) {
|
|
@@ -972,8 +1011,8 @@ class AppService {
|
|
|
972
1011
|
async revertStoryChapter(storyId) {
|
|
973
1012
|
return this.storyService.revertStoryChapter(storyId);
|
|
974
1013
|
}
|
|
975
|
-
async createStory(name, idea, userCharacterDesc, otherCharactersDesc, illustrateStory, storyModel, isImport, imageModelName,
|
|
976
|
-
return this.storyService.createStory(name, idea, userCharacterDesc, otherCharactersDesc, illustrateStory, storyModel, isImport, imageModelName,
|
|
1014
|
+
async createStory(name, idea, userCharacterDesc, otherCharactersDesc, illustrateStory, storyModel, isImport, imageModelName, skipDetailedPlot) {
|
|
1015
|
+
return this.storyService.createStory(name, idea, userCharacterDesc, otherCharactersDesc, illustrateStory, storyModel, isImport, imageModelName, skipDetailedPlot);
|
|
977
1016
|
}
|
|
978
1017
|
async importStoryFromZip(zipBuffer) {
|
|
979
1018
|
return this.storyService.importStoryFromZip(zipBuffer);
|
|
@@ -1148,6 +1187,13 @@ class AppService {
|
|
|
1148
1187
|
saveCharacter(storyId, characterName, content) {
|
|
1149
1188
|
this.storyService.saveCharacter(storyId, characterName, content);
|
|
1150
1189
|
}
|
|
1190
|
+
async getCharacterInventory(storyId, characterName) {
|
|
1191
|
+
const content = await this.storyService.getCharacterInventory(storyId, characterName);
|
|
1192
|
+
return { content: content || '' };
|
|
1193
|
+
}
|
|
1194
|
+
async saveCharacterInventory(storyId, characterName, content) {
|
|
1195
|
+
await this.storyService.saveCharacterInventory(storyId, characterName, content);
|
|
1196
|
+
}
|
|
1151
1197
|
async getPlotPlan(storyId) {
|
|
1152
1198
|
const content = await this.storyService.getPlotPlan(storyId);
|
|
1153
1199
|
return { content: content || '' };
|
|
@@ -44,7 +44,9 @@ class RoomMessage {
|
|
|
44
44
|
}
|
|
45
45
|
if (this.action === app_types_1.MessageAction.WHISPER ||
|
|
46
46
|
this.action === app_types_1.MessageAction.RELAY ||
|
|
47
|
-
this.action === app_types_1.MessageAction.RELAY_SILENT
|
|
47
|
+
this.action === app_types_1.MessageAction.RELAY_SILENT ||
|
|
48
|
+
this.action === app_types_1.MessageAction.COMMISSION ||
|
|
49
|
+
this.action === app_types_1.MessageAction.DELIVER) {
|
|
48
50
|
return this.targets.includes(agentName);
|
|
49
51
|
}
|
|
50
52
|
if (this.targets.length > 0) {
|
|
@@ -56,6 +58,8 @@ class RoomMessage {
|
|
|
56
58
|
if (this.sender === agentNickname) {
|
|
57
59
|
return false;
|
|
58
60
|
}
|
|
61
|
+
if (this.action === app_types_1.MessageAction.TOOL)
|
|
62
|
+
return false;
|
|
59
63
|
if (this.action === app_types_1.MessageAction.RELAY || this.action === app_types_1.MessageAction.RELAY_SILENT)
|
|
60
64
|
return this.targets.includes(agentNickname);
|
|
61
65
|
if (this.action === app_types_1.MessageAction.PUBLISH)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Room } from './room';
|
|
2
2
|
import { RoomStoreService } from './room-store.service';
|
|
3
|
+
import { ToolStoreService } from '../tools/tool-store.service';
|
|
4
|
+
import { ToolExecutionService } from '../tools/tool-execution.service';
|
|
3
5
|
export declare class RoomFactory {
|
|
4
6
|
private readonly roomStoreService;
|
|
5
|
-
|
|
7
|
+
private readonly toolStoreService;
|
|
8
|
+
private readonly toolExecutionService;
|
|
9
|
+
constructor(roomStoreService: RoomStoreService, toolStoreService: ToolStoreService, toolExecutionService: ToolExecutionService);
|
|
6
10
|
createRoom(name: string, goal: string, baseRoomDir?: string, storageDir?: string): Room;
|
|
7
11
|
}
|
|
@@ -4,12 +4,17 @@ exports.RoomFactory = void 0;
|
|
|
4
4
|
const room_1 = require("./room");
|
|
5
5
|
class RoomFactory {
|
|
6
6
|
roomStoreService;
|
|
7
|
-
|
|
7
|
+
toolStoreService;
|
|
8
|
+
toolExecutionService;
|
|
9
|
+
constructor(roomStoreService, toolStoreService, toolExecutionService) {
|
|
8
10
|
this.roomStoreService = roomStoreService;
|
|
11
|
+
this.toolStoreService = toolStoreService;
|
|
12
|
+
this.toolExecutionService = toolExecutionService;
|
|
9
13
|
}
|
|
10
14
|
createRoom(name, goal, baseRoomDir = '', storageDir = '') {
|
|
11
15
|
const finalStorageDir = storageDir || this.roomStoreService.getDefaultStorageDir();
|
|
12
16
|
const room = new room_1.Room(null, name, goal, baseRoomDir, finalStorageDir, this.roomStoreService);
|
|
17
|
+
room.setToolServices(this.toolStoreService, this.toolExecutionService);
|
|
13
18
|
return room;
|
|
14
19
|
}
|
|
15
20
|
}
|
|
@@ -6,16 +6,20 @@ import { RoomInfo } from '../../../shared/types/app.types';
|
|
|
6
6
|
import { RoomMessage } from './message';
|
|
7
7
|
import { ArtifactStoreService } from './artifact-store.service';
|
|
8
8
|
import { Artifact } from './artifact';
|
|
9
|
+
import { ToolStoreService } from '../tools/tool-store.service';
|
|
10
|
+
import { ToolExecutionService } from '../tools/tool-execution.service';
|
|
9
11
|
export declare class RoomStoreService {
|
|
10
12
|
private readonly userPaths;
|
|
11
13
|
private readonly agentStore;
|
|
12
14
|
private readonly attachedFileService;
|
|
13
15
|
private readonly artifactStoreService;
|
|
16
|
+
private readonly toolStoreService;
|
|
17
|
+
private readonly toolExecutionService;
|
|
14
18
|
private rooms;
|
|
15
19
|
private readonly defaultStorageDir;
|
|
16
20
|
private loaded;
|
|
17
21
|
private loadPromise;
|
|
18
|
-
constructor(userPaths: UserPathsService, agentStore: AgentStoreService, attachedFileService: AttachedFileService, artifactStoreService: ArtifactStoreService);
|
|
22
|
+
constructor(userPaths: UserPathsService, agentStore: AgentStoreService, attachedFileService: AttachedFileService, artifactStoreService: ArtifactStoreService, toolStoreService: ToolStoreService, toolExecutionService: ToolExecutionService);
|
|
19
23
|
getDefaultStorageDir(): string;
|
|
20
24
|
storeRoom(room: Room, storageDir?: string): string;
|
|
21
25
|
getRoom(id: string): Promise<Room | null>;
|
|
@@ -52,21 +52,27 @@ const user_paths_service_1 = require("../config/user-paths.service");
|
|
|
52
52
|
const agent_store_service_1 = require("../ai/agent-store.service");
|
|
53
53
|
const attached_file_service_1 = require("../ai/attached-file.service");
|
|
54
54
|
const artifact_store_service_1 = require("./artifact-store.service");
|
|
55
|
+
const tool_store_service_1 = require("../tools/tool-store.service");
|
|
56
|
+
const tool_execution_service_1 = require("../tools/tool-execution.service");
|
|
55
57
|
const logger_1 = require("../common/logger");
|
|
56
58
|
let RoomStoreService = class RoomStoreService {
|
|
57
59
|
userPaths;
|
|
58
60
|
agentStore;
|
|
59
61
|
attachedFileService;
|
|
60
62
|
artifactStoreService;
|
|
63
|
+
toolStoreService;
|
|
64
|
+
toolExecutionService;
|
|
61
65
|
rooms = new Map();
|
|
62
66
|
defaultStorageDir;
|
|
63
67
|
loaded = false;
|
|
64
68
|
loadPromise = null;
|
|
65
|
-
constructor(userPaths, agentStore, attachedFileService, artifactStoreService) {
|
|
69
|
+
constructor(userPaths, agentStore, attachedFileService, artifactStoreService, toolStoreService, toolExecutionService) {
|
|
66
70
|
this.userPaths = userPaths;
|
|
67
71
|
this.agentStore = agentStore;
|
|
68
72
|
this.attachedFileService = attachedFileService;
|
|
69
73
|
this.artifactStoreService = artifactStoreService;
|
|
74
|
+
this.toolStoreService = toolStoreService;
|
|
75
|
+
this.toolExecutionService = toolExecutionService;
|
|
70
76
|
this.defaultStorageDir = path.join(this.userPaths.getUserDataDir(), 'rooms');
|
|
71
77
|
}
|
|
72
78
|
getDefaultStorageDir() {
|
|
@@ -76,6 +82,7 @@ let RoomStoreService = class RoomStoreService {
|
|
|
76
82
|
const finalStorageDir = storageDir || this.defaultStorageDir;
|
|
77
83
|
room.setStorageDir(finalStorageDir);
|
|
78
84
|
room.setRoomStoreService(this);
|
|
85
|
+
room.setToolServices(this.toolStoreService, this.toolExecutionService);
|
|
79
86
|
this.rooms.set(room.getId(), room);
|
|
80
87
|
this.saveRoomToFile(room, finalStorageDir);
|
|
81
88
|
return room.getId();
|
|
@@ -118,6 +125,7 @@ let RoomStoreService = class RoomStoreService {
|
|
|
118
125
|
}
|
|
119
126
|
}
|
|
120
127
|
const instance = new room_1.Room(instanceId, publishedName, template.getGoal(), template.getBaseRoomDir(), this.defaultStorageDir, this);
|
|
128
|
+
instance.setToolServices(this.toolStoreService, this.toolExecutionService);
|
|
121
129
|
for (const agentId of clonedAgentIds) {
|
|
122
130
|
const agent = await this.agentStore.getAgent(agentId);
|
|
123
131
|
if (agent) {
|
|
@@ -219,6 +227,7 @@ let RoomStoreService = class RoomStoreService {
|
|
|
219
227
|
const config = JSON.parse(fileContent);
|
|
220
228
|
let messages = await this.readRoomMessagesFromFileAsync(messagesPath);
|
|
221
229
|
const room = new room_1.Room(config.id, config.name, config.goal, '', storageDir, this);
|
|
230
|
+
room.setToolServices(this.toolStoreService, this.toolExecutionService);
|
|
222
231
|
room.setLoading(true);
|
|
223
232
|
room.setCreatedAt(new Date(config.createdAt));
|
|
224
233
|
room.setRoomMessages(messages);
|
|
@@ -353,5 +362,7 @@ exports.RoomStoreService = RoomStoreService = __decorate([
|
|
|
353
362
|
__metadata("design:paramtypes", [user_paths_service_1.UserPathsService,
|
|
354
363
|
agent_store_service_1.AgentStoreService,
|
|
355
364
|
attached_file_service_1.AttachedFileService,
|
|
356
|
-
artifact_store_service_1.ArtifactStoreService
|
|
365
|
+
artifact_store_service_1.ArtifactStoreService,
|
|
366
|
+
tool_store_service_1.ToolStoreService,
|
|
367
|
+
tool_execution_service_1.ToolExecutionService])
|
|
357
368
|
], RoomStoreService);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Agent } from '../ai/agent';
|
|
2
2
|
import { RoomMessage } from './message';
|
|
3
3
|
import { Artifact } from './artifact';
|
|
4
|
+
import { ToolStoreService } from '../tools/tool-store.service';
|
|
5
|
+
import { ToolExecutionService } from '../tools/tool-execution.service';
|
|
4
6
|
export declare class Room {
|
|
7
|
+
private static readonly MAX_TOOL_ITERATIONS;
|
|
5
8
|
private id;
|
|
6
9
|
private name;
|
|
7
10
|
private goal;
|
|
@@ -22,11 +25,14 @@ export declare class Room {
|
|
|
22
25
|
private onStateChangeCallbacks;
|
|
23
26
|
private onError?;
|
|
24
27
|
private currentSituation;
|
|
28
|
+
private currentSituationTime;
|
|
25
29
|
private onSituationUpdate?;
|
|
26
30
|
private onModeratorResponseCallback?;
|
|
27
31
|
private templateRoomId;
|
|
28
32
|
private storageDir;
|
|
29
33
|
private roomStoreService;
|
|
34
|
+
private toolStoreService?;
|
|
35
|
+
private toolExecutionService?;
|
|
30
36
|
constructor(id: string | null, name: string, goal: string, baseRoomDir?: string, storageDir?: string, roomStoreService?: any);
|
|
31
37
|
deleteRoom(): void;
|
|
32
38
|
setLoading(isLoading: boolean): void;
|
|
@@ -59,7 +65,9 @@ export declare class Room {
|
|
|
59
65
|
};
|
|
60
66
|
getLatestRoomMessages(fromIndex?: number, includeThoughts?: boolean): RoomMessage[];
|
|
61
67
|
setRoomMessages(messages: RoomMessage[]): void;
|
|
62
|
-
addRoomMessage(message: RoomMessage
|
|
68
|
+
addRoomMessage(message: RoomMessage, options?: {
|
|
69
|
+
suppressSituationUpdate?: boolean;
|
|
70
|
+
}): void;
|
|
63
71
|
addRoomMessages(messages: RoomMessage[]): void;
|
|
64
72
|
getCreatedAt(): Date;
|
|
65
73
|
setCreatedAt(date: Date): void;
|
|
@@ -69,6 +77,14 @@ export declare class Room {
|
|
|
69
77
|
private parseAgentResponse;
|
|
70
78
|
private static extractPreamble;
|
|
71
79
|
private static coerceMessageAction;
|
|
80
|
+
private getPresentCharacters;
|
|
81
|
+
private buildCharacterPrivateContextDigest;
|
|
82
|
+
private buildAvailableTools;
|
|
83
|
+
private buildPerceiveVariables;
|
|
84
|
+
private buildTransientPrompt;
|
|
85
|
+
private promptAgentOnce;
|
|
86
|
+
private runAgentTurn;
|
|
87
|
+
private executeToolForAgent;
|
|
72
88
|
private getAgentAiResponse;
|
|
73
89
|
perceive(agent: Agent, message: RoomMessage, onResponse: (message: RoomMessage | null) => void): void;
|
|
74
90
|
moderate(moderatorAgent: Agent, message: RoomMessage, onResponse: (message: RoomMessage | null) => void): Promise<void>;
|
|
@@ -83,6 +99,7 @@ export declare class Room {
|
|
|
83
99
|
setStorageDir(dir: string): void;
|
|
84
100
|
getRoomStoreService(): any;
|
|
85
101
|
setRoomStoreService(service: any): void;
|
|
102
|
+
setToolServices(toolStore: ToolStoreService, toolExecution: ToolExecutionService): void;
|
|
86
103
|
saveMessages(messages: RoomMessage[]): void;
|
|
87
104
|
saveMetadata(): string;
|
|
88
105
|
setOnStateChange(key: string, callback: () => void): void;
|
|
@@ -93,13 +110,14 @@ export declare class Room {
|
|
|
93
110
|
getHumanAgentName(): string;
|
|
94
111
|
getModeratorAgent(): Agent | undefined;
|
|
95
112
|
getSituation(): string;
|
|
113
|
+
getSituationTime(): string;
|
|
114
|
+
setSituationTime(time: string): void;
|
|
115
|
+
private buildSituationHeader;
|
|
96
116
|
setSituation(situation: string): void;
|
|
97
|
-
setOnSituationUpdate(callback: (situation: string) => void): void;
|
|
117
|
+
setOnSituationUpdate(callback: (situation: string, messageBody?: string) => void | Promise<void>): void;
|
|
98
118
|
setOnModeratorResponse(callback: (message: RoomMessage) => void): void;
|
|
99
119
|
private handleSituationUpdate;
|
|
100
120
|
handlePublishMessages(messages: RoomMessage[]): void;
|
|
101
|
-
handleExecuteMessages(messages: RoomMessage[]): void;
|
|
102
|
-
private executeCommand;
|
|
103
121
|
handleAdjournMessages(messages: RoomMessage[]): void;
|
|
104
122
|
addPendingMessage(message: RoomMessage, clearQueue?: boolean): void;
|
|
105
123
|
isProcessingInProgress(): boolean;
|
|
@@ -108,6 +126,9 @@ export declare class Room {
|
|
|
108
126
|
interrupt(): void;
|
|
109
127
|
checkAgentNicknameMatch(existingNickname: string, targetNickname: string): boolean;
|
|
110
128
|
private handleModeratorResponse;
|
|
129
|
+
private runDeliverTurn;
|
|
130
|
+
private handleCommissionMessage;
|
|
131
|
+
private respondToCommissioner;
|
|
111
132
|
private processPendingMessages;
|
|
112
133
|
private filterConcurrentMessages;
|
|
113
134
|
}
|