@kitman-sh/cli 0.10.96 → 0.10.98
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-ampzxrqe.js → chunk-07p2dcq3.js} +333 -94
- package/dist/{chunk-2kr43ps6.js → chunk-3bjekzn7.js} +312 -395
- package/dist/{chunk-dh3108wk.js → chunk-6dc0x5cg.js} +8 -8
- package/dist/{chunk-q3nygncv.js → chunk-797w5qe6.js} +7 -7
- package/dist/{chunk-4psvc86s.js → chunk-7c3pgktm.js} +9 -8
- package/dist/{chunk-a244myqw.js → chunk-7ya2q09c.js} +1 -1
- package/dist/{chunk-qacvrg7j.js → chunk-95mkdtzk.js} +6 -6
- package/dist/{chunk-tpdcq44c.js → chunk-aba9zdpb.js} +32 -32
- package/dist/{chunk-mcpesyz2.js → chunk-bqg9gy2e.js} +7 -7
- package/dist/{chunk-8tq7n7wc.js → chunk-c6h3fhtb.js} +24 -24
- package/dist/{chunk-fv6kgtze.js → chunk-cgjyv52e.js} +2 -2
- package/dist/{chunk-bk3dpjxq.js → chunk-d1sqb8rt.js} +1 -1
- package/dist/{chunk-c9wzakrx.js → chunk-fd39ch4n.js} +8 -8
- package/dist/{chunk-6aa8y66v.js → chunk-g1xmj2nb.js} +4 -4
- package/dist/{chunk-abf4m4b2.js → chunk-gfqm22x7.js} +5 -5
- package/dist/{chunk-15w92pn6.js → chunk-j8vq6sk1.js} +19 -19
- package/dist/{chunk-t7ncjd6s.js → chunk-n8c1wh6t.js} +6 -6
- package/dist/{chunk-rdv42ygn.js → chunk-nym2zmz3.js} +4 -4
- package/dist/{chunk-3r7ahnwy.js → chunk-p83y21hp.js} +4 -4
- package/dist/{chunk-et6qa95h.js → chunk-qrxkpwzy.js} +1 -1
- package/dist/{chunk-vjcn82g3.js → chunk-s5p94z8x.js} +65 -214
- package/dist/{chunk-q2d37e4x.js → chunk-s90hj0mb.js} +53 -53
- package/dist/{chunk-s3qgchay.js → chunk-sy8d7bfa.js} +98 -98
- package/dist/{chunk-g3r5xp0t.js → chunk-xwhybbj2.js} +2 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
isObject,
|
|
7
7
|
isJsonObject,
|
|
8
8
|
isString
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-d1sqb8rt.js";
|
|
10
10
|
import {
|
|
11
11
|
pipeArguments,
|
|
12
12
|
dual,
|
|
@@ -46,14 +46,14 @@ import {
|
|
|
46
46
|
isSuccess2,
|
|
47
47
|
isFailure2,
|
|
48
48
|
hasInterrupts,
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
makeUnsafe4,
|
|
50
|
+
make15,
|
|
51
51
|
_await,
|
|
52
52
|
fail5,
|
|
53
53
|
isDoneUnsafe,
|
|
54
54
|
succeed4,
|
|
55
55
|
doneUnsafe,
|
|
56
|
-
|
|
56
|
+
makeUnsafe5,
|
|
57
57
|
provide,
|
|
58
58
|
succeed5,
|
|
59
59
|
effect,
|
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
die2,
|
|
62
62
|
findErrorOption,
|
|
63
63
|
pretty,
|
|
64
|
+
currentTimeMillis,
|
|
64
65
|
exponential,
|
|
65
66
|
jittered,
|
|
66
67
|
spaced,
|
|
@@ -88,7 +89,7 @@ import {
|
|
|
88
89
|
result,
|
|
89
90
|
option2,
|
|
90
91
|
exit,
|
|
91
|
-
|
|
92
|
+
map7,
|
|
92
93
|
as,
|
|
93
94
|
asSome2,
|
|
94
95
|
asVoid,
|
|
@@ -167,14 +168,13 @@ import {
|
|
|
167
168
|
encodePrettyJsonString,
|
|
168
169
|
decodeJsonStringSync,
|
|
169
170
|
encodeUnknownJsonStringSync
|
|
170
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-07p2dcq3.js";
|
|
171
172
|
import {
|
|
172
173
|
Id,
|
|
173
174
|
secretReference,
|
|
174
175
|
secretPlaceholder
|
|
175
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-qrxkpwzy.js";
|
|
176
177
|
import {
|
|
177
|
-
currentTimeMillis,
|
|
178
178
|
SecureRandom,
|
|
179
179
|
layerWebCrypto,
|
|
180
180
|
layer,
|
|
@@ -245,7 +245,7 @@ import {
|
|
|
245
245
|
installCommand,
|
|
246
246
|
checkServicesFile,
|
|
247
247
|
checkServices
|
|
248
|
-
} from "./chunk-
|
|
248
|
+
} from "./chunk-3bjekzn7.js";
|
|
249
249
|
import {
|
|
250
250
|
join,
|
|
251
251
|
interrupt,
|
|
@@ -253,8 +253,8 @@ import {
|
|
|
253
253
|
publishUnsafe,
|
|
254
254
|
unbounded2,
|
|
255
255
|
offer,
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
makeUnsafe2,
|
|
257
|
+
make10,
|
|
258
258
|
fromQueue,
|
|
259
259
|
fromPubSub,
|
|
260
260
|
map2,
|
|
@@ -285,7 +285,7 @@ import {
|
|
|
285
285
|
writeSrtSettings2,
|
|
286
286
|
srtStepArgv2,
|
|
287
287
|
srtArgv2
|
|
288
|
-
} from "./chunk-
|
|
288
|
+
} from "./chunk-s5p94z8x.js";
|
|
289
289
|
import {
|
|
290
290
|
writeAgentEnvironmentConfigFile2,
|
|
291
291
|
readManifestSkillPaths2,
|
|
@@ -301,8 +301,8 @@ import {
|
|
|
301
301
|
applyAgentEnvironmentMaterialization2,
|
|
302
302
|
isPathWithin2,
|
|
303
303
|
skillIdentity2
|
|
304
|
-
} from "./chunk-
|
|
305
|
-
import"./chunk-
|
|
304
|
+
} from "./chunk-6dc0x5cg.js";
|
|
305
|
+
import"./chunk-bqg9gy2e.js";
|
|
306
306
|
import {
|
|
307
307
|
egressAllowed,
|
|
308
308
|
writeSecretRegistry,
|
|
@@ -312,7 +312,7 @@ import {
|
|
|
312
312
|
secretFilter2,
|
|
313
313
|
opaqueTunnelRefusal2,
|
|
314
314
|
isOpaqueConnectReason2
|
|
315
|
-
} from "./chunk-
|
|
315
|
+
} from "./chunk-cgjyv52e.js";
|
|
316
316
|
import {
|
|
317
317
|
sliceBytes2,
|
|
318
318
|
maxLineBytes2,
|
|
@@ -320,23 +320,23 @@ import {
|
|
|
320
320
|
decodedOption2,
|
|
321
321
|
decoded2,
|
|
322
322
|
readOpencode2
|
|
323
|
-
} from "./chunk-
|
|
323
|
+
} from "./chunk-n8c1wh6t.js";
|
|
324
324
|
import {
|
|
325
325
|
uploadRunFile,
|
|
326
326
|
programLease,
|
|
327
327
|
rpcRunFiles,
|
|
328
328
|
programHostsEnv,
|
|
329
329
|
undeclaredHostsEnv
|
|
330
|
-
} from "./chunk-
|
|
331
|
-
import"./chunk-
|
|
330
|
+
} from "./chunk-7c3pgktm.js";
|
|
331
|
+
import"./chunk-95mkdtzk.js";
|
|
332
332
|
import {
|
|
333
333
|
nextInt
|
|
334
|
-
} from "./chunk-
|
|
334
|
+
} from "./chunk-7ya2q09c.js";
|
|
335
335
|
import {
|
|
336
336
|
ChildProcessSpawner,
|
|
337
337
|
make3
|
|
338
|
-
} from "./chunk-
|
|
339
|
-
import"./chunk-
|
|
338
|
+
} from "./chunk-p83y21hp.js";
|
|
339
|
+
import"./chunk-c6h3fhtb.js";
|
|
340
340
|
|
|
341
341
|
// packages/core/src/sync-kit.ts
|
|
342
342
|
import { createHash } from "crypto";
|
|
@@ -902,7 +902,7 @@ var resolvePackagePlugins = (input, plan) => gen(function* () {
|
|
|
902
902
|
const source = packageSource(plugin);
|
|
903
903
|
if (source === undefined || source.version !== undefined && input.versions !== "latest")
|
|
904
904
|
return succeed6([plugin]);
|
|
905
|
-
return resolver.npmLatest(source.packageName).pipe(
|
|
905
|
+
return resolver.npmLatest(source.packageName).pipe(map7((version) => [
|
|
906
906
|
{
|
|
907
907
|
...plugin,
|
|
908
908
|
item: {
|
|
@@ -2282,7 +2282,7 @@ var openCodeStore = (source) => gen(function* () {
|
|
|
2282
2282
|
var runOpenCode = (binary, store, args) => runCommand2(binary, [...args, "--standalone"], { env: store.env, timeout: "30 seconds" });
|
|
2283
2283
|
var readOpenCodeLogin = (binary, source) => gen(function* () {
|
|
2284
2284
|
const store = yield* openCodeStore(source);
|
|
2285
|
-
const exported = store === undefined ? none() : yield* runOpenCode(binary, store, ["auth", "export"]).pipe(
|
|
2285
|
+
const exported = store === undefined ? none() : yield* runOpenCode(binary, store, ["auth", "export"]).pipe(map7(decodeExport), orElseSucceed(() => none()));
|
|
2286
2286
|
if (isNone(exported)) {
|
|
2287
2287
|
const credentials = yield* fileCredentials(source);
|
|
2288
2288
|
return credentials === undefined ? undefined : { credentials };
|
|
@@ -2329,17 +2329,17 @@ var renewers = {
|
|
|
2329
2329
|
grant_type: "refresh_token",
|
|
2330
2330
|
refresh_token: login.refresh,
|
|
2331
2331
|
client_id: "9d1c250a-e61b-44d9-88ed-5944d1962f5e"
|
|
2332
|
-
}))).pipe(
|
|
2332
|
+
}))).pipe(map7(refreshed(now))),
|
|
2333
2333
|
openai: (login, now) => answer("openai", TokenAnswer, post("https://auth.openai.com/oauth/token").pipe(bodyUrlParams({
|
|
2334
2334
|
grant_type: "refresh_token",
|
|
2335
2335
|
refresh_token: login.refresh,
|
|
2336
2336
|
client_id: "app_EMoamEEZ73f0CkXaXp7hrann"
|
|
2337
|
-
}))).pipe(
|
|
2337
|
+
}))).pipe(map7(refreshed(now))),
|
|
2338
2338
|
xai: (login, now) => answer("xai", XaiAnswer, post("https://auth.x.ai/oauth2/token").pipe(acceptJson, bodyUrlParams({
|
|
2339
2339
|
grant_type: "refresh_token",
|
|
2340
2340
|
refresh_token: login.refresh,
|
|
2341
2341
|
client_id: "b1a00492-073a-47ea-816f-4c329264a828"
|
|
2342
|
-
}))).pipe(
|
|
2342
|
+
}))).pipe(map7((answered) => ({
|
|
2343
2343
|
access: answered.access_token,
|
|
2344
2344
|
...answered.refresh_token === undefined ? undefined : { refresh: answered.refresh_token },
|
|
2345
2345
|
expires: xaiExpiry(answered, now)
|
|
@@ -2348,8 +2348,8 @@ var renewers = {
|
|
|
2348
2348
|
grant_type: "refresh_token",
|
|
2349
2349
|
refresh_token: login.refresh,
|
|
2350
2350
|
client_id: "opencode-cli"
|
|
2351
|
-
}))).pipe(
|
|
2352
|
-
"github-copilot": (login) => answer("github-copilot", CopilotAnswer, get("https://api.github.com/copilot_internal/v2/token").pipe(setHeaders({ authorization: `Bearer ${login.refresh}`, accept: "application/json" }))).pipe(
|
|
2351
|
+
}))).pipe(map7(refreshed(now))),
|
|
2352
|
+
"github-copilot": (login) => answer("github-copilot", CopilotAnswer, get("https://api.github.com/copilot_internal/v2/token").pipe(setHeaders({ authorization: `Bearer ${login.refresh}`, accept: "application/json" }))).pipe(map7((answered) => ({ access: answered.token, expires: answered.expires_at * 1000 })))
|
|
2353
2353
|
};
|
|
2354
2354
|
var renewerFor = (provider) => isKeyOf(renewers, provider) ? renewers[provider] : undefined;
|
|
2355
2355
|
var renewableLogin = (provider, credential) => getOrUndefined(filter2(decodeRenewable(credential), (login) => renewerFor(provider) !== undefined && (provider !== "github-copilot" || login.access !== login.refresh)));
|
|
@@ -2380,7 +2380,7 @@ var replaceInFile = (source, provider, credential) => gen(function* () {
|
|
|
2380
2380
|
});
|
|
2381
2381
|
var renewalPermits = new Map;
|
|
2382
2382
|
var oneRenewalAt = (source) => (effect) => {
|
|
2383
|
-
const permit = renewalPermits.get(source) ??
|
|
2383
|
+
const permit = renewalPermits.get(source) ?? makeUnsafe2(1);
|
|
2384
2384
|
renewalPermits.set(source, permit);
|
|
2385
2385
|
return permit.withPermits(1)(effect);
|
|
2386
2386
|
};
|
|
@@ -2414,7 +2414,7 @@ var filesUnder = (root) => gen(function* () {
|
|
|
2414
2414
|
if (skipped.has(entry))
|
|
2415
2415
|
continue;
|
|
2416
2416
|
const path = relative === "" ? entry : `${relative}/${entry}`;
|
|
2417
|
-
const type = yield* fs.stat(`${root}/${path}`).pipe(
|
|
2417
|
+
const type = yield* fs.stat(`${root}/${path}`).pipe(map7((info) => info.type), orElseSucceed(() => {
|
|
2418
2418
|
return;
|
|
2419
2419
|
}));
|
|
2420
2420
|
if (type === "Directory")
|
|
@@ -2430,7 +2430,7 @@ var dependenciesOf = (root, files) => gen(function* () {
|
|
|
2430
2430
|
const fs = yield* FileSystem;
|
|
2431
2431
|
const names = new Set;
|
|
2432
2432
|
for (const file of files.filter((path) => path === "package.json" || path.endsWith("/package.json"))) {
|
|
2433
|
-
const manifest = yield* fs.readFileString(`${root}/${file}`).pipe(
|
|
2433
|
+
const manifest = yield* fs.readFileString(`${root}/${file}`).pipe(map7((text) => decodeJsonStringSync(text)), orElseSucceed(() => {
|
|
2434
2434
|
return;
|
|
2435
2435
|
}));
|
|
2436
2436
|
if (!isJsonObject(manifest))
|
|
@@ -2602,7 +2602,7 @@ var credentialsIn = (source) => gen(function* () {
|
|
|
2602
2602
|
const credentials = getOrUndefined(decodeJsonStringOption(text));
|
|
2603
2603
|
return isJsonObject(credentials) ? credentials : undefined;
|
|
2604
2604
|
});
|
|
2605
|
-
var loginCredentials = (login) => login.format === "opencode" ?
|
|
2605
|
+
var loginCredentials = (login) => login.format === "opencode" ? map7(readOpenCodeLogin(login.binary, login.source), (read) => read?.credentials) : credentialsIn(login.source);
|
|
2606
2606
|
var neverExpires = 253402300799000;
|
|
2607
2607
|
var isOAuth = (credential) => isJsonObject(credential) && credential.type === "oauth";
|
|
2608
2608
|
var claudeOAuth = "claudeAiOauth";
|
|
@@ -2770,7 +2770,7 @@ var refreshOperatorLogin = (login, expired, http) => gen(function* () {
|
|
|
2770
2770
|
}
|
|
2771
2771
|
}
|
|
2772
2772
|
});
|
|
2773
|
-
var stepLogin = (login, reference) =>
|
|
2773
|
+
var stepLogin = (login, reference) => map7(loginCredentials(login), (credentials) => {
|
|
2774
2774
|
if (credentials === undefined)
|
|
2775
2775
|
return;
|
|
2776
2776
|
const format = loginFormats[login.format];
|
|
@@ -2789,8 +2789,8 @@ var renewableStepLogin = (login, referenced, http) => gen(function* () {
|
|
|
2789
2789
|
const expired = new Map;
|
|
2790
2790
|
let published;
|
|
2791
2791
|
let heldTokens;
|
|
2792
|
-
const writing =
|
|
2793
|
-
const refreshing =
|
|
2792
|
+
const writing = makeUnsafe2(1);
|
|
2793
|
+
const refreshing = makeUnsafe2(1);
|
|
2794
2794
|
const copy = gen(function* () {
|
|
2795
2795
|
const copied = yield* stepLogin(login, referenced?.reference);
|
|
2796
2796
|
if (copied === undefined)
|
|
@@ -2849,7 +2849,7 @@ var loginHostsWithProviders = (operatorFiles) => gen(function* () {
|
|
|
2849
2849
|
};
|
|
2850
2850
|
return { ...login, hosts };
|
|
2851
2851
|
});
|
|
2852
|
-
var carriedLoginHosts = (launch) => launch.renewedLogin?.format === "opencode" ?
|
|
2852
|
+
var carriedLoginHosts = (launch) => launch.renewedLogin?.format === "opencode" ? map7(loginCredentials(launch.renewedLogin), openCodeConsoleHosts) : succeed6([]);
|
|
2853
2853
|
var carriedProviderHosts = (launch) => gen(function* () {
|
|
2854
2854
|
const providers = launch.operatorFiles?.providers;
|
|
2855
2855
|
if (providers === undefined)
|
|
@@ -2990,7 +2990,7 @@ var writeHarnessFiles = (input) => gen(function* () {
|
|
|
2990
2990
|
yield* every(loginRenewalMillis, true);
|
|
2991
2991
|
if (renewed.format !== "opencode")
|
|
2992
2992
|
yield* every(loginCopyMillis, false);
|
|
2993
|
-
const watching =
|
|
2993
|
+
const watching = makeUnsafe4();
|
|
2994
2994
|
yield* forkScoped(fs.watch(path.dirname(renewed.source), { onReady: () => doneUnsafe(watching, void_3) }).pipe(filter((event) => path.basename(event.path) === path.basename(renewed.source)), runForEach(() => login.publish(false)), catch_((error) => logWarning("harness_login_not_watched", error)), ensuring2(succeed4(watching, undefined))));
|
|
2995
2995
|
yield* _await(watching);
|
|
2996
2996
|
});
|
|
@@ -2999,7 +2999,7 @@ var decodeSetupArchive = decodeEffect(fromJsonString(SetupArchive));
|
|
|
2999
2999
|
var runsOnHost = (command) => gen(function* () {
|
|
3000
3000
|
const fs = yield* FileSystem;
|
|
3001
3001
|
const path = yield* Path;
|
|
3002
|
-
const executable = (file) => fs.stat(file).pipe(
|
|
3002
|
+
const executable = (file) => fs.stat(file).pipe(map7((info) => info.type === "File" && (info.mode & 73) !== 0), orElseSucceed(() => false));
|
|
3003
3003
|
if (command.includes("/"))
|
|
3004
3004
|
return yield* executable(command);
|
|
3005
3005
|
for (const directory of ((yield* optionalEnv("PATH")) ?? "").split(":"))
|
|
@@ -3027,7 +3027,7 @@ var stepKitSetup = (agent, harness) => gen(function* () {
|
|
|
3027
3027
|
const fetch = agent.setupArchive;
|
|
3028
3028
|
if (fetch === undefined)
|
|
3029
3029
|
return unavailable("this Runner fetches no setup archives");
|
|
3030
|
-
const setups = yield* forEach(kits, (kit) => fetch(kit.setupDigest).pipe(flatMap3(decodeSetupArchive),
|
|
3030
|
+
const setups = yield* forEach(kits, (kit) => fetch(kit.setupDigest).pipe(flatMap3(decodeSetupArchive), map7((archive) => ({ name: kit.name, version: kit.version, archive })))).pipe(result);
|
|
3031
3031
|
if (isFailure(setups))
|
|
3032
3032
|
return unavailable(setups.failure.message);
|
|
3033
3033
|
const setup = materializeKitSetup(harness, [...setups.success, kitmanSkillEntry], agent.brief.listedSkills ?? []);
|
|
@@ -3057,11 +3057,11 @@ var Proto = {
|
|
|
3057
3057
|
};
|
|
3058
3058
|
}
|
|
3059
3059
|
};
|
|
3060
|
-
var make = (value) =>
|
|
3060
|
+
var make = (value) => map7(unbounded({
|
|
3061
3061
|
replay: 1
|
|
3062
3062
|
}), (pubsub) => {
|
|
3063
3063
|
const self = Object.create(Proto);
|
|
3064
|
-
self.semaphore =
|
|
3064
|
+
self.semaphore = makeUnsafe2(1);
|
|
3065
3065
|
self.value = value;
|
|
3066
3066
|
self.pubsub = pubsub;
|
|
3067
3067
|
publishUnsafe(self.pubsub, value);
|
|
@@ -3266,7 +3266,7 @@ class ContainerError extends TaggedError("ContainerError") {
|
|
|
3266
3266
|
class SecretProxyUnreachable extends TaggedError("SecretProxyUnreachable") {
|
|
3267
3267
|
}
|
|
3268
3268
|
var imagePull = { timeout: "30 minutes" };
|
|
3269
|
-
var dockerContainerRunner =
|
|
3269
|
+
var dockerContainerRunner = map7(ChildProcessSpawner, (spawner) => {
|
|
3270
3270
|
const docker = (args, options = {}) => runCommand2("docker", args, options).pipe(mapError2((error) => new ContainerError({ message: error.message })), provideService(ChildProcessSpawner, spawner));
|
|
3271
3271
|
const labelArgs = (labels) => labels.flatMap(([key, value]) => ["--label", `${key}=${value}`]);
|
|
3272
3272
|
const ids = (output) => output.split(`
|
|
@@ -3540,12 +3540,12 @@ var openSession = (file) => gen(function* () {
|
|
|
3540
3540
|
}
|
|
3541
3541
|
return { handle, size: Number(opened.size) };
|
|
3542
3542
|
});
|
|
3543
|
-
var readAt = (handle, position, length) =>
|
|
3543
|
+
var readAt = (handle, position, length) => map7(tryPromise(() => handle.read(new Uint8Array(length), 0, length, position)), ({ buffer, bytesRead }) => buffer.subarray(0, bytesRead));
|
|
3544
3544
|
var readSessionRange = (file, position, length) => gen(function* () {
|
|
3545
3545
|
const { handle, size } = yield* openSession(file);
|
|
3546
3546
|
return yield* readAt(handle, position, Math.max(0, Math.min(length, size - position)));
|
|
3547
3547
|
}).pipe(scoped);
|
|
3548
|
-
var sessionFileSize = (file) =>
|
|
3548
|
+
var sessionFileSize = (file) => map7(openSession(file), ({ size }) => size).pipe(scoped);
|
|
3549
3549
|
var maxSubagentFiles = 1024;
|
|
3550
3550
|
var sessionExtent = (file) => gen(function* () {
|
|
3551
3551
|
const fs = yield* FileSystem;
|
|
@@ -3553,7 +3553,7 @@ var sessionExtent = (file) => gen(function* () {
|
|
|
3553
3553
|
if (file.subagents === undefined)
|
|
3554
3554
|
return own;
|
|
3555
3555
|
const found = yield* sessionFiles(file.subagents, 0, file.confinedTo);
|
|
3556
|
-
const sizes = yield* forEach(found.slice(0, maxSubagentFiles), (path) => fs.stat(path).pipe(
|
|
3556
|
+
const sizes = yield* forEach(found.slice(0, maxSubagentFiles), (path) => fs.stat(path).pipe(map7((info) => Number(info.size)), orElseSucceed(() => 0)));
|
|
3557
3557
|
return sizes.reduce((total, size) => total + size, own);
|
|
3558
3558
|
});
|
|
3559
3559
|
var packConfined = (file, root) => gen(function* () {
|
|
@@ -3580,7 +3580,7 @@ var packConfined = (file, root) => gen(function* () {
|
|
|
3580
3580
|
}
|
|
3581
3581
|
return packed;
|
|
3582
3582
|
}).pipe(scoped);
|
|
3583
|
-
var packSession = (file) => file.confinedTo === undefined ? flatMap3(FileSystem, (fs) => fs.readFile(file.path)).pipe(flatMap3((content) => tryPromise(() => gzipped(content))),
|
|
3583
|
+
var packSession = (file) => file.confinedTo === undefined ? flatMap3(FileSystem, (fs) => fs.readFile(file.path)).pipe(flatMap3((content) => tryPromise(() => gzipped(content))), map7((content) => new Uint8Array(content))) : packConfined(file, file.confinedTo);
|
|
3584
3584
|
var restoreSession = (adapter, place) => gen(function* () {
|
|
3585
3585
|
const fs = yield* FileSystem;
|
|
3586
3586
|
const location = adapter.session?.location;
|
|
@@ -3699,16 +3699,16 @@ var stepProcessEnvironment = (runnerId, attemptId, outer = process.env) => ({
|
|
|
3699
3699
|
var lists = (value, id) => value.split(listSeparator).includes(id);
|
|
3700
3700
|
var signalProcess = (pid, signal) => ignore(try_2(() => process.kill(pid, signal)));
|
|
3701
3701
|
var signalled = (pid) => try_2(() => process.kill(pid, 0)).pipe(as(true), catch_((error) => succeed6(hasProperty(error.cause, "code") && error.cause.code === "EPERM")));
|
|
3702
|
-
var procCommand = (fs, pid) =>
|
|
3703
|
-
var procProcessTable =
|
|
3702
|
+
var procCommand = (fs, pid) => map7(fs.readFile(`/proc/${pid}/cmdline`).pipe(orElseSucceed(() => new Uint8Array)), commandLine);
|
|
3703
|
+
var procProcessTable = map7(FileSystem, (fs) => ({
|
|
3704
3704
|
marked: ({ name, value }) => gen(function* () {
|
|
3705
3705
|
const prefix = `${name}=`;
|
|
3706
3706
|
const pids = (yield* fs.readDirectory("/proc").pipe(orElseSucceed(() => []))).filter((pid) => /^\d+$/.test(pid));
|
|
3707
|
-
const found = yield* forEach(pids, (pid) => fs.readFile(`/proc/${pid}/environ`).pipe(flatMap3((environ) => environEntries(environ).some((entry) => entry.startsWith(prefix) && lists(entry.slice(prefix.length), value)) ?
|
|
3707
|
+
const found = yield* forEach(pids, (pid) => fs.readFile(`/proc/${pid}/environ`).pipe(flatMap3((environ) => environEntries(environ).some((entry) => entry.startsWith(prefix) && lists(entry.slice(prefix.length), value)) ? map7(procCommand(fs, Number(pid)), (command) => [{ pid: Number(pid), command }]) : succeed6([])), orElseSucceed(() => [])), { concurrency: 16 });
|
|
3708
3708
|
return found.flat();
|
|
3709
3709
|
}),
|
|
3710
3710
|
signal: signalProcess,
|
|
3711
|
-
alive: (pid) => fs.readFileString(`/proc/${pid}/stat`).pipe(
|
|
3711
|
+
alive: (pid) => fs.readFileString(`/proc/${pid}/stat`).pipe(map7((stat) => !/^[ZX]/.test(stat.slice(stat.lastIndexOf(")") + 2))), orElseSucceed(() => false))
|
|
3712
3712
|
}));
|
|
3713
3713
|
var environEntries = (environ) => new TextDecoder().decode(environ).split("\x00");
|
|
3714
3714
|
var commandLine = (cmdline) => new TextDecoder().decode(cmdline).split("\x00").filter((part) => part !== "").join(" ");
|
|
@@ -3717,10 +3717,10 @@ var psRows = (listed) => listed.split(`
|
|
|
3717
3717
|
const matched = /^\s*(\d+)\s+(.*)$/.exec(line);
|
|
3718
3718
|
return matched === null ? [] : [{ pid: Number(matched[1]), text: matched[2] ?? "" }];
|
|
3719
3719
|
});
|
|
3720
|
-
var psProcessTable =
|
|
3720
|
+
var psProcessTable = map7(ChildProcessSpawner, (spawner) => {
|
|
3721
3721
|
const ps = (args) => runCommand2("ps", [...args, "-ww", "-U", String(process.getuid?.() ?? ""), "-o", "pid=,command="], {
|
|
3722
3722
|
timeout: "30 seconds"
|
|
3723
|
-
}).pipe(provideService(ChildProcessSpawner, spawner),
|
|
3723
|
+
}).pipe(provideService(ChildProcessSpawner, spawner), map7(psRows));
|
|
3724
3724
|
return {
|
|
3725
3725
|
marked: ({ name, value }) => gen(function* () {
|
|
3726
3726
|
const entry = ` ${name}=`;
|
|
@@ -3746,7 +3746,7 @@ var psProcessTable = map8(ChildProcessSpawner, (spawner) => {
|
|
|
3746
3746
|
var systemProcessTable = process.platform === "linux" ? procProcessTable : psProcessTable;
|
|
3747
3747
|
var unitPart = (id) => id.replaceAll(/[^A-Za-z0-9-]/g, (char) => `_${char.charCodeAt(0).toString(16)}`);
|
|
3748
3748
|
var unitPrefix = (runnerId, attemptId) => `kitman-step-${unitPart(runnerId)}.${attemptId === undefined ? "" : `${unitPart(attemptId)}.`}`;
|
|
3749
|
-
var unitSuffix = SecureRandom.pipe(flatMap3((random) => random.uuidV4()),
|
|
3749
|
+
var unitSuffix = SecureRandom.pipe(flatMap3((random) => random.uuidV4()), map7((uuid) => uuid.slice(0, 8)), provide3(layerWebCrypto));
|
|
3750
3750
|
var busVariables = ["XDG_RUNTIME_DIR", "DBUS_SESSION_BUS_ADDRESS"];
|
|
3751
3751
|
var systemdScopes = gen(function* () {
|
|
3752
3752
|
if (process.platform !== "linux")
|
|
@@ -3766,7 +3766,7 @@ var systemdScopes = gen(function* () {
|
|
|
3766
3766
|
`).filter((pid) => /^\d+$/.test(pid))).map(Number);
|
|
3767
3767
|
});
|
|
3768
3768
|
return {
|
|
3769
|
-
contain: (runnerId, attemptId, argv) =>
|
|
3769
|
+
contain: (runnerId, attemptId, argv) => map7(unitSuffix, (suffix) => {
|
|
3770
3770
|
const unit = `${unitPrefix(runnerId, attemptId)}${suffix}.scope`;
|
|
3771
3771
|
const scoped = [
|
|
3772
3772
|
"systemd-run",
|
|
@@ -3793,7 +3793,7 @@ var systemdScopes = gen(function* () {
|
|
|
3793
3793
|
])).split(`
|
|
3794
3794
|
`).flatMap((line) => line.trim().split(/\s+/)[0] ?? []).filter((unit) => unit.endsWith(".scope"));
|
|
3795
3795
|
const pids = yield* forEach(units, (unit) => flatMap3(systemd("systemctl", ["--user", "show", "--property=ControlGroup", "--value", unit]), (cgroup) => cgroup.trim() === "" ? succeed6([]) : cgroupProcesses(cgroup.trim())));
|
|
3796
|
-
return yield* forEach([...new Set(pids.flat())], (pid) =>
|
|
3796
|
+
return yield* forEach([...new Set(pids.flat())], (pid) => map7(procCommand(fs, pid), (command) => ({ pid, command })));
|
|
3797
3797
|
}).pipe(orElseSucceed(() => []))
|
|
3798
3798
|
};
|
|
3799
3799
|
});
|
|
@@ -3803,7 +3803,7 @@ var makeStepProcesses = (table, options = {}) => {
|
|
|
3803
3803
|
const { scopes } = options;
|
|
3804
3804
|
const unreaped = new Map;
|
|
3805
3805
|
const pollMs = options.pollMs ?? 50;
|
|
3806
|
-
const finding = (marker, scoped) =>
|
|
3806
|
+
const finding = (marker, scoped) => map7(all3([table.marked(marker), scoped]), ([marked, inScopes]) => {
|
|
3807
3807
|
const found = new Map([...marked, ...inScopes].map((candidate) => [candidate.pid, candidate]));
|
|
3808
3808
|
found.delete(process.pid);
|
|
3809
3809
|
return [...found.values()];
|
|
@@ -3891,7 +3891,7 @@ var stepProcessesUncontained = (input) => {
|
|
|
3891
3891
|
|
|
3892
3892
|
class StepProcesses extends Service2()("StepProcesses") {
|
|
3893
3893
|
}
|
|
3894
|
-
var stepProcessesLayer = effect(StepProcesses,
|
|
3894
|
+
var stepProcessesLayer = effect(StepProcesses, map7(systemProcessTable, (table) => makeStepProcesses(table)));
|
|
3895
3895
|
var systemStepProcessesLayer = effect(StepProcesses, gen(function* () {
|
|
3896
3896
|
const table = yield* systemProcessTable;
|
|
3897
3897
|
return makeStepProcesses(table, { scopes: yield* systemdScopes });
|
|
@@ -4189,7 +4189,7 @@ var runAttempt = (request, options) => gen(function* () {
|
|
|
4189
4189
|
env: {},
|
|
4190
4190
|
command: ["sh", "-c", 'p=$(command -v -- "$1") && [ -f "$p" ] && [ -x "$p" ]', "sh", command],
|
|
4191
4191
|
timeout: "30 seconds"
|
|
4192
|
-
}).pipe(
|
|
4192
|
+
}).pipe(map7((result) => result.exitCode === 0), mapError2(() => unavailable)));
|
|
4193
4193
|
const env = { ...policy.environment, ...marker };
|
|
4194
4194
|
return { argv: dockerExecArgv({ container, workspace, env, argv: harnessArgv }), env, registry };
|
|
4195
4195
|
}
|
|
@@ -4280,7 +4280,7 @@ var runAttempt = (request, options) => gen(function* () {
|
|
|
4280
4280
|
const brief = firstMessage(request.launch, workspace, launch.systemBrief === true);
|
|
4281
4281
|
const readyTurn = ready.value.turn;
|
|
4282
4282
|
const deliver = (tries) => gen(function* () {
|
|
4283
|
-
const sent = yield* result(call((connection) =>
|
|
4283
|
+
const sent = yield* result(call((connection) => map7(connection.send(address, brief), (reply) => ({ turn: reply.turn, lost: false })), () => succeed6({ turn: readyTurn, lost: true })));
|
|
4284
4284
|
if (isFailure(sent) || sent.success.lost || tries <= 1)
|
|
4285
4285
|
return sent;
|
|
4286
4286
|
const taken = yield* until(seen, stirredSince(sent.success.turn)).pipe(timeoutOption(options.briefAckMs));
|
|
@@ -4363,7 +4363,7 @@ var herdrCoreAgentBackendLayer = (options) => effect(AgentBackend, gen(function*
|
|
|
4363
4363
|
});
|
|
4364
4364
|
}));
|
|
4365
4365
|
// packages/agent-runtime/src/sandbox-host.ts
|
|
4366
|
-
var installed = (probe, command, label) =>
|
|
4366
|
+
var installed = (probe, command, label) => map7(probe("sh", ["-c", `command -v ${command}`]), (found) => found ? [] : [`${label} is not installed`]);
|
|
4367
4367
|
var srtMissing = (probe, platform) => gen(function* () {
|
|
4368
4368
|
if (platform === "darwin")
|
|
4369
4369
|
return [
|
|
@@ -4385,7 +4385,7 @@ var srtMissing = (probe, platform) => gen(function* () {
|
|
|
4385
4385
|
"unprivileged user namespaces are not allowed (on Ubuntu: sysctl kernel.apparmor_restrict_unprivileged_userns=0)"
|
|
4386
4386
|
];
|
|
4387
4387
|
});
|
|
4388
|
-
var dockerMissing = (probe, image) =>
|
|
4388
|
+
var dockerMissing = (probe, image) => map7(probe("docker", ["info"]), (reachable) => [
|
|
4389
4389
|
...reachable ? [] : ["the docker daemon is not reachable"],
|
|
4390
4390
|
...image === undefined ? ["KITMAN_RUNNER_DOCKER_IMAGE is not set"] : /@sha256:[a-f0-9]{64}$/.test(image) ? [] : ["KITMAN_RUNNER_DOCKER_IMAGE is not pinned by digest (image@sha256:...)"]
|
|
4391
4391
|
]);
|
|
@@ -4404,7 +4404,7 @@ var probeSandboxHost = (probe, platform = process.platform, options = {}) => gen
|
|
|
4404
4404
|
]
|
|
4405
4405
|
};
|
|
4406
4406
|
});
|
|
4407
|
-
var commandHostProbe =
|
|
4407
|
+
var commandHostProbe = map7(ChildProcessSpawner, (spawner) => (command, args) => runCommand2(command, args, { timeout: "10 seconds" }).pipe(as(true), orElseSucceed(() => false), provideService(ChildProcessSpawner, spawner)));
|
|
4408
4408
|
// packages/oversight/src/domain/intent.ts
|
|
4409
4409
|
var ConstraintKind = Literals(["rule", "semantic"]);
|
|
4410
4410
|
var ConstraintSeverity = Literals(["block", "warn"]);
|
|
@@ -4581,14 +4581,14 @@ var diffFlags = ["--no-color", "--no-ext-diff", "--no-textconv", "--no-renames",
|
|
|
4581
4581
|
var catchUpReport = (worktree, input) => gen(function* () {
|
|
4582
4582
|
const git = (...args) => runCommand2("git", ["-C", worktree, ...args]);
|
|
4583
4583
|
const target = `origin/${input.target}`;
|
|
4584
|
-
const names = (from, to) =>
|
|
4585
|
-
const ownDiff = (base, head, path) =>
|
|
4584
|
+
const names = (from, to) => map7(git("diff", "--name-only", "-z", "--no-renames", from, to), (out) => out.split("\x00").filter(Boolean));
|
|
4585
|
+
const ownDiff = (base, head, path) => map7(git("diff", ...diffFlags, base, head, "--", `:(literal,top)${path}`), normalizedDiff);
|
|
4586
4586
|
const before = (yield* git("merge-base", input.from, target)).trim();
|
|
4587
4587
|
const after = (yield* git("merge-base", input.head, target)).trim();
|
|
4588
4588
|
const settled = input.automerged === undefined ? [] : (yield* names(input.automerged, input.merged)).filter((path) => !input.conflicted.includes(path));
|
|
4589
4589
|
const rewritten = [...new Set([...settled, ...yield* names(input.merged, input.head)])].sort();
|
|
4590
4590
|
const paths = [...new Set([...yield* names(before, input.from), ...yield* names(after, input.head)])].sort();
|
|
4591
|
-
const changed = yield* filter3(paths.slice(0, catchUpPathLimit), (path) =>
|
|
4591
|
+
const changed = yield* filter3(paths.slice(0, catchUpPathLimit), (path) => map7(all3([ownDiff(before, input.from, path), ownDiff(after, input.head, path)]), ([was, is]) => was !== is), { concurrency: 8 });
|
|
4592
4592
|
const lists = [input.conflicted, rewritten, paths];
|
|
4593
4593
|
return {
|
|
4594
4594
|
from: input.from,
|
|
@@ -4757,7 +4757,7 @@ var failedWhenUnrun = (label) => (execution) => {
|
|
|
4757
4757
|
};
|
|
4758
4758
|
var makeReplicaSignals = sync2(() => {
|
|
4759
4759
|
let generation = 0;
|
|
4760
|
-
let nextWork =
|
|
4760
|
+
let nextWork = makeUnsafe4();
|
|
4761
4761
|
const stops = new Map;
|
|
4762
4762
|
const mailboxes = new Map;
|
|
4763
4763
|
const mailboxFor = (workUnitId) => {
|
|
@@ -4767,8 +4767,8 @@ var makeReplicaSignals = sync2(() => {
|
|
|
4767
4767
|
const created = {
|
|
4768
4768
|
notes: [],
|
|
4769
4769
|
seen: new Set,
|
|
4770
|
-
arrived:
|
|
4771
|
-
updated:
|
|
4770
|
+
arrived: makeUnsafe4(),
|
|
4771
|
+
updated: makeUnsafe4()
|
|
4772
4772
|
};
|
|
4773
4773
|
mailboxes.set(workUnitId, created);
|
|
4774
4774
|
return created;
|
|
@@ -4779,14 +4779,14 @@ var makeReplicaSignals = sync2(() => {
|
|
|
4779
4779
|
if (note !== undefined)
|
|
4780
4780
|
return succeed6(note);
|
|
4781
4781
|
if (isDoneUnsafe(mailbox.arrived))
|
|
4782
|
-
mailbox.arrived =
|
|
4782
|
+
mailbox.arrived = makeUnsafe4();
|
|
4783
4783
|
return andThen2(_await(mailbox.arrived), nextSteer(workUnitId));
|
|
4784
4784
|
});
|
|
4785
4785
|
const stopFor = (workUnitId) => {
|
|
4786
4786
|
const existing = stops.get(workUnitId);
|
|
4787
4787
|
if (existing !== undefined)
|
|
4788
4788
|
return existing;
|
|
4789
|
-
const created =
|
|
4789
|
+
const created = makeUnsafe4();
|
|
4790
4790
|
stops.set(workUnitId, created);
|
|
4791
4791
|
return created;
|
|
4792
4792
|
};
|
|
@@ -4798,7 +4798,7 @@ var makeReplicaSignals = sync2(() => {
|
|
|
4798
4798
|
WorkAvailable: () => {
|
|
4799
4799
|
generation += 1;
|
|
4800
4800
|
const signalled = nextWork;
|
|
4801
|
-
nextWork =
|
|
4801
|
+
nextWork = makeUnsafe4();
|
|
4802
4802
|
doneUnsafe(signalled, void_2);
|
|
4803
4803
|
},
|
|
4804
4804
|
LeaseRevoked: ({ workUnitId }) => stop(workUnitId, "lost"),
|
|
@@ -4831,7 +4831,7 @@ var makeReplicaSignals = sync2(() => {
|
|
|
4831
4831
|
sessionUpdated: (workUnitId) => suspend3(() => {
|
|
4832
4832
|
const mailbox = mailboxFor(workUnitId);
|
|
4833
4833
|
return andThen2(_await(mailbox.updated), sync2(() => {
|
|
4834
|
-
mailbox.updated =
|
|
4834
|
+
mailbox.updated = makeUnsafe4();
|
|
4835
4835
|
}));
|
|
4836
4836
|
}),
|
|
4837
4837
|
forget: (workUnitId) => sync2(() => {
|
|
@@ -4900,7 +4900,7 @@ var IdleRecheck = seconds(60);
|
|
|
4900
4900
|
var idleBackoff = (idleIterations) => millis(Math.min(1000 * 2 ** idleIterations, 30000));
|
|
4901
4901
|
function superviseReplica(input) {
|
|
4902
4902
|
const { signals } = input;
|
|
4903
|
-
const claimTurn =
|
|
4903
|
+
const claimTurn = makeUnsafe2(1);
|
|
4904
4904
|
let emptyAt = -1;
|
|
4905
4905
|
const wokenControl = (control, signals) => ({
|
|
4906
4906
|
...control,
|
|
@@ -5386,7 +5386,7 @@ var transcriptRelay = (input) => {
|
|
|
5386
5386
|
passOver(last);
|
|
5387
5387
|
batchLimit = batchSize;
|
|
5388
5388
|
};
|
|
5389
|
-
const givesUp = (error, lastChance) =>
|
|
5389
|
+
const givesUp = (error, lastChance) => map7(currentTimeMillis, (now) => {
|
|
5390
5390
|
if (lastChance || sendRefusal(error) === "refused")
|
|
5391
5391
|
return true;
|
|
5392
5392
|
failingSince ??= now;
|
|
@@ -5556,7 +5556,7 @@ var transcriptRelay = (input) => {
|
|
|
5556
5556
|
});
|
|
5557
5557
|
return {
|
|
5558
5558
|
record,
|
|
5559
|
-
stalledFor: (millis) =>
|
|
5559
|
+
stalledFor: (millis) => map7(currentTimeMillis, (now) => asking.size === 0 && progressAt !== undefined && now - progressAt >= millis),
|
|
5560
5560
|
asking: sync2(() => asking.size > 0),
|
|
5561
5561
|
loginLost: sync2(() => loginLost),
|
|
5562
5562
|
refusal: sync2(() => refusal),
|
|
@@ -5636,7 +5636,7 @@ var gitRemote = (repoBinding, credential) => {
|
|
|
5636
5636
|
};
|
|
5637
5637
|
var clonePermits = new Map;
|
|
5638
5638
|
var inClone = (directory) => (effect) => {
|
|
5639
|
-
const permit = clonePermits.get(directory) ??
|
|
5639
|
+
const permit = clonePermits.get(directory) ?? makeUnsafe2(1);
|
|
5640
5640
|
clonePermits.set(directory, permit);
|
|
5641
5641
|
return permit.withPermits(1)(effect);
|
|
5642
5642
|
};
|
|
@@ -5644,7 +5644,7 @@ var repositoryClone = (rootDir, repoBindingId) => `${rootDir}/repos/${repoBindin
|
|
|
5644
5644
|
var runCheckouts = (rootDir, credentials) => {
|
|
5645
5645
|
const runsDir = `${rootDir}/runs`;
|
|
5646
5646
|
const reposDir = `${rootDir}/repos`;
|
|
5647
|
-
const remote = (repoBinding) =>
|
|
5647
|
+
const remote = (repoBinding) => map7(credentials === undefined ? undefined_ : credentials(repoBinding.id).pipe(catch_((error) => as(logWarning("runner_git_credential_unavailable", error.message), undefined))), (credential) => gitRemote(repoBinding, credential));
|
|
5648
5648
|
const cloned = (repoBinding) => gen(function* () {
|
|
5649
5649
|
const fs = yield* FileSystem;
|
|
5650
5650
|
const forbidden = findForbiddenRepoBindingSecretPath(repoBinding);
|
|
@@ -5671,9 +5671,9 @@ var runCheckouts = (rootDir, credentials) => {
|
|
|
5671
5671
|
});
|
|
5672
5672
|
const fetch = (directory, env) => runCommand2("git", ["-C", directory, ...stallLimit, "fetch", "--prune", "origin"], { ...transfer, env });
|
|
5673
5673
|
const inCloneOf = (repoBinding) => inClone(repositoryClone(rootDir, repoBinding.id));
|
|
5674
|
-
const clone = (repoBinding) => inCloneOf(repoBinding)(
|
|
5675
|
-
const transferEnv = (repoBinding) => repoBinding === undefined ? succeed6({}) :
|
|
5676
|
-
const holds = (directory, revision) => revision === undefined || !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(revision) ? succeed6(false) :
|
|
5674
|
+
const clone = (repoBinding) => inCloneOf(repoBinding)(map7(cloned(repoBinding), ({ directory }) => directory));
|
|
5675
|
+
const transferEnv = (repoBinding) => repoBinding === undefined ? succeed6({}) : map7(remote(repoBinding), ({ env }) => env);
|
|
5676
|
+
const holds = (directory, revision) => revision === undefined || !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(revision) ? succeed6(false) : map7(exit(runCommand2("git", ["-C", directory, "cat-file", "-e", `${revision}^{commit}`])), isSuccess2);
|
|
5677
5677
|
const checkout = (work, repoBinding, checkpoint) => gen(function* () {
|
|
5678
5678
|
const fs = yield* FileSystem;
|
|
5679
5679
|
const path = yield* Path;
|
|
@@ -5782,7 +5782,7 @@ var runChange = (worktree, runBase) => gen(function* () {
|
|
|
5782
5782
|
const git = (...args) => runCommand2("git", ["-C", worktree, ...args]);
|
|
5783
5783
|
const base = (yield* git("merge-base", "HEAD", runBase)).trim();
|
|
5784
5784
|
const changedPaths = (yield* git("diff", "--name-only", "-z", "--no-renames", base, "HEAD")).split("\x00").filter((path) => path !== "");
|
|
5785
|
-
const files = yield* forEach(changedPaths.slice(0, EvidenceLimits.files).filter((path) => !looksSecret(path)), (path) =>
|
|
5785
|
+
const files = yield* forEach(changedPaths.slice(0, EvidenceLimits.files).filter((path) => !looksSecret(path)), (path) => map7(git("diff", "--no-color", "--no-renames", base, "HEAD", "--", `:(literal)${path}`), (diff) => ({
|
|
5786
5786
|
path,
|
|
5787
5787
|
diff
|
|
5788
5788
|
})));
|
|
@@ -5801,7 +5801,7 @@ var keepSession = (rpc, lease, content) => gen(function* () {
|
|
|
5801
5801
|
yield* fs.writeFile(path, content);
|
|
5802
5802
|
const files = {
|
|
5803
5803
|
createRunFile: ({ byteSize, sha256 }) => rpc.createCheckpointFile({ lease, byteSize, sha256 }),
|
|
5804
|
-
runFileParts: (request) =>
|
|
5804
|
+
runFileParts: (request) => map7(rpc.checkpointFileParts({ lease, ...request, partNumbers: [...request.partNumbers] }), ({ parts }) => parts),
|
|
5805
5805
|
completeRunFile: ({ parts, ...request }) => rpc.completeCheckpointFile({ lease, ...request, ...parts === undefined ? undefined : { parts: [...parts] } })
|
|
5806
5806
|
};
|
|
5807
5807
|
const kept = yield* uploadRunFile(files, { step: "", name: "session.gz", path });
|
|
@@ -5849,7 +5849,7 @@ var stageAll = (worktree, git) => gen(function* () {
|
|
|
5849
5849
|
yield* git("add", "--all", "--", ".", ...leftovers.map((name) => `:(exclude,top)${name}`));
|
|
5850
5850
|
});
|
|
5851
5851
|
var conflictMarker = "^(<<<<<<<|>>>>>>>)( |$)";
|
|
5852
|
-
var markedPaths = (git, paths, ...from) => git("grep", ...from, "-l", "-z", "-E", conflictMarker, "--", ...paths.map((path) => `:(literal,top)${path}`)).pipe(catchIf((error) => error.reason === "exit code 1", () => succeed6("")),
|
|
5852
|
+
var markedPaths = (git, paths, ...from) => git("grep", ...from, "-l", "-z", "-E", conflictMarker, "--", ...paths.map((path) => `:(literal,top)${path}`)).pipe(catchIf((error) => error.reason === "exit code 1", () => succeed6("")), map7((out) => out.split("\x00").filter(Boolean)));
|
|
5853
5853
|
var list = (paths) => paths.join(", ");
|
|
5854
5854
|
var unmarkedConflicts = (worktree, conflicted, marked) => gen(function* () {
|
|
5855
5855
|
const stages = new Map;
|
|
@@ -5886,7 +5886,7 @@ var automergedTree = (worktree, conflicted) => gen(function* () {
|
|
|
5886
5886
|
const scratchIndex = `${index}.kitman-automerged`;
|
|
5887
5887
|
const git = (...args) => runCommand2("git", ["-C", worktree, ...args], { env: { GIT_INDEX_FILE: scratchIndex } });
|
|
5888
5888
|
yield* fs.copyFile(index, scratchIndex);
|
|
5889
|
-
return yield* ensuring2(andThen2(git("update-index", "--force-remove", "--", ...conflicted),
|
|
5889
|
+
return yield* ensuring2(andThen2(git("update-index", "--force-remove", "--", ...conflicted), map7(git("write-tree"), (tree) => tree.trim())), ignore(fs.remove(scratchIndex)));
|
|
5890
5890
|
});
|
|
5891
5891
|
var mergeTarget = (worktree, target) => gen(function* () {
|
|
5892
5892
|
const git = (...args) => runCommand2("git", ["-C", worktree, ...gitIdentity, ...args]);
|
|
@@ -6002,7 +6002,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6002
6002
|
};
|
|
6003
6003
|
const sessionId = transcript !== undefined || adapter?.session?.start !== undefined ? session.id : undefined;
|
|
6004
6004
|
let last = saved?.ref === checkpointRef(work) ? saved : {};
|
|
6005
|
-
const checkpointTurn =
|
|
6005
|
+
const checkpointTurn = makeUnsafe2(1);
|
|
6006
6006
|
const takeCheckpoint = gen(function* () {
|
|
6007
6007
|
if (input.checkpoints === undefined)
|
|
6008
6008
|
return;
|
|
@@ -6092,7 +6092,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6092
6092
|
...refusal.until === undefined ? undefined : { until: refusal.until },
|
|
6093
6093
|
...backend === "docker" ? { scope: "step" } : undefined
|
|
6094
6094
|
});
|
|
6095
|
-
const outputSubmitted = input.heartbeat(work).pipe(option2,
|
|
6095
|
+
const outputSubmitted = input.heartbeat(work).pipe(option2, map7((state) => isSome(state) && state.value.outputSubmitted === true));
|
|
6096
6096
|
const providerRefused = relay === undefined ? never : gen(function* () {
|
|
6097
6097
|
for (;; ) {
|
|
6098
6098
|
yield* sleep("1 second");
|
|
@@ -6141,7 +6141,7 @@ var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
|
6141
6141
|
const state = isSuccess2(exit) ? exit.value.status : hasInterrupts(exit) ? "canceled" : "failed";
|
|
6142
6142
|
yield* relayed.pipe(timeout("5 seconds"), ignore);
|
|
6143
6143
|
yield* andThen2(relay.record([{ kind: "lifecycle", state }]), relay.lastFlush).pipe(timeout("5 seconds"), ignore);
|
|
6144
|
-
const sending = yield* forkIn(relay.sendRest, input.runnerScope ??
|
|
6144
|
+
const sending = yield* forkIn(relay.sendRest, input.runnerScope ?? makeUnsafe5());
|
|
6145
6145
|
resending.set(work.id, sending);
|
|
6146
6146
|
if (state !== "parked")
|
|
6147
6147
|
sending.addObserver(() => resending.delete(work.id));
|
|
@@ -6798,7 +6798,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
6798
6798
|
return {
|
|
6799
6799
|
request: (method, params) => gen(function* () {
|
|
6800
6800
|
const id = ++lastId;
|
|
6801
|
-
const deferred = yield*
|
|
6801
|
+
const deferred = yield* make15();
|
|
6802
6802
|
pending.set(id, deferred);
|
|
6803
6803
|
yield* send({ id, method, params });
|
|
6804
6804
|
return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
|
|
@@ -6899,7 +6899,7 @@ function composeAgentEnvironmentSyncPlan(targets) {
|
|
|
6899
6899
|
}
|
|
6900
6900
|
var updateHarness = (argv) => gen(function* () {
|
|
6901
6901
|
const run = yield* CommandRunner2;
|
|
6902
|
-
const failure = yield* run(argv).pipe(
|
|
6902
|
+
const failure = yield* run(argv).pipe(map7((result) => result.exitCode === 0 ? undefined : result.output.trim().split(`
|
|
6903
6903
|
`).at(-1) ?? `exit code ${result.exitCode}`), catch_((error) => succeed6(error.message)));
|
|
6904
6904
|
return failure === undefined ? [] : [`Kitman could not update ${argv[0]} with \`${argv.join(" ")}\`: ${failure}`];
|
|
6905
6905
|
});
|
|
@@ -6912,10 +6912,10 @@ var applyAgentEnvironmentPlans = fnUntraced(function* (plan) {
|
|
|
6912
6912
|
const updateWarnings = yield* forEach(plan.targets, (target) => target.harnessUpdater === undefined ? succeed6([]) : updateHarness(target.harnessUpdater));
|
|
6913
6913
|
for (const target of plan.targets)
|
|
6914
6914
|
yield* applyAgentEnvironmentConfigSync(target.harnessConfig).pipe(mapError2((cause) => new AgentEnvironmentPlanApplyError({ phase: "harness_config", cause })));
|
|
6915
|
-
const targets = yield* forEach(plan.targets, (target, index) =>
|
|
6915
|
+
const targets = yield* forEach(plan.targets, (target, index) => map7(target.skills.codexHookTrust === undefined ? succeed6([]) : trustCodexPluginHooks({
|
|
6916
6916
|
...target.skills.codexHookTrust,
|
|
6917
6917
|
plugins: target.skills.materializedPlugins.map((plugin) => plugin.name)
|
|
6918
|
-
}), (trustWarnings) => [...updateWarnings[index] ?? [], ...trustWarnings]).pipe(
|
|
6918
|
+
}), (trustWarnings) => [...updateWarnings[index] ?? [], ...trustWarnings]).pipe(map7((warnings) => ({
|
|
6919
6919
|
...target,
|
|
6920
6920
|
skills: { ...target.skills, warnings: [...target.skills.warnings, ...warnings.map((message) => ({ message }))] },
|
|
6921
6921
|
warnings: [...target.warnings, ...warnings]
|
|
@@ -6941,7 +6941,7 @@ var kitmanMcpPreflight = (mcp) => gen(function* () {
|
|
|
6941
6941
|
const server = yield* spawner.spawn(make3(mcp.command, [...mcp.args], {
|
|
6942
6942
|
extendEnv: true,
|
|
6943
6943
|
env: mcp.env,
|
|
6944
|
-
stdin: { stream:
|
|
6944
|
+
stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
|
|
6945
6945
|
stderr: "ignore"
|
|
6946
6946
|
}));
|
|
6947
6947
|
const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
|
|
@@ -7003,7 +7003,7 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
|
|
|
7003
7003
|
storageOrigin: work.storageOrigin,
|
|
7004
7004
|
network: work.network
|
|
7005
7005
|
});
|
|
7006
|
-
const inherited = (yield* forEach(inheritedEnv, (name) =>
|
|
7006
|
+
const inherited = (yield* forEach(inheritedEnv, (name) => map7(optionalEnv(name), (value) => value === undefined ? [] : [[name, value]]))).flat();
|
|
7007
7007
|
const programEnv = {
|
|
7008
7008
|
BUN_BE_BUN: "1",
|
|
7009
7009
|
KITMAN_LOOP_ID: program.loopId,
|
|
@@ -7015,7 +7015,7 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
|
|
|
7015
7015
|
const exitCode = sandbox === undefined ? yield* gen(function* () {
|
|
7016
7016
|
const spawner = yield* ChildProcessSpawner;
|
|
7017
7017
|
const handle = yield* spawner.spawn(make3(input.bun ?? process.execPath, [file], {
|
|
7018
|
-
stdin:
|
|
7018
|
+
stdin: make10(new TextEncoder().encode(stdin)),
|
|
7019
7019
|
stdout: "inherit",
|
|
7020
7020
|
stderr: "inherit",
|
|
7021
7021
|
extendEnv: false,
|
|
@@ -7291,7 +7291,7 @@ var redactedCopy = (from, to) => gen(function* () {
|
|
|
7291
7291
|
var checkFileKeeper = (work, runFiles, storage) => {
|
|
7292
7292
|
const files = rpcRunFiles(runFiles, programLease(work));
|
|
7293
7293
|
let left = checkFilesPerVerification;
|
|
7294
|
-
const keep = (name, path) => uploadRunFile(files, { step: work.stepKey, name, path }).pipe(provideService(HttpClient, storage),
|
|
7294
|
+
const keep = (name, path) => uploadRunFile(files, { step: work.stepKey, name, path }).pipe(provideService(HttpClient, storage), map7((file) => file.status === "available" ? [file.id] : []), catch_((error) => as(logWarning("check_run_file_not_kept", `${name}: ${error.message}`), [])));
|
|
7295
7295
|
return (input) => gen(function* () {
|
|
7296
7296
|
const path = yield* Path;
|
|
7297
7297
|
const log = `${input.output}.log`;
|
|
@@ -7306,7 +7306,7 @@ var reportedTests = (filesDir) => gen(function* () {
|
|
|
7306
7306
|
const fs = yield* FileSystem;
|
|
7307
7307
|
const path = yield* Path;
|
|
7308
7308
|
const names = (yield* regularFiles(filesDir)).filter(isTestReportName);
|
|
7309
|
-
const reports = yield* forEach(names, (name) => fs.readFileString(path.join(filesDir, name)).pipe(
|
|
7309
|
+
const reports = yield* forEach(names, (name) => fs.readFileString(path.join(filesDir, name)).pipe(map7((text) => [text]), orElseSucceed(() => [])));
|
|
7310
7310
|
return checkTests(reports.flat());
|
|
7311
7311
|
}).pipe(orElseSucceed(() => checkTests([])));
|
|
7312
7312
|
|
|
@@ -7449,7 +7449,7 @@ var unresolvedDependencies = (worktree) => gen(function* () {
|
|
|
7449
7449
|
}).pipe(orElseSucceed(() => {
|
|
7450
7450
|
return;
|
|
7451
7451
|
}));
|
|
7452
|
-
const manifestAt = (dir) => fs.readFileString(path.join(dir, "package.json")).pipe(
|
|
7452
|
+
const manifestAt = (dir) => fs.readFileString(path.join(dir, "package.json")).pipe(map7((text) => getOrUndefined(decodeJsonStringOption(text))), orElseSucceed(() => {
|
|
7453
7453
|
return;
|
|
7454
7454
|
}));
|
|
7455
7455
|
const unresolved = [];
|
|
@@ -7676,7 +7676,7 @@ var resolveRevisions = (work, revisions, checkouts) => gen(function* () {
|
|
|
7676
7676
|
};
|
|
7677
7677
|
return resolved;
|
|
7678
7678
|
});
|
|
7679
|
-
var treeOf = (worktree) =>
|
|
7679
|
+
var treeOf = (worktree) => map7(runCommand2("git", ["-C", worktree, "rev-parse", "HEAD^{tree}"]), (tree) => tree.trim());
|
|
7680
7680
|
var verificationExecutor = (input) => (work) => gen(function* () {
|
|
7681
7681
|
if (input.sandbox !== undefined && input.sandbox.backend === undefined)
|
|
7682
7682
|
return {
|