@linzumi/cli 0.0.100-beta → 0.0.101-beta

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/README.md CHANGED
@@ -58,7 +58,7 @@ Install the CLI or run it with `npx`:
58
58
  ```bash
59
59
  npm install -g @linzumi/cli@latest
60
60
  npx -y @linzumi/cli@latest signup
61
- npx -y @linzumi/cli@0.0.100-beta --version
61
+ npx -y @linzumi/cli@0.0.101-beta --version
62
62
  linzumi --version
63
63
  ```
64
64
 
package/dist/index.js CHANGED
@@ -3361,7 +3361,8 @@ async function connectPhoenixClient(baseUrl, token, socketFactory = (url, protoc
3361
3361
  resolveReady: void 0,
3362
3362
  rejectReady: void 0,
3363
3363
  reconnectTimer: void 0,
3364
- reconnectAttempts: 0
3364
+ reconnectAttempts: 0,
3365
+ heartbeatTimer: void 0
3365
3366
  };
3366
3367
  const pushTimeoutMs = options.pushTimeoutMs ?? defaultPushTimeoutMs;
3367
3368
  const controlCursorStore = options.controlCursorStore;
@@ -3751,6 +3752,7 @@ async function connectPhoenixClient(baseUrl, token, socketFactory = (url, protoc
3751
3752
  state.connected = false;
3752
3753
  const websocket = state.websocket;
3753
3754
  state.websocket = void 0;
3755
+ stopHeartbeat();
3754
3756
  if (websocket !== void 0 && (websocket.readyState === WebSocket.CONNECTING || websocket.readyState === WebSocket.OPEN)) {
3755
3757
  try {
3756
3758
  websocket.close();
@@ -3768,6 +3770,29 @@ async function connectPhoenixClient(baseUrl, token, socketFactory = (url, protoc
3768
3770
  });
3769
3771
  }
3770
3772
  };
3773
+ const HEARTBEAT_INTERVAL_MS = 3e4;
3774
+ const stopHeartbeat = () => {
3775
+ if (state.heartbeatTimer !== void 0) {
3776
+ clearInterval(state.heartbeatTimer);
3777
+ state.heartbeatTimer = void 0;
3778
+ }
3779
+ };
3780
+ const startHeartbeat = () => {
3781
+ stopHeartbeat();
3782
+ state.heartbeatTimer = setInterval(() => {
3783
+ const websocket = state.websocket;
3784
+ if (websocket === void 0 || websocket.readyState !== WebSocket.OPEN) {
3785
+ return;
3786
+ }
3787
+ const ref = String(state.nextRef);
3788
+ state.nextRef += 1;
3789
+ try {
3790
+ websocket.send(JSON.stringify([null, ref, "phoenix", "heartbeat", {}]));
3791
+ } catch {
3792
+ }
3793
+ }, HEARTBEAT_INTERVAL_MS);
3794
+ state.heartbeatTimer.unref?.();
3795
+ };
3771
3796
  const openSocket = async () => {
3772
3797
  if (state.closed) {
3773
3798
  return;
@@ -3803,6 +3828,7 @@ async function connectPhoenixClient(baseUrl, token, socketFactory = (url, protoc
3803
3828
  state.connected = true;
3804
3829
  state.hasEverConnected = true;
3805
3830
  state.reconnectAttempts = 0;
3831
+ startHeartbeat();
3806
3832
  markReady();
3807
3833
  if (state.connectionGeneration > 1) {
3808
3834
  reconnectCallbacks.forEach((callback) => {
@@ -19803,7 +19829,7 @@ var linzumiCliVersion, linzumiCliVersionText;
19803
19829
  var init_version = __esm({
19804
19830
  "src/version.ts"() {
19805
19831
  "use strict";
19806
- linzumiCliVersion = "0.0.100-beta";
19832
+ linzumiCliVersion = "0.0.101-beta";
19807
19833
  linzumiCliVersionText = `linzumi ${linzumiCliVersion}`;
19808
19834
  }
19809
19835
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linzumi/cli",
3
- "version": "0.0.100-beta",
3
+ "version": "0.0.101-beta",
4
4
  "description": "Linzumi CLI — point a Codex agent at the real code on your laptop, with your team watching and steering from shared threads.",
5
5
  "type": "module",
6
6
  "bin": {