@sleds/cli 0.1.36 → 0.1.37

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 +67 -7
  2. package/package.json +1 -1
package/dist/sleds.mjs CHANGED
@@ -6121,10 +6121,15 @@ var init_pack = __esm(() => {
6121
6121
  init_sentry();
6122
6122
  init_setup();
6123
6123
  });
6124
+ // ../../packages/shared/src/pack/prHeader.ts
6125
+ var PR_HEADER_OPEN = "<!-- sleds:header -->", PR_HEADER_CLOSE = "<!-- /sleds:header -->";
6126
+ var init_prHeader = () => {};
6127
+
6124
6128
  // ../../packages/shared/src/pack/index.ts
6125
6129
  var init_pack2 = __esm(() => {
6126
6130
  init_setup();
6127
6131
  init_pack();
6132
+ init_prHeader();
6128
6133
  });
6129
6134
 
6130
6135
  // ../../packages/shared/src/newrelic/newrelic.ts
@@ -6523,6 +6528,9 @@ function nodePrompt(o) {
6523
6528
  "",
6524
6529
  `- Work on branch \`${o.branch}\` from the latest \`origin/${base}\` (create it if this checkout is not on it). One branch, one PR.`,
6525
6530
  `- Open the PR against \`${base}\` with \`gh pr create${visual ? " --draft" : ""}\`${o.prTitle ? ` and title it exactly \`${o.prTitle}\` (the repo's CI checks it)` : ""}. Its body carries \`SLEDS-Node: ${claim.node}\` on the line under \`SLEDS-Source:\` when the pack names a source.`,
6531
+ ...claim.pack.includes(PR_HEADER_OPEN) ? [
6532
+ `- The PR body starts with the pack's PR header block (\`${PR_HEADER_OPEN}\` … \`${PR_HEADER_CLOSE}\`, in its part 5), above everything else and as given; when you edit the body later, keep it on top.`
6533
+ ] : [],
6526
6534
  "- Run the repo's own gate before you push. Never merge: a person (or the musher, when the attachment says so) does.",
6527
6535
  "- Stay inside this node's scope. Work another node needs goes in the PR description, not in this branch.",
6528
6536
  `- End every comment and reply you post on the PR with the line \`${ENGINE_MARK}\`, so the engine knows it is yours and not a reviewer's.`,
@@ -6847,6 +6855,7 @@ function eventPrompt(o) {
6847
6855
  }
6848
6856
  var DEFAULT_SEAT = "\x00default", MAX_SEAT_AT_ONCE = 16, HOLD_DEFAULTS, DRAFT_NODE = "draft", BRANCH_FIELDS, PR_TITLE_FIELDS, ENGINE_MCP_SERVER = "sleds", RUN_TOKEN_ENV = "SLEDS_RUN_TOKEN", NO_RUN_TOKEN = "no run token from SLEDS: this session acts as the seat", SANDBOX_DOMAIN, SANDBOX_DEFAULT_ALLOW, toolName = (name, engineMcp) => engineMcp ? `mcp__${ENGINE_MCP_SERVER}__${name}` : name, ENGINE_MARK = "<!-- sleds:engine -->", VISUAL_PATH, APPROACH_SHAPE, AUTONOMY_SAYS, IRREVERSIBLE = "deleting or migrating data in place; deploying outside the playbook's window; anything that leaves the org (a message to a customer, a publish, a release, an email); spend past the band or the allowance; force-pushing or deleting a branch someone else holds; granting or removing access; changing the brief. When in doubt, it is irreversible.", oneLine = (s, max) => s.replace(/\s+/g, " ").trim().slice(0, max), VERDICT_SHAPE, DECIDER_RULES, codes = (xs) => xs.map((x) => `\`${x}\``).join(", "), RESOLVE_MAX_FILES = 8;
