@mozaik-ai/core 3.3.2 → 3.3.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
@@ -39,28 +39,28 @@ declare class InputText extends ItemContent {
39
39
  toJSON(): any[];
40
40
  }
41
41
 
42
- declare class UserMessage extends ContextItem {
42
+ declare class UserMessageItem extends ContextItem {
43
43
  readonly type = "message";
44
44
  readonly role = "user";
45
45
  readonly content: InputText;
46
46
  private constructor();
47
- static create(text: string): UserMessage;
47
+ static create(text: string): UserMessageItem;
48
48
  static rehydrate(data: {
49
49
  text: string;
50
- }): UserMessage;
50
+ }): UserMessageItem;
51
51
  toJSON(): any;
52
52
  }
53
53
 
54
- declare class DeveloperMessage extends ContextItem {
54
+ declare class DeveloperMessageItem extends ContextItem {
55
55
  readonly type = "message";
56
56
  readonly role = "developer";
57
57
  readonly content: InputText;
58
58
  private constructor();
59
59
  toJSON(): any;
60
- static create(text: string): DeveloperMessage;
60
+ static create(text: string): DeveloperMessageItem;
61
61
  static rehydrate(data: {
62
62
  text: string;
63
- }): DeveloperMessage;
63
+ }): DeveloperMessageItem;
64
64
  }
65
65
 
66
66
  declare class OutputText extends ItemContent {
@@ -73,18 +73,18 @@ declare class OutputText extends ItemContent {
73
73
  toJSON(): any[];
74
74
  }
75
75
 
76
- declare class ModelMessage extends ContextItem {
76
+ declare class ModelMessageItem extends ContextItem {
77
77
  readonly type = "message";
78
78
  readonly role = "assistant";
79
79
  readonly content: OutputText;
80
80
  private constructor();
81
81
  static rehydrate(data: {
82
82
  text: string;
83
- }): ModelMessage;
83
+ }): ModelMessageItem;
84
84
  toJSON(): any;
85
85
  }
86
86
 
87
- declare class FunctionCall extends ContextItem {
87
+ declare class FunctionCallItem extends ContextItem {
88
88
  readonly type = "function_call";
89
89
  readonly callId: string;
90
90
  readonly name: string;
@@ -94,7 +94,7 @@ declare class FunctionCall extends ContextItem {
94
94
  callId: string;
95
95
  name: string;
96
96
  args: string;
97
- }): FunctionCall;
97
+ }): FunctionCallItem;
98
98
  toJSON(): any;
99
99
  }
100
100
 
@@ -108,7 +108,7 @@ declare class SummaryText extends ItemContent {
108
108
  toJSON(): Record<string, any>;
109
109
  }
110
110
 
111
- declare class Reasoning extends ContextItem {
111
+ declare class ReasoningItem extends ContextItem {
112
112
  readonly type = "reasoning";
113
113
  readonly content: InputText | undefined;
114
114
  readonly encryptedContent: string | undefined;
@@ -118,7 +118,7 @@ declare class Reasoning extends ContextItem {
118
118
  content: InputText | undefined;
119
119
  encryptedContent: string | undefined;
120
120
  summary: SummaryText[];
121
- }): Reasoning;
121
+ }): ReasoningItem;
122
122
  toJSON(): any;
123
123
  }
124
124
 
@@ -135,16 +135,16 @@ interface GenerativeModel {
135
135
  readonly specification: ModelSpecification;
136
136
  }
137
137
 
138
- declare class FunctionCallOutput extends ContextItem {
138
+ declare class FunctionCallOutputItem extends ContextItem {
139
139
  readonly type = "function_call_output";
140
140
  readonly callId: string;
141
141
  readonly output: InputText;
142
142
  private constructor();
143
- static create(callId: string, output: string): FunctionCallOutput;
143
+ static create(callId: string, output: string): FunctionCallOutputItem;
144
144
  static rehydrate(data: {
145
145
  callId: string;
146
146
  output: InputText;
147
- }): FunctionCallOutput;
147
+ }): FunctionCallOutputItem;
148
148
  toJSON(): any;
149
149
  }
