@kitman-sh/cli 0.10.98 → 0.10.99

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 (26) hide show
  1. package/dist/{chunk-g1xmj2nb.js → chunk-0a10kdrd.js} +4 -4
  2. package/dist/{chunk-aba9zdpb.js → chunk-0hjtwtms.js} +59 -34
  3. package/dist/{chunk-7c3pgktm.js → chunk-0tsc91qr.js} +8 -8
  4. package/dist/{chunk-sy8d7bfa.js → chunk-2fs34341.js} +111 -105
  5. package/dist/{chunk-797w5qe6.js → chunk-3ka78n56.js} +7 -7
  6. package/dist/{chunk-p83y21hp.js → chunk-3r7ahnwy.js} +4 -4
  7. package/dist/{chunk-6dc0x5cg.js → chunk-3v70x040.js} +8 -8
  8. package/dist/{chunk-fd39ch4n.js → chunk-4sswz0mn.js} +8 -8
  9. package/dist/{chunk-95mkdtzk.js → chunk-56e202xk.js} +6 -6
  10. package/dist/{chunk-j8vq6sk1.js → chunk-6vmpa1nw.js} +19 -19
  11. package/dist/{chunk-7ya2q09c.js → chunk-a244myqw.js} +1 -1
  12. package/dist/{chunk-gfqm22x7.js → chunk-abf4m4b2.js} +5 -5
  13. package/dist/{chunk-07p2dcq3.js → chunk-ampzxrqe.js} +94 -333
  14. package/dist/{chunk-d1sqb8rt.js → chunk-bk3dpjxq.js} +1 -1
  15. package/dist/{chunk-qrxkpwzy.js → chunk-et6qa95h.js} +1 -1
  16. package/dist/{chunk-cgjyv52e.js → chunk-fv6kgtze.js} +2 -2
  17. package/dist/{chunk-xwhybbj2.js → chunk-g3r5xp0t.js} +2 -2
  18. package/dist/{chunk-3bjekzn7.js → chunk-k0shg2fb.js} +485 -333
  19. package/dist/{chunk-nym2zmz3.js → chunk-rdv42ygn.js} +4 -4
  20. package/dist/{chunk-bqg9gy2e.js → chunk-rp224rm4.js} +7 -7
  21. package/dist/{chunk-s90hj0mb.js → chunk-rrj434w6.js} +361 -133
  22. package/dist/{chunk-n8c1wh6t.js → chunk-t7ncjd6s.js} +6 -6
  23. package/dist/{chunk-s5p94z8x.js → chunk-vjcn82g3.js} +214 -65
  24. package/dist/{chunk-c6h3fhtb.js → chunk-z2f9enrp.js} +24 -24
  25. package/dist/index.js +4 -4
  26. package/package.json +1 -1
@@ -6,11 +6,12 @@ import {
6
6
  isObject,
7
7
  isJsonObject,
8
8
  isString
9
- } from "./chunk-d1sqb8rt.js";
9
+ } from "./chunk-bk3dpjxq.js";
10
10
  import {
11
11
  pipeArguments,
12
12
  dual,
13
13
  identity,
14
+ isFunction2,
14
15
  hasProperty,
15
16
  isTagged,
16
17
  isUint8Array,
@@ -46,14 +47,14 @@ import {
46
47
  isSuccess2,
47
48
  isFailure2,
48
49
  hasInterrupts,
49
- makeUnsafe4,
50
- make15,
50
+ makeUnsafe5,
51
+ make16,
51
52
  _await,
52
53
  fail5,
53
54
  isDoneUnsafe,
54
55
  succeed4,
55
56
  doneUnsafe,
56
- makeUnsafe5,
57
+ makeUnsafe6,
57
58
  provide,
58
59
  succeed5,
59
60
  effect,
@@ -61,7 +62,6 @@ import {
61
62
  die2,
62
63
  findErrorOption,
63
64
  pretty,
64
- currentTimeMillis,
65
65
  exponential,
66
66
  jittered,
67
67
  spaced,
@@ -89,7 +89,7 @@ import {
89
89
  result,
90
90
  option2,
91
91
  exit,
92
- map7,
92
+ map8,
93
93
  as,
94
94
  asSome2,
95
95
  asVoid,
@@ -168,13 +168,14 @@ import {
168
168
  encodePrettyJsonString,
169
169
  decodeJsonStringSync,
170
170
  encodeUnknownJsonStringSync
171
- } from "./chunk-07p2dcq3.js";
171
+ } from "./chunk-ampzxrqe.js";
172
172
  import {
173
173
  Id,
174
174
  secretReference,
175
175
  secretPlaceholder
176
- } from "./chunk-qrxkpwzy.js";
176
+ } from "./chunk-et6qa95h.js";
177
177
  import {
178
+ currentTimeMillis,
178
179
  SecureRandom,
179
180
  layerWebCrypto,
180
181
  layer,
@@ -245,7 +246,7 @@ import {
245
246
  installCommand,
246
247
  checkServicesFile,
247
248
  checkServices
248
- } from "./chunk-3bjekzn7.js";
249
+ } from "./chunk-k0shg2fb.js";
249
250
  import {
250
251
  join,
251
252
  interrupt,
@@ -253,8 +254,8 @@ import {
253
254
  publishUnsafe,
254
255
  unbounded2,
255
256
  offer,
256
- makeUnsafe2,
257
- make10,
257
+ makeUnsafe3,
258
+ make11,
258
259
  fromQueue,
259
260
  fromPubSub,
260
261
  map2,
@@ -285,7 +286,7 @@ import {
285
286
  writeSrtSettings2,
286
287
  srtStepArgv2,
287
288
  srtArgv2
288
- } from "./chunk-s5p94z8x.js";
289
+ } from "./chunk-vjcn82g3.js";
289
290
  import {
290
291
  writeAgentEnvironmentConfigFile2,
291
292
  readManifestSkillPaths2,
@@ -301,8 +302,8 @@ import {
301
302
  applyAgentEnvironmentMaterialization2,
302
303
  isPathWithin2,
303
304
  skillIdentity2
304
- } from "./chunk-6dc0x5cg.js";
305
- import"./chunk-bqg9gy2e.js";
305
+ } from "./chunk-3v70x040.js";
306
+ import"./chunk-rp224rm4.js";
306
307
  import {
307
308
  egressAllowed,
308
309
  writeSecretRegistry,
@@ -312,7 +313,7 @@ import {
312
313
  secretFilter2,
313
314
  opaqueTunnelRefusal2,
314
315
  isOpaqueConnectReason2
315
- } from "./chunk-cgjyv52e.js";
316
+ } from "./chunk-fv6kgtze.js";
316
317
  import {
317
318
  sliceBytes2,
318
319
  maxLineBytes2,
@@ -320,23 +321,23 @@ import {
320
321
  decodedOption2,
321
322
  decoded2,
322
323
  readOpencode2
323
- } from "./chunk-n8c1wh6t.js";
324
+ } from "./chunk-t7ncjd6s.js";
324
325
  import {
325
326
  uploadRunFile,
326
327
  programLease,
327
328
  rpcRunFiles,
328
329
  programHostsEnv,
329
330
  undeclaredHostsEnv
330
- } from "./chunk-7c3pgktm.js";
331
- import"./chunk-95mkdtzk.js";
331
+ } from "./chunk-0tsc91qr.js";
332
+ import"./chunk-56e202xk.js";
332
333
  import {
333
334
  nextInt
334
- } from "./chunk-7ya2q09c.js";
335
+ } from "./chunk-a244myqw.js";
335
336
  import {
336
337
  ChildProcessSpawner,
337
338
  make3
338
- } from "./chunk-p83y21hp.js";
339
- import"./chunk-c6h3fhtb.js";
339
+ } from "./chunk-3r7ahnwy.js";
340
+ import"./chunk-z2f9enrp.js";
340
341
 
341
342
  // packages/core/src/sync-kit.ts
342
343
  import { createHash } from "crypto";
