@sleds/cli 0.1.49 → 0.1.50

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 (2) hide show
  1. package/dist/sleds.mjs +266 -168
  2. package/package.json +1 -1
package/dist/sleds.mjs CHANGED
@@ -5479,6 +5479,9 @@ var init_agent = __esm(() => {
5479
5479
  init_mention();
5480
5480
  });
5481
5481
 
5482
+ // ../../packages/shared/src/slack/channel.ts
5483
+ var init_channel = () => {};
5484
+
5482
5485
  // ../../packages/shared/src/item/productHits.ts
5483
5486
  var PATH_STOP, COMMON;
5484
5487
  var init_productHits = __esm(() => {
@@ -6531,6 +6534,30 @@ var init_deploys = __esm(() => {
6531
6534
  SERVICE_RE = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,39}$/;
6532
6535
  });
6533
6536
 
6537
+ // ../../packages/shared/src/deploys/metrics.ts
6538
+ var WEEK_MS;
6539
+ var init_metrics = __esm(() => {
6540
+ WEEK_MS = 7 * 24 * 60 * 60 * 1000;
6541
+ });
6542
+
6543
+ // ../../packages/shared/src/deploys/period.ts
6544
+ var DAY_MS2;
6545
+ var init_period = __esm(() => {
6546
+ DAY_MS2 = 24 * 60 * 60 * 1000;
6547
+ });
6548
+
6549
+ // ../../packages/shared/src/deploys/stability.ts
6550
+ var init_stability = __esm(() => {
6551
+ init_outcome();
6552
+ init_metrics();
6553
+ });
6554
+
6555
+ // ../../packages/shared/src/deploys/batchSize.ts
6556
+ var init_batchSize = __esm(() => {
6557
+ init_outcome();
6558
+ init_metrics();
6559
+ });
6560
+
6534
6561
  // ../../packages/shared/src/newrelic/newrelic.ts
6535
6562
  var init_newrelic = () => {};
6536
6563
 
@@ -7921,6 +7948,7 @@ var init_src = __esm(() => {
7921
7948
  init_mention();
7922
7949
  init_agent();
7923
7950
  init_copy();
7951
+ init_channel();
7924
7952
  init_productHits();
7925
7953
  init_model();
7926
7954
  init_parse();
@@ -7936,6 +7964,10 @@ var init_src = __esm(() => {
7936
7964
  init_pack2();
7937
7965
  init_flags();
7938
7966
  init_deploys();
7967
+ init_metrics();
7968
+ init_period();
7969
+ init_stability();
7970
+ init_batchSize();
7939
7971
  init_sentry();
7940
7972
  init_newrelic();
7941
7973
  init_musher();
@@ -8611,7 +8643,7 @@ var init_seat = __esm(() => {
8611
8643
 
8612
8644
  // src/index.ts
8613
8645
  import { existsSync as existsSync36, realpathSync as realpathSync3 } from "fs";
8614
- import { homedir as homedir9, platform as platform3 } from "os";
8646
+ import { homedir as homedir10, platform as platform3 } from "os";
8615
8647
  import { fileURLToPath } from "url";
8616
8648
 
8617
8649
  // ../../packages/shared/src/index.ts
@@ -8640,6 +8672,7 @@ init_outcome();
8640
8672
  init_mention();
8641
8673
  init_agent();
8642
8674
  init_copy();
8675
+ init_channel();
8643
8676
  init_productHits();
8644
8677
  init_model();
8645
8678
  init_parse();
@@ -8655,6 +8688,10 @@ init_cheatSheet();
8655
8688
  init_pack2();
8656
8689
  init_flags();
8657
8690
  init_deploys();
8691
+ init_metrics();
8692
+ init_period();
8693
+ init_stability();
8694
+ init_batchSize();
8658
8695
  init_sentry();
8659
8696
  init_newrelic();
8660
8697
  init_musher();
@@ -9824,6 +9861,7 @@ var defer = async (o) => {
9824
9861
  init_src();
9825
9862
  import { execFileSync as execFileSync2 } from "node:child_process";
9826
9863
  var DEPLOYS_URL = "https://hooks.sleds.ai/deploys";
9864
+ var DEPLOY_WAIT_MS = 120000;
9827
9865
  var USAGE = "usage: sleds deploy --env <slug> [--service <name>] [--sha <sha>] [--repo <owner/name>]";
9828
9866
  var FLAGS = ["env", "service", "sha", "repo"];
9829
9867
  var set = (x) => x?.trim() ? x.trim() : undefined;
@@ -9880,7 +9918,7 @@ var defaultPost = async (url, token, body) => {
9880
9918
  method: "POST",
9881
9919
  headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
9882
9920
  body: JSON.stringify(body),
9883
- signal: AbortSignal.timeout(15000)
9921
+ signal: AbortSignal.timeout(DEPLOY_WAIT_MS)
9884
9922
  });
9885
9923
  let json = null;
9886
9924
  try {
@@ -9888,7 +9926,8 @@ var defaultPost = async (url, token, body) => {
9888
9926
  } catch {}
9889
9927
  return { status: res.status, json };
9890
9928
  } catch (e) {
9891
- return { error: e instanceof Error ? e.message : String(e) };
9929
+ const timedOut = e instanceof Error && e.name === "TimeoutError";
9930
+ return { error: e instanceof Error ? e.message : String(e), ...timedOut ? { timedOut } : {} };
9892
9931
  }
9893
9932
  };
9894
9933
  function deployLine(body, json) {
@@ -9921,6 +9960,10 @@ var deployCmd = async (o) => {
9921
9960
  const body = resolved.body;
9922
9961
  const url = set(env.SLEDS_DEPLOYS_URL) ?? DEPLOYS_URL;
9923
9962
  const r = await (o.post ?? defaultPost)(url, token, body);
9963
+ if ("error" in r && r.timedOut) {
9964
+ error(`notice: the report was sent but SLEDS did not answer within ${DEPLOY_WAIT_MS / 1000}s; it is usually still recorded — see Settings › Deploys › Recent deploys`);
9965
+ return 0;
9966
+ }
9924
9967
  if ("error" in r) {
9925
9968
  error(`warning: SLEDS unreachable, deploy not recorded — ${r.error}`);
9926
9969
  return 0;
@@ -9952,7 +9995,7 @@ import {
9952
9995
  writeFileSync as writeFileSync19
9953
9996
  } from "node:fs";
9954
9997
  import { tmpdir, userInfo as userInfo2 } from "node:os";
9955
- import { delimiter as delimiter3, dirname as dirname17, join as join25, resolve as resolve9 } from "node:path";
9998
+ import { delimiter as delimiter3, dirname as dirname17, join as join26, resolve as resolve9 } from "node:path";
9956
9999
 
9957
10000
  // src/agentMcp.ts
9958
10001
  import { execFileSync as execFileSync3 } from "node:child_process";
@@ -10328,8 +10371,36 @@ var runCockpit = async (cockpit, argv, opts = {}) => {
10328
10371
  // src/commands/doctor.ts
10329
10372
  init_config();
10330
10373
 
10374
+ // src/engine/credential.ts
10375
+ import { homedir } from "node:os";
10376
+ import { join as join11 } from "node:path";
10377
+ var API_KEY_VAR = "ANTHROPIC_API_KEY";
10378
+ var SEAT_TOKEN_VAR = "CLAUDE_CODE_OAUTH_TOKEN";
10379
+ function namesVar(text, name) {
10380
+ return new RegExp(`^\\s*(?:export\\s+)?${name}\\s*=\\s*\\S`, "m").test(text);
10381
+ }
10382
+ function loginPath(env, home = homedir()) {
10383
+ return join11(env.CLAUDE_CONFIG_DIR?.trim() || join11(home, ".claude"), ".credentials.json");
10384
+ }
10385
+ function detectCredential(env, o) {
10386
+ const file = o.boxEnvText ?? "";
10387
+ const fileWhere = o.boxEnvPath ?? "box.env";
10388
+ const vars = [
10389
+ [API_KEY_VAR, "key", "api_key"],
10390
+ [SEAT_TOKEN_VAR, "seat", "seat_token"]
10391
+ ];
10392
+ for (const [name, kind, source] of vars) {
10393
+ if (env[name]?.trim())
10394
+ return { kind, source, where: "this shell" };
10395
+ if (namesVar(file, name))
10396
+ return { kind, source, where: fileWhere };
10397
+ }
10398
+ const login = loginPath(env, o.home);
10399
+ return o.exists(login) ? { kind: "seat", source: "login", where: login } : null;
10400
+ }
10401
+
10331
10402
  // src/engine/repos.ts
10332
- import { basename as basename2, dirname as dirname9, join as join11 } from "node:path";
10403
+ import { basename as basename2, dirname as dirname9, join as join12 } from "node:path";
10333
10404
  function splitReposDirs(raw) {
10334
10405
  return (raw ?? "").split(/[:\n]/).map((d) => d.trim()).filter(Boolean);
10335
10406
  }
@@ -10356,13 +10427,13 @@ function resolveRepoPath(o) {
10356
10427
  if (name.startsWith("."))
10357
10428
  continue;
10358
10429
  for (const dir of dirs) {
10359
- const p = join11(dir, name);
10360
- if (o.exists(join11(p, ".git")))
10430
+ const p = join12(dir, name);
10431
+ if (o.exists(join12(p, ".git")))
10361
10432
  return p;
10362
10433
  }
10363
10434
  }
10364
10435
  const want = o.repos.join(", ");
10365
- const where = names.flatMap((n) => dirs.map((d) => join11(d, n))).join(" or ");
10436
+ const where = names.flatMap((n) => dirs.map((d) => join12(d, n))).join(" or ");
10366
10437
  return {
10367
10438
  error: `No checkout of ${want} on this engine's machine: expected ${where}. Clone it there (or pass --repo).`
10368
10439
  };
@@ -10370,7 +10441,7 @@ function resolveRepoPath(o) {
10370
10441
  var isRoot = (p) => dirname9(p) === p;
10371
10442
  function insideCheckout(dir, exists) {
10372
10443
  for (let d = dir;!isRoot(d); d = dirname9(d)) {
10373
- if (exists(join11(d, ".git")))
10444
+ if (exists(join12(d, ".git")))
10374
10445
  return true;
10375
10446
  }
10376
10447
  return false;
@@ -10400,12 +10471,12 @@ init_meter();
10400
10471
 
10401
10472
  // src/runners/cmux.ts
10402
10473
  import { existsSync as existsSync11, rmSync as rmSync2, writeFileSync as writeFileSync10 } from "node:fs";
10403
- import { delimiter, join as join13 } from "node:path";
10474
+ import { delimiter, join as join14 } from "node:path";
10404
10475
 
10405
10476
  // src/runners/exec.ts
10406
10477
  import { spawn, spawnSync as spawnSync3 } from "node:child_process";
10407
10478
  import { closeSync as closeSync2, fstatSync, openSync as openSync2, readSync as readSync2 } from "node:fs";
10408
- import { basename as basename3, dirname as dirname10, join as join12 } from "node:path";
10479
+ import { basename as basename3, dirname as dirname10, join as join13 } from "node:path";
10409
10480
 
10410
10481
  // src/runners/sandbox.ts
10411
10482
  var absRule = (dir) => `/${dir.replace(/\/+$/, "")}/**`;
@@ -10549,7 +10620,7 @@ var readLogTail = (path) => {
10549
10620
  };
10550
10621
  var logPathFor = (promptFile, ext, dir) => {
10551
10622
  const base = basename3(promptFile).replace(/\.md$/i, "");
10552
- return join12(dir ?? dirname10(promptFile), `${base}.${ext}`);
10623
+ return join13(dir ?? dirname10(promptFile), `${base}.${ext}`);
10553
10624
  };
10554
10625
  var tailText = (s, bytes = 4096) => {
10555
10626
  if (s.length <= bytes)
@@ -10573,7 +10644,7 @@ var isRunnerKey = (key) => /^(?:[1-9]|esc)$/.test(key);
10573
10644
  var CMUX_APP_BIN = "/Applications/cmux.app/Contents/Resources/bin/cmux";
10574
10645
  var resolveCmuxBin = (exists = existsSync11, path = process.env.PATH ?? "") => {
10575
10646
  for (const dir of path.split(delimiter)) {
10576
- if (dir && exists(join13(dir, "cmux")))
10647
+ if (dir && exists(join14(dir, "cmux")))
10577
10648
  return "cmux";
10578
10649
  }
10579
10650
  return exists(CMUX_APP_BIN) ? CMUX_APP_BIN : "cmux";
@@ -10934,7 +11005,7 @@ function cmuxRunner(exec, deps = {}) {
10934
11005
 
10935
11006
  // src/runners/orca.ts
10936
11007
  import { existsSync as existsSync12, lstatSync, readlinkSync, writeFileSync as writeFileSync11 } from "node:fs";
10937
- import { join as join14, resolve as resolve7 } from "node:path";
11008
+ import { join as join15, resolve as resolve7 } from "node:path";
10938
11009
  var obj = (v) => v !== null && typeof v === "object" && !Array.isArray(v) ? v : null;
10939
11010
  var str8 = (v) => typeof v === "string" && v.length > 0 ? v : null;
10940
11011
  var parseOrcaJson = (stdout) => {
@@ -10995,7 +11066,7 @@ var realFs = { lstat: lstatSync, readlink: readlinkSync, exists: existsSync12 };
10995
11066
  var ORCA_LINK_FIX = "reinstall Orca's shell command from Orca (it links `orca` onto your PATH)";
10996
11067
  function danglingOrca(path, fs) {
10997
11068
  for (const dir of path.split(":").filter(Boolean)) {
10998
- const link = join14(dir, "orca");
11069
+ const link = join15(dir, "orca");
10999
11070
  try {
11000
11071
  if (!fs.lstat(link).isSymbolicLink())
11001
11072
  return null;
@@ -11142,10 +11213,10 @@ function orcaRunner(exec, deps = {}) {
11142
11213
  }
11143
11214
 
11144
11215
  // src/runtime.ts
11145
- import { homedir } from "node:os";
11146
- import { join as join15, win32 } from "node:path";
11216
+ import { homedir as homedir2 } from "node:os";
11217
+ import { join as join16, win32 } from "node:path";
11147
11218
  var isCompiled = (argv1 = process.argv[1]) => Boolean(argv1 && (argv1.startsWith("/$bunfs/") || argv1.startsWith("B:\\~BUN\\")));
11148
- var sledsLink = (home = homedir(), platform = process.platform) => platform === "win32" ? win32.join(process.env.LOCALAPPDATA ?? win32.join(home, "AppData", "Local"), "sleds", "bin", "sleds.exe") : join15(home, ".sleds", "bin", "sleds");
11219
+ var sledsLink = (home = homedir2(), platform = process.platform) => platform === "win32" ? win32.join(process.env.LOCALAPPDATA ?? win32.join(home, "AppData", "Local"), "sleds", "bin", "sleds.exe") : join16(home, ".sleds", "bin", "sleds");
11149
11220
 
11150
11221
  // src/commands/doctor.ts
11151
11222
  init_settings();
@@ -11165,7 +11236,7 @@ import {
11165
11236
  writeFileSync as writeFileSync16
11166
11237
  } from "node:fs";
11167
11238
  import { hostname as hostname2, userInfo } from "node:os";
11168
- import { dirname as dirname15, isAbsolute as isAbsolute3, join as join23, resolve as resolve8 } from "node:path";
11239
+ import { dirname as dirname15, isAbsolute as isAbsolute3, join as join24, resolve as resolve8 } from "node:path";
11169
11240
 
11170
11241
  // src/engine/beat.ts
11171
11242
  var BEAT_EVERY_MS = 60000;
@@ -11177,10 +11248,11 @@ function beatBody(state, flags, host = {}, cap = {}) {
11177
11248
  name: flags.name,
11178
11249
  os: host.os ?? process.platform,
11179
11250
  runner: flags.runner,
11180
- version: host.version ?? "0.1.49" ?? "dev",
11251
+ version: host.version ?? "0.1.50" ?? "dev",
11181
11252
  running: live.length,
11182
11253
  items: live.slice(0, BEAT_ITEMS).map((r) => `${r.item}/${r.node}`),
11183
11254
  ...cap.atOnce !== undefined ? { atOnce: cap.atOnce } : {},
11255
+ ...host.credential ? { credential: host.credential } : {},
11184
11256
  ...m ? {
11185
11257
  machine: {
11186
11258
  cpuPct: m.cpuPct,
@@ -13067,9 +13139,9 @@ function providerFailure(screen) {
13067
13139
  // src/engine/worktree.ts
13068
13140
  init_src();
13069
13141
  import { appendFileSync, existsSync as existsSync13, mkdirSync as mkdirSync11 } from "node:fs";
13070
- import { dirname as dirname11, isAbsolute, join as join16 } from "node:path";
13142
+ import { dirname as dirname11, isAbsolute, join as join17 } from "node:path";
13071
13143
  function worktreePath(repoPath, name) {
13072
- return join16(repoPath, ".worktrees", name);
13144
+ return join17(repoPath, ".worktrees", name);
13073
13145
  }
13074
13146
  var fail = (what, r) => new Error(`${what} failed: ${(r.stderr || r.stdout).trim() || `exit ${r.status}`}`);
13075
13147
  function defaultBranch(exec, repoPath) {
@@ -13104,7 +13176,7 @@ function ensureIgnored(exec, repoPath, fs = realWorktreeFs) {
13104
13176
  if (common.status !== 0)
13105
13177
  return;
13106
13178
  const dir = common.stdout.trim();
13107
- const exclude = join16(isAbsolute(dir) ? dir : join16(repoPath, dir), "info", "exclude");
13179
+ const exclude = join17(isAbsolute(dir) ? dir : join17(repoPath, dir), "info", "exclude");
13108
13180
  fs.append(exclude, `
13109
13181
  # sleds engine: one worktree per route node
13110
13182
  .worktrees/
@@ -13116,7 +13188,7 @@ function ensureWorktree(exec, repoPath, branch, path, base = "main", fs = realWo
13116
13188
  return path;
13117
13189
  }
13118
13190
  function makeWorktree(exec, repoPath, branch, path, base, fs, log) {
13119
- if (fs.exists(join16(path, ".git"))) {
13191
+ if (fs.exists(join17(path, ".git"))) {
13120
13192
  fastForwardUntouched(exec, path, base, log);
13121
13193
  return path;
13122
13194
  }
@@ -13192,13 +13264,13 @@ function installArgv(command) {
13192
13264
  return rest.every((a) => a.startsWith("-")) ? argv : null;
13193
13265
  }
13194
13266
  function lockfileInstall(path, exists) {
13195
- if (exists(join16(path, "pnpm-lock.yaml")))
13267
+ if (exists(join17(path, "pnpm-lock.yaml")))
13196
13268
  return ["pnpm", "install", "--frozen-lockfile"];
13197
- if (exists(join16(path, "bun.lock")) || exists(join16(path, "bun.lockb")))
13269
+ if (exists(join17(path, "bun.lock")) || exists(join17(path, "bun.lockb")))
13198
13270
  return ["bun", "install", "--frozen-lockfile"];
13199
- if (exists(join16(path, "yarn.lock")))
13271
+ if (exists(join17(path, "yarn.lock")))
13200
13272
  return ["yarn", "install", "--frozen-lockfile"];
13201
- if (exists(join16(path, "package-lock.json")))
13273
+ if (exists(join17(path, "package-lock.json")))
13202
13274
  return ["npm", "ci"];
13203
13275
  return null;
13204
13276
  }
@@ -13256,7 +13328,7 @@ function claimRunOf(run, repo) {
13256
13328
  };
13257
13329
  }
13258
13330
  function ensureInstalled(exec, path, fs, o = {}) {
13259
- if (!fs.exists(join16(path, "package.json")) || fs.exists(join16(path, "node_modules")))
13331
+ if (!fs.exists(join17(path, "package.json")) || fs.exists(join17(path, "node_modules")))
13260
13332
  return null;
13261
13333
  const argv = installArgv(o.command) ?? lockfileInstall(path, fs.exists);
13262
13334
  if (!argv)
@@ -13271,7 +13343,7 @@ function ensureInstalled(exec, path, fs, o = {}) {
13271
13343
  return { argv, ok };
13272
13344
  }
13273
13345
  function ensureDetachedWorktree(exec, repoPath, path, base = "main", fs = realWorktreeFs) {
13274
- if (fs.exists(join16(path, ".git")))
13346
+ if (fs.exists(join17(path, ".git")))
13275
13347
  return path;
13276
13348
  ensureIgnored(exec, repoPath, fs);
13277
13349
  const f = exec("git", ["-C", repoPath, "fetch", "origin", base]);
@@ -16560,8 +16632,8 @@ init_settings();
16560
16632
 
16561
16633
  // src/update/drain.ts
16562
16634
  import { closeSync as closeSync4, existsSync as existsSync18, mkdirSync as mkdirSync17, openSync as openSync4, rmSync as rmSync9, statSync as statSync4, writeSync as writeSync2 } from "node:fs";
16563
- import { homedir as homedir6 } from "node:os";
16564
- import { join as join22 } from "node:path";
16635
+ import { homedir as homedir7 } from "node:os";
16636
+ import { join as join23 } from "node:path";
16565
16637
 
16566
16638
  // ../../packages/shared/src/updates/manifest.ts
16567
16639
  var CLI_PLATFORMS = [
@@ -16703,13 +16775,13 @@ import {
16703
16775
  statSync as statSync2,
16704
16776
  writeFileSync as writeFileSync13
16705
16777
  } from "node:fs";
16706
- import { homedir as homedir2 } from "node:os";
16707
- import { dirname as dirname12, join as join17, win32 as win322 } from "node:path";
16778
+ import { homedir as homedir3 } from "node:os";
16779
+ import { dirname as dirname12, join as join18, win32 as win322 } from "node:path";
16708
16780
  var UPDATE_LOCK_STALE_MS = 10 * 60000;
16709
- function sledsRoot(home = homedir2(), platform = process.platform) {
16710
- return platform === "win32" ? win322.join(process.env.LOCALAPPDATA ?? win322.join(home, "AppData", "Local"), "sleds") : join17(home, ".sleds");
16781
+ function sledsRoot(home = homedir3(), platform = process.platform) {
16782
+ return platform === "win32" ? win322.join(process.env.LOCALAPPDATA ?? win322.join(home, "AppData", "Local"), "sleds") : join18(home, ".sleds");
16711
16783
  }
16712
- var pathFor = (platform) => platform === "win32" ? win322 : { join: join17 };
16784
+ var pathFor = (platform) => platform === "win32" ? win322 : { join: join18 };
16713
16785
  function versionDir(home, v, platform = process.platform) {
16714
16786
  return pathFor(platform).join(sledsRoot(home, platform), "versions", v);
16715
16787
  }
@@ -16901,7 +16973,7 @@ async function fetchVersion(o) {
16901
16973
  const platform = o.platform ?? process.platform;
16902
16974
  const arch = o.arch ?? process.arch;
16903
16975
  const publicKey = o.publicKey ?? RELEASE_PUBLIC_KEY;
16904
- const running = o.running ?? "0.1.49";
16976
+ const running = o.running ?? "0.1.50";
16905
16977
  if (!publicKey)
16906
16978
  return { ok: false, why: "no release key yet" };
16907
16979
  if (!VERSION_RE2.test(o.version))
@@ -16978,7 +17050,7 @@ async function fetchVersion(o) {
16978
17050
 
16979
17051
  // src/update/guard.ts
16980
17052
  import { existsSync as existsSync17 } from "node:fs";
16981
- import { homedir as homedir5 } from "node:os";
17053
+ import { homedir as homedir6 } from "node:os";
16982
17054
 
16983
17055
  // src/update/migrate.ts
16984
17056
  import { spawn as spawn2 } from "node:child_process";
@@ -16994,20 +17066,20 @@ import {
16994
17066
  symlinkSync,
16995
17067
  writeFileSync as writeFileSync15
16996
17068
  } from "node:fs";
16997
- import { homedir as homedir3 } from "node:os";
16998
- import { basename as basename5, delimiter as delimiter2, dirname as dirname13, isAbsolute as isAbsolute2, join as join20, relative } from "node:path";
17069
+ import { homedir as homedir4 } from "node:os";
17070
+ import { basename as basename5, delimiter as delimiter2, dirname as dirname13, isAbsolute as isAbsolute2, join as join21, relative } from "node:path";
16999
17071
 
17000
17072
  // src/commands/engineSystemd.ts
17001
- import { join as join18 } from "node:path";
17073
+ import { join as join19 } from "node:path";
17002
17074
  var BOX_ENV_UNIT_PATH = "%h/.config/sleds/box.env";
17003
17075
  function boxEnvPath(home) {
17004
- return join18(home, ".config", "sleds", "box.env");
17076
+ return join19(home, ".config", "sleds", "box.env");
17005
17077
  }
17006
17078
  function engineUnitDir(home) {
17007
- return join18(home, ".config", "systemd", "user");
17079
+ return join19(home, ".config", "systemd", "user");
17008
17080
  }
17009
17081
  function engineUnitPath(home, label) {
17010
- return join18(engineUnitDir(home), `${label}.service`);
17082
+ return join19(engineUnitDir(home), `${label}.service`);
17011
17083
  }
17012
17084
  function systemdQuote(s) {
17013
17085
  const body = s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/%/g, "%%").replace(/\$/g, "$$$$");
@@ -17049,7 +17121,7 @@ function parseEngineUnit(text) {
17049
17121
  // src/schedule.ts
17050
17122
  import { spawnSync as spawnSync4 } from "node:child_process";
17051
17123
  import { existsSync as existsSync15, mkdirSync as mkdirSync14, rmSync as rmSync6, writeFileSync as writeFileSync14 } from "node:fs";
17052
- import { join as join19 } from "node:path";
17124
+ import { join as join20 } from "node:path";
17053
17125
  var REVERT_LABEL = "ai.sleds.revert";
17054
17126
  var defaultExec2 = (cmd, args) => {
17055
17127
  const r = spawnSync4(cmd, [...args], { stdio: ["ignore", "ignore", "pipe"], encoding: "utf8" });
@@ -17057,7 +17129,7 @@ var defaultExec2 = (cmd, args) => {
17057
17129
  return { ok: false, stderr: r.error.message };
17058
17130
  return { ok: r.status === 0, stderr: r.stderr ?? "" };
17059
17131
  };
17060
- var plistPath = (home) => join19(home, "Library", "LaunchAgents", `${REVERT_LABEL}.plist`);
17132
+ var plistPath = (home) => join20(home, "Library", "LaunchAgents", `${REVERT_LABEL}.plist`);
17061
17133
  var xmlEscape2 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
17062
17134
  var buildLaunchdPlist = (sledsArgv, deadline) => {
17063
17135
  const args = [...sledsArgv, "off"].map((a) => ` <string>${xmlEscape2(a)}</string>`).join(`
@@ -17096,7 +17168,7 @@ var scheduleRevert = (d, deadlineMs) => {
17096
17168
  if (d.platform === "darwin") {
17097
17169
  const p = plistPath(d.home);
17098
17170
  try {
17099
- mkdirSync14(join19(d.home, "Library", "LaunchAgents"), { recursive: true });
17171
+ mkdirSync14(join20(d.home, "Library", "LaunchAgents"), { recursive: true });
17100
17172
  d.exec("launchctl", ["unload", p]);
17101
17173
  writeFileSync14(p, buildLaunchdPlist(d.sledsArgv, deadline));
17102
17174
  const r = d.exec("launchctl", ["load", p]);
@@ -17148,8 +17220,8 @@ var HOOK_SUBS = [
17148
17220
  "stop-event",
17149
17221
  "permission-event"
17150
17222
  ];
17151
- var migrateBakDir = (home) => join20(sledsRoot(home), "migrate.bak");
17152
- var manifestPath = (home) => join20(migrateBakDir(home), "manifest.json");
17223
+ var migrateBakDir = (home) => join21(sledsRoot(home), "migrate.bak");
17224
+ var manifestPath = (home) => join21(migrateBakDir(home), "manifest.json");
17153
17225
  var xmlEscape3 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
17154
17226
  var xmlUnescape = (s) => s.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
17155
17227
  var shQuote = (s) => /^[\w./~-]+$/.test(s) ? s : `'${s.replace(/'/g, "'\\''")}'`;
@@ -17249,13 +17321,13 @@ function rewriteSettings(text, link) {
17249
17321
  }
17250
17322
  var listDir = (dir, keep) => {
17251
17323
  try {
17252
- return readdirSync2(dir).filter(keep).sort().map((n) => join20(dir, n));
17324
+ return readdirSync2(dir).filter(keep).sort().map((n) => join21(dir, n));
17253
17325
  } catch {
17254
17326
  return [];
17255
17327
  }
17256
17328
  };
17257
17329
  function unitFiles(home) {
17258
- const agents = listDir(join20(home, "Library", "LaunchAgents"), (n) => n.startsWith("ai.sleds.") && n.endsWith(".plist")).map((path) => ({
17330
+ const agents = listDir(join21(home, "Library", "LaunchAgents"), (n) => n.startsWith("ai.sleds.") && n.endsWith(".plist")).map((path) => ({
17259
17331
  path,
17260
17332
  ...basename5(path).startsWith("ai.sleds.revert") ? {} : { reload: "launchd" }
17261
17333
  }));
@@ -17267,7 +17339,7 @@ function unitClaudeDir(text) {
17267
17339
  return plist ? xmlUnescape(plist) : undefined;
17268
17340
  }
17269
17341
  function claudeDirs(home, env) {
17270
- const dirs = [join20(home, ".claude"), claudeDir(home, env)];
17342
+ const dirs = [join21(home, ".claude"), claudeDir(home, env)];
17271
17343
  for (const u of unitFiles(home)) {
17272
17344
  try {
17273
17345
  const d = unitClaudeDir(readFileSync14(u.path, "utf8"));
@@ -17291,7 +17363,7 @@ function migrationPlan(home, link, env = process.env) {
17291
17363
  out.push({ ...u, text: next });
17292
17364
  }
17293
17365
  for (const dir of claudeDirs(home, env)) {
17294
- const path = join20(dir, "settings.json");
17366
+ const path = join21(dir, "settings.json");
17295
17367
  let text;
17296
17368
  try {
17297
17369
  text = readFileSync14(path, "utf8");
@@ -17306,7 +17378,7 @@ function migrationPlan(home, link, env = process.env) {
17306
17378
  }
17307
17379
  var backupFor = (home, path) => {
17308
17380
  const rel = relative(home, path);
17309
- return rel.startsWith("..") || isAbsolute2(rel) ? join20(migrateBakDir(home), "abs", path) : join20(migrateBakDir(home), rel);
17381
+ return rel.startsWith("..") || isAbsolute2(rel) ? join21(migrateBakDir(home), "abs", path) : join21(migrateBakDir(home), rel);
17310
17382
  };
17311
17383
  function writeKeepingMode(path, text) {
17312
17384
  let mode = 420;
@@ -17391,7 +17463,7 @@ function putBack(home, m) {
17391
17463
  return failed;
17392
17464
  }
17393
17465
  function restoreMigration(s, o) {
17394
- const home = o.home ?? homedir3();
17466
+ const home = o.home ?? homedir4();
17395
17467
  const m = readManifest(home);
17396
17468
  const to = m?.to ?? s.pending?.to ?? "?";
17397
17469
  const failed = m ? putBack(home, m) : [];
@@ -17403,7 +17475,7 @@ function restoreMigration(s, o) {
17403
17475
  return failed.length ? `moved back to the npm install, but could not restore ${failed.join(", ")} — the copies are in ${migrateBakDir(home)}` : "moved back to the npm install";
17404
17476
  }
17405
17477
  async function migrateToBinary(o) {
17406
- const home = o.home ?? homedir3();
17478
+ const home = o.home ?? homedir4();
17407
17479
  const log = o.log ?? console.error;
17408
17480
  const env = o.env ?? process.env;
17409
17481
  const platform = o.platform ?? process.platform;
@@ -17497,11 +17569,11 @@ import {
17497
17569
  rmSync as rmSync8,
17498
17570
  symlinkSync as symlinkSync2
17499
17571
  } from "node:fs";
17500
- import { homedir as homedir4 } from "node:os";
17501
- import { dirname as dirname14, join as join21 } from "node:path";
17572
+ import { homedir as homedir5 } from "node:os";
17573
+ import { dirname as dirname14, join as join22 } from "node:path";
17502
17574
  var NO_PREVIOUS = "no previous version on this machine";
17503
- function allStateFiles(home = homedir4(), env = process.env) {
17504
- const roots = [...new Set([configDir(home, env), join21(home, ".config", "sleds")])];
17575
+ function allStateFiles(home = homedir5(), env = process.env) {
17576
+ const roots = [...new Set([configDir(home, env), join22(home, ".config", "sleds")])];
17505
17577
  const out = [];
17506
17578
  const walk = (dir) => {
17507
17579
  let names;
@@ -17512,20 +17584,20 @@ function allStateFiles(home = homedir4(), env = process.env) {
17512
17584
  }
17513
17585
  for (const n of names.sort())
17514
17586
  if (n.endsWith(".json") && n !== "removed-engines.json")
17515
- out.push(join21(dir, n));
17587
+ out.push(join22(dir, n));
17516
17588
  for (const sub of ["orgs", "seats"]) {
17517
17589
  let kids;
17518
17590
  try {
17519
- kids = readdirSync3(join21(dir, sub));
17591
+ kids = readdirSync3(join22(dir, sub));
17520
17592
  } catch {
17521
17593
  continue;
17522
17594
  }
17523
17595
  for (const k of kids.sort())
17524
- walk(join21(dir, sub, k));
17596
+ walk(join22(dir, sub, k));
17525
17597
  }
17526
17598
  };
17527
17599
  for (const r of roots)
17528
- walk(join21(r, "engine"));
17600
+ walk(join22(r, "engine"));
17529
17601
  return out;
17530
17602
  }
17531
17603
  var backupPath2 = (file, v) => `${file}.${v}.bak`;
@@ -17621,7 +17693,7 @@ function applyConfirm(s, home, o = {}) {
17621
17693
  }
17622
17694
  for (const n of names)
17623
17695
  if (n.startsWith(prefix) && n.endsWith(".bak"))
17624
- rmSync8(join21(dir, n), { force: true });
17696
+ rmSync8(join22(dir, n), { force: true });
17625
17697
  }
17626
17698
  const keep = new Set([s.current, s.previous, s.drain?.to].filter(Boolean));
17627
17699
  const versions = dirname14(versionDir(home, s.current, platform));
@@ -17711,7 +17783,7 @@ function movedAway(s, home, version, platform) {
17711
17783
  return at && at !== version ? at : null;
17712
17784
  }
17713
17785
  async function startGuard(o) {
17714
- const home = o.home ?? homedir5();
17786
+ const home = o.home ?? homedir6();
17715
17787
  const platform = o.platform ?? process.platform;
17716
17788
  const version = o.version;
17717
17789
  if (!version || !guarded(home, version, platform))
@@ -17743,7 +17815,7 @@ async function startGuard(o) {
17743
17815
  }
17744
17816
  }
17745
17817
  function firstBeatWatchdog(o) {
17746
- const home = o.home ?? homedir5();
17818
+ const home = o.home ?? homedir6();
17747
17819
  const platform = o.platform ?? process.platform;
17748
17820
  const version = o.version;
17749
17821
  const idle = { beat: async () => {}, stop: () => {} };
@@ -17884,7 +17956,7 @@ async function machineAnswer(client, tokens) {
17884
17956
  }
17885
17957
  async function fetchOnce(o) {
17886
17958
  const dir = versionDir(o.home, o.version, o.platform);
17887
- const lock = join22(dir, "fetch.lock");
17959
+ const lock = join23(dir, "fetch.lock");
17888
17960
  mkdirSync17(dir, { recursive: true, mode: 493 });
17889
17961
  let fd;
17890
17962
  try {
@@ -17928,7 +18000,7 @@ var realPidAlive = (pid) => {
17928
18000
  }
17929
18001
  };
17930
18002
  function engineUpdater(o) {
17931
- const home = o.home ?? homedir6();
18003
+ const home = o.home ?? homedir7();
17932
18004
  const platform = o.platform ?? process.platform;
17933
18005
  const version = o.version;
17934
18006
  if (!version || !VERSION_RE3.test(version))
@@ -18391,7 +18463,7 @@ function flagsFromProfile(flags, given, profile, home) {
18391
18463
  }
18392
18464
  }
18393
18465
  if (profile.reposDir && !has("repos-dir") && !has("repo")) {
18394
- out.reposDir = splitReposDirs(profile.reposDir).map((d) => home && /^~(\/|$)/.test(d) ? join23(home, d.slice(1)) : d).join(":");
18466
+ out.reposDir = splitReposDirs(profile.reposDir).map((d) => home && /^~(\/|$)/.test(d) ? join24(home, d.slice(1)) : d).join(":");
18395
18467
  used.push(`repos ${profile.reposDir}`);
18396
18468
  }
18397
18469
  if (profile.mcpStrict !== undefined && !has("strict-mcp") && !has("no-strict-mcp")) {
@@ -18485,7 +18557,7 @@ function engineClient(o, org) {
18485
18557
  return fetchClient({
18486
18558
  ...src,
18487
18559
  timeoutMs: ENGINE_TIMEOUT_MS,
18488
- version: "0.1.49"
18560
+ version: "0.1.50"
18489
18561
  });
18490
18562
  const asked = org?.trim() || env.SLEDS_ORG?.trim();
18491
18563
  if (asked && !selectOrg(readConfig(o.home), org, env).seat)
@@ -18525,12 +18597,12 @@ function memberMcpConfigs(o, cwd) {
18525
18597
  });
18526
18598
  const claudeDir = (o.env ?? process.env).CLAUDE_CONFIG_DIR;
18527
18599
  return [
18528
- read(claudeDir ? join23(claudeDir, ".claude.json") : join23(o.home, ".claude.json")),
18529
- ...cwd ? [read(join23(cwd, ".mcp.json"))] : []
18600
+ read(claudeDir ? join24(claudeDir, ".claude.json") : join24(o.home, ".claude.json")),
18601
+ ...cwd ? [read(join24(cwd, ".mcp.json"))] : []
18530
18602
  ];
18531
18603
  }
18532
18604
  function engineStateDir(o, org, seat) {
18533
- return seatStateDir(orgStateDir(o.stateDir ?? join23(configDir(o.home, o.env ?? process.env), "engine"), org), seat);
18605
+ return seatStateDir(orgStateDir(o.stateDir ?? join24(configDir(o.home, o.env ?? process.env), "engine"), org), seat);
18534
18606
  }
18535
18607
  function engineSeat(o, org) {
18536
18608
  try {
@@ -18560,8 +18632,8 @@ function engineDeps(o, flags, source, runner, stateName) {
18560
18632
  const repo = flags.repo ? resolve8(cwd, flags.repo) : undefined;
18561
18633
  const reposDirs = splitReposDirs(flags.reposDir).map((d) => resolve8(cwd, d));
18562
18634
  const { branch, prTitle } = flags;
18563
- const hooksDir = join23(stateDir, "hooks");
18564
- const permissionMark = (name) => join23(hooksDir, `${name}.permission.json`);
18635
+ const hooksDir = join24(stateDir, "hooks");
18636
+ const permissionMark = (name) => join24(hooksDir, `${name}.permission.json`);
18565
18637
  const withHook = (name, settings) => applyPermissionHook(settings, [...o.sledsArgv ?? ["sleds"], "permission-event", "--mark", permissionMark(name)].map(shq2).join(" "));
18566
18638
  return {
18567
18639
  source,
@@ -18586,9 +18658,9 @@ function engineDeps(o, flags, source, runner, stateName) {
18586
18658
  sandbox: true,
18587
18659
  writeSandboxSettings: o.writeSandboxSettings ?? ((name, cwd, allow) => {
18588
18660
  const gitCommonDir = gitCommonDirOf(exec, cwd);
18589
- const dir = join23(stateDir, "sandbox");
18661
+ const dir = join24(stateDir, "sandbox");
18590
18662
  mkdirSync18(dir, { recursive: true, mode: 448 });
18591
- const p = join23(dir, `${name}.json`);
18663
+ const p = join24(dir, `${name}.json`);
18592
18664
  const walls = engineSandboxSettings(o.home, o.env ?? process.env, gitCommonDir, [
18593
18665
  ...SANDBOX_DEFAULT_ALLOW,
18594
18666
  ...flags.sandboxAllow ?? []
@@ -18605,7 +18677,7 @@ function engineDeps(o, flags, source, runner, stateName) {
18605
18677
  } : {},
18606
18678
  writeHookSettings: (name, allow) => {
18607
18679
  mkdirSync18(hooksDir, { recursive: true, mode: 448 });
18608
- const p = join23(hooksDir, `${name}.json`);
18680
+ const p = join24(hooksDir, `${name}.json`);
18609
18681
  const base = allow?.length ? { permissions: { allow: [...allow] } } : {};
18610
18682
  writeFileSync16(p, `${JSON.stringify(withHook(name, base), null, 2)}
18611
18683
  `, { mode: 384 });
@@ -18633,9 +18705,9 @@ function engineDeps(o, flags, source, runner, stateName) {
18633
18705
  exists
18634
18706
  }),
18635
18707
  writeMcpConfig: o.writeMcpConfig ?? ((name, runToken, worktree) => {
18636
- const dir = join23(stateDir, "mcp");
18708
+ const dir = join24(stateDir, "mcp");
18637
18709
  mkdirSync18(dir, { recursive: true, mode: 448 });
18638
- const p = join23(dir, `${name}.json`);
18710
+ const p = join24(dir, `${name}.json`);
18639
18711
  let others = {};
18640
18712
  if (flags.strictMcp && flags.mcpAllow?.length) {
18641
18713
  const r = mcpPassThrough(flags.mcpAllow, memberMcpConfigs(o, worktree));
@@ -18651,9 +18723,9 @@ function engineDeps(o, flags, source, runner, stateName) {
18651
18723
  }),
18652
18724
  removeMcpConfig: o.removeMcpConfig ?? ((p) => rmSync10(p, { force: true })),
18653
18725
  writePrompt: o.writePrompt ?? ((name, text) => {
18654
- const dir = join23(stateDir, "prompts");
18726
+ const dir = join24(stateDir, "prompts");
18655
18727
  mkdirSync18(dir, { recursive: true, mode: 448 });
18656
- const p = join23(dir, `${name}.md`);
18728
+ const p = join24(dir, `${name}.md`);
18657
18729
  writeFileSync16(p, text, { mode: 384 });
18658
18730
  return p;
18659
18731
  }),
@@ -18680,14 +18752,14 @@ function engineDeps(o, flags, source, runner, stateName) {
18680
18752
  }
18681
18753
  function sandboxDenyRead(home, env) {
18682
18754
  return {
18683
- dirs: [...new Set([configDir(home, env), join23(home, ".config", "sleds")])],
18755
+ dirs: [...new Set([configDir(home, env), join24(home, ".config", "sleds")])],
18684
18756
  files: [
18685
18757
  ...new Set([
18686
18758
  tokenPath(home, env),
18687
- join23(home, ".sleds-token"),
18759
+ join24(home, ".sleds-token"),
18688
18760
  settingsPath(home, env),
18689
18761
  backupPath(home, env),
18690
- join23(claudeDir(home, env), "settings.local.json")
18762
+ join24(claudeDir(home, env), "settings.local.json")
18691
18763
  ])
18692
18764
  ]
18693
18765
  };
@@ -18708,7 +18780,7 @@ function gitCommonDirOf(exec, cwd) {
18708
18780
  }
18709
18781
  var LENT_NEEDS_SANDBOX = "a lent engine runs every session sandboxed (spec 48 rule 10) — add --sandbox to --lent-by";
18710
18782
  function lenderHome(accountHome, lentBy) {
18711
- return isAbsolute3(lentBy) ? resolve8(lentBy) : join23(dirname15(accountHome), lentBy);
18783
+ return isAbsolute3(lentBy) ? resolve8(lentBy) : join24(dirname15(accountHome), lentBy);
18712
18784
  }
18713
18785
  function lentHomeProblems(accountHome, lentBy, modeOf) {
18714
18786
  const lender = lenderHome(accountHome, lentBy);
@@ -18776,7 +18848,7 @@ async function driveEngine(o, flags, deps, until = {}) {
18776
18848
  runner: deps.runner.name,
18777
18849
  atOnce: flags.atOnce,
18778
18850
  interval: flags.interval,
18779
- cliVersion: "0.1.49"
18851
+ cliVersion: "0.1.50"
18780
18852
  };
18781
18853
  const beat = (checkedAt) => {
18782
18854
  const m = deps.machine;
@@ -19122,7 +19194,7 @@ import {
19122
19194
  writeFileSync as writeFileSync17
19123
19195
  } from "node:fs";
19124
19196
  import { hostname as hostname3 } from "node:os";
19125
- import { basename as basename6, dirname as dirname16, isAbsolute as isAbsolute4, join as join24 } from "node:path";
19197
+ import { basename as basename6, dirname as dirname16, isAbsolute as isAbsolute4, join as join25 } from "node:path";
19126
19198
  init_state();
19127
19199
  var ENGINE_LABEL = "ai.sleds.engine";
19128
19200
  var ENGINE_INSTALL_USAGE = `usage: sleds engine install [engine flags] | sleds engine uninstall [--name <n>] [--org <slug>]
@@ -19143,13 +19215,13 @@ function engineLabel(name, org, seat) {
19143
19215
  return [ENGINE_LABEL, org, seat?.trim(), name].filter((p) => Boolean(p)).map((p, i) => i === 0 ? p : engineSlug(p)).join(".");
19144
19216
  }
19145
19217
  function enginePlistPath(home, name, org, seat) {
19146
- return join24(home, "Library", "LaunchAgents", `${engineLabel(name, org, seat)}.plist`);
19218
+ return join25(home, "Library", "LaunchAgents", `${engineLabel(name, org, seat)}.plist`);
19147
19219
  }
19148
19220
  function engineLogPath(stateDir, name) {
19149
- return join24(stateDir, `${engineSlug(name)}.log`);
19221
+ return join25(stateDir, `${engineSlug(name)}.log`);
19150
19222
  }
19151
19223
  function engineEventsPath(stateDir, name) {
19152
- return join24(stateDir, `${engineSlug(name)}.events.jsonl`);
19224
+ return join25(stateDir, `${engineSlug(name)}.events.jsonl`);
19153
19225
  }
19154
19226
  var xmlEscape4 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
19155
19227
  function buildEnginePlist(o) {
@@ -19246,7 +19318,7 @@ function readEngines(dir, suffix, manager, parse) {
19246
19318
  }
19247
19319
  const out = [];
19248
19320
  for (const name of names.filter((n) => n.startsWith(`${ENGINE_LABEL}.`) && n.endsWith(suffix))) {
19249
- const path = join24(dir, name);
19321
+ const path = join25(dir, name);
19250
19322
  let parsed;
19251
19323
  try {
19252
19324
  parsed = parse(readFileSync16(path, "utf8"), name);
@@ -19266,7 +19338,7 @@ function readEngines(dir, suffix, manager, parse) {
19266
19338
  }
19267
19339
  function installedEngines(home) {
19268
19340
  return [
19269
- ...readEngines(join24(home, "Library", "LaunchAgents"), ".plist", "launchd", parseEnginePlist),
19341
+ ...readEngines(join25(home, "Library", "LaunchAgents"), ".plist", "launchd", parseEnginePlist),
19270
19342
  ...readEngines(engineUnitDir(home), ".service", "systemd", (text, file) => {
19271
19343
  const parsed = parseEngineUnit(text);
19272
19344
  return parsed && { label: basename6(file, ".service"), ...parsed };
@@ -19923,12 +19995,12 @@ function sandboxChecks(o, env) {
19923
19995
  }
19924
19996
  ];
19925
19997
  const nonce = o.nonce ?? `sleds-probe-${randomBytes(16).toString("hex")}`;
19926
- const probe = join25(dir, SANDBOX_PROBE);
19927
- const work = mkdtempSync(join25(tmpdir(), "sleds-sandbox-"));
19998
+ const probe = join26(dir, SANDBOX_PROBE);
19999
+ const work = mkdtempSync(join26(tmpdir(), "sleds-sandbox-"));
19928
20000
  try {
19929
20001
  writeFileSync19(probe, `${nonce}
19930
20002
  `, { mode: 384 });
19931
- const settingsFile = join25(work, "settings.json");
20003
+ const settingsFile = join26(work, "settings.json");
19932
20004
  const settings = engineSandboxSettings(o.home, env, work, SANDBOX_DEFAULT_ALLOW);
19933
20005
  const claudeSettings = settingsPath(o.home, env);
19934
20006
  writeFileSync19(settingsFile, JSON.stringify(settings, null, 2), { mode: 384 });
@@ -20100,12 +20172,18 @@ function lentChecks(o, lentBy, engine) {
20100
20172
  function boxChecks(o, env, which, need) {
20101
20173
  const claude = which("claude");
20102
20174
  const file = boxEnvPath(o.home);
20103
- let named = false;
20175
+ let boxEnvText = null;
20104
20176
  try {
20105
- named = /^\s*(?:export\s+)?ANTHROPIC_API_KEY\s*=\s*\S/m.test(readFileSync19(file, "utf8"));
20177
+ boxEnvText = readFileSync19(file, "utf8");
20106
20178
  } catch {
20107
- named = false;
20179
+ boxEnvText = null;
20108
20180
  }
20181
+ const cred = detectCredential(env, {
20182
+ home: o.home,
20183
+ boxEnvText,
20184
+ boxEnvPath: file,
20185
+ exists: o.exists ?? existsSync21
20186
+ });
20109
20187
  return [
20110
20188
  claude ? { level: "ok", name: "claude cli", detail: `${claude} · the headless runner's agent` } : {
20111
20189
  level: need,
@@ -20113,14 +20191,20 @@ function boxChecks(o, env, which, need) {
20113
20191
  detail: "`claude` not on PATH — the headless runner starts Claude Code for each node",
20114
20192
  fix: "npm install -g @anthropic-ai/claude-code"
20115
20193
  },
20116
- env.ANTHROPIC_API_KEY?.trim() ? { level: "ok", name: "api key", detail: "ANTHROPIC_API_KEY set in this shell" } : named ? { level: "ok", name: "api key", detail: `ANTHROPIC_API_KEY named in ${file}` } : {
20194
+ cred ? { level: "ok", name: "credential", detail: credentialDetail(cred) } : {
20117
20195
  level: need,
20118
- name: "api key",
20119
- detail: `ANTHROPIC_API_KEY is not set here or in ${file} — a headless session cannot sign in`,
20120
- fix: `add ANTHROPIC_API_KEY=… to ${file} (the engine's unit reads it at start)`
20196
+ name: "credential",
20197
+ detail: `no ${API_KEY_VAR}, ${SEAT_TOKEN_VAR} or claude login here or in ${file} — a headless session cannot sign in`,
20198
+ fix: `add ${API_KEY_VAR}=… (a key) or ${SEAT_TOKEN_VAR}=… (a seat, from \`claude setup-token\`) to ${file}, or sign in once with \`claude\` and /login`
20121
20199
  }
20122
20200
  ];
20123
20201
  }
20202
+ function credentialDetail(c) {
20203
+ if (c.source === "login")
20204
+ return `seat · claude login at ${c.where}`;
20205
+ const name = c.source === "api_key" ? API_KEY_VAR : SEAT_TOKEN_VAR;
20206
+ return `${c.kind} · ${name} ${c.where === "this shell" ? "set in this shell" : `named in ${c.where}`}`;
20207
+ }
20124
20208
  function cmuxCheck(o, env) {
20125
20209
  const exec = o.exec ?? defaultExec3;
20126
20210
  const bin = resolveCmuxBin(o.exists ?? existsSync21, env.PATH ?? "");
@@ -20215,7 +20299,7 @@ import {
20215
20299
  writeFileSync as writeFileSync20
20216
20300
  } from "node:fs";
20217
20301
  import { hostname as hostname4, userInfo as userInfo3 } from "node:os";
20218
- import { dirname as dirname18, isAbsolute as isAbsolute5, join as join26, resolve as resolve10 } from "node:path";
20302
+ import { dirname as dirname18, isAbsolute as isAbsolute5, join as join27, resolve as resolve10 } from "node:path";
20219
20303
  init_machine();
20220
20304
  init_state();
20221
20305
  init_meter();
@@ -20475,7 +20559,7 @@ function flagsFromProfile2(flags, given, profile, home) {
20475
20559
  }
20476
20560
  }
20477
20561
  if (profile.reposDir && !has("repos-dir") && !has("repo")) {
20478
- out.reposDir = splitReposDirs(profile.reposDir).map((d) => home && /^~(\/|$)/.test(d) ? join26(home, d.slice(1)) : d).join(":");
20562
+ out.reposDir = splitReposDirs(profile.reposDir).map((d) => home && /^~(\/|$)/.test(d) ? join27(home, d.slice(1)) : d).join(":");
20479
20563
  used.push(`repos ${profile.reposDir}`);
20480
20564
  }
20481
20565
  if (profile.mcpStrict !== undefined && !has("strict-mcp") && !has("no-strict-mcp")) {
@@ -20621,7 +20705,7 @@ function engineClient2(o, org) {
20621
20705
  return fetchClient({
20622
20706
  ...src,
20623
20707
  timeoutMs: ENGINE_TIMEOUT_MS2,
20624
- version: "0.1.49"
20708
+ version: "0.1.50"
20625
20709
  });
20626
20710
  const asked = org?.trim() || env.SLEDS_ORG?.trim();
20627
20711
  if (asked && !selectOrg(readConfig(o.home), org, env).seat)
@@ -20670,12 +20754,12 @@ function memberMcpConfigs2(o, cwd) {
20670
20754
  });
20671
20755
  const claudeDir = (o.env ?? process.env).CLAUDE_CONFIG_DIR;
20672
20756
  return [
20673
- read(claudeDir ? join26(claudeDir, ".claude.json") : join26(o.home, ".claude.json")),
20674
- ...cwd ? [read(join26(cwd, ".mcp.json"))] : []
20757
+ read(claudeDir ? join27(claudeDir, ".claude.json") : join27(o.home, ".claude.json")),
20758
+ ...cwd ? [read(join27(cwd, ".mcp.json"))] : []
20675
20759
  ];
20676
20760
  }
20677
20761
  function engineStateDir2(o, org, seat) {
20678
- return seatStateDir(orgStateDir(o.stateDir ?? join26(configDir(o.home, o.env ?? process.env), "engine"), org), seat);
20762
+ return seatStateDir(orgStateDir(o.stateDir ?? join27(configDir(o.home, o.env ?? process.env), "engine"), org), seat);
20679
20763
  }
20680
20764
  function engineSeat2(o, org) {
20681
20765
  try {
@@ -20694,6 +20778,19 @@ function engineToken2(o, org) {
20694
20778
  }
20695
20779
  }
20696
20780
  var withToken2 = (token, now) => token ? { token, tokenNow: now } : {};
20781
+ function engineCredential(o) {
20782
+ const file = boxEnvPath(o.home);
20783
+ let boxEnvText = null;
20784
+ try {
20785
+ boxEnvText = readFileSync20(file, "utf8");
20786
+ } catch {}
20787
+ return detectCredential(o.env ?? process.env, {
20788
+ home: o.home,
20789
+ boxEnvText,
20790
+ boxEnvPath: file,
20791
+ exists: o.exists ?? realExists2
20792
+ })?.kind;
20793
+ }
20697
20794
  function engineDeps2(o, flags, source, runner, stateName) {
20698
20795
  const exec = guardGit(o.exec ?? defaultExec);
20699
20796
  const cwd = o.cwd ?? process.cwd();
@@ -20705,8 +20802,8 @@ function engineDeps2(o, flags, source, runner, stateName) {
20705
20802
  const repo = flags.repo ? resolve10(cwd, flags.repo) : undefined;
20706
20803
  const reposDirs = splitReposDirs(flags.reposDir).map((d) => resolve10(cwd, d));
20707
20804
  const { branch, prTitle } = flags;
20708
- const hooksDir = join26(stateDir, "hooks");
20709
- const permissionMark = (name) => join26(hooksDir, `${name}.permission.json`);
20805
+ const hooksDir = join27(stateDir, "hooks");
20806
+ const permissionMark = (name) => join27(hooksDir, `${name}.permission.json`);
20710
20807
  const withHook = (name, settings) => applyPermissionHook(settings, [...o.sledsArgv ?? ["sleds"], "permission-event", "--mark", permissionMark(name)].map(shq2).join(" "));
20711
20808
  return {
20712
20809
  source,
@@ -20731,9 +20828,9 @@ function engineDeps2(o, flags, source, runner, stateName) {
20731
20828
  sandbox: true,
20732
20829
  writeSandboxSettings: o.writeSandboxSettings ?? ((name, cwd, allow) => {
20733
20830
  const gitCommonDir = gitCommonDirOf2(exec, cwd);
20734
- const dir = join26(stateDir, "sandbox");
20831
+ const dir = join27(stateDir, "sandbox");
20735
20832
  mkdirSync21(dir, { recursive: true, mode: 448 });
20736
- const p = join26(dir, `${name}.json`);
20833
+ const p = join27(dir, `${name}.json`);
20737
20834
  const walls = engineSandboxSettings2(o.home, o.env ?? process.env, gitCommonDir, [
20738
20835
  ...SANDBOX_DEFAULT_ALLOW,
20739
20836
  ...flags.sandboxAllow ?? []
@@ -20750,7 +20847,7 @@ function engineDeps2(o, flags, source, runner, stateName) {
20750
20847
  } : {},
20751
20848
  writeHookSettings: (name, allow) => {
20752
20849
  mkdirSync21(hooksDir, { recursive: true, mode: 448 });
20753
- const p = join26(hooksDir, `${name}.json`);
20850
+ const p = join27(hooksDir, `${name}.json`);
20754
20851
  const base = allow?.length ? { permissions: { allow: [...allow] } } : {};
20755
20852
  writeFileSync20(p, `${JSON.stringify(withHook(name, base), null, 2)}
20756
20853
  `, { mode: 384 });
@@ -20778,9 +20875,9 @@ function engineDeps2(o, flags, source, runner, stateName) {
20778
20875
  exists
20779
20876
  }),
20780
20877
  writeMcpConfig: o.writeMcpConfig ?? ((name, runToken, worktree) => {
20781
- const dir = join26(stateDir, "mcp");
20878
+ const dir = join27(stateDir, "mcp");
20782
20879
  mkdirSync21(dir, { recursive: true, mode: 448 });
20783
- const p = join26(dir, `${name}.json`);
20880
+ const p = join27(dir, `${name}.json`);
20784
20881
  let others = {};
20785
20882
  if (flags.strictMcp && flags.mcpAllow?.length) {
20786
20883
  const r = mcpPassThrough(flags.mcpAllow, memberMcpConfigs2(o, worktree));
@@ -20796,9 +20893,9 @@ function engineDeps2(o, flags, source, runner, stateName) {
20796
20893
  }),
20797
20894
  removeMcpConfig: o.removeMcpConfig ?? ((p) => rmSync14(p, { force: true })),
20798
20895
  writePrompt: o.writePrompt ?? ((name, text) => {
20799
- const dir = join26(stateDir, "prompts");
20896
+ const dir = join27(stateDir, "prompts");
20800
20897
  mkdirSync21(dir, { recursive: true, mode: 448 });
20801
- const p = join26(dir, `${name}.md`);
20898
+ const p = join27(dir, `${name}.md`);
20802
20899
  writeFileSync20(p, text, { mode: 384 });
20803
20900
  return p;
20804
20901
  }),
@@ -20825,14 +20922,14 @@ function engineDeps2(o, flags, source, runner, stateName) {
20825
20922
  }
20826
20923
  function sandboxDenyRead2(home, env) {
20827
20924
  return {
20828
- dirs: [...new Set([configDir(home, env), join26(home, ".config", "sleds")])],
20925
+ dirs: [...new Set([configDir(home, env), join27(home, ".config", "sleds")])],
20829
20926
  files: [
20830
20927
  ...new Set([
20831
20928
  tokenPath(home, env),
20832
- join26(home, ".sleds-token"),
20929
+ join27(home, ".sleds-token"),
20833
20930
  settingsPath(home, env),
20834
20931
  backupPath(home, env),
20835
- join26(claudeDir(home, env), "settings.local.json")
20932
+ join27(claudeDir(home, env), "settings.local.json")
20836
20933
  ])
20837
20934
  ]
20838
20935
  };
@@ -20866,7 +20963,7 @@ function sandboxRefusal(flags) {
20866
20963
  }
20867
20964
  var LENT_NEEDS_SANDBOX2 = "a lent engine runs every session sandboxed (spec 48 rule 10) — add --sandbox to --lent-by";
20868
20965
  function lenderHome2(accountHome, lentBy) {
20869
- return isAbsolute5(lentBy) ? resolve10(lentBy) : join26(dirname18(accountHome), lentBy);
20966
+ return isAbsolute5(lentBy) ? resolve10(lentBy) : join27(dirname18(accountHome), lentBy);
20870
20967
  }
20871
20968
  function lentHomeProblems2(accountHome, lentBy, modeOf) {
20872
20969
  const lender = lenderHome2(accountHome, lentBy);
@@ -20934,7 +21031,7 @@ async function driveEngine2(o, flags, deps, until = {}) {
20934
21031
  runner: deps.runner.name,
20935
21032
  atOnce: flags.atOnce,
20936
21033
  interval: flags.interval,
20937
- cliVersion: "0.1.49"
21034
+ cliVersion: "0.1.50"
20938
21035
  };
20939
21036
  const beat = (checkedAt) => {
20940
21037
  const m = deps.machine;
@@ -21312,9 +21409,10 @@ var engineCmd = async (o) => {
21312
21409
  refused = r.refused;
21313
21410
  error(r.below ? `${r.refused}. This engine is not shown as up until it beats on a version SLEDS serves.` : `${r.refused}. This engine is not shown as up until it beats under a name of its own.`);
21314
21411
  };
21412
+ const credential = engineCredential(o);
21315
21413
  const body = () => {
21316
21414
  const m = deps.machine;
21317
- return beatBody(deps.readState(), { name: flags.name, runner: deps.runner.name }, {}, {
21415
+ return beatBody(deps.readState(), { name: flags.name, runner: deps.runner.name }, credential ? { credential } : {}, {
21318
21416
  atOnce: deps.atOnce,
21319
21417
  ...m?.last ? { machine: m.last } : {},
21320
21418
  ...m?.hold && !m.off ? { hold: m.hold } : {}
@@ -21556,7 +21654,7 @@ import {
21556
21654
  writeFileSync as writeFileSync21
21557
21655
  } from "node:fs";
21558
21656
  import { hostname as hostname5 } from "node:os";
21559
- import { basename as basename7, dirname as dirname19, isAbsolute as isAbsolute6, join as join27 } from "node:path";
21657
+ import { basename as basename7, dirname as dirname19, isAbsolute as isAbsolute6, join as join28 } from "node:path";
21560
21658
  init_state();
21561
21659
  var ENGINE_LABEL2 = "ai.sleds.engine";
21562
21660
  var ENGINE_INSTALL_USAGE2 = `usage: sleds engine install [engine flags] | sleds engine uninstall [--name <n>] [--org <slug>]
@@ -21577,13 +21675,13 @@ function engineLabel2(name, org, seat) {
21577
21675
  return [ENGINE_LABEL2, org, seat?.trim(), name].filter((p) => Boolean(p)).map((p, i) => i === 0 ? p : engineSlug(p)).join(".");
21578
21676
  }
21579
21677
  function enginePlistPath2(home, name, org, seat) {
21580
- return join27(home, "Library", "LaunchAgents", `${engineLabel2(name, org, seat)}.plist`);
21678
+ return join28(home, "Library", "LaunchAgents", `${engineLabel2(name, org, seat)}.plist`);
21581
21679
  }
21582
21680
  function engineLogPath2(stateDir, name) {
21583
- return join27(stateDir, `${engineSlug(name)}.log`);
21681
+ return join28(stateDir, `${engineSlug(name)}.log`);
21584
21682
  }
21585
21683
  function engineEventsPath2(stateDir, name) {
21586
- return join27(stateDir, `${engineSlug(name)}.events.jsonl`);
21684
+ return join28(stateDir, `${engineSlug(name)}.events.jsonl`);
21587
21685
  }
21588
21686
  var xmlEscape5 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
21589
21687
  function buildEnginePlist2(o) {
@@ -21680,7 +21778,7 @@ function readEngines2(dir, suffix, manager, parse) {
21680
21778
  }
21681
21779
  const out = [];
21682
21780
  for (const name of names.filter((n) => n.startsWith(`${ENGINE_LABEL2}.`) && n.endsWith(suffix))) {
21683
- const path = join27(dir, name);
21781
+ const path = join28(dir, name);
21684
21782
  let parsed;
21685
21783
  try {
21686
21784
  parsed = parse(readFileSync21(path, "utf8"), name);
@@ -21700,7 +21798,7 @@ function readEngines2(dir, suffix, manager, parse) {
21700
21798
  }
21701
21799
  function installedEngines2(home) {
21702
21800
  return [
21703
- ...readEngines2(join27(home, "Library", "LaunchAgents"), ".plist", "launchd", parseEnginePlist2),
21801
+ ...readEngines2(join28(home, "Library", "LaunchAgents"), ".plist", "launchd", parseEnginePlist2),
21704
21802
  ...readEngines2(engineUnitDir(home), ".service", "systemd", (text, file) => {
21705
21803
  const parsed = parseEngineUnit(text);
21706
21804
  return parsed && { label: basename7(file, ".service"), ...parsed };
@@ -21738,7 +21836,7 @@ async function ensureReposDir(o) {
21738
21836
  return false;
21739
21837
  }
21740
21838
  const exists = o.exists ?? existsSync22;
21741
- const missing = dirs.filter((d) => !exists(/^~(\/|$)/.test(d) ? join27(o.home, d.slice(1)) : d));
21839
+ const missing = dirs.filter((d) => !exists(/^~(\/|$)/.test(d) ? join28(o.home, d.slice(1)) : d));
21742
21840
  if (missing.length) {
21743
21841
  error(`Not a folder on this machine: ${missing.join(", ")}. ${REPOS_DIR_NEEDED}`);
21744
21842
  return false;
@@ -22861,9 +22959,9 @@ init_meter();
22861
22959
  // src/owed.ts
22862
22960
  init_config();
22863
22961
  import { existsSync as existsSync26, mkdirSync as mkdirSync23, readFileSync as readFileSync25, renameSync as renameSync11, writeFileSync as writeFileSync22 } from "node:fs";
22864
- import { dirname as dirname20, join as join28 } from "node:path";
22865
- var owedPath = (home) => join28(configDir(home), "owed.json");
22866
- var sessionPath = (home) => join28(configDir(home), "session.json");
22962
+ import { dirname as dirname20, join as join29 } from "node:path";
22963
+ var owedPath = (home) => join29(configDir(home), "owed.json");
22964
+ var sessionPath = (home) => join29(configDir(home), "session.json");
22867
22965
  var OWED_TTL_MS = 3 * 24 * 60 * 60000;
22868
22966
  var str14 = (v) => typeof v === "string" ? v : undefined;
22869
22967
  function sourceKey(s) {
@@ -23021,7 +23119,7 @@ function contextFor(deps) {
23021
23119
  ...src,
23022
23120
  fetchFn: deps.fetchFn,
23023
23121
  timeoutMs: deps.timeoutMs,
23024
- version: "0.1.49"
23122
+ version: "0.1.50"
23025
23123
  }), deps.home, now) : null;
23026
23124
  return {
23027
23125
  channel: "code",
@@ -24588,7 +24686,7 @@ var orgCmd = (o) => {
24588
24686
  init_src();
24589
24687
  import { spawnSync as spawnSync8 } from "node:child_process";
24590
24688
  import { writeFileSync as writeFileSync25 } from "node:fs";
24591
- import { join as join29 } from "node:path";
24689
+ import { join as join30 } from "node:path";
24592
24690
  function packFileName(key) {
24593
24691
  return `pack-${slugify(key, 80) || "item"}.md`;
24594
24692
  }
@@ -24616,7 +24714,7 @@ var packCmd = async (o) => {
24616
24714
  log(r.text);
24617
24715
  return 0;
24618
24716
  }
24619
- const path = join29(o.cwd ?? process.cwd(), packFileName(key));
24717
+ const path = join30(o.cwd ?? process.cwd(), packFileName(key));
24620
24718
  (o.write ?? ((p, t) => writeFileSync25(p, t.endsWith(`
24621
24719
  `) ? t : `${t}
24622
24720
  `)))(path, r.text);
@@ -25764,12 +25862,12 @@ async function seatRevokeCmd(o) {
25764
25862
  import { execFileSync as execFileSync5 } from "node:child_process";
25765
25863
  import { existsSync as existsSync30, mkdirSync as mkdirSync27, readFileSync as readFileSync30, readdirSync as readdirSync7, rmSync as rmSync21, writeFileSync as writeFileSync27 } from "node:fs";
25766
25864
  import { platform as platform2 } from "node:os";
25767
- import { dirname as dirname23, join as join31 } from "node:path";
25865
+ import { dirname as dirname23, join as join32 } from "node:path";
25768
25866
 
25769
25867
  // src/cookieDb.ts
25770
25868
  import { copyFileSync as copyFileSync3, rmSync as rmSync20 } from "node:fs";
25771
25869
  import { tmpdir as tmpdir2 } from "node:os";
25772
- import { join as join30 } from "node:path";
25870
+ import { join as join31 } from "node:path";
25773
25871
  var QUERY = "SELECT name, hex(encrypted_value) AS ev FROM cookies WHERE host_key LIKE '%claude.ai%'";
25774
25872
  var isBun = () => typeof globalThis.Bun !== "undefined";
25775
25873
  async function queryRows(dbPath) {
@@ -25798,7 +25896,7 @@ function nodeSqlite() {
25798
25896
  return mod;
25799
25897
  }
25800
25898
  async function readCookieRows(dbPath) {
25801
- const copy = join30(tmpdir2(), `sleds-cookies-${process.pid}-${Date.now()}.sqlite`);
25899
+ const copy = join31(tmpdir2(), `sleds-cookies-${process.pid}-${Date.now()}.sqlite`);
25802
25900
  copyFileSync3(dbPath, copy);
25803
25901
  try {
25804
25902
  const rows = await queryRows(copy);
@@ -26091,7 +26189,7 @@ function findFile(root, name) {
26091
26189
  continue;
26092
26190
  }
26093
26191
  for (const e of entries) {
26094
- const p = join31(dir, e.name);
26192
+ const p = join32(dir, e.name);
26095
26193
  if (e.isDirectory())
26096
26194
  stack.push(p);
26097
26195
  else if (e.name === name)
@@ -26102,7 +26200,7 @@ function findFile(root, name) {
26102
26200
  }
26103
26201
  function findCookieDb(home, source) {
26104
26202
  const b = BROWSERS[source.browser];
26105
- const root = join31(home, APP_SUPPORT, b.appDir);
26203
+ const root = join32(home, APP_SUPPORT, b.appDir);
26106
26204
  if (!existsSync30(root))
26107
26205
  throw new Error(`no ${source.browser} data at ${root} (is it installed?)`);
26108
26206
  if (!b.profiled) {
@@ -26111,7 +26209,7 @@ function findCookieDb(home, source) {
26111
26209
  throw new Error(`no cookie store under ${root}`);
26112
26210
  return db;
26113
26211
  }
26114
- const localStatePath = join31(root, "Local State");
26212
+ const localStatePath = join32(root, "Local State");
26115
26213
  const localState = existsSync30(localStatePath) ? readFileSync30(localStatePath, "utf8") : null;
26116
26214
  const wanted = source.profile ?? "Default";
26117
26215
  const { dir, ambiguous } = resolveProfileDir(localState, wanted);
@@ -26119,7 +26217,7 @@ function findCookieDb(home, source) {
26119
26217
  throw new Error(`"${wanted}" names ${ambiguous.length} ${source.browser} profiles (${ambiguous.join(", ")}) — pass the directory or the account email instead`);
26120
26218
  if (!dir)
26121
26219
  throw new Error(`no ${source.browser} profile named "${wanted}" (check chrome://version)`);
26122
- const db = cookieDbCandidates(join31(root, dir)).find((p) => existsSync30(p));
26220
+ const db = cookieDbCandidates(join32(root, dir)).find((p) => existsSync30(p));
26123
26221
  if (!db)
26124
26222
  throw new Error(`profile "${dir}" has no cookie store yet (open claude.ai in it once)`);
26125
26223
  return db;
@@ -26163,7 +26261,7 @@ function fetchSeatUsage(jar, org, now, run) {
26163
26261
  }
26164
26262
  function launchAgentPlist(argv, home, source) {
26165
26263
  const label = launchLabel(source);
26166
- const log = join31(home, ".config", "sleds", `${label.slice("ai.sleds.".length)}.log`);
26264
+ const log = join32(home, ".config", "sleds", `${label.slice("ai.sleds.".length)}.log`);
26167
26265
  const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
26168
26266
  const args = [...argv, "seat-sync", ...sourceArgs(source)].map((a) => ` <string>${esc(a)}</string>`).join(`
26169
26267
  `);
@@ -26185,14 +26283,14 @@ ${args}
26185
26283
  `;
26186
26284
  }
26187
26285
  function plistPath2(home, source) {
26188
- return join31(home, "Library", "LaunchAgents", `${launchLabel(source)}.plist`);
26286
+ return join32(home, "Library", "LaunchAgents", `${launchLabel(source)}.plist`);
26189
26287
  }
26190
26288
  function install(home, argv, source, log, launchctl) {
26191
26289
  if (!argv[0]) {
26192
26290
  log("cannot resolve the sleds command to install the timer");
26193
26291
  return 1;
26194
26292
  }
26195
- const dir = join31(home, "Library", "LaunchAgents");
26293
+ const dir = join32(home, "Library", "LaunchAgents");
26196
26294
  mkdirSync27(dir, { recursive: true });
26197
26295
  const path = plistPath2(home, source);
26198
26296
  const tokenPath = seatTokenPath(home, source);
@@ -27041,7 +27139,7 @@ var hasEitherKey = (settings) => {
27041
27139
  // src/commands/update.ts
27042
27140
  init_server();
27043
27141
  import { existsSync as existsSync34 } from "node:fs";
27044
- import { homedir as homedir7, userInfo as userInfo4 } from "node:os";
27142
+ import { homedir as homedir8, userInfo as userInfo4 } from "node:os";
27045
27143
  import { basename as basename9 } from "node:path";
27046
27144
  init_config();
27047
27145
  init_state();
@@ -27107,7 +27205,7 @@ var realPidAlive4 = (pid) => {
27107
27205
  };
27108
27206
  function machineClient(home, env) {
27109
27207
  const src = meterSource(home, undefined, { env });
27110
- return src ? fetchClient({ ...src, version: "0.1.49" }) : null;
27208
+ return src ? fetchClient({ ...src, version: "0.1.50" }) : null;
27111
27209
  }
27112
27210
  async function noteAnswer2(home, a, now) {
27113
27211
  try {
@@ -27129,7 +27227,7 @@ function busyLine(busy) {
27129
27227
  return `${n} session${n === 1 ? " is" : "s are"} running on ${on} — sleds update --now releases ${n === 1 ? "it" : "them"}`;
27130
27228
  }
27131
27229
  async function updateCmd(o) {
27132
- const home = o.home ?? homedir7();
27230
+ const home = o.home ?? homedir8();
27133
27231
  const env = o.env ?? process.env;
27134
27232
  const log = o.log ?? console.log;
27135
27233
  const error = o.error ?? console.error;
@@ -27433,12 +27531,12 @@ var webhooksCmd = async (o) => {
27433
27531
  // src/config.ts
27434
27532
  init_settings();
27435
27533
  import { chmodSync as chmodSync8, existsSync as existsSync35, mkdirSync as mkdirSync28, readFileSync as readFileSync33, renameSync as renameSync13, writeFileSync as writeFileSync28 } from "node:fs";
27436
- import { join as join32, resolve as resolve11 } from "node:path";
27534
+ import { join as join33, resolve as resolve11 } from "node:path";
27437
27535
  var configDir2 = (home, env = process.env) => {
27438
27536
  const o = env.SLEDS_HOME?.trim();
27439
- return o ? resolve11(home, o) : join32(home, ".config", "sleds");
27537
+ return o ? resolve11(home, o) : join33(home, ".config", "sleds");
27440
27538
  };
27441
- var configPath2 = (home) => join32(configDir2(home), "config.json");
27539
+ var configPath2 = (home) => join33(configDir2(home), "config.json");
27442
27540
  var isObject17 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
27443
27541
  var optString2 = (v) => typeof v === "string" ? v : undefined;
27444
27542
  var parsePriorEnv2 = (v) => {
@@ -27615,10 +27713,10 @@ function runnerFor3(name, exec = defaultExec, o = {}) {
27615
27713
  }
27616
27714
 
27617
27715
  // src/runtime.ts
27618
- import { homedir as homedir8 } from "node:os";
27619
- import { join as join33, win32 as win323 } from "node:path";
27716
+ import { homedir as homedir9 } from "node:os";
27717
+ import { join as join34, win32 as win323 } from "node:path";
27620
27718
  var isCompiled2 = (argv1 = process.argv[1]) => Boolean(argv1 && (argv1.startsWith("/$bunfs/") || argv1.startsWith("B:\\~BUN\\")));
27621
- var sledsLink2 = (home = homedir8(), platform = process.platform) => platform === "win32" ? win323.join(process.env.LOCALAPPDATA ?? win323.join(home, "AppData", "Local"), "sleds", "bin", "sleds.exe") : join33(home, ".sleds", "bin", "sleds");
27719
+ var sledsLink2 = (home = homedir9(), platform = process.platform) => platform === "win32" ? win323.join(process.env.LOCALAPPDATA ?? win323.join(home, "AppData", "Local"), "sleds", "bin", "sleds.exe") : join34(home, ".sleds", "bin", "sleds");
27622
27720
 
27623
27721
  // src/schedule.ts
27624
27722
  import { spawnSync as spawnSync11 } from "node:child_process";
@@ -27630,7 +27728,7 @@ var defaultExec5 = (cmd, args) => {
27630
27728
  };
27631
27729
 
27632
27730
  // src/settings.ts
27633
- import { dirname as dirname24, join as join34, resolve as resolve12 } from "node:path";
27731
+ import { dirname as dirname24, join as join35, resolve as resolve12 } from "node:path";
27634
27732
  var withSeatEnv2 = (command, home, env = process.env, org) => {
27635
27733
  const parts = [];
27636
27734
  const sh = env.SLEDS_HOME?.trim();
@@ -27927,12 +28025,12 @@ var sledsArgv = (execPath = process.execPath, script = process.argv[1], realpath
27927
28025
  return stableArgv2(script ? [execPath, script] : [execPath], realpath, o.home);
27928
28026
  };
27929
28027
  var shellQuote = (s) => /^[\w./-]+$/.test(s) ? s : `'${s.replace(/'/g, "'\\''")}'`;
27930
- var statusLineCommand = (argv, home = homedir9()) => withSeatEnv2([...argv, "statusline"].map(shellQuote).join(" "), home);
27931
- var seatEventCommand = (argv, home = homedir9()) => withSeatEnv2([...argv, "seat-event"].map(shellQuote).join(" "), home);
27932
- var promptEventCommand = (argv, home = homedir9()) => withSeatEnv2([...argv, "prompt-event"].map(shellQuote).join(" "), home);
27933
- var sessionEventCommand = (argv, home = homedir9()) => withSeatEnv2([...argv, "session-event"].map(shellQuote).join(" "), home);
27934
- var stopEventCommand = (argv, home = homedir9()) => withSeatEnv2([...argv, "stop-event"].map(shellQuote).join(" "), home);
27935
- var specEventCommand = (argv, home = homedir9()) => withSeatEnv2([...argv, "spec-event"].map(shellQuote).join(" "), home);
28028
+ var statusLineCommand = (argv, home = homedir10()) => withSeatEnv2([...argv, "statusline"].map(shellQuote).join(" "), home);
28029
+ var seatEventCommand = (argv, home = homedir10()) => withSeatEnv2([...argv, "seat-event"].map(shellQuote).join(" "), home);
28030
+ var promptEventCommand = (argv, home = homedir10()) => withSeatEnv2([...argv, "prompt-event"].map(shellQuote).join(" "), home);
28031
+ var sessionEventCommand = (argv, home = homedir10()) => withSeatEnv2([...argv, "session-event"].map(shellQuote).join(" "), home);
28032
+ var stopEventCommand = (argv, home = homedir10()) => withSeatEnv2([...argv, "stop-event"].map(shellQuote).join(" "), home);
28033
+ var specEventCommand = (argv, home = homedir10()) => withSeatEnv2([...argv, "spec-event"].map(shellQuote).join(" "), home);
27936
28034
  var mcpFlag = (flags) => flags["no-mcp"] === true ? false : flags.mcp === true ? true : undefined;
27937
28035
  var main = async (argv) => {
27938
28036
  const { cmd, flags } = parseArgs(argv);
@@ -27940,7 +28038,7 @@ var main = async (argv) => {
27940
28038
  console.log(commandUsage(cmd));
27941
28039
  return 0;
27942
28040
  }
27943
- const home = homedir9();
28041
+ const home = homedir10();
27944
28042
  const scheduler = {
27945
28043
  platform: platform3(),
27946
28044
  home,
@@ -27952,7 +28050,7 @@ var main = async (argv) => {
27952
28050
  now: Date.now(),
27953
28051
  stderr: (line) => console.error(line),
27954
28052
  isTTY: !!process.stderr.isTTY,
27955
- version: "0.1.49"
28053
+ version: "0.1.50"
27956
28054
  });
27957
28055
  switch (cmd) {
27958
28056
  case "update":
@@ -28185,7 +28283,7 @@ ${renderHelpText(argv[1])}`);
28185
28283
  case "version":
28186
28284
  case "--version":
28187
28285
  case "-v":
28188
- console.log("sleds 0.1.49");
28286
+ console.log("sleds 0.1.50");
28189
28287
  return 0;
28190
28288
  default:
28191
28289
  console.error(`unknown command: ${cmd}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleds/cli",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "SLEDS CLI — the cost and limits of AI agent work, decided at the wall. Point Claude Code at a SLEDS proxy; estimate before you run; hold, switch model, or run overnight when you hit a limit.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",