@sealant/sdk-next 0.40.0-next.854 → 0.40.0-next.857

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -200,6 +200,34 @@ const workspace = await sealant.workspaces.create({
200
200
  A gVisor (`runsc`) workspace cannot be guarded, so it launches only with the opt-in. A control plane
201
201
  older than the option rejects it.
202
202
 
203
+ ## Workspaces that never reach project resources
204
+
205
+ A workspace can be linked to a scope's resource instances (`scope.workspaces.link()`), and reaches
206
+ them by alias (`db`). On the Boat runtime that reach is built when the workspace launches: a gateway
207
+ on the control plane's Docker host, a tunnel to it and a resolver in the VM. A workspace whose
208
+ worktree binds no resource does not need any of it:
209
+
210
+ ```ts
211
+ const workspace = await sealant.workspaces.create({
212
+ source: { kind: "capture", endpoint, token },
213
+ harness: claudeCode(),
214
+ runtime: "boat",
215
+ resources: "none",
216
+ });
217
+ ```
218
+
219
+ `resources: "none"` is a promise made at create and kept for the workspace's life, restarts
220
+ included: this workspace will never be linked. On Boat it is launched with no gateway, tunnel or
221
+ resolver, is ready sooner, and can run on a deployment that has no resource gateway. Linking it
222
+ later rejects with `ResourceWorkspaceWithoutResourcesError` (`reason` `workspace-without-resources`)
223
+ and changes nothing; create the workspace again without the option and link that one, and it reaches
224
+ the resources from its next start. Docker and Kubernetes attach resources to a running workspace, so
225
+ they do not enforce the option: a later link works there.
226
+
227
+ A Boat deployment with no resource gateway refuses a Boat workspace created without the option
228
+ before it is built: `ready()` rejects with code `gateway-unavailable`. A control plane older than
229
+ the option rejects the create.
230
+
203
231
  ## Workspace environment variables
204
232
 
205
233
  Ordinary (non-secret) configuration set on the workspace at creation and inherited by every process
@@ -808,7 +808,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
808
808
  readonly worktreeKey: import("effect/Schema").brand<import("effect/Schema").String, "ResourceWorktreeKey">;
809
809
  readonly aliases: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").brand<import("effect/Schema").String, "ResourceInstanceAlias">, import("effect/Schema").Literals<readonly ["project", "worktree"]>>>;
810
810
  readonly attachedExecutors: import("effect/Schema").Int;
811
- }>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ResourceDomainForbiddenError | typeof import("@sealant/api-contracts").ResourceDomainNotFoundError | typeof import("@sealant/api-contracts").ResourceDomainInternalServerError | typeof import("@sealant/api-contracts").ResourceInstanceSpecRefusedError | typeof import("@sealant/api-contracts").ResourceRuntimeUnsupportedError | typeof import("@sealant/api-contracts").ResourceDomainNotActiveError | typeof import("@sealant/api-contracts").ResourceWorkspaceNotFoundError | typeof import("@sealant/api-contracts").ResourceWorkspaceLinkedElsewhereError | typeof import("@sealant/api-contracts").ResourceInstanceBusyError | typeof import("@sealant/api-contracts").ResourceInstanceBudgetError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
811
+ }>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ResourceDomainForbiddenError | typeof import("@sealant/api-contracts").ResourceDomainNotFoundError | typeof import("@sealant/api-contracts").ResourceDomainInternalServerError | typeof import("@sealant/api-contracts").ResourceInstanceSpecRefusedError | typeof import("@sealant/api-contracts").ResourceRuntimeUnsupportedError | typeof import("@sealant/api-contracts").ResourceDomainNotActiveError | typeof import("@sealant/api-contracts").ResourceWorkspaceNotFoundError | typeof import("@sealant/api-contracts").ResourceWorkspaceLinkedElsewhereError | typeof import("@sealant/api-contracts").ResourceWorkspaceWithoutResourcesError | typeof import("@sealant/api-contracts").ResourceInstanceBusyError | typeof import("@sealant/api-contracts").ResourceInstanceBudgetError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
812
812
  readonly listResourceInstances: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listResourceInstances", "GET", "/v1/resource-domains/:resourceDomainId/instances", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