150
150
 
@@ -325,12 +325,14 @@ declare class InMemoryModelContextRepository implements ModelContextRepository {
325
325
  }
326
326
 
327
327
  declare enum HookId {
328
+ BEFORE_MESSAGE_RECEIVED = "BEFORE_MESSAGE_RECEIVED",
329
+ AFTER_MESSAGE_RECEIVED = "AFTER_MESSAGE_RECEIVED",
328
330
  BEFORE_INFERENCE = "BEFORE_INFERENCE",
329
331
  AFTER_INFERENCE = "AFTER_INFERENCE",
330
332
  BEFORE_FUNCTION_CALL = "BEFORE_FUNCTION_CALL",
331
333
  AFTER_FUNCTION_CALL = "AFTER_FUNCTION_CALL",
332
- BEFORE_MODEL_MESSAGE = "BEFORE_MODEL_MESSAGE",
333
- AFTER_MODEL_MESSAGE = "AFTER_MODEL_MESSAGE",
334
+ BEFORE_MODEL_RESPONDED = "BEFORE_MODEL_RESPONDED",
335
+ AFTER_MODEL_RESPONDED = "AFTER_MODEL_RESPONDED",
334
336
  ON_ERROR = "ON_ERROR"
335
337
  }
336
338
 
@@ -343,9 +345,10 @@ interface TransitionRecord {
343
345
  }
344
346
 
345
347
  declare enum StateId {
348
+ MESSAGE_RECEIVED = "MESSAGE_RECEIVED",
346
349
  INFERENCE_PENDING = "INFERENCE_PENDING",
347
350
  FUNCTION_CALL_PENDING = "FUNCTION_CALL_PENDING",
348
- MODEL_MESSAGE_RECEIVED = "MODEL_MESSAGE_RECEIVED"
351
+ MODEL_RESPONDED = "MODEL_RESPONDED"
349
352
  }
350
353
 
