Repository navigation
Expand file tree
/
Copy pathshared.ts
More file actions
383 lines (329 loc) · 10.6 KB
/
Copy pathshared.ts
File metadata and controls
383 lines (329 loc) · 10.6 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
// 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';
}
/**
* Defines how the primary credential is applied to requests proxied to the
* upstream.
*/
export interface AuthMechanism {
/**
* The type of authentication mechanism: 'header', 'bearer', or 'basic'. For
* 'basic', store the secret as plain 'user:pass'; the proxy base64-encodes it.
*/
type: string;
/**
* The header name (e.g., 'x-api-key'). Required for 'header' type; invalid for
* other types.
*/
key?: 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, pi_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, pi_json).
*/
launch_args?: Array<string> | null;
/**
* The protocol used by the broker to deliver events to the agent.
*/
protocol?: 'acp' | 'claude_json' | 'codex_json' | 'pi_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;
}
/**
* An additional header applied to upstream requests alongside the primary
* credential. The value comes from an account secret or a literal string; exactly
* one of 'secret' and 'value' must be set.
*/
export interface CustomHeader {
/**
* The header name (e.g., 'DD-APPLICATION-KEY').
*/
name: string;
/**
* Account secret providing the header value. Accepts a secret name or 'sec*' id on
* writes; reads always return the 'sec*' id.
*/
secret?: string | null;
/**
* Literal header value. Stored in plaintext and returned by reads - use 'secret'
* for credentials or other sensitive values.
*/
value?: 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;
}
export type Mount = ObjectMount | 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;
}