@mozaik-ai/core 4.0.0-beta.2 → 4.0.0-beta.3

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
@@ -1953,6 +1953,18 @@ var DefaultFunctionCallRunner = class {
1953
1953
  }
1954
1954
  };
1955
1955
 
1956
+ // src/application/use-cases/send-event.ts
1957
+ function createSendEvent(resolveRuntime) {
1958
+ return function sendEvent(event, senderId) {
1959
+ const runtime = resolveRuntime();
1960
+ const participant = runtime.getParticipant(senderId);
1961
+ if (!participant) {
1962
+ throw new Error(`Participant ${senderId} not found`);
1963
+ }
1964
+ runtime.publish(event);
1965
+ };
1966
+ }
1967
+
1956
1968
  // src/define-runtime.ts
1957
1969
  function defineRuntime() {
1958
1970
  let runtime = null;
@@ -1989,6 +2001,7 @@ function defineRuntime() {
1989
2001
  const join = createJoin(resolveRuntime);
1990
2002
  const leave = createLeave(resolveRuntime);
1991
2003
  const sendMessage = createSendMessage(resolveRuntime);
2004
+ const sendEvent = createSendEvent(resolveRuntime);
1992
2005
  const runLoop = createRunLoop(resolveRuntime);
1993
2006
  return {
1994
2007
  initializeRuntime,
@@ -1997,6 +2010,7 @@ function defineRuntime() {
1997
2010
  join,
1998
2011
  leave,
1999
2012
  sendMessage,
2013
+ sendEvent,
2000
2014
  runLoop
2001
2015
  };
2002
2016
  }