@kitman-sh/cli 0.11.2 → 0.11.3

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.
@@ -246,7 +246,7 @@ import {
246
246
  installCommand,
247
247
  checkServicesFile,
248
248
  checkServices
249
- } from "./chunk-9z371t6k.js";
249
+ } from "./chunk-5scsh754.js";
250
250
  import {
251
251
  join,
252
252
  interrupt,
@@ -302,8 +302,8 @@ import {
302
302
  applyAgentEnvironmentMaterialization2,
303
303
  isPathWithin2,
304
304
  skillIdentity2
305
- } from "./chunk-3y7j2s7v.js";
306
- import"./chunk-0ca9dqh5.js";
305
+ } from "./chunk-30jqf7ez.js";
306
+ import"./chunk-pxrpwv4z.js";
307
307
  import {
308
308
  egressAllowed,
309
309
  writeSecretRegistry,
@@ -328,8 +328,8 @@ import {
328
328
  rpcRunFiles,
329
329
  programHostsEnv,
330
330
  undeclaredHostsEnv
331
- } from "./chunk-mtpjpa2p.js";
332
- import"./chunk-bm7hjnrx.js";
331
+ } from "./chunk-2t3beh6a.js";
332
+ import"./chunk-3466x4xq.js";
333
333
  import {
334
334
  nextInt
335
335
  } from "./chunk-nzjb36ad.js";
@@ -337,7 +337,7 @@ import {
337
337
  ChildProcessSpawner,
338
338
  make3
339
339
  } from "./chunk-sk6ceghr.js";
340
- import"./chunk-5326a9ks.js";
340
+ import"./chunk-r2e1ke17.js";
341
341
 
342
342
  // packages/core/src/sync-kit.ts
343
343
  import { createHash } from "crypto";
@@ -105,7 +105,7 @@ import {
105
105
  KitDigest,
106
106
  KitSetup,
107
107
  RunnerRpcError
108
- } from "./chunk-9z371t6k.js";
108
+ } from "./chunk-5scsh754.js";
109
109
  import {
110
110
  runForEach,
111
111
  FileSystem
@@ -37,10 +37,10 @@ import {
37
37
  AgentHarnessIds,
38
38
  sha2562,
39
39
  runCommand2
40
- } from "./chunk-9z371t6k.js";
40
+ } from "./chunk-5scsh754.js";
41
41
  import {
42
42
  NpmRegistry
43
- } from "./chunk-0ca9dqh5.js";
43
+ } from "./chunk-pxrpwv4z.js";
44
44
 
45
45
  // packages/agent-runtime/src/config-convergence.ts
46
46
  var writeAgentEnvironmentConfigFile2 = fnUntraced(function* (file, content, keep = {}) {
@@ -19,13 +19,13 @@ import {
19
19
  RunnerReplicaRpcs,
20
20
  RunnerRunFileRpcs,
21
21
  ProgramRpcs
22
- } from "./chunk-9z371t6k.js";
22
+ } from "./chunk-5scsh754.js";
23
23
  import {
24
24
  layerJson,
25
25
  make4,
26
26
  withHeaders,
27
27
  layerProtocolSocket
28
- } from "./chunk-5326a9ks.js";
28
+ } from "./chunk-r2e1ke17.js";
29
29
 
30
30
  // packages/live/src/rpc/runner-client.ts
31
31
  var proxiedWebSocket = (proxy) => succeed5(WebSocketConstructor)((target) => {
@@ -159,7 +159,7 @@ import {
159
159
  runMcpEffect,
160
160
  createAgentAuthSignedFetch,
161
161
  setupMcpAgentCredential
162
- } from "./chunk-9z371t6k.js";
162
+ } from "./chunk-5scsh754.js";
163
163
  import {
164
164
  guard,
165
165
  Id,
@@ -202,7 +202,7 @@ import {
202
202
  withHeaders,
203
203
  layerProtocolSocket,
204
204
  ConnectionHooks
205
- } from "./chunk-5326a9ks.js";
205
+ } from "./chunk-r2e1ke17.js";
206
206
 
207
207
  // apps/cli/src/mcp.ts
208
208
  import { tmpdir as tmpdir2 } from "os";
@@ -8079,6 +8079,21 @@ function deliveryProviderActions(providerActions, delivery) {
8079
8079
  release: posture("release")
8080
8080
  };
8081
8081
  }
