@kitman-sh/cli 0.10.98 → 0.10.100

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-nym2zmz3.js → chunk-0rf10v29.js} +4 -4
  2. package/dist/{chunk-g1xmj2nb.js → chunk-1k3cvdbt.js} +4 -4
  3. package/dist/{chunk-qrxkpwzy.js → chunk-1kww1jdz.js} +1 -1
  4. package/dist/{chunk-7c3pgktm.js → chunk-1nw7sbtr.js} +8 -8
  5. package/dist/{chunk-gfqm22x7.js → chunk-4c78jfqk.js} +5 -5
  6. package/dist/{chunk-s90hj0mb.js → chunk-5z0cwmet.js} +348 -120
  7. package/dist/{chunk-n8c1wh6t.js → chunk-6sanfepb.js} +4 -4
  8. package/dist/{chunk-fd39ch4n.js → chunk-9xj0djtp.js} +8 -8
  9. package/dist/{chunk-07p2dcq3.js → chunk-ayfdkptb.js} +100 -338
  10. package/dist/{chunk-6dc0x5cg.js → chunk-cpx45jzk.js} +8 -8
  11. package/dist/{chunk-j8vq6sk1.js → chunk-cy7cy84h.js} +19 -19
  12. package/dist/{chunk-xwhybbj2.js → chunk-gs6qdy2k.js} +2 -2
  13. package/dist/{chunk-95mkdtzk.js → chunk-hcpjfshb.js} +4 -4
  14. package/dist/{chunk-s5p94z8x.js → chunk-mjrr0wzp.js} +44 -44
  15. package/dist/{chunk-7ya2q09c.js → chunk-mk8vsaj7.js} +1 -1
  16. package/dist/{chunk-797w5qe6.js → chunk-mtz8f1hn.js} +7 -7
  17. package/dist/{chunk-p83y21hp.js → chunk-p3kwtm82.js} +4 -4
  18. package/dist/{chunk-cgjyv52e.js → chunk-qv9te9gr.js} +2 -2
  19. package/dist/{chunk-sy8d7bfa.js → chunk-r3rap6hz.js} +117 -105
  20. package/dist/{chunk-aba9zdpb.js → chunk-tk85pw4z.js} +144 -48
  21. package/dist/{chunk-bqg9gy2e.js → chunk-tqw2rkc9.js} +7 -7
  22. package/dist/{chunk-c6h3fhtb.js → chunk-vatjyw59.js} +11 -11
  23. package/dist/{chunk-3bjekzn7.js → chunk-wyh06par.js} +501 -193
  24. package/dist/{chunk-d1sqb8rt.js → chunk-wzkdjdb7.js} +1 -1
  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-wzkdjdb7.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
+ makeUnsafe5,
50
51
  make15,
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-ayfdkptb.js";
172
172
  import {
173
173
  Id,
174
174
  secretReference,
175
175
  secretPlaceholder
176
- } from "./chunk-qrxkpwzy.js";
176
+ } from "./chunk-1kww1jdz.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-wyh06par.js";
249
250
  import {
250
251
  join,
251
252
  interrupt,
@@ -253,7 +254,7 @@ import {
253
254
  publishUnsafe,
254
255
  unbounded2,
255
256
  offer,
256
- makeUnsafe2,
257
+ makeUnsafe3,
257
258
  make10,
258
259
  fromQueue,
259
260
  fromPubSub,
@@ -285,7 +286,7 @@ import {
285
286
  writeSrtSettings2,
286
287
  srtStepArgv2,
287
288
  srtArgv2
288
- } from "./chunk-s5p94z8x.js";
289
+ } from "./chunk-mjrr0wzp.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-cpx45jzk.js";
306
+ import"./chunk-tqw2rkc9.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-qv9te9gr.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-6sanfepb.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-1nw7sbtr.js";
332
+ import"./chunk-hcpjfshb.js";
332
333
  import {
333
334
  nextInt
334
- } from "./chunk-7ya2q09c.js";
335
+ } from "./chunk-mk8vsaj7.js";
335
336
  import {
336
337
  ChildProcessSpawner,
337
338
  make3
338
- } from "./chunk-p83y21hp.js";
339
- import"./chunk-c6h3fhtb.js";
339
+ } from "./chunk-p3kwtm82.js";
340
+ import"./chunk-vatjyw59.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: {
@@ -1699,6 +1700,7 @@ var HarnessAdapters = [
1699
1700
  ENABLE_TOOL_SEARCH: "false"
1700
1701
  },
1701
1702
  mcpToolTimeout: { kind: "env", variables: ["MCP_TOOL_TIMEOUT", "CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT"], unit: "ms" },
