briyah 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -30,6 +30,8 @@ await briyah.init();
|
|
|
30
30
|
const appService = briyah.getAppService('user-123');
|
|
31
31
|
|
|
32
32
|
// 3. Use full Briyah functionality
|
|
33
|
+
// createAgent() registers the agent in memory immediately — agent.id is usable right away.
|
|
34
|
+
// Call agent.save() when you want to persist it to disk.
|
|
33
35
|
const agent = appService.createAgent(
|
|
34
36
|
'Anthropic',
|
|
35
37
|
'Assistant',
|
|
@@ -38,9 +40,12 @@ const agent = appService.createAgent(
|
|
|
38
40
|
'claude-3-5-sonnet-20241022'
|
|
39
41
|
);
|
|
40
42
|
|
|
43
|
+
if (!agent.id) throw new Error('Agent creation failed');
|
|
41
44
|
const result = await appService.processText(agent.id, 'Hello! How are you?');
|
|
42
45
|
console.log(result.result);
|
|
43
46
|
|
|
47
|
+
agent.save(); // persist to disk
|
|
48
|
+
|
|
44
49
|
// 4. Cleanup when done
|
|
45
50
|
await briyah.shutdown();
|
|
46
51
|
```
|
|
@@ -283,6 +288,7 @@ const agent = appService.createAgent(
|
|
|
283
288
|
'claude-3-5-sonnet-20241022' // model
|
|
284
289
|
);
|
|
285
290
|
|
|
291
|
+
if (!agent.id) throw new Error('Agent creation failed');
|
|
286
292
|
console.log(`Created agent: ${agent.id}`);
|
|
287
293
|
|
|
288
294
|
// Process text with the agent
|
|
@@ -305,6 +311,8 @@ const appService = briyah.getAppService('user-123');
|
|
|
305
311
|
const analyst = appService.createAgent('OpenAI', 'Analyst', 'Analyst', 'Data analyst', 'gpt-4');
|
|
306
312
|
const writer = appService.createAgent('Anthropic', 'Writer', 'Writer', 'Content writer', 'claude-3-5-sonnet-20241022');
|
|
307
313
|
|
|
314
|
+
if (!analyst.id || !writer.id) throw new Error('Agent creation failed');
|
|
315
|
+
|
|
308
316
|
// Create a room with both agents
|
|
309
317
|
const room = await appService.createRoom(
|
|
310
318
|
'Analysis Session',
|
|
@@ -16,6 +16,7 @@ export declare class AgentStoreService {
|
|
|
16
16
|
private loadPromise;
|
|
17
17
|
constructor(aiFactoryService: AiFactoryService, configService: ConfigurationService, attachedFileService: AttachedFileService, balanceService: BalanceService, artifactService: ArtifactService);
|
|
18
18
|
getDefaultStorageDir(): string;
|
|
19
|
+
registerAgent(agent: Agent): void;
|
|
19
20
|
storeAgent(agent: Agent, storageDir?: string): string;
|
|
20
21
|
getAgent(id: string): Promise<Agent | undefined>;
|
|
21
22
|
removeAgent(id: string): boolean;
|
|
@@ -74,6 +74,12 @@ let AgentStoreService = class AgentStoreService {
|
|
|
74
74
|
getDefaultStorageDir() {
|
|
75
75
|
return this.defaultStorageDir;
|
|
76
76
|
}
|
|
77
|
+
registerAgent(agent) {
|
|
78
|
+
if (!agent.id) {
|
|
79
|
+
agent.id = (0, crypto_1.randomUUID)();
|
|
80
|
+
}
|
|
81
|
+
this.agents.set(agent.id, agent);
|
|
82
|
+
}
|
|
77
83
|
storeAgent(agent, storageDir) {
|
|
78
84
|
if (!agent.id) {
|
|
79
85
|
agent.id = (0, crypto_1.randomUUID)();
|