@kitman-sh/cli 0.33.0 → 0.35.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-tsx0347c.js → chunk-1hgsf81a.js} +1 -1
  2. package/dist/{chunk-samxkpbz.js → chunk-4qrb09w4.js} +3 -3
  3. package/dist/{chunk-s34am3kw.js → chunk-56gs4z53.js} +7 -7
  4. package/dist/{chunk-bnhb3cth.js → chunk-5e1ndtnp.js} +3 -3
  5. package/dist/{chunk-h2f26xbd.js → chunk-61dmxexa.js} +70 -28
  6. package/dist/{chunk-mhx0tgm3.js → chunk-64arqv10.js} +7 -7
  7. package/dist/{chunk-gnq1ryhx.js → chunk-c8eg05nh.js} +4 -4
  8. package/dist/{chunk-xkkyx7bn.js → chunk-ee7ss0df.js} +3 -3
  9. package/dist/{chunk-9nbqzdqp.js → chunk-er0e8d8v.js} +14 -60
  10. package/dist/{chunk-racse7zf.js → chunk-ke4rajdh.js} +44 -28
  11. package/dist/{chunk-sgkgwzvb.js → chunk-n01c55f9.js} +5 -5
  12. package/dist/{chunk-hgxhpj6m.js → chunk-n0bp958m.js} +4 -4
  13. package/dist/{chunk-1zb8h7gv.js → chunk-nna9pwp0.js} +53 -32
  14. package/dist/{chunk-vz38kngm.js → chunk-q8e58p57.js} +2 -2
  15. package/dist/{chunk-x29m7k25.js → chunk-qqb6djs7.js} +2 -2
  16. package/dist/{chunk-py3133q0.js → chunk-r9x4ehsy.js} +6 -6
  17. package/dist/{chunk-4qjfn1sa.js → chunk-rbpn35g5.js} +1 -1
  18. package/dist/{chunk-np5n54ky.js → chunk-t205gnzc.js} +5 -5
  19. package/dist/{chunk-9tyv6211.js → chunk-t9dmwy8x.js} +19 -19
  20. package/dist/{chunk-a9ncx2a8.js → chunk-tsefrrxz.js} +1 -1
  21. package/dist/{chunk-yveqd8ye.js → chunk-wkkjyzpx.js} +4 -4
  22. package/dist/{chunk-jrwpte6y.js → chunk-xc7kg57m.js} +64 -64
  23. package/dist/{chunk-ak1qrm4q.js → chunk-y3c9pxez.js} +7 -7
  24. package/dist/{chunk-nwbry6c8.js → chunk-yhat3rhw.js} +139 -121
  25. package/dist/{chunk-8fyfsajs.js → chunk-z0gqrc8c.js} +17 -17
  26. package/dist/{chunk-5kqt4bqp.js → chunk-znhjs0t6.js} +1 -1
  27. package/dist/index.js +4 -4
  28. package/package.json +1 -1
