@cadraos/sdk 0.3.6 → 0.3.8
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/chat/index.cjs +47 -6
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.d.cts +9 -1
- package/dist/chat/index.d.ts +9 -1
- package/dist/chat/index.js +47 -6
- package/dist/chat/index.js.map +1 -1
- package/dist/index.cjs +43 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -4
- package/dist/index.js.map +1 -1
- package/dist/kanban/engine/index.cjs +0 -6
- package/dist/kanban/engine/index.cjs.map +1 -1
- package/dist/kanban/engine/index.js +0 -6
- package/dist/kanban/engine/index.js.map +1 -1
- package/dist/kanban/index.cjs +43 -4
- package/dist/kanban/index.cjs.map +1 -1
- package/dist/kanban/index.js +43 -4
- package/dist/kanban/index.js.map +1 -1
- package/dist/teams/index.cjs +43 -4
- package/dist/teams/index.cjs.map +1 -1
- package/dist/teams/index.js +43 -4
- package/dist/teams/index.js.map +1 -1
- package/package.json +1 -1
package/dist/kanban/index.js
CHANGED
|
@@ -3668,6 +3668,15 @@ var ExecutionStreamControllerImpl = class {
|
|
|
3668
3668
|
sseClient = null;
|
|
3669
3669
|
status = "connecting";
|
|
3670
3670
|
reconnectAttempts = 0;
|
|
3671
|
+
// CAD-39 / webchat dual-plane create-connect race. `hasConnected` flips true on
|
|
3672
|
+
// the first successful SSE open; `notFoundRetries` bounds retries of a 404
|
|
3673
|
+
// encountered BEFORE we ever connect (the run row is persisted slightly AFTER
|
|
3674
|
+
// the client opens the stream — the norm on the webchat path where msg-api owns
|
|
3675
|
+
// the executionId and cadra persists the agent_executions row via an async
|
|
3676
|
+
// worker callback). See handleConnectionError.
|
|
3677
|
+
hasConnected = false;
|
|
3678
|
+
notFoundRetries = 0;
|
|
3679
|
+
maxConnectRaceRetries = 3;
|
|
3671
3680
|
seenEventIds = /* @__PURE__ */ new Set();
|
|
3672
3681
|
_lastEventId = null;
|
|
3673
3682
|
activityTimeoutId = null;
|
|
@@ -3807,6 +3816,8 @@ var ExecutionStreamControllerImpl = class {
|
|
|
3807
3816
|
if (connected) {
|
|
3808
3817
|
this.status = "connected";
|
|
3809
3818
|
this.reconnectAttempts = 0;
|
|
3819
|
+
this.hasConnected = true;
|
|
3820
|
+
this.notFoundRetries = 0;
|
|
3810
3821
|
this.resetActivityTimeout();
|
|
3811
3822
|
}
|
|
3812
3823
|
this.emit("connectionChange", { connected, usingFallback: false });
|
|
@@ -4096,6 +4107,38 @@ var ExecutionStreamControllerImpl = class {
|
|
|
4096
4107
|
return;
|
|
4097
4108
|
}
|
|
4098
4109
|
const msg = error instanceof Error ? error.message : String(error);
|
|
4110
|
+
const isNotFound = /\b404\b/.test(msg);
|
|
4111
|
+
const isAuthFailure = /\b40[13]\b/.test(msg) || /INVALID_API_KEY|INVALID_REQUEST/.test(msg);
|
|
4112
|
+
if (isNotFound && !isAuthFailure && !this.hasConnected) {
|
|
4113
|
+
if (this.notFoundRetries < this.maxConnectRaceRetries) {
|
|
4114
|
+
this.notFoundRetries++;
|
|
4115
|
+
this.status = "reconnecting";
|
|
4116
|
+
const delay = Math.min(
|
|
4117
|
+
this.config.reconnectBaseDelayMs * this.notFoundRetries,
|
|
4118
|
+
this.config.reconnectMaxDelayMs
|
|
4119
|
+
);
|
|
4120
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
4121
|
+
if (this.status === "closed") {
|
|
4122
|
+
return;
|
|
4123
|
+
}
|
|
4124
|
+
try {
|
|
4125
|
+
await this.connectSSE();
|
|
4126
|
+
} catch (retryError) {
|
|
4127
|
+
await this.handleConnectionError(retryError);
|
|
4128
|
+
}
|
|
4129
|
+
return;
|
|
4130
|
+
}
|
|
4131
|
+
if (this.pollingEnabled) {
|
|
4132
|
+
if (this.sseClient) {
|
|
4133
|
+
this.sseClient.disconnect();
|
|
4134
|
+
this.sseClient = null;
|
|
4135
|
+
}
|
|
4136
|
+
this.status = "fallback_polling";
|
|
4137
|
+
this.emit("connectionChange", { connected: false, usingFallback: true });
|
|
4138
|
+
this.startPolling();
|
|
4139
|
+
return;
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4099
4142
|
if (/\b4\d\d\b/.test(msg) || /INVALID_API_KEY|INVALID_REQUEST/.test(msg)) {
|
|
4100
4143
|
if (this.sseClient) {
|
|
4101
4144
|
this.sseClient.disconnect();
|
|
@@ -4345,7 +4388,6 @@ var AgentsAPI = class extends BaseResourceAPI {
|
|
|
4345
4388
|
super(http, "/api/v1/agents");
|
|
4346
4389
|
this.getStreamConfig = getStreamConfig;
|
|
4347
4390
|
}
|
|
4348
|
-
getStreamConfig;
|
|
4349
4391
|
// ===== LIST Operations =====
|
|
4350
4392
|
/**
|
|
4351
4393
|
* List all agents in the organization
|
|
@@ -5251,7 +5293,6 @@ var SessionsAPI = class extends BaseResourceAPI {
|
|
|
5251
5293
|
super(http, "/api/v1/sessions");
|
|
5252
5294
|
this.getStreamConfig = getStreamConfig;
|
|
5253
5295
|
}
|
|
5254
|
-
getStreamConfig;
|
|
5255
5296
|
// ===== LIST Operations =====
|
|
5256
5297
|
/**
|
|
5257
5298
|
* List all sessions in the organization
|
|
@@ -5571,7 +5612,6 @@ var KanbanAPI = class extends BaseResourceAPI {
|
|
|
5571
5612
|
super(http, "/api/v1/kanban");
|
|
5572
5613
|
this.getStreamConfig = getStreamConfig;
|
|
5573
5614
|
}
|
|
5574
|
-
getStreamConfig;
|
|
5575
5615
|
// ===== BOARD =====
|
|
5576
5616
|
/**
|
|
5577
5617
|
* Get the current org's board (lanes in declared order). Auto-provisions
|
|
@@ -5773,7 +5813,6 @@ var RemoteAgentsAPI = class extends BaseResourceAPI {
|
|
|
5773
5813
|
super(http, "/api/v1/remote-agents");
|
|
5774
5814
|
this.getStreamConfig = getStreamConfig;
|
|
5775
5815
|
}
|
|
5776
|
-
getStreamConfig;
|
|
5777
5816
|
/**
|
|
5778
5817
|
* List all remote agents in the organization
|
|
5779
5818
|
*
|