813
813
  readonly resourceDomainId: import("effect/Schema").String;
814
814
  }>>, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
@@ -3430,7 +3430,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
3430
3430
  readonly worktreeKey: import("effect/Schema").brand<import("effect/Schema").String, "ResourceWorktreeKey">;
3431
3431
  readonly aliases: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").brand<import("effect/Schema").String, "ResourceInstanceAlias">, import("effect/Schema").Literals<readonly ["project", "worktree"]>>>;
3432
3432
  readonly attachedExecutors: import("effect/Schema").Int;
3433
- }>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ResourceDomainForbiddenError | typeof import("@sealant/api-contracts").ResourceDomainNotFoundError | typeof import("@sealant/api-contracts").ResourceDomainInternalServerError | typeof import("@sealant/api-contracts").ResourceInstanceSpecRefusedError | typeof import("@sealant/api-contracts").ResourceRuntimeUnsupportedError | typeof import("@sealant/api-contracts").ResourceDomainNotActiveError | typeof import("@sealant/api-contracts").ResourceWorkspaceNotFoundError | typeof import("@sealant/api-contracts").ResourceWorkspaceLinkedElsewhereError | typeof import("@sealant/api-contracts").ResourceInstanceBusyError | typeof import("@sealant/api-contracts").ResourceInstanceBudgetError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
3433
+ }>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").ResourceDomainForbiddenError | typeof import("@sealant/api-contracts").ResourceDomainNotFoundError | typeof import("@sealant/api-contracts").ResourceDomainInternalServerError | typeof import("@sealant/api-contracts").ResourceInstanceSpecRefusedError | typeof import("@sealant/api-contracts").ResourceRuntimeUnsupportedError | typeof import("@sealant/api-contracts").ResourceDomainNotActiveError | typeof import("@sealant/api-contracts").ResourceWorkspaceNotFoundError | typeof import("@sealant/api-contracts").ResourceWorkspaceLinkedElsewhereError | typeof import("@sealant/api-contracts").ResourceWorkspaceWithoutResourcesError | typeof import("@sealant/api-contracts").ResourceInstanceBusyError | typeof import("@sealant/api-contracts").ResourceInstanceBudgetError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
3434
3434
  readonly listResourceInstances: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listResourceInstances", "GET", "/v1/resource-domains/:resourceDomainId/instances", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
3435
3435
  readonly resourceDomainId: import("effect/Schema").String;
3436
3436
  }>>, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
@@ -1679,7 +1679,7 @@ export declare const linkResourceWorkspaceOp: (resourceDomainId: string, workspa
1679
1679
  readonly [x: string & import("effect/Brand").Brand<"ResourceInstanceAlias">]: "project" | "worktree";
1680
1680
  } | null;
1681
1681
  readonly attachedExecutors: number;
