@copilotkit/core 2.0.0-rc.30 → 2.0.0-rc.32

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 (36) hide show
  1. package/dist/a2ui-markdown-BxZr1mEU.mjs +1360 -0
  2. package/dist/a2ui-markdown-BxZr1mEU.mjs.map +1 -0
  3. package/dist/a2ui-markdown-DkMXFQih.cjs +1419 -0
  4. package/dist/a2ui-markdown-DkMXFQih.cjs.map +1 -0
  5. package/dist/chat-configuration.cjs +1 -1
  6. package/dist/chat-configuration.d.cts +1 -1
  7. package/dist/chat-configuration.d.mts +1 -1
  8. package/dist/chat-configuration.mjs +1 -1
  9. package/dist/generative-ui/index.cjs +3121 -0
  10. package/dist/generative-ui/index.cjs.map +1 -0
  11. package/dist/generative-ui/index.d.cts +974 -0
  12. package/dist/generative-ui/index.d.cts.map +1 -0
  13. package/dist/generative-ui/index.d.mts +974 -0
  14. package/dist/generative-ui/index.d.mts.map +1 -0
  15. package/dist/generative-ui/index.mjs +3075 -0
  16. package/dist/generative-ui/index.mjs.map +1 -0
  17. package/dist/index.cjs +45 -1381
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.mts +1 -1
  21. package/dist/index.mjs +36 -1372
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/index.umd.js +28 -14
  24. package/dist/index.umd.js.map +1 -1
  25. package/dist/{learning-bridge-6XU87AJD.d.cts → learning-bridge-C_WCUqF-.d.cts} +9 -2
  26. package/dist/learning-bridge-C_WCUqF-.d.cts.map +1 -0
  27. package/dist/{learning-bridge-JEJAH81x.d.mts → learning-bridge-D30guTHM.d.mts} +9 -2
  28. package/dist/learning-bridge-D30guTHM.d.mts.map +1 -0
  29. package/dist/{viewport-D9ZX0xqz.mjs → viewport-CksL5y8p.mjs} +1 -1
  30. package/dist/{viewport-D9ZX0xqz.mjs.map → viewport-CksL5y8p.mjs.map} +1 -1
  31. package/dist/{viewport-GwjIosf7.cjs → viewport-D-tuKCeb.cjs} +1 -1
  32. package/dist/{viewport-GwjIosf7.cjs.map → viewport-D-tuKCeb.cjs.map} +1 -1
  33. package/package.json +12 -5
  34. package/tsdown.config.ts +5 -0
  35. package/dist/learning-bridge-6XU87AJD.d.cts.map +0 -1
  36. package/dist/learning-bridge-JEJAH81x.d.mts.map +0 -1
package/dist/index.umd.js CHANGED
@@ -385,6 +385,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
385
385
  _defineProperty(this, "socket", null);
386
386
  _defineProperty(this, "activeChannel", null);
387
387
  _defineProperty(this, "canonicalRunId", null);
388
+ _defineProperty(this, "runGeneration", 0);
388
389
  _defineProperty(this, "sharedState", void 0);
389
390
  this.config = config;
390
391
  this.sharedState = sharedState;
@@ -452,18 +453,27 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
452
453
  return ɵconnectWithoutEventVerification(this, effectiveParameters, subscriber, (input, lifecycle) => this.connect(input, lifecycle));
453
454
  }
454
455
  abortRun() {
455
- if (this.activeChannel && this.canonicalRunId) {
456
- const fallback = setTimeout(() => clear(), 5e3);
457
- const clear = () => {
458
- clearTimeout(fallback);
459
- this.detachActiveRun();
460
- this.cleanup();
461
- };
462
- this.activeChannel.push(STOP_RUN_EVENT, { run_id: this.canonicalRunId }).receive("ok", clear).receive("error", clear).receive("timeout", clear);
463
- } else {
456
+ const channel = this.activeChannel;
457
+ const runId = this.canonicalRunId;
458
+ if (!channel || !runId) {
464
459
  this.detachActiveRun();
465
460
  this.cleanup();
461
+ return;
466
462
  }
463
+ const socket = this.socket;
464
+ const generation = this.runGeneration;
465
+ let settled = false;
466
+ const clear = () => {
467
+ if (settled) return;
468
+ settled = true;
469
+ clearTimeout(fallback);
470
+ if (this.runGeneration === generation) {
471
+ this.detachActiveRun();
472
+ this.cleanup();
473
+ } else this.cleanupOwned(channel, socket, runId);
474
+ };
475
+ const fallback = setTimeout(clear, 5e3);
476
+ channel.push(STOP_RUN_EVENT, { run_id: runId }).receive("ok", clear).receive("error", clear).receive("timeout", clear);
467
477
  }
468
478
  /**
469
479
  * Trigger the run via REST, then join the realtime thread channel and relay
@@ -471,6 +481,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
471
481
  */
472
482
  run(input) {
473
483
  if (!isMcpResourceRead(input)) {
484
+ this.runGeneration += 1;
474
485
  this.threadId = input.threadId;
475
486
  this.canonicalRunId = input.runId;
476
487
  }
@@ -511,6 +522,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
511
522
  * entire history every time the chat re-opens a socket.
512
523
  */
513
524
  connect(input, lifecycle) {
525
+ this.runGeneration += 1;
514
526
  this.threadId = input.threadId;
515
527
  this.canonicalRunId = null;
516
528
  const replayCursor = this.getReconnectCursor(input);
@@ -533,9 +545,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
533
545
  /**
534
546
  * Tear down a specific channel + socket pair that belongs to one pipeline.
535
547
  * Only nulls instance references when they still point to the owned resource,
536
- * so a concurrent pipeline's resources are never clobbered.
548
+ * and the run ID only while it is still the owner's, so a concurrent
549
+ * pipeline's resources are never clobbered.
537
550
  */
538
- cleanupOwned(ownChannel, ownSocket) {
551
+ cleanupOwned(ownChannel, ownSocket, ownRunId) {
539
552
  if (ownChannel) {
540
553
  ownChannel.leave();
541
554
  if (this.activeChannel === ownChannel) this.activeChannel = null;
@@ -544,10 +557,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
544
557
  ownSocket.disconnect();
545
558
  if (this.socket === ownSocket) this.socket = null;
546
559
  }
547
- this.canonicalRunId = null;
560
+ if (this.canonicalRunId === ownRunId) this.canonicalRunId = null;
548
561
  }
549
562
  cleanup() {
550
- this.cleanupOwned(this.activeChannel, this.socket);
563
+ this.cleanupOwned(this.activeChannel, this.socket, this.canonicalRunId);
551
564
  }
552
565
  requestJoinCredentials$(mode, input, replayCursor) {
553
566
  return (0, rxjs.defer)(async () => {
@@ -642,6 +655,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
642
655
  (_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);
643
656
  let ownSocket = null;
644
657
  let ownChannel = null;
658
+ const ownRunId = this.canonicalRunId;
645
659
  let replayFinished = false;
646
660
  let warnedAboutIdle = false;
647
661
  let idleWarning;
@@ -729,7 +743,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
729
743
  const terminal$ = (0, rxjs.merge)(threadCompleted$, streamIdleCompletion$);
730
744
  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)(() => {
731
745
  clearIdleWarning();
732
- this.cleanupOwned(ownChannel, ownSocket);
746
+ this.cleanupOwned(ownChannel, ownSocket, ownRunId);
733
747
  }));
734
748
  });
735
749
  }