@kitman-sh/cli 0.31.0 → 0.33.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 (29) hide show
  1. package/dist/{chunk-fjdp3rd6.js → chunk-1zb8h7gv.js} +45 -32
  2. package/dist/{chunk-r2kzvdrg.js → chunk-4qjfn1sa.js} +1 -1
  3. package/dist/{chunk-m1qp6swh.js → chunk-5kqt4bqp.js} +1 -1
  4. package/dist/{chunk-z59pvcbk.js → chunk-8fyfsajs.js} +179 -31
  5. package/dist/{chunk-vh2a72d1.js → chunk-9nbqzdqp.js} +60 -14
  6. package/dist/{chunk-emw9ragp.js → chunk-9tyv6211.js} +21 -21
  7. package/dist/{chunk-vwynec02.js → chunk-a9ncx2a8.js} +1 -1
  8. package/dist/{chunk-yjc2w86k.js → chunk-ak1qrm4q.js} +7 -7
  9. package/dist/{chunk-9vqkjkya.js → chunk-bnhb3cth.js} +2 -2
  10. package/dist/{chunk-2sazk478.js → chunk-gnq1ryhx.js} +8 -4
  11. package/dist/{chunk-y64ssczv.js → chunk-h2f26xbd.js} +40 -226
  12. package/dist/{chunk-s4r49vbj.js → chunk-hgxhpj6m.js} +4 -4
  13. package/dist/{chunk-qb11yda6.js → chunk-jrwpte6y.js} +41 -41
  14. package/dist/{chunk-qbrkeg49.js → chunk-mhx0tgm3.js} +7 -7
  15. package/dist/{chunk-5qrjf4xq.js → chunk-np5n54ky.js} +6 -6
  16. package/dist/{chunk-xxcxramy.js → chunk-nwbry6c8.js} +130 -124
  17. package/dist/{chunk-nndgeync.js → chunk-py3133q0.js} +6 -6
  18. package/dist/{chunk-nk0ew12p.js → chunk-racse7zf.js} +449 -37
  19. package/dist/chunk-s34am3kw.js +399 -0
  20. package/dist/{chunk-9a6wbk11.js → chunk-samxkpbz.js} +3 -3
  21. package/dist/{chunk-njgay1ed.js → chunk-sgkgwzvb.js} +6 -6
  22. package/dist/{chunk-pd3azxev.js → chunk-tsx0347c.js} +1 -1
  23. package/dist/{chunk-zy21drtv.js → chunk-vz38kngm.js} +2 -2
  24. package/dist/{chunk-qjxgew0k.js → chunk-x29m7k25.js} +2 -2
  25. package/dist/{chunk-9yvknsnj.js → chunk-xkkyx7bn.js} +3 -3
  26. package/dist/{chunk-38drrdzp.js → chunk-yveqd8ye.js} +4 -4
  27. package/dist/index.js +4 -4
  28. package/package.json +1 -1
  29. package/dist/chunk-kx8rpa62.js +0 -230
@@ -12,7 +12,7 @@ import {
12
12
  succeed,
13
13
  isSuccess,
14
14
  TaggedError,
15
- make15,
15
+ make16,
16
16
  _await,
17
17
  fail5,
18
18
  succeed5,
@@ -108,8 +108,9 @@ import {
108
108
  decodeJsonStringOption,
109
109
  encodeJsonStringSync,
110
110
  encodePrettyJsonString
111
- } from "./chunk-y64ssczv.js";
111
+ } from "./chunk-h2f26xbd.js";
112
112
  import {
113
+ currentTimeMillis,
113
114
  tap,
114
115
  mapError,
115
116
  decodeText,
@@ -120,13 +121,8 @@ import {
120
121
  withDefault,
121
122
  option,
122
123
  String2
123
- } from "./chunk-z59pvcbk.js";
124
- import {
125
- ChildProcessSpawner,
126
- make2
127
- } from "./chunk-vh2a72d1.js";
124
+ } from "./chunk-8fyfsajs.js";
128
125
  import {
129
- currentTimeMillis,
130
126
  SecureRandom,
131
127
  layerWebCrypto,
132
128
  runMain,
@@ -189,7 +185,7 @@ import {
189
185
  digestSha256,
190
186
  sha256Hasher,
191
187
  raw,
192
- make4,
188
+ make5,
193
189
  get,
194
190
  put,
195
191
  HttpClient,
@@ -255,11 +251,15 @@ import {
255
251
  harnessNames,
256
252
  herdrRunnerCapabilities2,
257
253
  declaredChecks
258
- } from "./chunk-xxcxramy.js";
254
+ } from "./chunk-nwbry6c8.js";
255
+ import {
256
+ ChildProcessSpawner,
257
+ make3
258
+ } from "./chunk-9nbqzdqp.js";
259
259
  import {
260
260
  Id,
261
261
  Timestamp
262
- } from "./chunk-r2kzvdrg.js";
262
+ } from "./chunk-4qjfn1sa.js";
263
263
 
