@outerlayer/cli 0.34.0-next.20261028002917 → 0.34.0-next.20261028010245

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.
@@ -1 +1 @@
1
- {"id":"2026-10-28T00:31:49.139Z+965fd25","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
1
+ {"id":"2026-10-28T01:05:50.347Z+dd29145","root":"/home/runner/work/outerlayer/outerlayer","pkg":"outerlayer"}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { probeCredentials } from './chunk-ILTVAD5Y.js';
3
+ import { probeCredentials } from './chunk-HFMK2R7O.js';
4
4
  import './chunk-3JVYMD4G.js';
5
5
  import './chunk-GMEXR6PY.js';
6
6
  import './chunk-E7R2GIAW.js';
@@ -12,14 +12,14 @@ import { JOB_STATE_FORMAT, readsJobState, jobStateFormatOf } from './chunk-ZVB57
12
12
  import { realBlockedProbes, checkBlockedWithSlots, largeBuildMemoryBytes, LARGE_BUILD_DISK_BYTES, checkManagedRoom, sliceMemoryOf, createHousekeepingDocker, housekeepingDockerIfReachable, KIND_LABEL, RECIPE_KEY_LABEL } from './chunk-3E7QAXUW.js';
13
13
  import { writeMarker, readMarker, currentVersion, removeMarker, isInLayout, startedThroughCurrent, entryIn, versionDir, switchCurrent, cleanVersions, stagingDir } from './chunk-I4YOWQH7.js';
14
14
  import { RepoFilter } from './chunk-TBT347UY.js';
15
- import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, needsBuildSkill, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, provisionEnvironment, resolveHostBuild, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, currentSkillCommand, formerSkillProblem, containerCommandExec, execCommandLine, startHostServices, setUpRunnerCgroup, sweepImageBuilders, stoppedHelperReason, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, ensureNetworkReady, managedBuildSettingsFor, ADOPTED_FETCH_RETRY_WINDOW_MS, gitRemoteFor, startServicesFor, createLeaseChannel } from './chunk-VB4QD4WN.js';
15
+ import { leaseTimeLeftMs, createContainerRuntime, withTunnelLog, LEASE_SECONDS, attemptNote, fetchManagedClaudeKey, holdManagedClaudeKey, fetchManagedBuildSettings, holdManagedBuildSettings, needsBuildSkill, provisionContainer, leaseExpiresAtMs, deliverContainerHooks, provisionEnvironment, resolveHostBuild, listenOnBroker, hostEnvironment, deliverExecMaven, runWithSpawn, hostCommandEnvironment, lifecycleSteps, execArgv, lifecycleFailureReason, decideHostBuildSkill, prepareBranch, currentSkillCommand, formerSkillProblem, containerCommandExec, execCommandLine, startHostServices, HELPER_ENV, setUpRunnerCgroup, sweepImageBuilders, stoppedHelperReason, measureDisk, parseCpuList, ensureTunnel, keepGhConfigCurrent, filesAreCopied, ensureNetworkReady, managedBuildSettingsFor, ADOPTED_FETCH_RETRY_WINDOW_MS, gitRemoteFor, startServicesFor, createLeaseChannel } from './chunk-VB4QD4WN.js';
16
16
  import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, resolveGoverningSource, BuildTokens, classifyRefusal, refusalCode, createRunnerLog, formatClock } from './chunk-PPQTTJSW.js';
17
17
  import { imageTag, writeUpdateStatus, pullInstruction, tagToPull } from './chunk-LBKCYEJT.js';
18
18
  import { isVersion, compareVersions, satisfiesRange } from './chunk-TQMI335S.js';
19
19
  import { isBuiltinContainer, isBuiltinVm, isBuiltinProcess, loadRunnerConfig, checkHooks, builtinKind, keepsHostBuilder, DEFAULT_UPDATE_MAX_WAIT_HOURS } from './chunk-GXMMILQ4.js';
20
20
  import { freeBytes, formatBytes, allocatedBytes } from './chunk-EGJY6MBC.js';
21
21
  import { writeJobFile, ensureRunnerIdentity, identityDockerFor, readJobFile, exceedsDisk, builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, spawnRun, readJobFileChecked } from './chunk-AHWMY3MS.js';
22
- import { claimPidFile, writePidFile, readPidFile, releasePidFile } from './chunk-3X6OSXSB.js';
22
+ import { claimPidFile, releasePidFile, writePidFile, readPidFile } from './chunk-3X6OSXSB.js';
23
23
  import { startTimeOf, isSameProcess } from './chunk-JBJTC3UU.js';
