@noetic-tools/core 5.20.0 → 5.22.0-next.1

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.
Files changed (84) hide show
  1. package/dist/builders/tool-builder.d.ts +20 -0
  2. package/dist/builders/tool-builder.js +23 -1
  3. package/dist/builders/workflow-hydrator.d.ts +19 -0
  4. package/dist/builders/workflow-hydrator.js +19 -0
  5. package/dist/builders/workflow-step.js +7 -1
  6. package/dist/connections/cron-schedule.js +12 -3
  7. package/dist/connections/durability.d.ts +1 -2
  8. package/dist/connections/durability.js +1 -4
  9. package/dist/connections/gates.js +6 -2
  10. package/dist/connections/harness-wiring.d.ts +5 -0
  11. package/dist/connections/harness-wiring.js +76 -10
  12. package/dist/connections/in-memory-connection.d.ts +4 -0
  13. package/dist/connections/in-memory-connection.js +10 -0
  14. package/dist/connections/model-tools.js +5 -1
  15. package/dist/connections/registry.d.ts +6 -2
  16. package/dist/connections/registry.js +10 -0
  17. package/dist/connections/sources.js +261 -20
  18. package/dist/connections/triggers.d.ts +62 -2
  19. package/dist/connections/triggers.js +375 -35
  20. package/dist/harness/agent-harness.d.ts +263 -4
  21. package/dist/harness/agent-harness.js +1156 -95
  22. package/dist/harness/connection-gate.d.ts +3 -0
  23. package/dist/harness/connection-gate.js +4 -0
  24. package/dist/harness/deps/runtime.d.ts +3 -0
  25. package/dist/harness/deps/runtime.js +2 -0
  26. package/dist/harness/flow-version.d.ts +13 -0
  27. package/dist/harness/flow-version.js +66 -0
  28. package/dist/harness/harness-options.d.ts +82 -0
  29. package/dist/harness/model-call.d.ts +0 -1
  30. package/dist/harness/model-call.js +8 -48
  31. package/dist/harness/model-rounds.d.ts +30 -0
  32. package/dist/harness/model-rounds.js +146 -1
  33. package/dist/harness/model-tool-round.d.ts +3 -0
  34. package/dist/harness/model-tool-round.js +201 -19
  35. package/dist/harness/park-watchers.d.ts +93 -0
  36. package/dist/harness/park-watchers.js +217 -0
  37. package/dist/harness/read-decision.d.ts +23 -0
  38. package/dist/harness/read-decision.js +100 -0
  39. package/dist/harness/spend.js +4 -0
  40. package/dist/harness/steer-inbox.js +3 -1
  41. package/dist/harness/thread-record.d.ts +77 -1
  42. package/dist/harness/thread-record.js +272 -13
  43. package/dist/index.d.ts +17 -7
  44. package/dist/index.js +10 -2
  45. package/dist/interpreter/acp-resume.d.ts +77 -0
  46. package/dist/interpreter/acp-resume.js +164 -0
  47. package/dist/interpreter/acp-tools.d.ts +11 -0
  48. package/dist/interpreter/acp-tools.js +94 -7
  49. package/dist/interpreter/connection-steps.d.ts +24 -1
  50. package/dist/interpreter/connection-steps.js +77 -2
  51. package/dist/interpreter/execute-acp-agent.js +111 -15
  52. package/dist/interpreter/execute-action.js +7 -0
  53. package/dist/interpreter/execute-call.js +30 -4
  54. package/dist/interpreter/execute-control.js +21 -0
  55. package/dist/interpreter/execute-invoke-tool.js +149 -5
  56. package/dist/interpreter/execute-wait.js +67 -9
  57. package/dist/interpreter/execute.js +4 -0
  58. package/dist/interpreter/turn-ending.d.ts +15 -0
  59. package/dist/interpreter/turn-ending.js +46 -0
  60. package/dist/portable/builders.d.ts +1 -1
  61. package/dist/portable/builders.js +1 -1
  62. package/dist/runtime/durable/parking.d.ts +61 -0
  63. package/dist/runtime/durable/parking.js +137 -0
  64. package/dist/runtime/durable/session-store.d.ts +38 -0
  65. package/dist/runtime/durable/session-store.js +79 -1
  66. package/dist/runtime/durable/step-ledger.d.ts +121 -2
  67. package/dist/runtime/durable/step-ledger.js +352 -15
  68. package/dist/runtime/durable/turn-lease.d.ts +128 -0
  69. package/dist/runtime/durable/turn-lease.js +307 -0
  70. package/dist/runtime/held-calls.d.ts +192 -0
  71. package/dist/runtime/held-calls.js +496 -0
  72. package/dist/runtime/in-memory-storage.d.ts +10 -1
  73. package/dist/runtime/in-memory-storage.js +20 -2
  74. package/dist/runtime/message-queue.d.ts +2 -0
  75. package/dist/runtime/message-queue.js +8 -0
  76. package/dist/runtime/session-runner.d.ts +18 -2
  77. package/dist/runtime/session-runner.js +88 -3
  78. package/dist/runtime/tool-approval.d.ts +46 -6
  79. package/dist/runtime/tool-approval.js +160 -38
  80. package/dist/runtime/tool-call.d.ts +34 -2
  81. package/dist/runtime/tool-call.js +182 -13
  82. package/dist/runtime/tool-context.d.ts +15 -1
  83. package/dist/runtime/tool-context.js +38 -2
  84. package/package.json +3 -3
