@cloop/runner 0.3.24 → 0.3.27
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 +2 -2
- package/dist/{box-OGT2NRPJ.js → box-TENZ3P6J.js} +157 -32
- package/dist/{chunk-YEO27QQP.js → chunk-365HFCQQ.js} +1 -1
- package/dist/{chunk-6F2ZM5H3.js → chunk-3OF5FEMG.js} +1 -1
- package/dist/{chunk-UVB722OW.js → chunk-C6EAR65U.js} +1 -1
- package/dist/{chunk-PQPWITU3.js → chunk-CC2S6H4W.js} +197 -54
- package/dist/{chunk-IXG4H623.js → chunk-KDO735VV.js} +5 -5
- package/dist/{chunk-IJH4O27H.js → chunk-KYGYU5G2.js} +65 -2
- package/dist/{chunk-F4UQ2H5F.js → chunk-MRP3S5DT.js} +1 -1
- package/dist/{chunk-R3CLO2FB.js → chunk-PKIEWBR7.js} +2 -0
- package/dist/{chunk-NVESLEXA.js → chunk-PUKYUGWD.js} +26 -7
- package/dist/{chunk-VH7XVQFJ.js → chunk-U57DZQSE.js} +1 -1
- package/dist/{chunk-MHKSBXUD.js → chunk-ZYU7Y2SE.js} +6 -6
- package/dist/{connect-7DUV7BMO.js → connect-YAFC76SG.js} +9 -8
- package/dist/{disconnect-IWGVQ2GZ.js → disconnect-AJBQUDE3.js} +9 -8
- package/dist/existing-runner-FWDDD3L2.js +21 -0
- package/dist/index.js +23 -23
- package/dist/{login-J3N7TYDI.js → login-TALFCKAD.js} +2 -2
- package/dist/{mcp-server-HPMJRI6J.js → mcp-server-RUK3JL4O.js} +5 -5
- package/dist/{read-permissions-SPOKGVLO.js → read-permissions-EGSGI4HL.js} +1 -1
- package/dist/{runner-TMR3BBL5.js → runner-GOT6CIJW.js} +3 -3
- package/dist/{runs-S3QKEWHY.js → runs-SUZJHP7M.js} +2 -2
- package/dist/{statusline-UIG25UUX.js → statusline-XHSO6GCX.js} +1 -1
- package/dist/{takeover-3U5V2KXY.js → takeover-B63GSUZW.js} +4 -4
- package/dist/{use-I2KUA64A.js → use-L4CIPDJZ.js} +10 -9
- package/package.json +2 -2
- package/dist/existing-runner-4UYED6LY.js +0 -20
package/README.md
CHANGED
|
@@ -12,9 +12,9 @@ cloop install # register the MCP server with Claude Code / others
|
|
|
12
12
|
|
|
13
13
|
Credentials live in `~/.cloop/credentials.json`. The API origin comes from `CLOOP_ORIGIN`, the stored value, or the staging default.
|
|
14
14
|
|
|
15
|
-
`npx -y @cloop/runner@latest connect` makes this
|
|
15
|
+
`npx -y @cloop/runner@latest connect` makes this computer a Cloop machine. As its last step, it adds the remote Cloop MCP server to each Claude Code and Codex on the machine, and signs it in with OAuth on a terminal. It runs the usual lines: `claude mcp add -s user --transport http cloop https://app.mycloop.com/api/mcp/mcp` and `codex mcp add cloop --url https://app.mycloop.com/api/mcp/mcp`, then `claude mcp login cloop` and `codex mcp login cloop`. Staging uses the name `cloop-staging` and `https://mcp-staging.mycloop.com/mcp`. When an entry under any name already has the URL, `connect` adds nothing. This step never makes `connect` fail. Details: `docs/runbooks/cloop-local.md`, "Connect", step 5.
|
|
16
16
|
|
|
17
|
-
To disconnect a
|
|
17
|
+
To disconnect a machine, use Disconnect in its ⋯ menu on the Threads page.
|
|
18
18
|
|
|
19
19
|
### Windows
|
|
20
20
|
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
MeshSocket,
|
|
4
|
-
defaultSocketFactory
|
|
5
|
-
} from "./chunk-IJH4O27H.js";
|
|
6
2
|
import {
|
|
7
3
|
serveTakeovers
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-ZYU7Y2SE.js";
|
|
5
|
+
import "./chunk-MRP3S5DT.js";
|
|
10
6
|
import {
|
|
11
7
|
DEFAULT_FALLBACK_MODEL,
|
|
12
8
|
SUBSCRIPTIONS,
|
|
9
|
+
answerCall,
|
|
13
10
|
awaitDaemon,
|
|
11
|
+
buildDiag,
|
|
12
|
+
classifyError,
|
|
14
13
|
claudeDialect,
|
|
15
14
|
cmdWord,
|
|
16
15
|
codexDialect,
|
|
@@ -27,14 +26,20 @@ import {
|
|
|
27
26
|
probeCodex,
|
|
28
27
|
programFor,
|
|
29
28
|
psQuote,
|
|
30
|
-
runBoxTool,
|
|
31
29
|
runSteps,
|
|
30
|
+
runnerLog,
|
|
32
31
|
serviceEnv,
|
|
33
32
|
stopService,
|
|
34
33
|
systemServices,
|
|
35
34
|
unitFor,
|
|
36
35
|
which
|
|
37
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-CC2S6H4W.js";
|
|
37
|
+
import {
|
|
38
|
+
MeshSocket,
|
|
39
|
+
WAKE_TICK_MS,
|
|
40
|
+
defaultSocketFactory,
|
|
41
|
+
wakeWatch
|
|
42
|
+
} from "./chunk-KYGYU5G2.js";
|
|
38
43
|
import {
|
|
39
44
|
BoxWatch,
|
|
40
45
|
hostedThreadsFilePath,
|
|
@@ -43,7 +48,7 @@ import {
|
|
|
43
48
|
runnerStatePath,
|
|
44
49
|
threadsFilePath,
|
|
45
50
|
writeRunnerState
|
|
46
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-3OF5FEMG.js";
|
|
47
52
|
import {
|
|
48
53
|
BackgroundReading,
|
|
49
54
|
BoxToolError,
|
|
@@ -61,6 +66,8 @@ import {
|
|
|
61
66
|
addTokens,
|
|
62
67
|
commandFor,
|
|
63
68
|
failedEnd,
|
|
69
|
+
finalWords,
|
|
70
|
+
hasResultBlock,
|
|
64
71
|
isHosted,
|
|
65
72
|
isLocal,
|
|
66
73
|
isT3,
|
|
@@ -71,6 +78,7 @@ import {
|
|
|
71
78
|
readRunResult,
|
|
72
79
|
readRunnerConfig,
|
|
73
80
|
resultPrUrl,
|
|
81
|
+
resultText,
|
|
74
82
|
runnerDir,
|
|
75
83
|
runnerEnvironment,
|
|
76
84
|
runnerPath,
|
|
@@ -80,21 +88,21 @@ import {
|
|
|
80
88
|
utcWindow,
|
|
81
89
|
windowsPowerShellEnv,
|
|
82
90
|
writeBoxConfig
|
|
83
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-PUKYUGWD.js";
|
|
84
92
|
import {
|
|
85
93
|
getMachine
|
|
86
94
|
} from "./chunk-NTXQLEMQ.js";
|
|
87
95
|
import "./chunk-VK6GV757.js";
|
|
88
96
|
import {
|
|
89
97
|
olderThan
|
|
90
|
-
} from "./chunk-
|
|
91
|
-
import "./chunk-
|
|
92
|
-
import "./chunk-
|
|
93
|
-
import "./chunk-
|
|
98
|
+
} from "./chunk-365HFCQQ.js";
|
|
99
|
+
import "./chunk-PKIEWBR7.js";
|
|
100
|
+
import "./chunk-KDO735VV.js";
|
|
101
|
+
import "./chunk-C6EAR65U.js";
|
|
94
102
|
import "./chunk-ES5BRAKJ.js";
|
|
95
103
|
import {
|
|
96
104
|
VERSION
|
|
97
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-U57DZQSE.js";
|
|
98
106
|
import {
|
|
99
107
|
getMeshUrl,
|
|
100
108
|
getOrigin,
|
|
@@ -612,6 +620,7 @@ function apply(fold, r) {
|
|
|
612
620
|
const turn = turnOf(fold, r.request);
|
|
613
621
|
if (!turn) return null;
|
|
614
622
|
if (turn.item !== r.item) {
|
|
623
|
+
if (hasResultBlock(turn.text)) turn.block = turn.text;
|
|
615
624
|
turn.item = r.item;
|
|
616
625
|
turn.text = "";
|
|
617
626
|
}
|
|
@@ -623,6 +632,7 @@ function apply(fold, r) {
|
|
|
623
632
|
if (!turn) return null;
|
|
624
633
|
turn.item = r.item;
|
|
625
634
|
turn.text = r.text;
|
|
635
|
+
if (hasResultBlock(r.text)) turn.block = r.text;
|
|
626
636
|
return turn;
|
|
627
637
|
}
|
|
628
638
|
case "usage_limited": {
|
|
@@ -664,9 +674,9 @@ function runEnd(fold, harness) {
|
|
|
664
674
|
}
|
|
665
675
|
if (last.state === "completed" && !last.limited) {
|
|
666
676
|
const text = last.text.trim();
|
|
667
|
-
const result = readRunResult(text).result;
|
|
677
|
+
const result = readRunResult(resultText(text, last.block)).result;
|
|
668
678
|
const pr = resultPrUrl(text);
|
|
669
|
-
const summary = text
|
|
679
|
+
const summary = finalWords(text).slice(0, RUN_TEXT_MAX);
|
|
670
680
|
return {
|
|
671
681
|
kind: "settled",
|
|
672
682
|
...result ? { result } : {},
|
|
@@ -1666,6 +1676,52 @@ async function listOutsideSessions(root = join3(homedir2(), ".claude", "projects
|
|
|
1666
1676
|
return results;
|
|
1667
1677
|
}
|
|
1668
1678
|
|
|
1679
|
+
// src/result-outbox.ts
|
|
1680
|
+
var OUTBOX_MAX = 50;
|
|
1681
|
+
var OUTBOX_KEEP_MS = 24 * 36e5;
|
|
1682
|
+
var ResultOutbox = class {
|
|
1683
|
+
constructor(deps) {
|
|
1684
|
+
this.deps = deps;
|
|
1685
|
+
}
|
|
1686
|
+
deps;
|
|
1687
|
+
held = /* @__PURE__ */ new Map();
|
|
1688
|
+
acking = false;
|
|
1689
|
+
get size() {
|
|
1690
|
+
return this.held.size;
|
|
1691
|
+
}
|
|
1692
|
+
send(frame) {
|
|
1693
|
+
this.held.delete(frame.id);
|
|
1694
|
+
this.held.set(frame.id, { frame, at: this.now() });
|
|
1695
|
+
this.trim();
|
|
1696
|
+
this.deps.send(frame);
|
|
1697
|
+
}
|
|
1698
|
+
ack(id) {
|
|
1699
|
+
this.acking = true;
|
|
1700
|
+
this.held.delete(id);
|
|
1701
|
+
}
|
|
1702
|
+
/** Sends every unacked result again, oldest first. Answers how many went. */
|
|
1703
|
+
resend() {
|
|
1704
|
+
this.trim();
|
|
1705
|
+
if (!this.acking) return 0;
|
|
1706
|
+
let sent = 0;
|
|
1707
|
+
for (const { frame } of this.held.values()) if (this.deps.send(frame)) sent++;
|
|
1708
|
+
return sent;
|
|
1709
|
+
}
|
|
1710
|
+
now() {
|
|
1711
|
+
return (this.deps.now ?? Date.now)();
|
|
1712
|
+
}
|
|
1713
|
+
trim() {
|
|
1714
|
+
const oldest = this.now() - OUTBOX_KEEP_MS;
|
|
1715
|
+
let dropped = 0;
|
|
1716
|
+
for (const [id, { at }] of this.held) {
|
|
1717
|
+
if (at >= oldest && this.held.size <= OUTBOX_MAX) break;
|
|
1718
|
+
this.held.delete(id);
|
|
1719
|
+
dropped++;
|
|
1720
|
+
}
|
|
1721
|
+
if (dropped) this.deps.onDropped?.(dropped);
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
|
|
1669
1725
|
// src/setup-share.ts
|
|
1670
1726
|
import { spawn as spawn3 } from "child_process";
|
|
1671
1727
|
import {
|
|
@@ -2105,16 +2161,28 @@ function fetchVersion(npx, version) {
|
|
|
2105
2161
|
);
|
|
2106
2162
|
});
|
|
2107
2163
|
}
|
|
2108
|
-
function selfUpdate(kind, platform = process.platform) {
|
|
2164
|
+
function selfUpdate(kind, platform = process.platform, onFailed = () => {
|
|
2165
|
+
}) {
|
|
2109
2166
|
let latest = null;
|
|
2110
2167
|
let handing = false;
|
|
2111
2168
|
let lastWhy = null;
|
|
2169
|
+
const state = { checked_at: null, latest: null, error: null };
|
|
2170
|
+
const fail = (error, version) => {
|
|
2171
|
+
state.error = error;
|
|
2172
|
+
onFailed(error, version);
|
|
2173
|
+
};
|
|
2112
2174
|
const canDetach = platform === "darwin" || platform === "win32" || platform === "linux" && which("systemd-run") !== null;
|
|
2113
2175
|
const check = async () => {
|
|
2176
|
+
state.checked_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
2114
2177
|
const read = await readLatest();
|
|
2115
|
-
if (!read
|
|
2178
|
+
if (!read) return fail("registry_unreachable");
|
|
2179
|
+
state.latest = read;
|
|
2180
|
+
state.error = null;
|
|
2181
|
+
if (read === latest || !olderThan(VERSION, read) || read === readFailed()) return;
|
|
2116
2182
|
const npx = findNpx();
|
|
2117
|
-
if (npx
|
|
2183
|
+
if (!npx) return fail("npx_missing", read);
|
|
2184
|
+
if (await fetchVersion(npx, read)) latest = read;
|
|
2185
|
+
else fail("fetch_failed", read);
|
|
2118
2186
|
};
|
|
2119
2187
|
setTimeout(() => {
|
|
2120
2188
|
void check();
|
|
@@ -2125,6 +2193,7 @@ function selfUpdate(kind, platform = process.platform) {
|
|
|
2125
2193
|
if (!npx) {
|
|
2126
2194
|
log(`npx is not on PATH, so ${to} cannot start`);
|
|
2127
2195
|
recordFailed(to);
|
|
2196
|
+
fail("npx_missing", to);
|
|
2128
2197
|
return;
|
|
2129
2198
|
}
|
|
2130
2199
|
const [command, ...args] = handOverCommand(platform, npx, to, kind);
|
|
@@ -2151,6 +2220,7 @@ function selfUpdate(kind, platform = process.platform) {
|
|
|
2151
2220
|
handing = false;
|
|
2152
2221
|
log(`${to} did not take over (${why}); staying on ${VERSION}`);
|
|
2153
2222
|
recordFailed(to);
|
|
2223
|
+
fail("handover_failed", to);
|
|
2154
2224
|
};
|
|
2155
2225
|
child.on("error", (err) => failed(err.message));
|
|
2156
2226
|
child.on("exit", (code, signal) => {
|
|
@@ -2158,6 +2228,7 @@ function selfUpdate(kind, platform = process.platform) {
|
|
|
2158
2228
|
});
|
|
2159
2229
|
};
|
|
2160
2230
|
return {
|
|
2231
|
+
state: () => ({ ...state }),
|
|
2161
2232
|
beat({ running, inFlight }) {
|
|
2162
2233
|
if (handing) return;
|
|
2163
2234
|
const decision = updateDecision({
|
|
@@ -2251,6 +2322,7 @@ async function adopt(from, kind, { services: given, script = process.argv[1] ??
|
|
|
2251
2322
|
// src/commands/box.ts
|
|
2252
2323
|
var BEAT_MS = 6e4;
|
|
2253
2324
|
var RESEND_MS = 5 * 6e4;
|
|
2325
|
+
var RECENT_CALLS = 20;
|
|
2254
2326
|
var REPAIR_BEFORE_MS = 2 * 24 * 36e5;
|
|
2255
2327
|
var EXPIRING_BEFORE_MS = 3 * 24 * 36e5;
|
|
2256
2328
|
var out = (line) => console.log(line);
|
|
@@ -2338,7 +2410,7 @@ async function run2() {
|
|
|
2338
2410
|
let token = cfg?.deviceToken ?? getToken();
|
|
2339
2411
|
if (!token || !cfg) {
|
|
2340
2412
|
out(
|
|
2341
|
-
`${red("\u2717")} ${legacyStagingRunner() ? "This staging
|
|
2413
|
+
`${red("\u2717")} ${legacyStagingRunner() ? "This staging machine is still in ~/.cloop from before 0.3.9. Run `cloop connect --staging` to move it to ~/.cloop/staging." : "Not connected. Run `cloop connect` first."}`
|
|
2342
2414
|
);
|
|
2343
2415
|
process.exit(1);
|
|
2344
2416
|
}
|
|
@@ -2395,25 +2467,56 @@ async function run2() {
|
|
|
2395
2467
|
});
|
|
2396
2468
|
let inFlight = 0;
|
|
2397
2469
|
let callsStarted = 0;
|
|
2470
|
+
const startedAt = performance.now();
|
|
2471
|
+
let lastBeatAt = null;
|
|
2472
|
+
const wake = { last: null, unsent: false };
|
|
2473
|
+
const recentCalls = [];
|
|
2474
|
+
const outbox = new ResultOutbox({
|
|
2475
|
+
send: (frame) => socket.send(frame),
|
|
2476
|
+
onDropped: (n) => socket.send(runnerLog("results_dropped", { n }))
|
|
2477
|
+
});
|
|
2478
|
+
const resendResults = () => {
|
|
2479
|
+
const n = outbox.resend();
|
|
2480
|
+
if (!n) return;
|
|
2481
|
+
log2(`resent results n=${n}`);
|
|
2482
|
+
socket.send(runnerLog("result_resent", { n }));
|
|
2483
|
+
};
|
|
2398
2484
|
const onCall = async (frame) => {
|
|
2399
|
-
const started = Date.now();
|
|
2400
2485
|
inFlight++;
|
|
2401
2486
|
callsStarted++;
|
|
2402
2487
|
try {
|
|
2403
|
-
const
|
|
2488
|
+
const outcome = await answerCall(
|
|
2404
2489
|
{
|
|
2405
2490
|
driver,
|
|
2406
2491
|
onLaunch: (workId, threadId) => watch.add(workId, threadId),
|
|
2407
2492
|
onResume: (threadId) => watch.resume(threadId),
|
|
2408
|
-
...setup ? { setup } : {}
|
|
2493
|
+
...setup ? { setup } : {},
|
|
2494
|
+
diag: async () => buildDiag({
|
|
2495
|
+
version: VERSION,
|
|
2496
|
+
platform: process.platform,
|
|
2497
|
+
arch: process.arch,
|
|
2498
|
+
uptimeMs: performance.now() - startedAt,
|
|
2499
|
+
lastBeatAt,
|
|
2500
|
+
lastWake: wake.last,
|
|
2501
|
+
harnesses: await driver.status().then(
|
|
2502
|
+
(s) => s.harnesses,
|
|
2503
|
+
() => []
|
|
2504
|
+
),
|
|
2505
|
+
update: update?.state() ?? { checked_at: null, latest: null, error: null },
|
|
2506
|
+
unacked: outbox.size,
|
|
2507
|
+
clockOffsetMs: socket.clockOffset(),
|
|
2508
|
+
calls: recentCalls
|
|
2509
|
+
})
|
|
2409
2510
|
},
|
|
2410
|
-
frame
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2511
|
+
frame,
|
|
2512
|
+
{
|
|
2513
|
+
send: (f) => f.type === "result" ? outbox.send(f) : socket.send(f),
|
|
2514
|
+
log: log2,
|
|
2515
|
+
offset: () => socket.clockOffset()
|
|
2516
|
+
}
|
|
2416
2517
|
);
|
|
2518
|
+
recentCalls.push(outcome);
|
|
2519
|
+
if (recentCalls.length > RECENT_CALLS) recentCalls.shift();
|
|
2417
2520
|
} finally {
|
|
2418
2521
|
inFlight--;
|
|
2419
2522
|
}
|
|
@@ -2428,6 +2531,7 @@ async function run2() {
|
|
|
2428
2531
|
},
|
|
2429
2532
|
onCall: (frame) => void onCall(frame),
|
|
2430
2533
|
onAck: (of, ok) => watch.ack(of, ok),
|
|
2534
|
+
onResultAck: (id) => outbox.ack(id),
|
|
2431
2535
|
onOpen: () => {
|
|
2432
2536
|
log2(`connected to ${getMeshUrl()}`);
|
|
2433
2537
|
recordConnected(
|
|
@@ -2435,6 +2539,8 @@ async function run2() {
|
|
|
2435
2539
|
(state) => writeRunnerState(state, runnerStatePath(void 0, threadsFile))
|
|
2436
2540
|
);
|
|
2437
2541
|
watch.flush();
|
|
2542
|
+
resendResults();
|
|
2543
|
+
if (wake.unsent && wake.last) wake.unsent = !socket.send({ type: "wake", ...wake.last });
|
|
2438
2544
|
},
|
|
2439
2545
|
onClose: (code) => log2(
|
|
2440
2546
|
code === REVOKED_CLOSE ? "disconnected by Cloop (revoked), checking" : "disconnected, reconnecting"
|
|
@@ -2460,7 +2566,10 @@ async function run2() {
|
|
|
2460
2566
|
`connecting to ${getMeshUrl()} as ${sessionKey} (${readCredentials()?.deviceName ?? machine}) driver=${driver.name}`
|
|
2461
2567
|
);
|
|
2462
2568
|
watch.start();
|
|
2463
|
-
setInterval(() =>
|
|
2569
|
+
setInterval(() => {
|
|
2570
|
+
watch.flush();
|
|
2571
|
+
resendResults();
|
|
2572
|
+
}, RESEND_MS).unref();
|
|
2464
2573
|
const unfollow = driver instanceof CloudroomDriver ? driver.refuseOwnSandboxChildren() : null;
|
|
2465
2574
|
if (driver instanceof LocalDriver) serveTakeovers(driver, log2);
|
|
2466
2575
|
const renewT3 = async () => {
|
|
@@ -2485,7 +2594,11 @@ async function run2() {
|
|
|
2485
2594
|
log2(`T3 session renewal failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
2486
2595
|
}
|
|
2487
2596
|
};
|
|
2488
|
-
const update = hosted ? null : selfUpdate(
|
|
2597
|
+
const update = hosted ? null : selfUpdate(
|
|
2598
|
+
driver.name === "t3" ? "workstation" : "local",
|
|
2599
|
+
process.platform,
|
|
2600
|
+
(error, ver) => socket.send(runnerLog("update_failed", { error, ver }))
|
|
2601
|
+
);
|
|
2489
2602
|
const beat = async () => {
|
|
2490
2603
|
await renewT3();
|
|
2491
2604
|
const callsBefore = callsStarted;
|
|
@@ -2507,7 +2620,10 @@ async function run2() {
|
|
|
2507
2620
|
);
|
|
2508
2621
|
} catch (err) {
|
|
2509
2622
|
log2(`${driver.name} unreachable: ${err instanceof Error ? err.message : String(err)}`);
|
|
2623
|
+
socket.send(runnerLog("driver_unreachable", { error: classifyError(err, driver.name) }));
|
|
2510
2624
|
}
|
|
2625
|
+
lastBeatAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2626
|
+
socket.ping();
|
|
2511
2627
|
socket.sendPresence(
|
|
2512
2628
|
boxPresence({
|
|
2513
2629
|
sessionKey,
|
|
@@ -2525,6 +2641,15 @@ async function run2() {
|
|
|
2525
2641
|
};
|
|
2526
2642
|
void beat();
|
|
2527
2643
|
setInterval(() => void beat(), BEAT_MS);
|
|
2644
|
+
const sleptSince = wakeWatch();
|
|
2645
|
+
setInterval(() => {
|
|
2646
|
+
const woke = sleptSince();
|
|
2647
|
+
if (!woke) return;
|
|
2648
|
+
wake.last = woke;
|
|
2649
|
+
log2(`wake slept_ms=${woke.slept_ms}`);
|
|
2650
|
+
wake.unsent = !socket.send({ type: "wake", ...woke });
|
|
2651
|
+
void beat();
|
|
2652
|
+
}, WAKE_TICK_MS).unref();
|
|
2528
2653
|
const stop = (code = 0) => {
|
|
2529
2654
|
log2("stopping");
|
|
2530
2655
|
watch.stop();
|
|
@@ -18,7 +18,7 @@ function olderThan(version, floor) {
|
|
|
18
18
|
}
|
|
19
19
|
function nodeTooOld(version = process.versions.node) {
|
|
20
20
|
if (!olderThan(version, String(NODE_FLOOR))) return null;
|
|
21
|
-
return `Cloop
|
|
21
|
+
return `Cloop machine needs Node ${NODE_FLOOR} or later. This computer has Node ${version}. Update Node (brew upgrade node, or https://nodejs.org), then run the command again.`;
|
|
22
22
|
}
|
|
23
23
|
function claudeTooOld(version) {
|
|
24
24
|
return `Claude Code ${version} is older than ${CLAUDE_FLOOR}, the version Cloop runs on.`;
|