@outerlayer/cli 0.37.0-next.20261104233800 → 0.37.0-next.20261105010834

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.
Files changed (33) hide show
  1. package/dist/build-info.json +1 -1
  2. package/dist/{check-VOJWXIRZ.js → check-PJ5FLDTD.js} +7 -7
  3. package/dist/{chunk-SQWYFCEU.js → chunk-4A7D2HWQ.js} +1 -1
  4. package/dist/{chunk-VNMTA2JE.js → chunk-4TDBM3PK.js} +1 -1
  5. package/dist/{chunk-LLZG5A2J.js → chunk-77RLQS5V.js} +1 -1
  6. package/dist/{chunk-3Z5GISKU.js → chunk-KE5NFPP2.js} +111 -12
  7. package/dist/{chunk-TSYTPW6Y.js → chunk-P2UH4EBF.js} +13 -5
  8. package/dist/{chunk-ERGU3OZP.js → chunk-Q2JDKHOR.js} +42 -8
  9. package/dist/{chunk-W6GP4CNN.js → chunk-QK43VKE4.js} +1 -1
  10. package/dist/{chunk-FX4ZG4E5.js → chunk-XPIFUWWY.js} +1 -1
  11. package/dist/{chunk-IDYLPN4X.js → chunk-ZEHCE7ZE.js} +1 -1
  12. package/dist/{cli-FFPFIMPZ.js → cli-K62CS6XW.js} +31 -28
  13. package/dist/{command-MYYGFCW3.js → command-EG54FHMR.js} +3 -3
  14. package/dist/{container-start-ICNSSPBS.js → container-start-JBYD2XG4.js} +4 -4
  15. package/dist/{doctor-LEGPWSQ3.js → doctor-MXWODPPL.js} +4 -4
  16. package/dist/{host-checks-VGJVO23Y.js → host-checks-RK5TC3TX.js} +2 -2
  17. package/dist/index.js +1 -1
  18. package/dist/{init-Z6ZVLUJ5.js → init-CSWMBTTM.js} +2 -2
  19. package/dist/{init-F3L4CTBJ.js → init-GH74PR4K.js} +2 -2
  20. package/dist/{init-agent-DO233UTF.js → init-agent-54VT3S3Z.js} +2 -2
  21. package/dist/{init-cmd-AKIPYTNP.js → init-cmd-AIUYATFU.js} +1 -1
  22. package/dist/{loop-MUPQOIW6.js → loop-P7NDQS3G.js} +7 -7
  23. package/dist/{machine-WFZ5KM76.js → machine-UEW4P7I6.js} +2 -2
  24. package/dist/{runner-key-2SKLS37E.js → runner-key-PNZTLOK5.js} +2 -2
  25. package/dist/{status-WZCEHCL2.js → status-X7IK4XQU.js} +2 -2
  26. package/dist/{update-steps-5BGDQTVG.js → update-steps-R7AQAO6R.js} +3 -3
  27. package/dist/{work-claim-cmd-2IOJVHR5.js → work-claim-cmd-YE4MVGZH.js} +1 -1
  28. package/dist/{work-proofs-cmd-P33QGSIQ.js → work-proofs-cmd-Y7WZNTI3.js} +2 -2
  29. package/dist/{work-proofs-record-FN6M7BIZ.js → work-proofs-record-5DCQQT23.js} +66 -8
  30. package/package.json +1 -1
  31. package/skill-pack/maintained/outerlayer-build/references/agent-briefs.md +18 -7
  32. package/skill-pack/maintained/outerlayer-build/references/evidence.md +8 -5
  33. package/dist/{chunk-6SC66WGJ.js → chunk-BNYBHWYH.js} +172 -172