264
264
  // apps/cli/src/cli-error.ts
265
265
  function cliErrorCode(error, status) {
@@ -306,7 +306,7 @@ function cliErrorJson(error) {
306
306
  var cliErrorLine = (error) => error instanceof Error ? error.message : String(error);
307
307
 
308
308
  // apps/cli/src/commands.ts
309
- import { homedir } from "os";
309
+ import { homedir, tmpdir } from "os";
310
310
 
311
311
  // packages/core/src/marketplace.ts
312
312
  import { parse } from "@babel/parser";
@@ -1326,10 +1326,10 @@ var sandboxMissing = (sandbox, missing) => ({
1326
1326
  var personalCheckBackend = (agentSandbox, dockerAvailable) => agentSandbox === "srt" || agentSandbox === "docker" && dockerAvailable ? agentSandbox : undefined;
1327
1327
  var herdrCoreSession = (runnerId, personal) => personal ? undefined : `kitman-${sha2562(runnerId).slice(0, 16)}`;
1328
1328
  var OpenHerdrCore = Reference("kitman/cli/OpenHerdrCore", {
1329
- defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-38drrdzp.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
1329
+ defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-yveqd8ye.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
1330
1330
  });
1331
1331
  var UpdateHerdrCore = Reference("kitman/cli/UpdateHerdrCore", {
1332
- defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-38drrdzp.js")), (module) => module.updateHerdrCore(options))
1332
+ defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-yveqd8ye.js")), (module) => module.updateHerdrCore(options))
1333
1333
  });
1334
1334
  var herdrCoreMissing = (error) => {
1335
1335
  if (isTagged(error, "HerdrCoreMissing"))
@@ -1773,7 +1773,7 @@ var syncTargets = (harness) => gen(function* () {
1773
1773
  });
1774
1774
  var syncKits = (input) => gen(function* () {
1775
1775
  const fs = yield* FileSystem;
1776
- const { syncKitSetup } = yield* promise(() => import("./chunk-yjc2w86k.js"));
1776
+ const { syncKitSetup } = yield* promise(() => import("./chunk-ak1qrm4q.js"));
1777
1777
  const harnesses = yield* syncTargets(input.harness);
1778
1778
  const chain = yield* input.client.getKitChain(input.workspaceId);
1779
1779
  for (const { name, problem } of chain.skipped)
@@ -2290,7 +2290,7 @@ var ServiceManager = Reference("kitman/cli/ServiceManager", {
2290
2290
  run: (command, args) => runCommand2(command, args),
2291
2291
  attach: (command, args) => gen(function* () {
2292
2292
  const spawner = yield* ChildProcessSpawner;
2293
- const handle = yield* spawner.spawn(make2(command, args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" }));
2293
+ const handle = yield* spawner.spawn(make3(command, args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" }));
2294
2294
  const exitCode = yield* handle.exitCode;
2295
2295
  if (exitCode !== 0)
2296
2296
  return yield* new CommandFailed2({ command, reason: `exit code ${exitCode}` });
@@ -3268,7 +3268,7 @@ var shipped_steps_generated_default = {
3268
3268
  };
3269
3269
 
3270
3270
  // apps/cli/src/scaffold-files.ts
3271
- var cliVersion = "0.31.0";
3271
+ var cliVersion = "0.33.0";
3272
3272
  var shippedLoopSteps = new Map(Object.entries(shipped_steps_generated_default));
3273
3273
  var loopSteps = (loop) => shippedLoopSteps.get(loop) ?? [];
3274
3274
  var replacedStep = (loop) => loopSteps(loop).find((step) => step.from === defaultKitName && step.exported?.startsWith("steps.") === true);
@@ -3533,7 +3533,7 @@ var scaffoldKit = (directory, scaffold = {}) => gen(function* () {
3533
3533
 
3534
3534
  // apps/cli/src/commands.ts
3535
3535
  var ClientId = "kitman-cli";
3536
- var agentRuntime = promise(() => import("./chunk-nk0ew12p.js"));
3536
+ var agentRuntime = promise(() => import("./chunk-racse7zf.js"));
3537
3537
  var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
3538
3538
  defaultValue: () => gen(function* () {
3539
3539
  const tui = yield* tryPromise({
@@ -5072,7 +5072,7 @@ var SandboxHostProbe = Reference("kitman/cli/SandboxHostProbe", {
5072
5072
  });
5073
5073
  var OpenRunnerRpc = Reference("kitman/cli/OpenRunnerRpc", {
5074
5074
  defaultValue: () => (options) => gen(function* () {
5075
- const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-nndgeync.js"));
5075
+ const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-py3133q0.js"));
5076
5076
  return yield* makeRunnerRpcClient({
5077
5077
  runnerId: options.runnerId,
5078
5078
  bearer: options.bearer,
@@ -5189,6 +5189,10 @@ function startCanonicalHerdrRunnerCommand(input) {
5189
5189
  programProcessExecutor,
5190
5190
  removeRunnerTerminals,
5191
5191
  makeStepProcesses,
5192
+ dockerStepContainers,
5193
+ dockerRootDirectory,
5194
+ diskSpaceProblem,
5195
+ diskSpaceMeter,
5192
5196
  StepProcesses,
5193
5197
  stepProcessesUncontained,
5194
5198
  systemProcessTable,
@@ -5249,7 +5253,10 @@ function startCanonicalHerdrRunnerCommand(input) {
5249
5253
  const core = yield* (yield* OpenHerdrCore)(session === undefined ? {} : { session });
5250
5254
  if (!personal)
5251
5255
  yield* addFinalizer2(() => core.stopServer.pipe(timeout("10 seconds"), ignore));
5252
- const stepProcesses = makeStepProcesses(yield* systemProcessTable, { scopes: yield* systemdScopes });
5256
+ const stepProcesses = makeStepProcesses(yield* systemProcessTable, {
5257
+ scopes: yield* systemdScopes,
5258
+ containers: yield* dockerStepContainers
5259
+ });
5253
5260
  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
5261
  HerdrCoreMissing: (error) => succeed6(herdrCoreMissing(error)),
5255
5262
  HerdrCoreIncompatible: (error) => succeed6(herdrCoreMissing(error))
@@ -5274,6 +5281,12 @@ function startCanonicalHerdrRunnerCommand(input) {
5274
5281
  authStore,
5275
5282
  toolchain: homeDirectories([...searchPath.split(":"), ...kitmanInstall], homedir())
5276
5283
  };
5284
+ const dockerRoot = yield* dockerRootDirectory;
5285
+ const measureDiskSpace = yield* diskSpaceMeter;
5286
+ const diskProblems = map9(measureDiskSpace([runnerState.workRoot, tmpdir(), ...dockerRoot === undefined ? [] : [dockerRoot]]), (disks) => {
5287
+ const problem = diskSpaceProblem(disks);
5288
+ return problem === undefined ? [] : [problem];
5289
+ });
5277
5290
  const detected = yield* detectHarnesses;
5278
5291
  const inSrt = sandbox === "srt" ? yield* startupStep("start each Harness in srt", "120 seconds", harnessesInSrt({ detection: detected, runner: runnerState })) : undefined;
5279
5292
  const live = { settings, sandbox, sandboxProblem: chosen.problem, inSrt };
@@ -5360,13 +5373,13 @@ function startCanonicalHerdrRunnerCommand(input) {
5360
5373
  return yield* gen(function* () {
5361
5374
  const agentBackend = yield* AgentBackend;
5362
5375
  const spawner = yield* ChildProcessSpawner;
5363
- yield* startupStep("heartbeat", "30 seconds", stopOnRefusal(controlPlane.client.heartbeatRunner(input.runnerId, {
5376
+ yield* startupStep("heartbeat", "30 seconds", stopOnRefusal(flatMap3(diskProblems, (disk) => controlPlane.client.heartbeatRunner(input.runnerId, {
5364
5377
  ...reported,
5365
- problems: problemsNow(),
5378
+ problems: [...problemsNow(), ...disk],
5366
5379
  capabilities: capabilitiesNow(),
5367
5380
  labels: runner.labels,
5368
5381
  ...appliedSettingsReport()
5369
- }).pipe(tap2(followReleaseChannel), andThen2(controlPlane.client.heartbeatRunnerReplica(input.runnerId, replica.id, {
5382
+ })).pipe(tap2(followReleaseChannel), andThen2(controlPlane.client.heartbeatRunnerReplica(input.runnerId, replica.id, {
5370
5383
  healthStatus: "healthy",
5371
5384
  drainState: "accepting",
5372
5385
  capacity: { maxConcurrentRuns: live.settings.concurrency },
@@ -5387,7 +5400,7 @@ function startCanonicalHerdrRunnerCommand(input) {
5387
5400
  yield* controlPlane.client.listRepoBindings(runner.workspaceId).pipe(flatMap3(({ items }) => forEach(items.filter((binding) => binding.status === "active" && (teamId === undefined || binding.teamId === teamId)), (repoBinding) => map9(checkouts.reaches(repoBinding), (reachable) => ({ repoBinding, reachable })), { concurrency: 4 })), tap2((probed) => sync2(() => reached = probed)), catch_((error) => logWarning("runner_repository_probe_failed", error.message)), flatMap3(() => sleep(reached.some((probe) => !probe.reachable) ? repositoryRetryInterval : repositoryProbeInterval)), forever, forkScoped);
5388
5401
  yield* suspend3(() => sleep(ownerLogin.expired() ? ownerLoginRetryInterval : ownerLoginInterval)).pipe(andThen2(checkOwnerLogin), forever, forkScoped);
5389
5402
  const platform = yield* context();
5390
- const updated = yield* make15();
5403
+ const updated = yield* make16();
5391
5404
  const scope = yield* scope2;
5392
5405
  const startUpdate = (update) => update.pipe(catch_((error) => andThen2(restartOntoUpdate(input.runnerId), fail5(updated, error))), provideContext2(platform), forkIn(scope), asVoid);
5393
5406
  const refusedForProtocol = container ? updater.stopWhenDrained(new RunnerStopped({ problem: updateRequired })).pipe(catch_((stopped) => fail5(updated, stopped)), forkIn(scope), asVoid) : startUpdate(updater.updateRequired);
@@ -5564,9 +5577,9 @@ function startCanonicalHerdrRunnerCommand(input) {
5564
5577
  })), ensuring2(sync2(() => claimsInFlight -= 1)), tapError2(onProtocolRefusal));
5565
5578
  }),
5566
5579
  finished: () => sync2(() => activeSlots.delete(capacitySlot)),
5567
- heartbeatReplica: () => flatMap3(stepProcesses.problems, (unreaped) => controlPlane.client.heartbeatRunner(input.runnerId, {
5580
+ heartbeatReplica: () => flatMap3(all3([stepProcesses.problems, diskProblems]), ([unreaped, disk]) => controlPlane.client.heartbeatRunner(input.runnerId, {
5568
5581
  ...reported,
5569
- problems: [...problemsNow(), ...updater.problems(), ...unreaped],
5582
+ problems: [...problemsNow(), ...updater.problems(), ...unreaped, ...disk],
5570
5583
  capabilities: capabilitiesNow(),
5571
5584
  labels: runner.labels,
5572
5585
  ...appliedSettingsReport()
@@ -5648,7 +5661,7 @@ function mcpCommand(args) {
5648
5661
  if (command.action === "run") {
5649
5662
  if (command.args.length > 0)
5650
5663
  return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
5651
- const { runMcpServerCommand } = yield* promise(() => import("./chunk-qb11yda6.js"));
5664
+ const { runMcpServerCommand } = yield* promise(() => import("./chunk-jrwpte6y.js"));
5652
5665
  return yield* runMcpServerCommand({ flags: command.flags });
5653
5666
  }
5654
5667
  if (command.action !== "setup")
@@ -6148,7 +6161,7 @@ function programLoopCommand(command) {
6148
6161
  return yield* new CliError({ message: `Unknown loop command: ${command.action}` });
6149
6162
  });
6150
6163
  }
6151
- var docsModule = promise(() => import("./chunk-vwynec02.js"));
6164
+ var docsModule = promise(() => import("./chunk-a9ncx2a8.js"));
6152
6165
  function docsCommand(args) {
6153
6166
  return gen(function* () {
6154
6167
  const command = parseCommand(args);
@@ -7152,7 +7165,7 @@ function changeRequestCommand(args) {
7152
7165
  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
7166
  });
7154
7167
  }
7155
- var readOutlines = (directory) => flatMap3(promise(() => import("./chunk-emw9ragp.js")), (build) => build.readOutlines(directory)).pipe(mapError2((error) => new CliError({ message: error.message })));
7168
+ var readOutlines = (directory) => flatMap3(promise(() => import("./chunk-9tyv6211.js")), (build) => build.readOutlines(directory)).pipe(mapError2((error) => new CliError({ message: error.message })));
7156
7169
  var loopOutline = (command) => gen(function* () {
7157
7170
  const path = yield* Path;
7158
7171
  const loop = requiredArg(command, "a Loop id");
@@ -7172,9 +7185,9 @@ var loopOutline = (command) => gen(function* () {
7172
7185
  `).pipe(mapError2((error) => new CliError({ message: error.message })));
7173
7186
  yield* log(`Wrote the outline of ${loop} to ${out}`);
7174
7187
  });
7175
- var KitWriter = map9(promise(() => import("./chunk-emw9ragp.js")), (build) => build.writeKit);
7188
+ var KitWriter = map9(promise(() => import("./chunk-9tyv6211.js")), (build) => build.writeKit);
7176
7189
  var KitBuilder = Reference("kitman/cli/KitBuilder", {
7177
- defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-emw9ragp.js")), (build) => build.buildKit(directory))
7190
+ defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-9tyv6211.js")), (build) => build.buildKit(directory))
7178
7191
  });
7179
7192
  var uploadKit = (client, workspaceId, built) => gen(function* () {
7180
7193
  yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
@@ -7953,7 +7966,7 @@ function downloadPresignedAsset(download, outputPath) {
7953
7966
  return gen(function* () {
7954
7967
  const fs = yield* FileSystem;
7955
7968
  const failed = (cause) => new CliError({ message: `Asset download failed: ${String(cause)}` });
7956
- const response = yield* send(make4(download.method)(download.url), failed);
7969
+ const response = yield* send(make5(download.method)(download.url), failed);
7957
7970
  if (response.status < 200 || response.status >= 300)
7958
7971
  return yield* new CliError({ message: `Asset download failed with ${response.status}` });
7959
7972
  const body = yield* response.arrayBuffer.pipe(mapError2((error) => failed(error.message)));
@@ -18,7 +18,7 @@ import {
18
18
  isMinLength,
19
19
  isMaxLength,
20
20
  FiniteFromString
21
- } from "./chunk-y64ssczv.js";
21
+ } from "./chunk-h2f26xbd.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];
@@ -3,7 +3,7 @@ import {
3
3
  Random,
4
4
  succeed6,
5
5
  withFiber2
6
- } from "./chunk-y64ssczv.js";
6
+ } from "./chunk-h2f26xbd.js";
7
7
 
8
8
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Random.js
9
9
  var Random2 = Random;