@gjermundgaraba/clankerbox-sdk 0.15.6 → 0.18.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/client-8af586hb.d.mts +1007 -0
- package/dist/client-CbMWwHdT.mjs +708 -0
- package/dist/index.d.mts +91 -360
- package/dist/index.mjs +161 -140
- package/dist/node.d.mts +6 -2
- package/dist/node.mjs +5 -5
- package/package.json +6 -4
- package/dist/client-BkZhmYJx.mjs +0 -662
- package/dist/client-Cn1bj4It.d.mts +0 -328
package/dist/index.d.mts
CHANGED
|
@@ -1,423 +1,154 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import
|
|
3
|
-
import * as ActionHttp from "@gjermundgaraba/effect-actions/ActionHttp";
|
|
4
|
-
import { Duration, Effect, FileSystem, Path, PlatformError, Schema, Scope } from "effect";
|
|
5
|
-
//#region src/api.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* How long a client waits for a read's reply from one host, unless it sets its own. A host
|
|
8
|
-
* bounds its own reads of runtime state under it, so a list answers in time.
|
|
9
|
-
*/
|
|
10
|
-
export declare const readTimeout: Duration.Duration;
|
|
11
|
-
/**
|
|
12
|
-
* The header every client request carries the SDK's `version` in. A host refuses a request
|
|
13
|
-
* whose release (major.minor) differs from its own, or that carries none, before it runs
|
|
14
|
-
* anything.
|
|
15
|
-
*/
|
|
16
|
-
export declare const versionHeader = "clankerbox-version";
|
|
17
|
-
export declare const Http: ActionHttp.Binding<readonly [Action.Action<"listMachines", Schema.$Record<Schema.String, Schema.Never>, Schema.$Array<Schema.Struct<{
|
|
18
|
-
readonly id: Schema.String;
|
|
19
|
-
readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
|
|
20
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
21
|
-
readonly base: Schema.String;
|
|
22
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
23
|
-
readonly cpu: Schema.Int;
|
|
24
|
-
readonly ramMib: Schema.Int;
|
|
25
|
-
readonly diskGib: Schema.Int;
|
|
26
|
-
readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
|
|
27
|
-
readonly made: Schema.Boolean;
|
|
28
|
-
readonly action: Schema.Struct<{
|
|
29
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
30
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
31
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
32
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
33
|
-
readonly message: Schema.String;
|
|
34
|
-
}>>;
|
|
35
|
-
}>;
|
|
36
|
-
readonly ssh: Schema.optionalKey<Schema.Struct<{
|
|
37
|
-
readonly host: Schema.String;
|
|
38
|
-
readonly port: Schema.Int;
|
|
39
|
-
readonly user: Schema.String;
|
|
40
|
-
}>>;
|
|
41
|
-
readonly hostKey: Schema.optionalKey<Schema.String>;
|
|
42
|
-
}>>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>, Action.Action<"getMachine", Schema.Struct<{
|
|
43
|
-
readonly id: Schema.String;
|
|
44
|
-
}>, Schema.Struct<{
|
|
45
|
-
readonly id: Schema.String;
|
|
46
|
-
readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
|
|
47
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
48
|
-
readonly base: Schema.String;
|
|
49
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
50
|
-
readonly cpu: Schema.Int;
|
|
51
|
-
readonly ramMib: Schema.Int;
|
|
52
|
-
readonly diskGib: Schema.Int;
|
|
53
|
-
readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
|
|
54
|
-
readonly made: Schema.Boolean;
|
|
55
|
-
readonly action: Schema.Struct<{
|
|
56
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
57
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
58
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
59
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
60
|
-
readonly message: Schema.String;
|
|
61
|
-
}>>;
|
|
62
|
-
}>;
|
|
63
|
-
readonly ssh: Schema.optionalKey<Schema.Struct<{
|
|
64
|
-
readonly host: Schema.String;
|
|
65
|
-
readonly port: Schema.Int;
|
|
66
|
-
readonly user: Schema.String;
|
|
67
|
-
}>>;
|
|
68
|
-
readonly hostKey: Schema.optionalKey<Schema.String>;
|
|
69
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>, Action.Action<"createMachine", Schema.Struct<{
|
|
70
|
-
readonly base: Schema.String;
|
|
71
|
-
readonly cpu: Schema.Int;
|
|
72
|
-
readonly ramMib: Schema.Int;
|
|
73
|
-
readonly diskGib: Schema.Int;
|
|
74
|
-
readonly setup: Schema.optionalKey<Schema.Struct<{
|
|
75
|
-
readonly script: Schema.String;
|
|
76
|
-
readonly timeoutSeconds: Schema.optionalKey<Schema.Int>;
|
|
77
|
-
}>>;
|
|
78
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
79
|
-
readonly id: Schema.String;
|
|
80
|
-
}>, Schema.Struct<{
|
|
81
|
-
readonly id: Schema.String;
|
|
82
|
-
readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
|
|
83
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
84
|
-
readonly base: Schema.String;
|
|
85
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
86
|
-
readonly cpu: Schema.Int;
|
|
87
|
-
readonly ramMib: Schema.Int;
|
|
88
|
-
readonly diskGib: Schema.Int;
|
|
89
|
-
readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
|
|
90
|
-
readonly made: Schema.Boolean;
|
|
91
|
-
readonly action: Schema.Struct<{
|
|
92
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
93
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
94
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
95
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
96
|
-
readonly message: Schema.String;
|
|
97
|
-
}>>;
|
|
98
|
-
}>;
|
|
99
|
-
readonly ssh: Schema.optionalKey<Schema.Struct<{
|
|
100
|
-
readonly host: Schema.String;
|
|
101
|
-
readonly port: Schema.Int;
|
|
102
|
-
readonly user: Schema.String;
|
|
103
|
-
}>>;
|
|
104
|
-
readonly hostKey: Schema.optionalKey<Schema.String>;
|
|
105
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"startMachine", Schema.Struct<{
|
|
106
|
-
readonly id: Schema.String;
|
|
107
|
-
}>, Schema.Struct<{
|
|
108
|
-
readonly id: Schema.String;
|
|
109
|
-
readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
|
|
110
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
111
|
-
readonly base: Schema.String;
|
|
112
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
113
|
-
readonly cpu: Schema.Int;
|
|
114
|
-
readonly ramMib: Schema.Int;
|
|
115
|
-
readonly diskGib: Schema.Int;
|
|
116
|
-
readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
|
|
117
|
-
readonly made: Schema.Boolean;
|
|
118
|
-
readonly action: Schema.Struct<{
|
|
119
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
120
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
121
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
122
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
123
|
-
readonly message: Schema.String;
|
|
124
|
-
}>>;
|
|
125
|
-
}>;
|
|
126
|
-
readonly ssh: Schema.optionalKey<Schema.Struct<{
|
|
127
|
-
readonly host: Schema.String;
|
|
128
|
-
readonly port: Schema.Int;
|
|
129
|
-
readonly user: Schema.String;
|
|
130
|
-
}>>;
|
|
131
|
-
readonly hostKey: Schema.optionalKey<Schema.String>;
|
|
132
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"stopMachine", Schema.Struct<{
|
|
133
|
-
readonly id: Schema.String;
|
|
134
|
-
}>, Schema.Struct<{
|
|
135
|
-
readonly id: Schema.String;
|
|
136
|
-
readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
|
|
137
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
138
|
-
readonly base: Schema.String;
|
|
139
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
140
|
-
readonly cpu: Schema.Int;
|
|
141
|
-
readonly ramMib: Schema.Int;
|
|
142
|
-
readonly diskGib: Schema.Int;
|
|
143
|
-
readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
|
|
144
|
-
readonly made: Schema.Boolean;
|
|
145
|
-
readonly action: Schema.Struct<{
|
|
146
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
147
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
148
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
149
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
150
|
-
readonly message: Schema.String;
|
|
151
|
-
}>>;
|
|
152
|
-
}>;
|
|
153
|
-
readonly ssh: Schema.optionalKey<Schema.Struct<{
|
|
154
|
-
readonly host: Schema.String;
|
|
155
|
-
readonly port: Schema.Int;
|
|
156
|
-
readonly user: Schema.String;
|
|
157
|
-
}>>;
|
|
158
|
-
readonly hostKey: Schema.optionalKey<Schema.String>;
|
|
159
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"deleteMachine", Schema.Struct<{
|
|
160
|
-
readonly id: Schema.String;
|
|
161
|
-
}>, Schema.Void, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"forkMachine", Schema.Struct<{
|
|
162
|
-
readonly machine: Schema.String;
|
|
163
|
-
readonly name: Schema.String;
|
|
164
|
-
}>, Schema.Struct<{
|
|
165
|
-
readonly id: Schema.String;
|
|
166
|
-
readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
|
|
167
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
168
|
-
readonly base: Schema.String;
|
|
169
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
170
|
-
readonly cpu: Schema.Int;
|
|
171
|
-
readonly ramMib: Schema.Int;
|
|
172
|
-
readonly diskGib: Schema.Int;
|
|
173
|
-
readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
|
|
174
|
-
readonly made: Schema.Boolean;
|
|
175
|
-
readonly action: Schema.Struct<{
|
|
176
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
177
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
178
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
179
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
180
|
-
readonly message: Schema.String;
|
|
181
|
-
}>>;
|
|
182
|
-
}>;
|
|
183
|
-
readonly ssh: Schema.optionalKey<Schema.Struct<{
|
|
184
|
-
readonly host: Schema.String;
|
|
185
|
-
readonly port: Schema.Int;
|
|
186
|
-
readonly user: Schema.String;
|
|
187
|
-
}>>;
|
|
188
|
-
readonly hostKey: Schema.optionalKey<Schema.String>;
|
|
189
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"restoreMachine", Schema.Struct<{
|
|
190
|
-
readonly checkpoint: Schema.String;
|
|
191
|
-
readonly name: Schema.String;
|
|
192
|
-
}>, Schema.Struct<{
|
|
193
|
-
readonly id: Schema.String;
|
|
194
|
-
readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
|
|
195
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
196
|
-
readonly base: Schema.String;
|
|
197
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
198
|
-
readonly cpu: Schema.Int;
|
|
199
|
-
readonly ramMib: Schema.Int;
|
|
200
|
-
readonly diskGib: Schema.Int;
|
|
201
|
-
readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
|
|
202
|
-
readonly made: Schema.Boolean;
|
|
203
|
-
readonly action: Schema.Struct<{
|
|
204
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
205
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
206
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
207
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
208
|
-
readonly message: Schema.String;
|
|
209
|
-
}>>;
|
|
210
|
-
}>;
|
|
211
|
-
readonly ssh: Schema.optionalKey<Schema.Struct<{
|
|
212
|
-
readonly host: Schema.String;
|
|
213
|
-
readonly port: Schema.Int;
|
|
214
|
-
readonly user: Schema.String;
|
|
215
|
-
}>>;
|
|
216
|
-
readonly hostKey: Schema.optionalKey<Schema.String>;
|
|
217
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"listCheckpoints", Schema.$Record<Schema.String, Schema.Never>, Schema.$Array<Schema.Struct<{
|
|
218
|
-
readonly id: Schema.String;
|
|
219
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
220
|
-
readonly machine: Schema.String;
|
|
221
|
-
readonly kind: Schema.Literals<readonly ["ram", "disk"]>;
|
|
222
|
-
readonly base: Schema.String;
|
|
223
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
224
|
-
readonly cpu: Schema.Int;
|
|
225
|
-
readonly ramMib: Schema.Int;
|
|
226
|
-
readonly diskGib: Schema.Int;
|
|
227
|
-
readonly action: Schema.Struct<{
|
|
228
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
229
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
230
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
231
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
232
|
-
readonly message: Schema.String;
|
|
233
|
-
}>>;
|
|
234
|
-
}>;
|
|
235
|
-
}>>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>, Action.Action<"getCheckpoint", Schema.Struct<{
|
|
236
|
-
readonly id: Schema.String;
|
|
237
|
-
}>, Schema.Struct<{
|
|
238
|
-
readonly id: Schema.String;
|
|
239
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
240
|
-
readonly machine: Schema.String;
|
|
241
|
-
readonly kind: Schema.Literals<readonly ["ram", "disk"]>;
|
|
242
|
-
readonly base: Schema.String;
|
|
243
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
244
|
-
readonly cpu: Schema.Int;
|
|
245
|
-
readonly ramMib: Schema.Int;
|
|
246
|
-
readonly diskGib: Schema.Int;
|
|
247
|
-
readonly action: Schema.Struct<{
|
|
248
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
249
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
250
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
251
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
252
|
-
readonly message: Schema.String;
|
|
253
|
-
}>>;
|
|
254
|
-
}>;
|
|
255
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>, Action.Action<"captureCheckpoint", Schema.Struct<{
|
|
256
|
-
readonly machine: Schema.String;
|
|
257
|
-
readonly name: Schema.String;
|
|
258
|
-
}>, Schema.Struct<{
|
|
259
|
-
readonly id: Schema.String;
|
|
260
|
-
readonly createdAt: Schema.DateTimeUtcFromString;
|
|
261
|
-
readonly machine: Schema.String;
|
|
262
|
-
readonly kind: Schema.Literals<readonly ["ram", "disk"]>;
|
|
263
|
-
readonly base: Schema.String;
|
|
264
|
-
readonly profile: Schema.optionalKey<Schema.String>;
|
|
265
|
-
readonly cpu: Schema.Int;
|
|
266
|
-
readonly ramMib: Schema.Int;
|
|
267
|
-
readonly diskGib: Schema.Int;
|
|
268
|
-
readonly action: Schema.Struct<{
|
|
269
|
-
readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
|
|
270
|
-
readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
|
|
271
|
-
readonly error: Schema.optionalKey<Schema.Struct<{
|
|
272
|
-
readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
|
|
273
|
-
readonly message: Schema.String;
|
|
274
|
-
}>>;
|
|
275
|
-
}>;
|
|
276
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"deleteCheckpoint", Schema.Struct<{
|
|
277
|
-
readonly id: Schema.String;
|
|
278
|
-
}>, Schema.Void, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"getHost", Schema.$Record<Schema.String, Schema.Never>, Schema.Struct<{
|
|
279
|
-
readonly id: Schema.String;
|
|
280
|
-
readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
|
|
281
|
-
readonly version: Schema.String;
|
|
282
|
-
readonly runtimeVersion: Schema.String;
|
|
283
|
-
readonly bases: Schema.$Array<Schema.String>;
|
|
284
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>, Action.Action<"getCapacity", Schema.$Record<Schema.String, Schema.Never>, Schema.$Array<Schema.Struct<{
|
|
285
|
-
readonly host: Schema.String;
|
|
286
|
-
readonly resource: Schema.Literals<readonly ["ramMib", "runningVms", "activeSandboxes", "startsPerMinute", "startsPerHour", "startsPerDay"]>;
|
|
287
|
-
readonly limit: Schema.Int;
|
|
288
|
-
readonly used: Schema.Int;
|
|
289
|
-
}>>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>], [], undefined>;
|
|
290
|
-
//#endregion
|
|
1
|
+
import { A as ConflictKind, B as Refused, C as Declared, D as Capacity, E as readTimeout, F as NotFound, G as hostErrors, H as Unavailable, I as NotMade, K as retryable, L as NotOffered, M as Internal, N as Invalid, O as ClankerboxError, P as Missing, R as NotReady, S as stateLabel, T as actionsByName, U as Unsizable, V as ScriptFailed, W as WrongState, _ as Setup, b as Usage, c as ActionRecord, d as CreateRequest, f as Host, g as Runtime, h as Reading, i as Interface, j as HostError, k as Conflict, l as ActionStatus, m as MachineSpec, n as CreateOptions$1, o as client_d_exports, p as Machine, s as ActionName, u as Checkpoint, v as SshEndpoint, w as Http, x as isReady, y as SshLogin, z as PinMismatch } from "./client-8af586hb.mjs";
|
|
2
|
+
import { Effect, FileSystem, Path, PlatformError, Schema, Scope } from "effect";
|
|
291
3
|
//#region src/ids.d.ts
|
|
292
|
-
/** A host's part of every ID it holds. */
|
|
293
4
|
export declare const HostId: Schema.String;
|
|
294
|
-
/**
|
|
5
|
+
/** Unique per host and per resource type. */
|
|
295
6
|
export declare const Name: Schema.String;
|
|
296
|
-
/** The parts of an ID: the host that holds the resource and the resource's name there. */
|
|
297
7
|
export interface IdParts {
|
|
298
8
|
readonly host: string;
|
|
299
9
|
readonly name: string;
|
|
300
10
|
}
|
|
301
|
-
/**
|
|
11
|
+
/** `<host>_<name>`: neither part contains `_`, so an ID has exactly one. */
|
|
302
12
|
export declare const Id: Schema.String;
|
|
303
|
-
/** Splits an ID at its `_` into host and name. */
|
|
304
13
|
export declare const parseId: (id: string) => Effect.Effect<IdParts, Invalid>;
|
|
305
|
-
/** Checks a name on its own, before it is joined to a host. */
|
|
306
14
|
export declare const parseName: (name: string) => Effect.Effect<string, Invalid>;
|
|
307
|
-
/**
|
|
15
|
+
/** Checks both parts and the whole. */
|
|
308
16
|
export declare const formatId: (host: string, name: string) => Effect.Effect<string, Invalid>;
|
|
309
17
|
declare namespace prebuild_d_exports {
|
|
310
|
-
export { Built, Created, build, create, nameOf };
|
|
18
|
+
export { Built, CreateOptions, Created, build, create, nameOf };
|
|
311
19
|
}
|
|
312
20
|
/**
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* image: a host only names it. The script holds whatever secrets a recipe carries, and the name
|
|
318
|
-
* 12 hex characters of a digest of it.
|
|
21
|
+
* A digest of the spec's label, base, sizes, setup script as sent, and the host's runtime
|
|
22
|
+
* version: a `ram` checkpoint restores only under the release that saved it, so after a runtime
|
|
23
|
+
* bump a create misses the old prebuild instead of failing to restore it. The setup's timeout and
|
|
24
|
+
* the base's image are no part of it.
|
|
319
25
|
*/
|
|
320
26
|
declare const nameOf: (spec: MachineSpec, host: Pick<Host, "runtimeVersion">) => Effect.Effect<string>;
|
|
27
|
+
/** `fresh` runs the setup even when the host has a prebuild of the spec. */
|
|
28
|
+
interface CreateOptions extends CreateOptions$1 {
|
|
29
|
+
readonly fresh?: boolean | undefined;
|
|
30
|
+
}
|
|
321
31
|
interface Created {
|
|
322
32
|
readonly machine: Machine;
|
|
323
33
|
/** The prebuild the machine was restored from; without one, its setup ran. */
|
|
324
34
|
readonly prebuild?: Checkpoint | undefined;
|
|
325
35
|
}
|
|
326
36
|
/**
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* none. Placement is the create's own, and a prebuild stays on the host that made it, so a spec
|
|
330
|
-
* placed on another host runs its setup. A failed restore is the reply.
|
|
37
|
+
* `client.create`, restoring the spec's prebuild when the host it is placed on has one whose
|
|
38
|
+
* capture is done, unless `fresh`. A failed restore is the reply.
|
|
331
39
|
*/
|
|
332
40
|
declare const create: (client: Interface, name: string, spec: MachineSpec, options?: CreateOptions) => Effect.Effect<Created, ClankerboxError>;
|
|
333
41
|
interface Built {
|
|
334
42
|
readonly checkpoint: Checkpoint;
|
|
335
|
-
/** Whether this call built it; false when it was already there. */
|
|
336
43
|
readonly built: boolean;
|
|
337
|
-
/**
|
|
338
|
-
* The ID of the machine that built it, when its delete failed: it may still run, holding its
|
|
339
|
-
* RAM, until it is deleted.
|
|
340
|
-
*/
|
|
44
|
+
/** The builder's ID when its delete failed: it may still run, holding its RAM. */
|
|
341
45
|
readonly leftover?: string | undefined;
|
|
342
46
|
}
|
|
343
47
|
/**
|
|
344
|
-
* Builds the spec's prebuild on the host a create of it
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
* Each build's machine has a random name of its own, and the host takes a checkpoint name once,
|
|
351
|
-
* so of two builds of one spec at once both run the setup and the second's capture is
|
|
352
|
-
* `Conflict`: neither touches the other's machine or prebuild. A build deletes its machine
|
|
353
|
-
* however it ends. If that fails after a failure, the first failure is the reply; after a
|
|
354
|
-
* capture, the prebuild is made, and the machine is the reply's `leftover`.
|
|
48
|
+
* Builds the spec's prebuild on the host a create of it is placed on, with a machine of its own
|
|
49
|
+
* that it deletes however it ends. A prebuild that is there and done is the answer, one that
|
|
50
|
+
* failed is deleted and built again, and one still running is `Conflict{busy}`, as its capture
|
|
51
|
+
* holds it. Of two builds of one spec at once, the second's capture is `Conflict`, and neither
|
|
52
|
+
* touches the other's machine.
|
|
355
53
|
*/
|
|
356
|
-
declare const build: (client: Interface, spec: MachineSpec
|
|
54
|
+
declare const build: (client: Interface, spec: MachineSpec & {
|
|
55
|
+
readonly setup: Setup;
|
|
56
|
+
}, options?: CreateOptions$1) => Effect.Effect<Built, ClankerboxError>;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/release.d.ts
|
|
59
|
+
/** Also the version of the clankerbox binaries it ships with. */
|
|
60
|
+
export declare const version: string;
|
|
61
|
+
/** major.minor: releases that share it speak the same API. */
|
|
62
|
+
export declare const release: (of: string) => string;
|
|
63
|
+
/** A host refuses a request whose `release` differs from its own, or that has none. */
|
|
64
|
+
export declare const versionHeader = "clankerbox-version";
|
|
357
65
|
//#endregion
|
|
358
66
|
//#region src/profile.d.ts
|
|
359
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* A client-side file that fills in a create's spec; hosts never see it. `setup.path` is a script
|
|
69
|
+
* file or a recipe directory, relative to the profile file.
|
|
70
|
+
*/
|
|
71
|
+
export declare const Profile: Schema.Struct<{
|
|
72
|
+
readonly base: Schema.String;
|
|
73
|
+
readonly cpu: Schema.Int;
|
|
74
|
+
readonly ramMib: Schema.Int;
|
|
75
|
+
readonly diskGib: Schema.Int;
|
|
76
|
+
readonly setup: Schema.optionalKey<Schema.Struct<{
|
|
77
|
+
readonly path: Schema.String;
|
|
78
|
+
readonly timeoutSeconds: Schema.optionalKey<Schema.Int>;
|
|
79
|
+
}>>;
|
|
80
|
+
readonly host: Schema.optionalKey<Schema.String>;
|
|
81
|
+
}>;
|
|
82
|
+
export type Profile = typeof Profile.Type;
|
|
83
|
+
/** `setup.path` resolved, and the file's name as `label`. */
|
|
360
84
|
export interface LoadedProfile extends Profile {
|
|
361
85
|
readonly label: string;
|
|
362
86
|
}
|
|
363
87
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* itself is read by whoever sends it, with `readSetup`.
|
|
88
|
+
* Its file name without `.json` is the machine's `profile` label. Unknown keys are refused. The
|
|
89
|
+
* setup itself is read by whoever sends it, with `readSetup`.
|
|
367
90
|
*/
|
|
368
91
|
export declare const loadProfile: (file: string) => Effect.Effect<LoadedProfile, Invalid, FileSystem.FileSystem | Path.Path>;
|
|
92
|
+
type Sizes = Omit<Profile, "setup" | "host">;
|
|
93
|
+
/** Each field given replaces the profile's. */
|
|
94
|
+
export type Overrides = { readonly [K in keyof Sizes]?: Sizes[K] | undefined; } & {
|
|
95
|
+
/** A setup script or recipe directory, already resolved. */
|
|
96
|
+
readonly setup?: string | undefined;
|
|
97
|
+
readonly setupTimeoutSeconds?: number | undefined;
|
|
98
|
+
readonly host?: string | undefined;
|
|
99
|
+
};
|
|
100
|
+
export interface SpecRequest {
|
|
101
|
+
readonly spec: MachineSpec;
|
|
102
|
+
readonly host: string | undefined;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The spec and host a create of `profile` asks for, with the overrides applied and the setup
|
|
106
|
+
* read. Each refusal names `what`, and each field as `names` calls it.
|
|
107
|
+
*/
|
|
108
|
+
export declare const specRequest: (what: string, profile: LoadedProfile | undefined, overrides: Overrides, names?: ReadonlyMap<PropertyKey, string>) => Effect.Effect<SpecRequest, Invalid, FileSystem.FileSystem | Path.Path>;
|
|
369
109
|
//#endregion
|
|
370
110
|
//#region src/setup.d.ts
|
|
371
111
|
/**
|
|
372
|
-
* Packs a recipe directory into one self-extracting script
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
* so nothing outside the recipe is packed, and in the guest nothing is written through one.
|
|
376
|
-
* Of a mode only the execute bit is kept, as git keeps it, so a checkout's umask changes
|
|
377
|
-
* nothing. Entries go in sorted order and nothing records a time or an owner, so the same
|
|
378
|
-
* files pack into the same script: a prebuild is named after it.
|
|
112
|
+
* Packs a recipe directory, a `setup.sh` and the files it needs, into one self-extracting script.
|
|
113
|
+
* Symlinks are recreated as they are and never walked into. The same files always pack into the
|
|
114
|
+
* same script, as a prebuild is named after it.
|
|
379
115
|
*/
|
|
380
116
|
export declare const packRecipe: (directory: string) => Effect.Effect<string, Invalid, FileSystem.FileSystem>;
|
|
381
|
-
/**
|
|
117
|
+
/** A script file's text, or a recipe directory packed into one script. */
|
|
382
118
|
export declare const readSetup: (path: string) => Effect.Effect<string, Invalid, FileSystem.FileSystem>;
|
|
383
119
|
//#endregion
|
|
384
120
|
//#region src/ssh.d.ts
|
|
385
|
-
/** What ssh needs of a machine: where it is reached, as whom, and the host key to pin. */
|
|
386
121
|
export interface SshTarget {
|
|
387
122
|
readonly id: string;
|
|
388
123
|
readonly login: SshLogin;
|
|
389
124
|
readonly hostKey: string;
|
|
390
125
|
}
|
|
391
126
|
/**
|
|
392
|
-
*
|
|
393
|
-
*
|
|
127
|
+
* Only a running machine has an endpoint, and only a prepared one a host key; a machine without
|
|
128
|
+
* either is `WrongState`, naming what it lacks and why.
|
|
394
129
|
*/
|
|
395
|
-
export declare const sshTarget: (machine: Machine) => SshTarget
|
|
396
|
-
readonly lacks: "SSH endpoint" | "SSH host key on record";
|
|
397
|
-
};
|
|
130
|
+
export declare const sshTarget: (machine: Machine) => Effect.Effect<SshTarget, WrongState>;
|
|
398
131
|
/**
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
* boat at every start, so a target is read anew for each ssh.
|
|
132
|
+
* ssh's arguments, pinned to the target's host key through a known-hosts file that lasts as long
|
|
133
|
+
* as the scope, which must outlast the ssh. Ports change on fork, restore, and every boat start,
|
|
134
|
+
* so read the target anew for each ssh.
|
|
403
135
|
*/
|
|
404
136
|
export declare const pinnedSsh: (target: SshTarget, user: string, extra: ReadonlyArray<string>) => Effect.Effect<Array<string>, PlatformError.PlatformError, FileSystem.FileSystem | Path.Path | Scope.Scope>;
|
|
405
137
|
//#endregion
|
|
406
|
-
//#region src/
|
|
407
|
-
/**
|
|
408
|
-
* A RAM size, exactly, as a size flag takes one: GiB when it is whole or half GiB, `32G` or
|
|
409
|
-
* `1.5G`, and MiB when it isn't, `512M` or `1500M`.
|
|
410
|
-
*/
|
|
411
|
-
export declare const formatMib: (mib: number) => string;
|
|
412
|
-
/**
|
|
413
|
-
* Everything a decode refused, on one line, each under its JSON path: `cpu: missing; ram: not a
|
|
414
|
-
* known field`. `names` renames top-level fields, as when a flag set each: `--cpu: missing`.
|
|
415
|
-
*/
|
|
138
|
+
//#region src/describe.d.ts
|
|
139
|
+
/** On one line: `cpu: missing; ram: not a known field`. `names` renames top-level fields. */
|
|
416
140
|
export declare const describeIssues: (error: Schema.SchemaError, names?: ReadonlyMap<PropertyKey, string>) => string;
|
|
417
141
|
/**
|
|
418
|
-
*
|
|
419
|
-
*
|
|
142
|
+
* Node describes a failure only in its cause, so what has no wording here reads as the system's
|
|
143
|
+
* own.
|
|
420
144
|
*/
|
|
421
145
|
export declare const describeFileError: ({ reason }: PlatformError.PlatformError) => string;
|
|
422
146
|
//#endregion
|
|
423
|
-
|
|
147
|
+
//#region src/sizes.d.ts
|
|
148
|
+
export declare const mibPerGib = 1024;
|
|
149
|
+
/** Exactly, as a size flag takes it: `32G`, `1.5G`, `512M`, `1500M`. */
|
|
150
|
+
export declare const formatMib: (mib: number) => string;
|
|
151
|
+
/** As a size flag takes it: `60G`. */
|
|
152
|
+
export declare const formatGib: (gib: number) => string;
|
|
153
|
+
//#endregion
|
|
154
|
+
export { ActionName, ActionRecord, ActionStatus, Capacity, Checkpoint, ClankerboxError, client_d_exports as Client, Conflict, ConflictKind, CreateRequest, Declared, Host, HostError, Http, Internal, Invalid, Machine, MachineSpec, Missing, NotFound, NotMade, NotOffered, NotReady, PinMismatch, prebuild_d_exports as Prebuild, Reading, Refused, Runtime, ScriptFailed, Setup, SshEndpoint, SshLogin, Unavailable, Unsizable, Usage, WrongState, actionsByName, hostErrors, isReady, readTimeout, retryable, stateLabel };
|