@kitman-sh/cli 0.10.97 → 0.10.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-mrzmq4jq.js → chunk-0a10kdrd.js} +4 -4
- package/dist/{chunk-k6ndhjcd.js → chunk-0hjtwtms.js} +50 -25
- package/dist/{chunk-nwqcmdtz.js → chunk-0tsc91qr.js} +5 -4
- package/dist/{chunk-jtyxjjvs.js → chunk-2fs34341.js} +36 -30
- package/dist/{chunk-q4q69zgm.js → chunk-3ka78n56.js} +7 -7
- package/dist/{chunk-w0sehmpd.js → chunk-3r7ahnwy.js} +60 -14
- package/dist/{chunk-gfe4kk5k.js → chunk-3v70x040.js} +5 -5
- package/dist/{chunk-3tjssyvf.js → chunk-4sswz0mn.js} +8 -8
- package/dist/{chunk-t8ny8exc.js → chunk-56e202xk.js} +7 -7
- package/dist/{chunk-qr0n7rde.js → chunk-6vmpa1nw.js} +12 -12
- package/dist/{chunk-c3k32vw4.js → chunk-a244myqw.js} +1 -1
- package/dist/{chunk-yzmyy4vs.js → chunk-abf4m4b2.js} +5 -5
- package/dist/{chunk-dstm8aen.js → chunk-ampzxrqe.js} +28 -70
- package/dist/{chunk-k4fvnphp.js → chunk-bk3dpjxq.js} +1 -1
- package/dist/{chunk-mbqeakm1.js → chunk-et6qa95h.js} +1 -1
- package/dist/{chunk-hsf2sj69.js → chunk-fv6kgtze.js} +2 -2
- package/dist/{chunk-9m9cv82t.js → chunk-g3r5xp0t.js} +2 -2
- package/dist/{chunk-y8dzp1t8.js → chunk-k0shg2fb.js} +198 -129
- package/dist/{chunk-rmsm8vnc.js → chunk-rdv42ygn.js} +4 -4
- package/dist/{chunk-mkr1nwdy.js → chunk-rp224rm4.js} +3 -3
- package/dist/{chunk-3snbxcct.js → chunk-rrj434w6.js} +330 -102
- package/dist/{chunk-2ndnvcp3.js → chunk-t7ncjd6s.js} +8 -8
- package/dist/{chunk-25q7mg6g.js → chunk-vjcn82g3.js} +17 -17
- package/dist/{chunk-mxqrv47k.js → chunk-z2f9enrp.js} +5 -5
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -6,13 +6,14 @@ import {
|
|
|
6
6
|
getOrUndefined,
|
|
7
7
|
Reference,
|
|
8
8
|
TaggedError,
|
|
9
|
-
|
|
9
|
+
make16,
|
|
10
10
|
_await,
|
|
11
11
|
fail5,
|
|
12
12
|
succeed5,
|
|
13
13
|
provide2,
|
|
14
14
|
provideMerge,
|
|
15
15
|
squash,
|
|
16
|
+
pretty,
|
|
16
17
|
max2,
|
|
17
18
|
during,
|
|
18
19
|
min2,
|
|
@@ -40,6 +41,7 @@ import {
|
|
|
40
41
|
catch_,
|
|
41
42
|
catchTag,
|
|
42
43
|
catchTags,
|
|
44
|
+
catchCause2,
|
|
43
45
|
catchIf,
|
|
44
46
|
mapError2,
|
|
45
47
|
tapError2,
|
|
@@ -85,7 +87,7 @@ import {
|
|
|
85
87
|
decodeJsonString,
|
|
86
88
|
encodeJsonStringSync,
|
|
87
89
|
encodePrettyJsonString
|
|
88
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-ampzxrqe.js";
|
|
89
91
|
import {
|
|
90
92
|
tap,
|
|
91
93
|
mapError,
|
|
@@ -97,7 +99,7 @@ import {
|
|
|
97
99
|
withDefault,
|
|
98
100
|
option,
|
|
99
101
|
String2
|
|
100
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-vjcn82g3.js";
|
|
101
103
|
import {
|
|
102
104
|
currentTimeMillis,
|
|
103
105
|
SecureRandom,
|
|
@@ -113,6 +115,7 @@ import {
|
|
|
113
115
|
waitingOnWords,
|
|
114
116
|
queueWords,
|
|
115
117
|
redactResponseSurface,
|
|
118
|
+
NetworkHost,
|
|
116
119
|
RepoBindingProviders,
|
|
117
120
|
RepoBindingCredentialProviderTypes,
|
|
118
121
|
ContextPackModes,
|
|
@@ -120,6 +123,13 @@ import {
|
|
|
120
123
|
ProposalStatuses,
|
|
121
124
|
ProposalTargetTypes,
|
|
122
125
|
RunDisplayStates,
|
|
126
|
+
RunnerExecutionBackend,
|
|
127
|
+
MaxRunnerConcurrency,
|
|
128
|
+
PinnedImage,
|
|
129
|
+
RunnerSettingNames,
|
|
130
|
+
RunnerSettingsUpdate,
|
|
131
|
+
defaultRunnerSettings,
|
|
132
|
+
shownRunnerSetting,
|
|
123
133
|
defaultRunnerCapabilities,
|
|
124
134
|
MemoryStatuses,
|
|
125
135
|
MemoryScopes,
|
|
@@ -135,7 +145,7 @@ import {
|
|
|
135
145
|
digestSha256,
|
|
136
146
|
sha256Hasher,
|
|
137
147
|
raw,
|
|
138
|
-
|
|
148
|
+
make5,
|
|
139
149
|
get,
|
|
140
150
|
put,
|
|
141
151
|
HttpClient,
|
|
@@ -197,10 +207,10 @@ import {
|
|
|
197
207
|
harnessNames,
|
|
198
208
|
herdrRunnerCapabilities2,
|
|
199
209
|
declaredChecks
|
|
200
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-k0shg2fb.js";
|
|
201
211
|
import {
|
|
202
212
|
Id
|
|
203
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-et6qa95h.js";
|
|
204
214
|
import {
|
|
205
215
|
toJsonValue,
|
|
206
216
|
isOneOf,
|
|
@@ -210,11 +220,11 @@ import {
|
|
|
210
220
|
isObject,
|
|
211
221
|
isJsonObject,
|
|
212
222
|
isString
|
|
213
|
-
} from "./chunk-
|
|
223
|
+
} from "./chunk-bk3dpjxq.js";
|
|
214
224
|
import {
|
|
215
225
|
ChildProcessSpawner,
|
|
216
|
-
|
|
217
|
-
} from "./chunk-
|
|
226
|
+
make3
|
|
227
|
+
} from "./chunk-3r7ahnwy.js";
|
|
218
228
|
|
|
219
229
|
// apps/cli/src/cli-error.ts
|
|
220
230
|
function cliErrorCode(error, status) {
|
|
@@ -487,27 +497,20 @@ var runnerRemoved = {
|
|
|
487
497
|
};
|
|
488
498
|
var sandboxInstall = {
|
|
489
499
|
srt: process.platform === "darwin" ? "Install what it needs with `brew install ripgrep`" : "Install what it needs with `sudo apt install bubblewrap socat ripgrep` (or your distribution\u2019s packages)",
|
|
490
|
-
docker: "Install and start Docker (https://docs.docker.com/engine/install/), and
|
|
500
|
+
docker: "Install and start Docker (https://docs.docker.com/engine/install/), and give the Runner a Docker image pinned by digest in its settings"
|
|
491
501
|
};
|
|
492
502
|
var sandboxMissing = (sandbox, missing) => ({
|
|
493
503
|
code: "sandbox_missing",
|
|
494
504
|
message: `\`${sandbox}\` is not available on this host: ${missing.join("; ")}.`.slice(0, 500),
|
|
495
|
-
fix: `${sandboxInstall[sandbox]},
|
|
505
|
+
fix: `${sandboxInstall[sandbox]}, then restart the Runner; or choose another sandbox in its settings, with \`kitman runner settings\` or on its page in Kitman.`
|
|
496
506
|
});
|
|
497
507
|
var personalCheckBackend = (agentSandbox, dockerAvailable) => agentSandbox === "srt" || agentSandbox === "docker" && dockerAvailable ? agentSandbox : undefined;
|
|
498
|
-
var checkHostsSetting = (value) => (value ?? "").split(",").map((host) => host.trim()).filter((host) => host !== "");
|
|
499
|
-
var pinnedImage = (value) => {
|
|
500
|
-
const image = value?.trim();
|
|
501
|
-
return image !== undefined && /@sha256:[a-f0-9]{64}$/.test(image) ? image : undefined;
|
|
502
|
-
};
|
|
503
|
-
var checkDockerImageSetting = pinnedImage;
|
|
504
|
-
var checkRegistryImageSetting = pinnedImage;
|
|
505
508
|
var herdrCoreSession = (runnerId, personal) => personal ? undefined : `kitman-${sha2562(runnerId).slice(0, 16)}`;
|
|
506
509
|
var OpenHerdrCore = Reference("kitman/cli/OpenHerdrCore", {
|
|
507
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
510
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-0a10kdrd.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
|
|
508
511
|
});
|
|
509
512
|
var UpdateHerdrCore = Reference("kitman/cli/UpdateHerdrCore", {
|
|
510
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
513
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-0a10kdrd.js")), (module) => module.updateHerdrCore(options))
|
|
511
514
|
});
|
|
512
515
|
var herdrCoreMissing = (error) => {
|
|
513
516
|
if (isTagged(error, "HerdrCoreMissing"))
|
|
@@ -559,6 +562,125 @@ var startupStep = (step, bound, attempt) => attempt.pipe(timeoutOrElse({ duratio
|
|
|
559
562
|
});
|
|
560
563
|
}));
|
|
561
564
|
|
|
565
|
+
// apps/cli/src/runner-settings.ts
|
|
566
|
+
var settingVariables = {
|
|
567
|
+
concurrency: "KITMAN_RUNNER_CONCURRENCY",
|
|
568
|
+
sandbox: "KITMAN_RUNNER_SANDBOX",
|
|
569
|
+
dockerImage: "KITMAN_RUNNER_DOCKER_IMAGE",
|
|
570
|
+
checkHosts: "KITMAN_RUNNER_CHECK_HOSTS",
|
|
571
|
+
checkDockerImage: "KITMAN_RUNNER_CHECK_DOCKER_IMAGE",
|
|
572
|
+
checkRegistryImage: "KITMAN_RUNNER_CHECK_REGISTRY_IMAGE"
|
|
573
|
+
};
|
|
574
|
+
var AllowFullAccessVariable = "KITMAN_RUNNER_ALLOW_FULL_ACCESS";
|
|
575
|
+
var isPinnedImage = is(PinnedImage);
|
|
576
|
+
var isNetworkHost = is(NetworkHost);
|
|
577
|
+
var isBackend = is(RunnerExecutionBackend);
|
|
578
|
+
var settingFromVariable = {
|
|
579
|
+
concurrency: (value) => {
|
|
580
|
+
const concurrency = Math.trunc(Number(value));
|
|
581
|
+
return Number.isFinite(concurrency) ? { concurrency: Math.min(MaxRunnerConcurrency, Math.max(1, concurrency)) } : {};
|
|
582
|
+
},
|
|
583
|
+
sandbox: (value) => isBackend(value) ? { sandbox: value } : {},
|
|
584
|
+
dockerImage: (value) => isPinnedImage(value) ? { dockerImage: value } : {},
|
|
585
|
+
checkHosts: (value) => ({
|
|
586
|
+
checkHosts: value.split(",").map((host) => host.trim()).filter(isNetworkHost)
|
|
587
|
+
}),
|
|
588
|
+
checkDockerImage: (value) => isPinnedImage(value) ? { checkDockerImage: value } : {},
|
|
589
|
+
checkRegistryImage: (value) => isPinnedImage(value) ? { checkRegistryImage: value } : {}
|
|
590
|
+
};
|
|
591
|
+
var variableValue = (environment, name) => {
|
|
592
|
+
const value = environment[name]?.trim();
|
|
593
|
+
return value === undefined || value === "" ? undefined : value;
|
|
594
|
+
};
|
|
595
|
+
var environmentSettings = (environment) => {
|
|
596
|
+
const settings = {};
|
|
597
|
+
const variables = [];
|
|
598
|
+
for (const setting of RunnerSettingNames) {
|
|
599
|
+
const value = variableValue(environment, settingVariables[setting]);
|
|
600
|
+
if (value === undefined)
|
|
601
|
+
continue;
|
|
602
|
+
variables.push(settingVariables[setting]);
|
|
603
|
+
Object.assign(settings, settingFromVariable[setting](value));
|
|
604
|
+
}
|
|
605
|
+
const reported = settings;
|
|
606
|
+
return { settings: reported, variables };
|
|
607
|
+
};
|
|
608
|
+
var fullAccessAllowed = (environment) => variableValue(environment, AllowFullAccessVariable) === "1" || variableValue(environment, settingVariables.sandbox) === "host";
|
|
609
|
+
var fullAccessRefused = {
|
|
610
|
+
code: "full_access_refused",
|
|
611
|
+
message: "Kitman asks this Runner to run agents on the host, which its machine does not allow, so they run in srt.",
|
|
612
|
+
fix: `To run them on the host, set ${AllowFullAccessVariable}=1 on that machine and restart the Runner; or choose srt or docker in its settings.`
|
|
613
|
+
};
|
|
614
|
+
var appliedSandbox = (input) => {
|
|
615
|
+
const runnable = (sandbox) => sandbox === "host" ? input.personal && input.fullAccessAllowed : input.available.includes(sandbox);
|
|
616
|
+
const refused = input.wanted === "host" && !(input.personal && input.fullAccessAllowed);
|
|
617
|
+
const wanted = refused ? input.personal ? "srt" : "docker" : input.wanted;
|
|
618
|
+
const refusal = refused && input.personal ? { problem: fullAccessRefused } : undefined;
|
|
619
|
+
if (runnable(wanted))
|
|
620
|
+
return { sandbox: wanted, ...refusal };
|
|
621
|
+
const missing = wanted === "host" || !input.personal ? undefined : sandboxMissing(wanted, missingFor(input, wanted));
|
|
622
|
+
const kept = input.current === undefined || input.current === "host" ? [] : [input.current];
|
|
623
|
+
const fallbacks = input.personal ? ["srt", "docker"] : ["docker", "srt"];
|
|
624
|
+
const fallback = [...kept, ...fallbacks].find(runnable);
|
|
625
|
+
if (fallback === undefined)
|
|
626
|
+
return { sandbox: wanted, ...missing === undefined ? undefined : { problem: missing } };
|
|
627
|
+
const problem = refusal?.problem ?? missing;
|
|
628
|
+
return { sandbox: fallback, ...problem === undefined ? undefined : { problem } };
|
|
629
|
+
};
|
|
630
|
+
var missingFor = (input, sandbox) => input.unavailable?.find((entry) => entry.backend === sandbox)?.missing ?? ["unsupported"];
|
|
631
|
+
var deprecationWarnings = (variables, settings) => RunnerSettingNames.flatMap((setting) => {
|
|
632
|
+
const variable = settingVariables[setting];
|
|
633
|
+
if (!variables.includes(variable))
|
|
634
|
+
return [];
|
|
635
|
+
const consent = setting === "sandbox" ? ` While it is host, it also lets this machine run agents on the host: set ${AllowFullAccessVariable}=1 instead to keep that.` : "";
|
|
636
|
+
return [
|
|
637
|
+
`${variable} is deprecated and ignored: Kitman keeps this Runner's ${setting} (${shownRunnerSetting(settings[setting])}). Change it on the Runner's page or with \`kitman runner settings\`, then remove the variable.${consent}`
|
|
638
|
+
];
|
|
639
|
+
});
|
|
640
|
+
var settingFlags = {
|
|
641
|
+
"--concurrency": "concurrency",
|
|
642
|
+
"--sandbox": "sandbox",
|
|
643
|
+
"--docker-image": "dockerImage",
|
|
644
|
+
"--check-hosts": "checkHosts",
|
|
645
|
+
"--check-docker-image": "checkDockerImage",
|
|
646
|
+
"--check-registry-image": "checkRegistryImage"
|
|
647
|
+
};
|
|
648
|
+
var isRunnerSettingFlag = (flag) => (flag in settingFlags);
|
|
649
|
+
var isSettingsUpdate = is(RunnerSettingsUpdate);
|
|
650
|
+
var settingFromFlag = (flag, value) => {
|
|
651
|
+
const setting = settingFlags[flag];
|
|
652
|
+
const cleared = value.trim() === "none";
|
|
653
|
+
const parsed = setting === "concurrency" ? Number(value) : setting === "checkHosts" ? cleared ? [] : value.split(",").map((host) => host.trim()).filter((host) => host !== "") : setting === "sandbox" ? value.trim() : cleared ? null : value.trim();
|
|
654
|
+
const update = { [setting]: parsed };
|
|
655
|
+
if (!isSettingsUpdate(update))
|
|
656
|
+
throw new Error(settingFlagRefused[setting]);
|
|
657
|
+
return update;
|
|
658
|
+
};
|
|
659
|
+
var settingFlagRefused = {
|
|
660
|
+
concurrency: "--concurrency takes a whole number from 1 to 4",
|
|
661
|
+
sandbox: "--sandbox takes srt, docker or host",
|
|
662
|
+
dockerImage: "--docker-image takes an image pinned by digest (name@sha256:...), or none",
|
|
663
|
+
checkHosts: "--check-hosts takes comma-separated hosts, such as registry.npmjs.org,*.example.com, or none",
|
|
664
|
+
checkDockerImage: "--check-docker-image takes an image pinned by digest (name@sha256:...), or none",
|
|
665
|
+
checkRegistryImage: "--check-registry-image takes an image pinned by digest (name@sha256:...), or none"
|
|
666
|
+
};
|
|
667
|
+
var settingRows = (settings, applied) => RunnerSettingNames.map((setting) => {
|
|
668
|
+
const value = shownRunnerSetting(settings[setting]);
|
|
669
|
+
const inEffect = applied === undefined ? undefined : shownRunnerSetting(applied[setting]);
|
|
670
|
+
return {
|
|
671
|
+
setting,
|
|
672
|
+
value,
|
|
673
|
+
...inEffect === undefined || inEffect === value ? undefined : { applied: inEffect }
|
|
674
|
+
};
|
|
675
|
+
});
|
|
676
|
+
var settingChangeRows = (history) => history.items.map((change) => ({
|
|
677
|
+
changedAt: change.changedAt,
|
|
678
|
+
setting: change.setting,
|
|
679
|
+
from: shownRunnerSetting(change.from),
|
|
680
|
+
to: shownRunnerSetting(change.to),
|
|
681
|
+
by: change.source === "environment" ? "environment variables" : `${change.actorType}:${change.actorId}`
|
|
682
|
+
}));
|
|
683
|
+
|
|
562
684
|
// apps/cli/src/managed-install.ts
|
|
563
685
|
var RunnerReleaseManifest = Struct({
|
|
564
686
|
version: String4.check(isPattern(/^[\w.+-]+$/u)),
|
|
@@ -739,7 +861,7 @@ var syncTargets = (harness) => gen(function* () {
|
|
|
739
861
|
});
|
|
740
862
|
var syncKits = (input) => gen(function* () {
|
|
741
863
|
const fs = yield* FileSystem;
|
|
742
|
-
const { syncKitSetup } = yield* promise(() => import("./chunk-
|
|
864
|
+
const { syncKitSetup } = yield* promise(() => import("./chunk-4sswz0mn.js"));
|
|
743
865
|
const harnesses = yield* syncTargets(input.harness);
|
|
744
866
|
const chain = yield* input.client.getKitChain(input.workspaceId);
|
|
745
867
|
for (const { name, problem } of chain.skipped)
|
|
@@ -1255,7 +1377,7 @@ var ServiceManager = Reference("kitman/cli/ServiceManager", {
|
|
|
1255
1377
|
run: (command, args) => runCommand2(command, args),
|
|
1256
1378
|
attach: (command, args) => gen(function* () {
|
|
1257
1379
|
const spawner = yield* ChildProcessSpawner;
|
|
1258
|
-
const handle = yield* spawner.spawn(
|
|
1380
|
+
const handle = yield* spawner.spawn(make3(command, args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" }));
|
|
1259
1381
|
const exitCode = yield* handle.exitCode;
|
|
1260
1382
|
if (exitCode !== 0)
|
|
1261
1383
|
return yield* new CommandFailed2({ command, reason: `exit code ${exitCode}` });
|
|
@@ -1657,7 +1779,7 @@ var package_default = {
|
|
|
1657
1779
|
};
|
|
1658
1780
|
|
|
1659
1781
|
// apps/cli/src/scaffold.ts
|
|
1660
|
-
var cliVersion = "0.10.
|
|
1782
|
+
var cliVersion = "0.10.99";
|
|
1661
1783
|
var packageJson = (name, scaffold) => `${JSON.stringify({
|
|
1662
1784
|
name,
|
|
1663
1785
|
private: true,
|
|
@@ -1817,6 +1939,9 @@ var Usage = [
|
|
|
1817
1939
|
" kitman pair [<pairing code>] [--api-url <url>] (what the command the web shows runs; no code finishes or re-keys with your session)",
|
|
1818
1940
|
" kitman pair <runner pairing code> --credential-file <path> (writes a shared Runner's credential for a container or its replicas to mount)",
|
|
1819
1941
|
" kitman runner start --credential-file <path> (or KITMAN_RUNNER_CREDENTIAL_FILE; starts the Runner the file holds)",
|
|
1942
|
+
" kitman runner settings <runner> [--concurrency <1-4>] [--sandbox srt|docker|host] [--docker-image <image@sha256:\u2026>|none]",
|
|
1943
|
+
" [--check-hosts <host,\u2026>|none] [--check-docker-image <image@sha256:\u2026>|none] [--check-registry-image <image@sha256:\u2026>|none]",
|
|
1944
|
+
" kitman runner settings history <runner> (each change: who, when, old and new value)",
|
|
1820
1945
|
"",
|
|
1821
1946
|
"Runs:",
|
|
1822
1947
|
' kitman run start <loop> "<words>" [--input <json>] [--team <team>] [--type <task type>] [--constraint <text>]... [--fresh] [--override-blockers]',
|
|
@@ -1907,7 +2032,7 @@ var Usage = [
|
|
|
1907
2032
|
"Every run, loop, agent, verify, constraint, secret, claim, deploy, dev and kit command takes --json."
|
|
1908
2033
|
].join(`
|
|
1909
2034
|
`);
|
|
1910
|
-
var agentRuntime = promise(() => import("./chunk-
|
|
2035
|
+
var agentRuntime = promise(() => import("./chunk-2fs34341.js"));
|
|
1911
2036
|
var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
|
|
1912
2037
|
defaultValue: () => gen(function* () {
|
|
1913
2038
|
const tui = yield* tryPromise({
|
|
@@ -2101,6 +2226,11 @@ function parseCommand(args) {
|
|
|
2101
2226
|
if (flags.closure !== undefined && flags.closure !== kind)
|
|
2102
2227
|
throw new Error("run close takes one of --complete or --abandoned");
|
|
2103
2228
|
flags.closure = kind;
|
|
2229
|
+
} else if (group === "runner" && action === "settings" && arg !== undefined && isRunnerSettingFlag(arg)) {
|
|
2230
|
+
const value = args[++index];
|
|
2231
|
+
if (value === undefined)
|
|
2232
|
+
throw new Error(`${arg} requires a value`);
|
|
2233
|
+
flags.runnerSettings = { ...flags.runnerSettings, ...settingFromFlag(arg, value) };
|
|
2104
2234
|
} else if (arg === "--runner" || arg === "--credential-file") {
|
|
2105
2235
|
const value = args[++index];
|
|
2106
2236
|
if (!value)
|
|
@@ -2648,6 +2778,19 @@ function runnerCommand(args) {
|
|
|
2648
2778
|
const response = yield* client.listRunners(workspaceId);
|
|
2649
2779
|
return yield* printRows(response.items.map(runnerRow), command.flags.json);
|
|
2650
2780
|
}
|
|
2781
|
+
if (command.action === "settings") {
|
|
2782
|
+
const history = command.args[0] === "history";
|
|
2783
|
+
const runnerRef = command.flags.runnerId ?? command.args[history ? 1 : 0];
|
|
2784
|
+
if (runnerRef === undefined)
|
|
2785
|
+
return yield* new CliError({ message: "runner settings requires a Runner: kitman runner settings <runner>" });
|
|
2786
|
+
const runner = yield* resolveRunnerForCommand(client, workspaceId, runnerRef);
|
|
2787
|
+
if (history)
|
|
2788
|
+
return yield* printRows(settingChangeRows(yield* client.listRunnerSettingsHistory(runner.id)), command.flags.json);
|
|
2789
|
+
const changed = command.flags.runnerSettings === undefined ? yield* client.getRunner(runner.id) : yield* client.updateRunnerSettings(runner.id, command.flags.runnerSettings);
|
|
2790
|
+
if (changed.settings === undefined)
|
|
2791
|
+
return yield* new CliError({ message: `${apiUrl} keeps no Runner settings; update Kitman there first.` });
|
|
2792
|
+
return yield* printRows(settingRows(changed.settings, changed.appliedSettings), command.flags.json);
|
|
2793
|
+
}
|
|
2651
2794
|
if (command.action === "rescope") {
|
|
2652
2795
|
const runnerRef = command.flags.runnerId ?? requiredArg(command, "Runner");
|
|
2653
2796
|
const runner = yield* resolveRunnerForCommand(client, workspaceId, runnerRef);
|
|
@@ -2783,7 +2926,7 @@ var SandboxHostProbe = Reference("kitman/cli/SandboxHostProbe", {
|
|
|
2783
2926
|
});
|
|
2784
2927
|
var OpenRunnerRpc = Reference("kitman/cli/OpenRunnerRpc", {
|
|
2785
2928
|
defaultValue: () => (options) => gen(function* () {
|
|
2786
|
-
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-
|
|
2929
|
+
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-3ka78n56.js"));
|
|
2787
2930
|
return yield* makeRunnerRpcClient({
|
|
2788
2931
|
runnerId: options.runnerId,
|
|
2789
2932
|
bearer: options.bearer,
|
|
@@ -2791,23 +2934,19 @@ var OpenRunnerRpc = Reference("kitman/cli/OpenRunnerRpc", {
|
|
|
2791
2934
|
});
|
|
2792
2935
|
})
|
|
2793
2936
|
});
|
|
2794
|
-
var
|
|
2795
|
-
const
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2937
|
+
var runnerHostSettings = gen(function* () {
|
|
2938
|
+
const names = [
|
|
2939
|
+
...Object.values(settingVariables),
|
|
2940
|
+
AllowFullAccessVariable,
|
|
2941
|
+
"KITMAN_RUNNER_FULL_ACCESS",
|
|
2942
|
+
"SSH_AUTH_SOCK"
|
|
2943
|
+
];
|
|
2944
|
+
const environment = Object.fromEntries(yield* forEach(names, (name) => String2(name).pipe(option, map8((value) => [name, getOrUndefined(value)?.trim()]))));
|
|
2802
2945
|
return {
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
dockerImage: yield* optional("KITMAN_RUNNER_DOCKER_IMAGE"),
|
|
2808
|
-
checkHosts: checkHostsSetting(yield* optional("KITMAN_RUNNER_CHECK_HOSTS")),
|
|
2809
|
-
checkDockerImage: checkDockerImageSetting(yield* optional("KITMAN_RUNNER_CHECK_DOCKER_IMAGE")),
|
|
2810
|
-
checkRegistryImage: checkRegistryImageSetting(yield* optional("KITMAN_RUNNER_CHECK_REGISTRY_IMAGE"))
|
|
2946
|
+
fullAccess: environment["KITMAN_RUNNER_FULL_ACCESS"] === "1",
|
|
2947
|
+
sshAgentAvailable: environment["SSH_AUTH_SOCK"] !== undefined,
|
|
2948
|
+
fullAccessAllowed: fullAccessAllowed(environment),
|
|
2949
|
+
environment: environmentSettings(environment)
|
|
2811
2950
|
};
|
|
2812
2951
|
});
|
|
2813
2952
|
var herdrRunnerRootDir = gen(function* () {
|
|
@@ -2864,8 +3003,8 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
2864
3003
|
verificationExecutor
|
|
2865
3004
|
} = yield* agentRuntime;
|
|
2866
3005
|
const openRunnerRpc = yield* OpenRunnerRpc;
|
|
2867
|
-
const
|
|
2868
|
-
const {
|
|
3006
|
+
const hostSettings = yield* runnerHostSettings;
|
|
3007
|
+
const { fullAccess, sshAgentAvailable } = hostSettings;
|
|
2869
3008
|
const fs = yield* FileSystem;
|
|
2870
3009
|
const container = input.credential !== undefined || (yield* fs.exists("/.dockerenv").pipe(orElseSucceed(() => false))) || (yield* fs.exists("/run/.containerenv").pipe(orElseSucceed(() => false)));
|
|
2871
3010
|
const reported = { ...kitmanVersion === undefined ? undefined : { version: kitmanVersion }, container };
|
|
@@ -2873,13 +3012,32 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
2873
3012
|
if (credential === undefined)
|
|
2874
3013
|
return yield* new RunnerStopped({ problem: credentialMissing(input.runnerId) });
|
|
2875
3014
|
const controlPlane = yield* createHerdrRunnerClient({ apiUrl: input.apiUrl, runnerId: input.runnerId, credential });
|
|
2876
|
-
const
|
|
3015
|
+
const firstHeartbeat = yield* startupStep("first heartbeat", "30 seconds", stopOnRefusal(controlPlane.client.heartbeatRunner(input.runnerId, reported)));
|
|
3016
|
+
const keepsSettings = firstHeartbeat.settings !== undefined;
|
|
3017
|
+
const runner = keepsSettings && Object.keys(hostSettings.environment.settings).length > 0 ? yield* startupStep("report the environment settings", "30 seconds", stopOnRefusal(controlPlane.client.heartbeatRunner(input.runnerId, {
|
|
3018
|
+
...reported,
|
|
3019
|
+
environmentSettings: hostSettings.environment.settings
|
|
3020
|
+
}))) : firstHeartbeat;
|
|
2877
3021
|
const personal = runner.ownership.kind === "personal";
|
|
2878
|
-
const
|
|
2879
|
-
|
|
3022
|
+
const settings = runner.settings ?? {
|
|
3023
|
+
...defaultRunnerSettings(personal),
|
|
3024
|
+
...hostSettings.environment.settings
|
|
3025
|
+
};
|
|
3026
|
+
if (runner.settings !== undefined)
|
|
3027
|
+
for (const warning of deprecationWarnings(hostSettings.environment.variables, runner.settings))
|
|
3028
|
+
yield* error(`Runner start: ${warning}`);
|
|
3029
|
+
const host = yield* startupStep("check the sandbox", "30 seconds", probeSandboxHost(yield* yield* SandboxHostProbe, undefined, settings.dockerImage === null ? {} : { dockerImage: settings.dockerImage }));
|
|
3030
|
+
const chosen = appliedSandbox({
|
|
3031
|
+
wanted: settings.sandbox,
|
|
3032
|
+
personal,
|
|
3033
|
+
available: host.backends,
|
|
3034
|
+
unavailable: host.unavailable,
|
|
3035
|
+
fullAccessAllowed: hostSettings.fullAccessAllowed
|
|
3036
|
+
});
|
|
3037
|
+
const sandbox = chosen.sandbox;
|
|
2880
3038
|
const stopOn = (problem) => startupStep("report the Runner Problem", "30 seconds", stopOnRefusal(controlPlane.client.heartbeatRunner(input.runnerId, { ...reported, problems: [problem] }))).pipe(andThen2(fail7(new RunnerStopped({ problem }))));
|
|
2881
|
-
if (personal && sandbox !== "host" && !host.backends.includes(sandbox))
|
|
2882
|
-
return yield* stopOn(
|
|
3039
|
+
if (personal && chosen.problem !== undefined && sandbox !== "host" && !host.backends.includes(sandbox))
|
|
3040
|
+
return yield* stopOn(chosen.problem);
|
|
2883
3041
|
const session = herdrCoreSession(input.runnerId, personal);
|
|
2884
3042
|
const coreProblems = yield* (yield* UpdateHerdrCore)({
|
|
2885
3043
|
...session === undefined ? undefined : { session },
|
|
@@ -2892,8 +3050,6 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
2892
3050
|
if (!personal)
|
|
2893
3051
|
yield* addFinalizer2(() => core.stopServer.pipe(timeout("10 seconds"), ignore));
|
|
2894
3052
|
const stepProcesses = makeStepProcesses(yield* systemProcessTable, { scopes: yield* systemdScopes });
|
|
2895
|
-
const uncontained = stepProcessesUncontained({ sandbox, scoped: stepProcesses.scoped });
|
|
2896
|
-
const startupProblems = uncontained === undefined ? coreProblems : [...coreProblems, uncontained];
|
|
2897
3053
|
const unready = yield* startupStep("connect to herdr-core", "30 seconds", core.connect.pipe(flatMap3((connection) => removeRunnerTerminals(connection, input.runnerId)), scoped, andThen2(stepProcesses.reapRunner(input.runnerId)), as(undefined), catchTags({
|
|
2898
3054
|
HerdrCoreMissing: (error) => succeed6(herdrCoreMissing(error)),
|
|
2899
3055
|
HerdrCoreIncompatible: (error) => succeed6(herdrCoreMissing(error))
|
|
@@ -2920,35 +3076,57 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
2920
3076
|
};
|
|
2921
3077
|
const detected = yield* detectHarnesses;
|
|
2922
3078
|
const inSrt = sandbox === "srt" ? yield* startupStep("start each Harness in srt", "120 seconds", harnessesInSrt({ detection: detected, runner: runnerState })) : undefined;
|
|
2923
|
-
const
|
|
2924
|
-
const
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
3079
|
+
const live = { settings, sandbox, sandboxProblem: chosen.problem, inSrt };
|
|
3080
|
+
const srtBinaries = { ...inSrt?.binaries };
|
|
3081
|
+
const capabilitiesNow = () => {
|
|
3082
|
+
const harnesses = live.sandbox === "srt" && live.inSrt !== undefined ? live.inSrt.detection : detected;
|
|
3083
|
+
const profile = {
|
|
3084
|
+
harnesses,
|
|
3085
|
+
fullAccess,
|
|
3086
|
+
sandbox: host,
|
|
3087
|
+
shared: !personal,
|
|
3088
|
+
agentSandbox: live.sandbox
|
|
3089
|
+
};
|
|
3090
|
+
const advertised = repoBinding === undefined ? herdrRunnerCapabilities(profile) : herdrRunnerCapabilitiesForRepoBinding(repoBinding, { ...profile, sshAgentAvailable });
|
|
3091
|
+
return {
|
|
3092
|
+
...advertised,
|
|
3093
|
+
resourceLimits: { ...advertised.resourceLimits, maxConcurrentRuns: live.settings.concurrency }
|
|
3094
|
+
};
|
|
3095
|
+
};
|
|
3096
|
+
const problemsNow = () => {
|
|
3097
|
+
const uncontained = stepProcessesUncontained({ sandbox: live.sandbox, scoped: stepProcesses.scoped });
|
|
3098
|
+
return [
|
|
3099
|
+
...coreProblems,
|
|
3100
|
+
...uncontained === undefined ? [] : [uncontained],
|
|
3101
|
+
...live.sandboxProblem === undefined ? [] : [live.sandboxProblem]
|
|
3102
|
+
];
|
|
2935
3103
|
};
|
|
2936
|
-
assertHerdrRunnerCapability(
|
|
3104
|
+
assertHerdrRunnerCapability(capabilitiesNow());
|
|
2937
3105
|
const replica = yield* startupStep("register the replica", "30 seconds", stopOnRefusal(controlPlane.client.registerRunnerReplica(input.runnerId, {
|
|
2938
3106
|
name: `replica-${createId()}`,
|
|
2939
|
-
capacity: { maxConcurrentRuns: concurrency },
|
|
3107
|
+
capacity: { maxConcurrentRuns: live.settings.concurrency },
|
|
2940
3108
|
telemetry: { activeWorkUnits: 0 }
|
|
2941
3109
|
})));
|
|
2942
3110
|
const uid = process.getuid?.();
|
|
2943
3111
|
const gid = process.getgid?.();
|
|
2944
|
-
const docker = host.backends.includes("docker") && settings.dockerImage !==
|
|
3112
|
+
const docker = host.backends.includes("docker") && settings.dockerImage !== null ? {
|
|
2945
3113
|
containers: yield* dockerContainerRunner,
|
|
2946
3114
|
image: settings.dockerImage,
|
|
2947
3115
|
...uid === undefined || gid === undefined ? undefined : { user: `${uid}:${gid}` }
|
|
2948
3116
|
} : undefined;
|
|
3117
|
+
const appliedSettings = () => ({
|
|
3118
|
+
concurrency: live.settings.concurrency,
|
|
3119
|
+
sandbox: live.sandbox,
|
|
3120
|
+
dockerImage: settings.dockerImage,
|
|
3121
|
+
checkHosts: live.settings.checkHosts,
|
|
3122
|
+
checkDockerImage: settings.checkDockerImage,
|
|
3123
|
+
checkRegistryImage: settings.checkRegistryImage,
|
|
3124
|
+
fullAccessAllowed: hostSettings.fullAccessAllowed
|
|
3125
|
+
});
|
|
3126
|
+
const appliedSettingsReport = () => keepsSettings ? { appliedSettings: appliedSettings() } : undefined;
|
|
2949
3127
|
const root = herdrCoreAgentBackendLayer({
|
|
2950
3128
|
sandboxBackends: host.backends,
|
|
2951
|
-
|
|
3129
|
+
srtBinaries,
|
|
2952
3130
|
...docker === undefined ? undefined : { docker: { ...docker, runnerId: input.runnerId } }
|
|
2953
3131
|
}).pipe(provide2(succeed5(HerdrCore, core)), provide2(succeed5(StepProcesses, stepProcesses)), provide2(layer3));
|
|
2954
3132
|
const activeSlots = new Set;
|
|
@@ -2964,13 +3142,14 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
2964
3142
|
const spawner = yield* ChildProcessSpawner;
|
|
2965
3143
|
yield* startupStep("heartbeat", "30 seconds", stopOnRefusal(controlPlane.client.heartbeatRunner(input.runnerId, {
|
|
2966
3144
|
...reported,
|
|
2967
|
-
problems:
|
|
2968
|
-
capabilities,
|
|
2969
|
-
labels: runner.labels
|
|
3145
|
+
problems: problemsNow(),
|
|
3146
|
+
capabilities: capabilitiesNow(),
|
|
3147
|
+
labels: runner.labels,
|
|
3148
|
+
...appliedSettingsReport()
|
|
2970
3149
|
}).pipe(andThen2(controlPlane.client.heartbeatRunnerReplica(input.runnerId, replica.id, {
|
|
2971
3150
|
healthStatus: "healthy",
|
|
2972
3151
|
drainState: "accepting",
|
|
2973
|
-
capacity: { maxConcurrentRuns: concurrency },
|
|
3152
|
+
capacity: { maxConcurrentRuns: live.settings.concurrency },
|
|
2974
3153
|
telemetry: { activeWorkUnits: 0 }
|
|
2975
3154
|
})))));
|
|
2976
3155
|
return yield* scoped(gen(function* () {
|
|
@@ -2986,7 +3165,7 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
2986
3165
|
});
|
|
2987
3166
|
const checkouts = runCheckouts(path.join(runnerRootDir, ".kitman"), rpc.gitCredential);
|
|
2988
3167
|
const platform = yield* context();
|
|
2989
|
-
const updated = yield*
|
|
3168
|
+
const updated = yield* make16();
|
|
2990
3169
|
const scope = yield* scope2;
|
|
2991
3170
|
yield* listenForSignals({
|
|
2992
3171
|
rpc,
|
|
@@ -3005,8 +3184,50 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3005
3184
|
runner: runnerState,
|
|
3006
3185
|
...docker !== undefined ? { backend: "docker", docker, runnerId: input.runnerId } : { backend: host.backends.includes("srt") ? "srt" : undefined }
|
|
3007
3186
|
};
|
|
3008
|
-
const
|
|
3009
|
-
|
|
3187
|
+
const checkSandbox = () => {
|
|
3188
|
+
if (!personal)
|
|
3189
|
+
return live.sandbox === "srt" && host.backends.includes("srt") ? { runner: runnerState, backend: "srt" } : sharedSandbox;
|
|
3190
|
+
const personalChecks = personalCheckBackend(live.sandbox, docker !== undefined);
|
|
3191
|
+
if (personalChecks === "docker" && docker !== undefined)
|
|
3192
|
+
return { runner: runnerState, backend: "docker", docker, runnerId: input.runnerId };
|
|
3193
|
+
return personalChecks === "srt" ? { runner: runnerState, backend: "srt" } : undefined;
|
|
3194
|
+
};
|
|
3195
|
+
let preparingSrt = false;
|
|
3196
|
+
const applySettings = (next) => gen(function* () {
|
|
3197
|
+
if (next === undefined)
|
|
3198
|
+
return;
|
|
3199
|
+
live.settings = next;
|
|
3200
|
+
const wanted = appliedSandbox({
|
|
3201
|
+
wanted: next.sandbox,
|
|
3202
|
+
personal,
|
|
3203
|
+
available: host.backends,
|
|
3204
|
+
unavailable: host.unavailable,
|
|
3205
|
+
fullAccessAllowed: hostSettings.fullAccessAllowed,
|
|
3206
|
+
current: live.sandbox
|
|
3207
|
+
});
|
|
3208
|
+
if (wanted.sandbox === live.sandbox) {
|
|
3209
|
+
live.sandboxProblem = wanted.problem;
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
if (wanted.sandbox !== "host" && !host.backends.includes(wanted.sandbox)) {
|
|
3213
|
+
live.sandboxProblem = wanted.problem;
|
|
3214
|
+
return;
|
|
3215
|
+
}
|
|
3216
|
+
if (wanted.sandbox === "srt" && live.inSrt === undefined) {
|
|
3217
|
+
if (preparingSrt)
|
|
3218
|
+
return;
|
|
3219
|
+
preparingSrt = true;
|
|
3220
|
+
return yield* harnessesInSrt({ detection: detected, runner: runnerState }).pipe(flatMap3((prepared) => sync2(() => {
|
|
3221
|
+
Object.assign(srtBinaries, prepared.binaries);
|
|
3222
|
+
live.inSrt = prepared;
|
|
3223
|
+
})), catchCause2((cause) => logWarning("runner_srt_switch_failed", pretty(cause))), ensuring2(sync2(() => preparingSrt = false)), provideContext2(platform), forkIn(scope), asVoid);
|
|
3224
|
+
}
|
|
3225
|
+
live.sandbox = wanted.sandbox;
|
|
3226
|
+
live.sandboxProblem = wanted.problem;
|
|
3227
|
+
yield* error(`Runner: its settings run new Steps in ${wanted.sandbox} now`);
|
|
3228
|
+
});
|
|
3229
|
+
const stepSandboxes = new Map;
|
|
3230
|
+
const sandboxOf = (work) => stepSandboxes.get(work.id) ?? live.sandbox;
|
|
3010
3231
|
const runKitProgram = programProcessExecutor({
|
|
3011
3232
|
bundles,
|
|
3012
3233
|
apiUrl: input.apiUrl,
|
|
@@ -3034,7 +3255,7 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3034
3255
|
const storage = yield* provide3(service(HttpClient), layer4);
|
|
3035
3256
|
const runAgentStep = agentStepExecutor({
|
|
3036
3257
|
rootDir: path.join(runnerRootDir, ".kitman"),
|
|
3037
|
-
sandbox,
|
|
3258
|
+
sandbox: sandboxOf,
|
|
3038
3259
|
heartbeat: heartbeatOf,
|
|
3039
3260
|
gitCredentials: rpc.gitCredential,
|
|
3040
3261
|
checkpoints: rpcStepCheckpoints(rpc, signals, storage),
|
|
@@ -3054,7 +3275,7 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3054
3275
|
recordRefusal: refused,
|
|
3055
3276
|
revokedSecrets: heartbeatOf(work).pipe(map8((state) => state.revokedSecrets ?? [])),
|
|
3056
3277
|
sandbox: {
|
|
3057
|
-
backend: work.sandbox ??
|
|
3278
|
+
backend: work.sandbox ?? sandboxOf(work),
|
|
3058
3279
|
policy: agentStepSandboxPolicy(work, input.apiUrl, runnerState)
|
|
3059
3280
|
},
|
|
3060
3281
|
settled: heartbeatOf(work).pipe(map8((state) => state.settled || state.outputSubmitted === true)),
|
|
@@ -3064,7 +3285,7 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3064
3285
|
report: (note, delivered) => andThen2(delivered ? steered(note) : void_3, rpc.reportSteer({ workUnitId: work.id, messageId: note.messageId, delivered }).pipe(catch_((error) => logWarning("runner_steer_report_failed", error.message))))
|
|
3065
3286
|
}
|
|
3066
3287
|
}).pipe(map8((outcome) => agentStepRunOutcome(outcome, {
|
|
3067
|
-
sandbox: work.sandbox ??
|
|
3288
|
+
sandbox: work.sandbox ?? sandboxOf(work),
|
|
3068
3289
|
lacksLoginSecret: lacksLoginSecret(work.brief.harness, work.secrets)
|
|
3069
3290
|
})), catch_((refusal) => succeed6({ status: "failed", summary: refusal.summary }))))
|
|
3070
3291
|
});
|
|
@@ -3077,22 +3298,24 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3077
3298
|
}).pipe(ignore);
|
|
3078
3299
|
yield* removeOrphanedCheckPostgres;
|
|
3079
3300
|
yield* removeOrphanedCheckPostgres.pipe(delay(checkPostgresSweepInterval), forever, forkScoped);
|
|
3080
|
-
const
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
postgres: dockerCheckPostgres(input.runnerId, replica.id),
|
|
3086
|
-
...settings.checkDockerImage === undefined || settings.checkRegistryImage === undefined ? undefined : {
|
|
3087
|
-
docker: dockerCheckDaemon({
|
|
3088
|
-
runnerId: input.runnerId,
|
|
3089
|
-
replicaId: replica.id,
|
|
3090
|
-
image: settings.checkDockerImage,
|
|
3091
|
-
registryImage: settings.checkRegistryImage
|
|
3092
|
-
})
|
|
3093
|
-
},
|
|
3094
|
-
...checkSandbox === undefined ? undefined : { sandbox: { ...checkSandbox, apiUrl: input.apiUrl, hosts: settings.checkHosts } }
|
|
3301
|
+
const checkDocker = settings.checkDockerImage === null || settings.checkRegistryImage === null ? undefined : dockerCheckDaemon({
|
|
3302
|
+
runnerId: input.runnerId,
|
|
3303
|
+
replicaId: replica.id,
|
|
3304
|
+
image: settings.checkDockerImage,
|
|
3305
|
+
registryImage: settings.checkRegistryImage
|
|
3095
3306
|
});
|
|
3307
|
+
const runVerification = (work) => {
|
|
3308
|
+
const sandbox = checkSandbox();
|
|
3309
|
+
return verificationExecutor({
|
|
3310
|
+
rootDir: path.join(runnerRootDir, ".kitman"),
|
|
3311
|
+
known: rpcKnownEvidence(rpc),
|
|
3312
|
+
gitCredentials: rpc.gitCredential,
|
|
3313
|
+
runFiles: { client: rpc, storage },
|
|
3314
|
+
postgres: dockerCheckPostgres(input.runnerId, replica.id),
|
|
3315
|
+
...checkDocker === undefined ? undefined : { docker: checkDocker },
|
|
3316
|
+
...sandbox === undefined ? undefined : { sandbox: { ...sandbox, apiUrl: input.apiUrl, hosts: live.settings.checkHosts } }
|
|
3317
|
+
})(work);
|
|
3318
|
+
};
|
|
3096
3319
|
const control = (capacitySlot) => {
|
|
3097
3320
|
return {
|
|
3098
3321
|
claim: (idempotencyKey) => suspend3(() => {
|
|
@@ -3112,13 +3335,14 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3112
3335
|
finished: () => sync2(() => activeSlots.delete(capacitySlot)),
|
|
3113
3336
|
heartbeatReplica: () => flatMap3(stepProcesses.problems, (unreaped) => controlPlane.client.heartbeatRunner(input.runnerId, {
|
|
3114
3337
|
...reported,
|
|
3115
|
-
problems: [...
|
|
3116
|
-
capabilities,
|
|
3117
|
-
labels: runner.labels
|
|
3118
|
-
|
|
3338
|
+
problems: [...problemsNow(), ...updater.problems(), ...unreaped],
|
|
3339
|
+
capabilities: capabilitiesNow(),
|
|
3340
|
+
labels: runner.labels,
|
|
3341
|
+
...appliedSettingsReport()
|
|
3342
|
+
})).pipe(flatMap3((heartbeat) => applySettings(heartbeat.settings)), flatMap3(() => controlPlane.client.heartbeatRunnerReplica(input.runnerId, replica.id, {
|
|
3119
3343
|
healthStatus: "healthy",
|
|
3120
3344
|
drainState: updater.claiming() ? "accepting" : "draining",
|
|
3121
|
-
capacity: { maxConcurrentRuns: concurrency },
|
|
3345
|
+
capacity: { maxConcurrentRuns: live.settings.concurrency },
|
|
3122
3346
|
telemetry: { activeWorkUnits: activeSlots.size }
|
|
3123
3347
|
}).pipe(asVoid))),
|
|
3124
3348
|
heartbeatWork: (workUnitId, lease) => rpc.heartbeat({ workUnitId, lease }),
|
|
@@ -3131,7 +3355,8 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3131
3355
|
};
|
|
3132
3356
|
};
|
|
3133
3357
|
const supervised = superviseReplica({
|
|
3134
|
-
slots: Array.from({ length:
|
|
3358
|
+
slots: Array.from({ length: MaxRunnerConcurrency }, (_, index) => `slot-${index + 1}`),
|
|
3359
|
+
concurrency: sync2(() => live.settings.concurrency),
|
|
3135
3360
|
control,
|
|
3136
3361
|
executor: {
|
|
3137
3362
|
execute: (work) => {
|
|
@@ -3139,7 +3364,10 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3139
3364
|
case "orchestration":
|
|
3140
3365
|
return runKitProgram(work).pipe(provideContext2(platform));
|
|
3141
3366
|
case "agent_step":
|
|
3142
|
-
return
|
|
3367
|
+
return suspend3(() => {
|
|
3368
|
+
stepSandboxes.set(work.id, live.sandbox);
|
|
3369
|
+
return runAgentStep(work);
|
|
3370
|
+
}).pipe(ensuring2(sync2(() => stepSandboxes.delete(work.id))), provideContext2(platform), failedWhenUnrun("agent Step"));
|
|
3143
3371
|
case "verification":
|
|
3144
3372
|
return runVerification(work).pipe(provideContext2(platform), failedWhenUnrun("verification"));
|
|
3145
3373
|
}
|
|
@@ -3175,7 +3403,7 @@ function mcpCommand(args) {
|
|
|
3175
3403
|
if (command.action === "run") {
|
|
3176
3404
|
if (command.args.length > 0)
|
|
3177
3405
|
return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
|
|
3178
|
-
const { runMcpServerCommand } = yield* promise(() => import("./chunk-
|
|
3406
|
+
const { runMcpServerCommand } = yield* promise(() => import("./chunk-0hjtwtms.js"));
|
|
3179
3407
|
return yield* runMcpServerCommand({ flags: command.flags });
|
|
3180
3408
|
}
|
|
3181
3409
|
if (command.action !== "setup")
|
|
@@ -4386,9 +4614,9 @@ function claimCommand(args) {
|
|
|
4386
4614
|
}
|
|
4387
4615
|
});
|
|
4388
4616
|
}
|
|
4389
|
-
var KitWriter = map8(promise(() => import("./chunk-
|
|
4617
|
+
var KitWriter = map8(promise(() => import("./chunk-6vmpa1nw.js")), (build) => build.writeKit);
|
|
4390
4618
|
var KitBuilder = Reference("kitman/cli/KitBuilder", {
|
|
4391
|
-
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-
|
|
4619
|
+
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-6vmpa1nw.js")), (build) => build.buildKit(directory))
|
|
4392
4620
|
});
|
|
4393
4621
|
var uploadKit = (client, workspaceId, built) => gen(function* () {
|
|
4394
4622
|
yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
|
|
@@ -5146,7 +5374,7 @@ function downloadPresignedAsset(download, outputPath) {
|
|
|
5146
5374
|
return gen(function* () {
|
|
5147
5375
|
const fs = yield* FileSystem;
|
|
5148
5376
|
const failed = (cause) => new CliError({ message: `Asset download failed: ${String(cause)}` });
|
|
5149
|
-
const response = yield* send(
|
|
5377
|
+
const response = yield* send(make5(download.method)(download.url), failed);
|
|
5150
5378
|
if (response.status < 200 || response.status >= 300)
|
|
5151
5379
|
return yield* new CliError({ message: `Asset download failed with ${response.status}` });
|
|
5152
5380
|
const body = yield* response.arrayBuffer.pipe(mapError2((error) => failed(error.message)));
|