351
354
  declare enum ExecutionStatus {
@@ -368,7 +371,7 @@ declare class Execution {
368
371
 
369
372
  interface RuntimeContext {
370
373
  execution: Execution;
371
- userMessage: UserMessage;
374
+ userMessage: UserMessageItem;
372
375
  inferenceRequest?: InferenceRequest;
373
376
  model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability;
374
377
  context: ModelContext;
@@ -380,12 +383,13 @@ declare class AgentRuntime {
380
383
  private hooksRegistry;
381
384
  private stateHandlerRegistry;
382
385
  constructor();
386
+ onMessageReceived(runtimeContext: RuntimeContext): Promise<void>;
383
387
  onInferencePending(runtimeContext: RuntimeContext): Promise<void>;
384
388
  onFunctionCallPending(runtimeContext: RuntimeContext): Promise<void>;
385
389
  onError(context: RuntimeContext): Promise<void>;
386
- onModelMessageReceived(context: RuntimeContext): Promise<void>;
390
+ onModelResponded(context: RuntimeContext): Promise<void>;
387
391
  on(hookId: HookId, callback: (data: any) => Promise<void>): Promise<void>;
388
- start(userMessage: UserMessage, model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: ModelContext): Promise<void>;
392
+ start(userMessage: UserMessageItem, model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: ModelContext): Promise<void>;
389
393
  }
390
394
 
391
395
  interface InferenceVisitor {
@@ -399,16 +403,18 @@ interface FunctionCallVisitor {
399
403
  }
400
404
 
401
405
  declare class Agent {
402
- private readonly runtime;
403
406
  private visitor;
404
407
  private functionCallVisitor;
405
- constructor(runtime: AgentRuntime);
408
+ protected runtime: AgentRuntime;
409
+ constructor();
410
+ beforeMessageReceived(context: RuntimeContext): Promise<void>;
411
+ afterMessageReceived(context: RuntimeContext): Promise<void>;
406
412
  beforeInference(context: RuntimeContext): Promise<void>;
407
413
  afterInference(context: RuntimeContext): Promise<void>;
408
414
  beforeFunctionCall(context: RuntimeContext): Promise<void>;
409
415
  afterFunctionCall(context: RuntimeContext): Promise<void>;
410
- beforeModelMessage(context: RuntimeContext): Promise<void>;
411
- afterModelMessage(context: RuntimeContext): Promise<void>;
416
+ beforeModelResponded(context: RuntimeContext): Promise<void>;
417
+ afterModelResponded(context: RuntimeContext): Promise<void>;
412
418
  onError(context: RuntimeContext): Promise<void>;
413
419
  onStart(context: RuntimeContext): Promise<void>;
414
420
  setInferenceVisitor(visitor: InferenceVisitor): void;
@@ -427,4 +433,16 @@ declare class AgentSociety {
427
433
  stop(): void;
428
434
  }
429
435
 
430
- export { type Action, Agent, AgentRuntime, AgentSociety, type AsyncAction, type AsyncRule, BaseSpecification, ContextItem, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryModelContextRepository, InferenceRequest, InferenceResponse, type InferenceVisitor, InputTokenDetails, Loop, ModelContext, type ModelContextRepository, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning, type RuntimeContext, type Specification, TokenUsage, type Tool, UserMessage };
436
+ declare class SystemMessageItem extends ContextItem {
437
+ readonly type = "message";
438
+ readonly role = "system";
439
+ readonly content: InputText;
440
+ private constructor();
441
+ toJSON(): any;
442
+ static create(text: string): SystemMessageItem;
443
+ static rehydrate(data: {
444
+ text: string;
445
+ }): SystemMessageItem;
446
+ }
447
+
448
+ export { type Action, Agent, AgentSociety, type AsyncAction, type AsyncRule, BaseSpecification, ContextItem, DeveloperMessageItem, FunctionCallItem, FunctionCallOutputItem, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryModelContextRepository, InferenceRequest, InferenceResponse, type InferenceVisitor, InputTokenDetails, Loop, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIResponses, OutputTokenDetails, ReasoningItem, type RuntimeContext, type Specification, SystemMessageItem, TokenUsage, type Tool, UserMessageItem };
package/dist/index.d.ts CHANGED
@@ -39,28 +39,28 @@ declare class InputText extends ItemContent {
39
39
  toJSON(): any[];
40
40
  }
41
41
 
42
- declare class UserMessage extends ContextItem {
42
+ declare class UserMessageItem extends ContextItem {
43
43
  readonly type = "message";
44
44
  readonly role = "user";
45
45
  readonly content: InputText;
46
46
  private constructor();
47
- static create(text: string): UserMessage;
47
+ static create(text: string): UserMessageItem;
48
48
  static rehydrate(data: {
49
49
  text: string;
50
- }): UserMessage;
50
+ }): UserMessageItem;
51
51
  toJSON(): any;
52
52
  }
53
53
 
54
- declare class DeveloperMessage extends ContextItem {
54
+ declare class DeveloperMessageItem extends ContextItem {
55
55
  readonly type = "message";
56
56
  readonly role = "developer";
57
57
  readonly content: InputText;
58
58
  private constructor();
59
59
  toJSON(): any;
60
- static create(text: string): DeveloperMessage;
60
+ static create(text: string): DeveloperMessageItem;
61
61
  static rehydrate(data: {
62
62
  text: string;
63
- }): DeveloperMessage;
63
+ }): DeveloperMessageItem;
64
64
  }
65
65
 
66
66
  declare class OutputText extends ItemContent {
@@ -73,18 +73,18 @@ declare class OutputText extends ItemContent {
73
73
  toJSON(): any[];
74
74
  }
75
75
 
76
- declare class ModelMessage extends ContextItem {
76
+ declare class ModelMessageItem extends ContextItem {
77
77
  readonly type = "message";
78
78
  readonly role = "assistant";
79
79
  readonly content: OutputText;
80
80
  private constructor();
81
81
  static rehydrate(data: {
82
82
  text: string;
83
- }): ModelMessage;
83
+ }): ModelMessageItem;
84
84
  toJSON(): any;
85
85
  }
86
86
 
87
- declare class FunctionCall extends ContextItem {
87
+ declare class FunctionCallItem extends ContextItem {
88
88
  readonly type = "function_call";
89
89
  readonly callId: string;
90
90
  readonly name: string;
@@ -94,7 +94,7 @@ declare class FunctionCall extends ContextItem {
94
94
  callId: string;
95
95
  name: string;
96
96
  args: string;
97
- }): FunctionCall;
97
+ }): FunctionCallItem;
98
98
  toJSON(): any;
99
99
  }
100
100
 
@@ -108,7 +108,7 @@ declare class SummaryText extends ItemContent {
108
108
  toJSON(): Record<string, any>;
109
109
  }
110
110
 
111
- declare class Reasoning extends ContextItem {
111
+ declare class ReasoningItem extends ContextItem {
112
112
  readonly type = "reasoning";
113
113
  readonly content: InputText | undefined;
114
114
  readonly encryptedContent: string | undefined;
@@ -118,7 +118,7 @@ declare class Reasoning extends ContextItem {
118
118
  content: InputText | undefined;
119
119
  encryptedContent: string | undefined;
120
120
  summary: SummaryText[];
121
- }): Reasoning;
121
+ }): ReasoningItem;
122
122
  toJSON(): any;
