@kynver-app/runtime 0.1.112 → 0.1.117
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/bootstrap.d.ts +1 -0
- package/dist/cli.js +1559 -397
- package/dist/cli.js.map +4 -4
- package/dist/daemon-heartbeat.d.ts +20 -0
- package/dist/daemon-keeper.d.ts +21 -0
- package/dist/device-login.d.ts +8 -0
- package/dist/index.js +2185 -999
- package/dist/index.js.map +4 -4
- package/dist/provider-evidence/collect.d.ts +18 -0
- package/dist/provider-evidence/exec.d.ts +5 -0
- package/dist/provider-evidence/index.d.ts +7 -0
- package/dist/provider-evidence/recipes-github.d.ts +4 -0
- package/dist/provider-evidence/recipes-vercel.d.ts +2 -0
- package/dist/provider-evidence/registry.d.ts +6 -0
- package/dist/provider-evidence/types.d.ts +48 -0
- package/dist/provider-evidence/wanted-store.d.ts +5 -0
- package/dist/providers/codex.d.ts +7 -2
- package/dist/providers/hermes-codex.d.ts +5 -2
- package/dist/server/cleanup.js +376 -127
- package/dist/server/cleanup.js.map +4 -4
- package/dist/server/default-repo.js +288 -68
- package/dist/server/default-repo.js.map +4 -4
- package/dist/server/monitor.js +342 -126
- package/dist/server/monitor.js.map +4 -4
- package/dist/server/worker-policy.js +304 -49
- package/dist/server/worker-policy.js.map +4 -4
- package/dist/status.d.ts +18 -0
- package/package.json +1 -1
package/dist/server/cleanup.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { existsSync as existsSync8 } from "node:fs";
|
|
6
|
-
import { homedir as homedir3 } from "node:os";
|
|
7
|
-
import path6 from "node:path";
|
|
8
|
-
|
|
9
|
-
// src/config.ts
|
|
10
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
11
|
-
import { homedir as homedir2, totalmem } from "node:os";
|
|
12
|
-
import path5 from "node:path";
|
|
13
|
-
|
|
14
|
-
// src/git.ts
|
|
15
|
-
import { spawnSync } from "node:child_process";
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __esm = (fn, res) => function __init() {
|
|
3
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
|
+
};
|
|
16
5
|
|
|
17
6
|
// src/util.ts
|
|
18
7
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -92,43 +81,55 @@ function latestIso(values) {
|
|
|
92
81
|
function secsAgo(ms) {
|
|
93
82
|
return Math.max(0, Math.round((Date.now() - ms) / 1e3));
|
|
94
83
|
}
|
|
84
|
+
var init_util = __esm({
|
|
85
|
+
"src/util.ts"() {
|
|
86
|
+
"use strict";
|
|
87
|
+
}
|
|
88
|
+
});
|
|
95
89
|
|
|
96
90
|
// src/worker-env.ts
|
|
97
|
-
var FORBIDDEN_WORKER_ENV_KEYS
|
|
98
|
-
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
91
|
+
var FORBIDDEN_WORKER_ENV_KEYS, FORBIDDEN_KEY_SET;
|
|
92
|
+
var init_worker_env = __esm({
|
|
93
|
+
"src/worker-env.ts"() {
|
|
94
|
+
"use strict";
|
|
95
|
+
FORBIDDEN_WORKER_ENV_KEYS = [
|
|
96
|
+
"ANTHROPIC_API_KEY",
|
|
97
|
+
"ANALYST_API_KEY",
|
|
98
|
+
"RECRUITER_API_KEY",
|
|
99
|
+
"AUTH_SECRET",
|
|
100
|
+
"NEXTAUTH_SECRET",
|
|
101
|
+
"DATABASE_URL",
|
|
102
|
+
"PRODUCTION_DATABASE_URL",
|
|
103
|
+
"KYNVER_PRODUCTION_DATABASE_URL",
|
|
104
|
+
"REDIS_URL",
|
|
105
|
+
"GOOGLE_CLIENT_SECRET",
|
|
106
|
+
"GITHUB_CLIENT_SECRET",
|
|
107
|
+
"KYNVER_API_KEY",
|
|
108
|
+
"KYNVER_SERVICE_SECRET",
|
|
109
|
+
"KYNVER_RUNTIME_SECRET",
|
|
110
|
+
"KYNVER_CRON_SECRET",
|
|
111
|
+
"OPENCLAW_CRON_SECRET",
|
|
112
|
+
"QSTASH_TOKEN",
|
|
113
|
+
"QSTASH_CURRENT_SIGNING_KEY",
|
|
114
|
+
"QSTASH_NEXT_SIGNING_KEY",
|
|
115
|
+
"TOOL_SECRETS_KEK",
|
|
116
|
+
"TOOL_EXECUTOR_DISPATCH_SECRET",
|
|
117
|
+
"CLOUDFLARE_API_TOKEN",
|
|
118
|
+
"STRIPE_SECRET_KEY",
|
|
119
|
+
"STRIPE_WEBHOOK_SECRET",
|
|
120
|
+
"STRIPE_IDENTITY_WEBHOOK_SECRET",
|
|
121
|
+
"VOYAGE_API_KEY",
|
|
122
|
+
"PERPLEXITY_API_KEY",
|
|
123
|
+
"FRED_API_KEY",
|
|
124
|
+
"FMP_API_KEY",
|
|
125
|
+
"CURSOR_API_KEY"
|
|
126
|
+
];
|
|
127
|
+
FORBIDDEN_KEY_SET = new Set(FORBIDDEN_WORKER_ENV_KEYS);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
130
|
|
|
131
131
|
// src/git.ts
|
|
132
|
+
import { spawnSync } from "node:child_process";
|
|
132
133
|
function git(cwd, args, options = {}) {
|
|
133
134
|
const res = spawnSync(
|
|
134
135
|
"git",
|
|
@@ -249,6 +250,13 @@ function unknownAncestry(base, error, head = null) {
|
|
|
249
250
|
error
|
|
250
251
|
};
|
|
251
252
|
}
|
|
253
|
+
var init_git = __esm({
|
|
254
|
+
"src/git.ts"() {
|
|
255
|
+
"use strict";
|
|
256
|
+
init_util();
|
|
257
|
+
init_worker_env();
|
|
258
|
+
}
|
|
259
|
+
});
|
|
252
260
|
|
|
253
261
|
// src/path-values.ts
|
|
254
262
|
import { homedir } from "node:os";
|
|
@@ -263,15 +271,37 @@ function expandHomePath(value) {
|
|
|
263
271
|
function resolveUserPath(value) {
|
|
264
272
|
return path2.resolve(expandHomePath(value));
|
|
265
273
|
}
|
|
274
|
+
var init_path_values = __esm({
|
|
275
|
+
"src/path-values.ts"() {
|
|
276
|
+
"use strict";
|
|
277
|
+
}
|
|
278
|
+
});
|
|
266
279
|
|
|
267
|
-
// src/
|
|
268
|
-
|
|
280
|
+
// src/default-repo-discovery.ts
|
|
281
|
+
var init_default_repo_discovery = __esm({
|
|
282
|
+
"src/default-repo-discovery.ts"() {
|
|
283
|
+
"use strict";
|
|
284
|
+
init_git();
|
|
285
|
+
init_path_values();
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
// src/box-identity.ts
|
|
290
|
+
var init_box_identity = __esm({
|
|
291
|
+
"src/box-identity.ts"() {
|
|
292
|
+
"use strict";
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// src/bounded-build/meminfo.ts
|
|
297
|
+
var init_meminfo = __esm({
|
|
298
|
+
"src/bounded-build/meminfo.ts"() {
|
|
299
|
+
"use strict";
|
|
300
|
+
}
|
|
301
|
+
});
|
|
269
302
|
|
|
270
303
|
// src/wsl-host.ts
|
|
271
304
|
import { existsSync as existsSync2, readFileSync as readFileSync2, statfsSync } from "node:fs";
|
|
272
|
-
var DEFAULT_WSL_HOST_WARN_FREE_BYTES = 25 * 1024 * 1024 * 1024;
|
|
273
|
-
var DEFAULT_WSL_HOST_CRITICAL_FREE_BYTES = 12 * 1024 * 1024 * 1024;
|
|
274
|
-
var DEFAULT_WSL_HOST_MOUNT = "/mnt/c";
|
|
275
305
|
function isWslHost() {
|
|
276
306
|
if (process.platform !== "linux") return false;
|
|
277
307
|
for (const probe of ["/proc/sys/kernel/osrelease", "/proc/version"]) {
|
|
@@ -334,12 +364,18 @@ function observeWslHostDisk(options = {}) {
|
|
|
334
364
|
function summarizeWslRecoverySteps() {
|
|
335
365
|
return "Recovery: 1) free Windows C: (empty Recycle Bin / Storage Sense / clear %TEMP%); 2) shut down WSL (`wsl --shutdown`) then compact the VHDX (`Optimize-VHD` or `diskpart compact vdisk`); 3) clear local node_modules / .next / harness worktrees before restarting workers. Full runbook: docs/runbooks/wsl-disk-pressure.md.";
|
|
336
366
|
}
|
|
367
|
+
var DEFAULT_WSL_HOST_WARN_FREE_BYTES, DEFAULT_WSL_HOST_CRITICAL_FREE_BYTES, DEFAULT_WSL_HOST_MOUNT;
|
|
368
|
+
var init_wsl_host = __esm({
|
|
369
|
+
"src/wsl-host.ts"() {
|
|
370
|
+
"use strict";
|
|
371
|
+
DEFAULT_WSL_HOST_WARN_FREE_BYTES = 25 * 1024 * 1024 * 1024;
|
|
372
|
+
DEFAULT_WSL_HOST_CRITICAL_FREE_BYTES = 12 * 1024 * 1024 * 1024;
|
|
373
|
+
DEFAULT_WSL_HOST_MOUNT = "/mnt/c";
|
|
374
|
+
}
|
|
375
|
+
});
|
|
337
376
|
|
|
338
377
|
// src/disk-gate.ts
|
|
339
|
-
|
|
340
|
-
var DEFAULT_CRITICAL_FREE_BYTES = 15 * 1024 * 1024 * 1024;
|
|
341
|
-
var DEFAULT_MAX_USED_PERCENT = 80;
|
|
342
|
-
var DEFAULT_HARD_MAX_USED_PERCENT = 90;
|
|
378
|
+
import { statfsSync as statfsSync2 } from "node:fs";
|
|
343
379
|
function observeRunnerDiskGate(input = {}) {
|
|
344
380
|
const path24 = input.diskPath?.trim() || "/";
|
|
345
381
|
const warnBelowBytes = input.diskFreeWarnBytes ?? DEFAULT_WARN_FREE_BYTES;
|
|
@@ -381,6 +417,17 @@ function observeRunnerDiskGate(input = {}) {
|
|
|
381
417
|
wslHost
|
|
382
418
|
};
|
|
383
419
|
}
|
|
420
|
+
var DEFAULT_WARN_FREE_BYTES, DEFAULT_CRITICAL_FREE_BYTES, DEFAULT_MAX_USED_PERCENT, DEFAULT_HARD_MAX_USED_PERCENT;
|
|
421
|
+
var init_disk_gate = __esm({
|
|
422
|
+
"src/disk-gate.ts"() {
|
|
423
|
+
"use strict";
|
|
424
|
+
init_wsl_host();
|
|
425
|
+
DEFAULT_WARN_FREE_BYTES = 30 * 1024 * 1024 * 1024;
|
|
426
|
+
DEFAULT_CRITICAL_FREE_BYTES = 15 * 1024 * 1024 * 1024;
|
|
427
|
+
DEFAULT_MAX_USED_PERCENT = 80;
|
|
428
|
+
DEFAULT_HARD_MAX_USED_PERCENT = 90;
|
|
429
|
+
}
|
|
430
|
+
});
|
|
384
431
|
|
|
385
432
|
// src/run-store.ts
|
|
386
433
|
import { existsSync as existsSync3, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
@@ -428,6 +475,13 @@ function runDirectory(id) {
|
|
|
428
475
|
function runDirectoryAt(harnessRoot, id) {
|
|
429
476
|
return runDir(harnessRunsDir(harnessRoot), safeSlug(id));
|
|
430
477
|
}
|
|
478
|
+
var init_run_store = __esm({
|
|
479
|
+
"src/run-store.ts"() {
|
|
480
|
+
"use strict";
|
|
481
|
+
init_paths();
|
|
482
|
+
init_util();
|
|
483
|
+
}
|
|
484
|
+
});
|
|
431
485
|
|
|
432
486
|
// src/run-worker-index.ts
|
|
433
487
|
import { existsSync as existsSync4, readdirSync as readdirSync3 } from "node:fs";
|
|
@@ -445,9 +499,13 @@ function listRunWorkerNames(run) {
|
|
|
445
499
|
}
|
|
446
500
|
return [...names];
|
|
447
501
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
502
|
+
var init_run_worker_index = __esm({
|
|
503
|
+
"src/run-worker-index.ts"() {
|
|
504
|
+
"use strict";
|
|
505
|
+
init_run_store();
|
|
506
|
+
init_util();
|
|
507
|
+
}
|
|
508
|
+
});
|
|
451
509
|
|
|
452
510
|
// src/heartbeat-final-result.ts
|
|
453
511
|
function tryParseJsonObject(text) {
|
|
@@ -498,9 +556,14 @@ function terminalFinalResultFromHeartbeatRow(row) {
|
|
|
498
556
|
if (embedded) return embedded;
|
|
499
557
|
return summary;
|
|
500
558
|
}
|
|
559
|
+
var init_heartbeat_final_result = __esm({
|
|
560
|
+
"src/heartbeat-final-result.ts"() {
|
|
561
|
+
"use strict";
|
|
562
|
+
}
|
|
563
|
+
});
|
|
501
564
|
|
|
502
565
|
// src/heartbeat.ts
|
|
503
|
-
|
|
566
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "node:fs";
|
|
504
567
|
function isTerminalHeartbeatPhase(phase) {
|
|
505
568
|
return phase === "complete";
|
|
506
569
|
}
|
|
@@ -563,29 +626,17 @@ function parseHeartbeat(file) {
|
|
|
563
626
|
}
|
|
564
627
|
return result;
|
|
565
628
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
629
|
+
var HEARTBEAT_FUTURE_SKEW_MS;
|
|
630
|
+
var init_heartbeat = __esm({
|
|
631
|
+
"src/heartbeat.ts"() {
|
|
632
|
+
"use strict";
|
|
633
|
+
init_heartbeat_final_result();
|
|
634
|
+
init_util();
|
|
635
|
+
HEARTBEAT_FUTURE_SKEW_MS = 6e4;
|
|
636
|
+
}
|
|
637
|
+
});
|
|
569
638
|
|
|
570
639
|
// src/repo-search.ts
|
|
571
|
-
var RG_BINARIES = /* @__PURE__ */ new Set(["rg", "ripgrep", "grep"]);
|
|
572
|
-
var RG_OPTS_WITH_VALUE = /* @__PURE__ */ new Set([
|
|
573
|
-
"-e",
|
|
574
|
-
"--regexp",
|
|
575
|
-
"-f",
|
|
576
|
-
"--file",
|
|
577
|
-
"-m",
|
|
578
|
-
"--max-count",
|
|
579
|
-
"-A",
|
|
580
|
-
"--after-context",
|
|
581
|
-
"-B",
|
|
582
|
-
"--before-context",
|
|
583
|
-
"-C",
|
|
584
|
-
"--context",
|
|
585
|
-
"-g",
|
|
586
|
-
"--glob",
|
|
587
|
-
"--iglob"
|
|
588
|
-
]);
|
|
589
640
|
function binaryName(token) {
|
|
590
641
|
if (!token) return null;
|
|
591
642
|
const base = token.split("/").pop() ?? token;
|
|
@@ -784,11 +835,32 @@ function diagnoseRepoSearchFailure(input) {
|
|
|
784
835
|
}
|
|
785
836
|
return null;
|
|
786
837
|
}
|
|
838
|
+
var RG_BINARIES, RG_OPTS_WITH_VALUE;
|
|
839
|
+
var init_repo_search = __esm({
|
|
840
|
+
"src/repo-search.ts"() {
|
|
841
|
+
"use strict";
|
|
842
|
+
RG_BINARIES = /* @__PURE__ */ new Set(["rg", "ripgrep", "grep"]);
|
|
843
|
+
RG_OPTS_WITH_VALUE = /* @__PURE__ */ new Set([
|
|
844
|
+
"-e",
|
|
845
|
+
"--regexp",
|
|
846
|
+
"-f",
|
|
847
|
+
"--file",
|
|
848
|
+
"-m",
|
|
849
|
+
"--max-count",
|
|
850
|
+
"-A",
|
|
851
|
+
"--after-context",
|
|
852
|
+
"-B",
|
|
853
|
+
"--before-context",
|
|
854
|
+
"-C",
|
|
855
|
+
"--context",
|
|
856
|
+
"-g",
|
|
857
|
+
"--glob",
|
|
858
|
+
"--iglob"
|
|
859
|
+
]);
|
|
860
|
+
}
|
|
861
|
+
});
|
|
787
862
|
|
|
788
863
|
// src/shell-command-outcome.ts
|
|
789
|
-
var NPM_AUDIT_RE = /\bnpm\s+audit\b/i;
|
|
790
|
-
var RG_CMD_RE = /\b(rg|ripgrep)\b/i;
|
|
791
|
-
var RG_REAL_ERROR_RE = /\b(error|invalid|unknown|panic|not found)\b/i;
|
|
792
864
|
function tidy(text, max = 200) {
|
|
793
865
|
const one = text.replace(/\s+/g, " ").trim();
|
|
794
866
|
return one.length > max ? `${one.slice(0, max - 1)}\u2026` : one;
|
|
@@ -992,8 +1064,19 @@ function classifyShellCommandOutcome(input) {
|
|
|
992
1064
|
summary: `command failed (exit ${input.exitCode}): ${tail}`
|
|
993
1065
|
};
|
|
994
1066
|
}
|
|
1067
|
+
var NPM_AUDIT_RE, RG_CMD_RE, RG_REAL_ERROR_RE;
|
|
1068
|
+
var init_shell_command_outcome = __esm({
|
|
1069
|
+
"src/shell-command-outcome.ts"() {
|
|
1070
|
+
"use strict";
|
|
1071
|
+
init_repo_search();
|
|
1072
|
+
NPM_AUDIT_RE = /\bnpm\s+audit\b/i;
|
|
1073
|
+
RG_CMD_RE = /\b(rg|ripgrep)\b/i;
|
|
1074
|
+
RG_REAL_ERROR_RE = /\b(error|invalid|unknown|panic|not found)\b/i;
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
995
1077
|
|
|
996
1078
|
// src/stream.ts
|
|
1079
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "node:fs";
|
|
997
1080
|
function eventTimestampIso(event) {
|
|
998
1081
|
const tsMs = event.timestamp_ms;
|
|
999
1082
|
return event.timestamp || event.ts || (tsMs ? new Date(tsMs).toISOString() : void 0);
|
|
@@ -1094,38 +1177,15 @@ function parseHarnessStream(file) {
|
|
|
1094
1177
|
}
|
|
1095
1178
|
return result;
|
|
1096
1179
|
}
|
|
1180
|
+
var init_stream = __esm({
|
|
1181
|
+
"src/stream.ts"() {
|
|
1182
|
+
"use strict";
|
|
1183
|
+
init_shell_command_outcome();
|
|
1184
|
+
init_util();
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1097
1187
|
|
|
1098
1188
|
// src/exit-classify.ts
|
|
1099
|
-
var FAILURE_PATTERNS = [
|
|
1100
|
-
{
|
|
1101
|
-
test: /\b(?:invalid|unknown|unsupported|unrecognized)\b[^.\n]*\bmodel\b/i,
|
|
1102
|
-
label: "provider rejected the requested model"
|
|
1103
|
-
},
|
|
1104
|
-
{
|
|
1105
|
-
test: /\bmodel\b[^.\n]*\b(?:not\s+(?:found|supported|available|recognized|valid)|is\s+not\s+valid|does\s+not\s+exist)/i,
|
|
1106
|
-
label: "provider rejected the requested model"
|
|
1107
|
-
},
|
|
1108
|
-
{
|
|
1109
|
-
test: /\b(?:did you mean|available models|choose (?:a|one of)|supported models)\b/i,
|
|
1110
|
-
label: "provider rejected the requested model"
|
|
1111
|
-
},
|
|
1112
|
-
{
|
|
1113
|
-
test: /model preflight failed/i,
|
|
1114
|
-
label: "model/provider preflight failed"
|
|
1115
|
-
},
|
|
1116
|
-
{
|
|
1117
|
-
test: /\b(?:command not found|ENOENT|is the .*CLI on PATH|executable not found|no such file or directory)\b/i,
|
|
1118
|
-
label: "provider CLI is missing or not on PATH"
|
|
1119
|
-
},
|
|
1120
|
-
{
|
|
1121
|
-
test: /\bfailed to spawn\b/i,
|
|
1122
|
-
label: "provider failed to spawn the worker process"
|
|
1123
|
-
},
|
|
1124
|
-
{
|
|
1125
|
-
test: /\b(?:not logged in|unauthorized|authentication (?:failed|required)|invalid api key|missing api key|401)\b/i,
|
|
1126
|
-
label: "provider authentication failed"
|
|
1127
|
-
}
|
|
1128
|
-
];
|
|
1129
1189
|
function tidy2(errorText, max = 240) {
|
|
1130
1190
|
const oneLine2 = errorText.replace(/\s+/g, " ").trim();
|
|
1131
1191
|
return oneLine2.length > max ? `${oneLine2.slice(0, max - 1)}\u2026` : oneLine2;
|
|
@@ -1140,6 +1200,42 @@ function classifyExitFailure(errorText) {
|
|
|
1140
1200
|
}
|
|
1141
1201
|
return null;
|
|
1142
1202
|
}
|
|
1203
|
+
var FAILURE_PATTERNS;
|
|
1204
|
+
var init_exit_classify = __esm({
|
|
1205
|
+
"src/exit-classify.ts"() {
|
|
1206
|
+
"use strict";
|
|
1207
|
+
FAILURE_PATTERNS = [
|
|
1208
|
+
{
|
|
1209
|
+
test: /\b(?:invalid|unknown|unsupported|unrecognized)\b[^.\n]*\bmodel\b/i,
|
|
1210
|
+
label: "provider rejected the requested model"
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
test: /\bmodel\b[^.\n]*\b(?:not\s+(?:found|supported|available|recognized|valid)|is\s+not\s+valid|does\s+not\s+exist)/i,
|
|
1214
|
+
label: "provider rejected the requested model"
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
test: /\b(?:did you mean|available models|choose (?:a|one of)|supported models)\b/i,
|
|
1218
|
+
label: "provider rejected the requested model"
|
|
1219
|
+
},
|
|
1220
|
+
{
|
|
1221
|
+
test: /model preflight failed/i,
|
|
1222
|
+
label: "model/provider preflight failed"
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
test: /\b(?:command not found|ENOENT|is the .*CLI on PATH|executable not found|no such file or directory)\b/i,
|
|
1226
|
+
label: "provider CLI is missing or not on PATH"
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
test: /\bfailed to spawn\b/i,
|
|
1230
|
+
label: "provider failed to spawn the worker process"
|
|
1231
|
+
},
|
|
1232
|
+
{
|
|
1233
|
+
test: /\b(?:not logged in|unauthorized|authentication (?:failed|required)|invalid api key|missing api key|401)\b/i,
|
|
1234
|
+
label: "provider authentication failed"
|
|
1235
|
+
}
|
|
1236
|
+
];
|
|
1237
|
+
}
|
|
1238
|
+
});
|
|
1143
1239
|
|
|
1144
1240
|
// src/exited-salvage.ts
|
|
1145
1241
|
function trimOrNull(value) {
|
|
@@ -1198,6 +1294,11 @@ function assessExitedWorkerSalvage(input) {
|
|
|
1198
1294
|
attentionReason: buildAttentionReason(kind, uncommittedCount, headCommit)
|
|
1199
1295
|
};
|
|
1200
1296
|
}
|
|
1297
|
+
var init_exited_salvage = __esm({
|
|
1298
|
+
"src/exited-salvage.ts"() {
|
|
1299
|
+
"use strict";
|
|
1300
|
+
}
|
|
1301
|
+
});
|
|
1201
1302
|
|
|
1202
1303
|
// src/landing-gate.ts
|
|
1203
1304
|
function trimOrNull2(value) {
|
|
@@ -1243,6 +1344,11 @@ function landingAttentionReason(verdict) {
|
|
|
1243
1344
|
if (!verdict.blocked) return void 0;
|
|
1244
1345
|
return verdict.detail ?? verdict.reason ?? "dirty_worktree_no_pr";
|
|
1245
1346
|
}
|
|
1347
|
+
var init_landing_gate = __esm({
|
|
1348
|
+
"src/landing-gate.ts"() {
|
|
1349
|
+
"use strict";
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1246
1352
|
|
|
1247
1353
|
// src/worker-final-result-embed.ts
|
|
1248
1354
|
function tryParseJsonObject2(text) {
|
|
@@ -1292,6 +1398,11 @@ function extractEmbeddedWorkerFinalResultRecord(value) {
|
|
|
1292
1398
|
}
|
|
1293
1399
|
return best;
|
|
1294
1400
|
}
|
|
1401
|
+
var init_worker_final_result_embed = __esm({
|
|
1402
|
+
"src/worker-final-result-embed.ts"() {
|
|
1403
|
+
"use strict";
|
|
1404
|
+
}
|
|
1405
|
+
});
|
|
1295
1406
|
|
|
1296
1407
|
// src/landing-contract-gate.ts
|
|
1297
1408
|
function trimOrNull3(value) {
|
|
@@ -1451,10 +1562,14 @@ function landingContractAttentionReason(verdict) {
|
|
|
1451
1562
|
if (!verdict.blocked) return void 0;
|
|
1452
1563
|
return verdict.detail ?? verdict.reason;
|
|
1453
1564
|
}
|
|
1565
|
+
var init_landing_contract_gate = __esm({
|
|
1566
|
+
"src/landing-contract-gate.ts"() {
|
|
1567
|
+
"use strict";
|
|
1568
|
+
init_worker_final_result_embed();
|
|
1569
|
+
}
|
|
1570
|
+
});
|
|
1454
1571
|
|
|
1455
1572
|
// src/status.ts
|
|
1456
|
-
var NO_START_MS = 18e4;
|
|
1457
|
-
var STALE_MS = 6e5;
|
|
1458
1573
|
function computeAttention(input) {
|
|
1459
1574
|
const now = Date.now();
|
|
1460
1575
|
if (input.completionBlocker && !isSkippedTerminalCompletionBlocker(input.completionBlocker)) {
|
|
@@ -1646,7 +1761,15 @@ function computeWorkerStatus(worker, options = {}) {
|
|
|
1646
1761
|
changedFiles,
|
|
1647
1762
|
gitAncestry,
|
|
1648
1763
|
instructionPolicyFingerprint: worker.instructionPolicyFingerprint ?? null,
|
|
1649
|
-
instructionPolicyEvidence: worker.instructionPolicyEvidence ?? null
|
|
1764
|
+
instructionPolicyEvidence: worker.instructionPolicyEvidence ?? null,
|
|
1765
|
+
model: worker.model ?? worker.orchestrationAudit?.model ?? null,
|
|
1766
|
+
provider: worker.orchestrationAudit?.provider ?? null,
|
|
1767
|
+
boxKind: worker.boxKind ?? null,
|
|
1768
|
+
boxId: worker.boxId ?? null,
|
|
1769
|
+
runtimeId: worker.runtimeId ?? null,
|
|
1770
|
+
personaSlug: worker.personaSlug ?? null,
|
|
1771
|
+
dispatched: worker.dispatched ?? null,
|
|
1772
|
+
localOnly: worker.localOnly ?? null
|
|
1650
1773
|
};
|
|
1651
1774
|
}
|
|
1652
1775
|
function isFinishedWorkerStatus(status) {
|
|
@@ -1659,15 +1782,63 @@ function isLandingBlockedWorkerStatus(status) {
|
|
|
1659
1782
|
if (!status.finalResult) return false;
|
|
1660
1783
|
return status.attention.state === "needs_attention" || status.attention.state === "blocked";
|
|
1661
1784
|
}
|
|
1785
|
+
var NO_START_MS, STALE_MS;
|
|
1786
|
+
var init_status = __esm({
|
|
1787
|
+
"src/status.ts"() {
|
|
1788
|
+
"use strict";
|
|
1789
|
+
init_heartbeat();
|
|
1790
|
+
init_stream();
|
|
1791
|
+
init_exit_classify();
|
|
1792
|
+
init_exited_salvage();
|
|
1793
|
+
init_git();
|
|
1794
|
+
init_landing_gate();
|
|
1795
|
+
init_landing_contract_gate();
|
|
1796
|
+
init_worker_final_result_embed();
|
|
1797
|
+
init_util();
|
|
1798
|
+
NO_START_MS = 18e4;
|
|
1799
|
+
STALE_MS = 6e5;
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
|
|
1803
|
+
// src/harness-worker-active.ts
|
|
1804
|
+
var init_harness_worker_active = __esm({
|
|
1805
|
+
"src/harness-worker-active.ts"() {
|
|
1806
|
+
"use strict";
|
|
1807
|
+
init_status();
|
|
1808
|
+
}
|
|
1809
|
+
});
|
|
1662
1810
|
|
|
1663
1811
|
// src/resource-gate.ts
|
|
1664
|
-
var DEFAULT_PER_WORKER_MEM_BYTES
|
|
1665
|
-
var
|
|
1812
|
+
var DEFAULT_PER_WORKER_MEM_BYTES, DEFAULT_MEM_RESERVE_BYTES;
|
|
1813
|
+
var init_resource_gate = __esm({
|
|
1814
|
+
"src/resource-gate.ts"() {
|
|
1815
|
+
"use strict";
|
|
1816
|
+
init_meminfo();
|
|
1817
|
+
init_config();
|
|
1818
|
+
init_box_identity();
|
|
1819
|
+
init_worker_cap_source();
|
|
1820
|
+
init_disk_gate();
|
|
1821
|
+
init_run_store();
|
|
1822
|
+
init_run_worker_index();
|
|
1823
|
+
init_harness_worker_active();
|
|
1824
|
+
init_util();
|
|
1825
|
+
DEFAULT_PER_WORKER_MEM_BYTES = 500 * 1024 * 1024;
|
|
1826
|
+
DEFAULT_MEM_RESERVE_BYTES = 4 * 1024 * 1024 * 1024;
|
|
1827
|
+
}
|
|
1828
|
+
});
|
|
1829
|
+
|
|
1830
|
+
// src/worker-cap-source.ts
|
|
1831
|
+
var init_worker_cap_source = __esm({
|
|
1832
|
+
"src/worker-cap-source.ts"() {
|
|
1833
|
+
"use strict";
|
|
1834
|
+
init_resource_gate();
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
1666
1837
|
|
|
1667
1838
|
// src/config.ts
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1839
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
1840
|
+
import { homedir as homedir2, totalmem } from "node:os";
|
|
1841
|
+
import path5 from "node:path";
|
|
1671
1842
|
function loadUserConfig() {
|
|
1672
1843
|
if (!existsSync7(CONFIG_FILE)) return {};
|
|
1673
1844
|
try {
|
|
@@ -1676,12 +1847,28 @@ function loadUserConfig() {
|
|
|
1676
1847
|
return {};
|
|
1677
1848
|
}
|
|
1678
1849
|
}
|
|
1679
|
-
var
|
|
1680
|
-
var
|
|
1850
|
+
var CONFIG_DIR, CONFIG_FILE, CREDENTIALS_FILE, SETUP_PER_WORKER_MEM_BYTES, SETUP_MEM_RESERVE_BYTES;
|
|
1851
|
+
var init_config = __esm({
|
|
1852
|
+
"src/config.ts"() {
|
|
1853
|
+
"use strict";
|
|
1854
|
+
init_default_repo_discovery();
|
|
1855
|
+
init_path_values();
|
|
1856
|
+
init_util();
|
|
1857
|
+
init_box_identity();
|
|
1858
|
+
init_worker_cap_source();
|
|
1859
|
+
init_disk_gate();
|
|
1860
|
+
CONFIG_DIR = path5.join(homedir2(), ".kynver");
|
|
1861
|
+
CONFIG_FILE = path5.join(CONFIG_DIR, "config.json");
|
|
1862
|
+
CREDENTIALS_FILE = path5.join(CONFIG_DIR, "credentials");
|
|
1863
|
+
SETUP_PER_WORKER_MEM_BYTES = 500 * 1024 * 1024;
|
|
1864
|
+
SETUP_MEM_RESERVE_BYTES = 4 * 1024 * 1024 * 1024;
|
|
1865
|
+
}
|
|
1866
|
+
});
|
|
1681
1867
|
|
|
1682
1868
|
// src/paths.ts
|
|
1683
|
-
|
|
1684
|
-
|
|
1869
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
1870
|
+
import { homedir as homedir3 } from "node:os";
|
|
1871
|
+
import path6 from "node:path";
|
|
1685
1872
|
function normalizeHarnessRoot(root) {
|
|
1686
1873
|
let resolved = path6.resolve(resolveUserPath(root.trim()));
|
|
1687
1874
|
while (HARNESS_LAYOUT_DIR_NAMES.has(path6.basename(resolved))) {
|
|
@@ -1716,10 +1903,30 @@ function getHarnessPaths() {
|
|
|
1716
1903
|
function runDir(runsDir, id) {
|
|
1717
1904
|
return path6.join(runsDir, safeSlug(id));
|
|
1718
1905
|
}
|
|
1906
|
+
var LEGACY_ROOT, HARNESS_LAYOUT_DIR_NAMES;
|
|
1907
|
+
var init_paths = __esm({
|
|
1908
|
+
"src/paths.ts"() {
|
|
1909
|
+
"use strict";
|
|
1910
|
+
init_config();
|
|
1911
|
+
init_path_values();
|
|
1912
|
+
init_util();
|
|
1913
|
+
LEGACY_ROOT = path6.join(homedir3(), ".openclaw", "harness");
|
|
1914
|
+
HARNESS_LAYOUT_DIR_NAMES = /* @__PURE__ */ new Set(["runs", "worktrees"]);
|
|
1915
|
+
}
|
|
1916
|
+
});
|
|
1917
|
+
|
|
1918
|
+
// src/cleanup.ts
|
|
1919
|
+
init_paths();
|
|
1920
|
+
import path23 from "node:path";
|
|
1719
1921
|
|
|
1720
1922
|
// src/cleanup-guards.ts
|
|
1923
|
+
init_landing_gate();
|
|
1721
1924
|
import path8 from "node:path";
|
|
1722
1925
|
|
|
1926
|
+
// src/cleanup-index-status.ts
|
|
1927
|
+
init_git();
|
|
1928
|
+
init_status();
|
|
1929
|
+
|
|
1723
1930
|
// src/cleanup-build-cache-paths.ts
|
|
1724
1931
|
var HARNESS_BUILD_CACHE_RELATIVE_PATHS = [
|
|
1725
1932
|
".next",
|
|
@@ -1774,6 +1981,7 @@ function isPrOrUnmergedWork(status) {
|
|
|
1774
1981
|
}
|
|
1775
1982
|
|
|
1776
1983
|
// src/cleanup-index-status.ts
|
|
1984
|
+
init_util();
|
|
1777
1985
|
function indexedWorktreeStatus(entry) {
|
|
1778
1986
|
if (!entry.status) {
|
|
1779
1987
|
entry.status = computeWorkerStatus(entry.worker, {
|
|
@@ -1850,7 +2058,14 @@ function resolveWorktreeGuardStatus(entry, ctx) {
|
|
|
1850
2058
|
return indexedWorktreeStatus(entry);
|
|
1851
2059
|
}
|
|
1852
2060
|
|
|
2061
|
+
// src/cleanup-guards.ts
|
|
2062
|
+
init_status();
|
|
2063
|
+
|
|
1853
2064
|
// src/finalize.ts
|
|
2065
|
+
init_run_store();
|
|
2066
|
+
init_run_worker_index();
|
|
2067
|
+
init_status();
|
|
2068
|
+
init_util();
|
|
1854
2069
|
import path7 from "node:path";
|
|
1855
2070
|
var ACTIVE_RUN_STATUSES = /* @__PURE__ */ new Set([
|
|
1856
2071
|
"running",
|
|
@@ -1908,7 +2123,12 @@ function finalizeStaleRuns() {
|
|
|
1908
2123
|
return finalized;
|
|
1909
2124
|
}
|
|
1910
2125
|
|
|
2126
|
+
// src/cleanup-run-liveness.ts
|
|
2127
|
+
init_status();
|
|
2128
|
+
|
|
1911
2129
|
// src/cleanup-completion-blocker.ts
|
|
2130
|
+
init_landing_gate();
|
|
2131
|
+
init_status();
|
|
1912
2132
|
function completionBlockerBlocksWorktreeRemoval(indexed, status) {
|
|
1913
2133
|
const blocker = typeof indexed.worker.completionBlocker === "string" ? indexed.worker.completionBlocker.trim() : "";
|
|
1914
2134
|
if (!blocker) return false;
|
|
@@ -1928,6 +2148,7 @@ function completionBlockerBlocksWorktreeRemoval(indexed, status) {
|
|
|
1928
2148
|
}
|
|
1929
2149
|
|
|
1930
2150
|
// src/cleanup-run-liveness.ts
|
|
2151
|
+
init_util();
|
|
1931
2152
|
var TERMINAL_WORKER_JSON_STATUSES = /* @__PURE__ */ new Set([
|
|
1932
2153
|
"done",
|
|
1933
2154
|
"exited",
|
|
@@ -2081,6 +2302,8 @@ import { existsSync as existsSync11, readdirSync as readdirSync6, statSync as st
|
|
|
2081
2302
|
import path12 from "node:path";
|
|
2082
2303
|
|
|
2083
2304
|
// src/cleanup-active-worktrees.ts
|
|
2305
|
+
init_run_store();
|
|
2306
|
+
init_paths();
|
|
2084
2307
|
import { existsSync as existsSync10, readdirSync as readdirSync5, statSync as statSync4 } from "node:fs";
|
|
2085
2308
|
import path11 from "node:path";
|
|
2086
2309
|
|
|
@@ -2088,7 +2311,19 @@ import path11 from "node:path";
|
|
|
2088
2311
|
import { existsSync as existsSync9, readdirSync as readdirSync4, statSync as statSync3 } from "node:fs";
|
|
2089
2312
|
import path10 from "node:path";
|
|
2090
2313
|
|
|
2314
|
+
// src/default-repo.ts
|
|
2315
|
+
init_config();
|
|
2316
|
+
init_default_repo_discovery();
|
|
2317
|
+
init_path_values();
|
|
2318
|
+
|
|
2319
|
+
// src/run-metadata-retention.ts
|
|
2320
|
+
init_heartbeat();
|
|
2321
|
+
init_paths();
|
|
2322
|
+
init_run_store();
|
|
2323
|
+
|
|
2091
2324
|
// src/worker-metadata-paths.ts
|
|
2325
|
+
init_paths();
|
|
2326
|
+
init_util();
|
|
2092
2327
|
import path9 from "node:path";
|
|
2093
2328
|
var NESTED_RUNS = `${path9.sep}runs${path9.sep}runs${path9.sep}`;
|
|
2094
2329
|
function workerArtifactPaths(workerDir) {
|
|
@@ -2102,6 +2337,7 @@ function workerArtifactPaths(workerDir) {
|
|
|
2102
2337
|
}
|
|
2103
2338
|
|
|
2104
2339
|
// src/run-metadata-retention.ts
|
|
2340
|
+
init_util();
|
|
2105
2341
|
var RUN_METADATA_ACTIVE_SIGNAL_MS = 15 * 60 * 1e3;
|
|
2106
2342
|
function isHarnessRunMetadataPath(targetPath, harnessRoot) {
|
|
2107
2343
|
const resolved = path10.resolve(targetPath);
|
|
@@ -2173,6 +2409,7 @@ function collectFilesystemLiveRunKeys(harnessRoot, now = Date.now()) {
|
|
|
2173
2409
|
}
|
|
2174
2410
|
|
|
2175
2411
|
// src/cleanup-active-worktrees.ts
|
|
2412
|
+
init_util();
|
|
2176
2413
|
function workerHasRecentHarnessActivity(worker, now) {
|
|
2177
2414
|
const paths = [worker.heartbeatPath, worker.stdoutPath, worker.stderrPath];
|
|
2178
2415
|
for (const target of paths) {
|
|
@@ -2221,6 +2458,7 @@ function isWorktreeOnLiveRun(worktreePath, harnessRoot, runId, liveRunKeys) {
|
|
|
2221
2458
|
}
|
|
2222
2459
|
|
|
2223
2460
|
// src/cleanup-run-directory.ts
|
|
2461
|
+
init_util();
|
|
2224
2462
|
function pathAgeMs(target, now) {
|
|
2225
2463
|
try {
|
|
2226
2464
|
const mtime = statSync5(target).mtimeMs;
|
|
@@ -2283,6 +2521,7 @@ function scanStaleRunDirectoryCandidates(opts) {
|
|
|
2283
2521
|
}
|
|
2284
2522
|
|
|
2285
2523
|
// src/cleanup-execute.ts
|
|
2524
|
+
init_git();
|
|
2286
2525
|
import { existsSync as existsSync14, rmSync as rmSync2 } from "node:fs";
|
|
2287
2526
|
|
|
2288
2527
|
// src/cleanup-dir-size.ts
|
|
@@ -2338,6 +2577,7 @@ function directorySizeBytes(root, maxEntries = 5e4) {
|
|
|
2338
2577
|
|
|
2339
2578
|
// src/cleanup-remove-path.ts
|
|
2340
2579
|
import { existsSync as existsSync13, rmSync } from "node:fs";
|
|
2580
|
+
init_paths();
|
|
2341
2581
|
|
|
2342
2582
|
// src/cleanup-path-ownership.ts
|
|
2343
2583
|
import { lstatSync, readdirSync as readdirSync8 } from "node:fs";
|
|
@@ -2846,6 +3086,7 @@ function scanDependencyCacheCandidates(opts) {
|
|
|
2846
3086
|
}
|
|
2847
3087
|
|
|
2848
3088
|
// src/cleanup-duplicate-worktrees.ts
|
|
3089
|
+
init_git();
|
|
2849
3090
|
import { existsSync as existsSync17, statSync as statSync9 } from "node:fs";
|
|
2850
3091
|
import path18 from "node:path";
|
|
2851
3092
|
function pathAgeMs4(target, now) {
|
|
@@ -2938,6 +3179,8 @@ function scanDuplicateWorktreeCandidates(opts) {
|
|
|
2938
3179
|
}
|
|
2939
3180
|
|
|
2940
3181
|
// src/cleanup-worktree-index.ts
|
|
3182
|
+
init_run_store();
|
|
3183
|
+
init_util();
|
|
2941
3184
|
import path19 from "node:path";
|
|
2942
3185
|
function buildWorktreeIndexAt(harnessRoot) {
|
|
2943
3186
|
const index = /* @__PURE__ */ new Map();
|
|
@@ -3008,6 +3251,7 @@ function resolveHarnessRetention(options = {}) {
|
|
|
3008
3251
|
}
|
|
3009
3252
|
|
|
3010
3253
|
// src/cleanup-orphan-safety.ts
|
|
3254
|
+
init_git();
|
|
3011
3255
|
import { existsSync as existsSync18, statSync as statSync10 } from "node:fs";
|
|
3012
3256
|
import path20 from "node:path";
|
|
3013
3257
|
var DEFAULT_HEARTBEAT_FRESH_MS = 30 * 60 * 1e3;
|
|
@@ -3060,6 +3304,7 @@ function assessOrphanWorktreeSafety(input) {
|
|
|
3060
3304
|
}
|
|
3061
3305
|
|
|
3062
3306
|
// src/harness-storage-snapshot.ts
|
|
3307
|
+
init_paths();
|
|
3063
3308
|
import { existsSync as existsSync19, readdirSync as readdirSync11, statSync as statSync11 } from "node:fs";
|
|
3064
3309
|
import path21 from "node:path";
|
|
3065
3310
|
function harnessStorageSnapshot(opts = {}) {
|
|
@@ -3134,6 +3379,7 @@ function harnessStorageSnapshot(opts = {}) {
|
|
|
3134
3379
|
}
|
|
3135
3380
|
|
|
3136
3381
|
// src/cleanup-harness-roots.ts
|
|
3382
|
+
init_paths();
|
|
3137
3383
|
import { existsSync as existsSync20 } from "node:fs";
|
|
3138
3384
|
import { homedir as homedir4 } from "node:os";
|
|
3139
3385
|
import path22 from "node:path";
|
|
@@ -3169,6 +3415,7 @@ function resolveHarnessScanRoots(options = {}) {
|
|
|
3169
3415
|
}
|
|
3170
3416
|
|
|
3171
3417
|
// src/cleanup-disk-pressure.ts
|
|
3418
|
+
init_disk_gate();
|
|
3172
3419
|
function envFlag2(name) {
|
|
3173
3420
|
const v = process.env[name];
|
|
3174
3421
|
return v === "1" || v === "true" || v === "yes";
|
|
@@ -3218,6 +3465,7 @@ function emitCleanupProgress(phase, detail) {
|
|
|
3218
3465
|
}
|
|
3219
3466
|
|
|
3220
3467
|
// src/cleanup-git-rev-cache.ts
|
|
3468
|
+
init_git();
|
|
3221
3469
|
var CleanupGitRevCache = class {
|
|
3222
3470
|
aheadOfMain = /* @__PURE__ */ new Map();
|
|
3223
3471
|
countAheadOfMain(worktreePath, base = "origin/main") {
|
|
@@ -3236,6 +3484,7 @@ var CleanupGitRevCache = class {
|
|
|
3236
3484
|
};
|
|
3237
3485
|
|
|
3238
3486
|
// src/cleanup-git-status-cache.ts
|
|
3487
|
+
init_git();
|
|
3239
3488
|
var CleanupGitStatusCache = class {
|
|
3240
3489
|
cache = /* @__PURE__ */ new Map();
|
|
3241
3490
|
porcelain(worktreePath) {
|