@sleds/cli 0.1.27 → 0.1.28

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 (3) hide show
  1. package/README.md +2 -1
  2. package/dist/sleds.mjs +136 -56
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -71,7 +71,8 @@ tmux the default — any terminal; one detached session per node, `tmux at
71
71
  headless Claude Code's -p with no terminal; the transcript goes to a file beside the prompt, nothing goes in
72
72
  command your own launcher: --runner-cmd '<shell template>' with {prompt} {cwd} {name} {branch} {agent};
73
73
  it must block until the session ends, or the node reads as exited at once
74
- orca for people who run agents in Orca: Orca makes the worktree and starts the agent in its terminal
74
+ orca for people who run agents in Orca: Orca makes the worktree, the engine starts the agent in an
75
+ Orca terminal with the same command tmux runs (--agent, --mode and --model all apply)
75
76
  ```
76
77
 
77
78
  The flags `sleds route run` and `sleds engine` share:
package/dist/sleds.mjs CHANGED
@@ -590,11 +590,11 @@ import {
590
590
  existsSync as existsSync19,
591
591
  mkdirSync as mkdirSync18,
592
592
  openSync as openSync3,
593
- readFileSync as readFileSync17,
593
+ readFileSync as readFileSync16,
594
594
  readSync as readSync3,
595
595
  renameSync as renameSync8,
596
596
  statSync as statSync3,
597
- writeFileSync as writeFileSync18
597
+ writeFileSync as writeFileSync19
598
598
  } from "node:fs";
599
599
  import { join as join22 } from "node:path";
