Skip to content

EventStream

Events after a cursor, as an async iterable. Returned by the stream* methods.

const events = agent.streamEvents({ after: saved });
for await (const event of events) await save(event, events.cursor);
  • Reconnects after any drop and resumes after cursor.
  • Throws a WardrikError for a status below 500.
  • Deltas and tool progress don't move the cursor, and aren't resent after a reconnect.
  • wardrik.events.dropped says the log was trimmed past the cursor.
  • Never ends by itself. Stop it with signal.
readonly opened: Promise<void>;

Resolves when the stream first opens. Rejects if it can't open.

get cursor(): string | undefined;

The cursor to resume after. Save it and pass it back as after.

string | undefined

[asyncIterator](): AsyncGenerator<WardrikEvent>;

AsyncGenerator<WardrikEvent>

AsyncIterable.[asyncIterator]