@@ -81,17 +81,72 @@ function sleep(ms, signal) {
81
81
  }
82
82
  //#endregion
83
83
  //#region Source hub
84
+ /**
85
+ * Give `event` to a listener that stores what it receives, and resolve once it says
86
+ * the event is stored. Rejects with its error, or if the listener ends first.
87
+ */
88
+ function handToStore(listener, event) {
89
+ return new Promise((resolve, reject) => {
90
+ const ended = () => {
91
+ reject(new Error(`The listener for '${event.type}' ended before it stored the event.`));
92
+ };
93
+ listener.onEnd.add(ended);
94
+ listener.push({
95
+ type: 'event',
96
+ event,
97
+ stored: (error) => {
98
+ listener.onEnd.delete(ended);
99
+ if (error === undefined) {
100
+ resolve();
101
+ return;
102
+ }
103
+ reject(error instanceof Error ? error : new Error(String(error)));
104
+ },
105
+ });
106
+ });
107
+ }
108
+ /**
109
+ * The cursor of a source that has emitted nothing yet: "before the first event". A
110
+ * listener that starts there and listens again later gets everything since.
111
+ */
112
+ const SOURCE_ORIGIN = '';
113
+ /**
114
+ * The prefix of a position a hub makes up for an event its source gave no cursor:
115
+ * the event's place in what the hub emitted. It means nothing to the source, and
116
+ * nothing to a hub in another process.
117
+ */
118
+ const LOCAL_POSITION = 'noetic-local:';
119
+ function isLocalPosition(cursor) {
120
+ return cursor?.startsWith(LOCAL_POSITION) === true;
121
+ }
84
122
  /** The live side of a source: its listeners, its pending events, and its one running `start`. */
