-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathopenapi.yaml
189 lines (189 loc) · 5 KB
/
openapi.yaml
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
openapi: 3.1.0
info:
title: Server Witch API
description: Execute commands, read files and write files on the user's server
version: 0.1.0
servers:
- url: https://serverwitch.dev
paths:
/command:
post:
operationId: post_send_command
summary: Execute a command on the server.
x-openai-isConsequential: false
requestBody:
description: Request body containing the command and session ID.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CommandRequest'
responses:
'200':
description: Command executed successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/CommandResponse'
'500':
description: Server error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/read:
post:
operationId: post_read
summary: Read a file on the server.
x-openai-isConsequential: false
requestBody:
description: Request body containing the file path and session ID.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ReadRequest'
responses:
'200':
description: File read successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/ReadResponse'
'500':
description: Server error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/write:
post:
operationId: post_write
summary: Write a file on the server.
x-openai-isConsequential: false
requestBody:
description: Request body containing the file path, new content and session ID.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WriteRequest'
responses:
'200':
description: File written successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/WriteResponse'
'500':
description: Server error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/status:
get:
operationId: get_status
summary: Get the status of the server.
x-openai-isConsequential: false
responses:
'200':
description: Status of the server.
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
components:
schemas:
CommandRequest:
type: object
required:
- session_id
- command
properties:
command:
type: string
description: Command to execute on the server.
session_id:
type: string
description: Session ID.
ReadRequest:
type: object
required:
- session_id
- path
properties:
path:
type: string
description: Absolute path of the file to be read.
session_id:
type: string
description: Session ID.
WriteRequest:
type: object
required:
- session_id
- path
- content
properties:
path:
type: string
description: Absolute path of the file to be written.
content:
type: string
description: New content of the file.
session_id:
type: string
description: Session ID.
CommandResponse:
type: object
required:
- return_code
- stdout
- stderr
properties:
return_code:
type: integer
description: Return code of the executed command.
stdout:
type: string
description: Standard output of the executed command.
stderr:
type: string
description: Standard error of the executed command.
ReadResponse:
type: object
required:
- content
properties:
content:
type: string
description: Content of the file.
WriteResponse:
type: object
required:
- size
properties:
size:
type: int
description: Number of characters written to the file.
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message detailing what went wrong.
StatusResponse:
type: object
required:
- status
- version
properties:
status:
type: string
description: Current status of the server.
version:
type: string
description: Version of the server software.