@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.
@@ -225,10 +225,7 @@ var runSubscriber = (agent, publishesTo, dequeue, plane, emitQueue, channelName)
225
225
  if (listensTo.length > 0 && !listensTo.includes(envelope.name)) {
226
226
  return;
227
227
  }
228
- const runEvents = plane.getRunEvents(
229
- envelope.meta.runId,
230
- envelope.meta.contextId
231
- );
228
+ const runEvents = plane.getRunEvents(envelope.meta.runId, envelope.meta.contextId);
232
229
  const contextEvents = plane.getContextEvents(envelope.meta.contextId);
233
230
  yield* Effect.withSpan("agent.listen", {
234
231
  attributes: {
@@ -263,9 +260,7 @@ var runSubscriber = (agent, publishesTo, dequeue, plane, emitQueue, channelName)
263
260
  ).catch(() => {
264
261
  });
265
262
  } else {
266
- Effect.runFork(
267
- plane.publishToChannels(publishesTo, fullEnvelope)
268
- );
263
+ Effect.runFork(plane.publishToChannels(publishesTo, fullEnvelope));
269
264
  }
270
265
  },
271
266
  runEvents,
@@ -291,14 +286,7 @@ var run = (network, plane, options) => Effect.gen(function* () {
291
286
  for (const reg of registrations.values()) {
292
287
  for (const channel of reg.subscribedTo) {
293
288
  const dequeue = yield* plane.subscribe(channel.name);
294
- yield* runSubscriber(
295
- reg.agent,
296
- reg.publishesTo,
297
- dequeue,
298
- plane,
299
- emitQueue,
300
- channel.name
301
- );
289
+ yield* runSubscriber(reg.agent, reg.publishesTo, dequeue, plane, emitQueue, channel.name);
302
290
  }
303
291
  }
304
292
  yield* Effect.never;
@@ -366,14 +354,7 @@ function streamFromDequeue(take, signal, eventFilter) {
366
354
  };
367
355
  }
368
356
  function expose(network, options) {
369
- const {
370
- auth,
371
- select,
372
- plane: providedPlane,
373
- onRequest,
374
- triggerEvents,
375
- tracingLayer
376
- } = options;
357
+ const { auth, select, plane: providedPlane, onRequest, triggerEvents, tracingLayer } = options;
377
358
  const triggerEventDef = triggerEvents?.[0];
378
359
  const triggerEventName = triggerEventDef?.name ?? "request";
379
360
  const channels = resolveChannels(network, select);
@@ -420,10 +401,8 @@ function expose(network, options) {
420
401
  meta,
421
402
  payload: opts.event.payload
422
403
  };
423
- Effect.runPromise(plane.publish(targetChannel, envelope)).catch(
424
- () => {
425
- }
426
- );
404
+ Effect.runPromise(plane.publish(targetChannel, envelope)).catch(() => {
405
+ });
427
406
  };
428
407
  const dequeue = yield* plane.subscribe(channels[0]);
429
408
  if (onRequest) {
@@ -463,10 +442,7 @@ function expose(network, options) {
463
442
  if (auth) {
464
443
  const result = await auth(req);
465
444
  if (!result.allowed) {
466
- throw new ExposeAuthError(
467
- result.message ?? "Unauthorized",
468
- result.status ?? 401
469
- );
445
+ throw new ExposeAuthError(result.message ?? "Unauthorized", result.status ?? 401);
470
446
  }
471
447
  }
472
448
  return consumer ? createStream(req, consumer) : createStream(req);
@@ -643,7 +619,9 @@ var AgentNetworkEvent = {
643
619
  const makeBound = (meta, payload2) => Effect.runSync(
644
620
  decodeEnvelope({ name, meta, payload: payload2 })
645
621
  );
646
- const makeEffect = (payload2) => decodePayload(payload2).pipe(Effect.map((p) => ({ name, payload: p })));
622
+ const makeEffect = (payload2) => decodePayload(payload2).pipe(
623
+ Effect.map((p) => ({ name, payload: p }))
624
+ );
647
625
  const makeBoundEffect = (meta, payload2) => decodeEnvelope({ name, meta, payload: payload2 });
648
626
  const is = Schema.is(envelopeSchema);
649
627
  return {
@@ -973,9 +951,7 @@ var Skill = class _Skill {
973
951
  const layersObj = runtime?.layers ?? {};
974
952
  const chunks = [];
975
953
  const emit = (chunk) => {
976
- const decoded = Effect.runSync(
977
- decodeChunk(chunk)
978
- );
954
+ const decoded = Effect.runSync(decodeChunk(chunk));
979
955
  chunks.push(decoded);
980
956
  };
981
957
  const done = await defineFn({
@@ -983,9 +959,7 @@ var Skill = class _Skill {
983
959
  emit,
984
960
  layers: layersObj
985
961
  });
986
- const decodedDone = Effect.runSync(
987
- decodeDone(done)
988
- );
962
+ const decodedDone = Effect.runSync(decodeDone(done));
989
963
  return { chunks, done: decodedDone };
990
964
  };
991
965
  return {
@@ -996,9 +970,7 @@ var Skill = class _Skill {
996
970
  const layersObj = runtime?.layers ?? {};
997
971
  const chunks = [];
998
972
  const emit = (chunk) => {
999
- const decoded = Effect.runSync(
1000
- decodeChunk(chunk)
1001
- );
973
+ const decoded = Effect.runSync(decodeChunk(chunk));
1002
974
  chunks.push(decoded);
1003
975
  };
1004
976
  const done = await defineFn({
@@ -1006,9 +978,7 @@ var Skill = class _Skill {
1006
978
  emit,
1007
979
  layers: layersObj
1008
980
  });
1009
- const decodedDone = Effect.runSync(
1010
- decodeDone(done)
1011
- );
981
+ const decodedDone = Effect.runSync(decodeDone(done));
1012
982
  for (const c of chunks) {
1013
983
  yield c;
1014
984
  }
@@ -1113,9 +1083,7 @@ var NextEndpoint = {
1113
1083
  var ExpressEndpoint = {
1114
1084
  from(api, options) {
1115
1085
  if (api.protocol !== "sse") {
1116
- throw new Error(
1117
- `ExpressEndpoint: unsupported protocol "${api.protocol}"`
1118
- );
1086
+ throw new Error(`ExpressEndpoint: unsupported protocol "${api.protocol}"`);
1119
1087
  }
1120
1088
  const { requestToContextId, requestToRunId } = options;
1121
1089
  return {
@@ -1218,20 +1186,10 @@ function getDepth(parent) {
1218
1186
  return 1 + getDepth(p.parent);
1219
1187
  }
1220
1188
  var consoleTracer = Tracer.make({
1221
- span: (name, parent, context, links, startTime, kind) => new ConsoleSpan(
1222
- name,
1223
- parent,
1224
- context,
1225
- links,
1226
- startTime,
1227
- kind,
1228
- getDepth(parent)
1229
- ),
1189
+ span: (name, parent, context, links, startTime, kind) => new ConsoleSpan(name, parent, context, links, startTime, kind, getDepth(parent)),
1230
1190
  context: (f) => f()
1231
1191
  });
1232
- var consoleTracerLayer = Layer.setTracer(
1233
- consoleTracer
1234
- );
1192
+ var consoleTracerLayer = Layer.setTracer(consoleTracer);
1235
1193
 
1236
1194
  export { Agent, AgentFactory, AgentNetwork, AgentNetworkEvent, Channel, ChannelName, ConfiguredChannel, DepedencyLayer, Done, EventAggregator, EventAggregatorInstance, EventMetaSchema, ExposeAuthError, ExpressEndpoint, LayerName, NextEndpoint, Sink, Skill, consoleTracer, consoleTracerLayer, formatSSE, isHttpStreamSink, toSSEStream };
1237
1195
  //# sourceMappingURL=out.js.map