@mozaik-ai/core 3.3.2 → 3.3.4

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
 
@@ -324,16 +324,6 @@ declare class InMemoryModelContextRepository implements ModelContextRepository {
324
324
  private clone;
325
325
  }
326
326
 
327
- declare enum HookId {
328
- BEFORE_INFERENCE = "BEFORE_INFERENCE",
329
- AFTER_INFERENCE = "AFTER_INFERENCE",
330
- BEFORE_FUNCTION_CALL = "BEFORE_FUNCTION_CALL",
331
- AFTER_FUNCTION_CALL = "AFTER_FUNCTION_CALL",
332
- BEFORE_MODEL_MESSAGE = "BEFORE_MODEL_MESSAGE",
333
- AFTER_MODEL_MESSAGE = "AFTER_MODEL_MESSAGE",
334
- ON_ERROR = "ON_ERROR"
335
- }
336
-
337
327
  interface TransitionRecord {
338
328
  fromState: StateId;
339
329
  toState: StateId;
@@ -343,9 +333,10 @@ interface TransitionRecord {
343
333
  }
344
334
 
345
335
  declare enum StateId {
336
+ MESSAGE_RECEIVED = "MESSAGE_RECEIVED",
346
337
  INFERENCE_PENDING = "INFERENCE_PENDING",
347
338
  FUNCTION_CALL_PENDING = "FUNCTION_CALL_PENDING",
348
- MODEL_MESSAGE_RECEIVED = "MODEL_MESSAGE_RECEIVED"
339
+ MODEL_RESPONDED = "MODEL_RESPONDED"
349
340
  }
350
341
 
351
342
  declare enum ExecutionStatus {
@@ -368,7 +359,7 @@ declare class Execution {
368
359
 
369
360
  interface RuntimeContext {
370
361
  execution: Execution;
371
- userMessage: UserMessage;
362
+ userMessage: UserMessageItem;
372
363
  inferenceRequest?: InferenceRequest;
373
364
  model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability;
374
365
  context: ModelContext;
@@ -376,18 +367,6 @@ interface RuntimeContext {
376
367
  error?: Error;
377
368
  }
378
369
 
379
- declare class AgentRuntime {
380
- private hooksRegistry;
381
- private stateHandlerRegistry;
382
- constructor();
383
- onInferencePending(runtimeContext: RuntimeContext): Promise<void>;
384
- onFunctionCallPending(runtimeContext: RuntimeContext): Promise<void>;
385
- onError(context: RuntimeContext): Promise<void>;
386
- onModelMessageReceived(context: RuntimeContext): Promise<void>;
387
- on(hookId: HookId, callback: (data: any) => Promise<void>): Promise<void>;
388
- start(userMessage: UserMessage, model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: ModelContext): Promise<void>;
389
- }
390
-
391
370
  interface InferenceVisitor {
392
371
  onStart(context: RuntimeContext): Promise<void>;
393
372
  afterInference(inferenceResponse: InferenceResponse): Promise<void>;
@@ -399,16 +378,18 @@ interface FunctionCallVisitor {
399
378
  }
400
379
 
401
380
  declare class Agent {
402
- private readonly runtime;
403
381
  private visitor;
404
382
  private functionCallVisitor;
405
- constructor(runtime: AgentRuntime);
383
+ private runtime;
384
+ constructor();
385
+ beforeMessageReceived(context: RuntimeContext): Promise<void>;
386
+ afterMessageReceived(context: RuntimeContext): Promise<void>;
406
387
  beforeInference(context: RuntimeContext): Promise<void>;
407
388
  afterInference(context: RuntimeContext): Promise<void>;
408
389
  beforeFunctionCall(context: RuntimeContext): Promise<void>;
409
390
  afterFunctionCall(context: RuntimeContext): Promise<void>;
410
- beforeModelMessage(context: RuntimeContext): Promise<void>;
411
- afterModelMessage(context: RuntimeContext): Promise<void>;
391
+ beforeModelResponded(context: RuntimeContext): Promise<void>;
392
+ afterModelResponded(context: RuntimeContext): Promise<void>;
412
393
  onError(context: RuntimeContext): Promise<void>;
413
394
  onStart(context: RuntimeContext): Promise<void>;
414
395
  setInferenceVisitor(visitor: InferenceVisitor): void;
@@ -427,4 +408,16 @@ declare class AgentSociety {
427
408
  stop(): void;
428
409
  }
429
410
 
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 };
411
+ declare class SystemMessageItem extends ContextItem {
412
+ readonly type = "message";
413
+ readonly role = "system";
414
+ readonly content: InputText;
415
+ private constructor();
416
+ toJSON(): any;
417
+ static create(text: string): SystemMessageItem;
418
+ static rehydrate(data: {
419
+ text: string;
420
+ }): SystemMessageItem;
421
+ }
422
+
423
+ 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
 
@@ -324,16 +324,6 @@ declare class InMemoryModelContextRepository implements ModelContextRepository {
324
324
  private clone;
325
325
  }
326
326
 
327
- declare enum HookId {
328
- BEFORE_INFERENCE = "BEFORE_INFERENCE",
329
- AFTER_INFERENCE = "AFTER_INFERENCE",
330
- BEFORE_FUNCTION_CALL = "BEFORE_FUNCTION_CALL",
331
- AFTER_FUNCTION_CALL = "AFTER_FUNCTION_CALL",
332
- BEFORE_MODEL_MESSAGE = "BEFORE_MODEL_MESSAGE",
333
- AFTER_MODEL_MESSAGE = "AFTER_MODEL_MESSAGE",
334
- ON_ERROR = "ON_ERROR"
335
- }
336
-
337
327
  interface TransitionRecord {
338
328
  fromState: StateId;
339
329
  toState: StateId;
@@ -343,9 +333,10 @@ interface TransitionRecord {
343
333
  }
344
334
 
345
335
  declare enum StateId {
336
+ MESSAGE_RECEIVED = "MESSAGE_RECEIVED",
346
337
  INFERENCE_PENDING = "INFERENCE_PENDING",
347
338
  FUNCTION_CALL_PENDING = "FUNCTION_CALL_PENDING",
348
- MODEL_MESSAGE_RECEIVED = "MODEL_MESSAGE_RECEIVED"
339
+ MODEL_RESPONDED = "MODEL_RESPONDED"
349
340
  }
350
341
 
351
342
  declare enum ExecutionStatus {
@@ -368,7 +359,7 @@ declare class Execution {
368
359
 
369
360
  interface RuntimeContext {
370
361
  execution: Execution;
371
- userMessage: UserMessage;
362
+ userMessage: UserMessageItem;
372
363
  inferenceRequest?: InferenceRequest;
373
364
  model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability;
374
365
  context: ModelContext;
@@ -376,18 +367,6 @@ interface RuntimeContext {
376
367
  error?: Error;
377
368
  }
378
369
 
379
- declare class AgentRuntime {
380
- private hooksRegistry;
381
- private stateHandlerRegistry;
382
- constructor();
383
- onInferencePending(runtimeContext: RuntimeContext): Promise<void>;
384
- onFunctionCallPending(runtimeContext: RuntimeContext): Promise<void>;
385
- onError(context: RuntimeContext): Promise<void>;
386
- onModelMessageReceived(context: RuntimeContext): Promise<void>;
387
- on(hookId: HookId, callback: (data: any) => Promise<void>): Promise<void>;
388
- start(userMessage: UserMessage, model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: ModelContext): Promise<void>;
389
- }
390
-
391
370
  interface InferenceVisitor {
392
371
  onStart(context: RuntimeContext): Promise<void>;
393
372
  afterInference(inferenceResponse: InferenceResponse): Promise<void>;
@@ -399,16 +378,18 @@ interface FunctionCallVisitor {
399
378
  }
400
379
 
401
380
  declare class Agent {
402
- private readonly runtime;
403
381
  private visitor;
404
382
  private functionCallVisitor;
405
- constructor(runtime: AgentRuntime);
383
+ private runtime;
384
+ constructor();
385
+ beforeMessageReceived(context: RuntimeContext): Promise<void>;
386
+ afterMessageReceived(context: RuntimeContext): Promise<void>;
406
387
  beforeInference(context: RuntimeContext): Promise<void>;
407
388
  afterInference(context: RuntimeContext): Promise<void>;
408
389
  beforeFunctionCall(context: RuntimeContext): Promise<void>;
409
390
  afterFunctionCall(context: RuntimeContext): Promise<void>;
410
- beforeModelMessage(context: RuntimeContext): Promise<void>;
411
- afterModelMessage(context: RuntimeContext): Promise<void>;
391
+ beforeModelResponded(context: RuntimeContext): Promise<void>;
392
+ afterModelResponded(context: RuntimeContext): Promise<void>;
412
393
  onError(context: RuntimeContext): Promise<void>;
413
394
  onStart(context: RuntimeContext): Promise<void>;
414
395
  setInferenceVisitor(visitor: InferenceVisitor): void;
@@ -427,4 +408,16 @@ declare class AgentSociety {
427
408
  stop(): void;
428
409
  }
429
410
 
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 };
411
+ declare class SystemMessageItem extends ContextItem {
412
+ readonly type = "message";
413
+ readonly role = "system";
414
+ readonly content: InputText;
415
+ private constructor();
416
+ toJSON(): any;
417
+ static create(text: string): SystemMessageItem;
418
+ static rehydrate(data: {
419
+ text: string;
420
+ }): SystemMessageItem;
421
+ }
422
+
423
+ 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 };