85
123
  class SourceHub {
86
124
  definition;
87
125
  listeners = new Set();
88
126
  pending = [];
127
+ /**
128
+ * What a source with a `start` has emitted, newest last, so a listener that comes
129
+ * with a cursor gets what came after it. Without this only the first listener ever
130
+ * saw a replay, though the manifest says the events replay from a cursor.
131
+ */
132
+ history = [];
133
+ /** How many events this hub has emitted: the place of the newest in `history`. */
134
+ emitted = 0;
135
+ /** Tells this hub's own positions from those of a hub in an earlier process. */
136
+ epoch = crypto.randomUUID();
89
137
  started = false;
90
138
  controller = new AbortController();
139
+ /**
140
+ * Event types a storing listener (a trigger) has asked for and not given up.
141
+ * While one is away, between a failed write and its next listen, an event of that
142
+ * type has nowhere durable to go.
143
+ */
144
+ storers = new Map();
91
145
  constructor(definition) {
92
146
  this.definition = definition;
93
147
  }
94
- async emit(event) {
148
+ /** Check `event` against its schema and stamp it. */
149
+ stamp(event) {
95
150
  const schema = this.definition.events[event.type];
96
151
  if (!schema) {
97
152
  throw invalidConnectionError(`The source has no event '${event.type}'.`, `Emit one of: ${Object.keys(this.definition.events).join(', ')}.`);
@@ -100,16 +155,33 @@ class SourceHub {
100
155
  if (!parsed.success) {
101
156
  throw invalidConnectionError(`Payload of source event '${event.type}' does not match its schema: ${parsed.error.message}`, `Emit a payload the '${event.type}' schema accepts.`);
102
157
  }
103
- const init = {
158
+ return {
104
159
  id: event.id,
105
160
  type: event.type,
106
161
  time: event.time ?? new Date().toISOString(),
107
162
  payload: parsed.data,
108
163
  cursor: event.cursor ?? null,
109
164
  };
165
+ }
166
+ async emit(event) {
167
+ const init = this.stamp(event);
168
+ if (this.definition.start) {
169
+ this.history.push(init);
170
+ this.emitted += 1;
171
+ if (this.history.length > WAIT_BUFFER_LIMIT) {
172
+ this.history.shift();
173
+ }
174
+ }
110
175
  const targets = [
111
176
  ...this.listeners,
112
177
  ].filter((l) => l.event === event.type);
178
+ // A trigger stores this event type but is not listening at this moment (it is
179
+ // backing off after a failure). Holding the event in memory and saying it is
180
+ // taken would be a lie the sender cannot check: say it was not stored.
181
+ const storing = targets.some((l) => l.stores);
182
+ if (!storing && (this.storers.get(event.type) ?? 0) > 0) {
183
+ throw new Error(`Source event '${event.type}' was not stored: the trigger that stores it is not listening right now. Send it again.`);
184
+ }
113
185
  if (targets.length === 0) {
114
186
  this.pending.push(init);
115
187
  if (this.pending.length > WAIT_BUFFER_LIMIT) {
@@ -117,31 +189,170 @@ class SourceHub {
117
189
  }
118
190
  return;
119
191
  }
192
+ const stored = [];
120
193
  for (const listener of targets) {
121
- listener.push({
122
- type: 'event',
123
- event: init,
124
- });
194
+ if (!listener.stores) {
195
+ listener.push({
196
+ type: 'event',
197
+ event: init,
198
+ });
199
+ continue;
200
+ }
201
+ stored.push(handToStore(listener, init));
125
202
  }
203
+ // Resolve only once every trigger has the event in its inbox.
204
+ await Promise.all(stored);
126
205
  }
127
206
  listen(request) {
207
+ const asked = request.cursor ?? null;
208
+ if (this.definition.schedule && this.definition.start) {
209
+ return this.listenAlone(request, asked);
210
+ }
128
211
  const { stream, listener } = createListenerStream(this.listeners, request, {
129
- cursor: request.cursor ?? null,
212
+ // Where this listener starts: what it asked for, or where the source is now. A
213
+ // wait records it, and listening again from it replays what came since.
214
+ cursor: asked ?? this.position(),
130
215
  });
131
216
  this.listeners.add(listener);
217
+ if (listener.stores) {
218
+ this.expectStore(request);
219
+ }
132
220
  const held = this.pending.filter((e) => e.type === request.event);
133
221
  for (const event of held) {
134
222
  this.pending.splice(this.pending.indexOf(event), 1);
223
+ }
224
+ // A listener with a cursor gets everything after it; one without gets only
225
+ // what nobody was there to hear.
226
+ const replay = asked === null ? held : this.since(asked, request.event);
227
+ for (const event of replay) {
135
228
  listener.push({
136
229
  type: 'event',
137
230
  event,
138
231
  });
139
232
  }
140
- this.startOnce(request.cursor ?? null);
233
+ // A position this hub made up is not a cursor the source knows.
234
+ this.startOnce(asked === SOURCE_ORIGIN || isLocalPosition(asked) ? null : asked);
141
235
  return stream;
142
236
  }
237
+ /**
238
+ * Listen to a source with a schedule. Its events are a function of time, not a
239
+ * stream to share, so each listener gets a run of `start` of its own, from its own
240
+ * cursor: two triggers on one `cron()` each get every tick they missed, whichever
241
+ * of them was behind.
242
+ */
243
+ listenAlone(request, asked) {
244
+ const { schedule, start } = this.definition;
245
+ // A listener with no cursor starts now. A wait records that, and listening
246
+ // again from it gets the ticks since.
247
+ const from = asked ?? schedule?.begin(Date.now()) ?? null;
248
+ const { stream, listener } = createListenerStream(this.listeners, request, {
249
+ cursor: from,
250
+ });
251
+ this.listeners.add(listener);
252
+ if (listener.stores) {
253
+ this.expectStore(request);
254
+ }
255
+ const run = new AbortController();
256
+ const stop = () => run.abort();
257
+ listener.onEnd.add(stop);
258
+ this.controller.signal.addEventListener('abort', stop, {
259
+ once: true,
260
+ });
261
+ const deliver = async (event) => {
262
+ const init = this.stamp(event);
263
+ if (listener.stores) {
264
+ await handToStore(listener, init);
265
+ return;
266
+ }
267
+ listener.push({
268
+ type: 'event',
269
+ event: init,
270
+ });
271
+ };
272
+ void (async () => {
273
+ await start?.call(this.definition, {
274
+ emit: deliver,
275
+ cursor: from,
276
+ signal: run.signal,
277
+ });
278
+ })().catch((e) => {
279
+ // Most often its event could not be stored. The listener is told the stream
280
+ // ended; a trigger listens again from its cursor and gets the event then.
281
+ listener.push({
282
+ type: 'terminated',
283
+ reason: `source stopped: ${e instanceof Error ? e.message : String(e)}`,
284
+ });
285
+ listener.end();
286
+ });
287
+ return stream;
288
+ }
289
+ /**
290
+ * Remember that `request`'s event type is one a trigger stores, until that
291
+ * trigger stops for good (its signal is aborted), not merely until its stream ends.
292
+ */
293
+ expectStore(request) {
294
+ const type = request.event;
295
+ const { signal } = request;
296
+ if (signal.aborted) {
297
+ return;
298
+ }
299
+ this.storers.set(type, (this.storers.get(type) ?? 0) + 1);
300
+ signal.addEventListener('abort', () => {
301
+ const left = (this.storers.get(type) ?? 1) - 1;
302
+ if (left > 0) {
303
+ this.storers.set(type, left);
304
+ return;
305
+ }
306
+ this.storers.delete(type);
307
+ }, {
308
+ once: true,
309
+ });
310
+ }
311
+ /** Where the source is now, as a cursor: after its last event, or before any. */
312
+ position() {
313
+ if (!this.definition.start) {
314
+ return null;
315
+ }
316
+ const newest = this.history.at(-1);
317
+ if (!newest) {
318
+ return this.emitted === 0 ? SOURCE_ORIGIN : this.localPosition(this.emitted);
319
+ }
320
+ // The source's own cursor where it gives one. Where it does not, the event's
321
+ // place in what this hub emitted: without that, "where the source is now" stayed
322
+ // at the origin, and listening again from it replayed everything ever emitted.
323
+ return newest.cursor ?? this.localPosition(this.emitted);
324
+ }
325
+ localPosition(count) {
326
+ return `${LOCAL_POSITION}${this.epoch}:${count}`;
327
+ }
328
+ /** How many events had been emitted at `cursor`, when it is a position of this hub. */
329
+ localCount(cursor) {
330
+ const prefix = `${LOCAL_POSITION}${this.epoch}:`;
331
+ if (!cursor.startsWith(prefix)) {
332
+ return undefined;
333
+ }
334
+ const count = Number(cursor.slice(prefix.length));
335
+ return Number.isInteger(count) ? count : undefined;
336
+ }
337
+ /**
338
+ * The events of `type` emitted after `cursor`. A cursor that is not in the history
339
+ * is older than all of it — the source began after it — so everything is after it.
340
+ */
341
+ since(cursor, type) {
342
+ const count = this.localCount(cursor);
343
+ if (count !== undefined) {
344
+ // The history holds the newest events: those after `count` are its tail.
345
+ const after = Math.min(this.history.length, Math.max(0, this.emitted - count));
346
+ return this.history.slice(this.history.length - after).filter((e) => e.type === type);
347
+ }
348
+ const at = cursor === SOURCE_ORIGIN ? -1 : this.history.findLastIndex((e) => e.cursor === cursor);
349
+ return this.history.slice(at + 1).filter((e) => e.type === type);
350
+ }
143
351
  close(reason) {
144
352
  this.controller.abort();
353
+ this.endListeners(reason);
354
+ }
355
+ endListeners(reason) {
145
356
  for (const listener of [
146
357
  ...this.listeners,
147
358
  ]) {
@@ -166,7 +377,15 @@ class SourceHub {
166
377
  });
167
378
  };
168
379
  void run().catch((e) => {
169
- this.close(`source stopped: ${e instanceof Error ? e.message : String(e)}`);
380
+ // `start` threw, most often because an event it emitted could not be stored.
381
+ // Its listeners are told the stream ended, and the source is left able to
382
+ // start again: the next listener begins it from its own cursor.
383
+ const reason = `source stopped: ${e instanceof Error ? e.message : String(e)}`;
384
+ const stopped = this.controller;
385
+ this.controller = new AbortController();
386
+ this.started = false;
387
+ stopped.abort();
388
+ this.endListeners(reason);
170
389
  });
171
390
  }
172
391
  }
@@ -213,6 +432,11 @@ export const defineSource = (definition) => {
213
432
  throw invalidConnectionError(`A source has no resource '${resource}'.`, 'Sources only deliver events.');
214
433
  },
215
434
  listen: (request) => current.listen(request),
435
+ ...(definition.schedule
436
+ ? {
437
+ schedule: definition.schedule,
438
+ }
439
+ : {}),
216
440
  tasks: {
217
441
  async get(taskId) {
218
442
  return {
@@ -260,12 +484,37 @@ export const cron = (schedule, options) => {
260
484
  const events = {
261
485
  tick: CronTickSchema,
262
486
  };
487
+ /** Cursors found to be too far behind to catch up from: they stay so. */
488
+ const abandoned = new Set();
489
+ /**
490
+ * Where to count from: the cursor, or `now` when more runs were missed since the
491
+ * cursor than a restart replays. The schedule and the source both ask here, so
492
+ * the time the schedule says is due is one the source will deliver.
493
+ */
494
+ const resumeFrom = (cursor, now) => {
495
+ const resumed = cursor === null ? Number.NaN : Date.parse(cursor);
496
+ if (cursor === null || Number.isNaN(resumed) || abandoned.has(cursor)) {
497
+ return now;
498
+ }
499
+ let at = resumed;
500
+ for (let missed = 0; missed <= CRON_CATCH_UP_LIMIT; missed += 1) {
501
+ const next = nextCronRun(parsed, at);
502
+ if (next === undefined || next > now) {
503
+ return resumed;
504
+ }
505
+ at = next;
506
+ }
507
+ abandoned.add(cursor);
508
+ return now;
509
+ };
263
510
  return defineSource({
264
511
  events,
512
+ schedule: {
513
+ next: (cursor, now) => nextCronRun(parsed, resumeFrom(cursor, now)),
514
+ begin: (now) => new Date(now).toISOString(),
515
+ },
265
516
  async start({ emit, cursor, signal }) {
266
- const resumed = cursor === null ? Number.NaN : Date.parse(cursor);
267
- let after = Number.isNaN(resumed) ? Date.now() : resumed;
268
- let caughtUp = 0;
517
+ let after = resumeFrom(cursor, Date.now());
269
518
  for (;;) {
270
519
  const next = nextCronRun(parsed, after);
271
520
  if (next === undefined || signal.aborted) {
@@ -275,14 +524,6 @@ export const cron = (schedule, options) => {
275
524
  if (wait > 0 && !(await sleep(wait, signal))) {
276
525
  return;
277
526
  }
278
- if (wait <= 0) {
279
- caughtUp += 1;
280
- }
281
- if (caughtUp > CRON_CATCH_UP_LIMIT) {
282
- after = Date.now();
283
- caughtUp = 0;
284
- continue;
285
- }
286
527
  const scheduledFor = new Date(next).toISOString();
287
528
  await emit({
288
529
  type: 'tick',
@@ -36,6 +36,10 @@ export interface TriggerRunnerOptions {
36
36
  readonly relistenDelayMs?: (attempt: number) => number;
37
37
  /** Delay before retrying a failed delivery, by attempt. Default: 1 s doubling to 30 s. */
38
38
  readonly redeliverDelayMs?: (attempt: number) => number;
39
+ /** The clock scheduled events are counted by. Default `Date.now`. */
40
+ readonly now?: () => number;
41
+ /** A trigger on a scheduled connection moved on, so its next event is a new one. */
42
+ readonly onSchedule?: () => Promise<void>;
39
43
  }
40
44
  /**
41
45
  * Checks triggers against the harness connections at construction.
@@ -48,21 +52,72 @@ export declare function validateTriggers(triggers: ReadonlyArray<ConnectionTrigg
48
52
  export declare class TriggerRunner {
49
53
  private readonly options;
50
54
  private readonly controller;
55
+ private readonly triggers;
56
+ private readonly compiled;
57
+ /** Each trigger's listen loop, and what stops it. */
51
58
  private readonly loops;
59
+ private started;
52
60
  /**
53
61
  * The last delivery on each thread. A thread's events are delivered one turn
54
62
  * at a time, so each matching event starts its own turn instead of joining
55
63
  * a queued one (spec 35 § Triggers).
56
64
  */
57
65
  private readonly threads;
66
+ /** Events being stored right now, whose turns do not exist yet. */
67
+ private handling;
68
+ /** How often reading an event into an inbox entry has failed, by inbox key. */
69
+ private readonly entryTries;
58
70
  constructor(options: TriggerRunnerOptions);
59
71
  /**
60
- * Redelivers undelivered inbox entries and starts listening.
72
+ * Loads the triggers added on an earlier run, redelivers undelivered inbox
73
+ * entries, and starts listening.
61
74
  *
62
75
  * @throws ConnectionUnsatisfiedError when a trigger's connection does not offer its event.
63
76
  */
64
77
  start(): Promise<void>;
65
78
  close(): Promise<void>;
79
+ /** Every trigger the runner has: the harness's own, and those added while it ran. */
80
+ list(): ConnectionTrigger[];
81
+ /**
82
+ * Add a trigger while the harness runs. One written with expressions only is kept
83
+ * in storage and is there again after a restart; one with a function in it lasts
84
+ * for this process.
85
+ *
86
+ * @throws NoeticConfigError `CONNECTION_INVALID` for an id already in use, a
87
+ * missing event or an expression that does not parse; `CONNECTION_UNKNOWN` for
88
+ * an unknown connection.
89
+ * @throws ConnectionUnsatisfiedError when the connection does not offer the event.
90
+ */
91
+ add(trigger: ConnectionTrigger): Promise<void>;
92
+ /** Stop and forget a trigger. Resolves false when there is none with that id. */
93
+ remove(id: string): Promise<boolean>;
94
+ /**
95
+ * Epoch ms of the earliest event a trigger is due, for triggers on a connection
96
+ * that can tell (`Connection.schedule`, as `cron()` has). Undefined when none can,
97
+ * or before the runner has started.
98
+ */
99
+ nextDue(): Promise<number | undefined>;
100
+ /**
101
+ * Resolves once the runner has nothing in hand: every scheduled event that is
102
+ * due has been read, and every turn a trigger started has finished or parked.
103
+ * It gives up waiting on a due event after `dueWaitMs`, so a source that cannot
104
+ * deliver does not hold a caller forever.
105
+ */
106
+ idle(dueWaitMs?: number): Promise<void>;
107
+ private cursorOf;
108
+ /**
109
+ * A trigger on a scheduled connection starts counting from now. Without a stored
110
+ * place to count from, a host that is not running when the first event falls due
111
+ * would come back, count from "now" again, and never see it.
112
+ */
113
+ private anchor;
114
+ /** Triggers added on an earlier run, read back from storage. */
115
+ private loadAdded;
116
+ private requireEvent;
117
+ /** Redeliver what the trigger left in its inbox, then listen. */
118
+ private begin;
119
+ /** Say on the stream that this event will not be tried again, and which one it was. */
120
+ private gaveUp;
66
121
  private report;
67
122
  private redeliver;
68
123
  private listenLoop;
@@ -73,6 +128,11 @@ export declare class TriggerRunner {
73
128
  private entryFor;
74
129
  private advance;
75
130
  private deliver;
76
- /** Delivers one inbox entry, retrying a failed turn with backoff; marks it done on success. */
131
+ /**
132
+ * Delivers one inbox entry, retrying a failed turn with backoff. On success the
133
+ * event is marked done. After the last try the trigger gives up: the failure is
134
+ * reported, the event is marked seen so it is not delivered again, and nothing
135
+ * more is kept. A host that wants another try emits the event again itself.
136
+ */
77
137
  private deliverWithRetry;
78
138
  }