1703
+ tempDirectoryVariable: "CLAUDE_CODE_TMPDIR",
1702
1704
  session: {
1703
1705
  location: { root: ".claude/projects", layout: "per_directory", subagentFiles: true },
1704
1706
  start: ["--session-id", "{session}"],
@@ -1818,8 +1820,9 @@ var HarnessAdapters = [
1818
1820
  skills: { kind: "config_paths", root: "skills" },
1819
1821
  mcpToolTimeout: { kind: "server_field", field: "timeout", unit: "ms" },
1820
1822
  sessionDatabase: ".local/share/opencode/opencode.db",
1823
+ tempDirectoryVariable: "CLAUDE_CODE_TMPDIR",
1821
1824
  sandboxHome: {
1822
- directories: { XDG_DATA_HOME: "data", XDG_STATE_HOME: "state", CLAUDE_CODE_TMPDIR: "tmp" },
1825
+ directories: { XDG_DATA_HOME: "data", XDG_STATE_HOME: "state" },
1823
1826
  sessionDatabase: "data/opencode/opencode.db",
1824
1827
  login: { source: ".local/share/opencode/auth.json", path: "data/opencode/auth.json" },
1825
1828
  configHomeDirectory: "opencode"
@@ -1864,8 +1867,12 @@ function lacksLoginSecret(harness, secrets) {
1864
1867
  function resolveHarnessLaunch(input) {
1865
1868
  const kit = renewedLoginLaunch(input, agentDirLaunch(input, briefLaunch(input, kitSetupLaunch(input, skillsLaunch(input)))));
1866
1869
  const launch = input.adapter.env === undefined ? kit : { ...kit, env: { ...input.adapter.env, ...kit.env } };
1870
+ const temporary = input.adapter.tempDirectoryVariable === undefined ? launch : { ...launch, env: { ...launch.env, [input.adapter.tempDirectoryVariable]: `${input.configDir}/tmp` } };
1867
1871
  const effort = input.effort;
1868
- const effortful = effort === undefined || input.adapter.effortArgs === undefined ? launch : { ...launch, args: [...launch.args, ...input.adapter.effortArgs.map((arg) => arg.replace("{effort}", effort))] };
1872
+ const effortful = effort === undefined || input.adapter.effortArgs === undefined ? temporary : {
1873
+ ...temporary,
1874
+ args: [...temporary.args, ...input.adapter.effortArgs.map((arg) => arg.replace("{effort}", effort))]
1875
+ };
1869
1876
  return flagProbedLaunch(input.adapter, globalConfigLaunch(input, sandboxHomeLaunch(input, effortful)));
1870
1877
  }
1871
1878
  var sandboxedLaunch = (launch, backend) => {
@@ -2282,7 +2289,7 @@ var openCodeStore = (source) => gen(function* () {
2282
2289
  var runOpenCode = (binary, store, args) => runCommand2(binary, [...args, "--standalone"], { env: store.env, timeout: "30 seconds" });
2283
2290
  var readOpenCodeLogin = (binary, source) => gen(function* () {
2284
2291
  const store = yield* openCodeStore(source);
2285
- const exported = store === undefined ? none() : yield* runOpenCode(binary, store, ["auth", "export"]).pipe(map7(decodeExport), orElseSucceed(() => none()));
2292
+ const exported = store === undefined ? none() : yield* runOpenCode(binary, store, ["auth", "export"]).pipe(map8(decodeExport), orElseSucceed(() => none()));
2286
2293
  if (isNone(exported)) {
2287
2294
  const credentials = yield* fileCredentials(source);
2288
2295
  return credentials === undefined ? undefined : { credentials };
@@ -2329,17 +2336,17 @@ var renewers = {
2329
2336
  grant_type: "refresh_token",
2330
2337
  refresh_token: login.refresh,
2331
2338
  client_id: "9d1c250a-e61b-44d9-88ed-5944d1962f5e"
2332
- }))).pipe(map7(refreshed(now))),
2339
+ }))).pipe(map8(refreshed(now))),
2333
2340
  openai: (login, now) => answer("openai", TokenAnswer, post("https://auth.openai.com/oauth/token").pipe(bodyUrlParams({
2334
2341
  grant_type: "refresh_token",
2335
2342
  refresh_token: login.refresh,
2336
2343
  client_id: "app_EMoamEEZ73f0CkXaXp7hrann"
2337
- }))).pipe(map7(refreshed(now))),
2344
+ }))).pipe(map8(refreshed(now))),
2338
2345
  xai: (login, now) => answer("xai", XaiAnswer, post("https://auth.x.ai/oauth2/token").pipe(acceptJson, bodyUrlParams({
2339
2346
  grant_type: "refresh_token",
2340
2347
  refresh_token: login.refresh,
2341
2348
  client_id: "b1a00492-073a-47ea-816f-4c329264a828"
2342
- }))).pipe(map7((answered) => ({
2349
+ }))).pipe(map8((answered) => ({
2343
2350
  access: answered.access_token,
2344
2351
  ...answered.refresh_token === undefined ? undefined : { refresh: answered.refresh_token },
2345
2352
  expires: xaiExpiry(answered, now)
@@ -2348,8 +2355,8 @@ var renewers = {
2348
2355
  grant_type: "refresh_token",
2349
2356
  refresh_token: login.refresh,
2350
2357
  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 })))
2358
+ }))).pipe(map8(refreshed(now))),
2359
+ "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
2360
  };
2354
2361
  var renewerFor = (provider) => isKeyOf(renewers, provider) ? renewers[provider] : undefined;
2355
2362
  var renewableLogin = (provider, credential) => getOrUndefined(filter2(decodeRenewable(credential), (login) => renewerFor(provider) !== undefined && (provider !== "github-copilot" || login.access !== login.refresh)));
@@ -2380,7 +2387,7 @@ var replaceInFile = (source, provider, credential) => gen(function* () {
2380
2387
  });
2381
2388
  var renewalPermits = new Map;
2382
2389
  var oneRenewalAt = (source) => (effect) => {
2383
- const permit = renewalPermits.get(source) ?? makeUnsafe2(1);
2390
+ const permit = renewalPermits.get(source) ?? makeUnsafe3(1);
2384
2391
  renewalPermits.set(source, permit);
2385
2392
  return permit.withPermits(1)(effect);
2386
2393
  };
