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