123
123
  }
124
124
 
@@ -135,16 +135,16 @@ interface GenerativeModel {
135
135
  readonly specification: ModelSpecification;
136
136
  }
137
137
 
138
- declare class FunctionCallOutput extends ContextItem {
138
+ declare class FunctionCallOutputItem extends ContextItem {
139
139
  readonly type = "function_call_output";
140
140
  readonly callId: string;
141
141
  readonly output: InputText;
142
142
  private constructor();
143
- static create(callId: string, output: string): FunctionCallOutput;
143
+ static create(callId: string, output: string): FunctionCallOutputItem;
144
144
  static rehydrate(data: {
145
145
  callId: string;
146
146
  output: InputText;
147
- }): FunctionCallOutput;
147
+ }): FunctionCallOutputItem;
148
148
  toJSON(): any;
149
149
  }
150
150
 
@@ -325,12 +325,14 @@ declare class InMemoryModelContextRepository implements ModelContextRepository {
325
325
  }
326
326
 
327
327
  declare enum HookId {
328
+ BEFORE_MESSAGE_RECEIVED = "BEFORE_MESSAGE_RECEIVED",
329
+ AFTER_MESSAGE_RECEIVED = "AFTER_MESSAGE_RECEIVED",
328
330
  BEFORE_INFERENCE = "BEFORE_INFERENCE",
329
331
  AFTER_INFERENCE = "AFTER_INFERENCE",
330
332
  BEFORE_FUNCTION_CALL = "BEFORE_FUNCTION_CALL",
331
333
  AFTER_FUNCTION_CALL = "AFTER_FUNCTION_CALL",
332
- BEFORE_MODEL_MESSAGE = "BEFORE_MODEL_MESSAGE",
333
- AFTER_MODEL_MESSAGE = "AFTER_MODEL_MESSAGE",
334
+ BEFORE_MODEL_RESPONDED = "BEFORE_MODEL_RESPONDED",
335
+ AFTER_MODEL_RESPONDED = "AFTER_MODEL_RESPONDED",
334
336
  ON_ERROR = "ON_ERROR"
335
337
  }
336
338
 
@@ -343,9 +345,10 @@ interface TransitionRecord {
343
345
  }
344
346
 
345
347
  declare enum StateId {
348
+ MESSAGE_RECEIVED = "MESSAGE_RECEIVED",
346
349
  INFERENCE_PENDING = "INFERENCE_PENDING",
347
350
  FUNCTION_CALL_PENDING = "FUNCTION_CALL_PENDING",
348
- MODEL_MESSAGE_RECEIVED = "MODEL_MESSAGE_RECEIVED"
351
+ MODEL_RESPONDED = "MODEL_RESPONDED"
349
352
  }
350
353
 