6849
6857
  var init_engine = __esm(() => {
6858
+ init_prHeader();
6850
6859
  init_route();
6851
6860
  HOLD_DEFAULTS = {
6852
6861
  holdCpu: 85,
@@ -10329,15 +10338,28 @@ import { join as join15, resolve as resolve7 } from "node:path";
10329
10338
  // src/engine/beat.ts
10330
10339
  var BEAT_EVERY_MS = 60000;
10331
10340
  var BEAT_ITEMS = 8;
10332
- function beatBody(state, flags, host = {}) {
10341
+ function beatBody(state, flags, host = {}, cap = {}) {
10333
10342
  const live = state.runs.filter((r) => !r.pr && !r.parked);
10343
+ const m = cap.machine;
10334
10344
  return {
10335
10345
  name: flags.name,
10336
10346
  os: host.os ?? process.platform,
10337
10347
  runner: flags.runner,
10338
- version: host.version ?? "0.1.36" ?? "dev",
10348
+ version: host.version ?? "0.1.37" ?? "dev",
10339
10349
  running: live.length,
10340
- items: live.slice(0, BEAT_ITEMS).map((r) => `${r.item}/${r.node}`)
10350
+ items: live.slice(0, BEAT_ITEMS).map((r) => `${r.item}/${r.node}`),
10351
+ ...cap.atOnce !== undefined ? { atOnce: cap.atOnce } : {},
10352
+ ...m ? {
10353
+ machine: {
10354
+ cpuPct: m.cpuPct,
10355
+ load1: m.load1,
10356
+ cores: m.cores,
10357
+ loadPerCore: m.loadPerCore,
10358
+ pressure: m.pressure
10359
+ },
10360
+ level: cap.hold?.level ?? "calm",
10361
+ ...cap.hold ? { allowed: cap.hold.allowed } : {}
10362
+ } : {}
10341
10363
  };
10342
10364
  }
10343
10365
  async function postBeat(client, body) {
@@ -18119,7 +18141,12 @@ var engineCmd = async (o) => {
18119
18141
  const who = { name: flags.name, runner: runner.name };
18120
18142
  afterTick = () => {
18121
18143
  try {
18122
- send(beatBody(deps.readState(), who));
18144
+ const m = deps.machine;
18145
+ send(beatBody(deps.readState(), who, {}, {
18146
+ atOnce: deps.atOnce,
18147
+ ...m?.last ? { machine: m.last } : {},
18148
+ ...m?.hold && !m.off ? { hold: m.hold } : {}
18149
+ }));
18123
18150
  } catch {}
18124
18151
  };
18125
18152
  }
@@ -18577,6 +18604,31 @@ function ago(at, now) {
18577
18604
  // src/commands/engineList.ts
18578
18605
  var ENGINE_LIST_USAGE = "usage: sleds engine list [--json]";
18579
18606
  var str11 = (x) => typeof x === "string" ? x : "";
18607
+ var numOrNull = (x) => typeof x === "number" && Number.isFinite(x) ? x : null;
18608
+ function machineOf(x) {
18609
+ if (!x || typeof x !== "object")
18610
+ return null;
18611
+ const m = x;
18612
+ const out = { pressure: str11(m.pressure) || "unknown" };
18613
+ for (const k of ["cpuPct", "load1", "cores", "loadPerCore"]) {
18614
+ const n = numOrNull(m[k]);
18615
+ if (n !== null)
18616
+ out[k] = n;
18617
+ }
18618
+ return out;
18619
+ }
18620
+ var LEVELS = ["calm", "strained", "busy"];
18621
+ function workOf(x) {
18622
+ if (!Array.isArray(x))
18623
+ return [];
18624
+ return x.flatMap((w) => {
18625
+ if (!w || typeof w !== "object")
18626
+ return [];
18627
+ const o = w;
18628
+ const item = str11(o.item);
18629
+ return item ? [{ item, node: str11(o.node), title: typeof o.title === "string" ? o.title : null }] : [];
18630
+ });
18631
+ }
18580
18632
  function engineRows(raw) {
18581
18633
  const rows = Array.isArray(raw.engines) ? raw.engines : [];
18582
18634
  return rows.flatMap((r) => {
@@ -18596,8 +18648,13 @@ function engineRows(raw) {
18596
18648
  running: typeof e.running === "number" ? e.running : 0,
18597
18649
  items: Array.isArray(e.items) ? e.items.filter((i) => typeof i === "string") : [],
18598
18650
  seatKind: typeof e.seatKind === "string" ? e.seatKind : null,
18651
+ atOnce: numOrNull(e.atOnce),
18652
+ machine: machineOf(e.machine),
18653
+ level: LEVELS.find((l) => l === e.level) ?? null,
18654
+ allowed: numOrNull(e.allowed),
18599
18655
  lastBeatAt: typeof e.lastBeatAt === "number" ? e.lastBeatAt : 0,
18600
- state: e.state === "up" ? "up" : "down"
18656
+ state: e.state === "up" ? "up" : "down",
18657
+ work: workOf(e.work)
18601
18658
  }
18602
18659
  ];
18603
18660
  });
@@ -18608,7 +18665,10 @@ function engineListLines(rows, now) {
18608
18665
  "no engines have beaten in this org — start one with `sleds engine` or `sleds engine install`"
18609
18666
  ];
18610
18667
  return rows.map((r) => {
18611
- const parts = [r.name.replace(/^engine:/, ""), r.os || "?", r.state, `${r.running} running`];
18668
+ const slots = r.atOnce ? `${r.running} of ${r.atOnce} running` : `${r.running} running`;
18669
+ const parts = [r.name.replace(/^engine:/, ""), r.os || "?", r.state, slots];
18670
+ if (r.state === "up" && r.level && r.level !== "calm")
18671
+ parts.push(r.level);
18612
18672
  if (r.state === "down" && r.lastBeatAt)
18613
18673
  parts.push(`last beat ${ago(r.lastBeatAt, now)}`);
18614
18674
  return clean(parts.join(" · "));
@@ -24155,7 +24215,7 @@ ${renderHelpText(argv[1])}`);
24155
24215
  case "version":
24156
24216
  case "--version":
24157
24217
  case "-v":
24158
- console.log("sleds 0.1.36");
24218
+ console.log("sleds 0.1.37");
24159
24219
  return 0;
24160
24220
  default:
24161
24221
  console.error(`unknown command: ${cmd}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleds/cli",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
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",