600
600
  var SEAT_POST_MIN_DELTA_PCT2 = 1, SEAT_POST_MIN_INTERVAL_MS2, SEAT_POST_TIMEOUT_MS2 = 1500, STDIN_TIMEOUT_MS2 = 300, isObject16 = (v) => typeof v === "object" && v !== null && !Array.isArray(v), num8 = (v) => typeof v === "number" && Number.isFinite(v) ? v : undefined, EPOCH_MS_THRESHOLD2 = 100000000000, parseResetsAt2 = (v) => {
@@ -844,7 +844,7 @@ var SEAT_POST_MIN_DELTA_PCT2 = 1, SEAT_POST_MIN_INTERVAL_MS2, SEAT_POST_TIMEOUT_
844
844
  if (!existsSync19(p2))
845
845
  return {};
846
846
  try {
847
- return parseSeatState2(JSON.parse(readFileSync17(p2, "utf8")));
847
+ return parseSeatState2(JSON.parse(readFileSync16(p2, "utf8")));
848
848
  } catch {
849
849
  return {};
850
850
  }
@@ -853,7 +853,7 @@ var SEAT_POST_MIN_DELTA_PCT2 = 1, SEAT_POST_MIN_INTERVAL_MS2, SEAT_POST_TIMEOUT_
853
853
  mkdirSync18(dir, { recursive: true, mode: 448 });
854
854
  const target = seatStatePath2(home);
855
855
  const tmp = `${target}.${process.pid}.tmp`;
856
- writeFileSync18(tmp, `${JSON.stringify(state)}
856
+ writeFileSync19(tmp, `${JSON.stringify(state)}
857
857
  `, { mode: 384 });
858
858
  renameSync8(tmp, target);
859
859
  }, pctOf2 = (b) => b?.usedPct, shouldPostSeat2 = (state, next, now) => {
@@ -7549,7 +7549,7 @@ var doctor = async (o2) => {
7549
7549
  };
7550
7550
 
7551
7551
  // src/commands/engine.ts
7552
- import { mkdirSync as mkdirSync9, existsSync as realExists, writeFileSync as writeFileSync8 } from "node:fs";
7552
+ import { mkdirSync as mkdirSync9, existsSync as realExists, writeFileSync as writeFileSync9 } from "node:fs";
7553
7553
  import { hostname as hostname2 } from "node:os";
7554
7554
  import { join as join12, resolve as resolve6 } from "node:path";
7555
7555
  init_config();
@@ -8115,6 +8115,10 @@ function removeWorktree(exec, repoPath, path) {
8115
8115
  if (r.status !== 0)
8116
8116
  throw fail(`git worktree remove ${path}`, r);
8117
8117
  }
8118
+ function worktreeHead(exec, path) {
8119
+ const r = exec("git", ["-C", path, "rev-parse", "HEAD"]);
8120
+ return r.status === 0 && r.stdout.trim() ? r.stdout.trim() : null;
8121
+ }
8118
8122
  function removeBranch(exec, repoPath, branch, head) {
8119
8123
  const r = exec("git", ["-C", repoPath, "update-ref", "-d", `refs/heads/${branch}`, head]);
8120
8124
  if (r.status !== 0)
@@ -8512,6 +8516,27 @@ async function follow(d, run, claim, runner, finished, attention, changes = [])
8512
8516
  pr.clear = clear;
8513
8517
  return true;
8514
8518
  }
8519
+ function rippleRunnerWorktree(d, run, runner, head) {
8520
+ const wt = run.handle.cwd;
8521
+ if (!runner.removeWorktree || wt === run.repoPath)
8522
+ return;
8523
+ const at = d.worktreeHead?.(d.exec, wt) ?? null;
8524
+ if (!head || !at) {
8525
+ d.log(`${ref(run)}: kept the worktree ${wt}: no merged commit to check it against`);
8526
+ return;
8527
+ }
8528
+ if (at !== head) {
8529
+ d.log(`${ref(run)}: kept the worktree ${wt}: it has commits after the merge`);
8530
+ return;
8531
+ }
8532
+ try {
8533
+ const note = runner.removeWorktree(run.handle, run.repoPath);
8534
+ if (note)
8535
+ d.log(`${ref(run)}: ${note}`);
8536
+ } catch (e) {
8537
+ d.log(`${ref(run)}: kept the worktree ${wt}: ${message(e)}`);
8538
+ }
8539
+ }
8515
8540
  async function ripple(d, run, claim, runner, url, finished, head) {
8516
8541
  const outcome = { kind: "merged", ref: url };
8517
8542
  try {
@@ -8527,7 +8552,11 @@ async function ripple(d, run, claim, runner, url, finished, head) {
8527
8552
  d.log(`${ref(run)}: could not close the session: ${message(e)}`);
8528
8553
  }
8529
8554
  const wt = run.handle.cwd;
8530
- if (runner.makesWorktree || wt === run.repoPath || !wt.startsWith(`${run.repoPath}/.worktrees/`))
8555
+ if (runner.makesWorktree) {
8556
+ rippleRunnerWorktree(d, run, runner, head);
8557
+ return;
8558
+ }
8559
+ if (wt === run.repoPath || !wt.startsWith(`${run.repoPath}/.worktrees/`))
8531
8560
  return;
8532
8561
  try {
8533
8562
  d.removeWorktree(d.exec, run.repoPath, wt);
@@ -8780,7 +8809,8 @@ function parseRun(v) {
8780
8809
  runner: handle.runner,
8781
8810
  id: handle.id,
8782
8811
  cwd: handle.cwd,
8783
- ...typeof handle.log === "string" ? { log: handle.log } : {}
8812
+ ...typeof handle.log === "string" ? { log: handle.log } : {},
8813
+ ...isObject10(handle.own) && typeof handle.own.branch === "string" && typeof handle.own.head === "string" ? { own: { branch: handle.own.branch, head: handle.own.head } } : {}
8784
8814
  },
8785
8815
  startedAt: typeof startedAt === "number" ? startedAt : 0,
8786
8816
  ...typeof v.seen === "string" ? { seen: v.seen } : {},
@@ -9034,7 +9064,7 @@ function headlessRunner(deps = {}) {
9034
9064
  }
9035
9065
 
9036
9066
  // src/runners/orca.ts
9037
- import { readFileSync as readFileSync9 } from "node:fs";
9067
+ import { writeFileSync as writeFileSync8 } from "node:fs";
9038
9068
  var obj = (v) => v !== null && typeof v === "object" && !Array.isArray(v) ? v : null;
9039
9069
  var str7 = (v) => typeof v === "string" && v.length > 0 ? v : null;
9040
9070
  var parseOrcaJson = (stdout) => {
@@ -9052,13 +9082,25 @@ var orcaError = (env) => {
9052
9082
  const code = str7(e?.code);
9053
9083
  return code ? `${message2} (${code})` : message2;
9054
9084
  };
9055
- var parseOrcaCreate = (env, repoPath) => {
9085
+ var parseOrcaWorktree = (env) => {
9086
+ const result = obj(env.result) ?? {};
9087
+ return str7(obj(result.worktree)?.path) ?? str7(result.worktreePath) ?? str7(result.path);
9088
+ };
9089
+ var parseOrcaBranch = (env) => {
9090
+ const wt = obj(obj(env.result)?.worktree);
9091
+ const branch = str7(wt?.branch)?.replace(/^refs\/heads\//, "");
9092
+ const head = str7(wt?.head);
9093
+ return branch && head ? { branch, head } : null;
9094
+ };
9095
+ var parseOrcaTerminal = (env) => {
9056
9096
  const result = obj(env.result) ?? {};
9057
- const terminal = str7(result.agentTerminalHandle) ?? str7(obj(result.startupTerminal)?.handle) ?? null;
9058
- const worktree = obj(result.worktree);
9059
- const cwd = str7(worktree?.path) ?? str7(result.worktreePath) ?? str7(result.path) ?? repoPath;
9060
- return { terminal, cwd };
9097
+ return str7(obj(result.terminal)?.handle) ?? str7(result.handle) ?? str7(result.terminalHandle) ?? null;
9061
9098
  };
9099
+ var orcaLauncher = (o2) => `#!/bin/sh
9100
+ # sleds engine: ${o2.name}
9101
+ exec ${agentShellCommand(o2)}
9102
+ `;
9103
+ var orcaCommand = (launcher) => `sh ${shq(launcher)}; exit`;
9062
9104
  var GONE = /exit|clos|gone|dead|stopp|kill/i;
9063
9105
  var orcaTerminalLive = (status3, stdout) => {
9064
9106
  const env = parseOrcaJson(stdout);
@@ -9073,43 +9115,66 @@ var orcaTerminalLive = (status3, stdout) => {
9073
9115
  return false;
9074
9116
  if (typeof t.exitCode === "number")
9075
9117
  return false;
9118
+ if (obj(t.exitCause))
9119
+ return false;
9120
+ if (t.orphaned === true && t.writable === false)
9121
+ return false;
9076
9122
  return true;
9077
9123
  };
9124
+ var launcherPath = (promptFile) => `${promptFile.replace(/\.md$/, "")}.orca.sh`;
9078
9125
  function orcaRunner(exec, deps = {}) {
9079
- const readFile = deps.readFile ?? ((p2) => readFileSync9(p2, "utf8"));
9126
+ const writeFile = deps.writeFile ?? ((p2, t) => writeFileSync8(p2, t, { mode: 384 }));
9127
+ const orca = (args, what) => {
9128
+ const r = exec("orca", args);
9129
+ const env = parseOrcaJson(r.stdout);
9130
+ const refused = orcaError(env);
9131
+ if (refused)
9132
+ throw new Error(`${what}: ${refused}`);
9133
+ if (r.status !== 0 || !env) {
9134
+ throw new Error(`${what} failed: ${r.stderr.trim() || r.stdout.trim() || `exit ${r.status}`}`);
9135
+ }
9136
+ return env;
9137
+ };
9080
9138
  return {
9081
9139
  name: "orca",
9082
9140
  makesWorktree: true,
9083
9141
  readsSession: true,
9084
9142
  start(o2) {
9085
- const r = exec("orca", [
9143
+ const created = orca([
9086
9144
  "worktree",
9087
9145
  "create",
9088
9146
  "--repo",
9089
9147
  `path:${o2.repoPath}`,
9090
9148
  "--name",
9091
9149
  o2.name,
9092
- "--agent",
9093
- "claude",
9094
- "--prompt",
9095
- readFile(o2.promptFile),
9096
9150
  "--base-branch",
9097
9151
  `origin/${o2.base ?? "main"}`,
9098
9152
  "--no-parent",
9099
9153
  "--json"
9100
- ]);
9101
- const env = parseOrcaJson(r.stdout);
9102
- const refused = orcaError(env);
9103
- if (refused)
9104
- throw new Error(`orca worktree create ${o2.name}: ${refused}`);
9105
- if (r.status !== 0 || !env) {
9106
- throw new Error(`orca worktree create ${o2.name} failed: ${r.stderr.trim() || r.stdout.trim() || `exit ${r.status}`}`);
9154
+ ], `orca worktree create ${o2.name}`);
9155
+ const cwd = parseOrcaWorktree(created);
9156
+ if (!cwd) {
9157
+ throw new Error(`orca worktree create ${o2.name} returned no worktree path; the agent was not started`);
9107
9158
  }
9108
- const { terminal, cwd } = parseOrcaCreate(env, o2.repoPath);
9159
+ const launcher = launcherPath(o2.promptFile);
9160
+ writeFile(launcher, orcaLauncher(o2));
9161
+ const shown = orca([
9162
+ "terminal",
9163
+ "create",
9164
+ "--worktree",
9165
+ `path:${cwd}`,
9166
+ "--title",
9167
+ o2.name,
9168
+ "--command",
9169
+ orcaCommand(launcher),
9170
+ "--json"
9171
+ ], `orca terminal create ${o2.name} (worktree ${cwd})`);
9172
+ const terminal = parseOrcaTerminal(shown);
9109
9173
  if (!terminal) {
9110
- throw new Error(`orca worktree create ${o2.name} made the worktree at ${cwd} but returned no agent terminal handle`);
9174
+ throw new Error(`orca terminal create ${o2.name} started in ${cwd} but returned no terminal handle`);
9111
9175
  }
9112
- const h = { runner: "orca", id: terminal, cwd };
9176
+ const own = parseOrcaBranch(created);
9177
+ const h = { runner: "orca", id: terminal, cwd, ...own ? { own } : {} };
9113
9178
  return h;
9114
9179
  },
9115
9180
  status(h) {
@@ -9131,6 +9196,19 @@ function orcaRunner(exec, deps = {}) {
9131
9196
  },
9132
9197
  watchHint(h) {
9133
9198
  return `orca terminal show --terminal ${h.id}`;
9199
+ },
9200
+ removeWorktree(h, repoPath) {
9201
+ orca(["worktree", "rm", "--worktree", `path:${h.cwd}`, "--json"], `orca worktree rm ${h.cwd}`);
9202
+ if (!h.own)
9203
+ return;
9204
+ const ref2 = `refs/heads/${h.own.branch}`;
9205
+ const r = exec("git", ["-C", repoPath, "update-ref", "-d", ref2, h.own.head]);
9206
+ if (r.status === 0)
9207
+ return;
9208
+ const still = exec("git", ["-C", repoPath, "rev-parse", "--verify", "--quiet", ref2]);
9209
+ if (still.status !== 0)
9210
+ return;
9211
+ return `kept Orca's branch ${h.own.branch}: ${r.stderr.trim() || `exit ${r.status}`}`;
9134
9212
  }
9135
9213
  };