351
354
  declare enum ExecutionStatus {
@@ -368,7 +371,7 @@ declare class Execution {
368
371
 
369
372
  interface RuntimeContext {
370
373
  execution: Execution;
371
- userMessage: UserMessage;
374
+ userMessage: UserMessageItem;
372
375
  inferenceRequest?: InferenceRequest;
373
376
  model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability;
374
377
  context: ModelContext;
@@ -380,12 +383,13 @@ declare class AgentRuntime {
380
383
  private hooksRegistry;
381
384
  private stateHandlerRegistry;
382
385
  constructor();
386
+ onMessageReceived(runtimeContext: RuntimeContext): Promise<void>;
383
387
  onInferencePending(runtimeContext: RuntimeContext): Promise<void>;
384
388
  onFunctionCallPending(runtimeContext: RuntimeContext): Promise<void>;
385
389
  onError(context: RuntimeContext): Promise<void>;
386
- onModelMessageReceived(context: RuntimeContext): Promise<void>;
390
+ onModelResponded(context: RuntimeContext): Promise<void>;
387
391
  on(hookId: HookId, callback: (data: any) => Promise<void>): Promise<void>;
388
- start(userMessage: UserMessage, model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: ModelContext): Promise<void>;
392
+ start(userMessage: UserMessageItem, model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: ModelContext): Promise<void>;
389
393
  }
390
394
 
391
395
  interface InferenceVisitor {
@@ -399,16 +403,18 @@ interface FunctionCallVisitor {
399
403
  }
400
404
 
401
405
  declare class Agent {
402
- private readonly runtime;
403
406
  private visitor;
404
407
  private functionCallVisitor;
405
- constructor(runtime: AgentRuntime);
408
+ protected runtime: AgentRuntime;
409
+ constructor();
410
+ beforeMessageReceived(context: RuntimeContext): Promise<void>;
411
+ afterMessageReceived(context: RuntimeContext): Promise<void>;
406
412
  beforeInference(context: RuntimeContext): Promise<void>;
407
413
  afterInference(context: RuntimeContext): Promise<void>;
408
414
  beforeFunctionCall(context: RuntimeContext): Promise<void>;
409
415
  afterFunctionCall(context: RuntimeContext): Promise<void>;
410
- beforeModelMessage(context: RuntimeContext): Promise<void>;
411
- afterModelMessage(context: RuntimeContext): Promise<void>;
416
+ beforeModelResponded(context: RuntimeContext): Promise<void>;
417
+ afterModelResponded(context: RuntimeContext): Promise<void>;
412
418
  onError(context: RuntimeContext): Promise<void>;
413
419
  onStart(context: RuntimeContext): Promise<void>;
414
420
  setInferenceVisitor(visitor: InferenceVisitor): void;
@@ -427,4 +433,16 @@ declare class AgentSociety {
427
433
  stop(): void;
428
434
  }
429
435
 
430
- export { type Action, Agent, AgentRuntime, AgentSociety, type AsyncAction, type AsyncRule, BaseSpecification, ContextItem, DeveloperMessage, FunctionCall, FunctionCallOutput, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryModelContextRepository, InferenceRequest, InferenceResponse, type InferenceVisitor, InputTokenDetails, Loop, ModelContext, type ModelContextRepository, ModelMessage, OpenAIResponses, OutputTokenDetails, Reasoning, type RuntimeContext, type Specification, TokenUsage, type Tool, UserMessage };
436
+ declare class SystemMessageItem extends ContextItem {
437
+ readonly type = "message";
438
+ readonly role = "system";
439
+ readonly content: InputText;
440
+ private constructor();
441
+ toJSON(): any;
442
+ static create(text: string): SystemMessageItem;
443
+ static rehydrate(data: {
444
+ text: string;
445
+ }): SystemMessageItem;
446
+ }
447
+
448
+ export { type Action, Agent, AgentSociety, type AsyncAction, type AsyncRule, BaseSpecification, ContextItem, DeveloperMessageItem, FunctionCallItem, FunctionCallOutputItem, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, If, InMemoryModelContextRepository, InferenceRequest, InferenceResponse, type InferenceVisitor, InputTokenDetails, Loop, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIResponses, OutputTokenDetails, ReasoningItem, type RuntimeContext, type Specification, SystemMessageItem, TokenUsage, type Tool, UserMessageItem };