@gjermundgaraba/clankerbox-sdk 0.13.0 → 0.14.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.
|
@@ -161,6 +161,22 @@ declare const Host: Schema.Struct<{
|
|
|
161
161
|
readonly bases: Schema.$Array<Schema.String>;
|
|
162
162
|
}>;
|
|
163
163
|
type Host = typeof Host.Type;
|
|
164
|
+
/**
|
|
165
|
+
* One limit a host's `Capacity` refusals come from, and how much of it is in use, counted as
|
|
166
|
+
* the refusal counts it, so `used` needn't match the host's own machines. Read from the runtime,
|
|
167
|
+
* never stored.
|
|
168
|
+
*/
|
|
169
|
+
declare const Limit: Schema.Struct<{
|
|
170
|
+
readonly host: Schema.String;
|
|
171
|
+
/**
|
|
172
|
+
* `ramMib`: smolvm's RAM budget. `runningVms`: Tart's, Apple's two VMs per Mac.
|
|
173
|
+
* `activeSandboxes` and the `starts` of each rolling window: the boat account's.
|
|
174
|
+
*/
|
|
175
|
+
readonly resource: Schema.Literals<readonly ["ramMib", "runningVms", "activeSandboxes", "startsPerMinute", "startsPerHour", "startsPerDay"]>;
|
|
176
|
+
readonly limit: Schema.Int;
|
|
177
|
+
readonly used: Schema.Int;
|
|
178
|
+
}>;
|
|
179
|
+
type Limit = typeof Limit.Type;
|
|
164
180
|
/** A setup script and how long it may run. Nothing logs the script: it can carry secrets. */
|
|
165
181
|
declare const Setup: Schema.Struct<{
|
|
166
182
|
readonly script: Schema.String;
|
|
@@ -261,6 +277,8 @@ interface Interface {
|
|
|
261
277
|
readonly hosts: Effect.Effect<Gathered<Host>>;
|
|
262
278
|
readonly machines: Effect.Effect<Gathered<Machine>>;
|
|
263
279
|
readonly checkpoints: Effect.Effect<Gathered<Checkpoint>>;
|
|
280
|
+
/** Every host's limits; a host whose runtime couldn't be read is among the unreachable. */
|
|
281
|
+
readonly capacity: Effect.Effect<Gathered<Limit>>;
|
|
264
282
|
readonly machine: (id: string) => Effect.Effect<Machine, ClankerboxError>;
|
|
265
283
|
readonly checkpoint: (id: string) => Effect.Effect<Checkpoint, ClankerboxError>;
|
|
266
284
|
/**
|
|
@@ -286,4 +304,4 @@ declare class Client extends Client_base {}
|
|
|
286
304
|
*/
|
|
287
305
|
declare const make: (hosts: ReadonlyArray<HostEntry>, options?: Options) => Effect.Effect<Interface, Invalid, HttpClient.HttpClient>;
|
|
288
306
|
//#endregion
|
|
289
|
-
export {
|
|
307
|
+
export { Unavailable as A, ErrorTag as C, Invalid as D, Internal as E, NotFound as O, ConflictKind as S, HostErrorTag as T, release as _, ActionName as a, ClankerboxError as b, CreateRequest as c, Machine as d, MachineSpec as f, SshEndpoint as g, Setup as h, client_d_exports as i, hostErrors as j, Precondition as k, Host as l, Runtime as m, HostEntry as n, ActionRecord as o, Profile as p, Options as r, Checkpoint as s, Client as t, Limit as u, version as v, HostError as w, Conflict as x, Capacity as y };
|
|
@@ -129,7 +129,7 @@ const formatId = (host, name) => {
|
|
|
129
129
|
};
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region package.json
|
|
132
|
-
var version$1 = "0.
|
|
132
|
+
var version$1 = "0.14.0";
|
|
133
133
|
//#endregion
|
|
134
134
|
//#region src/resources.ts
|
|
135
135
|
/** The resources a host reports: machines, checkpoints and the host itself. */
|
|
@@ -225,6 +225,28 @@ const Host = Schema.Struct({
|
|
|
225
225
|
runtimeVersion: Schema.String,
|
|
226
226
|
bases: Schema.Array(Schema.String)
|
|
227
227
|
}).annotate({ identifier: "Host" });
|
|
228
|
+
/**
|
|
229
|
+
* One limit a host's `Capacity` refusals come from, and how much of it is in use, counted as
|
|
230
|
+
* the refusal counts it, so `used` needn't match the host's own machines. Read from the runtime,
|
|
231
|
+
* never stored.
|
|
232
|
+
*/
|
|
233
|
+
const Limit = Schema.Struct({
|
|
234
|
+
host: HostId,
|
|
235
|
+
/**
|
|
236
|
+
* `ramMib`: smolvm's RAM budget. `runningVms`: Tart's, Apple's two VMs per Mac.
|
|
237
|
+
* `activeSandboxes` and the `starts` of each rolling window: the boat account's.
|
|
238
|
+
*/
|
|
239
|
+
resource: Schema.Literals([
|
|
240
|
+
"ramMib",
|
|
241
|
+
"runningVms",
|
|
242
|
+
"activeSandboxes",
|
|
243
|
+
"startsPerMinute",
|
|
244
|
+
"startsPerHour",
|
|
245
|
+
"startsPerDay"
|
|
246
|
+
]),
|
|
247
|
+
limit: Schema.Int,
|
|
248
|
+
used: Schema.Int
|
|
249
|
+
}).annotate({ identifier: "Limit" });
|
|
228
250
|
/** A setup script and how long it may run. Nothing logs the script: it can carry secrets. */
|
|
229
251
|
const Setup = Schema.Struct({
|
|
230
252
|
script: Schema.String,
|
|
@@ -383,6 +405,11 @@ const Http = ActionHttp.make([
|
|
|
383
405
|
...read,
|
|
384
406
|
description: "Read the host: its runtime, versions and bases.",
|
|
385
407
|
success: Host
|
|
408
|
+
}),
|
|
409
|
+
Action.make("getCapacity", {
|
|
410
|
+
...read,
|
|
411
|
+
description: "Read the host's limits and how much of each is in use. It fails when the runtime can't be read.",
|
|
412
|
+
success: Schema.Array(Limit)
|
|
386
413
|
})
|
|
387
414
|
], { prefix: "/api" });
|
|
388
415
|
//#endregion
|
|
@@ -559,6 +586,7 @@ const make = (hosts, options) => Effect.gen(function* () {
|
|
|
559
586
|
hosts: gather((route) => Effect.map(readHost(route), (host) => [host])),
|
|
560
587
|
machines: gather((route) => ask(route, actions.listMachines, "list machines", (api) => api.listMachines())),
|
|
561
588
|
checkpoints: gather((route) => ask(route, actions.listCheckpoints, "list checkpoints", (api) => api.listCheckpoints())),
|
|
589
|
+
capacity: gather((route) => ask(route, actions.getCapacity, "get capacity", (api) => api.getCapacity())),
|
|
562
590
|
machine: (id) => byId(id, actions.getMachine, `get ${id}`, (api) => api.getMachine({ id })),
|
|
563
591
|
checkpoint: (id) => byId(id, actions.getCheckpoint, `get ${id}`, (api) => api.getCheckpoint({ id })),
|
|
564
592
|
create,
|
|
@@ -581,4 +609,4 @@ const make = (hosts, options) => Effect.gen(function* () {
|
|
|
581
609
|
};
|
|
582
610
|
});
|
|
583
611
|
//#endregion
|
|
584
|
-
export {
|
|
612
|
+
export { ErrorTag as A, Name as C, Capacity as D, parseName as E, Precondition as F, Unavailable as I, hostErrors as L, Internal as M, Invalid as N, Conflict as O, NotFound as P, Id as S, parseId as T, Setup as _, readTimeout as a, version as b, ActionRecord as c, Host as d, Limit as f, Runtime as g, Profile as h, Http as i, HostErrorTag as j, ConflictKind as k, Checkpoint as l, MachineSpec as m, client_exports as n, versionHeader as o, Machine as p, make as r, ActionName as s, Client as t, CreateRequest as u, SshEndpoint as v, formatId as w, HostId as x, release as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as Unavailable, C as ErrorTag, D as Invalid, E as Internal, O as NotFound, S as ConflictKind, T as HostErrorTag, _ as release, a as ActionName, b as ClankerboxError, c as CreateRequest, d as Machine, f as MachineSpec, g as SshEndpoint, h as Setup, i as client_d_exports, j as hostErrors, k as Precondition, l as Host, m as Runtime, o as ActionRecord, p as Profile, s as Checkpoint, u as Limit, v as version, w as HostError, x as Conflict, y as Capacity } from "./client-D63Z17YP.mjs";
|
|
2
2
|
import * as Action from "@gjermundgaraba/effect-actions/Action";
|
|
3
3
|
import * as ActionHttp from "@gjermundgaraba/effect-actions/ActionHttp";
|
|
4
4
|
import { Duration, Effect, FileSystem, Path, Schema } from "effect";
|
|
@@ -268,7 +268,12 @@ export declare const Http: ActionHttp.Binding<readonly [Action.Action<"listMachi
|
|
|
268
268
|
readonly version: Schema.String;
|
|
269
269
|
readonly runtimeVersion: Schema.String;
|
|
270
270
|
readonly bases: Schema.$Array<Schema.String>;
|
|
271
|
-
}>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone
|
|
271
|
+
}>, 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<{
|
|
272
|
+
readonly host: Schema.String;
|
|
273
|
+
readonly resource: Schema.Literals<readonly ["ramMib", "runningVms", "activeSandboxes", "startsPerMinute", "startsPerHour", "startsPerDay"]>;
|
|
274
|
+
readonly limit: Schema.Int;
|
|
275
|
+
readonly used: Schema.Int;
|
|
276
|
+
}>>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>], [], undefined>;
|
|
272
277
|
//#endregion
|
|
273
278
|
//#region src/ids.d.ts
|
|
274
279
|
/** A host's part of every ID it holds. */
|
|
@@ -311,4 +316,4 @@ export declare const packRecipe: (directory: string) => Effect.Effect<string, In
|
|
|
311
316
|
/** Reads a setup: a script file's text, or a recipe directory packed into one script. */
|
|
312
317
|
export declare const readSetup: (path: string) => Effect.Effect<string, Invalid, FileSystem.FileSystem | ChildProcessSpawner.ChildProcessSpawner>;
|
|
313
318
|
//#endregion
|
|
314
|
-
export { ActionName, ActionRecord, Capacity, Checkpoint, ClankerboxError, client_d_exports as Client, Conflict, ConflictKind, CreateRequest, ErrorTag, Host, HostError, HostErrorTag, Internal, Invalid, Machine, MachineSpec, NotFound, Precondition, Profile, Runtime, Setup, SshEndpoint, Unavailable, hostErrors, release, version };
|
|
319
|
+
export { ActionName, ActionRecord, Capacity, Checkpoint, ClankerboxError, client_d_exports as Client, Conflict, ConflictKind, CreateRequest, ErrorTag, Host, HostError, HostErrorTag, Internal, Invalid, Limit, Machine, MachineSpec, NotFound, Precondition, Profile, Runtime, Setup, SshEndpoint, Unavailable, hostErrors, release, version };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as ErrorTag, C as Name, D as Capacity, E as parseName, F as Precondition, I as Unavailable, L as hostErrors, M as Internal, N as Invalid, O as Conflict, P as NotFound, S as Id, T as parseId, _ as Setup, a as readTimeout, b as version, c as ActionRecord, d as Host, f as Limit, g as Runtime, h as Profile, i as Http, j as HostErrorTag, k as ConflictKind, l as Checkpoint, m as MachineSpec, n as client_exports, o as versionHeader, p as Machine, s as ActionName, u as CreateRequest, v as SshEndpoint, w as formatId, x as HostId, y as release } from "./client-DSd3saH0.mjs";
|
|
2
2
|
import { Effect, FileSystem, Path, Predicate, Schema, Stream } from "effect";
|
|
3
3
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
4
4
|
//#region src/profile.ts
|
|
@@ -103,4 +103,4 @@ const readSetup = (path) => Effect.gen(function* () {
|
|
|
103
103
|
return yield* fs.readFileString(path);
|
|
104
104
|
}).pipe(Effect.catchTag("PlatformError", (error) => Effect.fail(new Invalid({ message: `couldn't read setup ${path}: ${error.message}` }))));
|
|
105
105
|
//#endregion
|
|
106
|
-
export { ActionName, ActionRecord, Capacity, Checkpoint, client_exports as Client, Conflict, ConflictKind, CreateRequest, ErrorTag, Host, HostErrorTag, HostId, Http, Id, Internal, Invalid, Machine, MachineSpec, Name, NotFound, Precondition, Profile, Runtime, Setup, SshEndpoint, Unavailable, formatId, hostErrors, loadProfile, packRecipe, parseId, parseName, readSetup, readTimeout, release, version, versionHeader };
|
|
106
|
+
export { ActionName, ActionRecord, Capacity, Checkpoint, client_exports as Client, Conflict, ConflictKind, CreateRequest, ErrorTag, Host, HostErrorTag, HostId, Http, Id, Internal, Invalid, Limit, Machine, MachineSpec, Name, NotFound, Precondition, Profile, Runtime, Setup, SshEndpoint, Unavailable, formatId, hostErrors, loadProfile, packRecipe, parseId, parseName, readSetup, readTimeout, release, version, versionHeader };
|
package/dist/node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as Invalid, n as HostEntry, r as Options, t as Client } from "./client-D63Z17YP.mjs";
|
|
2
2
|
import { Layer } from "effect";
|
|
3
3
|
//#region src/node.d.ts
|
|
4
4
|
/** Node's `http` module sets no timeout of its own: a mutation can run for hours. */
|
package/dist/node.mjs
CHANGED