-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshared.ts
More file actions
519 lines (444 loc) · 13.1 KB
/
Copy pathshared.ts
File metadata and controls
519 lines (444 loc) · 13.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
/**
* Configuration for automatic Devbox behavior after idle time.
*
* @category Shared Types
*/
export interface AfterIdle {
/**
* After idle_time_seconds, on_idle action will be taken.
*/
idle_time_seconds: number;
/**
* Action to take after Devbox becomes idle.
*/
on_idle: 'shutdown' | 'suspend';
}
export interface AgentMount {
/**
* The ID of the agent to mount. Either agent_id or name must be set.
*/
agent_id: string | null;
/**
* The name of the agent to mount. Returns the most recent agent with a matching
* name if no agent id string provided. Either agent id or name must be set
*/
agent_name: string | null;
type: 'agent_mount';
/**
* Path to mount the agent on the Devbox. Required for git and object agents. Use
* absolute path (e.g., /home/user/agent)
*/
agent_path?: string | null;
/**
* Optional auth token for private repositories. Only used for git agents.
*/
auth_token?: string | null;
}
/**
* Agent source configuration.
*
* @category Shared Types
*/
export interface AgentSource {
/**
* Source type: npm, pip, object, or git
*/
type: string;
/**
* Git-based agent source configuration.
*/
git?: AgentSource.Git | null;
/**
* NPM-based agent source configuration.
*/
npm?: AgentSource.Npm | null;
/**
* Object store agent source configuration.
*/
object?: AgentSource.Object | null;
/**
* Pip-based agent source configuration.
*/
pip?: AgentSource.Pip | null;
}
export namespace AgentSource {
/**
* Git-based agent source configuration.
*/
export interface Git {
/**
* Git repository URL
*/
repository: string;
/**
* Setup commands to run after cloning
*/
agent_setup?: Array<string> | null;
/**
* Optional Git ref (branch/tag/commit), defaults to main/HEAD
*/
ref?: string | null;
}
/**
* NPM-based agent source configuration.
*/
export interface Npm {
/**
* NPM package name
*/
package_name: string;
/**
* Setup commands to run after installation
*/
agent_setup?: Array<string> | null;
/**
* NPM registry URL
*/
registry_url?: string | null;
}
/**
* Object store agent source configuration.
*/
export interface Object {
/**
* Object ID
*/
object_id: string;
/**
* Setup commands to run after unpacking
*/
agent_setup?: Array<string> | null;
}
/**
* Pip-based agent source configuration.
*/
export interface Pip {
/**
* Pip package name
*/
package_name: string;
/**
* Setup commands to run after installation
*/
agent_setup?: Array<string> | null;
/**
* Pip registry URL
*/
registry_url?: string | null;
}
}
export interface BrokerMount {
/**
* The ID of the axon event stream to mount onto the Devbox.
*/
axon_id: string;
type: 'broker_mount';
/**
* Binary to launch the agent (e.g., 'opencode'). Used by protocols that launch a
* subprocess (acp, claude_json, codex_json).
*/
agent_binary?: string | null;
/**
* Arguments to pass to the agent command (e.g., ['acp']). Used by protocols that
* launch a subprocess (acp, claude_json, codex_json).
*/
launch_args?: Array<string> | null;
/**
* The protocol used by the broker to deliver events to the agent.
*/
protocol?: 'acp' | 'claude_json' | 'codex_json' | null;
/**
* Working directory in which to launch the agent binary. Defaults to the home
* directory if not specified.
*/
working_directory?: string | null;
}
/**
* Parameters for mounting code from a Git repository.
*
* @category Shared Types
*/
export interface CodeMountParameters {
/**
* The name of the repo to mount. By default, code will be mounted at
* /home/user/{repo_name}.
*/
repo_name: string;
/**
* The owner of the repo.
*/
repo_owner: string;
/**
* The authentication token necessary to pull repo.
*/
token?: string | null;
/**
* Optional git ref (branch or tag) to checkout. Defaults to the repository default
* branch.
*/
git_ref?: string | null;
/**
* Installation command to install and setup repository.
*/
install_command?: string | null;
}
/**
* LaunchParameters enable you to customize the resources available to your Devbox
* as well as the environment set up that should be completed before the Devbox is
* marked as 'running'.
*
* @category Shared Types
*/
export interface LaunchParameters {
/**
* Configure Devbox lifecycle based on idle activity. If after_idle is set, Devbox
* will ignore keep_alive_time_seconds. If both after_idle and lifecycle.after_idle
* are set, they must have the same value. Use lifecycle.after_idle instead.
*/
after_idle?: AfterIdle | null;
/**
* The target architecture for the Devbox. If unset, defaults to x86_64.
*/
architecture?: 'x86_64' | 'arm64' | null;
/**
* [Deprecated] A list of ports to make available on the Devbox. This field is
* ignored.
*/
available_ports?: Array<number> | null;
/**
* Custom CPU cores. Must be 0.5, 1, or a multiple of 2. Max is 16.
*/
custom_cpu_cores?: number | null;
/**
* Custom disk size in GiB. Must be a multiple of 2. Min is 2GiB, max is 64GiB.
*/
custom_disk_size?: number | null;
/**
* Custom memory size in GiB. Must be 1 or a multiple of 2. Max is 64GiB.
*/
custom_gb_memory?: number | null;
/**
* Time in seconds after which Devbox will automatically shutdown. Default is 1
* hour. Maximum is 48 hours (172800 seconds).
*/
keep_alive_time_seconds?: number | null;
/**
* Set of commands to be run at launch time, before the entrypoint process is run.
*/
launch_commands?: Array<string> | null;
/**
* Lifecycle configuration for Devbox idle and resume behavior. Configure idle
* policy via after_idle, resume triggers via resume_triggers, and optional
* lifecycle hooks via lifecycle_hooks.
*/
lifecycle?: LifecycleConfiguration | null;
/**
* (Optional) ID of the network policy to apply to Devboxes launched with these
* parameters. When set on a Blueprint launch parameters, Devboxes created from it
* will inherit this policy unless explicitly overridden.
*/
network_policy_id?: string | null;
/**
* (Optional, Alpha) standard is default and flex is lazily provisioned and may be
* pre-empted. This is an alpha feature and its behavior may change without notice.
*/
provisioning_tier?: 'standard' | 'flex' | null;
/**
* A list of ContainerizedService names to be started when a Devbox is created. A
* valid ContainerizedService must be specified in Blueprint to be started.
*/
required_services?: Array<string> | null;
/**
* The size of the Devbox resources for Runloop to allocate.
*
* X_SMALL: 0.5 cpu x 1GiB memory x 4GiB disk SMALL: 1 cpu x 2GiB memory x 4GiB
* disk MEDIUM: 2 cpu x 4GiB memory x 8GiB disk LARGE: 2 cpu x 8GiB memory x 16GiB
* disk X_LARGE: 4 cpu x 16GiB memory x 16GiB disk XX_LARGE: 8 cpu x 32GiB memory x
* 16GiB disk CUSTOM_SIZE: To choose a custom size, set this enum and also the
* custom_cpu_cores, custom_gb_memory, and optionally custom_disk_size in launch
* parameters. CPU must be 0.5, 1, or a multiple of 2 (max 16). Memory must be 1 or
* a multiple of 2 (max 64GiB). Disk must be a multiple of 2 (min 2GiB, max 64GiB).
* The cpu:memory ratio must be between 1:2 and 1:8 inclusive.
*/
resource_size_request?:
| 'X_SMALL'
| 'SMALL'
| 'MEDIUM'
| 'LARGE'
| 'X_LARGE'
| 'XX_LARGE'
| 'CUSTOM_SIZE'
| null;
/**
* Configuration for the Linux user in the Devbox environment.
*/
user_parameters?: LaunchParameters.UserParameters | null;
}
export namespace LaunchParameters {
/**
* Configuration for the Linux user in the Devbox environment.
*/
export interface UserParameters {
/**
* User ID (UID) for the Linux user. Must be a non-negative integer.
*/
uid: number;
/**
* Username for the Linux user.
*/
username: string;
}
}
/**
* Lifecycle configuration for Devbox idle and resume behavior. Configure idle
* policy via after_idle, resume triggers via resume_triggers, and optional
* lifecycle hooks via lifecycle_hooks.
*/
export interface LifecycleConfiguration {
/**
* Configure Devbox lifecycle based on idle activity. If both this and the
* top-level after_idle are set, they must have the same value. Prefer this field
* for new integrations.
*/
after_idle?: AfterIdle | null;
/**
* Lifecycle hooks for Devbox suspend. suspend_commands run sequentially as the
* configured Devbox user before the Devbox suspends; failures are logged but do
* not block suspending. The suspend_deadline_ms budget defaults to 30000 ms, may
* not exceed 60000 ms, and covers broker drain plus suspend_commands. If the
* deadline is exceeded, suspend work is abandoned, the timeout is logged, and the
* Devbox still proceeds to suspend. launch_commands still run on every startup,
* including after resume.
*/
lifecycle_hooks?: LifecycleHooks | null;
/**
* Triggers that can resume a suspended Devbox.
*/
resume_triggers?: ResumeTriggers | null;
}
/**
* Lifecycle hooks for Devbox suspend. suspend_commands run sequentially as the
* configured Devbox user before the Devbox suspends; failures are logged but do
* not block suspending. The suspend_deadline_ms budget defaults to 30000 ms, may
* not exceed 60000 ms, and covers broker drain plus suspend_commands. If the
* deadline is exceeded, suspend work is abandoned, the timeout is logged, and the
* Devbox still proceeds to suspend. launch_commands still run on every startup,
* including after resume.
*/
export interface LifecycleHooks {
/**
* Commands to run through the suspend path before the Devbox suspends (e.g.
* cleanup, quiesce daemons).
*/
suspend_commands?: Array<string> | null;
/**
* Deadline in milliseconds for broker drain and suspend_commands during suspend.
* Defaults to 30000 ms and may not exceed 60000 ms. If exceeded, suspend work is
* abandoned, the timeout is logged, and the Devbox still proceeds to suspend by
* shutting down vmagent and killing the VM.
*/
suspend_deadline_ms?: number | null;
}
/**
* Mount configuration for attaching files, agents, or code to a Devbox.
*
* @category Shared Types
*/
export type Mount = ObjectMount | AgentMount | Mount.CodeMount | Mount.FileMount | BrokerMount;
export namespace Mount {
export interface CodeMount {
/**
* The name of the repo to mount. By default, code will be mounted at
* /home/user/{repo_name}.
*/
repo_name: string;
/**
* The owner of the repo.
*/
repo_owner: string;
type: 'code_mount';
/**
* The authentication token necessary to pull repo.
*/
token?: string | null;
/**
* Optional git ref (branch or tag) to checkout. Defaults to the repository default
* branch.
*/
git_ref?: string | null;
/**
* Installation command to install and setup repository.
*/
install_command?: string | null;
}
export interface FileMount {
/**
* Content of the file to mount.
*/
content: string;
/**
* Target path where the file should be mounted.
*/
target: string;
type: 'file_mount';
}
}
export interface ObjectMount {
/**
* The ID of the object to write.
*/
object_id: string;
/**
* The path to write the object on the Devbox. Use absolute path of object (ie
* /home/user/object.txt, or directory if archive /home/user/archive_dir)
*/
object_path: string;
type: 'object_mount';
}
/**
* Triggers that can resume a suspended Devbox.
*/
export interface ResumeTriggers {
/**
* When true, axon events targeting a suspended Devbox will trigger a resume.
*/
axon_event?: boolean | null;
/**
* When true, HTTP traffic to a suspended Devbox via tunnel will trigger a resume.
*/
http?: boolean | null;
}
/**
* Configuration profile for scenario/benchmark runs.
*
* @category Shared Types
*/
export interface RunProfile {
/**
* Mapping of Environment Variable to Value. May be shown in devbox logging.
* Example: {"DB_PASS": "DATABASE_PASSWORD"} would set the environment variable
* 'DB_PASS' to the value 'DATABASE_PASSWORD_VALUE'.
*/
envVars?: { [key: string]: string } | null;
/**
* LaunchParameters enable you to customize the resources available to your Devbox
* as well as the environment set up that should be completed before the Devbox is
* marked as 'running'.
*/
launchParameters?: LaunchParameters | null;
/**
* A list of mounts to be included in the scenario run.
*/
mounts?: Array<Mount> | null;
/**
* Purpose of the run.
*/
purpose?: string | null;
/**
* Mapping of Environment Variable to User Secret Name. Never shown in devbox
* logging. Example: {"DB_PASS": "DATABASE_PASSWORD"} would set the environment
* variable 'DB_PASS' to the value of the secret 'DATABASE_PASSWORD'.
*/
secrets?: { [key: string]: string } | null;
}