@@ -2414,7 +2421,7 @@ var filesUnder = (root) => gen(function* () {
2414
2421
  if (skipped.has(entry))
2415
2422
  continue;
2416
2423
  const path = relative === "" ? entry : `${relative}/${entry}`;
2417
- const type = yield* fs.stat(`${root}/${path}`).pipe(map7((info) => info.type), orElseSucceed(() => {
2424
+ const type = yield* fs.stat(`${root}/${path}`).pipe(map8((info) => info.type), orElseSucceed(() => {
2418
2425
  return;
2419
2426
  }));
2420
2427
  if (type === "Directory")
@@ -2430,7 +2437,7 @@ var dependenciesOf = (root, files) => gen(function* () {
2430
2437
  const fs = yield* FileSystem;
2431
2438
  const names = new Set;
2432
2439
  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(() => {
2440
+ const manifest = yield* fs.readFileString(`${root}/${file}`).pipe(map8((text) => decodeJsonStringSync(text)), orElseSucceed(() => {
2434
2441
  return;
2435
2442
  }));
2436
2443
  if (!isJsonObject(manifest))
@@ -2602,7 +2609,7 @@ var credentialsIn = (source) => gen(function* () {
2602
2609
  const credentials = getOrUndefined(decodeJsonStringOption(text));
2603
2610
  return isJsonObject(credentials) ? credentials : undefined;
2604
2611
  });
2605
- var loginCredentials = (login) => login.format === "opencode" ? map7(readOpenCodeLogin(login.binary, login.source), (read) => read?.credentials) : credentialsIn(login.source);
2612
+ var loginCredentials = (login) => login.format === "opencode" ? map8(readOpenCodeLogin(login.binary, login.source), (read) => read?.credentials) : credentialsIn(login.source);
2606
2613
  var neverExpires = 253402300799000;
2607
2614
  var isOAuth = (credential) => isJsonObject(credential) && credential.type === "oauth";
2608
2615
  var claudeOAuth = "claudeAiOauth";
@@ -2770,7 +2777,7 @@ var refreshOperatorLogin = (login, expired, http) => gen(function* () {
2770
2777
  }
2771
2778
  }
2772
2779
  });
2773
- var stepLogin = (login, reference) => map7(loginCredentials(login), (credentials) => {
2780
+ var stepLogin = (login, reference) => map8(loginCredentials(login), (credentials) => {
2774
2781
  if (credentials === undefined)
2775
2782
  return;
2776
2783
  const format = loginFormats[login.format];
@@ -2789,8 +2796,8 @@ var renewableStepLogin = (login, referenced, http) => gen(function* () {
2789
2796
  const expired = new Map;
2790
2797
  let published;
2791
2798
  let heldTokens;
2792
- const writing = makeUnsafe2(1);
2793
- const refreshing = makeUnsafe2(1);
2799
+ const writing = makeUnsafe3(1);
2800
+ const refreshing = makeUnsafe3(1);
2794
2801
  const copy = gen(function* () {
2795
2802
  const copied = yield* stepLogin(login, referenced?.reference);
2796
2803
  if (copied === undefined)
@@ -2849,7 +2856,7 @@ var loginHostsWithProviders = (operatorFiles) => gen(function* () {
2849
2856
  };
2850
2857
  return { ...login, hosts };
2851
2858
  });
2852
- var carriedLoginHosts = (launch) => launch.renewedLogin?.format === "opencode" ? map7(loginCredentials(launch.renewedLogin), openCodeConsoleHosts) : succeed6([]);
2859
+ var carriedLoginHosts = (launch) => launch.renewedLogin?.format === "opencode" ? map8(loginCredentials(launch.renewedLogin), openCodeConsoleHosts) : succeed6([]);
2853
2860
  var carriedProviderHosts = (launch) => gen(function* () {
2854
2861
  const providers = launch.operatorFiles?.providers;
2855
2862
  if (providers === undefined)
@@ -2990,7 +2997,7 @@ var writeHarnessFiles = (input) => gen(function* () {
2990
2997
  yield* every(loginRenewalMillis, true);
2991
2998
  if (renewed.format !== "opencode")
2992
2999
  yield* every(loginCopyMillis, false);
2993
- const watching = makeUnsafe4();
3000
+ const watching = makeUnsafe5();
2994
3001
  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
3002
  yield* _await(watching);
2996
3003
  });
@@ -2999,7 +3006,7 @@ var decodeSetupArchive = decodeEffect(fromJsonString(SetupArchive));
2999
3006
  var runsOnHost = (command) => gen(function* () {
3000
3007
  const fs = yield* FileSystem;
3001
3008
  const path = yield* Path;
3002
- const executable = (file) => fs.stat(file).pipe(map7((info) => info.type === "File" && (info.mode & 73) !== 0), orElseSucceed(() => false));
3009
+ const executable = (file) => fs.stat(file).pipe(map8((info) => info.type === "File" && (info.mode & 73) !== 0), orElseSucceed(() => false));
3003
3010
  if (command.includes("/"))
3004
3011
  return yield* executable(command);
3005
3012
  for (const directory of ((yield* optionalEnv("PATH")) ?? "").split(":"))
@@ -3027,7 +3034,7 @@ var stepKitSetup = (agent, harness) => gen(function* () {
3027
3034
  const fetch = agent.setupArchive;
3028
3035
  if (fetch === undefined)
3029
3036
  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);
3037
+ const setups = yield* forEach(kits, (kit) => fetch(kit.setupDigest).pipe(flatMap3(decodeSetupArchive), map8((archive) => ({ name: kit.name, version: kit.version, archive })))).pipe(result);
3031
3038
  if (isFailure(setups))
3032
3039
  return unavailable(setups.failure.message);
3033
3040
  const setup = materializeKitSetup(harness, [...setups.success, kitmanSkillEntry], agent.brief.listedSkills ?? []);
@@ -3057,11 +3064,11 @@ var Proto = {
3057
3064
  };
3058
3065
  }
3059
3066
  };
3060
- var make = (value) => map7(unbounded({
3067
+ var make = (value) => map8(unbounded({
3061
3068
  replay: 1
3062
3069
  }), (pubsub) => {
3063
3070
  const self = Object.create(Proto);
3064
- self.semaphore = makeUnsafe2(1);
3071
+ self.semaphore = makeUnsafe3(1);
3065
3072
  self.value = value;
3066
3073
  self.pubsub = pubsub;
3067
3074
  publishUnsafe(self.pubsub, value);
@@ -3266,7 +3273,7 @@ class ContainerError extends TaggedError("ContainerError") {
3266
3273
  class SecretProxyUnreachable extends TaggedError("SecretProxyUnreachable") {
3267
3274
  }
3268
3275
  var imagePull = { timeout: "30 minutes" };
3269
- var dockerContainerRunner = map7(ChildProcessSpawner, (spawner) => {
3276
+ var dockerContainerRunner = map8(ChildProcessSpawner, (spawner) => {
3270
3277
  const docker = (args, options = {}) => runCommand2("docker", args, options).pipe(mapError2((error) => new ContainerError({ message: error.message })), provideService(ChildProcessSpawner, spawner));
3271
3278
  const labelArgs = (labels) => labels.flatMap(([key, value]) => ["--label", `${key}=${value}`]);
3272
3279
  const ids = (output) => output.split(`
@@ -3312,7 +3319,7 @@ var dockerContainerRunner = map7(ChildProcessSpawner, (spawner) => {
3312
3319
  const filter = ["--filter", `label=${key}=${value}`];
3313
3320
  const containers = ids(yield* docker(["ps", "--all", "--quiet", ...filter]));
3314
3321
  if (containers.length > 0)
3315
- yield* docker(["rm", "--force", ...containers]);
3322
+ yield* docker(["rm", "--force", "--volumes", ...containers]);
3316
3323
  const networks = ids(yield* docker(["network", "ls", "--quiet", ...filter]));
3317
3324
  if (networks.length > 0)
3318
3325
  yield* docker(["network", "rm", ...networks]);
@@ -3540,12 +3547,12 @@ var openSession = (file) => gen(function* () {
3540
3547
  }
3541
3548
  return { handle, size: Number(opened.size) };
3542
3549
  });
3543
- var readAt = (handle, position, length) => map7(tryPromise(() => handle.read(new Uint8Array(length), 0, length, position)), ({ buffer, bytesRead }) => buffer.subarray(0, bytesRead));
3550
+ var readAt = (handle, position, length) => map8(tryPromise(() => handle.read(new Uint8Array(length), 0, length, position)), ({ buffer, bytesRead }) => buffer.subarray(0, bytesRead));
3544
3551
  var readSessionRange = (file, position, length) => gen(function* () {
3545
3552
  const { handle, size } = yield* openSession(file);
3546
3553
  return yield* readAt(handle, position, Math.max(0, Math.min(length, size - position)));
3547
3554
  }).pipe(scoped);
3548
- var sessionFileSize = (file) => map7(openSession(file), ({ size }) => size).pipe(scoped);
3555
+ var sessionFileSize = (file) => map8(openSession(file), ({ size }) => size).pipe(scoped);
3549
3556
  var maxSubagentFiles = 1024;
3550
3557
  var sessionExtent = (file) => gen(function* () {
3551
3558
  const fs = yield* FileSystem;
@@ -3553,7 +3560,7 @@ var sessionExtent = (file) => gen(function* () {
3553
3560
  if (file.subagents === undefined)
3554
3561
  return own;
3555
3562
  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)));
3563
+ const sizes = yield* forEach(found.slice(0, maxSubagentFiles), (path) => fs.stat(path).pipe(map8((info) => Number(info.size)), orElseSucceed(() => 0)));
3557
3564
  return sizes.reduce((total, size) => total + size, own);
3558
3565
  });
3559
3566
  var packConfined = (file, root) => gen(function* () {
@@ -3580,7 +3587,7 @@ var packConfined = (file, root) => gen(function* () {
3580
3587
  }
3581
3588
  return packed;
3582
3589
  }).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);
3590
+ 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
3591
  var restoreSession = (adapter, place) => gen(function* () {
3585
3592
  const fs = yield* FileSystem;
3586
3593
  const location = adapter.session?.location;
@@ -3699,16 +3706,16 @@ var stepProcessEnvironment = (runnerId, attemptId, outer = process.env) => ({
3699
3706
  var lists = (value, id) => value.split(listSeparator).includes(id);
3700
3707
  var signalProcess = (pid, signal) => ignore(try_2(() => process.kill(pid, signal)));
3701
3708
  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) => ({
3709
+ var procCommand = (fs, pid) => map8(fs.readFile(`/proc/${pid}/cmdline`).pipe(orElseSucceed(() => new Uint8Array)), commandLine);
3710
+ var procProcessTable = map8(FileSystem, (fs) => ({
3704
3711
  marked: ({ name, value }) => gen(function* () {
3705
3712
  const prefix = `${name}=`;
3706
3713
  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 });
3714
+ 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
3715
  return found.flat();
3709
3716
  }),
3710
3717
  signal: signalProcess,
3711
- alive: (pid) => fs.readFileString(`/proc/${pid}/stat`).pipe(map7((stat) => !/^[ZX]/.test(stat.slice(stat.lastIndexOf(")") + 2))), orElseSucceed(() => false))
3718
+ alive: (pid) => fs.readFileString(`/proc/${pid}/stat`).pipe(map8((stat) => !/^[ZX]/.test(stat.slice(stat.lastIndexOf(")") + 2))), orElseSucceed(() => false))
3712
3719
  }));
3713
3720
  var environEntries = (environ) => new TextDecoder().decode(environ).split("\x00");
3714
3721
  var commandLine = (cmdline) => new TextDecoder().decode(cmdline).split("\x00").filter((part) => part !== "").join(" ");
@@ -3717,10 +3724,10 @@ var psRows = (listed) => listed.split(`
3717
3724
  const matched = /^\s*(\d+)\s+(.*)$/.exec(line);
3718
3725
  return matched === null ? [] : [{ pid: Number(matched[1]), text: matched[2] ?? "" }];
3719
3726
  });
3720
- var psProcessTable = map7(ChildProcessSpawner, (spawner) => {
3727
+ var psProcessTable = map8(ChildProcessSpawner, (spawner) => {
3721
3728
  const ps = (args) => runCommand2("ps", [...args, "-ww", "-U", String(process.getuid?.() ?? ""), "-o", "pid=,command="], {
3722
3729
  timeout: "30 seconds"
3723
- }).pipe(provideService(ChildProcessSpawner, spawner), map7(psRows));
3730
+ }).pipe(provideService(ChildProcessSpawner, spawner), map8(psRows));
3724
3731
  return {
3725
3732
  marked: ({ name, value }) => gen(function* () {
3726
3733
  const entry = ` ${name}=`;
@@ -3746,7 +3753,7 @@ var psProcessTable = map7(ChildProcessSpawner, (spawner) => {
3746
3753
  var systemProcessTable = process.platform === "linux" ? procProcessTable : psProcessTable;
3747
3754
  var unitPart = (id) => id.replaceAll(/[^A-Za-z0-9-]/g, (char) => `_${char.charCodeAt(0).toString(16)}`);
3748
3755
  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));
3756
+ var unitSuffix = SecureRandom.pipe(flatMap3((random) => random.uuidV4()), map8((uuid) => uuid.slice(0, 8)), provide3(layerWebCrypto));
3750
3757
  var busVariables = ["XDG_RUNTIME_DIR", "DBUS_SESSION_BUS_ADDRESS"];
3751
3758
  var systemdScopes = gen(function* () {
3752
3759
  if (process.platform !== "linux")
@@ -3766,7 +3773,7 @@ var systemdScopes = gen(function* () {
3766
3773
  `).filter((pid) => /^\d+$/.test(pid))).map(Number);
3767
3774
  });
3768
3775
  return {
3769
- contain: (runnerId, attemptId, argv) => map7(unitSuffix, (suffix) => {
3776
+ contain: (runnerId, attemptId, argv) => map8(unitSuffix, (suffix) => {
3770
3777
  const unit = `${unitPrefix(runnerId, attemptId)}${suffix}.scope`;
3771
3778
  const scoped = [
3772
3779
  "systemd-run",
@@ -3793,7 +3800,7 @@ var systemdScopes = gen(function* () {
3793
3800
  ])).split(`
3794
3801
  `).flatMap((line) => line.trim().split(/\s+/)[0] ?? []).filter((unit) => unit.endsWith(".scope"));
3795
3802
  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 })));
3803
+ return yield* forEach([...new Set(pids.flat())], (pid) => map8(procCommand(fs, pid), (command) => ({ pid, command })));
3797
3804
  }).pipe(orElseSucceed(() => []))
3798
3805
  };
3799
3806
  });
@@ -3803,7 +3810,7 @@ var makeStepProcesses = (table, options = {}) => {
3803
3810
  const { scopes } = options;
3804
3811
  const unreaped = new Map;
3805
3812
  const pollMs = options.pollMs ?? 50;
3806
- const finding = (marker, scoped) => map7(all3([table.marked(marker), scoped]), ([marked, inScopes]) => {
3813
+ const finding = (marker, scoped) => map8(all3([table.marked(marker), scoped]), ([marked, inScopes]) => {
3807
3814
  const found = new Map([...marked, ...inScopes].map((candidate) => [candidate.pid, candidate]));
3808
3815
  found.delete(process.pid);
3809
3816
  return [...found.values()];
@@ -3885,13 +3892,13 @@ var stepProcessesUncontained = (input) => {
3885
3892
  return {
3886
3893
  code: "processes_uncontained",
3887
3894
  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."
3895
+ 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
3896
  };
3890
3897
  };
3891
3898
 
3892
3899
  class StepProcesses extends Service2()("StepProcesses") {
3893
3900
  }
3894
- var stepProcessesLayer = effect(StepProcesses, map7(systemProcessTable, (table) => makeStepProcesses(table)));
3901
+ var stepProcessesLayer = effect(StepProcesses, map8(systemProcessTable, (table) => makeStepProcesses(table)));
3895
3902
  var systemStepProcessesLayer = effect(StepProcesses, gen(function* () {
3896
3903
  const table = yield* systemProcessTable;
3897
3904
  return makeStepProcesses(table, { scopes: yield* systemdScopes });
@@ -4109,7 +4116,7 @@ var runAttempt = (request, options) => gen(function* () {
4109
4116
  if (harnessesUnsupportedInSrt2.includes(adapter.id))
4110
4117
  return yield* new AgentStepFailure({
4111
4118
  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."
4119
+ 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
4120
  });
4114
4121
  const sessions = worktreeSessionDirectory(adapter, options.home, workspace);
4115
4122
  const loginValues = yield* inheritedEnvironment2(adapter.loginSecrets ?? []);
@@ -4189,7 +4196,7 @@ var runAttempt = (request, options) => gen(function* () {
4189
4196
  env: {},
4190
4197
  command: ["sh", "-c", 'p=$(command -v -- "$1") && [ -f "$p" ] && [ -x "$p" ]', "sh", command],
4191
4198
  timeout: "30 seconds"
4192
- }).pipe(map7((result) => result.exitCode === 0), mapError2(() => unavailable)));
4199
+ }).pipe(map8((result) => result.exitCode === 0), mapError2(() => unavailable)));
4193
4200
  const env = { ...policy.environment, ...marker };
4194
4201
  return { argv: dockerExecArgv({ container, workspace, env, argv: harnessArgv }), env, registry };
4195
4202
  }
@@ -4280,7 +4287,7 @@ var runAttempt = (request, options) => gen(function* () {
4280
4287
  const brief = firstMessage(request.launch, workspace, launch.systemBrief === true);
4281
4288
  const readyTurn = ready.value.turn;
4282
4289
  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 })));
4290
+ const sent = yield* result(call((connection) => map8(connection.send(address, brief), (reply) => ({ turn: reply.turn, lost: false })), () => succeed6({ turn: readyTurn, lost: true })));
4284
4291
  if (isFailure(sent) || sent.success.lost || tries <= 1)
4285
4292
  return sent;
4286
4293
  const taken = yield* until(seen, stirredSince(sent.success.turn)).pipe(timeoutOption(options.briefAckMs));
@@ -4363,7 +4370,7 @@ var herdrCoreAgentBackendLayer = (options) => effect(AgentBackend, gen(function*
4363
4370
  });
4364
4371
  }));
4365
4372
  // 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`]);
4373
+ var installed = (probe, command, label) => map8(probe("sh", ["-c", `command -v ${command}`]), (found) => found ? [] : [`${label} is not installed`]);
4367
4374
  var srtMissing = (probe, platform) => gen(function* () {
4368
4375
  if (platform === "darwin")
4369
4376
  return [
@@ -4385,9 +4392,9 @@ var srtMissing = (probe, platform) => gen(function* () {
4385
4392
  "unprivileged user namespaces are not allowed (on Ubuntu: sysctl kernel.apparmor_restrict_unprivileged_userns=0)"
4386
4393
  ];
4387
4394
  });
4388
- var dockerMissing = (probe, image) => map7(probe("docker", ["info"]), (reachable) => [
4395
+ var dockerMissing = (probe, image) => map8(probe("docker", ["info"]), (reachable) => [
4389
4396
  ...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:...)"]
4397
+ ...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
4398
  ]);
4392
4399
  var probeSandboxHost = (probe, platform = process.platform, options = {}) => gen(function* () {
4393
4400
  const srt = yield* srtMissing(probe, platform);
@@ -4404,7 +4411,7 @@ var probeSandboxHost = (probe, platform = process.platform, options = {}) => gen
4404
4411
  ]
4405
4412
  };
4406
4413
  });
4407
- var commandHostProbe = map7(ChildProcessSpawner, (spawner) => (command, args) => runCommand2(command, args, { timeout: "10 seconds" }).pipe(as(true), orElseSucceed(() => false), provideService(ChildProcessSpawner, spawner)));
4414
+ var commandHostProbe = map8(ChildProcessSpawner, (spawner) => (command, args) => runCommand2(command, args, { timeout: "10 seconds" }).pipe(as(true), orElseSucceed(() => false), provideService(ChildProcessSpawner, spawner)));
4408
4415
  // packages/oversight/src/domain/intent.ts
4409
4416
  var ConstraintKind = Literals(["rule", "semantic"]);
4410
4417
  var ConstraintSeverity = Literals(["block", "warn"]);
@@ -4581,14 +4588,14 @@ var diffFlags = ["--no-color", "--no-ext-diff", "--no-textconv", "--no-renames",
4581
4588
  var catchUpReport = (worktree, input) => gen(function* () {
4582
4589
  const git = (...args) => runCommand2("git", ["-C", worktree, ...args]);
4583
4590
  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);
4591
+ const names = (from, to) => map8(git("diff", "--name-only", "-z", "--no-renames", from, to), (out) => out.split("\x00").filter(Boolean));
4592
+ const ownDiff = (base, head, path) => map8(git("diff", ...diffFlags, base, head, "--", `:(literal,top)${path}`), normalizedDiff);
4586
4593
  const before = (yield* git("merge-base", input.from, target)).trim();
4587
4594
  const after = (yield* git("merge-base", input.head, target)).trim();
4588
4595
  const settled = input.automerged === undefined ? [] : (yield* names(input.automerged, input.merged)).filter((path) => !input.conflicted.includes(path));
4589
4596
  const rewritten = [...new Set([...settled, ...yield* names(input.merged, input.head)])].sort();
4590
4597
  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 });
4598
+ 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
4599
  const lists = [input.conflicted, rewritten, paths];
4593
4600
  return {
4594
4601
  from: input.from,
@@ -4757,7 +4764,7 @@ var failedWhenUnrun = (label) => (execution) => {
4757
4764
  };
4758
4765
  var makeReplicaSignals = sync2(() => {
4759
4766
  let generation = 0;
4760
- let nextWork = makeUnsafe4();
4767
+ let nextWork = makeUnsafe5();
4761
4768
  const stops = new Map;
4762
4769
  const mailboxes = new Map;
4763
4770
  const mailboxFor = (workUnitId) => {
@@ -4767,8 +4774,8 @@ var makeReplicaSignals = sync2(() => {
4767
4774
  const created = {
4768
4775
  notes: [],
4769
4776
  seen: new Set,
4770
- arrived: makeUnsafe4(),
4771
- updated: makeUnsafe4()
4777
+ arrived: makeUnsafe5(),
4778
+ updated: makeUnsafe5()
4772
4779
  };
4773
4780
  mailboxes.set(workUnitId, created);
4774
4781
  return created;
@@ -4779,14 +4786,14 @@ var makeReplicaSignals = sync2(() => {
4779
4786
  if (note !== undefined)
4780
4787
  return succeed6(note);
4781
4788
  if (isDoneUnsafe(mailbox.arrived))
4782
- mailbox.arrived = makeUnsafe4();
4789
+ mailbox.arrived = makeUnsafe5();
4783
4790
  return andThen2(_await(mailbox.arrived), nextSteer(workUnitId));
4784
4791
  });
4785
4792
  const stopFor = (workUnitId) => {
4786
4793
  const existing = stops.get(workUnitId);
4787
4794
  if (existing !== undefined)
4788
4795
  return existing;
4789
- const created = makeUnsafe4();
4796
+ const created = makeUnsafe5();
4790
4797
  stops.set(workUnitId, created);
4791
4798
  return created;
4792
4799
  };
@@ -4798,7 +4805,7 @@ var makeReplicaSignals = sync2(() => {
4798
4805
  WorkAvailable: () => {
4799
4806
  generation += 1;
4800
4807
  const signalled = nextWork;
4801
- nextWork = makeUnsafe4();
4808
+ nextWork = makeUnsafe5();
4802
4809
  doneUnsafe(signalled, void_2);
4803
4810
  },
4804
4811
  LeaseRevoked: ({ workUnitId }) => stop(workUnitId, "lost"),
@@ -4831,7 +4838,7 @@ var makeReplicaSignals = sync2(() => {
4831
4838
  sessionUpdated: (workUnitId) => suspend3(() => {
4832
4839
  const mailbox = mailboxFor(workUnitId);
4833
4840
  return andThen2(_await(mailbox.updated), sync2(() => {
4834
- mailbox.updated = makeUnsafe4();
4841
+ mailbox.updated = makeUnsafe5();
4835
4842
  }));
4836
4843
  }),
4837
4844
  forget: (workUnitId) => sync2(() => {
@@ -4896,11 +4903,12 @@ function runReplica(control, executor, signals) {
4896
4903
  })), 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
4904
  }));
4898
4905
  }
4906
+ var ConcurrencyRecheck = seconds(1);
4899
4907
  var IdleRecheck = seconds(60);
4900
4908
  var idleBackoff = (idleIterations) => millis(Math.min(1000 * 2 ** idleIterations, 30000));
4901
4909
  function superviseReplica(input) {
4902
4910
  const { signals } = input;
4903
- const claimTurn = makeUnsafe2(1);
4911
+ const claimTurn = makeUnsafe3(1);
4904
4912
  let emptyAt = -1;
4905
4913
  const wokenControl = (control, signals) => ({
4906
4914
  ...control,
@@ -4914,10 +4922,14 @@ function superviseReplica(input) {
4914
4922
  return claimed;
4915
4923
  }))
4916
4924
  });
4917
- const runSlot = (capacitySlot) => gen(function* () {
4925
+ const runSlot = (capacitySlot, index) => gen(function* () {
4918
4926
  let idleIterations = 0;
4919
4927
  let woken = true;
4920
4928
  while (true) {
4929
+ if (input.concurrency !== undefined && index >= (yield* input.concurrency)) {
4930
+ yield* sleep(ConcurrencyRecheck);
4931
+ continue;
4932
+ }
4921
4933
  const seen = signals === undefined ? 0 : yield* signals.generation;
4922
4934
  const control = input.control(capacitySlot);
4923
4935
  const exit2 = yield* exit(runReplica(signals !== undefined && woken ? wokenControl(control, signals) : control, input.executor, signals));
@@ -5386,7 +5398,7 @@ var transcriptRelay = (input) => {
5386
5398
  passOver(last);
5387
5399
  batchLimit = batchSize;
5388
5400
  };
5389
- const givesUp = (error, lastChance) => map7(currentTimeMillis, (now) => {
5401
+ const givesUp = (error, lastChance) => map8(currentTimeMillis, (now) => {
5390
5402
  if (lastChance || sendRefusal(error) === "refused")
5391
5403
  return true;
5392
5404
  failingSince ??= now;
@@ -5556,7 +5568,7 @@ var transcriptRelay = (input) => {
5556
5568
  });
5557
5569
  return {
5558
5570
  record,
5559
- stalledFor: (millis) => map7(currentTimeMillis, (now) => asking.size === 0 && progressAt !== undefined && now - progressAt >= millis),
5571
+ stalledFor: (millis) => map8(currentTimeMillis, (now) => asking.size === 0 && progressAt !== undefined && now - progressAt >= millis),
5560
5572
  asking: sync2(() => asking.size > 0),
5561
5573
  loginLost: sync2(() => loginLost),
5562
5574
  refusal: sync2(() => refusal),
@@ -5636,7 +5648,7 @@ var gitRemote = (repoBinding, credential) => {
5636
5648
  };
5637
5649
  var clonePermits = new Map;
5638
5650
  var inClone = (directory) => (effect) => {
5639
- const permit = clonePermits.get(directory) ?? makeUnsafe2(1);
5651
+ const permit = clonePermits.get(directory) ?? makeUnsafe3(1);
5640
5652
  clonePermits.set(directory, permit);
5641
5653
  return permit.withPermits(1)(effect);
5642
5654
  };
@@ -5644,7 +5656,7 @@ var repositoryClone = (rootDir, repoBindingId) => `${rootDir}/repos/${repoBindin
5644
5656
  var runCheckouts = (rootDir, credentials) => {
5645
5657
  const runsDir = `${rootDir}/runs`;
5646
5658
  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));
5659
+ 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
5660
  const cloned = (repoBinding) => gen(function* () {
5649
5661
  const fs = yield* FileSystem;
5650
5662
  const forbidden = findForbiddenRepoBindingSecretPath(repoBinding);
@@ -5671,9 +5683,9 @@ var runCheckouts = (rootDir, credentials) => {
5671
5683
  });
5672
5684
  const fetch = (directory, env) => runCommand2("git", ["-C", directory, ...stallLimit, "fetch", "--prune", "origin"], { ...transfer, env });
5673
5685
  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);
5686
+ const clone = (repoBinding) => inCloneOf(repoBinding)(map8(cloned(repoBinding), ({ directory }) => directory));
5687
+ const transferEnv = (repoBinding) => repoBinding === undefined ? succeed6({}) : map8(remote(repoBinding), ({ env }) => env);
5688
+ 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
5689
  const checkout = (work, repoBinding, checkpoint) => gen(function* () {
5678
5690
  const fs = yield* FileSystem;
5679
5691
  const path = yield* Path;
@@ -5782,7 +5794,7 @@ var runChange = (worktree, runBase) => gen(function* () {
5782
5794
  const git = (...args) => runCommand2("git", ["-C", worktree, ...args]);
5783
5795
  const base = (yield* git("merge-base", "HEAD", runBase)).trim();
5784
5796
  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) => ({
5797
+ 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
5798
  path,
5787
5799
  diff
5788
5800
  })));
@@ -5801,7 +5813,7 @@ var keepSession = (rpc, lease, content) => gen(function* () {
5801
5813
  yield* fs.writeFile(path, content);
5802
5814
  const files = {
5803
5815
  createRunFile: ({ byteSize, sha256 }) => rpc.createCheckpointFile({ lease, byteSize, sha256 }),
5804
- runFileParts: (request) => map7(rpc.checkpointFileParts({ lease, ...request, partNumbers: [...request.partNumbers] }), ({ parts }) => parts),
5816
+ runFileParts: (request) => map8(rpc.checkpointFileParts({ lease, ...request, partNumbers: [...request.partNumbers] }), ({ parts }) => parts),
5805
5817
  completeRunFile: ({ parts, ...request }) => rpc.completeCheckpointFile({ lease, ...request, ...parts === undefined ? undefined : { parts: [...parts] } })
5806
5818
  };
5807
5819
  const kept = yield* uploadRunFile(files, { step: "", name: "session.gz", path });
@@ -5849,7 +5861,7 @@ var stageAll = (worktree, git) => gen(function* () {
5849
5861
  yield* git("add", "--all", "--", ".", ...leftovers.map((name) => `:(exclude,top)${name}`));
5850
5862
  });
5851
5863
  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)));
5864
+ 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
5865
  var list = (paths) => paths.join(", ");
5854
5866
  var unmarkedConflicts = (worktree, conflicted, marked) => gen(function* () {
5855
5867
  const stages = new Map;
@@ -5886,7 +5898,7 @@ var automergedTree = (worktree, conflicted) => gen(function* () {
5886
5898
  const scratchIndex = `${index}.kitman-automerged`;
5887
5899
  const git = (...args) => runCommand2("git", ["-C", worktree, ...args], { env: { GIT_INDEX_FILE: scratchIndex } });
5888
5900
  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)));
5901
+ return yield* ensuring2(andThen2(git("update-index", "--force-remove", "--", ...conflicted), map8(git("write-tree"), (tree) => tree.trim())), ignore(fs.remove(scratchIndex)));
5890
5902
  });
5891
5903
  var mergeTarget = (worktree, target) => gen(function* () {
5892
5904
  const git = (...args) => runCommand2("git", ["-C", worktree, ...gitIdentity, ...args]);
@@ -5986,7 +5998,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
5986
5998
  const merge = merging === undefined ? undefined : yield* mergeTarget(worktree, merging);
5987
5999
  const notes = [...work.resumeNotes ?? [], ...merge === undefined ? [] : [merge.note]];
5988
6000
  const configDir = yield* (yield* FileSystem).makeTempDirectoryScoped({ prefix: "kitman-harness-" }).pipe(orDie);
5989
- const backend = work.sandbox ?? input.sandbox;
6001
+ const backend = work.sandbox ?? (isFunction2(input.sandbox) ? input.sandbox(work) : input.sandbox);
5990
6002
  const writableSessions = adapter === undefined ? undefined : worktreeSessionDirectory(adapter, home, worktree);
5991
6003
  if (backend === "srt" && writableSessions !== undefined)
5992
6004
  yield* freshDirectory(writableSessions);
@@ -6002,7 +6014,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6002
6014
  };
6003
6015
  const sessionId = transcript !== undefined || adapter?.session?.start !== undefined ? session.id : undefined;
6004
6016
  let last = saved?.ref === checkpointRef(work) ? saved : {};
6005
- const checkpointTurn = makeUnsafe2(1);
6017
+ const checkpointTurn = makeUnsafe3(1);
6006
6018
  const takeCheckpoint = gen(function* () {
6007
6019
  if (input.checkpoints === undefined)
6008
6020
  return;
@@ -6092,7 +6104,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6092
6104
  ...refusal.until === undefined ? undefined : { until: refusal.until },
6093
6105
  ...backend === "docker" ? { scope: "step" } : undefined
6094
6106
  });
6095
- const outputSubmitted = input.heartbeat(work).pipe(option2, map7((state) => isSome(state) && state.value.outputSubmitted === true));
6107
+ const outputSubmitted = input.heartbeat(work).pipe(option2, map8((state) => isSome(state) && state.value.outputSubmitted === true));
6096
6108
  const providerRefused = relay === undefined ? never : gen(function* () {
6097
6109
  for (;; ) {
6098
6110
  yield* sleep("1 second");
@@ -6141,7 +6153,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
6141
6153
  const state = isSuccess2(exit) ? exit.value.status : hasInterrupts(exit) ? "canceled" : "failed";
6142
6154
  yield* relayed.pipe(timeout("5 seconds"), ignore);
6143
6155
  yield* andThen2(relay.record([{ kind: "lifecycle", state }]), relay.lastFlush).pipe(timeout("5 seconds"), ignore);
6144
- const sending = yield* forkIn(relay.sendRest, input.runnerScope ?? makeUnsafe5());
6156
+ const sending = yield* forkIn(relay.sendRest, input.runnerScope ?? makeUnsafe6());
6145
6157
  resending.set(work.id, sending);
6146
6158
  if (state !== "parked")
6147
6159
  sending.addObserver(() => resending.delete(work.id));
@@ -6383,7 +6395,7 @@ var harnessesInSrt = (input) => gen(function* () {
6383
6395
  missing: [
6384
6396
  `\`${entry.harness} --version\` does not start in srt from any \`${entry.harness}\` on the Runner's PATH`,
6385
6397
  ...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"
6398
+ "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
6399
  ]
6388
6400
  }))
6389
6401
  ]
@@ -6476,7 +6488,7 @@ var removeCheckPostgres = (runnerId, liveReplicas) => gen(function* () {
6476
6488
  `{{.ID}} {{.Label "${CheckPostgresReplicaLabel}"}}`
6477
6489
  ], { timeout: "10 seconds" }), liveReplicas);
6478
6490
  if (ids.length > 0)
6479
- yield* runCommand2("docker", ["rm", "--force", ...ids], { timeout: "30 seconds" });
6491
+ yield* runCommand2("docker", ["rm", "--force", "--volumes", ...ids], { timeout: "30 seconds" });
6480
6492
  }).pipe(ignore);
6481
6493
 
6482
6494
  class CheckPostgresUnavailable extends TaggedError("CheckPostgresUnavailable") {
@@ -6527,7 +6539,7 @@ var dockerCheckPostgres = (runnerId, replicaId) => (id) => gen(function* () {
6527
6539
  "fsync=off",
6528
6540
  "-c",
6529
6541
  "full_page_writes=off"
6530
- ], "30 minutes"), () => ignore(docker(["rm", "--force", container])));
6542
+ ], "30 minutes"), () => ignore(docker(["rm", "--force", "--volumes", container])));
6531
6543
  const hostPort = publishedPort(yield* docker(["port", container, `${checkPostgresSandboxPort}/tcp`]));
6532
6544
  if (hostPort === undefined)
6533
6545
  return yield* new CheckPostgresUnavailable({ reason: "docker published no port" });
@@ -6899,7 +6911,7 @@ function composeAgentEnvironmentSyncPlan(targets) {
6899
6911
  }
6900
6912
  var updateHarness = (argv) => gen(function* () {
6901
6913
  const run = yield* CommandRunner2;
6902
- const failure = yield* run(argv).pipe(map7((result) => result.exitCode === 0 ? undefined : result.output.trim().split(`
6914
+ const failure = yield* run(argv).pipe(map8((result) => result.exitCode === 0 ? undefined : result.output.trim().split(`
6903
6915
  `).at(-1) ?? `exit code ${result.exitCode}`), catch_((error) => succeed6(error.message)));
6904
6916
  return failure === undefined ? [] : [`Kitman could not update ${argv[0]} with \`${argv.join(" ")}\`: ${failure}`];
6905
6917
  });
@@ -6912,10 +6924,10 @@ var applyAgentEnvironmentPlans = fnUntraced(function* (plan) {
6912
6924
  const updateWarnings = yield* forEach(plan.targets, (target) => target.harnessUpdater === undefined ? succeed6([]) : updateHarness(target.harnessUpdater));
6913
6925
  for (const target of plan.targets)
6914
6926
  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({
6927
+ const targets = yield* forEach(plan.targets, (target, index) => map8(target.skills.codexHookTrust === undefined ? succeed6([]) : trustCodexPluginHooks({
6916
6928
  ...target.skills.codexHookTrust,
6917
6929
  plugins: target.skills.materializedPlugins.map((plugin) => plugin.name)
6918
- }), (trustWarnings) => [...updateWarnings[index] ?? [], ...trustWarnings]).pipe(map7((warnings) => ({
6930
+ }), (trustWarnings) => [...updateWarnings[index] ?? [], ...trustWarnings]).pipe(map8((warnings) => ({
6919
6931
  ...target,
6920
6932
  skills: { ...target.skills, warnings: [...target.skills.warnings, ...warnings.map((message) => ({ message }))] },
6921
6933
  warnings: [...target.warnings, ...warnings]
@@ -7003,7 +7015,7 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
7003
7015
  storageOrigin: work.storageOrigin,
7004
7016
  network: work.network
7005
7017
  });
7006
- const inherited = (yield* forEach(inheritedEnv, (name) => map7(optionalEnv(name), (value) => value === undefined ? [] : [[name, value]]))).flat();
7018
+ const inherited = (yield* forEach(inheritedEnv, (name) => map8(optionalEnv(name), (value) => value === undefined ? [] : [[name, value]]))).flat();
7007
7019
  const programEnv = {
7008
7020
  BUN_BE_BUN: "1",
7009
7021
  KITMAN_LOOP_ID: program.loopId,
@@ -7291,7 +7303,7 @@ var redactedCopy = (from, to) => gen(function* () {
7291
7303
  var checkFileKeeper = (work, runFiles, storage) => {
7292
7304
  const files = rpcRunFiles(runFiles, programLease(work));
7293
7305
  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}`), [])));
7306
+ 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
7307
  return (input) => gen(function* () {
7296
7308
  const path = yield* Path;
7297
7309
  const log = `${input.output}.log`;
@@ -7306,7 +7318,7 @@ var reportedTests = (filesDir) => gen(function* () {
7306
7318
  const fs = yield* FileSystem;
7307
7319
  const path = yield* Path;
7308
7320
  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(() => [])));
7321
+ const reports = yield* forEach(names, (name) => fs.readFileString(path.join(filesDir, name)).pipe(map8((text) => [text]), orElseSucceed(() => [])));
7310
7322
  return checkTests(reports.flat());
7311
7323
  }).pipe(orElseSucceed(() => checkTests([])));
7312
7324
 
@@ -7336,7 +7348,7 @@ var decodeListeningPort = decodeUnknownEffect2(Struct({ port: Finite }));
7336
7348
  var pipelineDaemon = (services, check) => gen(function* () {
7337
7349
  if (services.docker === undefined)
7338
7350
  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.`
7351
+ 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
7352
  });
7341
7353
  const fs = yield* FileSystem;
7342
7354
  const started = yield* services.docker({ id: services.id, network: services.network }).pipe(mapError2((error) => new ServicesUnavailable({ reason: error.message })));
@@ -7449,7 +7461,7 @@ var unresolvedDependencies = (worktree) => gen(function* () {
7449
7461
  }).pipe(orElseSucceed(() => {
7450
7462
  return;
7451
7463
  }));
7452
- const manifestAt = (dir) => fs.readFileString(path.join(dir, "package.json")).pipe(map7((text) => getOrUndefined(decodeJsonStringOption(text))), orElseSucceed(() => {
7464
+ const manifestAt = (dir) => fs.readFileString(path.join(dir, "package.json")).pipe(map8((text) => getOrUndefined(decodeJsonStringOption(text))), orElseSucceed(() => {
7453
7465
  return;
7454
7466
  }));
7455
7467
  const unresolved = [];
@@ -7676,7 +7688,7 @@ var resolveRevisions = (work, revisions, checkouts) => gen(function* () {
7676
7688
  };
7677
7689
  return resolved;
7678
7690
  });
7679
- var treeOf = (worktree) => map7(runCommand2("git", ["-C", worktree, "rev-parse", "HEAD^{tree}"]), (tree) => tree.trim());
7691
+ var treeOf = (worktree) => map8(runCommand2("git", ["-C", worktree, "rev-parse", "HEAD^{tree}"]), (tree) => tree.trim());
7680
7692
  var verificationExecutor = (input) => (work) => gen(function* () {
7681
7693
  if (input.sandbox !== undefined && input.sandbox.backend === undefined)
7682
7694
  return {