1682
- }, import("@sealant/api-contracts").BudgetExceededError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | import("@sealant/api-contracts").ResourceDomainForbiddenError | import("@sealant/api-contracts").ResourceDomainInternalServerError | import("@sealant/api-contracts").ResourceDomainNotActiveError | import("@sealant/api-contracts").ResourceDomainNotFoundError | import("@sealant/api-contracts").ResourceInstanceBudgetError | import("@sealant/api-contracts").ResourceInstanceBusyError | import("@sealant/api-contracts").ResourceInstanceSpecRefusedError | import("@sealant/api-contracts").ResourceRuntimeUnsupportedError | import("@sealant/api-contracts").ResourceWorkspaceLinkedElsewhereError | import("@sealant/api-contracts").ResourceWorkspaceNotFoundError | Schema.SchemaError | import("effect/Cause").UnknownError, SealantApiClient>;
1682
+ }, import("@sealant/api-contracts").BudgetExceededError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | import("@sealant/api-contracts").ResourceDomainForbiddenError | import("@sealant/api-contracts").ResourceDomainInternalServerError | import("@sealant/api-contracts").ResourceDomainNotActiveError | import("@sealant/api-contracts").ResourceDomainNotFoundError | import("@sealant/api-contracts").ResourceInstanceBudgetError | import("@sealant/api-contracts").ResourceInstanceBusyError | import("@sealant/api-contracts").ResourceInstanceSpecRefusedError | import("@sealant/api-contracts").ResourceRuntimeUnsupportedError | import("@sealant/api-contracts").ResourceWorkspaceLinkedElsewhereError | import("@sealant/api-contracts").ResourceWorkspaceNotFoundError | import("@sealant/api-contracts").ResourceWorkspaceWithoutResourcesError | Schema.SchemaError | import("effect/Cause").UnknownError, SealantApiClient>;
1683
1683
  export declare const archiveResourceDomainOp: (resourceDomainId: string) => Effect.Effect<{
1684
1684
  readonly volumes: readonly {
1685
1685
  readonly instanceKey: string & import("effect/Brand").Brand<"ResourceInstanceKey">;
@@ -1,4 +1,4 @@
1
- import { sessionArgvIssue } from "@sealant/api-contracts";
1
+ import { sessionArgvIssue, WORKSPACE_GATEWAY_UNAVAILABLE_CODE } from "@sealant/api-contracts";
2
2
  import { applyDotfiles } from "../effect/apply-dotfiles.js";
3
3
  import { execWorkspace } from "../effect/exec-workspace.js";
4
4
  import { bindWorkspaceOp, flushWorkspaceCaptureOp, getWorkspaceCaptureStatusOp, createSessionAsUserOp, createSessionOp, expireWorkspaceOp, clearWorkspaceSshUserOp, getSessionOp, getWorkspaceOp, listSessionsOp, replanWorkspaceCaptureOp, recoverWorkspaceOp, restartWorkspaceOp, listWorkspaceCredentialsOp, putWorkspaceCredentialsOp, pruneWorkspaceCredentialsOp, releaseWorkspaceCredentialsOp, stopWorkspaceOp, } from "../effect/operations.js";
@@ -33,6 +33,10 @@ const readyFailureCode = (code) => {
33
33
  return "workspace_image_build_timeout";
34
34
  if (code !== undefined && OWNER_MAP_REFUSAL_CODES.has(code))
35
35
  return code;
36
+ // A Boat deployment with no resource gateway refused a workspace that may be linked to
37
+ // resources (created without `resources: "none"`).
38
+ if (code === WORKSPACE_GATEWAY_UNAVAILABLE_CODE)
39
+ return code;
36
40
  return "workspace_not_ready";
37
41
  };
38
42
  const READY_POLL_INTERVAL_MS = 2_000;
@@ -35,6 +35,9 @@ export const buildCreateWorkspaceRequest = (options, config) => {
35
35
  code: "invalid_create_options",
36
36
  });
37
37
  }
38
+ if (options.resources !== undefined && options.resources !== "none") {
39
+ throw new SealantError('workspaces.create `resources` is "none" (the workspace is never linked to project resources) or omitted.', { code: "invalid_create_options" });
40
+ }
38
41
  if ((options.repository === undefined) === (options.source === undefined)) {
39
42
  throw new SealantError("workspaces.create requires exactly one of `repository` (a git remote to clone) or `source` (a caller-owned mount).", { code: "invalid_create_options" });
40
43
  }
@@ -152,6 +155,8 @@ export const buildCreateWorkspaceRequest = (options, config) => {
152
155
  ? {}
153
156
  : { kubernetes: { serviceAccountName: options.kubernetes.serviceAccountName } }),
154
157
  ...(options.network?.cloudMetadata === true ? { network: { cloudMetadata: true } } : {}),