8082
+ var releaseVersion = (version) => {
8083
+ const parts = /^v?(\d+)\.(\d+)\.(\d+)(-.+)?$/u.exec(version);
8084
+ if (parts === null)
8085
+ return;
8086
+ const suffix = parts[4];
8087
+ const stage = suffix === undefined ? 1 : /^-\d+-g[0-9a-f]+$/u.test(suffix) ? 2 : 0;
8088
+ return { numbers: [...parts.slice(1, 4).map(Number), stage], stable: suffix === undefined };
8089
+ };
8090
+ var newerKitmanVersion = (candidate, running) => {
8091
+ const [a, b] = [releaseVersion(candidate), releaseVersion(running)];
8092
+ if (a === undefined || b === undefined)
8093
+ return true;
8094
+ const differing = a.numbers.findIndex((part, index) => part !== b.numbers[index]);
8095
+ return differing !== -1 && (a.numbers[differing] ?? 0) > (b.numbers[differing] ?? 0);
8096
+ };
8082
8097
  // packages/core/src/team-context.ts
8083
8098
  var BranchTemplate = String4.check(isMinLength(1), isMaxLength(160));
8084
8099
  var DeliveryMode = Literals(["gated", "auto"]);
@@ -15981,4 +15996,4 @@ function checkServices(declaration) {
15981
15996
  return isSome(decoded) ? [...new Set(decoded.value.services)] : undefined;
15982
15997
  }
15983
15998
 
15984
- export { Clock, currentTimeMillis, WebCrypto, SecureRandom, layerWebCrypto, makeUnsafe, formatIso, empty, fromInput, merge, runMain, layer, layer2, Stdio, Terminal, layer3, error, log, toDate, parseDate, toIso, currentDate, wallClockMillis, waitingOnWords, queueWords, scanDurableSurface, redactResponseSurface, redactCredentials, redactedOutputTail, SafeJson, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, findForbiddenRepoBindingSecretPath, AgentSandboxNetwork, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, AgentEfforts, AgentCapabilities, LoopDataSchemaRef, RunDisplayStates, LoopVersion, ProgramLoop, AgentFallback, RunWaitUntils, isTestReportName, checkTests, ProgramWorkUnit, MeasureSample, MeasureEvidence, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, MaxRunnerConcurrency, PinnedImage, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, repositoryKey, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make5, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, KitName, KitDigest, defaultKitName, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make6, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make7, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, RunSettled, UpdateAvailable, RunnerReplicaRpcs, RunnerRunFileRpcs, ProgramRpcs, parseCallbackUrl, revokeToken, toStoredSession, browserLogin, openBrowser, shouldRefresh, createSdkClient, refreshSession, AgentAuthClientError, executeAgentCapability, createAgentAuthBearerToken, McpPlatformLive, runMcpEffect, createAgentAuthSignedFetch, setupMcpAgentCredential, generateAgentKeyPair, HERDR_CORE_GENERATION2, HERDR_CORE_INSTALL_COMMAND2, HerdrCoreMissing2, HerdrCoreIncompatible2, HerdrCoreConnectionLost2, HerdrCoreRpcError2, HerdrCoreUpdateFailed2, HerdrCore2, herdrCoreLayer2, herdrCoreTransportLayer2, updateHerdrCore2, CommandFailed2, runCommand2, withoutPreloads2, shellOutputTailChars2, runProcess2, CommandRunner2, runShell2, detectHarnesses2, kitHarnesses, isKitHarness, instructionsStart, instructionsEnd, harnessNames, renderMcpServer, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices };
15999
+ export { Clock, currentTimeMillis, WebCrypto, SecureRandom, layerWebCrypto, makeUnsafe, formatIso, empty, fromInput, merge, runMain, layer, layer2, Stdio, Terminal, layer3, error, log, toDate, parseDate, toIso, currentDate, wallClockMillis, waitingOnWords, queueWords, scanDurableSurface, redactResponseSurface, redactCredentials, redactedOutputTail, SafeJson, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, findForbiddenRepoBindingSecretPath, AgentSandboxNetwork, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, AgentEfforts, AgentCapabilities, LoopDataSchemaRef, RunDisplayStates, LoopVersion, ProgramLoop, AgentFallback, RunWaitUntils, isTestReportName, checkTests, ProgramWorkUnit, MeasureSample, MeasureEvidence, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, MaxRunnerConcurrency, PinnedImage, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, newerKitmanVersion, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, repositoryKey, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make5, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, KitName, KitDigest, defaultKitName, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make6, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make7, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, RunSettled, UpdateAvailable, RunnerReplicaRpcs, RunnerRunFileRpcs, ProgramRpcs, parseCallbackUrl, revokeToken, toStoredSession, browserLogin, openBrowser, shouldRefresh, createSdkClient, refreshSession, AgentAuthClientError, executeAgentCapability, createAgentAuthBearerToken, McpPlatformLive, runMcpEffect, createAgentAuthSignedFetch, setupMcpAgentCredential, generateAgentKeyPair, HERDR_CORE_GENERATION2, HERDR_CORE_INSTALL_COMMAND2, HerdrCoreMissing2, HerdrCoreIncompatible2, HerdrCoreConnectionLost2, HerdrCoreRpcError2, HerdrCoreUpdateFailed2, HerdrCore2, herdrCoreLayer2, herdrCoreTransportLayer2, updateHerdrCore2, CommandFailed2, runCommand2, withoutPreloads2, shellOutputTailChars2, runProcess2, CommandRunner2, runShell2, detectHarnesses2, kitHarnesses, isKitHarness, instructionsStart, instructionsEnd, harnessNames, renderMcpServer, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices };
@@ -12,7 +12,7 @@ import {
12
12
  herdrCoreLayer2,
13
13
  herdrCoreTransportLayer2,
14
14
  updateHerdrCore2
15
- } from "./chunk-9z371t6k.js";
15
+ } from "./chunk-5scsh754.js";
16
16
  import"./chunk-3d4d52e5.js";
