@gjermundgaraba/clankerbox-sdk 0.12.2 → 0.13.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.
@@ -1,11 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
2
  import * as Action from "@gjermundgaraba/effect-actions/Action";
3
- import * as ActionGroup from "@gjermundgaraba/effect-actions/ActionGroup";
4
3
  import * as ActionHttp from "@gjermundgaraba/effect-actions/ActionHttp";
5
4
  import { Context, Duration, Effect, Fiber, Match, Predicate, Result, Schema } from "effect";
6
5
  import { HttpClient, HttpClientRequest } from "effect/http";
7
- import { HttpApiClient } from "effect/http-api";
8
6
  //#region src/errors.ts
7
+ /**
8
+ * The seven errors every clankerbox call can fail with. `retryable` is derived from the
9
+ * tag, so callers never keep their own table of which failures to repeat.
10
+ */
9
11
  /** The request is malformed: a bad ID or name, an undeclared field, a value out of range. */
10
12
  var Invalid = class extends Schema.TaggedError()("Invalid", { message: Schema.String }, { httpApiStatus: 400 }) {
11
13
  get retryable() {
@@ -42,15 +44,15 @@ var Capacity = class extends Schema.TaggedError()("Capacity", { message: Schema.
42
44
  };
43
45
  /**
44
46
  * The client couldn't reach the host, or lost its reply. Only the client library produces
45
- * it. `access` is the access of the action that met it: a mutation's request may have
46
- * reached the host and run, so it is never retryable.
47
+ * it. `readOnly` is that of the action that met it: a mutation's request may have reached
48
+ * the host and run, so it is never retryable.
47
49
  */
48
50
  var Unavailable = class extends Schema.TaggedError()("Unavailable", {
49
51
  message: Schema.String,
50
- access: Schema.Literals(["read", "write"])
52
+ readOnly: Schema.Boolean
51
53
  }) {
52
54
  get retryable() {
53
- return this.access === "read";
55
+ return this.readOnly;
54
56
  }
55
57
  };
56
58
  var Internal = class extends Schema.TaggedError()("Internal", { message: Schema.String }, { httpApiStatus: 500 }) {
@@ -58,7 +60,7 @@ var Internal = class extends Schema.TaggedError()("Internal", { message: Schema.
58
60
  return false;
59
61
  }
60
62
  };
61
- /** What a host answers with; every action group declares these. */
63
+ /** What a host answers with; every action declares these. */
62
64
  const hostErrors = [
63
65
  Invalid,
64
66
  NotFound,
@@ -127,7 +129,7 @@ const formatId = (host, name) => {
127
129
  };
128
130
  //#endregion
129
131
  //#region package.json
130
- var version$1 = "0.12.2";
132
+ var version$1 = "0.13.0";
131
133
  //#endregion
132
134
  //#region src/resources.ts
133
135
  /** The resources a host reports: machines, checkpoints and the host itself. */
@@ -270,24 +272,11 @@ const Profile = Schema.Struct({
270
272
  //#endregion
271
273
  //#region src/api.ts
272
274
  /**
273
- * The host API: three effect-actions groups, served as JSON POST routes under `/api`.
274
- * A mutation replies when its action has finished.
275
+ * The host API: one effect-actions binding, each action a JSON POST route at `/api/<action>`.
276
+ * A mutation replies when its action has finished. Every action is public: a host listens
277
+ * only on the tailnet or loopback.
275
278
  */
276
279
  /**
277
- * Without a policy, effect-actions answers undeclared or malformed input with an empty 400.
278
- * Schema issues never carry the rejected values, so a setup script never reaches a message.
279
- */
280
- const schemaError = {
281
- invalid: {
282
- schema: Invalid,
283
- make: (failure) => new Invalid({ message: `the request doesn't match the action's input: ${failure.cause.message}` })
284
- },
285
- internal: {
286
- schema: Internal,
287
- make: () => new Internal({ message: "the host's reply did not encode" })
288
- }
289
- };
290
- /**
291
280
  * How long a client waits for a read's reply from one host, unless it sets its own. A host
292
281
  * bounds its own reads of runtime state under it, so a list answers in time.
293
282
  */
@@ -304,89 +293,106 @@ const FromMachine = Schema.Struct({
304
293
  machine: Id,
305
294
  name: Name
306
295
  });
307
- const MachineGroup = ActionGroup.make({
308
- name: "machine",
309
- errors: hostErrors,
310
- schemaError
311
- }, Action.make("list", {
312
- description: "List the host's machines.",
313
- success: Schema.Array(Machine),
314
- access: "read"
315
- }), Action.make("get", {
316
- description: "Read one machine.",
317
- input: ById,
318
- success: Machine,
319
- access: "read"
320
- }), Action.make("create", {
321
- description: "Create a machine from a base, run its setup once, and prepare it.",
322
- input: CreateRequest,
323
- success: Machine,
324
- access: "write"
325
- }), Action.make("start", {
326
- description: "Start a machine. On a running machine, run preparation again.",
327
- input: ById,
328
- success: Machine,
329
- access: "write"
330
- }), Action.make("stop", {
331
- description: "Stop a machine. A stopped machine stays stopped, and the stop is still its last action.",
332
- input: ById,
333
- success: Machine,
334
- access: "write"
335
- }), Action.make("delete", {
336
- description: "Delete a machine and everything native it owns.",
337
- input: ById,
338
- success: Schema.Void,
339
- access: "write"
340
- }), Action.make("fork", {
341
- description: "Copy a machine to a new name on the same host.",
342
- input: FromMachine,
343
- success: Machine,
344
- access: "write"
345
- }), Action.make("restore", {
346
- description: "Create a machine on the checkpoint's host from that checkpoint.",
347
- input: Schema.Struct({
348
- checkpoint: Id,
349
- name: Name
296
+ /**
297
+ * What every action shares, by whether it reads or changes the host. Every action declares
298
+ * `hostErrors`, so a client decodes the `Invalid` the host's version check answers with.
299
+ */
300
+ const read = {
301
+ caller: Action.Anyone,
302
+ error: hostErrors,
303
+ readOnly: true
304
+ };
305
+ const write = {
306
+ caller: Action.Anyone,
307
+ error: hostErrors,
308
+ readOnly: false
309
+ };
310
+ const Http = ActionHttp.make([
311
+ Action.make("listMachines", {
312
+ ...read,
313
+ description: "List the host's machines.",
314
+ success: Schema.Array(Machine)
350
315
  }),
351
- success: Machine,
352
- access: "write"
353
- }));
354
- const CheckpointGroup = ActionGroup.make({
355
- name: "checkpoint",
356
- errors: hostErrors,
357
- schemaError
358
- }, Action.make("list", {
359
- description: "List the host's checkpoints.",
360
- success: Schema.Array(Checkpoint),
361
- access: "read"
362
- }), Action.make("get", {
363
- description: "Read one checkpoint.",
364
- input: ById,
365
- success: Checkpoint,
366
- access: "read"
367
- }), Action.make("capture", {
368
- description: "Capture a checkpoint of a machine. Its kind follows the runtime: ram on smolvm, which captures only a running machine, and disk on Tart and boat.",
369
- input: FromMachine,
370
- success: Checkpoint,
371
- access: "write"
372
- }), Action.make("delete", {
373
- description: "Delete a checkpoint.",
374
- input: ById,
375
- success: Schema.Void,
376
- access: "write"
377
- }));
378
- const HostGroup = ActionGroup.make({
379
- name: "host",
380
- errors: hostErrors,
381
- schemaError
382
- }, Action.make("get", {
383
- description: "Read the host: its runtime, versions and bases.",
384
- success: Host,
385
- access: "read"
386
- }));
387
- const Http = ActionHttp.make({ apiPath: "/api" }, MachineGroup, CheckpointGroup, HostGroup);
316
+ Action.make("getMachine", {
317
+ ...read,
318
+ description: "Read one machine.",
319
+ input: ById,
320
+ success: Machine
321
+ }),
322
+ Action.make("createMachine", {
323
+ ...write,
324
+ description: "Create a machine from a base, run its setup once, and prepare it.",
325
+ input: CreateRequest,
326
+ success: Machine
327
+ }),
328
+ Action.make("startMachine", {
329
+ ...write,
330
+ description: "Start a machine. On a running machine, run preparation again.",
331
+ input: ById,
332
+ success: Machine
333
+ }),
334
+ Action.make("stopMachine", {
335
+ ...write,
336
+ description: "Stop a machine. A stopped machine stays stopped, and the stop is still its last action.",
337
+ input: ById,
338
+ success: Machine
339
+ }),
340
+ Action.make("deleteMachine", {
341
+ ...write,
342
+ description: "Delete a machine and everything native it owns.",
343
+ input: ById
344
+ }),
345
+ Action.make("forkMachine", {
346
+ ...write,
347
+ description: "Copy a machine to a new name on the same host.",
348
+ input: FromMachine,
349
+ success: Machine
350
+ }),
351
+ Action.make("restoreMachine", {
352
+ ...write,
353
+ description: "Create a machine on the checkpoint's host from that checkpoint.",
354
+ input: Schema.Struct({
355
+ checkpoint: Id,
356
+ name: Name
357
+ }),
358
+ success: Machine
359
+ }),
360
+ Action.make("listCheckpoints", {
361
+ ...read,
362
+ description: "List the host's checkpoints.",
363
+ success: Schema.Array(Checkpoint)
364
+ }),
365
+ Action.make("getCheckpoint", {
366
+ ...read,
367
+ description: "Read one checkpoint.",
368
+ input: ById,
369
+ success: Checkpoint
370
+ }),
371
+ Action.make("captureCheckpoint", {
372
+ ...write,
373
+ description: "Capture a checkpoint of a machine. Its kind follows the runtime: ram on smolvm, which captures only a running machine, and disk on Tart and boat.",
374
+ input: FromMachine,
375
+ success: Checkpoint
376
+ }),
377
+ Action.make("deleteCheckpoint", {
378
+ ...write,
379
+ description: "Delete a checkpoint.",
380
+ input: ById
381
+ }),
382
+ Action.make("getHost", {
383
+ ...read,
384
+ description: "Read the host: its runtime, versions and bases.",
385
+ success: Host
386
+ })
387
+ ], { prefix: "/api" });
388
388
  //#endregion
389
389
  //#region src/client.ts
390
+ /**
391
+ * The client library: a host list in placement order, routing by ID, list fan-out and
392
+ * create placement. Nothing here retries: a mutation whose reply is lost, or that outlasts
393
+ * the client's mutation timeout, is `Unavailable`, and the caller reads the resource to see
394
+ * what happened.
395
+ */
390
396
  var client_exports = /* @__PURE__ */ __exportAll({
391
397
  Client: () => Client,
392
398
  HostEntry: () => HostEntry,
@@ -400,28 +406,26 @@ const HostEntry = Schema.Struct({
400
406
  var Client = class extends Context.Service()("@gjermundgaraba/clankerbox-sdk/Client") {};
401
407
  /**
402
408
  * A client for one host. Every request carries the SDK's version, which the host checks
403
- * against its own. Its reply decoding is the only step `transformResponse` wraps, so a reply
404
- * that doesn't decode is `Internal` here, and a `SchemaError` that reaches `settle` came from
405
- * encoding the request.
409
+ * against its own. Input that doesn't encode fails as `InvalidInput` before anything is
410
+ * sent, so a `SchemaError` that reaches `settle` is a reply that didn't decode.
406
411
  */
407
- const makeHostApi = (entry) => HttpApiClient.make(Http.api, {
412
+ const makeHostApi = (entry) => ActionHttp.client(Http, {
408
413
  baseUrl: entry.url,
409
- transformClient: HttpClient.mapRequest(HttpClientRequest.setHeader(versionHeader, version)),
410
- transformResponse: (reply) => Effect.mapError(reply, (error) => Schema.isSchemaError(error) ? new Internal({ message: `host ${entry.id}'s reply didn't decode: ${error.message}` }) : error)
414
+ transformClient: HttpClient.mapRequest(HttpClientRequest.setHeader(versionHeader, version))
411
415
  });
412
- /** Every action's contract, keyed `<group>.<action>`: a call reads its access from its action. */
413
- const actions = ActionGroup.contracts(MachineGroup, CheckpointGroup, HostGroup);
416
+ /** Every action's contract, by name: a call's timeout and retry follow its `readOnly`. */
417
+ const actions = Action.byName(Http.actions);
414
418
  const causeDetail = (error) => error.cause instanceof Error ? error.cause.message : error.message;
415
419
  /**
416
420
  * No reply came: the connection failed or dropped, or the timeout passed. A mutation's
417
421
  * request may or may not have reached its host, so it may have run.
418
422
  */
419
- const unanswered = (context, detail) => context.access === "read" ? new Unavailable({
423
+ const unanswered = (context, detail) => context.readOnly ? new Unavailable({
420
424
  message: `host ${context.host.id} (${context.host.url}) didn't answer ${context.action}: ${detail}`,
421
- access: "read"
425
+ readOnly: context.readOnly
422
426
  }) : new Unavailable({
423
427
  message: `no reply from host ${context.host.id} to ${context.action} (${detail}); the action may have run: read ${context.target ?? "the resource"} to see`,
424
- access: "write"
428
+ readOnly: context.readOnly
425
429
  });
426
430
  /** Bounds the wait for the reply; the clock starts when the request is sent. */
427
431
  const bounded = (call, context) => {
@@ -431,10 +435,18 @@ const bounded = (call, context) => {
431
435
  orElse: () => Effect.fail(unanswered(context, `timed out after ${Duration.format(timeout)}`))
432
436
  });
433
437
  };
434
- const settle = (call, context) => bounded(call, context).pipe(Effect.catchTag("HttpClientError", (error) => Effect.fail(Match.value(error.reason).pipe(Match.tag("TransportError", () => unanswered(context, causeDetail(error))), Match.when({
435
- _tag: "DecodeError",
436
- cause: (cause) => cause !== void 0 && !(cause instanceof SyntaxError)
437
- }, () => unanswered(context, causeDetail(error))), Match.orElse(() => new Internal({ message: `host ${context.host.id} answered ${context.action} unexpectedly: ${error.message}` }))))), Effect.catchTag("SchemaError", (error) => Effect.fail(new Invalid({ message: `${context.action}: the request doesn't match the action's input: ${error.message}` }))));
438
+ /** The host answered with something the call doesn't expect. */
439
+ const unexpected = (context, error) => new Internal({ message: `host ${context.host.id} answered ${context.action} unexpectedly: ${error.message}` });
440
+ const settle = (call, context) => bounded(call, context).pipe(Effect.catchTags({
441
+ HttpClientError: (error) => Effect.fail(Match.value(error.reason).pipe(Match.tag("TransportError", () => unanswered(context, causeDetail(error))), Match.when({
442
+ _tag: "DecodeError",
443
+ cause: (cause) => cause !== void 0 && !(cause instanceof SyntaxError)
444
+ }, () => unanswered(context, causeDetail(error))), Match.orElse(() => unexpected(context, error)))),
445
+ InvalidInput: (error) => Effect.fail(new Invalid({ message: `${context.action}: the request doesn't match the action's input: ${error.message}` })),
446
+ SchemaError: (error) => Effect.fail(new Internal({ message: `host ${context.host.id}'s reply didn't decode: ${error.message}` })),
447
+ Unauthenticated: (error) => Effect.fail(unexpected(context, error)),
448
+ Forbidden: (error) => Effect.fail(unexpected(context, error))
449
+ }));
438
450
  /** A host this client can use: it calls itself by its entry's ID. */
439
451
  const checkHost = (entry, host) => host.id === entry.id ? Effect.succeed(host) : Effect.fail(new Invalid({ message: `host ${entry.id} (${entry.url}) calls itself ${host.id}; its entry in the host list must use that ID` }));
440
452
  /** Every entry is checked here, so a call never meets a malformed URL. */
@@ -453,23 +465,18 @@ const make = (hosts, options) => Effect.gen(function* () {
453
465
  api
454
466
  })));
455
467
  const routes = new Map(routed.map((route) => [route.entry.id, route]));
456
- /** How long a call waits for its reply, by its action's access. */
457
- const bounds = {
458
- read: options?.readTimeout ?? readTimeout,
459
- write: options?.timeout
460
- };
461
468
  const route = (host) => {
462
469
  const found = routes.get(host);
463
470
  return found === void 0 ? Effect.fail(new Invalid({ message: `host ${host} isn't in the host list` })) : Effect.succeed(found);
464
471
  };
465
472
  /**
466
- * Sends one call to one host, bounded by its action's access. `target` is the ID to read
467
- * when a mutation's reply is lost.
473
+ * Sends one call to one host, bounded by the read or the mutation timeout. `target` is the
474
+ * ID to read when a mutation's reply is lost.
468
475
  */
469
- const ask = ({ entry, api }, contract, action, call, target) => settle(call(api), {
476
+ const ask = ({ entry, api }, { readOnly }, action, call, target) => settle(call(api), {
470
477
  host: entry,
471
- timeout: bounds[contract.access],
472
- access: contract.access,
478
+ timeout: readOnly ? options?.readTimeout ?? readTimeout : options?.timeout,
479
+ readOnly,
473
480
  action,
474
481
  target
475
482
  });
@@ -502,13 +509,13 @@ const make = (hosts, options) => Effect.gen(function* () {
502
509
  * Reads a host. IDs route by its entry's ID, so a host that calls itself something else
503
510
  * fails rather than being placed on.
504
511
  */
505
- const readHost = (route) => ask(route, actions["host.get"], "get host", (api) => Effect.flatMap(api.host.get({ payload: {} }), (host) => checkHost(route.entry, host)));
512
+ const readHost = (route) => ask(route, actions.getHost, "get host", (api) => Effect.flatMap(api.getHost(), (host) => checkHost(route.entry, host)));
506
513
  const createOn = (host, name, spec) => Effect.gen(function* () {
507
514
  const id = yield* formatId(host, name);
508
- return yield* ask(yield* route(host), actions["machine.create"], `create ${id}`, (api) => api.machine.create({ payload: {
515
+ return yield* ask(yield* route(host), actions.createMachine, `create ${id}`, (api) => api.createMachine({
509
516
  ...spec,
510
517
  id
511
- } }), id);
518
+ }), id);
512
519
  });
513
520
  /**
514
521
  * Asks every host at once and goes through the answers in list order: the first host
@@ -538,7 +545,7 @@ const make = (hosts, options) => Effect.gen(function* () {
538
545
  const message = `no host offers base ${base}: ${misses.join("; ")}`;
539
546
  return yield* noReply ? new Unavailable({
540
547
  message,
541
- access: "read"
548
+ readOnly: true
542
549
  }) : new Precondition({ message });
543
550
  }).pipe(Effect.scoped);
544
551
  const create = (name, spec, options) => Effect.gen(function* () {
@@ -550,28 +557,28 @@ const make = (hosts, options) => Effect.gen(function* () {
550
557
  const sibling = (source, name) => Effect.flatMap(parseId(source), ({ host }) => formatId(host, name));
551
558
  return {
552
559
  hosts: gather((route) => Effect.map(readHost(route), (host) => [host])),
553
- machines: gather((route) => ask(route, actions["machine.list"], "list machines", (api) => api.machine.list({ payload: {} }))),
554
- checkpoints: gather((route) => ask(route, actions["checkpoint.list"], "list checkpoints", (api) => api.checkpoint.list({ payload: {} }))),
555
- machine: (id) => byId(id, actions["machine.get"], `get ${id}`, (api) => api.machine.get({ payload: { id } })),
556
- checkpoint: (id) => byId(id, actions["checkpoint.get"], `get ${id}`, (api) => api.checkpoint.get({ payload: { id } })),
560
+ machines: gather((route) => ask(route, actions.listMachines, "list machines", (api) => api.listMachines())),
561
+ checkpoints: gather((route) => ask(route, actions.listCheckpoints, "list checkpoints", (api) => api.listCheckpoints())),
562
+ machine: (id) => byId(id, actions.getMachine, `get ${id}`, (api) => api.getMachine({ id })),
563
+ checkpoint: (id) => byId(id, actions.getCheckpoint, `get ${id}`, (api) => api.getCheckpoint({ id })),
557
564
  create,
558
- start: (id) => byId(id, actions["machine.start"], `start ${id}`, (api) => api.machine.start({ payload: { id } })),
559
- stop: (id) => byId(id, actions["machine.stop"], `stop ${id}`, (api) => api.machine.stop({ payload: { id } })),
560
- delete: (id) => byId(id, actions["machine.delete"], `delete ${id}`, (api) => api.machine.delete({ payload: { id } })),
561
- fork: (machine, name) => Effect.flatMap(sibling(machine, name), (made) => byId(machine, actions["machine.fork"], `fork ${machine} to ${made}`, (api) => api.machine.fork({ payload: {
565
+ start: (id) => byId(id, actions.startMachine, `start ${id}`, (api) => api.startMachine({ id })),
566
+ stop: (id) => byId(id, actions.stopMachine, `stop ${id}`, (api) => api.stopMachine({ id })),
567
+ delete: (id) => byId(id, actions.deleteMachine, `delete ${id}`, (api) => api.deleteMachine({ id })),
568
+ fork: (machine, name) => Effect.flatMap(sibling(machine, name), (made) => byId(machine, actions.forkMachine, `fork ${machine} to ${made}`, (api) => api.forkMachine({
562
569
  machine,
563
570
  name
564
- } }), made)),
565
- restore: (checkpoint, name) => Effect.flatMap(sibling(checkpoint, name), (made) => byId(checkpoint, actions["machine.restore"], `restore ${checkpoint} to ${made}`, (api) => api.machine.restore({ payload: {
571
+ }), made)),
572
+ restore: (checkpoint, name) => Effect.flatMap(sibling(checkpoint, name), (made) => byId(checkpoint, actions.restoreMachine, `restore ${checkpoint} to ${made}`, (api) => api.restoreMachine({
566
573
  checkpoint,
567
574
  name
568
- } }), made)),
569
- capture: (machine, name) => Effect.flatMap(sibling(machine, name), (made) => byId(machine, actions["checkpoint.capture"], `capture ${machine} to ${made}`, (api) => api.checkpoint.capture({ payload: {
575
+ }), made)),
576
+ capture: (machine, name) => Effect.flatMap(sibling(machine, name), (made) => byId(machine, actions.captureCheckpoint, `capture ${machine} to ${made}`, (api) => api.captureCheckpoint({
570
577
  machine,
571
578
  name
572
- } }), made)),
573
- deleteCheckpoint: (id) => byId(id, actions["checkpoint.delete"], `delete ${id}`, (api) => api.checkpoint.delete({ payload: { id } }))
579
+ }), made)),
580
+ deleteCheckpoint: (id) => byId(id, actions.deleteCheckpoint, `delete ${id}`, (api) => api.deleteCheckpoint({ id }))
574
581
  };
575
582
  });
576
583
  //#endregion
577
- export { Conflict as A, HostId as C, parseId as D, formatId as E, Invalid as F, NotFound as I, Precondition as L, ErrorTag as M, HostErrorTag as N, parseName as O, Internal as P, Unavailable as R, version as S, Name as T, Profile as _, HostGroup as a, SshEndpoint as b, readTimeout as c, ActionRecord as d, Checkpoint as f, MachineSpec as g, Machine as h, CheckpointGroup as i, ConflictKind as j, Capacity as k, versionHeader as l, Host as m, client_exports as n, Http as o, CreateRequest as p, make as r, MachineGroup as s, Client as t, ActionName as u, Runtime as v, Id as w, release as x, Setup as y, hostErrors as z };
584
+ export { HostErrorTag as A, formatId as C, Conflict as D, Capacity as E, Unavailable as F, hostErrors as I, Invalid as M, NotFound as N, ConflictKind as O, Precondition as P, Name as S, parseName as T, SshEndpoint as _, readTimeout as a, HostId as b, ActionRecord as c, Host as d, Machine as f, Setup as g, Runtime as h, Http as i, Internal as j, ErrorTag as k, Checkpoint as l, Profile as m, client_exports as n, versionHeader as o, MachineSpec as p, make as r, ActionName as s, Client as t, CreateRequest as u, release as v, parseId as w, Id as x, version as y };
@@ -41,12 +41,12 @@ declare class Capacity extends Capacity_base {
41
41
  }
42
42
  declare const Unavailable_base: Schema.Class<Unavailable, Schema.TaggedStruct<"Unavailable", {
43
43
  readonly message: Schema.String;
44
- readonly access: Schema.Literals<("read" | "write")[]>;
44
+ readonly readOnly: Schema.Boolean;
45
45
  }>, import("effect/Cause").YieldableError>;
46
46
  /**
47
47
  * The client couldn't reach the host, or lost its reply. Only the client library produces
48
- * it. `access` is the access of the action that met it: a mutation's request may have
49
- * reached the host and run, so it is never retryable.
48
+ * it. `readOnly` is that of the action that met it: a mutation's request may have reached
49
+ * the host and run, so it is never retryable.
50
50
  */
51
51
  declare class Unavailable extends Unavailable_base {
52
52
  get retryable(): boolean;
@@ -57,7 +57,7 @@ declare const Internal_base: Schema.Class<Internal, Schema.TaggedStruct<"Interna
57
57
  declare class Internal extends Internal_base {
58
58
  get retryable(): boolean;
59
59
  }
60
- /** What a host answers with; every action group declares these. */
60
+ /** What a host answers with; every action declares these. */
61
61
  declare const hostErrors: readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal];
62
62
  type HostError = InstanceType<(typeof hostErrors)[number]>;
63
63
  /** What a call through the client library fails with. */
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { A as hostErrors, C as HostError, D as NotFound, E as Invalid, O as Precondition, S as ErrorTag, T as Internal, _ as version, a as ActionName, b as Conflict, c as CreateRequest, d as MachineSpec, f as Profile, g as release, h as SshEndpoint, i as client_d_exports, k as Unavailable, l as Host, m as Setup, o as ActionRecord, p as Runtime, s as Checkpoint, u as Machine, v as Capacity, w as HostErrorTag, x as ConflictKind, y as ClankerboxError } from "./client-C6ll48AB.mjs";
1
+ import { A as hostErrors, C as HostError, D as NotFound, E as Invalid, O as Precondition, S as ErrorTag, T as Internal, _ as version, a as ActionName, b as Conflict, c as CreateRequest, d as MachineSpec, f as Profile, g as release, h as SshEndpoint, i as client_d_exports, k as Unavailable, l as Host, m as Setup, o as ActionRecord, p as Runtime, s as Checkpoint, u as Machine, v as Capacity, w as HostErrorTag, x as ConflictKind, y as ClankerboxError } from "./client-mIuehl40.mjs";
2
2
  import * as Action from "@gjermundgaraba/effect-actions/Action";
3
- import * as ActionGroup from "@gjermundgaraba/effect-actions/ActionGroup";
4
3
  import * as ActionHttp from "@gjermundgaraba/effect-actions/ActionHttp";
5
4
  import { Duration, Effect, FileSystem, Path, Schema } from "effect";
6
5
  import { ChildProcessSpawner } from "effect/process";
@@ -16,7 +15,7 @@ export declare const readTimeout: Duration.Duration;
16
15
  * anything.
17
16
  */
18
17
  export declare const versionHeader = "clankerbox-version";
19
- export declare const MachineGroup: ActionGroup.Group<"machine", readonly [Action.Action<"list", Schema.$Record<Schema.String, Schema.Never>, Schema.$Array<Schema.Struct<{
18
+ export declare const Http: ActionHttp.Binding<readonly [Action.Action<"listMachines", Schema.$Record<Schema.String, Schema.Never>, Schema.$Array<Schema.Struct<{
20
19
  readonly id: Schema.String;
21
20
  readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
22
21
  readonly createdAt: Schema.DateTimeUtcFromString;
@@ -39,7 +38,7 @@ export declare const MachineGroup: ActionGroup.Group<"machine", readonly [Action
39
38
  readonly port: Schema.Int;
40
39
  }>>;
41
40
  readonly hostKey: Schema.optionalKey<Schema.String>;
42
- }>>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>, Action.Action<"get", Schema.Struct<{
41
+ }>>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>, Action.Action<"getMachine", Schema.Struct<{
43
42
  readonly id: Schema.String;
44
43
  }>, Schema.Struct<{
45
44
  readonly id: Schema.String;
@@ -64,7 +63,7 @@ export declare const MachineGroup: ActionGroup.Group<"machine", readonly [Action
64
63
  readonly port: Schema.Int;
65
64
  }>>;
66
65
  readonly hostKey: Schema.optionalKey<Schema.String>;
67
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>, Action.Action<"create", Schema.Struct<{
66
+ }>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>, Action.Action<"createMachine", Schema.Struct<{
68
67
  readonly base: Schema.String;
69
68
  readonly cpu: Schema.Int;
70
69
  readonly ramMib: Schema.Int;
@@ -98,7 +97,7 @@ export declare const MachineGroup: ActionGroup.Group<"machine", readonly [Action
98
97
  readonly port: Schema.Int;
99
98
  }>>;
100
99
  readonly hostKey: Schema.optionalKey<Schema.String>;
101
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"start", Schema.Struct<{
100
+ }>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"startMachine", Schema.Struct<{
102
101
  readonly id: Schema.String;
103
102
  }>, Schema.Struct<{
104
103
  readonly id: Schema.String;
@@ -123,7 +122,7 @@ export declare const MachineGroup: ActionGroup.Group<"machine", readonly [Action
123
122
  readonly port: Schema.Int;
124
123
  }>>;
125
124
  readonly hostKey: Schema.optionalKey<Schema.String>;
126
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"stop", Schema.Struct<{
125
+ }>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"stopMachine", Schema.Struct<{
127
126
  readonly id: Schema.String;
128
127
  }>, Schema.Struct<{
129
128
  readonly id: Schema.String;
@@ -148,9 +147,9 @@ export declare const MachineGroup: ActionGroup.Group<"machine", readonly [Action
148
147
  readonly port: Schema.Int;
149
148
  }>>;
150
149
  readonly hostKey: Schema.optionalKey<Schema.String>;
151
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"delete", Schema.Struct<{
150
+ }>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"deleteMachine", Schema.Struct<{
152
151
  readonly id: Schema.String;
153
- }>, Schema.Void, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"fork", Schema.Struct<{
152
+ }>, Schema.Void, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"forkMachine", Schema.Struct<{
154
153
  readonly machine: Schema.String;
155
154
  readonly name: Schema.String;
156
155
  }>, Schema.Struct<{
@@ -176,7 +175,7 @@ export declare const MachineGroup: ActionGroup.Group<"machine", readonly [Action
176
175
  readonly port: Schema.Int;
177
176
  }>>;
178
177
  readonly hostKey: Schema.optionalKey<Schema.String>;
179
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"restore", Schema.Struct<{
178
+ }>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"restoreMachine", Schema.Struct<{
180
179
  readonly checkpoint: Schema.String;
181
180
  readonly name: Schema.String;
182
181
  }>, Schema.Struct<{
@@ -202,8 +201,7 @@ export declare const MachineGroup: ActionGroup.Group<"machine", readonly [Action
202
201
  readonly port: Schema.Int;
203
202
  }>>;
204
203
  readonly hostKey: Schema.optionalKey<Schema.String>;
205
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>], typeof Invalid | typeof Internal>;
206
- export declare const CheckpointGroup: ActionGroup.Group<"checkpoint", readonly [Action.Action<"list", Schema.$Record<Schema.String, Schema.Never>, Schema.$Array<Schema.Struct<{
204
+ }>, 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<{
207
205
  readonly id: Schema.String;
208
206
  readonly createdAt: Schema.DateTimeUtcFromString;
209
207
  readonly machine: Schema.String;
@@ -221,7 +219,7 @@ export declare const CheckpointGroup: ActionGroup.Group<"checkpoint", readonly [
221
219
  readonly message: Schema.String;
222
220
  }>>;
223
221
  }>;
224
- }>>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>, Action.Action<"get", Schema.Struct<{
222
+ }>>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>, Action.Action<"getCheckpoint", Schema.Struct<{
225
223
  readonly id: Schema.String;
226
224
  }>, Schema.Struct<{
227
225
  readonly id: Schema.String;
@@ -241,7 +239,7 @@ export declare const CheckpointGroup: ActionGroup.Group<"checkpoint", readonly [
241
239
  readonly message: Schema.String;
242
240
  }>>;
243
241
  }>;
244
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>, Action.Action<"capture", Schema.Struct<{
242
+ }>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>, Action.Action<"captureCheckpoint", Schema.Struct<{
245
243
  readonly machine: Schema.String;
246
244
  readonly name: Schema.String;
247
245
  }>, Schema.Struct<{
@@ -262,270 +260,15 @@ export declare const CheckpointGroup: ActionGroup.Group<"checkpoint", readonly [
262
260
  readonly message: Schema.String;
263
261
  }>>;
264
262
  }>;
265
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"delete", Schema.Struct<{
263
+ }>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], false, typeof Action.Anyone>, Action.Action<"deleteCheckpoint", Schema.Struct<{
266
264
  readonly id: Schema.String;
267
- }>, Schema.Void, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>], typeof Invalid | typeof Internal>;
268
- export declare const HostGroup: ActionGroup.Group<"host", readonly [Action.Action<"get", Schema.$Record<Schema.String, Schema.Never>, Schema.Struct<{
265
+ }>, 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<{
269
266
  readonly id: Schema.String;
270
267
  readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
271
268
  readonly version: Schema.String;
272
269
  readonly runtimeVersion: Schema.String;
273
270
  readonly bases: Schema.$Array<Schema.String>;
274
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>], typeof Invalid | typeof Internal>;
275
- export declare const Http: ActionHttp.Http<readonly [ActionGroup.Group<"machine", readonly [Action.Action<"list", Schema.$Record<Schema.String, Schema.Never>, Schema.$Array<Schema.Struct<{
276
- readonly id: Schema.String;
277
- readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
278
- readonly createdAt: Schema.DateTimeUtcFromString;
279
- readonly base: Schema.String;
280
- readonly profile: Schema.optionalKey<Schema.String>;
281
- readonly cpu: Schema.Int;
282
- readonly ramMib: Schema.Int;
283
- readonly diskGib: Schema.Int;
284
- readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
285
- readonly action: Schema.Struct<{
286
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
287
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
288
- readonly error: Schema.optionalKey<Schema.Struct<{
289
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
290
- readonly message: Schema.String;
291
- }>>;
292
- }>;
293
- readonly ssh: Schema.optionalKey<Schema.Struct<{
294
- readonly host: Schema.String;
295
- readonly port: Schema.Int;
296
- }>>;
297
- readonly hostKey: Schema.optionalKey<Schema.String>;
298
- }>>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>, Action.Action<"get", Schema.Struct<{
299
- readonly id: Schema.String;
300
- }>, Schema.Struct<{
301
- readonly id: Schema.String;
302
- readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
303
- readonly createdAt: Schema.DateTimeUtcFromString;
304
- readonly base: Schema.String;
305
- readonly profile: Schema.optionalKey<Schema.String>;
306
- readonly cpu: Schema.Int;
307
- readonly ramMib: Schema.Int;
308
- readonly diskGib: Schema.Int;
309
- readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
310
- readonly action: Schema.Struct<{
311
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
312
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
313
- readonly error: Schema.optionalKey<Schema.Struct<{
314
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
315
- readonly message: Schema.String;
316
- }>>;
317
- }>;
318
- readonly ssh: Schema.optionalKey<Schema.Struct<{
319
- readonly host: Schema.String;
320
- readonly port: Schema.Int;
321
- }>>;
322
- readonly hostKey: Schema.optionalKey<Schema.String>;
323
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>, Action.Action<"create", Schema.Struct<{
324
- readonly base: Schema.String;
325
- readonly cpu: Schema.Int;
326
- readonly ramMib: Schema.Int;
327
- readonly diskGib: Schema.Int;
328
- readonly setup: Schema.optionalKey<Schema.Struct<{
329
- readonly script: Schema.String;
330
- readonly timeoutSeconds: Schema.Int;
331
- }>>;
332
- readonly profile: Schema.optionalKey<Schema.String>;
333
- readonly id: Schema.String;
334
- }>, Schema.Struct<{
335
- readonly id: Schema.String;
336
- readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
337
- readonly createdAt: Schema.DateTimeUtcFromString;
338
- readonly base: Schema.String;
339
- readonly profile: Schema.optionalKey<Schema.String>;
340
- readonly cpu: Schema.Int;
341
- readonly ramMib: Schema.Int;
342
- readonly diskGib: Schema.Int;
343
- readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
344
- readonly action: Schema.Struct<{
345
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
346
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
347
- readonly error: Schema.optionalKey<Schema.Struct<{
348
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
349
- readonly message: Schema.String;
350
- }>>;
351
- }>;
352
- readonly ssh: Schema.optionalKey<Schema.Struct<{
353
- readonly host: Schema.String;
354
- readonly port: Schema.Int;
355
- }>>;
356
- readonly hostKey: Schema.optionalKey<Schema.String>;
357
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"start", Schema.Struct<{
358
- readonly id: Schema.String;
359
- }>, Schema.Struct<{
360
- readonly id: Schema.String;
361
- readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
362
- readonly createdAt: Schema.DateTimeUtcFromString;
363
- readonly base: Schema.String;
364
- readonly profile: Schema.optionalKey<Schema.String>;
365
- readonly cpu: Schema.Int;
366
- readonly ramMib: Schema.Int;
367
- readonly diskGib: Schema.Int;
368
- readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
369
- readonly action: Schema.Struct<{
370
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
371
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
372
- readonly error: Schema.optionalKey<Schema.Struct<{
373
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
374
- readonly message: Schema.String;
375
- }>>;
376
- }>;
377
- readonly ssh: Schema.optionalKey<Schema.Struct<{
378
- readonly host: Schema.String;
379
- readonly port: Schema.Int;
380
- }>>;
381
- readonly hostKey: Schema.optionalKey<Schema.String>;
382
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"stop", Schema.Struct<{
383
- readonly id: Schema.String;
384
- }>, Schema.Struct<{
385
- readonly id: Schema.String;
386
- readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
387
- readonly createdAt: Schema.DateTimeUtcFromString;
388
- readonly base: Schema.String;
389
- readonly profile: Schema.optionalKey<Schema.String>;
390
- readonly cpu: Schema.Int;
391
- readonly ramMib: Schema.Int;
392
- readonly diskGib: Schema.Int;
393
- readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
394
- readonly action: Schema.Struct<{
395
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
396
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
397
- readonly error: Schema.optionalKey<Schema.Struct<{
398
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
399
- readonly message: Schema.String;
400
- }>>;
401
- }>;
402
- readonly ssh: Schema.optionalKey<Schema.Struct<{
403
- readonly host: Schema.String;
404
- readonly port: Schema.Int;
405
- }>>;
406
- readonly hostKey: Schema.optionalKey<Schema.String>;
407
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"delete", Schema.Struct<{
408
- readonly id: Schema.String;
409
- }>, Schema.Void, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"fork", Schema.Struct<{
410
- readonly machine: Schema.String;
411
- readonly name: Schema.String;
412
- }>, Schema.Struct<{
413
- readonly id: Schema.String;
414
- readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
415
- readonly createdAt: Schema.DateTimeUtcFromString;
416
- readonly base: Schema.String;
417
- readonly profile: Schema.optionalKey<Schema.String>;
418
- readonly cpu: Schema.Int;
419
- readonly ramMib: Schema.Int;
420
- readonly diskGib: Schema.Int;
421
- readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
422
- readonly action: Schema.Struct<{
423
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
424
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
425
- readonly error: Schema.optionalKey<Schema.Struct<{
426
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
427
- readonly message: Schema.String;
428
- }>>;
429
- }>;
430
- readonly ssh: Schema.optionalKey<Schema.Struct<{
431
- readonly host: Schema.String;
432
- readonly port: Schema.Int;
433
- }>>;
434
- readonly hostKey: Schema.optionalKey<Schema.String>;
435
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"restore", Schema.Struct<{
436
- readonly checkpoint: Schema.String;
437
- readonly name: Schema.String;
438
- }>, Schema.Struct<{
439
- readonly id: Schema.String;
440
- readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
441
- readonly createdAt: Schema.DateTimeUtcFromString;
442
- readonly base: Schema.String;
443
- readonly profile: Schema.optionalKey<Schema.String>;
444
- readonly cpu: Schema.Int;
445
- readonly ramMib: Schema.Int;
446
- readonly diskGib: Schema.Int;
447
- readonly state: Schema.Literals<readonly ["running", "stopped", "missing", "unknown"]>;
448
- readonly action: Schema.Struct<{
449
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
450
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
451
- readonly error: Schema.optionalKey<Schema.Struct<{
452
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
453
- readonly message: Schema.String;
454
- }>>;
455
- }>;
456
- readonly ssh: Schema.optionalKey<Schema.Struct<{
457
- readonly host: Schema.String;
458
- readonly port: Schema.Int;
459
- }>>;
460
- readonly hostKey: Schema.optionalKey<Schema.String>;
461
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>], typeof Invalid | typeof Internal>, ActionGroup.Group<"checkpoint", readonly [Action.Action<"list", Schema.$Record<Schema.String, Schema.Never>, Schema.$Array<Schema.Struct<{
462
- readonly id: Schema.String;
463
- readonly createdAt: Schema.DateTimeUtcFromString;
464
- readonly machine: Schema.String;
465
- readonly kind: Schema.Literals<readonly ["ram", "disk"]>;
466
- readonly base: Schema.String;
467
- readonly profile: Schema.optionalKey<Schema.String>;
468
- readonly cpu: Schema.Int;
469
- readonly ramMib: Schema.Int;
470
- readonly diskGib: Schema.Int;
471
- readonly action: Schema.Struct<{
472
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
473
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
474
- readonly error: Schema.optionalKey<Schema.Struct<{
475
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
476
- readonly message: Schema.String;
477
- }>>;
478
- }>;
479
- }>>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>, Action.Action<"get", Schema.Struct<{
480
- readonly id: Schema.String;
481
- }>, Schema.Struct<{
482
- readonly id: Schema.String;
483
- readonly createdAt: Schema.DateTimeUtcFromString;
484
- readonly machine: Schema.String;
485
- readonly kind: Schema.Literals<readonly ["ram", "disk"]>;
486
- readonly base: Schema.String;
487
- readonly profile: Schema.optionalKey<Schema.String>;
488
- readonly cpu: Schema.Int;
489
- readonly ramMib: Schema.Int;
490
- readonly diskGib: Schema.Int;
491
- readonly action: Schema.Struct<{
492
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
493
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
494
- readonly error: Schema.optionalKey<Schema.Struct<{
495
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
496
- readonly message: Schema.String;
497
- }>>;
498
- }>;
499
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>, Action.Action<"capture", Schema.Struct<{
500
- readonly machine: Schema.String;
501
- readonly name: Schema.String;
502
- }>, Schema.Struct<{
503
- readonly id: Schema.String;
504
- readonly createdAt: Schema.DateTimeUtcFromString;
505
- readonly machine: Schema.String;
506
- readonly kind: Schema.Literals<readonly ["ram", "disk"]>;
507
- readonly base: Schema.String;
508
- readonly profile: Schema.optionalKey<Schema.String>;
509
- readonly cpu: Schema.Int;
510
- readonly ramMib: Schema.Int;
511
- readonly diskGib: Schema.Int;
512
- readonly action: Schema.Struct<{
513
- readonly name: Schema.Literals<readonly ["create", "start", "stop", "delete", "fork", "restore", "capture"]>;
514
- readonly status: Schema.Literals<readonly ["running", "failed", "done"]>;
515
- readonly error: Schema.optionalKey<Schema.Struct<{
516
- readonly tag: Schema.Literals<("Capacity" | "Conflict" | "Internal" | "Invalid" | "NotFound" | "Precondition")[]>;
517
- readonly message: Schema.String;
518
- }>>;
519
- }>;
520
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>, Action.Action<"delete", Schema.Struct<{
521
- readonly id: Schema.String;
522
- }>, Schema.Void, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "write", undefined>], typeof Invalid | typeof Internal>, ActionGroup.Group<"host", readonly [Action.Action<"get", Schema.$Record<Schema.String, Schema.Never>, Schema.Struct<{
523
- readonly id: Schema.String;
524
- readonly runtime: Schema.Literals<readonly ["smolvm", "tart", "boat"]>;
525
- readonly version: Schema.String;
526
- readonly runtimeVersion: Schema.String;
527
- readonly bases: Schema.$Array<Schema.String>;
528
- }>, readonly [typeof Invalid, typeof NotFound, typeof Conflict, typeof Precondition, typeof Capacity, typeof Internal], "read", undefined>], typeof Invalid | typeof Internal>], []>;
271
+ }>, readonly (typeof Invalid | typeof NotFound | typeof Conflict | typeof Precondition | typeof Capacity | typeof Internal)[], true, typeof Action.Anyone>], [], undefined>;
529
272
  //#endregion
530
273
  //#region src/ids.d.ts
531
274
  /** A host's part of every ID it holds. */
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as Conflict, C as HostId, D as parseId, E as formatId, F as Invalid, I as NotFound, L as Precondition, M as ErrorTag, N as HostErrorTag, O as parseName, P as Internal, R as Unavailable, S as version, T as Name, _ as Profile, a as HostGroup, b as SshEndpoint, c as readTimeout, d as ActionRecord, f as Checkpoint, g as MachineSpec, h as Machine, i as CheckpointGroup, j as ConflictKind, k as Capacity, l as versionHeader, m as Host, n as client_exports, o as Http, p as CreateRequest, s as MachineGroup, u as ActionName, v as Runtime, w as Id, x as release, y as Setup, z as hostErrors } from "./client-DXuiPvxU.mjs";
1
+ import { A as HostErrorTag, C as formatId, D as Conflict, E as Capacity, F as Unavailable, I as hostErrors, M as Invalid, N as NotFound, O as ConflictKind, P as Precondition, S as Name, T as parseName, _ as SshEndpoint, a as readTimeout, b as HostId, c as ActionRecord, d as Host, f as Machine, g as Setup, h as Runtime, i as Http, j as Internal, k as ErrorTag, l as Checkpoint, m as Profile, n as client_exports, o as versionHeader, p as MachineSpec, s as ActionName, u as CreateRequest, v as release, w as parseId, x as Id, y as version } from "./client-Bb5qTz-i.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, CheckpointGroup, client_exports as Client, Conflict, ConflictKind, CreateRequest, ErrorTag, Host, HostErrorTag, HostGroup, HostId, Http, Id, Internal, Invalid, Machine, MachineGroup, 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, 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 { E as Invalid, n as HostEntry, r as Options, t as Client } from "./client-C6ll48AB.mjs";
1
+ import { E as Invalid, n as HostEntry, r as Options, t as Client } from "./client-mIuehl40.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
@@ -1,4 +1,4 @@
1
- import { r as make, t as Client } from "./client-DXuiPvxU.mjs";
1
+ import { r as make, t as Client } from "./client-Bb5qTz-i.mjs";
2
2
  import { Layer } from "effect";
3
3
  import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";
4
4
  //#region src/node.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjermundgaraba/clankerbox-sdk",
3
- "version": "0.12.2",
3
+ "version": "0.13.0",
4
4
  "description": "clankerbox's API contract and client library, for Effect",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,19 +28,19 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@gjermundgaraba/effect-actions": "0.9.0"
31
+ "@gjermundgaraba/effect-actions": "0.11.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@effect/platform-node": "4.0.0",
34
+ "@effect/platform-node": "4.0.2",
35
35
  "@types/node": "26.6.4",
36
- "effect": "4.0.0",
36
+ "effect": "4.0.2",
37
37
  "typescript": "7.0.2",
38
- "vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
39
- "vite-plus": "1.0.0"
38
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.1.0",
39
+ "vite-plus": "1.1.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "@effect/platform-node": "^4.0.0",
43
- "effect": "^4.0.0"
42
+ "@effect/platform-node": "~4.0.2",
43
+ "effect": "~4.0.2"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "@effect/platform-node": {