24
24
  import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-GJYGOFF3.js';
25
25
  import { loadHostKey, ensureHostKey, signerFor } from './chunk-VKYU4HHW.js';
@@ -27,9 +27,9 @@ import { resolveVersion } from './chunk-RA3O54FC.js';
27
27
  import { RUNNER_DIR_MODE, runnerDir, buildDir, attemptStamp, jobDir, RUNNER_FILE_MODE, jobsDir, pidFilePath, spoolDir, imagesDir, rootfsDir, builderCacheDiskPath } from './chunk-AJTGTSNA.js';
28
28
  import { parseClaimIdentity, parseClaimedRepositories, parseUnreachable, repositoriesOf, primaryOf, sharedUserEnvironment, JOB_MOUNT, takeClaudeCredential, heldClaudeCredential, currentClaudeCredential, fdName } from './chunk-L2OARQKP.js';
29
29
  import { COMMAND_LOST_REASON, CONTAINER_STOPPED_REASON } from './chunk-MESOOLF4.js';
30
- import { randomBytes } from 'crypto';
31
- import { mkdirSync, existsSync, chmodSync, writeFileSync, renameSync, statSync, readdirSync, readFileSync, closeSync, rmSync, lstatSync } from 'fs';
32
- import { totalmem, constants } from 'os';
30
+ import { randomBytes, createHash } from 'crypto';
31
+ import { mkdirSync, existsSync, chmodSync, writeFileSync, renameSync, statSync, readdirSync, readFileSync, rmSync, closeSync, lstatSync } from 'fs';
32
+ import { totalmem, userInfo, constants } from 'os';
33
33
  import { join, dirname } from 'path';
34
34
 
35
35
  createRequire(import.meta.url);
