@mozaik-ai/core 4.0.0-beta.4 → 4.0.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
@@ -331,6 +331,7 @@ declare abstract class Participant {
331
331
  getManifest(): ParticipantManifest;
332
332
  getId(): string;
333
333
  getHandlers(): SituationHandler[];
334
+ setHandlers(handlers: SituationHandler[]): void;
334
335
  }
335
336
 
336
337
  declare class Memory {
@@ -407,8 +408,8 @@ declare class RuntimeService<TRuntimeState extends RuntimeState> {
407
408
  }
408
409
 
409
410
  type InferenceRunnerConfig = {
410
- supportedModels: GenerativeModel[];
411
- runner: InferenceRunner;
411
+ supportedModels?: GenerativeModel[];
412
+ runner?: InferenceRunner;
412
413
  };
413
414
  declare function defineRuntime<TRuntimeState extends RuntimeState>(): {
414
415
  initializeRuntime: (config: {
@@ -428,8 +429,9 @@ declare const supportedModels: GenerativeModel[];
428
429
 
429
430
  declare class OpenAIResponses implements Endpoint {
430
431
  endpointMapper: InferenceEndpointMapper;
431
- private readonly client;
432
+ private _client?;
432
433
  constructor(endpointMapper?: InferenceEndpointMapper);
434
+ private get client();
433
435
  infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
434
436
  stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
435
437
  }
@@ -473,9 +475,11 @@ interface OpenAICompatibleConfig {
473
475
  */
474
476
  declare class OpenAIChatCompletions implements Endpoint {
475
477
  endpointMapper: InferenceEndpointMapper;
476
- private readonly client;
478
+ private _client?;
479
+ private readonly clientConfig;
477
480
  private readonly extraBody;
478
481
  constructor(endpointMapper?: InferenceEndpointMapper, config?: OpenAICompatibleConfig);
482
+ private get client();
479
483
  private buildRequest;
480
484
  infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
481
485
  stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
@@ -492,8 +496,10 @@ interface AnthropicConnectionConfig {
492
496
  */
493
497
  declare class AnthropicMessages implements Endpoint {
494
498
  endpointMapper: InferenceEndpointMapper;
495
- private readonly client;
499
+ private _client?;
500
+ private readonly clientConfig;
496
501
  constructor(endpointMapper?: InferenceEndpointMapper, config?: AnthropicConnectionConfig);
502
+ private get client();
497
503
  infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
498
504
  stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
499
505
  }
@@ -512,10 +518,12 @@ interface GeminiConnectionConfig {
512
518
  */
513
519
  declare class GeminiGenerateContent implements Endpoint {
514
520
  endpointMapper: InferenceEndpointMapper;
515
- private readonly client;
521
+ private _client?;
522
+ private readonly clientConfig;
516
523
  constructor(endpointMapper?: InferenceEndpointMapper, config?: GeminiConnectionConfig);
524
+ private get client();
517
525
  infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
518
526
  stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
519
527
  }
520
528
 
521
- export { AnthropicMessages, ContextItem, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, GeminiGenerateContent, type InferenceInput, type InferenceOutput, InputTokenDetails, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIChatCompletions, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, RuntimeState, SemanticEvent, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, createAgent, createHuman, defineRuntime, supportedModels };
529
+ export { Agent, AnthropicMessages, ContextItem, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, GeminiGenerateContent, Human, type InferenceInput, type InferenceOutput, type InferenceRunner, type InferenceRunnerConfig, InputTokenDetails, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIChatCompletions, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, RuntimeState, SemanticEvent, type SituationContext, type SituationHandler, type SituationProcessor, SituationSpecification, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, createAgent, createHuman, defineRuntime, supportedModels };
package/dist/index.d.ts CHANGED
@@ -331,6 +331,7 @@ declare abstract class Participant {
331
331
  getManifest(): ParticipantManifest;
332
332
  getId(): string;
333
333
  getHandlers(): SituationHandler[];
334
+ setHandlers(handlers: SituationHandler[]): void;
334
335
  }
335
336
 
336
337
  declare class Memory {
@@ -407,8 +408,8 @@ declare class RuntimeService<TRuntimeState extends RuntimeState> {
407
408
  }
408
409
 
409
410
  type InferenceRunnerConfig = {
410
- supportedModels: GenerativeModel[];
411
- runner: InferenceRunner;
411
+ supportedModels?: GenerativeModel[];
412
+ runner?: InferenceRunner;
412
413
  };
413
414
  declare function defineRuntime<TRuntimeState extends RuntimeState>(): {
414
415
  initializeRuntime: (config: {
@@ -428,8 +429,9 @@ declare const supportedModels: GenerativeModel[];
428
429
 
429
430
  declare class OpenAIResponses implements Endpoint {
430
431
  endpointMapper: InferenceEndpointMapper;
431
- private readonly client;
432
+ private _client?;
432
433
  constructor(endpointMapper?: InferenceEndpointMapper);
434
+ private get client();
433
435
  infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
434
436
  stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
435
437
  }
@@ -473,9 +475,11 @@ interface OpenAICompatibleConfig {
473
475
  */
474
476
  declare class OpenAIChatCompletions implements Endpoint {
475
477
  endpointMapper: InferenceEndpointMapper;
476
- private readonly client;
478
+ private _client?;
479
+ private readonly clientConfig;
477
480
  private readonly extraBody;
478
481
  constructor(endpointMapper?: InferenceEndpointMapper, config?: OpenAICompatibleConfig);
482
+ private get client();
479
483
  private buildRequest;
480
484
  infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
481
485
  stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
@@ -492,8 +496,10 @@ interface AnthropicConnectionConfig {
492
496
  */
493
497
  declare class AnthropicMessages implements Endpoint {
494
498
  endpointMapper: InferenceEndpointMapper;
495
- private readonly client;
499
+ private _client?;
500
+ private readonly clientConfig;
496
501
  constructor(endpointMapper?: InferenceEndpointMapper, config?: AnthropicConnectionConfig);
502
+ private get client();
497
503
  infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
498
504
  stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
499
505
  }
@@ -512,10 +518,12 @@ interface GeminiConnectionConfig {
512
518
  */
513
519
  declare class GeminiGenerateContent implements Endpoint {
514
520
  endpointMapper: InferenceEndpointMapper;
515
- private readonly client;
521
+ private _client?;
522
+ private readonly clientConfig;
516
523
  constructor(endpointMapper?: InferenceEndpointMapper, config?: GeminiConnectionConfig);
524
+ private get client();
517
525
  infer(inferenceInput: InferenceInput): Promise<InferenceOutput>;
518
526
  stream(inferenceInput: InferenceInput): AsyncIterable<SemanticEvent>;
519
527
  }
520
528
 
521
- export { AnthropicMessages, ContextItem, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, GeminiGenerateContent, type InferenceInput, type InferenceOutput, InputTokenDetails, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIChatCompletions, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, RuntimeState, SemanticEvent, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, createAgent, createHuman, defineRuntime, supportedModels };
529
+ export { Agent, AnthropicMessages, ContextItem, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, GeminiGenerateContent, Human, type InferenceInput, type InferenceOutput, type InferenceRunner, type InferenceRunnerConfig, InputTokenDetails, McpClient, type McpServerConfig, McpToolRegistry, type McpToolSpec, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIChatCompletions, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, RuntimeState, SemanticEvent, type SituationContext, type SituationHandler, type SituationProcessor, SituationSpecification, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, createAgent, createHuman, defineRuntime, supportedModels };
package/dist/index.js CHANGED
@@ -30,12 +30,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ Agent: () => Agent,
33
34
  AnthropicMessages: () => AnthropicMessages,
34
35
  ContextItem: () => ContextItem,
35
36
  DeveloperMessageItem: () => DeveloperMessageItem,
36
37
  FunctionCallItem: () => FunctionCallItem,
37
38
  FunctionCallOutputItem: () => FunctionCallOutputItem,
38
39
  GeminiGenerateContent: () => GeminiGenerateContent,
40
+ Human: () => Human,
39
41
  InputTokenDetails: () => InputTokenDetails,
40
42
  McpClient: () => McpClient,
41
43
  McpToolRegistry: () => McpToolRegistry,
@@ -48,6 +50,7 @@ __export(index_exports, {
48
50
  ReasoningItem: () => ReasoningItem,
49
51
  RuntimeState: () => RuntimeState,
50
52
  SemanticEvent: () => SemanticEvent,
53
+ SituationSpecification: () => SituationSpecification,
51
54
  SystemMessageItem: () => SystemMessageItem,
52
55
  TokenUsage: () => TokenUsage,
53
56
  UserMessageItem: () => UserMessageItem,
@@ -413,6 +416,9 @@ var Participant = class {
413
416
  getHandlers() {
414
417
  return this.handlers;
415
418
  }
419
+ setHandlers(handlers) {
420
+ this.handlers = handlers;
421
+ }
416
422
  };
417
423
 
418
424
  // src/domain/agentic-environment/participant/memory.ts
@@ -1104,7 +1110,14 @@ var import_sdk = __toESM(require("@anthropic-ai/sdk"));
1104
1110
  var AnthropicMessages = class {
1105
1111
  constructor(endpointMapper = new AnthropicMessagesMapper(), config = {}) {
1106
1112
  this.endpointMapper = endpointMapper;
1107
- this.client = new import_sdk.default({ baseURL: config.baseURL, apiKey: config.apiKey });
1113
+ this.clientConfig = config;
1114
+ }
1115
+ get client() {
1116
+ var _a;
1117
+ return (_a = this._client) != null ? _a : this._client = new import_sdk.default({
1118
+ baseURL: this.clientConfig.baseURL,
1119
+ apiKey: this.clientConfig.apiKey
1120
+ });
1108
1121
  }
1109
1122
  async infer(inferenceInput) {
1110
1123
  const request = this.endpointMapper.toRequest(inferenceInput);
@@ -1285,7 +1298,10 @@ var OpenAIResponsesMapper = class {
1285
1298
  var OpenAIResponses = class {
1286
1299
  constructor(endpointMapper = new OpenAIResponsesMapper()) {
1287
1300
  this.endpointMapper = endpointMapper;
1288
- this.client = new import_openai.default();
1301
+ }
1302
+ get client() {
1303
+ var _a;
1304
+ return (_a = this._client) != null ? _a : this._client = new import_openai.default();
1289
1305
  }
1290
1306
  async infer(inferenceInput) {
1291
1307
  const request = this.endpointMapper.toRequest(inferenceInput);
@@ -1468,11 +1484,14 @@ var GeminiGenerateContentMapper = class {
1468
1484
  // src/infrastructure/providers/gemini/endpoints/gemini-generate-content.ts
1469
1485
  var GeminiGenerateContent = class {
1470
1486
  constructor(endpointMapper = new GeminiGenerateContentMapper(), config = {}) {
1471
- var _a;
1472
1487
  this.endpointMapper = endpointMapper;
1473
- this.client = new import_genai.GoogleGenAI({
1474
- apiKey: (_a = config.apiKey) != null ? _a : process.env.GEMINI_API_KEY,
1475
- ...config.baseURL ? { httpOptions: { baseUrl: config.baseURL } } : {}
1488
+ this.clientConfig = config;
1489
+ }
1490
+ get client() {
1491
+ var _a, _b;
1492
+ return (_b = this._client) != null ? _b : this._client = new import_genai.GoogleGenAI({
1493
+ apiKey: (_a = this.clientConfig.apiKey) != null ? _a : process.env.GEMINI_API_KEY,
1494
+ ...this.clientConfig.baseURL ? { httpOptions: { baseUrl: this.clientConfig.baseURL } } : {}
1476
1495
  });
1477
1496
  }
1478
1497
  async infer(inferenceInput) {
@@ -1614,12 +1633,16 @@ var OpenAIChatCompletions = class {
1614
1633
  constructor(endpointMapper = new OpenAIChatCompletionsMapper(), config = {}) {
1615
1634
  var _a;
1616
1635
  this.endpointMapper = endpointMapper;
1617
- this.client = new import_openai2.default({
1618
- baseURL: config.baseURL,
1619
- apiKey: config.apiKey
1620
- });
1636
+ this.clientConfig = config;
1621
1637
  this.extraBody = (_a = config.extraBody) != null ? _a : {};
1622
1638
  }
1639
+ get client() {
1640
+ var _a;
1641
+ return (_a = this._client) != null ? _a : this._client = new import_openai2.default({
1642
+ baseURL: this.clientConfig.baseURL,
1643
+ apiKey: this.clientConfig.apiKey
1644
+ });
1645
+ }
1623
1646
  buildRequest(inferenceInput) {
1624
1647
  return {
1625
1648
  ...this.extraBody,
@@ -2148,14 +2171,58 @@ function defineRuntime() {
2148
2171
  runLoop
2149
2172
  };
2150
2173
  }
2174
+
2175
+ // src/domain/agentic-environment/situation/situation-specification.ts
2176
+ var SituationSpecification = class {
2177
+ and(other) {
2178
+ return new AndSituationSpecification(this, other);
2179
+ }
2180
+ or(other) {
2181
+ return new OrSituationSpecification(this, other);
2182
+ }
2183
+ not() {
2184
+ return new NotSituationSpecification(this);
2185
+ }
2186
+ };
2187
+ var AndSituationSpecification = class extends SituationSpecification {
2188
+ constructor(left, right) {
2189
+ super();
2190
+ this.left = left;
2191
+ this.right = right;
2192
+ }
2193
+ isSatisfiedBy(situationContext) {
2194
+ return this.left.isSatisfiedBy(situationContext) && this.right.isSatisfiedBy(situationContext);
2195
+ }
2196
+ };
2197
+ var OrSituationSpecification = class extends SituationSpecification {
2198
+ constructor(left, right) {
2199
+ super();
2200
+ this.left = left;
2201
+ this.right = right;
2202
+ }
2203
+ isSatisfiedBy(situationContext) {
2204
+ return this.left.isSatisfiedBy(situationContext) || this.right.isSatisfiedBy(situationContext);
2205
+ }
2206
+ };
2207
+ var NotSituationSpecification = class extends SituationSpecification {
2208
+ constructor(rule) {
2209
+ super();
2210
+ this.rule = rule;
2211
+ }
2212
+ isSatisfiedBy(situationContext) {
2213
+ return !this.rule.isSatisfiedBy(situationContext);
2214
+ }
2215
+ };
2151
2216
  // Annotate the CommonJS export names for ESM import in node:
2152
2217
  0 && (module.exports = {
2218
+ Agent,
2153
2219
  AnthropicMessages,
2154
2220
  ContextItem,
2155
2221
  DeveloperMessageItem,
2156
2222
  FunctionCallItem,
2157
2223
  FunctionCallOutputItem,
2158
2224
  GeminiGenerateContent,
2225
+ Human,
2159
2226
  InputTokenDetails,
2160
2227
  McpClient,
2161
2228
  McpToolRegistry,
@@ -2168,6 +2235,7 @@ function defineRuntime() {
2168
2235
  ReasoningItem,
2169
2236
  RuntimeState,
2170
2237
  SemanticEvent,
2238
+ SituationSpecification,
2171
2239
  SystemMessageItem,
2172
2240
  TokenUsage,
2173
2241
  UserMessageItem,