Skip to main content

Class: InMemoryOutbox

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:278

Outbound deliveries in memory, for tests and single-process hosts.

Implements​

Constructors​

Constructor​

new InMemoryOutbox(): InMemoryOutbox

Returns​

InMemoryOutbox

Methods​

cancel()​

cancel(runId, destinationRef): Promise<boolean>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:327

Optional (the library's stores have it). Ends every pending delivery of the run to the destination (an address that declined), their bodies emptied. True when recorded; false from a wrapper whose outbox cannot.

Parameters​

runId​

string

destinationRef​

string

Returns​

Promise<boolean>

Implementation of​

IOutbox.cancel


due()​

due(now, limit?): Promise<OutboxDelivery[]>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:296

Pending deliveries due at now, ordered by nextAt then id ascending, a mail delivery past its expiry left out; default limit 100.

Parameters​

now​

number

limit?​

number = 100

Returns​

Promise<OutboxDelivery[]>

Implementation of​

IOutbox.due


endExpired()​

endExpired(now): Promise<number>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:331

Optional (the library's stores have it). Ends every pending mail delivery whose expiry has passed at now, dead with its body emptied, so an expired body waits for no attempt; the count ended. OutboxDispatcher calls it at the start of each pass.

Parameters​

now​

number

Returns​

Promise<number>

Implementation of​

IOutbox.endExpired


enqueue()​

enqueue(d, now): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:289

Adds a pending delivery, due at now; a repeated id preserves the first delivery and its retry state. After purgeContent for the run, a delivery of a content event (a type in CONTENT_EVENT_TYPES) is not stored: the purge is the outbox's fence. A delivery of any other type (bot:left, bot:purged, bot:done and the rest) is stored. A mail delivery (kind: 'mail') is content: behind the fence it is stored empty and dead, and purgeContent empties it with the content events.

Parameters​

d​

OutboxEnqueue

now​

number

Returns​

Promise<void>

Implementation of​

IOutbox.enqueue


forget()​

forget(runId): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:279

Optional whole-run eviction for in-memory hosts after terminal cleanup and the retention grace. Durable stores omit it to retain their records. Call only after producers have stopped; forgetting removes fences too.

Parameters​

runId​

string

Returns​

Promise<void>

Implementation of​

IOutbox.forget


holdUntil()​

holdUntil(id, notBefore): Promise<boolean>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:322

Optional (the library's stores have it). Moves a pending delivery's next attempt to notBefore without counting an attempt (a cap that holds it). True when recorded; false from a wrapper whose outbox cannot.

Parameters​

id​

string

notBefore​

number

Returns​

Promise<boolean>

Implementation of​

IOutbox.holdUntil


listByRun()​

listByRun(runId): Promise<OutboxDelivery[]>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:361

Every delivery of the run, whatever its state, ordered by nextAt then id ascending.

Parameters​

runId​

string

Returns​

Promise<OutboxDelivery[]>

Implementation of​

IOutbox.listByRun


markDead()​

markDead(id): Promise<boolean>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:317

Optional (the library's stores have it). Ends a pending delivery at once (a destination's permanent refusal, or an outcome the destination never answered), a mail's body emptied; one no longer pending is left as it is. True when the outbox recorded it; false from a wrapper whose outbox cannot, whose caller records a failed attempt instead.

Parameters​

id​

string

Returns​

Promise<boolean>

Implementation of​

IOutbox.markDead


markDelivered()​

markDelivered(id): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:304

Records that the destination took the delivery; a mail delivery's body is emptied with it.

Parameters​

id​

string

Returns​

Promise<void>

Implementation of​

IOutbox.markDelivered


markFailed()​

markFailed(id, now): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:308

Records a failed attempt: due again after the backoff of nextAttemptAt, or dead a day after the first failed attempt, or at a mail delivery's expiry (its body emptied). A delivery that is no longer pending, delivered or dead, is left as it is.

Parameters​

id​

string

now​

number

Returns​

Promise<void>

Implementation of​

IOutbox.markFailed


purgeContent()​

purgeContent(runId): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:348

Empties every content delivery of the run (a type in CONTENT_EVENT_TYPES), delivered ones included, so a replay after a purge sends the content-free bot:purged in its place. A delivery of any other type (bot:done, bot:left and the rest) carries no content and keeps its type and payload. From then on the run takes no content delivery (see enqueue).

Parameters​

runId​

string

Returns​

Promise<void>

Implementation of​

IOutbox.purgeContent


replay()​

replay(id, now): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:340

Makes a delivery pending again, due at now, with its attempts counted afresh (a manual replay); a mail delivery is never replayed, and the call changes nothing.

Parameters​

id​

string

now​

number

Returns​

Promise<void>

Implementation of​

IOutbox.replay


sendClaimed()​

sendClaimed(candidate, send): Promise<boolean>

Defined in: packages/agentos/src/io/channels/meetings/stores/memory.ts:372

Sends one delivery as the outbox holds it now, not as due returned it: one gone or no longer pending is skipped (false). The signal send gets aborts when purgeContent purges the delivery's run, so a send that has not written its body yet stops (false); any other rejection is send's.

Parameters​

candidate​

OutboxDelivery

A delivery due returned.

send​

(fresh, signal) => Promise<void>

Sends the fresh copy under the signal.

Returns​

Promise<boolean>

Implementation of​

IOutbox.sendClaimed