@starcell/environment 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +19 -2
- package/dist/client.d.ts +101 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +132 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/tools.d.ts +22 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +110 -0
- package/dist/tools.js.map +1 -0
- package/package.json +41 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LiCHT-77
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @starcell/environment
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Client for the [starcell](https://github.com/LiCHT-77/starcell) environment runtime. The harness runs here; commands run in the environment, reached over the `starcelld` unix socket.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @starcell/environment
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { StarcellClient, createEnvironmentTools } from "@starcell/environment";
|
|
11
|
+
|
|
12
|
+
const client = new StarcellClient({ socketPath: "/run/starcell/starcelld.sock" });
|
|
13
|
+
const env = await client.create({ image: "ubuntu-dev" });
|
|
14
|
+
|
|
15
|
+
await env.exec("apt-get install -y redis", { cwd: "/root", timeoutMs: 600_000 });
|
|
16
|
+
const tools = createEnvironmentTools(env);
|
|
17
|
+
await env.destroy();
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Node 20 or newer. No runtime dependencies. Running `starcelld` and the API it serves are documented in the repository README.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export type Limits = {
|
|
2
|
+
memoryBytes?: number;
|
|
3
|
+
cpuShares?: number;
|
|
4
|
+
cpuPercent?: number;
|
|
5
|
+
maxPids?: number;
|
|
6
|
+
};
|
|
7
|
+
export type EnvironmentRecord = {
|
|
8
|
+
id: string;
|
|
9
|
+
image: string;
|
|
10
|
+
parent?: string;
|
|
11
|
+
lower: string[];
|
|
12
|
+
limits: Limits;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
};
|
|
15
|
+
export type SnapshotRecord = {
|
|
16
|
+
id: string;
|
|
17
|
+
environmentId: string;
|
|
18
|
+
image: string;
|
|
19
|
+
lower: string[];
|
|
20
|
+
diff: string;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
};
|
|
23
|
+
export type ExecRequest = {
|
|
24
|
+
argv: string[];
|
|
25
|
+
cwd?: string;
|
|
26
|
+
env?: Record<string, string>;
|
|
27
|
+
stdin?: string;
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
};
|
|
30
|
+
export type ExecResult = {
|
|
31
|
+
exitCode: number;
|
|
32
|
+
stdout: string;
|
|
33
|
+
stderr: string;
|
|
34
|
+
truncated: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type DirEntry = {
|
|
37
|
+
name: string;
|
|
38
|
+
dir: boolean;
|
|
39
|
+
size: number;
|
|
40
|
+
mode: string;
|
|
41
|
+
mtime: string;
|
|
42
|
+
};
|
|
43
|
+
export type Isolation = {
|
|
44
|
+
namespaces: string[];
|
|
45
|
+
network: string;
|
|
46
|
+
seccomp: string;
|
|
47
|
+
userNamespace: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type RuntimeInfo = {
|
|
50
|
+
layerfs: string;
|
|
51
|
+
runner: string;
|
|
52
|
+
isolation: Isolation;
|
|
53
|
+
images: string[];
|
|
54
|
+
};
|
|
55
|
+
export declare class StarcellError extends Error {
|
|
56
|
+
code: string;
|
|
57
|
+
status: number;
|
|
58
|
+
constructor(status: number, code: string, message: string);
|
|
59
|
+
}
|
|
60
|
+
export declare class StarcellClient {
|
|
61
|
+
readonly socketPath: string;
|
|
62
|
+
constructor(options: {
|
|
63
|
+
socketPath: string;
|
|
64
|
+
});
|
|
65
|
+
raw(method: string, path: string, body?: Uint8Array): Promise<Uint8Array>;
|
|
66
|
+
json<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
67
|
+
info(): Promise<RuntimeInfo>;
|
|
68
|
+
create(options: {
|
|
69
|
+
image: string;
|
|
70
|
+
limits?: Limits;
|
|
71
|
+
}): Promise<Environment>;
|
|
72
|
+
get(id: string): Promise<Environment>;
|
|
73
|
+
list(): Promise<Environment[]>;
|
|
74
|
+
snapshots(): Promise<{
|
|
75
|
+
snapshots: SnapshotRecord[];
|
|
76
|
+
}>;
|
|
77
|
+
deleteSnapshot(snapshotId: string): Promise<void>;
|
|
78
|
+
restore(snapshotId: string, limits?: Limits): Promise<Environment>;
|
|
79
|
+
}
|
|
80
|
+
export declare class Environment {
|
|
81
|
+
readonly client: StarcellClient;
|
|
82
|
+
readonly record: EnvironmentRecord;
|
|
83
|
+
constructor(client: StarcellClient, record: EnvironmentRecord);
|
|
84
|
+
get id(): string;
|
|
85
|
+
private get base();
|
|
86
|
+
exec(command: string | ExecRequest, options?: {
|
|
87
|
+
cwd?: string;
|
|
88
|
+
timeoutMs?: number;
|
|
89
|
+
}): Promise<ExecResult>;
|
|
90
|
+
readonly files: {
|
|
91
|
+
read: (path: string) => Promise<string>;
|
|
92
|
+
write: (path: string, data: string) => Promise<void>;
|
|
93
|
+
remove: (path: string) => Promise<void>;
|
|
94
|
+
list: (path: string) => Promise<DirEntry[]>;
|
|
95
|
+
};
|
|
96
|
+
snapshot(): Promise<SnapshotRecord>;
|
|
97
|
+
fork(): Promise<Environment>;
|
|
98
|
+
destroy(): Promise<void>;
|
|
99
|
+
private filesURL;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,MAAM,GAAG;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,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AAI,MAAM,CAEf;IAED,OAAO,KAAK,IAAI,GAEf;IAED,IAAI,CACF,OAAO,EAAE,MAAM,GAAG,WAAW,EAC7B,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7C,OAAO,CAAC,UAAU,CAAC;IAQtB,QAAQ,CAAC,KAAK;qBACO,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC;sBAGvB,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;uBAGnC,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;qBAGxB,MAAM,KAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;MAO/C;IAEF,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC;IAI7B,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;IAK5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,OAAO,CAAC,QAAQ;CAGjB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import http from "node:http";
|
|
2
|
+
// Uint8Array, not Buffer: the published types stay usable without @types/node.
|
|
3
|
+
const encode = (text) => new TextEncoder().encode(text);
|
|
4
|
+
const decode = (bytes) => new TextDecoder().decode(bytes);
|
|
5
|
+
export class StarcellError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
status;
|
|
8
|
+
constructor(status, code, message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "StarcellError";
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.code = code;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function send(socketPath, method, path, body) {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const req = http.request({ socketPath, method, path, headers: body ? { "content-length": body.length } : {} }, (res) => {
|
|
18
|
+
const chunks = [];
|
|
19
|
+
res.on("data", (c) => chunks.push(c));
|
|
20
|
+
res.on("end", () => resolve({ status: res.statusCode ?? 0, body: Buffer.concat(chunks) }));
|
|
21
|
+
});
|
|
22
|
+
req.on("error", reject);
|
|
23
|
+
if (body)
|
|
24
|
+
req.write(body);
|
|
25
|
+
req.end();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export class StarcellClient {
|
|
29
|
+
socketPath;
|
|
30
|
+
constructor(options) {
|
|
31
|
+
this.socketPath = options.socketPath;
|
|
32
|
+
}
|
|
33
|
+
async raw(method, path, body) {
|
|
34
|
+
const res = await send(this.socketPath, method, path, body);
|
|
35
|
+
if (res.status >= 400) {
|
|
36
|
+
let code = "unknown";
|
|
37
|
+
let message = decode(res.body);
|
|
38
|
+
try {
|
|
39
|
+
const parsed = JSON.parse(message);
|
|
40
|
+
if (parsed.error) {
|
|
41
|
+
code = parsed.error.code;
|
|
42
|
+
message = parsed.error.message;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch { }
|
|
46
|
+
throw new StarcellError(res.status, code, message);
|
|
47
|
+
}
|
|
48
|
+
return res.body;
|
|
49
|
+
}
|
|
50
|
+
async json(method, path, body) {
|
|
51
|
+
const payload = body === undefined ? undefined : encode(JSON.stringify(body));
|
|
52
|
+
const out = await this.raw(method, path, payload);
|
|
53
|
+
return out.length === 0 ? undefined : JSON.parse(decode(out));
|
|
54
|
+
}
|
|
55
|
+
info() {
|
|
56
|
+
return this.json("GET", "/v1/info");
|
|
57
|
+
}
|
|
58
|
+
async create(options) {
|
|
59
|
+
const record = await this.json("POST", "/v1/environments", {
|
|
60
|
+
image: options.image,
|
|
61
|
+
limits: options.limits ?? {},
|
|
62
|
+
});
|
|
63
|
+
return new Environment(this, record);
|
|
64
|
+
}
|
|
65
|
+
async get(id) {
|
|
66
|
+
const record = await this.json("GET", `/v1/environments/${encodeURIComponent(id)}`);
|
|
67
|
+
return new Environment(this, record);
|
|
68
|
+
}
|
|
69
|
+
async list() {
|
|
70
|
+
const out = await this.json("GET", "/v1/environments");
|
|
71
|
+
return out.environments.map((record) => new Environment(this, record));
|
|
72
|
+
}
|
|
73
|
+
snapshots() {
|
|
74
|
+
return this.json("GET", "/v1/snapshots");
|
|
75
|
+
}
|
|
76
|
+
async deleteSnapshot(snapshotId) {
|
|
77
|
+
await this.raw("DELETE", `/v1/snapshots/${encodeURIComponent(snapshotId)}`);
|
|
78
|
+
}
|
|
79
|
+
async restore(snapshotId, limits) {
|
|
80
|
+
const record = await this.json("POST", `/v1/snapshots/${encodeURIComponent(snapshotId)}/clone`, { limits: limits ?? {} });
|
|
81
|
+
return new Environment(this, record);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export class Environment {
|
|
85
|
+
client;
|
|
86
|
+
record;
|
|
87
|
+
constructor(client, record) {
|
|
88
|
+
this.client = client;
|
|
89
|
+
this.record = record;
|
|
90
|
+
}
|
|
91
|
+
get id() {
|
|
92
|
+
return this.record.id;
|
|
93
|
+
}
|
|
94
|
+
get base() {
|
|
95
|
+
return `/v1/environments/${encodeURIComponent(this.record.id)}`;
|
|
96
|
+
}
|
|
97
|
+
exec(command, options) {
|
|
98
|
+
const request = typeof command === "string"
|
|
99
|
+
? { argv: ["/bin/sh", "-c", command], cwd: options?.cwd, timeoutMs: options?.timeoutMs }
|
|
100
|
+
: command;
|
|
101
|
+
return this.client.json("POST", `${this.base}/exec`, request);
|
|
102
|
+
}
|
|
103
|
+
files = {
|
|
104
|
+
read: async (path) => {
|
|
105
|
+
return decode(await this.client.raw("GET", this.filesURL(path)));
|
|
106
|
+
},
|
|
107
|
+
write: async (path, data) => {
|
|
108
|
+
await this.client.raw("PUT", this.filesURL(path), encode(data));
|
|
109
|
+
},
|
|
110
|
+
remove: async (path) => {
|
|
111
|
+
await this.client.raw("DELETE", this.filesURL(path));
|
|
112
|
+
},
|
|
113
|
+
list: async (path) => {
|
|
114
|
+
const out = await this.client.json("GET", `${this.base}/files/list?path=${encodeURIComponent(path)}`);
|
|
115
|
+
return out.entries;
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
snapshot() {
|
|
119
|
+
return this.client.json("POST", `${this.base}/snapshots`);
|
|
120
|
+
}
|
|
121
|
+
async fork() {
|
|
122
|
+
const snapshot = await this.snapshot();
|
|
123
|
+
return this.client.restore(snapshot.id, this.record.limits);
|
|
124
|
+
}
|
|
125
|
+
async destroy() {
|
|
126
|
+
await this.client.raw("DELETE", this.base);
|
|
127
|
+
}
|
|
128
|
+
filesURL(path) {
|
|
129
|
+
return `${this.base}/files?path=${encodeURIComponent(path)}`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,+EAA+E;AAC/E,MAAM,MAAM,GAAG,CAAC,IAAY,EAAc,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5E,MAAM,MAAM,GAAG,CAAC,KAAiB,EAAU,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAgE9E,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,IAAI,CAAS;IACb,MAAM,CAAS;IAEf,YAAY,MAAc,EAAE,IAAY,EAAE,OAAe;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAID,SAAS,IAAI,CACX,UAAkB,EAClB,MAAc,EACd,IAAY,EACZ,IAAiB;IAEjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CACtB,EAAE,UAAU,EAAE,MAAM,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AAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAChC,KAAK,EACL,GAAG,IAAI,CAAC,IAAI,oBAAoB,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAC3D,CAAC;YACF,OAAO,GAAG,CAAC,OAAO,CAAC;QACrB,CAAC;KACF,CAAC;IAEF,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,YAAY,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEO,QAAQ,CAAC,IAAY;QAC3B,OAAO,GAAG,IAAI,CAAC,IAAI,eAAe,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC/D,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { StarcellClient, StarcellError, Environment, type DirEntry, type EnvironmentRecord, type ExecRequest, type ExecResult, type Isolation, type Limits, type RuntimeInfo, type SnapshotRecord, } from "./client.ts";
|
|
2
|
+
export { createEnvironmentTools, type EnvironmentTool, type JSONSchema } from "./tools.ts";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,EACX,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,GASZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAyC,MAAM,YAAY,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Environment } from "./client.ts";
|
|
2
|
+
export type JSONSchema = {
|
|
3
|
+
type: "object";
|
|
4
|
+
properties: Record<string, {
|
|
5
|
+
type: string;
|
|
6
|
+
description: string;
|
|
7
|
+
}>;
|
|
8
|
+
required: string[];
|
|
9
|
+
};
|
|
10
|
+
export type EnvironmentTool = {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: JSONSchema;
|
|
14
|
+
execute: (input: Record<string, unknown>) => Promise<string>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Tools that an agent harness running outside the environment can hand to a
|
|
18
|
+
* model. Every call lands in the environment runtime, so the harness process
|
|
19
|
+
* never touches the host filesystem on the model's behalf.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createEnvironmentTools(env: Environment): EnvironmentTool[];
|
|
22
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClE,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D,CAAC;AAiBF;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,WAAW,GAAG,eAAe,EAAE,CAuF1E"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
function str(input, key) {
|
|
2
|
+
const value = input[key];
|
|
3
|
+
if (typeof value !== "string" || value === "") {
|
|
4
|
+
throw new Error(`tool input ${key} must be a non-empty string`);
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function optionalStr(input, key) {
|
|
9
|
+
const value = input[key];
|
|
10
|
+
if (value === undefined || value === null)
|
|
11
|
+
return undefined;
|
|
12
|
+
if (typeof value !== "string")
|
|
13
|
+
throw new Error(`tool input ${key} must be a string`);
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Tools that an agent harness running outside the environment can hand to a
|
|
18
|
+
* model. Every call lands in the environment runtime, so the harness process
|
|
19
|
+
* never touches the host filesystem on the model's behalf.
|
|
20
|
+
*/
|
|
21
|
+
export function createEnvironmentTools(env) {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
name: "bash",
|
|
25
|
+
description: "Run a shell command inside the environment and return its output.",
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
command: { type: "string", description: "Shell command to run." },
|
|
30
|
+
cwd: { type: "string", description: "Working directory inside the environment." },
|
|
31
|
+
},
|
|
32
|
+
required: ["command"],
|
|
33
|
+
},
|
|
34
|
+
execute: async (input) => {
|
|
35
|
+
const result = await env.exec(str(input, "command"), { cwd: optionalStr(input, "cwd") });
|
|
36
|
+
const parts = [result.stdout, result.stderr].filter((p) => p !== "");
|
|
37
|
+
if (result.truncated)
|
|
38
|
+
parts.push("[output truncated]");
|
|
39
|
+
const output = parts.join("\n");
|
|
40
|
+
return result.exitCode === 0 ? output : `exit ${result.exitCode}\n${output}`;
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "read",
|
|
45
|
+
description: "Read a file from the environment.",
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: "object",
|
|
48
|
+
properties: { path: { type: "string", description: "Absolute path in the environment." } },
|
|
49
|
+
required: ["path"],
|
|
50
|
+
},
|
|
51
|
+
execute: (input) => env.files.read(str(input, "path")),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "write",
|
|
55
|
+
description: "Write a file in the environment, creating parent directories.",
|
|
56
|
+
inputSchema: {
|
|
57
|
+
type: "object",
|
|
58
|
+
properties: {
|
|
59
|
+
path: { type: "string", description: "Absolute path in the environment." },
|
|
60
|
+
content: { type: "string", description: "Full file content." },
|
|
61
|
+
},
|
|
62
|
+
required: ["path", "content"],
|
|
63
|
+
},
|
|
64
|
+
execute: async (input) => {
|
|
65
|
+
const path = str(input, "path");
|
|
66
|
+
await env.files.write(path, String(input.content ?? ""));
|
|
67
|
+
return `wrote ${path}`;
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "edit",
|
|
72
|
+
description: "Replace an exact, unique string in a file in the environment.",
|
|
73
|
+
inputSchema: {
|
|
74
|
+
type: "object",
|
|
75
|
+
properties: {
|
|
76
|
+
path: { type: "string", description: "Absolute path in the environment." },
|
|
77
|
+
oldText: { type: "string", description: "Exact text to replace, unique in the file." },
|
|
78
|
+
newText: { type: "string", description: "Replacement text." },
|
|
79
|
+
},
|
|
80
|
+
required: ["path", "oldText", "newText"],
|
|
81
|
+
},
|
|
82
|
+
execute: async (input) => {
|
|
83
|
+
const path = str(input, "path");
|
|
84
|
+
const oldText = str(input, "oldText");
|
|
85
|
+
const newText = String(input.newText ?? "");
|
|
86
|
+
const current = await env.files.read(path);
|
|
87
|
+
const occurrences = current.split(oldText).length - 1;
|
|
88
|
+
if (occurrences !== 1) {
|
|
89
|
+
throw new Error(`oldText matched ${occurrences} times in ${path}, expected exactly 1`);
|
|
90
|
+
}
|
|
91
|
+
await env.files.write(path, current.replace(oldText, newText));
|
|
92
|
+
return `edited ${path}`;
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "list",
|
|
97
|
+
description: "List a directory in the environment.",
|
|
98
|
+
inputSchema: {
|
|
99
|
+
type: "object",
|
|
100
|
+
properties: { path: { type: "string", description: "Absolute path in the environment." } },
|
|
101
|
+
required: ["path"],
|
|
102
|
+
},
|
|
103
|
+
execute: async (input) => {
|
|
104
|
+
const entries = await env.files.list(str(input, "path"));
|
|
105
|
+
return entries.map((e) => (e.dir ? `${e.name}/` : `${e.name} ${e.size}`)).join("\n");
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAeA,SAAS,GAAG,CAAC,KAA8B,EAAE,GAAW;IACtD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC9C,MAAM,IAAI,KAA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WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE,EAAE;gBAC1F,QAAQ,EAAE,CAAC,MAAM,CAAC;aACnB;YACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACvB,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;gBACzD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvF,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starcell/environment",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Client for the starcell environment runtime: agent harnesses run here, commands run in the environment.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/LiCHT-77/starcell.git",
|
|
9
|
+
"directory": "sdk/typescript"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/LiCHT-77/starcell#readme",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"starcell",
|
|
14
|
+
"agent",
|
|
15
|
+
"sandbox",
|
|
16
|
+
"environment"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.json",
|
|
33
|
+
"prepack": "npm run build",
|
|
34
|
+
"test": "node --test test/*.test.ts"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^24.0.0",
|
|
38
|
+
"typescript": "^5.9.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
43
|
+
}
|