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