17
17
  import"./chunk-vtfwjhzh.js";
18
18
  export {
@@ -38,7 +38,7 @@ import {
38
38
  get2,
39
39
  layer4,
40
40
  KitDigest
41
- } from "./chunk-9z371t6k.js";
41
+ } from "./chunk-5scsh754.js";
42
42
 
43
43
  // packages/core/src/npm-registry.ts
44
44
  var KitManifest = Struct({
@@ -123,7 +123,7 @@ import {
123
123
  ParseOptions,
124
124
  RpcClientDefect,
125
125
  RpcClientError
126
- } from "./chunk-9z371t6k.js";
126
+ } from "./chunk-5scsh754.js";
127
127
 
128
128
  // node_modules/.bun/effect@4.1.2/node_modules/effect/dist/workers/Transferable.js
129
129
  class Collector extends (/* @__PURE__ */ Service2()("effect/workers/Transferable/Collector")) {
@@ -26,15 +26,15 @@ import {
26
26
  tomlKeyPath2,
27
27
  kitmanSkillEntry,
28
28
  isPathWithin2
29
- } from "./chunk-3y7j2s7v.js";
29
+ } from "./chunk-30jqf7ez.js";
30
30
  import {
31
31
  instructionsStart,
32
32
  instructionsEnd,
33
33
  renderMcpServer,
34
34
  materializeKitSetup,
35
35
  tomlInline
36
- } from "./chunk-9z371t6k.js";
37
- import"./chunk-0ca9dqh5.js";
36
+ } from "./chunk-5scsh754.js";
37
+ import"./chunk-pxrpwv4z.js";
38
38
  import"./chunk-sk6ceghr.js";
39
39
 
40
40
  // packages/agent-runtime/src/kit-setup-sync.ts
@@ -4,9 +4,9 @@ import {
4
4
  runnerRpcUrl2,
5
5
  makeRunnerRpcClient2,
6
6
  makeProgramRpcClient2
7
- } from "./chunk-bm7hjnrx.js";
8
- import"./chunk-5326a9ks.js";
9
- import"./chunk-9z371t6k.js";
7
+ } from "./chunk-3466x4xq.js";
8
+ import"./chunk-r2e1ke17.js";
9
+ import"./chunk-5scsh754.js";
10
10
  import"./chunk-0qz10ek8.js";
11
11
  import"./chunk-c6rbt85q.js";
