@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.
package/dist/index.cjs CHANGED
@@ -677,15 +677,6 @@ var ExecutionStreamControllerImpl = class {
677
677
  sseClient = null;
678
678
  status = "connecting";
679
679
  reconnectAttempts = 0;
680
- // CAD-39 / webchat dual-plane create-connect race. `hasConnected` flips true on
681
- // the first successful SSE open; `notFoundRetries` bounds retries of a 404
682
- // encountered BEFORE we ever connect (the run row is persisted slightly AFTER
683
- // the client opens the stream — the norm on the webchat path where msg-api owns
684
- // the executionId and cadra persists the agent_executions row via an async
685
- // worker callback). See handleConnectionError.
686
- hasConnected = false;
687
- notFoundRetries = 0;
688
- maxConnectRaceRetries = 3;
689
680
  seenEventIds = /* @__PURE__ */ new Set();
690
681
  _lastEventId = null;
691
682
  activityTimeoutId = null;
@@ -825,8 +816,6 @@ var ExecutionStreamControllerImpl = class {
825
816
  if (connected) {
826
817
  this.status = "connected";
827
818
  this.reconnectAttempts = 0;
828
- this.hasConnected = true;
829
- this.notFoundRetries = 0;
830
819
  this.resetActivityTimeout();
831
820
  }
832
821
  this.emit("connectionChange", { connected, usingFallback: false });
@@ -1116,38 +1105,6 @@ var ExecutionStreamControllerImpl = class {
1116
1105
  return;
1117
1106
  }
1118
1107
  const msg = error instanceof Error ? error.message : String(error);
1119
- const isNotFound = /\b404\b/.test(msg);
1120
- const isAuthFailure = /\b40[13]\b/.test(msg) || /INVALID_API_KEY|INVALID_REQUEST/.test(msg);
1121
- if (isNotFound && !isAuthFailure && !this.hasConnected) {
1122
- if (this.notFoundRetries < this.maxConnectRaceRetries) {
1123
- this.notFoundRetries++;
1124
- this.status = "reconnecting";
1125
- const delay = Math.min(
1126
- this.config.reconnectBaseDelayMs * this.notFoundRetries,
1127
- this.config.reconnectMaxDelayMs
1128
- );
1129
- await new Promise((resolve) => setTimeout(resolve, delay));
1130
- if (this.status === "closed") {
1131
- return;
1132
- }
1133
- try {
1134
- await this.connectSSE();
1135
- } catch (retryError) {
1136
- await this.handleConnectionError(retryError);
1137
- }
1138
- return;
1139
- }
1140
- if (this.pollingEnabled) {
1141
- if (this.sseClient) {
1142
- this.sseClient.disconnect();
1143
- this.sseClient = null;
1144
- }
1145
- this.status = "fallback_polling";
1146
- this.emit("connectionChange", { connected: false, usingFallback: true });
1147
- this.startPolling();
1148
- return;
1149
- }
1150
- }
1151
1108
  if (/\b4\d\d\b/.test(msg) || /INVALID_API_KEY|INVALID_REQUEST/.test(msg)) {
1152
1109
  if (this.sseClient) {
1153
1110
  this.sseClient.disconnect();