@cloop/runner 0.2.6 → 0.2.8
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-Q5AA4S2T.js → box-TMEYQ5AN.js} +53 -41
- package/dist/{chunk-E3V2PRVS.js → chunk-5GPCD7HI.js} +21 -148
- package/dist/{chunk-UEV7ARIT.js → chunk-GGK4FLAH.js} +7 -7
- package/dist/{chunk-GTE4QSTR.js → chunk-JXVCUFUB.js} +1 -1
- package/dist/{chunk-H7ZCXBNW.js → chunk-L5R7QXIB.js} +362 -46
- package/dist/{chunk-V4IYJUCC.js → chunk-LJTAYH6Q.js} +6 -6
- package/dist/{chunk-2SZUL2B6.js → chunk-SQLFEVGP.js} +1 -1
- package/dist/{chunk-SXV4JF5H.js → chunk-WKJBZKUO.js} +8 -26
- package/dist/{chunk-52VJGOLJ.js → chunk-YVMU3GCX.js} +1 -1
- package/dist/{connect-FG5VDH5N.js → connect-RLDBBQI7.js} +6 -5
- package/dist/{disconnect-ZV32O475.js → disconnect-UYN2G7CO.js} +7 -7
- package/dist/index.js +18 -16
- package/dist/{login-ZKPZEFCV.js → login-262MCIQ4.js} +2 -2
- package/dist/{mcp-server-TINABFRL.js → mcp-server-R5LX4ER5.js} +5 -5
- package/dist/{runner-VY3HK7L4.js → runner-ML437F74.js} +3 -3
- package/dist/{runs-QLO2XZVZ.js → runs-UV7GEDGW.js} +3 -3
- package/dist/{statusline-BWUUERD5.js → statusline-LDW7RBT6.js} +1 -1
- package/dist/{takeover-TKQ5V4KV.js → takeover-KTRIOB3P.js} +5 -5
- package/dist/{use-ALFEOPLY.js → use-2W7Y42JQ.js} +6 -5
- package/package.json +1 -1
- package/dist/{hook-activity-R7OPEYBX.js → hook-activity-LBYV4WJW.js} +1 -1
- package/dist/{hook-session-start-GEBGA63R.js → hook-session-start-YSEV5DCB.js} +3 -3
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
serveTakeovers
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-LJTAYH6Q.js";
|
|
5
|
+
import "./chunk-GGK4FLAH.js";
|
|
6
6
|
import {
|
|
7
7
|
LocalDriver
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5GPCD7HI.js";
|
|
9
9
|
import {
|
|
10
10
|
MeshSocket,
|
|
11
11
|
defaultSocketFactory
|
|
12
12
|
} from "./chunk-ZILLDYL4.js";
|
|
13
|
-
import "./chunk-VK6GV757.js";
|
|
14
13
|
import {
|
|
15
14
|
DEFAULT_FALLBACK_MODEL,
|
|
16
15
|
T3Client,
|
|
@@ -22,7 +21,7 @@ import {
|
|
|
22
21
|
probeClaudePermissions,
|
|
23
22
|
probeCodex,
|
|
24
23
|
runBoxTool
|
|
25
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WKJBZKUO.js";
|
|
26
25
|
import {
|
|
27
26
|
BoxWatch,
|
|
28
27
|
lockThreadsFile,
|
|
@@ -33,16 +32,20 @@ import {
|
|
|
33
32
|
T3Driver,
|
|
34
33
|
isLocal,
|
|
35
34
|
readRunnerConfig,
|
|
35
|
+
showsOtherThreads,
|
|
36
36
|
writeBoxConfig
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-L5R7QXIB.js";
|
|
38
38
|
import {
|
|
39
39
|
getMachine
|
|
40
40
|
} from "./chunk-JX6VG5FE.js";
|
|
41
|
+
import "./chunk-VK6GV757.js";
|
|
41
42
|
import "./chunk-R3CLO2FB.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-YVMU3GCX.js";
|
|
44
|
+
import "./chunk-SQLFEVGP.js";
|
|
44
45
|
import "./chunk-AG6SI6I2.js";
|
|
45
|
-
import
|
|
46
|
+
import {
|
|
47
|
+
VERSION
|
|
48
|
+
} from "./chunk-JXVCUFUB.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,148 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
stripControl
|
|
4
|
-
} from "./chunk-VK6GV757.js";
|
|
5
2
|
import {
|
|
6
3
|
BoxToolError,
|
|
7
4
|
RESULT_INSTRUCTION,
|
|
5
|
+
STOPPED_SUMMARY,
|
|
6
|
+
appendRunLog,
|
|
7
|
+
endNote,
|
|
8
|
+
isProgressSentence,
|
|
9
|
+
logLineFor,
|
|
10
|
+
nextProgress,
|
|
8
11
|
orderThreads,
|
|
9
|
-
parseRunResult
|
|
10
|
-
|
|
12
|
+
parseRunResult,
|
|
13
|
+
prUrlIn,
|
|
14
|
+
pruneRunLogs,
|
|
15
|
+
resultPrUrl,
|
|
16
|
+
runLogDir
|
|
17
|
+
} from "./chunk-L5R7QXIB.js";
|
|
11
18
|
import {
|
|
12
19
|
CONFIG_DIR
|
|
13
20
|
} from "./chunk-3DIGCVL4.js";
|
|
14
21
|
|
|
15
|
-
// src/run-log.ts
|
|
16
|
-
import {
|
|
17
|
-
appendFileSync,
|
|
18
|
-
chmodSync,
|
|
19
|
-
mkdirSync,
|
|
20
|
-
readdirSync,
|
|
21
|
-
renameSync,
|
|
22
|
-
statSync,
|
|
23
|
-
unlinkSync
|
|
24
|
-
} from "fs";
|
|
25
|
-
import { dirname, join } from "path";
|
|
26
|
-
var RUN_LOG_LINE_MAX = 500;
|
|
27
|
-
var RUN_LOG_MAX_BYTES = 5 * 1024 * 1024;
|
|
28
|
-
var RUN_LOG_KEEP_MS = 14 * 24 * 36e5;
|
|
29
|
-
var SAFE_ID = /^[\w-]{1,100}$/;
|
|
30
|
-
function runLogDir(runsFile) {
|
|
31
|
-
return join(dirname(runsFile), "runs");
|
|
32
|
-
}
|
|
33
|
-
function runLogPath(dir, workId) {
|
|
34
|
-
return SAFE_ID.test(workId) ? join(dir, `${workId}.log`) : null;
|
|
35
|
-
}
|
|
36
|
-
var SECRETS = [
|
|
37
|
-
[/-----BEGIN [A-Z ]*PRIVATE KEY-----.*/g, "[redacted private key]"],
|
|
38
|
-
[/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{8,}/gi, "$1 [redacted]"],
|
|
39
|
-
[/(:\/\/)[^\s/@:]+:[^\s/@]+@/g, "$1[redacted]@"],
|
|
40
|
-
[
|
|
41
|
-
/([?&](?:access_token|token|key|api_key|apikey|secret|sig|signature|code|password)=)[^&\s"']+/gi,
|
|
42
|
-
"$1[redacted]"
|
|
43
|
-
],
|
|
44
|
-
[
|
|
45
|
-
/(\b(?:[\w-]*(?:token|secret|passw(?:or)?d|pwd|api[_-]?key|apikey|credential|private[_-]?key)[\w-]*|authorization|auth)["']?\s*[=:]\s*["']?)(?!Bearer\b|Basic\b|\[redacted)[^\s"',;}]{4,}/gi,
|
|
46
|
-
"$1[redacted]"
|
|
47
|
-
],
|
|
48
|
-
[
|
|
49
|
-
/(--?[\w-]*(?:token|secret|password|api-key|apikey)[\w-]*[ =])["']?[^\s"']{4,}["']?/gi,
|
|
50
|
-
"$1[redacted]"
|
|
51
|
-
],
|
|
52
|
-
[/\b(?:sk|pk|rk)-[A-Za-z0-9_-]{16,}/g, "[redacted]"],
|
|
53
|
-
[/\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})/g, "[redacted]"],
|
|
54
|
-
[/\bxox[abprs]-[A-Za-z0-9-]{10,}/g, "[redacted]"],
|
|
55
|
-
[/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g, "[redacted]"],
|
|
56
|
-
[/\bAIza[0-9A-Za-z_-]{30,}/g, "[redacted]"],
|
|
57
|
-
[/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{4,}/g, "[redacted]"]
|
|
58
|
-
];
|
|
59
|
-
var OPAQUE = /[A-Za-z0-9_+=-]{32,}/g;
|
|
60
|
-
function redactSecrets(text) {
|
|
61
|
-
let out = text;
|
|
62
|
-
for (const [pattern, replacement] of SECRETS) out = out.replace(pattern, replacement);
|
|
63
|
-
return out.replace(
|
|
64
|
-
OPAQUE,
|
|
65
|
-
(run2) => /^[0-9a-f-]+$/i.test(run2) || !/\d/.test(run2) || !/[A-Za-z]/.test(run2) ? run2 : "[redacted]"
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
function logText(text) {
|
|
69
|
-
const flat = redactSecrets(stripControl(text).replace(/\s+/g, " ").trim());
|
|
70
|
-
return flat.length > RUN_LOG_LINE_MAX ? `${flat.slice(0, RUN_LOG_LINE_MAX - 1)}\u2026` : flat;
|
|
71
|
-
}
|
|
72
|
-
function logLineFor(item) {
|
|
73
|
-
switch (item.type) {
|
|
74
|
-
case "text":
|
|
75
|
-
return item.text;
|
|
76
|
-
case "tool": {
|
|
77
|
-
const input = item.detail ?? item.summary ?? item.target;
|
|
78
|
-
return `> ${item.name}${input ? `: ${input}` : ""}`;
|
|
79
|
-
}
|
|
80
|
-
case "ask":
|
|
81
|
-
return `? ${item.summary}`;
|
|
82
|
-
case "result":
|
|
83
|
-
return item.ok ? `= Result: ${item.text ?? "done"}` : `= Error: ${item.text ?? "no text"}`;
|
|
84
|
-
default:
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function appendRunLog(dir, workId, text, { now = Date.now(), maxBytes = RUN_LOG_MAX_BYTES } = {}) {
|
|
89
|
-
const path = runLogPath(dir, workId);
|
|
90
|
-
if (!path) return;
|
|
91
|
-
const line = `${stamp(now)} ${logText(text)}
|
|
92
|
-
`;
|
|
93
|
-
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
94
|
-
const size = sizeOf(path);
|
|
95
|
-
if (size > 0 && size + Buffer.byteLength(line) > maxBytes) renameSync(path, `${path}.1`);
|
|
96
|
-
appendFileSync(path, line, { mode: 384 });
|
|
97
|
-
}
|
|
98
|
-
function pruneRunLogs(dir, now = Date.now(), keepMs = RUN_LOG_KEEP_MS) {
|
|
99
|
-
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
100
|
-
chmodSync(dir, 448);
|
|
101
|
-
let removed = 0;
|
|
102
|
-
for (const name of readdirSync(dir)) {
|
|
103
|
-
if (!/\.log(\.1)?$/.test(name)) continue;
|
|
104
|
-
const path = join(dir, name);
|
|
105
|
-
try {
|
|
106
|
-
if (statSync(path).mtimeMs < now - keepMs) {
|
|
107
|
-
unlinkSync(path);
|
|
108
|
-
removed++;
|
|
109
|
-
}
|
|
110
|
-
} catch {
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return removed;
|
|
114
|
-
}
|
|
115
|
-
function sizeOf(path) {
|
|
116
|
-
try {
|
|
117
|
-
return statSync(path).size;
|
|
118
|
-
} catch {
|
|
119
|
-
return 0;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
var STOPPED_SUMMARY = "The run was stopped.";
|
|
123
|
-
function endNote(end) {
|
|
124
|
-
return `= ${end.kind === "settled" ? "Done" : "Ended"}: ${end.summary ?? end.kind}`;
|
|
125
|
-
}
|
|
126
|
-
function isEndLogLine(line) {
|
|
127
|
-
return /^\S+ = (Done|Ended): /.test(line);
|
|
128
|
-
}
|
|
129
|
-
function stamp(now) {
|
|
130
|
-
const d = new Date(now);
|
|
131
|
-
return [d.getHours(), d.getMinutes(), d.getSeconds()].map((n) => String(n).padStart(2, "0")).join(":");
|
|
132
|
-
}
|
|
133
|
-
|
|
134
22
|
// src/drivers/local.ts
|
|
135
23
|
import { execFile, execFileSync, spawn } from "child_process";
|
|
136
|
-
import { chmodSync
|
|
24
|
+
import { chmodSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
137
25
|
import { homedir, hostname } from "os";
|
|
138
|
-
import { basename, dirname
|
|
26
|
+
import { basename, dirname, join } from "path";
|
|
139
27
|
import { createInterface } from "readline";
|
|
140
28
|
var STOPPED = { kind: "failed", summary: STOPPED_SUMMARY };
|
|
141
29
|
function takeoverSummary(machine) {
|
|
142
30
|
return `You took this over on ${machine}.`;
|
|
143
31
|
}
|
|
144
32
|
var CONTINUE_PROMPT = "Continue the work from where you stopped. If it is already done, say so in one sentence.";
|
|
145
|
-
var PR_URL = /https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/pull\/\d+/g;
|
|
146
33
|
var SHARED_BRANCHES = /* @__PURE__ */ new Set(["staging", "main", "master", "HEAD"]);
|
|
147
34
|
var COMMANDS_KEPT = 50;
|
|
148
35
|
var SUMMARY_MAX = 200;
|
|
@@ -165,7 +52,7 @@ function failedEnd(harness, run2) {
|
|
|
165
52
|
return { summary: `${lead}${quoted}"`, ...error };
|
|
166
53
|
}
|
|
167
54
|
function localRunsFilePath() {
|
|
168
|
-
return process.env.CLOOP_LOCAL_RUNS_FILE ??
|
|
55
|
+
return process.env.CLOOP_LOCAL_RUNS_FILE ?? join(homedir(), CONFIG_DIR, "local-runs.json");
|
|
169
56
|
}
|
|
170
57
|
function pickRepo(repos, repository) {
|
|
171
58
|
if (!repository) {
|
|
@@ -179,9 +66,6 @@ function pickRepo(repos, repository) {
|
|
|
179
66
|
if (!found) throw new BoxToolError("no_project");
|
|
180
67
|
return found;
|
|
181
68
|
}
|
|
182
|
-
function prUrlIn(text) {
|
|
183
|
-
return text?.match(PR_URL)?.at(-1) ?? null;
|
|
184
|
-
}
|
|
185
69
|
function run(cmd, args, cwd) {
|
|
186
70
|
return new Promise(
|
|
187
71
|
(resolve, reject) => execFile(
|
|
@@ -604,12 +488,8 @@ ${RESULT_INSTRUCTION}`));
|
|
|
604
488
|
}
|
|
605
489
|
}
|
|
606
490
|
progress(r, live, line, force) {
|
|
607
|
-
const summary = (
|
|
608
|
-
if (
|
|
609
|
-
const now = this.now();
|
|
610
|
-
if (!force && now - live.lastProgressAt < (this.deps.progressMs ?? 3e4)) return;
|
|
611
|
-
live.lastProgressAt = now;
|
|
612
|
-
this.emit(r.work_id, { kind: "progress", summary });
|
|
491
|
+
const summary = nextProgress(live, line, this.now(), this.deps.progressMs, force);
|
|
492
|
+
if (summary) this.emit(r.work_id, { kind: "progress", summary });
|
|
613
493
|
}
|
|
614
494
|
async onExit(r, live, code, signal) {
|
|
615
495
|
if (this.lives.get(r.work_id) === live) this.lives.delete(r.work_id);
|
|
@@ -685,7 +565,7 @@ ${RESULT_INSTRUCTION}`));
|
|
|
685
565
|
* work. A run that committed without pushing says so.
|
|
686
566
|
*/
|
|
687
567
|
async outcome(r, text) {
|
|
688
|
-
const named =
|
|
568
|
+
const named = resultPrUrl(text);
|
|
689
569
|
if (named) return { pr: named };
|
|
690
570
|
if (!r.head_at_launch) return { pr: null };
|
|
691
571
|
const head = await this.repo.head(r.repo);
|
|
@@ -730,12 +610,12 @@ ${RESULT_INSTRUCTION}`));
|
|
|
730
610
|
return readRunRecords(this.file).filter((r) => !(r.end && Date.parse(r.end.at) < cutoff));
|
|
731
611
|
}
|
|
732
612
|
save() {
|
|
733
|
-
|
|
613
|
+
mkdirSync(dirname(this.file), { recursive: true, mode: 448 });
|
|
734
614
|
const tmp = `${this.file}.tmp`;
|
|
735
615
|
writeFileSync(tmp, `${JSON.stringify([...this.runs.values()], null, 2)}
|
|
736
616
|
`, { mode: 384 });
|
|
737
|
-
|
|
738
|
-
|
|
617
|
+
chmodSync(tmp, 384);
|
|
618
|
+
renameSync(tmp, this.file);
|
|
739
619
|
}
|
|
740
620
|
};
|
|
741
621
|
function readRunRecords(file = localRunsFilePath()) {
|
|
@@ -748,15 +628,8 @@ function readRunRecords(file = localRunsFilePath()) {
|
|
|
748
628
|
return [];
|
|
749
629
|
}
|
|
750
630
|
}
|
|
751
|
-
function isProgressSentence(value) {
|
|
752
|
-
return typeof value === "string" && /\S[ \t]+\S/.test(value.trim().split(/\r?\n/)[0] ?? "");
|
|
753
|
-
}
|
|
754
631
|
|
|
755
632
|
export {
|
|
756
|
-
runLogDir,
|
|
757
|
-
runLogPath,
|
|
758
|
-
STOPPED_SUMMARY,
|
|
759
|
-
isEndLogLine,
|
|
760
633
|
takeoverSummary,
|
|
761
634
|
localRunsFilePath,
|
|
762
635
|
LocalDriver,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
localRunsFilePath,
|
|
4
|
+
readRunRecords
|
|
5
|
+
} from "./chunk-5GPCD7HI.js";
|
|
2
6
|
import {
|
|
3
7
|
STOPPED_SUMMARY,
|
|
4
8
|
isEndLogLine,
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
isLocal,
|
|
10
|
+
readRunnerConfig,
|
|
7
11
|
runLogDir,
|
|
8
12
|
runLogPath
|
|
9
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-L5R7QXIB.js";
|
|
10
14
|
import {
|
|
11
15
|
sanitizeLabel,
|
|
12
16
|
stripControl
|
|
13
17
|
} from "./chunk-VK6GV757.js";
|
|
14
|
-
import {
|
|
15
|
-
isLocal,
|
|
16
|
-
readRunnerConfig
|
|
17
|
-
} from "./chunk-H7ZCXBNW.js";
|
|
18
18
|
|
|
19
19
|
// src/commands/runs.ts
|
|
20
20
|
import { spawnSync } from "child_process";
|