@kitman-sh/cli 0.27.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/{chunk-ja48xvcs.js → chunk-18x6rmkq.js} +9 -9
  2. package/dist/{chunk-tsx0347c.js → chunk-1hgsf81a.js} +1 -1
  3. package/dist/{chunk-nhe2pgzz.js → chunk-1yyq4nh2.js} +24 -24
  4. package/dist/{chunk-samxkpbz.js → chunk-4qrb09w4.js} +3 -3
  5. package/dist/{chunk-t6ynnbcb.js → chunk-4tdk1w0k.js} +7 -7
  6. package/dist/{chunk-h2f26xbd.js → chunk-61dmxexa.js} +70 -28
  7. package/dist/{chunk-1vnvmeqr.js → chunk-801jtbdq.js} +3 -3
  8. package/dist/{chunk-sxjz1jg3.js → chunk-89eskdmq.js} +26 -23
  9. package/dist/{chunk-vv7zg8rb.js → chunk-8andwyqa.js} +5 -5
  10. package/dist/{chunk-zysde2fp.js → chunk-9zxzmsmm.js} +9 -9
  11. package/dist/{chunk-mpxtpwqp.js → chunk-cbkj3km5.js} +1 -1
  12. package/dist/{chunk-dfvamygr.js → chunk-cm2sr223.js} +129 -87
  13. package/dist/{chunk-7re3n1ze.js → chunk-e491q405.js} +10 -10
  14. package/dist/{chunk-8t2wcrvv.js → chunk-eshk0da5.js} +2 -2
  15. package/dist/{chunk-220vzyz9.js → chunk-f9fhdprs.js} +4 -4
  16. package/dist/{chunk-npfdbssf.js → chunk-fyjet273.js} +4 -4
  17. package/dist/{chunk-bsgvmq34.js → chunk-j021bman.js} +14 -60
  18. package/dist/{chunk-g9z2pdfh.js → chunk-pyjx5q5s.js} +1 -1
  19. package/dist/{chunk-ks4q040v.js → chunk-q1medqp5.js} +6 -6
  20. package/dist/{chunk-vz38kngm.js → chunk-q8e58p57.js} +2 -2
  21. package/dist/{chunk-4qjfn1sa.js → chunk-rbpn35g5.js} +1 -1
  22. package/dist/{chunk-j4b1yvcd.js → chunk-sm340tvm.js} +26 -17
  23. package/dist/{chunk-z05pkzhf.js → chunk-vshy6fm5.js} +10 -10
  24. package/dist/{chunk-mvqggmpj.js → chunk-wqdxszpm.js} +19 -19
  25. package/dist/{chunk-xppw33hz.js → chunk-y6petreh.js} +116 -124
  26. package/dist/{chunk-5kqt4bqp.js → chunk-znhjs0t6.js} +1 -1
  27. package/dist/index.js +4 -4
  28. package/package.json +1 -1
