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