@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.d.mts
CHANGED
|
@@ -222,23 +222,29 @@ interface Memory {
|
|
|
222
222
|
|
|
223
223
|
type AgentRecord = {
|
|
224
224
|
id: string;
|
|
225
|
-
|
|
225
|
+
name: string;
|
|
226
|
+
instruction: string;
|
|
226
227
|
tools: Tool[];
|
|
227
228
|
memory: Memory;
|
|
228
|
-
handlers: SituationHandler[];
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
-
declare class Agent
|
|
232
|
-
private
|
|
233
|
-
private
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
231
|
+
declare class Agent {
|
|
232
|
+
private _id;
|
|
233
|
+
private _name;
|
|
234
|
+
private _instruction;
|
|
235
|
+
private _memory;
|
|
236
|
+
private _tools;
|
|
237
|
+
constructor(id: string, name: string, instruction: string, tools: Tool[], memory: Memory);
|
|
238
|
+
get id(): string;
|
|
239
|
+
get name(): string;
|
|
240
|
+
get instruction(): string;
|
|
241
|
+
get tools(): Tool[];
|
|
242
|
+
get memory(): Memory;
|
|
243
|
+
static create({ name, instruction, tools, memory, }: {
|
|
244
|
+
name: string;
|
|
245
|
+
instruction: string;
|
|
239
246
|
tools: Tool[];
|
|
240
247
|
memory: Memory;
|
|
241
|
-
handlers: SituationHandler[];
|
|
242
248
|
}): Agent;
|
|
243
249
|
static rehydrate(record: AgentRecord): Agent;
|
|
244
250
|
}
|
|
@@ -448,7 +454,7 @@ declare function defineAgentModule(config: AgentModuleConfig): {
|
|
|
448
454
|
instruction: string;
|
|
449
455
|
tools: Tool[];
|
|
450
456
|
handlers: SituationHandler[];
|
|
451
|
-
}) => Promise<
|
|
457
|
+
}) => Promise<Agent>;
|
|
452
458
|
createLoop: (params: CreateLoopParams) => Promise<Loop>;
|
|
453
459
|
runLoop: (loopId: string) => Promise<Loop>;
|
|
454
460
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -222,23 +222,29 @@ interface Memory {
|
|
|
222
222
|
|
|
223
223
|
type AgentRecord = {
|
|
224
224
|
id: string;
|
|
225
|
-
|
|
225
|
+
name: string;
|
|
226
|
+
instruction: string;
|
|
226
227
|
tools: Tool[];
|
|
227
228
|
memory: Memory;
|
|
228
|
-
handlers: SituationHandler[];
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
-
declare class Agent
|
|
232
|
-
private
|
|
233
|
-
private
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
231
|
+
declare class Agent {
|
|
232
|
+
private _id;
|
|
233
|
+
private _name;
|
|
234
|
+
private _instruction;
|
|
235
|
+
private _memory;
|
|
236
|
+
private _tools;
|
|
237
|
+
constructor(id: string, name: string, instruction: string, tools: Tool[], memory: Memory);
|
|
238
|
+
get id(): string;
|
|
239
|
+
get name(): string;
|
|
240
|
+
get instruction(): string;
|
|
241
|
+
get tools(): Tool[];
|
|
242
|
+
get memory(): Memory;
|
|
243
|
+
static create({ name, instruction, tools, memory, }: {
|
|
244
|
+
name: string;
|
|
245
|
+
instruction: string;
|
|
239
246
|
tools: Tool[];
|
|
240
247
|
memory: Memory;
|
|
241
|
-
handlers: SituationHandler[];
|
|
242
248
|
}): Agent;
|
|
243
249
|
static rehydrate(record: AgentRecord): Agent;
|
|
244
250
|
}
|
|
@@ -448,7 +454,7 @@ declare function defineAgentModule(config: AgentModuleConfig): {
|
|
|
448
454
|
instruction: string;
|
|
449
455
|
tools: Tool[];
|
|
450
456
|
handlers: SituationHandler[];
|
|
451
|
-
}) => Promise<
|
|
457
|
+
}) => Promise<Agent>;
|
|
452
458
|
createLoop: (params: CreateLoopParams) => Promise<Loop>;
|
|
453
459
|
runLoop: (loopId: string) => Promise<Loop>;
|
|
454
460
|
};
|
package/dist/index.js
CHANGED
|
@@ -405,28 +405,40 @@ var NotSituationSpecification = class extends SituationSpecification {
|
|
|
405
405
|
};
|
|
406
406
|
|
|
407
407
|
// src/domain/agent/agent.ts
|
|
408
|
-
var Agent = class _Agent
|
|
409
|
-
constructor(
|
|
410
|
-
|
|
411
|
-
this.
|
|
412
|
-
this.
|
|
408
|
+
var Agent = class _Agent {
|
|
409
|
+
constructor(id, name, instruction, tools, memory) {
|
|
410
|
+
this._id = id;
|
|
411
|
+
this._name = name;
|
|
412
|
+
this._instruction = instruction;
|
|
413
|
+
this._memory = memory;
|
|
414
|
+
this._tools = tools;
|
|
415
|
+
}
|
|
416
|
+
get id() {
|
|
417
|
+
return this._id;
|
|
413
418
|
}
|
|
414
|
-
|
|
415
|
-
return this.
|
|
419
|
+
get name() {
|
|
420
|
+
return this._name;
|
|
416
421
|
}
|
|
417
|
-
|
|
418
|
-
return this.
|
|
422
|
+
get instruction() {
|
|
423
|
+
return this._instruction;
|
|
424
|
+
}
|
|
425
|
+
get tools() {
|
|
426
|
+
return this._tools;
|
|
427
|
+
}
|
|
428
|
+
get memory() {
|
|
429
|
+
return this._memory;
|
|
419
430
|
}
|
|
420
431
|
static create({
|
|
421
|
-
|
|
432
|
+
name,
|
|
433
|
+
instruction,
|
|
422
434
|
tools,
|
|
423
|
-
memory
|
|
424
|
-
handlers
|
|
435
|
+
memory
|
|
425
436
|
}) {
|
|
426
|
-
|
|
437
|
+
const id = UuidGenerator.create();
|
|
438
|
+
return new _Agent(id, name, instruction, tools, memory);
|
|
427
439
|
}
|
|
428
440
|
static rehydrate(record) {
|
|
429
|
-
return new _Agent(record.
|
|
441
|
+
return new _Agent(record.id, record.name, record.instruction, record.tools, record.memory);
|
|
430
442
|
}
|
|
431
443
|
};
|
|
432
444
|
|
|
@@ -436,14 +448,11 @@ var CreateAgentUseCase = class {
|
|
|
436
448
|
this.agentRepository = agentRepository;
|
|
437
449
|
this.memoryFactory = memoryFactory;
|
|
438
450
|
}
|
|
439
|
-
async execute(name, instruction, tools
|
|
440
|
-
const id = UuidGenerator.create();
|
|
441
|
-
const manifest = { id, name, role: "agent" };
|
|
451
|
+
async execute(name, instruction, tools) {
|
|
442
452
|
const memory = this.memoryFactory.create();
|
|
443
|
-
const
|
|
444
|
-
const agent = Agent.create(agentRecord);
|
|
453
|
+
const agent = Agent.create({ name, instruction, tools, memory });
|
|
445
454
|
await this.agentRepository.save(agent);
|
|
446
|
-
return
|
|
455
|
+
return agent;
|
|
447
456
|
}
|
|
448
457
|
};
|
|
449
458
|
|
|
@@ -2581,7 +2590,7 @@ function defineAgentModule(config) {
|
|
|
2581
2590
|
const createAgentUseCase = new CreateAgentUseCase(agentRepository, memoryFactory);
|
|
2582
2591
|
const createLoopUseCase = new CreateAgentLoopUseCase(agentLoopRepository);
|
|
2583
2592
|
async function createAgent(config2) {
|
|
2584
|
-
return await createAgentUseCase.execute(config2.name, config2.instruction, config2.tools
|
|
2593
|
+
return await createAgentUseCase.execute(config2.name, config2.instruction, config2.tools);
|
|
2585
2594
|
}
|
|
2586
2595
|
async function createLoop(params) {
|
|
2587
2596
|
return await createLoopUseCase.execute(params);
|