plato-sandbox-sdk 1.1.1

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.
Files changed (203) hide show
  1. package/BaseClient.ts +28 -0
  2. package/Client.ts +1849 -0
  3. package/README.md +339 -0
  4. package/api/client/index.ts +1 -0
  5. package/api/client/requests/CreateSandboxRequest.ts +37 -0
  6. package/api/client/requests/CreateSnapshotRequest.ts +11 -0
  7. package/api/client/requests/EvaluateRequest.ts +9 -0
  8. package/api/client/requests/GetEnvironmentStateRequest.ts +11 -0
  9. package/api/client/requests/GetTestCasesRequest.ts +15 -0
  10. package/api/client/requests/LogRequest.ts +19 -0
  11. package/api/client/requests/MakeEnvironmentRequest.ts +27 -0
  12. package/api/client/requests/PostEvaluationResultRequest.ts +14 -0
  13. package/api/client/requests/ResetEnvironmentRequest.ts +11 -0
  14. package/api/client/requests/SetupRootAccessRequest.ts +14 -0
  15. package/api/client/requests/SetupSandboxRequest.ts +29 -0
  16. package/api/client/requests/StartWorkerRequest.ts +28 -0
  17. package/api/client/requests/index.ts +12 -0
  18. package/api/errors/BadRequestError.ts +17 -0
  19. package/api/errors/index.ts +1 -0
  20. package/api/index.ts +3 -0
  21. package/api/types/ActiveSessionResponse.ts +6 -0
  22. package/api/types/BackupEnvironmentResponse.ts +7 -0
  23. package/api/types/CdpUrlResponse.ts +12 -0
  24. package/api/types/CloseEnvironmentResponse.ts +6 -0
  25. package/api/types/CreateSandboxResponse.ts +14 -0
  26. package/api/types/CreateSnapshotResponse.ts +10 -0
  27. package/api/types/DeleteSandboxResponse.ts +6 -0
  28. package/api/types/Environment.ts +7 -0
  29. package/api/types/EnvironmentStateResponse.ts +11 -0
  30. package/api/types/ErrorResponse.ts +6 -0
  31. package/api/types/EvaluateResponse.ts +21 -0
  32. package/api/types/EvaluationResult.ts +9 -0
  33. package/api/types/HeartbeatResponse.ts +6 -0
  34. package/api/types/JobStatusResponse.ts +7 -0
  35. package/api/types/LogResponse.ts +5 -0
  36. package/api/types/MakeEnvironmentResponse.ts +6 -0
  37. package/api/types/OperationEvent.ts +42 -0
  38. package/api/types/PlatoConfig.ts +8 -0
  39. package/api/types/PlatoTask.ts +21 -0
  40. package/api/types/PlatoTaskMetadata.ts +20 -0
  41. package/api/types/PostEvaluationResultResponse.ts +6 -0
  42. package/api/types/ProxyUrlResponse.ts +12 -0
  43. package/api/types/ResetEnvironmentResponse.ts +13 -0
  44. package/api/types/RunningSessionsCountResponse.ts +6 -0
  45. package/api/types/Sandbox.ts +10 -0
  46. package/api/types/ScoringType.ts +7 -0
  47. package/api/types/SetupRootAccessResponse.ts +7 -0
  48. package/api/types/SetupSandboxResponse.ts +6 -0
  49. package/api/types/SimConfigCompute.ts +9 -0
  50. package/api/types/SimConfigDataset.ts +10 -0
  51. package/api/types/SimConfigListener.ts +27 -0
  52. package/api/types/SimConfigMetadata.ts +14 -0
  53. package/api/types/SimConfigService.ts +8 -0
  54. package/api/types/Simulator.ts +10 -0
  55. package/api/types/SimulatorListItem.ts +7 -0
  56. package/api/types/SshInfo.ts +18 -0
  57. package/api/types/StartWorkerResponse.ts +7 -0
  58. package/api/types/TaskMetadata.ts +20 -0
  59. package/api/types/TestCase.ts +40 -0
  60. package/api/types/TestCasesResponse.ts +10 -0
  61. package/api/types/Variable.ts +6 -0
  62. package/api/types/WorkerReadyResponse.ts +9 -0
  63. package/api/types/index.ts +42 -0
  64. package/core/fetcher/APIResponse.ts +23 -0
  65. package/core/fetcher/BinaryResponse.ts +36 -0
  66. package/core/fetcher/EndpointMetadata.ts +13 -0
  67. package/core/fetcher/EndpointSupplier.ts +14 -0
  68. package/core/fetcher/Fetcher.ts +165 -0
  69. package/core/fetcher/Headers.ts +93 -0
  70. package/core/fetcher/HttpResponsePromise.ts +116 -0
  71. package/core/fetcher/RawResponse.ts +61 -0
  72. package/core/fetcher/ResponseWithBody.ts +7 -0
  73. package/core/fetcher/Supplier.ts +11 -0
  74. package/core/fetcher/createRequestUrl.ts +6 -0
  75. package/core/fetcher/getErrorResponseBody.ts +33 -0
  76. package/core/fetcher/getFetchFn.ts +3 -0
  77. package/core/fetcher/getHeader.ts +8 -0
  78. package/core/fetcher/getRequestBody.ts +16 -0
  79. package/core/fetcher/getResponseBody.ts +43 -0
  80. package/core/fetcher/index.ts +11 -0
  81. package/core/fetcher/makeRequest.ts +44 -0
  82. package/core/fetcher/requestWithRetries.ts +73 -0
  83. package/core/fetcher/signals.ts +38 -0
  84. package/core/headers.ts +33 -0
  85. package/core/index.ts +4 -0
  86. package/core/json.ts +27 -0
  87. package/core/runtime/index.ts +1 -0
  88. package/core/runtime/runtime.ts +133 -0
  89. package/core/stream/Stream.ts +155 -0
  90. package/core/stream/index.ts +1 -0
  91. package/core/url/encodePathParam.ts +18 -0
  92. package/core/url/index.ts +3 -0
  93. package/core/url/join.ts +80 -0
  94. package/core/url/qs.ts +74 -0
  95. package/dist/BaseClient.d.ts +25 -0
  96. package/dist/Client.d.ts +376 -0
  97. package/dist/api/client/index.d.ts +2 -0
  98. package/dist/api/client/requests/CreateSandboxRequest.d.ts +35 -0
  99. package/dist/api/client/requests/CreateSnapshotRequest.d.ts +10 -0
  100. package/dist/api/client/requests/EvaluateRequest.d.ts +8 -0
  101. package/dist/api/client/requests/GetEnvironmentStateRequest.d.ts +10 -0
  102. package/dist/api/client/requests/GetTestCasesRequest.d.ts +14 -0
  103. package/dist/api/client/requests/LogRequest.d.ts +18 -0
  104. package/dist/api/client/requests/MakeEnvironmentRequest.d.ts +26 -0
  105. package/dist/api/client/requests/PostEvaluationResultRequest.d.ts +13 -0
  106. package/dist/api/client/requests/ResetEnvironmentRequest.d.ts +10 -0
  107. package/dist/api/client/requests/SetupRootAccessRequest.d.ts +13 -0
  108. package/dist/api/client/requests/SetupSandboxRequest.d.ts +27 -0
  109. package/dist/api/client/requests/StartWorkerRequest.d.ts +26 -0
  110. package/dist/api/client/requests/index.d.ts +13 -0
  111. package/dist/api/errors/BadRequestError.d.ts +7 -0
  112. package/dist/api/errors/index.d.ts +2 -0
  113. package/dist/api/index.d.ts +4 -0
  114. package/dist/api/types/ActiveSessionResponse.d.ts +5 -0
  115. package/dist/api/types/BackupEnvironmentResponse.d.ts +6 -0
  116. package/dist/api/types/CdpUrlResponse.d.ts +10 -0
  117. package/dist/api/types/CloseEnvironmentResponse.d.ts +5 -0
  118. package/dist/api/types/CreateSandboxResponse.d.ts +13 -0
  119. package/dist/api/types/CreateSnapshotResponse.d.ts +9 -0
  120. package/dist/api/types/DeleteSandboxResponse.d.ts +5 -0
  121. package/dist/api/types/Environment.d.ts +6 -0
  122. package/dist/api/types/EnvironmentStateResponse.d.ts +9 -0
  123. package/dist/api/types/ErrorResponse.d.ts +5 -0
  124. package/dist/api/types/EvaluateResponse.d.ts +18 -0
  125. package/dist/api/types/EvaluationResult.d.ts +8 -0
  126. package/dist/api/types/HeartbeatResponse.d.ts +5 -0
  127. package/dist/api/types/JobStatusResponse.d.ts +6 -0
  128. package/dist/api/types/LogResponse.d.ts +4 -0
  129. package/dist/api/types/MakeEnvironmentResponse.d.ts +5 -0
  130. package/dist/api/types/OperationEvent.d.ts +40 -0
  131. package/dist/api/types/PlatoConfig.d.ts +6 -0
  132. package/dist/api/types/PlatoTask.d.ts +19 -0
  133. package/dist/api/types/PlatoTaskMetadata.d.ts +18 -0
  134. package/dist/api/types/PostEvaluationResultResponse.d.ts +5 -0
  135. package/dist/api/types/ProxyUrlResponse.d.ts +10 -0
  136. package/dist/api/types/ResetEnvironmentResponse.d.ts +11 -0
  137. package/dist/api/types/RunningSessionsCountResponse.d.ts +5 -0
  138. package/dist/api/types/Sandbox.d.ts +9 -0
  139. package/dist/api/types/ScoringType.d.ts +6 -0
  140. package/dist/api/types/SetupRootAccessResponse.d.ts +6 -0
  141. package/dist/api/types/SetupSandboxResponse.d.ts +5 -0
  142. package/dist/api/types/SimConfigCompute.d.ts +8 -0
  143. package/dist/api/types/SimConfigDataset.d.ts +8 -0
  144. package/dist/api/types/SimConfigListener.d.ts +25 -0
  145. package/dist/api/types/SimConfigMetadata.d.ts +12 -0
  146. package/dist/api/types/SimConfigService.d.ts +7 -0
  147. package/dist/api/types/Simulator.d.ts +9 -0
  148. package/dist/api/types/SimulatorListItem.d.ts +6 -0
  149. package/dist/api/types/SshInfo.d.ts +17 -0
  150. package/dist/api/types/StartWorkerResponse.d.ts +6 -0
  151. package/dist/api/types/TaskMetadata.d.ts +18 -0
  152. package/dist/api/types/TestCase.d.ts +34 -0
  153. package/dist/api/types/TestCasesResponse.d.ts +8 -0
  154. package/dist/api/types/Variable.d.ts +5 -0
  155. package/dist/api/types/WorkerReadyResponse.d.ts +8 -0
  156. package/dist/api/types/index.d.ts +43 -0
  157. package/dist/core/fetcher/APIResponse.d.ts +21 -0
  158. package/dist/core/fetcher/BinaryResponse.d.ts +21 -0
  159. package/dist/core/fetcher/EndpointMetadata.d.ts +14 -0
  160. package/dist/core/fetcher/EndpointSupplier.d.ts +13 -0
  161. package/dist/core/fetcher/Fetcher.d.ts +43 -0
  162. package/dist/core/fetcher/Headers.d.ts +3 -0
  163. package/dist/core/fetcher/HttpResponsePromise.d.ts +59 -0
  164. package/dist/core/fetcher/RawResponse.d.ts +30 -0
  165. package/dist/core/fetcher/ResponseWithBody.d.ts +5 -0
  166. package/dist/core/fetcher/Supplier.d.ts +5 -0
  167. package/dist/core/fetcher/createRequestUrl.d.ts +2 -0
  168. package/dist/core/fetcher/getErrorResponseBody.d.ts +2 -0
  169. package/dist/core/fetcher/getFetchFn.d.ts +2 -0
  170. package/dist/core/fetcher/getHeader.d.ts +2 -0
  171. package/dist/core/fetcher/getRequestBody.d.ts +8 -0
  172. package/dist/core/fetcher/getResponseBody.d.ts +2 -0
  173. package/dist/core/fetcher/index.d.ts +12 -0
  174. package/dist/core/fetcher/makeRequest.d.ts +2 -0
  175. package/dist/core/fetcher/requestWithRetries.d.ts +2 -0
  176. package/dist/core/fetcher/signals.d.ts +12 -0
  177. package/dist/core/headers.d.ts +3 -0
  178. package/dist/core/index.d.ts +5 -0
  179. package/dist/core/json.d.ts +16 -0
  180. package/dist/core/runtime/index.d.ts +2 -0
  181. package/dist/core/runtime/runtime.d.ts +10 -0
  182. package/dist/core/stream/Stream.d.ts +48 -0
  183. package/dist/core/stream/index.d.ts +2 -0
  184. package/dist/core/url/encodePathParam.d.ts +2 -0
  185. package/dist/core/url/index.d.ts +4 -0
  186. package/dist/core/url/join.d.ts +2 -0
  187. package/dist/core/url/qs.d.ts +7 -0
  188. package/dist/errors/ApiError.d.ts +13 -0
  189. package/dist/errors/ApiTimeoutError.d.ts +4 -0
  190. package/dist/errors/index.d.ts +3 -0
  191. package/dist/helpers/SandboxHelpers.d.ts +127 -0
  192. package/dist/helpers/SandboxMonitor.d.ts +89 -0
  193. package/dist/helpers/index.d.ts +9 -0
  194. package/dist/index.d.ts +6 -0
  195. package/errors/ApiError.ts +53 -0
  196. package/errors/ApiTimeoutError.ts +8 -0
  197. package/errors/index.ts +2 -0
  198. package/helpers/README.md +229 -0
  199. package/helpers/SandboxHelpers.ts +213 -0
  200. package/helpers/SandboxMonitor.ts +252 -0
  201. package/helpers/index.ts +10 -0
  202. package/index.ts +7 -0
  203. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,339 @@
