Open Agent Loops
API Reference

InMemoryChannelSource

@open-agent-loops/core


Defined in: channels/in-memory-channel-source.ts:26

A ChannelSource backed by in-memory arrays. No I/O, no timers — perfect for tests and the runnable example.

Implements

Constructors

Constructor

new InMemoryChannelSource(): InMemoryChannelSource;

Returns

InMemoryChannelSource

Methods

emit()

emit(message): void;

Defined in: channels/in-memory-channel-source.ts:52

Simulate an inbound message arriving on the socket. Use this from a test or example to drive traffic — including bursts, by calling it several times in a row synchronously.

Parameters

ParameterTypeDescription
messageInboundMessageThe inbound message to deliver.

Returns

void

Throws

If called before start.


send()

send(target, text): void;

Defined in: channels/in-memory-channel-source.ts:36

Post reply text back to a channel/thread.

Parameters

ParameterTypeDescription
targetOutboundTargetWhere the reply goes.
textstringThe reply text.

Returns

void

Implementation of

ChannelSource.send


start()

start(onMessage): void;

Defined in: channels/in-memory-channel-source.ts:32

Begin receiving. onMessage is invoked for every normalized inbound message — the source must drain and ack its transport continuously and never stop reading just because a run is in flight (that is what the bounded queue downstream is for). Owns its own reconnect/heartbeat internally.

Parameters

ParameterTypeDescription
onMessage(message) => voidCalled per normalized inbound message.

Returns

void

Implementation of

ChannelSource.start


stop()

stop(): void;

Defined in: channels/in-memory-channel-source.ts:40

Stop receiving and release the transport.

Returns

void

Implementation of

ChannelSource.stop

Properties

PropertyModifierTypeDefault valueDescriptionDefined in
sentreadonlySentReply[][]Every reply posted via send, in order.channels/in-memory-channel-source.ts:28

On this page