@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.cjs CHANGED
@@ -5901,7 +5901,7 @@ function errorCode(value, fallback) {
5901
5901
  var TrajectoryConnection = class {
5902
5902
  session;
5903
5903
  warned = /* @__PURE__ */ new Set();
5904
- nextSeq = Math.floor(Date.now()) * 1e3;
5904
+ nextSeq;
5905
5905
  constructor(core, onChange) {
5906
5906
  this.core = core;
5907
5907
  this.onChange = onChange;
@@ -5912,6 +5912,7 @@ var TrajectoryConnection = class {
5912
5912
  start(trajectoryId, config) {
5913
5913
  if (this.session && (trajectoryId === void 0 || trajectoryId === this.session.trajectoryId)) return this.session.promise;
5914
5914
  this.stop();
5915
+ this.nextSeq ??= Math.floor(Date.now()) * 1e3;
5915
5916
  const id = trajectoryId ?? crypto.randomUUID();
5916
5917
  let resolveStart;
5917
5918
  const promise = new Promise((resolve) => {
@@ -6250,18 +6251,20 @@ var TrajectoryConnection = class {
6250
6251
  this.fail(session, connection, "CONNECTION_LOST");
6251
6252
  return;
6252
6253
  }
6253
- if (!Number.isSafeInteger(this.nextSeq)) {
6254
+ const seq = this.nextSeq ?? 0;
6255
+ if (!Number.isSafeInteger(seq)) {
6254
6256
  this.addDropped(session, 1);
6255
6257
  this.report(session, "SEQUENCE_EXHAUSTED");
6256
6258
  return;
6257
6259
  }
6260
+ this.nextSeq = seq + 1;
6258
6261
  const original = event.value;
6259
6262
  const fields = isObject(original) && !Array.isArray(original) && !Object.hasOwn(original, "seq") ? original : { data: original };
6260
6263
  const wire = {
6261
6264
  ...event,
6262
6265
  value: {
6263
6266
  ...fields,
6264
- seq: this.nextSeq++
6267
+ seq
6265
6268
  }
6266
6269
  };
6267
6270
  if (byteLength(wire) > MAX_EVENT_BYTES) {