@@ -1 +1 @@
1
- {"id":"2026-11-04T23:44:49.729Z","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
1
+ {"id":"2026-11-05T01:15:16.435Z","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { probeCredentials } from './chunk-ERGU3OZP.js';
3
+ import { probeCredentials } from './chunk-Q2JDKHOR.js';
4
4
  import './chunk-PNZN656P.js';
5
5
  import './chunk-2QFRAMJX.js';
6
6
  import './chunk-LVZ3UV7T.js';
7
7
  import './chunk-3JVYMD4G.js';
8
8
  import './chunk-E7R2GIAW.js';
9
- import './chunk-W6GP4CNN.js';
10
- import './chunk-SQWYFCEU.js';
11
- import './chunk-IDYLPN4X.js';
12
- import { fleetConfigProblem, managedProblems, managedFactsOf, askFleetMachine } from './chunk-LLZG5A2J.js';
9
+ import './chunk-QK43VKE4.js';
10
+ import './chunk-4A7D2HWQ.js';
11
+ import './chunk-ZEHCE7ZE.js';
12
+ import { fleetConfigProblem, managedProblems, managedFactsOf, askFleetMachine } from './chunk-77RLQS5V.js';
13
13
  import './chunk-IJU6DMQA.js';
14
14
  import { findServiceUnit } from './chunk-3LT6REKE.js';
15
- import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, HELPER_ENV, helperSocketPath, probeHelper, needsAgentCredential, agentCredentialCheck, claimPermissionProblem, formerSkillQueues, modellessQueues, formerSkillProblem, modellessProblem } from './chunk-TSYTPW6Y.js';
16
- import './chunk-6SC66WGJ.js';
15
+ import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, HELPER_ENV, helperSocketPath, probeHelper, needsAgentCredential, agentCredentialCheck, claimPermissionProblem, formerSkillQueues, modellessQueues, formerSkillProblem, modellessProblem } from './chunk-P2UH4EBF.js';
16
+ import './chunk-BNYBHWYH.js';
17
17
  import './chunk-2PGI6RDE.js';
18
18
  import './chunk-I3LTIAOR.js';
19
19
  import './chunk-ZHOPDD7U.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { stripTerminalControls } from './chunk-TSYTPW6Y.js';
3
+ import { stripTerminalControls } from './chunk-P2UH4EBF.js';
4
4
  import { tagToPull, imageTag, pullInstruction, readUpdateStatus, runnerImageVersion } from './chunk-NBGBMZE4.js';
5
5
  import { readFileSync } from 'fs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { helperSocketPath } from './chunk-TSYTPW6Y.js';
3
+ import { helperSocketPath } from './chunk-P2UH4EBF.js';
4
4
  import { UNIT_MARKER } from './chunk-VTJ5MGGC.js';
5
5
  import { runnerDir } from './chunk-RXWFZB3P.js';
6
6
  import { createHash } from 'crypto';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { placeholderQueues, placeholderProblem } from './chunk-TSYTPW6Y.js';
3
+ import { placeholderQueues, placeholderProblem } from './chunk-P2UH4EBF.js';
4
4
  import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-VTJ5MGGC.js';
5
5
  import { getJson, WorkCommandError } from './chunk-6BS4DDCY.js';
6
6
  import { isBuiltinVm, builtinKind, EGRESS_SWITCHABLE_KEYS, imageBuildOf, keepsHostBuilder } from './chunk-G43WGW64.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { criteriaOf, loadCitationFinder, testFileMatcher, hostItemsOf, NO_VERDICT_REASON } from './chunk-6SC66WGJ.js';
3
+ import { criteriaOf, loadCitationFinder, testFileMatcher, hostItemsOf, runnerMatcher, NO_VERDICT_REASON } from './chunk-BNYBHWYH.js';
4
4
  import { WorkCommandError, resolveCredentials, getJson } from './chunk-6BS4DDCY.js';
5
5
  import { sanitizeTerminal } from './chunk-VVZIFOAN.js';
6
6
  import { C } from './chunk-2AM6Z5BP.js';
@@ -8,16 +8,17 @@ import { defaultFetch } from './chunk-FYPVUT27.js';
8
8
  import { parseWorkItemEnv } from './chunk-4OD45RBP.js';
9
9
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
10
10
  import { readDeliveryRecord } from './chunk-YQR6E6OV.js';
11
+ import { parseProofsConfig } from './chunk-UZNSGMUZ.js';
11
12
  import { resolveRepoIdentity } from './chunk-ZQNYV4OZ.js';
12
- import { inferArtifactKind, mediaTypeForArtifactPath, WORK_ITEM_COMMENT_MAX_BODY_LENGTH } from './chunk-2JIGPSVF.js';
13
- import { createHash } from 'crypto';
13
+ import { inferArtifactKind, mediaTypeForArtifactPath, WORK_ITEM_COMMENT_MAX_BODY_LENGTH, parseJunit } from './chunk-2JIGPSVF.js';
14
14
  import { spawnSync } from 'child_process';
15
- import { existsSync, statSync, readFileSync } from 'fs';
16
- import { resolve, dirname } from 'path';
15
+ import { createHash } from 'crypto';
16
+ import { readFileSync, readdirSync, lstatSync, statSync, existsSync } from 'fs';
17
+ import { relative, join, resolve, dirname } from 'path';
17
18
 
