@kitman-sh/cli 0.12.7 → 0.12.8
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-q5w3v4k1.js → chunk-0tjg9eya.js} +1 -1
- package/dist/{chunk-cbpb2rww.js → chunk-31gpnkq3.js} +5 -5
- package/dist/{chunk-gxbcvd4q.js → chunk-3x6cbhzd.js} +4 -4
- package/dist/{chunk-mtkstrh3.js → chunk-6d53ezj1.js} +4 -4
- package/dist/{chunk-fyvtc3xv.js → chunk-6w7ajkm8.js} +18 -18
- package/dist/{chunk-vkg40ysx.js → chunk-93ypzdpa.js} +7 -7
- package/dist/{chunk-8b8pw0md.js → chunk-9qp59fht.js} +32 -32
- package/dist/{chunk-p7hxrkmf.js → chunk-bh9k3kty.js} +55 -55
- package/dist/{chunk-jn7w2ntt.js → chunk-c8hwfktd.js} +7 -7
- package/dist/{chunk-0h49y8gf.js → chunk-c8wpw9nh.js} +65 -214
- package/dist/{chunk-4w0c1ykv.js → chunk-cr3qw0xf.js} +297 -381
- package/dist/{chunk-gq7y5v3e.js → chunk-cw61zyh5.js} +1 -1
- package/dist/{chunk-gy9rf14f.js → chunk-fh58za51.js} +3 -3
- package/dist/{chunk-4gy4ty6k.js → chunk-gyek54h3.js} +8 -8
- package/dist/{chunk-5zhh41gb.js → chunk-j1cnq2j0.js} +4 -4
- package/dist/{chunk-gwnyxm1r.js → chunk-jwrs9pfa.js} +107 -107
- package/dist/{chunk-5zth85pj.js → chunk-kzwdhdej.js} +2 -2
- package/dist/{chunk-azfjx5d8.js → chunk-n9351czb.js} +7 -7
- package/dist/{chunk-7dahw7e2.js → chunk-pjpfc3sd.js} +1 -1
- package/dist/{chunk-zw3gf6r5.js → chunk-qjqa338f.js} +333 -94
- package/dist/{chunk-ywzxwgrz.js → chunk-s5pzy86v.js} +6 -6
- package/dist/{chunk-7afnkx5b.js → chunk-tgwa9vqw.js} +6 -6
- package/dist/{chunk-fr79hgq2.js → chunk-wcvfkdwd.js} +24 -24
- package/dist/{chunk-b9rbh1va.js → chunk-xng6j3a8.js} +1 -1
- package/dist/{chunk-y1krmnbv.js → chunk-z5f7g1w1.js} +2 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -40,14 +40,14 @@ import {
|
|
|
40
40
|
isSuccess2,
|
|
41
41
|
isFailure2,
|
|
42
42
|
hasInterrupts,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
makeUnsafe4,
|
|
44
|
+
make15,
|
|
45
45
|
_await,
|
|
46
46
|
fail5,
|
|
47
47
|
isDoneUnsafe,
|
|
48
48
|
succeed4,
|
|
49
49
|
doneUnsafe,
|
|
50
|
-
|
|
50
|
+
makeUnsafe5,
|
|
51
51
|
provide,
|
|
52
52
|
succeed5,
|
|
53
53
|
effect,
|
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
die2,
|
|
56
56
|
findErrorOption,
|
|
57
57
|
pretty,
|
|
58
|
+
currentTimeMillis,
|
|
58
59
|
exponential,
|
|
59
60
|
jittered,
|
|
60
61
|
spaced,
|
|
@@ -82,7 +83,7 @@ import {
|
|
|
82
83
|
result,
|
|
83
84
|
option2,
|
|
84
85
|
exit,
|
|
85
|
-
|
|
86
|
+
map7,
|
|
86
87
|
as,
|
|
87
88
|
asSome2,
|
|
88
89
|
asVoid,
|
|
@@ -168,14 +169,13 @@ import {
|
|
|
168
169
|
decodeJsonStringSync,
|
|
169
170
|
encodeUnknownJsonStringSync,
|
|
170
171
|
storable
|
|
171
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-qjqa338f.js";
|
|
172
173
|
import {
|
|
173
174
|
Id,
|
|
174
175
|
secretReference,
|
|
175
176
|
secretPlaceholder
|
|
176
|
-
} from "./chunk-
|
|
177
|
+
} from "./chunk-0tjg9eya.js";
|
|
177
178
|
import {
|
|
178
|
-
currentTimeMillis,
|
|
179
179
|
SecureRandom,
|
|
180
180
|
layerWebCrypto,
|
|
181
181
|
layer,
|
|
@@ -247,7 +247,7 @@ import {
|
|
|
247
247
|
installCommand,
|
|
248
248
|
checkServicesFile,
|
|
249
249
|
checkServices
|
|
250
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-cr3qw0xf.js";
|
|
251
251
|
import {
|
|
252
252
|
join,
|
|
253
253
|
interrupt,
|
|
@@ -255,8 +255,8 @@ import {
|
|
|
255
255
|
publishUnsafe,
|
|
256
256
|
unbounded2,
|
|
257
257
|
offer,
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
makeUnsafe2,
|
|
259
|
+
make10,
|
|
260
260
|
fromQueue,
|
|
261
261
|
fromPubSub,
|
|
262
262
|
map2,
|
|
@@ -288,7 +288,7 @@ import {
|
|
|
288
288
|
writeSrtSettings2,
|
|
289
289
|
srtStepArgv2,
|
|
290
290
|
srtArgv2
|
|
291
|
-
} from "./chunk-
|
|
291
|
+
} from "./chunk-c8wpw9nh.js";
|
|
292
292
|
import {
|
|
293
293
|
writeAgentEnvironmentConfigFile2,
|
|
294
294
|
readManifestSkillPaths2,
|
|
@@ -304,8 +304,8 @@ import {
|
|
|
304
304
|
applyAgentEnvironmentMaterialization2,
|
|
305
305
|
isPathWithin2,
|
|
306
306
|
skillIdentity2
|
|
307
|
-
} from "./chunk-
|
|
308
|
-
import"./chunk-
|
|
307
|
+
} from "./chunk-c8hwfktd.js";
|
|
308
|
+
import"./chunk-n9351czb.js";
|
|
309
309
|
import {
|
|
310
310
|
egressAllowed,
|
|
311
311
|
writeSecretRegistry,
|
|
@@ -315,7 +315,7 @@ import {
|
|
|
315
315
|
secretFilter2,
|
|
316
316
|
opaqueTunnelRefusal2,
|
|
317
317
|
isOpaqueConnectReason2
|
|
318
|
-
} from "./chunk-
|
|
318
|
+
} from "./chunk-z5f7g1w1.js";
|
|
319
319
|
import {
|
|
320
320
|
sliceBytes2,
|
|
321
321
|
maxLineBytes2,
|
|
@@ -323,23 +323,23 @@ import {
|
|
|
323
323
|
decodedOption2,
|
|
324
324
|
decoded2,
|
|
325
325
|
readOpencode2
|
|
326
|
-
} from "./chunk-
|
|
326
|
+
} from "./chunk-31gpnkq3.js";
|
|
327
327
|
import {
|
|
328
328
|
uploadRunFile,
|
|
329
329
|
programLease,
|
|
330
330
|
rpcRunFiles,
|
|
331
331
|
programHostsEnv,
|
|
332
332
|
undeclaredHostsEnv
|
|
333
|
-
} from "./chunk-
|
|
334
|
-
import"./chunk-
|
|
333
|
+
} from "./chunk-gyek54h3.js";
|
|
334
|
+
import"./chunk-tgwa9vqw.js";
|
|
335
335
|
import {
|
|
336
336
|
nextInt
|
|
337
|
-
} from "./chunk-
|
|
337
|
+
} from "./chunk-cw61zyh5.js";
|
|
338
338
|
import {
|
|
339
339
|
ChildProcessSpawner,
|
|
340
340
|
make3
|
|
341
|
-
} from "./chunk-
|
|
342
|
-
import"./chunk-
|
|
341
|
+
} from "./chunk-6d53ezj1.js";
|
|
342
|
+
import"./chunk-wcvfkdwd.js";
|
|
343
343
|
|
|
344
344
|
// packages/core/src/sync-kit.ts
|
|
345
345
|
import { createHash } from "crypto";
|
|
@@ -905,7 +905,7 @@ var resolvePackagePlugins = (input, plan) => gen(function* () {
|
|
|
905
905
|
const source = packageSource(plugin);
|
|
906
906
|
if (source === undefined || source.version !== undefined && input.versions !== "latest")
|
|
907
907
|
return succeed6([plugin]);
|
|
908
|
-
return resolver.npmLatest(source.packageName).pipe(
|
|
908
|
+
return resolver.npmLatest(source.packageName).pipe(map7((version) => [
|
|
909
909
|
{
|
|
910
910
|
...plugin,
|
|
911
911
|
item: {
|
|
@@ -2291,7 +2291,7 @@ var openCodeStore = (source) => gen(function* () {
|
|
|
2291
2291
|
var runOpenCode = (binary, store, args) => runCommand2(binary, [...args, "--standalone"], { env: store.env, timeout: "30 seconds" });
|
|
2292
2292
|
var readOpenCodeLogin = (binary, source) => gen(function* () {
|
|
2293
2293
|
const store = yield* openCodeStore(source);
|
|
2294
|
-
const exported = store === undefined ? none() : yield* runOpenCode(binary, store, ["auth", "export"]).pipe(
|
|
2294
|
+
const exported = store === undefined ? none() : yield* runOpenCode(binary, store, ["auth", "export"]).pipe(map7(decodeExport), orElseSucceed(() => none()));
|
|
2295
2295
|
if (isNone(exported)) {
|
|
2296
2296
|
const credentials = yield* fileCredentials(source);
|
|
2297
2297
|
return credentials === undefined ? undefined : { credentials };
|
|
@@ -2338,17 +2338,17 @@ var renewers = {
|
|
|
2338
2338
|
grant_type: "refresh_token",
|
|
2339
2339
|
refresh_token: login.refresh,
|
|
2340
2340
|
client_id: "9d1c250a-e61b-44d9-88ed-5944d1962f5e"
|
|
2341
|
-
}))).pipe(
|
|
2341
|
+
}))).pipe(map7(refreshed(now))),
|
|
2342
2342
|
openai: (login, now) => answer("openai", TokenAnswer, post("https://auth.openai.com/oauth/token").pipe(bodyUrlParams({
|
|
2343
2343
|
grant_type: "refresh_token",
|
|
2344
2344
|
refresh_token: login.refresh,
|
|
2345
2345
|
client_id: "app_EMoamEEZ73f0CkXaXp7hrann"
|
|
2346
|
-
}))).pipe(
|
|
2346
|
+
}))).pipe(map7(refreshed(now))),
|
|
2347
2347
|
xai: (login, now) => answer("xai", XaiAnswer, post("https://auth.x.ai/oauth2/token").pipe(acceptJson, bodyUrlParams({
|
|
2348
2348
|
grant_type: "refresh_token",
|
|
2349
2349
|
refresh_token: login.refresh,
|
|
2350
2350
|
client_id: "b1a00492-073a-47ea-816f-4c329264a828"
|
|
2351
|
-
}))).pipe(
|
|
2351
|
+
}))).pipe(map7((answered) => ({
|
|
2352
2352
|
access: answered.access_token,
|
|
2353
2353
|
...answered.refresh_token === undefined ? undefined : { refresh: answered.refresh_token },
|
|
2354
2354
|
expires: xaiExpiry(answered, now)
|
|
@@ -2357,8 +2357,8 @@ var renewers = {
|
|
|
2357
2357
|
grant_type: "refresh_token",
|
|
2358
2358
|
refresh_token: login.refresh,
|
|
2359
2359
|
client_id: "opencode-cli"
|
|
2360
|
-
}))).pipe(
|
|
2361
|
-
"github-copilot": (login) => answer("github-copilot", CopilotAnswer, get("https://api.github.com/copilot_internal/v2/token").pipe(setHeaders({ authorization: `Bearer ${login.refresh}`, accept: "application/json" }))).pipe(
|
|
2360
|
+
}))).pipe(map7(refreshed(now))),
|
|
2361
|
+
"github-copilot": (login) => answer("github-copilot", CopilotAnswer, get("https://api.github.com/copilot_internal/v2/token").pipe(setHeaders({ authorization: `Bearer ${login.refresh}`, accept: "application/json" }))).pipe(map7((answered) => ({ access: answered.token, expires: answered.expires_at * 1000 })))
|
|
2362
2362
|
};
|
|
2363
2363
|
var renewerFor = (provider) => isKeyOf(renewers, provider) ? renewers[provider] : undefined;
|
|
2364
2364
|
var renewableLogin = (provider, credential) => getOrUndefined(filter2(decodeRenewable(credential), (login) => renewerFor(provider) !== undefined && (provider !== "github-copilot" || login.access !== login.refresh)));
|
|
@@ -2389,7 +2389,7 @@ var replaceInFile = (source, provider, credential) => gen(function* () {
|
|
|
2389
2389
|
});
|
|
2390
2390
|
var renewalPermits = new Map;
|
|
2391
2391
|
var oneRenewalAt = (source) => (effect) => {
|
|
2392
|
-
const permit = renewalPermits.get(source) ??
|
|
2392
|
+
const permit = renewalPermits.get(source) ?? makeUnsafe2(1);
|
|
2393
2393
|
renewalPermits.set(source, permit);
|
|
2394
2394
|
return permit.withPermits(1)(effect);
|
|
2395
2395
|
};
|
|
@@ -2423,7 +2423,7 @@ var filesUnder = (root) => gen(function* () {
|
|
|
2423
2423
|
if (skipped.has(entry))
|
|
2424
2424
|
continue;
|
|
2425
2425
|
const path = relative === "" ? entry : `${relative}/${entry}`;
|
|
2426
|
-
const type = yield* fs.stat(`${root}/${path}`).pipe(
|
|
2426
|
+
const type = yield* fs.stat(`${root}/${path}`).pipe(map7((info) => info.type), orElseSucceed(() => {
|
|
2427
2427
|
return;
|
|
2428
2428
|
}));
|
|
2429
2429
|
if (type === "Directory")
|
|
@@ -2439,7 +2439,7 @@ var dependenciesOf = (root, files) => gen(function* () {
|
|
|
2439
2439
|
const fs = yield* FileSystem;
|
|
2440
2440
|
const names = new Set;
|
|
2441
2441
|
for (const file of files.filter((path) => path === "package.json" || path.endsWith("/package.json"))) {
|
|
2442
|
-
const manifest = yield* fs.readFileString(`${root}/${file}`).pipe(
|
|
2442
|
+
const manifest = yield* fs.readFileString(`${root}/${file}`).pipe(map7((text) => decodeJsonStringSync(text)), orElseSucceed(() => {
|
|
2443
2443
|
return;
|
|
2444
2444
|
}));
|
|
2445
2445
|
if (!isJsonObject(manifest))
|
|
@@ -2611,7 +2611,7 @@ var credentialsIn = (source) => gen(function* () {
|
|
|
2611
2611
|
const credentials = getOrUndefined(decodeJsonStringOption(text));
|
|
2612
2612
|
return isJsonObject(credentials) ? credentials : undefined;
|
|
2613
2613
|
});
|
|
2614
|
-
var loginCredentials = (login) => login.format === "opencode" ?
|
|
2614
|
+
var loginCredentials = (login) => login.format === "opencode" ? map7(readOpenCodeLogin(login.binary, login.source), (read) => read?.credentials) : credentialsIn(login.source);
|
|
2615
2615
|
var neverExpires = 253402300799000;
|
|
2616
2616
|
var isOAuth = (credential) => isJsonObject(credential) && credential.type === "oauth";
|
|
2617
2617
|
var claudeOAuth = "claudeAiOauth";
|
|
@@ -2779,7 +2779,7 @@ var refreshOperatorLogin = (login, expired, http) => gen(function* () {
|
|
|
2779
2779
|
}
|
|
2780
2780
|
}
|
|
2781
2781
|
});
|
|
2782
|
-
var stepLogin = (login, reference) =>
|
|
2782
|
+
var stepLogin = (login, reference) => map7(loginCredentials(login), (credentials) => {
|
|
2783
2783
|
if (credentials === undefined)
|
|
2784
2784
|
return;
|
|
2785
2785
|
const format = loginFormats[login.format];
|
|
@@ -2798,8 +2798,8 @@ var renewableStepLogin = (login, referenced, http) => gen(function* () {
|
|
|
2798
2798
|
const expired = new Map;
|
|
2799
2799
|
let published;
|
|
2800
2800
|
let heldTokens;
|
|
2801
|
-
const writing =
|
|
2802
|
-
const refreshing =
|
|
2801
|
+
const writing = makeUnsafe2(1);
|
|
2802
|
+
const refreshing = makeUnsafe2(1);
|
|
2803
2803
|
const copy = gen(function* () {
|
|
2804
2804
|
const copied = yield* stepLogin(login, referenced?.reference);
|
|
2805
2805
|
if (copied === undefined)
|
|
@@ -2858,7 +2858,7 @@ var loginHostsWithProviders = (operatorFiles) => gen(function* () {
|
|
|
2858
2858
|
};
|
|
2859
2859
|
return { ...login, hosts };
|
|
2860
2860
|
});
|
|
2861
|
-
var carriedLoginHosts = (launch) => launch.renewedLogin?.format === "opencode" ?
|
|
2861
|
+
var carriedLoginHosts = (launch) => launch.renewedLogin?.format === "opencode" ? map7(loginCredentials(launch.renewedLogin), openCodeConsoleHosts) : succeed6([]);
|
|
2862
2862
|
var carriedProviderHosts = (launch) => gen(function* () {
|
|
2863
2863
|
const providers = launch.operatorFiles?.providers;
|
|
2864
2864
|
if (providers === undefined)
|
|
@@ -2999,7 +2999,7 @@ var writeHarnessFiles = (input) => gen(function* () {
|
|
|
2999
2999
|
yield* every(loginRenewalMillis, true);
|
|
3000
3000
|
if (renewed.format !== "opencode")
|
|
3001
3001
|
yield* every(loginCopyMillis, false);
|
|
3002
|
-
const watching =
|
|
3002
|
+
const watching = makeUnsafe4();
|
|
3003
3003
|
yield* forkScoped(fs.watch(path.dirname(renewed.source), { onReady: () => doneUnsafe(watching, void_3) }).pipe(filter((event) => path.basename(event.path) === path.basename(renewed.source)), runForEach(() => login.publish(false)), catch_((error) => logWarning("harness_login_not_watched", error)), ensuring2(succeed4(watching, undefined))));
|
|
3004
3004
|
yield* _await(watching);
|
|
3005
3005
|
});
|
|
@@ -3008,7 +3008,7 @@ var decodeSetupArchive = decodeEffect(fromJsonString(SetupArchive));
|
|
|
3008
3008
|
var runsOnHost = (command) => gen(function* () {
|
|
3009
3009
|
const fs = yield* FileSystem;
|
|
3010
3010
|
const path = yield* Path;
|
|
3011
|
-
const executable = (file) => fs.stat(file).pipe(
|
|
3011
|
+
const executable = (file) => fs.stat(file).pipe(map7((info) => info.type === "File" && (info.mode & 73) !== 0), orElseSucceed(() => false));
|
|
3012
3012
|
if (command.includes("/"))
|
|
3013
3013
|
return yield* executable(command);
|
|
3014
3014
|
for (const directory of ((yield* optionalEnv("PATH")) ?? "").split(":"))
|
|
@@ -3036,7 +3036,7 @@ var stepKitSetup = (agent, harness) => gen(function* () {
|
|
|
3036
3036
|
const fetch = agent.setupArchive;
|
|
3037
3037
|
if (fetch === undefined)
|
|
3038
3038
|
return unavailable("this Runner fetches no setup archives");
|
|
3039
|
-
const setups = yield* forEach(kits, (kit) => fetch(kit.setupDigest).pipe(flatMap3(decodeSetupArchive),
|
|
3039
|
+
const setups = yield* forEach(kits, (kit) => fetch(kit.setupDigest).pipe(flatMap3(decodeSetupArchive), map7((archive) => ({ name: kit.name, version: kit.version, archive })))).pipe(result);
|
|
3040
3040
|
if (isFailure(setups))
|
|
3041
3041
|
return unavailable(setups.failure.message);
|
|
3042
3042
|
const setup = materializeKitSetup(harness, [...setups.success, kitmanSkillEntry], agent.brief.listedSkills ?? []);
|
|
@@ -3066,11 +3066,11 @@ var Proto = {
|
|
|
3066
3066
|
};
|
|
3067
3067
|
}
|
|
3068
3068
|
};
|
|
3069
|
-
var make = (value) =>
|
|
3069
|
+
var make = (value) => map7(unbounded({
|
|
3070
3070
|
replay: 1
|
|
3071
3071
|
}), (pubsub) => {
|
|
3072
3072
|
const self = Object.create(Proto);
|
|
3073
|
-
self.semaphore =
|
|
3073
|
+
self.semaphore = makeUnsafe2(1);
|
|
3074
3074
|
self.value = value;
|
|
3075
3075
|
self.pubsub = pubsub;
|
|
3076
3076
|
publishUnsafe(self.pubsub, value);
|
|
@@ -3100,7 +3100,7 @@ var configLockPolls = 2 * configLockStaleMs / configLockPollMs;
|
|
|
3100
3100
|
var recordAttempts = 3;
|
|
3101
3101
|
var writePermits = new Map;
|
|
3102
3102
|
var trustClaudeWorkspace = (home, workspace) => {
|
|
3103
|
-
const permit = writePermits.get(home) ??
|
|
3103
|
+
const permit = writePermits.get(home) ?? makeUnsafe2(1);
|
|
3104
3104
|
writePermits.set(home, permit);
|
|
3105
3105
|
return permit.withPermits(1)(trust(home, workspace));
|
|
3106
3106
|
};
|
|
@@ -3135,7 +3135,7 @@ var projectOf = (config, workspace) => {
|
|
|
3135
3135
|
const project = isJsonObject(projects[workspace]) ? projects[workspace] : {};
|
|
3136
3136
|
return { projects, project };
|
|
3137
3137
|
};
|
|
3138
|
-
var isTrusted = (file, workspace) =>
|
|
3138
|
+
var isTrusted = (file, workspace) => map7(readConfig(file), (config) => isSome(config) ? projectOf(config.value, workspace).project.hasTrustDialogAccepted === true : false);
|
|
3139
3139
|
var holdConfigLock = (file) => gen(function* () {
|
|
3140
3140
|
const fs = yield* FileSystem;
|
|
3141
3141
|
const lock = `${file}.lock`;
|
|
@@ -3334,7 +3334,7 @@ class ContainerError extends TaggedError("ContainerError") {
|
|
|
3334
3334
|
class SecretProxyUnreachable extends TaggedError("SecretProxyUnreachable") {
|
|
3335
3335
|
}
|
|
3336
3336
|
var imagePull = { timeout: "30 minutes" };
|
|
3337
|
-
var dockerContainerRunner =
|
|
3337
|
+
var dockerContainerRunner = map7(ChildProcessSpawner, (spawner) => {
|
|
3338
3338
|
const docker = (args, options = {}) => runCommand2("docker", args, options).pipe(mapError2((error) => new ContainerError({ message: error.message })), provideService(ChildProcessSpawner, spawner));
|
|
3339
3339
|
const labelArgs = (labels) => labels.flatMap(([key, value]) => ["--label", `${key}=${value}`]);
|
|
3340
3340
|
const ids = (output) => output.split(`
|
|
@@ -3608,19 +3608,19 @@ var openSession = (file) => gen(function* () {
|
|
|
3608
3608
|
}
|
|
3609
3609
|
return { handle, size: Number(opened.size) };
|
|
3610
3610
|
});
|
|
3611
|
-
var readAt = (handle, position, length) =>
|
|
3611
|
+
var readAt = (handle, position, length) => map7(tryPromise(() => handle.read(new Uint8Array(length), 0, length, position)), ({ buffer, bytesRead }) => buffer.subarray(0, bytesRead));
|
|
3612
3612
|
var readSessionRange = (file, position, length) => gen(function* () {
|
|
3613
3613
|
const { handle, size } = yield* openSession(file);
|
|
3614
3614
|
return yield* readAt(handle, position, Math.max(0, Math.min(length, size - position)));
|
|
3615
3615
|
}).pipe(scoped);
|
|
3616
|
-
var sessionFileSize = (file) =>
|
|
3616
|
+
var sessionFileSize = (file) => map7(openSession(file), ({ size }) => size).pipe(scoped);
|
|
3617
3617
|
var maxSubagentFiles = 1024;
|
|
3618
3618
|
var subagentFiles = (file) => gen(function* () {
|
|
3619
3619
|
const fs = yield* FileSystem;
|
|
3620
3620
|
if (file.subagents === undefined)
|
|
3621
3621
|
return [];
|
|
3622
3622
|
const found = yield* sessionFiles(file.subagents, 0, file.confinedTo);
|
|
3623
|
-
return yield* forEach(found.slice(0, maxSubagentFiles), (path) => fs.stat(path).pipe(
|
|
3623
|
+
return yield* forEach(found.slice(0, maxSubagentFiles), (path) => fs.stat(path).pipe(map7((info) => {
|
|
3624
3624
|
const modifiedAt = getOrUndefined(info.mtime)?.getTime();
|
|
3625
3625
|
return { path, size: Number(info.size), ...modifiedAt === undefined ? undefined : { modifiedAt } };
|
|
3626
3626
|
}), orElseSucceed(() => ({ path, size: 0 }))));
|
|
@@ -3654,7 +3654,7 @@ var packConfined = (file, root) => gen(function* () {
|
|
|
3654
3654
|
}
|
|
3655
3655
|
return packed;
|
|
3656
3656
|
}).pipe(scoped);
|
|
3657
|
-
var packSession = (file) => file.confinedTo === undefined ? flatMap3(FileSystem, (fs) => fs.readFile(file.path)).pipe(flatMap3((content) => tryPromise(() => gzipped(content))),
|
|
3657
|
+
var packSession = (file) => file.confinedTo === undefined ? flatMap3(FileSystem, (fs) => fs.readFile(file.path)).pipe(flatMap3((content) => tryPromise(() => gzipped(content))), map7((content) => new Uint8Array(content))) : packConfined(file, file.confinedTo);
|
|
3658
3658
|
var restoreSession = (adapter, place) => gen(function* () {
|
|
3659
3659
|
const fs = yield* FileSystem;
|
|
3660
3660
|
const location = adapter.session?.location;
|
|
@@ -3773,16 +3773,16 @@ var stepProcessEnvironment = (runnerId, attemptId, outer = process.env) => ({
|
|
|
3773
3773
|
var lists = (value, id) => value.split(listSeparator).includes(id);
|
|
3774
3774
|
var signalProcess = (pid, signal) => ignore(try_2(() => process.kill(pid, signal)));
|
|
3775
3775
|
var signalled = (pid) => try_2(() => process.kill(pid, 0)).pipe(as(true), catch_((error) => succeed6(hasProperty(error.cause, "code") && error.cause.code === "EPERM")));
|
|
3776
|
-
var procCommand = (fs, pid) =>
|
|
3777
|
-
var procProcessTable =
|
|
3776
|
+
var procCommand = (fs, pid) => map7(fs.readFile(`/proc/${pid}/cmdline`).pipe(orElseSucceed(() => new Uint8Array)), commandLine);
|
|
3777
|
+
var procProcessTable = map7(FileSystem, (fs) => ({
|
|
3778
3778
|
marked: ({ name, value }) => gen(function* () {
|
|
3779
3779
|
const prefix = `${name}=`;
|
|
3780
3780
|
const pids = (yield* fs.readDirectory("/proc").pipe(orElseSucceed(() => []))).filter((pid) => /^\d+$/.test(pid));
|
|
3781
|
-
const found = yield* forEach(pids, (pid) => fs.readFile(`/proc/${pid}/environ`).pipe(flatMap3((environ) => environEntries(environ).some((entry) => entry.startsWith(prefix) && lists(entry.slice(prefix.length), value)) ?
|
|
3781
|
+
const found = yield* forEach(pids, (pid) => fs.readFile(`/proc/${pid}/environ`).pipe(flatMap3((environ) => environEntries(environ).some((entry) => entry.startsWith(prefix) && lists(entry.slice(prefix.length), value)) ? map7(procCommand(fs, Number(pid)), (command) => [{ pid: Number(pid), command }]) : succeed6([])), orElseSucceed(() => [])), { concurrency: 16 });
|
|
3782
3782
|
return found.flat();
|
|
3783
3783
|
}),
|
|
3784
3784
|
signal: signalProcess,
|
|
3785
|
-
alive: (pid) => fs.readFileString(`/proc/${pid}/stat`).pipe(
|
|
3785
|
+
alive: (pid) => fs.readFileString(`/proc/${pid}/stat`).pipe(map7((stat) => !/^[ZX]/.test(stat.slice(stat.lastIndexOf(")") + 2))), orElseSucceed(() => false))
|
|
3786
3786
|
}));
|
|
3787
3787
|
var environEntries = (environ) => new TextDecoder().decode(environ).split("\x00");
|
|
3788
3788
|
var commandLine = (cmdline) => new TextDecoder().decode(cmdline).split("\x00").filter((part) => part !== "").join(" ");
|
|
@@ -3791,10 +3791,10 @@ var psRows = (listed) => listed.split(`
|
|
|
3791
3791
|
const matched = /^\s*(\d+)\s+(.*)$/.exec(line);
|
|
3792
3792
|
return matched === null ? [] : [{ pid: Number(matched[1]), text: matched[2] ?? "" }];
|
|
3793
3793
|
});
|
|
3794
|
-
var psProcessTable =
|
|
3794
|
+
var psProcessTable = map7(ChildProcessSpawner, (spawner) => {
|
|
3795
3795
|
const ps = (args) => runCommand2("ps", [...args, "-ww", "-U", String(process.getuid?.() ?? ""), "-o", "pid=,command="], {
|
|
3796
3796
|
timeout: "30 seconds"
|
|
3797
|
-
}).pipe(provideService(ChildProcessSpawner, spawner),
|
|
3797
|
+
}).pipe(provideService(ChildProcessSpawner, spawner), map7(psRows));
|
|
3798
3798
|
return {
|
|
3799
3799
|
marked: ({ name, value }) => gen(function* () {
|
|
3800
3800
|
const entry = ` ${name}=`;
|
|
@@ -3820,7 +3820,7 @@ var psProcessTable = map8(ChildProcessSpawner, (spawner) => {
|
|
|
3820
3820
|
var systemProcessTable = process.platform === "linux" ? procProcessTable : psProcessTable;
|
|
3821
3821
|
var unitPart = (id) => id.replaceAll(/[^A-Za-z0-9-]/g, (char) => `_${char.charCodeAt(0).toString(16)}`);
|
|
3822
3822
|
var unitPrefix = (runnerId, attemptId) => `kitman-step-${unitPart(runnerId)}.${attemptId === undefined ? "" : `${unitPart(attemptId)}.`}`;
|
|
3823
|
-
var unitSuffix = SecureRandom.pipe(flatMap3((random) => random.uuidV4()),
|
|
3823
|
+
var unitSuffix = SecureRandom.pipe(flatMap3((random) => random.uuidV4()), map7((uuid) => uuid.slice(0, 8)), provide3(layerWebCrypto));
|
|
3824
3824
|
var busVariables = ["XDG_RUNTIME_DIR", "DBUS_SESSION_BUS_ADDRESS"];
|
|
3825
3825
|
var systemdScopes = gen(function* () {
|
|
3826
3826
|
if (process.platform !== "linux")
|
|
@@ -3840,7 +3840,7 @@ var systemdScopes = gen(function* () {
|
|
|
3840
3840
|
`).filter((pid) => /^\d+$/.test(pid))).map(Number);
|
|
3841
3841
|
});
|
|
3842
3842
|
return {
|
|
3843
|
-
contain: (runnerId, attemptId, argv) =>
|
|
3843
|
+
contain: (runnerId, attemptId, argv) => map7(unitSuffix, (suffix) => {
|
|
3844
3844
|
const unit = `${unitPrefix(runnerId, attemptId)}${suffix}.scope`;
|
|
3845
3845
|
const scoped = [
|
|
3846
3846
|
"systemd-run",
|
|
@@ -3867,7 +3867,7 @@ var systemdScopes = gen(function* () {
|
|
|
3867
3867
|
])).split(`
|
|
3868
3868
|
`).flatMap((line) => line.trim().split(/\s+/)[0] ?? []).filter((unit) => unit.endsWith(".scope"));
|
|
3869
3869
|
const pids = yield* forEach(units, (unit) => flatMap3(systemd("systemctl", ["--user", "show", "--property=ControlGroup", "--value", unit]), (cgroup) => cgroup.trim() === "" ? succeed6([]) : cgroupProcesses(cgroup.trim())));
|
|
3870
|
-
return yield* forEach([...new Set(pids.flat())], (pid) =>
|
|
3870
|
+
return yield* forEach([...new Set(pids.flat())], (pid) => map7(procCommand(fs, pid), (command) => ({ pid, command })));
|
|
3871
3871
|
}).pipe(orElseSucceed(() => []))
|
|
3872
3872
|
};
|
|
3873
3873
|
});
|
|
@@ -3877,7 +3877,7 @@ var makeStepProcesses = (table, options = {}) => {
|
|
|
3877
3877
|
const { scopes } = options;
|
|
3878
3878
|
const unreaped = new Map;
|
|
3879
3879
|
const pollMs = options.pollMs ?? 50;
|
|
3880
|
-
const finding = (marker, scoped) =>
|
|
3880
|
+
const finding = (marker, scoped) => map7(all3([table.marked(marker), scoped]), ([marked, inScopes]) => {
|
|
3881
3881
|
const found = new Map([...marked, ...inScopes].map((candidate) => [candidate.pid, candidate]));
|
|
3882
3882
|
found.delete(process.pid);
|
|
3883
3883
|
return [...found.values()];
|
|
@@ -3965,7 +3965,7 @@ var stepProcessesUncontained = (input) => {
|
|
|
3965
3965
|
|
|
3966
3966
|
class StepProcesses extends Service2()("StepProcesses") {
|
|
3967
3967
|
}
|
|
3968
|
-
var stepProcessesLayer = effect(StepProcesses,
|
|
3968
|
+
var stepProcessesLayer = effect(StepProcesses, map7(systemProcessTable, (table) => makeStepProcesses(table)));
|
|
3969
3969
|
var systemStepProcessesLayer = effect(StepProcesses, gen(function* () {
|
|
3970
3970
|
const table = yield* systemProcessTable;
|
|
3971
3971
|
return makeStepProcesses(table, { scopes: yield* systemdScopes });
|
|
@@ -4075,9 +4075,9 @@ var lastingStop = (input) => gen(function* () {
|
|
|
4075
4075
|
const watch = gen(function* () {
|
|
4076
4076
|
while (true) {
|
|
4077
4077
|
const stopped = yield* raceAllFirst([
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4078
|
+
map7(until(input.seen, (last) => last.end !== undefined || last.turn > input.promptTurn && !["blocked", "working", "error"].includes(last.status ?? "")), (seen) => signalled2(seen.end === undefined ? "turn_ended" : "terminal_ended")(seen)),
|
|
4079
|
+
map7(lastingStatus(input.seen, "blocked", input.blockedGraceMs), signalled2("blocked")),
|
|
4080
|
+
map7(lastingStatus(input.seen, "error", input.idleGraceMs), signalled2("error"))
|
|
4081
4081
|
]);
|
|
4082
4082
|
if (stopped.signal !== "turn_ended" || (yield* input.outputSubmitted))
|
|
4083
4083
|
return stopped;
|
|
@@ -4281,7 +4281,7 @@ var runAttempt = (request, options) => gen(function* () {
|
|
|
4281
4281
|
env: {},
|
|
4282
4282
|
command: ["sh", "-c", 'p=$(command -v -- "$1") && [ -f "$p" ] && [ -x "$p" ]', "sh", command],
|
|
4283
4283
|
timeout: "30 seconds"
|
|
4284
|
-
}).pipe(
|
|
4284
|
+
}).pipe(map7((result) => result.exitCode === 0), mapError2(() => unavailable)));
|
|
4285
4285
|
const env = { ...policy.environment, ...marker };
|
|
4286
4286
|
return { argv: dockerExecArgv({ container, workspace, env, argv: harnessArgv }), env, registry };
|
|
4287
4287
|
}
|
|
@@ -4342,7 +4342,7 @@ var runAttempt = (request, options) => gen(function* () {
|
|
|
4342
4342
|
});
|
|
4343
4343
|
let accepted = false;
|
|
4344
4344
|
const outputSubmitted = suspend3(() => accepted ? succeed6(true) : request.settled.pipe(orElseSucceed(() => false), tap2((settled) => sync2(() => accepted ||= settled))));
|
|
4345
|
-
const readScreen =
|
|
4345
|
+
const readScreen = map7(option2(call((connection) => connection.read(address))), (screen) => isSome(screen) ? redactCredentials(screen.value).trim() : "");
|
|
4346
4346
|
const judge = (last) => gen(function* () {
|
|
4347
4347
|
if (yield* outputSubmitted)
|
|
4348
4348
|
return { status: "settled" };
|
|
@@ -4384,7 +4384,7 @@ var runAttempt = (request, options) => gen(function* () {
|
|
|
4384
4384
|
const brief = firstMessage(request.launch, workspace, launch.systemBrief === true);
|
|
4385
4385
|
const readyTurn = ready.value.turn;
|
|
4386
4386
|
const deliver = (tries) => gen(function* () {
|
|
4387
|
-
const sent = yield* result(call((connection) =>
|
|
4387
|
+
const sent = yield* result(call((connection) => map7(connection.send(address, brief), (reply) => ({ turn: reply.turn, lost: false })), () => succeed6({ turn: readyTurn, lost: true })));
|
|
4388
4388
|
if (isFailure(sent) || sent.success.lost || tries <= 1)
|
|
4389
4389
|
return sent;
|
|
4390
4390
|
const taken = yield* until(seen, stirredSince(sent.success.turn)).pipe(timeoutOption(options.briefAckMs));
|
|
@@ -4474,7 +4474,7 @@ var herdrCoreAgentBackendLayer = (options) => effect(AgentBackend, gen(function*
|
|
|
4474
4474
|
});
|
|
4475
4475
|
}));
|
|
4476
4476
|
// packages/agent-runtime/src/sandbox-host.ts
|
|
4477
|
-
var installed = (probe, command, label) =>
|
|
4477
|
+
var installed = (probe, command, label) => map7(probe("sh", ["-c", `command -v ${command}`]), (found) => found ? [] : [`${label} is not installed`]);
|
|
4478
4478
|
var srtMissing = (probe, platform) => gen(function* () {
|
|
4479
4479
|
if (platform === "darwin")
|
|
4480
4480
|
return [
|
|
@@ -4496,7 +4496,7 @@ var srtMissing = (probe, platform) => gen(function* () {
|
|
|
4496
4496
|
"unprivileged user namespaces are not allowed (on Ubuntu: sysctl kernel.apparmor_restrict_unprivileged_userns=0)"
|
|
4497
4497
|
];
|
|
4498
4498
|
});
|
|
4499
|
-
var dockerMissing = (probe, image) =>
|
|
4499
|
+
var dockerMissing = (probe, image) => map7(probe("docker", ["info"]), (reachable) => [
|
|
4500
4500
|
...reachable ? [] : ["the docker daemon is not reachable"],
|
|
4501
4501
|
...image === undefined ? ["its settings name no Docker image"] : /@sha256:[a-f0-9]{64}$/.test(image) ? [] : ["its Docker image is not pinned by digest (image@sha256:...)"]
|
|
4502
4502
|
]);
|
|
@@ -4515,7 +4515,7 @@ var probeSandboxHost = (probe, platform = process.platform, options = {}) => gen
|
|
|
4515
4515
|
]
|
|
4516
4516
|
};
|
|
4517
4517
|
});
|
|
4518
|
-
var commandHostProbe =
|
|
4518
|
+
var commandHostProbe = map7(ChildProcessSpawner, (spawner) => (command, args) => runCommand2(command, args, { timeout: "10 seconds" }).pipe(as(true), orElseSucceed(() => false), provideService(ChildProcessSpawner, spawner)));
|
|
4519
4519
|
// packages/oversight/src/domain/intent.ts
|
|
4520
4520
|
var ConstraintKind = Literals(["rule", "semantic"]);
|
|
4521
4521
|
var ConstraintSeverity = Literals(["block", "warn"]);
|
|
@@ -4693,14 +4693,14 @@ var diffFlags = ["--no-color", "--no-ext-diff", "--no-textconv", "--no-renames",
|
|
|
4693
4693
|
var catchUpReport = (worktree, input) => gen(function* () {
|
|
4694
4694
|
const git = (...args) => runCommand2("git", ["-C", worktree, ...args]);
|
|
4695
4695
|
const target = `origin/${input.target}`;
|
|
4696
|
-
const names = (from, to) =>
|
|
4697
|
-
const ownDiff = (base, head, path) =>
|
|
4696
|
+
const names = (from, to) => map7(git("diff", "--name-only", "-z", "--no-renames", from, to), (out) => out.split("\x00").filter(Boolean));
|
|
4697
|
+
const ownDiff = (base, head, path) => map7(git("diff", ...diffFlags, base, head, "--", `:(literal,top)${path}`), normalizedDiff);
|
|
4698
4698
|
const before = (yield* git("merge-base", input.from, target)).trim();
|
|
4699
4699
|
const after = (yield* git("merge-base", input.head, target)).trim();
|
|
4700
4700
|
const settled = input.automerged === undefined ? [] : (yield* names(input.automerged, input.merged)).filter((path) => !input.conflicted.includes(path));
|
|
4701
4701
|
const rewritten = [...new Set([...settled, ...yield* names(input.merged, input.head)])].sort();
|
|
4702
4702
|
const paths = [...new Set([...yield* names(before, input.from), ...yield* names(after, input.head)])].sort();
|
|
4703
|
-
const changed = yield* filter3(paths.slice(0, catchUpPathLimit), (path) =>
|
|
4703
|
+
const changed = yield* filter3(paths.slice(0, catchUpPathLimit), (path) => map7(all3([ownDiff(before, input.from, path), ownDiff(after, input.head, path)]), ([was, is]) => was !== is), { concurrency: 8 });
|
|
4704
4704
|
const lists = [input.conflicted, rewritten, paths];
|
|
4705
4705
|
return {
|
|
4706
4706
|
from: input.from,
|
|
@@ -4869,7 +4869,7 @@ var failedWhenUnrun = (label) => (execution) => {
|
|
|
4869
4869
|
};
|
|
4870
4870
|
var makeReplicaSignals = sync2(() => {
|
|
4871
4871
|
let generation = 0;
|
|
4872
|
-
let nextWork =
|
|
4872
|
+
let nextWork = makeUnsafe4();
|
|
4873
4873
|
const stops = new Map;
|
|
4874
4874
|
const mailboxes = new Map;
|
|
4875
4875
|
const mailboxFor = (workUnitId) => {
|
|
@@ -4879,8 +4879,8 @@ var makeReplicaSignals = sync2(() => {
|
|
|
4879
4879
|
const created = {
|
|
4880
4880
|
notes: [],
|
|
4881
4881
|
seen: new Set,
|
|
4882
|
-
arrived:
|
|
4883
|
-
updated:
|
|
4882
|
+
arrived: makeUnsafe4(),
|
|
4883
|
+
updated: makeUnsafe4()
|
|
4884
4884
|
};
|
|
4885
4885
|
mailboxes.set(workUnitId, created);
|
|
4886
4886
|
return created;
|
|
@@ -4891,14 +4891,14 @@ var makeReplicaSignals = sync2(() => {
|
|
|
4891
4891
|
if (note !== undefined)
|
|
4892
4892
|
return succeed6(note);
|
|
4893
4893
|
if (isDoneUnsafe(mailbox.arrived))
|
|
4894
|
-
mailbox.arrived =
|
|
4894
|
+
mailbox.arrived = makeUnsafe4();
|
|
4895
4895
|
return andThen2(_await(mailbox.arrived), nextSteer(workUnitId));
|
|
4896
4896
|
});
|
|
4897
4897
|
const stopFor = (workUnitId) => {
|
|
4898
4898
|
const existing = stops.get(workUnitId);
|
|
4899
4899
|
if (existing !== undefined)
|
|
4900
4900
|
return existing;
|
|
4901
|
-
const created =
|
|
4901
|
+
const created = makeUnsafe4();
|
|
4902
4902
|
stops.set(workUnitId, created);
|
|
4903
4903
|
return created;
|
|
4904
4904
|
};
|
|
@@ -4910,7 +4910,7 @@ var makeReplicaSignals = sync2(() => {
|
|
|
4910
4910
|
WorkAvailable: () => {
|
|
4911
4911
|
generation += 1;
|
|
4912
4912
|
const signalled = nextWork;
|
|
4913
|
-
nextWork =
|
|
4913
|
+
nextWork = makeUnsafe4();
|
|
4914
4914
|
doneUnsafe(signalled, void_2);
|
|
4915
4915
|
},
|
|
4916
4916
|
LeaseRevoked: ({ workUnitId }) => stop(workUnitId, "lost"),
|
|
@@ -4943,7 +4943,7 @@ var makeReplicaSignals = sync2(() => {
|
|
|
4943
4943
|
sessionUpdated: (workUnitId) => suspend3(() => {
|
|
4944
4944
|
const mailbox = mailboxFor(workUnitId);
|
|
4945
4945
|
return andThen2(_await(mailbox.updated), sync2(() => {
|
|
4946
|
-
mailbox.updated =
|
|
4946
|
+
mailbox.updated = makeUnsafe4();
|
|
4947
4947
|
}));
|
|
4948
4948
|
}),
|
|
4949
4949
|
forget: (workUnitId) => sync2(() => {
|
|
@@ -5019,7 +5019,7 @@ var IdleRecheck = seconds(60);
|
|
|
5019
5019
|
var idleBackoff = (idleIterations) => millis(Math.min(1000 * 2 ** idleIterations, 30000));
|
|
5020
5020
|
function superviseReplica(input) {
|
|
5021
5021
|
const { signals } = input;
|
|
5022
|
-
const claimTurn =
|
|
5022
|
+
const claimTurn = makeUnsafe2(1);
|
|
5023
5023
|
let emptyAt = -1;
|
|
5024
5024
|
const wokenControl = (control, signals) => ({
|
|
5025
5025
|
...control,
|
|
@@ -5617,7 +5617,7 @@ var transcriptRelay = (input) => {
|
|
|
5617
5617
|
passOver(last);
|
|
5618
5618
|
batchLimit = batchSize;
|
|
5619
5619
|
};
|
|
5620
|
-
const givesUp = (error, lastChance) =>
|
|
5620
|
+
const givesUp = (error, lastChance) => map7(currentTimeMillis, (now) => {
|
|
5621
5621
|
if (lastChance || sendRefusal(error) === "refused")
|
|
5622
5622
|
return true;
|
|
5623
5623
|
failingSince ??= now;
|
|
@@ -5788,7 +5788,7 @@ var transcriptRelay = (input) => {
|
|
|
5788
5788
|
});
|
|
5789
5789
|
return {
|
|
5790
5790
|
record,
|
|
5791
|
-
stalledFor: (millis) =>
|
|
5791
|
+
stalledFor: (millis) => map7(currentTimeMillis, (now) => asking.size === 0 && progressAt !== undefined && now - progressAt >= millis),
|
|
5792
5792
|
asking: sync2(() => asking.size > 0),
|
|
5793
5793
|
loginLost: sync2(() => loginLost),
|
|
5794
5794
|
refusal: sync2(() => refusal),
|
|
@@ -5881,7 +5881,7 @@ var gitRemote = (repoBinding, credential) => {
|
|
|
5881
5881
|
};
|
|
5882
5882
|
var clonePermits = new Map;
|
|
5883
5883
|
var inClone = (directory) => (effect) => {
|
|
5884
|
-
const permit = clonePermits.get(directory) ??
|
|
5884
|
+
const permit = clonePermits.get(directory) ?? makeUnsafe2(1);
|
|
5885
5885
|
clonePermits.set(directory, permit);
|
|
5886
5886
|
return permit.withPermits(1)(effect);
|
|
5887
5887
|
};
|
|
@@ -5889,7 +5889,7 @@ var repositoryClone = (rootDir, repoBindingId) => `${rootDir}/repos/${repoBindin
|
|
|
5889
5889
|
var runCheckouts = (rootDir, credentials) => {
|
|
5890
5890
|
const runsDir = `${rootDir}/runs`;
|
|
5891
5891
|
const reposDir = `${rootDir}/repos`;
|
|
5892
|
-
const remote = (repoBinding) =>
|
|
5892
|
+
const remote = (repoBinding) => map7(credentials === undefined ? undefined_ : credentials(repoBinding.id).pipe(catch_((error) => as(logWarning("runner_git_credential_unavailable", error.message), undefined))), (credential) => gitRemote(repoBinding, credential));
|
|
5893
5893
|
const cloned = (repoBinding) => gen(function* () {
|
|
5894
5894
|
const fs = yield* FileSystem;
|
|
5895
5895
|
const forbidden = findForbiddenRepoBindingSecretPath(repoBinding);
|
|
@@ -5916,9 +5916,9 @@ var runCheckouts = (rootDir, credentials) => {
|
|
|
5916
5916
|
});
|
|
5917
5917
|
const fetch = (directory, env) => runCommand2("git", ["-C", directory, ...stallLimit, "fetch", "--prune", "origin"], { ...transfer, env });
|
|
5918
5918
|
const inCloneOf = (repoBinding) => inClone(repositoryClone(rootDir, repoBinding.id));
|
|
5919
|
-
const clone = (repoBinding) => inCloneOf(repoBinding)(
|
|
5920
|
-
const transferEnv = (repoBinding) => repoBinding === undefined ? succeed6({}) :
|
|
5921
|
-
const holds = (directory, revision) => revision === undefined || !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(revision) ? succeed6(false) :
|
|
5919
|
+
const clone = (repoBinding) => inCloneOf(repoBinding)(map7(cloned(repoBinding), ({ directory }) => directory));
|
|
5920
|
+
const transferEnv = (repoBinding) => repoBinding === undefined ? succeed6({}) : map7(remote(repoBinding), ({ env }) => env);
|
|
5921
|
+
const holds = (directory, revision) => revision === undefined || !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(revision) ? succeed6(false) : map7(exit(runCommand2("git", ["-C", directory, "cat-file", "-e", `${revision}^{commit}`])), isSuccess2);
|
|
5922
5922
|
const checkout = (work, repoBinding, checkpoint) => gen(function* () {
|
|
5923
5923
|
const fs = yield* FileSystem;
|
|
5924
5924
|
const path = yield* Path;
|
|
@@ -5961,7 +5961,7 @@ var runCheckouts = (rootDir, credentials) => {
|
|
|
5961
5961
|
const directory = `${rootDir}/scratch/${work.id}`;
|
|
5962
5962
|
return yield* acquireRelease(as(fs.makeDirectory(directory, { recursive: true }), directory), () => ignore(fs.remove(directory, { recursive: true, force: true })));
|
|
5963
5963
|
});
|
|
5964
|
-
const reaches = (repoBinding) => flatMap3(remote(repoBinding), ({ url, env }) =>
|
|
5964
|
+
const reaches = (repoBinding) => flatMap3(remote(repoBinding), ({ url, env }) => map7(exit(runCommand2("git", [...stallLimit, "ls-remote", url, "HEAD"], { timeout: "1 minute", env })), isSuccess2));
|
|
5965
5965
|
return {
|
|
5966
5966
|
clone,
|
|
5967
5967
|
transferEnv,
|
|
@@ -5990,7 +5990,7 @@ var clearSettledCheckpoints = (rpc, checkouts) => gen(function* () {
|
|
|
5990
5990
|
var deleteRef = (checkouts, repoBinding, ref) => gen(function* () {
|
|
5991
5991
|
const repository = yield* checkouts.clone(repoBinding);
|
|
5992
5992
|
const env = yield* checkouts.transferEnv(repoBinding);
|
|
5993
|
-
const onOrigin =
|
|
5993
|
+
const onOrigin = map7(runCommand2("git", ["-C", repository, "ls-remote", "origin", ref], { env }), (listed) => listed.trim() !== "");
|
|
5994
5994
|
if (yield* onOrigin)
|
|
5995
5995
|
yield* runCommand2("git", ["-C", repository, ...stallLimit, "push", "origin", "--delete", ref], {
|
|
5996
5996
|
...transfer,
|
|
@@ -6030,7 +6030,7 @@ var runChange = (worktree, runBase) => gen(function* () {
|
|
|
6030
6030
|
const git = (...args) => runCommand2("git", ["-C", worktree, ...args]);
|
|
6031
6031
|
const base = (yield* git("merge-base", "HEAD", runBase)).trim();
|
|
6032
6032
|
const changedPaths = (yield* git("diff", "--name-only", "-z", "--no-renames", base, "HEAD")).split("\x00").filter((path) => path !== "");
|
|
6033
|
-
const files = yield* forEach(changedPaths.slice(0, EvidenceLimits.files).filter((path) => !looksSecret(path)), (path) =>
|
|
6033
|
+
const files = yield* forEach(changedPaths.slice(0, EvidenceLimits.files).filter((path) => !looksSecret(path)), (path) => map7(git("diff", "--no-color", "--no-renames", base, "HEAD", "--", `:(literal)${path}`), (diff) => ({
|
|
6034
6034
|
path,
|
|
6035
6035
|
diff
|
|
6036
6036
|
})));
|
|
@@ -6049,7 +6049,7 @@ var keepSession = (rpc, lease, content) => gen(function* () {
|
|
|
6049
6049
|
yield* fs.writeFile(path, content);
|
|
6050
6050
|
const files = {
|
|
6051
6051
|
createRunFile: ({ byteSize, sha256 }) => rpc.createCheckpointFile({ lease, byteSize, sha256 }),
|
|
6052
|
-
runFileParts: (request) =>
|
|
6052
|
+
runFileParts: (request) => map7(rpc.checkpointFileParts({ lease, ...request, partNumbers: [...request.partNumbers] }), ({ parts }) => parts),
|
|
6053
6053
|
completeRunFile: ({ parts, ...request }) => rpc.completeCheckpointFile({ lease, ...request, ...parts === undefined ? undefined : { parts: [...parts] } })
|
|
6054
6054
|
};
|
|
6055
6055
|
const kept = yield* uploadRunFile(files, { step: "", name: "session.gz", path });
|
|
@@ -6097,7 +6097,7 @@ var stageAll = (worktree, git) => gen(function* () {
|
|
|
6097
6097
|
yield* git("add", "--all", "--", ".", ...leftovers.map((name) => `:(exclude,top)${name}`));
|
|
6098
6098
|
});
|
|
6099
6099
|
var conflictMarker = "^(<<<<<<<|>>>>>>>)( |$)";
|
|
6100
|
-
var markedPaths = (git, paths, ...from) => git("grep", ...from, "-l", "-z", "-E", conflictMarker, "--", ...paths.map((path) => `:(literal,top)${path}`)).pipe(catchIf((error) => error.reason === "exit code 1", () => succeed6("")),
|
|
6100
|
+
var markedPaths = (git, paths, ...from) => git("grep", ...from, "-l", "-z", "-E", conflictMarker, "--", ...paths.map((path) => `:(literal,top)${path}`)).pipe(catchIf((error) => error.reason === "exit code 1", () => succeed6("")), map7((out) => out.split("\x00").filter(Boolean)));
|
|
6101
6101
|
var list = (paths) => paths.join(", ");
|
|
6102
6102
|
var unmarkedConflicts = (worktree, conflicted, marked) => gen(function* () {
|
|
6103
6103
|
const stages = new Map;
|
|
@@ -6134,7 +6134,7 @@ var automergedTree = (worktree, conflicted) => gen(function* () {
|
|
|
6134
6134
|
const scratchIndex = `${index}.kitman-automerged`;
|
|
6135
6135
|
const git = (...args) => runCommand2("git", ["-C", worktree, ...args], { env: { GIT_INDEX_FILE: scratchIndex } });
|
|
6136
6136
|
yield* fs.copyFile(index, scratchIndex);
|
|
6137
|
-
return yield* ensuring2(andThen2(git("update-index", "--force-remove", "--", ...conflicted),
|
|
6137
|
+
return yield* ensuring2(andThen2(git("update-index", "--force-remove", "--", ...conflicted), map7(git("write-tree"), (tree) => tree.trim())), ignore(fs.remove(scratchIndex)));
|
|
6138
6138
|
});
|
|
6139
6139
|
var mergeTarget = (worktree, target) => gen(function* () {
|
|
6140
6140
|
const git = (...args) => runCommand2("git", ["-C", worktree, ...gitIdentity, ...args]);
|
|
@@ -6275,7 +6275,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6275
6275
|
};
|
|
6276
6276
|
const sessionId = transcript !== undefined || adapter?.session?.start !== undefined ? session.id : undefined;
|
|
6277
6277
|
let last = saved?.ref === checkpointRef(work) ? saved : {};
|
|
6278
|
-
const checkpointTurn =
|
|
6278
|
+
const checkpointTurn = makeUnsafe2(1);
|
|
6279
6279
|
const takeCheckpoint = gen(function* () {
|
|
6280
6280
|
if (input.checkpoints === undefined)
|
|
6281
6281
|
return;
|
|
@@ -6367,7 +6367,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6367
6367
|
...refusal.until === undefined ? undefined : { until: refusal.until },
|
|
6368
6368
|
...backend === "docker" ? { scope: "step" } : undefined
|
|
6369
6369
|
});
|
|
6370
|
-
const outputSubmitted = input.heartbeat(work).pipe(option2,
|
|
6370
|
+
const outputSubmitted = input.heartbeat(work).pipe(option2, map7((state) => isSome(state) && state.value.outputSubmitted === true));
|
|
6371
6371
|
const providerRefused = relay === undefined ? never : gen(function* () {
|
|
6372
6372
|
for (;; ) {
|
|
6373
6373
|
yield* sleep("1 second");
|
|
@@ -6419,7 +6419,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6419
6419
|
tokens = spentNow;
|
|
6420
6420
|
input.spending?.set(work.id, spentNow);
|
|
6421
6421
|
yield* andThen2(relay.record([{ kind: "lifecycle", state }]), relay.lastFlush).pipe(timeout("5 seconds"), ignore);
|
|
6422
|
-
const sending = yield* forkIn(relay.sendRest, input.runnerScope ??
|
|
6422
|
+
const sending = yield* forkIn(relay.sendRest, input.runnerScope ?? makeUnsafe5());
|
|
6423
6423
|
resending.set(work.id, sending);
|
|
6424
6424
|
if (state !== "parked")
|
|
6425
6425
|
sending.addObserver(() => resending.delete(work.id));
|
|
@@ -7061,7 +7061,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
7061
7061
|
return {
|
|
7062
7062
|
request: (method, params) => gen(function* () {
|
|
7063
7063
|
const id = ++lastId;
|
|
7064
|
-
const deferred = yield*
|
|
7064
|
+
const deferred = yield* make15();
|
|
7065
7065
|
pending.set(id, deferred);
|
|
7066
7066
|
yield* send({ id, method, params });
|
|
7067
7067
|
return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
|
|
@@ -7162,7 +7162,7 @@ function composeAgentEnvironmentSyncPlan(targets) {
|
|
|
7162
7162
|
}
|
|
7163
7163
|
var updateHarness = (argv) => gen(function* () {
|
|
7164
7164
|
const run = yield* CommandRunner2;
|
|
7165
|
-
const failure = yield* run(argv).pipe(
|
|
7165
|
+
const failure = yield* run(argv).pipe(map7((result) => result.exitCode === 0 ? undefined : result.output.trim().split(`
|
|
7166
7166
|
`).at(-1) ?? `exit code ${result.exitCode}`), catch_((error) => succeed6(error.message)));
|
|
7167
7167
|
return failure === undefined ? [] : [`Kitman could not update ${argv[0]} with \`${argv.join(" ")}\`: ${failure}`];
|
|
7168
7168
|
});
|
|
@@ -7175,10 +7175,10 @@ var applyAgentEnvironmentPlans = fnUntraced(function* (plan) {
|
|
|
7175
7175
|
const updateWarnings = yield* forEach(plan.targets, (target) => target.harnessUpdater === undefined ? succeed6([]) : updateHarness(target.harnessUpdater));
|
|
7176
7176
|
for (const target of plan.targets)
|
|
7177
7177
|
yield* applyAgentEnvironmentConfigSync(target.harnessConfig).pipe(mapError2((cause) => new AgentEnvironmentPlanApplyError({ phase: "harness_config", cause })));
|
|
7178
|
-
const targets = yield* forEach(plan.targets, (target, index) =>
|
|
7178
|
+
const targets = yield* forEach(plan.targets, (target, index) => map7(target.skills.codexHookTrust === undefined ? succeed6([]) : trustCodexPluginHooks({
|
|
7179
7179
|
...target.skills.codexHookTrust,
|
|
7180
7180
|
plugins: target.skills.materializedPlugins.map((plugin) => plugin.name)
|
|
7181
|
-
}), (trustWarnings) => [...updateWarnings[index] ?? [], ...trustWarnings]).pipe(
|
|
7181
|
+
}), (trustWarnings) => [...updateWarnings[index] ?? [], ...trustWarnings]).pipe(map7((warnings) => ({
|
|
7182
7182
|
...target,
|
|
7183
7183
|
skills: { ...target.skills, warnings: [...target.skills.warnings, ...warnings.map((message) => ({ message }))] },
|
|
7184
7184
|
warnings: [...target.warnings, ...warnings]
|
|
@@ -7204,7 +7204,7 @@ var kitmanMcpPreflight = (mcp) => gen(function* () {
|
|
|
7204
7204
|
const server = yield* spawner.spawn(make3(mcp.command, [...mcp.args], {
|
|
7205
7205
|
extendEnv: true,
|
|
7206
7206
|
env: mcp.env,
|
|
7207
|
-
stdin: { stream:
|
|
7207
|
+
stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
|
|
7208
7208
|
stderr: "ignore"
|
|
7209
7209
|
}));
|
|
7210
7210
|
const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
|
|
@@ -7266,7 +7266,7 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
|
|
|
7266
7266
|
storageOrigin: work.storageOrigin,
|
|
7267
7267
|
network: work.network
|
|
7268
7268
|
});
|
|
7269
|
-
const inherited = (yield* forEach(inheritedEnv, (name) =>
|
|
7269
|
+
const inherited = (yield* forEach(inheritedEnv, (name) => map7(optionalEnv(name), (value) => value === undefined ? [] : [[name, value]]))).flat();
|
|
7270
7270
|
const programEnv = {
|
|
7271
7271
|
BUN_BE_BUN: "1",
|
|
7272
7272
|
KITMAN_LOOP_ID: program.loopId,
|
|
@@ -7278,7 +7278,7 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
|
|
|
7278
7278
|
const exitCode = sandbox === undefined ? yield* gen(function* () {
|
|
7279
7279
|
const spawner = yield* ChildProcessSpawner;
|
|
7280
7280
|
const handle = yield* spawner.spawn(make3(input.bun ?? process.execPath, [file], {
|
|
7281
|
-
stdin:
|
|
7281
|
+
stdin: make10(new TextEncoder().encode(stdin)),
|
|
7282
7282
|
stdout: "inherit",
|
|
7283
7283
|
stderr: "inherit",
|
|
7284
7284
|
extendEnv: false,
|
|
@@ -7356,9 +7356,9 @@ var statusOfExit = (exitCode) => {
|
|
|
7356
7356
|
return "failed";
|
|
7357
7357
|
}
|
|
7358
7358
|
};
|
|
7359
|
-
var executableAt = (checkout, revision) =>
|
|
7359
|
+
var executableAt = (checkout, revision) => map7(runCommand2("git", ["-C", checkout, "ls-tree", "--end-of-options", revision, "--", deployScript]), (listed) => listed.startsWith("100755 "));
|
|
7360
7360
|
var tagCommit = (checkout, tagRef) => exit(runCommand2("git", ["-C", checkout, "rev-parse", "--verify", "--quiet", "--end-of-options", `${tagRef}^{commit}`]));
|
|
7361
|
-
var headOf = (checkout) =>
|
|
7361
|
+
var headOf = (checkout) => map7(all3([
|
|
7362
7362
|
runCommand2("git", ["-C", checkout, "rev-parse", "HEAD"]),
|
|
7363
7363
|
runCommand2("git", ["-C", checkout, "rev-parse", "HEAD^{tree}"])
|
|
7364
7364
|
]), ([revision, tree]) => ({ revision: revision.trim(), tree: tree.trim(), checks: [] }));
|
|
@@ -7629,7 +7629,7 @@ var redactedCopy = (from, to) => gen(function* () {
|
|
|
7629
7629
|
var checkFileKeeper = (work, runFiles, storage) => {
|
|
7630
7630
|
const files = rpcRunFiles(runFiles, programLease(work));
|
|
7631
7631
|
let left = checkFilesPerVerification;
|
|
7632
|
-
const keep = (name, path) => uploadRunFile(files, { step: work.stepKey, name, path }).pipe(provideService(HttpClient, storage),
|
|
7632
|
+
const keep = (name, path) => uploadRunFile(files, { step: work.stepKey, name, path }).pipe(provideService(HttpClient, storage), map7((file) => file.status === "available" ? [file.id] : []), catch_((error) => as(logWarning("check_run_file_not_kept", `${name}: ${error.message}`), [])));
|
|
7633
7633
|
return (input) => gen(function* () {
|
|
7634
7634
|
const path = yield* Path;
|
|
7635
7635
|
const log = `${input.output}.log`;
|
|
@@ -7644,7 +7644,7 @@ var reportedTests = (filesDir) => gen(function* () {
|
|
|
7644
7644
|
const fs = yield* FileSystem;
|
|
7645
7645
|
const path = yield* Path;
|
|
7646
7646
|
const names = (yield* regularFiles(filesDir)).filter(isTestReportName);
|
|
7647
|
-
const reports = yield* forEach(names, (name) => fs.readFileString(path.join(filesDir, name)).pipe(
|
|
7647
|
+
const reports = yield* forEach(names, (name) => fs.readFileString(path.join(filesDir, name)).pipe(map7((text) => [text]), orElseSucceed(() => [])));
|
|
7648
7648
|
return checkTests(reports.flat());
|
|
7649
7649
|
}).pipe(orElseSucceed(() => checkTests([])));
|
|
7650
7650
|
|
|
@@ -7787,7 +7787,7 @@ var unresolvedDependencies = (worktree) => gen(function* () {
|
|
|
7787
7787
|
}).pipe(orElseSucceed(() => {
|
|
7788
7788
|
return;
|
|
7789
7789
|
}));
|
|
7790
|
-
const manifestAt = (dir) => fs.readFileString(path.join(dir, "package.json")).pipe(
|
|
7790
|
+
const manifestAt = (dir) => fs.readFileString(path.join(dir, "package.json")).pipe(map7((text) => getOrUndefined(decodeJsonStringOption(text))), orElseSucceed(() => {
|
|
7791
7791
|
return;
|
|
7792
7792
|
}));
|
|
7793
7793
|
const unresolved = [];
|
|
@@ -8014,7 +8014,7 @@ var resolveRevisions = (work, revisions, checkouts) => gen(function* () {
|
|
|
8014
8014
|
};
|
|
8015
8015
|
return resolved;
|
|
8016
8016
|
});
|
|
8017
|
-
var treeOf = (worktree) =>
|
|
8017
|
+
var treeOf = (worktree) => map7(runCommand2("git", ["-C", worktree, "rev-parse", "HEAD^{tree}"]), (tree) => tree.trim());
|
|
8018
8018
|
var verificationExecutor = (input) => (work) => gen(function* () {
|
|
8019
8019
|
if (input.sandbox !== undefined && input.sandbox.backend === undefined)
|
|
8020
8020
|
return {
|