@cliphijack/santaclaude 1.0.0 → 1.0.1
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/package.json +1 -1
- package/santaclaude.js +17 -3
package/package.json
CHANGED
package/santaclaude.js
CHANGED
|
@@ -252,10 +252,24 @@ async function run(conf) {
|
|
|
252
252
|
ws.addEventListener('close', () => { clearInterval(hbIv); console.log(' 🔌 연결 끊김 — 5초 후 재연결'); setTimeout(connectWS, 5000); });
|
|
253
253
|
ws.addEventListener('error', () => { try { ws.close(); } catch (e) {} });
|
|
254
254
|
}
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
// 폴링 폴백 (node<21 = WebSocket 미지원) — 워커가 DO 백엔드라 폴링이어도 KV write 0
|
|
256
|
+
async function pollTick() {
|
|
257
|
+
try {
|
|
258
|
+
post(api, '/api/heartbeat', { token, pane, sessions: listWindows(session), screens: captureAll(session) }).catch(() => {});
|
|
259
|
+
post(api, '/api/control/claim', { token }).then((c) => { for (const cmd of (c && c.commands) || []) runControl(cmd); }).catch(() => {});
|
|
260
|
+
const d = await post(api, '/api/jobs/claim', { token });
|
|
261
|
+
for (const j of (d.jobs || [])) onJob(j);
|
|
262
|
+
} catch (e) {}
|
|
263
|
+
}
|
|
257
264
|
const scanIv = setInterval(scanPublish, Math.max(every, 10000)); // 로컬 클린등록 폴더 감지(주기)
|
|
258
|
-
|
|
265
|
+
if (typeof WebSocket !== 'undefined') {
|
|
266
|
+
connectWS();
|
|
267
|
+
process.on('SIGINT', () => { clearInterval(hbIv); clearInterval(scanIv); try { ws && ws.close(); } catch (e) {} console.log('\n🛷 커넥터 종료. 너의 루돌프들은 자러 간다.'); process.exit(0); });
|
|
268
|
+
} else {
|
|
269
|
+
console.log(` ℹ️ 이 node는 WebSocket(21+) 미지원 — 폴링 모드로 동작 (DO 백엔드라 KV write 0 동일, 발사 ±${Math.round(every / 1000)}초). node 21+ 쓰면 자동 WebSocket.`);
|
|
270
|
+
await pollTick(); const pollIv = setInterval(pollTick, every);
|
|
271
|
+
process.on('SIGINT', () => { clearInterval(pollIv); clearInterval(scanIv); console.log('\n🛷 커넥터 종료. 너의 루돌프들은 자러 간다.'); process.exit(0); });
|
|
272
|
+
}
|
|
259
273
|
}
|
|
260
274
|
|
|
261
275
|
async function main() {
|