@@ -902,7 +903,7 @@ var resolvePackagePlugins = (input, plan) => gen(function* () {
902
903
  const source = packageSource(plugin);
903
904
  if (source === undefined || source.version !== undefined && input.versions !== "latest")
904
905
  return succeed6([plugin]);
905
- return resolver.npmLatest(source.packageName).pipe(map7((version) => [
906
+ return resolver.npmLatest(source.packageName).pipe(map8((version) => [
906
907
  {
907
908
  ...plugin,
908
909
  item: {
@@ -2282,7 +2283,7 @@ var openCodeStore = (source) => gen(function* () {
2282
2283
  var runOpenCode = (binary, store, args) => runCommand2(binary, [...args, "--standalone"], { env: store.env, timeout: "30 seconds" });
2283
2284
  var readOpenCodeLogin = (binary, source) => gen(function* () {
2284
2285
  const store = yield* openCodeStore(source);
2285
- const exported = store === undefined ? none() : yield* runOpenCode(binary, store, ["auth", "export"]).pipe(map7(decodeExport), orElseSucceed(() => none()));
2286
+ const exported = store === undefined ? none() : yield* runOpenCode(binary, store, ["auth", "export"]).pipe(map8(decodeExport), orElseSucceed(() => none()));
2286
2287
  if (isNone(exported)) {
2287
2288
  const credentials = yield* fileCredentials(source);
2288
2289
  return credentials === undefined ? undefined : { credentials };
@@ -2329,17 +2330,17 @@ var renewers = {
2329
2330
  grant_type: "refresh_token",
2330
2331
  refresh_token: login.refresh,
2331
2332
  client_id: "9d1c250a-e61b-44d9-88ed-5944d1962f5e"
2332
- }))).pipe(map7(refreshed(now))),
2333
+ }))).pipe(map8(refreshed(now))),
2333
2334
  openai: (login, now) => answer("openai", TokenAnswer, post("https://auth.openai.com/oauth/token").pipe(bodyUrlParams({
2334
2335
  grant_type: "refresh_token",
2335
2336
  refresh_token: login.refresh,
2336
2337
  client_id: "app_EMoamEEZ73f0CkXaXp7hrann"
2337
- }))).pipe(map7(refreshed(now))),
2338
+ }))).pipe(map8(refreshed(now))),
2338
2339
  xai: (login, now) => answer("xai", XaiAnswer, post("https://auth.x.ai/oauth2/token").pipe(acceptJson, bodyUrlParams({
2339
2340
  grant_type: "refresh_token",
2340
2341
  refresh_token: login.refresh,
2341
2342
  client_id: "b1a00492-073a-47ea-816f-4c329264a828"
2342
- }))).pipe(map7((answered) => ({
2343
+ }))).pipe(map8((answered) => ({
2343
2344
  access: answered.access_token,
2344
2345
  ...answered.refresh_token === undefined ? undefined : { refresh: answered.refresh_token },
2345
2346
  expires: xaiExpiry(answered, now)
@@ -2348,8 +2349,8 @@ var renewers = {
2348
2349
  grant_type: "refresh_token",
2349
2350
  refresh_token: login.refresh,
2350
2351
  client_id: "opencode-cli"
2351
- }))).pipe(map7(refreshed(now))),
2352
- "github-copilot": (login) => answer("github-copilot", CopilotAnswer, get("https://api.github.com/copilot_internal/v2/token").pipe(setHeaders({ authorization: `Bearer ${login.refresh}`, accept: "application/json" }))).pipe(map7((answered) => ({ access: answered.token, expires: answered.expires_at * 1000 })))
2352
+ }))).pipe(map8(refreshed(now))),
2353
+ "github-copilot": (login) => answer("github-copilot", CopilotAnswer, get("https://api.github.com/copilot_internal/v2/token").pipe(setHeaders({ authorization: `Bearer ${login.refresh}`, accept: "application/json" }))).pipe(map8((answered) => ({ access: answered.token, expires: answered.expires_at * 1000 })))
2353
2354
  };
2354
2355
  var renewerFor = (provider) => isKeyOf(renewers, provider) ? renewers[provider] : undefined;
2355
2356
  var renewableLogin = (provider, credential) => getOrUndefined(filter2(decodeRenewable(credential), (login) => renewerFor(provider) !== undefined && (provider !== "github-copilot" || login.access !== login.refresh)));
@@ -2380,7 +2381,7 @@ var replaceInFile = (source, provider, credential) => gen(function* () {
2380
2381
  });
2381
2382
  var renewalPermits = new Map;
2382
2383
  var oneRenewalAt = (source) => (effect) => {
2383
- const permit = renewalPermits.get(source) ?? makeUnsafe2(1);
2384
+ const permit = renewalPermits.get(source) ?? makeUnsafe3(1);
2384
2385
  renewalPermits.set(source, permit);
2385
2386
  return permit.withPermits(1)(effect);
2386
2387
  };
