@m4trix/core 0.15.0 → 0.15.1

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.js CHANGED
@@ -78,16 +78,10 @@ var SocketIoFactory = class _SocketIoFactory {
78
78
  this.socket.on(prefix("voice:output_file"), onVoiceOutputFile);
79
79
  }
80
80
  if (onVoiceOutputTranscriptDelta) {
81
- this.socket.on(
82
- prefix("voice:output_transcript_delta"),
83
- onVoiceOutputTranscriptDelta
84
- );
81
+ this.socket.on(prefix("voice:output_transcript_delta"), onVoiceOutputTranscriptDelta);
85
82
  }
86
83
  if (onVoiceOutputTranscriptFull) {
87
- this.socket.on(
88
- prefix("voice:output_transcript_full"),
89
- onVoiceOutputTranscriptFull
90
- );
84
+ this.socket.on(prefix("voice:output_transcript_full"), onVoiceOutputTranscriptFull);
91
85
  }
92
86
  }
93
87
  setupChatEvents(_socket) {
@@ -303,10 +297,7 @@ var runSubscriber = (agent, publishesTo, dequeue, plane, emitQueue, channelName)
303
297
  if (listensTo.length > 0 && !listensTo.includes(envelope.name)) {
304
298
  return;
305
299
  }
306
- const runEvents = plane.getRunEvents(
307
- envelope.meta.runId,
308
- envelope.meta.contextId
309
- );
300
+ const runEvents = plane.getRunEvents(envelope.meta.runId, envelope.meta.contextId);
310
301
  const contextEvents = plane.getContextEvents(envelope.meta.contextId);
311
302
  yield* Effect.withSpan("agent.listen", {
312
303
  attributes: {
@@ -341,9 +332,7 @@ var runSubscriber = (agent, publishesTo, dequeue, plane, emitQueue, channelName)
341
332
  ).catch(() => {
342
333
  });
343
334
  } else {
344
- Effect.runFork(
345
- plane.publishToChannels(publishesTo, fullEnvelope)
346
- );
335
+ Effect.runFork(plane.publishToChannels(publishesTo, fullEnvelope));
347
336
  }
348
337
  },
349
338
  runEvents,
@@ -369,14 +358,7 @@ var run = (network, plane, options) => Effect.gen(function* () {
369
358
  for (const reg of registrations.values()) {
370
359
  for (const channel of reg.subscribedTo) {
371
360
  const dequeue = yield* plane.subscribe(channel.name);
372
- yield* runSubscriber(
373
- reg.agent,
374
- reg.publishesTo,
375
- dequeue,
376
- plane,
377
- emitQueue,
378
- channel.name
379
- );
361
+ yield* runSubscriber(reg.agent, reg.publishesTo, dequeue, plane, emitQueue, channel.name);
380
362
  }
381
363
  }
382
364
  yield* Effect.never;
@@ -444,14 +426,7 @@ function streamFromDequeue(take, signal, eventFilter) {
444
426
  };
445
427
  }
446
428
  function expose(network, options) {
447
- const {
448
- auth,
449
- select,
450
- plane: providedPlane,
451
- onRequest,
452
- triggerEvents,
453
- tracingLayer
454
- } = options;
429
+ const { auth, select, plane: providedPlane, onRequest, triggerEvents, tracingLayer } = options;
455
430
  const triggerEventDef = triggerEvents?.[0];
456
431
  const triggerEventName = triggerEventDef?.name ?? "request";
457
432
  const channels = resolveChannels(network, select);
@@ -498,10 +473,8 @@ function expose(network, options) {
498
473
  meta,
499
474
  payload: opts.event.payload
500
475
  };
501
- Effect.runPromise(plane.publish(targetChannel, envelope)).catch(
502
- () => {
503
- }
504
- );
476
+ Effect.runPromise(plane.publish(targetChannel, envelope)).catch(() => {
477
+ });
505
478
  };
506
479
  const dequeue = yield* plane.subscribe(channels[0]);
507
480
  if (onRequest) {
@@ -541,10 +514,7 @@ function expose(network, options) {
541
514
  if (auth) {
542
515
  const result = await auth(req);
543
516
  if (!result.allowed) {
544
- throw new ExposeAuthError(
545
- result.message ?? "Unauthorized",
546
- result.status ?? 401
547
- );
517
+ throw new ExposeAuthError(result.message ?? "Unauthorized", result.status ?? 401);
548
518
  }
549
519
  }
550
520
  return consumer ? createStream(req, consumer) : createStream(req);
@@ -721,7 +691,9 @@ var AgentNetworkEvent = {
721
691
  const makeBound = (meta, payload2) => Effect.runSync(
722
692
  decodeEnvelope({ name, meta, payload: payload2 })
723
693
  );
724
- const makeEffect = (payload2) => decodePayload(payload2).pipe(Effect.map((p) => ({ name, payload: p })));
694
+ const makeEffect = (payload2) => decodePayload(payload2).pipe(
695
+ Effect.map((p) => ({ name, payload: p }))
696
+ );
725
697
  const makeBoundEffect = (meta, payload2) => decodeEnvelope({ name, meta, payload: payload2 });
726
698
  const is = Schema.is(envelopeSchema);
727
699
  return {
@@ -1051,9 +1023,7 @@ var Skill = class _Skill {
1051
1023
  const layersObj = runtime?.layers ?? {};
1052
1024
  const chunks = [];
1053
1025
  const emit = (chunk) => {
1054
- const decoded = Effect.runSync(
1055
- decodeChunk(chunk)
1056
- );
1026
+ const decoded = Effect.runSync(decodeChunk(chunk));
1057
1027
  chunks.push(decoded);
1058
1028
  };
1059
1029
  const done = await defineFn({
@@ -1061,9 +1031,7 @@ var Skill = class _Skill {
1061
1031
  emit,
1062
1032
  layers: layersObj
1063
1033
  });
1064
- const decodedDone = Effect.runSync(
1065
- decodeDone(done)
1066
- );
1034
+ const decodedDone = Effect.runSync(decodeDone(done));
1067
1035
  return { chunks, done: decodedDone };
1068
1036
  };
1069
1037
  return {
@@ -1074,9 +1042,7 @@ var Skill = class _Skill {
1074
1042
  const layersObj = runtime?.layers ?? {};
1075
1043
  const chunks = [];
1076
1044
  const emit = (chunk) => {
1077
- const decoded = Effect.runSync(
1078
- decodeChunk(chunk)
1079
- );
1045
+ const decoded = Effect.runSync(decodeChunk(chunk));
1080
1046
  chunks.push(decoded);
1081
1047
  };
1082
1048
  const done = await defineFn({
@@ -1084,9 +1050,7 @@ var Skill = class _Skill {
1084
1050
  emit,
1085
1051
  layers: layersObj
1086
1052
  });
1087
- const decodedDone = Effect.runSync(
1088
- decodeDone(done)
1089
- );
1053
+ const decodedDone = Effect.runSync(decodeDone(done));
1090
1054
  for (const c of chunks) {
1091
1055
  yield c;
1092
1056
  }
@@ -1191,9 +1155,7 @@ var NextEndpoint = {
1191
1155
  var ExpressEndpoint = {
1192
1156
  from(api, options) {
1193
1157
  if (api.protocol !== "sse") {
1194
- throw new Error(
1195
- `ExpressEndpoint: unsupported protocol "${api.protocol}"`
1196
- );
1158
+ throw new Error(`ExpressEndpoint: unsupported protocol "${api.protocol}"`);
1197
1159
  }
1198
1160
  const { requestToContextId, requestToRunId } = options;
1199
1161
  return {
@@ -1296,20 +1258,10 @@ function getDepth(parent) {
1296
1258
  return 1 + getDepth(p.parent);
1297
1259
  }
1298
1260
  var consoleTracer = Tracer.make({
1299
- span: (name, parent, context, links, startTime, kind) => new ConsoleSpan(
1300
- name,
1301
- parent,
1302
- context,
1303
- links,
1304
- startTime,
1305
- kind,
1306
- getDepth(parent)
1307
- ),
1261
+ span: (name, parent, context, links, startTime, kind) => new ConsoleSpan(name, parent, context, links, startTime, kind, getDepth(parent)),
1308
1262
  context: (f) => f()
1309
1263
  });
1310
- var consoleTracerLayer = Layer.setTracer(
1311
- consoleTracer
1312
- );
1264
+ var consoleTracerLayer = Layer.setTracer(consoleTracer);
1313
1265
 
1314
1266
  export { Agent, AgentFactory, AgentNetwork, AgentNetworkEvent, Channel, ChannelName, ConfiguredChannel, DepedencyLayer, Done, EventAggregator, EventAggregatorInstance, EventMetaSchema, ExposeAuthError, ExpressEndpoint, LayerName, NextEndpoint, Sink, Skill, SocketIoFactory, consoleTracer, consoleTracerLayer, formatSSE, isHttpStreamSink, toSSEStream };
1315
1267
  //# sourceMappingURL=out.js.map