@kitman-sh/cli 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-js64y97w.js → chunk-2sazk478.js} +4 -4
- package/dist/{chunk-msn6rrx9.js → chunk-38drrdzp.js} +4 -4
- package/dist/{chunk-cehbrs1y.js → chunk-5qrjf4xq.js} +5 -5
- package/dist/{chunk-samxkpbz.js → chunk-9a6wbk11.js} +3 -3
- package/dist/{chunk-sw0dadq5.js → chunk-9vqkjkya.js} +1 -1
- package/dist/{chunk-yr7np5eb.js → chunk-9yvknsnj.js} +3 -3
- package/dist/{chunk-39kjyh2y.js → chunk-emw9ragp.js} +21 -21
- package/dist/{chunk-d4h1p51s.js → chunk-fjdp3rd6.js} +24 -24
- package/dist/{chunk-my92qn4x.js → chunk-kx8rpa62.js} +10 -10
- package/dist/{chunk-5kqt4bqp.js → chunk-m1qp6swh.js} +1 -1
- package/dist/{chunk-3xg9zbmy.js → chunk-njgay1ed.js} +9 -9
- package/dist/{chunk-chxtmsns.js → chunk-nk0ew12p.js} +152 -109
- package/dist/{chunk-7j1kf6sa.js → chunk-nndgeync.js} +6 -6
- package/dist/{chunk-tsx0347c.js → chunk-pd3azxev.js} +1 -1
- package/dist/{chunk-wtea9nbk.js → chunk-qb11yda6.js} +24 -24
- package/dist/{chunk-bv4gcq1h.js → chunk-qbrkeg49.js} +7 -7
- package/dist/{chunk-1j38xtvp.js → chunk-qjxgew0k.js} +2 -2
- package/dist/{chunk-4qjfn1sa.js → chunk-r2kzvdrg.js} +1 -1
- package/dist/{chunk-yaa3gkpx.js → chunk-s4r49vbj.js} +9 -9
- package/dist/{chunk-gap0vmj7.js → chunk-vh2a72d1.js} +14 -60
- package/dist/{chunk-r7m32p2j.js → chunk-vwynec02.js} +1 -1
- package/dist/{chunk-0mg7k9b4.js → chunk-xxcxramy.js} +117 -118
- package/dist/{chunk-h2f26xbd.js → chunk-y64ssczv.js} +226 -40
- package/dist/{chunk-tbmht2qb.js → chunk-yjc2w86k.js} +10 -10
- package/dist/{chunk-63cyj9dh.js → chunk-z59pvcbk.js} +31 -174
- package/dist/{chunk-vz38kngm.js → chunk-zy21drtv.js} +2 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
isFailure2,
|
|
44
44
|
hasInterrupts,
|
|
45
45
|
makeUnsafe5,
|
|
46
|
-
|
|
46
|
+
make15,
|
|
47
47
|
_await,
|
|
48
48
|
fail5,
|
|
49
49
|
isDoneUnsafe,
|
|
@@ -172,53 +172,7 @@ import {
|
|
|
172
172
|
decodeJsonStringSync,
|
|
173
173
|
encodeUnknownJsonStringSync,
|
|
174
174
|
storable
|
|
175
|
-
} from "./chunk-
|
|
176
|
-
import {
|
|
177
|
-
join,
|
|
178
|
-
interrupt,
|
|
179
|
-
unbounded,
|
|
180
|
-
publishUnsafe,
|
|
181
|
-
unbounded2,
|
|
182
|
-
offer,
|
|
183
|
-
makeUnsafe3,
|
|
184
|
-
make11,
|
|
185
|
-
fromQueue,
|
|
186
|
-
fromPubSub,
|
|
187
|
-
map2,
|
|
188
|
-
filter,
|
|
189
|
-
take2,
|
|
190
|
-
mapAccum,
|
|
191
|
-
decodeText,
|
|
192
|
-
encodeText,
|
|
193
|
-
splitLines,
|
|
194
|
-
run,
|
|
195
|
-
runCollect,
|
|
196
|
-
runFold,
|
|
197
|
-
runHead,
|
|
198
|
-
runForEach,
|
|
199
|
-
FileSystem,
|
|
200
|
-
Path,
|
|
201
|
-
embeddedFile,
|
|
202
|
-
extractEmbeddedFile,
|
|
203
|
-
optionalEnv,
|
|
204
|
-
operatorConfigHome,
|
|
205
|
-
tempDirectoryScoped,
|
|
206
|
-
harnessesUnsupportedInSrt2,
|
|
207
|
-
harnessesUnsupportedInDocker2,
|
|
208
|
-
compiled2,
|
|
209
|
-
pinnedSrtCommand2,
|
|
210
|
-
pinnedSrtStepCommand2,
|
|
211
|
-
runSrtCli2,
|
|
212
|
-
kitmanCacheDirectory2,
|
|
213
|
-
srtSettings2,
|
|
214
|
-
srtCacheEnvironment2,
|
|
215
|
-
srtInheritedEnv2,
|
|
216
|
-
inheritedEnvironment2,
|
|
217
|
-
withOnlyEnvironment2,
|
|
218
|
-
writeSrtSettings2,
|
|
219
|
-
srtStepArgv2,
|
|
220
|
-
srtArgv2
|
|
221
|
-
} from "./chunk-63cyj9dh.js";
|
|
175
|
+
} from "./chunk-y64ssczv.js";
|
|
222
176
|
import {
|
|
223
177
|
currentTimeMillis,
|
|
224
178
|
SecureRandom,
|
|
@@ -307,7 +261,53 @@ import {
|
|
|
307
261
|
checkServicesFile,
|
|
308
262
|
checkServices,
|
|
309
263
|
serviceChecks
|
|
310
|
-
} from "./chunk-
|
|
264
|
+
} from "./chunk-xxcxramy.js";
|
|
265
|
+
import {
|
|
266
|
+
join,
|
|
267
|
+
interrupt,
|
|
268
|
+
unbounded,
|
|
269
|
+
publishUnsafe,
|
|
270
|
+
unbounded2,
|
|
271
|
+
offer,
|
|
272
|
+
makeUnsafe3,
|
|
273
|
+
make10,
|
|
274
|
+
fromQueue,
|
|
275
|
+
fromPubSub,
|
|
276
|
+
map2,
|
|
277
|
+
filter,
|
|
278
|
+
take2,
|
|
279
|
+
mapAccum,
|
|
280
|
+
decodeText,
|
|
281
|
+
encodeText,
|
|
282
|
+
splitLines,
|
|
283
|
+
run,
|
|
284
|
+
runCollect,
|
|
285
|
+
runFold,
|
|
286
|
+
runHead,
|
|
287
|
+
runForEach,
|
|
288
|
+
FileSystem,
|
|
289
|
+
Path,
|
|
290
|
+
embeddedFile,
|
|
291
|
+
extractEmbeddedFile,
|
|
292
|
+
optionalEnv,
|
|
293
|
+
operatorConfigHome,
|
|
294
|
+
tempDirectoryScoped,
|
|
295
|
+
harnessesUnsupportedInSrt2,
|
|
296
|
+
harnessesUnsupportedInDocker2,
|
|
297
|
+
compiled2,
|
|
298
|
+
pinnedSrtCommand2,
|
|
299
|
+
pinnedSrtStepCommand2,
|
|
300
|
+
runSrtCli2,
|
|
301
|
+
kitmanCacheDirectory2,
|
|
302
|
+
srtSettings2,
|
|
303
|
+
srtCacheEnvironment2,
|
|
304
|
+
srtInheritedEnv2,
|
|
305
|
+
inheritedEnvironment2,
|
|
306
|
+
withOnlyEnvironment2,
|
|
307
|
+
writeSrtSettings2,
|
|
308
|
+
srtStepArgv2,
|
|
309
|
+
srtArgv2
|
|
310
|
+
} from "./chunk-z59pvcbk.js";
|
|
311
311
|
import {
|
|
312
312
|
writeAgentEnvironmentConfigFile2,
|
|
313
313
|
readManifestSkillPaths2,
|
|
@@ -323,8 +323,12 @@ import {
|
|
|
323
323
|
applyAgentEnvironmentMaterialization2,
|
|
324
324
|
isPathWithin2,
|
|
325
325
|
skillIdentity2
|
|
326
|
-
} from "./chunk-
|
|
327
|
-
import"./chunk-
|
|
326
|
+
} from "./chunk-s4r49vbj.js";
|
|
327
|
+
import"./chunk-9yvknsnj.js";
|
|
328
|
+
import {
|
|
329
|
+
ChildProcessSpawner,
|
|
330
|
+
make2
|
|
331
|
+
} from "./chunk-vh2a72d1.js";
|
|
328
332
|
import {
|
|
329
333
|
egressAllowed,
|
|
330
334
|
writeSecretRegistry,
|
|
@@ -334,7 +338,7 @@ import {
|
|
|
334
338
|
secretFilter2,
|
|
335
339
|
opaqueTunnelRefusal2,
|
|
336
340
|
isOpaqueConnectReason2
|
|
337
|
-
} from "./chunk-
|
|
341
|
+
} from "./chunk-zy21drtv.js";
|
|
338
342
|
import {
|
|
339
343
|
sliceBytes2,
|
|
340
344
|
maxLineBytes2,
|
|
@@ -342,29 +346,25 @@ import {
|
|
|
342
346
|
decodedOption2,
|
|
343
347
|
decoded2,
|
|
344
348
|
readOpencode2
|
|
345
|
-
} from "./chunk-
|
|
349
|
+
} from "./chunk-kx8rpa62.js";
|
|
346
350
|
import {
|
|
347
351
|
uploadRunFile,
|
|
348
352
|
programLease,
|
|
349
353
|
rpcRunFiles,
|
|
350
354
|
programHostsEnv,
|
|
351
355
|
undeclaredHostsEnv
|
|
352
|
-
} from "./chunk-
|
|
353
|
-
import"./chunk-
|
|
356
|
+
} from "./chunk-njgay1ed.js";
|
|
357
|
+
import"./chunk-qbrkeg49.js";
|
|
354
358
|
import {
|
|
355
359
|
nextInt
|
|
356
|
-
} from "./chunk-
|
|
357
|
-
import"./chunk-
|
|
358
|
-
import
|
|
359
|
-
ChildProcessSpawner,
|
|
360
|
-
make3
|
|
361
|
-
} from "./chunk-gap0vmj7.js";
|
|
362
|
-
import"./chunk-cehbrs1y.js";
|
|
360
|
+
} from "./chunk-m1qp6swh.js";
|
|
361
|
+
import"./chunk-pd3azxev.js";
|
|
362
|
+
import"./chunk-5qrjf4xq.js";
|
|
363
363
|
import {
|
|
364
364
|
Id,
|
|
365
365
|
secretReference,
|
|
366
366
|
secretPlaceholder
|
|
367
|
-
} from "./chunk-
|
|
367
|
+
} from "./chunk-r2kzvdrg.js";
|
|
368
368
|
|
|
369
369
|
// packages/core/src/sync-kit.ts
|
|
370
370
|
import { createHash } from "crypto";
|
|
@@ -3648,7 +3648,7 @@ var removeRunnerContainers = (containers, runnerId) => containers.removeLabelled
|
|
|
3648
3648
|
|
|
3649
3649
|
// packages/agent-runtime/src/harness-sessions.ts
|
|
3650
3650
|
import { constants } from "fs";
|
|
3651
|
-
import { open, readdir } from "fs/promises";
|
|
3651
|
+
import { lstat, open, readdir, stat } from "fs/promises";
|
|
3652
3652
|
import { promisify } from "util";
|
|
3653
3653
|
import { gunzip, gzip } from "zlib";
|
|
3654
3654
|
var gzipped = promisify(gzip);
|
|
@@ -3700,7 +3700,7 @@ var sessionFiles = (root, depth, confinedTo) => gen(function* () {
|
|
|
3700
3700
|
return yield* filesBelow(root, depth, walkLimit(confinedTo));
|
|
3701
3701
|
}).pipe(orElseSucceed(() => []));
|
|
3702
3702
|
var maxFirstLineBytes = 1024 * 1024;
|
|
3703
|
-
var
|
|
3703
|
+
var readRolloutDirectory = (file) => gen(function* () {
|
|
3704
3704
|
const start = new TextDecoder().decode(yield* readSessionRange(file, 0, maxFirstLineBytes));
|
|
3705
3705
|
const line = getOrUndefined(decodeJsonStringOption(start.split(`
|
|
3706
3706
|
`, 1)[0] ?? ""));
|
|
@@ -3709,11 +3709,27 @@ var rolloutDirectory = (file) => gen(function* () {
|
|
|
3709
3709
|
}).pipe(orElseSucceed(() => {
|
|
3710
3710
|
return;
|
|
3711
3711
|
}));
|
|
3712
|
+
var rolloutDirectory = (file, known) => gen(function* () {
|
|
3713
|
+
if (known === undefined)
|
|
3714
|
+
return yield* readRolloutDirectory(file);
|
|
3715
|
+
const stamp = yield* sessionStamp(file).pipe(orElseSucceed(() => {
|
|
3716
|
+
return;
|
|
3717
|
+
}));
|
|
3718
|
+
if (stamp === undefined)
|
|
3719
|
+
return yield* readRolloutDirectory(file);
|
|
3720
|
+
const key = `${stamp.dev}:${stamp.ino}`;
|
|
3721
|
+
const cached = known.get(key);
|
|
3722
|
+
if (cached !== undefined && sameSessionStamp(cached.stamp, stamp))
|
|
3723
|
+
return cached.directory;
|
|
3724
|
+
const directory = yield* readRolloutDirectory(file);
|
|
3725
|
+
known.set(key, { stamp, directory });
|
|
3726
|
+
return directory;
|
|
3727
|
+
});
|
|
3712
3728
|
var confinement = (location, place) => {
|
|
3713
3729
|
const confinedTo = location.inConfigDir === true ? place.home : place.confinedTo;
|
|
3714
3730
|
return confinedTo === undefined ? undefined : { confinedTo };
|
|
3715
3731
|
};
|
|
3716
|
-
var findSession = (adapter, place) => gen(function* () {
|
|
3732
|
+
var findSession = (adapter, place, rolloutDirectories) => gen(function* () {
|
|
3717
3733
|
const location = adapter.session?.location;
|
|
3718
3734
|
if (location === undefined)
|
|
3719
3735
|
return;
|
|
@@ -3758,7 +3774,7 @@ var findSession = (adapter, place) => gen(function* () {
|
|
|
3758
3774
|
if (id === undefined)
|
|
3759
3775
|
continue;
|
|
3760
3776
|
const file = { id, name, path, ...confined };
|
|
3761
|
-
if (place.id === undefined ? (yield* rolloutDirectory(file)) === place.worktree : id === place.id)
|
|
3777
|
+
if (place.id === undefined ? (yield* rolloutDirectory(file, rolloutDirectories)) === place.worktree : id === place.id)
|
|
3762
3778
|
return file;
|
|
3763
3779
|
}
|
|
3764
3780
|
return;
|
|
@@ -3786,7 +3802,7 @@ var openSession = (file) => gen(function* () {
|
|
|
3786
3802
|
if (!opened.isFile() || opened.nlink !== 1n || named.dev !== opened.dev || getOrUndefined(named.ino) !== opened.ino || !isPathWithin2(yield* Path, yield* fs.realPath(root), real))
|
|
3787
3803
|
return yield* new SessionFileRefused({ path: file.path, root });
|
|
3788
3804
|
}
|
|
3789
|
-
return { handle, size: Number(opened.size) };
|
|
3805
|
+
return { handle, size: Number(opened.size), stamp: stampOf(opened) };
|
|
3790
3806
|
});
|
|
3791
3807
|
var readAt = (handle, position, length) => map9(tryPromise(() => handle.read(new Uint8Array(length), 0, length, position)), ({ buffer, bytesRead }) => buffer.subarray(0, bytesRead));
|
|
3792
3808
|
var readSessionRange = (file, position, length) => gen(function* () {
|
|
@@ -3810,8 +3826,15 @@ var sessionExtent = (file) => gen(function* () {
|
|
|
3810
3826
|
const subagents = yield* subagentFiles(file);
|
|
3811
3827
|
return subagents.reduce((total, { size }) => total + size, own);
|
|
3812
3828
|
});
|
|
3813
|
-
var
|
|
3814
|
-
|
|
3829
|
+
var stampOf = (info) => ({
|
|
3830
|
+
dev: info.dev,
|
|
3831
|
+
ino: info.ino,
|
|
3832
|
+
size: info.size,
|
|
3833
|
+
mtimeNs: info.mtimeNs
|
|
3834
|
+
});
|
|
3835
|
+
var sessionStamp = (file) => map9(tryPromise(() => file.confinedTo === undefined ? stat(file.path, { bigint: true }) : lstat(file.path, { bigint: true })), stampOf);
|
|
3836
|
+
var sameSessionStamp = (left, right) => left !== undefined && right !== undefined && left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeNs === right.mtimeNs;
|
|
3837
|
+
var packConfined = (handle, size, file, root) => gen(function* () {
|
|
3815
3838
|
if (size > maxConfinedBytes)
|
|
3816
3839
|
return yield* new SessionFileRefused({ path: file.path, root });
|
|
3817
3840
|
const members = [];
|
|
@@ -3833,8 +3856,12 @@ var packConfined = (file, root) => gen(function* () {
|
|
|
3833
3856
|
offset += member.length;
|
|
3834
3857
|
}
|
|
3835
3858
|
return packed;
|
|
3859
|
+
});
|
|
3860
|
+
var packStampedSession = (file) => gen(function* () {
|
|
3861
|
+
const { handle, size, stamp } = yield* openSession(file);
|
|
3862
|
+
const content = file.confinedTo === undefined ? new Uint8Array(yield* tryPromise(() => handle.readFile().then(gzipped))) : yield* packConfined(handle, size, file, file.confinedTo);
|
|
3863
|
+
return { content, stamp };
|
|
3836
3864
|
}).pipe(scoped);
|
|
3837
|
-
var packSession = (file) => file.confinedTo === undefined ? flatMap3(FileSystem, (fs) => fs.readFile(file.path)).pipe(flatMap3((content) => tryPromise(() => gzipped(content))), map9((content) => new Uint8Array(content))) : packConfined(file, file.confinedTo);
|
|
3838
3865
|
var restoreSession = (adapter, place) => gen(function* () {
|
|
3839
3866
|
const fs = yield* FileSystem;
|
|
3840
3867
|
const location = adapter.session?.location;
|
|
@@ -6864,31 +6891,37 @@ var keepSession = (rpc, lease, content) => gen(function* () {
|
|
|
6864
6891
|
return yield* new SessionNotKept({ status: kept.status });
|
|
6865
6892
|
return kept;
|
|
6866
6893
|
}).pipe(scoped, timeout(checkpointTransfer.timeout));
|
|
6867
|
-
var rpcStepCheckpoints = (rpc, signals, storage) =>
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
});
|
|
6894
|
+
var rpcStepCheckpoints = (rpc, signals, storage) => {
|
|
6895
|
+
const keptSessions = new WeakMap;
|
|
6896
|
+
return {
|
|
6897
|
+
resume: (work) => gen(function* () {
|
|
6898
|
+
const point = yield* rpc.resumeCheckpoint({ lease: programLease(work) });
|
|
6899
|
+
if (point === undefined)
|
|
6900
|
+
return;
|
|
6901
|
+
const { session, ...workspace } = point;
|
|
6902
|
+
if (session === undefined)
|
|
6903
|
+
return workspace;
|
|
6904
|
+
const { url, headers, ...file } = session;
|
|
6905
|
+
const content = yield* storage.execute(get(url).pipe(setHeaders(headers ?? {}))).pipe(flatMap3(filterStatusOk), flatMap3((response) => response.arrayBuffer), tapError2((error) => logWarning("runner_session_unreadable", error.message)), option2);
|
|
6906
|
+
return isNone(content) ? workspace : { ...workspace, session: { ...file, content: new Uint8Array(content.value) } };
|
|
6907
|
+
}),
|
|
6908
|
+
save: (work, { session, ...workspace }) => gen(function* () {
|
|
6909
|
+
const lease = programLease(work);
|
|
6910
|
+
const known = session === undefined ? undefined : keptSessions.get(session.content);
|
|
6911
|
+
const fileId = session === undefined ? undefined : known?.attemptId === work.id ? known.fileId : (yield* keepSession(rpc, lease, session.content).pipe(provideService(HttpClient, storage))).id;
|
|
6912
|
+
yield* rpc.saveCheckpoint({
|
|
6913
|
+
lease,
|
|
6914
|
+
checkpoint: {
|
|
6915
|
+
...workspace,
|
|
6916
|
+
...session === undefined || fileId === undefined ? undefined : { session: { harness: session.harness, id: session.id, name: session.name, fileId } }
|
|
6917
|
+
}
|
|
6918
|
+
}).pipe(tapError2(() => sync2(() => session !== undefined && keptSessions.delete(session.content))));
|
|
6919
|
+
if (session !== undefined && fileId !== undefined)
|
|
6920
|
+
keptSessions.set(session.content, { attemptId: work.id, fileId });
|
|
6921
|
+
}),
|
|
6922
|
+
sessionUpdated: (work) => signals.sessionUpdated(work.id)
|
|
6923
|
+
};
|
|
6924
|
+
};
|
|
6892
6925
|
var gitIdentity = ["-c", "user.name=Kitman", "-c", "user.email=runner@kitman.invalid"];
|
|
6893
6926
|
var srtMaskNames = [...DANGEROUS_FILES, ...DANGEROUS_DIRECTORIES.filter((name) => name !== ".git")];
|
|
6894
6927
|
var stageAll = (worktree, git) => gen(function* () {
|
|
@@ -7149,6 +7182,7 @@ var freshDirectory = (directory) => gen(function* () {
|
|
|
7149
7182
|
yield* fs.remove(directory, { recursive: true, force: true });
|
|
7150
7183
|
yield* fs.makeDirectory(directory, { recursive: true });
|
|
7151
7184
|
}).pipe(orDie);
|
|
7185
|
+
var harnessSessionFiles = { find: findSession, pack: packStampedSession };
|
|
7152
7186
|
var stepAttempt = (input, resending) => (work) => gen(function* () {
|
|
7153
7187
|
const checkouts = runCheckouts(input.rootDir, input.gitCredentials);
|
|
7154
7188
|
const repoBinding = work.checkout === "none" ? undefined : work.repoBinding;
|
|
@@ -7216,22 +7250,31 @@ ${afterMergeFailed}`];
|
|
|
7216
7250
|
};
|
|
7217
7251
|
const sessionId = transcript !== undefined || adapter?.session?.start !== undefined ? session.id : undefined;
|
|
7218
7252
|
let last = saved?.ref === checkpointRef(work) ? saved : {};
|
|
7253
|
+
const rolloutDirectories = new Map;
|
|
7254
|
+
const sessionFiles = input.sessionFiles ?? harnessSessionFiles;
|
|
7219
7255
|
const checkpointTurn = makeUnsafe3(1);
|
|
7220
7256
|
const takeCheckpoint = gen(function* () {
|
|
7221
7257
|
if (input.checkpoints === undefined)
|
|
7222
7258
|
return;
|
|
7223
7259
|
const workspace = writable ? yield* pushCheckpoint(worktree, checkpointRef(work), last.tree, yield* checkouts.transferEnv(repoBinding)) : undefined;
|
|
7224
|
-
const file = adapter === undefined ? undefined : yield*
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
const content =
|
|
7260
|
+
const file = adapter === undefined ? undefined : yield* sessionFiles.find(adapter, { ...sessions, worktree, ...sessionId === undefined ? undefined : { id: sessionId } }, rolloutDirectories);
|
|
7261
|
+
const unchanged = file !== undefined && last.session?.harness === adapter?.id && last.session?.id === file.id && sameSessionStamp(last.sessionStamp, yield* sessionStamp(file).pipe(orElseSucceed(() => {
|
|
7262
|
+
return;
|
|
7263
|
+
})));
|
|
7264
|
+
const packed = file === undefined || unchanged ? undefined : yield* sessionFiles.pack(file).pipe(catch_((error) => as(logWarning("runner_session_unread", error.message), undefined)));
|
|
7265
|
+
const content = packed?.content;
|
|
7230
7266
|
const sessionChanged = content !== undefined && !sameBytes(last.session?.content, content);
|
|
7267
|
+
if (packed !== undefined && !sessionChanged)
|
|
7268
|
+
last = { ...last, sessionStamp: packed.stamp };
|
|
7231
7269
|
if (workspace === undefined && !sessionChanged)
|
|
7232
7270
|
return;
|
|
7233
7271
|
const session = file === undefined || content === undefined || adapter === undefined ? last.session ?? (transcript === undefined ? undefined : storedSession) : { harness: adapter.id, id: file.id, name: file.name, content };
|
|
7234
|
-
const next = {
|
|
7272
|
+
const next = {
|
|
7273
|
+
...last,
|
|
7274
|
+
...workspace,
|
|
7275
|
+
...session === undefined ? undefined : { session },
|
|
7276
|
+
...packed === undefined ? undefined : { sessionStamp: packed.stamp }
|
|
7277
|
+
};
|
|
7235
7278
|
yield* input.checkpoints.save(work, {
|
|
7236
7279
|
...next.ref === undefined || next.revision === undefined ? undefined : { ref: next.ref, revision: next.revision },
|
|
7237
7280
|
...session === undefined ? undefined : { session }
|
|
@@ -8032,7 +8075,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
8032
8075
|
const input = yield* unbounded2();
|
|
8033
8076
|
const pending = new Map;
|
|
8034
8077
|
let lastId = 0;
|
|
8035
|
-
const handle = yield* spawner.spawn(
|
|
8078
|
+
const handle = yield* spawner.spawn(make2(binary, ["app-server"], {
|
|
8036
8079
|
cwd: env.home,
|
|
8037
8080
|
extendEnv: true,
|
|
8038
8081
|
env: { HOME: env.home, CODEX_HOME: env.codexHome },
|
|
@@ -8055,7 +8098,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
8055
8098
|
return {
|
|
8056
8099
|
request: (method, params) => gen(function* () {
|
|
8057
8100
|
const id = ++lastId;
|
|
8058
|
-
const deferred = yield*
|
|
8101
|
+
const deferred = yield* make15();
|
|
8059
8102
|
pending.set(id, deferred);
|
|
8060
8103
|
yield* send({ id, method, params });
|
|
8061
8104
|
return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
|
|
@@ -8195,10 +8238,10 @@ var handshake = [
|
|
|
8195
8238
|
`).join("");
|
|
8196
8239
|
var kitmanMcpPreflight = (mcp) => gen(function* () {
|
|
8197
8240
|
const spawner = yield* ChildProcessSpawner;
|
|
8198
|
-
const server = yield* spawner.spawn(
|
|
8241
|
+
const server = yield* spawner.spawn(make2(mcp.command, [...mcp.args], {
|
|
8199
8242
|
extendEnv: true,
|
|
8200
8243
|
env: mcp.env,
|
|
8201
|
-
stdin: { stream:
|
|
8244
|
+
stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
|
|
8202
8245
|
stderr: "ignore"
|
|
8203
8246
|
}));
|
|
8204
8247
|
const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
|
|
@@ -8271,8 +8314,8 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
|
|
|
8271
8314
|
};
|
|
8272
8315
|
const exitCode = sandbox === undefined ? yield* gen(function* () {
|
|
8273
8316
|
const spawner = yield* ChildProcessSpawner;
|
|
8274
|
-
const handle = yield* spawner.spawn(
|
|
8275
|
-
stdin:
|
|
8317
|
+
const handle = yield* spawner.spawn(make2(input.bun ?? process.execPath, [file], {
|
|
8318
|
+
stdin: make10(new TextEncoder().encode(stdin)),
|
|
8276
8319
|
stdout: "inherit",
|
|
8277
8320
|
stderr: "inherit",
|
|
8278
8321
|
extendEnv: false,
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
runnerRpcUrl2,
|
|
5
5
|
makeRunnerRpcClient2,
|
|
6
6
|
makeProgramRpcClient2
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import"./chunk-
|
|
9
|
-
import"./chunk-
|
|
10
|
-
import"./chunk-
|
|
11
|
-
import"./chunk-
|
|
12
|
-
import"./chunk-
|
|
7
|
+
} from "./chunk-qbrkeg49.js";
|
|
8
|
+
import"./chunk-5qrjf4xq.js";
|
|
9
|
+
import"./chunk-xxcxramy.js";
|
|
10
|
+
import"./chunk-r2kzvdrg.js";
|
|
11
|
+
import"./chunk-z59pvcbk.js";
|
|
12
|
+
import"./chunk-y64ssczv.js";
|
|
13
13
|
export {
|
|
14
14
|
makeProgramRpcClient2 as makeProgramRpcClient,
|
|
15
15
|
makeRunnerRpcClient2 as makeRunnerRpcClient,
|
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
decodeJsonStringOption,
|
|
119
119
|
encodeJsonStringSync,
|
|
120
120
|
encodePrettyJsonString
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-y64ssczv.js";
|
|
122
122
|
import {
|
|
123
123
|
currentTimeMillis,
|
|
124
124
|
SecureRandom,
|
|
@@ -158,8 +158,8 @@ import {
|
|
|
158
158
|
sessionForApi,
|
|
159
159
|
readAuthStore,
|
|
160
160
|
agentCredentialForApi,
|
|
161
|
+
make5,
|
|
161
162
|
make6,
|
|
162
|
-
make7,
|
|
163
163
|
Service,
|
|
164
164
|
shouldRefresh,
|
|
165
165
|
refreshSession,
|
|
@@ -170,7 +170,7 @@ import {
|
|
|
170
170
|
runMcpEffect,
|
|
171
171
|
createAgentAuthSignedFetch,
|
|
172
172
|
setupMcpAgentCredential
|
|
173
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-xxcxramy.js";
|
|
174
174
|
import {
|
|
175
175
|
join,
|
|
176
176
|
interrupt,
|
|
@@ -187,30 +187,30 @@ import {
|
|
|
187
187
|
withDefault,
|
|
188
188
|
option,
|
|
189
189
|
String2
|
|
190
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-z59pvcbk.js";
|
|
191
191
|
import {
|
|
192
192
|
searchDocs2,
|
|
193
193
|
readDoc2
|
|
194
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-9vqkjkya.js";
|
|
195
195
|
import {
|
|
196
196
|
nextInt
|
|
197
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-m1qp6swh.js";
|
|
198
198
|
import {
|
|
199
199
|
recommendationProblem
|
|
200
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-pd3azxev.js";
|
|
201
201
|
import {
|
|
202
202
|
layerJson,
|
|
203
|
-
|
|
203
|
+
make3,
|
|
204
204
|
withHeaders,
|
|
205
205
|
layerProtocolSocket,
|
|
206
206
|
ConnectionHooks
|
|
207
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-5qrjf4xq.js";
|
|
208
208
|
import {
|
|
209
209
|
guard,
|
|
210
210
|
Id,
|
|
211
211
|
Timestamp,
|
|
212
212
|
ActorType
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-r2kzvdrg.js";
|
|
214
214
|
|
|
215
215
|
// apps/cli/src/mcp.ts
|
|
216
216
|
import { tmpdir as tmpdir2 } from "os";
|
|
@@ -1947,56 +1947,56 @@ var LivePresenceSubscriptionMessage = Union([
|
|
|
1947
1947
|
LivePresenceSubscriptionUpdate
|
|
1948
1948
|
]);
|
|
1949
1949
|
|
|
1950
|
-
class LiveRpcs extends
|
|
1950
|
+
class LiveRpcs extends make6(make5("Session", {
|
|
1951
1951
|
success: Struct({ workspaceId: String4, clientKind: String4 }),
|
|
1952
1952
|
error: LiveRpcError
|
|
1953
|
-
}),
|
|
1953
|
+
}), make5("Subscribe", {
|
|
1954
1954
|
payload: LiveSubscribeInput,
|
|
1955
1955
|
success: LiveSubscriptionMessage,
|
|
1956
1956
|
error: LiveRpcError,
|
|
1957
1957
|
stream: true
|
|
1958
|
-
}),
|
|
1958
|
+
}), make5("Replay", {
|
|
1959
1959
|
payload: LiveReplayInput,
|
|
1960
1960
|
success: ArraySchema(LiveEvent),
|
|
1961
1961
|
error: LiveRpcError
|
|
1962
|
-
}),
|
|
1962
|
+
}), make5("Ack", {
|
|
1963
1963
|
payload: LiveAckInput,
|
|
1964
1964
|
success: LiveAckResult,
|
|
1965
1965
|
error: LiveRpcError
|
|
1966
|
-
}),
|
|
1966
|
+
}), make5("SubscribeWeb", {
|
|
1967
1967
|
payload: LiveWebSubscribeInput,
|
|
1968
1968
|
success: LiveWebSubscriptionMessage,
|
|
1969
1969
|
error: LiveRpcError,
|
|
1970
1970
|
stream: true
|
|
1971
|
-
}),
|
|
1971
|
+
}), make5("SubscriptionStatus", {
|
|
1972
1972
|
payload: { subscriptionId: String4 },
|
|
1973
1973
|
success: LiveSubscriptionStatus,
|
|
1974
1974
|
error: LiveRpcError
|
|
1975
|
-
}),
|
|
1975
|
+
}), make5("ReplayWeb", {
|
|
1976
1976
|
payload: LiveWebReplayInput,
|
|
1977
1977
|
success: LiveWebReplayResult,
|
|
1978
1978
|
error: LiveRpcError
|
|
1979
|
-
}),
|
|
1979
|
+
}), make5("AckWeb", {
|
|
1980
1980
|
payload: LiveWebAckInput,
|
|
1981
1981
|
success: LiveWebAckResult,
|
|
1982
1982
|
error: LiveRpcError
|
|
1983
|
-
}),
|
|
1983
|
+
}), make5("PublishPresence", {
|
|
1984
1984
|
payload: LivePresencePublishInput,
|
|
1985
1985
|
success: LivePresenceEntry,
|
|
1986
1986
|
error: LiveRpcError
|
|
1987
|
-
}),
|
|
1987
|
+
}), make5("SubscribePresence", {
|
|
1988
1988
|
payload: LivePresenceSubscribeInput,
|
|
1989
1989
|
success: LivePresenceSubscriptionMessage,
|
|
1990
1990
|
error: LiveRpcError,
|
|
1991
1991
|
stream: true
|
|
1992
|
-
}),
|
|
1992
|
+
}), make5("ClearPresence", {
|
|
1993
1993
|
payload: { scope: optional(LiveScope) },
|
|
1994
1994
|
error: LiveRpcError
|
|
1995
|
-
}),
|
|
1995
|
+
}), make5("RecordSessionUpdate", {
|
|
1996
1996
|
payload: { sessionId: String4, input: SessionUpdateCreate },
|
|
1997
1997
|
success: SessionUpdate,
|
|
1998
1998
|
error: LiveRpcError
|
|
1999
|
-
}),
|
|
1999
|
+
}), make5("EndSession", {
|
|
2000
2000
|
payload: { sessionId: String4, input: SessionEnd },
|
|
2001
2001
|
success: Session,
|
|
2002
2002
|
error: LiveRpcError
|
|
@@ -2048,7 +2048,7 @@ function connectKitmanLiveRoot(protocol) {
|
|
|
2048
2048
|
})
|
|
2049
2049
|
});
|
|
2050
2050
|
const layer = (isString2(protocol) ? liveWebSocketProtocol(protocol) : protocol()).pipe(provideMerge(hooks));
|
|
2051
|
-
const client = await runPromise(buildWithScope(layer, scope).pipe(flatMap3((context) =>
|
|
2051
|
+
const client = await runPromise(buildWithScope(layer, scope).pipe(flatMap3((context) => make3(LiveRpcs).pipe(provideContext2(context))), provide(scope)));
|
|
2052
2052
|
let abandon = () => {};
|
|
2053
2053
|
const abandoned = new Promise((_resolve, reject) => {
|
|
2054
2054
|
abandon = reject;
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
gen,
|
|
7
7
|
flatMap3,
|
|
8
8
|
provideContext2
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-y64ssczv.js";
|
|
10
10
|
import {
|
|
11
11
|
runForEach
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-z59pvcbk.js";
|
|
13
13
|
import {
|
|
14
14
|
WebSocketConstructor,
|
|
15
15
|
layerWebSocketConstructorGlobal,
|
|
@@ -19,13 +19,13 @@ import {
|
|
|
19
19
|
RunnerReplicaRpcs,
|
|
20
20
|
RunnerRunFileRpcs,
|
|
21
21
|
ProgramRpcs
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-xxcxramy.js";
|
|
23
23
|
import {
|
|
24
24
|
layerJson,
|
|
25
|
-
|
|
25
|
+
make3,
|
|
26
26
|
withHeaders,
|
|
27
27
|
layerProtocolSocket
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-5qrjf4xq.js";
|
|
29
29
|
|
|
30
30
|
// packages/live/src/rpc/runner-client.ts
|
|
31
31
|
var proxiedWebSocket = (proxy) => succeed5(WebSocketConstructor)((target) => {
|
|
@@ -46,7 +46,7 @@ var authorizer = (options) => (call) => flatMap3(options.bearer, (token) => with
|
|
|
46
46
|
var RunnerProcessRpcs = RunnerReplicaRpcs.merge(RunnerRunFileRpcs);
|
|
47
47
|
var makeRunnerRpcClient2 = (options) => gen(function* () {
|
|
48
48
|
const protocol = yield* build(options.protocol);
|
|
49
|
-
const client = yield*
|
|
49
|
+
const client = yield* make3(RunnerProcessRpcs).pipe(provideContext2(protocol));
|
|
50
50
|
const authorized = authorizer(options);
|
|
51
51
|
return {
|
|
52
52
|
claim: (input) => authorized(client.Claim(input)),
|
|
@@ -74,7 +74,7 @@ var makeRunnerRpcClient2 = (options) => gen(function* () {
|
|
|
74
74
|
});
|
|
75
75
|
var makeProgramRpcClient2 = (options) => gen(function* () {
|
|
76
76
|
const protocol = yield* build(options.protocol);
|
|
77
|
-
const client = yield*
|
|
77
|
+
const client = yield* make3(ProgramRpcs).pipe(provideContext2(protocol));
|
|
78
78
|
const authorized = authorizer(options);
|
|
79
79
|
return {
|
|
80
80
|
recordActivity: (input) => authorized(client.RecordActivity(input)),
|
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
writeSrtSettings2,
|
|
16
16
|
srtStepArgv2,
|
|
17
17
|
srtArgv2
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import"./chunk-
|
|
18
|
+
} from "./chunk-z59pvcbk.js";
|
|
19
|
+
import"./chunk-y64ssczv.js";
|
|
20
20
|
export {
|
|
21
21
|
compiled2 as compiled,
|
|
22
22
|
harnessesUnsupportedInDocker2 as harnessesUnsupportedInDocker,
|