@copilotkit/core 1.74.0 → 1.75.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.
package/dist/index.umd.js CHANGED
@@ -23,20 +23,23 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
23
23
  *
24
24
  * `transformChunks` is still applied — message reassembly is needed either way.
25
25
  *
26
- * This mirrors the base `AbstractAgent.connectAgent` implementation exactly
27
- * apart from that omission, so callers keep the same subscriber notifications,
28
- * detach semantics, and `{ result, newMessages }` return shape.
26
+ * Connection-local replay hooks track the phase before applying events. An
27
+ * explicitly live RUN_ERROR clears busy without closing the connection;
28
+ * historical errors remain data. Connections without hooks retain the existing
29
+ * completion behavior. Subscriber, detach, and result contracts are preserved.
29
30
  *
30
31
  * TODO: Remove this in favour of the base implementation once AG-UI's
31
32
  * AbstractAgent supports opting out of `verifyEvents` for transports whose
32
- * connection life-cycle isn't a single run. As of `@ag-ui/client@0.0.57`
33
+ * connection life-cycle isn't a single run AND preserves the connection-local
34
+ * replay lifecycle and running-state behavior below. Skipping verification alone
35
+ * is insufficient. As of `@ag-ui/client@0.0.57`
33
36
  * `connectAgent(parameters?, subscriber?)` takes no such option.
34
37
  *
35
38
  * @param agent - The agent whose `connect()` stream should be consumed.
36
39
  * @param parameters - Run parameters, forwarded to `prepareRunAgentInput`.
37
40
  * @param subscriber - Optional one-shot subscriber for this connect call.
38
41
  */
