@sealant/sdk-next 0.40.0-next.936 → 0.40.0-next.937
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 +47 -0
- package/dist/client.js +1 -0
- package/dist/effect/api-client.d.ts +16 -0
- package/dist/effect/operations.d.ts +6 -0
- package/dist/facade/workspace.js +3 -0
- package/dist/internal/blueprint.d.ts +5 -0
- package/dist/internal/blueprint.js +19 -0
- package/dist/types.d.ts +63 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -484,6 +484,53 @@ const workspace = await sealant.workspaces.create({
|
|
|
484
484
|
a cluster ConfigMap nor an image `ENV` can, and an environment variable name holding `=` is
|
|
485
485
|
refused.
|
|
486
486
|
|
|
487
|
+
## Serving an executor's capture and session sockets
|
|
488
|
+
|
|
489
|
+
Each Docker or `host-vm` executor mounts one directory of the deployment's control root at
|
|
490
|
+
`/run/sealant`: its _control scope_. sealantd's `control.sock` is there, and so are the two sockets
|
|
491
|
+
the caller serves the executor, `capture.sock` (captures and presigned object requests) and
|
|
492
|
+
`session.sock` (the session channel). Name the scope to bind both before the executor dials them:
|
|
493
|
+
|
|
494
|
+
```ts
|
|
495
|
+
const scope = `mend-${launchId}`;
|
|
496
|
+
await bindSockets(`${controlRoot}/${scope}`); // your capture.sock and session.sock
|
|
497
|
+
|
|
498
|
+
const workspace = await sealant.workspaces.create({
|
|
499
|
+
repository: "github.com/acme/billing-service",
|
|
500
|
+
harness: codex(),
|
|
501
|
+
launchId,
|
|
502
|
+
controlScope: scope,
|
|
503
|
+
executorSockets: { capture: true, session: true }, // Docker; host-vm relays both itself
|
|
504
|
+
});
|
|
505
|
+
workspace.launch?.controlScope; // "mend-…"
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
- **The scope is one path segment**: lowercase letters, digits, `_`, `.` and `-`, never starting
|
|
509
|
+
with `sealant` (sealant's own directories there do, among them each egress proxy's admin
|
|
510
|
+
directory). It is unique for all time: naming a scope any executor has held rejects with a
|
|
511
|
+
`SealantApiError` whose `status` is 409, `code` is `WorkspaceConflictError` and `reason` is
|
|
512
|
+
`control-scope-taken`. Mint it unguessable, from the launch id. Omitted, the scope is the
|
|
513
|
+
executor's container name.
|
|
514
|
+
- **Your sockets stay yours.** Launch and recovery never remove or replace `capture.sock` or
|
|
515
|
+
`session.sock`; only the executor's final removal takes the directory. Serve them as root or as a
|
|
516
|
+
member of the control directory's group: sealant sets the directory's owner and mode (on
|
|
517
|
+
`host-vm`, the runner's uid 65532 and the control group, 0770). Give the sockets themselves a mode
|
|
518
|
+
their clients can connect with: on `host-vm` the runner connects to both as uid 65532; on Docker
|
|
519
|
+
sealantd connects to `capture.sock` as root, and the workspace's non-root processes to
|
|
520
|
+
`session.sock`.
|
|
521
|
+
- **Docker needs `executorSockets`.** `capture` makes sealantd dial `unix:/run/sealant/capture.sock`
|
|
522
|
+
(sealant sets `SEALANT_CAPTURE_DIAL`; a caller's `SEALANT_*` env is refused), so a workspace
|
|
523
|
+
behind its egress proxy still reaches your capture store. `session` makes `/run/sealant`
|
|
524
|
+
searchable (0711) so the workspace's non-root processes reach `session.sock`; nothing there is
|
|
525
|
+
listable, and `control.sock` stays sealantd's alone (0600). A `host-vm` executor relays vsock 1025
|
|
526
|
+
to `capture.sock` and 1027 to `session.sock` and needs neither flag.
|
|
527
|
+
- **Where it is reported.** `runtime.controlScope` on `workspace.launch`, `details()` and every
|
|
528
|
+
read; `controlScope` on `capture.replan()` (a standby claim, whose scope was fixed when the
|
|
529
|
+
standby launched) and on `recover()`. A recovery keeps the executor's scope and dials only
|
|
530
|
+
`capture.sock`: bind that, and no `session.sock`, for it.
|
|
531
|
+
- **Refused where there is no scope**: Kubernetes, Boat, MicroVM, Cloudflare, and Docker without
|
|
532
|
+
`WORKSPACE_CONTROL_SOCKET_HOST_DIR`. A restart is a new executor, in its container name's scope.
|
|
533
|
+
|
|
487
534
|
## Dotfiles and shell
|
|
488
535
|
|
|
489
536
|
Bring your own environment: a login shell and dotfiles applied before the workspace accepts work.
|
package/dist/client.js
CHANGED
|
@@ -107,6 +107,7 @@ export class Sealant {
|
|
|
107
107
|
replayed: created.replayed === true,
|
|
108
108
|
...(created.runId === undefined ? {} : { runId: created.runId }),
|
|
109
109
|
...(created.launchId === undefined ? {} : { launchId: created.launchId }),
|
|
110
|
+
...(created.controlScope === undefined ? {} : { controlScope: created.controlScope }),
|
|
110
111
|
...(created.runtime === undefined ? {} : { runtime: toRuntimeInfo(created.runtime) }),
|
|
111
112
|
},
|
|
112
113
|
});
|
|
@@ -3740,6 +3740,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
3740
3740
|
readonly ttlSeconds: import("effect/Schema").optional<import("effect/Schema").Int>;
|
|
3741
3741
|
readonly idempotencyKey: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3742
3742
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3743
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3743
3744
|
readonly sshAsOwner: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
3744
3745
|
}>>, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
3745
3746
|
readonly "idempotency-key": import("effect/Schema").optional<import("effect/Schema").String>;
|
|
@@ -3760,9 +3761,11 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
3760
3761
|
readonly deadline: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
3761
3762
|
readonly runId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3762
3763
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3764
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3763
3765
|
}>>;
|
|
3764
3766
|
readonly replayed: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
3765
3767
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3768
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3766
3769
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").BudgetExceededError | typeof import("@sealant/api-contracts").WorkspaceBadRequestError | typeof import("@sealant/api-contracts").WorkspaceRuntimeEnvReferencesUnsupportedError | typeof import("@sealant/api-contracts").WorkspaceRuntimeRequirementUnsupportedError | typeof import("@sealant/api-contracts").WorkspaceDockerServiceUnsupportedError | typeof import("@sealant/api-contracts").WorkspaceSshOwnerRefusedError | typeof import("@sealant/api-contracts").WorkspaceForbiddenError | typeof import("@sealant/api-contracts").WorkspaceNotFoundError | typeof import("@sealant/api-contracts").WorkspaceConflictError | typeof import("@sealant/api-contracts").WorkspaceBadGatewayError | typeof import("@sealant/api-contracts").WorkspaceServiceUnavailableError | typeof import("@sealant/api-contracts").WorkspaceInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
3767
3770
|
readonly execWorkspace: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"execWorkspace", "POST", "/v1/workspaces/:workspaceId/exec", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
3768
3771
|
readonly workspaceId: import("effect/Schema").String;
|
|
@@ -3924,6 +3927,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
3924
3927
|
readonly deadline: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
3925
3928
|
readonly runId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3926
3929
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3930
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
3927
3931
|
}>>;
|
|
3928
3932
|
readonly publishedImage: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
3929
3933
|
readonly reference: import("effect/Schema").String;
|
|
@@ -4300,6 +4304,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
4300
4304
|
readonly deadline: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
4301
4305
|
readonly runId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4302
4306
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4307
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4303
4308
|
}>>;
|
|
4304
4309
|
readonly publishedImage: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
4305
4310
|
readonly reference: import("effect/Schema").String;
|
|
@@ -4600,6 +4605,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
4600
4605
|
readonly deadline: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
4601
4606
|
readonly runId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4602
4607
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4608
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4603
4609
|
}>>;
|
|
4604
4610
|
readonly publishedImage: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
4605
4611
|
readonly reference: import("effect/Schema").String;
|
|
@@ -4831,6 +4837,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
4831
4837
|
readonly workspaceId: import("effect/Schema").String;
|
|
4832
4838
|
readonly state: import("effect/Schema").Literals<readonly ["requested", "not-retained"]>;
|
|
4833
4839
|
readonly recoverable: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
4840
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4834
4841
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").WorkspaceBadRequestError | typeof import("@sealant/api-contracts").WorkspaceNotFoundError | typeof import("@sealant/api-contracts").WorkspaceConflictError | typeof import("@sealant/api-contracts").WorkspaceInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
4835
4842
|
readonly releaseWorkspaceCredentials: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"releaseWorkspaceCredentials", "DELETE", "/v1/workspaces/:workspaceId/credentials", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
4836
4843
|
readonly workspaceId: import("effect/Schema").String;
|
|
@@ -4876,6 +4883,7 @@ declare const buildControlPlaneClient: (config: SealantInternalConfig) => Effect
|
|
|
4876
4883
|
readonly bytesSkipped: import("effect/Schema").Number;
|
|
4877
4884
|
readonly removed: import("effect/Schema").Number;
|
|
4878
4885
|
readonly unchanged: import("effect/Schema").Boolean;
|
|
4886
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
4879
4887
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").WorkspaceBadRequestError | typeof import("@sealant/api-contracts").WorkspaceNotFoundError | typeof import("@sealant/api-contracts").WorkspaceConflictError | typeof import("@sealant/api-contracts").WorkspaceInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
4880
4888
|
readonly restartWorkspace: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"restartWorkspace", "POST", "/v1/workspaces/:workspaceId/restart", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
4881
4889
|
readonly workspaceId: import("effect/Schema").String;
|
|
@@ -8665,6 +8673,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
8665
8673
|
readonly ttlSeconds: import("effect/Schema").optional<import("effect/Schema").Int>;
|
|
8666
8674
|
readonly idempotencyKey: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8667
8675
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8676
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8668
8677
|
readonly sshAsOwner: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
8669
8678
|
}>>, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
8670
8679
|
readonly "idempotency-key": import("effect/Schema").optional<import("effect/Schema").String>;
|
|
@@ -8685,9 +8694,11 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
8685
8694
|
readonly deadline: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
8686
8695
|
readonly runId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8687
8696
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8697
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8688
8698
|
}>>;
|
|
8689
8699
|
readonly replayed: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
8690
8700
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8701
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8691
8702
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").BudgetExceededError | typeof import("@sealant/api-contracts").WorkspaceBadRequestError | typeof import("@sealant/api-contracts").WorkspaceRuntimeEnvReferencesUnsupportedError | typeof import("@sealant/api-contracts").WorkspaceRuntimeRequirementUnsupportedError | typeof import("@sealant/api-contracts").WorkspaceDockerServiceUnsupportedError | typeof import("@sealant/api-contracts").WorkspaceSshOwnerRefusedError | typeof import("@sealant/api-contracts").WorkspaceForbiddenError | typeof import("@sealant/api-contracts").WorkspaceNotFoundError | typeof import("@sealant/api-contracts").WorkspaceConflictError | typeof import("@sealant/api-contracts").WorkspaceBadGatewayError | typeof import("@sealant/api-contracts").WorkspaceServiceUnavailableError | typeof import("@sealant/api-contracts").WorkspaceInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
8692
8703
|
readonly execWorkspace: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"execWorkspace", "POST", "/v1/workspaces/:workspaceId/exec", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
8693
8704
|
readonly workspaceId: import("effect/Schema").String;
|
|
@@ -8849,6 +8860,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
8849
8860
|
readonly deadline: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
8850
8861
|
readonly runId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8851
8862
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8863
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
8852
8864
|
}>>;
|
|
8853
8865
|
readonly publishedImage: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
8854
8866
|
readonly reference: import("effect/Schema").String;
|
|
@@ -9225,6 +9237,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
9225
9237
|
readonly deadline: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
9226
9238
|
readonly runId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
9227
9239
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
9240
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
9228
9241
|
}>>;
|
|
9229
9242
|
readonly publishedImage: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
9230
9243
|
readonly reference: import("effect/Schema").String;
|
|
@@ -9525,6 +9538,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
9525
9538
|
readonly deadline: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
9526
9539
|
readonly runId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
9527
9540
|
readonly launchId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
9541
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
9528
9542
|
}>>;
|
|
9529
9543
|
readonly publishedImage: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
9530
9544
|
readonly reference: import("effect/Schema").String;
|
|
@@ -9756,6 +9770,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
9756
9770
|
readonly workspaceId: import("effect/Schema").String;
|
|
9757
9771
|
readonly state: import("effect/Schema").Literals<readonly ["requested", "not-retained"]>;
|
|
9758
9772
|
readonly recoverable: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
9773
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
9759
9774
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").WorkspaceBadRequestError | typeof import("@sealant/api-contracts").WorkspaceNotFoundError | typeof import("@sealant/api-contracts").WorkspaceConflictError | typeof import("@sealant/api-contracts").WorkspaceInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
9760
9775
|
readonly releaseWorkspaceCredentials: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"releaseWorkspaceCredentials", "DELETE", "/v1/workspaces/:workspaceId/credentials", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
9761
9776
|
readonly workspaceId: import("effect/Schema").String;
|
|
@@ -9801,6 +9816,7 @@ declare const SealantApiClient_base: Context.ServiceClass<SealantApiClient, "@se
|
|
|
9801
9816
|
readonly bytesSkipped: import("effect/Schema").Number;
|
|
9802
9817
|
readonly removed: import("effect/Schema").Number;
|
|
9803
9818
|
readonly unchanged: import("effect/Schema").Boolean;
|
|
9819
|
+
readonly controlScope: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
9804
9820
|
}>>, import("effect/Schema").toCodecJson<typeof import("@sealant/api-contracts").WorkspaceBadRequestError | typeof import("@sealant/api-contracts").WorkspaceNotFoundError | typeof import("@sealant/api-contracts").WorkspaceConflictError | typeof import("@sealant/api-contracts").WorkspaceInternalServerError>, import("@sealant/api-contracts").RequestBudget | import("@sealant/api-contracts").RequestRefusal, never>, never, never>;
|
|
9805
9821
|
readonly restartWorkspace: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"restartWorkspace", "POST", "/v1/workspaces/:workspaceId/restart", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
9806
9822
|
readonly workspaceId: import("effect/Schema").String;
|
|
@@ -24,9 +24,11 @@ export declare const createWorkspaceOp: (payload: CreateWorkspaceRequest, idempo
|
|
|
24
24
|
readonly deadline?: string | null | undefined;
|
|
25
25
|
readonly runId?: string | undefined;
|
|
26
26
|
readonly launchId?: string | undefined;
|
|
27
|
+
readonly controlScope?: string | undefined;
|
|
27
28
|
} | undefined;
|
|
28
29
|
readonly replayed?: boolean | undefined;
|
|
29
30
|
readonly launchId?: string | undefined;
|
|
31
|
+
readonly controlScope?: string | undefined;
|
|
30
32
|
}, import("@sealant/api-contracts").BudgetExceededError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | Schema.SchemaError | import("@sealant/api-contracts").WorkspaceBadGatewayError | import("@sealant/api-contracts").WorkspaceBadRequestError | import("@sealant/api-contracts").WorkspaceConflictError | import("@sealant/api-contracts").WorkspaceDockerServiceUnsupportedError | import("@sealant/api-contracts").WorkspaceForbiddenError | import("@sealant/api-contracts").WorkspaceInternalServerError | import("@sealant/api-contracts").WorkspaceNotFoundError | import("@sealant/api-contracts").WorkspaceRuntimeEnvReferencesUnsupportedError | import("@sealant/api-contracts").WorkspaceRuntimeRequirementUnsupportedError | import("@sealant/api-contracts").WorkspaceServiceUnavailableError | import("@sealant/api-contracts").WorkspaceSshOwnerRefusedError, SealantApiClient>;
|
|
31
33
|
export declare const getWorkspaceOp: (workspaceId: string, ownerUserId?: string) => Effect.Effect<{
|
|
32
34
|
readonly workspaceId: string;
|
|
@@ -45,6 +47,7 @@ export declare const getWorkspaceOp: (workspaceId: string, ownerUserId?: string)
|
|
|
45
47
|
readonly deadline?: string | null | undefined;
|
|
46
48
|
readonly runId?: string | undefined;
|
|
47
49
|
readonly launchId?: string | undefined;
|
|
50
|
+
readonly controlScope?: string | undefined;
|
|
48
51
|
} | undefined;
|
|
49
52
|
readonly publishedImage?: {
|
|
50
53
|
readonly reference: string;
|
|
@@ -216,6 +219,7 @@ export declare const listWorkspacesOp: (query: ListWorkspacesQuery) => Effect.Ef
|
|
|
216
219
|
readonly deadline?: string | null | undefined;
|
|
217
220
|
readonly runId?: string | undefined;
|
|
218
221
|
readonly launchId?: string | undefined;
|
|
222
|
+
readonly controlScope?: string | undefined;
|
|
219
223
|
} | undefined;
|
|
220
224
|
readonly publishedImage?: {
|
|
221
225
|
readonly reference: string;
|
|
@@ -518,6 +522,7 @@ export declare const replanWorkspaceCaptureOp: (workspaceId: string, payload: Re
|
|
|
518
522
|
readonly bytesSkipped: number;
|
|
519
523
|
readonly removed: number;
|
|
520
524
|
readonly unchanged: boolean;
|
|
525
|
+
readonly controlScope?: string | undefined;
|
|
521
526
|
}, import("@sealant/api-contracts").BudgetExceededError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | Schema.SchemaError | import("@sealant/api-contracts").WorkspaceBadRequestError | import("@sealant/api-contracts").WorkspaceConflictError | import("@sealant/api-contracts").WorkspaceInternalServerError | import("@sealant/api-contracts").WorkspaceNotFoundError, SealantApiClient>;
|
|
522
527
|
export declare const stopWorkspaceOp: (workspaceId: string, payload: StopWorkspaceRequest) => Effect.Effect<{
|
|
523
528
|
readonly workspaceId: string;
|
|
@@ -531,6 +536,7 @@ export declare const recoverWorkspaceOp: (workspaceId: string, payload: RecoverW
|
|
|
531
536
|
readonly workspaceId: string;
|
|
532
537
|
readonly state: "not-retained" | "requested";
|
|
533
538
|
readonly recoverable?: boolean | undefined;
|
|
539
|
+
readonly controlScope?: string | undefined;
|
|
534
540
|
}, import("@sealant/api-contracts").BudgetExceededError | import("effect/http/HttpClientError").HttpClientError | import("@sealant/api-contracts").RequestRefusedError | Schema.SchemaError | import("@sealant/api-contracts").WorkspaceBadRequestError | import("@sealant/api-contracts").WorkspaceConflictError | import("@sealant/api-contracts").WorkspaceInternalServerError | import("@sealant/api-contracts").WorkspaceNotFoundError, SealantApiClient>;
|
|
535
541
|
export declare const restartWorkspaceOp: (workspaceId: string, payload: RestartWorkspaceRequest) => Effect.Effect<{
|
|
536
542
|
readonly workspaceId: string;
|
package/dist/facade/workspace.js
CHANGED
|
@@ -20,6 +20,7 @@ export const toRuntimeInfo = (runtime) => ({
|
|
|
20
20
|
status: runtime.status,
|
|
21
21
|
...(runtime.runId === undefined ? {} : { runId: runtime.runId }),
|
|
22
22
|
...(runtime.launchId === undefined ? {} : { launchId: runtime.launchId }),
|
|
23
|
+
...(runtime.controlScope === undefined ? {} : { controlScope: runtime.controlScope }),
|
|
23
24
|
deadline: runtime.deadline ?? null,
|
|
24
25
|
});
|
|
25
26
|
// Terminal statuses a workspace can never leave: ready()/events() fail fast (or end the stream)
|
|
@@ -640,6 +641,7 @@ export const makeWorkspace = (ctx, init) => {
|
|
|
640
641
|
bytesSkipped: result.bytesSkipped,
|
|
641
642
|
removed: result.removed,
|
|
642
643
|
unchanged: result.unchanged,
|
|
644
|
+
...(result.controlScope === undefined ? {} : { controlScope: result.controlScope }),
|
|
643
645
|
};
|
|
644
646
|
},
|
|
645
647
|
},
|
|
@@ -782,6 +784,7 @@ export const makeWorkspace = (ctx, init) => {
|
|
|
782
784
|
return {
|
|
783
785
|
state: answered.state,
|
|
784
786
|
...(answered.recoverable === undefined ? {} : { recoverable: answered.recoverable }),
|
|
787
|
+
...(answered.controlScope === undefined ? {} : { controlScope: answered.controlScope }),
|
|
785
788
|
};
|
|
786
789
|
},
|
|
787
790
|
// Restart drives a fresh launch (new attempt, new container, same resolved spec) and returns a
|
|
@@ -12,6 +12,7 @@ export declare const buildCreateWorkspaceRequest: (options: CreateOptions, confi
|
|
|
12
12
|
ttlSeconds?: number;
|
|
13
13
|
idempotencyKey?: string;
|
|
14
14
|
launchId?: string;
|
|
15
|
+
controlScope?: string;
|
|
15
16
|
sshAsOwner?: true;
|
|
16
17
|
spec: {
|
|
17
18
|
version: string;
|
|
@@ -95,6 +96,10 @@ export declare const buildCreateWorkspaceRequest: (options: CreateOptions, confi
|
|
|
95
96
|
};
|
|
96
97
|
resources?: "none";
|
|
97
98
|
boatAccountId?: string;
|
|
99
|
+
executorSockets?: {
|
|
100
|
+
capture: boolean;
|
|
101
|
+
session: boolean;
|
|
102
|
+
};
|
|
98
103
|
credentialsHome?: {
|
|
99
104
|
path: string;
|
|
100
105
|
uid: number;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import { randomUUID } from "node:crypto";
|
|
16
16
|
import { runtimeAdapterIds, toOciRepositoryComponent, } from "@sealant/api-contracts";
|
|
17
17
|
import { captureOwnerMapProblems } from "@sealant/api-contracts/capture-owner-map";
|
|
18
|
+
import { controlScopeProblem } from "@sealant/api-contracts/control-scope";
|
|
18
19
|
import { formatWorkspaceEnvIssue, parseWorkspaceEnv, parseWorkspaceSecretEnv, } from "@sealant/api-contracts/workspace-environment";
|
|
19
20
|
import { Predicate } from "effect";
|
|
20
21
|
import { SealantError } from "../errors.js";
|
|
@@ -40,6 +41,14 @@ export const buildCreateWorkspaceRequest = (options, config) => {
|
|
|
40
41
|
if (options.resources !== undefined && options.resources !== "none") {
|
|
41
42
|
throw new SealantError('workspaces.create `resources` is "none" (the workspace is never linked to project resources) or omitted.', { code: "invalid_create_options" });
|
|
42
43
|
}
|
|
44
|
+
if (options.controlScope !== undefined) {
|
|
45
|
+
const problem = controlScopeProblem(options.controlScope);
|
|
46
|
+
if (problem !== undefined) {
|
|
47
|
+
throw new SealantError(`workspaces.create \`controlScope\` ${problem}.`, {
|
|
48
|
+
code: "invalid_create_options",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
43
52
|
if (options.boatAccountId !== undefined &&
|
|
44
53
|
options.runtime !== undefined &&
|
|
45
54
|
options.runtime !== "boat") {
|
|
@@ -172,6 +181,15 @@ export const buildCreateWorkspaceRequest = (options, config) => {
|
|
|
172
181
|
// Sent only when asked: absent is the control plane's default (the workspace may be linked).
|
|
173
182
|
...(options.resources === undefined ? {} : { resources: options.resources }),
|
|
174
183
|
...(options.boatAccountId === undefined ? {} : { boatAccountId: options.boatAccountId }),
|
|
184
|
+
// Sent only when it asks for a channel: absent is the control plane's default (none).
|
|
185
|
+
...(options.executorSockets?.capture === true || options.executorSockets?.session === true
|
|
186
|
+
? {
|
|
187
|
+
executorSockets: {
|
|
188
|
+
capture: options.executorSockets.capture === true,
|
|
189
|
+
session: options.executorSockets.session === true,
|
|
190
|
+
},
|
|
191
|
+
}
|
|
192
|
+
: {}),
|
|
175
193
|
...(options.credentialsHome === undefined
|
|
176
194
|
? {}
|
|
177
195
|
: {
|
|
@@ -299,6 +317,7 @@ export const buildCreateWorkspaceRequest = (options, config) => {
|
|
|
299
317
|
...(options.ttl === undefined ? {} : { ttlSeconds: parseTtlSeconds(options.ttl) }),
|
|
300
318
|
...(options.idempotencyKey === undefined ? {} : { idempotencyKey: options.idempotencyKey }),
|
|
301
319
|
...(options.launchId === undefined ? {} : { launchId: options.launchId }),
|
|
320
|
+
...(options.controlScope === undefined ? {} : { controlScope: options.controlScope }),
|
|
302
321
|
...(options.sshAsOwner === true ? { sshAsOwner: true } : {}),
|
|
303
322
|
spec,
|
|
304
323
|
...(secretEnv === undefined ? {} : { secretEnv }),
|
package/dist/types.d.ts
CHANGED
|
@@ -605,6 +605,12 @@ export interface WorkspaceStopCompletion {
|
|
|
605
605
|
export interface WorkspaceRecoverResult {
|
|
606
606
|
readonly state: "requested" | "not-retained";
|
|
607
607
|
readonly recoverable?: boolean;
|
|
608
|
+
/**
|
|
609
|
+
* The retained executor's control scope (`WorkspaceRuntimeInfo.controlScope`), when its runtime
|
|
610
|
+
* has one. A recovery boot dials only `capture.sock` there (no session channel): bind that, and
|
|
611
|
+
* no `session.sock`, for the recovery.
|
|
612
|
+
*/
|
|
613
|
+
readonly controlScope?: string;
|
|
608
614
|
}
|
|
609
615
|
/**
|
|
610
616
|
* What `workspace.stop()` observed — never more than was observed:
|
|
@@ -656,6 +662,11 @@ export interface WorkspaceCaptureReplanned {
|
|
|
656
662
|
readonly removed: number;
|
|
657
663
|
/** The plan named the worktree and epoch already in force; nothing moved. */
|
|
658
664
|
readonly unchanged: boolean;
|
|
665
|
+
/**
|
|
666
|
+
* The claimed executor's control scope (`WorkspaceRuntimeInfo.controlScope`), when its runtime
|
|
667
|
+
* has one: where a caller claiming a standby serves its `capture.sock` and `session.sock`.
|
|
668
|
+
*/
|
|
669
|
+
readonly controlScope?: string;
|
|
659
670
|
}
|
|
660
671
|
/** Options for `workspace.capture.flush()`: which flush the daemon runs, and its bounds. */
|
|
661
672
|
export interface WorkspaceCaptureFlushOptions {
|
|
@@ -968,6 +979,28 @@ export interface CreateOptions {
|
|
|
968
979
|
* removed with a 409, and naming one for a workspace not on Boat with a 400.
|
|
969
980
|
*/
|
|
970
981
|
readonly boatAccountId?: string;
|
|
982
|
+
/**
|
|
983
|
+
* Connect the executor to the channels you serve in its control scope (`controlScope`), on
|
|
984
|
+
* Docker. A `host-vm` executor always relays both (vsock 1025 to `capture.sock`, 1027 to
|
|
985
|
+
* `session.sock`) and needs neither.
|
|
986
|
+
*
|
|
987
|
+
* - `capture`: sealantd sends its captures and presigned object requests to
|
|
988
|
+
* `/run/sealant/capture.sock` (`SEALANT_CAPTURE_DIAL`, which sealant sets: a caller's
|
|
989
|
+
* `SEALANT_*` env is refused) instead of over the network, so a workspace behind its egress
|
|
990
|
+
* proxy still reaches your capture store.
|
|
991
|
+
* - `session`: the workspace's processes, not only root, can reach `/run/sealant/session.sock`.
|
|
992
|
+
* `/run/sealant` is made searchable but not listable (0711); `control.sock` stays sealantd's
|
|
993
|
+
* alone (0600).
|
|
994
|
+
*
|
|
995
|
+
* Kept for the workspace's life (a restart reads the same spec). Refused on a runtime with no
|
|
996
|
+
* control scope: Kubernetes, Boat, MicroVM, Cloudflare, and Docker without
|
|
997
|
+
* `WORKSPACE_CONTROL_SOCKET_HOST_DIR`. A control plane older than the option rejects the create
|
|
998
|
+
* (400): its spec is strict.
|
|
999
|
+
*/
|
|
1000
|
+
readonly executorSockets?: {
|
|
1001
|
+
readonly capture?: boolean;
|
|
1002
|
+
readonly session?: boolean;
|
|
1003
|
+
};
|
|
971
1004
|
/** When true (default), resolve only once the workspace runtime is live. */
|
|
972
1005
|
readonly wait?: boolean;
|
|
973
1006
|
/**
|
|
@@ -1025,6 +1058,27 @@ export interface CreateOptions {
|
|
|
1025
1058
|
* `runtime.launchId`; a `stop({ completion })` about this executor must name it.
|
|
1026
1059
|
*/
|
|
1027
1060
|
readonly launchId?: string;
|
|
1061
|
+
/**
|
|
1062
|
+
* The control scope of the ONE executor this create launches: the subdirectory of the
|
|
1063
|
+
* deployment's control root (Mend's `mend-control` volume) it mounts at `/run/sealant`. Name it
|
|
1064
|
+
* to bind your `capture.sock` and `session.sock` in `<control root>/<controlScope>/` BEFORE the
|
|
1065
|
+
* create, and so before sealantd dials them: launch and recovery never remove or replace them.
|
|
1066
|
+
* Serve them as root or as a member of the control directory's group, since sealant sets the
|
|
1067
|
+
* directory's owner and mode.
|
|
1068
|
+
*
|
|
1069
|
+
* One path segment: up to 128 lowercase letters, digits, `_`, `.` and `-`, starting with a letter
|
|
1070
|
+
* or digit, and never starting with `sealant` (sealant's own directories there do). Unique for
|
|
1071
|
+
* all time on the control plane: a create naming a scope any executor has held rejects with a
|
|
1072
|
+
* `SealantApiError` (409, `reason` `control-scope-taken`); first come, first served, so mint it
|
|
1073
|
+
* unguessable, from the launch id. The executor's recovery keeps it; a restart is a new
|
|
1074
|
+
* executor, in its container name's scope. Refused on a runtime with no control scope (see
|
|
1075
|
+
* `executorSockets`).
|
|
1076
|
+
*
|
|
1077
|
+
* Omitted, the scope is the executor's container name. Either way it is reported as
|
|
1078
|
+
* `runtime.controlScope` once the executor exists, on `workspace.launch`, `details()`,
|
|
1079
|
+
* `capture.replan()` (a standby claim) and `recover()`.
|
|
1080
|
+
*/
|
|
1081
|
+
readonly controlScope?: string;
|
|
1028
1082
|
}
|
|
1029
1083
|
/**
|
|
1030
1084
|
* What became of an idempotent create, by its key:
|
|
@@ -1063,6 +1117,13 @@ export interface WorkspaceRuntimeInfo {
|
|
|
1063
1117
|
readonly runId?: string;
|
|
1064
1118
|
/** The launch identity the create named for this executor (`CreateOptions.launchId`). */
|
|
1065
1119
|
readonly launchId?: string;
|
|
1120
|
+
/**
|
|
1121
|
+
* The executor's control scope: the subdirectory of the deployment's control root it mounts at
|
|
1122
|
+
* `/run/sealant`, where you serve its `capture.sock` and `session.sock`. The create's
|
|
1123
|
+
* `controlScope`, else its container name. Absent on a runtime with no control scope, and from
|
|
1124
|
+
* control planes before it.
|
|
1125
|
+
*/
|
|
1126
|
+
readonly controlScope?: string;
|
|
1066
1127
|
/** ISO-8601 instant the runtime ends it on its own; `null` where there is no such cap. */
|
|
1067
1128
|
readonly deadline: string | null;
|
|
1068
1129
|
}
|
|
@@ -1079,6 +1140,8 @@ export interface WorkspaceLaunch {
|
|
|
1079
1140
|
readonly replayed: boolean;
|
|
1080
1141
|
/** The launch identity the create named. */
|
|
1081
1142
|
readonly launchId?: string;
|
|
1143
|
+
/** The control scope the create named (`CreateOptions.controlScope`). */
|
|
1144
|
+
readonly controlScope?: string;
|
|
1082
1145
|
/** The image the executor booted, with its per-person capability; filled in by `ready()`. */
|
|
1083
1146
|
readonly image?: WorkspaceImage;
|
|
1084
1147
|
readonly publication?: WorkspacePublication;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealant/sdk-next",
|
|
3
|
-
"version": "0.40.0-next.
|
|
3
|
+
"version": "0.40.0-next.937",
|
|
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.
|
|
29
|
+
"@sealant/api-contracts": "npm:@sealant/api-contracts-next@0.40.0-next.937"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"effect": "^4.0.5"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "ce04b9190a56121780edc18f8eecbd1d7d356e37",
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
}
|