@sealant/sdk-next 0.40.0-next.877 → 0.40.0-next.879
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 +3 -3
- package/dist/effect/run-harness.js +2 -2
- package/dist/effect/runtime.d.ts +1 -1
- package/dist/effect/runtime.js +1 -3
- package/dist/errors.d.ts +9 -9
- package/dist/errors.js +7 -7
- package/dist/facade/forward.js +8 -4
- package/dist/facade/session.js +5 -2
- package/dist/facade/workspace.js +2 -2
- package/dist/internal/blueprint.d.ts +140 -2
- package/dist/internal/blueprint.js +7 -0
- package/dist/internal/map-error.js +2 -2
- package/dist/scope-instances.d.ts +5 -2
- package/dist/types.d.ts +14 -14
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -399,9 +399,9 @@ const workspace = await sealant.workspaces.create({
|
|
|
399
399
|
`-`), no id and no uid twice, at most 256 people.
|
|
400
400
|
- Launched only on an image whose probe reports `restore.owner_map` from its sealantd
|
|
401
401
|
(`personLayout`). On an image whose sealantd does not report it, the launch fails with
|
|
402
|
-
`owner-map-unsupported` before anything starts; on one with no probe, or a probe
|
|
403
|
-
it fails with `owner-map-unverified`. Refused at create on Cloudflare. On Kubernetes it runs
|
|
404
|
-
runc: a per-person Pod may escalate, so each person's `sudo` works, and the cluster's image
|
|
402
|
+
`owner-map-unsupported` before anything starts; on one with no probe, or a probe sealant cannot
|
|
403
|
+
read, it fails with `owner-map-unverified`. Refused at create on Cloudflare. On Kubernetes it runs
|
|
404
|
+
under runc: a per-person Pod may escalate, so each person's `sudo` works, and the cluster's image
|
|
405
405
|
builder reads the probe back from the pushed image. Under gVisor (`ociRuntime: "runsc"`) it is
|
|
406
406
|
refused. `features().kubernetesPersonLayout` says whether the control plane takes it on
|
|
407
407
|
Kubernetes.
|
|
@@ -12,6 +12,7 @@ import { BudgetExceededError } from "@sealant/api-contracts";
|
|
|
12
12
|
import { Effect } from "effect";
|
|
13
13
|
import { SealantError } from "../errors.js";
|
|
14
14
|
import { makeRun, toRunChangesData } from "../facade/run.js";
|
|
15
|
+
import { specHarnessId } from "../internal/blueprint.js";
|
|
15
16
|
import { elapsed } from "../internal/clock.js";
|
|
16
17
|
import { toSealantError } from "../internal/map-error.js";
|
|
17
18
|
import { createRunOp, getRunChangesOp, getRunOp, getWorkspaceOp } from "./operations.js";
|
|
@@ -42,8 +43,7 @@ const createHarnessRunEffect = (ctx, init, prompt, options) => Effect.gen(functi
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
const details = yield* getWorkspaceOp(init.id, ctx.config.hostLocal.ownerUserId);
|
|
45
|
-
const
|
|
46
|
-
const harnessId = spec?.harness?.id;
|
|
46
|
+
const harnessId = specHarnessId(details.spec);
|
|
47
47
|
if (harnessId === undefined) {
|
|
48
48
|
return yield* Effect.fail(new SealantError(`Workspace ${init.id} has no harness in its spec; pass a harness at workspaces.create() or use workspace.exec().`, { code: "harness_required" }));
|
|
49
49
|
}
|
package/dist/effect/runtime.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { SealantApiClient } from "./api-client.js";
|
|
|
15
15
|
export type SdkServices = SealantApiClient;
|
|
16
16
|
export interface SdkRuntime {
|
|
17
17
|
/** Provide the app context and run an operation effect, surfacing plain `SealantError`s. */
|
|
18
|
-
readonly run: <A, E
|
|
18
|
+
readonly run: <A, E>(effect: Effect.Effect<A, E, SdkServices>) => Promise<A>;
|
|
19
19
|
/** Dispose the runtime scope (the HTTP client). Idempotent. */
|
|
20
20
|
readonly dispose: () => Promise<void>;
|
|
21
21
|
}
|
package/dist/effect/runtime.js
CHANGED
|
@@ -22,7 +22,7 @@ export const makeSdkRuntime = (config) => {
|
|
|
22
22
|
const scope = yield* Scope.make();
|
|
23
23
|
const context = yield* Layer.buildWithScope(appLayer, scope);
|
|
24
24
|
// The layer provides a superset of SdkServices; narrow to the surfaced services.
|
|
25
|
-
return { context
|
|
25
|
+
return { context, scope };
|
|
26
26
|
})).then((exit) => {
|
|
27
27
|
if (Exit.isSuccess(exit)) {
|
|
28
28
|
return exit.value;
|
|
@@ -40,8 +40,6 @@ export const makeSdkRuntime = (config) => {
|
|
|
40
40
|
return {
|
|
41
41
|
run: async (effect) => {
|
|
42
42
|
const { context } = await build();
|
|
43
|
-
// R extends SdkServices and the context provides SdkServices, so all requirements are met
|
|
44
|
-
// (TS can't reduce Exclude<R, SdkServices> to never for a generic R).
|
|
45
43
|
const provided = Effect.provide(effect, context);
|
|
46
44
|
const exit = await Effect.runPromiseExit(provided);
|
|
47
45
|
if (Exit.isSuccess(exit)) {
|
package/dist/errors.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare class SealantApiError extends SealantError {
|
|
|
45
45
|
readonly receipt?: InferenceReceipt;
|
|
46
46
|
/** A Boat key refusal (`boat-key-refused`, `boat-key-unverified`): why, as Boat said. */
|
|
47
47
|
readonly boat?: BoatFailure;
|
|
48
|
-
/** `boat-key-missing-permissions`: the Boat permissions
|
|
48
|
+
/** `boat-key-missing-permissions`: the Boat permissions sealant needs that the key lacks. */
|
|
49
49
|
readonly missingPermissions?: readonly string[];
|
|
50
50
|
/** `boat-key-missing-permissions`: what the check observed of the refused key. */
|
|
51
51
|
readonly boatKeyReport?: BoatKeyReport;
|
|
@@ -63,10 +63,10 @@ export declare class SealantApiError extends SealantError {
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* A Boat workspace that did not become ready because Boat refused, or did not answer, a call
|
|
67
|
-
* made for it: its VM create, its image build, a saved snapshot. `boat` says why, as a kind
|
|
68
|
-
* closed set (`key-expired`, `permission-missing`, `billing-required`, `rate-limited`, …)
|
|
69
|
-
* Boat's own code, message and request id, and when to retry or where to pay when Boat said.
|
|
66
|
+
* A Boat workspace that did not become ready because Boat refused, or did not answer, a call
|
|
67
|
+
* sealant made for it: its VM create, its image build, a saved snapshot. `boat` says why, as a kind
|
|
68
|
+
* from a closed set (`key-expired`, `permission-missing`, `billing-required`, `rate-limited`, …)
|
|
69
|
+
* with Boat's own code, message and request id, and when to retry or where to pay when Boat said.
|
|
70
70
|
* `boat.retryable` is false when the same key and request cannot succeed later. `code` is the
|
|
71
71
|
* same as for any other workspace that did not become ready (`workspace_not_ready`).
|
|
72
72
|
*/
|
|
@@ -100,8 +100,8 @@ export declare class SealantBudgetExceededError extends SealantApiError {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
|
-
* Why a workspace forward did not open.
|
|
104
|
-
* `unrecognized-refusal` (
|
|
103
|
+
* Why a workspace forward did not open. sealant names every refusal it sends. The SDK adds
|
|
104
|
+
* `unrecognized-refusal` (sealant sent a reason newer than this SDK; it is kept in `wireReason`),
|
|
105
105
|
* `protocol-unsupported` (the control plane predates typed refusals, or answered with something
|
|
106
106
|
* unreadable) and `transport-unavailable` (no answer could be read at all).
|
|
107
107
|
*/
|
|
@@ -128,7 +128,7 @@ export type ForwardDialFailure = ({
|
|
|
128
128
|
export declare class ForwardDialError extends SealantApiError {
|
|
129
129
|
readonly name: string;
|
|
130
130
|
readonly reason: ForwardDialReason;
|
|
131
|
-
/** The reason
|
|
131
|
+
/** The reason sealant sent, when this SDK does not know it (`unrecognized-refusal`). */
|
|
132
132
|
readonly wireReason?: string;
|
|
133
133
|
/** Budget metadata from a refusal after the WebSocket upgrade. */
|
|
134
134
|
readonly budget?: string;
|
|
@@ -146,7 +146,7 @@ export declare class SealantNotImplementedError extends SealantError {
|
|
|
146
146
|
export declare class ForwardResetError extends SealantError {
|
|
147
147
|
readonly name: string;
|
|
148
148
|
readonly reason: ForwardResetCause;
|
|
149
|
-
/** The reason
|
|
149
|
+
/** The reason sealant sent, when this SDK does not know it (`unrecognized-reset`). */
|
|
150
150
|
readonly wireReason?: string;
|
|
151
151
|
constructor(reason: ForwardResetCause, wireReason?: string);
|
|
152
152
|
}
|
package/dist/errors.js
CHANGED
|
@@ -45,7 +45,7 @@ export class SealantApiError extends SealantError {
|
|
|
45
45
|
receipt;
|
|
46
46
|
/** A Boat key refusal (`boat-key-refused`, `boat-key-unverified`): why, as Boat said. */
|
|
47
47
|
boat;
|
|
48
|
-
/** `boat-key-missing-permissions`: the Boat permissions
|
|
48
|
+
/** `boat-key-missing-permissions`: the Boat permissions sealant needs that the key lacks. */
|
|
49
49
|
missingPermissions;
|
|
50
50
|
/** `boat-key-missing-permissions`: what the check observed of the refused key. */
|
|
51
51
|
boatKeyReport;
|
|
@@ -78,10 +78,10 @@ export class SealantApiError extends SealantError {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
* A Boat workspace that did not become ready because Boat refused, or did not answer, a call
|
|
82
|
-
* made for it: its VM create, its image build, a saved snapshot. `boat` says why, as a kind
|
|
83
|
-
* closed set (`key-expired`, `permission-missing`, `billing-required`, `rate-limited`, …)
|
|
84
|
-
* Boat's own code, message and request id, and when to retry or where to pay when Boat said.
|
|
81
|
+
* A Boat workspace that did not become ready because Boat refused, or did not answer, a call
|
|
82
|
+
* sealant made for it: its VM create, its image build, a saved snapshot. `boat` says why, as a kind
|
|
83
|
+
* from a closed set (`key-expired`, `permission-missing`, `billing-required`, `rate-limited`, …)
|
|
84
|
+
* with Boat's own code, message and request id, and when to retry or where to pay when Boat said.
|
|
85
85
|
* `boat.retryable` is false when the same key and request cannot succeed later. `code` is the
|
|
86
86
|
* same as for any other workspace that did not become ready (`workspace_not_ready`).
|
|
87
87
|
*/
|
|
@@ -126,7 +126,7 @@ export class SealantBudgetExceededError extends SealantApiError {
|
|
|
126
126
|
export class ForwardDialError extends SealantApiError {
|
|
127
127
|
name = "ForwardDialError";
|
|
128
128
|
reason;
|
|
129
|
-
/** The reason
|
|
129
|
+
/** The reason sealant sent, when this SDK does not know it (`unrecognized-refusal`). */
|
|
130
130
|
wireReason;
|
|
131
131
|
/** Budget metadata from a refusal after the WebSocket upgrade. */
|
|
132
132
|
budget;
|
|
@@ -164,7 +164,7 @@ export class SealantNotImplementedError extends SealantError {
|
|
|
164
164
|
export class ForwardResetError extends SealantError {
|
|
165
165
|
name = "ForwardResetError";
|
|
166
166
|
reason;
|
|
167
|
-
/** The reason
|
|
167
|
+
/** The reason sealant sent, when this SDK does not know it (`unrecognized-reset`). */
|
|
168
168
|
wireReason;
|
|
169
169
|
constructor(reason, wireReason) {
|
|
170
170
|
super(`The forward was reset: ${wireReason ?? reason}.`, { code: "ForwardResetError" });
|
package/dist/facade/forward.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FORWARD_REFUSAL_STATUS, FORWARD_V2_SUBPROTOCOL, forwardOpenFrameSchema, forwardRefusalReasonSchema, } from "@sealant/api-contracts";
|
|
2
|
-
import { Option, Schema } from "effect";
|
|
2
|
+
import { Option, Predicate, Schema } from "effect";
|
|
3
3
|
import { ForwardDialError } from "../errors.js";
|
|
4
4
|
import { resolveRequestPriority } from "../internal/config.js";
|
|
5
5
|
import { boundedForward } from "./bounded-forward.js";
|
|
@@ -36,14 +36,16 @@ const bridgeForward = (ws) => {
|
|
|
36
36
|
if (typeof event.data === "string") {
|
|
37
37
|
try {
|
|
38
38
|
const frame = JSON.parse(event.data);
|
|
39
|
-
if (frame
|
|
39
|
+
if (Predicate.isObject(frame) && frame["t"] === "end") {
|
|
40
40
|
finish("end");
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
catch { }
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
// binaryType is "arraybuffer", so every binary frame arrives as an ArrayBuffer.
|
|
47
|
+
if (event.data instanceof ArrayBuffer)
|
|
48
|
+
pending.push(new Uint8Array(event.data));
|
|
47
49
|
wake?.();
|
|
48
50
|
});
|
|
49
51
|
const output = {
|
|
@@ -117,7 +119,9 @@ const refusalError = (frame) => {
|
|
|
117
119
|
message: frame.message,
|
|
118
120
|
});
|
|
119
121
|
};
|
|
120
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* A gated sealant before v2 answers the route 401, an open one 404. sealant with v2 answers 426.
|
|
124
|
+
*/
|
|
121
125
|
const answeredLikeCoreBeforeV2 = (status) => status === 401 || status === 404;
|
|
122
126
|
const failedHandshakeError = async (url, origin, signal, requestPriority) => {
|
|
123
127
|
const probe = new URL(url.pathname, url);
|
package/dist/facade/session.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Predicate } from "effect";
|
|
1
2
|
import { closeSessionOp, getSessionOp, getSessionOutputOp, resizeSessionOp, sendSessionInputOp, signalSessionOp, } from "../effect/operations.js";
|
|
2
3
|
import { SealantBudgetExceededError } from "../errors.js";
|
|
3
4
|
import { resolveRequestPriority } from "../internal/config.js";
|
|
@@ -42,7 +43,7 @@ const openAttachment = (ctx, sessionId, options) => {
|
|
|
42
43
|
if (typeof event.data === "string") {
|
|
43
44
|
try {
|
|
44
45
|
const frame = JSON.parse(event.data);
|
|
45
|
-
if (frame
|
|
46
|
+
if (Predicate.isObject(frame) && frame["t"] === "end") {
|
|
46
47
|
finish("end");
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -51,7 +52,9 @@ const openAttachment = (ctx, sessionId, options) => {
|
|
|
51
52
|
}
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
+
// binaryType is "arraybuffer", so every binary frame arrives as an ArrayBuffer.
|
|
56
|
+
if (event.data instanceof ArrayBuffer)
|
|
57
|
+
pending.push(new Uint8Array(event.data));
|
|
55
58
|
wake?.();
|
|
56
59
|
});
|
|
57
60
|
ws.addEventListener("close", () => finish("closed"));
|
package/dist/facade/workspace.js
CHANGED
|
@@ -3,6 +3,7 @@ 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";
|
|
5
5
|
import { SealantApiError, SealantBoatError, SealantBudgetExceededError, SealantError, SealantNotImplementedError, } from "../errors.js";
|
|
6
|
+
import { specHarnessId } from "../internal/blueprint.js";
|
|
6
7
|
import { elapsed } from "../internal/clock.js";
|
|
7
8
|
import { mapAccountRef } from "../internal/credentials.js";
|
|
8
9
|
import { parseTtlSeconds } from "../internal/duration.js";
|
|
@@ -396,8 +397,7 @@ export const makeWorkspace = (ctx, init) => {
|
|
|
396
397
|
return [init.harness.launchCommand ?? init.harness.id];
|
|
397
398
|
}
|
|
398
399
|
const details = await ctx.runtime.run(getWorkspaceOp(init.id, ctx.config.hostLocal.ownerUserId));
|
|
399
|
-
const
|
|
400
|
-
const harnessId = spec?.harness?.id;
|
|
400
|
+
const harnessId = specHarnessId(details.spec);
|
|
401
401
|
if (harnessId === undefined) {
|
|
402
402
|
throw new SealantError(`Workspace ${init.id} has no harness in its spec; open a session with workspace.sessions.open(argv) instead.`, { code: "harness_required" });
|
|
403
403
|
}
|
|
@@ -1,7 +1,145 @@
|
|
|
1
|
-
import { type CreateWorkspaceRequest } from "@sealant/api-contracts";
|
|
2
1
|
import type { CreateOptions } from "../types.js";
|
|
3
2
|
import type { SealantInternalConfig } from "./config.js";
|
|
4
3
|
export declare const toGitUrl: (repository: string) => string;
|
|
5
4
|
export declare const buildCreateWorkspaceRequest: (options: CreateOptions, config: SealantInternalConfig) => {
|
|
6
|
-
|
|
5
|
+
payload: {
|
|
6
|
+
ownerUserId: string;
|
|
7
|
+
imageScopeId?: string;
|
|
8
|
+
registryId: string;
|
|
9
|
+
repository: string;
|
|
10
|
+
tag: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
ttlSeconds?: number;
|
|
13
|
+
idempotencyKey?: string;
|
|
14
|
+
launchId?: string;
|
|
15
|
+
sshAsOwner?: true;
|
|
16
|
+
spec: {
|
|
17
|
+
version: string;
|
|
18
|
+
sources: {
|
|
19
|
+
workspace: {
|
|
20
|
+
kind: string;
|
|
21
|
+
provider: string;
|
|
22
|
+
url: string;
|
|
23
|
+
ref?: string;
|
|
24
|
+
rootPath?: never;
|
|
25
|
+
hostPath?: never;
|
|
26
|
+
} | {
|
|
27
|
+
kind: string;
|
|
28
|
+
rootPath: string;
|
|
29
|
+
hostPath?: never;
|
|
30
|
+
} | {
|
|
31
|
+
rootPath?: never;
|
|
32
|
+
kind: string;
|
|
33
|
+
endpoint: string;
|
|
34
|
+
worktreeId?: string;
|
|
35
|
+
harnessHome?: string;
|
|
36
|
+
platform?: string;
|
|
37
|
+
transport?: import("../types.js").WorkspaceCaptureTransport;
|
|
38
|
+
ownerMap?: {
|
|
39
|
+
gid: number;
|
|
40
|
+
worktreeUid: number;
|
|
41
|
+
people: {
|
|
42
|
+
id: string;
|
|
43
|
+
uid: number;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
hostPath?: never;
|
|
47
|
+
} | {
|
|
48
|
+
rootPath?: never;
|
|
49
|
+
kind: string;
|
|
50
|
+
hostPath: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
inputs?: {
|
|
53
|
+
id: string;
|
|
54
|
+
kind: string;
|
|
55
|
+
purpose: string;
|
|
56
|
+
provider: string;
|
|
57
|
+
url: string;
|
|
58
|
+
ref?: string;
|
|
59
|
+
}[];
|
|
60
|
+
mounts?: {
|
|
61
|
+
hostPath: string;
|
|
62
|
+
mountPath: string;
|
|
63
|
+
readOnly?: boolean;
|
|
64
|
+
bindable?: boolean;
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
67
|
+
harness: {
|
|
68
|
+
id: string;
|
|
69
|
+
};
|
|
70
|
+
customization: {
|
|
71
|
+
enableSealantd: boolean;
|
|
72
|
+
defaultShell?: "bash" | "fish" | "zsh";
|
|
73
|
+
dotfilesManager?: import("../types.js").WorkspaceDotfilesManager;
|
|
74
|
+
dotfilesBootstrap?: boolean;
|
|
75
|
+
dotfilesBootstrapCommand?: string;
|
|
76
|
+
};
|
|
77
|
+
runtime?: {
|
|
78
|
+
dotfilesArchives?: {
|
|
79
|
+
data: string;
|
|
80
|
+
manager?: import("../types.js").WorkspaceDotfilesManager;
|
|
81
|
+
target?: "config" | "home";
|
|
82
|
+
bootstrap?: boolean;
|
|
83
|
+
bootstrapCommand?: string;
|
|
84
|
+
}[];
|
|
85
|
+
userEnv?: Readonly<Record<string, string>>;
|
|
86
|
+
envFrom?: {
|
|
87
|
+
kind: "configmap" | "secret";
|
|
88
|
+
name: string;
|
|
89
|
+
}[];
|
|
90
|
+
kubernetes?: {
|
|
91
|
+
serviceAccountName: string;
|
|
92
|
+
};
|
|
93
|
+
network?: {
|
|
94
|
+
cloudMetadata: boolean;
|
|
95
|
+
};
|
|
96
|
+
resources?: "none";
|
|
97
|
+
boatAccountId?: string;
|
|
98
|
+
credentialsHome?: {
|
|
99
|
+
path: string;
|
|
100
|
+
uid: number;
|
|
101
|
+
gid: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
target: {
|
|
105
|
+
os: {
|
|
106
|
+
family: string;
|
|
107
|
+
mode: string;
|
|
108
|
+
baseImage: string;
|
|
109
|
+
} | {
|
|
110
|
+
baseImage?: never;
|
|
111
|
+
family: import("../types.js").WorkspaceOs;
|
|
112
|
+
mode: string;
|
|
113
|
+
};
|
|
114
|
+
runtime: {
|
|
115
|
+
family: string;
|
|
116
|
+
mode: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
lifecycle: {
|
|
120
|
+
startup: {
|
|
121
|
+
foreground: {
|
|
122
|
+
kind: string;
|
|
123
|
+
run: string;
|
|
124
|
+
shell: string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
tooling?: {
|
|
129
|
+
packages?: {
|
|
130
|
+
id: string;
|
|
131
|
+
}[];
|
|
132
|
+
services?: {
|
|
133
|
+
docker: {
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
credentials?: import("./credentials.js").WorkspaceCredentialsPayload;
|
|
139
|
+
};
|
|
140
|
+
secretEnv?: Readonly<Record<string, string>>;
|
|
141
|
+
captureToken?: string;
|
|
142
|
+
};
|
|
7
143
|
};
|
|
144
|
+
/** The harness id a workspace's spec names (`harness.id`, as `buildCreateWorkspaceRequest` writes it). */
|
|
145
|
+
export declare const specHarnessId: (spec: unknown) => string | undefined;
|
|
@@ -16,6 +16,7 @@ import { randomUUID } from "node:crypto";
|
|
|
16
16
|
import { toOciRepositoryComponent } from "@sealant/api-contracts";
|
|
17
17
|
import { captureOwnerMapProblems } from "@sealant/api-contracts/capture-owner-map";
|
|
18
18
|
import { formatWorkspaceEnvIssue, parseWorkspaceEnv, parseWorkspaceSecretEnv, } from "@sealant/api-contracts/workspace-environment";
|
|
19
|
+
import { Predicate } from "effect";
|
|
19
20
|
import { SealantError } from "../errors.js";
|
|
20
21
|
import { mapWorkspaceCredentials } from "./credentials.js";
|
|
21
22
|
import { parseTtlSeconds } from "./duration.js";
|
|
@@ -294,3 +295,9 @@ export const buildCreateWorkspaceRequest = (options, config) => {
|
|
|
294
295
|
},
|
|
295
296
|
};
|
|
296
297
|
};
|
|
298
|
+
/** The harness id a workspace's spec names (`harness.id`, as `buildCreateWorkspaceRequest` writes it). */
|
|
299
|
+
export const specHarnessId = (spec) => {
|
|
300
|
+
const harness = Predicate.isObject(spec) ? spec["harness"] : undefined;
|
|
301
|
+
const id = Predicate.isObject(harness) ? harness["id"] : undefined;
|
|
302
|
+
return typeof id === "string" ? id : undefined;
|
|
303
|
+
};
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* here. This is the single funnel that keeps Effect internals out of the public, Promise-based API.
|
|
6
6
|
*/
|
|
7
7
|
import { boatFailureSchema, boatKeyReportSchema, BudgetExceededError, } from "@sealant/api-contracts";
|
|
8
|
-
import { Option, Schema } from "effect";
|
|
8
|
+
import { Option, Predicate, Schema } from "effect";
|
|
9
9
|
import { SealantApiError, SealantBudgetExceededError, SealantError } from "../errors.js";
|
|
10
|
-
const asRecord = (value) =>
|
|
10
|
+
const asRecord = (value) => Predicate.isObject(value) ? value : undefined;
|
|
11
11
|
const extractStatus = (record) => {
|
|
12
12
|
if (record === undefined) {
|
|
13
13
|
return undefined;
|
|
@@ -135,7 +135,7 @@ export type ScopeInstancePurgeResult = ResourceInstancePurgeResult;
|
|
|
135
135
|
export interface ScopeInstances {
|
|
136
136
|
/**
|
|
137
137
|
* Irreversibly delete a stopped or archived caller-owned instance, including retained volumes
|
|
138
|
-
* and sealed env. Pass its observed id to protect a replacement using the same key. No
|
|
138
|
+
* and sealed env. Pass its observed id to protect a replacement using the same key. No sealant
|
|
139
139
|
* backup is retained; previously downloaded copies belong to their recipient.
|
|
140
140
|
*/
|
|
141
141
|
purge(key: string, options: {
|
|
@@ -149,7 +149,10 @@ export interface ScopeInstances {
|
|
|
149
149
|
*/
|
|
150
150
|
up(key: string, spec: ScopeInstanceSpec, options: {
|
|
151
151
|
readonly cause: "use" | "person";
|
|
152
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* Omission retains secrets; an explicit map replaces them. Requires sealant's credentials
|
|
154
|
+
* key.
|
|
155
|
+
*/
|
|
153
156
|
readonly secretEnv?: Readonly<Record<string, string>>;
|
|
154
157
|
}): Promise<ScopeInstance>;
|
|
155
158
|
/** Download a stopped named volume as an uncompressed tar stream. No volume is deleted. */
|
package/dist/types.d.ts
CHANGED
|
@@ -254,7 +254,7 @@ export interface WorkspaceCaptureSource {
|
|
|
254
254
|
* Cloudflare, and on Kubernetes under gVisor (`ociRuntime: "runsc"`); under runc a per-person Pod
|
|
255
255
|
* may escalate, so each person's `sudo` works. Refused at launch, with nothing started, on an
|
|
256
256
|
* image whose sealantd does not report `restore.owner_map` (`owner-map-unsupported`) and on one
|
|
257
|
-
* with no probe
|
|
257
|
+
* with no probe sealant can read (`owner-map-unverified`). The workspace creator's choice of
|
|
258
258
|
* privilege; only this field sets it.
|
|
259
259
|
*/
|
|
260
260
|
readonly ownerMap?: WorkspaceCaptureOwnerMap;
|
|
@@ -1123,8 +1123,8 @@ export interface Workspace {
|
|
|
1123
1123
|
* otherwise (with the control plane's reason; a runtime's `unsupported-runtime-requirement`
|
|
1124
1124
|
* refusal is one). A per-person launch the worker refused for its owner map rejects with the
|
|
1125
1125
|
* refusal's own code: `owner-map-unsupported` when the image cannot apply the owner map,
|
|
1126
|
-
* `owner-map-unverified` when
|
|
1127
|
-
* `resources: "none"` on a deployment that has no resource gateway rejects with
|
|
1126
|
+
* `owner-map-unverified` when sealant cannot tell whether it does. A Boat workspace created
|
|
1127
|
+
* without `resources: "none"` on a deployment that has no resource gateway rejects with
|
|
1128
1128
|
* `gateway-unavailable`: nothing was built and no VM was created.
|
|
1129
1129
|
* When the handle came from `workspaces.create()` and `ready()` gives up on a bound, a stop is
|
|
1130
1130
|
* requested before the error is thrown, so an abandoned launch does not keep running to its cap;
|
|
@@ -1220,7 +1220,7 @@ export interface Workspace {
|
|
|
1220
1220
|
*
|
|
1221
1221
|
* With `flow: "bounded"`, a TCP forward whose two directions are bounded: the workspace's
|
|
1222
1222
|
* producer is held back while `readable` is not read, and `writable` holds back its writer while
|
|
1223
|
-
* the workspace does not take the bytes. It resolves once
|
|
1223
|
+
* the workspace does not take the bytes. It resolves once sealant and the workspace runtime have
|
|
1224
1224
|
* opened it, and rejects with a {@link ForwardDialError} that says why when they did not.
|
|
1225
1225
|
*/
|
|
1226
1226
|
forward(port: number, options: BoundedWorkspaceForwardOptions): Promise<BoundedWorkspaceForward>;
|
|
@@ -1230,7 +1230,7 @@ export interface Workspace {
|
|
|
1230
1230
|
* One person's logins in the homes of a running workspace (see {@link Workspace.credentials}). A
|
|
1231
1231
|
* home holds one person's logins while it is held: the first `put` names its person and a `put` for
|
|
1232
1232
|
* anyone else is refused (`WorkspaceConflictError`, code `home-held`) until the home is released.
|
|
1233
|
-
*
|
|
1233
|
+
* sealant writes a copy of each account (no refresh token, as at launch) owned by the home's owner,
|
|
1234
1234
|
* mode 0600, and keeps it refreshed there; GitHub is written as `<home>/.config/gh/hosts.yml`.
|
|
1235
1235
|
*/
|
|
1236
1236
|
export interface WorkspaceCredentials {
|
|
@@ -1256,7 +1256,7 @@ export interface WorkspaceCredentials {
|
|
|
1256
1256
|
release(home: string): Promise<{
|
|
1257
1257
|
readonly released: boolean;
|
|
1258
1258
|
}>;
|
|
1259
|
-
/** The homes of the running executor and the logins
|
|
1259
|
+
/** The homes of the running executor and the logins sealant keeps in each, oldest first. */
|
|
1260
1260
|
list(): Promise<readonly WorkspaceCredentialHome[]>;
|
|
1261
1261
|
/**
|
|
1262
1262
|
* Remove every login of `home` that is neither in `live` (the placements running processes hold)
|
|
@@ -1363,7 +1363,7 @@ export interface WorkspaceCredentialsPutOptions {
|
|
|
1363
1363
|
* opencode's ChatGPT login, made the same way, as the `openai` entry of opencode's `auth.json`
|
|
1364
1364
|
* (`<home>/.local/share/opencode/auth.json`, followed through links to where it really is,
|
|
1365
1365
|
* which must be inside the home). A login the person made in opencode is never replaced, and a
|
|
1366
|
-
* release removes only
|
|
1366
|
+
* release removes only sealant's copy.
|
|
1367
1367
|
*/
|
|
1368
1368
|
readonly opencode?: WorkspaceCredentialsAccountChoice;
|
|
1369
1369
|
/**
|
|
@@ -1425,7 +1425,7 @@ export interface WorkspaceCredentialHomeAccount {
|
|
|
1425
1425
|
/** The account's name under its provider, as it is now. */
|
|
1426
1426
|
readonly name: string;
|
|
1427
1427
|
}
|
|
1428
|
-
/** One home of a running workspace and the logins
|
|
1428
|
+
/** One home of a running workspace and the logins sealant keeps in it. */
|
|
1429
1429
|
export interface WorkspaceCredentialHome {
|
|
1430
1430
|
/** One receipt per login written there. Absent from a control plane without placements. */
|
|
1431
1431
|
readonly placements?: readonly WorkspaceCredentialPlacementReceipt[];
|
|
@@ -1695,10 +1695,10 @@ export type BoundedWorkspaceForwardOptions = BoundedForwardTarget & {
|
|
|
1695
1695
|
};
|
|
1696
1696
|
/**
|
|
1697
1697
|
* Why a bounded forward was reset: a reason either side sent, `connection-lost` when the socket
|
|
1698
|
-
* closed with neither a `fin` nor a reset, `unrecognized-reset` when
|
|
1699
|
-
* this SDK (kept in `wireReason`), or `workspace-ended` when the workspace ended the forward
|
|
1700
|
-
* it took everything written to it. A write after the workspace ended fails with
|
|
1701
|
-
* too.
|
|
1698
|
+
* closed with neither a `fin` nor a reset, `unrecognized-reset` when sealant sent a reason newer
|
|
1699
|
+
* than this SDK (kept in `wireReason`), or `workspace-ended` when the workspace ended the forward
|
|
1700
|
+
* before it took everything written to it. A write after the workspace ended fails with
|
|
1701
|
+
* `workspace-ended` too.
|
|
1702
1702
|
*/
|
|
1703
1703
|
export type ForwardResetCause = ForwardResetReason | "connection-lost" | "unrecognized-reset" | "workspace-ended";
|
|
1704
1704
|
/**
|
|
@@ -2412,7 +2412,7 @@ export interface BoatAccountsNamespace {
|
|
|
2412
2412
|
/**
|
|
2413
2413
|
* Stores a Boat account. The key (whitespace around it trimmed) is checked with Boat by
|
|
2414
2414
|
* read-only calls first: a key Boat refuses rejects with a `SealantApiError` (422, `reason`
|
|
2415
|
-
* `boat-key-refused`, Boat's reason in `boat`), one that lacks permissions
|
|
2415
|
+
* `boat-key-refused`, Boat's reason in `boat`), one that lacks permissions sealant needs with
|
|
2416
2416
|
* `boat-key-missing-permissions` (`missingPermissions`, `boatKeyReport`), and
|
|
2417
2417
|
* `boat-key-unverified` when Boat did not answer; nothing is stored. No error names the key.
|
|
2418
2418
|
*/
|
|
@@ -2420,7 +2420,7 @@ export interface BoatAccountsNamespace {
|
|
|
2420
2420
|
readonly label: string;
|
|
2421
2421
|
readonly apiKey: string;
|
|
2422
2422
|
/**
|
|
2423
|
-
* For a personal key: the Boat organization to bill (its id or name).
|
|
2423
|
+
* For a personal key: the Boat organization to bill (its id or name). sealant stores it and
|
|
2424
2424
|
* names it on every request for the account, so billing never follows the key's active wallet.
|
|
2425
2425
|
*/
|
|
2426
2426
|
readonly organization?: string;
|
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.879",
|
|
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.879"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"effect": "^4.0.5"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "7023ad209c68e65b6b2bdf12b981e90f7b362d54",
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
}
|