39
- async function ɵconnectWithoutEventVerification(agent, parameters, subscriber) {
42
+ async function ɵconnectWithoutEventVerification(agent, parameters, subscriber, connect) {
40
43
  const self = agent;
41
44
  try {
42
45
  var _agent$agentId;
@@ -45,10 +48,20 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
45
48
  const input = self.prepareRunAgentInput(parameters);
46
49
  let result;
47
50
  const previousMessageIds = new Set(agent.messages.map((m) => m.id));
51
+ let isReplaying = true;
52
+ const liveErrors = /* @__PURE__ */ new WeakSet();
48
53
  const subscribers = [
49
- { onRunFinishedEvent: (event) => {
50
- if (event.outcome === "success") result = event.result;
51
- } },
54
+ {
55
+ onRunStartedEvent: () => {
56
+ agent.isRunning = true;
57
+ },
58
+ onRunErrorEvent: ({ event }) => {
59
+ if (liveErrors.has(event)) agent.isRunning = false;
60
+ },
61
+ onRunFinishedEvent: (event) => {
62
+ if (event.outcome === "success") result = event.result;
63
+ }
64
+ },
52
65
  ...agent.subscribers,
53
66
  subscriber !== null && subscriber !== void 0 ? subscriber : {}
54
67
  ];
@@ -58,7 +71,18 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
58
71
  self.activeRunCompletionPromise = new Promise((resolve) => {
59
72
  resolveCompletion = resolve;
60
73
  });
61
- const source$ = (0, rxjs.defer)(() => self.connect(input)).pipe((0, _ag_ui_client.transformChunks)(self.debugLogger), (0, rxjs_operators.takeUntil)(self.activeRunDetach$));
74
+ const lifecycle = {
75
+ onReplayStarted: () => {
76
+ isReplaying = true;
77
+ agent.isRunning = true;
78
+ },
79
+ onReplayFinished: () => {
80
+ isReplaying = false;
81
+ }
82
+ };
83
+ const source$ = (0, rxjs.defer)(() => connect ? connect(input, lifecycle) : self.connect(input)).pipe((0, rxjs_operators.tap)((event) => {
84
+ if (!isReplaying && event.type === _ag_ui_client.EventType.RUN_ERROR) liveErrors.add(event);
85
+ }), (0, _ag_ui_client.transformChunks)(self.debugLogger), (0, rxjs_operators.takeUntil)(self.activeRunDetach$));
62
86
  const applied$ = self.apply(input, source$, subscribers);
63
87
  await (0, rxjs.lastValueFrom)(self.processApplyEvents(input, applied$, subscribers).pipe((0, rxjs_operators.catchError)((error) => {
64
88
  agent.isRunning = false;
@@ -247,9 +271,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
247
271
  const globalFetch = (...args) => fetch(...args);
248
272
  const CLIENT_AG_UI_EVENT = "ag_ui_event";
249
273
  const REPLAY_COMPLETE_EVENT = "replay_complete";
274
+ const REPLAY_FAILED_EVENT = "replay_failed";
250
275
  const STREAM_IDLE_EVENT = "stream_idle";
251
276
  const STOP_RUN_EVENT = "stop_run";
252
277
  const CONNECT_STREAM_IDLE_REPLAY_FALLBACK_MS = 100;
278
+ const CONNECT_IDLE_WARNING_MS = 3e4;
253
279
  const MAX_UNOPENED_CREDENTIAL_REFRESHES = 2;
254
280
  var AgentThreadLockedError = class extends Error {
255
281
  constructor(threadId) {
@@ -337,7 +363,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
337
363
  ...parameters,
338
364
  runId: this.canonicalRunId
339
365
  };
340
- return ɵconnectWithoutEventVerification(this, effectiveParameters, subscriber);
366
+ return ɵconnectWithoutEventVerification(this, effectiveParameters, subscriber, (input, lifecycle) => this.connect(input, lifecycle));
341
367
  }
342
368
  abortRun() {
343
369
  if (this.activeChannel && this.canonicalRunId) {
@@ -386,17 +412,23 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
386
412
  * gateway only streams events past it instead of replaying the
387
413
  * entire history every time the chat re-opens a socket.
388
414
  */
389
- connect(input) {
415
+ connect(input, lifecycle) {
390
416
  this.threadId = input.threadId;
391
417
  this.canonicalRunId = null;
392
418
  const replayCursor = this.getReconnectCursor(input);
393
419
  return (0, rxjs.defer)(() => this.requestJoinCredentials$("connect", input, replayCursor)).pipe((0, rxjs.switchMap)((credentials) => {
394
- if (credentials === null) return rxjs.EMPTY;
420
+ if (credentials === null) {
421
+ var _lifecycle$onReplaySt, _lifecycle$onReplayFi;
422
+ lifecycle === null || lifecycle === void 0 || (_lifecycle$onReplaySt = lifecycle.onReplayStarted) === null || _lifecycle$onReplaySt === void 0 || _lifecycle$onReplaySt.call(lifecycle);
423
+ lifecycle === null || lifecycle === void 0 || (_lifecycle$onReplayFi = lifecycle.onReplayFinished) === null || _lifecycle$onReplayFi === void 0 || _lifecycle$onReplayFi.call(lifecycle);
424
+ return rxjs.EMPTY;
425
+ }
395
426
  const canonicalInput = this.applyCanonicalRunIdentity(input, credentials, { fallbackToInputRunId: false });
396
427
  return this.observeThread$(canonicalInput, credentials, {
397
428
  completeOnRunError: false,
398
429
  streamMode: "connect",
399
- replayCursor
430
+ replayCursor,
431
+ lifecycle
400
432
  });
401
433
  }));
402
434
  }
@@ -497,9 +529,26 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
497
529
  }
498
530
  observeThreadSession$(input, credentials, options) {
499
531
  return (0, rxjs.defer)(() => {
500
- var _options$channelMode, _options$replayCursor;
532
+ var _options$lifecycle, _options$lifecycle$on, _options$channelMode, _options$replayCursor;
533
+ (_options$lifecycle = options.lifecycle) === null || _options$lifecycle === void 0 || (_options$lifecycle$on = _options$lifecycle.onReplayStarted) === null || _options$lifecycle$on === void 0 || _options$lifecycle$on.call(_options$lifecycle);
501
534
  let ownSocket = null;
502
535
  let ownChannel = null;
536
+ let replayFinished = false;
537
+ let warnedAboutIdle = false;
538
+ let idleWarning;
539
+ const clearIdleWarning = () => {
540
+ clearTimeout(idleWarning);
541
+ idleWarning = void 0;
542
+ };
543
+ const scheduleIdleWarning = () => {
544
+ clearIdleWarning();
545
+ if (options.streamMode !== "connect" || !replayFinished || warnedAboutIdle) return;
546
+ idleWarning = setTimeout(() => {
547
+ var _this$debugLogger;
548
+ warnedAboutIdle = true;
549
+ (_this$debugLogger = this.debugLogger) === null || _this$debugLogger === void 0 || _this$debugLogger.lifecycle("INTELLIGENCE", "No progress or stream_idle for 30 seconds after replay_complete; the run may still be active or its status unavailable.", { threadId: input.threadId });
550
+ }, CONNECT_IDLE_WARNING_MS);
551
+ };
503
552
  const socket$ = ɵphoenixSocket$({
504
553
  url: credentials.realtime.clientUrl,
505
554
  options: {
@@ -534,19 +583,45 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
534
583
  const threadEvents$ = this.observeThreadEvents$(input.threadId, channel$, options).pipe((0, rxjs_operators.tap)((payload) => {
535
584
  var _this$readEventId;
536
585
  latestObservedReplayCursor = (_this$readEventId = this.readEventId(payload)) !== null && _this$readEventId !== void 0 ? _this$readEventId : latestObservedReplayCursor;
586
+ scheduleIdleWarning();
537
587
  }), (0, rxjs_operators.share)());
538
- const replayComplete$ = this.observeControlEvent$(input.threadId, channel$, REPLAY_COMPLETE_EVENT).pipe((0, rxjs_operators.shareReplay)({
539
- bufferSize: 1,
540
- refCount: true
588
+ const controlCursor = {
589
+ applied: null,
590
+ replayFailed: false
591
+ };
592
+ const replayFailed$ = channel$.pipe((0, rxjs_operators.switchMap)(({ channel }) => this.observeChannelEvent$(channel, REPLAY_FAILED_EVENT)), (0, rxjs_operators.tap)(() => {
593
+ controlCursor.replayFailed = true;
541
594
  }));
542
- const streamIdle$ = this.observeControlEvent$(input.threadId, channel$, STREAM_IDLE_EVENT).pipe((0, rxjs_operators.shareReplay)({
595
+ const replayComplete$ = this.observeControlEvent$(input.threadId, channel$, REPLAY_COMPLETE_EVENT, controlCursor).pipe((0, rxjs_operators.tap)(() => {
596
+ var _options$lifecycle2, _options$lifecycle2$o;
597
+ replayFinished = true;
598
+ scheduleIdleWarning();
599
+ (_options$lifecycle2 = options.lifecycle) === null || _options$lifecycle2 === void 0 || (_options$lifecycle2$o = _options$lifecycle2.onReplayFinished) === null || _options$lifecycle2$o === void 0 || _options$lifecycle2$o.call(_options$lifecycle2);
600
+ }), (0, rxjs_operators.share)());
601
+ const streamIdle$ = this.observeControlEvent$(input.threadId, channel$, STREAM_IDLE_EVENT, controlCursor).pipe((0, rxjs_operators.share)());
602
+ const replayRestart$ = (0, rxjs.merge)(this.observeControlEvent$(input.threadId, channel$, "phx_error", controlCursor), ɵobservePhoenixSocketSignals$(socket$).pipe((0, rxjs_operators.filter)((signal) => signal.type === "error"))).pipe((0, rxjs_operators.tap)(() => {
603
+ var _options$lifecycle3, _options$lifecycle3$o;
604
+ replayFinished = false;
605
+ warnedAboutIdle = false;
606
+ clearIdleWarning();
607
+ (_options$lifecycle3 = options.lifecycle) === null || _options$lifecycle3 === void 0 || (_options$lifecycle3$o = _options$lifecycle3.onReplayStarted) === null || _options$lifecycle3$o === void 0 || _options$lifecycle3$o.call(_options$lifecycle3);
608
+ }), (0, rxjs_operators.share)());
609
+ const streamIdleCompletion$ = options.streamMode === "connect" ? replayRestart$.pipe((0, rxjs_operators.startWith)(null), (0, rxjs.switchMap)(() => (0, rxjs.merge)((0, rxjs.combineLatest)([replayComplete$.pipe((0, rxjs_operators.take)(1)), streamIdle$.pipe((0, rxjs_operators.take)(1))]), streamIdle$.pipe((0, rxjs_operators.take)(1), (0, rxjs_operators.filter)((payload) => this.canFallbackCompleteConnect(payload, reconnectCursor, latestObservedReplayCursor)), (0, rxjs_operators.delay)(CONNECT_STREAM_IDLE_REPLAY_FALLBACK_MS), (0, rxjs_operators.tap)(() => {
610
+ var _this$debugLogger2;
611
+ (_this$debugLogger2 = this.debugLogger) === null || _this$debugLogger2 === void 0 || _this$debugLogger2.lifecycle("INTELLIGENCE", "Completing connection on stream_idle fallback without replay_complete.", {
612
+ threadId: input.threadId,
613
+ fallbackMs: CONNECT_STREAM_IDLE_REPLAY_FALLBACK_MS
614
+ });
615
+ })))), (0, rxjs_operators.take)(1), (0, rxjs_operators.shareReplay)({
543
616
  bufferSize: 1,
544
617
  refCount: true
545
- }));
546
- const streamIdleCompletion$ = options.streamMode === "connect" ? (0, rxjs.merge)((0, rxjs.combineLatest)([replayComplete$.pipe((0, rxjs_operators.take)(1)), streamIdle$.pipe((0, rxjs_operators.take)(1))]), streamIdle$.pipe((0, rxjs_operators.take)(1), (0, rxjs_operators.filter)((payload) => this.canFallbackCompleteConnect(payload, reconnectCursor, latestObservedReplayCursor)), (0, rxjs_operators.delay)(CONNECT_STREAM_IDLE_REPLAY_FALLBACK_MS))).pipe((0, rxjs_operators.take)(1)) : rxjs.EMPTY;
618
+ })) : rxjs.EMPTY;
547
619
  const threadCompleted$ = threadEvents$.pipe((0, rxjs_operators.ignoreElements)(), (0, rxjs_operators.endWith)(null), (0, rxjs_operators.take)(1));
548
620
  const terminal$ = (0, rxjs.merge)(threadCompleted$, streamIdleCompletion$);
549
- return (0, rxjs.merge)(this.joinThreadChannel$(channel$), this.observeSocketHealth$(socket$, options.onSocketOpen).pipe((0, rxjs_operators.takeUntil)(terminal$)), threadEvents$.pipe((0, rxjs_operators.takeUntil)(streamIdleCompletion$)), replayComplete$.pipe((0, rxjs_operators.ignoreElements)(), (0, rxjs_operators.takeUntil)(terminal$)), streamIdleCompletion$.pipe((0, rxjs_operators.ignoreElements)(), (0, rxjs_operators.takeUntil)(threadCompleted$))).pipe((0, rxjs_operators.finalize)(() => this.cleanupOwned(ownChannel, ownSocket)));
621
+ return (0, rxjs.merge)(replayFailed$.pipe((0, rxjs_operators.ignoreElements)(), (0, rxjs_operators.takeUntil)(terminal$)), replayComplete$.pipe((0, rxjs_operators.ignoreElements)(), (0, rxjs_operators.takeUntil)(terminal$)), this.joinThreadChannel$(channel$), this.observeSocketHealth$(socket$, options.onSocketOpen).pipe((0, rxjs_operators.takeUntil)(terminal$)), threadEvents$.pipe((0, rxjs_operators.takeUntil)(streamIdleCompletion$)), streamIdleCompletion$.pipe((0, rxjs_operators.ignoreElements)(), (0, rxjs_operators.takeUntil)(threadCompleted$))).pipe((0, rxjs_operators.finalize)(() => {
622
+ clearIdleWarning();
623
+ this.cleanupOwned(ownChannel, ownSocket);
624
+ }));
550
625
  });
551
626
  }
552
627
  joinThreadChannel$(channel$) {
@@ -566,8 +641,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
566
641
  errorOnRunError: options.streamMode === "run"
567
642
  })), (0, rxjs.dematerialize)());
568
643
  }
569
- observeControlEvent$(threadId, channel$, eventName) {
570
- return channel$.pipe((0, rxjs_operators.switchMap)(({ channel }) => this.observeChannelEvent$(channel, eventName)), (0, rxjs_operators.tap)((payload) => this.updateLastSeenEventIdFromControl(threadId, payload)));
644
+ observeControlEvent$(threadId, channel$, eventName, controlCursor) {
645
+ return channel$.pipe((0, rxjs_operators.switchMap)(({ channel }) => this.observeChannelEvent$(channel, eventName)), (0, rxjs_operators.tap)((payload) => this.updateLastSeenEventIdFromControl(threadId, payload, controlCursor)));
571
646
  }
572
647
  observeChannelEvent$(channel, eventName) {
573
648
  return ɵobservePhoenixEvent$(channel, eventName);
@@ -618,9 +693,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
618
693
  if (!eventId) return;
619
694
  this.advanceLastSeenEventId(threadId, eventId);
620
695
  }
621
- updateLastSeenEventIdFromControl(threadId, payload) {
696
+ updateLastSeenEventIdFromControl(threadId, payload, controlCursor) {
622
697
  const eventId = this.readControlEventId(payload);
623
698
  if (!eventId) return;
699
+ if (eventId === controlCursor.applied && !controlCursor.replayFailed) return;
700
+ controlCursor.applied = eventId;
624
701
  this.advanceLastSeenEventId(threadId, eventId);
625
702
  }
626
703
  advanceLastSeenEventId(threadId, eventId) {
@@ -1031,7 +1108,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1031
1108
  });
1032
1109
  }
1033
1110
  async connectAgent(parameters, subscriber) {
1034
- if (this.runtimeMode !== _copilotkit_shared.RUNTIME_MODE_INTELLIGENCE) return ɵconnectWithoutEventVerification(this, parameters, subscriber);
1111
+ if (this.runtimeMode !== _copilotkit_shared.RUNTIME_MODE_INTELLIGENCE) return ɵconnectWithoutEventVerification(this, parameters, subscriber, (input, lifecycle) => this.connect(input, lifecycle));
1035
1112
  if (this.delegate) await this.delegate.detachActiveRun();
1036
1113
  await this.resolveDelegate();
1037
1114
  const delegate = this.delegate;
@@ -1052,7 +1129,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1052
1129
  this.isRunning = false;
1053
1130
  },
1054
1131
  onRunErrorEvent: () => {
1055
- this.isRunning = false;
1132
+ this.isRunning = delegate.isRunning;
1133
+ },
1134
+ onRunStartedEvent: () => {
1135
+ this.isRunning = delegate.isRunning;
1056
1136
  }
1057
1137
  });
1058
1138
  const forwardedSubs = this.subscribers.map((s) => delegate.subscribe(s));
@@ -1067,9 +1147,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1067
1147
  for (const sub of forwardedSubs) sub.unsubscribe();
1068
1148
  }
1069
1149
  }
1070
- connect(input) {
1071
- if (this.runtimeMode === "pending" || this.transport === "auto" && this.runtimeMode !== _copilotkit_shared.RUNTIME_MODE_INTELLIGENCE) return (0, rxjs.defer)(() => (0, rxjs.from)(this.ensureRuntimeConfiguration())).pipe((0, rxjs_operators.switchMap)(() => this.connect(input)));
1072
- if (this.runtimeMode === _copilotkit_shared.RUNTIME_MODE_INTELLIGENCE) return _assertClassBrand(_ProxiedCopilotRuntimeAgent_brand, this, _connectViaDelegate).call(this, input);
1150
+ connect(input, lifecycle) {
1151
+ if (this.runtimeMode === "pending" || this.transport === "auto" && this.runtimeMode !== _copilotkit_shared.RUNTIME_MODE_INTELLIGENCE) return (0, rxjs.defer)(() => (0, rxjs.from)(this.ensureRuntimeConfiguration())).pipe((0, rxjs_operators.switchMap)(() => this.connect(input, lifecycle)));
1152
+ if (this.runtimeMode === _copilotkit_shared.RUNTIME_MODE_INTELLIGENCE) return _assertClassBrand(_ProxiedCopilotRuntimeAgent_brand, this, _connectViaDelegate).call(this, input, lifecycle);
1073
1153
  return _assertClassBrand(_ProxiedCopilotRuntimeAgent_brand, this, _connectViaHttp).call(this, input);
1074
1154
  }
1075
1155
  run(input) {
@@ -1242,6 +1322,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1242
1322
  delegate.agentId = this.routedAgentId();
1243
1323
  delegate.description = this.description;
1244
1324
  delegate.threadId = this.threadId;
1325
+ delegate.debugLogger = this.debugLogger;
1245
1326
  delegate.setMessages(this.messages);
1246
1327
  delegate.setState(this.state);
1247
1328
  if (hasHeaders(delegate)) delegate.headers = { ...this.headers };
@@ -1297,8 +1378,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1297
1378
  return input;
1298
1379
  }
1299
1380
  }
1300
- function _connectViaDelegate(input) {
1301
- return (0, rxjs.defer)(() => (0, rxjs.from)(this.resolveDelegate())).pipe((0, rxjs_operators.switchMap)((delegate) => withAbortErrorHandling(delegate.connect(input))));
1381
+ function _connectViaDelegate(input, lifecycle) {
1382
+ return (0, rxjs.defer)(() => (0, rxjs.from)(this.resolveDelegate())).pipe((0, rxjs_operators.switchMap)((delegate) => withAbortErrorHandling(delegate.connect(input, lifecycle))));
1302
1383
  }
1303
1384
  function _connectViaHttp(unfiltered) {
1304
1385
  const input = _assertClassBrand(_ProxiedCopilotRuntimeAgent_brand, this, _applyMessageFilter).call(this, unfiltered);
@@ -5552,6 +5633,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5552
5633
  "onMessagesChanged",
5553
5634
  "onStateChanged",
5554
5635
  "onRunInitialized",
5636
+ "onRunStartedEvent",
5555
5637
  "onRunFinalized",
5556
5638
  "onRunFailed",
5557
5639
  "onRunErrorEvent"
@@ -6158,6 +6240,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6158
6240
  const fn = sub.onRunInitialized;
6159
6241
  guarded.onRunInitialized = (params) => safeCall("onRunInitialized", fn, params);
6160
6242
  }
6243
+ if (sub.onRunStartedEvent) {
6244
+ const fn = sub.onRunStartedEvent;
6245
+ guarded.onRunStartedEvent = (params) => safeCall("onRunStartedEvent", fn, params);
6246
+ }
6161
6247
  if (sub.onRunFinalized) {
6162
6248
  const fn = sub.onRunFinalized;
6163
6249
  guarded.onRunFinalized = (params) => safeCall("onRunFinalized", fn, params);
@@ -6209,6 +6295,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6209
6295
  });
6210
6296
  const lifecycleOnly = {};
6211
6297
  if (subscriber.onRunInitialized) lifecycleOnly.onRunInitialized = subscriber.onRunInitialized;
6298
+ if (subscriber.onRunStartedEvent) lifecycleOnly.onRunStartedEvent = subscriber.onRunStartedEvent;
6212
6299
  if (subscriber.onRunFinalized) lifecycleOnly.onRunFinalized = subscriber.onRunFinalized;
6213
6300
  if (subscriber.onRunFailed) lifecycleOnly.onRunFailed = subscriber.onRunFailed;
6214
6301
  if (subscriber.onRunErrorEvent) lifecycleOnly.onRunErrorEvent = subscriber.onRunErrorEvent;