9136
9214
  }
@@ -9373,7 +9451,7 @@ function engineDeps(o2, flags, source, runner, stateName) {
9373
9451
  const dir = join12(stateDir, "prompts");
9374
9452
  mkdirSync9(dir, { recursive: true, mode: 448 });
9375
9453
  const p2 = join12(dir, `${name}.md`);
9376
- writeFileSync8(p2, text, { mode: 384 });
9454
+ writeFileSync9(p2, text, { mode: 384 });
9377
9455
  return p2;
9378
9456
  }),
9379
9457
  ensureWorktree: (e, repoPath, branch2, path, base) => ensureWorktree(e, repoPath, branch2, path, base, o2.worktreeFs ?? { ...realWorktreeFs, exists }),
@@ -9383,6 +9461,7 @@ function engineDeps(o2, flags, source, runner, stateName) {
9383
9461
  prView,
9384
9462
  removeWorktree,
9385
9463
  removeBranch,
9464
+ worktreeHead,
9386
9465
  log: o2.log ?? console.log
9387
9466
  };
9388
9467
  }
@@ -9603,7 +9682,7 @@ init_meter();
9603
9682
 
9604
9683
  // src/owed.ts
9605
9684
  init_config();
9606
- import { existsSync as existsSync10, mkdirSync as mkdirSync10, readFileSync as readFileSync10, renameSync as renameSync6, writeFileSync as writeFileSync9 } from "node:fs";
9685
+ import { existsSync as existsSync10, mkdirSync as mkdirSync10, readFileSync as readFileSync9, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "node:fs";
9607
9686
  import { dirname as dirname7, join as join13 } from "node:path";
9608
9687
  var owedPath = (home) => join13(configDir(home), "owed.json");
9609
9688
  var sessionPath = (home) => join13(configDir(home), "session.json");
@@ -9624,7 +9703,7 @@ var readJson = (p2) => {
9624
9703
  if (!existsSync10(p2))
9625
9704
  return null;
9626
9705
  try {
9627
- return JSON.parse(readFileSync10(p2, "utf8"));
9706
+ return JSON.parse(readFileSync9(p2, "utf8"));
9628
9707
  } catch {
9629
9708
  return null;
9630
9709
  }
@@ -9632,7 +9711,7 @@ var readJson = (p2) => {
9632
9711
  var writeJson = (p2, v) => {
9633
9712
  mkdirSync10(dirname7(p2), { recursive: true, mode: 448 });
9634
9713
  const tmp = `${p2}.${process.pid}.tmp`;
9635
- writeFileSync9(tmp, `${JSON.stringify(v, null, 2)}
9714
+ writeFileSync10(tmp, `${JSON.stringify(v, null, 2)}
9636
9715
  `, { mode: 384 });
9637
9716
  renameSync6(tmp, p2);
9638
9717
  };
@@ -9819,7 +9898,7 @@ var hooks = (o2) => {
9819
9898
  // src/commands/init.ts
9820
9899
  init_config();
9821
9900
  init_settings();
9822
- import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync10 } from "node:fs";
9901
+ import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync11 } from "node:fs";
9823
9902
  import { createInterface } from "node:readline";
9824
9903
 
9825
9904
  // src/skill.ts
@@ -10377,7 +10456,7 @@ var init = async (o2) => {
10377
10456
  });
10378
10457
  wrote.push(`saved token and proxy URL to ${configPath(o2.home)} (0600)`);
10379
10458
  mkdirSync11(skillDir(o2.home), { recursive: true });
10380
- writeFileSync10(skillPath(o2.home), SKILL_MD);
10459
+ writeFileSync11(skillPath(o2.home), SKILL_MD);
10381
10460
  wrote.push(`installed skill at ${skillPath(o2.home)}`);
10382
10461
  if (o2.installMusher) {
10383
10462
  const r = o2.installMusher();
@@ -10469,7 +10548,7 @@ var meter = async (o2) => {
10469
10548
  init_config();
10470
10549
  init_meter();
10471
10550
  import { spawnSync as spawnSync5 } from "node:child_process";
10472
- import { existsSync as existsSync11, mkdirSync as mkdirSync12, readFileSync as readFileSync11, rmSync as rmSync2, writeFileSync as writeFileSync11 } from "node:fs";
10551
+ import { existsSync as existsSync11, mkdirSync as mkdirSync12, readFileSync as readFileSync10, rmSync as rmSync2, writeFileSync as writeFileSync12 } from "node:fs";
10473
10552
  import { hostname as hostname4 } from "node:os";
10474
10553
  import { dirname as dirname8 } from "node:path";
10475
10554
  var defaultWhich3 = (cmd) => {
@@ -10521,7 +10600,7 @@ var musherInstall = (o2) => {
10521
10600
  const exec = o2.exec ?? defaultExecSync;
10522
10601
  if (existsSync11(plist))
10523
10602
  exec("launchctl", ["unload", plist]);
10524
- writeFileSync11(plist, buildMusherPlist({ sledsArgv: o2.sledsArgv, env: agentEnv, logPath: musherLogPath(dir), label }));
10603
+ writeFileSync12(plist, buildMusherPlist({ sledsArgv: o2.sledsArgv, env: agentEnv, logPath: musherLogPath(dir), label }));
10525
10604
  const r = exec("launchctl", ["load", plist]);
10526
10605
  if (!r.ok) {
10527
10606
  error(`launchctl load failed: ${r.stderr.trim() || "unknown"}`);
@@ -10687,7 +10766,7 @@ var musher3 = async (o2) => {
10687
10766
  init_config();
10688
10767
 
10689
10768
  // src/schedule.ts
10690
- import { existsSync as existsSync12, mkdirSync as mkdirSync13, rmSync as rmSync3, writeFileSync as writeFileSync12 } from "node:fs";
10769
+ import { existsSync as existsSync12, mkdirSync as mkdirSync13, rmSync as rmSync3, writeFileSync as writeFileSync13 } from "node:fs";
10691
10770
  import { join as join14 } from "node:path";
10692
10771
  var REVERT_LABEL = "ai.sleds.revert";
10693
10772
  var plistPath = (home) => join14(home, "Library", "LaunchAgents", `${REVERT_LABEL}.plist`);
@@ -10731,7 +10810,7 @@ var scheduleRevert = (d, deadlineMs) => {
10731
10810
  try {
10732
10811
  mkdirSync13(join14(d.home, "Library", "LaunchAgents"), { recursive: true });
10733
10812
  d.exec("launchctl", ["unload", p2]);
10734
- writeFileSync12(p2, buildLaunchdPlist(d.sledsArgv, deadline));
10813
+ writeFileSync13(p2, buildLaunchdPlist(d.sledsArgv, deadline));
10735
10814
  const r = d.exec("launchctl", ["load", p2]);
10736
10815
  if (r.ok)
10737
10816
  return { kind: "launchd", detail: `launchd agent ${REVERT_LABEL}` };
@@ -10885,7 +10964,7 @@ var on = (o2) => {
10885
10964
 
10886
10965
  // src/commands/pack.ts
10887
10966
  import { spawnSync as spawnSync6 } from "node:child_process";
10888
- import { writeFileSync as writeFileSync13 } from "node:fs";
10967
+ import { writeFileSync as writeFileSync14 } from "node:fs";
10889
10968
  import { join as join15 } from "node:path";
10890
10969
  function packFileName(key) {
10891
10970
  return `pack-${slugify(key, 80) || "item"}.md`;
@@ -10915,7 +10994,7 @@ var packCmd = async (o2) => {
10915
10994
  return 0;
10916
10995
  }
10917
10996
  const path = join15(o2.cwd ?? process.cwd(), packFileName(key));
10918
- (o2.write ?? ((p2, t) => writeFileSync13(p2, t.endsWith(`
10997
+ (o2.write ?? ((p2, t) => writeFileSync14(p2, t.endsWith(`
10919
10998
  `) ? t : `${t}
10920
10999
  `)))(path, r.text);
10921
11000
  log(`Wrote ${path} — hand it to any model. \`sleds pack ${key} --run\` starts Claude Code with it.`);
@@ -11013,7 +11092,7 @@ var promptEvent = async (o2) => {
11013
11092
  import { hostname as hostname5 } from "node:os";
11014
11093
 
11015
11094
  // src/commands/engine.ts
11016
- import { mkdirSync as mkdirSync14, existsSync as realExists2, writeFileSync as writeFileSync14 } from "node:fs";
11095
+ import { mkdirSync as mkdirSync14, existsSync as realExists2, writeFileSync as writeFileSync15 } from "node:fs";
11017
11096
  import { join as join16, resolve as resolve7 } from "node:path";
11018
11097
  init_config();
11019
11098
  init_meter();
@@ -11175,7 +11254,7 @@ function engineDeps2(o2, flags, source, runner, stateName) {
11175
11254
  const dir = join16(stateDir, "prompts");
11176
11255
  mkdirSync14(dir, { recursive: true, mode: 448 });
11177
11256
  const p2 = join16(dir, `${name}.md`);
11178
- writeFileSync14(p2, text, { mode: 384 });
11257
+ writeFileSync15(p2, text, { mode: 384 });
11179
11258
  return p2;
11180
11259
  }),
11181
11260
  ensureWorktree: (e, repoPath, branch2, path, base) => ensureWorktree(e, repoPath, branch2, path, base, o2.worktreeFs ?? { ...realWorktreeFs, exists }),
@@ -11185,6 +11264,7 @@ function engineDeps2(o2, flags, source, runner, stateName) {
11185
11264
  prView,
11186
11265
  removeWorktree,
11187
11266
  removeBranch,
11267
+ worktreeHead,
11188
11268
  log: o2.log ?? console.log
11189
11269
  };
11190
11270
  }
@@ -11582,7 +11662,7 @@ var seatEvent = async (o2) => {
11582
11662
 
11583
11663
  // src/commands/seatSync.ts
11584
11664
  import { execFileSync as execFileSync2 } from "node:child_process";
11585
- import { existsSync as existsSync13, mkdirSync as mkdirSync15, readFileSync as readFileSync12, readdirSync as readdirSync2, writeFileSync as writeFileSync15 } from "node:fs";
11665
+ import { existsSync as existsSync13, mkdirSync as mkdirSync15, readFileSync as readFileSync11, readdirSync as readdirSync2, writeFileSync as writeFileSync16 } from "node:fs";
11586
11666
  import { platform as platform2 } from "node:os";
11587
11667
  import { join as join18 } from "node:path";
11588
11668
 
@@ -11924,7 +12004,7 @@ function findCookieDb(home, source) {
11924
12004
  return db2;
11925
12005
  }
11926
12006
  const localStatePath = join18(root, "Local State");
11927
- const localState = existsSync13(localStatePath) ? readFileSync12(localStatePath, "utf8") : null;
12007
+ const localState = existsSync13(localStatePath) ? readFileSync11(localStatePath, "utf8") : null;
11928
12008
  const wanted = source.profile ?? "Default";
11929
12009
  const { dir, ambiguous } = resolveProfileDir(localState, wanted);
11930
12010
  if (ambiguous)
@@ -12008,7 +12088,7 @@ function install(home, argv, source, log) {
12008
12088
  const dir = join18(home, "Library", "LaunchAgents");
12009
12089
  mkdirSync15(dir, { recursive: true });
12010
12090
  const path = plistPath2(home, source);
12011
- writeFileSync15(path, launchAgentPlist(bun, script, home, source), { mode: 384 });
12091
+ writeFileSync16(path, launchAgentPlist(bun, script, home, source), { mode: 384 });
12012
12092
  try {
12013
12093
  execFileSync2("launchctl", ["unload", path], { stdio: "ignore" });
12014
12094
  } catch {}
@@ -12170,7 +12250,7 @@ var sessionEvent = async (o2) => {
12170
12250
 
12171
12251
  // src/commands/specEvent.ts
12172
12252
  init_meter();
12173
- import { readFileSync as readFileSync13, statSync as statSync2 } from "node:fs";
12253
+ import { readFileSync as readFileSync12, statSync as statSync2 } from "node:fs";
12174
12254
  import { basename as basename4, isAbsolute as isAbsolute2, relative } from "node:path";
12175
12255
  var HOOK_STDIN_TIMEOUT_MS3 = 1000;
12176
12256
  var ESTIMATE_TIMEOUT_MS = 4000;
@@ -12226,7 +12306,7 @@ function readFileOrNull(path) {
12226
12306
  try {
12227
12307
  if (statSync2(path).size > 2000000)
12228
12308
  return null;
12229
- return readFileSync13(path, "utf8");
12309
+ return readFileSync12(path, "utf8");
12230
12310
  } catch {
12231
12311
  return null;
12232
12312
  }
@@ -12537,7 +12617,7 @@ var announce = (o2, events) => {
12537
12617
 
12538
12618
  // src/commands/stopEvent.ts
12539
12619
  init_meter();
12540
- import { existsSync as existsSync15, readFileSync as readFileSync14 } from "node:fs";
12620
+ import { existsSync as existsSync15, readFileSync as readFileSync13 } from "node:fs";
12541
12621
 
12542
12622
  // src/transcript.ts
12543
12623
  var isObject13 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
@@ -12633,7 +12713,7 @@ async function postTranscript(o2, payload, now) {
12633
12713
  const src = meterSource(o2.home);
12634
12714
  if (!src)
12635
12715
  return false;
12636
- const read2 = o2.readFile ?? ((p2) => existsSync15(p2) ? readFileSync14(p2, "utf8") : null);
12716
+ const read2 = o2.readFile ?? ((p2) => existsSync15(p2) ? readFileSync13(p2, "utf8") : null);
12637
12717
  let text;
12638
12718
  try {
12639
12719
  text = read2(path);
@@ -12715,7 +12795,7 @@ import { existsSync as existsSync17, rmSync as rmSync5 } from "node:fs";
12715
12795
 
12716
12796
  // src/codex.ts
12717
12797
  init_config();
12718
- import { existsSync as existsSync16, mkdirSync as mkdirSync16, readFileSync as readFileSync15, writeFileSync as writeFileSync16 } from "node:fs";
12798
+ import { existsSync as existsSync16, mkdirSync as mkdirSync16, readFileSync as readFileSync14, writeFileSync as writeFileSync17 } from "node:fs";
12719
12799
  import { dirname as dirname9, join as join19 } from "node:path";
12720
12800
  var PROVIDER_ID2 = "sleds";
12721
12801
  var codexDir2 = (home) => join19(home, ".codex");
@@ -12750,11 +12830,11 @@ function uninstallCodex(home) {
12750
12830
  const path = codexConfigPath2(home);
12751
12831
  if (!existsSync16(path))
12752
12832
  return null;
12753
- const prior = readFileSync15(path, "utf8");
12833
+ const prior = readFileSync14(path, "utf8");
12754
12834
  const next = removeCodexProvider2(prior);
12755
12835
  if (next === prior)
12756
12836
  return null;
12757
- writeFileSync16(path, next, { mode: 384 });
12837
+ writeFileSync17(path, next, { mode: 384 });
12758
12838
  return `removed the "${PROVIDER_ID2}" provider from ${path}`;
12759
12839
  }
12760
12840
 
@@ -12901,7 +12981,7 @@ var verify = async (o2) => {
12901
12981
 
12902
12982
  // src/config.ts
12903
12983
  init_settings();
12904
- import { chmodSync as chmodSync2, existsSync as existsSync18, mkdirSync as mkdirSync17, readFileSync as readFileSync16, renameSync as renameSync7, writeFileSync as writeFileSync17 } from "node:fs";
12984
+ import { chmodSync as chmodSync2, existsSync as existsSync18, mkdirSync as mkdirSync17, readFileSync as readFileSync15, renameSync as renameSync7, writeFileSync as writeFileSync18 } from "node:fs";
12905
12985
  import { join as join20, resolve as resolve8 } from "node:path";
12906
12986
  var configDir2 = (home, env = process.env) => {
12907
12987
  const o2 = env.SLEDS_HOME?.trim();
@@ -13012,7 +13092,7 @@ var readConfig2 = (home) => {
13012
13092
  const p2 = configPath2(home);
13013
13093
  if (!existsSync18(p2))
13014
13094
  return {};
13015
- return parseConfig2(JSON.parse(readFileSync16(p2, "utf8")));
13095
+ return parseConfig2(JSON.parse(readFileSync15(p2, "utf8")));
13016
13096
  };
13017
13097
 
13018
13098
  // src/runners/exec.ts
@@ -13388,7 +13468,7 @@ ${renderHelpText(argv[1])}`);
13388
13468
  case "version":
13389
13469
  case "--version":
13390
13470
  case "-v":
13391
- console.log("sleds 0.1.27");
13471
+ console.log("sleds 0.1.28");
13392
13472
  return 0;
13393
13473
  default:
13394
13474
  console.error(`unknown command: ${cmd}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleds/cli",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
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",