@mozaik-ai/core 4.2.0-beta.4 → 4.2.0-beta.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/dist/index.d.mts CHANGED
@@ -216,9 +216,8 @@ interface InferenceRunner {
216
216
  }
217
217
 
218
218
  interface Memory {
219
- getContext(): Context;
220
- saveItem(item: ContextItem): void;
221
- saveItems(items: ContextItem[]): void;
219
+ remember(items: ContextItem[], participantId: string): void;
220
+ recall(topic: string, participantId: string): ContextItem[];
222
221
  }
223
222
 
224
223
  type AgentRecord = {
@@ -345,6 +344,19 @@ declare class LoopRule {
345
344
  static create(spec: CreateLoopRuleParams): LoopRule;
346
345
  static rehydrate(spec: LoopRuleRecord): LoopRule;
347
346
  }
347
+ type RuleBookRecord = {
348
+ readonly rules: LoopRuleRecord[];
349
+ };
350
+ declare class RuleBook {
351
+ private rules;
352
+ private constructor();
353
+ addRule(rule: LoopRule): void;
354
+ removeRule(rule: LoopRule): void;
355
+ getRules(): readonly LoopRule[];
356
+ static create(loopRuleParams: CreateLoopRuleParams[]): RuleBook;
357
+ static rehydrate(record: RuleBookRecord): RuleBook;
358
+ record(): RuleBookRecord;
359
+ }
348
360
 
349
361
  interface LoopRecord {
350
362
  id: string;
@@ -356,10 +368,19 @@ interface LoopRecord {
356
368
  pendingOperation?: PendingOperation;
357
369
  transitionHistory: LoopTransition[];
358
370
  operationHistory: CompletedOperation[];
359
- rules: LoopRule[];
371
+ ruleBook: RuleBookRecord;
360
372
  }
361
373
 
362
374
  type LoopStateId = "idle" | "awaiting_inference_request" | "awaiting_inference" | "awaiting_tool_output" | "stopped" | "completed";
375
+ type CreateLoopParams = {
376
+ subject: string;
377
+ agentId: string;
378
+ rules: CreateLoopRuleParams[];
379
+ } | {
380
+ subject: string;
381
+ agentId: string;
382
+ request: InferenceRequest;
383
+ };
363
384
  declare class Loop {
364
385
  private readonly loopId;
365
386
  private readonly agentId;
@@ -370,7 +391,7 @@ declare class Loop {
370
391
  private readonly transitionHistory;
371
392
  private inferenceRequest;
372
393
  private readonly operationHistory;
373
- private readonly loopRules;
394
+ private readonly _ruleBook;
374
395
  private constructor();
375
396
  get id(): string;
376
397
  get stateId(): LoopStateId;
@@ -378,7 +399,8 @@ declare class Loop {
378
399
  get history(): readonly LoopTransition[];
379
400
  get completedOperations(): readonly CompletedOperation[];
380
401
  get request(): InferenceRequest | undefined;
381
- get rules(): readonly LoopRule[];
402
+ get ruleBook(): RuleBook;
403
+ getSubject(): string;
382
404
  getAgentId(): string;
383
405
  record(): LoopRecord;
384
406
  moveToIdle(reason: string, transitionId: string): void;
@@ -397,7 +419,7 @@ declare class Loop {
397
419
  stop(reason: string): void;
398
420
  wait(reason: string): void;
399
421
  private assertNotSettled;
400
- static create(id: string, agentId: string, subject: string, rules: LoopRule[]): Loop;
422
+ static create(agentId: string, subject: string, ruleBook: RuleBook): Loop;
401
423
  static rehydrate(record: LoopRecord): Loop;
402
424
  }
403
425
 
@@ -427,18 +449,8 @@ declare function defineAgentModule(config: AgentModuleConfig): {
427
449
  tools: Tool[];
428
450
  handlers: SituationHandler[];
429
451
  }) => Promise<AgentRecord>;
430
- createLoop: (params: {
431
- subject: string;
432
- agentId: string;
433
- rules: CreateLoopRuleParams[];
434
- }) => Promise<Loop>;
452
+ createLoop: (params: CreateLoopParams) => Promise<Loop>;
435
453
  runLoop: (loopId: string) => Promise<Loop>;
436
- state: (loopStateId: LoopStateId) => LoopSpecification;
437
- modelAnswered: () => LoopSpecification;
438
- runInference: () => LoopAction;
439
- toolUse: () => LoopAction;
440
- complete: (reason?: string) => LoopAction;
441
- wait: (reason?: string) => LoopAction;
442
454
  };
443
455
 
444
456
  export { Agent, type AgentModuleConfig, type AgentRepository, type GenerativeModel, type InferenceRunner, type InferenceRunnerConfig, type LoopRepository, Participant, type SharedState, type SituationContext, type SituationHandler, type SituationProcessor, SituationSpecification, SpaceEvent, type Tool, type ToolUseRunner, defineAgentModule, defineRuntime };
package/dist/index.d.ts CHANGED
@@ -216,9 +216,8 @@ interface InferenceRunner {
216
216
  }
217
217
 
218
218
  interface Memory {
219
- getContext(): Context;
220
- saveItem(item: ContextItem): void;
221
- saveItems(items: ContextItem[]): void;
219
+ remember(items: ContextItem[], participantId: string): void;
220
+ recall(topic: string, participantId: string): ContextItem[];
222
221
  }
223
222
 
224
223
  type AgentRecord = {
@@ -345,6 +344,19 @@ declare class LoopRule {
345
344
  static create(spec: CreateLoopRuleParams): LoopRule;
346
345
  static rehydrate(spec: LoopRuleRecord): LoopRule;
347
346
  }
347
+ type RuleBookRecord = {
348
+ readonly rules: LoopRuleRecord[];
349
+ };
350
+ declare class RuleBook {
351
+ private rules;
352
+ private constructor();
353
+ addRule(rule: LoopRule): void;
354
+ removeRule(rule: LoopRule): void;
355
+ getRules(): readonly LoopRule[];
356
+ static create(loopRuleParams: CreateLoopRuleParams[]): RuleBook;
357
+ static rehydrate(record: RuleBookRecord): RuleBook;
358
+ record(): RuleBookRecord;
359
+ }
348
360
 
349
361
  interface LoopRecord {
350
362
  id: string;
@@ -356,10 +368,19 @@ interface LoopRecord {
356
368
  pendingOperation?: PendingOperation;
357
369
  transitionHistory: LoopTransition[];
358
370
  operationHistory: CompletedOperation[];
359
- rules: LoopRule[];
371
+ ruleBook: RuleBookRecord;
360
372
  }
361
373
 
362
374
  type LoopStateId = "idle" | "awaiting_inference_request" | "awaiting_inference" | "awaiting_tool_output" | "stopped" | "completed";
375
+ type CreateLoopParams = {
376
+ subject: string;
377
+ agentId: string;
378
+ rules: CreateLoopRuleParams[];
379
+ } | {
380
+ subject: string;
381
+ agentId: string;
382
+ request: InferenceRequest;
383
+ };
363
384
  declare class Loop {
364
385
  private readonly loopId;
365
386
  private readonly agentId;
@@ -370,7 +391,7 @@ declare class Loop {
370
391
  private readonly transitionHistory;
371
392
  private inferenceRequest;
372
393
  private readonly operationHistory;
373
- private readonly loopRules;
394
+ private readonly _ruleBook;
374
395
  private constructor();
375
396
  get id(): string;
376
397
  get stateId(): LoopStateId;
@@ -378,7 +399,8 @@ declare class Loop {
378
399
  get history(): readonly LoopTransition[];
379
400
  get completedOperations(): readonly CompletedOperation[];
380
401
  get request(): InferenceRequest | undefined;
381
- get rules(): readonly LoopRule[];
402
+ get ruleBook(): RuleBook;
403
+ getSubject(): string;
382
404
  getAgentId(): string;
383
405
  record(): LoopRecord;
384
406
  moveToIdle(reason: string, transitionId: string): void;
@@ -397,7 +419,7 @@ declare class Loop {
397
419
  stop(reason: string): void;
398
420
  wait(reason: string): void;
399
421
  private assertNotSettled;
400
- static create(id: string, agentId: string, subject: string, rules: LoopRule[]): Loop;
422
+ static create(agentId: string, subject: string, ruleBook: RuleBook): Loop;
401
423
  static rehydrate(record: LoopRecord): Loop;
402
424
  }
403
425
 
@@ -427,18 +449,8 @@ declare function defineAgentModule(config: AgentModuleConfig): {
427
449
  tools: Tool[];
428
450
  handlers: SituationHandler[];
429
451
  }) => Promise<AgentRecord>;
430
- createLoop: (params: {
431
- subject: string;
432
- agentId: string;
433
- rules: CreateLoopRuleParams[];
434
- }) => Promise<Loop>;
452
+ createLoop: (params: CreateLoopParams) => Promise<Loop>;
435
453
  runLoop: (loopId: string) => Promise<Loop>;
436
- state: (loopStateId: LoopStateId) => LoopSpecification;
437
- modelAnswered: () => LoopSpecification;
438
- runInference: () => LoopAction;
439
- toolUse: () => LoopAction;
440
- complete: (reason?: string) => LoopAction;
441
- wait: (reason?: string) => LoopAction;
442
454
  };
443
455
 
444
456
  export { Agent, type AgentModuleConfig, type AgentRepository, type GenerativeModel, type InferenceRunner, type InferenceRunnerConfig, type LoopRepository, Participant, type SharedState, type SituationContext, type SituationHandler, type SituationProcessor, SituationSpecification, SpaceEvent, type Tool, type ToolUseRunner, defineAgentModule, defineRuntime };