Skip to main content

Interface: IOutbox

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:190

Outbound deliveries: retried with backoff for a day, replayable, content-free after a purge; mail deliveries delivered at most once within their expiry.

Methods​

cancel()?​

optional cancel(runId, destinationRef): Promise<boolean>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:213

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>


due()​

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

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:201

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

Returns​

Promise<OutboxDelivery[]>


endExpired()?​

optional endExpired(now): Promise<number>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:215

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>


enqueue()​

enqueue(delivery, now): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:199

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​

delivery​

OutboxEnqueue

now​

number

Returns​

Promise<void>


forget()?​

optional forget(runId): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:192

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>


holdUntil()?​

optional holdUntil(id, notBefore): Promise<boolean>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:211

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>


listByRun()​

listByRun(runId): Promise<OutboxDelivery[]>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:224

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

Parameters​

runId​

string

Returns​

Promise<OutboxDelivery[]>


markDead()?​

optional markDead(id): Promise<boolean>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:209

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>


markDelivered()​

markDelivered(id): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:203

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

Parameters​

id​

string

Returns​

Promise<void>


markFailed()​

markFailed(id, now): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:205

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>


purgeContent()​

purgeContent(runId): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:222

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>


replay()​

replay(id, now): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:207

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>


sendClaimed()?​

optional sendClaimed(candidate, send): Promise<boolean>

Defined in: packages/agentos/src/io/channels/meetings/stores/types.ts:233

Optional. Sends one delivery under the outbox's own guard: re-reads candidate (a row due returned, which a purge may have emptied since) and, when it is still pending, calls send with the fresh row and a signal that a purge of its run aborts. Answers true when send resolved, false when the delivery was skipped (gone, no longer pending, being sent already, or cancelled by a purge), and rejects with send's error otherwise. OutboxDispatcher sends through it when an outbox has it (InMemoryOutbox, SqlOutbox and FencedOutbox do), and sends the row due returned when it has not.

Parameters​

candidate​

OutboxDelivery

send​

(fresh, signal) => Promise<void>

Returns​

Promise<boolean>