@copilotkit/core 2.0.0-rc.50 → 2.0.0-rc.51

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
@@ -6087,15 +6087,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6087
6087
  this.onChange = onChange;
6088
6088
  _defineProperty(this, "session", void 0);
6089
6089
  _defineProperty(this, "warned", /* @__PURE__ */ new Set());
6090
- _defineProperty(this, "nextSeq", Math.floor(Date.now()) * 1e3);
6090
+ _defineProperty(this, "nextSeq", void 0);
6091
6091
  }
6092
6092
  get trajectoryId() {
6093
6093
  var _this$session;
6094
6094
  return ((_this$session = this.session) === null || _this$session === void 0 ? void 0 : _this$session.ready) ? this.session.trajectoryId : null;
6095
6095
  }
6096
6096
  start(trajectoryId, config) {
6097
+ var _this$nextSeq;
6097
6098
  if (this.session && (trajectoryId === void 0 || trajectoryId === this.session.trajectoryId)) return this.session.promise;
6098
6099
  this.stop();
6100
+ (_this$nextSeq = this.nextSeq) !== null && _this$nextSeq !== void 0 || (this.nextSeq = Math.floor(Date.now()) * 1e3);
6099
6101
  const id = trajectoryId !== null && trajectoryId !== void 0 ? trajectoryId : crypto.randomUUID();
6100
6102
  let resolveStart;
6101
6103
  const promise = new Promise((resolve) => {
@@ -6432,6 +6434,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6432
6434
  return ((_connection$socket = connection.socket) === null || _connection$socket === void 0 ? void 0 : _connection$socket.isConnected()) === true && ((_connection$channel = connection.channel) === null || _connection$channel === void 0 ? void 0 : _connection$channel.state) === "joined";
6433
6435
  }
6434
6436
  send(session, connection, event) {
6437
+ var _this$nextSeq2;
6435
6438
  if (!this.current(session, connection)) return;
6436
6439
  if (!session.ready) {
6437
6440
  this.addDropped(session, 1, false);
@@ -6442,18 +6445,20 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6442
6445
  this.fail(session, connection, "CONNECTION_LOST");
6443
6446
  return;
6444
6447
  }
6445
- if (!Number.isSafeInteger(this.nextSeq)) {
6448
+ const seq = (_this$nextSeq2 = this.nextSeq) !== null && _this$nextSeq2 !== void 0 ? _this$nextSeq2 : 0;
6449
+ if (!Number.isSafeInteger(seq)) {
6446
6450
  this.addDropped(session, 1);
6447
6451
  this.report(session, "SEQUENCE_EXHAUSTED");
6448
6452
  return;
6449
6453
  }
6454
+ this.nextSeq = seq + 1;
6450
6455
  const original = event.value;
6451
6456
  const fields = isObject(original) && !Array.isArray(original) && !Object.hasOwn(original, "seq") ? original : { data: original };
6452
6457
  const wire = {
6453
6458
  ...event,
6454
6459
  value: {
6455
6460
  ...fields,
6456
- seq: this.nextSeq++
6461
+ seq
6457
6462
  }
6458
6463
  };
6459
6464
  if (byteLength(wire) > MAX_EVENT_BYTES) {