forked from alibaba/OpenSandbox
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexecd-api.yaml
More file actions
1224 lines (1179 loc) · 38.5 KB
/
execd-api.yaml
File metadata and controls
1224 lines (1179 loc) · 38.5 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
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: OpenSandbox Execd API
version: 1.0.0
description: |
OpenSandbox Execd provides a comprehensive API for managing code execution, file operations,
and system monitoring within a sandboxed environment. The API supports multiple programming
languages, real-time streaming output via Server-Sent Events (SSE), and complete file system
management capabilities.
## Key Features
- **Code Execution**: Execute code in Python, JavaScript, and other languages with stateful contexts
- **Command Execution**: Run shell commands with foreground/background modes
- **File Operations**: Complete CRUD operations for files and directories
- **Real-time Streaming**: SSE-based output streaming for code and command execution
- **System Monitoring**: CPU and memory metrics with real-time watching
- **Access Control**: Token-based authentication for all API endpoints
contact:
name: OpenSandbox Team
url: https://github.com/alibaba/OpenSandbox
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: http://localhost:44772
description: Local development server
- url: https://api.opensandbox.example.com
description: Production server
security:
- AccessToken: []
tags:
- name: Health
description: Server health check and status monitoring
- name: CodeInterpreting
description: Code execution and context management
- name: Command
description: Shell command execution and interruption
- name: Filesystem
description: File and directory operations
- name: Metric
description: System resource monitoring and metrics
paths:
/ping:
get:
summary: Health check endpoint
description: |
Performs a simple health check to verify that the server is running and responsive.
Returns HTTP 200 OK status if the server is healthy. This endpoint is typically used
by load balancers, monitoring systems, and orchestration platforms (like Kubernetes)
to check service availability.
operationId: ping
tags:
- Health
responses:
"200":
description: Server is alive and healthy
/code/contexts:
get:
summary: List active code execution contexts
description: |
Lists all active/available code execution contexts.
If `language` is provided, only contexts under that language/runtime are returned.
operationId: listContexts
tags:
- CodeInterpreting
parameters:
- name: language
in: query
required: true
description: Filter contexts by execution runtime (python, bash, java, etc.)
schema:
type: string
example: python
responses:
"200":
description: Array of active contexts
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/CodeContext"
examples:
python_only:
summary: Context list filtered by language
value:
- id: session-abc123
language: python
- id: session-def456
language: python
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
delete:
summary: Delete all contexts under a language
description: |
Deletes all existing code execution contexts under the specified `language`/runtime.
This is a bulk operation intended for code-interpreter context cleanup.
operationId: deleteContextsByLanguage
tags:
- CodeInterpreting
parameters:
- name: language
in: query
required: true
description: Target execution runtime whose contexts should be deleted
schema:
type: string
example: python
responses:
"200":
description: Contexts deleted successfully
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
/code/contexts/{context_id}:
get:
summary: Get a code execution context by id
description: |
Retrieves the details of an existing code execution context (session) by id.
Returns the context ID, language, and any associated metadata.
operationId: getContext
tags:
- CodeInterpreting
parameters:
- name: context_id
in: path
required: true
description: Session/context id to get
schema:
type: string
example: session-abc123
responses:
"200":
description: Context details retrieved successfully
content:
application/json:
schema:
$ref: "#/components/schemas/CodeContext"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalServerError"
delete:
summary: Delete a code execution context by id
description: |
Deletes an existing code execution context (session) by id.
This should terminate the underlying context thread/process and release resources.
operationId: deleteContext
tags:
- CodeInterpreting
parameters:
- name: context_id
in: path
required: true
description: Session/context id to delete
schema:
type: string
example: session-abc123
responses:
"200":
description: Context deleted successfully
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalServerError"
/code/context:
post:
summary: Create code execution context
description: |
Creates a new code execution environment and returns a session ID that can be used
for subsequent code execution requests. The context maintains state across multiple
code executions within the same session.
operationId: createCodeContext
tags:
- CodeInterpreting
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CodeContextRequest"
examples:
python:
summary: Create Python context
value:
language: python
bash:
summary: Create Bash context
value:
language: bash
responses:
"200":
description: Successfully created context with session ID
content:
application/json:
schema:
$ref: "#/components/schemas/CodeContext"
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
/code:
post:
summary: Execute code in context
description: |
Executes code using Jupyter kernel in a specified execution context and streams
the output in real-time using SSE (Server-Sent Events). Supports multiple programming
languages (Python, JavaScript, etc.) and maintains execution state within the session.
Returns execution results, output streams, execution count, and any errors.
operationId: runCode
tags:
- CodeInterpreting
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/RunCodeRequest"
examples:
python:
summary: Execute Python code
value:
context:
id: session-123
language: python
code: |
print("Hello, World!")
result = 2 + 2
result
stateless:
summary: Stateless execution
value:
code: echo "Hello from shell"
responses:
"200":
description: Stream of code execution events
content:
text/event-stream:
schema:
$ref: "#/components/schemas/ServerStreamEvent"
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
delete:
summary: Interrupt code execution
description: |
Interrupts the currently running code execution in the specified context.
This sends a signal to terminate the execution process and releases associated resources.
operationId: interruptCode
tags:
- CodeInterpreting
parameters:
- name: id
in: query
required: true
description: Session ID of the execution context to interrupt
schema:
type: string
example: session-123
responses:
"200":
description: Code execution successfully interrupted
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
/command:
post:
summary: Execute shell command
description: |
Executes a shell command and streams the output in real-time using SSE (Server-Sent Events).
The command can run in foreground or background mode. The response includes stdout, stderr,
execution status, and completion events.
Optionally specify `timeout` (milliseconds) to enforce a maximum runtime; the server will
terminate the process when the timeout is reached.
operationId: runCommand
tags:
- Command
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/RunCommandRequest"
examples:
foreground:
summary: Foreground command
value:
command: ls -la /workspace
cwd: /workspace
background: false
timeout: 30000
background:
summary: Background command
value:
command: python server.py
cwd: /app
background: true
timeout: 120000
responses:
"200":
description: Stream of command execution events
content:
text/event-stream:
schema:
$ref: "#/components/schemas/ServerStreamEvent"
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
delete:
summary: Interrupt command execution
description: |
Interrupts the currently running command execution in the specified context.
This sends a signal to terminate the execution process and releases associated resources.
operationId: interruptCommand
tags:
- Command
parameters:
- name: id
in: query
required: true
description: Session ID of the execution context to interrupt
schema:
type: string
example: session-456
responses:
"200":
description: Command execution successfully interrupted
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
/command/status/{id}:
get:
summary: Get command running status
description: |
Returns the current status of a command (foreground or background) by command ID.
Includes running flag, exit code, error (if any), and start/finish timestamps.
operationId: getCommandStatus
tags:
- Command
parameters:
- name: id
in: path
required: true
description: Command ID returned by RunCommand
schema:
type: string
example: cmd-abc123
responses:
"200":
description: Command status
content:
application/json:
schema:
$ref: "#/components/schemas/CommandStatusResponse"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalServerError"
/command/{id}/logs:
get:
summary: Get background command stdout/stderr (non-streamed)
description: |
Returns stdout and stderr for a background (detached) command by command ID.
Foreground commands should be consumed via SSE; this endpoint is intended for
polling logs of background commands. Supports incremental reads similar to a file seek:
pass a starting line via query to fetch output after that line and receive the latest
tail cursor for the next poll. When no starting line is provided, the full logs are returned.
Response body is plain text so it can be rendered directly in browsers; the latest line index
is provided via response header `EXECD-COMMANDS-TAIL-CURSOR` for subsequent incremental requests.
operationId: getBackgroundCommandLogs
tags:
- Command
parameters:
- name: id
in: path
required: true
description: Command ID returned by RunCommand
schema:
type: string
example: cmd-abc123
- name: cursor
in: query
required: false
description: |
Optional 0-based line cursor (behaves like a file seek). When provided, only
stdout/stderr lines after this line are returned. The response includes the
latest line index (`cursor`) so the client can request incremental output
on subsequent calls. If omitted, the full log is returned.
schema:
type: integer
format: int64
minimum: 0
example: 120
responses:
"200":
description: Command output (plain text) and status metadata via headers
content:
text/plain:
schema:
type: string
example: |
line1
line2
warn: something on stderr
headers:
EXECD-COMMANDS-TAIL-CURSOR:
description: Highest available 0-based line index after applying the request cursor (use as the next cursor for incremental reads)
schema:
type: integer
format: int64
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalServerError"
/files/info:
get:
summary: Get file metadata
description: |
Retrieves detailed metadata for one or multiple files including permissions, owner,
group, size, and modification time. Returns a map of file paths to their corresponding
FileInfo objects.
operationId: getFilesInfo
tags:
- Filesystem
parameters:
- name: path
in: query
required: true
description: File path(s) to get info for (can be specified multiple times)
schema:
type: array
items:
type: string
style: form
explode: true
examples:
single:
summary: Single file
value: ["/workspace/file.txt"]
multiple:
summary: Multiple files
value: ["/workspace/file1.txt", "/workspace/file2.py"]
responses:
"200":
description: Map of file paths to FileInfo objects
content:
application/json:
schema:
type: object
additionalProperties:
$ref: "#/components/schemas/FileInfo"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalServerError"
/files:
delete:
summary: Delete files
description: |
Deletes one or multiple files from the sandbox. Only removes files, not directories.
Use RemoveDirs for directory removal.
operationId: removeFiles
tags:
- Filesystem
parameters:
- name: path
in: query
required: true
description: File path(s) to delete (can be specified multiple times)
schema:
type: array
items:
type: string
style: form
explode: true
example: ["/workspace/temp.txt"]
responses:
"200":
description: Files deleted successfully
"500":
$ref: "#/components/responses/InternalServerError"
/files/permissions:
post:
summary: Change file permissions
description: |
Changes permissions (mode), owner, and group for one or multiple files.
Accepts a map of file paths to permission settings including octal mode,
owner username, and group name.
operationId: chmodFiles
tags:
- Filesystem
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties:
$ref: "#/components/schemas/Permission"
example:
"/workspace/script.sh":
owner: admin
group: admin
mode: 755
"/workspace/config.json":
owner: admin
group: admin
mode: 755
responses:
"200":
description: Permissions changed successfully
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
/files/mv:
post:
summary: Rename or move files
description: |
Renames or moves one or multiple files to new paths. Can be used for both
renaming within the same directory and moving to different directories.
Target directory must exist.
operationId: renameFiles
tags:
- Filesystem
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/RenameFileItem"
example:
- src: /workspace/old_name.txt
dest: /workspace/new_name.txt
- src: /workspace/file.py
dest: /archive/file.py
responses:
"200":
description: Files renamed/moved successfully
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalServerError"
/files/search:
get:
summary: Search for files
description: |
Searches for files matching a glob pattern within a specified directory and
its subdirectories. Returns file metadata including path, permissions, owner,
and group. Supports glob patterns like **, *.txt, etc. Default pattern is ** (all files).
operationId: searchFiles
tags:
- Filesystem
parameters:
- name: path
in: query
required: true
description: Root directory path to search in
schema:
type: string
- name: pattern
in: query
required: false
description: Glob pattern to match files (default is **)
schema:
type: string
default: "**"
responses:
"200":
description: Array of matching files with metadata
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/FileInfo"
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalServerError"
/files/replace:
post:
summary: Replace file content
description: |
Performs text replacement in one or multiple files. Replaces all occurrences
of the old string with the new string (similar to strings.ReplaceAll).
Preserves file permissions. Useful for batch text substitution across files.
operationId: replaceContent
tags:
- Filesystem
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties:
$ref: "#/components/schemas/ReplaceFileContentItem"
example:
"/workspace/config.yaml":
old: "localhost:8080"
new: "0.0.0.0:9090"
"/workspace/app.py":
old: "DEBUG = True"
new: "DEBUG = False"
responses:
"200":
description: Content replaced successfully
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
/files/upload:
post:
summary: Upload files to sandbox
description: |
Uploads one or multiple files to specified paths within the sandbox.
Reads metadata and file content from multipart form parts in sequence.
Each file upload consists of two parts: a metadata part (JSON) followed
by the actual file part.
operationId: uploadFile
tags:
- Filesystem
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
metadata:
type: string
description: JSON-encoded file metadata (FileMetadata object)
example: '{"path":"/workspace/file.txt","owner":"admin","group":"admin","mode":755}'
file:
type: string
format: binary
description: File to upload
encoding:
metadata:
contentType: application/json
file:
contentType: application/octet-stream
responses:
"200":
description: Files uploaded successfully
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
/files/download:
get:
summary: Download file from sandbox
description: |
Downloads a file from the specified path within the sandbox. Supports HTTP
range requests for resumable downloads and partial content retrieval.
Returns file as octet-stream with appropriate headers.
operationId: downloadFile
tags:
- Filesystem
parameters:
- name: path
in: query
required: true
description: Absolute or relative path of the file to download
schema:
type: string
example: /workspace/data.csv
- name: Range
in: header
required: false
description: HTTP Range header for partial content requests
schema:
type: string
example: "bytes=0-1023"
responses:
"200":
description: File content
content:
application/octet-stream:
schema:
type: string
format: binary
headers:
Content-Disposition:
schema:
type: string
description: Attachment header with filename
Content-Length:
schema:
type: integer
description: File size in bytes
"206":
description: Partial file content (when Range header is provided)
content:
application/octet-stream:
schema:
type: string
format: binary
headers:
Content-Range:
schema:
type: string
description: Range of bytes being returned
Content-Length:
schema:
type: integer
description: Length of the returned range
"400":
$ref: "#/components/responses/BadRequest"
"404":
$ref: "#/components/responses/NotFound"
"416":
description: Requested range not satisfiable
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"500":
$ref: "#/components/responses/InternalServerError"
/directories:
post:
summary: Create directories
description: |
Creates one or multiple directories with specified permissions. Creates parent
directories as needed (similar to mkdir -p). Accepts a map of directory paths
to permission objects.
operationId: makeDirs
tags:
- Filesystem
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties:
$ref: "#/components/schemas/Permission"
example:
"/workspace/project":
owner: admin
group: admin
mode: 755
"/workspace/logs":
owner: admin
group: admin
mode: 755
responses:
"200":
description: Directories created successfully
"400":
$ref: "#/components/responses/BadRequest"
"500":
$ref: "#/components/responses/InternalServerError"
delete:
summary: Delete directories
description: |
Recursively deletes one or multiple directories and all their contents.
Similar to rm -rf. Use with caution as this operation cannot be undone.
operationId: removeDirs
tags:
- Filesystem
parameters:
- name: path
in: query
required: true
description: Directory path(s) to delete (can be specified multiple times)
schema:
type: array
items:
type: string
style: form
explode: true
example: ["/workspace/temp"]
responses:
"200":
description: Directories deleted successfully
"500":
$ref: "#/components/responses/InternalServerError"
/metrics:
get:
summary: Get system metrics
description: |
Retrieves current system resource metrics including CPU usage percentage,
CPU core count, total memory, used memory, and timestamp. Provides a snapshot
of system resource utilization at the time of request.
operationId: getMetrics
tags:
- Metric
responses:
"200":
description: Current system metrics including CPU and memory usage
content:
application/json:
schema:
$ref: "#/components/schemas/Metrics"
"500":
$ref: "#/components/responses/InternalServerError"
/metrics/watch:
get:
summary: Watch system metrics in real-time
description: |
Streams system resource metrics in real-time using Server-Sent Events (SSE).
Updates are sent every second, providing continuous monitoring of CPU usage,
memory usage, and other system metrics. The connection remains open until
the client disconnects.
operationId: watchMetrics
tags:
- Metric
responses:
"200":
description: Stream of system metrics updated every second
content:
text/event-stream:
schema:
$ref: "#/components/schemas/Metrics"
"500":
$ref: "#/components/responses/InternalServerError"
components:
securitySchemes:
AccessToken:
type: apiKey
in: header
name: X-EXECD-ACCESS-TOKEN
description: |
Access token for API authentication. All requests must include this header
with a valid token. The token is configured during server initialization.
schemas:
CodeContextRequest:
type: object
description: Request to create a code execution context
properties:
language:
type: string
description: Execution runtime (python, bash, java, etc.)
example: python
CodeContext:
type: object
description: Code execution context with session identifier
properties:
id:
type: string
description: Unique session identifier returned by CreateContext
example: session-abc123
language:
type: string
description: Execution runtime
example: python
required:
- language
RunCodeRequest:
type: object
required:
- code
description: Request to execute code in a context
properties:
context:
$ref: "#/components/schemas/CodeContext"
code:
type: string
description: Source code to execute
example: |
import numpy as np
result = np.array([1, 2, 3])
print(result)
RunCommandRequest:
type: object
required:
- command
description: Request to execute a shell command
properties:
command:
type: string
description: Shell command to execute
example: ls -la /workspace
cwd:
type: string
description: Working directory for command execution
example: /workspace
background:
type: boolean
description: Whether to run command in detached mode
default: false
example: false
timeout:
type: integer
format: int64
description: Maximum allowed execution time in milliseconds before the command is forcefully terminated by the server. If omitted, the server will not enforce any timeout.
example: 60000
CommandStatusResponse:
type: object
description: Command execution status (foreground or background)
properties:
id:
type: string
description: Command ID returned by RunCommand
example: cmd-abc123
content:
type: string
description: Original command content
example: ls -la
running:
type: boolean
description: Whether the command is still running
example: false
exit_code:
type: integer
format: int32
nullable: true
description: Exit code if the command has finished
example: 0
error:
type: string
description: Error message if the command failed
example: permission denied
started_at:
type: string
format: date-time
description: Start time in RFC3339 format
example: "2025-12-22T09:08:05Z"
finished_at:
type: string
format: date-time
nullable: true
description: Finish time in RFC3339 format (null if still running)
example: "2025-12-22T09:08:09Z"
ServerStreamEvent:
type: object
description: Server-sent event for streaming execution output
properties:
type:
type: string
enum:
- init
- status
- error
- stdout
- stderr
- result
- execution_complete
- execution_count
- ping
description: Event type for client-side handling
example: stdout
text:
type: string
description: Textual data for status, init, and stream events