@mozaik-ai/core 4.2.0-beta.8 → 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 +30 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -364,28 +364,40 @@ var NotSituationSpecification = class extends SituationSpecification {
|
|
|
364
364
|
};
|
|
365
365
|
|
|
366
366
|
// src/domain/agent/agent.ts
|
|
367
|
-
var Agent = class _Agent
|
|
368
|
-
constructor(
|
|
369
|
-
|
|
370
|
-
this.
|
|
371
|
-
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;
|
|
372
377
|
}
|
|
373
|
-
|
|
374
|
-
return this.
|
|
378
|
+
get name() {
|
|
379
|
+
return this._name;
|
|
375
380
|
}
|
|
376
|
-
|
|
377
|
-
return this.
|
|
381
|
+
get instruction() {
|
|
382
|
+
return this._instruction;
|
|
383
|
+
}
|
|
384
|
+
get tools() {
|
|
385
|
+
return this._tools;
|
|
386
|
+
}
|
|
387
|
+
get memory() {
|
|
388
|
+
return this._memory;
|
|
378
389
|
}
|
|
379
390
|
static create({
|
|
380
|
-
|
|
391
|
+
name,
|
|
392
|
+
instruction,
|
|
381
393
|
tools,
|
|
382
|
-
memory
|
|
383
|
-
handlers
|
|
394
|
+
memory
|
|
384
395
|
}) {
|
|
385
|
-
|
|
396
|
+
const id = UuidGenerator.create();
|
|
397
|
+
return new _Agent(id, name, instruction, tools, memory);
|
|
386
398
|
}
|
|
387
399
|
static rehydrate(record) {
|
|
388
|
-
return new _Agent(record.
|
|
400
|
+
return new _Agent(record.id, record.name, record.instruction, record.tools, record.memory);
|
|
389
401
|
}
|
|
390
402
|
};
|
|
391
403
|
|
|
@@ -395,14 +407,11 @@ var CreateAgentUseCase = class {
|
|
|
395
407
|
this.agentRepository = agentRepository;
|
|
396
408
|
this.memoryFactory = memoryFactory;
|
|
397
409
|
}
|
|
398
|
-
async execute(name, instruction, tools
|
|
399
|
-
const id = UuidGenerator.create();
|
|
400
|
-
const manifest = { id, name, role: "agent" };
|
|
410
|
+
async execute(name, instruction, tools) {
|
|
401
411
|
const memory = this.memoryFactory.create();
|
|
402
|
-
const
|
|
403
|
-
const agent = Agent.create(agentRecord);
|
|
412
|
+
const agent = Agent.create({ name, instruction, tools, memory });
|
|
404
413
|
await this.agentRepository.save(agent);
|
|
405
|
-
return
|
|
414
|
+
return agent;
|
|
406
415
|
}
|
|
407
416
|
};
|
|
408
417
|
|
|
@@ -2540,7 +2549,7 @@ function defineAgentModule(config) {
|
|
|
2540
2549
|
const createAgentUseCase = new CreateAgentUseCase(agentRepository, memoryFactory);
|
|
2541
2550
|
const createLoopUseCase = new CreateAgentLoopUseCase(agentLoopRepository);
|
|
2542
2551
|
async function createAgent(config2) {
|
|
2543
|
-
return await createAgentUseCase.execute(config2.name, config2.instruction, config2.tools
|
|
2552
|
+
return await createAgentUseCase.execute(config2.name, config2.instruction, config2.tools);
|
|
2544
2553
|
}
|
|
2545
2554
|
async function createLoop(params) {
|
|
2546
2555
|
return await createLoopUseCase.execute(params);
|