@sealant/sdk 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/client.js +21 -21
- package/dist/effect/api-client.d.ts +250 -250
- package/dist/effect/operations.d.ts +14 -14
- package/dist/effect/operations.js +4 -4
- package/dist/effect/run-harness.d.ts +2 -2
- package/dist/effect/run-harness.js +4 -4
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/facade/run.d.ts +1 -1
- package/dist/facade/{sandbox.d.ts → workspace.d.ts} +6 -6
- package/dist/facade/{sandbox.js → workspace.js} +17 -17
- package/dist/harness.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/internal/blueprint.d.ts +1 -1
- package/dist/internal/blueprint.js +8 -8
- package/dist/internal/config.d.ts +2 -2
- package/dist/internal/credentials.d.ts +7 -7
- package/dist/internal/credentials.js +2 -2
- package/dist/internal/map-error.d.ts +1 -1
- package/dist/internal/map-error.js +1 -1
- package/dist/types.d.ts +35 -35
- package/dist/types.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# @sealant/sdk
|
|
2
2
|
|
|
3
|
-
The fluent public SDK for Sealant — **create a
|
|
3
|
+
The fluent public SDK for Sealant — **create a workspace, run a harness, replay the record.**
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
import { Sealant, opencode } from "@sealant/sdk";
|
|
7
7
|
|
|
8
8
|
const sealant = new Sealant({ baseUrl: "http://localhost:8080" });
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const workspace = await sealant.workspaces.create({
|
|
11
11
|
repository: "github.com/acme/billing-service",
|
|
12
12
|
harness: opencode(),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
const run = await
|
|
15
|
+
const run = await workspace.harness.run("Round invoice totals once, after applying the discount.");
|
|
16
16
|
|
|
17
17
|
await run.record.replay();
|
|
18
18
|
```
|
|
@@ -31,11 +31,11 @@ await run.record.replay();
|
|
|
31
31
|
|
|
32
32
|
## Connected-account credentials
|
|
33
33
|
|
|
34
|
-
Attach the caller's connected Claude / Codex / GitHub accounts to a
|
|
34
|
+
Attach the caller's connected Claude / Codex / GitHub accounts to a workspace so the harness
|
|
35
35
|
authenticates as that identity instead of running unauthenticated:
|
|
36
36
|
|
|
37
37
|
```ts
|
|
38
|
-
const
|
|
38
|
+
const workspace = await sealant.workspaces.create({
|
|
39
39
|
repository: "github.com/acme/billing-service",
|
|
40
40
|
harness: claudeCode(),
|
|
41
41
|
credentials: { claude: true, github: "bot-account" },
|
|
@@ -50,12 +50,12 @@ and injects them at launch.
|
|
|
50
50
|
|
|
51
51
|
## Status
|
|
52
52
|
|
|
53
|
-
The core loop is real: `
|
|
53
|
+
The core loop is real: `workspaces.create()`/`get()`/`list()`, `ready()`, blocking `harness.run()`
|
|
54
54
|
and non-blocking `harness.start()` (run execution happens server-side; the SDK is a thin HTTP
|
|
55
55
|
client), `runs.get()`, and the record read surface — `replay()`, `timeline()`, `scrollback()`,
|
|
56
56
|
`commands()`, `transcript()`, `stream()` (poll-backed), `loss()`, `summary()`, plus captured
|
|
57
57
|
`changes` (files + diff) settled by `run()`/`wait()`.
|
|
58
58
|
|
|
59
59
|
Still typed stubs pending their read models / endpoints: `artifacts.get()` and the time-travel folds
|
|
60
|
-
`fileTreeAt()`/`processTreeAt()` (Phase 1), and `harness.session()` +
|
|
60
|
+
`fileTreeAt()`/`processTreeAt()` (Phase 1), and `harness.session()` + workspace lifecycle
|
|
61
61
|
`stop()`/`restart()`/`expire()` (Phase 3).
|
package/dist/client.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { CreateOptions, ListOptions, Run,
|
|
1
|
+
import type { CreateOptions, ListOptions, Run, Workspace, SealantConfig } from "./types.js";
|
|
2
2
|
export declare class Sealant {
|
|
3
3
|
#private;
|
|
4
4
|
constructor(config: SealantConfig);
|
|
5
5
|
/** The configured control-plane base URL. */
|
|
6
6
|
get baseUrl(): string;
|
|
7
|
-
/**
|
|
8
|
-
readonly
|
|
9
|
-
create: (options: CreateOptions) => Promise<
|
|
10
|
-
get: (id: string) => Promise<
|
|
11
|
-
list: (options?: ListOptions | undefined) => Promise<readonly
|
|
7
|
+
/** Workspace lifecycle: create, fetch, and list live environments. */
|
|
8
|
+
readonly workspaces: {
|
|
9
|
+
create: (options: CreateOptions) => Promise<Workspace>;
|
|
10
|
+
get: (id: string) => Promise<Workspace>;
|
|
11
|
+
list: (options?: ListOptions | undefined) => Promise<readonly Workspace[]>;
|
|
12
12
|
};
|
|
13
|
-
/** Runs by id — so a record can be replayed long after its
|
|
13
|
+
/** Runs by id — so a record can be replayed long after its workspace is gone. */
|
|
14
14
|
readonly runs: {
|
|
15
15
|
get: (runId: string) => Promise<Run>;
|
|
16
16
|
};
|
package/dist/client.js
CHANGED
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
* stable surface and reject with `SealantNotImplementedError` so callers can compile and wire
|
|
11
11
|
* against the final shape today.
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { createWorkspaceOp, getRunOp, getWorkspaceOp, listWorkspacesOp, } from "./effect/operations.js";
|
|
14
14
|
import { runHarness, startHarness } from "./effect/run-harness.js";
|
|
15
15
|
import { makeSdkRuntime } from "./effect/runtime.js";
|
|
16
16
|
import { SealantError } from "./errors.js";
|
|
17
17
|
import { makeRun } from "./facade/run.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { makeWorkspace, registerHarnessExecutors } from "./facade/workspace.js";
|
|
19
|
+
import { buildCreateWorkspaceRequest } from "./internal/blueprint.js";
|
|
20
20
|
import { resolveInternalConfig } from "./internal/config.js";
|
|
21
|
-
// Wire the run-execution implementations into the
|
|
22
|
-
// break the
|
|
21
|
+
// Wire the run-execution implementations into the Workspace facade (the injection point exists to
|
|
22
|
+
// break the workspace <-> run-harness import cycle; the client is the composition root).
|
|
23
23
|
registerHarnessExecutors({ run: runHarness, start: startHarness });
|
|
24
24
|
export class Sealant {
|
|
25
25
|
#config;
|
|
@@ -38,19 +38,19 @@ export class Sealant {
|
|
|
38
38
|
get baseUrl() {
|
|
39
39
|
return this.#config.baseUrl;
|
|
40
40
|
}
|
|
41
|
-
/**
|
|
42
|
-
|
|
41
|
+
/** Workspace lifecycle: create, fetch, and list live environments. */
|
|
42
|
+
workspaces = {
|
|
43
43
|
create: async (options) => {
|
|
44
|
-
const { payload } =
|
|
45
|
-
const created = await this.#runtime.run(
|
|
46
|
-
const
|
|
47
|
-
id: created.
|
|
44
|
+
const { payload } = buildCreateWorkspaceRequest(options, this.#ctx.config);
|
|
45
|
+
const created = await this.#runtime.run(createWorkspaceOp(payload));
|
|
46
|
+
const workspace = makeWorkspace(this.#ctx, {
|
|
47
|
+
id: created.workspaceId,
|
|
48
48
|
name: created.name,
|
|
49
49
|
status: created.status,
|
|
50
50
|
harness: options.harness,
|
|
51
51
|
});
|
|
52
52
|
if (options.wait === false) {
|
|
53
|
-
return
|
|
53
|
+
return workspace;
|
|
54
54
|
}
|
|
55
55
|
// Pump provisioning events to onEvent (best-effort) while we wait for ready. Never let an
|
|
56
56
|
// event-stream hiccup fail create().
|
|
@@ -58,7 +58,7 @@ export class Sealant {
|
|
|
58
58
|
const onEvent = options.onEvent;
|
|
59
59
|
void (async () => {
|
|
60
60
|
try {
|
|
61
|
-
for await (const event of
|
|
61
|
+
for await (const event of workspace.events()) {
|
|
62
62
|
onEvent(event);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -67,30 +67,30 @@ export class Sealant {
|
|
|
67
67
|
}
|
|
68
68
|
})();
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return workspace.ready();
|
|
71
71
|
},
|
|
72
72
|
get: async (id) => {
|
|
73
|
-
const details = await this.#runtime.run(
|
|
74
|
-
return
|
|
75
|
-
id: details.
|
|
73
|
+
const details = await this.#runtime.run(getWorkspaceOp(id));
|
|
74
|
+
return makeWorkspace(this.#ctx, {
|
|
75
|
+
id: details.workspaceId,
|
|
76
76
|
name: details.name,
|
|
77
77
|
status: details.status,
|
|
78
78
|
});
|
|
79
79
|
},
|
|
80
80
|
list: async (options) => {
|
|
81
|
-
const response = await this.#runtime.run(
|
|
81
|
+
const response = await this.#runtime.run(listWorkspacesOp({
|
|
82
82
|
ownerUserId: this.#ctx.config.hostLocal.ownerUserId,
|
|
83
83
|
...(options?.status === undefined ? {} : { status: options.status }),
|
|
84
84
|
...(options?.limit === undefined ? {} : { limit: String(options.limit) }),
|
|
85
85
|
}));
|
|
86
|
-
return response.items.map((item) =>
|
|
87
|
-
id: item.
|
|
86
|
+
return response.items.map((item) => makeWorkspace(this.#ctx, {
|
|
87
|
+
id: item.workspaceId,
|
|
88
88
|
name: item.name,
|
|
89
89
|
status: item.status,
|
|
90
90
|
}));
|
|
91
91
|
},
|
|
92
92
|
};
|
|
93
|
-
/** Runs by id — so a record can be replayed long after its
|
|
93
|
+
/** Runs by id — so a record can be replayed long after its workspace is gone. */
|
|
94
94
|
runs = {
|
|
95
95
|
get: async (runId) => {
|
|
96
96
|
const wire = await this.#runtime.run(getRunOp(runId));
|