@kitman-sh/cli 0.10.53 → 0.10.55

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.
Files changed (34) hide show
  1. package/dist/{chunk-x9dhxfts.js → chunk-148mjppg.js} +5 -5
  2. package/dist/{chunk-pp1p3g6e.js → chunk-4kssrezn.js} +6 -1
  3. package/dist/{chunk-ctasxxz5.js → chunk-5j3cxsnp.js} +10 -10
  4. package/dist/{chunk-7thnf14y.js → chunk-5y5axze6.js} +609 -6
  5. package/dist/{chunk-mbctzx7e.js → chunk-61k67vxh.js} +76 -1389
  6. package/dist/{chunk-arvwar2c.js → chunk-7evwar6b.js} +1 -1
  7. package/dist/{chunk-mej2bx5n.js → chunk-99ver3za.js} +4 -4
  8. package/dist/{chunk-jagzz148.js → chunk-axdmbr61.js} +26 -26
  9. package/dist/{chunk-p6spvbwq.js → chunk-dgb6s5vq.js} +482 -100
  10. package/dist/{chunk-v290mf51.js → chunk-dj7pp4w4.js} +179 -35
  11. package/dist/{chunk-eg8f5ncv.js → chunk-dkpqwk0q.js} +7 -7
  12. package/dist/{chunk-r8p3nxcp.js → chunk-eerh2t20.js} +10 -10
  13. package/dist/{chunk-jafetf7z.js → chunk-g53wn1q8.js} +2 -2
  14. package/dist/chunk-g7vk5tjp.js +1109 -0
  15. package/dist/{chunk-vjmz23rs.js → chunk-gwcqz1bj.js} +1 -1
  16. package/dist/{chunk-wh1pa2aa.js → chunk-m32wb6t0.js} +245 -108
  17. package/dist/{chunk-3bj7sc3v.js → chunk-mmetyep8.js} +7 -7
  18. package/dist/{chunk-30397r95.js → chunk-mtgkvbk4.js} +4 -4
  19. package/dist/{chunk-dzh9e6n2.js → chunk-q0yna8sw.js} +52 -35
  20. package/dist/{chunk-6vns3ej0.js → chunk-rjfxnk05.js} +5 -5
  21. package/dist/{chunk-g5bs3f6z.js → chunk-twp7aprz.js} +4 -6
  22. package/dist/{chunk-x0b92bjb.js → chunk-vtn088tq.js} +6 -6
  23. package/dist/{chunk-b6thzgc9.js → chunk-wczs5vrq.js} +2 -2
  24. package/dist/{chunk-11p4wf6n.js → chunk-xgwjcq4z.js} +3 -3
  25. package/dist/egress-proxy.ts +138 -21
  26. package/dist/half-close-relay.ts +125 -0
  27. package/dist/index.js +4 -4
  28. package/dist/tcp-forwarder.ts +29 -0
  29. package/package.json +1 -1
  30. package/dist/chunk-1mc9vgcr.js +0 -39
  31. package/dist/chunk-jfvq7s24.js +0 -145
  32. package/dist/chunk-txwt6r25.js +0 -1731
  33. package/dist/chunk-vyv0p5eq.js +0 -3183
  34. package/dist/chunk-z821b2gp.js +0 -164
