@kitman-sh/cli 0.32.0 → 0.34.0

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 (28) hide show
  1. package/dist/{chunk-nb6h112w.js → chunk-0m8ktgmz.js} +360 -187
  2. package/dist/{chunk-awx0zevr.js → chunk-2a40hhfz.js} +4 -4
  3. package/dist/{chunk-ah59jrtr.js → chunk-2gz59jcx.js} +1 -1
  4. package/dist/{chunk-z0gqrc8c.js → chunk-337drcr7.js} +35 -184
  5. package/dist/{chunk-r3mjxsmn.js → chunk-3jxdtkwd.js} +20 -20
  6. package/dist/{chunk-q8e58p57.js → chunk-6387vj9z.js} +2 -2
  7. package/dist/{chunk-4qrb09w4.js → chunk-6hxtg6eb.js} +3 -3
  8. package/dist/{chunk-rnm5ybw4.js → chunk-89ygm64f.js} +4 -4
  9. package/dist/{chunk-4tzzmrz2.js → chunk-8p5csa63.js} +64 -64
  10. package/dist/{chunk-5hp8ams4.js → chunk-9da9b7ys.js} +19 -19
  11. package/dist/{chunk-6e6t0f8y.js → chunk-a230abnk.js} +2 -2
  12. package/dist/{chunk-af8kftyw.js → chunk-d64j8v9n.js} +7 -7
  13. package/dist/{chunk-x4d4t28n.js → chunk-djzfaqaq.js} +352 -29
  14. package/dist/{chunk-61dmxexa.js → chunk-ew07nt2d.js} +60 -102
  15. package/dist/{chunk-c8eg05nh.js → chunk-fr0qseam.js} +4 -4
  16. package/dist/{chunk-56gs4z53.js → chunk-g5b61tek.js} +5 -5
  17. package/dist/{chunk-er0e8d8v.js → chunk-gy7nygep.js} +60 -14
  18. package/dist/{chunk-1hgsf81a.js → chunk-haq904fk.js} +1 -1
  19. package/dist/{chunk-qqb6djs7.js → chunk-hwjp28rh.js} +2 -2
  20. package/dist/{chunk-acmyagwp.js → chunk-phx3zffc.js} +8 -8
  21. package/dist/{chunk-rbpn35g5.js → chunk-qvpkwnky.js} +1 -1
  22. package/dist/{chunk-3cneth9k.js → chunk-r90j80q5.js} +9 -9
  23. package/dist/{chunk-abyssa8p.js → chunk-swc0ctf2.js} +3 -3
  24. package/dist/{chunk-a0bjjbhg.js → chunk-w8hf2etp.js} +81 -49
  25. package/dist/{chunk-1an3xh3b.js → chunk-wkbsbxp8.js} +6 -6
  26. package/dist/{chunk-znhjs0t6.js → chunk-y7bth30s.js} +1 -1
  27. package/dist/index.js +4 -4
  28. package/package.json +1 -1
@@ -12,7 +12,7 @@ import {
12
12
  empty3,
13
13
  add,
14
14
  getOrUndefined2,
15
- get4,
15
+ get3,
16
16
  merge3,
17
17
  Reference,
18
18
  fromInputUnsafe,
@@ -138,7 +138,7 @@ import {
138
138
  toJsonSchemaDocument,
139
139
  toCodecJson,
140
140
  Json
141
- } from "./chunk-61dmxexa.js";
141
+ } from "./chunk-ew07nt2d.js";
142
142
  import {
143
143
  WebCrypto,
144
144
  makeUnsafe,
@@ -175,24 +175,24 @@ import {
175
175
  StepManifest,
176
176
  KitSetup,
177
177
  RunnerRpcError
178
- } from "./chunk-nb6h112w.js";
178
+ } from "./chunk-0m8ktgmz.js";
179
179
  import {
180
180
  currentTimeMillis,
181
181
  getCurrent,
182
182
  runForEach,
183
183
  FileSystem
184
- } from "./chunk-z0gqrc8c.js";
184
+ } from "./chunk-337drcr7.js";
185
185
  import {
186
186
  splitQuestionOptions,
187
187
  recommendationProblem,
188
188
  questionAdvice
189
- } from "./chunk-1hgsf81a.js";
189
+ } from "./chunk-haq904fk.js";
190
190
  import {
191
191
  guard,
192
192
  Id,
193
193
  Timestamp,
194
194
  ActorType
195
- } from "./chunk-rbpn35g5.js";
195
+ } from "./chunk-qvpkwnky.js";
196
196
  var __defProp = Object.defineProperty;
