@love-moon/conductor-sdk 0.17.1 → 0.18.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @love-moon/conductor-sdk
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 924f51c: Time out stalled WebSocket handshakes so a fire can no longer wedge forever
8
+ mid-reconnect, and let an in-place restart replace a task's tmux fire that the
9
+ server sees as disconnected instead of refusing with "task already active".
10
+
11
+ ## 0.17.2
12
+
3
13
  ## 0.17.1
4
14
 
5
15
  ## 0.17.0
@@ -17,6 +17,7 @@ export interface WebSocketLike {
17
17
  }
18
18
  export interface ConnectOptions {
19
19
  headers: Record<string, string>;
20
+ handshakeTimeout?: number;
20
21
  }
21
22
  export type ConnectImpl = (url: string, options: ConnectOptions) => Promise<WebSocketLike>;
22
23
  export interface WebSocketConnectedEvent {
@@ -101,3 +102,4 @@ export declare class ConductorWebSocketClient {
101
102
  private closeConnection;
102
103
  private terminateConnection;
103
104
  }
105
+ export declare function defaultConnectImpl(url: string, options: ConnectOptions): Promise<WebSocketLike>;
package/dist/ws/client.js CHANGED
@@ -432,12 +432,16 @@ async function wait(ms, signal) {
432
432
  function formatBeijingTimestamp(date = new Date()) {
433
433
  return date.toLocaleString('sv-SE', { timeZone: 'Asia/Shanghai', hour12: false }).replace(' ', 'T');
434
434
  }
435
- async function defaultConnectImpl(url, options) {
435
+ const HANDSHAKE_TIMEOUT_MS = 30_000;
436
+ export async function defaultConnectImpl(url, options) {
436
437
  const { default: WebSocket } = await import('ws');
437
438
  return new Promise((resolve, reject) => {
438
439
  const ws = new WebSocket(url, {
439
440
  headers: options.headers,
440
441
  perMessageDeflate: false,
442
+ // Without this a handshake stalled on a lossy link never settles, and
443
+ // openConnection waits on it forever while holding the reconnect lock.
444
+ handshakeTimeout: options.handshakeTimeout ?? HANDSHAKE_TIMEOUT_MS,
441
445
  });
442
446
  ws.once('open', () => resolve(new WsAdapter(ws)));
443
447
  ws.once('error', (err) => reject(err));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@love-moon/conductor-sdk",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lovemoon-ai/conductor.git"
@@ -33,5 +33,5 @@
33
33
  "typescript": "^5.6.3",
34
34
  "vitest": "^2.1.4"
35
35
  },
36
- "gitCommitId": "e3dbbad"
36
+ "gitCommitId": "825d90a"
37
37
  }