@@ -1,145 +0,0 @@
1
- // @bun
2
- import {
3
- getOrElse,
4
- TaggedError,
5
- forEach,
6
- tryPromise,
7
- sync2,
8
- gen,
9
- flatMap3,
10
- andThen2,
11
- map8,
12
- scoped,
13
- makeFormatterStandardSchemaV1,
14
- is,
15
- encodeEffect,
16
- optionalKey,
17
- String4,
18
- Struct,
19
- Record,
20
- ArraySchema,
21
- Union,
22
- TaggedStruct,
23
- fromJsonString,
24
- TaggedError2,
25
- toCodecJson,
26
- Json
27
- } from "./chunk-mbctzx7e.js";
28
- import {
29
- currentTimeMillis,
30
- ProgramWorkUnit,
31
- RunFileRefused,
32
- runFileContentType,
33
- sha256Hasher,
34
- put,
35
- setHeaders,
36
- bodyUint8Array,
37
- filterStatusOk,
38
- HttpClient,
39
- KitSetup,
40
- RunnerRpcError
41
- } from "./chunk-wh1pa2aa.js";
42
- import {
43
- guard
44
- } from "./chunk-pp1p3g6e.js";
45
- import {
46
- runForEach,
47
- FileSystem
48
- } from "./chunk-11p4wf6n.js";
49
- import {
50
- LoopManifest,
51
- ManifestInvalid,
52
- make14,
53
- Suspended,
54
- LoopCheckError
55
- } from "./chunk-txwt6r25.js";
56
-
57
- // packages/sdk/src/program/engine.ts
58
- class JournalWriteFailed extends TaggedError("JournalWriteFailed") {
59
- get message() {
60
- return `Journal write failed: ${this.cause.message}`;
61
- }
62
- }
63
- var JournalEntries = Record(String4, Json);
64
- var isSuspended = is(Suspended);
65
- var emptyWorkflow = make14("kitman-loop/none", { payload: {}, idempotencyKey: () => "none" });
66
- var replayStatuses = new Set([401, 403, 409, 429]);
67
- var isRunnerRpcError = is(RunnerRpcError);
68
- var isRunFileRefused = is(RunFileRefused);
69
- var issues = makeFormatterStandardSchemaV1();
70
- var put2 = (target, contentType, body) => gen(function* () {
71
- const response = yield* (yield* HttpClient).execute(put(target.url).pipe(bodyUint8Array(body, contentType), setHeaders(target.headers ?? {})));
72
- return (yield* filterStatusOk(response)).headers.etag ?? "";
73
- });
74
- var readRange = (path, offset, size) => scoped(gen(function* () {
75
- const file = yield* (yield* FileSystem).open(path);
76
- return getOrElse(yield* file.readAlloc(size, { position: BigInt(offset) }), () => new Uint8Array);
77
- }));
78
- var partUrlMarginMillis = 60000;
79
- var uploadParts = (files, path, contentType, fileId, upload) => forEach(upload.parts, (part) => gen(function* () {
80
- const now = yield* currentTimeMillis;
81
- const fresh = Date.parse(part.expiresAt) - now > partUrlMarginMillis ? part : (yield* files.runFileParts({ fileId, partNumbers: [part.partNumber] }))[0] ?? part;
82
- const body = yield* readRange(path, (part.partNumber - 1) * upload.partSize, upload.partSize);
83
- return { partNumber: part.partNumber, etag: yield* put2(fresh, contentType, body) };
84
- }));
85
- var uploadRunFile = (files, file) => gen(function* () {
86
- const fs = yield* FileSystem;
87
- const contentType = runFileContentType(file.name);
88
- const byteSize = Number((yield* fs.stat(file.path)).size);
89
- const hash = sha256Hasher();
90
- yield* runForEach(fs.stream(file.path), (chunk) => sync2(() => hash.update(chunk)));
91
- const { file: slotted, upload } = yield* files.createRunFile({
92
- step: file.step,
93
- name: file.name,
94
- ...file.caption === undefined ? undefined : { caption: file.caption },
95
- contentType,
96
- byteSize,
97
- sha256: hash.digest("hex")
98
- });
99
- if (upload === undefined)
100
- return slotted;
101
- return yield* upload.kind === "single" ? readRange(file.path, 0, byteSize).pipe(flatMap3((body) => put2(upload, contentType, body)), andThen2(files.completeRunFile({ fileId: slotted.id }))) : flatMap3(uploadParts(files, file.path, contentType, slotted.id, upload), (parts) => files.completeRunFile({ fileId: slotted.id, parts }));
102
- });
103
- var programLease = (work) => ({
104
- workUnitId: work.id,
105
- leaseOwnerId: work.lease.leaseOwnerId,
106
- runnerReplicaId: work.lease.runnerReplicaId,
107
- leaseId: work.lease.leaseId,
108
- attempt: work.lease.attempt,
109
- fencingToken: work.lease.fencingToken,
110
- capacitySlot: work.lease.capacitySlot
111
- });
112
- var rpcRunFiles = (rpc, lease) => ({
113
- createRunFile: (file) => rpc.createRunFile({ lease, ...file }),
114
- runFileParts: (request) => map8(rpc.runFileParts({ lease, ...request, partNumbers: [...request.partNumbers] }), ({ parts }) => parts),
115
- completeRunFile: ({ parts, ...request }) => rpc.completeRunFile({ lease, ...request, ...parts === undefined ? undefined : { parts: [...parts] } })
116
- });
117
-
118
- // packages/sdk/src/program/host.ts
119
- var describeFlag = "--kitman-describe";
120
- var DescribedKit = Struct({
121
- name: String4,
122
- version: String4,
123
- loops: ArraySchema(LoopManifest),
124
- agents: Record(String4, Json),
125
- schedules: optionalKey(Record(String4, Json)),
126
- setup: optionalKey(KitSetup)
127
- });
128
- var Described = Union([
129
- TaggedStruct("Described", { kits: ArraySchema(DescribedKit) }),
130
- TaggedStruct("Refused", { error: Union([ManifestInvalid, LoopCheckError]) })
131
- ]);
132
- var encodeDescribed = encodeEffect(fromJsonString(toCodecJson(Described)));
133
-
134
- class ProgramRefused extends TaggedError2()("ProgramRefused", { reason: String4 }) {
135
- get message() {
136
- return this.reason;
137
- }
138
- }
139
- var programHostsEnv = "KITMAN_PROGRAM_HOSTS";
140
- var undeclaredHostsEnv = "KITMAN_UNDECLARED_HOSTS";
141
- var redirectStatuses = new Set([301, 302, 303, 307, 308]);
142
- var readStdin = tryPromise(() => Bun.stdin.text());
143
- var isWorkUnit = guard(ProgramWorkUnit);
144
-
145
- export { uploadRunFile, programLease, rpcRunFiles, describeFlag, Described, programHostsEnv, undeclaredHostsEnv };