@@ -43,7 +43,7 @@ import {
43
43
  isFailure2,
44
44
  hasInterrupts,
45
45
  makeUnsafe5,
46
- make16,
46
+ make15,
47
47
  _await,
48
48
  fail5,
49
49
  isDoneUnsafe,
@@ -172,7 +172,53 @@ import {
172
172
  decodeJsonStringSync,
173
173
  encodeUnknownJsonStringSync,
174
174
  storable
175
- } from "./chunk-h2f26xbd.js";
175
+ } from "./chunk-61dmxexa.js";
176
+ import {
177
+ join,
178
+ interrupt,
179
+ unbounded,
180
+ publishUnsafe,
181
+ unbounded2,
182
+ offer,
183
+ makeUnsafe3,
184
+ make10,
185
+ fromQueue,
186
+ fromPubSub,
187
+ map2,
188
+ filter,
189
+ take2,
190
+ mapAccum,
191
+ decodeText,
192
+ encodeText,
193
+ splitLines,
194
+ run,
195
+ runCollect,
196
+ runFold,
197
+ runHead,
198
+ runForEach,
199
+ FileSystem,
200
+ Path,
201
+ embeddedFile,
202
+ extractEmbeddedFile,
203
+ optionalEnv,
204
+ operatorConfigHome,
205
+ tempDirectoryScoped,
206
+ harnessesUnsupportedInSrt2,
207
+ harnessesUnsupportedInDocker2,
208
+ compiled2,
209
+ pinnedSrtCommand2,
210
+ pinnedSrtStepCommand2,
211
+ runSrtCli2,
212
+ kitmanCacheDirectory2,
213
+ srtSettings2,
214
+ srtCacheEnvironment2,
215
+ srtInheritedEnv2,
216
+ inheritedEnvironment2,
217
+ withOnlyEnvironment2,
218
+ writeSrtSettings2,
219
+ srtStepArgv2,
220
+ srtArgv2
221
+ } from "./chunk-sm340tvm.js";
176
222
  import {
177
223
  currentTimeMillis,
178
224
  SecureRandom,
@@ -261,53 +307,7 @@ import {
261
307
  checkServicesFile,
262
308
  checkServices,
263
309
  serviceChecks
264
- } from "./chunk-xppw33hz.js";
265
- import {
266
- join,
267
- interrupt,
268
- unbounded,
269
- publishUnsafe,
270
- unbounded2,
271
- offer,
272
- makeUnsafe3,
273
- make11,
274
- fromQueue,
275
- fromPubSub,
276
- map2,
277
- filter,
278
- take2,
279
- mapAccum,
280
- decodeText,
281
- encodeText,
282
- splitLines,
283
- run,
284
- runCollect,
285
- runFold,
286
- runHead,
287
- runForEach,
288
- FileSystem,
289
- Path,
290
- embeddedFile,
291
- extractEmbeddedFile,
292
- optionalEnv,
293
- operatorConfigHome,
294
- tempDirectoryScoped,
295
- harnessesUnsupportedInSrt2,
296
- harnessesUnsupportedInDocker2,
297
- compiled2,
298
- pinnedSrtCommand2,
299
- pinnedSrtStepCommand2,
300
- runSrtCli2,
301
- kitmanCacheDirectory2,
302
- srtSettings2,
303
- srtCacheEnvironment2,
304
- srtInheritedEnv2,
305
- inheritedEnvironment2,
306
- withOnlyEnvironment2,
307
- writeSrtSettings2,
308
- srtStepArgv2,
309
- srtArgv2
310
- } from "./chunk-j4b1yvcd.js";
310
+ } from "./chunk-y6petreh.js";
311
311
  import {
312
312
  writeAgentEnvironmentConfigFile2,
313
313
  readManifestSkillPaths2,
@@ -323,8 +323,8 @@ import {
323
323
  applyAgentEnvironmentMaterialization2,
324
324
  isPathWithin2,
325
325
  skillIdentity2
326
- } from "./chunk-zysde2fp.js";
327
- import"./chunk-1vnvmeqr.js";
326
+ } from "./chunk-9zxzmsmm.js";
327
+ import"./chunk-801jtbdq.js";
328
328
  import {
329
329
  egressAllowed,
330
330
  writeSecretRegistry,
@@ -334,7 +334,7 @@ import {
334
334
  secretFilter2,
335
335
  opaqueTunnelRefusal2,
336
336
  isOpaqueConnectReason2
337
- } from "./chunk-vz38kngm.js";
337
+ } from "./chunk-q8e58p57.js";
338
338
  import {
339
339
  sliceBytes2,
340
340
  maxLineBytes2,
@@ -342,29 +342,29 @@ import {
342
342
  decodedOption2,
343
343
  decoded2,
344
344
  readOpencode2
345
- } from "./chunk-7re3n1ze.js";
345
+ } from "./chunk-e491q405.js";
346
346
  import {
347
347
  uploadRunFile,
348
348
  programLease,
349
349
  rpcRunFiles,
350
350
  programHostsEnv,
351
351
  undeclaredHostsEnv
352
- } from "./chunk-ja48xvcs.js";
353
- import"./chunk-t6ynnbcb.js";
352
+ } from "./chunk-18x6rmkq.js";
353
+ import"./chunk-4tdk1w0k.js";
354
354
  import {
355
355
  nextInt
356
- } from "./chunk-5kqt4bqp.js";
357
- import"./chunk-tsx0347c.js";
356
+ } from "./chunk-znhjs0t6.js";
357
+ import"./chunk-1hgsf81a.js";
358
358
  import {
359
359
  ChildProcessSpawner,
360
- make3
361
- } from "./chunk-bsgvmq34.js";
362
- import"./chunk-vv7zg8rb.js";
360
+ make2
361
+ } from "./chunk-j021bman.js";
362
+ import"./chunk-8andwyqa.js";
363
363
  import {
364
364
  Id,
365
365
  secretReference,
366
366
  secretPlaceholder
367
- } from "./chunk-4qjfn1sa.js";
367
+ } from "./chunk-rbpn35g5.js";
368
368
 
369
369
  // packages/core/src/sync-kit.ts
370
370
  import { createHash } from "crypto";
@@ -4152,6 +4152,23 @@ var systemStepProcessesLayer = effect(StepProcesses, gen(function* () {
4152
4152
  return makeStepProcesses(table, { scopes: yield* systemdScopes });
4153
4153
  }));
4154
4154
 