158
+ // Sent only when asked: absent is the control plane's default (the workspace may be linked).
159
+ ...(options.resources === undefined ? {} : { resources: options.resources }),
155
160
  ...(options.credentialsHome === undefined
156
161
  ? {}
157
162
  : {
@@ -190,7 +190,12 @@ export interface ScopeWorkspaces {
190
190
  * the worktree's own `mail` and the project's `db`, and no other instance. Without it, every
191
191
  * project instance and the worktree's own. Linking again replaces the worktree key and the map,
192
192
  * and detaches what the new map leaves out at once; a workspace linked to another scope rejects
193
- * (409 `ResourceWorkspaceLinkedElsewhereError`). Answers once its running executors converged.
193
+ * (409 `ResourceWorkspaceLinkedElsewhereError`). A Boat workspace created with
194
+ * `resources: "none"` rejects too (409 `ResourceWorkspaceWithoutResourcesError`, `reason`
195
+ * `workspace-without-resources`): Boat gives a workspace its way to reach resources at launch
196
+ * or never, so nothing is linked; create it again without the option and link that one. Docker
197
+ * and Kubernetes link a workspace created with the option as any other. Answers once its
198
+ * running executors converged.
194
199
  */
195
200
  link(workspaceId: string, options: {
196
201
  readonly worktreeKey: string;
package/dist/types.d.ts CHANGED
@@ -890,6 +890,30 @@ export interface CreateOptions {
890
890
  readonly services?: WorkspaceServicesOptions;
891
891
  /** The workspace's network (see `WorkspaceNetworkOptions`). */
892
892
  readonly network?: WorkspaceNetworkOptions;
893
+ /**
894
+ * `"none"`: your promise that this workspace will never be linked to project resources
895
+ * (`scope.workspaces.link()`), made at create and kept for the workspace's life, restarts
896
+ * included. Set it for a workspace whose worktree binds no resource. Omitted, the workspace may
897
+ * be linked, as before the option existed, on every runtime.
898
+ *
899
+ * What it changes depends on the runtime:
900
+ *
901
+ * - **Boat** builds a workspace's way to reach resources when it launches: a gateway on the
902
+ * control plane's Docker host, a tunnel to it and a resolver in the VM. With `"none"` none of
903
+ * that is built, the workspace is ready sooner, and a Boat deployment that has no resource
904
+ * gateway at all can run it. Linking such a workspace later rejects with a `SealantApiError`
905
+ * whose `code` is `ResourceWorkspaceWithoutResourcesError` and `reason` is
906
+ * `workspace-without-resources`; nothing is linked and the running workspace is
907
+ * unchanged. To give it resources, create the workspace again without the option and link that
908
+ * one: it reaches them from its next start.
909
+ * - **Docker and Kubernetes** attach resources to a running workspace, so they do not enforce
910
+ * the option: linking a workspace created with it works as it does without.
911
+ *
912
+ * A Boat deployment with no resource gateway refuses a Boat workspace created WITHOUT the
913
+ * option before it is built: `ready()` rejects with code `gateway-unavailable`. A control plane
914
+ * older than the option rejects the create (400): its spec is strict.
915
+ */
916
+ readonly resources?: "none";
893
917
  /** When true (default), resolve only once the workspace runtime is live. */
894
918
  readonly wait?: boolean;
895
919
  /**
@@ -1088,7 +1112,9 @@ export interface Workspace {
1088
1112
  * otherwise (with the control plane's reason; a runtime's `unsupported-runtime-requirement`
1089
1113
  * refusal is one). A per-person launch the worker refused for its owner map rejects with the
1090
1114
  * refusal's own code: `owner-map-unsupported` when the image cannot apply the owner map,
1091
- * `owner-map-unverified` when Core cannot tell whether it does.
1115
+ * `owner-map-unverified` when Core cannot tell whether it does. A Boat workspace created without
1116
+ * `resources: "none"` on a deployment that has no resource gateway rejects with
1117
+ * `gateway-unavailable`: nothing was built and no VM was created.
1092
1118
  * When the handle came from `workspaces.create()` and `ready()` gives up on a bound, a stop is
1093
1119
  * requested before the error is thrown, so an abandoned launch does not keep running to its cap;
1094
1120
  * the error says whether the request was accepted (not that the workspace stopped). Options given
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealant/sdk-next",
3
- "version": "0.40.0-next.854",
3
+ "version": "0.40.0-next.857",
4
4
  "description": "The fluent public SDK for Sealant — create a workspace, run a harness, replay the record.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -26,12 +26,12 @@
26
26
  "node": ">=20"
27
27
  },
28
28
  "dependencies": {
29
- "@sealant/api-contracts": "npm:@sealant/api-contracts-next@0.40.0-next.854"
29
+ "@sealant/api-contracts": "npm:@sealant/api-contracts-next@0.40.0-next.857"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "effect": "^4.0.5"
33
33
  },
34
- "gitHead": "fc0d825a118cabf673a6698e71262c7642dc22bd",
34
+ "gitHead": "3bc545ab218e56eda4903aca4f202921b3cde82b",
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  }