@@ -44,7 +44,7 @@ import {
44
44
  isFailure2,
45
45
  hasInterrupts,
46
46
  makeUnsafe5,
47
- make16,
47
+ make15,
48
48
  _await,
49
49
  fail5,
50
50
  isDoneUnsafe,
@@ -174,7 +174,7 @@ import {
174
174
  decodeJsonStringSync,
175
175
  encodeUnknownJsonStringSync,
176
176
  storable
177
- } from "./chunk-h2f26xbd.js";
177
+ } from "./chunk-61dmxexa.js";
178
178
  import {
179
179
  SecureRandom,
180
180
  layerWebCrypto,
@@ -262,7 +262,7 @@ import {
262
262
  checkServicesFile,
263
263
  checkServices,
264
264
  serviceChecks
265
- } from "./chunk-nwbry6c8.js";
265
+ } from "./chunk-yhat3rhw.js";
266
266
  import {
267
267
  currentTimeMillis,
268
268
  join,
@@ -272,7 +272,7 @@ import {
272
272
  unbounded2,
273
273
  offer,
274
274
  makeUnsafe3,
275
- make11,
275
+ make10,
276
276
  fromQueue,
277
277
  fromPubSub,
278
278
  map2,
@@ -311,7 +311,7 @@ import {
311
311
  writeSrtSettings2,
312
312
  srtStepArgv2,
313
313
  srtArgv2
314
- } from "./chunk-8fyfsajs.js";
314
+ } from "./chunk-z0gqrc8c.js";
315
315
  import {
316
316
  writeAgentEnvironmentConfigFile2,
317
317
  readManifestSkillPaths2,
@@ -327,8 +327,8 @@ import {
327
327
  applyAgentEnvironmentMaterialization2,
328
328
  isPathWithin2,
329
329
  skillIdentity2
330
- } from "./chunk-hgxhpj6m.js";
331
- import"./chunk-xkkyx7bn.js";
330
+ } from "./chunk-n0bp958m.js";
331
+ import"./chunk-ee7ss0df.js";
332
332
  import {
333
333
  egressAllowed,
334
334
  writeSecretRegistry,
@@ -338,7 +338,7 @@ import {
338
338
  secretFilter2,
339
339
  opaqueTunnelRefusal2,
340
340
  isOpaqueConnectReason2
341
- } from "./chunk-vz38kngm.js";
341
+ } from "./chunk-q8e58p57.js";
342
342
  import {
343
343
  sliceBytes2,
344
344
  maxLineBytes2,
@@ -348,29 +348,29 @@ import {
348
348
  lookAtOpencode2,
349
349
  readOpencode2,
350
350
  databaseStamp2
351
- } from "./chunk-s34am3kw.js";
351
+ } from "./chunk-56gs4z53.js";
352
352
  import {
353
353
  uploadRunFile,
354
354
  programLease,
355
355
  rpcRunFiles,
356
356
  programHostsEnv,
357
357
  undeclaredHostsEnv
358
- } from "./chunk-sgkgwzvb.js";
359
- import"./chunk-mhx0tgm3.js";
358
+ } from "./chunk-n01c55f9.js";
359
+ import"./chunk-64arqv10.js";
360
360
  import {
361
361
  nextInt
362
- } from "./chunk-5kqt4bqp.js";
363
- import"./chunk-tsx0347c.js";
362
+ } from "./chunk-znhjs0t6.js";
363
+ import"./chunk-1hgsf81a.js";
364
364
  import {
365
365
  ChildProcessSpawner,
366
- make3
367
- } from "./chunk-9nbqzdqp.js";
368
- import"./chunk-np5n54ky.js";
366
+ make2
367
+ } from "./chunk-er0e8d8v.js";
368
+ import"./chunk-t205gnzc.js";
369
369
  import {
370
370
  Id,
371
371
  secretReference,
372
372
  secretPlaceholder
373
- } from "./chunk-4qjfn1sa.js";
373
+ } from "./chunk-rbpn35g5.js";
374
374
 
375
375
  // packages/core/src/sync-kit.ts
376
376
  import { createHash } from "crypto";
@@ -1786,7 +1786,8 @@ var HarnessAdapters = [
1786
1786
  CLAUDE_CODE_DISABLE_ADVISOR_TOOL: "1",
1787
1787
  CLAUDE_CODE_DISABLE_FEATURE_FLAGS: "1",
1788
1788
  ENABLE_TOOL_SEARCH: "false",
1789
- CLAUDE_CODE_EXPERIMENTAL_CODE_MODE: "1"
1789
+ CLAUDE_CODE_EXPERIMENTAL_CODE_MODE: "1",
1790
+ CLAUDE_CODE_SANDBOXED: "1"
1790
1791
  },
1791
1792
  mcpToolTimeout: { kind: "env", variables: ["MCP_TOOL_TIMEOUT", "CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT"], unit: "ms" },
1792
1793
  tempDirectoryVariable: "CLAUDE_CODE_TMPDIR",
@@ -4661,8 +4662,18 @@ var aborted = (signal) => signal === undefined ? never : callback3((resume) => {
4661
4662
  });
4662
4663
  var canceled = { status: "canceled", reason: "canceled" };
4663
4664
  var loginRefusedError = /(OAuth token revoked|OAuth access token is invalid|Login expired)\W{0,12}Please run \/login/;