@@ -2414,7 +2415,7 @@ var filesUnder = (root) => gen(function* () {
2414
2415
  if (skipped.has(entry))
2415
2416
  continue;
2416
2417
  const path = relative === "" ? entry : `${relative}/${entry}`;
2417
- const type = yield* fs.stat(`${root}/${path}`).pipe(map7((info) => info.type), orElseSucceed(() => {
2418
+ const type = yield* fs.stat(`${root}/${path}`).pipe(map8((info) => info.type), orElseSucceed(() => {
2418
2419
  return;
2419
2420
  }));
2420
2421
  if (type === "Directory")
@@ -2430,7 +2431,7 @@ var dependenciesOf = (root, files) => gen(function* () {
2430
2431
  const fs = yield* FileSystem;
2431
2432
  const names = new Set;
2432
2433
  for (const file of files.filter((path) => path === "package.json" || path.endsWith("/package.json"))) {
2433
- const manifest = yield* fs.readFileString(`${root}/${file}`).pipe(map7((text) => decodeJsonStringSync(text)), orElseSucceed(() => {
2434
+ const manifest = yield* fs.readFileString(`${root}/${file}`).pipe(map8((text) => decodeJsonStringSync(text)), orElseSucceed(() => {
2434
2435
  return;
2435
2436
  }));
2436
2437
  if (!isJsonObject(manifest))
@@ -2602,7 +2603,7 @@ var credentialsIn = (source) => gen(function* () {
2602
2603
  const credentials = getOrUndefined(decodeJsonStringOption(text));
2603
2604
  return isJsonObject(credentials) ? credentials : undefined;
2604
2605
  });
2605
- var loginCredentials = (login) => login.format === "opencode" ? map7(readOpenCodeLogin(login.binary, login.source), (read) => read?.credentials) : credentialsIn(login.source);
2606
+ var loginCredentials = (login) => login.format === "opencode" ? map8(readOpenCodeLogin(login.binary, login.source), (read) => read?.credentials) : credentialsIn(login.source);
2606
2607
  var neverExpires = 253402300799000;
2607
2608
  var isOAuth = (credential) => isJsonObject(credential) && credential.type === "oauth";
2608
2609
  var claudeOAuth = "claudeAiOauth";
@@ -2770,7 +2771,7 @@ var refreshOperatorLogin = (login, expired, http) => gen(function* () {
2770
2771
  }
2771
2772
  }
2772
2773
  });
2773
- var stepLogin = (login, reference) => map7(loginCredentials(login), (credentials) => {
2774
+ var stepLogin = (login, reference) => map8(loginCredentials(login), (credentials) => {
2774
2775
  if (credentials === undefined)
2775
2776
  return;
2776
2777
  const format = loginFormats[login.format];
@@ -2789,8 +2790,8 @@ var renewableStepLogin = (login, referenced, http) => gen(function* () {
2789
2790
  const expired = new Map;
2790
2791
  let published;
2791
2792
  let heldTokens;
2792
- const writing = makeUnsafe2(1);
2793
- const refreshing = makeUnsafe2(1);
2793
+ const writing = makeUnsafe3(1);
2794
+ const refreshing = makeUnsafe3(1);
2794
2795
  const copy = gen(function* () {
2795
2796
  const copied = yield* stepLogin(login, referenced?.reference);
2796
2797
  if (copied === undefined)
@@ -2849,7 +2850,7 @@ var loginHostsWithProviders = (operatorFiles) => gen(function* () {
2849
2850
  };
2850
2851
  return { ...login, hosts };
2851
2852
  });
2852
- var carriedLoginHosts = (launch) => launch.renewedLogin?.format === "opencode" ? map7(loginCredentials(launch.renewedLogin), openCodeConsoleHosts) : succeed6([]);
2853
+ var carriedLoginHosts = (launch) => launch.renewedLogin?.format === "opencode" ? map8(loginCredentials(launch.renewedLogin), openCodeConsoleHosts) : succeed6([]);
2853
2854
  var carriedProviderHosts = (launch) => gen(function* () {
2854
2855
  const providers = launch.operatorFiles?.providers;
2855
2856
  if (providers === undefined)
@@ -2990,7 +2991,7 @@ var writeHarnessFiles = (input) => gen(function* () {
2990
2991
  yield* every(loginRenewalMillis, true);
2991
2992
  if (renewed.format !== "opencode")
2992
2993
  yield* every(loginCopyMillis, false);
2993
- const watching = makeUnsafe4();
2994
+ const watching = makeUnsafe5();
2994
2995
  yield* forkScoped(fs.watch(path.dirname(renewed.source), { onReady: () => doneUnsafe(watching, void_3) }).pipe(filter((event) => path.basename(event.path) === path.basename(renewed.source)), runForEach(() => login.publish(false)), catch_((error) => logWarning("harness_login_not_watched", error)), ensuring2(succeed4(watching, undefined))));
2995
2996
  yield* _await(watching);
2996
2997
  });
@@ -2999,7 +3000,7 @@ var decodeSetupArchive = decodeEffect(fromJsonString(SetupArchive));
2999
3000
  var runsOnHost = (command) => gen(function* () {
3000
3001
  const fs = yield* FileSystem;
3001
3002
  const path = yield* Path;
3002
- const executable = (file) => fs.stat(file).pipe(map7((info) => info.type === "File" && (info.mode & 73) !== 0), orElseSucceed(() => false));
3003
+ const executable = (file) => fs.stat(file).pipe(map8((info) => info.type === "File" && (info.mode & 73) !== 0), orElseSucceed(() => false));
3003
3004
  if (command.includes("/"))
3004
3005
  return yield* executable(command);
3005
3006
  for (const directory of ((yield* optionalEnv("PATH")) ?? "").split(":"))
@@ -3027,7 +3028,7 @@ var stepKitSetup = (agent, harness) => gen(function* () {
3027
3028
  const fetch = agent.setupArchive;
3028
3029
  if (fetch === undefined)
3029
3030
  return unavailable("this Runner fetches no setup archives");
3030
- const setups = yield* forEach(kits, (kit) => fetch(kit.setupDigest).pipe(flatMap3(decodeSetupArchive), map7((archive) => ({ name: kit.name, version: kit.version, archive })))).pipe(result);
3031
+ const setups = yield* forEach(kits, (kit) => fetch(kit.setupDigest).pipe(flatMap3(decodeSetupArchive), map8((archive) => ({ name: kit.name, version: kit.version, archive })))).pipe(result);
3031
3032
  if (isFailure(setups))
3032
3033
  return unavailable(setups.failure.message);
3033
3034
  const setup = materializeKitSetup(harness, [...setups.success, kitmanSkillEntry], agent.brief.listedSkills ?? []);
@@ -3057,11 +3058,11 @@ var Proto = {
3057
3058
  };
3058
3059
  }
3059
3060
  };
3060
- var make = (value) => map7(unbounded({
3061
+ var make = (value) => map8(unbounded({
3061
3062
  replay: 1
3062
3063
  }), (pubsub) => {
3063
3064
  const self = Object.create(Proto);
3064
- self.semaphore = makeUnsafe2(1);
3065
+ self.semaphore = makeUnsafe3(1);
3065
3066
  self.value = value;
3066
3067
  self.pubsub = pubsub;
3067
3068
  publishUnsafe(self.pubsub, value);
@@ -3266,7 +3267,7 @@ class ContainerError extends TaggedError("ContainerError") {
3266
3267
  class SecretProxyUnreachable extends TaggedError("SecretProxyUnreachable") {
3267
3268
  }
3268
3269
  var imagePull = { timeout: "30 minutes" };
3269
- var dockerContainerRunner = map7(ChildProcessSpawner, (spawner) => {
3270
+ var dockerContainerRunner = map8(ChildProcessSpawner, (spawner) => {
3270
3271
  const docker = (args, options = {}) => runCommand2("docker", args, options).pipe(mapError2((error) => new ContainerError({ message: error.message })), provideService(ChildProcessSpawner, spawner));
3271
3272
  const labelArgs = (labels) => labels.flatMap(([key, value]) => ["--label", `${key}=${value}`]);
3272
3273
  const ids = (output) => output.split(`
@@ -3540,12 +3541,12 @@ var openSession = (file) => gen(function* () {
3540
3541
  }
3541
3542
  return { handle, size: Number(opened.size) };
3542
3543
  });
3543
- var readAt = (handle, position, length) => map7(tryPromise(() => handle.read(new Uint8Array(length), 0, length, position)), ({ buffer, bytesRead }) => buffer.subarray(0, bytesRead));
3544
+ var readAt = (handle, position, length) => map8(tryPromise(() => handle.read(new Uint8Array(length), 0, length, position)), ({ buffer, bytesRead }) => buffer.subarray(0, bytesRead));
3544
3545
  var readSessionRange = (file, position, length) => gen(function* () {
3545
3546
  const { handle, size } = yield* openSession(file);
3546
3547
  return yield* readAt(handle, position, Math.max(0, Math.min(length, size - position)));
3547
3548
  }).pipe(scoped);
3548
- var sessionFileSize = (file) => map7(openSession(file), ({ size }) => size).pipe(scoped);
3549
+ var sessionFileSize = (file) => map8(openSession(file), ({ size }) => size).pipe(scoped);
3549
3550
  var maxSubagentFiles = 1024;
3550
3551
  var sessionExtent = (file) => gen(function* () {
3551
3552
  const fs = yield* FileSystem;
@@ -3553,7 +3554,7 @@ var sessionExtent = (file) => gen(function* () {
3553
3554
  if (file.subagents === undefined)
3554
3555
  return own;
3555
3556
  const found = yield* sessionFiles(file.subagents, 0, file.confinedTo);
3556
- const sizes = yield* forEach(found.slice(0, maxSubagentFiles), (path) => fs.stat(path).pipe(map7((info) => Number(info.size)), orElseSucceed(() => 0)));
3557
+ const sizes = yield* forEach(found.slice(0, maxSubagentFiles), (path) => fs.stat(path).pipe(map8((info) => Number(info.size)), orElseSucceed(() => 0)));
3557
3558
  return sizes.reduce((total, size) => total + size, own);
3558
3559
  });
3559
3560
  var packConfined = (file, root) => gen(function* () {
@@ -3580,7 +3581,7 @@ var packConfined = (file, root) => gen(function* () {
3580
3581
  }
3581
3582
  return packed;
3582
3583
  }).pipe(scoped);
3583
- var packSession = (file) => file.confinedTo === undefined ? flatMap3(FileSystem, (fs) => fs.readFile(file.path)).pipe(flatMap3((content) => tryPromise(() => gzipped(content))), map7((content) => new Uint8Array(content))) : packConfined(file, file.confinedTo);
3584
+ var packSession = (file) => file.confinedTo === undefined ? flatMap3(FileSystem, (fs) => fs.readFile(file.path)).pipe(flatMap3((content) => tryPromise(() => gzipped(content))), map8((content) => new Uint8Array(content))) : packConfined(file, file.confinedTo);
3584
3585
  var restoreSession = (adapter, place) => gen(function* () {
3585
3586
  const fs = yield* FileSystem;
3586
3587
  const location = adapter.session?.location;
@@ -3699,16 +3700,16 @@ var stepProcessEnvironment = (runnerId, attemptId, outer = process.env) => ({
3699
3700
  var lists = (value, id) => value.split(listSeparator).includes(id);
3700
3701
  var signalProcess = (pid, signal) => ignore(try_2(() => process.kill(pid, signal)));
3701
3702
  var signalled = (pid) => try_2(() => process.kill(pid, 0)).pipe(as(true), catch_((error) => succeed6(hasProperty(error.cause, "code") && error.cause.code === "EPERM")));
3702
- var procCommand = (fs, pid) => map7(fs.readFile(`/proc/${pid}/cmdline`).pipe(orElseSucceed(() => new Uint8Array)), commandLine);
3703
- var procProcessTable = map7(FileSystem, (fs) => ({
3703
+ var procCommand = (fs, pid) => map8(fs.readFile(`/proc/${pid}/cmdline`).pipe(orElseSucceed(() => new Uint8Array)), commandLine);
3704
+ var procProcessTable = map8(FileSystem, (fs) => ({
3704
3705
  marked: ({ name, value }) => gen(function* () {
3705
3706
  const prefix = `${name}=`;
3706
3707
  const pids = (yield* fs.readDirectory("/proc").pipe(orElseSucceed(() => []))).filter((pid) => /^\d+$/.test(pid));
3707
- const found = yield* forEach(pids, (pid) => fs.readFile(`/proc/${pid}/environ`).pipe(flatMap3((environ) => environEntries(environ).some((entry) => entry.startsWith(prefix) && lists(entry.slice(prefix.length), value)) ? map7(procCommand(fs, Number(pid)), (command) => [{ pid: Number(pid), command }]) : succeed6([])), orElseSucceed(() => [])), { concurrency: 16 });
3708
+ const found = yield* forEach(pids, (pid) => fs.readFile(`/proc/${pid}/environ`).pipe(flatMap3((environ) => environEntries(environ).some((entry) => entry.startsWith(prefix) && lists(entry.slice(prefix.length), value)) ? map8(procCommand(fs, Number(pid)), (command) => [{ pid: Number(pid), command }]) : succeed6([])), orElseSucceed(() => [])), { concurrency: 16 });
3708
3709
  return found.flat();
3709
3710
  }),
3710
3711
  signal: signalProcess,
3711
- alive: (pid) => fs.readFileString(`/proc/${pid}/stat`).pipe(map7((stat) => !/^[ZX]/.test(stat.slice(stat.lastIndexOf(")") + 2))), orElseSucceed(() => false))
3712
+ alive: (pid) => fs.readFileString(`/proc/${pid}/stat`).pipe(map8((stat) => !/^[ZX]/.test(stat.slice(stat.lastIndexOf(")") + 2))), orElseSucceed(() => false))
3712
3713
  }));
3713
3714
  var environEntries = (environ) => new TextDecoder().decode(environ).split("\x00");
3714
3715
  var commandLine = (cmdline) => new TextDecoder().decode(cmdline).split("\x00").filter((part) => part !== "").join(" ");
@@ -3717,10 +3718,10 @@ var psRows = (listed) => listed.split(`
3717
3718
  const matched = /^\s*(\d+)\s+(.*)$/.exec(line);
3718
3719
  return matched === null ? [] : [{ pid: Number(matched[1]), text: matched[2] ?? "" }];
3719
3720
  });
3720
- var psProcessTable = map7(ChildProcessSpawner, (spawner) => {
3721
+ var psProcessTable = map8(ChildProcessSpawner, (spawner) => {
3721
3722
  const ps = (args) => runCommand2("ps", [...args, "-ww", "-U", String(process.getuid?.() ?? ""), "-o", "pid=,command="], {
3722
3723
  timeout: "30 seconds"
3723
- }).pipe(provideService(ChildProcessSpawner, spawner), map7(psRows));
3724
+ }).pipe(provideService(ChildProcessSpawner, spawner), map8(psRows));
3724
3725
  return {
3725
3726
  marked: ({ name, value }) => gen(function* () {
3726
3727
  const entry = ` ${name}=`;
@@ -3746,7 +3747,7 @@ var psProcessTable = map7(ChildProcessSpawner, (spawner) => {
3746
3747
  var systemProcessTable = process.platform === "linux" ? procProcessTable : psProcessTable;
3747
3748
  var unitPart = (id) => id.replaceAll(/[^A-Za-z0-9-]/g, (char) => `_${char.charCodeAt(0).toString(16)}`);
3748
3749
  var unitPrefix = (runnerId, attemptId) => `kitman-step-${unitPart(runnerId)}.${attemptId === undefined ? "" : `${unitPart(attemptId)}.`}`;
3749
- var unitSuffix = SecureRandom.pipe(flatMap3((random) => random.uuidV4()), map7((uuid) => uuid.slice(0, 8)), provide3(layerWebCrypto));
3750
+ var unitSuffix = SecureRandom.pipe(flatMap3((random) => random.uuidV4()), map8((uuid) => uuid.slice(0, 8)), provide3(layerWebCrypto));
3750
3751
  var busVariables = ["XDG_RUNTIME_DIR", "DBUS_SESSION_BUS_ADDRESS"];
3751
3752
  var systemdScopes = gen(function* () {
3752
3753
  if (process.platform !== "linux")
@@ -3766,7 +3767,7 @@ var systemdScopes = gen(function* () {
3766
3767
  `).filter((pid) => /^\d+$/.test(pid))).map(Number);
3767
3768
  });
3768
3769
  return {
3769
- contain: (runnerId, attemptId, argv) => map7(unitSuffix, (suffix) => {
3770
+ contain: (runnerId, attemptId, argv) => map8(unitSuffix, (suffix) => {
3770
3771
  const unit = `${unitPrefix(runnerId, attemptId)}${suffix}.scope`;
3771
3772
  const scoped = [
3772
3773
  "systemd-run",
@@ -3793,7 +3794,7 @@ var systemdScopes = gen(function* () {
3793
3794
  ])).split(`
3794
3795
  `).flatMap((line) => line.trim().split(/\s+/)[0] ?? []).filter((unit) => unit.endsWith(".scope"));
3795
3796
  const pids = yield* forEach(units, (unit) => flatMap3(systemd("systemctl", ["--user", "show", "--property=ControlGroup", "--value", unit]), (cgroup) => cgroup.trim() === "" ? succeed6([]) : cgroupProcesses(cgroup.trim())));
3796
- return yield* forEach([...new Set(pids.flat())], (pid) => map7(procCommand(fs, pid), (command) => ({ pid, command })));
3797
+ return yield* forEach([...new Set(pids.flat())], (pid) => map8(procCommand(fs, pid), (command) => ({ pid, command })));
3797
3798
  }).pipe(orElseSucceed(() => []))
3798
3799
  };
3799
3800
  });
@@ -3803,7 +3804,7 @@ var makeStepProcesses = (table, options = {}) => {
3803
3804
  const { scopes } = options;
3804
3805
  const unreaped = new Map;
3805
3806
  const pollMs = options.pollMs ?? 50;
3806
- const finding = (marker, scoped) => map7(all3([table.marked(marker), scoped]), ([marked, inScopes]) => {
3807
+ const finding = (marker, scoped) => map8(all3([table.marked(marker), scoped]), ([marked, inScopes]) => {
3807
3808
  const found = new Map([...marked, ...inScopes].map((candidate) => [candidate.pid, candidate]));
3808
3809
  found.delete(process.pid);
3809
3810
  return [...found.values()];
@@ -3885,13 +3886,13 @@ var stepProcessesUncontained = (input) => {
3885
3886
  return {
3886
3887
  code: "processes_uncontained",
3887
3888
  message: `Agents run on \`${input.sandbox}\` without a systemd user scope, so a process one starts in a session of its own with a cleared environment outlives its Step unseen.`,
3888
- fix: platform === "linux" ? "Run the Runner where `systemd-run --user --scope true` works, such as after `loginctl enable-linger`, or set `KITMAN_RUNNER_SANDBOX=srt` or `docker`." : "Set `KITMAN_RUNNER_SANDBOX=docker`, or run the Runner on Linux."
3889
+ fix: platform === "linux" ? "Run the Runner where `systemd-run --user --scope true` works, such as after `loginctl enable-linger`, or set the sandbox in the Runner settings to srt or docker." : "Set the Runner's sandbox to docker in its settings, or run the Runner on Linux."
3889
3890
  };
3890
3891
  };
3891
3892
 
3892
3893
  class StepProcesses extends Service2()("StepProcesses") {
3893
3894
  }
3894
- var stepProcessesLayer = effect(StepProcesses, map7(systemProcessTable, (table) => makeStepProcesses(table)));
3895
+ var stepProcessesLayer = effect(StepProcesses, map8(systemProcessTable, (table) => makeStepProcesses(table)));
3895
3896
  var systemStepProcessesLayer = effect(StepProcesses, gen(function* () {
3896
3897
  const table = yield* systemProcessTable;
3897
3898
  return makeStepProcesses(table, { scopes: yield* systemdScopes });
@@ -4109,7 +4110,7 @@ var runAttempt = (request, options) => gen(function* () {
4109
4110
  if (harnessesUnsupportedInSrt2.includes(adapter.id))
4110
4111
  return yield* new AgentStepFailure({
4111
4112
  reason: "harness_unsupported_in_sandbox",
4112
- summary: "Codex cannot run in srt yet, because it writes to ~/.codex. Run this Step with another Harness, or set KITMAN_RUNNER_SANDBOX=host on a personal Runner."
4113
+ summary: "Codex cannot run in srt yet, because it writes to ~/.codex. Run this Step with another Harness, or set the sandbox of a personal Runner to host in its settings."
4113
4114
  });
4114
4115
  const sessions = worktreeSessionDirectory(adapter, options.home, workspace);
4115
4116
  const loginValues = yield* inheritedEnvironment2(adapter.loginSecrets ?? []);
@@ -4189,7 +4190,7 @@ var runAttempt = (request, options) => gen(function* () {
4189
4190
  env: {},
4190
4191
  command: ["sh", "-c", 'p=$(command -v -- "$1") && [ -f "$p" ] && [ -x "$p" ]', "sh", command],
4191
4192
  timeout: "30 seconds"
4192
- }).pipe(map7((result) => result.exitCode === 0), mapError2(() => unavailable)));
4193
+ }).pipe(map8((result) => result.exitCode === 0), mapError2(() => unavailable)));
4193
4194
  const env = { ...policy.environment, ...marker };
4194
4195
  return { argv: dockerExecArgv({ container, workspace, env, argv: harnessArgv }), env, registry };
4195
4196
  }
@@ -4280,7 +4281,7 @@ var runAttempt = (request, options) => gen(function* () {
4280
4281
  const brief = firstMessage(request.launch, workspace, launch.systemBrief === true);
4281
4282
  const readyTurn = ready.value.turn;
4282
4283
  const deliver = (tries) => gen(function* () {
4283
- const sent = yield* result(call((connection) => map7(connection.send(address, brief), (reply) => ({ turn: reply.turn, lost: false })), () => succeed6({ turn: readyTurn, lost: true })));
4284
+ const sent = yield* result(call((connection) => map8(connection.send(address, brief), (reply) => ({ turn: reply.turn, lost: false })), () => succeed6({ turn: readyTurn, lost: true })));
4284
4285
  if (isFailure(sent) || sent.success.lost || tries <= 1)
4285
4286
  return sent;
4286
4287
  const taken = yield* until(seen, stirredSince(sent.success.turn)).pipe(timeoutOption(options.briefAckMs));
@@ -4363,7 +4364,7 @@ var herdrCoreAgentBackendLayer = (options) => effect(AgentBackend, gen(function*
4363
4364
  });
4364
4365
  }));
4365
4366
  // packages/agent-runtime/src/sandbox-host.ts
4366
- var installed = (probe, command, label) => map7(probe("sh", ["-c", `command -v ${command}`]), (found) => found ? [] : [`${label} is not installed`]);
4367
+ var installed = (probe, command, label) => map8(probe("sh", ["-c", `command -v ${command}`]), (found) => found ? [] : [`${label} is not installed`]);
4367
4368
  var srtMissing = (probe, platform) => gen(function* () {
4368
4369
  if (platform === "darwin")
4369
4370
  return [
@@ -4385,9 +4386,9 @@ var srtMissing = (probe, platform) => gen(function* () {
4385
4386
  "unprivileged user namespaces are not allowed (on Ubuntu: sysctl kernel.apparmor_restrict_unprivileged_userns=0)"
4386
4387
  ];
4387
4388
  });
4388
- var dockerMissing = (probe, image) => map7(probe("docker", ["info"]), (reachable) => [
4389
+ var dockerMissing = (probe, image) => map8(probe("docker", ["info"]), (reachable) => [
4389
4390
  ...reachable ? [] : ["the docker daemon is not reachable"],
4390
- ...image === undefined ? ["KITMAN_RUNNER_DOCKER_IMAGE is not set"] : /@sha256:[a-f0-9]{64}$/.test(image) ? [] : ["KITMAN_RUNNER_DOCKER_IMAGE is not pinned by digest (image@sha256:...)"]
4391
+ ...image === undefined ? ["its settings name no Docker image"] : /@sha256:[a-f0-9]{64}$/.test(image) ? [] : ["its Docker image is not pinned by digest (image@sha256:...)"]
4391
4392
  ]);
4392
4393
  var probeSandboxHost = (probe, platform = process.platform, options = {}) => gen(function* () {
4393
4394
  const srt = yield* srtMissing(probe, platform);
@@ -4404,7 +4405,7 @@ var probeSandboxHost = (probe, platform = process.platform, options = {}) => gen
4404
4405
  ]
4405
4406
  };
4406
4407
  });
4407
- var commandHostProbe = map7(ChildProcessSpawner, (spawner) => (command, args) => runCommand2(command, args, { timeout: "10 seconds" }).pipe(as(true), orElseSucceed(() => false), provideService(ChildProcessSpawner, spawner)));
4408
+ var commandHostProbe = map8(ChildProcessSpawner, (spawner) => (command, args) => runCommand2(command, args, { timeout: "10 seconds" }).pipe(as(true), orElseSucceed(() => false), provideService(ChildProcessSpawner, spawner)));
4408
4409
  // packages/oversight/src/domain/intent.ts
4409
4410
  var ConstraintKind = Literals(["rule", "semantic"]);
4410
4411
  var ConstraintSeverity = Literals(["block", "warn"]);
@@ -4581,14 +4582,14 @@ var diffFlags = ["--no-color", "--no-ext-diff", "--no-textconv", "--no-renames",
4581
4582
  var catchUpReport = (worktree, input) => gen(function* () {
4582
4583
  const git = (...args) => runCommand2("git", ["-C", worktree, ...args]);
4583
4584
  const target = `origin/${input.target}`;
4584
- const names = (from, to) => map7(git("diff", "--name-only", "-z", "--no-renames", from, to), (out) => out.split("\x00").filter(Boolean));
4585
- const ownDiff = (base, head, path) => map7(git("diff", ...diffFlags, base, head, "--", `:(literal,top)${path}`), normalizedDiff);
4585
+ const names = (from, to) => map8(git("diff", "--name-only", "-z", "--no-renames", from, to), (out) => out.split("\x00").filter(Boolean));
4586
+ const ownDiff = (base, head, path) => map8(git("diff", ...diffFlags, base, head, "--", `:(literal,top)${path}`), normalizedDiff);
4586
4587
  const before = (yield* git("merge-base", input.from, target)).trim();
4587
4588
  const after = (yield* git("merge-base", input.head, target)).trim();
4588
4589
  const settled = input.automerged === undefined ? [] : (yield* names(input.automerged, input.merged)).filter((path) => !input.conflicted.includes(path));
4589
4590
  const rewritten = [...new Set([...settled, ...yield* names(input.merged, input.head)])].sort();
4590
4591
  const paths = [...new Set([...yield* names(before, input.from), ...yield* names(after, input.head)])].sort();
4591
- const changed = yield* filter3(paths.slice(0, catchUpPathLimit), (path) => map7(all3([ownDiff(before, input.from, path), ownDiff(after, input.head, path)]), ([was, is]) => was !== is), { concurrency: 8 });
4592
+ const changed = yield* filter3(paths.slice(0, catchUpPathLimit), (path) => map8(all3([ownDiff(before, input.from, path), ownDiff(after, input.head, path)]), ([was, is]) => was !== is), { concurrency: 8 });
4592
4593
  const lists = [input.conflicted, rewritten, paths];
4593
4594
  return {
4594
4595
  from: input.from,
@@ -4757,7 +4758,7 @@ var failedWhenUnrun = (label) => (execution) => {
4757
4758
  };
4758
4759
  var makeReplicaSignals = sync2(() => {
4759
4760
  let generation = 0;
4760
- let nextWork = makeUnsafe4();
4761
+ let nextWork = makeUnsafe5();
4761
4762
  const stops = new Map;
4762
4763
  const mailboxes = new Map;
4763
4764
  const mailboxFor = (workUnitId) => {
@@ -4767,8 +4768,8 @@ var makeReplicaSignals = sync2(() => {
4767
4768
  const created = {
4768
4769
  notes: [],
4769
4770
  seen: new Set,
4770
- arrived: makeUnsafe4(),
4771
- updated: makeUnsafe4()
4771
+ arrived: makeUnsafe5(),
4772
+ updated: makeUnsafe5()
4772
4773
  };
4773
4774
  mailboxes.set(workUnitId, created);
4774
4775
  return created;
@@ -4779,14 +4780,14 @@ var makeReplicaSignals = sync2(() => {
4779
4780
  if (note !== undefined)
4780
4781
  return succeed6(note);
4781
4782
  if (isDoneUnsafe(mailbox.arrived))
4782
- mailbox.arrived = makeUnsafe4();
4783
+ mailbox.arrived = makeUnsafe5();
4783
4784
  return andThen2(_await(mailbox.arrived), nextSteer(workUnitId));
4784
4785
  });
4785
4786
  const stopFor = (workUnitId) => {
4786
4787
  const existing = stops.get(workUnitId);
4787
4788
  if (existing !== undefined)
4788
4789
  return existing;
4789
- const created = makeUnsafe4();
4790
+ const created = makeUnsafe5();
4790
4791
  stops.set(workUnitId, created);
4791
4792
  return created;
4792
4793
  };
@@ -4798,7 +4799,7 @@ var makeReplicaSignals = sync2(() => {
4798
4799
  WorkAvailable: () => {
4799
4800
  generation += 1;
4800
4801
  const signalled = nextWork;
4801
- nextWork = makeUnsafe4();
4802
+ nextWork = makeUnsafe5();
4802
4803
  doneUnsafe(signalled, void_2);
4803
4804
  },
4804
4805
  LeaseRevoked: ({ workUnitId }) => stop(workUnitId, "lost"),
@@ -4831,7 +4832,7 @@ var makeReplicaSignals = sync2(() => {
4831
4832
  sessionUpdated: (workUnitId) => suspend3(() => {
4832
4833
  const mailbox = mailboxFor(workUnitId);
4833
4834
  return andThen2(_await(mailbox.updated), sync2(() => {
4834
- mailbox.updated = makeUnsafe4();
4835
+ mailbox.updated = makeUnsafe5();
4835
4836
  }));
4836
4837
  }),
4837
4838
  forget: (workUnitId) => sync2(() => {
@@ -4896,11 +4897,12 @@ function runReplica(control, executor, signals) {
4896
4897
  })), ensuring2(suspend3(() => completed || leaseLost ? void_3 : call("release", () => control.release(work.id, lease, crashed)).pipe(timeout(releaseTimeout), catch_((error) => logWarning("runner_release_failed", error.message))))), ensuring2(control.finished?.() ?? void_3));
4897
4898
  }));
4898
4899
  }
4900
+ var ConcurrencyRecheck = seconds(1);
4899
4901
  var IdleRecheck = seconds(60);
4900
4902
  var idleBackoff = (idleIterations) => millis(Math.min(1000 * 2 ** idleIterations, 30000));
4901
4903
  function superviseReplica(input) {
4902
4904
  const { signals } = input;
4903
- const claimTurn = makeUnsafe2(1);
4905
+ const claimTurn = makeUnsafe3(1);
4904
4906
  let emptyAt = -1;
4905
4907
  const wokenControl = (control, signals) => ({
4906
4908
  ...control,
@@ -4914,10 +4916,14 @@ function superviseReplica(input) {
4914
4916
  return claimed;
4915
4917
  }))
4916
4918
  });
4917
- const runSlot = (capacitySlot) => gen(function* () {
4919
+ const runSlot = (capacitySlot, index) => gen(function* () {
4918
4920
  let idleIterations = 0;
4919
4921
  let woken = true;
4920
4922
  while (true) {
4923
+ if (input.concurrency !== undefined && index >= (yield* input.concurrency)) {
4924
+ yield* sleep(ConcurrencyRecheck);
4925
+ continue;
4926
+ }
4921
4927
  const seen = signals === undefined ? 0 : yield* signals.generation;
4922
4928
  const control = input.control(capacitySlot);
4923
4929
  const exit2 = yield* exit(runReplica(signals !== undefined && woken ? wokenControl(control, signals) : control, input.executor, signals));
@@ -5386,7 +5392,7 @@ var transcriptRelay = (input) => {
5386
5392
  passOver(last);
5387
5393
  batchLimit = batchSize;
5388
5394
  };
5389
- const givesUp = (error, lastChance) => map7(currentTimeMillis, (now) => {
5395
+ const givesUp = (error, lastChance) => map8(currentTimeMillis, (now) => {
5390
5396
  if (lastChance || sendRefusal(error) === "refused")
5391
5397
  return true;
5392
5398
  failingSince ??= now;
@@ -5556,7 +5562,7 @@ var transcriptRelay = (input) => {
5556
5562
  });
5557
5563
  return {
5558
5564
  record,
5559
- stalledFor: (millis) => map7(currentTimeMillis, (now) => asking.size === 0 && progressAt !== undefined && now - progressAt >= millis),
5565
+ stalledFor: (millis) => map8(currentTimeMillis, (now) => asking.size === 0 && progressAt !== undefined && now - progressAt >= millis),
5560
5566
  asking: sync2(() => asking.size > 0),
5561
5567
  loginLost: sync2(() => loginLost),
5562
5568
  refusal: sync2(() => refusal),
@@ -5636,7 +5642,7 @@ var gitRemote = (repoBinding, credential) => {
5636
5642
  };
5637
5643
  var clonePermits = new Map;
5638
5644
  var inClone = (directory) => (effect) => {
5639
- const permit = clonePermits.get(directory) ?? makeUnsafe2(1);
5645
+ const permit = clonePermits.get(directory) ?? makeUnsafe3(1);
5640
5646
  clonePermits.set(directory, permit);
5641
5647
  return permit.withPermits(1)(effect);
5642
5648
  };
@@ -5644,7 +5650,7 @@ var repositoryClone = (rootDir, repoBindingId) => `${rootDir}/repos/${repoBindin
5644
5650
  var runCheckouts = (rootDir, credentials) => {
5645
5651
  const runsDir = `${rootDir}/runs`;
5646
5652
  const reposDir = `${rootDir}/repos`;
5647
- const remote = (repoBinding) => map7(credentials === undefined ? undefined_ : credentials(repoBinding.id).pipe(catch_((error) => as(logWarning("runner_git_credential_unavailable", error.message), undefined))), (credential) => gitRemote(repoBinding, credential));
5653
+ const remote = (repoBinding) => map8(credentials === undefined ? undefined_ : credentials(repoBinding.id).pipe(catch_((error) => as(logWarning("runner_git_credential_unavailable", error.message), undefined))), (credential) => gitRemote(repoBinding, credential));
5648
5654
  const cloned = (repoBinding) => gen(function* () {
5649
5655
  const fs = yield* FileSystem;
5650
5656
  const forbidden = findForbiddenRepoBindingSecretPath(repoBinding);
@@ -5671,9 +5677,9 @@ var runCheckouts = (rootDir, credentials) => {
5671
5677
  });
5672
5678
  const fetch = (directory, env) => runCommand2("git", ["-C", directory, ...stallLimit, "fetch", "--prune", "origin"], { ...transfer, env });
5673
5679
  const inCloneOf = (repoBinding) => inClone(repositoryClone(rootDir, repoBinding.id));
5674
- const clone = (repoBinding) => inCloneOf(repoBinding)(map7(cloned(repoBinding), ({ directory }) => directory));
5675
- const transferEnv = (repoBinding) => repoBinding === undefined ? succeed6({}) : map7(remote(repoBinding), ({ env }) => env);
5676
- const holds = (directory, revision) => revision === undefined || !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(revision) ? succeed6(false) : map7(exit(runCommand2("git", ["-C", directory, "cat-file", "-e", `${revision}^{commit}`])), isSuccess2);
5680
+ const clone = (repoBinding) => inCloneOf(repoBinding)(map8(cloned(repoBinding), ({ directory }) => directory));
5681
+ const transferEnv = (repoBinding) => repoBinding === undefined ? succeed6({}) : map8(remote(repoBinding), ({ env }) => env);
5682
+ const holds = (directory, revision) => revision === undefined || !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(revision) ? succeed6(false) : map8(exit(runCommand2("git", ["-C", directory, "cat-file", "-e", `${revision}^{commit}`])), isSuccess2);
5677
5683
  const checkout = (work, repoBinding, checkpoint) => gen(function* () {
5678
5684
  const fs = yield* FileSystem;
5679
5685
  const path = yield* Path;
@@ -5782,7 +5788,7 @@ var runChange = (worktree, runBase) => gen(function* () {
5782
5788
  const git = (...args) => runCommand2("git", ["-C", worktree, ...args]);
5783
5789
  const base = (yield* git("merge-base", "HEAD", runBase)).trim();
5784
5790
  const changedPaths = (yield* git("diff", "--name-only", "-z", "--no-renames", base, "HEAD")).split("\x00").filter((path) => path !== "");
5785
- const files = yield* forEach(changedPaths.slice(0, EvidenceLimits.files).filter((path) => !looksSecret(path)), (path) => map7(git("diff", "--no-color", "--no-renames", base, "HEAD", "--", `:(literal)${path}`), (diff) => ({
5791
+ const files = yield* forEach(changedPaths.slice(0, EvidenceLimits.files).filter((path) => !looksSecret(path)), (path) => map8(git("diff", "--no-color", "--no-renames", base, "HEAD", "--", `:(literal)${path}`), (diff) => ({
5786
5792
  path,
5787
5793
  diff
5788
5794
  })));
@@ -5801,7 +5807,7 @@ var keepSession = (rpc, lease, content) => gen(function* () {
5801
5807
  yield* fs.writeFile(path, content);
5802
5808
  const files = {
5803
5809
  createRunFile: ({ byteSize, sha256 }) => rpc.createCheckpointFile({ lease, byteSize, sha256 }),
5804
- runFileParts: (request) => map7(rpc.checkpointFileParts({ lease, ...request, partNumbers: [...request.partNumbers] }), ({ parts }) => parts),
5810
+ runFileParts: (request) => map8(rpc.checkpointFileParts({ lease, ...request, partNumbers: [...request.partNumbers] }), ({ parts }) => parts),
5805
5811
  completeRunFile: ({ parts, ...request }) => rpc.completeCheckpointFile({ lease, ...request, ...parts === undefined ? undefined : { parts: [...parts] } })
5806
5812
  };
5807
5813
  const kept = yield* uploadRunFile(files, { step: "", name: "session.gz", path });
@@ -5849,7 +5855,7 @@ var stageAll = (worktree, git) => gen(function* () {
5849
5855
  yield* git("add", "--all", "--", ".", ...leftovers.map((name) => `:(exclude,top)${name}`));
5850
5856
  });
5851
5857
  var conflictMarker = "^(<<<<<<<|>>>>>>>)( |$)";
5852
- var markedPaths = (git, paths, ...from) => git("grep", ...from, "-l", "-z", "-E", conflictMarker, "--", ...paths.map((path) => `:(literal,top)${path}`)).pipe(catchIf((error) => error.reason === "exit code 1", () => succeed6("")), map7((out) => out.split("\x00").filter(Boolean)));
5858
+ var markedPaths = (git, paths, ...from) => git("grep", ...from, "-l", "-z", "-E", conflictMarker, "--", ...paths.map((path) => `:(literal,top)${path}`)).pipe(catchIf((error) => error.reason === "exit code 1", () => succeed6("")), map8((out) => out.split("\x00").filter(Boolean)));
5853
5859
  var list = (paths) => paths.join(", ");
5854
5860
  var unmarkedConflicts = (worktree, conflicted, marked) => gen(function* () {
5855
5861
  const stages = new Map;
@@ -5886,7 +5892,7 @@ var automergedTree = (worktree, conflicted) => gen(function* () {
5886
5892
  const scratchIndex = `${index}.kitman-automerged`;
5887
5893
  const git = (...args) => runCommand2("git", ["-C", worktree, ...args], { env: { GIT_INDEX_FILE: scratchIndex } });
5888
5894
  yield* fs.copyFile(index, scratchIndex);
5889
- return yield* ensuring2(andThen2(git("update-index", "--force-remove", "--", ...conflicted), map7(git("write-tree"), (tree) => tree.trim())), ignore(fs.remove(scratchIndex)));
5895
+ return yield* ensuring2(andThen2(git("update-index", "--force-remove", "--", ...conflicted), map8(git("write-tree"), (tree) => tree.trim())), ignore(fs.remove(scratchIndex)));
5890
5896
  });
5891
5897
  var mergeTarget = (worktree, target) => gen(function* () {
5892
5898
  const git = (...args) => runCommand2("git", ["-C", worktree, ...gitIdentity, ...args]);
@@ -5986,7 +5992,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
5986
5992
  const merge = merging === undefined ? undefined : yield* mergeTarget(worktree, merging);
5987
5993
  const notes = [...work.resumeNotes ?? [], ...merge === undefined ? [] : [merge.note]];
5988
5994
  const configDir = yield* (yield* FileSystem).makeTempDirectoryScoped({ prefix: "kitman-harness-" }).pipe(orDie);
5989
- const backend = work.sandbox ?? input.sandbox;
5995
+ const backend = work.sandbox ?? (isFunction2(input.sandbox) ? input.sandbox(work) : input.sandbox);
5990
5996
  const writableSessions = adapter === undefined ? undefined : worktreeSessionDirectory(adapter, home, worktree);
5991
5997
  if (backend === "srt" && writableSessions !== undefined)
5992
5998
  yield* freshDirectory(writableSessions);
@@ -6002,7 +6008,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6002
6008
  };
6003
6009
  const sessionId = transcript !== undefined || adapter?.session?.start !== undefined ? session.id : undefined;
6004
6010
  let last = saved?.ref === checkpointRef(work) ? saved : {};
6005
- const checkpointTurn = makeUnsafe2(1);
6011
+ const checkpointTurn = makeUnsafe3(1);
6006
6012
  const takeCheckpoint = gen(function* () {
6007
6013
  if (input.checkpoints === undefined)
6008
6014
  return;
@@ -6092,7 +6098,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6092
6098
  ...refusal.until === undefined ? undefined : { until: refusal.until },
6093
6099
  ...backend === "docker" ? { scope: "step" } : undefined
6094
6100
  });
6095
- const outputSubmitted = input.heartbeat(work).pipe(option2, map7((state) => isSome(state) && state.value.outputSubmitted === true));
6101
+ const outputSubmitted = input.heartbeat(work).pipe(option2, map8((state) => isSome(state) && state.value.outputSubmitted === true));
6096
6102
  const providerRefused = relay === undefined ? never : gen(function* () {
6097
6103
  for (;; ) {
6098
6104
  yield* sleep("1 second");
@@ -6141,7 +6147,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6141
6147
  const state = isSuccess2(exit) ? exit.value.status : hasInterrupts(exit) ? "canceled" : "failed";
6142
6148
  yield* relayed.pipe(timeout("5 seconds"), ignore);
6143
6149
  yield* andThen2(relay.record([{ kind: "lifecycle", state }]), relay.lastFlush).pipe(timeout("5 seconds"), ignore);
6144
- const sending = yield* forkIn(relay.sendRest, input.runnerScope ?? makeUnsafe5());
6150
+ const sending = yield* forkIn(relay.sendRest, input.runnerScope ?? makeUnsafe6());
6145
6151
  resending.set(work.id, sending);
6146
6152
  if (state !== "parked")
6147
6153
  sending.addObserver(() => resending.delete(work.id));
@@ -6383,7 +6389,7 @@ var harnessesInSrt = (input) => gen(function* () {
6383
6389
  missing: [
6384
6390
  `\`${entry.harness} --version\` does not start in srt from any \`${entry.harness}\` on the Runner's PATH`,
6385
6391
  ...entry.candidates.slice(0, 10).map((binary) => `tried ${binary}`.slice(0, 240)),
6386
- "put an install that needs no write to your home directory on the Runner's PATH, or set KITMAN_RUNNER_SANDBOX=host"
6392
+ "put an install that needs no write to your home directory on the Runner's PATH, or set the Runner's sandbox to host in its settings"
6387
6393
  ]
6388
6394
  }))
6389
6395
  ]
@@ -6798,7 +6804,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
6798
6804
  return {
6799
6805
  request: (method, params) => gen(function* () {
6800
6806
  const id = ++lastId;
6801
- const deferred = yield* make15();
6807
+ const deferred = yield* make16();
6802
6808
  pending.set(id, deferred);
6803
6809
  yield* send({ id, method, params });
6804
6810
  return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
@@ -6899,7 +6905,7 @@ function composeAgentEnvironmentSyncPlan(targets) {
6899
6905
  }
6900
6906
  var updateHarness = (argv) => gen(function* () {
6901
6907
  const run = yield* CommandRunner2;
6902
- const failure = yield* run(argv).pipe(map7((result) => result.exitCode === 0 ? undefined : result.output.trim().split(`
6908
+ const failure = yield* run(argv).pipe(map8((result) => result.exitCode === 0 ? undefined : result.output.trim().split(`
6903
6909
  `).at(-1) ?? `exit code ${result.exitCode}`), catch_((error) => succeed6(error.message)));
6904
6910
  return failure === undefined ? [] : [`Kitman could not update ${argv[0]} with \`${argv.join(" ")}\`: ${failure}`];
6905
6911
  });
@@ -6912,10 +6918,10 @@ var applyAgentEnvironmentPlans = fnUntraced(function* (plan) {
6912
6918
  const updateWarnings = yield* forEach(plan.targets, (target) => target.harnessUpdater === undefined ? succeed6([]) : updateHarness(target.harnessUpdater));
6913
6919
  for (const target of plan.targets)
6914
6920
  yield* applyAgentEnvironmentConfigSync(target.harnessConfig).pipe(mapError2((cause) => new AgentEnvironmentPlanApplyError({ phase: "harness_config", cause })));
6915
- const targets = yield* forEach(plan.targets, (target, index) => map7(target.skills.codexHookTrust === undefined ? succeed6([]) : trustCodexPluginHooks({
6921
+ const targets = yield* forEach(plan.targets, (target, index) => map8(target.skills.codexHookTrust === undefined ? succeed6([]) : trustCodexPluginHooks({
6916
6922
  ...target.skills.codexHookTrust,
6917
6923
  plugins: target.skills.materializedPlugins.map((plugin) => plugin.name)
6918
- }), (trustWarnings) => [...updateWarnings[index] ?? [], ...trustWarnings]).pipe(map7((warnings) => ({
6924
+ }), (trustWarnings) => [...updateWarnings[index] ?? [], ...trustWarnings]).pipe(map8((warnings) => ({
6919
6925
  ...target,
6920
6926
  skills: { ...target.skills, warnings: [...target.skills.warnings, ...warnings.map((message) => ({ message }))] },
6921
6927
  warnings: [...target.warnings, ...warnings]
@@ -6941,7 +6947,7 @@ var kitmanMcpPreflight = (mcp) => gen(function* () {
6941
6947
  const server = yield* spawner.spawn(make3(mcp.command, [...mcp.args], {
6942
6948
  extendEnv: true,
6943
6949
  env: mcp.env,
6944
- stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
6950
+ stdin: { stream: make11(new TextEncoder().encode(handshake)), endOnDone: false },
6945
6951
  stderr: "ignore"
6946
6952
  }));
6947
6953
  const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
@@ -7003,7 +7009,7 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
7003
7009
  storageOrigin: work.storageOrigin,
7004
7010
  network: work.network
7005
7011
  });
7006
- const inherited = (yield* forEach(inheritedEnv, (name) => map7(optionalEnv(name), (value) => value === undefined ? [] : [[name, value]]))).flat();
7012
+ const inherited = (yield* forEach(inheritedEnv, (name) => map8(optionalEnv(name), (value) => value === undefined ? [] : [[name, value]]))).flat();
7007
7013
  const programEnv = {
7008
7014
  BUN_BE_BUN: "1",
7009
7015
  KITMAN_LOOP_ID: program.loopId,
@@ -7015,7 +7021,7 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
7015
7021
  const exitCode = sandbox === undefined ? yield* gen(function* () {
7016
7022
  const spawner = yield* ChildProcessSpawner;
7017
7023
  const handle = yield* spawner.spawn(make3(input.bun ?? process.execPath, [file], {
7018
- stdin: make10(new TextEncoder().encode(stdin)),
7024
+ stdin: make11(new TextEncoder().encode(stdin)),
7019
7025
  stdout: "inherit",
7020
7026
  stderr: "inherit",
7021
7027
  extendEnv: false,
@@ -7291,7 +7297,7 @@ var redactedCopy = (from, to) => gen(function* () {
7291
7297
  var checkFileKeeper = (work, runFiles, storage) => {
7292
7298
  const files = rpcRunFiles(runFiles, programLease(work));
7293
7299
  let left = checkFilesPerVerification;
7294
- const keep = (name, path) => uploadRunFile(files, { step: work.stepKey, name, path }).pipe(provideService(HttpClient, storage), map7((file) => file.status === "available" ? [file.id] : []), catch_((error) => as(logWarning("check_run_file_not_kept", `${name}: ${error.message}`), [])));
7300
+ const keep = (name, path) => uploadRunFile(files, { step: work.stepKey, name, path }).pipe(provideService(HttpClient, storage), map8((file) => file.status === "available" ? [file.id] : []), catch_((error) => as(logWarning("check_run_file_not_kept", `${name}: ${error.message}`), [])));
7295
7301
  return (input) => gen(function* () {
7296
7302
  const path = yield* Path;
7297
7303
  const log = `${input.output}.log`;
@@ -7306,7 +7312,7 @@ var reportedTests = (filesDir) => gen(function* () {
7306
7312
  const fs = yield* FileSystem;
7307
7313
  const path = yield* Path;
7308
7314
  const names = (yield* regularFiles(filesDir)).filter(isTestReportName);
7309
- const reports = yield* forEach(names, (name) => fs.readFileString(path.join(filesDir, name)).pipe(map7((text) => [text]), orElseSucceed(() => [])));
7315
+ const reports = yield* forEach(names, (name) => fs.readFileString(path.join(filesDir, name)).pipe(map8((text) => [text]), orElseSucceed(() => [])));
7310
7316
  return checkTests(reports.flat());
7311
7317
  }).pipe(orElseSucceed(() => checkTests([])));
7312
7318
 
@@ -7336,7 +7342,7 @@ var decodeListeningPort = decodeUnknownEffect2(Struct({ port: Finite }));
7336
7342
  var pipelineDaemon = (services, check) => gen(function* () {
7337
7343
  if (services.docker === undefined)
7338
7344
  return yield* new ServicesUnavailable({
7339
- reason: `The pipeline check ${check} runs with a Docker daemon of its own, and this Runner cannot start one: set KITMAN_RUNNER_CHECK_DOCKER_IMAGE to a docker:*-dind-rootless image and KITMAN_RUNNER_CHECK_REGISTRY_IMAGE to a registry:3 image, each pinned by digest.`
7345
+ reason: `The pipeline check ${check} runs with a Docker daemon of its own, and this Runner cannot start one: set its checkDockerImage setting to a docker:*-dind-rootless image and its checkRegistryImage setting to a registry:3 image, each pinned by digest, then restart it.`
7340
7346
  });
7341
7347
  const fs = yield* FileSystem;
7342
7348
  const started = yield* services.docker({ id: services.id, network: services.network }).pipe(mapError2((error) => new ServicesUnavailable({ reason: error.message })));
@@ -7449,7 +7455,7 @@ var unresolvedDependencies = (worktree) => gen(function* () {
7449
7455
  }).pipe(orElseSucceed(() => {
7450
7456
  return;
7451
7457
  }));
7452
- const manifestAt = (dir) => fs.readFileString(path.join(dir, "package.json")).pipe(map7((text) => getOrUndefined(decodeJsonStringOption(text))), orElseSucceed(() => {
7458
+ const manifestAt = (dir) => fs.readFileString(path.join(dir, "package.json")).pipe(map8((text) => getOrUndefined(decodeJsonStringOption(text))), orElseSucceed(() => {
7453
7459
  return;
7454
7460
  }));
7455
7461
  const unresolved = [];
@@ -7676,7 +7682,7 @@ var resolveRevisions = (work, revisions, checkouts) => gen(function* () {
7676
7682
  };
7677
7683
  return resolved;
7678
7684
  });
7679
- var treeOf = (worktree) => map7(runCommand2("git", ["-C", worktree, "rev-parse", "HEAD^{tree}"]), (tree) => tree.trim());
7685
+ var treeOf = (worktree) => map8(runCommand2("git", ["-C", worktree, "rev-parse", "HEAD^{tree}"]), (tree) => tree.trim());
7680
7686
  var verificationExecutor = (input) => (work) => gen(function* () {
7681
7687
  if (input.sandbox !== undefined && input.sandbox.backend === undefined)
7682
7688
  return {