12
12
  import"./chunk-3d4d52e5.js";
@@ -35,6 +35,14 @@ import {
35
35
  } from "./chunk-vtfwjhzh.js";
36
36
  import"./chunk-0qz10ek8.js";
37
37
  import"./chunk-c6rbt85q.js";
38
+ import {
39
+ decodeText,
40
+ mkString,
41
+ FileSystem,
42
+ Path,
43
+ withDefault,
44
+ String2
45
+ } from "./chunk-3d4d52e5.js";
38
46
  import {
39
47
  SecureRandom,
40
48
  layerWebCrypto,
@@ -46,31 +54,23 @@ import {
46
54
  layer4,
47
55
  kitmanMcpServer,
48
56
  RunnerRpcProtocolVersion
49
- } from "./chunk-9z371t6k.js";
50
- import {
51
- decodeText,
52
- mkString,
53
- FileSystem,
54
- Path,
55
- withDefault,
56
- String2
57
- } from "./chunk-3d4d52e5.js";
57
+ } from "./chunk-5scsh754.js";
58
58
  import {
59
59
  Packument,
60
60
  tarballMatches
61
- } from "./chunk-0ca9dqh5.js";
62
- import"./chunk-bm7hjnrx.js";
61
+ } from "./chunk-pxrpwv4z.js";
62
+ import"./chunk-3466x4xq.js";
63
63
  import {
64
64
  AgentDeclaration,
65
65
  KitDeclarations,
66
66
  describeFlag,
67
67
  Described
68
- } from "./chunk-mtpjpa2p.js";
68
+ } from "./chunk-2t3beh6a.js";
69
69
  import {
70
70
  ChildProcessSpawner,
71
71
  make3
72
72
  } from "./chunk-sk6ceghr.js";
73
- import"./chunk-5326a9ks.js";
73
+ import"./chunk-r2e1ke17.js";
74
74
 
75
75
  // packages/sdk/src/build/index.ts
