@m4trix/core 0.5.0 → 0.6.0

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.
@@ -0,0 +1,705 @@
1
+ import { Brand, Schema, Effect, PubSub, Queue, Cause } from 'effect';
2
+ export { Schema as S } from 'effect';
3
+ import { randomUUID } from 'crypto';
4
+
5
+ var __accessCheck = (obj, member, msg) => {
6
+ if (!member.has(obj))
7
+ throw TypeError("Cannot " + msg);
8
+ };
9
+ var __privateGet = (obj, member, getter) => {
10
+ __accessCheck(obj, member, "read from private field");
11
+ return getter ? getter.call(obj) : member.get(obj);
12
+ };
13
+ var __privateAdd = (obj, member, value) => {
14
+ if (member.has(obj))
15
+ throw TypeError("Cannot add the same private member more than once");
16
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
17
+ };
18
+ var __privateSet = (obj, member, value, setter) => {
19
+ __accessCheck(obj, member, "write to private field");
20
+ setter ? setter.call(obj, value) : member.set(obj, value);
21
+ return value;
22
+ };
23
+ var KEBAB_CASE_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
24
+ var ChannelName = Brand.refined(
25
+ (s) => typeof s === "string" && KEBAB_CASE_REGEX.test(s),
26
+ (s) => Brand.error(`Expected kebab-case (e.g. my-channel-name), got: ${s}`)
27
+ );
28
+
29
+ // src/matrix/agent-network/channel.ts
30
+ var Sink = {
31
+ kafka(config) {
32
+ return { _tag: "SinkDef", type: "kafka", config };
33
+ },
34
+ httpStream() {
35
+ return { _tag: "SinkDef", type: "http-stream", config: {} };
36
+ }
37
+ };
38
+ function isHttpStreamSink(sink) {
39
+ return sink.type === "http-stream";
40
+ }
41
+ var ConfiguredChannel = class {
42
+ constructor(name) {
43
+ this._tag = "ConfiguredChannel";
44
+ this._events = [];
45
+ this._sinks = [];
46
+ this.name = name;
47
+ }
48
+ events(events) {
49
+ this._events = [...events];
50
+ return this;
51
+ }
52
+ sink(sink) {
53
+ this._sinks = [...this._sinks, sink];
54
+ return this;
55
+ }
56
+ sinks(sinks) {
57
+ this._sinks = [...sinks];
58
+ return this;
59
+ }
60
+ getEvents() {
61
+ return this._events;
62
+ }
63
+ getSinks() {
64
+ return this._sinks;
65
+ }
66
+ };
67
+ var Channel = {
68
+ of(name) {
69
+ return {
70
+ _tag: "ChannelDef",
71
+ name
72
+ };
73
+ }
74
+ };
75
+ var DEFAULT_CAPACITY = 16;
76
+ var createEventPlane = (network, capacity = DEFAULT_CAPACITY) => Effect.gen(function* () {
77
+ const channels = network.getChannels();
78
+ const pubsubs = /* @__PURE__ */ new Map();
79
+ for (const channel of channels.values()) {
80
+ const pubsub = yield* PubSub.bounded(capacity);
81
+ pubsubs.set(channel.name, pubsub);
82
+ }
83
+ const getPubsub = (channel) => {
84
+ const p = pubsubs.get(channel);
85
+ if (!p)
86
+ throw new Error(`Channel not found: ${channel}`);
87
+ return p;
88
+ };
89
+ const publish = (channel, envelope) => PubSub.publish(getPubsub(channel), envelope);
90
+ const publishToChannels = (targetChannels, envelope) => Effect.all(
91
+ targetChannels.map((c) => publish(c.name, envelope)),
92
+ { concurrency: "unbounded" }
93
+ ).pipe(Effect.map((results) => results.every(Boolean)));
94
+ const subscribe = (channel) => PubSub.subscribe(getPubsub(channel));
95
+ const shutdown = Effect.all([...pubsubs.values()].map(PubSub.shutdown), {
96
+ concurrency: "unbounded"
97
+ }).pipe(Effect.asVoid);
98
+ return {
99
+ publish,
100
+ publishToChannels,
101
+ subscribe,
102
+ shutdown
103
+ };
104
+ });
105
+ var runSubscriber = (agent, publishesTo, dequeue, plane, emitQueue) => Effect.gen(function* () {
106
+ const listensTo = agent.getListensTo?.() ?? [];
107
+ const processOne = () => Effect.gen(function* () {
108
+ const envelope = yield* Queue.take(dequeue);
109
+ if (listensTo.length > 0 && !listensTo.includes(envelope.name)) {
110
+ return;
111
+ }
112
+ yield* Effect.tryPromise({
113
+ try: () => agent.invoke({
114
+ triggerEvent: envelope,
115
+ emit: (userEvent) => {
116
+ const fullEnvelope = {
117
+ name: userEvent.name,
118
+ meta: envelope.meta,
119
+ payload: userEvent.payload
120
+ };
121
+ if (emitQueue) {
122
+ Effect.runPromise(
123
+ Queue.offer(emitQueue, {
124
+ channels: publishesTo,
125
+ envelope: fullEnvelope
126
+ })
127
+ ).catch(() => {
128
+ });
129
+ } else {
130
+ Effect.runFork(
131
+ plane.publishToChannels(publishesTo, fullEnvelope)
132
+ );
133
+ }
134
+ }
135
+ }),
136
+ catch: (e) => e
137
+ });
138
+ }).pipe(
139
+ Effect.catchAllCause(
140
+ (cause) => Cause.isInterrupted(cause) ? Effect.void : Effect.sync(() => {
141
+ console.error(`Agent ${agent.getId()} failed:`, cause);
142
+ }).pipe(Effect.asVoid)
143
+ )
144
+ );
145
+ const loop = () => processOne().pipe(Effect.flatMap(() => loop()));
146
+ return yield* Effect.fork(loop());
147
+ });
148
+ var run = (network, plane, options) => Effect.gen(function* () {
149
+ const registrations = network.getAgentRegistrations();
150
+ const emitQueue = options?.emitQueue;
151
+ for (const reg of registrations.values()) {
152
+ for (const channel of reg.subscribedTo) {
153
+ const dequeue = yield* plane.subscribe(channel.name);
154
+ yield* runSubscriber(
155
+ reg.agent,
156
+ reg.publishesTo,
157
+ dequeue,
158
+ plane,
159
+ emitQueue
160
+ );
161
+ }
162
+ }
163
+ yield* Effect.never;
164
+ });
165
+ async function extractPayload(req) {
166
+ const webRequest = req.request;
167
+ if (webRequest?.method === "POST") {
168
+ const ct = webRequest.headers?.get?.("content-type") ?? "";
169
+ if (ct.includes("application/json")) {
170
+ try {
171
+ return await webRequest.json();
172
+ } catch {
173
+ return {};
174
+ }
175
+ }
176
+ }
177
+ const expressReq = req.req;
178
+ if (expressReq?.body != null) {
179
+ return expressReq.body;
180
+ }
181
+ return {};
182
+ }
183
+ function resolveChannels(network, select) {
184
+ const channels = network.getChannels();
185
+ if (select?.channels) {
186
+ const ch = select.channels;
187
+ const arr = Array.isArray(ch) ? ch : [ch];
188
+ return arr.map((c) => ChannelName(c));
189
+ }
190
+ const httpStreamChannels = [...channels.values()].filter((ch) => ch.getSinks().some(isHttpStreamSink)).map((ch) => ch.name);
191
+ if (httpStreamChannels.length > 0)
192
+ return httpStreamChannels;
193
+ const client = channels.get("client");
194
+ if (client)
195
+ return [client.name];
196
+ const first = channels.values().next().value;
197
+ return first ? [first.name] : [];
198
+ }
199
+ function streamFromDequeue(take, signal, eventFilter) {
200
+ const shouldInclude = (e) => !eventFilter?.length || eventFilter.includes(e.name);
201
+ return {
202
+ async *[Symbol.asyncIterator]() {
203
+ while (!signal?.aborted) {
204
+ const takePromise = take();
205
+ const abortPromise = signal ? new Promise((_, reject) => {
206
+ signal.addEventListener(
207
+ "abort",
208
+ () => reject(new DOMException("Aborted", "AbortError")),
209
+ { once: true }
210
+ );
211
+ }) : new Promise(() => {
212
+ });
213
+ let envelope;
214
+ try {
215
+ envelope = await Promise.race([takePromise, abortPromise]);
216
+ } catch (e) {
217
+ if (e instanceof DOMException && e.name === "AbortError")
218
+ break;
219
+ throw e;
220
+ }
221
+ if (shouldInclude(envelope))
222
+ yield envelope;
223
+ }
224
+ }
225
+ };
226
+ }
227
+ function expose(network, options) {
228
+ const { auth, select, plane: providedPlane, onRequest, startEventName = "request" } = options;
229
+ const channels = resolveChannels(network, select);
230
+ const eventFilter = select?.events;
231
+ const mainChannel = network.getMainChannel();
232
+ if (channels.length === 0) {
233
+ throw new Error("expose: no channels to subscribe to");
234
+ }
235
+ const createStream = async (req, consumer) => {
236
+ const payload = await extractPayload(req);
237
+ const signal = req.request?.signal;
238
+ const program = Effect.gen(function* () {
239
+ const plane = providedPlane ?? (yield* createEventPlane(network));
240
+ if (!providedPlane) {
241
+ const emitQueue = yield* Queue.unbounded();
242
+ yield* Effect.fork(
243
+ Effect.forever(
244
+ Queue.take(emitQueue).pipe(
245
+ Effect.flatMap(
246
+ ({ channels: chs, envelope }) => plane.publishToChannels(chs, envelope)
247
+ )
248
+ )
249
+ )
250
+ );
251
+ yield* Effect.fork(run(network, plane, { emitQueue }));
252
+ yield* Effect.sleep("10 millis");
253
+ }
254
+ const targetChannel = mainChannel?.name ?? channels[0];
255
+ const emitStartEvent = (p) => {
256
+ const pld = p ?? payload;
257
+ const envelope = {
258
+ name: startEventName,
259
+ meta: { runId: crypto.randomUUID() },
260
+ payload: pld
261
+ };
262
+ Effect.runPromise(plane.publish(targetChannel, envelope)).catch(() => {
263
+ });
264
+ };
265
+ const dequeue = yield* plane.subscribe(channels[0]);
266
+ if (onRequest) {
267
+ yield* Effect.tryPromise(
268
+ () => Promise.resolve(onRequest({ emitStartEvent, req, payload }))
269
+ );
270
+ } else if (!providedPlane) {
271
+ const envelope = {
272
+ name: startEventName,
273
+ meta: { runId: crypto.randomUUID() },
274
+ payload
275
+ };
276
+ yield* plane.publish(targetChannel, envelope);
277
+ yield* Effect.sleep("10 millis");
278
+ }
279
+ const take = () => Effect.runPromise(Queue.take(dequeue));
280
+ const stream = streamFromDequeue(take, signal ?? void 0, eventFilter);
281
+ if (consumer) {
282
+ return yield* Effect.tryPromise(() => consumer(stream));
283
+ }
284
+ return stream;
285
+ });
286
+ return Effect.runPromise(program.pipe(Effect.scoped));
287
+ };
288
+ return {
289
+ protocol: "sse",
290
+ createStream: async (req, consumer) => {
291
+ if (auth) {
292
+ const result = await auth(req);
293
+ if (!result.allowed) {
294
+ throw new ExposeAuthError(
295
+ result.message ?? "Unauthorized",
296
+ result.status ?? 401
297
+ );
298
+ }
299
+ }
300
+ return consumer ? createStream(req, consumer) : createStream(req);
301
+ }
302
+ };
303
+ }
304
+ var ExposeAuthError = class extends Error {
305
+ constructor(message, status = 401) {
306
+ super(message);
307
+ this.status = status;
308
+ this.name = "ExposeAuthError";
309
+ }
310
+ };
311
+
312
+ // src/matrix/agent-network/agent-network.ts
313
+ var AgentNetwork = class _AgentNetwork {
314
+ constructor() {
315
+ this.channels = /* @__PURE__ */ new Map();
316
+ this.agentRegistrations = /* @__PURE__ */ new Map();
317
+ this.spawnerRegistrations = [];
318
+ }
319
+ /* ─── Public Static Factory ─── */
320
+ static setup(callback) {
321
+ const network = new _AgentNetwork();
322
+ const ctx = {
323
+ mainChannel: (name) => {
324
+ const channel = network.addChannel(name);
325
+ network.setMainChannel(channel);
326
+ return channel;
327
+ },
328
+ createChannel: (name) => network.addChannel(name),
329
+ sink: Sink,
330
+ registerAgent: (agent) => network.registerAgentInternal(agent),
331
+ spawner: (factory) => network.createSpawnerInternal(factory)
332
+ };
333
+ callback(ctx);
334
+ return network;
335
+ }
336
+ /* ─── Internal Builders ─── */
337
+ addChannel(name) {
338
+ const channelName = ChannelName(name);
339
+ const channel = new ConfiguredChannel(channelName);
340
+ this.channels.set(channelName, channel);
341
+ return channel;
342
+ }
343
+ setMainChannel(channel) {
344
+ this._mainChannel = channel;
345
+ }
346
+ registerAgentInternal(agent) {
347
+ const registration = {
348
+ agent,
349
+ subscribedTo: [],
350
+ publishesTo: []
351
+ };
352
+ this.agentRegistrations.set(agent.getId(), registration);
353
+ const binding = {
354
+ subscribe(channel) {
355
+ registration.subscribedTo.push(channel);
356
+ return binding;
357
+ },
358
+ publishTo(channel) {
359
+ registration.publishesTo.push(channel);
360
+ return binding;
361
+ }
362
+ };
363
+ return binding;
364
+ }
365
+ createSpawnerInternal(factoryClass) {
366
+ const reg = {
367
+ factoryClass,
368
+ registry: {}
369
+ };
370
+ this.spawnerRegistrations.push(reg);
371
+ const builder = {
372
+ listen(channel, event) {
373
+ reg.listenChannel = channel;
374
+ reg.listenEvent = event;
375
+ return builder;
376
+ },
377
+ registry(registry) {
378
+ reg.registry = registry;
379
+ return builder;
380
+ },
381
+ defaultBinding(fn) {
382
+ reg.defaultBindingFn = fn;
383
+ return builder;
384
+ },
385
+ onSpawn(fn) {
386
+ reg.onSpawnFn = fn;
387
+ return builder;
388
+ }
389
+ };
390
+ return builder;
391
+ }
392
+ /* ─── Accessors ─── */
393
+ getChannels() {
394
+ return this.channels;
395
+ }
396
+ getMainChannel() {
397
+ return this._mainChannel;
398
+ }
399
+ getAgentRegistrations() {
400
+ return this.agentRegistrations;
401
+ }
402
+ getSpawnerRegistrations() {
403
+ return this.spawnerRegistrations;
404
+ }
405
+ /**
406
+ * Expose the network as a streamable API (e.g. SSE). Returns an ExposedAPI
407
+ * that adapters (NextEndpoint, ExpressEndpoint) consume to produce streamed
408
+ * responses.
409
+ *
410
+ * @example
411
+ * const api = network.expose({ protocol: "sse", auth, select });
412
+ * export const GET = NextEndpoint.from(api).handler();
413
+ */
414
+ expose(options) {
415
+ return expose(this, options);
416
+ }
417
+ /**
418
+ * Starts the event plane: creates one PubSub per channel and runs subscriber
419
+ * loops for each (agent, channel) pair. Agents subscribed to a channel are
420
+ * invoked concurrently when events are published to that channel.
421
+ *
422
+ * Returns the EventPlane for publishing. Use `Effect.scoped` so the run is
423
+ * interrupted when the scope ends.
424
+ */
425
+ run(capacity) {
426
+ return this.runScoped(this, capacity);
427
+ }
428
+ runScoped(network, capacity) {
429
+ return Effect.gen(function* () {
430
+ const plane = yield* createEventPlane(network, capacity);
431
+ yield* Effect.fork(run(network, plane));
432
+ return plane;
433
+ });
434
+ }
435
+ };
436
+ var EventMetaSchema = Schema.Struct({
437
+ runId: Schema.String,
438
+ contextId: Schema.optional(Schema.String),
439
+ correlationId: Schema.optional(Schema.String),
440
+ causationId: Schema.optional(Schema.String),
441
+ ts: Schema.optional(Schema.Number)
442
+ });
443
+ var AgentNetworkEvent = {
444
+ of(name, payload) {
445
+ const decodePayload = Schema.decodeUnknown(payload);
446
+ const envelopeSchema = Schema.Struct({
447
+ name: Schema.Literal(name),
448
+ meta: EventMetaSchema,
449
+ payload
450
+ });
451
+ const decodeEnvelope = Schema.decodeUnknown(envelopeSchema);
452
+ const make = (meta, payload2) => Effect.runSync(
453
+ decodeEnvelope({ name, meta, payload: payload2 })
454
+ );
455
+ const makeEffect = (meta, payload2) => decodeEnvelope({ name, meta, payload: payload2 });
456
+ const is = Schema.is(envelopeSchema);
457
+ return {
458
+ _tag: "AgentNetworkEventDef",
459
+ name,
460
+ payload,
461
+ decodePayload,
462
+ decode: decodeEnvelope,
463
+ make,
464
+ makeEffect,
465
+ is
466
+ };
467
+ }
468
+ };
469
+ var _params, _logic, _id, _listensTo;
470
+ var Agent = class {
471
+ constructor(logic, params, listensTo) {
472
+ __privateAdd(this, _params, void 0);
473
+ __privateAdd(this, _logic, void 0);
474
+ __privateAdd(this, _id, void 0);
475
+ __privateAdd(this, _listensTo, void 0);
476
+ __privateSet(this, _logic, logic);
477
+ __privateSet(this, _params, params);
478
+ __privateSet(this, _id, `agent-${randomUUID()}`);
479
+ __privateSet(this, _listensTo, listensTo ?? []);
480
+ }
481
+ getListensTo() {
482
+ return __privateGet(this, _listensTo);
483
+ }
484
+ async invoke(options) {
485
+ const { triggerEvent, emit } = options ?? {};
486
+ const emitFn = emit ?? ((_event) => {
487
+ });
488
+ await __privateGet(this, _logic).call(this, {
489
+ params: __privateGet(this, _params),
490
+ triggerEvent: triggerEvent ?? void 0,
491
+ emit: emitFn
492
+ });
493
+ }
494
+ getId() {
495
+ return __privateGet(this, _id);
496
+ }
497
+ };
498
+ _params = new WeakMap();
499
+ _logic = new WeakMap();
500
+ _id = new WeakMap();
501
+ _listensTo = new WeakMap();
502
+
503
+ // src/matrix/agent-factory.ts
504
+ var AgentFactory = class _AgentFactory {
505
+ constructor({
506
+ logic,
507
+ paramsSchema,
508
+ listensTo = [],
509
+ emits = []
510
+ }) {
511
+ this._logic = logic;
512
+ this._paramsSchema = paramsSchema;
513
+ this._listensTo = listensTo;
514
+ this._emits = emits;
515
+ }
516
+ getConstructorState() {
517
+ return {
518
+ logic: this._logic,
519
+ paramsSchema: this._paramsSchema,
520
+ listensTo: this._listensTo,
521
+ emits: this._emits
522
+ };
523
+ }
524
+ /** Union of all event definitions this agent listens to */
525
+ getListensTo() {
526
+ return this._listensTo;
527
+ }
528
+ /** Union of all event definitions this agent can emit */
529
+ getEmits() {
530
+ return this._emits;
531
+ }
532
+ getLogic() {
533
+ return this._logic;
534
+ }
535
+ static run() {
536
+ return new _AgentFactory({});
537
+ }
538
+ params(params) {
539
+ const { logic, ...rest } = this.getConstructorState();
540
+ return new _AgentFactory({
541
+ ...rest,
542
+ logic,
543
+ paramsSchema: params
544
+ });
545
+ }
546
+ listensTo(events) {
547
+ return new _AgentFactory({
548
+ ...this.getConstructorState(),
549
+ listensTo: [...this._listensTo, ...events]
550
+ });
551
+ }
552
+ emits(events) {
553
+ return new _AgentFactory({
554
+ ...this.getConstructorState(),
555
+ emits: [...this._emits, ...events]
556
+ });
557
+ }
558
+ logic(fn) {
559
+ return new _AgentFactory({
560
+ ...this.getConstructorState(),
561
+ logic: fn
562
+ });
563
+ }
564
+ produce(params) {
565
+ const listensTo = this._listensTo.map((e) => e.name);
566
+ return new Agent(
567
+ this._logic,
568
+ params,
569
+ listensTo
570
+ );
571
+ }
572
+ };
573
+
574
+ // src/matrix/io/protocols/sse.ts
575
+ function formatSSE(envelope) {
576
+ const data = JSON.stringify(envelope);
577
+ return `event: ${envelope.name}
578
+ data: ${data}
579
+
580
+ `;
581
+ }
582
+ function toSSEStream(source, signal) {
583
+ const encoder = new TextEncoder();
584
+ return new ReadableStream({
585
+ async start(controller) {
586
+ const onAbort = () => controller.close();
587
+ signal?.addEventListener("abort", onAbort, { once: true });
588
+ try {
589
+ for await (const envelope of source) {
590
+ if (signal?.aborted)
591
+ break;
592
+ controller.enqueue(encoder.encode(formatSSE(envelope)));
593
+ }
594
+ } finally {
595
+ signal?.removeEventListener("abort", onAbort);
596
+ controller.close();
597
+ }
598
+ }
599
+ });
600
+ }
601
+
602
+ // src/matrix/io/adapters/next-endpoint.ts
603
+ var NextEndpoint = {
604
+ from(api) {
605
+ if (api.protocol !== "sse") {
606
+ throw new Error(`NextEndpoint: unsupported protocol "${api.protocol}"`);
607
+ }
608
+ return {
609
+ handler() {
610
+ return async (request) => {
611
+ const req = { request };
612
+ try {
613
+ const encoder = new TextEncoder();
614
+ const { readable, writable } = new TransformStream();
615
+ let consumerStarted;
616
+ const started = new Promise((resolve) => {
617
+ consumerStarted = resolve;
618
+ });
619
+ const streamDone = api.createStream(req, async (stream) => {
620
+ consumerStarted();
621
+ const writer = writable.getWriter();
622
+ try {
623
+ for await (const envelope of stream) {
624
+ if (request.signal?.aborted)
625
+ break;
626
+ await writer.write(encoder.encode(formatSSE(envelope)));
627
+ }
628
+ } finally {
629
+ await writer.close();
630
+ }
631
+ });
632
+ await Promise.race([started, streamDone]);
633
+ streamDone.catch(() => {
634
+ });
635
+ return new Response(readable, {
636
+ headers: {
637
+ "Content-Type": "text/event-stream",
638
+ "Cache-Control": "no-cache",
639
+ Connection: "keep-alive"
640
+ }
641
+ });
642
+ } catch (e) {
643
+ if (e instanceof ExposeAuthError) {
644
+ return new Response(e.message, { status: e.status });
645
+ }
646
+ throw e;
647
+ }
648
+ };
649
+ }
650
+ };
651
+ }
652
+ };
653
+
654
+ // src/matrix/io/adapters/express-endpoint.ts
655
+ var ExpressEndpoint = {
656
+ from(api) {
657
+ if (api.protocol !== "sse") {
658
+ throw new Error(
659
+ `ExpressEndpoint: unsupported protocol "${api.protocol}"`
660
+ );
661
+ }
662
+ return {
663
+ handler() {
664
+ return async (req, res) => {
665
+ const controller = new AbortController();
666
+ req.on("close", () => controller.abort());
667
+ const exposeReq = {
668
+ request: { signal: controller.signal },
669
+ req,
670
+ res
671
+ };
672
+ try {
673
+ const encoder = new TextEncoder();
674
+ await api.createStream(exposeReq, async (stream) => {
675
+ res.setHeader("Content-Type", "text/event-stream");
676
+ res.setHeader("Cache-Control", "no-cache");
677
+ res.setHeader("Connection", "keep-alive");
678
+ res.flushHeaders?.();
679
+ try {
680
+ for await (const envelope of stream) {
681
+ if (controller.signal.aborted)
682
+ break;
683
+ res.write(encoder.encode(formatSSE(envelope)));
684
+ res.flush?.();
685
+ }
686
+ } finally {
687
+ res.end();
688
+ }
689
+ });
690
+ } catch (e) {
691
+ if (e instanceof ExposeAuthError) {
692
+ res.status(e.status).send(e.message);
693
+ return;
694
+ }
695
+ throw e;
696
+ }
697
+ };
698
+ }
699
+ };
700
+ }
701
+ };
702
+
703
+ export { Agent, AgentFactory, AgentNetwork, AgentNetworkEvent, Channel, ChannelName, ConfiguredChannel, EventMetaSchema, ExposeAuthError, ExpressEndpoint, NextEndpoint, Sink, formatSSE, isHttpStreamSink, toSSEStream };
704
+ //# sourceMappingURL=out.js.map
705
+ //# sourceMappingURL=index.js.map