@celestoai/sdk 0.1.2 → 0.1.3
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 +195 -54
- package/dist/chunk-LPTIN7LO.js +475 -0
- package/dist/chunk-LPTIN7LO.js.map +1 -0
- package/dist/computers/index.cjs +269 -6
- package/dist/computers/index.cjs.map +1 -1
- package/dist/computers/index.d.cts +76 -49
- package/dist/computers/index.d.ts +76 -49
- package/dist/computers/index.js +3 -3
- package/dist/index.cjs +439 -186
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -13
- package/dist/index.d.ts +4 -13
- package/dist/index.js +3 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-7OJDEZ7J.js +0 -212
- package/dist/chunk-7OJDEZ7J.js.map +0 -1
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { C as ClientConfig
|
|
1
|
+
import { C as ClientConfig } from '../config-BTTpuv_b.cjs';
|
|
2
2
|
|
|
3
3
|
type ComputerStatus = "creating" | "running" | "stopping" | "stopped" | "starting" | "restoring" | "restorable" | "deleting" | "deleted" | "error";
|
|
4
4
|
interface ComputerConnectionInfo {
|
|
5
5
|
ssh?: string;
|
|
6
6
|
accessUrl?: string;
|
|
7
7
|
}
|
|
8
|
+
type PublishedPortStatus = "publishing" | "published" | "unpublishing" | "unpublished" | "error";
|
|
9
|
+
interface ComputerPublishedPortInfo {
|
|
10
|
+
id?: string | null;
|
|
11
|
+
computerId: string;
|
|
12
|
+
port: number;
|
|
13
|
+
url?: string | null;
|
|
14
|
+
status: PublishedPortStatus;
|
|
15
|
+
createdAt?: string | null;
|
|
16
|
+
}
|
|
8
17
|
interface ComputerInfo {
|
|
9
18
|
id: string;
|
|
10
19
|
name: string;
|
|
@@ -16,6 +25,7 @@ interface ComputerInfo {
|
|
|
16
25
|
templateId: string;
|
|
17
26
|
templateVersion?: string | null;
|
|
18
27
|
connection?: ComputerConnectionInfo;
|
|
28
|
+
publishedPorts?: ComputerPublishedPortInfo[];
|
|
19
29
|
lastError?: string | null;
|
|
20
30
|
createdAt: string;
|
|
21
31
|
stoppedAt?: string | null;
|
|
@@ -24,6 +34,16 @@ interface ComputerListResponse {
|
|
|
24
34
|
computers: ComputerInfo[];
|
|
25
35
|
count: number;
|
|
26
36
|
}
|
|
37
|
+
interface ListComputersParams {
|
|
38
|
+
/** Optional status filter, such as "running" or "stopped". */
|
|
39
|
+
status?: ComputerStatus;
|
|
40
|
+
/** Optional template filter, such as "coding-agent". */
|
|
41
|
+
templateId?: string;
|
|
42
|
+
/** Optional project ID filter. */
|
|
43
|
+
projectId?: string;
|
|
44
|
+
/** Optional maximum number of computers to return. */
|
|
45
|
+
limit?: number;
|
|
46
|
+
}
|
|
27
47
|
interface ComputerExecResponse {
|
|
28
48
|
exitCode: number;
|
|
29
49
|
stdout: string;
|
|
@@ -48,6 +68,8 @@ interface CreateComputerParams {
|
|
|
48
68
|
memory?: number;
|
|
49
69
|
/** Memory in MB (512-32768). */
|
|
50
70
|
ramMb?: number;
|
|
71
|
+
/** Disk size as MB or a string like "2gb". Alias for diskSizeMb. */
|
|
72
|
+
disk?: number | string;
|
|
51
73
|
/** Disk size in MB (512-51200). */
|
|
52
74
|
diskSizeMb?: number;
|
|
53
75
|
/** Legacy OS image selector. */
|
|
@@ -66,7 +88,7 @@ interface ExecParams {
|
|
|
66
88
|
*
|
|
67
89
|
* Use with any WebSocket library:
|
|
68
90
|
* ```ts
|
|
69
|
-
* const conn = await
|
|
91
|
+
* const conn = await client.getTerminalConnection("my-computer");
|
|
70
92
|
* const ws = new WebSocket(conn.url, { headers: conn.headers });
|
|
71
93
|
* ws.on("open", () => ws.send(conn.firstMessage));
|
|
72
94
|
* ```
|
|
@@ -80,52 +102,57 @@ interface TerminalConnectionInfo {
|
|
|
80
102
|
firstMessage: string;
|
|
81
103
|
}
|
|
82
104
|
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
get(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
105
|
+
/** Convenience object for one Celesto computer. */
|
|
106
|
+
declare class Computer {
|
|
107
|
+
private readonly client;
|
|
108
|
+
private info;
|
|
109
|
+
private constructor();
|
|
110
|
+
/** Create a new computer and return an object with methods on it. */
|
|
111
|
+
static create(params?: CreateComputerParams, config?: ClientConfig): Promise<Computer>;
|
|
112
|
+
/** Load an existing computer by name or ID. */
|
|
113
|
+
static get(computerIdOrName: string, config?: ClientConfig): Promise<Computer>;
|
|
114
|
+
/** List computers in the current account. */
|
|
115
|
+
static list(params?: ListComputersParams, config?: ClientConfig): Promise<Computer[]>;
|
|
116
|
+
/** List available computer templates. */
|
|
117
|
+
static listTemplates(config?: ClientConfig): Promise<SandboxTemplateInfo[]>;
|
|
118
|
+
/** Wrap an existing API response in the convenience object. */
|
|
119
|
+
static fromInfo(info: ComputerInfo, config?: ClientConfig): Computer;
|
|
120
|
+
get id(): string;
|
|
121
|
+
get name(): string;
|
|
122
|
+
get status(): ComputerStatus;
|
|
123
|
+
get vcpus(): number;
|
|
124
|
+
get ramMb(): number;
|
|
125
|
+
get diskSizeMb(): number;
|
|
126
|
+
get image(): string;
|
|
127
|
+
get templateId(): string;
|
|
128
|
+
get templateVersion(): string | null | undefined;
|
|
129
|
+
get connection(): ComputerConnectionInfo | undefined;
|
|
130
|
+
get publishedPorts(): ComputerPublishedPortInfo[] | undefined;
|
|
131
|
+
get lastError(): string | null | undefined;
|
|
132
|
+
get createdAt(): string;
|
|
133
|
+
get stoppedAt(): string | null | undefined;
|
|
134
|
+
/** Get one field from the latest computer data. */
|
|
135
|
+
get<K extends keyof ComputerInfo>(key: K): ComputerInfo[K];
|
|
136
|
+
/** Return a copy of the latest computer data. */
|
|
137
|
+
toJSON(): ComputerInfo;
|
|
138
|
+
/** Reload this computer from Celesto. */
|
|
139
|
+
refresh(): Promise<this>;
|
|
140
|
+
/** Run a shell command on this computer. */
|
|
141
|
+
run(command: string, params?: ExecParams): Promise<ComputerExecResponse>;
|
|
142
|
+
/** Alias for run(). */
|
|
143
|
+
exec(command: string, params?: ExecParams): Promise<ComputerExecResponse>;
|
|
144
|
+
/** Stop this computer and update the local data. */
|
|
145
|
+
stop(): Promise<this>;
|
|
146
|
+
/** Start this computer and update the local data. */
|
|
147
|
+
start(): Promise<this>;
|
|
148
|
+
/** Delete this computer and update the local data. */
|
|
149
|
+
delete(): Promise<this>;
|
|
150
|
+
/** Publish a port and return its public URL when the API provides one. */
|
|
151
|
+
publishPort(port?: number): Promise<string | null>;
|
|
152
|
+
/** List public ports for this computer. */
|
|
153
|
+
listPublishedPorts(): Promise<ComputerPublishedPortInfo[]>;
|
|
154
|
+
/** Remove a public port route. */
|
|
155
|
+
unpublishPort(port?: number): Promise<ComputerPublishedPortInfo>;
|
|
129
156
|
}
|
|
130
157
|
|
|
131
|
-
export { type ComputerConnectionInfo, type ComputerExecResponse, type ComputerInfo, type ComputerListResponse, type
|
|
158
|
+
export { Computer, type ComputerConnectionInfo, type ComputerExecResponse, type ComputerInfo, type ComputerListResponse, type ComputerPublishedPortInfo, type ComputerStatus, type CreateComputerParams, type ExecParams, type ListComputersParams, type PublishedPortStatus, type SandboxTemplateInfo, type TerminalConnectionInfo };
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { C as ClientConfig
|
|
1
|
+
import { C as ClientConfig } from '../config-BTTpuv_b.js';
|
|
2
2
|
|
|
3
3
|
type ComputerStatus = "creating" | "running" | "stopping" | "stopped" | "starting" | "restoring" | "restorable" | "deleting" | "deleted" | "error";
|
|
4
4
|
interface ComputerConnectionInfo {
|
|
5
5
|
ssh?: string;
|
|
6
6
|
accessUrl?: string;
|
|
7
7
|
}
|
|
8
|
+
type PublishedPortStatus = "publishing" | "published" | "unpublishing" | "unpublished" | "error";
|
|
9
|
+
interface ComputerPublishedPortInfo {
|
|
10
|
+
id?: string | null;
|
|
11
|
+
computerId: string;
|
|
12
|
+
port: number;
|
|
13
|
+
url?: string | null;
|
|
14
|
+
status: PublishedPortStatus;
|
|
15
|
+
createdAt?: string | null;
|
|
16
|
+
}
|
|
8
17
|
interface ComputerInfo {
|
|
9
18
|
id: string;
|
|
10
19
|
name: string;
|
|
@@ -16,6 +25,7 @@ interface ComputerInfo {
|
|
|
16
25
|
templateId: string;
|
|
17
26
|
templateVersion?: string | null;
|
|
18
27
|
connection?: ComputerConnectionInfo;
|
|
28
|
+
publishedPorts?: ComputerPublishedPortInfo[];
|
|
19
29
|
lastError?: string | null;
|
|
20
30
|
createdAt: string;
|
|
21
31
|
stoppedAt?: string | null;
|
|
@@ -24,6 +34,16 @@ interface ComputerListResponse {
|
|
|
24
34
|
computers: ComputerInfo[];
|
|
25
35
|
count: number;
|
|
26
36
|
}
|
|
37
|
+
interface ListComputersParams {
|
|
38
|
+
/** Optional status filter, such as "running" or "stopped". */
|
|
39
|
+
status?: ComputerStatus;
|
|
40
|
+
/** Optional template filter, such as "coding-agent". */
|
|
41
|
+
templateId?: string;
|
|
42
|
+
/** Optional project ID filter. */
|
|
43
|
+
projectId?: string;
|
|
44
|
+
/** Optional maximum number of computers to return. */
|
|
45
|
+
limit?: number;
|
|
46
|
+
}
|
|
27
47
|
interface ComputerExecResponse {
|
|
28
48
|
exitCode: number;
|
|
29
49
|
stdout: string;
|
|
@@ -48,6 +68,8 @@ interface CreateComputerParams {
|
|
|
48
68
|
memory?: number;
|
|
49
69
|
/** Memory in MB (512-32768). */
|
|
50
70
|
ramMb?: number;
|
|
71
|
+
/** Disk size as MB or a string like "2gb". Alias for diskSizeMb. */
|
|
72
|
+
disk?: number | string;
|
|
51
73
|
/** Disk size in MB (512-51200). */
|
|
52
74
|
diskSizeMb?: number;
|
|
53
75
|
/** Legacy OS image selector. */
|
|
@@ -66,7 +88,7 @@ interface ExecParams {
|
|
|
66
88
|
*
|
|
67
89
|
* Use with any WebSocket library:
|
|
68
90
|
* ```ts
|
|
69
|
-
* const conn = await
|
|
91
|
+
* const conn = await client.getTerminalConnection("my-computer");
|
|
70
92
|
* const ws = new WebSocket(conn.url, { headers: conn.headers });
|
|
71
93
|
* ws.on("open", () => ws.send(conn.firstMessage));
|
|
72
94
|
* ```
|
|
@@ -80,52 +102,57 @@ interface TerminalConnectionInfo {
|
|
|
80
102
|
firstMessage: string;
|
|
81
103
|
}
|
|
82
104
|
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
get(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
105
|
+
/** Convenience object for one Celesto computer. */
|
|
106
|
+
declare class Computer {
|
|
107
|
+
private readonly client;
|
|
108
|
+
private info;
|
|
109
|
+
private constructor();
|
|
110
|
+
/** Create a new computer and return an object with methods on it. */
|
|
111
|
+
static create(params?: CreateComputerParams, config?: ClientConfig): Promise<Computer>;
|
|
112
|
+
/** Load an existing computer by name or ID. */
|
|
113
|
+
static get(computerIdOrName: string, config?: ClientConfig): Promise<Computer>;
|
|
114
|
+
/** List computers in the current account. */
|
|
115
|
+
static list(params?: ListComputersParams, config?: ClientConfig): Promise<Computer[]>;
|
|
116
|
+
/** List available computer templates. */
|
|
117
|
+
static listTemplates(config?: ClientConfig): Promise<SandboxTemplateInfo[]>;
|
|
118
|
+
/** Wrap an existing API response in the convenience object. */
|
|
119
|
+
static fromInfo(info: ComputerInfo, config?: ClientConfig): Computer;
|
|
120
|
+
get id(): string;
|
|
121
|
+
get name(): string;
|
|
122
|
+
get status(): ComputerStatus;
|
|
123
|
+
get vcpus(): number;
|
|
124
|
+
get ramMb(): number;
|
|
125
|
+
get diskSizeMb(): number;
|
|
126
|
+
get image(): string;
|
|
127
|
+
get templateId(): string;
|
|
128
|
+
get templateVersion(): string | null | undefined;
|
|
129
|
+
get connection(): ComputerConnectionInfo | undefined;
|
|
130
|
+
get publishedPorts(): ComputerPublishedPortInfo[] | undefined;
|
|
131
|
+
get lastError(): string | null | undefined;
|
|
132
|
+
get createdAt(): string;
|
|
133
|
+
get stoppedAt(): string | null | undefined;
|
|
134
|
+
/** Get one field from the latest computer data. */
|
|
135
|
+
get<K extends keyof ComputerInfo>(key: K): ComputerInfo[K];
|
|
136
|
+
/** Return a copy of the latest computer data. */
|
|
137
|
+
toJSON(): ComputerInfo;
|
|
138
|
+
/** Reload this computer from Celesto. */
|
|
139
|
+
refresh(): Promise<this>;
|
|
140
|
+
/** Run a shell command on this computer. */
|
|
141
|
+
run(command: string, params?: ExecParams): Promise<ComputerExecResponse>;
|
|
142
|
+
/** Alias for run(). */
|
|
143
|
+
exec(command: string, params?: ExecParams): Promise<ComputerExecResponse>;
|
|
144
|
+
/** Stop this computer and update the local data. */
|
|
145
|
+
stop(): Promise<this>;
|
|
146
|
+
/** Start this computer and update the local data. */
|
|
147
|
+
start(): Promise<this>;
|
|
148
|
+
/** Delete this computer and update the local data. */
|
|
149
|
+
delete(): Promise<this>;
|
|
150
|
+
/** Publish a port and return its public URL when the API provides one. */
|
|
151
|
+
publishPort(port?: number): Promise<string | null>;
|
|
152
|
+
/** List public ports for this computer. */
|
|
153
|
+
listPublishedPorts(): Promise<ComputerPublishedPortInfo[]>;
|
|
154
|
+
/** Remove a public port route. */
|
|
155
|
+
unpublishPort(port?: number): Promise<ComputerPublishedPortInfo>;
|
|
129
156
|
}
|
|
130
157
|
|
|
131
|
-
export { type ComputerConnectionInfo, type ComputerExecResponse, type ComputerInfo, type ComputerListResponse, type
|
|
158
|
+
export { Computer, type ComputerConnectionInfo, type ComputerExecResponse, type ComputerInfo, type ComputerListResponse, type ComputerPublishedPortInfo, type ComputerStatus, type CreateComputerParams, type ExecParams, type ListComputersParams, type PublishedPortStatus, type SandboxTemplateInfo, type TerminalConnectionInfo };
|