4155
+ // packages/agent-runtime/src/thread-budget.ts
4156
+ import { availableParallelism } from "os";
4157
+ var threadBudget = (cores, concurrency) => Math.max(2, Math.floor(cores / concurrency));
4158
+ var hostThreadBudget = (concurrency) => threadBudget(availableParallelism(), concurrency);
4159
+ var threadBudgetVariables = [
4160
+ "GOMAXPROCS",
4161
+ "RAYON_NUM_THREADS",
4162
+ "UV_THREADPOOL_SIZE",
4163
+ "VITEST_MAX_WORKERS"
4164
+ ];
4165
+ var threadBudgetNames = new Set(threadBudgetVariables);
4166
+ var threadBudgetEnvironment = (budget) => Object.fromEntries(threadBudgetVariables.map((name) => [name, String(budget)]));
4167
+ var threadBudgetCollision = (kind, names) => {
4168
+ const reserved = names.filter((name) => threadBudgetNames.has(name));
4169
+ return reserved.length === 0 ? undefined : `The ${kind} ${reserved.join(", ")} name a thread budget variable, which the Runner sets for every attempt; rename them.`;
4170
+ };
4171
+
4155
4172
  // packages/agent-runtime/src/herdr-core-agent-backend.ts
4156
4173
  var launchTimeout = "120 seconds";
4157
4174
  var startupBlockedMs = 5000;
