@mozaik-ai/core 4.0.0-beta.1 → 4.0.0-beta.10

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.mjs CHANGED
@@ -314,6 +314,16 @@ var SemanticEvent = class _SemanticEvent {
314
314
  return new _SemanticEvent(type, producerId, occurredAt, payload);
315
315
  }
316
316
  };
317
+ var ParticipantJoinedEvent = class extends SemanticEvent {
318
+ static init(manifest) {
319
+ return SemanticEvent.create("participant.joined", manifest.id, manifest);
320
+ }
321
+ };
322
+ var ParticipantLeftEvent = class extends SemanticEvent {
323
+ static init(manifest) {
324
+ return SemanticEvent.create("participant.left", manifest.id, manifest);
325
+ }
326
+ };
317
327
  var MessageSentEvent = class extends SemanticEvent {
318
328
  static init(producerId, message) {
319
329
  return SemanticEvent.create("message.sent", producerId, { message });
@@ -353,6 +363,9 @@ var Participant = class {
353
363
  getHandlers() {
354
364
  return this.handlers;
355
365
  }
366
+ setHandlers(handlers) {
367
+ this.handlers = handlers;
368
+ }
356
369
  };
357
370
 
358
371
  // src/domain/agentic-environment/participant/memory.ts
@@ -469,9 +482,11 @@ var RuntimeService = class {
469
482
  }
470
483
  join(participant) {
471
484
  this.state.addParticipant(participant);
485
+ this.publish(ParticipantJoinedEvent.init(participant.getManifest()));
472
486
  }
473
487
  leave(participant) {
474
488
  this.state.removeParticipant(participant);
489
+ this.publish(ParticipantLeftEvent.init(participant.getManifest()));
475
490
  }
476
491
  publish(event) {
477
492
  for (const participant of this.state.getParticipants()) {
@@ -535,38 +550,57 @@ function createSendMessage(resolveRuntime) {
535
550
  }
536
551
 
537
552
  // src/domain/agentic-environment/loop/agent-loop.ts
538
- var AgentLoop = class {
539
- constructor(stateExecutor, transitionResolver, loopVisitor) {
553
+ var AgentLoop = class _AgentLoop {
554
+ constructor(loopId, stateExecutor, transitionResolver, interceptionHandler) {
555
+ this.loopId = loopId;
540
556
  this.stateExecutor = stateExecutor;
541
557
  this.transitionResolver = transitionResolver;
542
- this.loopVisitor = loopVisitor;
558
+ this.interceptionHandler = interceptionHandler;
543
559
  }
544
- async run(message) {
560
+ async run(message, loopVisitor) {
561
+ var _a;
545
562
  let transition = {
546
- nextStateId: "message_received",
563
+ nextStateId: "context_update",
547
564
  input: message
548
565
  };
549
566
  while (transition.nextStateId !== "idle") {
550
- const execution = await this.stateExecutor.execute(transition, this.loopVisitor);
551
- transition = this.transitionResolver.resolve(execution);
567
+ const isInterceptionSatisfied = (_a = this.interceptionHandler) == null ? void 0 : _a.isSatisfiedBy(transition);
568
+ if (isInterceptionSatisfied && this.interceptionHandler) {
569
+ loopVisitor.visitInterceptionStarted(transition);
570
+ transition = await this.interceptionHandler.handle(transition);
571
+ loopVisitor.visitInterceptionFinished(transition);
572
+ } else {
573
+ const execution = await this.stateExecutor.execute(transition, loopVisitor);
574
+ transition = this.transitionResolver.resolve(execution);
575
+ }
552
576
  }
553
577
  }
578
+ getLoopId() {
579
+ return this.loopId;
580
+ }
581
+ static create(stateExecutor, transitionResolver, interceptionHandler) {
582
+ const loopId = crypto.randomUUID();
583
+ return new _AgentLoop(loopId, stateExecutor, transitionResolver, interceptionHandler);
584
+ }
554
585
  };
555
586
 
556
587
  // src/domain/agentic-environment/loop/state-executor.ts
557
588
  var LoopStateExecutor = class {
558
- constructor(messageReceivedState, inferenceState, functionCallState, modelMessageState) {
559
- this.messageReceivedState = messageReceivedState;
589
+ constructor(contextUpdateState, inferenceState, inferenceStreamingState, functionCallState, modelMessageState) {
590
+ this.contextUpdateState = contextUpdateState;
560
591
  this.inferenceState = inferenceState;
592
+ this.inferenceStreamingState = inferenceStreamingState;
561
593
  this.functionCallState = functionCallState;
562
594
  this.modelMessageState = modelMessageState;
563
595
  }
564
596
  async execute(transition, loopVisitor) {
565
597
  switch (transition.nextStateId) {
566
- case "message_received":
567
- return await this.messageReceivedState.run(transition.input, loopVisitor);
598
+ case "context_update":
599
+ return await this.contextUpdateState.run(transition.input, loopVisitor);
568
600
  case "inference":
569
601
  return await this.inferenceState.run(transition.input, loopVisitor);
602
+ case "inference_streaming":
603
+ return await this.inferenceStreamingState.run(transition.input, loopVisitor);
570
604
  case "function_call":
571
605
  return await this.functionCallState.run(transition.input, loopVisitor);
572
606
  case "model_message":
@@ -607,19 +641,19 @@ var FunctionCallState = class {
607
641
  }
608
642
  };
609
643
 
610
- // src/application/states/message-received.ts
611
- var MessageReceivedState = class {
644
+ // src/application/states/context-update.ts
645
+ var ContextUpdateState = class {
612
646
  constructor() {
613
- this.id = "message_received";
647
+ this.id = "context_update";
614
648
  }
615
649
  async run(input, loopVisitor) {
616
- loopVisitor.visitMessageReceivedStarted(input);
650
+ loopVisitor.visitContextUpdateStarted(input);
617
651
  const userMessage = UserMessageItem.create(input.content);
618
652
  const output = {
619
653
  ...input.input,
620
654
  context: input.input.context.addContextItems([userMessage])
621
655
  };
622
- loopVisitor.visitMessageReceivedCompleted(output);
656
+ loopVisitor.visitContextUpdateCompleted(output);
623
657
  return {
624
658
  stateId: this.id,
625
659
  input,
@@ -660,17 +694,20 @@ var TransitionResolver = class {
660
694
  // src/domain/agentic-environment/loop/transition-specification.ts
661
695
  var MessageReceivedSpecification = class {
662
696
  isSatisfiedBy(execution) {
663
- return execution.stateId === "message_received";
697
+ return execution.stateId === "context_update";
664
698
  }
665
699
  };
700
+ function isInferenceExecution(execution) {
701
+ return execution.stateId === "inference" || execution.stateId === "inference_streaming";
702
+ }
666
703
  var InferenceProducedFunctionCallSpecification = class {
667
704
  isSatisfiedBy(execution) {
668
- return execution.stateId === "inference" && execution.output.items.some((item) => item.type === "function_call");
705
+ return isInferenceExecution(execution) && execution.output.items.some((item) => item.type === "function_call");
669
706
  }
670
707
  };
671
708
  var InferenceProducedModelMessageSpecification = class {
672
709
  isSatisfiedBy(execution) {
673
- return execution.stateId === "inference" && execution.output.items.some((item) => item.type === "message" && item.role === "assistant");
710
+ return isInferenceExecution(execution) && execution.output.items.some((item) => item.type === "message" && item.role === "assistant");
674
711
  }
675
712
  };
676
713
  var FunctionCallCompletedSpecification = class {
@@ -685,16 +722,17 @@ var ModelMessageCompletedSpecification = class {
685
722
  };
686
723
 
687
724
  // src/domain/agentic-environment/loop/transition-rule.ts
688
- var MessageReceivedToInferenceRule = class {
725
+ var ContextPreparationToInferenceRule = class {
689
726
  constructor() {
690
727
  this.specification = new MessageReceivedSpecification();
691
728
  }
692
729
  createTransition(execution) {
693
- if (execution.stateId !== "message_received") {
694
- throw new Error("Expected message_received execution");
730
+ if (execution.stateId !== "context_update") {
731
+ throw new Error("Expected context_preparation execution");
695
732
  }
733
+ const nextStateId = execution.output.streaming ? "inference_streaming" : "inference";
696
734
  return {
697
- nextStateId: "inference",
735
+ nextStateId,
698
736
  input: execution.output
699
737
  };
700
738
  }
@@ -704,7 +742,7 @@ var InferenceToFunctionCallRule = class {
704
742
  this.specification = new InferenceProducedFunctionCallSpecification();
705
743
  }
706
744
  createTransition(execution) {
707
- if (execution.stateId !== "inference" || !execution.output.items.some((item) => item.type === "function_call")) {
745
+ if (execution.stateId !== "inference" && execution.stateId !== "inference_streaming" || !execution.output.items.some((item) => item.type === "function_call")) {
708
746
  throw new Error("Expected inference function-call output");
709
747
  }
710
748
  const functionCallItem = execution.output.items.find((item) => item.type === "function_call");
@@ -725,7 +763,7 @@ var InferenceToModelMessageRule = class {
725
763
  this.specification = new InferenceProducedModelMessageSpecification();
726
764
  }
727
765
  createTransition(execution) {
728
- if (execution.stateId !== "inference" || !execution.output.items.some((item) => item.type === "message" && item.role === "assistant")) {
766
+ if (execution.stateId !== "inference" && execution.stateId !== "inference_streaming" || !execution.output.items.some((item) => item.type === "message" && item.role === "assistant")) {
729
767
  throw new Error("Expected inference model-message output");
730
768
  }
731
769
  const modelMessageItem = execution.output.items.find(
@@ -753,7 +791,7 @@ var FunctionCallToInferenceRule = class {
753
791
  const previousRequest = execution.input.inferenceInput;
754
792
  previousRequest.context.addContextItems([execution.input.call, execution.output.item]);
755
793
  return {
756
- nextStateId: "inference",
794
+ nextStateId: previousRequest.streaming ? "inference_streaming" : "inference",
757
795
  input: {
758
796
  ...previousRequest
759
797
  }
@@ -776,82 +814,110 @@ var ModelMessageToIdleRule = class {
776
814
  };
777
815
 
778
816
  // src/domain/agentic-environment/loop/event-publisher-visitor.ts
817
+ import { createCloudClient } from "@mozaik-ai/cloud-sdk";
779
818
  var EventPublisherLoopVisitor = class {
780
- constructor(agentId, runtime) {
819
+ constructor(agentId, loopId, runtime) {
781
820
  this.agentId = agentId;
821
+ this.loopId = loopId;
782
822
  this.runtime = runtime;
823
+ this.cloud = createCloudClient();
783
824
  }
784
- visitMessageReceivedStarted(input) {
785
- console.log("Visiting message received started: ", input);
786
- this.publish("message_received.started", input);
825
+ visitContextUpdateStarted(input) {
826
+ this.publish("context_update.started", { ...input, loopId: this.loopId });
787
827
  }
788
- visitMessageReceivedCompleted(output) {
789
- console.log("Visiting message received completed: ", output);
790
- this.publish("message_received.completed", output);
828
+ visitContextUpdateCompleted(output) {
829
+ this.publish("context_update.completed", { ...output, loopId: this.loopId });
791
830
  }
792
831
  visitInferenceStarted(input) {
793
- console.log("Visiting inference started: ", input);
794
832
  this.publish("inference.started", input);
795
833
  }
796
834
  visitInferenceEvent(event) {
797
- console.log("Visiting inference event: ", event);
798
835
  this.publish("inference.stream", event);
799
836
  }
800
837
  visitInferenceCompleted(output) {
801
- console.log("Visiting inference completed: ", output);
802
838
  this.publish("inference.completed", output);
803
839
  }
804
840
  visitFunctionCallStarted(input) {
805
- console.log("Visiting function call started: ", input);
806
841
  this.publish("function_call.started", input);
807
842
  }
808
843
  visitFunctionCallCompleted(output) {
809
- console.log("Visiting function call completed: ", output);
810
844
  this.publish("function_call.completed", output);
811
845
  }
812
846
  visitModelAnswer(input) {
813
- console.log("Visiting model answer: ", input.answer);
814
847
  this.publish("model.answer", input);
815
848
  }
849
+ visitInterceptionStarted(transition) {
850
+ this.publish("interception.started", transition);
851
+ }
852
+ visitInterceptionFinished(transition) {
853
+ this.publish("interception.finished", transition);
854
+ }
816
855
  publish(type, payload) {
817
- this.runtime.publish({
818
- type,
819
- producerId: this.agentId,
820
- occurredAt: /* @__PURE__ */ new Date(),
821
- payload
822
- });
856
+ const event = new SemanticEvent(type, this.agentId, /* @__PURE__ */ new Date(), payload);
857
+ this.runtime.publish(event);
858
+ if (this.cloud.enabled) {
859
+ this.cloud.send(event);
860
+ }
861
+ }
862
+ };
863
+
864
+ // src/application/states/inference-streaming.ts
865
+ var InferenceStreamingState = class {
866
+ constructor(inferenceRunner) {
867
+ this.inferenceRunner = inferenceRunner;
868
+ this.id = "inference_streaming";
869
+ }
870
+ async run(input, loopVisitor) {
871
+ loopVisitor.visitInferenceStarted(input);
872
+ let output = void 0;
873
+ for await (const event of this.inferenceRunner.stream(input)) {
874
+ loopVisitor.visitInferenceEvent(event);
875
+ if (event.type === "inference.output") {
876
+ output = event.payload;
877
+ }
878
+ }
879
+ if (!output) {
880
+ throw new Error("Inference output not found");
881
+ }
882
+ loopVisitor.visitInferenceCompleted(output);
883
+ return {
884
+ stateId: "inference_streaming",
885
+ input,
886
+ output
887
+ };
823
888
  }
824
889
  };
825
890
 
826
891
  // src/application/use-cases/run-loop.ts
827
892
  function createRunLoop(resolveRuntime) {
828
- return function runLoop(agentId, message, inferenceInput) {
893
+ return function runLoop(agentId, message, inferenceInput, interceptionHandler) {
829
894
  const runtime = resolveRuntime();
830
895
  const inferenceRunner = runtime.getInferenceRunner();
831
896
  const functionCallRunner = runtime.getFunctionCallRunner();
832
897
  const transitionResolver = new TransitionResolver([
833
898
  // High-priority interception rules would go first.
834
- new MessageReceivedToInferenceRule(),
899
+ new ContextPreparationToInferenceRule(),
835
900
  new InferenceToFunctionCallRule(),
836
901
  new InferenceToModelMessageRule(),
837
902
  new FunctionCallToInferenceRule(),
838
903
  new ModelMessageToIdleRule()
839
904
  ]);
840
905
  const stateExecutor = new LoopStateExecutor(
841
- new MessageReceivedState(),
906
+ new ContextUpdateState(),
842
907
  new InferenceState(inferenceRunner),
908
+ new InferenceStreamingState(inferenceRunner),
843
909
  new FunctionCallState(functionCallRunner),
844
910
  new ModelMessageState()
845
911
  );
846
- const agentLoop = new AgentLoop(
847
- stateExecutor,
848
- transitionResolver,
849
- new EventPublisherLoopVisitor(agentId, runtime)
912
+ const agentLoop = AgentLoop.create(stateExecutor, transitionResolver, interceptionHandler);
913
+ const loopVisitor = new EventPublisherLoopVisitor(agentId, agentLoop.getLoopId(), runtime);
914
+ agentLoop.run(
915
+ {
916
+ content: message,
917
+ input: inferenceInput
918
+ },
919
+ loopVisitor
850
920
  );
851
- agentLoop.run({
852
- content: message,
853
- input: inferenceInput
854
- });
855
921
  };
856
922
  }
857
923
 
@@ -1010,7 +1076,14 @@ import Anthropic from "@anthropic-ai/sdk";
1010
1076
  var AnthropicMessages = class {
1011
1077
  constructor(endpointMapper = new AnthropicMessagesMapper(), config = {}) {
1012
1078
  this.endpointMapper = endpointMapper;
1013
- this.client = new Anthropic({ baseURL: config.baseURL, apiKey: config.apiKey });
1079
+ this.clientConfig = config;
1080
+ }
1081
+ get client() {
1082
+ var _a;
1083
+ return (_a = this._client) != null ? _a : this._client = new Anthropic({
1084
+ baseURL: this.clientConfig.baseURL,
1085
+ apiKey: this.clientConfig.apiKey
1086
+ });
1014
1087
  }
1015
1088
  async infer(inferenceInput) {
1016
1089
  const request = this.endpointMapper.toRequest(inferenceInput);
@@ -1019,10 +1092,17 @@ var AnthropicMessages = class {
1019
1092
  }
1020
1093
  async *stream(inferenceInput) {
1021
1094
  const request = this.endpointMapper.toRequest(inferenceInput);
1022
- const stream = await this.client.messages.create(request);
1095
+ const stream = this.client.messages.stream(request);
1023
1096
  for await (const event of stream) {
1024
1097
  yield event;
1025
1098
  }
1099
+ const output = this.endpointMapper.toResponse(await stream.finalMessage());
1100
+ yield {
1101
+ type: "inference.output",
1102
+ producerId: request.model,
1103
+ occurredAt: /* @__PURE__ */ new Date(),
1104
+ payload: output
1105
+ };
1026
1106
  }
1027
1107
  };
1028
1108
 
@@ -1184,7 +1264,10 @@ var OpenAIResponsesMapper = class {
1184
1264
  var OpenAIResponses = class {
1185
1265
  constructor(endpointMapper = new OpenAIResponsesMapper()) {
1186
1266
  this.endpointMapper = endpointMapper;
1187
- this.client = new OpenAI();
1267
+ }
1268
+ get client() {
1269
+ var _a;
1270
+ return (_a = this._client) != null ? _a : this._client = new OpenAI();
1188
1271
  }
1189
1272
  async infer(inferenceInput) {
1190
1273
  const request = this.endpointMapper.toRequest(inferenceInput);
@@ -1193,10 +1276,24 @@ var OpenAIResponses = class {
1193
1276
  }
1194
1277
  async *stream(inferenceInput) {
1195
1278
  const request = this.endpointMapper.toRequest(inferenceInput);
1196
- const response = await this.client.responses.create(request);
1197
- for await (const event of response) {
1279
+ const stream = await this.client.responses.create({ ...request, stream: true });
1280
+ let completedResponse = void 0;
1281
+ for await (const event of stream) {
1282
+ if (event.type === "response.completed") {
1283
+ completedResponse = event.response;
1284
+ }
1198
1285
  yield event;
1199
1286
  }
1287
+ if (!completedResponse) {
1288
+ throw new Error("Stream ended without a completed response");
1289
+ }
1290
+ const output = this.endpointMapper.toResponse(completedResponse);
1291
+ yield {
1292
+ type: "inference.output",
1293
+ payload: output,
1294
+ occurredAt: /* @__PURE__ */ new Date(),
1295
+ producerId: inferenceInput.model
1296
+ };
1200
1297
  }
1201
1298
  };
1202
1299
 
@@ -1353,11 +1450,14 @@ var GeminiGenerateContentMapper = class {
1353
1450
  // src/infrastructure/providers/gemini/endpoints/gemini-generate-content.ts
1354
1451
  var GeminiGenerateContent = class {
1355
1452
  constructor(endpointMapper = new GeminiGenerateContentMapper(), config = {}) {
1356
- var _a;
1357
1453
  this.endpointMapper = endpointMapper;
1358
- this.client = new GoogleGenAI({
1359
- apiKey: (_a = config.apiKey) != null ? _a : process.env.GEMINI_API_KEY,
1360
- ...config.baseURL ? { httpOptions: { baseUrl: config.baseURL } } : {}
1454
+ this.clientConfig = config;
1455
+ }
1456
+ get client() {
1457
+ var _a, _b;
1458
+ return (_b = this._client) != null ? _b : this._client = new GoogleGenAI({
1459
+ apiKey: (_a = this.clientConfig.apiKey) != null ? _a : process.env.GEMINI_API_KEY,
1460
+ ...this.clientConfig.baseURL ? { httpOptions: { baseUrl: this.clientConfig.baseURL } } : {}
1361
1461
  });
1362
1462
  }
1363
1463
  async infer(inferenceInput) {
@@ -1368,9 +1468,21 @@ var GeminiGenerateContent = class {
1368
1468
  async *stream(inferenceInput) {
1369
1469
  const request = this.endpointMapper.toRequest(inferenceInput);
1370
1470
  const stream = await this.client.models.generateContentStream(request);
1471
+ let lastEvent = void 0;
1371
1472
  for await (const chunk of stream) {
1473
+ lastEvent = chunk;
1372
1474
  yield chunk;
1373
1475
  }
1476
+ if (!lastEvent) {
1477
+ throw new Error("Last event not found");
1478
+ }
1479
+ const output = this.endpointMapper.toResponse(lastEvent);
1480
+ yield {
1481
+ type: "inference.output",
1482
+ producerId: request.model,
1483
+ occurredAt: /* @__PURE__ */ new Date(),
1484
+ payload: output
1485
+ };
1374
1486
  }
1375
1487
  };
1376
1488
 
@@ -1487,12 +1599,16 @@ var OpenAIChatCompletions = class {
1487
1599
  constructor(endpointMapper = new OpenAIChatCompletionsMapper(), config = {}) {
1488
1600
  var _a;
1489
1601
  this.endpointMapper = endpointMapper;
1490
- this.client = new OpenAI2({
1491
- baseURL: config.baseURL,
1492
- apiKey: config.apiKey
1493
- });
1602
+ this.clientConfig = config;
1494
1603
  this.extraBody = (_a = config.extraBody) != null ? _a : {};
1495
1604
  }
1605
+ get client() {
1606
+ var _a;
1607
+ return (_a = this._client) != null ? _a : this._client = new OpenAI2({
1608
+ baseURL: this.clientConfig.baseURL,
1609
+ apiKey: this.clientConfig.apiKey
1610
+ });
1611
+ }
1496
1612
  buildRequest(inferenceInput) {
1497
1613
  return {
1498
1614
  ...this.extraBody,
@@ -1504,10 +1620,17 @@ var OpenAIChatCompletions = class {
1504
1620
  return this.endpointMapper.toResponse(response);
1505
1621
  }
1506
1622
  async *stream(inferenceInput) {
1507
- const stream = await this.client.chat.completions.create(this.buildRequest(inferenceInput));
1508
- for await (const event of stream) {
1509
- yield event;
1623
+ const stream = this.client.chat.completions.stream(this.buildRequest(inferenceInput));
1624
+ for await (const chunk of stream) {
1625
+ yield chunk;
1510
1626
  }
1627
+ const output = this.endpointMapper.toResponse(await stream.finalChatCompletion());
1628
+ yield {
1629
+ type: "inference.output",
1630
+ payload: output,
1631
+ occurredAt: /* @__PURE__ */ new Date(),
1632
+ producerId: inferenceInput.model
1633
+ };
1511
1634
  }
1512
1635
  };
1513
1636
 
@@ -1931,13 +2054,13 @@ var DefaultInferenceRunner = class {
1931
2054
  this.requestValidator.validate(input, generativeModel.specification);
1932
2055
  return await generativeModel.endpoint.infer(input);
1933
2056
  }
1934
- async streamInference(input) {
2057
+ async *stream(input) {
1935
2058
  const generativeModel = this.supportedModels.find((model) => model.specification.name === input.model);
1936
2059
  if (!generativeModel) {
1937
2060
  throw new Error(`Unsupported model: ${input.model}`);
1938
2061
  }
1939
2062
  this.requestValidator.validate(input, generativeModel.specification);
1940
- return await generativeModel.endpoint.stream(input);
2063
+ yield* generativeModel.endpoint.stream(input);
1941
2064
  }
1942
2065
  };
1943
2066
 
@@ -1953,6 +2076,18 @@ var DefaultFunctionCallRunner = class {
1953
2076
  }
1954
2077
  };
1955
2078
 
2079
+ // src/application/use-cases/send-event.ts
2080
+ function createSendEvent(resolveRuntime) {
2081
+ return function sendEvent(event, senderId) {
2082
+ const runtime = resolveRuntime();
2083
+ const participant = runtime.getParticipant(senderId);
2084
+ if (!participant) {
2085
+ throw new Error(`Participant ${senderId} not found`);
2086
+ }
2087
+ runtime.publish(event);
2088
+ };
2089
+ }
2090
+
1956
2091
  // src/define-runtime.ts
1957
2092
  function defineRuntime() {
1958
2093
  let runtime = null;
@@ -1989,6 +2124,7 @@ function defineRuntime() {
1989
2124
  const join = createJoin(resolveRuntime);
1990
2125
  const leave = createLeave(resolveRuntime);
1991
2126
  const sendMessage = createSendMessage(resolveRuntime);
2127
+ const sendEvent = createSendEvent(resolveRuntime);
1992
2128
  const runLoop = createRunLoop(resolveRuntime);
1993
2129
  return {
1994
2130
  initializeRuntime,
@@ -1997,29 +2133,81 @@ function defineRuntime() {
1997
2133
  join,
1998
2134
  leave,
1999
2135
  sendMessage,
2136
+ sendEvent,
2000
2137
  runLoop
2001
2138
  };
2002
2139
  }
2140
+
2141
+ // src/domain/agentic-environment/situation/situation-specification.ts
2142
+ var SituationSpecification = class {
2143
+ and(other) {
2144
+ return new AndSituationSpecification(this, other);
2145
+ }
2146
+ or(other) {
2147
+ return new OrSituationSpecification(this, other);
2148
+ }
2149
+ not() {
2150
+ return new NotSituationSpecification(this);
2151
+ }
2152
+ };
2153
+ var AndSituationSpecification = class extends SituationSpecification {
2154
+ constructor(left, right) {
2155
+ super();
2156
+ this.left = left;
2157
+ this.right = right;
2158
+ }
2159
+ isSatisfiedBy(situationContext) {
2160
+ return this.left.isSatisfiedBy(situationContext) && this.right.isSatisfiedBy(situationContext);
2161
+ }
2162
+ };
2163
+ var OrSituationSpecification = class extends SituationSpecification {
2164
+ constructor(left, right) {
2165
+ super();
2166
+ this.left = left;
2167
+ this.right = right;
2168
+ }
2169
+ isSatisfiedBy(situationContext) {
2170
+ return this.left.isSatisfiedBy(situationContext) || this.right.isSatisfiedBy(situationContext);
2171
+ }
2172
+ };
2173
+ var NotSituationSpecification = class extends SituationSpecification {
2174
+ constructor(rule) {
2175
+ super();
2176
+ this.rule = rule;
2177
+ }
2178
+ isSatisfiedBy(situationContext) {
2179
+ return !this.rule.isSatisfiedBy(situationContext);
2180
+ }
2181
+ };
2003
2182
  export {
2183
+ Agent,
2184
+ AnthropicMessages,
2004
2185
  ContextItem,
2186
+ DefaultInferenceRunner,
2005
2187
  DeveloperMessageItem,
2006
2188
  FunctionCallItem,
2007
2189
  FunctionCallOutputItem,
2190
+ GeminiGenerateContent,
2191
+ Human,
2008
2192
  InputTokenDetails,
2009
2193
  McpClient,
2010
2194
  McpToolRegistry,
2011
2195
  ModelContext,
2012
2196
  ModelMessageItem,
2197
+ OpenAIChatCompletions,
2198
+ OpenAIResponses,
2013
2199
  OutputTokenDetails,
2014
2200
  Participant,
2015
2201
  ReasoningItem,
2016
2202
  RuntimeState,
2017
2203
  SemanticEvent,
2204
+ SituationSpecification,
2018
2205
  SystemMessageItem,
2019
2206
  TokenUsage,
2020
2207
  UserMessageItem,
2021
2208
  createAgent,
2022
2209
  createHuman,
2023
- defineRuntime
2210
+ defineRuntime,
2211
+ supportedModels
2024
2212
  };
2025
2213
  //# sourceMappingURL=index.mjs.map