@gjermundgaraba/clankerbox-sdk 0.12.1 → 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,
@@ -107,8 +109,6 @@ const describeId = (id) => {
107
109
  };
108
110
  /** A full `<host>_<name>` ID. */
109
111
  const Id = Schema.String.check(Schema.makeFilter((id) => describeId(id) ?? true));
110
- /** Whether `create`'s target is a full ID rather than a bare name: a name has no `_`. */
111
- const isId = (target) => target.includes(separator);
112
112
  /** Splits an ID at its `_` into host and name. */
113
113
  const parseId = (id) => {
114
114
  const problem = describeId(id);
@@ -129,7 +129,7 @@ const formatId = (host, name) => {
129
129
  };
130
130
  //#endregion
131
131
  //#region package.json
132
- var version$1 = "0.12.1";
132
+ var version$1 = "0.13.0";
133
133
  //#endregion
134
134
  //#region src/resources.ts
135
135
  /** The resources a host reports: machines, checkpoints and the host itself. */
@@ -272,23 +272,10 @@ const Profile = Schema.Struct({
272
272
  //#endregion
273
273
  //#region src/api.ts
274
274
  /**
275
- * The host API: three effect-actions groups, served as JSON POST routes under `/api`.
276
- * A mutation replies when its action has finished.
277
- */
278
- /**
279
- * Without a policy, effect-actions answers undeclared or malformed input with an empty 400.
280
- * Schema issues never carry the rejected values, so a setup script never reaches a message.
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.
281
278
  */
282
- const schemaError = {
283
- invalid: {
284
- schema: Invalid,
285
- make: (failure) => new Invalid({ message: `the request doesn't match the action's input: ${failure.cause.message}` })
286
- },
287
- internal: {
288
- schema: Internal,
289
- make: () => new Internal({ message: "the host's reply did not encode" })
290
- }
291
- };
292
279
  /**
293
280
  * How long a client waits for a read's reply from one host, unless it sets its own. A host
294
281
  * bounds its own reads of runtime state under it, so a list answers in time.
@@ -306,89 +293,106 @@ const FromMachine = Schema.Struct({
306
293
  machine: Id,
307
294
  name: Name
308
295
  });
309
- const MachineGroup = ActionGroup.make({
310
- name: "machine",
311
- errors: hostErrors,
312
- schemaError
313
- }, Action.make("list", {
314
- description: "List the host's machines.",
315
- success: Schema.Array(Machine),
316
- access: "read"
317
- }), Action.make("get", {
318
- description: "Read one machine.",
319
- input: ById,
320
- success: Machine,
321
- access: "read"
322
- }), Action.make("create", {
323
- description: "Create a machine from a base, run its setup once, and prepare it.",
324
- input: CreateRequest,
325
- success: Machine,
326
- access: "write"
327
- }), Action.make("start", {
328
- description: "Start a machine. On a running machine, run preparation again.",
329
- input: ById,
330
- success: Machine,
331
- access: "write"
332
- }), Action.make("stop", {
333
- description: "Stop a machine. A stopped machine stays stopped, and the stop is still its last action.",
334
- input: ById,
335
- success: Machine,
336
- access: "write"
337
- }), Action.make("delete", {
338
- description: "Delete a machine and everything native it owns.",
339
- input: ById,
340
- success: Schema.Void,
341
- access: "write"
342
- }), Action.make("fork", {
343
- description: "Copy a machine to a new name on the same host.",
344
- input: FromMachine,
345
- success: Machine,
346
- access: "write"
347
- }), Action.make("restore", {
348
- description: "Create a machine on the checkpoint's host from that checkpoint.",
349
- input: Schema.Struct({
350
- checkpoint: Id,
351
- 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)
352
315
  }),
353
- success: Machine,
354
- access: "write"
355
- }));
356
- const CheckpointGroup = ActionGroup.make({
357
- name: "checkpoint",
358
- errors: hostErrors,
359
- schemaError
360
- }, Action.make("list", {
361
- description: "List the host's checkpoints.",
362
- success: Schema.Array(Checkpoint),
363
- access: "read"
364
- }), Action.make("get", {
365
- description: "Read one checkpoint.",
366
- input: ById,
367
- success: Checkpoint,
368
- access: "read"
369
- }), Action.make("capture", {
370
- 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.",
371
- input: FromMachine,
372
- success: Checkpoint,
373
- access: "write"
374
- }), Action.make("delete", {
375
- description: "Delete a checkpoint.",
376
- input: ById,
377
- success: Schema.Void,
378
- access: "write"
379
- }));
380
- const HostGroup = ActionGroup.make({
381
- name: "host",
382
- errors: hostErrors,
383
- schemaError
384
- }, Action.make("get", {
385
- description: "Read the host: its runtime, versions and bases.",
386
- success: Host,
387
- access: "read"
388
- }));
389
- 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" });
390
388
  //#endregion
391
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
+ */
392
396
  var client_exports = /* @__PURE__ */ __exportAll({
393
397
  Client: () => Client,
394
398
  HostEntry: () => HostEntry,
@@ -402,28 +406,26 @@ const HostEntry = Schema.Struct({
402
406
  var Client = class extends Context.Service()("@gjermundgaraba/clankerbox-sdk/Client") {};
403
407
  /**
404
408
  * A client for one host. Every request carries the SDK's version, which the host checks
405
- * against its own. Its reply decoding is the only step `transformResponse` wraps, so a reply
406
- * that doesn't decode is `Internal` here, and a `SchemaError` that reaches `settle` came from
407
- * 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.
408
411
  */
409
- const makeHostApi = (entry) => HttpApiClient.make(Http.api, {
412
+ const makeHostApi = (entry) => ActionHttp.client(Http, {
410
413
  baseUrl: entry.url,
411
- transformClient: HttpClient.mapRequest(HttpClientRequest.setHeader(versionHeader, version)),
412
- 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))
413
415
  });
414
- /** Every action's contract, keyed `<group>.<action>`: a call reads its access from its action. */
415
- 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);
416
418
  const causeDetail = (error) => error.cause instanceof Error ? error.cause.message : error.message;
417
419
  /**
418
420
  * No reply came: the connection failed or dropped, or the timeout passed. A mutation's
419
421
  * request may or may not have reached its host, so it may have run.
420
422
  */
421
- const unanswered = (context, detail) => context.access === "read" ? new Unavailable({
423
+ const unanswered = (context, detail) => context.readOnly ? new Unavailable({
422
424
  message: `host ${context.host.id} (${context.host.url}) didn't answer ${context.action}: ${detail}`,
423
- access: "read"
425
+ readOnly: context.readOnly
424
426
  }) : new Unavailable({
425
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`,
426
- access: "write"
428
+ readOnly: context.readOnly
427
429
  });
428
430
  /** Bounds the wait for the reply; the clock starts when the request is sent. */
429
431
  const bounded = (call, context) => {
@@ -433,10 +435,18 @@ const bounded = (call, context) => {
433
435
  orElse: () => Effect.fail(unanswered(context, `timed out after ${Duration.format(timeout)}`))
434
436
  });
435
437
  };
436
- 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({
437
- _tag: "DecodeError",
438
- cause: (cause) => cause !== void 0 && !(cause instanceof SyntaxError)
439
- }, () => 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
+ }));
440
450
  /** A host this client can use: it calls itself by its entry's ID. */
441
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` }));
442
452
  /** Every entry is checked here, so a call never meets a malformed URL. */
@@ -455,23 +465,18 @@ const make = (hosts, options) => Effect.gen(function* () {
455
465
  api
456
466
  })));
457
467
  const routes = new Map(routed.map((route) => [route.entry.id, route]));
458
- /** How long a call waits for its reply, by its action's access. */
459
- const bounds = {
460
- read: options?.readTimeout ?? readTimeout,
461
- write: options?.timeout
462
- };
463
468
  const route = (host) => {
464
469
  const found = routes.get(host);
465
470
  return found === void 0 ? Effect.fail(new Invalid({ message: `host ${host} isn't in the host list` })) : Effect.succeed(found);
466
471
  };
467
472
  /**
468
- * Sends one call to one host, bounded by its action's access. `target` is the ID to read
469
- * 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.
470
475
  */
471
- const ask = ({ entry, api }, contract, action, call, target) => settle(call(api), {
476
+ const ask = ({ entry, api }, { readOnly }, action, call, target) => settle(call(api), {
472
477
  host: entry,
473
- timeout: bounds[contract.access],
474
- access: contract.access,
478
+ timeout: readOnly ? options?.readTimeout ?? readTimeout : options?.timeout,
479
+ readOnly,
475
480
  action,
476
481
  target
477
482
  });
@@ -504,13 +509,13 @@ const make = (hosts, options) => Effect.gen(function* () {
504
509
  * Reads a host. IDs route by its entry's ID, so a host that calls itself something else
505
510
  * fails rather than being placed on.
506
511
  */
507
- 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)));
508
513
  const createOn = (host, name, spec) => Effect.gen(function* () {
509
514
  const id = yield* formatId(host, name);
510
- 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({
511
516
  ...spec,
512
517
  id
513
- } }), id);
518
+ }), id);
514
519
  });
515
520
  /**
516
521
  * Asks every host at once and goes through the answers in list order: the first host
@@ -540,15 +545,11 @@ const make = (hosts, options) => Effect.gen(function* () {
540
545
  const message = `no host offers base ${base}: ${misses.join("; ")}`;
541
546
  return yield* noReply ? new Unavailable({
542
547
  message,
543
- access: "read"
548
+ readOnly: true
544
549
  }) : new Precondition({ message });
545
550
  }).pipe(Effect.scoped);
546
- const create = (target, spec, options) => Effect.gen(function* () {
547
- if (isId(target)) {
548
- const { host, name } = yield* parseId(target);
549
- return yield* createOn(host, name, spec);
550
- }
551
- const name = yield* parseName(target);
551
+ const create = (name, spec, options) => Effect.gen(function* () {
552
+ yield* parseName(name);
552
553
  if (options?.host !== void 0) return yield* createOn(options.host, name, spec);
553
554
  return yield* createOn(yield* place(spec.base), name, spec);
554
555
  });
@@ -556,28 +557,28 @@ const make = (hosts, options) => Effect.gen(function* () {
556
557
  const sibling = (source, name) => Effect.flatMap(parseId(source), ({ host }) => formatId(host, name));
557
558
  return {
558
559
  hosts: gather((route) => Effect.map(readHost(route), (host) => [host])),
559
- machines: gather((route) => ask(route, actions["machine.list"], "list machines", (api) => api.machine.list({ payload: {} }))),
560
- checkpoints: gather((route) => ask(route, actions["checkpoint.list"], "list checkpoints", (api) => api.checkpoint.list({ payload: {} }))),
561
- machine: (id) => byId(id, actions["machine.get"], `get ${id}`, (api) => api.machine.get({ payload: { id } })),
562
- 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 })),
563
564
  create,
564
- start: (id) => byId(id, actions["machine.start"], `start ${id}`, (api) => api.machine.start({ payload: { id } })),
565
- stop: (id) => byId(id, actions["machine.stop"], `stop ${id}`, (api) => api.machine.stop({ payload: { id } })),
566
- delete: (id) => byId(id, actions["machine.delete"], `delete ${id}`, (api) => api.machine.delete({ payload: { id } })),
567
- 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({
568
569
  machine,
569
570
  name
570
- } }), made)),
571
- 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({
572
573
  checkpoint,
573
574
  name
574
- } }), made)),
575
- 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({
576
577
  machine,
577
578
  name
578
- } }), made)),
579
- 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 }))
580
581
  };
581
582
  });
582
583
  //#endregion
583
- export { Capacity as A, hostErrors as B, HostId as C, isId as D, formatId as E, Internal as F, Invalid as I, NotFound as L, ConflictKind as M, ErrorTag as N, parseId as O, HostErrorTag as P, Precondition 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, Conflict as j, parseName 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, Unavailable 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. */
@@ -253,7 +253,7 @@ interface Options {
253
253
  readonly readTimeout?: Duration.Duration | undefined;
254
254
  }
255
255
  interface CreateOptions {
256
- /** The host to create on, normally a profile's `host`. A full ID in `target` wins over it. */
256
+ /** The host to create on instead of placing by base: a `--host` flag or a profile's `host`. */
257
257
  readonly host?: string | undefined;
258
258
  }
259
259
  interface Interface {
@@ -264,10 +264,10 @@ interface Interface {
264
264
  readonly machine: (id: string) => Effect.Effect<Machine, ClankerboxError>;
265
265
  readonly checkpoint: (id: string) => Effect.Effect<Checkpoint, ClankerboxError>;
266
266
  /**
267
- * Creates a machine. `target` is a full ID, which names its host, or a name: then the
268
- * options' host, or else the first host in the list that offers the spec's base.
267
+ * Creates a machine named `name` on the options' host, or else on the first host in the
268
+ * list that offers the spec's base.
269
269
  */
270
- readonly create: (target: string, spec: MachineSpec, options?: CreateOptions) => Effect.Effect<Machine, ClankerboxError>;
270
+ readonly create: (name: string, spec: MachineSpec, options?: CreateOptions) => Effect.Effect<Machine, ClankerboxError>;
271
271
  readonly start: (id: string) => Effect.Effect<Machine, ClankerboxError>;
272
272
  readonly stop: (id: string) => Effect.Effect<Machine, ClankerboxError>;
273
273
  readonly delete: (id: string) => Effect.Effect<void, ClankerboxError>;
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-BVzrg2pq.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. */
@@ -539,8 +282,6 @@ export interface IdParts {
539
282
  }
540
283
  /** A full `<host>_<name>` ID. */
541
284
  export declare const Id: Schema.String;
542
- /** Whether `create`'s target is a full ID rather than a bare name: a name has no `_`. */
543
- export declare const isId: (target: string) => boolean;
544
285
  /** Splits an ID at its `_` into host and name. */
545
286
  export declare const parseId: (id: string) => Effect.Effect<IdParts, Invalid>;
546
287
  /** Checks a name on its own, before it is joined to a host. */
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as Capacity, B as hostErrors, C as HostId, D as isId, E as formatId, F as Internal, I as Invalid, L as NotFound, M as ConflictKind, N as ErrorTag, O as parseId, P as HostErrorTag, R as Precondition, 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 Conflict, k as parseName, 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 Unavailable } from "./client-CbgD_J1o.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, isId, 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-BVzrg2pq.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-CbgD_J1o.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.1",
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": {