18
19
  createRequire(import.meta.url);
19
20
  function kindProblem(declared, file) {
20
- if (declared === "test") return "a test proof is recorded by CI, not by --record";
21
+ if (declared === "test") return "a test proof is recorded from the JUnit results of its tests, not from a file named for the criterion";
21
22
  const kind = inferArtifactKind(mediaTypeForArtifactPath(file));
22
23
  return kind === declared ? void 0 : `the kinds differ: the file is a ${kind}, but the criterion declares a ${declared} proof`;
23
24
  }
@@ -128,14 +129,14 @@ function governingDir(cwd) {
128
129
  async function testProofMode(cwd) {
129
130
  const dir = governingDir(cwd);
130
131
  if (dir === void 0) return "any";
131
- const { testProofIn } = await import('./host-checks-VGJVO23Y.js');
132
+ const { testProofIn } = await import('./host-checks-RK5TC3TX.js');
132
133
  return testProofIn(dir);
133
134
  }
134
135
  async function judgeCheckName(cwd) {
135
136
  const dir = governingDir(cwd);
136
137
  if (dir === void 0) return {};
137
138
  if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
138
- const { checksIn, isJudgeCheck } = await import('./host-checks-VGJVO23Y.js');
139
+ const { checksIn, isJudgeCheck } = await import('./host-checks-RK5TC3TX.js');
139
140
  const quiet = { line: () => void 0, error: () => void 0 };
140
141
  const check = checksIn(dir, quiet, "").checks.find((c) => isJudgeCheck(c) && c.judge.subjects === "criteria");
141
142
  return check === void 0 ? {} : { name: check.name };
@@ -161,8 +162,101 @@ async function findUnproven(input) {
161
162
  return { entries: [], notes: [err instanceof Error ? err.message : String(err)] };
162
163
  }
163
164
  }
165
+ function freshXmlFiles(folders, sinceMs) {
166
+ const skipped = /* @__PURE__ */ new Set([".git", "node_modules", ".gradle", ".m2", ".venv", "venv", "__pycache__", ".next", ".turbo"]);
167
+ const found = /* @__PURE__ */ new Set();
168
+ const walk = (folder) => {
169
+ let names;
170
+ try {
171
+ names = readdirSync(folder);
172
+ } catch {
173
+ return;
174
+ }
175
+ for (const name of names) {
176
+ const path = join(folder, name);
177
+ const stat = lstatSync(path, { throwIfNoEntry: false });
178
+ if (stat === void 0) continue;
179
+ if (stat.isDirectory()) {
180
+ if (!skipped.has(name)) walk(path);
181
+ } else if (stat.isFile() && name.endsWith(".xml") && stat.mtimeMs >= sinceMs && stat.size <= 16 * 1024 * 1024) {
182
+ found.add(path);
183
+ }
184
+ }
185
+ };
186
+ for (const folder of folders) walk(folder);
187
+ return [...found].sort();
188
+ }
189
+ function suitesOf(text, root) {
190
+ const start = text.search(new RegExp(`<${root}[\\s>/]`));
191
+ const close = `</${root}>`;
192
+ const end = text.lastIndexOf(close);
193
+ if (root === "testsuite") return text.slice(start, end + close.length);
194
+ return text.slice(text.indexOf(">", start) + 1, end);
195
+ }
196
+ function joinResults(files, names, root) {
197
+ const parts = [];
198
+ const used = [];
199
+ const seen = /* @__PURE__ */ new Set();
200
+ for (const file of files) {
201
+ let bytes;
202
+ try {
203
+ bytes = readFileSync(file);
204
+ } catch {
205
+ continue;
206
+ }
207
+ const parsed = parseJunit(bytes);
208
+ if (parsed.kind !== "junit") continue;
209
+ const held = parsed.testcases.filter((testcase) => names.size === 0 || names.has(testcase.name));
210
+ if (held.length === 0) continue;
211
+ parts.push(suitesOf(bytes.toString("utf8"), parsed.root).trim());
212
+ used.push(relative(root, file) || file);
213
+ for (const testcase of held) seen.add(testcase.name);
214
+ }
215
+ const missing = [...names].filter((name) => !seen.has(name));
216
+ if (parts.length === 0) return { ok: false, reason: "the run wrote no JUnit results that hold its tests" };
217
+ if (missing.length > 0) return { ok: false, reason: `the run's JUnit results do not hold ${missing.slice(0, 3).map((name) => `"${name}"`).join(", ")}${missing.length > 3 ? " and others" : ""}` };
218
+ const xml = `<?xml version="1.0" encoding="UTF-8"?>
219
+ <testsuites>
220
+ ${parts.join("\n")}
221
+ </testsuites>
222
+ `;
223
+ return { ok: true, xml, files: used };
224
+ }
225
+ function testSelectors(tests) {
226
+ if (!tests.selected) return [];
227
+ return tests.items.map((test) => test.file !== null && test.line !== null ? `${test.name}=${test.file}:${test.line}` : test.name);
228
+ }
229
+ function testFilesOf(tests) {
230
+ return [...new Set(tests.items.flatMap((test) => test.file === null ? [] : [test.file]))].sort();
231
+ }
232
+ function recordingProblems(input) {
233
+ const recorded = input.notCurrent;
234
+ if (recorded.length === 0) return [];
235
+ const ids = recorded.map((entry) => entry.id).join(", ");
236
+ if (input.proofsFile === void 0) {
237
+ return [`The host cannot record ${ids} again: .outerlayer-proofs.yaml is missing at HEAD. Commit it with a runner that runs these tests.`];
238
+ }
239
+ const parsed = parseProofsConfig(input.proofsFile);
240
+ if (!parsed.ok) {
241
+ return [`The host cannot record ${ids} again: .outerlayer-proofs.yaml cannot be read: ${parsed.problems.join("; ")}. Fix it and commit it.`];
242
+ }
243
+ const matches = runnerMatcher(parsed.value.runners);
244
+ const problems = [];
245
+ for (const entry of recorded) {
246
+ if (entry.proof !== "test" || entry.tests === void 0) continue;
247
+ const files = testFilesOf(entry.tests);
248
+ const unmatched = files.filter((file) => matches(file) === void 0);
249
+ if (files.length === 0) problems.push(`The host cannot record ${entry.id} again: its results name no test file. Emit them again naming each test with --test <name>=<path>:<line>.`);
250
+ else if (unmatched.length > 0) problems.push(`The host cannot record ${entry.id} again: no runner in .outerlayer-proofs.yaml matches ${unmatched.join(", ")}.`);
251
+ }
252
+ return problems;
253
+ }
164
254
 
165
255
  // src/work-proofs-cmd.ts
256
+ function proofsFileAtHead(cwd) {
257
+ const shown = spawnSync("git", ["show", "HEAD:.outerlayer-proofs.yaml"], { cwd, encoding: "utf8" });
258
+ return shown.status === 0 ? shown.stdout : void 0;
259
+ }
166
260
  function liveHead(pr) {
167
261
  if (pr.state !== "open" && pr.state !== "merged" || typeof pr.headSha !== "string" || pr.headSha === "") return void 0;
168
262
  return pr.headSha.toLowerCase();
@@ -210,7 +304,8 @@ function renderEntry(e) {
210
304
  }
211
305
  const row = `${id} ${sanitizeTerminal(e.proof)} ${STATE_LABEL[e.state]} ${sanitizeTerminal(e.commit ?? "no commit")}`;
212
306
  if (e.proof !== "test" || e.state === "current") return row;
213
- return `${row} Run the tests with a JUnit reporter at HEAD, then run outerlayer emit artifact <file> --for ${id}`;
307
+ if (e.state === "out-of-date") return `${row} Run outerlayer work proofs --record to run its tests again at HEAD, or emit new results with outerlayer emit artifact <file> --for ${id}`;
308
+ return `${row} Run the tests with a JUnit reporter at HEAD, then run outerlayer emit artifact <file> --for ${id} --test <name>=<path>:<line>`;
214
309
  }
215
310
  function render(entries, notes, json, tests) {
216
311
  if (json) return JSON.stringify(entries);
@@ -255,10 +350,14 @@ async function runWorkProofs(opts) {
255
350
  const declared = classifyProofs(body, checkoutHead, { tests });
256
351
  const unproven = await findUnproven({ item: body, cwd, head: checkoutHead });
257
352
  const entries = [...declared, ...unproven.entries];
353
+ const notCurrent = declared.filter((e) => e.state !== "current").map((e) => ({ id: e.id, proof: e.proof, tests: items.find((c) => c.id === e.id).newestProof?.tests }));
354
+ const recording = notCurrent.length === 0 ? [] : recordingProblems({ notCurrent, proofsFile: (opts.readProofsFile ?? proofsFileAtHead)(cwd) });
258
355
  const json = opts.json === true;
259
- const output = render(entries, json ? [] : unproven.notes, json, tests);
356
+ const output = [render(entries, json ? [] : unproven.notes, json, tests), ...json ? [] : recording].join("\n");
260
357
  if (!opts.quiet) {
261
358
  process.stdout.write(output + "\n");
359
+ if (json && recording.length > 0) process.stderr.write(`${recording.join("\n")}
360
+ `);
262
361
  if (json && unproven.notes.length > 0) process.stderr.write(`The command could not check the judge's results: ${unproven.notes.join("; ")}.
263
362
  `);
264
363
  }
@@ -269,7 +368,7 @@ async function runWorkProofs(opts) {
269
368
  async function runWorkProofsCommand(opts) {
270
369
  try {
271
370
  if (opts.record) {
272
- const { runWorkProofsRecord } = await import('./work-proofs-record-FN6M7BIZ.js');
371
+ const { runWorkProofsRecord } = await import('./work-proofs-record-5DCQQT23.js');
273
372
  const result2 = await runWorkProofsRecord(opts);
274
373
  process.exitCode = result2.exitCode;
275
374
  return;
@@ -287,4 +386,4 @@ async function runWorkProofsCommand(opts) {
287
386
  }
288
387
  }
289
388
 
290
- export { classifyProofs, classifyProofsAt, kindProblem, otherPullRequestHeads, ownPullRequest, proofsCommentBody, proofsCommentId, resolveProofsItem, runWorkProofs, runWorkProofsCommand };
389
+ export { classifyProofs, classifyProofsAt, freshXmlFiles, joinResults, kindProblem, otherPullRequestHeads, ownPullRequest, proofsCommentBody, proofsCommentId, resolveProofsItem, runWorkProofs, runWorkProofsCommand, testFilesOf, testProofMode, testSelectors };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems, MAX_TEST_FILE_BYTES } from './chunk-6SC66WGJ.js';
3
+ import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems, MAX_TEST_FILE_BYTES } from './chunk-BNYBHWYH.js';
4
4
  import { sha256OfFile, downloadPinned, VoiceDownloadError } from './chunk-2PGI6RDE.js';
5
5
  import { zodProblem } from './chunk-I3LTIAOR.js';
6
6
  import { hasStoredCredential, storeAgentCredential, credentialFromStdin, isAgentName } from './chunk-ZHOPDD7U.js';
@@ -7201,7 +7201,7 @@ async function releaseLease(config, item, outcome, detail, fetchImpl) {
7201
7201
  `/v1/work-items/${item}/claim/release`,
7202
7202
  config.apiKey,
7203
7203
  config.appId,
7204
- { host: config.host, outcome: sent2, stage: detail.stage, exitCode: detail.exitCode, reason: detail.reason, environment: environment2, resume: resume2, disk: disk2, log: log2 },
7204
+ { host: config.host, claimId: detail.claimId, outcome: sent2, stage: detail.stage, exitCode: detail.exitCode, reason: detail.reason, environment: environment2, resume: resume2, disk: disk2, log: log2 },
7205
7205
  fetchImpl,
7206
7206
  void 0,
7207
7207
  await signerFor(config.configPath)
@@ -7337,10 +7337,9 @@ async function runRecordProofsViaExec(config, job, jobDirPath, spawnFn = spawn)
7337
7337
  return { ok: false, reason: describeCallFailure(err) };
7338
7338
  }
7339
7339
  }
7340
- var RECORDED_PROOFS = /* @__PURE__ */ new Set(["screenshot", "video", "report", "log", "file"]);
7341
7340
  async function declaresRecordedProof(config, item, fetchImpl) {
7342
7341
  try {
7343
- return (criteriaOf(await readWorkItem(config, item, fetchImpl)) ?? []).some((criterion) => criterion.proof !== null && RECORDED_PROOFS.has(criterion.proof));
7342
+ return (criteriaOf(await readWorkItem(config, item, fetchImpl)) ?? []).some((criterion) => criterion.proof !== null);
7344
7343
  } catch {
7345
7344
  return true;
7346
7345
  }
@@ -7829,6 +7828,15 @@ async function retryFailedReleases(jobsDirPath, config, deps) {
7829
7828
  function isUnfinished(job) {
7830
7829
  return job.outcome === void 0 && job.endedAt === void 0;
7831
7830
  }
7831
+ function jobRecordsClaim(jobsDirPath, claimId) {
7832
+ if (!existsSync(jobsDirPath)) return false;
7833
+ for (const entry of readdirSync(jobsDirPath, { withFileTypes: true })) {
7834
+ if (!entry.isDirectory()) continue;
7835
+ if (entry.name.includes(claimId)) return true;
7836
+ if (readJobFile(join(jobsDirPath, entry.name, "job.json"))?.claimId === claimId) return true;
7837
+ }
7838
+ return false;
7839
+ }
7832
7840
  function unfinishedJobs(jobsDirPath) {
7833
7841
  if (!existsSync(jobsDirPath)) return [];
7834
7842
  const found = [];
@@ -11729,4 +11737,4 @@ async function runHostChecks(input) {
11729
11737
  }
11730
11738
  }
11731
11739
 
11732
- export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, agentCredentialCheck, appendCommandLog, attemptNote, checksIn, claimPermissionProblem, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inTeardown, isContainerTracked, isGroupAlive, isIdle, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, judgeProbe, keepGhConfigCurrent, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, provisionContainer, provisionEnvironment, provisionMicroVm, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, recoverLostJobs, releaseLease, removeOldestUntil, renewLease, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, retryFailedReleases, runCommand, runHook, runHostChecks, runHousekeeping, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
11740
+ export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, agentCredentialCheck, appendCommandLog, attemptNote, checksIn, claimPermissionProblem, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inTeardown, isContainerTracked, isGroupAlive, isIdle, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, jobRecordsClaim, judgeProbe, keepGhConfigCurrent, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, provisionContainer, provisionEnvironment, provisionMicroVm, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, recoverLostJobs, releaseLease, removeOldestUntil, renewLease, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, retryFailedReleases, runCommand, runHook, runHostChecks, runHousekeeping, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
@@ -5,12 +5,12 @@ import { writePendingUpdate } from './chunk-2QFRAMJX.js';
5
5
  import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-LVZ3UV7T.js';
6
6
  import { decideInstalledSwitch } from './chunk-3JVYMD4G.js';
7
7
  import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-E7R2GIAW.js';
8
- import { reportFailedStart, fitImageBuildMemory } from './chunk-W6GP4CNN.js';
9
- import { renderUpdateSteps } from './chunk-SQWYFCEU.js';
10
- import { RUNNER_PROTOCOL } from './chunk-IDYLPN4X.js';
11
- import { fleetConfigProblem, realBlockedProbes, sliceMemoryOf, checkBlockedWithSlots, largeBuildMemoryBytes, LARGE_BUILD_DISK_BYTES, checkManagedRoom, askFleetMachine } from './chunk-LLZG5A2J.js';
8
+ import { reportFailedStart, fitImageBuildMemory } from './chunk-QK43VKE4.js';
9
+ import { renderUpdateSteps } from './chunk-4A7D2HWQ.js';
10
+ import { RUNNER_PROTOCOL } from './chunk-ZEHCE7ZE.js';
11
+ import { fleetConfigProblem, realBlockedProbes, sliceMemoryOf, checkBlockedWithSlots, largeBuildMemoryBytes, LARGE_BUILD_DISK_BYTES, checkManagedRoom, askFleetMachine } from './chunk-77RLQS5V.js';
12
12
  import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-IJU6DMQA.js';
13
- import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, releaseLease, LEASE_SECONDS, itemTag, isUnfinished, prepareResume, restoreSessionIntoMicroVm, restoreSessionIntoContainer, itemScope, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, setStage, jobEnv, runHook, describeHookEnd, needsBuildSkill, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, provisionMicroVm, deliverCommitHooks, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, currentSkillCommand, formerSkillProblem, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, containerCommandExec, execCommandLine, startSender, startHostServices, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, HELPER_ENV, setUpRunnerCgroup, stopOrphanedMicroVms, unfinishedJobs, sweepImageBuilders, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, usableCpus, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, stoppedHelperReason, measureDisk, listTrackedJobs, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, restartSender, createHousekeepingDocker, housekeepingDockerIfReachable, runHousekeeping, freeItemDisksUntil, savedStatesDir, readRecords, removeOldestUntil, ensureNetworkReady, managedBuildSettingsFor, ADOPTED_FETCH_RETRY_WINDOW_MS, gitRemoteFor, startServicesFor, createLeaseChannel, serveLease, vmAlive, writeGuestGhConfig, shellQuote, deliverJobFiles, inTeardown } from './chunk-TSYTPW6Y.js';
13
+ import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, releaseLease, LEASE_SECONDS, itemTag, isUnfinished, prepareResume, restoreSessionIntoMicroVm, restoreSessionIntoContainer, itemScope, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, setStage, jobEnv, runHook, describeHookEnd, needsBuildSkill, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, provisionMicroVm, deliverCommitHooks, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, currentSkillCommand, formerSkillProblem, MICROVM_COMMAND_DIR, commandLogOffset, startMicroVmCommand, microVmCommandLine, runCommand, containerCommandExec, execCommandLine, startSender, startHostServices, finishJob, sampleGuest, foldSample, isContainerTracked, isMicroVmTracked, probeMicroVmCommand, probeCommand, appendCommandLog, judgeProbe, EXIT_CODE_FILE, isTracked, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, HELPER_ENV, setUpRunnerCgroup, stopOrphanedMicroVms, unfinishedJobs, sweepImageBuilders, listUnreadableJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, GUEST_USAGE_INTERVAL_MS, usableCpus, hookLimitsFor, AttemptLogBook, microVmOomKills, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, stoppedHelperReason, measureDisk, listTrackedJobs, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, restartSender, createHousekeepingDocker, housekeepingDockerIfReachable, runHousekeeping, jobRecordsClaim, freeItemDisksUntil, savedStatesDir, readRecords, removeOldestUntil, ensureNetworkReady, managedBuildSettingsFor, ADOPTED_FETCH_RETRY_WINDOW_MS, gitRemoteFor, startServicesFor, createLeaseChannel, serveLease, vmAlive, writeGuestGhConfig, shellQuote, deliverJobFiles, inTeardown } from './chunk-P2UH4EBF.js';
14
14
  import { RUNNER_RESERVE_BYTES } from './chunk-VTJ5MGGC.js';
15
15
  import { RepoFilter } from './chunk-KCNL7KX2.js';
16
16
  import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57WI6.js';
@@ -394,6 +394,17 @@ function commentsOf(data) {
394
394
  }
395
395
  return comments;
396
396
  }
397
+ function lapsedOf(data) {
398
+ const raw = data.lapsed;
399
+ if (!Array.isArray(raw)) return [];
400
+ const lapsed = [];
401
+ for (const entry of raw) {
402
+ const { claimId, workItemId, number, expiredAt } = entry ?? {};
403
+ if (typeof claimId !== "string" || claimId === "" || typeof workItemId !== "string" || workItemId === "" || typeof expiredAt !== "string") continue;
404
+ lapsed.push({ claimId, workItemId, number: typeof number === "number" ? number : null, expiredAt });
405
+ }
406
+ return lapsed;
407
+ }
397
408
  function takesBody(takes) {
398
409
  let truncated = false;
399
410
  const list = (patterns) => {
@@ -449,7 +460,8 @@ async function sendHeartbeat(args, fetchImpl) {
449
460
  const runnerVersion = response.data?.runnerVersion;
450
461
  const stops = stopsOf(response.data);
451
462
  const comments = commentsOf(response.data);
452
- return typeof runnerVersion === "string" ? { ok: true, runnerVersion, stops, comments } : { ok: true, stops, comments };
463
+ const lapsed = lapsedOf(response.data);
464
+ return typeof runnerVersion === "string" ? { ok: true, runnerVersion, stops, comments, lapsed } : { ok: true, stops, comments, lapsed };
453
465
  } catch (err) {
454
466
  return { ok: false, reason: describeCallFailure(err) };
455
467
  }
@@ -1347,6 +1359,7 @@ async function sendTickHeartbeat(state, workRequest, wake2 = false) {
1347
1359
  considerNamedVersion(state, result.runnerVersion);
1348
1360
  applyStops(state, result.stops);
1349
1361
  applyComments(state, result.comments);
1362
+ applyLapsed(state, result.lapsed);
1350
1363
  }
1351
1364
  next = state.queuedWorkRequest;
1352
1365
  state.queuedWorkRequest = void 0;
@@ -1379,6 +1392,27 @@ function applyStops(state, stops) {
1379
1392
  });
1380
1393
  }
1381
1394
  }
1395
+ var LAPSED_REASON = "the lease lapsed with no build on this host";
1396
+ function applyLapsed(state, lapsed) {
1397
+ const released = state.lapsedReleases ??= /* @__PURE__ */ new Set();
1398
+ const jobsDirPath = jobsDir(state.config.configPath);
1399
+ for (const lease of lapsed) {
1400
+ if (released.has(lease.claimId)) continue;
1401
+ const held = [...state.jobs.values()].some((entry) => entry.job.claimId === lease.claimId || entry.job.workItemId === lease.workItemId);
1402
+ if (held || jobRecordsClaim(jobsDirPath, lease.claimId)) continue;
1403
+ released.add(lease.claimId);
1404
+ const tag = itemTag({ item: lease.number ?? lease.workItemId });
1405
+ const claim = `${lease.claimId.slice(0, 8)}\u2026`;
1406
+ void releaseLease(runnerCalls(state.config), lease.workItemId, "lease_lost", { reason: LAPSED_REASON, claimId: lease.claimId }, state.deps.fetchImpl).then(() => logOf(state).line(`${tag} released claim ${claim}: ${LAPSED_REASON}`)).catch((err) => {
1407
+ if (err instanceof WorkCommandError && !err.retryable) {
1408
+ logOf(state).line(`${tag} left claim ${claim} as it is: the gateway refused its release: ${describeCallFailure(err)}`);
1409
+ return;
1410
+ }
1411
+ released.delete(lease.claimId);
1412
+ reportRepeating(state, `release of lapsed claim ${lease.claimId}`, `${tag} could not release lapsed claim ${claim}: ${describeCallFailure(err)}`);
1413
+ });
1414
+ }
1415
+ }
1382
1416
  function applyComments(state, comments) {
1383
1417
  if (state.config.deliverComments === false) return;
1384
1418
  for (const comment of comments) {
@@ -3559,7 +3593,7 @@ async function startRunner(configPath, deps, startup) {
3559
3593
  check: update.check ? () => update.check(configPath) : async () => {
3560
3594
  const held = runnerAgents(deps.agents).flatMap((agent) => heldAgentCredential(agent.descriptor.id) ?? []);
3561
3595
  const env = { ...process.env, ...Object.fromEntries(held.map((credential) => [credential.variable, credential.value])) };
3562
- return (await import('./check-VOJWXIRZ.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3596
+ return (await import('./check-PJ5FLDTD.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3563
3597
  },
3564
3598
  now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
3565
3599
  log
@@ -3941,4 +3975,4 @@ function runnerProcessState(configPath) {
3941
3975
  return isSameProcess(entry.pid, entry.start) ? { state: "running", pid: entry.pid } : { state: "stale", pid: entry.pid };
3942
3976
  }
3943
3977
 
3944
- export { RunnerStartError, fleetKeepalive, leaseTimeLeftFor, listJobFiles, logUnusableHelper, prepareSession, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick };
3978
+ export { LAPSED_REASON, RunnerStartError, fleetKeepalive, leaseTimeLeftFor, listJobFiles, logUnusableHelper, prepareSession, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { scrubReason, stripTerminalControls } from './chunk-TSYTPW6Y.js';
3
+ import { scrubReason, stripTerminalControls } from './chunk-P2UH4EBF.js';
4
4
  import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-VTJ5MGGC.js';
5
5
  import { RunnerAlreadyRunningError, readPidFile } from './chunk-WCJCGFVQ.js';
6
6
  import { isSameProcess } from './chunk-JBJTC3UU.js';
@@ -1079,7 +1079,7 @@ async function gatherDoctorChecks() {
1079
1079
  const { runnerVmCheck } = await import('./doctor-53F2PYY7.js');
1080
1080
  checks.push(runnerVmCheck(configPath, { lima: realLima(), home: homeFromEnv(), instance: runnerVm.instance }));
1081
1081
  } else if (hasRunnerBlock(configPath)) {
1082
- const { runnerHostChecks } = await import('./doctor-LEGPWSQ3.js');
1082
+ const { runnerHostChecks } = await import('./doctor-MXWODPPL.js');
1083
1083
  const gateway = (() => {
1084
1084
  try {
1085
1085
  const loaded = loadRunnerConfig(configPath);
@@ -4,6 +4,6 @@ import { createRequire } from 'node:module';
4
4
  createRequire(import.meta.url);
5
5
 
6
6
  // src/runner/protocol.ts
7
- var RUNNER_PROTOCOL = 42;
7
+ var RUNNER_PROTOCOL = 43;
8
8
 
9
9
  export { RUNNER_PROTOCOL };