197
197
  var __returnValue = (v) => v;
198
198
  function __exportSetter(name, newValue) {
@@ -769,7 +769,7 @@ class Suspended extends (/* @__PURE__ */ Class2("effect/workflow/Workflow/Suspen
769
769
  [ResultTypeId] = ResultTypeId;
770
770
  }
771
771
  var wrapActivityResult = (effect, isSuspend) => contextWith((context) => {
772
- const instance = get4(context, InstanceTag);
772
+ const instance = get3(context, InstanceTag);
773
773
  return acquireUseRelease(sync2(() => adoptActivityUnsafe(context, instance) ?? registerActivityUnsafe(instance)), () => effect, (registration, exit) => {
774
774
  releaseActivityUnsafe(registration);
775
775
  const isSuspended = isSuccess2(exit) && isSuspend(exit.value);
@@ -1420,7 +1420,7 @@ var scopingActivities = (engine) => ({
1420
1420
  }),
1421
1421
  activityExecute: (activity, attempt) => gen(function* () {
1422
1422
  const scope = yield* StepScope;
1423
- if (scope === "" || get4(activity.annotations, ActivityNamed))
1423
+ if (scope === "" || get3(activity.annotations, ActivityNamed))
1424
1424
  return yield* engine.activityExecute(activity, attempt);
1425
1425
  return yield* engine.activityExecute(renamed(activity, scopedName(scope, activity.name)), attempt);
1426
1426
  })
@@ -18,7 +18,7 @@ import {
18
18
  isMinLength,
19
19
  isMaxLength,
20
20
  FiniteFromString
21
- } from "./chunk-61dmxexa.js";
21
+ } from "./chunk-ew07nt2d.js";
22
22
 
23
23
  // packages/core/src/schema.ts
24
24
  var Days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
@@ -6,10 +6,7 @@ import {
6
6
  gen,
7
7
  flatMap3,
8
8
  provideContext2
9
- } from "./chunk-61dmxexa.js";
10
- import {
11
- runForEach
12
- } from "./chunk-z0gqrc8c.js";
9
+ } from "./chunk-ew07nt2d.js";
13
10
  import {
14
11
  WebSocketConstructor,
15
12
  layerWebSocketConstructorGlobal,
@@ -19,13 +16,16 @@ import {
19
16
  RunnerReplicaRpcs,
20
17
  RunnerRunFileRpcs,
21
18
  ProgramRpcs
22
- } from "./chunk-nb6h112w.js";
19
+ } from "./chunk-0m8ktgmz.js";
20
+ import {
21
+ runForEach
22
+ } from "./chunk-337drcr7.js";
23
23
  import {
24
24
  layerJson,
25
- make3,
25
+ make4,
26
26
  withHeaders,
27
27
  layerProtocolSocket
28
- } from "./chunk-r3mjxsmn.js";
28
+ } from "./chunk-3jxdtkwd.js";
29
29
 
30
30
  // packages/live/src/rpc/runner-client.ts
31
31
  var proxiedWebSocket = (proxy) => succeed5(WebSocketConstructor)((target) => {
@@ -46,7 +46,7 @@ var authorizer = (options) => (call) => flatMap3(options.bearer, (token) => with
46
46
  var RunnerProcessRpcs = RunnerReplicaRpcs.merge(RunnerRunFileRpcs);
47
47
  var makeRunnerRpcClient2 = (options) => gen(function* () {
48
48
  const protocol = yield* build(options.protocol);
49
- const client = yield* make3(RunnerProcessRpcs).pipe(provideContext2(protocol));
49
+ const client = yield* make4(RunnerProcessRpcs).pipe(provideContext2(protocol));
50
50
  const authorized = authorizer(options);
51
51
  return {
52
52
  claim: (input) => authorized(client.Claim(input)),
@@ -74,7 +74,7 @@ var makeRunnerRpcClient2 = (options) => gen(function* () {
74
74
  });
75
75
  var makeProgramRpcClient2 = (options) => gen(function* () {
76
76
  const protocol = yield* build(options.protocol);
77
- const client = yield* make3(ProgramRpcs).pipe(provideContext2(protocol));
77
+ const client = yield* make4(ProgramRpcs).pipe(provideContext2(protocol));
78
78
  const authorized = authorizer(options);
79
79
  return {
80
80
  recordActivity: (input) => authorized(client.RecordActivity(input)),
@@ -24,11 +24,11 @@ import {
24
24
  Record,
25
25
  Int,
26
26
  fromJsonString
27
- } from "./chunk-61dmxexa.js";
27
+ } from "./chunk-ew07nt2d.js";
28
28
  import {
29
29
  withDefault,
30
30
  String2
31
- } from "./chunk-z0gqrc8c.js";
31
+ } from "./chunk-337drcr7.js";
32
32
  import {
33
33
  newerKitmanVersion,
34
34
  digestSha256,
@@ -39,7 +39,7 @@ import {
39
39
  get2,
40
40
  layer4,
41
41
  KitDigest
42
- } from "./chunk-nb6h112w.js";
42
+ } from "./chunk-0m8ktgmz.js";
43
43
 
44
44
  // packages/core/src/npm-registry.ts
45
45
  var KitManifest = Struct({
@@ -15,6 +15,7 @@ import {
15
15
  make15,
16
16
  _await,
17
17
  fail5,
18
+ succeed4,
18
19
  succeed5,
19
20
  provide2,
20
21
  squash,
@@ -108,20 +109,7 @@ import {
108
109
  decodeJsonStringOption,
109
110
  encodeJsonStringSync,
110
111
  encodePrettyJsonString
111
- } from "./chunk-61dmxexa.js";
112
- import {
113
- currentTimeMillis,
114
- tap,
115
- mapError,
116
- decodeText,
117
- run,
118
- mkString,
119
- FileSystem,
120
- Path,
121
- withDefault,
122
- option,
123
- String2
124
- } from "./chunk-z0gqrc8c.js";
112
+ } from "./chunk-ew07nt2d.js";
125
113
  import {
126
114
  SecureRandom,
127
115
  layerWebCrypto,
@@ -185,7 +173,7 @@ import {
185
173
  digestSha256,
186
174
  sha256Hasher,
187
175
  raw,
188
- make4,
176
+ make5,
189
177
  get,
190
178
  put,
191
179
  HttpClient,
@@ -251,15 +239,28 @@ import {
251
239
  harnessNames,
252
240
  herdrRunnerCapabilities2,
253
241
  declaredChecks
254
- } from "./chunk-nb6h112w.js";
242
+ } from "./chunk-0m8ktgmz.js";
243
+ import {
244
+ currentTimeMillis,
245
+ tap,
246
+ mapError,
247
+ decodeText,
248
+ run,
249
+ mkString,
250
+ FileSystem,
251
+ Path,
252
+ withDefault,
253
+ option,
254
+ String2
255
+ } from "./chunk-337drcr7.js";
255
256
  import {
256
257
  ChildProcessSpawner,
257
- make2
258
- } from "./chunk-er0e8d8v.js";
258
+ make3
259
+ } from "./chunk-gy7nygep.js";
259
260
  import {
260
261
  Id,
261
262
  Timestamp
262
- } from "./chunk-rbpn35g5.js";
263
+ } from "./chunk-qvpkwnky.js";
263
264
 
264
265
  // apps/cli/src/cli-error.ts
265
266
  function cliErrorCode(error, status) {
@@ -306,7 +307,7 @@ function cliErrorJson(error) {
306
307
  var cliErrorLine = (error) => error instanceof Error ? error.message : String(error);
307
308
 
308
309
  // apps/cli/src/commands.ts
309
- import { homedir } from "os";
310
+ import { homedir, tmpdir } from "os";
310
311
 
311
312
  // packages/core/src/marketplace.ts
312
313
  import { parse } from "@babel/parser";
@@ -1326,10 +1327,10 @@ var sandboxMissing = (sandbox, missing) => ({
1326
1327
  var personalCheckBackend = (agentSandbox, dockerAvailable) => agentSandbox === "srt" || agentSandbox === "docker" && dockerAvailable ? agentSandbox : undefined;
1327
1328
  var herdrCoreSession = (runnerId, personal) => personal ? undefined : `kitman-${sha2562(runnerId).slice(0, 16)}`;
1328
1329
  var OpenHerdrCore = Reference("kitman/cli/OpenHerdrCore", {
1329
- defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-rnm5ybw4.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
1330
+ defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-89ygm64f.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
1330
1331
  });
1331
1332
  var UpdateHerdrCore = Reference("kitman/cli/UpdateHerdrCore", {
1332
- defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-rnm5ybw4.js")), (module) => module.updateHerdrCore(options))
1333
+ defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-89ygm64f.js")), (module) => module.updateHerdrCore(options))
1333
1334
  });
1334
1335
  var herdrCoreMissing = (error) => {
1335
1336
  if (isTagged(error, "HerdrCoreMissing"))
@@ -1630,15 +1631,28 @@ var runnerUpdater = (input) => {
1630
1631
  let claiming = true;
1631
1632
  let updating = false;
1632
1633
  let problems = [];
1634
+ let draining;
1633
1635
  const failed = new Set;
1634
1636
  let requiredFailedAt;
1635
- const drain = suspend3(() => {
1637
+ const drain = (version) => gen(function* () {
1636
1638
  claiming = false;
1637
- return gen(function* () {
1639
+ const since = yield* currentTimeMillis;
1640
+ const switchNow = yield* make15();
1641
+ if (version !== undefined)
1642
+ draining = {
1643
+ report: {
1644
+ version,
1645
+ since: toIso(since),
1646
+ until: toIso(since + toMillis(DrainLimit))
1647
+ },
1648
+ switchNow
1649
+ };
1650
+ const idle = gen(function* () {
1638
1651
  while ((yield* input.inFlight) > 0)
1639
1652
  yield* sleep("1 second");
1640
- }).pipe(timeoutOrElse({ duration: DrainLimit, orElse: () => void_3 }));
1641
- });
1653
+ });
1654
+ yield* raceFirst(idle.pipe(timeoutOrElse({ duration: DrainLimit, orElse: () => void_3 })), _await(switchNow));
1655
+ }).pipe(ensuring2(sync2(() => draining = undefined)));
1642
1656
  const channel = () => input.releaseChannel?.() ?? DefaultReleaseChannel;
1643
1657
  const onChannel = (version) => releaseChannelOffers(channel(), version);
1644
1658
  const attempt = gen(function* () {
@@ -1654,11 +1668,13 @@ var runnerUpdater = (input) => {
1654
1668
  const reported = (yield* runCommand2(downloaded.kitman, ["--version"], { timeout: "30 seconds" }).pipe(step("start"))).trim();
1655
1669
  if (reported !== downloaded.version)
1656
1670
  return yield* new UpdateStepFailed({ step: "start", reason: `it reported version ${reported || "none"}` });
1657
- yield* drain;
1671
+ yield* drain(downloaded.version);
1658
1672
  yield* linkManagedKitman(downloaded.kitman).pipe(step("switch"));
1659
1673
  return yield* new RunnerUpdated({ version: downloaded.version });
1660
1674
  });
1661
- const update = (version) => suspend3(() => {
1675
+ const update = (version, options) => suspend3(() => {
1676
+ if (options?.now === true && draining !== undefined)
1677
+ return succeed4(draining.switchNow, undefined);
1662
1678
  if (updating || failed.has(version))
1663
1679
  return void_3;
1664
1680
  updating = true;
@@ -1706,7 +1722,7 @@ var runnerUpdater = (input) => {
1706
1722
  updating = true;
1707
1723
  const served = input.version === undefined ? succeed(undefined) : yield* result(servedKitmanRelease(input.apiUrl));
1708
1724
  if (isSuccess(served) && servesNewer(served.success))
1709
- return yield* andThen2(drain, fail7(stop));
1725
+ return yield* andThen2(drain(served.success?.version), fail7(stop));
1710
1726
  requiredFailedAt = now;
1711
1727
  updating = false;
1712
1728
  const reason = isSuccess(served) ? `serves kitman ${served.success?.version}, not newer than this Runner's ${input.version} on its ${channel()} channel` : `its release could not be read: ${served.failure.message}`;
@@ -1723,6 +1739,7 @@ var runnerUpdater = (input) => {
1723
1739
  });
1724
1740
  return {
1725
1741
  claiming: () => claiming,
1742
+ updateDrain: () => draining?.report,
1726
1743
  problems: () => problems,
1727
1744
  update,
1728
1745
  cannotUpdate,
@@ -1773,7 +1790,7 @@ var syncTargets = (harness) => gen(function* () {
1773
1790
  });
1774
1791
  var syncKits = (input) => gen(function* () {
1775
1792
  const fs = yield* FileSystem;
1776
- const { syncKitSetup } = yield* promise(() => import("./chunk-af8kftyw.js"));
1793
+ const { syncKitSetup } = yield* promise(() => import("./chunk-d64j8v9n.js"));
1777
1794
  const harnesses = yield* syncTargets(input.harness);
1778
1795
  const chain = yield* input.client.getKitChain(input.workspaceId);
1779
1796
  for (const { name, problem } of chain.skipped)
@@ -2290,7 +2307,7 @@ var ServiceManager = Reference("kitman/cli/ServiceManager", {
2290
2307
  run: (command, args) => runCommand2(command, args),
2291
2308
  attach: (command, args) => gen(function* () {
2292
2309
  const spawner = yield* ChildProcessSpawner;
2293
- const handle = yield* spawner.spawn(make2(command, args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" }));
2310
+ const handle = yield* spawner.spawn(make3(command, args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" }));
2294
2311
  const exitCode = yield* handle.exitCode;
2295
2312
  if (exitCode !== 0)
2296
2313
  return yield* new CommandFailed2({ command, reason: `exit code ${exitCode}` });
@@ -3268,7 +3285,7 @@ var shipped_steps_generated_default = {
3268
3285
  };
3269
3286
 
3270
3287
  // apps/cli/src/scaffold-files.ts
3271
- var cliVersion = "0.32.0";
3288
+ var cliVersion = "0.34.0";
3272
3289
  var shippedLoopSteps = new Map(Object.entries(shipped_steps_generated_default));
3273
3290
  var loopSteps = (loop) => shippedLoopSteps.get(loop) ?? [];
3274
3291
  var replacedStep = (loop) => loopSteps(loop).find((step) => step.from === defaultKitName && step.exported?.startsWith("steps.") === true);
@@ -3533,7 +3550,7 @@ var scaffoldKit = (directory, scaffold = {}) => gen(function* () {
3533
3550
 
3534
3551
  // apps/cli/src/commands.ts
3535
3552
  var ClientId = "kitman-cli";
3536
- var agentRuntime = promise(() => import("./chunk-x4d4t28n.js"));
3553
+ var agentRuntime = promise(() => import("./chunk-djzfaqaq.js"));
3537
3554
  var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
3538
3555
  defaultValue: () => gen(function* () {
3539
3556
  const tui = yield* tryPromise({
@@ -5072,7 +5089,7 @@ var SandboxHostProbe = Reference("kitman/cli/SandboxHostProbe", {
5072
5089
  });
5073
5090
  var OpenRunnerRpc = Reference("kitman/cli/OpenRunnerRpc", {
5074
5091
  defaultValue: () => (options) => gen(function* () {
5075
- const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-1an3xh3b.js"));
5092
+ const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-wkbsbxp8.js"));
5076
5093
  return yield* makeRunnerRpcClient({
5077
5094
  runnerId: options.runnerId,
5078
5095
  bearer: options.bearer,
@@ -5155,6 +5172,7 @@ var updateRefusedRunner = (input) => gen(function* () {
5155
5172
  }
5156
5173
  yield* sleep(RequiredRetryAfter);
5157
5174
  });
5175
+ var updateDrainReport = (updateDrain) => updateDrain === undefined ? undefined : { updateDrain };
5158
5176
  function startCanonicalHerdrRunnerCommand(input) {
5159
5177
  const startOnce = gen(function* () {
5160
5178
  const {
@@ -5189,6 +5207,10 @@ function startCanonicalHerdrRunnerCommand(input) {
5189
5207
  programProcessExecutor,
5190
5208
  removeRunnerTerminals,
5191
5209
  makeStepProcesses,
5210
+ dockerStepContainers,
5211
+ dockerRootDirectory,
5212
+ diskSpaceProblem,
5213
+ diskSpaceMeter,
5192
5214
  StepProcesses,
5193
5215
  stepProcessesUncontained,
5194
5216
  systemProcessTable,
@@ -5249,7 +5271,10 @@ function startCanonicalHerdrRunnerCommand(input) {
5249
5271
  const core = yield* (yield* OpenHerdrCore)(session === undefined ? {} : { session });
5250
5272
  if (!personal)
5251
5273
  yield* addFinalizer2(() => core.stopServer.pipe(timeout("10 seconds"), ignore));
5252
- const stepProcesses = makeStepProcesses(yield* systemProcessTable, { scopes: yield* systemdScopes });
5274
+ const stepProcesses = makeStepProcesses(yield* systemProcessTable, {
5275
+ scopes: yield* systemdScopes,
5276
+ containers: yield* dockerStepContainers
5277
+ });
5253
5278
  const unready = yield* startupStep("connect to herdr-core", "30 seconds", core.connect.pipe(flatMap3((connection) => removeRunnerTerminals(connection, input.runnerId)), scoped, andThen2(stepProcesses.reapRunner(input.runnerId)), as(undefined), catchTags({
5254
5279
  HerdrCoreMissing: (error) => succeed6(herdrCoreMissing(error)),
5255
5280
  HerdrCoreIncompatible: (error) => succeed6(herdrCoreMissing(error))
@@ -5274,6 +5299,12 @@ function startCanonicalHerdrRunnerCommand(input) {
5274
5299
  authStore,
5275
5300
  toolchain: homeDirectories([...searchPath.split(":"), ...kitmanInstall], homedir())
5276
5301
  };
5302
+ const dockerRoot = yield* dockerRootDirectory;
5303
+ const measureDiskSpace = yield* diskSpaceMeter;
5304
+ const diskProblems = map9(measureDiskSpace([runnerState.workRoot, tmpdir(), ...dockerRoot === undefined ? [] : [dockerRoot]]), (disks) => {
5305
+ const problem = diskSpaceProblem(disks);
5306
+ return problem === undefined ? [] : [problem];
5307
+ });
5277
5308
  const detected = yield* detectHarnesses;
5278
5309
  const inSrt = sandbox === "srt" ? yield* startupStep("start each Harness in srt", "120 seconds", harnessesInSrt({ detection: detected, runner: runnerState })) : undefined;
5279
5310
  const live = { settings, sandbox, sandboxProblem: chosen.problem, inSrt };
@@ -5360,13 +5391,13 @@ function startCanonicalHerdrRunnerCommand(input) {
5360
5391
  return yield* gen(function* () {
5361
5392
  const agentBackend = yield* AgentBackend;
5362
5393
  const spawner = yield* ChildProcessSpawner;
5363
- yield* startupStep("heartbeat", "30 seconds", stopOnRefusal(controlPlane.client.heartbeatRunner(input.runnerId, {
5394
+ yield* startupStep("heartbeat", "30 seconds", stopOnRefusal(flatMap3(diskProblems, (disk) => controlPlane.client.heartbeatRunner(input.runnerId, {
5364
5395
  ...reported,
5365
- problems: problemsNow(),
5396
+ problems: [...problemsNow(), ...disk],
5366
5397
  capabilities: capabilitiesNow(),
5367
5398
  labels: runner.labels,
5368
5399
  ...appliedSettingsReport()
5369
- }).pipe(tap2(followReleaseChannel), andThen2(controlPlane.client.heartbeatRunnerReplica(input.runnerId, replica.id, {
5400
+ })).pipe(tap2(followReleaseChannel), andThen2(controlPlane.client.heartbeatRunnerReplica(input.runnerId, replica.id, {
5370
5401
  healthStatus: "healthy",
5371
5402
  drainState: "accepting",
5372
5403
  capacity: { maxConcurrentRuns: live.settings.concurrency },
@@ -5398,7 +5429,7 @@ function startCanonicalHerdrRunnerCommand(input) {
5398
5429
  signals,
5399
5430
  checkouts,
5400
5431
  reconnectAfter: "2 seconds",
5401
- update: (version) => container ? updater.cannotUpdate(version) : startUpdate(updater.update(version))
5432
+ update: (version, { now }) => container ? updater.cannotUpdate(version) : startUpdate(updater.update(version, { now }))
5402
5433
  }).pipe(forkScoped);
5403
5434
  const sharedSandbox = personal ? undefined : {
5404
5435
  runner: runnerState,
@@ -5564,12 +5595,13 @@ function startCanonicalHerdrRunnerCommand(input) {
5564
5595
  })), ensuring2(sync2(() => claimsInFlight -= 1)), tapError2(onProtocolRefusal));
5565
5596
  }),
5566
5597
  finished: () => sync2(() => activeSlots.delete(capacitySlot)),
5567
- heartbeatReplica: () => flatMap3(stepProcesses.problems, (unreaped) => controlPlane.client.heartbeatRunner(input.runnerId, {
5598
+ heartbeatReplica: () => flatMap3(all3([stepProcesses.problems, diskProblems]), ([unreaped, disk]) => controlPlane.client.heartbeatRunner(input.runnerId, {
5568
5599
  ...reported,
5569
- problems: [...problemsNow(), ...updater.problems(), ...unreaped],
5600
+ problems: [...problemsNow(), ...updater.problems(), ...unreaped, ...disk],
5570
5601
  capabilities: capabilitiesNow(),
5571
5602
  labels: runner.labels,
5572
- ...appliedSettingsReport()
5603
+ ...appliedSettingsReport(),
5604
+ ...updateDrainReport(updater.updateDrain())
5573
5605
  })).pipe(tap2(followReleaseChannel), flatMap3((heartbeat) => applySettings(heartbeat.settings)), flatMap3(() => controlPlane.client.heartbeatRunnerReplica(input.runnerId, replica.id, {
5574
5606
  healthStatus: "healthy",
5575
5607
  drainState: updater.claiming() ? "accepting" : "draining",
@@ -5648,7 +5680,7 @@ function mcpCommand(args) {
5648
5680
  if (command.action === "run") {
5649
5681
  if (command.args.length > 0)
5650
5682
  return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
5651
- const { runMcpServerCommand } = yield* promise(() => import("./chunk-4tzzmrz2.js"));
5683
+ const { runMcpServerCommand } = yield* promise(() => import("./chunk-8p5csa63.js"));
5652
5684
  return yield* runMcpServerCommand({ flags: command.flags });
5653
5685
  }
5654
5686
  if (command.action !== "setup")
@@ -6148,7 +6180,7 @@ function programLoopCommand(command) {
6148
6180
  return yield* new CliError({ message: `Unknown loop command: ${command.action}` });
6149
6181
  });
6150
6182
  }
6151
- var docsModule = promise(() => import("./chunk-ah59jrtr.js"));
6183
+ var docsModule = promise(() => import("./chunk-2gz59jcx.js"));
6152
6184
  function docsCommand(args) {
6153
6185
  return gen(function* () {
6154
6186
  const command = parseCommand(args);
@@ -6525,7 +6557,7 @@ var runShowLines = (shown) => [
6525
6557
  ...questionLines2(shown.questions.filter((question) => question.status === "open")),
6526
6558
  ...shown.artifacts.flatMap((artifact) => [`Artifact ${artifact.kind}: ${artifact.title}`, artifact.text]),
6527
6559
  ...shown.children.map((child) => `Child ${child.name}: ${child.runId} ${child.status}`),
6528
- ...shown.waiting.map((waiting) => waiting.kind === "queue" ? waiting.quotaUntil !== undefined ? `${waiting.name}: ${queueWords(waiting)}` : `${waiting.unrunnable === undefined ? "Waiting for a Runner slot for" : "Waiting for a Runner that can run"} ${waiting.name}: ${queueWords(waiting)}` : `Waiting on ${waiting.kind} ${waiting.name}`)
6560
+ ...shown.waiting.map((waiting) => waiting.kind === "queue" ? waiting.quotaUntil !== undefined ? `${waiting.name}: ${queueWords(waiting)}` : `${waiting.unrunnable !== undefined ? "Waiting for a Runner that can run" : waiting.updating !== undefined ? "Waiting for a Runner to update for" : "Waiting for a Runner slot for"} ${waiting.name}: ${queueWords(waiting)}` : `Waiting on ${waiting.kind} ${waiting.name}`)
6529
6561
  ];
6530
6562
  var myTeamsSections = [
6531
6563
  ["needsYou", "Needs you"],
@@ -7152,7 +7184,7 @@ function changeRequestCommand(args) {
7152
7184
  yield* log(command.action === "approve" ? `Approved ${short} of ${changeRequest.title}. A Run waiting on approval of ${short} resumes; one waiting on another head does not.` : `Requested changes to ${short} of ${changeRequest.title}`);
7153
7185
  });
7154
7186
  }
7155
- var readOutlines = (directory) => flatMap3(promise(() => import("./chunk-5hp8ams4.js")), (build) => build.readOutlines(directory)).pipe(mapError2((error) => new CliError({ message: error.message })));
7187
+ var readOutlines = (directory) => flatMap3(promise(() => import("./chunk-9da9b7ys.js")), (build) => build.readOutlines(directory)).pipe(mapError2((error) => new CliError({ message: error.message })));
7156
7188
  var loopOutline = (command) => gen(function* () {
7157
7189
  const path = yield* Path;
7158
7190
  const loop = requiredArg(command, "a Loop id");
@@ -7172,9 +7204,9 @@ var loopOutline = (command) => gen(function* () {
7172
7204
  `).pipe(mapError2((error) => new CliError({ message: error.message })));
7173
7205
  yield* log(`Wrote the outline of ${loop} to ${out}`);
7174
7206
  });
7175
- var KitWriter = map9(promise(() => import("./chunk-5hp8ams4.js")), (build) => build.writeKit);
7207
+ var KitWriter = map9(promise(() => import("./chunk-9da9b7ys.js")), (build) => build.writeKit);
7176
7208
  var KitBuilder = Reference("kitman/cli/KitBuilder", {
7177
- defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-5hp8ams4.js")), (build) => build.buildKit(directory))
7209
+ defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-9da9b7ys.js")), (build) => build.buildKit(directory))
7178
7210
  });
7179
7211
  var uploadKit = (client, workspaceId, built) => gen(function* () {
7180
7212
  yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
@@ -7953,7 +7985,7 @@ function downloadPresignedAsset(download, outputPath) {
7953
7985
  return gen(function* () {
7954
7986
  const fs = yield* FileSystem;
7955
7987
  const failed = (cause) => new CliError({ message: `Asset download failed: ${String(cause)}` });
7956
- const response = yield* send(make4(download.method)(download.url), failed);
7988
+ const response = yield* send(make5(download.method)(download.url), failed);
7957
7989
  if (response.status < 200 || response.status >= 300)
7958
7990
  return yield* new CliError({ message: `Asset download failed with ${response.status}` });
7959
7991
  const body = yield* response.arrayBuffer.pipe(mapError2((error) => failed(error.message)));
@@ -4,12 +4,12 @@ import {
4
4
  runnerRpcUrl2,
5
5
  makeRunnerRpcClient2,
6
6
  makeProgramRpcClient2
7
- } from "./chunk-3cneth9k.js";
8
- import"./chunk-r3mjxsmn.js";
9
- import"./chunk-nb6h112w.js";
10
- import"./chunk-rbpn35g5.js";
11
- import"./chunk-z0gqrc8c.js";
12
- import"./chunk-61dmxexa.js";
7
+ } from "./chunk-r90j80q5.js";
8
+ import"./chunk-3jxdtkwd.js";
9
+ import"./chunk-0m8ktgmz.js";
10
+ import"./chunk-qvpkwnky.js";
11
+ import"./chunk-337drcr7.js";
12
+ import"./chunk-ew07nt2d.js";
13
13
  export {
14
14
  makeProgramRpcClient2 as makeProgramRpcClient,
15
15
  makeRunnerRpcClient2 as makeRunnerRpcClient,
@@ -3,7 +3,7 @@ import {
3
3
  Random,
4
4
  succeed6,
5
5
  withFiber2
6
- } from "./chunk-61dmxexa.js";
6
+ } from "./chunk-ew07nt2d.js";
7
7
 
8
8
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Random.js
9
9
  var Random2 = Random;
package/dist/index.js CHANGED
@@ -5,15 +5,15 @@
5
5
  var args = process.argv.slice(2);
6
6
  if (args[0] === "srt") {
7
7
  process.argv.splice(2, 1);
8
- const { runSrtCli } = await import("./chunk-qqb6djs7.js");
8
+ const { runSrtCli } = await import("./chunk-hwjp28rh.js");
9
9
  await runSrtCli();
10
10
  } else if (args[0] === "srt-step") {
11
- const { runSrtStep } = await import("./chunk-4qrb09w4.js");
11
+ const { runSrtStep } = await import("./chunk-6hxtg6eb.js");
12
12
  await runSrtStep(args.slice(1));
13
13
  } else if (args[0] === "opencode-read") {
14
- const { runOpencodeReader } = await import("./chunk-c8eg05nh.js");
14
+ const { runOpencodeReader } = await import("./chunk-fr0qseam.js");
15
15
  runOpencodeReader();
16
16
  } else {
17
- const { runCli } = await import("./chunk-a0bjjbhg.js");
17
+ const { runCli } = await import("./chunk-w8hf2etp.js");
18
18
  runCli(args);
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitman-sh/cli",
3
- "version": "0.32.0",
3
+ "version": "0.34.0",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bin": {