hexel-sdk 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/Makefile +28 -0
- package/README.md +123 -0
- package/dist/_internal/auth.d.ts +17 -0
- package/dist/_internal/auth.d.ts.map +1 -0
- package/dist/_internal/auth.js +50 -0
- package/dist/_internal/auth.js.map +1 -0
- package/dist/_internal/client.d.ts +15 -0
- package/dist/_internal/client.d.ts.map +1 -0
- package/dist/_internal/client.js +22 -0
- package/dist/_internal/client.js.map +1 -0
- package/dist/_internal/http.d.ts +15 -0
- package/dist/_internal/http.d.ts.map +1 -0
- package/dist/_internal/http.js +59 -0
- package/dist/_internal/http.js.map +1 -0
- package/dist/compute/agent.d.ts +18 -0
- package/dist/compute/agent.d.ts.map +1 -0
- package/dist/compute/agent.js +40 -0
- package/dist/compute/agent.js.map +1 -0
- package/dist/compute/index.d.ts +13 -0
- package/dist/compute/index.d.ts.map +1 -0
- package/dist/compute/index.js +36 -0
- package/dist/compute/index.js.map +1 -0
- package/dist/compute/instance.d.ts +18 -0
- package/dist/compute/instance.d.ts.map +1 -0
- package/dist/compute/instance.js +40 -0
- package/dist/compute/instance.js.map +1 -0
- package/dist/compute/sandbox.d.ts +20 -0
- package/dist/compute/sandbox.d.ts.map +1 -0
- package/dist/compute/sandbox.js +44 -0
- package/dist/compute/sandbox.js.map +1 -0
- package/dist/compute/types.d.ts +272 -0
- package/dist/compute/types.d.ts.map +1 -0
- package/dist/compute/types.js +4 -0
- package/dist/compute/types.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/generator/generate.py +180 -0
- package/generator/ir.json +1545 -0
- package/generator/overrides.json +66 -0
- package/generator/parser.py +180 -0
- package/package.json +21 -0
- package/specs/agent-registry-api.json +1 -0
- package/specs/agentd-api.json +1364 -0
- package/specs/compute-api.json +1 -0
- package/src/_internal/auth.ts +56 -0
- package/src/_internal/client.ts +33 -0
- package/src/_internal/http.ts +61 -0
- package/src/compute/agent.ts +41 -0
- package/src/compute/index.ts +20 -0
- package/src/compute/instance.ts +41 -0
- package/src/compute/sandbox.ts +46 -0
- package/src/compute/types.ts +310 -0
- package/src/index.ts +3 -0
- package/tsconfig.json +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hexel Studio
|
|
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/Makefile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.PHONY: generate sync-specs build check clean
|
|
2
|
+
|
|
3
|
+
COMPUTE_REPO := $(HOME)/compute
|
|
4
|
+
REGISTRY_REPO := $(HOME)/agent-registry
|
|
5
|
+
PYTHON := $(HOME)/python-sdk/.venv/bin/python
|
|
6
|
+
|
|
7
|
+
generate:
|
|
8
|
+
$(PYTHON) generator/generate.py
|
|
9
|
+
|
|
10
|
+
sync-specs:
|
|
11
|
+
@echo "→ Syncing specs..."
|
|
12
|
+
cd $(COMPUTE_REPO)/compute-controller && make swagger
|
|
13
|
+
cp $(COMPUTE_REPO)/specs/json/compute-api.json specs/
|
|
14
|
+
cp $(COMPUTE_REPO)/specs/json/agentd-api.json specs/
|
|
15
|
+
cp $(REGISTRY_REPO)/specs/json/agent-registry-api.json specs/
|
|
16
|
+
@echo "✓ Specs synced"
|
|
17
|
+
$(MAKE) generate
|
|
18
|
+
|
|
19
|
+
build:
|
|
20
|
+
npm run build
|
|
21
|
+
|
|
22
|
+
check:
|
|
23
|
+
npx tsc --noEmit
|
|
24
|
+
|
|
25
|
+
clean:
|
|
26
|
+
rm -rf src/compute/*.ts dist/
|
|
27
|
+
|
|
28
|
+
all: sync-specs build
|
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Hexel TypeScript SDK
|
|
2
|
+
|
|
3
|
+
The official TypeScript/Node.js SDK for [Hexel Studio](https://hexelstudio.com) — build, deploy, and run AI agents.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @hexel/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Hexel } from "@hexel/sdk";
|
|
15
|
+
|
|
16
|
+
const client = new Hexel({ apiKey: "your_api_key" });
|
|
17
|
+
|
|
18
|
+
// Create a sandbox
|
|
19
|
+
const sandbox = await client.compute.sandbox.create({ tier: "standard" });
|
|
20
|
+
console.log(sandbox); // { vm_id: "...", state: "allocated", ... }
|
|
21
|
+
|
|
22
|
+
// Register an agent
|
|
23
|
+
const agent = await client.compute.agent.register({
|
|
24
|
+
name: "my-agent",
|
|
25
|
+
image: "ghcr.io/org/agent:v1",
|
|
26
|
+
capabilities: ["chat"],
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Deploy
|
|
30
|
+
const instance = await client.compute.instance.deploy(agent.id);
|
|
31
|
+
console.log(instance.endpoint);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Authentication
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// API Key (recommended for development)
|
|
38
|
+
const client = new Hexel({ apiKey: "studio_live_xxxx" });
|
|
39
|
+
|
|
40
|
+
// OAuth Client Credentials (recommended for production)
|
|
41
|
+
const client = new Hexel({
|
|
42
|
+
clientId: "your_client_id",
|
|
43
|
+
clientSecret: "your_client_secret",
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Both methods exchange credentials for a short-lived STS token automatically.
|
|
48
|
+
|
|
49
|
+
## Sandboxes
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
// Create
|
|
53
|
+
const sandbox = await client.compute.sandbox.create({ tier: "standard" });
|
|
54
|
+
|
|
55
|
+
// List
|
|
56
|
+
const sandboxes = await client.compute.sandbox.list();
|
|
57
|
+
|
|
58
|
+
// Get
|
|
59
|
+
const info = await client.compute.sandbox.get("vm-id");
|
|
60
|
+
|
|
61
|
+
// Renew
|
|
62
|
+
await client.compute.sandbox.renew("vm-id", { ttl_seconds: 3600 });
|
|
63
|
+
|
|
64
|
+
// Release
|
|
65
|
+
await client.compute.sandbox.release("vm-id", { recycle: true });
|
|
66
|
+
|
|
67
|
+
// Delete
|
|
68
|
+
await client.compute.sandbox.delete("vm-id");
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Agents
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// Register
|
|
75
|
+
const agent = await client.compute.agent.register({
|
|
76
|
+
name: "fraud-detector",
|
|
77
|
+
image: "ghcr.io/org/fraud-agent:v1",
|
|
78
|
+
capabilities: ["fraud-detection"],
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// List
|
|
82
|
+
const agents = await client.compute.agent.list();
|
|
83
|
+
|
|
84
|
+
// Get
|
|
85
|
+
const agent = await client.compute.agent.get("agent-id");
|
|
86
|
+
|
|
87
|
+
// Delete
|
|
88
|
+
await client.compute.agent.delete("agent-id");
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Instances
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// Deploy
|
|
95
|
+
const instance = await client.compute.instance.deploy("agent-id");
|
|
96
|
+
|
|
97
|
+
// List
|
|
98
|
+
const instances = await client.compute.instance.list();
|
|
99
|
+
|
|
100
|
+
// Stop
|
|
101
|
+
await client.compute.instance.stop("deployment-id");
|
|
102
|
+
|
|
103
|
+
// Redeploy
|
|
104
|
+
await client.compute.instance.redeploy("deployment-id");
|
|
105
|
+
|
|
106
|
+
// Delete
|
|
107
|
+
await client.compute.instance.delete("deployment-id");
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Configuration
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
const client = new Hexel({ apiKey: "your_api_key" });
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Requirements
|
|
117
|
+
|
|
118
|
+
- Node.js 18+
|
|
119
|
+
- TypeScript 5+
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Token management — API key and client_credentials auth flows. */
|
|
2
|
+
interface AuthConfig {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
clientId?: string;
|
|
5
|
+
clientSecret?: string;
|
|
6
|
+
stsUrl: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class AuthManager {
|
|
9
|
+
private accessToken;
|
|
10
|
+
private expiresAt;
|
|
11
|
+
private config;
|
|
12
|
+
constructor(config: AuthConfig);
|
|
13
|
+
getToken(): Promise<string>;
|
|
14
|
+
refresh(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/_internal/auth.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,UAAU;IAOxB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAQ3B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CA0B/B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Token management — API key and client_credentials auth flows. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AuthManager = void 0;
|
|
5
|
+
class AuthManager {
|
|
6
|
+
accessToken = null;
|
|
7
|
+
expiresAt = 0;
|
|
8
|
+
config;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
if (!config.apiKey && !(config.clientId && config.clientSecret)) {
|
|
11
|
+
throw new Error("Provide apiKey or (clientId + clientSecret)");
|
|
12
|
+
}
|
|
13
|
+
this.config = config;
|
|
14
|
+
}
|
|
15
|
+
async getToken() {
|
|
16
|
+
if (this.accessToken && Date.now() / 1000 < this.expiresAt - 30) {
|
|
17
|
+
return this.accessToken;
|
|
18
|
+
}
|
|
19
|
+
await this.refresh();
|
|
20
|
+
return this.accessToken;
|
|
21
|
+
}
|
|
22
|
+
async refresh() {
|
|
23
|
+
const url = `${this.config.stsUrl}/token`;
|
|
24
|
+
let resp;
|
|
25
|
+
if (this.config.apiKey) {
|
|
26
|
+
resp = await fetch(url, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: { "X-API-Key": this.config.apiKey },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
resp = await fetch(url, {
|
|
33
|
+
method: "POST",
|
|
34
|
+
headers: { "Content-Type": "application/json" },
|
|
35
|
+
body: JSON.stringify({
|
|
36
|
+
grant_type: "client_credentials",
|
|
37
|
+
client_id: this.config.clientId,
|
|
38
|
+
client_secret: this.config.clientSecret,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (!resp.ok)
|
|
43
|
+
throw new Error(`STS token exchange failed: ${resp.status}`);
|
|
44
|
+
const data = await resp.json();
|
|
45
|
+
this.accessToken = data.access_token;
|
|
46
|
+
this.expiresAt = Date.now() / 1000 + (data.expires_in || 900);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.AuthManager = AuthManager;
|
|
50
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/_internal/auth.ts"],"names":[],"mappings":";AAAA,oEAAoE;;;AASpE,MAAa,WAAW;IACd,WAAW,GAAkB,IAAI,CAAC;IAClC,SAAS,GAAG,CAAC,CAAC;IACd,MAAM,CAAa;IAE3B,YAAY,MAAkB;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;YAChE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,IAAI,IAAI,CAAC,WA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CAAC,IAAI,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC;IAChE,CAAC;CACF;AA9CD,kCA8CC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Main Hexel client. */
|
|
2
|
+
import { ComputeClient } from "../compute";
|
|
3
|
+
export interface HexelConfig {
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
clientId?: string;
|
|
6
|
+
clientSecret?: string;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
stsUrl?: string;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class Hexel {
|
|
12
|
+
readonly compute: ComputeClient;
|
|
13
|
+
constructor(config: HexelConfig);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/_internal/client.ts"],"names":[],"mappings":"AAAA,yBAAyB;AAIzB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,KAAK;IAChB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;gBAEpB,MAAM,EAAE,WAAW;CAchC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Main Hexel client. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Hexel = void 0;
|
|
5
|
+
const auth_1 = require("./auth");
|
|
6
|
+
const http_1 = require("./http");
|
|
7
|
+
const compute_1 = require("../compute");
|
|
8
|
+
class Hexel {
|
|
9
|
+
compute;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
const auth = new auth_1.AuthManager({
|
|
12
|
+
apiKey: config.apiKey,
|
|
13
|
+
clientId: config.clientId,
|
|
14
|
+
clientSecret: config.clientSecret,
|
|
15
|
+
stsUrl: config.stsUrl || "https://sts.hexelstudio.com",
|
|
16
|
+
});
|
|
17
|
+
const http = new http_1.HttpClient(config.baseUrl || "https://compute.hexelstudio.com", auth, config.timeout || 30000);
|
|
18
|
+
this.compute = new compute_1.ComputeClient(http);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Hexel = Hexel;
|
|
22
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/_internal/client.ts"],"names":[],"mappings":";AAAA,yBAAyB;;;AAEzB,iCAAqC;AACrC,iCAAoC;AACpC,wCAA2C;AAW3C,MAAa,KAAK;IACP,OAAO,CAAgB;IAEhC,YAAY,MAAmB;QAC7B,MAAM,IAAI,GAAG,IAAI,kBAAW,CAAC;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,6BAA6B;SACvD,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,iBAAU,CACzB,MAAM,CAAC,OAAO,IAAI,iCAAiC,EACnD,IAAI,EACJ,MAAM,CAAC,OAAO,IAAI,KAAK,CACxB,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,uBAAa,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AAjBD,sBAiBC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** HTTP request pipeline — retries, auth refresh, backoff. */
|
|
2
|
+
import { AuthManager } from "./auth";
|
|
3
|
+
export declare class HttpClient {
|
|
4
|
+
private baseUrl;
|
|
5
|
+
private auth;
|
|
6
|
+
private timeout;
|
|
7
|
+
constructor(baseUrl: string, auth: AuthManager, timeout?: number);
|
|
8
|
+
request(method: string, path: string, data?: unknown): Promise<unknown>;
|
|
9
|
+
get(path: string): Promise<unknown>;
|
|
10
|
+
post(path: string, data?: unknown): Promise<unknown>;
|
|
11
|
+
put(path: string, data?: unknown): Promise<unknown>;
|
|
12
|
+
delete(path: string): Promise<unknown>;
|
|
13
|
+
patch(path: string, data?: unknown): Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/_internal/http.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAKrC,qBAAa,UAAU;IAEnB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;gBAFP,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE,MAAc;IAK3B,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAuC7E,GAAG,CAAC,IAAI,EAAE,MAAM;IAChB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;IACjC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;IAChC,MAAM,CAAC,IAAI,EAAE,MAAM;IACnB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CACnC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** HTTP request pipeline — retries, auth refresh, backoff. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.HttpClient = void 0;
|
|
5
|
+
const RETRY_STATUS = new Set([429, 500, 502, 503]);
|
|
6
|
+
const MAX_RETRIES = 3;
|
|
7
|
+
class HttpClient {
|
|
8
|
+
baseUrl;
|
|
9
|
+
auth;
|
|
10
|
+
timeout;
|
|
11
|
+
constructor(baseUrl, auth, timeout = 30000) {
|
|
12
|
+
this.baseUrl = baseUrl;
|
|
13
|
+
this.auth = auth;
|
|
14
|
+
this.timeout = timeout;
|
|
15
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
16
|
+
}
|
|
17
|
+
async request(method, path, data) {
|
|
18
|
+
const url = `${this.baseUrl}${path}`;
|
|
19
|
+
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
20
|
+
const token = await this.auth.getToken();
|
|
21
|
+
const headers = {
|
|
22
|
+
Authorization: `Bearer ${token}`,
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
};
|
|
25
|
+
const init = { method, headers };
|
|
26
|
+
if (data && method !== "GET") {
|
|
27
|
+
init.body = JSON.stringify(data);
|
|
28
|
+
}
|
|
29
|
+
const resp = await fetch(url, init);
|
|
30
|
+
if (resp.status === 401 && attempt === 0) {
|
|
31
|
+
await this.auth.refresh();
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (RETRY_STATUS.has(resp.status) && attempt < MAX_RETRIES) {
|
|
35
|
+
await new Promise((r) => setTimeout(r, 500 * 2 ** attempt));
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (!resp.ok) {
|
|
39
|
+
const body = await resp.text().catch(() => "");
|
|
40
|
+
throw new Error(`${method} ${path} failed: ${resp.status} ${body}`);
|
|
41
|
+
}
|
|
42
|
+
const text = await resp.text();
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(text);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return text;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
throw new Error(`${method} ${path} failed after ${MAX_RETRIES} retries`);
|
|
51
|
+
}
|
|
52
|
+
get(path) { return this.request("GET", path); }
|
|
53
|
+
post(path, data) { return this.request("POST", path, data); }
|
|
54
|
+
put(path, data) { return this.request("PUT", path, data); }
|
|
55
|
+
delete(path) { return this.request("DELETE", path); }
|
|
56
|
+
patch(path, data) { return this.request("PATCH", path, data); }
|
|
57
|
+
}
|
|
58
|
+
exports.HttpClient = HttpClient;
|
|
59
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/_internal/http.ts"],"names":[],"mappings":";AAAA,8DAA8D;;;AAI9D,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AACnD,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAa,UAAU;IAEX;IACA;IACA;IAHV,YACU,OAAe,EACf,IAAiB,EACjB,UAAkB,KAAK;QAFvB,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAAa;QACjB,YAAO,GAAP,OAAO,CAAgB;QAE/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,IAAY,EAAE,IAAc;QACxD,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC;QAErC,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;YACxD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACzC,MAAM,OAAO,GAA2B;gBACtC,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,cAAc,EAAE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,MAAM,IAAI,IAAI,iBAAiB,WAAW,UAAU,CAAC,CAAC;IAC3E,CAAC;IAED,GAAG,CAAC,IAAY,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACvD,IAAI,CAAC,IAAY,EAAE,IAAc,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/E,GAAG,CAAC,IAAY,EAAE,IAAc,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7E,MAAM,CAAC,IAAY,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7D,KAAK,CAAC,IAAY,EAAE,IAAc,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CAClF;AArDD,gCAqDC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HttpClient } from "../_internal/http";
|
|
2
|
+
export declare class AgentClient {
|
|
3
|
+
private http;
|
|
4
|
+
constructor(http: HttpClient);
|
|
5
|
+
/** Register a new agent in the catalog */
|
|
6
|
+
register(data: Record<string, unknown>): Promise<unknown>;
|
|
7
|
+
/** List agents with optional filters */
|
|
8
|
+
list(): Promise<unknown>;
|
|
9
|
+
/** Get agent by ID */
|
|
10
|
+
get(id: string): Promise<unknown>;
|
|
11
|
+
/** Update agent fields */
|
|
12
|
+
update(id: string, data: Record<string, unknown>): Promise<unknown>;
|
|
13
|
+
/** Delete agent by ID */
|
|
14
|
+
delete(id: string): Promise<void>;
|
|
15
|
+
/** Find agents matching given capabilities */
|
|
16
|
+
search(): Promise<unknown>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/compute/agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,qBAAa,WAAW;IACV,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC,0CAA0C;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/D,wCAAwC;IAClC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAK9B,sBAAsB;IAChB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvC,0BAA0B;IACpB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAKzE,yBAAyB;IACnB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,8CAA8C;IACxC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;CAIjC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentClient = void 0;
|
|
4
|
+
class AgentClient {
|
|
5
|
+
http;
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
/** Register a new agent in the catalog */
|
|
10
|
+
async register(data) {
|
|
11
|
+
const resp = await this.http.post("/registry/v1/agents", data);
|
|
12
|
+
return resp;
|
|
13
|
+
}
|
|
14
|
+
/** List agents with optional filters */
|
|
15
|
+
async list() {
|
|
16
|
+
const resp = await this.http.get("/registry/v1/agents");
|
|
17
|
+
return resp;
|
|
18
|
+
}
|
|
19
|
+
/** Get agent by ID */
|
|
20
|
+
async get(id) {
|
|
21
|
+
const resp = await this.http.get("/registry/v1/agents/{id}".replace("{id}", id));
|
|
22
|
+
return resp;
|
|
23
|
+
}
|
|
24
|
+
/** Update agent fields */
|
|
25
|
+
async update(id, data) {
|
|
26
|
+
const resp = await this.http.put("/registry/v1/agents/{id}".replace("{id}", id), data);
|
|
27
|
+
return resp;
|
|
28
|
+
}
|
|
29
|
+
/** Delete agent by ID */
|
|
30
|
+
async delete(id) {
|
|
31
|
+
const resp = await this.http.delete("/registry/v1/agents/{id}".replace("{id}", id));
|
|
32
|
+
}
|
|
33
|
+
/** Find agents matching given capabilities */
|
|
34
|
+
async search() {
|
|
35
|
+
const resp = await this.http.get("/registry/v1/agents/search");
|
|
36
|
+
return resp;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.AgentClient = AgentClient;
|
|
40
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/compute/agent.ts"],"names":[],"mappings":";;;AAGA,MAAa,WAAW;IACF;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC,0CAA0C;IAC1C,KAAK,CAAC,QAAQ,CAAC,IAA6B;QAC1C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wCAAwC;IACxC,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,sBAAsB;IACtB,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;QACjF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAA0B;IAC1B,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,IAA6B;QACpD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QACvF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yBAAyB;IACzB,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,0BAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IACtF,CAAC;IAED,8CAA8C;IAC9C,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArCD,kCAqCC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HttpClient } from "../_internal/http";
|
|
2
|
+
import { SandboxClient } from "./sandbox";
|
|
3
|
+
import { AgentClient } from "./agent";
|
|
4
|
+
import { InstanceClient } from "./instance";
|
|
5
|
+
export declare class ComputeClient {
|
|
6
|
+
readonly sandbox: SandboxClient;
|
|
7
|
+
readonly agent: AgentClient;
|
|
8
|
+
readonly instance: InstanceClient;
|
|
9
|
+
constructor(http: HttpClient);
|
|
10
|
+
}
|
|
11
|
+
export { SandboxClient, AgentClient, InstanceClient };
|
|
12
|
+
export * from "./types";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compute/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,qBAAa,aAAa;IACxB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;gBAEtB,IAAI,EAAE,UAAU;CAK7B;AAED,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AACtD,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.InstanceClient = exports.AgentClient = exports.SandboxClient = exports.ComputeClient = void 0;
|
|
18
|
+
const sandbox_1 = require("./sandbox");
|
|
19
|
+
Object.defineProperty(exports, "SandboxClient", { enumerable: true, get: function () { return sandbox_1.SandboxClient; } });
|
|
20
|
+
const agent_1 = require("./agent");
|
|
21
|
+
Object.defineProperty(exports, "AgentClient", { enumerable: true, get: function () { return agent_1.AgentClient; } });
|
|
22
|
+
const instance_1 = require("./instance");
|
|
23
|
+
Object.defineProperty(exports, "InstanceClient", { enumerable: true, get: function () { return instance_1.InstanceClient; } });
|
|
24
|
+
class ComputeClient {
|
|
25
|
+
sandbox;
|
|
26
|
+
agent;
|
|
27
|
+
instance;
|
|
28
|
+
constructor(http) {
|
|
29
|
+
this.sandbox = new sandbox_1.SandboxClient(http);
|
|
30
|
+
this.agent = new agent_1.AgentClient(http);
|
|
31
|
+
this.instance = new instance_1.InstanceClient(http);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ComputeClient = ComputeClient;
|
|
35
|
+
__exportStar(require("./types"), exports);
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compute/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,uCAA0C;AAgBjC,8FAhBA,uBAAa,OAgBA;AAftB,mCAAsC;AAed,4FAff,mBAAW,OAee;AAdnC,yCAA4C;AAcP,+FAd5B,yBAAc,OAc4B;AAZnD,MAAa,aAAa;IACf,OAAO,CAAgB;IACvB,KAAK,CAAc;IACnB,QAAQ,CAAiB;IAElC,YAAY,IAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,uBAAa,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,IAAI,mBAAW,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,IAAI,yBAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF;AAVD,sCAUC;AAGD,0CAAwB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HttpClient } from "../_internal/http";
|
|
2
|
+
export declare class InstanceClient {
|
|
3
|
+
private http;
|
|
4
|
+
constructor(http: HttpClient);
|
|
5
|
+
/** Creates a new deployment from a registered agent. Returns a deployment_id to use for all subsequent operations. */
|
|
6
|
+
deploy(agentId: string): Promise<unknown>;
|
|
7
|
+
/** List all deployments */
|
|
8
|
+
list(): Promise<unknown>;
|
|
9
|
+
/** Get deployment by ID */
|
|
10
|
+
get(deploymentId: string): Promise<unknown>;
|
|
11
|
+
/** Delete a deployment */
|
|
12
|
+
delete(deploymentId: string): Promise<void>;
|
|
13
|
+
/** Stop a deployment */
|
|
14
|
+
stop(deploymentId: string): Promise<unknown>;
|
|
15
|
+
/** Redeploy (stop + start) */
|
|
16
|
+
redeploy(deploymentId: string): Promise<unknown>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=instance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/compute/instance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,qBAAa,cAAc;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC,sHAAsH;IAChH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/C,2BAA2B;IACrB,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAK9B,2BAA2B;IACrB,GAAG,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKjD,0BAA0B;IACpB,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD,wBAAwB;IAClB,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKlD,8BAA8B;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAIvD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstanceClient = void 0;
|
|
4
|
+
class InstanceClient {
|
|
5
|
+
http;
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
/** Creates a new deployment from a registered agent. Returns a deployment_id to use for all subsequent operations. */
|
|
10
|
+
async deploy(agentId) {
|
|
11
|
+
const resp = await this.http.post("/compute/v1/agents/{agent_id}/deploy".replace("{agent_id}", agentId));
|
|
12
|
+
return resp;
|
|
13
|
+
}
|
|
14
|
+
/** List all deployments */
|
|
15
|
+
async list() {
|
|
16
|
+
const resp = await this.http.get("/compute/v1/deployments");
|
|
17
|
+
return resp;
|
|
18
|
+
}
|
|
19
|
+
/** Get deployment by ID */
|
|
20
|
+
async get(deploymentId) {
|
|
21
|
+
const resp = await this.http.get("/compute/v1/deployments/{deployment_id}".replace("{deployment_id}", deploymentId));
|
|
22
|
+
return resp;
|
|
23
|
+
}
|
|
24
|
+
/** Delete a deployment */
|
|
25
|
+
async delete(deploymentId) {
|
|
26
|
+
const resp = await this.http.delete("/compute/v1/deployments/{deployment_id}".replace("{deployment_id}", deploymentId));
|
|
27
|
+
}
|
|
28
|
+
/** Stop a deployment */
|
|
29
|
+
async stop(deploymentId) {
|
|
30
|
+
const resp = await this.http.post("/compute/v1/deployments/{deployment_id}/stop".replace("{deployment_id}", deploymentId));
|
|
31
|
+
return resp;
|
|
32
|
+
}
|
|
33
|
+
/** Redeploy (stop + start) */
|
|
34
|
+
async redeploy(deploymentId) {
|
|
35
|
+
const resp = await this.http.post("/compute/v1/deployments/{deployment_id}/redeploy".replace("{deployment_id}", deploymentId));
|
|
36
|
+
return resp;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.InstanceClient = InstanceClient;
|
|
40
|
+
//# sourceMappingURL=instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../src/compute/instance.ts"],"names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DAAkD,CAAC,OAAO,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC,CAAC;QAC/H,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArCD,wCAqCC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HttpClient } from "../_internal/http";
|
|
2
|
+
export declare class SandboxClient {
|
|
3
|
+
private http;
|
|
4
|
+
constructor(http: HttpClient);
|
|
5
|
+
/** Allocates a VM from the pool or creates a new one for the requesting org */
|
|
6
|
+
create(data: Record<string, unknown>): Promise<unknown>;
|
|
7
|
+
/** Returns VMs scoped to the caller's org */
|
|
8
|
+
list(): Promise<unknown>;
|
|
9
|
+
/** Get Agent VM by ID */
|
|
10
|
+
get(id: string): Promise<unknown>;
|
|
11
|
+
/** Delete Agent VM */
|
|
12
|
+
delete(id: string): Promise<void>;
|
|
13
|
+
/** Release Agent VM */
|
|
14
|
+
release(id: string, data: Record<string, unknown>): Promise<unknown>;
|
|
15
|
+
/** Renew Agent VM TTL */
|
|
16
|
+
renew(id: string, data: Record<string, unknown>): Promise<unknown>;
|
|
17
|
+
/** Runs code or shell commands in an allocated sandbox VM */
|
|
18
|
+
execute(id: string): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/compute/sandbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,qBAAa,aAAa;IACZ,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC,+EAA+E;IACzE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAK7D,6CAA6C;IACvC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAK9B,yBAAyB;IACnB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvC,sBAAsB;IAChB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,uBAAuB;IACjB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAK1E,yBAAyB;IACnB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxE,6DAA6D;IACvD,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGzC"}
|