@cadraos/sdk 0.3.8 → 0.3.10

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.
@@ -690,15 +690,6 @@ var ExecutionStreamControllerImpl = class {
690
690
  sseClient = null;
691
691
  status = "connecting";
692
692
  reconnectAttempts = 0;
693
- // CAD-39 / webchat dual-plane create-connect race. `hasConnected` flips true on
694
- // the first successful SSE open; `notFoundRetries` bounds retries of a 404
695
- // encountered BEFORE we ever connect (the run row is persisted slightly AFTER
696
- // the client opens the stream — the norm on the webchat path where msg-api owns
697
- // the executionId and cadra persists the agent_executions row via an async
698
- // worker callback). See handleConnectionError.
699
- hasConnected = false;
700
- notFoundRetries = 0;
701
- maxConnectRaceRetries = 3;
702
693
  seenEventIds = /* @__PURE__ */ new Set();
703
694
  _lastEventId = null;
704
695
  activityTimeoutId = null;
@@ -838,8 +829,6 @@ var ExecutionStreamControllerImpl = class {
838
829
  if (connected) {
839
830
  this.status = "connected";
840
831
  this.reconnectAttempts = 0;
841
- this.hasConnected = true;
842
- this.notFoundRetries = 0;
843
832
  this.resetActivityTimeout();
844
833
  }
845
834
  this.emit("connectionChange", { connected, usingFallback: false });
@@ -1129,38 +1118,6 @@ var ExecutionStreamControllerImpl = class {
1129
1118
  return;
1130
1119
  }
1131
1120
  const msg = error instanceof Error ? error.message : String(error);
1132
- const isNotFound = /\b404\b/.test(msg);
1133
- const isAuthFailure = /\b40[13]\b/.test(msg) || /INVALID_API_KEY|INVALID_REQUEST/.test(msg);
1134
- if (isNotFound && !isAuthFailure && !this.hasConnected) {
1135
- if (this.notFoundRetries < this.maxConnectRaceRetries) {
1136
- this.notFoundRetries++;
1137
- this.status = "reconnecting";
1138
- const delay = Math.min(
1139
- this.config.reconnectBaseDelayMs * this.notFoundRetries,
1140
- this.config.reconnectMaxDelayMs
1141
- );
1142
- await new Promise((resolve) => setTimeout(resolve, delay));
1143
- if (this.status === "closed") {
1144
- return;
1145
- }
1146
- try {
1147
- await this.connectSSE();
1148
- } catch (retryError) {
1149
- await this.handleConnectionError(retryError);
1150
- }
1151
- return;
1152
- }
1153
- if (this.pollingEnabled) {
1154
- if (this.sseClient) {
1155
- this.sseClient.disconnect();
1156
- this.sseClient = null;
1157
- }
1158
- this.status = "fallback_polling";
1159
- this.emit("connectionChange", { connected: false, usingFallback: true });
1160
- this.startPolling();
1161
- return;
1162
- }
1163
- }
1164
1121
  if (/\b4\d\d\b/.test(msg) || /INVALID_API_KEY|INVALID_REQUEST/.test(msg)) {
1165
1122
  if (this.sseClient) {
1166
1123
  this.sseClient.disconnect();