@@ -996,6 +996,45 @@ function notEndedByRunnerReason(exit, isolated) {
996
996
  function jobNotEndedByRunnerReason(exit, job) {
997
997
  return notEndedByRunnerReason(exit, job.container !== void 0 || job.microvm !== void 0);
998
998
  }
999
+ var HelperInUseError = class extends Error {
1000
+ constructor(socketPath, holder) {
1001
+ super(
1002
+ `another runner already uses the root helper at ${socketPath} (pid ${holder.pid}, config ${holder.config}). A runner stops every microVM build its helper lists that it did not start, so two runners on one helper end each other's builds. Give this runner a service and a helper of its own: outerlayer runner install --service --unit-name <name>.`
1003
+ );
1004
+ this.socketPath = socketPath;
1005
+ this.holder = holder;
1006
+ }
1007
+ };
1008
+ function helperClaimPath(socketPath, home = userInfo().homedir) {
1009
+ const key = createHash("sha256").update(socketPath).digest("hex").slice(0, 16);
1010
+ return join(home, ".outerlayer", "helper-runners", `${key}.json`);
1011
+ }
1012
+ function readClaim(path) {
1013
+ if (!existsSync(path)) return void 0;
1014
+ try {
1015
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
1016
+ if (typeof parsed.pid !== "number" || typeof parsed.start !== "string") return void 0;
1017
+ return { pid: parsed.pid, start: parsed.start, config: typeof parsed.config === "string" ? parsed.config : "unknown" };
1018
+ } catch {
1019
+ return void 0;
1020
+ }
1021
+ }
1022
+ function claimHelper(socketPath, self, options = {}) {
1023
+ const path = helperClaimPath(socketPath, options.home);
1024
+ const alive = options.isSameProcessFn ?? isSameProcess;
1025
+ const holder = readClaim(path);
1026
+ if (holder !== void 0 && !(holder.pid === self.pid && holder.start === self.start) && alive(holder.pid, holder.start)) {
1027
+ throw new HelperInUseError(socketPath, holder);
1028
+ }
1029
+ mkdirSync(join(path, ".."), { recursive: true, mode: RUNNER_DIR_MODE });
1030
+ writeFileSync(path, JSON.stringify(self), { mode: RUNNER_FILE_MODE });
1031
+ }
1032
+ function releaseHelper(socketPath, self, options = {}) {
1033
+ const path = helperClaimPath(socketPath, options.home);
1034
+ const holder = readClaim(path);
1035
+ if (holder === void 0 || holder.pid !== self.pid || holder.start !== self.start) return;
1036
+ rmSync(path, { force: true });
1037
+ }
999
1038
 
1000
1039
  // src/runner/loop.ts
1001
1040
  var QUEUE_ORDER = ["amend", "implement"];
@@ -3150,7 +3189,7 @@ async function startRunner(configPath, deps, startup) {
3150
3189
  check: update.check ? () => update.check(configPath) : async () => {
3151
3190
  const held = heldClaudeCredential();
3152
3191
  const env = held === void 0 ? process.env : { ...process.env, [held.variable]: held.value };
3153
- return (await import('./check-ZULOZVV4.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3192
+ return (await import('./check-C7UKLYZQ.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl, env });
3154
3193
  },
3155
3194
  now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
3156
3195
  log
@@ -3191,6 +3230,15 @@ async function startRunner(configPath, deps, startup) {
3191
3230
  mkdirSync(jobsDir(configPath), { recursive: true, mode: RUNNER_DIR_MODE });
3192
3231
  const self = { pid: process.pid, start: startTimeOf(process.pid) ?? "" };
3193
3232
  claimPidFile(pidFilePath(configPath), self);
3233
+ const helperSocket = process.env[HELPER_ENV];
3234
+ if (helperSocket !== void 0 && helperSocket !== "") {
3235
+ try {
3236
+ claimHelper(helperSocket, { ...self, config: configPath }, deps.helperClaim);
3237
+ } catch (err) {
3238
+ releasePidFile(pidFilePath(configPath), self);
3239
+ throw err instanceof HelperInUseError ? new RunnerStartError(err.message) : err;
3240
+ }
3241
+ }
3194
3242
  check = "cgroup";
3195
3243
  const { delegated, refusal } = setUpRunnerCgroup();
3196
3244
  if (refusal !== void 0) log.error(`the kernel refused a cgroup step for the runner's service: ${refusal}`);
@@ -3353,6 +3401,7 @@ async function startRunner(configPath, deps, startup) {
3353
3401
  close();
3354
3402
  for (const relay of state.containerRuntime?.relays.values() ?? []) void relay.close();
3355
3403
  releasePidFile(pidFilePath(configPath), self);
3404
+ if (helperSocket !== void 0 && helperSocket !== "") releaseHelper(helperSocket, self, deps.helperClaim);
3356
3405
  log.line("runner exited");
3357
3406
  };
3358
3407
  const drain = async (onWaiting) => {
@@ -5146,7 +5146,7 @@ function registerRunnerCommands(program2) {
5146
5146
  const configOption = "the cloud config file to run against (default: ~/.outerlayer/config.json)";
5147
5147
  runnerCmd.command("start").description("Run the loop: claim work, run it, report, clean up, repeat").option("--config <path>", configOption).action(async (opts) => {
5148
5148
  const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-YPUOOZB6.js');
5149
- const { start, RunnerStartError } = await import('./loop-WM62DR42.js');
5149
+ const { start, RunnerStartError } = await import('./loop-ELTO36MN.js');
5150
5150
  const { RunnerAlreadyRunningError } = await import('./pidfile-VLZPRIBZ.js');
5151
5151
  const configPath = opts.config ?? defaultRunnerConfigPath();
5152
5152
  try {
@@ -5166,7 +5166,7 @@ function registerRunnerCommands(program2) {
5166
5166
  ).action(async () => {
5167
5167
  const { defaultRunnerConfigPath, RunnerConfigError } = await import('./config-YPUOOZB6.js');
5168
5168
  const { containerStart } = await import('./container-start-OOBTGHWF.js');
5169
- const { start, RunnerStartError } = await import('./loop-WM62DR42.js');
5169
+ const { start, RunnerStartError } = await import('./loop-ELTO36MN.js');
5170
5170
  const { RunnerAlreadyRunningError } = await import('./pidfile-VLZPRIBZ.js');
5171
5171
  try {
5172
5172
  const result = await containerStart({
@@ -5197,7 +5197,7 @@ function registerRunnerCommands(program2) {
5197
5197
  });
5198
5198
  runnerCmd.command("check").description("Validate the config, the hooks and the key, and print the effective settings").option("--config <path>", configOption).action(async (opts) => {
5199
5199
  const { defaultRunnerConfigPath } = await import('./config-YPUOOZB6.js');
5200
- const { runRunnerCheck } = await import('./check-ZULOZVV4.js');
5200
+ const { runRunnerCheck } = await import('./check-C7UKLYZQ.js');
5201
5201
  const configPath = opts.config ?? defaultRunnerConfigPath();
5202
5202
  const result = await runRunnerCheck(configPath);
5203
5203
  if (!result.ok) {
@@ -5606,7 +5606,7 @@ Next:
5606
5606
  });
5607
5607
  runnerCmd.command("stop").description("Take no more work; finish running jobs, then exit").option("--config <path>", "the cloud config file naming the runner to stop").option("--now", "end running jobs immediately, with outcome stopped").action(async (opts) => {
5608
5608
  const { defaultRunnerConfigPath } = await import('./config-YPUOOZB6.js');
5609
- const { requestStop } = await import('./loop-WM62DR42.js');
5609
+ const { requestStop } = await import('./loop-ELTO36MN.js');
5610
5610
  const configPath = opts.config ?? defaultRunnerConfigPath();
5611
5611
  const { runnerImageVersion } = await import('./image-tag-LF3NEGSL.js');
5612
5612
  await requestStop(configPath, Boolean(opts.now), void 0, { image: runnerImageVersion() !== void 0 });
@@ -5614,7 +5614,7 @@ Next:
5614
5614
  runnerCmd.command("status").description("List running jobs; with --recent, finished ones too").option("--config <path>", "the cloud config file naming the runner to inspect").option("--recent", "also list finished jobs, newest first, capped at 20").option("--json", "machine-readable JSON output").action(async (opts) => {
5615
5615
  const { defaultRunnerConfigPath, loadRunnerConfig } = await import('./config-YPUOOZB6.js');
5616
5616
  const { jobsDir, runnerDir } = await import('./paths-4ZGWWNTG.js');
5617
- const { listJobFiles, runnerProcessState } = await import('./loop-WM62DR42.js');
5617
+ const { listJobFiles, runnerProcessState } = await import('./loop-ELTO36MN.js');
5618
5618
  const { renderStatus } = await import('./status-L2OYAZHY.js');
5619
5619
  const { readHousekeepingRecord } = await import('./record-4ZJPJTWO.js');
5620
5620
  const path2 = await import('path');
@@ -5674,7 +5674,7 @@ Next:
5674
5674
  });
5675
5675
  runnerCmd.command("logs").argument("<item>", "the work item's number in the factory").description("Print the newest attempt's log for one item").option("--config <path>", "the cloud config file naming the runner to inspect").option("-f, --follow", "keep printing as the log grows").action(async (itemArg, opts) => {
5676
5676
  const { defaultRunnerConfigPath } = await import('./config-YPUOOZB6.js');
5677
- const { listJobFiles } = await import('./loop-WM62DR42.js');
5677
+ const { listJobFiles } = await import('./loop-ELTO36MN.js');
5678
5678
  const { newestAttempt, logPathFor, tail, RunnerLogsError } = await import('./logs-QHXZTSKZ.js');
5679
5679
  const configPath = opts.config ?? defaultRunnerConfigPath();
5680
5680
  const item = parseTrackerNumber(itemArg);
package/dist/index.js CHANGED
@@ -26,5 +26,5 @@ if (argv[0] === "claude") {
26
26
  process.exit(await runClaudeLauncher(argv.slice(1)));
27
27
  }
28
28
  (await import('./hook-fast-WM6YZVBJ.js')).recordLinkExitFailure(argv);
29
- var { runCli } = await import('./cli-6WPETUBZ.js');
29
+ var { runCli } = await import('./cli-IG52447Q.js');
30
30
  await runCli(process.argv);
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- export { RunnerStartError, leaseTimeLeftFor, listJobFiles, logUnusableHelper, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick } from './chunk-ILTVAD5Y.js';
3
+ export { RunnerStartError, leaseTimeLeftFor, listJobFiles, logUnusableHelper, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick } from './chunk-HFMK2R7O.js';
4
4
  import './chunk-3JVYMD4G.js';
5
5
  import './chunk-GMEXR6PY.js';
6
6
  import './chunk-E7R2GIAW.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outerlayer/cli",
3
- "version": "0.34.0-next.20261028002917",
3
+ "version": "0.34.0-next.20261028010245",
4
4
  "description": "OuterLayer CLI — commands: init, claude, connect, doctor, login, logout, sync, daemon (alias: watch), emit, demo, findings, work, spec, runner, hooks, mcp, context. Capture and sync coding-agent sessions, and record proof of factory work.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Magu Studios, Inc.",