@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.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
|
@@ -246,9 +246,6 @@ var Space = class _Space {
|
|
|
246
246
|
}
|
|
247
247
|
getParticipant(id) {
|
|
248
248
|
const participant = this.getParticipants().find((p) => p.getId() === id);
|
|
249
|
-
if (!participant) {
|
|
250
|
-
throw new Error(`Participant ${id} not found`);
|
|
251
|
-
}
|
|
252
249
|
return participant;
|
|
253
250
|
}
|
|
254
251
|
removeParticipant(participant) {
|
|
@@ -322,13 +319,13 @@ function defineRuntime() {
|
|
|
322
319
|
const createSpace = async (name) => {
|
|
323
320
|
return await createSpaceUseCase.execute(name);
|
|
324
321
|
};
|
|
325
|
-
const
|
|
322
|
+
const participantJoinUseCase = new ParticipantJoinUseCase(spaceRepository, eventPublisher);
|
|
326
323
|
const join = async (spaceId, participant) => {
|
|
327
|
-
return await
|
|
324
|
+
return await participantJoinUseCase.execute(spaceId, participant);
|
|
328
325
|
};
|
|
329
|
-
const
|
|
326
|
+
const participantLeaveUseCase = new ParticipantLeaveUseCase(spaceRepository, eventPublisher);
|
|
330
327
|
const leave = async (spaceId, participantId) => {
|
|
331
|
-
return await
|
|
328
|
+
return await participantLeaveUseCase.execute(spaceId, participantId);
|
|
332
329
|
};
|
|
333
330
|
const sendMessageUseCase = new SendMessageUseCase(spaceRepository, eventPublisher);
|
|
334
331
|
const sendMessage = async (spaceId, participantId, message) => {
|
|
@@ -408,28 +405,40 @@ var NotSituationSpecification = class extends SituationSpecification {
|
|
|
408
405
|
};
|
|
409
406
|
|
|
410
407
|
// src/domain/agent/agent.ts
|
|
411
|
-
var Agent = class _Agent
|
|
412
|
-
constructor(
|
|
413
|
-
|
|
414
|
-
this.
|
|
415
|
-
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;
|
|
418
|
+
}
|
|
419
|
+
get name() {
|
|
420
|
+
return this._name;
|
|
421
|
+
}
|
|
422
|
+
get instruction() {
|
|
423
|
+
return this._instruction;
|
|
416
424
|
}
|
|
417
|
-
|
|
418
|
-
return this.
|
|
425
|
+
get tools() {
|
|
426
|
+
return this._tools;
|
|
419
427
|
}
|
|
420
|
-
|
|
421
|
-
return this.
|
|
428
|
+
get memory() {
|
|
429
|
+
return this._memory;
|
|
422
430
|
}
|
|
423
431
|
static create({
|
|
424
|
-
|
|
432
|
+
name,
|
|
433
|
+
instruction,
|
|
425
434
|
tools,
|
|
426
|
-
memory
|
|
427
|
-
handlers
|
|
435
|
+
memory
|
|
428
436
|
}) {
|
|
429
|
-
|
|
437
|
+
const id = UuidGenerator.create();
|
|
438
|
+
return new _Agent(id, name, instruction, tools, memory);
|
|
430
439
|
}
|
|
431
440
|
static rehydrate(record) {
|
|
432
|
-
return new _Agent(record.
|
|
441
|
+
return new _Agent(record.id, record.name, record.instruction, record.tools, record.memory);
|
|
433
442
|
}
|
|
434
443
|
};
|
|
435
444
|
|
|
@@ -439,14 +448,11 @@ var CreateAgentUseCase = class {
|
|
|
439
448
|
this.agentRepository = agentRepository;
|
|
440
449
|
this.memoryFactory = memoryFactory;
|
|
441
450
|
}
|
|
442
|
-
async execute(name, instruction, tools
|
|
443
|
-
const id = UuidGenerator.create();
|
|
444
|
-
const manifest = { id, name, role: "agent" };
|
|
451
|
+
async execute(name, instruction, tools) {
|
|
445
452
|
const memory = this.memoryFactory.create();
|
|
446
|
-
const
|
|
447
|
-
const agent = Agent.create(agentRecord);
|
|
453
|
+
const agent = Agent.create({ name, instruction, tools, memory });
|
|
448
454
|
await this.agentRepository.save(agent);
|
|
449
|
-
return
|
|
455
|
+
return agent;
|
|
450
456
|
}
|
|
451
457
|
};
|
|
452
458
|
|
|
@@ -2584,7 +2590,7 @@ function defineAgentModule(config) {
|
|
|
2584
2590
|
const createAgentUseCase = new CreateAgentUseCase(agentRepository, memoryFactory);
|
|
2585
2591
|
const createLoopUseCase = new CreateAgentLoopUseCase(agentLoopRepository);
|
|
2586
2592
|
async function createAgent(config2) {
|
|
2587
|
-
return await createAgentUseCase.execute(config2.name, config2.instruction, config2.tools
|
|
2593
|
+
return await createAgentUseCase.execute(config2.name, config2.instruction, config2.tools);
|
|
2588
2594
|
}
|
|
2589
2595
|
async function createLoop(params) {
|
|
2590
2596
|
return await createLoopUseCase.execute(params);
|