@@ -4345,6 +4362,9 @@ var runAttempt = (request, options) => gen(function* () {
4345
4362
  const bound = yield* result(requireSecretHosts(request.launch.secrets, request.launch.secretDestinations));
4346
4363
  if (isFailure(bound))
4347
4364
  return failed(bound.failure.reason, bound.failure.summary);
4365
+ const reservedSecrets = threadBudgetCollision("Secrets", Object.keys(secrets));
4366
+ if (reservedSecrets !== undefined)
4367
+ return failed("secret_name_reserved", reservedSecrets);
4348
4368
  const referenced = request.sandbox.backend === "host" ? undefined : secretReferences(secrets, request.launch.secretDestinations ?? {});
4349
4369
  const holdSecrets = (initial) => stepSecretRegistry(stepSecretDirectory(options.home, attempt.id), initial, referenced?.references ?? {}).pipe(mapError2(() => new AgentStepFailure({
4350
4370
  reason: "secret_registry_unwritable",
@@ -4376,7 +4396,10 @@ var runAttempt = (request, options) => gen(function* () {
4376
4396
  launch
4377
4397
  });
4378
4398
  const harnessArgv = [launch.binary, ...launch.args];
4379
- const marker = stepProcessEnvironment(request.runnerId, attempt.id);
4399
+ const attemptEnvironment = {
4400
+ ...stepProcessEnvironment(request.runnerId, attempt.id),
4401
+ ...threadBudgetEnvironment(yield* options.threadBudget)
4402
+ };
4380
4403
  const sandboxed = gen(function* () {
4381
4404
  switch (request.sandbox.backend) {
4382
4405
  case "srt": {
@@ -4412,7 +4435,7 @@ var runAttempt = (request, options) => gen(function* () {
4412
4435
  ...loginReferences,
4413
4436
  ...policy.environment,
4414
4437
  ...srtCacheEnvironment2(`${configDir}/cache`),
4415
- ...marker
4438
+ ...attemptEnvironment
4416
4439
  };
4417
4440
  return {
4418
4441
  argv: withOnlyEnvironment2([...Object.keys(env), "TERM", "COLORTERM"], registry === undefined ? srtArgv2(options.srtCommand ?? pinnedSrtCommand2(), settingsFile, harnessArgv) : srtStepArgv2(options.srtStepCommand ?? pinnedSrtStepCommand2(), settingsFile, registry.file, harnessArgv)),
@@ -4469,12 +4492,16 @@ var runAttempt = (request, options) => gen(function* () {
4469
4492
  command: ["sh", "-c", 'p=$(command -v -- "$1") && [ -f "$p" ] && [ -x "$p" ]', "sh", command],
4470
4493
  timeout: "30 seconds"
4471
4494
  }).pipe(map9((result) => result.exitCode === 0), mapError2(() => unavailable)));
4472
- const env = { ...policy.environment, ...marker };
4495
+ const env = { ...policy.environment, ...attemptEnvironment };
4473
4496
  return { argv: dockerExecArgv({ container, workspace, env, argv: harnessArgv }), env, registry };
4474
4497
  }
4475
4498
  default:
4476
4499
  yield* requireKitCommands(kitSetup, runsOnHost);
4477
- const env = { ...yield* inheritedEnvironment2(["SSH_AUTH_SOCK"]), ...policy.environment, ...marker };
4500
+ const env = {
4501
+ ...yield* inheritedEnvironment2(["SSH_AUTH_SOCK"]),
4502
+ ...policy.environment,
4503
+ ...attemptEnvironment
4504
+ };
4478
4505
  return { argv: harnessArgv, env, registry: undefined };
4479
4506
  }
4480
4507
  });
@@ -4650,7 +4677,8 @@ var herdrCoreAgentBackendLayer = (options) => effect(AgentBackend, gen(function*
4650
4677
  secretRevocationMs: options.secretRevocationMs ?? 30000,
4651
4678
  ...options.srtBinaries === undefined ? undefined : { srtBinaries: options.srtBinaries },
4652
4679
  ...options.docker === undefined ? undefined : { docker: options.docker },
4653
- stepProcesses: yield* StepProcesses
4680
+ stepProcesses: yield* StepProcesses,
4681
+ threadBudget: options.threadBudget ?? sync2(() => hostThreadBudget(1))
4654
4682
  };
4655
4683
  return AgentBackend.of({
4656
4684
  sandboxBackends,
@@ -8004,7 +8032,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
8004
8032
  const input = yield* unbounded2();
8005
8033
  const pending = new Map;
8006
8034
  let lastId = 0;
8007
- const handle = yield* spawner.spawn(make3(binary, ["app-server"], {
8035
+ const handle = yield* spawner.spawn(make2(binary, ["app-server"], {
8008
8036
  cwd: env.home,
8009
8037
  extendEnv: true,
8010
8038
  env: { HOME: env.home, CODEX_HOME: env.codexHome },
@@ -8027,7 +8055,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
8027
8055
  return {
8028
8056
  request: (method, params) => gen(function* () {
8029
8057
  const id = ++lastId;
8030
- const deferred = yield* make16();
8058
+ const deferred = yield* make15();
8031
8059
  pending.set(id, deferred);
8032
8060
  yield* send({ id, method, params });
8033
8061
  return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
@@ -8167,10 +8195,10 @@ var handshake = [
8167
8195
  `).join("");
8168
8196
  var kitmanMcpPreflight = (mcp) => gen(function* () {
8169
8197
  const spawner = yield* ChildProcessSpawner;
8170
- const server = yield* spawner.spawn(make3(mcp.command, [...mcp.args], {
8198
+ const server = yield* spawner.spawn(make2(mcp.command, [...mcp.args], {
8171
8199
  extendEnv: true,
8172
8200
  env: mcp.env,
8173
- stdin: { stream: make11(new TextEncoder().encode(handshake)), endOnDone: false },
8201
+ stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
8174
8202
  stderr: "ignore"
8175
8203
  }));
8176
8204
  const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
@@ -8243,8 +8271,8 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
8243
8271
  };
8244
8272
  const exitCode = sandbox === undefined ? yield* gen(function* () {
8245
8273
  const spawner = yield* ChildProcessSpawner;
8246
- const handle = yield* spawner.spawn(make3(input.bun ?? process.execPath, [file], {
8247
- stdin: make11(new TextEncoder().encode(stdin)),
8274
+ const handle = yield* spawner.spawn(make2(input.bun ?? process.execPath, [file], {
8275
+ stdin: make10(new TextEncoder().encode(stdin)),
8248
8276
  stdout: "inherit",
8249
8277
  stderr: "inherit",
8250
8278
  extendEnv: false,
@@ -8338,7 +8366,7 @@ var deployDetail = (output, exitCode) => {
8338
8366
  const ended = exitCode === undefined ? `${deployScript} did not exit in time` : `${deployScript} exited with exit code ${exitCode}`;
8339
8367
  return `${ended}: ${redactedOutputTail(output, detailLimit - ended.length - 2)}`;
8340
8368
  };
8341
- var deployTag = (work, deploy, checkouts, mayRun, timeout = deployTimeout) => gen(function* () {
8369
+ var deployTag = (work, deploy, checkouts, mayRun, env, timeout = deployTimeout) => gen(function* () {
8342
8370
  const checkout = yield* checkouts.checkout({ runId: work.runId, id: work.id, baseRevision: work.revision }, work.repoBinding);
8343
8371
  const tagRef = `refs/tags/${deploy.tag}`;
8344
8372
  if (!(yield* executableAt(checkout, "HEAD"))) {
@@ -8367,7 +8395,7 @@ var deployTag = (work, deploy, checkouts, mayRun, timeout = deployTimeout) => ge
8367
8395
  let printed = "";
8368
8396
  const ran = yield* runProcess2([`${checkout}/${deployScript}`, deploy.tag, ...deploy.previousTag === undefined ? [] : [deploy.previousTag]], {
8369
8397
  cwd: checkout,
8370
- env: { GIT_TERMINAL_PROMPT: "0" },
8398
+ env: { ...env, GIT_TERMINAL_PROMPT: "0" },
8371
8399
  timeout,
8372
8400
  onOutput: (chunk) => sync2(() => {
8373
8401
  printed = (printed + decoder.decode(chunk, { stream: true })).slice(-shellOutputTailChars2);
@@ -8568,11 +8596,11 @@ if (false)
8568
8596
  var checkTimeout = "30 minutes";
8569
8597
  var checkFilesPerVerification = 50;
8570
8598
  var halfCloseListener = (encoder, listenPort, relayPort) => `BUN_BE_BUN=1 ${encoder.map(quoted).join(" ")} ${listenPort} "$HTTP_PROXY" ${relayPort}`;
8571
- var srtDockerTunnel = (relayPort, encoder) => srtLoopbackTunnel({
8599
+ var srtDockerTunnel = (relayPort, encoder, listenPort) => srtLoopbackTunnel({
8572
8600
  service: "Docker daemon",
8573
8601
  hostPort: relayPort,
8574
- listenPort: checkDockerPort,
8575
- listener: halfCloseListener(encoder, checkDockerPort, relayPort),
8602
+ listenPort,
8603
+ listener: halfCloseListener(encoder, listenPort, relayPort),
8576
8604
  probe: String.raw`printf 'GET /_ping HTTP/1.0\r\n\r\n'`,
8577
8605
  read: "tail -c 2",
8578
8606
  answers: "OK"
@@ -8582,7 +8610,7 @@ var pipelineEnvironment = (docker, dockerHost) => ({
8582
8610
  DOCKER_CONFIG: `${docker.clientDir}/docker`,
8583
8611
  GCL_HOME: `${docker.clientDir}/gitlab-ci-local-home`
8584
8612
  });
8585
- var dockerRoute = (backend, docker) => {
8613
+ var dockerRoute = (backend, docker, srtDockerPort) => {
8586
8614
  if (docker === undefined)
8587
8615
  return { env: {}, hosts: [], unixSockets: [], services: [], tunnel: undefined };
8588
8616
  if (backend === "docker")
@@ -8608,11 +8636,11 @@ var dockerRoute = (backend, docker) => {
8608
8636
  };
8609
8637
  case "relay":
8610
8638
  return {
8611
- env: pipelineEnvironment(docker, `tcp://127.0.0.1:${checkDockerPort}`),
8639
+ env: pipelineEnvironment(docker, `tcp://127.0.0.1:${srtDockerPort}`),
8612
8640
  hosts: [`127.0.0.1:${docker.route.port}`],
8613
8641
  unixSockets: [],
8614
8642
  services: [],
8615
- tunnel: srtDockerTunnel(docker.route.port, docker.route.encoder)
8643
+ tunnel: srtDockerTunnel(docker.route.port, docker.route.encoder, srtDockerPort)
8616
8644
  };
8617
8645
  case "direct":
8618
8646
  throw new Error("A pipeline check in srt reaches its daemon through a socket or the relay, never directly.");
@@ -8671,7 +8699,7 @@ var checkSandboxPolicy = (work, sandbox, checkout, cache, filesDir, postgresHost
8671
8699
  environment: srtCacheEnvironment2(cache)
8672
8700
  });
8673
8701
  var checkGitEnvironment = { GIT_CONFIG_GLOBAL: "/dev/null", GIT_TERMINAL_PROMPT: "0" };
8674
- var checkRunner = (work, sandbox, cache, inherited) => (checkout) => ({
8702
+ var checkRunner = (work, sandbox, cache, inherited, threadBudget) => (checkout) => ({
8675
8703
  command,
8676
8704
  cwd,
8677
8705
  filesDir,
@@ -8684,7 +8712,12 @@ var checkRunner = (work, sandbox, cache, inherited) => (checkout) => ({
8684
8712
  runnerGitConfig
8685
8713
  }) => {
8686
8714
  const gitEnvironment = runnerGitConfig === true ? { GIT_TERMINAL_PROMPT: "0" } : checkGitEnvironment;
8687
- const env = { ...added, ...gitEnvironment, KITMAN_RUN_FILES_DIR: filesDir };
8715
+ const env = {
8716
+ ...added,
8717
+ ...threadBudgetEnvironment(threadBudget),
8718
+ ...gitEnvironment,
8719
+ KITMAN_RUN_FILES_DIR: filesDir
8720
+ };
8688
8721
  const output = onOutput === undefined ? undefined : { onOutput };
8689
8722
  if (sandbox === undefined || sandbox.backend === undefined) {
8690
8723
  return runShell2(command, {
@@ -8700,7 +8733,7 @@ var checkRunner = (work, sandbox, cache, inherited) => (checkout) => ({
8700
8733
  });
8701
8734
  }
8702
8735
  const route = postgresRoute(sandbox.backend, postgres);
8703
- const daemon = dockerRoute(sandbox.backend, docker);
8736
+ const daemon = dockerRoute(sandbox.backend, docker, (sandbox.backend === "srt" ? sandbox.dockerPort : undefined) ?? checkDockerPort);
8704
8737
  const policy = checkSandboxPolicy(work, sandbox, checkout, cache, filesDir, [...route.hosts, ...daemon.hosts], docker);
8705
8738
  const [tunnel, ...innerTunnels] = [route.tunnel, daemon.tunnel].filter((script) => script !== undefined);
8706
8739
  const tunnelled = innerTunnels.reduceRight((inner, script) => `sh -c ${quoted(script)} sh ${quoted(inner)}`, command);
@@ -9375,7 +9408,7 @@ var removeUntracked = (worktree, files) => forEach(chunksOf(files, 200), (some)
9375
9408
  "--",
9376
9409
  ...some.map((file) => `:(literal,top)${file}`)
9377
9410
  ]), { discard: true });
9378
- var afterMergeRunner = (sandbox) => (work, worktree, command, args) => gen(function* () {
9411
+ var afterMergeRunner = (sandbox, threadBudget = hostThreadBudget(1)) => (work, worktree, command, args) => gen(function* () {
9379
9412
  const { repoBinding } = work;
9380
9413
  if (repoBinding === undefined)
9381
9414
  return yield* new AfterMergeUnrun({ message: "The Step has no repository" });
@@ -9391,7 +9424,7 @@ var afterMergeRunner = (sandbox) => (work, worktree, command, args) => gen(funct
9391
9424
  repoBinding,
9392
9425
  ...work.storageOrigin === undefined ? undefined : { storageOrigin: work.storageOrigin },
9393
9426
  ...work.hosts === undefined ? undefined : { hosts: work.hosts }
9394
- }, sandbox, cache, inherited)(worktree);
9427
+ }, sandbox, cache, inherited, threadBudget)(worktree);
9395
9428
  yield* installIn(worktree, run);
9396
9429
  yield* runCommand2("git", ["-C", worktree, "reset", "--hard", "--quiet", "HEAD"]);
9397
9430
  const installed = yield* untrackedFiles(worktree);
@@ -9453,6 +9486,9 @@ var runApprovedCommand = (work, command, checkout, sandboxed, run, runFiles, rev
9453
9486
  const cwd = path.join(checkout, command.workingDirectory ?? ".");
9454
9487
  if (!(yield* commandFileFound(command, checkout)))
9455
9488
  return commandRan({ result: { status: "missing" } });
9489
+ const reserved = threadBudgetCollision("variables", Object.keys(command.env ?? {})) ?? threadBudgetCollision("Secrets", Object.keys(secretValues));
9490
+ if (reserved !== undefined)
9491
+ return commandRan({ failed: reserved });
9456
9492
  const bound = yield* result(requireSecretHosts(secretValues, command.secretDestinations));
9457
9493
  if (isFailure(bound))
9458
9494
  return commandRan({ failed: bound.failure.summary });
@@ -9532,7 +9568,8 @@ var verificationExecutor = (input) => (work) => gen(function* () {
9532
9568
  failureSummary: "A shared Runner runs verifications only in `srt` or `docker`."
9533
9569
  };
9534
9570
  const cache = yield* tempDirectoryScoped(yield* FileSystem, { prefix: "kitman-verify-cache-" });
9535
- const runIn = checkRunner(work, input.sandbox, cache, yield* inheritedEnvironment2(srtInheritedEnv2));
9571
+ const threadBudget = input.threadBudget ?? hostThreadBudget(1);
9572
+ const runIn = checkRunner(work, input.sandbox, cache, yield* inheritedEnvironment2(srtInheritedEnv2), threadBudget);
9536
9573
  const checkouts = runCheckouts(input.rootDir, input.gitCredentials);
9537
9574
  if (work.resolve !== undefined)
9538
9575
  return yield* resolveRevisions(work, work.resolve.revisions, checkouts);
@@ -9541,7 +9578,7 @@ var verificationExecutor = (input) => (work) => gen(function* () {
9541
9578
  if (work.compare !== undefined)
9542
9579
  return yield* compareRevisions(work, work.compare, checkouts);
9543
9580
  if (work.deploy !== undefined) {
9544
- const ran = yield* deployTag(work, work.deploy, checkouts, input.runsDeployScripts === true && work.deploy.runsScript === true, input.deployTimeout);
9581
+ const ran = yield* deployTag(work, work.deploy, checkouts, input.runsDeployScripts === true && work.deploy.runsScript === true, threadBudgetEnvironment(threadBudget), input.deployTimeout);
9545
9582
  if ("failed" in ran)
9546
9583
  return { status: "failed", failureSummary: ran.failed };
9547
9584
  return {
@@ -9778,6 +9815,7 @@ export {
9778
9815
  herdrRunnerCapabilitiesForRepoBinding2 as herdrRunnerCapabilitiesForRepoBinding,
9779
9816
  herdrSandboxBackends,
9780
9817
  homeDirectories,
9818
+ hostThreadBudget,
9781
9819
  inheritedEnvironment2 as inheritedEnvironment,
9782
9820
  isPathWithin2 as isPathWithin,
9783
9821
  kitMcpHosts,
@@ -9862,6 +9900,10 @@ export {
9862
9900
  systemProcessTable,
9863
9901
  systemStepProcessesLayer,
9864
9902
  systemdScopes,
9903
+ threadBudget,
9904
+ threadBudgetCollision,
9905
+ threadBudgetEnvironment,
9906
+ threadBudgetVariables,
9865
9907
  tomlKeyPath2 as tomlKeyPath,
9866
9908
  tomlTableHeader2 as tomlTableHeader,
9867
9909
  updateHerdrCore2 as updateHerdrCore,
@@ -1,4 +1,9 @@
1
1
  // @bun
2
+ import {
3
+ make10,
4
+ runForEach,
5
+ compiled2
6
+ } from "./chunk-sm340tvm.js";
2
7
  import {
3
8
  getOrUndefined,
4
9
  liftThrowable,
@@ -25,16 +30,11 @@ import {
25
30
  isJsonObject,
26
31
  isString2,
27
32
  encodeUnknownJsonStringSync
28
- } from "./chunk-h2f26xbd.js";
29
- import {
30
- make11,
31
- runForEach,
32
- compiled2
33
- } from "./chunk-j4b1yvcd.js";
33
+ } from "./chunk-61dmxexa.js";
34
34
  import {
35
35
  ChildProcessSpawner,
36
- make3
37
- } from "./chunk-bsgvmq34.js";
36
+ make2
37
+ } from "./chunk-j021bman.js";
38
38
 
39
39
  // packages/agent-runtime/src/opencode-store.ts
40
40
  import { lstatSync, readFileSync, realpathSync } from "fs";
@@ -172,8 +172,8 @@ var opencodeReaderCommand = () => compiled2 ? [process.execPath, "opencode-read"
172
172
  var isolatedRead = (store, name, input) => gen(function* () {
173
173
  const spawner = yield* ChildProcessSpawner;
174
174
  const [command, ...args] = opencodeReaderCommand();
175
- const handle = yield* spawner.spawn(make3(command, args, {
176
- stdin: make11(new TextEncoder().encode(encodeUnknownJsonStringSync({ store, name, input }))),
175
+ const handle = yield* spawner.spawn(make2(command, args, {
176
+ stdin: make10(new TextEncoder().encode(encodeUnknownJsonStringSync({ store, name, input }))),
177
177
  stderr: "ignore",
178
178
  extendEnv: false,
179
179
  env: {},
@@ -15,8 +15,8 @@ import {
15
15
  writeSrtSettings2,
16
16
  srtStepArgv2,
17
17
  srtArgv2
18
- } from "./chunk-j4b1yvcd.js";
19
- import"./chunk-h2f26xbd.js";
18
+ } from "./chunk-sm340tvm.js";
19
+ import"./chunk-61dmxexa.js";
20
20
  export {
21
21
  compiled2 as compiled,
22
22
  harnessesUnsupportedInDocker2 as harnessesUnsupportedInDocker,
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-bsgvmq34.js";
2
+ import"./chunk-j021bman.js";
3
3
  import {
4
4
  HERDR_CORE_GENERATION2,
5
5
  HERDR_CORE_INSTALL_COMMAND2,
@@ -12,9 +12,9 @@ import {
12
12
  herdrCoreLayer2,
13
13
  herdrCoreTransportLayer2,
14
14
  updateHerdrCore2
15
- } from "./chunk-xppw33hz.js";
16
- import"./chunk-j4b1yvcd.js";
17
- import"./chunk-h2f26xbd.js";
15
+ } from "./chunk-y6petreh.js";
16
+ import"./chunk-sm340tvm.js";
17
+ import"./chunk-61dmxexa.js";
18
18
  export {
19
19
  HERDR_CORE_GENERATION2 as HERDR_CORE_GENERATION,
20
20
  HERDR_CORE_INSTALL_COMMAND2 as HERDR_CORE_INSTALL_COMMAND,
@@ -7,10 +7,10 @@ import {
7
7
  decoded2,
8
8
  readOpencode2,
9
9
  runOpencodeReader2
10
- } from "./chunk-7re3n1ze.js";
11
- import"./chunk-bsgvmq34.js";
12
- import"./chunk-j4b1yvcd.js";
13
- import"./chunk-h2f26xbd.js";
10
+ } from "./chunk-e491q405.js";
11
+ import"./chunk-j021bman.js";
12
+ import"./chunk-sm340tvm.js";
13
+ import"./chunk-61dmxexa.js";
14
14
  export {
15
15
  decoded2 as decoded,
16
16
  decodedOption2 as decodedOption,
@@ -1,13 +1,6 @@
1
1
  // @bun
2
2
  import {
3
- isString,
4
- hasProperty,
5
- symbol,
6
- hash,
7
- symbol2,
8
- equals,
9
3
  BaseProto,
10
- PipeInspectableProto,
11
4
  Prototype,
12
5
  some,
13
6
  Service2,
@@ -21,8 +14,11 @@ import {
21
14
  andThen2,
22
15
  map9,
23
16
  raceFirst,
24
- scoped
25
- } from "./chunk-h2f26xbd.js";
17
+ scoped,
18
+ isRedacted,
19
+ make16,
20
+ value
21
+ } from "./chunk-61dmxexa.js";
26
22
  import {
27
23
  unwrap,
28
24
  drainFork,
@@ -31,49 +27,7 @@ import {
31
27
  runCollect,
32
28
  runDrain,
33
29
  mkString
34
- } from "./chunk-j4b1yvcd.js";
35
-
36
- // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/redacted.js
37
- var redactedRegistry = /* @__PURE__ */ new WeakMap;
38
- var value2 = (self) => {
39
- if (redactedRegistry.has(self)) {
40
- return redactedRegistry.get(self);
41
- } else {
42
- throw new Error("Unable to get redacted value" + (self.label ? ` with label: "${self.label}"` : ""));
43
- }
44
- };
45
-
46
- // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Redacted.js
47
- var TypeId = "~effect/Redacted";
48
- var isRedacted = (u) => hasProperty(u, TypeId);
49
- var make = (value, options) => {
50
- const self = Object.create(Proto);
51
- if (options?.label) {
52
- self.label = options.label;
53
- }
54
- redactedRegistry.set(self, value);
55
- return self;
56
- };
57
- var Proto = {
58
- [TypeId]: {
59
- _A: (_) => _
60
- },
61
- label: undefined,
62
- ...PipeInspectableProto,
63
- toJSON() {
64
- return this.toString();
65
- },
66
- toString() {
67
- return `<redacted${isString(this.label) ? ":" + this.label : ""}>`;
68
- },
69
- [symbol]() {
70
- return hash(redactedRegistry.get(this));
71
- },
72
- [symbol2](that) {
73
- return isRedacted(that) && equals(redactedRegistry.get(this), redactedRegistry.get(that));
74
- }
75
- };
76
- var value = value2;
30
+ } from "./chunk-sm340tvm.js";
77
31
 
78
32
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Brand.js
79
33
  function nominal() {
@@ -101,7 +55,7 @@ var HandleProto = {
101
55
  var makeHandle = (params) => Object.setPrototypeOf({
102
56
  ...params
103
57
  }, HandleProto);
104
- var make2 = (spawn) => {
58
+ var make = (spawn) => {
105
59
  const streamString = (command, options) => spawn(command).pipe(map9((handle) => decodeText(options?.includeStderr === true ? handle.all : drainFork(handle.stdout, handle.stderr))), unwrap);
106
60
  const streamLines = (command, options) => splitLines(streamString(command, options));
107
61
  return ChildProcessSpawner.of({
@@ -222,7 +176,7 @@ var parseTemplate = (texts, values) => {
222
176
  if (word.length === 0)
223
177
  return;
224
178
  const value = word.map(unwrap2).join("");
225
- words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make(value) : value);
179
+ words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make16(value) : value);
226
180
  word = [];
227
181
  plain = true;
228
182
  braceDepth = 0;
@@ -312,23 +266,23 @@ var parseTemplate = (texts, values) => {
312
266
  };
313
267
 
314
268
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/process/ChildProcess.js
315
- var TypeId2 = "~effect/process/ChildProcess";
316
- var Proto2 = {
269
+ var TypeId = "~effect/process/ChildProcess";
270
+ var Proto = {
317
271
  .../* @__PURE__ */ Prototype({
318
272
  label: "Command",
319
273
  evaluate(fiber) {
320
274
  return getUnsafe(fiber.context, ChildProcessSpawner).spawn(this);
321
275
  }
322
276
  }),
323
- [TypeId2]: TypeId2
277
+ [TypeId]: TypeId
324
278
  };
325
- var makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto2), {
279
+ var makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto), {
326
280
  _tag: "StandardCommand",
327
281
  command,
328
282
  args,
329
283
  options
330
284
  });
331
- var make3 = function make(...args) {
285
+ var make2 = function make(...args) {
332
286
  if (isTemplateString(args[0])) {
333
287
  const [templates, ...expressions] = args;
334
288
  const [command, cmdArgs] = parseTemplate2(templates, expressions);
@@ -386,4 +340,4 @@ var shellScript = (templates, expressions) => {
386
340
  }
387
341
  return script;
388
342
  };
389
- export { isRedacted, make, value, ExitCode, ProcessId, makeHandle, make2, ChildProcessSpawner, display, make3, parseFdName, fdName };
343
+ export { ExitCode, ProcessId, makeHandle, make, ChildProcessSpawner, display, make2, parseFdName, fdName };
@@ -2211,7 +2211,7 @@ var pathOfLink = (link) => {
2211
2211
  return page === null ? link : page[1] || "index";
2212
2212
  };
2213
2213
  var UnpinnedSdkLink = "https://cdn.jsdelivr.net/npm/@kitman-sh/sdk/";
2214
- var pinnedLink2 = (link, version = "0.27.1") => version === undefined || !link.startsWith(UnpinnedSdkLink) ? link : link.replace(UnpinnedSdkLink, `https://cdn.jsdelivr.net/npm/@kitman-sh/sdk@${version}/`);
2214
+ var pinnedLink2 = (link, version = "0.29.0") => version === undefined || !link.startsWith(UnpinnedSdkLink) ? link : link.replace(UnpinnedSdkLink, `https://cdn.jsdelivr.net/npm/@kitman-sh/sdk@${version}/`);
2215
2215
  var pageOf = (path) => path.split("#")[0];
2216
2216
  var exportName = (section) => section.path.startsWith("sdk/") ? section.path.split("#")[1] ?? "" : "";
2217
2217
  function excerpt(text, queryTerms) {