@cloop/runner 0.2.7 → 0.2.9
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/{box-U65RXLCX.js → box-Z4NS6J7A.js} +52 -40
- package/dist/{chunk-DLFNATEZ.js → chunk-3PIT6YXL.js} +3 -3
- package/dist/{chunk-JFCEKATW.js → chunk-IRRQ55FQ.js} +6 -3
- package/dist/{chunk-KH6FK6UQ.js → chunk-Q2MTOW4O.js} +1 -1
- package/dist/{chunk-JZNBZUPZ.js → chunk-QAOAR5OL.js} +1 -1
- package/dist/{chunk-MC4DJ4LX.js → chunk-V4QYTF6O.js} +2 -2
- package/dist/{chunk-SANEFNTU.js → chunk-VBWETWB5.js} +1 -1
- package/dist/{chunk-LNQLGVYC.js → chunk-VIQF3JF3.js} +121 -59
- package/dist/{chunk-X7MNNKU3.js → chunk-VKEX5FVO.js} +7 -6
- package/dist/{connect-GSGNPOPK.js → connect-CGOALTSO.js} +5 -5
- package/dist/{disconnect-VTIIRAIV.js → disconnect-H3RDATJF.js} +6 -6
- package/dist/index.js +16 -14
- package/dist/{login-XK4DOOGZ.js → login-IQSMR2SY.js} +2 -2
- package/dist/{mcp-server-GDTT45SF.js → mcp-server-PRPB2JYE.js} +1 -1
- package/dist/{runner-ST77ZDLI.js → runner-JNMWMBIG.js} +3 -3
- package/dist/{runs-2CZ3YZGI.js → runs-BMTJHKBI.js} +3 -3
- package/dist/{statusline-6WXP6S3D.js → statusline-UVEWJ4BA.js} +1 -1
- package/dist/{takeover-WHU4CEKP.js → takeover-XL2P7RML.js} +4 -4
- package/dist/{use-TBSTJORL.js → use-3B33RXZH.js} +5 -5
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
serveTakeovers
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-3PIT6YXL.js";
|
|
5
|
+
import "./chunk-V4QYTF6O.js";
|
|
6
6
|
import {
|
|
7
7
|
LocalDriver
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IRRQ55FQ.js";
|
|
9
9
|
import {
|
|
10
10
|
MeshSocket,
|
|
11
11
|
defaultSocketFactory
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
probeClaudePermissions,
|
|
22
22
|
probeCodex,
|
|
23
23
|
runBoxTool
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VKEX5FVO.js";
|
|
25
25
|
import {
|
|
26
26
|
BoxWatch,
|
|
27
27
|
lockThreadsFile,
|
|
@@ -32,17 +32,20 @@ import {
|
|
|
32
32
|
T3Driver,
|
|
33
33
|
isLocal,
|
|
34
34
|
readRunnerConfig,
|
|
35
|
+
showsOtherThreads,
|
|
35
36
|
writeBoxConfig
|
|
36
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-VIQF3JF3.js";
|
|
37
38
|
import {
|
|
38
39
|
getMachine
|
|
39
40
|
} from "./chunk-JX6VG5FE.js";
|
|
40
41
|
import "./chunk-VK6GV757.js";
|
|
41
42
|
import "./chunk-R3CLO2FB.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-QAOAR5OL.js";
|
|
44
|
+
import "./chunk-VBWETWB5.js";
|
|
44
45
|
import "./chunk-AG6SI6I2.js";
|
|
45
|
-
import
|
|
46
|
+
import {
|
|
47
|
+
VERSION
|
|
48
|
+
} from "./chunk-Q2MTOW4O.js";
|
|
46
49
|
import {
|
|
47
50
|
getMeshUrl,
|
|
48
51
|
getToken,
|
|
@@ -55,6 +58,7 @@ import { readdir, stat } from "fs/promises";
|
|
|
55
58
|
import { homedir } from "os";
|
|
56
59
|
import { join } from "path";
|
|
57
60
|
import { createInterface } from "readline";
|
|
61
|
+
var seen = /* @__PURE__ */ new Map();
|
|
58
62
|
var UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;
|
|
59
63
|
async function listOutsideSessions(root = join(homedir(), ".claude", "projects"), own = /* @__PURE__ */ new Set(), now = Date.now()) {
|
|
60
64
|
const files = [];
|
|
@@ -73,32 +77,42 @@ async function listOutsideSessions(root = join(homedir(), ".claude", "projects")
|
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
const results = [];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
const newest = files.sort((a, b) => b.mtime - a.mtime).slice(0, 20);
|
|
81
|
+
for (const path of seen.keys()) if (!newest.some((file) => file.file === path)) seen.delete(path);
|
|
82
|
+
for (const file of newest) {
|
|
83
|
+
const known = seen.get(file.file);
|
|
84
|
+
let title = known?.mtime === file.mtime ? known.title : void 0;
|
|
85
|
+
let cwd = known?.mtime === file.mtime ? known.cwd : void 0;
|
|
86
|
+
if (known?.mtime !== file.mtime) {
|
|
87
|
+
const stream = createReadStream(file.file, { encoding: "utf8" });
|
|
88
|
+
const lines = createInterface({ input: stream, crlfDelay: Number.POSITIVE_INFINITY });
|
|
89
|
+
try {
|
|
90
|
+
for await (const line of lines) {
|
|
91
|
+
if (!cwd && line.includes('"cwd"')) {
|
|
92
|
+
try {
|
|
93
|
+
const record = JSON.parse(line);
|
|
94
|
+
if (typeof record.cwd === "string" && record.cwd.startsWith("/") && record.cwd.length <= 500)
|
|
95
|
+
cwd = record.cwd;
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (!/^\s*\{\s*"type"\s*:\s*"(?:summary|custom-title|title)"/.test(line)) continue;
|
|
84
100
|
try {
|
|
85
101
|
const record = JSON.parse(line);
|
|
86
|
-
|
|
87
|
-
|
|
102
|
+
const value = record.type === "summary" ? record.summary : record.type === "custom-title" ? record.customTitle : record.title;
|
|
103
|
+
if (typeof value === "string" && value.trim()) title = value.trim().slice(0, 120);
|
|
88
104
|
} catch {
|
|
89
105
|
}
|
|
90
106
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const value = record.type === "summary" ? record.summary : record.type === "custom-title" ? record.customTitle : record.title;
|
|
95
|
-
if (typeof value === "string" && value.trim()) title = value.trim().slice(0, 120);
|
|
96
|
-
} catch {
|
|
97
|
-
}
|
|
107
|
+
} finally {
|
|
108
|
+
lines.close();
|
|
109
|
+
stream.destroy();
|
|
98
110
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
111
|
+
seen.set(file.file, {
|
|
112
|
+
mtime: file.mtime,
|
|
113
|
+
...title ? { title } : {},
|
|
114
|
+
...cwd ? { cwd } : {}
|
|
115
|
+
});
|
|
102
116
|
}
|
|
103
117
|
results.push({
|
|
104
118
|
id: file.id,
|
|
@@ -146,7 +160,9 @@ function boxPresence(beat) {
|
|
|
146
160
|
machine: beat.machine,
|
|
147
161
|
surface: {
|
|
148
162
|
driver: beat.driver,
|
|
163
|
+
version: VERSION,
|
|
149
164
|
outsideThreads: beat.outsideThreads,
|
|
165
|
+
otherThreads: beat.otherThreads,
|
|
150
166
|
...beat.t3 ? { t3: beat.t3 } : {}
|
|
151
167
|
},
|
|
152
168
|
status: beat.running > 0 ? "active" : "idle",
|
|
@@ -290,7 +306,7 @@ async function run() {
|
|
|
290
306
|
...await mintSession(cfg.t3Url, { stored: cfg.t3Bin }),
|
|
291
307
|
// Read from disk: `cloop connect` may have replaced it since.
|
|
292
308
|
deviceToken: disk?.deviceToken ?? cfg.deviceToken,
|
|
293
|
-
|
|
309
|
+
hideOtherThreads: disk?.hideOtherThreads === true,
|
|
294
310
|
...disk?.chosenDriver ? { chosenDriver: disk.chosenDriver } : {},
|
|
295
311
|
...disk?.origin ?? cfg.origin ? { origin: disk?.origin ?? cfg.origin } : {}
|
|
296
312
|
};
|
|
@@ -308,21 +324,16 @@ async function run() {
|
|
|
308
324
|
await renewT3();
|
|
309
325
|
let running = 0;
|
|
310
326
|
let outsideThreads = [];
|
|
327
|
+
const shown = showsOtherThreads(readRunnerConfig());
|
|
311
328
|
try {
|
|
312
|
-
const
|
|
329
|
+
const own = shown && driver.name === "claude-code";
|
|
313
330
|
const listed = await driver.listThreads({
|
|
314
|
-
scope:
|
|
315
|
-
limit:
|
|
331
|
+
scope: own ? "all" : "unsettled",
|
|
332
|
+
limit: own ? 200 : 1
|
|
316
333
|
});
|
|
317
334
|
running = listed.running;
|
|
318
|
-
if (
|
|
319
|
-
|
|
320
|
-
id: t.id,
|
|
321
|
-
title: t.title.slice(0, 120),
|
|
322
|
-
updatedAt: t.updatedAt,
|
|
323
|
-
status: t.status
|
|
324
|
-
}));
|
|
325
|
-
if (enabled && driver.name === "claude-code")
|
|
335
|
+
if (shown && driver instanceof T3Driver) outsideThreads = await driver.outsideThreads(20);
|
|
336
|
+
if (own)
|
|
326
337
|
outsideThreads = await listOutsideSessions(
|
|
327
338
|
void 0,
|
|
328
339
|
new Set(listed.threads.map((t) => t.id))
|
|
@@ -337,6 +348,7 @@ async function run() {
|
|
|
337
348
|
capabilities: driver.capabilities,
|
|
338
349
|
machine,
|
|
339
350
|
outsideThreads,
|
|
351
|
+
otherThreads: shown,
|
|
340
352
|
running,
|
|
341
353
|
t3: cfg && !isLocal(cfg) ? t3Presence(cfg, t3.renewalFailed) : null
|
|
342
354
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
findRun
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-V4QYTF6O.js";
|
|
5
5
|
import {
|
|
6
6
|
localRunsFilePath,
|
|
7
7
|
readRunRecords,
|
|
8
8
|
takeoverSummary
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IRRQ55FQ.js";
|
|
10
10
|
import {
|
|
11
11
|
lockThreadsFile,
|
|
12
12
|
threadsFilePath
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
isLocal,
|
|
16
16
|
readRunnerConfig
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VIQF3JF3.js";
|
|
18
18
|
import {
|
|
19
19
|
shortMachineName
|
|
20
20
|
} from "./chunk-JX6VG5FE.js";
|
|
@@ -4,17 +4,18 @@ import {
|
|
|
4
4
|
RESULT_INSTRUCTION,
|
|
5
5
|
STOPPED_SUMMARY,
|
|
6
6
|
appendRunLog,
|
|
7
|
+
droppedLine,
|
|
7
8
|
endNote,
|
|
8
9
|
isProgressSentence,
|
|
9
10
|
logLineFor,
|
|
10
11
|
nextProgress,
|
|
11
12
|
orderThreads,
|
|
12
|
-
parseRunResult,
|
|
13
13
|
prUrlIn,
|
|
14
14
|
pruneRunLogs,
|
|
15
|
+
readRunResult,
|
|
15
16
|
resultPrUrl,
|
|
16
17
|
runLogDir
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VIQF3JF3.js";
|
|
18
19
|
import {
|
|
19
20
|
CONFIG_DIR
|
|
20
21
|
} from "./chunk-3DIGCVL4.js";
|
|
@@ -508,7 +509,9 @@ ${RESULT_INSTRUCTION}`));
|
|
|
508
509
|
}
|
|
509
510
|
if (code === 0 && live.result?.ok) {
|
|
510
511
|
const text = live.result.text?.trim() || r.last_text;
|
|
511
|
-
const result =
|
|
512
|
+
const { result, dropped } = readRunResult(text);
|
|
513
|
+
const lost = droppedLine(dropped, r.work_id);
|
|
514
|
+
if (lost) this.log(lost);
|
|
512
515
|
const { pr, note } = await this.outcome(r, text);
|
|
513
516
|
const summary = [r.switched, note, text].filter(Boolean).join(" ").replace(/\s+/g, " ");
|
|
514
517
|
await this.end(r, {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
localRunsFilePath,
|
|
4
4
|
readRunRecords
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IRRQ55FQ.js";
|
|
6
6
|
import {
|
|
7
7
|
STOPPED_SUMMARY,
|
|
8
8
|
isEndLogLine,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
readRunnerConfig,
|
|
11
11
|
runLogDir,
|
|
12
12
|
runLogPath
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VIQF3JF3.js";
|
|
14
14
|
import {
|
|
15
15
|
sanitizeLabel,
|
|
16
16
|
stripControl
|
|
@@ -225,7 +225,13 @@ function whichAll(bin) {
|
|
|
225
225
|
import { execFile, execFileSync as execFileSync2 } from "child_process";
|
|
226
226
|
|
|
227
227
|
// src/run-result.ts
|
|
228
|
-
var RESULT_INSTRUCTION =
|
|
228
|
+
var RESULT_INSTRUCTION = [
|
|
229
|
+
"When you finish, end your final message with a fenced block tagged cloop-result containing JSON, for example:",
|
|
230
|
+
"```cloop-result",
|
|
231
|
+
'{"summary": "One or two sentences on what you did.", "outputs": [{"kind": "pr", "title": "fix: the thing", "url": "https://github.com/org/repo/pull/1"}], "checks": [{"name": "Tests", "outcome": "passed"}]}',
|
|
232
|
+
"```",
|
|
233
|
+
"An output kind is one of: pr or link (title, url), draft (title, body, optional to), doc (title, optional url or body), file (title, path). A check outcome is passed, failed or skipped."
|
|
234
|
+
].join("\n");
|
|
229
235
|
var text = (v, max) => typeof v === "string" && v.length <= max;
|
|
230
236
|
var optionalText = (v, max) => v === void 0 || text(v, max);
|
|
231
237
|
var https = (v) => {
|
|
@@ -245,69 +251,87 @@ function resultPrUrl(finalMessage) {
|
|
|
245
251
|
const prs = result.outputs.flatMap((o) => o.kind === "pr" ? [o.url] : []);
|
|
246
252
|
return prs.at(-1) ?? null;
|
|
247
253
|
}
|
|
248
|
-
|
|
254
|
+
var SUMMARY_MAX = 500;
|
|
255
|
+
function addressOutput(url) {
|
|
256
|
+
const pr = url.match(/\/pull\/(\d+)$/);
|
|
257
|
+
if (pr && prUrlIn(url) === url) return { kind: "pr", title: `Pull request #${pr[1]}`, url };
|
|
258
|
+
const { host, pathname } = new URL(url);
|
|
259
|
+
return { kind: "link", title: `${host}${pathname === "/" ? "" : pathname}`.slice(0, 120), url };
|
|
260
|
+
}
|
|
261
|
+
function cleanOutput(o) {
|
|
262
|
+
if (typeof o === "string") return https(o.trim()) ? addressOutput(o.trim()) : null;
|
|
263
|
+
if (!o || typeof o !== "object") return null;
|
|
264
|
+
const out = o;
|
|
265
|
+
if (!text(out.title, 120)) return null;
|
|
266
|
+
const title = out.title;
|
|
267
|
+
switch (out.kind) {
|
|
268
|
+
case "pr":
|
|
269
|
+
case "link":
|
|
270
|
+
return https(out.url) ? { kind: out.kind, title, url: out.url } : null;
|
|
271
|
+
case "draft":
|
|
272
|
+
return text(out.body, 4e3) && optionalText(out.to, 200) ? {
|
|
273
|
+
kind: "draft",
|
|
274
|
+
title,
|
|
275
|
+
body: out.body,
|
|
276
|
+
...out.to !== void 0 ? { to: out.to } : {}
|
|
277
|
+
} : null;
|
|
278
|
+
case "doc":
|
|
279
|
+
return optionalText(out.body, 8e3) && (out.url === void 0 || https(out.url)) ? {
|
|
280
|
+
kind: "doc",
|
|
281
|
+
title,
|
|
282
|
+
...out.url !== void 0 ? { url: out.url } : {},
|
|
283
|
+
...out.body !== void 0 ? { body: out.body } : {}
|
|
284
|
+
} : null;
|
|
285
|
+
case "file":
|
|
286
|
+
return text(out.path, 400) ? { kind: "file", title, path: out.path } : null;
|
|
287
|
+
default:
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function cleanCheck(c) {
|
|
292
|
+
if (!c || typeof c !== "object") return null;
|
|
293
|
+
const check = c;
|
|
294
|
+
if (!text(check.name, 80) || !["passed", "failed", "skipped"].includes(check.outcome))
|
|
295
|
+
return null;
|
|
296
|
+
if (!optionalText(check.detail, 200)) return null;
|
|
297
|
+
return {
|
|
298
|
+
name: check.name,
|
|
299
|
+
outcome: check.outcome,
|
|
300
|
+
...check.detail !== void 0 ? { detail: check.detail } : {}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function readRunResult(message) {
|
|
304
|
+
const none = { dropped: { outputs: 0, checks: 0 } };
|
|
249
305
|
const block = [...(message ?? "").matchAll(/```cloop-result\s*\n([\s\S]*?)```/g)].at(-1)?.[1];
|
|
250
|
-
if (!block) return
|
|
306
|
+
if (!block) return none;
|
|
251
307
|
try {
|
|
252
308
|
const value = JSON.parse(block);
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const clean = [];
|
|
259
|
-
for (const o of outputs) {
|
|
260
|
-
if (!o || !text(o.title, 120)) return void 0;
|
|
261
|
-
switch (o.kind) {
|
|
262
|
-
case "pr":
|
|
263
|
-
case "link":
|
|
264
|
-
if (!https(o.url)) return void 0;
|
|
265
|
-
clean.push({ kind: o.kind, title: o.title, url: o.url });
|
|
266
|
-
break;
|
|
267
|
-
case "draft":
|
|
268
|
-
if (!text(o.body, 4e3) || !optionalText(o.to, 200)) return void 0;
|
|
269
|
-
clean.push({
|
|
270
|
-
kind: "draft",
|
|
271
|
-
title: o.title,
|
|
272
|
-
body: o.body,
|
|
273
|
-
...o.to !== void 0 ? { to: o.to } : {}
|
|
274
|
-
});
|
|
275
|
-
break;
|
|
276
|
-
case "doc":
|
|
277
|
-
if (!optionalText(o.body, 8e3) || o.url !== void 0 && !https(o.url))
|
|
278
|
-
return void 0;
|
|
279
|
-
clean.push({
|
|
280
|
-
kind: "doc",
|
|
281
|
-
title: o.title,
|
|
282
|
-
...o.url !== void 0 ? { url: o.url } : {},
|
|
283
|
-
...o.body !== void 0 ? { body: o.body } : {}
|
|
284
|
-
});
|
|
285
|
-
break;
|
|
286
|
-
case "file":
|
|
287
|
-
if (!text(o.path, 400)) return void 0;
|
|
288
|
-
clean.push({ kind: "file", title: o.title, path: o.path });
|
|
289
|
-
break;
|
|
290
|
-
default:
|
|
291
|
-
return void 0;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
if (checks.some(
|
|
295
|
-
(c) => !c || !text(c.name, 80) || !["passed", "failed", "skipped"].includes(c.outcome) || !optionalText(c.detail, 200)
|
|
296
|
-
))
|
|
297
|
-
return void 0;
|
|
309
|
+
const summary = typeof value?.summary === "string" ? value.summary.trim() : "";
|
|
310
|
+
if (!summary) return none;
|
|
311
|
+
const list = (v) => Array.isArray(v) ? v : [];
|
|
312
|
+
const outputs = list(value.outputs).flatMap((o) => cleanOutput(o) ?? []);
|
|
313
|
+
const checks = list(value.checks).flatMap((c) => cleanCheck(c) ?? []);
|
|
298
314
|
return {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
315
|
+
result: {
|
|
316
|
+
summary: summary.length > SUMMARY_MAX ? `${summary.slice(0, SUMMARY_MAX - 1)}\u2026` : summary,
|
|
317
|
+
outputs: outputs.slice(0, 10),
|
|
318
|
+
checks: checks.slice(0, 10)
|
|
319
|
+
},
|
|
320
|
+
dropped: {
|
|
321
|
+
outputs: list(value.outputs).length - outputs.length,
|
|
322
|
+
checks: list(value.checks).length - checks.length
|
|
323
|
+
}
|
|
306
324
|
};
|
|
307
325
|
} catch {
|
|
308
|
-
return
|
|
326
|
+
return none;
|
|
309
327
|
}
|
|
310
328
|
}
|
|
329
|
+
function parseRunResult(message) {
|
|
330
|
+
return readRunResult(message).result;
|
|
331
|
+
}
|
|
332
|
+
function droppedLine(dropped, run) {
|
|
333
|
+
return dropped.outputs || dropped.checks ? `result_items_dropped run=${run} outputs=${dropped.outputs} checks=${dropped.checks}` : null;
|
|
334
|
+
}
|
|
311
335
|
|
|
312
336
|
// src/drivers/driver.ts
|
|
313
337
|
var RUNTIME_MODES = /* @__PURE__ */ new Set([
|
|
@@ -438,14 +462,15 @@ function outcomeOf(p) {
|
|
|
438
462
|
const status = run?.status ?? "pending";
|
|
439
463
|
const settled = TERMINAL_RUN.has(status) || Boolean(p.thread.settledAt);
|
|
440
464
|
const text2 = (p.messages ?? []).filter((m) => m.role === "assistant" && m.text).at(-1)?.text?.trim();
|
|
441
|
-
const result =
|
|
465
|
+
const { result, dropped } = readRunResult(text2);
|
|
442
466
|
return {
|
|
443
467
|
status,
|
|
444
468
|
settled,
|
|
445
469
|
kind: settled ? status === "completed" || !run ? "settled" : "failed" : null,
|
|
446
470
|
pr_url: resultPrUrl(text2),
|
|
447
471
|
last_assistant_text: text2 ? text2.slice(0, 300) : null,
|
|
448
|
-
...result ? { result } : {}
|
|
472
|
+
...result ? { result } : {},
|
|
473
|
+
...dropped.outputs || dropped.checks ? { dropped } : {}
|
|
449
474
|
};
|
|
450
475
|
}
|
|
451
476
|
function permissionOf(runtimeMode) {
|
|
@@ -767,6 +792,30 @@ ${RESULT_INSTRUCTION}`, attachments: [] }
|
|
|
767
792
|
const open = await this.openTarget(id, projection).catch(() => null);
|
|
768
793
|
return { status, settled, pr_url, last_assistant_text, open };
|
|
769
794
|
}
|
|
795
|
+
/**
|
|
796
|
+
* The owner's own open threads, the ones Cloop did not start: running
|
|
797
|
+
* first, then the most recent. Each carries where it opens, the same
|
|
798
|
+
* target as a Cloop run's thread: its web page when another device can
|
|
799
|
+
* reach T3, else its project, to find it by title.
|
|
800
|
+
*/
|
|
801
|
+
async outsideThreads(limit) {
|
|
802
|
+
const [cfg, shell] = await this.readT3State();
|
|
803
|
+
const base = this.t3.t3Url;
|
|
804
|
+
const web = base ? reachableBase(base, cfg.directEndpoints, this.servedBase(base)) : null;
|
|
805
|
+
const projects = new Map((shell.projects ?? []).map((p) => [p.id, p.title]));
|
|
806
|
+
const mine = (shell.threads ?? []).filter((t) => isUnsettled(t) && !threadView(t).cloop);
|
|
807
|
+
return orderThreads(mine, limit).map((t) => {
|
|
808
|
+
const project = t.projectId ? projects.get(t.projectId) : void 0;
|
|
809
|
+
return {
|
|
810
|
+
id: t.id,
|
|
811
|
+
title: t.title.slice(0, 120),
|
|
812
|
+
updatedAt: t.updatedAt,
|
|
813
|
+
status: t.status,
|
|
814
|
+
...project ? { project: project.slice(0, 200) } : {},
|
|
815
|
+
...web ? { url: t3ThreadUrl(web, cfg.environment.environmentId, t.id) } : {}
|
|
816
|
+
};
|
|
817
|
+
});
|
|
818
|
+
}
|
|
770
819
|
/** Where the owner opens this thread: the T3 web app's page for it, or its title and project. */
|
|
771
820
|
async openTarget(id, p) {
|
|
772
821
|
const [cfg, shell] = await this.readT3State();
|
|
@@ -913,6 +962,8 @@ ${RESULT_INSTRUCTION}`, attachments: [] }
|
|
|
913
962
|
...outcome.result ? pr : {}
|
|
914
963
|
});
|
|
915
964
|
} else {
|
|
965
|
+
const lost = outcome.dropped ? droppedLine(outcome.dropped, threadId) : null;
|
|
966
|
+
if (lost) this.log(lost);
|
|
916
967
|
onEvent({
|
|
917
968
|
kind: "settled",
|
|
918
969
|
...outcome.result ? { result: outcome.result } : {},
|
|
@@ -1087,6 +1138,14 @@ function boxPath() {
|
|
|
1087
1138
|
function isLocal(cfg) {
|
|
1088
1139
|
return cfg.driver === "claude-code" || cfg.driver === "codex";
|
|
1089
1140
|
}
|
|
1141
|
+
function showsOtherThreads(cfg) {
|
|
1142
|
+
return cfg?.hideOtherThreads !== true;
|
|
1143
|
+
}
|
|
1144
|
+
function otherThreadsChoice(argv, previous) {
|
|
1145
|
+
if (argv.includes("--hide-other-threads")) return true;
|
|
1146
|
+
if (argv.includes("--show-other-threads")) return false;
|
|
1147
|
+
return previous?.hideOtherThreads === true;
|
|
1148
|
+
}
|
|
1090
1149
|
function readRunnerConfig() {
|
|
1091
1150
|
let parsed;
|
|
1092
1151
|
try {
|
|
@@ -1115,7 +1174,8 @@ export {
|
|
|
1115
1174
|
RESULT_INSTRUCTION,
|
|
1116
1175
|
prUrlIn,
|
|
1117
1176
|
resultPrUrl,
|
|
1118
|
-
|
|
1177
|
+
readRunResult,
|
|
1178
|
+
droppedLine,
|
|
1119
1179
|
RUNTIME_MODES,
|
|
1120
1180
|
BoxToolError,
|
|
1121
1181
|
CLOOP_THREAD_PREFIX,
|
|
@@ -1140,6 +1200,8 @@ export {
|
|
|
1140
1200
|
T3Driver,
|
|
1141
1201
|
boxPath,
|
|
1142
1202
|
isLocal,
|
|
1203
|
+
showsOtherThreads,
|
|
1204
|
+
otherThreadsChoice,
|
|
1143
1205
|
readRunnerConfig,
|
|
1144
1206
|
writeBoxConfig
|
|
1145
1207
|
};
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
defaultT3BinSources,
|
|
11
11
|
isLocal,
|
|
12
12
|
isYes,
|
|
13
|
+
otherThreadsChoice,
|
|
13
14
|
pickT3Bin,
|
|
14
15
|
questionLine,
|
|
15
16
|
readRunnerConfig,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
t3BaseDirArgs,
|
|
18
19
|
t3Candidates,
|
|
19
20
|
writeBoxConfig
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-VIQF3JF3.js";
|
|
21
22
|
import {
|
|
22
23
|
getMachine,
|
|
23
24
|
shortMachineName
|
|
@@ -28,17 +29,17 @@ import {
|
|
|
28
29
|
} from "./chunk-R3CLO2FB.js";
|
|
29
30
|
import {
|
|
30
31
|
connectWebhook
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-QAOAR5OL.js";
|
|
32
33
|
import {
|
|
33
34
|
ConnectFailure,
|
|
34
35
|
connectReport,
|
|
35
36
|
deviceLogin,
|
|
36
37
|
newAttempt,
|
|
37
38
|
sendConnectReport
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-VBWETWB5.js";
|
|
39
40
|
import {
|
|
40
41
|
VERSION
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-Q2MTOW4O.js";
|
|
42
43
|
import {
|
|
43
44
|
STAGING_ORIGIN,
|
|
44
45
|
getOrigin
|
|
@@ -1392,7 +1393,7 @@ async function connectT3(argv, attempt, fallback, chosen, services) {
|
|
|
1392
1393
|
writeBoxConfig: (cfg2) => writeBoxConfig({
|
|
1393
1394
|
...cfg2,
|
|
1394
1395
|
origin: getOrigin(),
|
|
1395
|
-
|
|
1396
|
+
hideOtherThreads: otherThreadsChoice(argv, previous),
|
|
1396
1397
|
...chosen ? { chosenDriver: chosen } : {}
|
|
1397
1398
|
})
|
|
1398
1399
|
});
|
|
@@ -1441,7 +1442,7 @@ async function connectLocal(driver, found, argv, attempt, chosen, services) {
|
|
|
1441
1442
|
const deviceToken = await deviceLogin({ origin: getOrigin(), deviceName, device });
|
|
1442
1443
|
attempt.deviceToken = deviceToken;
|
|
1443
1444
|
const cfg = {
|
|
1444
|
-
|
|
1445
|
+
hideOtherThreads: otherThreadsChoice(argv, previous),
|
|
1445
1446
|
driver,
|
|
1446
1447
|
environmentId: device.environmentId,
|
|
1447
1448
|
label: deviceName,
|
|
@@ -38,16 +38,16 @@ import {
|
|
|
38
38
|
tilde,
|
|
39
39
|
unitEnv,
|
|
40
40
|
unitFor
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-VKEX5FVO.js";
|
|
42
42
|
import "./chunk-MWWA2VH7.js";
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-VIQF3JF3.js";
|
|
44
44
|
import "./chunk-JX6VG5FE.js";
|
|
45
45
|
import "./chunk-VK6GV757.js";
|
|
46
46
|
import "./chunk-R3CLO2FB.js";
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-QAOAR5OL.js";
|
|
48
|
+
import "./chunk-VBWETWB5.js";
|
|
49
49
|
import "./chunk-AG6SI6I2.js";
|
|
50
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-Q2MTOW4O.js";
|
|
51
51
|
import "./chunk-3DIGCVL4.js";
|
|
52
52
|
export {
|
|
53
53
|
DEFAULT_T3_URL,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
localRunsFilePath
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IRRQ55FQ.js";
|
|
5
5
|
import {
|
|
6
6
|
installedService,
|
|
7
7
|
revokeOwnDevice,
|
|
8
8
|
runSteps,
|
|
9
9
|
tokenGone
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VKEX5FVO.js";
|
|
11
11
|
import {
|
|
12
12
|
runnerStatePath,
|
|
13
13
|
threadsFilePath
|
|
@@ -15,14 +15,14 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
boxPath,
|
|
17
17
|
readRunnerConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VIQF3JF3.js";
|
|
19
19
|
import "./chunk-JX6VG5FE.js";
|
|
20
20
|
import "./chunk-VK6GV757.js";
|
|
21
21
|
import "./chunk-R3CLO2FB.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-QAOAR5OL.js";
|
|
23
|
+
import "./chunk-VBWETWB5.js";
|
|
24
24
|
import "./chunk-AG6SI6I2.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-Q2MTOW4O.js";
|
|
26
26
|
import {
|
|
27
27
|
getOrigin
|
|
28
28
|
} from "./chunk-3DIGCVL4.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q2MTOW4O.js";
|
|
5
5
|
import {
|
|
6
6
|
applyEnvironmentFlag
|
|
7
7
|
} from "./chunk-3DIGCVL4.js";
|
|
@@ -23,12 +23,14 @@ Usage:
|
|
|
23
23
|
cloop hook activity Lifecycle hook: records what this session is doing
|
|
24
24
|
cloop connect [--repo <path>]... [--driver t3|claude-code|codex] [--fallback-model <list>]
|
|
25
25
|
[--no-service] [--no-start] [--ask-everything] [--t3-pair <link>]
|
|
26
|
+
[--hide-other-threads | --show-other-threads]
|
|
26
27
|
Make this machine a Cloop runner: T3 Code, else
|
|
27
28
|
Claude Code or Codex in the repos you name.
|
|
28
29
|
When T3 Code will not pair by itself, paste a
|
|
29
30
|
link from T3 Code (Settings, Connections,
|
|
30
31
|
Create pairing link) at the question, or pass
|
|
31
|
-
it with --t3-pair
|
|
32
|
+
it with --t3-pair. Cloop shows the threads you
|
|
33
|
+
started yourself; --hide-other-threads hides them
|
|
32
34
|
cloop use t3|claude-code|codex Run Cloop work here with that harness. It reconnects
|
|
33
35
|
this machine, swaps its service, and keeps the choice
|
|
34
36
|
cloop disconnect [--yes] Stop being a Cloop runner: revoke this computer on
|
|
@@ -55,7 +57,7 @@ async function main() {
|
|
|
55
57
|
switch (command) {
|
|
56
58
|
case "login":
|
|
57
59
|
case "auth": {
|
|
58
|
-
const { loginCommand } = await import("./login-
|
|
60
|
+
const { loginCommand } = await import("./login-IQSMR2SY.js");
|
|
59
61
|
await loginCommand(argv);
|
|
60
62
|
break;
|
|
61
63
|
}
|
|
@@ -65,57 +67,57 @@ async function main() {
|
|
|
65
67
|
break;
|
|
66
68
|
}
|
|
67
69
|
case "serve": {
|
|
68
|
-
const { startMcpServer } = await import("./mcp-server-
|
|
70
|
+
const { startMcpServer } = await import("./mcp-server-PRPB2JYE.js");
|
|
69
71
|
await startMcpServer();
|
|
70
72
|
break;
|
|
71
73
|
}
|
|
72
74
|
case "statusline": {
|
|
73
|
-
const { statuslineCommand } = await import("./statusline-
|
|
75
|
+
const { statuslineCommand } = await import("./statusline-UVEWJ4BA.js");
|
|
74
76
|
statuslineCommand();
|
|
75
77
|
break;
|
|
76
78
|
}
|
|
77
79
|
case "connect": {
|
|
78
|
-
const { connectCommand } = await import("./connect-
|
|
80
|
+
const { connectCommand } = await import("./connect-CGOALTSO.js");
|
|
79
81
|
await connectCommand(argv.slice(1));
|
|
80
82
|
break;
|
|
81
83
|
}
|
|
82
84
|
case "use": {
|
|
83
|
-
const { useCommand } = await import("./use-
|
|
85
|
+
const { useCommand } = await import("./use-3B33RXZH.js");
|
|
84
86
|
process.exitCode = await useCommand(argv.slice(1));
|
|
85
87
|
break;
|
|
86
88
|
}
|
|
87
89
|
case "disconnect": {
|
|
88
|
-
const { disconnectCommand } = await import("./disconnect-
|
|
90
|
+
const { disconnectCommand } = await import("./disconnect-H3RDATJF.js");
|
|
89
91
|
await disconnectCommand(argv.slice(1));
|
|
90
92
|
break;
|
|
91
93
|
}
|
|
92
94
|
case "box": {
|
|
93
|
-
const { boxCommand } = await import("./box-
|
|
95
|
+
const { boxCommand } = await import("./box-Z4NS6J7A.js");
|
|
94
96
|
await boxCommand(argv.slice(1));
|
|
95
97
|
break;
|
|
96
98
|
}
|
|
97
99
|
case "runs": {
|
|
98
|
-
const { runsCommand } = await import("./runs-
|
|
100
|
+
const { runsCommand } = await import("./runs-BMTJHKBI.js");
|
|
99
101
|
process.exitCode = runsCommand();
|
|
100
102
|
break;
|
|
101
103
|
}
|
|
102
104
|
case "watch": {
|
|
103
|
-
const { watchCommand } = await import("./runs-
|
|
105
|
+
const { watchCommand } = await import("./runs-BMTJHKBI.js");
|
|
104
106
|
process.exitCode = await watchCommand(argv.slice(1));
|
|
105
107
|
break;
|
|
106
108
|
}
|
|
107
109
|
case "takeover": {
|
|
108
|
-
const { takeoverCommand } = await import("./takeover-
|
|
110
|
+
const { takeoverCommand } = await import("./takeover-XL2P7RML.js");
|
|
109
111
|
process.exitCode = await takeoverCommand(argv.slice(1));
|
|
110
112
|
break;
|
|
111
113
|
}
|
|
112
114
|
case "resume": {
|
|
113
|
-
const { resumeCommand } = await import("./runs-
|
|
115
|
+
const { resumeCommand } = await import("./runs-BMTJHKBI.js");
|
|
114
116
|
process.exitCode = await resumeCommand(argv.slice(1));
|
|
115
117
|
break;
|
|
116
118
|
}
|
|
117
119
|
case "runner": {
|
|
118
|
-
const { runnerCommand } = await import("./runner-
|
|
120
|
+
const { runnerCommand } = await import("./runner-JNMWMBIG.js");
|
|
119
121
|
await runnerCommand(argv.slice(1));
|
|
120
122
|
break;
|
|
121
123
|
}
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
deviceLogin,
|
|
4
4
|
loginCommand,
|
|
5
5
|
refusalSentence
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VBWETWB5.js";
|
|
7
7
|
import "./chunk-AG6SI6I2.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-Q2MTOW4O.js";
|
|
9
9
|
import "./chunk-3DIGCVL4.js";
|
|
10
10
|
export {
|
|
11
11
|
deviceLogin,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
connectWebhook,
|
|
4
4
|
runnerCommand
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-QAOAR5OL.js";
|
|
6
|
+
import "./chunk-VBWETWB5.js";
|
|
7
7
|
import "./chunk-AG6SI6I2.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-Q2MTOW4O.js";
|
|
9
9
|
import "./chunk-3DIGCVL4.js";
|
|
10
10
|
export {
|
|
11
11
|
connectWebhook,
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
runsCommand,
|
|
9
9
|
sessionFolder,
|
|
10
10
|
watchCommand
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-V4QYTF6O.js";
|
|
12
|
+
import "./chunk-IRRQ55FQ.js";
|
|
13
|
+
import "./chunk-VIQF3JF3.js";
|
|
14
14
|
import "./chunk-VK6GV757.js";
|
|
15
15
|
import "./chunk-3DIGCVL4.js";
|
|
16
16
|
export {
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
takeoverDir,
|
|
10
10
|
writeTakeoverReply,
|
|
11
11
|
writeTakeoverRequest
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-3PIT6YXL.js";
|
|
13
|
+
import "./chunk-V4QYTF6O.js";
|
|
14
|
+
import "./chunk-IRRQ55FQ.js";
|
|
15
15
|
import "./chunk-MWWA2VH7.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-VIQF3JF3.js";
|
|
17
17
|
import "./chunk-JX6VG5FE.js";
|
|
18
18
|
import "./chunk-VK6GV757.js";
|
|
19
19
|
import "./chunk-AG6SI6I2.js";
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
import {
|
|
3
3
|
DRIVER_NAME,
|
|
4
4
|
runConnect
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VKEX5FVO.js";
|
|
6
6
|
import "./chunk-MWWA2VH7.js";
|
|
7
7
|
import {
|
|
8
8
|
isLocal,
|
|
9
9
|
readRunnerConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VIQF3JF3.js";
|
|
11
11
|
import "./chunk-JX6VG5FE.js";
|
|
12
12
|
import "./chunk-VK6GV757.js";
|
|
13
13
|
import "./chunk-R3CLO2FB.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-QAOAR5OL.js";
|
|
15
|
+
import "./chunk-VBWETWB5.js";
|
|
16
16
|
import "./chunk-AG6SI6I2.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-Q2MTOW4O.js";
|
|
18
18
|
import "./chunk-3DIGCVL4.js";
|
|
19
19
|
|
|
20
20
|
// src/commands/use.ts
|
package/package.json
CHANGED