1
+ # Plato TypeScript SDK
2
+
3
+ TypeScript/JavaScript client library for the Plato platform - manage sandbox VMs, simulators, and environments programmatically.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install plato-sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { ApiClient } from 'plato-sdk';
15
+
16
+ // Initialize the client
17
+ const client = new ApiClient({
18
+ baseUrl: 'https://api.plato.so',
19
+ // Or use environment for predefined endpoints
20
+ // environment: 'production'
21
+ });
22
+
23
+ // Create an environment
24
+ const response = await client.makeEnvironment({
25
+ interface_type: 'desktop',
26
+ env_id: 'my-env-001'
27
+ });
28
+
29
+ console.log('Environment created:', response);
30
+ ```
31
+
32
+ ## Features
33
+
34
+ - Full TypeScript support with generated types
35
+ - Promise-based API with async/await
36
+ - Built-in error handling and retries
37
+ - Request/response interceptors
38
+ - Timeout configuration
39
+ - Comprehensive API coverage for:
40
+ - Environment management
41
+ - Sandbox operations
42
+ - Simulator control
43
+ - Worker management
44
+ - Snapshot creation
45
+ - SSH and proxy access
46
+
47
+ ## Usage
48
+
49
+ ### Client Configuration
50
+
51
+ ```typescript
52
+ import { ApiClient } from 'plato-sdk';
53
+
54
+ const client = new ApiClient({
55
+ baseUrl: 'https://api.plato.so',
56
+ headers: {
57
+ 'Authorization': 'Bearer your-api-token'
58
+ },
59
+ timeoutInSeconds: 60,
60
+ maxRetries: 3
61
+ });
62
+ ```
63
+
64
+ ### Environment Operations
65
+
66
+ ```typescript
67
+ // Create an environment
68
+ const env = await client.makeEnvironment({
69
+ interface_type: 'desktop',
70
+ env_id: 'my-environment',
71
+ variables: [
72
+ { key: 'DATABASE_URL', value: 'postgresql://...' }
73
+ ]
74
+ });
75
+
76
+ // Check job status
77
+ const status = await client.getJobStatus('job-123');
78
+
79
+ // Get environment state
80
+ const state = await client.getEnvironmentState({
81
+ env_id: 'my-environment'
82
+ });
83
+
84
+ // Close environment
85
+ await client.closeEnvironment('my-environment');
86
+ ```
87
+
88
+ ### Sandbox Management
89
+
90
+ ```typescript
91
+ // Create a sandbox
92
+ const sandbox = await client.createSandbox({
93
+ simulator_name: 'ubuntu-22.04',
94
+ env_vars: {
95
+ NODE_ENV: 'production'
96
+ }
97
+ });
98
+
99
+ // Setup sandbox
100
+ await client.setupSandbox({
101
+ sandbox_id: sandbox.sandbox_id,
102
+ commands: ['npm install', 'npm run build']
103
+ });
104
+
105
+ // Delete sandbox
106
+ await client.deleteSandbox(sandbox.sandbox_id);
107
+ ```
108
+
109
+ ### Helper Functions
110
+
111
+ The SDK includes high-level helper functions that combine API calls with operation monitoring:
112
+
113
+ ```typescript
114
+ import { ApiClient } from 'plato-sdk';
115
+ import { SandboxHelpers } from 'plato-sdk/helpers';
116
+
117
+ const client = new ApiClient({ baseUrl: 'https://api.plato.so' });
118
+ const helpers = new SandboxHelpers(client);
119
+
120
+ // Create and wait for sandbox to be ready
121
+ const sandbox = await helpers.createSandbox(
122
+ {
123
+ simulator_name: 'ubuntu-22.04',
124
+ env_vars: { NODE_ENV: 'production' }
125
+ },
126
+ {
127
+ wait: true, // Wait for operation to complete
128
+ pollInterval: 2000, // Check every 2 seconds
129
+ maxWaitTime: 300000 // Max 5 minutes
130
+ }
131
+ );
132
+
133
+ // Setup sandbox with automatic monitoring
134
+ await helpers.setupSandbox(
135
+ sandbox.sandbox_id,
136
+ {
137
+ commands: ['npm install'],
138
+ files: { '/app/config.json': '{"env":"prod"}' }
139
+ },
140
+ { wait: true }
141
+ );
142
+ ```
143
+
144
+ ### Working with Simulators
145
+
146
+ ```typescript
147
+ // List available simulators
148
+ const simulators = await client.listSimulators();
149
+
150
+ // Get simulator details
151
+ const simulator = await client.getSimulator('ubuntu-22.04');
152
+
153
+ // Start a worker
154
+ const worker = await client.startWorker({
155
+ simulator_name: 'ubuntu-22.04',
156
+ worker_id: 'worker-001'
157
+ });
158
+ ```
159
+
160
+ ### Snapshot Management
161
+
162
+ ```typescript
163
+ // Create a snapshot
164
+ const snapshot = await client.createSnapshot({
165
+ sandbox_id: 'sandbox-123',
166
+ snapshot_name: 'backup-v1'
167
+ });
168
+
169
+ // Backup environment
170
+ await client.backupEnvironment('env-123');
171
+
172
+ // Reset environment
173
+ await client.resetEnvironment({
174
+ env_id: 'env-123',
175
+ snapshot_id: 'snapshot-456'
176
+ });
177
+ ```
178
+
179
+ ### Error Handling
180
+
181
+ ```typescript
182
+ import { ApiError, ApiTimeoutError, BadRequestError } from 'plato-sdk';
183
+
184
+ try {
185
+ await client.makeEnvironment({
186
+ interface_type: 'desktop',
187
+ env_id: 'my-env'
188
+ });
189
+ } catch (error) {
190
+ if (error instanceof BadRequestError) {
191
+ console.error('Invalid request:', error.body);
192
+ } else if (error instanceof ApiTimeoutError) {
193
+ console.error('Request timed out');
194
+ } else if (error instanceof ApiError) {
195
+ console.error('API error:', error.statusCode, error.body);
196
+ } else {
197
+ throw error;
198
+ }
199
+ }
200
+ ```
201
+
202
+ ### Request Options
203
+
204
+ Per-request configuration options:
205
+
206
+ ```typescript
207
+ await client.makeEnvironment(
208
+ { interface_type: 'desktop', env_id: 'my-env' },
209
+ {
210
+ timeoutInSeconds: 120,
211
+ maxRetries: 5,
212
+ headers: {
213
+ 'X-Custom-Header': 'value'
214
+ },
215
+ abortSignal: abortController.signal
216
+ }
217
+ );
218
+ ```
219
+
220
+ ## API Reference
221
+
222
+ ### Core Types
223
+
224
+ All API types are exported from `plato-sdk/api`:
225
+
226
+ ```typescript
227
+ import type * as Api from 'plato-sdk/api';
228
+
229
+ const request: Api.MakeEnvironmentRequest = {
230
+ interface_type: 'desktop',
231
+ env_id: 'my-env'
232
+ };
233
+ ```
234
+
235
+ ### Main Classes
236
+
237
+ - `ApiClient` - Main API client
238
+ - `SandboxHelpers` - High-level sandbox operations
239
+ - `SandboxMonitor` - Operation monitoring utilities
240
+
241
+ ### Error Types
242
+
243
+ - `ApiError` - Generic API error
244
+ - `ApiTimeoutError` - Request timeout
245
+ - `BadRequestError` - 400 Bad Request
246
+
247
+ ## Advanced Usage
248
+
249
+ ### Custom Base URL
250
+
251
+ ```typescript
252
+ const client = new ApiClient({
253
+ baseUrl: process.env.PLATO_API_URL || 'https://api.plato.so'
254
+ });
255
+ ```
256
+
257
+ ### Request Interceptors
258
+
259
+ ```typescript
260
+ const client = new ApiClient({
261
+ baseUrl: 'https://api.plato.so',
262
+ headers: {
263
+ 'Authorization': `Bearer ${getToken()}`
264
+ }
265
+ });
266
+ ```
267
+
268
+ ### Monitoring Operations
269
+
270
+ ```typescript
271
+ import { SandboxMonitor } from 'plato-sdk/helpers';
272
+
273
+ const monitor = new SandboxMonitor(client);
274
+
275
+ const result = await monitor.waitForOperation(
276
+ 'operation-123',
277
+ {
278
+ pollInterval: 1000,
279
+ maxWaitTime: 60000,
280
+ onProgress: (event) => {
281
+ console.log('Operation progress:', event.status);
282
+ }
283
+ }
284
+ );
285
+ ```
286
+
287
+ ## TypeScript Support
288
+
289
+ This SDK is written in TypeScript and includes full type definitions:
290
+
291
+ ```typescript
292
+ import { ApiClient, type BaseClientOptions } from 'plato-sdk';
293
+ import type * as Api from 'plato-sdk/api';
294
+
295
+ const options: BaseClientOptions = {
296
+ baseUrl: 'https://api.plato.so'
297
+ };
298
+
299
+ const client = new ApiClient(options);
300
+
301
+ // Full type inference
302
+ const response: Api.MakeEnvironmentResponse =
303
+ await client.makeEnvironment({
304
+ interface_type: 'desktop',
305
+ env_id: 'my-env'
306
+ });
307
+ ```
308
+
309
+ ## Requirements
310
+
311
+ - Node.js 18.0.0 or higher
312
+ - TypeScript 5.0+ (for TypeScript projects)
313
+
314
+ ## Development
315
+
316
+ ```bash
317
+ # Install dependencies
318
+ npm install
319
+
320
+ # Build the SDK
321
+ npm run build
322
+
323
+ # The compiled output will be in the current directory
324
+ ```
325
+
326
+ ## License
327
+
328
+ MIT
329
+
330
+ ## Support
331
+
332
+ - GitHub Issues: https://github.com/plato-ai/plato-client/issues
333
+ - Documentation: https://github.com/plato-ai/plato-client#readme
334
+
335
+ ## Related Projects
336
+
337
+ - [Plato Python SDK](../../python/) - Python client library
338
+ - [Plato CLI](../../cli/) - Command-line interface
339
+ - [Plato Go SDK](../../sdk/) - Core Go implementation
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,37 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ import type * as Api from "../../index.js";
4
+
5
+ /**
6
+ * @example
7
+ * {
8
+ * dataset: "dataset",
9
+ * plato_dataset_config: {
10
+ * compute: {
11
+ * cpus: 1,
12
+ * memory: 1,
13
+ * disk: 1,
14
+ * app_port: 1,
15
+ * plato_messaging_port: 1
16
+ * },
17
+ * metadata: {
18
+ * name: "name"
19
+ * }
20
+ * }
21
+ * }
22
+ */
23
+ export interface CreateSandboxRequest {
24
+ /** Dataset name (e.g., "base") */
25
+ dataset: string;
26
+ plato_dataset_config: Api.SimConfigDataset;
27
+ /** Timeout in seconds for sandbox creation */
28
+ timeout?: number;
29
+ /** Wait time in seconds */
30
+ wait_time?: number;
31
+ /** Human-readable alias for the sandbox */
32
+ alias?: string;
33
+ /** Optional artifact ID to create sandbox from snapshot */
34
+ artifact_id?: string;
35
+ /** Service name */
36
+ service?: string;
37
+ }
@@ -0,0 +1,11 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ /**
4
+ * @example
5
+ * {}
6
+ */
7
+ export interface CreateSnapshotRequest {
8
+ service?: string;
9
+ git_hash?: string;
10
+ dataset?: string;
11
+ }
@@ -0,0 +1,9 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ /**
4
+ * @example
5
+ * {}
6
+ */
7
+ export interface EvaluateRequest {
8
+ value?: Record<string, unknown>;
9
+ }
@@ -0,0 +1,11 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ /**
4
+ * @example
5
+ * {
6
+ * merge_mutations: true
7
+ * }
8
+ */
9
+ export interface GetEnvironmentStateRequest {
10
+ merge_mutations?: boolean;
11
+ }
@@ -0,0 +1,15 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ /**
4
+ * @example
5
+ * {
6
+ * simulator_name: "simulator_name",
7
+ * simulator_id: "simulator_id",
8
+ * page_size: 1
9
+ * }
10
+ */
11
+ export interface GetTestCasesRequest {
12
+ simulator_name?: string;
13
+ simulator_id?: string;
14
+ page_size?: number;
15
+ }
@@ -0,0 +1,19 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ /**
4
+ * @example
5
+ * {
6
+ * source: "source",
7
+ * type: "type",
8
+ * message: {
9
+ * "key": "value"
10
+ * },
11
+ * timestamp: "timestamp"
12
+ * }
13
+ */
14
+ export interface LogRequest {
15
+ source: string;
16
+ type: string;
17
+ message: Record<string, unknown>;
18
+ timestamp: string;
19
+ }
@@ -0,0 +1,27 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ /**
4
+ * @example
5
+ * {
6
+ * interface_type: "interface_type",
7
+ * env_id: "env_id"
8
+ * }
9
+ */
10
+ export interface MakeEnvironmentRequest {
11
+ interface_type: string;
12
+ interface_width?: number;
13
+ interface_height?: number;
14
+ source?: string;
15
+ open_page_on_start?: boolean;
16
+ env_id: string;
17
+ tag?: string;
18
+ dataset?: string;
19
+ artifact_id?: string;
20
+ env_config?: Record<string, unknown>;
21
+ record_network_requests?: boolean;
22
+ record_actions?: boolean;
23
+ keepalive?: boolean;
24
+ alias?: string;
25
+ fast?: boolean;
26
+ version?: string;
27
+ }
@@ -0,0 +1,14 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ /**
4
+ * @example
5
+ * {
6
+ * success: true
7
+ * }
8
+ */
9
+ export interface PostEvaluationResultRequest {
10
+ success: boolean;
11
+ reason?: string;
12
+ agent_version?: string;
13
+ mutations?: Record<string, unknown>[];
14
+ }
@@ -0,0 +1,11 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ /**
4
+ * @example
5
+ * {}
6
+ */
7
+ export interface ResetEnvironmentRequest {
8
+ test_case_public_id?: string;
9
+ agent_version?: string;
10
+ load_browser_state?: boolean;
11
+ }
@@ -0,0 +1,14 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ /**
4
+ * @example
5
+ * {
6
+ * ssh_public_key: "ssh_public_key"
7
+ * }
8
+ */
9
+ export interface SetupRootAccessRequest {
10
+ /** SSH public key to install for root user */
11
+ ssh_public_key: string;
12
+ /** Timeout in seconds */
13
+ timeout?: number;
14
+ }
@@ -0,0 +1,29 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ import type * as Api from "../../index.js";
4
+
5
+ /**
6
+ * @example
7
+ * {
8
+ * dataset: "dataset",
9
+ * plato_dataset_config: {
10
+ * compute: {
11
+ * cpus: 1,
12
+ * memory: 1,
13
+ * disk: 1,
14
+ * app_port: 1,
15
+ * plato_messaging_port: 1
16
+ * },
17
+ * metadata: {
18
+ * name: "name"
19
+ * }
20
+ * }
21
+ * }
22
+ */
23
+ export interface SetupSandboxRequest {
24
+ /** Dataset name */
25
+ dataset: string;
26
+ plato_dataset_config: Api.SimConfigDataset;
27
+ /** SSH public key to install for plato user */
28
+ ssh_public_key?: string;
29
+ }
@@ -0,0 +1,28 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ import type * as Api from "../../index.js";
4
+
5
+ /**
6
+ * @example
7
+ * {
8
+ * dataset: "dataset",
9
+ * plato_dataset_config: {
10
+ * compute: {
11
+ * cpus: 1,
12
+ * memory: 1,
13
+ * disk: 1,
14
+ * app_port: 1,
15
+ * plato_messaging_port: 1
16
+ * },
17
+ * metadata: {
18
+ * name: "name"
19
+ * }
20
+ * }
21
+ * }
22
+ */
23
+ export interface StartWorkerRequest {
24
+ service?: string;
25
+ dataset: string;
26
+ plato_dataset_config: Api.SimConfigDataset;
27
+ timeout?: number;
28
+ }
@@ -0,0 +1,12 @@
1
+ export type { CreateSandboxRequest } from "./CreateSandboxRequest.js";
2
+ export type { CreateSnapshotRequest } from "./CreateSnapshotRequest.js";
3
+ export type { EvaluateRequest } from "./EvaluateRequest.js";
4
+ export type { GetEnvironmentStateRequest } from "./GetEnvironmentStateRequest.js";
5
+ export type { GetTestCasesRequest } from "./GetTestCasesRequest.js";
6
+ export type { LogRequest } from "./LogRequest.js";
7
+ export type { MakeEnvironmentRequest } from "./MakeEnvironmentRequest.js";
8
+ export type { PostEvaluationResultRequest } from "./PostEvaluationResultRequest.js";
9
+ export type { ResetEnvironmentRequest } from "./ResetEnvironmentRequest.js";
10
+ export type { SetupRootAccessRequest } from "./SetupRootAccessRequest.js";
11
+ export type { SetupSandboxRequest } from "./SetupSandboxRequest.js";
12
+ export type { StartWorkerRequest } from "./StartWorkerRequest.js";
@@ -0,0 +1,17 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ import type * as core from "../../core/index.js";
4
+ import * as errors from "../../errors/index.js";
5
+ import type * as Api from "../index.js";
6
+
7
+ export class BadRequestError extends errors.ApiError {
8
+ constructor(body: Api.ErrorResponse, rawResponse?: core.RawResponse) {
9
+ super({
10
+ message: "BadRequestError",
11
+ statusCode: 400,
12
+ body: body,
13
+ rawResponse: rawResponse,
14
+ });
15
+ Object.setPrototypeOf(this, BadRequestError.prototype);
16
+ }
17
+ }
@@ -0,0 +1 @@
1
+ export * from "./BadRequestError.js";
package/api/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./client/index.js";
2
+ export * from "./errors/index.js";
3
+ export * from "./types/index.js";
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ export interface ActiveSessionResponse {
4
+ session_id?: string;
5
+ error?: string;
6
+ }
@@ -0,0 +1,7 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ export interface BackupEnvironmentResponse {
4
+ success?: boolean;
5
+ message?: string;
6
+ data?: Record<string, unknown>;
7
+ }
@@ -0,0 +1,12 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ export interface CdpUrlResponse {
4
+ data?: CdpUrlResponse.Data;
5
+ error?: string;
6
+ }
7
+
8
+ export namespace CdpUrlResponse {
9
+ export interface Data {
10
+ cdp_url?: string;
11
+ }
12
+ }
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ export interface CloseEnvironmentResponse {
4
+ success?: boolean;
5
+ message?: string;
6
+ }
@@ -0,0 +1,14 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ export interface CreateSandboxResponse {
4
+ /** Public URL for the sandbox */
5
+ url?: string;
6
+ /** Public ID of the sandbox job */
7
+ job_public_id: string;
8
+ /** Job group ID for the sandbox */
9
+ job_group_id: string;
10
+ /** Current status of the sandbox */
11
+ status?: string;
12
+ /** Correlation ID for monitoring operation progress via SSE */
13
+ correlation_id?: string;
14
+ }
@@ -0,0 +1,10 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ export interface CreateSnapshotResponse {
4
+ artifact_id: string;
5
+ status: string;
6
+ timestamp: string;
7
+ correlation_id: string;
8
+ s3_uri: string;
9
+ git_hash?: string;
10
+ }
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+
3
+ export interface DeleteSandboxResponse {
4
+ success?: boolean;
5
+ message?: string;
6
+ }