4664
- var loginRefused = (screen) => loginRefusedError.test(screen.split(`
4665
- `).slice(-12).join(" "));
4665
+ var screenTail = (screen) => screen.split(`
4666
+ `).slice(-12);
4667
+ var loginRefused = (screen) => loginRefusedError.test(screenTail(screen).join(" "));
4668
+ var setupPrompts = [
4669
+ { confirm: /^Yes, I trust this folder$/, cancel: /^No, (exit|continue without these permissions)$/ },
4670
+ { confirm: /^Yes, turn on Code Mode$/, cancel: /^No, start without it$/ }
4671
+ ];
4672
+ var menuOption = (line) => line.replace(/^[\s\u276F\u203A>]*(\d+\.\s*)?/, "").trim();
4673
+ var atSetupPrompt = (screen) => {
4674
+ const options = screenTail(screen).map(menuOption);
4675
+ return setupPrompts.some(({ confirm, cancel }) => options.some((option) => confirm.test(option)) && options.some((option) => cancel.test(option)));
4676
+ };
4666
4677
  var watchSecretRegistry = (registry, request, revocationMs) => gen(function* () {
4667
4678
  const fs = yield* FileSystem;
4668
4679
  const log = secretRefusalLog(registry.file);
@@ -4906,6 +4917,7 @@ var runAttempt = (request, options) => gen(function* () {
4906
4917
  let accepted = false;
4907
4918
  const outputSubmitted = suspend3(() => accepted ? succeed6(true) : request.settled.pipe(orElseSucceed(() => false), tap2((settled) => sync2(() => accepted ||= settled))));
4908
4919
  const readScreen = map9(option2(call((connection) => connection.read(address))), (screen) => isSome(screen) ? redactCredentials(screen.value).trim() : "");
4920
+ const setupPromptFailure = (shown) => failed("harness_setup_prompt", `The agent stopped at a prompt Kitman answers before launch. Its screen ended: ${shown.slice(-blockedScreenChars)}`);
4909
4921
  const judge = (last) => gen(function* () {
4910
4922
  if (yield* outputSubmitted)
4911
4923
  return { status: "settled" };
@@ -4927,6 +4939,8 @@ var runAttempt = (request, options) => gen(function* () {
4927
4939
  yield* logWarning("agent_blocked", { attempt: attempt.id, address, screen: shown });
4928
4940
  if (loginRefused(shown))
4929
4941
  return failed("harness_login_lost", `The Harness's login was refused before it submitted its Output. Its screen ended: ${shown.slice(-blockedScreenChars)}`);
4942
+ if (atSetupPrompt(shown))
4943
+ return setupPromptFailure(shown);
4930
4944
  return {
4931
4945
  status: "blocked",
4932
4946
  summary: `The agent stopped for input before submitting its Output.${shown === "" ? "" : ` Its screen ended: ${shown.slice(-blockedScreenChars)}`}`
@@ -4940,6 +4954,8 @@ var runAttempt = (request, options) => gen(function* () {
4940
4954
  if (isNone(ready)) {
4941
4955
  const shown = yield* readScreen;
4942
4956
  yield* logWarning("agent_launch_timeout", { attempt: attempt.id, address, screen: shown });
4957
+ if (atSetupPrompt(shown))
4958
+ return ended("launch_timeout")(setupPromptFailure(shown));
4943
4959
  return ended("launch_timeout")(failed("harness_launch_timeout", `The Harness reported no status within 120 s of its launch.${shown === "" ? " Its screen was empty." : ` Its screen ended: ${shown.slice(-blockedScreenChars)}`}`));
4944
4960
  }
4945
4961
  if (ready.value.end !== undefined)
@@ -7241,7 +7257,7 @@ var listenForSignals = (input) => gen(function* () {
7241
7257
  const dropSettled = (runIds) => forEach(runIds, (runId) => ignore(input.checkouts.drop(runId)), { discard: true }).pipe(provideContext2(services), andThen2(clearCheckpoints), forkIn(scope), asVoid);
7242
7258
  const held = yield* input.checkouts.held;
7243
7259
  yield* dropSettled(held.length === 0 ? [] : yield* input.rpc.settledRuns(held));
7244
- yield* input.rpc.listen(input.runnerReplicaId, (signal) => isUpdateAvailable(signal) ? input.update?.(signal.version) ?? void_3 : isRunSettled(signal) ? dropSettled([signal.runId]) : input.signals.push(signal));
7260
+ yield* input.rpc.listen(input.runnerReplicaId, (signal) => isUpdateAvailable(signal) ? input.update?.(signal.version, { now: signal.now === true }) ?? void_3 : isRunSettled(signal) ? dropSettled([signal.runId]) : input.signals.push(signal));
7245
7261
  }).pipe(scoped, catch_((error) => logWarning("runner_signals_disconnected", error.message)), catchDefect((defect) => logError("runner_signals_failed", pretty(die2(defect)))), andThen2(sleep(input.reconnectAfter)), forever);
7246
7262
  var pushWork = (worktree, branch, step, shared, env) => gen(function* () {
7247
7263
  const git = (...args) => runCommand2("git", ["-C", worktree, ...args]);
@@ -7716,7 +7732,7 @@ ${afterMergeFailed}`];
7716
7732
  });
7717
7733
  if (relay !== undefined)
7718
7734
  yield* relay.record([{ kind: "lifecycle", state: transcript === undefined ? "started" : "resumed" }]);
7719
- const relaying = relay === undefined ? undefined : yield* forkScoped(forever(andThen2(sleep("1 second"), relayed)));
7735
+ const relaying = relay === undefined ? undefined : yield* forkScoped(forever(andThen2(sleep("2 seconds"), relayed)));
7720
7736
  const parks = gen(function* () {
7721
7737
  const kept = yield* uninterruptible(takeCheckpoint).pipe(as(true), catch_((error) => as(logWarning("runner_park_checkpoint_failed", error.message), false)));
7722
7738
  if (!kept)
@@ -8477,7 +8493,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
8477
8493
  const input = yield* unbounded2();
8478
8494
  const pending = new Map;
8479
8495
  let lastId = 0;
8480
- const handle = yield* spawner.spawn(make3(binary, ["app-server"], {
8496
+ const handle = yield* spawner.spawn(make2(binary, ["app-server"], {
8481
8497
  cwd: env.home,
8482
8498
  extendEnv: true,
8483
8499
  env: { HOME: env.home, CODEX_HOME: env.codexHome },
@@ -8500,7 +8516,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
8500
8516
  return {
8501
8517
  request: (method, params) => gen(function* () {
8502
8518
  const id = ++lastId;
8503
- const deferred = yield* make16();
8519
+ const deferred = yield* make15();
8504
8520
  pending.set(id, deferred);
8505
8521
  yield* send({ id, method, params });
8506
8522
  return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
@@ -8640,10 +8656,10 @@ var handshake = [
8640
8656
  `).join("");
8641
8657
  var kitmanMcpPreflight = (mcp) => gen(function* () {
8642
8658
  const spawner = yield* ChildProcessSpawner;
8643
- const server = yield* spawner.spawn(make3(mcp.command, [...mcp.args], {
8659
+ const server = yield* spawner.spawn(make2(mcp.command, [...mcp.args], {
8644
8660
  extendEnv: true,
8645
8661
  env: mcp.env,
8646
- stdin: { stream: make11(new TextEncoder().encode(handshake)), endOnDone: false },
8662
+ stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
8647
8663
  stderr: "ignore"
8648
8664
  }));
8649
8665
  const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
@@ -8716,8 +8732,8 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
8716
8732
  };
8717
8733
  const exitCode = sandbox === undefined ? yield* gen(function* () {
8718
8734
  const spawner = yield* ChildProcessSpawner;
8719
- const handle = yield* spawner.spawn(make3(input.bun ?? process.execPath, [file], {
8720
- stdin: make11(new TextEncoder().encode(stdin)),
8735
+ const handle = yield* spawner.spawn(make2(input.bun ?? process.execPath, [file], {
8736
+ stdin: make10(new TextEncoder().encode(stdin)),
8721
8737
  stdout: "inherit",
8722
8738
  stderr: "inherit",
8723
8739
  extendEnv: false,
@@ -138,7 +138,7 @@ import {
138
138
  toJsonSchemaDocument,
139
139
  toCodecJson,
140
140
  Json
141
- } from "./chunk-h2f26xbd.js";
141
+ } from "./chunk-61dmxexa.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-nwbry6c8.js";
178
+ } from "./chunk-yhat3rhw.js";
179
179
  import {
180
180
  currentTimeMillis,
181
181
  getCurrent,
182
182
  runForEach,
183
183
  FileSystem
184
- } from "./chunk-8fyfsajs.js";
184
+ } from "./chunk-z0gqrc8c.js";
185
185
  import {
186
186
  splitQuestionOptions,
187
187
  recommendationProblem,
188
188
  questionAdvice
189
- } from "./chunk-tsx0347c.js";
189
+ } from "./chunk-1hgsf81a.js";
190
190
  import {
191
191
  guard,
192
192
  Id,
193
193
  Timestamp,
194
194
  ActorType
195
- } from "./chunk-4qjfn1sa.js";
195
+ } from "./chunk-rbpn35g5.js";
196
196
  var __defProp = Object.defineProperty;
197
197
  var __returnValue = (v) => v;
198
198
  function __exportSetter(name, newValue) {
@@ -25,21 +25,21 @@ import {
25
25
  isString2,
26
26
  encodePrettyJsonString,
27
27
  decodeJsonStringSync
28
- } from "./chunk-h2f26xbd.js";
28
+ } from "./chunk-61dmxexa.js";
29
29
  import {
30
30
  FileSystem,
31
31
  Path,
32
32
  optionalEnv,
33
33
  tempDirectoryScoped
34
- } from "./chunk-8fyfsajs.js";
34
+ } from "./chunk-z0gqrc8c.js";
35
35
  import {
36
36
  AgentHarnessIds,
37
37
  sha2562,
38
38
  runCommand2
39
- } from "./chunk-nwbry6c8.js";
39
+ } from "./chunk-yhat3rhw.js";
40
40
  import {
41
41
  NpmRegistry
42
- } from "./chunk-xkkyx7bn.js";
42
+ } from "./chunk-ee7ss0df.js";
43
43
 
44
44
  // packages/agent-runtime/src/config-convergence.ts
45
45
  var writeAgentEnvironmentConfigFile2 = fnUntraced(function* (file, content, keep = {}) {
@@ -12,9 +12,10 @@ import {
12
12
  succeed,
13
13
  isSuccess,
14
14
  TaggedError,
15
- make16,
15
+ make15,
16
16
  _await,
17
17
  fail5,
18
+ succeed4,
18
19
  succeed5,
19
20
  provide2,
20
21
  squash,
@@ -108,7 +109,7 @@ import {
108
109
  decodeJsonStringOption,
109
110
  encodeJsonStringSync,
110
111
  encodePrettyJsonString
111
- } from "./chunk-h2f26xbd.js";
112
+ } from "./chunk-61dmxexa.js";
112
113
  import {
113
114
  currentTimeMillis,
114
115
  tap,
@@ -121,7 +122,7 @@ import {
121
122
  withDefault,
122
123
  option,
123
124
  String2
124
- } from "./chunk-8fyfsajs.js";
125
+ } from "./chunk-z0gqrc8c.js";
125
126
  import {
126
127
  SecureRandom,
127
128
  layerWebCrypto,
@@ -185,7 +186,7 @@ import {
185
186
  digestSha256,
186
187
  sha256Hasher,
187
188
  raw,
188
- make5,
189
+ make4,
189
190
  get,
190
191
  put,
191
192
  HttpClient,
@@ -251,15 +252,15 @@ import {
251
252
  harnessNames,
252
253
  herdrRunnerCapabilities2,
253
254
  declaredChecks
254
- } from "./chunk-nwbry6c8.js";
255
+ } from "./chunk-yhat3rhw.js";
255
256
  import {
256
257
  ChildProcessSpawner,
257
- make3
258
- } from "./chunk-9nbqzdqp.js";
258
+ make2
259
+ } from "./chunk-er0e8d8v.js";
259
260
  import {
260
261
  Id,
261
262
  Timestamp
262
- } from "./chunk-4qjfn1sa.js";
263
+ } from "./chunk-rbpn35g5.js";
263
264
 
264
265
  // apps/cli/src/cli-error.ts
265
266
  function cliErrorCode(error, status) {
@@ -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-yveqd8ye.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
1330
+ defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-wkkjyzpx.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-yveqd8ye.js")), (module) => module.updateHerdrCore(options))
1333
+ defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-wkkjyzpx.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-ak1qrm4q.js"));
1793
+ const { syncKitSetup } = yield* promise(() => import("./chunk-y3c9pxez.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(make3(command, args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" }));
2310
+ const handle = yield* spawner.spawn(make2(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.33.0";
3288
+ var cliVersion = "0.35.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-racse7zf.js"));
3553
+ var agentRuntime = promise(() => import("./chunk-ke4rajdh.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-py3133q0.js"));
5092
+ const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-r9x4ehsy.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 {
@@ -5400,7 +5418,7 @@ function startCanonicalHerdrRunnerCommand(input) {
5400
5418
  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);
5401
5419
  yield* suspend3(() => sleep(ownerLogin.expired() ? ownerLoginRetryInterval : ownerLoginInterval)).pipe(andThen2(checkOwnerLogin), forever, forkScoped);
5402
5420
  const platform = yield* context();
5403
- const updated = yield* make16();
5421
+ const updated = yield* make15();
5404
5422
  const scope = yield* scope2;
5405
5423
  const startUpdate = (update) => update.pipe(catch_((error) => andThen2(restartOntoUpdate(input.runnerId), fail5(updated, error))), provideContext2(platform), forkIn(scope), asVoid);
5406
5424
  const refusedForProtocol = container ? updater.stopWhenDrained(new RunnerStopped({ problem: updateRequired })).pipe(catch_((stopped) => fail5(updated, stopped)), forkIn(scope), asVoid) : startUpdate(updater.updateRequired);
@@ -5411,7 +5429,7 @@ function startCanonicalHerdrRunnerCommand(input) {
5411
5429
  signals,
5412
5430
  checkouts,
5413
5431
  reconnectAfter: "2 seconds",
5414
- update: (version) => container ? updater.cannotUpdate(version) : startUpdate(updater.update(version))
5432
+ update: (version, { now }) => container ? updater.cannotUpdate(version) : startUpdate(updater.update(version, { now }))
5415
5433
  }).pipe(forkScoped);
5416
5434
  const sharedSandbox = personal ? undefined : {
5417
5435
  runner: runnerState,
@@ -5582,7 +5600,8 @@ function startCanonicalHerdrRunnerCommand(input) {
5582
5600
  problems: [...problemsNow(), ...updater.problems(), ...unreaped, ...disk],
5583
5601
  capabilities: capabilitiesNow(),
5584
5602
  labels: runner.labels,
5585
- ...appliedSettingsReport()
5603
+ ...appliedSettingsReport(),
5604
+ ...updateDrainReport(updater.updateDrain())
5586
5605
  })).pipe(tap2(followReleaseChannel), flatMap3((heartbeat) => applySettings(heartbeat.settings)), flatMap3(() => controlPlane.client.heartbeatRunnerReplica(input.runnerId, replica.id, {
5587
5606
  healthStatus: "healthy",
5588
5607
  drainState: updater.claiming() ? "accepting" : "draining",
@@ -5661,7 +5680,7 @@ function mcpCommand(args) {
5661
5680
  if (command.action === "run") {
5662
5681
  if (command.args.length > 0)
5663
5682
  return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
5664
- const { runMcpServerCommand } = yield* promise(() => import("./chunk-jrwpte6y.js"));
5683
+ const { runMcpServerCommand } = yield* promise(() => import("./chunk-xc7kg57m.js"));
5665
5684
  return yield* runMcpServerCommand({ flags: command.flags });
5666
5685
  }
5667
5686
  if (command.action !== "setup")
@@ -6161,7 +6180,7 @@ function programLoopCommand(command) {
6161
6180
  return yield* new CliError({ message: `Unknown loop command: ${command.action}` });
6162
6181
  });
6163
6182
  }
6164
- var docsModule = promise(() => import("./chunk-a9ncx2a8.js"));
6183
+ var docsModule = promise(() => import("./chunk-tsefrrxz.js"));
6165
6184
  function docsCommand(args) {
6166
6185
  return gen(function* () {
6167
6186
  const command = parseCommand(args);
@@ -6538,7 +6557,7 @@ var runShowLines = (shown) => [
6538
6557
  ...questionLines2(shown.questions.filter((question) => question.status === "open")),
6539
6558
  ...shown.artifacts.flatMap((artifact) => [`Artifact ${artifact.kind}: ${artifact.title}`, artifact.text]),
6540
6559
  ...shown.children.map((child) => `Child ${child.name}: ${child.runId} ${child.status}`),
6541
- ...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}`)
6542
6561
  ];
6543
6562
  var myTeamsSections = [
6544
6563
  ["needsYou", "Needs you"],
@@ -7165,7 +7184,7 @@ function changeRequestCommand(args) {
7165
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}`);
7166
7185
  });
7167
7186
  }
7168
- var readOutlines = (directory) => flatMap3(promise(() => import("./chunk-9tyv6211.js")), (build) => build.readOutlines(directory)).pipe(mapError2((error) => new CliError({ message: error.message })));
7187
+ var readOutlines = (directory) => flatMap3(promise(() => import("./chunk-t9dmwy8x.js")), (build) => build.readOutlines(directory)).pipe(mapError2((error) => new CliError({ message: error.message })));
7169
7188
  var loopOutline = (command) => gen(function* () {
7170
7189
  const path = yield* Path;
7171
7190
  const loop = requiredArg(command, "a Loop id");
@@ -7185,9 +7204,9 @@ var loopOutline = (command) => gen(function* () {
7185
7204
  `).pipe(mapError2((error) => new CliError({ message: error.message })));
7186
7205
  yield* log(`Wrote the outline of ${loop} to ${out}`);
7187
7206
  });
7188
- var KitWriter = map9(promise(() => import("./chunk-9tyv6211.js")), (build) => build.writeKit);
7207
+ var KitWriter = map9(promise(() => import("./chunk-t9dmwy8x.js")), (build) => build.writeKit);
7189
7208
  var KitBuilder = Reference("kitman/cli/KitBuilder", {
7190
- defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-9tyv6211.js")), (build) => build.buildKit(directory))
7209
+ defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-t9dmwy8x.js")), (build) => build.buildKit(directory))
7191
7210
  });
7192
7211
  var uploadKit = (client, workspaceId, built) => gen(function* () {
7193
7212
  yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
@@ -7966,7 +7985,7 @@ function downloadPresignedAsset(download, outputPath) {
7966
7985
  return gen(function* () {
7967
7986
  const fs = yield* FileSystem;
7968
7987
  const failed = (cause) => new CliError({ message: `Asset download failed: ${String(cause)}` });
7969
- const response = yield* send(make5(download.method)(download.url), failed);
7988
+ const response = yield* send(make4(download.method)(download.url), failed);
7970
7989
  if (response.status < 200 || response.status >= 300)
7971
7990
  return yield* new CliError({ message: `Asset download failed with ${response.status}` });
7972
7991
  const body = yield* response.arrayBuffer.pipe(mapError2((error) => failed(error.message)));
@@ -8238,6 +8257,8 @@ function agentStepRunOutcome(outcome, step) {
8238
8257
  return { status: "failed", summary: outcome.summary, restart: { reason: "login_revoked" } };
8239
8258
  if (outcome.reason === "harness_error")
8240
8259
  return { status: "failed", summary: outcome.summary, restart: { reason: "harness_error" } };
8260
+ if (outcome.reason === "harness_setup_prompt")
8261
+ return { status: "failed", summary: outcome.summary, restart: { reason: "setup_prompt" } };
8241
8262
  if (!failedToStart(outcome.reason))
8242
8263
  return { status: "failed", summary: outcome.summary };
8243
8264
  return {
@@ -13,11 +13,11 @@ import {
13
13
  ArraySchema,
14
14
  decodeJsonStringOption,
15
15
  encodeUnknownJsonStringSync
16
- } from "./chunk-h2f26xbd.js";
16
+ } from "./chunk-61dmxexa.js";
17
17
  import {
18
18
  replaceSecretReferences,
19
19
  secretReferencesIn
20
- } from "./chunk-4qjfn1sa.js";
20
+ } from "./chunk-rbpn35g5.js";
21
21
 
22
22
  // packages/agent-runtime/src/srt-step.ts
23
23
  import { SandboxRuntimeConfigSchema } from "@anthropic-ai/sandbox-runtime";
@@ -15,8 +15,8 @@ import {
15
15
  writeSrtSettings2,
16
16
  srtStepArgv2,
17
17
  srtArgv2
18
- } from "./chunk-8fyfsajs.js";
19
- import"./chunk-h2f26xbd.js";
18
+ } from "./chunk-z0gqrc8c.js";
19
+ import"./chunk-61dmxexa.js";
20
20
  export {
21
21
  compiled2 as compiled,
22
22
  harnessesUnsupportedInDocker2 as harnessesUnsupportedInDocker,
@@ -4,12 +4,12 @@ import {
4
4
  runnerRpcUrl2,
5
5
  makeRunnerRpcClient2,
6
6
  makeProgramRpcClient2
7
- } from "./chunk-mhx0tgm3.js";
8
- import"./chunk-np5n54ky.js";
9
- import"./chunk-nwbry6c8.js";
10
- import"./chunk-4qjfn1sa.js";
11
- import"./chunk-8fyfsajs.js";
12
- import"./chunk-h2f26xbd.js";
7
+ } from "./chunk-64arqv10.js";
8
+ import"./chunk-t205gnzc.js";
9
+ import"./chunk-yhat3rhw.js";
10
+ import"./chunk-rbpn35g5.js";
11
+ import"./chunk-z0gqrc8c.js";
12
+ import"./chunk-61dmxexa.js";
13
13
  export {
14
14
  makeProgramRpcClient2 as makeProgramRpcClient,
15
15
  makeRunnerRpcClient2 as makeRunnerRpcClient,
@@ -18,7 +18,7 @@ import {
18
18
  isMinLength,
19
19
  isMaxLength,
20
20
  FiniteFromString
21
- } from "./chunk-h2f26xbd.js";
21
+ } from "./chunk-61dmxexa.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];
@@ -96,7 +96,7 @@ import {
96
96
  Defect,
97
97
  Exit,
98
98
  toCodecJson
99
- } from "./chunk-h2f26xbd.js";
99
+ } from "./chunk-61dmxexa.js";
100
100
  import {
101
101
  Clock,
102
102
  interrupt,
@@ -109,7 +109,7 @@ import {
109
109
  shutdownUnsafe,
110
110
  fromQueue,
111
111
  unwrap
112
- } from "./chunk-8fyfsajs.js";
112
+ } from "./chunk-z0gqrc8c.js";
113
113
  import {
114
114
  empty,
115
115
  fromInput,
@@ -123,7 +123,7 @@ import {
123
123
  ParseOptions,
124
124
  RpcClientDefect,
125
125
  RpcClientError
126
- } from "./chunk-nwbry6c8.js";
126
+ } from "./chunk-yhat3rhw.js";
127
127
 
128
128
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/workers/Transferable.js
129
129
  class Collector extends (/* @__PURE__ */ Service2()("effect/workers/Transferable/Collector")) {
@@ -483,7 +483,7 @@ var makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options)
483
483
  };
484
484
  });
485
485
  var clientIdCounter = 0;
486
- var make4 = /* @__PURE__ */ fnUntraced(function* (group, options) {
486
+ var make3 = /* @__PURE__ */ fnUntraced(function* (group, options) {
487
487
  const clientId = clientIdCounter++;
488
488
  const {
489
489
  codecFor,
@@ -829,4 +829,4 @@ var layerProtocolSocket = (options) => effect(Protocol)(makeProtocolSocket(optio
829
829
  class ConnectionHooks extends (/* @__PURE__ */ Service2()("effect/rpc/RpcClient/ConnectionHooks")) {
830
830
  }
831
831
 
832
- export { layerJson, make4, withHeaders, layerProtocolSocket, ConnectionHooks };
832
+ export { layerJson, make3, withHeaders, layerProtocolSocket, ConnectionHooks };