@pulso/companion 0.1.0 → 0.1.2
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.js +16 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -177,6 +177,8 @@ async function handleCommand(command, params) {
|
|
|
177
177
|
}
|
|
178
178
|
var ws = null;
|
|
179
179
|
var reconnectTimer = null;
|
|
180
|
+
var heartbeatTimer = null;
|
|
181
|
+
var HEARTBEAT_INTERVAL = 3e4;
|
|
180
182
|
function connect() {
|
|
181
183
|
console.log("\u{1F50C} Connecting to Pulso...");
|
|
182
184
|
console.log(` ${WS_URL.replace(/token=.*/, "token=***")}`);
|
|
@@ -199,6 +201,12 @@ function connect() {
|
|
|
199
201
|
console.log(` Access: ${ACCESS_LEVEL === "full" ? "\u{1F513} Full (unrestricted)" : "\u{1F512} Sandboxed (safe dirs only)"}`);
|
|
200
202
|
console.log(" Waiting for commands from Pulso agent...");
|
|
201
203
|
ws.send(JSON.stringify({ type: "extension_ready" }));
|
|
204
|
+
if (heartbeatTimer) clearInterval(heartbeatTimer);
|
|
205
|
+
heartbeatTimer = setInterval(() => {
|
|
206
|
+
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
207
|
+
ws.send(JSON.stringify({ type: "ping" }));
|
|
208
|
+
}
|
|
209
|
+
}, HEARTBEAT_INTERVAL);
|
|
202
210
|
});
|
|
203
211
|
ws.on("message", async (raw) => {
|
|
204
212
|
try {
|
|
@@ -207,6 +215,9 @@ function connect() {
|
|
|
207
215
|
console.log(` \u2713 Server: ${msg.message}`);
|
|
208
216
|
return;
|
|
209
217
|
}
|
|
218
|
+
if (msg.type === "pong") {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
210
221
|
if (msg.id && msg.command) {
|
|
211
222
|
console.log(`
|
|
212
223
|
\u26A1 Command: ${msg.command}`, msg.params ? JSON.stringify(msg.params).slice(0, 200) : "");
|
|
@@ -223,6 +234,10 @@ function connect() {
|
|
|
223
234
|
ws.on("close", (code, reason) => {
|
|
224
235
|
console.log(`
|
|
225
236
|
\u{1F50C} Disconnected (${code}: ${reason.toString() || "unknown"})`);
|
|
237
|
+
if (heartbeatTimer) {
|
|
238
|
+
clearInterval(heartbeatTimer);
|
|
239
|
+
heartbeatTimer = null;
|
|
240
|
+
}
|
|
226
241
|
scheduleReconnect();
|
|
227
242
|
});
|
|
228
243
|
ws.on("error", (err) => {
|
|
@@ -239,7 +254,7 @@ function scheduleReconnect() {
|
|
|
239
254
|
}
|
|
240
255
|
console.log("");
|
|
241
256
|
console.log(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
|
|
242
|
-
console.log(" \u2551 \u{1FAC0} Pulso Mac Companion v0.1.
|
|
257
|
+
console.log(" \u2551 \u{1FAC0} Pulso Mac Companion v0.1.2 \u2551");
|
|
243
258
|
console.log(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
|
|
244
259
|
console.log("");
|
|
245
260
|
connect();
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulso/companion",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pulso Companion — gives your AI agent real control over your computer",
|
|
6
6
|
"bin": {
|
|
7
|
-
"pulso-companion": "
|
|
7
|
+
"pulso-companion": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/pulso-dev/pulso"
|
|
29
|
+
"url": "git+https://github.com/pulso-dev/pulso.git"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": ">=18.0.0"
|