@mozaik-ai/core 4.2.0-beta.7 → 4.2.0-beta.9
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/dist/index.d.mts +18 -12
- package/dist/index.d.ts +18 -12
- package/dist/index.js +34 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -205,9 +205,6 @@ var Space = class _Space {
|
|
|
205
205
|
}
|
|
206
206
|
getParticipant(id) {
|
|
207
207
|
const participant = this.getParticipants().find((p) => p.getId() === id);
|
|
208
|
-
if (!participant) {
|
|
209
|
-
throw new Error(`Participant ${id} not found`);
|
|
210
|
-
}
|
|
211
208
|
return participant;
|
|
212
209
|
}
|
|
213
210
|
removeParticipant(participant) {
|
|
@@ -281,13 +278,13 @@ function defineRuntime() {
|
|
|
281
278
|
const createSpace = async (name) => {
|
|
282
279
|
return await createSpaceUseCase.execute(name);
|
|
283
280
|
};
|
|
284
|
-
const
|
|
281
|
+
const participantJoinUseCase = new ParticipantJoinUseCase(spaceRepository, eventPublisher);
|
|
285
282
|
const join = async (spaceId, participant) => {
|
|
286
|
-
return await
|
|
283
|
+
return await participantJoinUseCase.execute(spaceId, participant);
|
|
287
284
|
};
|
|
288
|
-
const
|
|
285
|
+
const participantLeaveUseCase = new ParticipantLeaveUseCase(spaceRepository, eventPublisher);
|
|
289
286
|
const leave = async (spaceId, participantId) => {
|
|
290
|
-
return await
|
|
287
|
+
return await participantLeaveUseCase.execute(spaceId, participantId);
|
|
291
288
|
};
|
|
292
289
|
const sendMessageUseCase = new SendMessageUseCase(spaceRepository, eventPublisher);
|
|
293
290
|
const sendMessage = async (spaceId, participantId, message) => {
|
|
@@ -367,28 +364,40 @@ var NotSituationSpecification = class extends SituationSpecification {
|
|
|
367
364
|
};
|
|
368
365
|
|
|
369
366
|
// src/domain/agent/agent.ts
|
|
370
|
-
var Agent = class _Agent
|
|
371
|
-
constructor(
|
|
372
|
-
|
|
373
|
-
this.
|
|
374
|
-
this.
|
|
367
|
+
var Agent = class _Agent {
|
|
368
|
+
constructor(id, name, instruction, tools, memory) {
|
|
369
|
+
this._id = id;
|
|
370
|
+
this._name = name;
|
|
371
|
+
this._instruction = instruction;
|
|
372
|
+
this._memory = memory;
|
|
373
|
+
this._tools = tools;
|
|
374
|
+
}
|
|
375
|
+
get id() {
|
|
376
|
+
return this._id;
|
|
377
|
+
}
|
|
378
|
+
get name() {
|
|
379
|
+
return this._name;
|
|
380
|
+
}
|
|
381
|
+
get instruction() {
|
|
382
|
+
return this._instruction;
|
|
375
383
|
}
|
|
376
|
-
|
|
377
|
-
return this.
|
|
384
|
+
get tools() {
|
|
385
|
+
return this._tools;
|
|
378
386
|
}
|
|
379
|
-
|
|
380
|
-
return this.
|
|
387
|
+
get memory() {
|
|
388
|
+
return this._memory;
|
|
381
389
|
}
|
|
382
390
|
static create({
|
|
383
|
-
|
|
391
|
+
name,
|
|
392
|
+
instruction,
|
|
384
393
|
tools,
|
|
385
|
-
memory
|
|
386
|
-
handlers
|
|
394
|
+
memory
|
|
387
395
|
}) {
|
|
388
|
-
|
|
396
|
+
const id = UuidGenerator.create();
|
|
397
|
+
return new _Agent(id, name, instruction, tools, memory);
|
|
389
398
|
}
|
|
390
399
|
static rehydrate(record) {
|
|
391
|
-
return new _Agent(record.
|
|
400
|
+
return new _Agent(record.id, record.name, record.instruction, record.tools, record.memory);
|
|
392
401
|
}
|
|
393
402
|
};
|
|
394
403
|
|
|
@@ -398,14 +407,11 @@ var CreateAgentUseCase = class {
|
|
|
398
407
|
this.agentRepository = agentRepository;
|
|
399
408
|
this.memoryFactory = memoryFactory;
|
|
400
409
|
}
|
|
401
|
-
async execute(name, instruction, tools
|
|
402
|
-
const id = UuidGenerator.create();
|
|
403
|
-
const manifest = { id, name, role: "agent" };
|
|
410
|
+
async execute(name, instruction, tools) {
|
|
404
411
|
const memory = this.memoryFactory.create();
|
|
405
|
-
const
|
|
406
|
-
const agent = Agent.create(agentRecord);
|
|
412
|
+
const agent = Agent.create({ name, instruction, tools, memory });
|
|
407
413
|
await this.agentRepository.save(agent);
|
|
408
|
-
return
|
|
414
|
+
return agent;
|
|
409
415
|
}
|
|
410
416
|
};
|
|
411
417
|
|
|
@@ -2543,7 +2549,7 @@ function defineAgentModule(config) {
|
|
|
2543
2549
|
const createAgentUseCase = new CreateAgentUseCase(agentRepository, memoryFactory);
|
|
2544
2550
|
const createLoopUseCase = new CreateAgentLoopUseCase(agentLoopRepository);
|
|
2545
2551
|
async function createAgent(config2) {
|
|
2546
|
-
return await createAgentUseCase.execute(config2.name, config2.instruction, config2.tools
|
|
2552
|
+
return await createAgentUseCase.execute(config2.name, config2.instruction, config2.tools);
|
|
2547
2553
|
}
|
|
2548
2554
|
async function createLoop(params) {
|
|
2549
2555
|
return await createLoopUseCase.execute(params);
|