76
76
  class DependencyInstallFailed extends TaggedError2()("DependencyInstallFailed", {
@@ -141,6 +141,7 @@ import {
141
141
  shownRunnerSetting,
142
142
  defaultRunnerCapabilities,
143
143
  deliveryProviderActions,
144
+ newerKitmanVersion,
144
145
  MemoryStatuses,
145
146
  MemoryScopes,
146
147
  MaxMemoryListLimit,
@@ -217,7 +218,7 @@ import {
217
218
  harnessNames,
218
219
  herdrRunnerCapabilities2,
219
220
  declaredChecks
220
- } from "./chunk-9z371t6k.js";
221
+ } from "./chunk-5scsh754.js";
221
222
  import {
222
223
  Id
223
224
  } from "./chunk-0qz10ek8.js";
@@ -529,10 +530,10 @@ var sandboxMissing = (sandbox, missing) => ({
529
530
  var personalCheckBackend = (agentSandbox, dockerAvailable) => agentSandbox === "srt" || agentSandbox === "docker" && dockerAvailable ? agentSandbox : undefined;
530
531
  var herdrCoreSession = (runnerId, personal) => personal ? undefined : `kitman-${sha2562(runnerId).slice(0, 16)}`;
531
532
  var OpenHerdrCore = Reference("kitman/cli/OpenHerdrCore", {
532
- defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-ryed23pv.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
533
+ defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-6f0sjc6r.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
533
534
  });
534
535
  var UpdateHerdrCore = Reference("kitman/cli/UpdateHerdrCore", {
535
- defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-ryed23pv.js")), (module) => module.updateHerdrCore(options))
536
+ defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-6f0sjc6r.js")), (module) => module.updateHerdrCore(options))
536
537
  });
537
538
  var herdrCoreMissing = (error) => {
538
539
  if (isTagged(error, "HerdrCoreMissing"))
@@ -809,40 +810,35 @@ class RunnerUpdated extends TaggedError("RunnerUpdated") {
809
810
  class UpdateStepFailed extends TaggedError("UpdateStepFailed") {
810
811
  }
811
812
  var step = (name) => (effect) => mapError2(effect, (error) => new UpdateStepFailed({ step: name, reason: error.message }));
813
+
814
+ class NothingNewer extends TaggedError("NothingNewer") {
815
+ }
812
816
  var DrainLimit = "30 minutes";
813
817
  var RequiredRetryAfter = minutes(10);
814
- var releaseNumbers = (version) => /^v?(\d+)\.(\d+)\.(\d+)/u.exec(version)?.slice(1).map(Number);
815
- var newerThan = (candidate, running) => {
816
- const [a, b] = [releaseNumbers(candidate), releaseNumbers(running)];
817
- if (a === undefined || b === undefined)
818
- return true;
819
- const differing = a.findIndex((part, index) => part !== b[index]);
820
- return differing !== -1 && (a[differing] ?? 0) > (b[differing] ?? 0);
821
- };
818
+ var OfferedRetryAfter = minutes(2);
822
819
  var runnerUpdater = (input) => {
823
820
  let claiming = true;
824
821
  let updating = false;
825
822
  let problems = [];
826
823
  const failed = new Set;
827
824
  let requiredFailedAt;
828
- const drain = (onLimit) => suspend3(() => {
825
+ const drain = suspend3(() => {
829
826
  claiming = false;
830
827
  return gen(function* () {
831
828
  while ((yield* input.inFlight) > 0)
832
829
  yield* sleep("1 second");
833
- }).pipe(timeoutOrElse({ duration: DrainLimit, orElse: () => onLimit }));
830
+ }).pipe(timeoutOrElse({ duration: DrainLimit, orElse: () => void_3 }));
834
831
  });
835
- const attempt = (required) => gen(function* () {
832
+ const attempt = gen(function* () {
836
833
  const downloaded = yield* downloadManagedKitman(input.apiUrl, input.platform).pipe(filterOrFail((found) => found !== undefined, () => new UpdateStepFailed({ step: "download", reason: `${input.apiUrl} serves no kitman` })), step("download"));
837
- if (required && input.version !== undefined && !newerThan(downloaded.version, input.version))
838
- return yield* new UpdateStepFailed({
839
- step: "download",
834
+ if (input.version !== undefined && !newerKitmanVersion(downloaded.version, input.version))
835
+ return yield* new NothingNewer({
840
836
  reason: `${input.apiUrl} serves kitman ${downloaded.version}, not newer than this Runner's ${input.version}`
841
837
  });
842
838
  const reported = (yield* runCommand2(downloaded.kitman, ["--version"], { timeout: "30 seconds" }).pipe(step("start"))).trim();
843
839
  if (reported !== downloaded.version)
844
840
  return yield* new UpdateStepFailed({ step: "start", reason: `it reported version ${reported || "none"}` });
845
- yield* drain(required ? void_3 : fail7(new UpdateStepFailed({ step: "drain", reason: "its work in flight did not finish in 30 minutes" })));
841
+ yield* drain;
846
842
  yield* linkManagedKitman(downloaded.kitman).pipe(step("switch"));
847
843
  return yield* new RunnerUpdated({ version: downloaded.version });
848
844
  });
@@ -850,30 +846,43 @@ var runnerUpdater = (input) => {
850
846
  if (updating || failed.has(version))
851
847
  return void_3;
852
848
  updating = true;
853
- return attempt(false).pipe(catchTag("UpdateStepFailed", ({ step: failedStep, reason }) => sync2(() => {
854
- failed.add(version);
855
- claiming = true;
856
- problems = [
857
- {
858
- code: "update_failed",
859
- message: `Updating kitman to ${version} failed at the ${failedStep} step: ${reason}`.slice(0, 500),
860
- fix: `It keeps running its current version. Check that this machine reaches ${input.apiUrl}, then run \`kitman runner restart ${input.runnerId}\` here to try again.`.slice(0, 500)
861
- }
862
- ];
863
- })), ensuring2(sync2(() => updating = false)));
849
+ const untilNewer = gen(function* () {
850
+ for (;; ) {
851
+ const reason = yield* attempt.pipe(catchTag("NothingNewer", ({ reason }) => succeed6(reason)));
852
+ yield* error(`Not updating kitman to ${version} yet: ${reason}. Checking again in ${toMinutes(OfferedRetryAfter)} minutes.`);
853
+ yield* sleep(OfferedRetryAfter);
854
+ }
855
+ });
856
+ return untilNewer.pipe(catchTags({
857
+ UpdateStepFailed: ({ step: failedStep, reason }) => sync2(() => {
858
+ failed.add(version);
859
+ claiming = true;
860
+ problems = [
861
+ {
862
+ code: "update_failed",
863
+ message: `Updating kitman to ${version} failed at the ${failedStep} step: ${reason}`.slice(0, 500),
864
+ fix: `It keeps running its current version. Check that this machine reaches ${input.apiUrl}, then run \`kitman runner restart ${input.runnerId}\` here to try again.`.slice(0, 500)
865
+ }
866
+ ];
867
+ })
868
+ }), ensuring2(sync2(() => updating = false)));
864
869
  });
865
870
  const updateRequired = gen(function* () {
866
871
  const now = yield* currentTimeMillis;
867
872
  if (updating || requiredFailedAt !== undefined && now - requiredFailedAt < toMillis(RequiredRetryAfter))
868
873
  return;
869
874
  updating = true;
870
- return yield* attempt(true).pipe(catchTag("UpdateStepFailed", ({ step: failedStep, reason }) => gen(function* () {
875
+ const retryLater = (failedStep, reason) => gen(function* () {
871
876
  requiredFailedAt = yield* currentTimeMillis;
872
877
  claiming = true;
873
878
  yield* error(`Kitman refuses this Runner's client protocol, and updating kitman failed at the ${failedStep} step: ${reason}. Trying again in ${toMinutes(RequiredRetryAfter)} minutes.`);
874
- })), ensuring2(sync2(() => updating = false)));
879
+ });
880
+ return yield* attempt.pipe(catchTags({
881
+ NothingNewer: ({ reason }) => retryLater("download", reason),
882
+ UpdateStepFailed: ({ step: failedStep, reason }) => retryLater(failedStep, reason)
883
+ }), ensuring2(sync2(() => updating = false)));
875
884
  });
876
- const servesNewer = (served) => input.version === undefined || served === undefined || newerThan(served.version, input.version);
885
+ const servesNewer = (served) => input.version === undefined || served === undefined || newerKitmanVersion(served.version, input.version);
877
886
  const stopWhenDrained = (stop) => gen(function* () {
878
887
  const now = yield* currentTimeMillis;
879
888
  if (updating || requiredFailedAt !== undefined && now - requiredFailedAt < toMillis(RequiredRetryAfter))
@@ -881,16 +890,26 @@ var runnerUpdater = (input) => {
881
890
  updating = true;
882
891
  const served = input.version === undefined ? succeed(undefined) : yield* result(servedKitmanRelease(input.apiUrl));
883
892
  if (isSuccess(served) && servesNewer(served.success))
884
- return yield* andThen2(drain(void_3), fail7(stop));
893
+ return yield* andThen2(drain, fail7(stop));
885
894
  requiredFailedAt = now;
886
895
  updating = false;
887
896
  const reason = isSuccess(served) ? `serves kitman ${served.success?.version}, not newer than this Runner's ${input.version}` : `its release could not be read: ${served.failure.message}`;
888
897
  yield* error(`Kitman refuses this Runner's client protocol, but ${reason}. Checking again in ${toMinutes(RequiredRetryAfter)} minutes.`);
889
898
  });
899
+ const cannotUpdate = (version) => sync2(() => {
900
+ problems = [
901
+ {
902
+ code: "update_required",
903
+ message: `This Runner cannot update itself here, and its control plane serves kitman ${version}, newer than the one it runs.`,
904
+ fix: `Run it from an image with kitman ${version}, then start it again.`
905
+ }
906
+ ];
907
+ });
890
908
  return {
891
909
  claiming: () => claiming,
892
910
  problems: () => problems,
893
911
  update,
912
+ cannotUpdate,
894
913
  updateRequired,
895
914
  stopWhenDrained
896
915
  };
@@ -934,7 +953,7 @@ var syncTargets = (harness) => gen(function* () {
934
953
  });
935
954
  var syncKits = (input) => gen(function* () {
936
955
  const fs = yield* FileSystem;
937
- const { syncKitSetup } = yield* promise(() => import("./chunk-5tp7y1kc.js"));
956
+ const { syncKitSetup } = yield* promise(() => import("./chunk-rrg23eed.js"));
938
957
  const harnesses = yield* syncTargets(input.harness);
939
958
  const chain = yield* input.client.getKitChain(input.workspaceId);
940
959
  for (const { name, problem } of chain.skipped)
@@ -1852,7 +1871,7 @@ var package_default = {
1852
1871
  };
1853
1872
 
1854
1873
  // apps/cli/src/scaffold.ts
1855
- var cliVersion = "0.11.2";
1874
+ var cliVersion = "0.11.3";
1856
1875
  var packageJson = (name, scaffold) => `${JSON.stringify({
1857
1876
  name,
1858
1877
  private: true,
@@ -2118,7 +2137,7 @@ var Usage = [
2118
2137
  "Every run, loop, agent, verify, constraint, secret, claim, deploy, dev and kit command takes --json."
2119
2138
  ].join(`
2120
2139
  `);
2121
- var agentRuntime = promise(() => import("./chunk-rfn4jgah.js"));
2140
+ var agentRuntime = promise(() => import("./chunk-0ebt5ek2.js"));
2122
2141
  var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
2123
2142
  defaultValue: () => gen(function* () {
2124
2143
  const tui = yield* tryPromise({
@@ -3115,7 +3134,7 @@ var SandboxHostProbe = Reference("kitman/cli/SandboxHostProbe", {
3115
3134
  });
3116
3135
  var OpenRunnerRpc = Reference("kitman/cli/OpenRunnerRpc", {
3117
3136
  defaultValue: () => (options) => gen(function* () {
3118
- const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-gjt5m6xc.js"));
3137
+ const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-t2eqpjdk.js"));
3119
3138
  return yield* makeRunnerRpcClient({
3120
3139
  runnerId: options.runnerId,
3121
3140
  bearer: options.bearer,
@@ -3406,7 +3425,7 @@ function startCanonicalHerdrRunnerCommand(input) {
3406
3425
  signals,
3407
3426
  checkouts,
3408
3427
  reconnectAfter: "2 seconds",
3409
- update: (version) => container ? void_3 : startUpdate(updater.update(version))
3428
+ update: (version) => container ? updater.cannotUpdate(version) : startUpdate(updater.update(version))
3410
3429
  }).pipe(forkScoped);
3411
3430
  const sharedSandbox = personal ? undefined : {
3412
3431
  runner: runnerState,
@@ -3639,7 +3658,7 @@ function mcpCommand(args) {
3639
3658
  if (command.action === "run") {
3640
3659
  if (command.args.length > 0)
3641
3660
  return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
3642
- const { runMcpServerCommand } = yield* promise(() => import("./chunk-hvr790k3.js"));
3661
+ const { runMcpServerCommand } = yield* promise(() => import("./chunk-45fy4v4q.js"));
3643
3662
  return yield* runMcpServerCommand({ flags: command.flags });
3644
3663
  }
3645
3664
  if (command.action !== "setup")
@@ -4909,9 +4928,9 @@ function changeRequestCommand(args) {
4909
4928
  yield* log(command.action === "approve" ? `Approved ${short} of ${changeRequest.title}. A Run waiting on approval of ${short} resumes; one waiting on another head does not.` : `Requested changes to ${short} of ${changeRequest.title}`);
4910
4929
  });
4911
4930
  }
4912
- var KitWriter = map8(promise(() => import("./chunk-956h42xv.js")), (build) => build.writeKit);
4931
+ var KitWriter = map8(promise(() => import("./chunk-x8tn2md0.js")), (build) => build.writeKit);
4913
4932
  var KitBuilder = Reference("kitman/cli/KitBuilder", {
4914
- defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-956h42xv.js")), (build) => build.buildKit(directory))
4933
+ defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-x8tn2md0.js")), (build) => build.buildKit(directory))
4915
4934
  });
4916
4935
  var uploadKit = (client, workspaceId, built) => gen(function* () {
4917
4936
  yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
package/dist/index.js CHANGED
@@ -14,6 +14,6 @@ if (args[0] === "srt") {
14
14
  const { runOpencodeReader } = await import("./chunk-d9bv70qb.js");
15
15
  runOpencodeReader();
16
16
  } else {
17
- const { runCli } = await import("./chunk-7wptm1tk.js");
17
+ const { runCli } = await import("./chunk-yqarnbky.js");
18
18
  runCli(args);
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitman-sh/cli",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {