@sealant/api-contracts-next 0.40.0-next.869 → 0.40.0-next.872

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,5 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
3
+ import { boatFailureSchema } from "./boat-failures.js";
3
4
  import { BudgetExceededError } from "./budgets.js";
4
5
  import { connectedAccountProviderSchema } from "./connected-accounts.js";
5
6
  import { EndpointUrl } from "./endpoint-url.js";
@@ -176,6 +177,11 @@ export const workspacePublicationSchema = Schema.Union([
176
177
  export const workspaceErrorSchema = Schema.Struct({
177
178
  message: Schema.String,
178
179
  code: Schema.optional(NonEmptyString),
180
+ /**
181
+ * Why Boat refused, or did not answer, the call that failed this Boat workspace's launch or image
182
+ * build: the kind, and Boat's own code, message and request id. Absent for any other failure.
183
+ */
184
+ boat: Schema.optional(boatFailureSchema),
179
185
  });
180
186
  export const githubWorkspaceSourceSelectionSchema = Schema.Struct({
181
187
  provider: Schema.Literal("github"),
@@ -745,6 +751,81 @@ export const inspectWorkspaceImageResponseSchema = Schema.Struct({
745
751
  /** The image's per-person capability (`unknown` when none has been built yet). */
746
752
  personLayout: workspaceImagePersonLayoutSchema,
747
753
  });
754
+ /** What a runtime does not do, with the sentence a person choosing an environment reads. */
755
+ export const runtimeUnsupportedSchema = Schema.Struct({
756
+ supported: Schema.Literal(false),
757
+ message: NonEmptyString,
758
+ });
759
+ /** Whether a runtime does one thing. A create that asks for an unsupported one is refused. */
760
+ export const runtimeCapabilitySchema = Schema.Union([
761
+ Schema.Struct({ supported: Schema.Literal(true) }),
762
+ runtimeUnsupportedSchema,
763
+ ]);
764
+ /** The CPU architectures a runtime's workspaces run on. */
765
+ export const runtimeArchitectures = ["x86_64", "aarch64"];
766
+ export const runtimeArchitectureSchema = Schema.Literals(runtimeArchitectures);
767
+ /** The managed OS families a workspace image is built from. */
768
+ export const runtimeOsFamilies = ["ubuntu", "nix", "arch", "fedora"];
769
+ /**
770
+ * What one runtime supports, from the same rules a create is refused by: a create that asks a
771
+ * runtime for an item it marks unsupported is refused with that item's `message`.
772
+ */
773
+ export const runtimeSupportSchema = Schema.Struct({
774
+ runtime: Schema.Literals(runtimeAdapterIds),
775
+ /** The managed OS families that run on this runtime (`target.os.family`). */
776
+ os: Schema.Struct({
777
+ ubuntu: runtimeCapabilitySchema,
778
+ nix: runtimeCapabilitySchema,
779
+ arch: runtimeCapabilitySchema,
780
+ fedora: runtimeCapabilitySchema,
781
+ }),
782
+ /** A workspace built from a base image of its own (`target.os.family: "custom"`). */
783
+ customImage: runtimeCapabilitySchema,
784
+ /** Directories of the deployment's own servers bound into the workspace (mount sources). */
785
+ hostDirectories: runtimeCapabilitySchema,
786
+ /** Docker inside the workspace (`tooling.services.docker`). */
787
+ docker: runtimeCapabilitySchema,
788
+ /** The workspace run under gVisor (`runtime.ociRuntime: "runsc"`). */
789
+ gvisor: runtimeCapabilitySchema,
790
+ /** Kubernetes Secrets, ConfigMaps and a service account (`runtime.envFrom`, `kubernetes`). */
791
+ clusterEnv: runtimeCapabilitySchema,
792
+ /** A workspace started by cloning a repository (a `git` source), not from a capture. */
793
+ gitSource: runtimeCapabilitySchema,
794
+ /** Dotfiles sent with the create as archives (`runtime.dotfilesArchives`). */
795
+ dotfilesArchives: runtimeCapabilitySchema,
796
+ /** A screen (an X display) inside the workspace, and the CPU architectures it runs on. */
797
+ screen: Schema.Union([
798
+ Schema.Struct({
799
+ supported: Schema.Literal(true),
800
+ architectures: Schema.Array(runtimeArchitectureSchema),
801
+ }),
802
+ runtimeUnsupportedSchema,
803
+ ]),
804
+ /** Ports inside the workspace the runtime holds for itself: nothing else can listen on them. */
805
+ reservedPorts: Schema.Array(Schema.Number),
806
+ /**
807
+ * A project's resources linked to the workspace: `live` reaches a running workspace when it is
808
+ * linked, `next-start` only once the workspace starts again.
809
+ */
810
+ resources: Schema.Union([
811
+ Schema.Struct({
812
+ supported: Schema.Literal(true),
813
+ attach: Schema.Literals(["live", "next-start"]),
814
+ }),
815
+ runtimeUnsupportedSchema,
816
+ ]),
817
+ /** Whether a workspace that sits idle costs money, and the sentence that says so. */
818
+ idleCost: Schema.Struct({ charged: Schema.Boolean, message: NonEmptyString }),
819
+ });
820
+ /**
821
+ * The runtimes this install launches workspaces on, and what each supports. `default` is the one
822
+ * a create that names no runtime (`target.runtime.family: "auto"`) runs on; it is listed first.
823
+ * A runtime that is not listed is one this install cannot launch.
824
+ */
825
+ export const workspaceRuntimesResponseSchema = Schema.Struct({
826
+ default: Schema.Literals(runtimeAdapterIds),
827
+ runtimes: Schema.Array(runtimeSupportSchema),
828
+ });
748
829
  /**
749
830
  * Stable codes of a refused connected account, carried with the account's `provider` by the error
750
831
  * that refuses it (a create's or a credentials put's): `connected-account-missing`
@@ -1562,11 +1643,20 @@ HttpApiEndpoint.post("restartWorkspace", "/:workspaceId/restart", {
1562
1643
  WorkspaceConflictError,
1563
1644
  WorkspaceBadGatewayError,
1564
1645
  WorkspaceServiceUnavailableError,
1646
+ // The recorded spec asks for what its runtime does not support (now), as a create would.
1565
1647
  WorkspaceRuntimeRequirementUnsupportedError,
1648
+ WorkspaceRuntimeEnvReferencesUnsupportedError,
1649
+ WorkspaceDockerServiceUnsupportedError,
1566
1650
  WorkspaceInternalServerError,
1567
1651
  ],
1568
1652
  }))
1569
1653
  .add(
1654
+ // A read, before any create: the runtimes this install launches and what each supports.
1655
+ HttpApiEndpoint.get("listWorkspaceRuntimes", "/runtimes", {
1656
+ success: workspaceRuntimesResponseSchema,
1657
+ error: [WorkspaceInternalServerError],
1658
+ }))
1659
+ .add(
1570
1660
  // A read: plans the spec as a build would and looks up what was published for it.
1571
1661
  HttpApiEndpoint.post("inspectWorkspaceImage", "/image", {
1572
1662
  payload: inspectWorkspaceImageRequestSchema,
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export * from "./core-api/ssh-keys.js";
22
22
  export * from "./core-api/system.js";
23
23
  export * from "./core-api/users.js";
24
24
  export * from "./core-api/boat-accounts.js";
25
+ export * from "./core-api/boat-failures.js";
25
26
  export * from "./workspace-environment.js";
26
27
  export * from "./capture-owner-map.js";
27
28
  export * from "./connected-account-selector.js";
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ export * from "./core-api/ssh-keys.js";
22
22
  export * from "./core-api/system.js";
23
23
  export * from "./core-api/users.js";
24
24
  export * from "./core-api/boat-accounts.js";
25
+ export * from "./core-api/boat-failures.js";
25
26
  export * from "./workspace-environment.js";
26
27
  export * from "./capture-owner-map.js";
27
28
  export * from "./connected-account-selector.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealant/api-contracts-next",
3
- "version": "0.40.0-next.869",
3
+ "version": "0.40.0-next.872",
4
4
  "description": "Contract-first HTTP API definitions for Sealant services",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "peerDependencies": {
37
37
  "effect": "^4.0.5"
38
38
  },
39
- "gitHead": "5cf184dd41f91e6448f78304d5a1446f27f2d175",
39
+ "gitHead": "2af5257ecfc0d624b837c86ed6fe59a09a4bcc7a",
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  }