wcgw 0.2.0__tar.gz → 1.0.1__tar.gz
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.
Potentially problematic release.
This version of wcgw might be problematic. Click here for more details.
- {wcgw-0.2.0 → wcgw-1.0.1}/PKG-INFO +7 -4
- {wcgw-0.2.0 → wcgw-1.0.1}/README.md +4 -3
- wcgw-1.0.1/gpt_action_json_schema.json +353 -0
- wcgw-1.0.1/gpt_instructions.txt +38 -0
- {wcgw-0.2.0 → wcgw-1.0.1}/pyproject.toml +5 -1
- wcgw-1.0.1/src/wcgw/__init__.py +2 -0
- wcgw-1.0.1/src/wcgw/client/__main__.py +3 -0
- {wcgw-0.2.0/src/wcgw → wcgw-1.0.1/src/wcgw/client}/basic.py +16 -12
- {wcgw-0.2.0/src/wcgw → wcgw-1.0.1/src/wcgw/client}/tools.py +248 -132
- wcgw-1.0.1/src/wcgw/relay/serve.py +316 -0
- wcgw-1.0.1/src/wcgw/types_.py +37 -0
- {wcgw-0.2.0 → wcgw-1.0.1}/tests/test_basic.py +1 -1
- wcgw-1.0.1/tests/test_tools.py +41 -0
- {wcgw-0.2.0 → wcgw-1.0.1}/uv.lock +61 -1
- wcgw-0.2.0/gpt_action_json_schema.json +0 -231
- wcgw-0.2.0/gpt_instructions.txt +0 -38
- wcgw-0.2.0/src/relay/serve.py +0 -155
- wcgw-0.2.0/src/wcgw/__init__.py +0 -2
- wcgw-0.2.0/src/wcgw/__main__.py +0 -3
- wcgw-0.2.0/tests/test_tools.py +0 -34
- {wcgw-0.2.0 → wcgw-1.0.1}/.github/workflows/python-publish.yml +0 -0
- {wcgw-0.2.0 → wcgw-1.0.1}/.github/workflows/python-tests.yml +0 -0
- {wcgw-0.2.0 → wcgw-1.0.1}/.gitignore +0 -0
- {wcgw-0.2.0 → wcgw-1.0.1}/.python-version +0 -0
- {wcgw-0.2.0 → wcgw-1.0.1}/.vscode/settings.json +0 -0
- {wcgw-0.2.0 → wcgw-1.0.1}/config.toml +0 -0
- {wcgw-0.2.0/src/wcgw → wcgw-1.0.1/src/wcgw/client}/claude.py +0 -0
- {wcgw-0.2.0/src/wcgw → wcgw-1.0.1/src/wcgw/client}/common.py +0 -0
- {wcgw-0.2.0/src/wcgw → wcgw-1.0.1/src/wcgw/client}/openai_adapters.py +0 -0
- {wcgw-0.2.0/src/wcgw → wcgw-1.0.1/src/wcgw/client}/openai_utils.py +0 -0
- {wcgw-0.2.0/src → wcgw-1.0.1/src/wcgw}/relay/static/privacy.txt +0 -0
- {wcgw-0.2.0 → wcgw-1.0.1}/static/ss1.png +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: wcgw
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: What could go wrong giving full shell access to chatgpt?
|
|
5
5
|
Project-URL: Homepage, https://github.com/rusiaaman/wcgw
|
|
6
6
|
Author-email: Aman Rusia <gapypi@arcfu.com>
|
|
7
7
|
Requires-Python: <3.13,>=3.10
|
|
8
8
|
Requires-Dist: fastapi>=0.115.0
|
|
9
9
|
Requires-Dist: mypy>=1.11.2
|
|
10
|
+
Requires-Dist: nltk>=3.9.1
|
|
10
11
|
Requires-Dist: openai>=1.46.0
|
|
11
12
|
Requires-Dist: petname>=2.6
|
|
12
13
|
Requires-Dist: pexpect>=4.9.0
|
|
@@ -14,6 +15,7 @@ Requires-Dist: pydantic>=2.9.2
|
|
|
14
15
|
Requires-Dist: pyte>=0.8.2
|
|
15
16
|
Requires-Dist: python-dotenv>=1.0.1
|
|
16
17
|
Requires-Dist: rich>=13.8.1
|
|
18
|
+
Requires-Dist: semantic-version>=2.10.0
|
|
17
19
|
Requires-Dist: shell>=1.0.1
|
|
18
20
|
Requires-Dist: tiktoken==0.7.0
|
|
19
21
|
Requires-Dist: toml>=0.10.2
|
|
@@ -32,7 +34,8 @@ A custom gpt on chatgpt web app to interact with your local shell.
|
|
|
32
34
|
### 🚀 Highlights
|
|
33
35
|
- ⚡ **Full Shell Access**: No restrictions, complete control.
|
|
34
36
|
- ⚡ **Create, Execute, Iterate**: Ask the gpt to keep running compiler checks till all errors are fixed, or ask it to keep checking for the status of a long running command till it's done.
|
|
35
|
-
- ⚡ **Interactive Command Handling**:
|
|
37
|
+
- ⚡ **Interactive Command Handling**: Supports interactive commands using arrow keys, interrupt, and ansi escape sequences.
|
|
38
|
+
- ⚡ **REPL support**: [beta] Supports python/node and other REPL execution.
|
|
36
39
|
|
|
37
40
|
### 🪜 Steps:
|
|
38
41
|
1. Run the [cli client](https://github.com/rusiaaman/wcgw?tab=readme-ov-file#client) in any directory of choice.
|
|
@@ -98,12 +101,12 @@ https://github.com/rusiaaman/wcgw/blob/main/gpt_instructions.txt
|
|
|
98
101
|
https://github.com/rusiaaman/wcgw/blob/main/gpt_action_json_schema.json
|
|
99
102
|
|
|
100
103
|
Run the server
|
|
101
|
-
`gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
|
|
104
|
+
`gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.wcgw.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
|
|
102
105
|
|
|
103
106
|
If you don't have public ip and domain name, you can use `ngrok` or similar services to get a https address to the api.
|
|
104
107
|
|
|
105
108
|
The specify the server url in the `wcgw` command like so
|
|
106
|
-
`wcgw --server-url https://your-url/register`
|
|
109
|
+
`wcgw --server-url https://your-url/v1/register`
|
|
107
110
|
|
|
108
111
|
# [Optional] Local shell access with openai API key
|
|
109
112
|
|
|
@@ -7,7 +7,8 @@ A custom gpt on chatgpt web app to interact with your local shell.
|
|
|
7
7
|
### 🚀 Highlights
|
|
8
8
|
- ⚡ **Full Shell Access**: No restrictions, complete control.
|
|
9
9
|
- ⚡ **Create, Execute, Iterate**: Ask the gpt to keep running compiler checks till all errors are fixed, or ask it to keep checking for the status of a long running command till it's done.
|
|
10
|
-
- ⚡ **Interactive Command Handling**:
|
|
10
|
+
- ⚡ **Interactive Command Handling**: Supports interactive commands using arrow keys, interrupt, and ansi escape sequences.
|
|
11
|
+
- ⚡ **REPL support**: [beta] Supports python/node and other REPL execution.
|
|
11
12
|
|
|
12
13
|
### 🪜 Steps:
|
|
13
14
|
1. Run the [cli client](https://github.com/rusiaaman/wcgw?tab=readme-ov-file#client) in any directory of choice.
|
|
@@ -73,12 +74,12 @@ https://github.com/rusiaaman/wcgw/blob/main/gpt_instructions.txt
|
|
|
73
74
|
https://github.com/rusiaaman/wcgw/blob/main/gpt_action_json_schema.json
|
|
74
75
|
|
|
75
76
|
Run the server
|
|
76
|
-
`gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
|
|
77
|
+
`gunicorn --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:443 src.wcgw.relay.serve:app --certfile fullchain.pem --keyfile privkey.pem`
|
|
77
78
|
|
|
78
79
|
If you don't have public ip and domain name, you can use `ngrok` or similar services to get a https address to the api.
|
|
79
80
|
|
|
80
81
|
The specify the server url in the `wcgw` command like so
|
|
81
|
-
`wcgw --server-url https://your-url/register`
|
|
82
|
+
`wcgw --server-url https://your-url/v1/register`
|
|
82
83
|
|
|
83
84
|
# [Optional] Local shell access with openai API key
|
|
84
85
|
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.1.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "FastAPI",
|
|
5
|
+
"version": "0.1.0"
|
|
6
|
+
},
|
|
7
|
+
"servers": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://bf94-103-212-152-58.ngrok-free.app"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"paths": {
|
|
13
|
+
"/v1/write_file": {
|
|
14
|
+
"post": {
|
|
15
|
+
"x-openai-isConsequential": false,
|
|
16
|
+
"summary": "Write File",
|
|
17
|
+
"operationId": "write_file_v1_write_file_post",
|
|
18
|
+
"requestBody": {
|
|
19
|
+
"content": {
|
|
20
|
+
"application/json": {
|
|
21
|
+
"schema": {
|
|
22
|
+
"$ref": "#/components/schemas/WritefileWithUUID"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": true
|
|
27
|
+
},
|
|
28
|
+
"responses": {
|
|
29
|
+
"200": {
|
|
30
|
+
"description": "Successful Response",
|
|
31
|
+
"content": {
|
|
32
|
+
"application/json": {
|
|
33
|
+
"schema": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"title": "Response Write File V1 Write File Post"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"422": {
|
|
41
|
+
"description": "Validation Error",
|
|
42
|
+
"content": {
|
|
43
|
+
"application/json": {
|
|
44
|
+
"schema": {
|
|
45
|
+
"$ref": "#/components/schemas/HTTPValidationError"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"/v1/reset_shell": {
|
|
54
|
+
"post": {
|
|
55
|
+
"x-openai-isConsequential": false,
|
|
56
|
+
"summary": "Reset Shell",
|
|
57
|
+
"operationId": "reset_shell_v1_reset_shell_post",
|
|
58
|
+
"requestBody": {
|
|
59
|
+
"content": {
|
|
60
|
+
"application/json": {
|
|
61
|
+
"schema": {
|
|
62
|
+
"$ref": "#/components/schemas/ResetShellWithUUID"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"required": true
|
|
67
|
+
},
|
|
68
|
+
"responses": {
|
|
69
|
+
"200": {
|
|
70
|
+
"description": "Successful Response",
|
|
71
|
+
"content": {
|
|
72
|
+
"application/json": {
|
|
73
|
+
"schema": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"title": "Response Reset Shell V1 Reset Shell Post"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"422": {
|
|
81
|
+
"description": "Validation Error",
|
|
82
|
+
"content": {
|
|
83
|
+
"application/json": {
|
|
84
|
+
"schema": {
|
|
85
|
+
"$ref": "#/components/schemas/HTTPValidationError"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"/v1/bash_command": {
|
|
94
|
+
"post": {
|
|
95
|
+
"x-openai-isConsequential": false,
|
|
96
|
+
"summary": "Bash Command",
|
|
97
|
+
"operationId": "bash_command_v1_bash_command_post",
|
|
98
|
+
"requestBody": {
|
|
99
|
+
"content": {
|
|
100
|
+
"application/json": {
|
|
101
|
+
"schema": {
|
|
102
|
+
"$ref": "#/components/schemas/CommandWithUUID"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"required": true
|
|
107
|
+
},
|
|
108
|
+
"responses": {
|
|
109
|
+
"200": {
|
|
110
|
+
"description": "Successful Response",
|
|
111
|
+
"content": {
|
|
112
|
+
"application/json": {
|
|
113
|
+
"schema": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"title": "Response Bash Command V1 Bash Command Post"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"422": {
|
|
121
|
+
"description": "Validation Error",
|
|
122
|
+
"content": {
|
|
123
|
+
"application/json": {
|
|
124
|
+
"schema": {
|
|
125
|
+
"$ref": "#/components/schemas/HTTPValidationError"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"/v1/bash_interaction": {
|
|
134
|
+
"post": {
|
|
135
|
+
"x-openai-isConsequential": false,
|
|
136
|
+
"summary": "Bash Interaction",
|
|
137
|
+
"operationId": "bash_interaction_v1_bash_interaction_post",
|
|
138
|
+
"requestBody": {
|
|
139
|
+
"content": {
|
|
140
|
+
"application/json": {
|
|
141
|
+
"schema": {
|
|
142
|
+
"$ref": "#/components/schemas/BashInteractionWithUUID"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"required": true
|
|
147
|
+
},
|
|
148
|
+
"responses": {
|
|
149
|
+
"200": {
|
|
150
|
+
"description": "Successful Response",
|
|
151
|
+
"content": {
|
|
152
|
+
"application/json": {
|
|
153
|
+
"schema": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"title": "Response Bash Interaction V1 Bash Interaction Post"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"422": {
|
|
161
|
+
"description": "Validation Error",
|
|
162
|
+
"content": {
|
|
163
|
+
"application/json": {
|
|
164
|
+
"schema": {
|
|
165
|
+
"$ref": "#/components/schemas/HTTPValidationError"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"components": {
|
|
175
|
+
"schemas": {
|
|
176
|
+
"BashInteractionWithUUID": {
|
|
177
|
+
"properties": {
|
|
178
|
+
"send_text": {
|
|
179
|
+
"anyOf": [
|
|
180
|
+
{
|
|
181
|
+
"type": "string"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"type": "null"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"title": "Send Text"
|
|
188
|
+
},
|
|
189
|
+
"send_specials": {
|
|
190
|
+
"anyOf": [
|
|
191
|
+
{
|
|
192
|
+
"items": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"enum": [
|
|
195
|
+
"Key-up",
|
|
196
|
+
"Key-down",
|
|
197
|
+
"Key-left",
|
|
198
|
+
"Key-right",
|
|
199
|
+
"Enter",
|
|
200
|
+
"Ctrl-c",
|
|
201
|
+
"Ctrl-d",
|
|
202
|
+
"Ctrl-z"
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
"type": "array"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"type": "null"
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"title": "Send Specials"
|
|
212
|
+
},
|
|
213
|
+
"send_ascii": {
|
|
214
|
+
"anyOf": [
|
|
215
|
+
{
|
|
216
|
+
"items": {
|
|
217
|
+
"type": "integer"
|
|
218
|
+
},
|
|
219
|
+
"type": "array"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"type": "null"
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
"title": "Send Ascii"
|
|
226
|
+
},
|
|
227
|
+
"user_id": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"format": "uuid",
|
|
230
|
+
"title": "User Id"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"type": "object",
|
|
234
|
+
"required": [
|
|
235
|
+
"user_id"
|
|
236
|
+
],
|
|
237
|
+
"title": "BashInteractionWithUUID"
|
|
238
|
+
},
|
|
239
|
+
"CommandWithUUID": {
|
|
240
|
+
"properties": {
|
|
241
|
+
"command": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"title": "Command"
|
|
244
|
+
},
|
|
245
|
+
"user_id": {
|
|
246
|
+
"type": "string",
|
|
247
|
+
"format": "uuid",
|
|
248
|
+
"title": "User Id"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"type": "object",
|
|
252
|
+
"required": [
|
|
253
|
+
"command",
|
|
254
|
+
"user_id"
|
|
255
|
+
],
|
|
256
|
+
"title": "CommandWithUUID"
|
|
257
|
+
},
|
|
258
|
+
"HTTPValidationError": {
|
|
259
|
+
"properties": {
|
|
260
|
+
"detail": {
|
|
261
|
+
"items": {
|
|
262
|
+
"$ref": "#/components/schemas/ValidationError"
|
|
263
|
+
},
|
|
264
|
+
"type": "array",
|
|
265
|
+
"title": "Detail"
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
"type": "object",
|
|
269
|
+
"title": "HTTPValidationError"
|
|
270
|
+
},
|
|
271
|
+
"ResetShellWithUUID": {
|
|
272
|
+
"properties": {
|
|
273
|
+
"should_reset": {
|
|
274
|
+
"type": "boolean",
|
|
275
|
+
"enum": [
|
|
276
|
+
true
|
|
277
|
+
],
|
|
278
|
+
"const": true,
|
|
279
|
+
"title": "Should Reset",
|
|
280
|
+
"default": true
|
|
281
|
+
},
|
|
282
|
+
"user_id": {
|
|
283
|
+
"type": "string",
|
|
284
|
+
"format": "uuid",
|
|
285
|
+
"title": "User Id"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"type": "object",
|
|
289
|
+
"required": [
|
|
290
|
+
"user_id"
|
|
291
|
+
],
|
|
292
|
+
"title": "ResetShellWithUUID"
|
|
293
|
+
},
|
|
294
|
+
"ValidationError": {
|
|
295
|
+
"properties": {
|
|
296
|
+
"loc": {
|
|
297
|
+
"items": {
|
|
298
|
+
"anyOf": [
|
|
299
|
+
{
|
|
300
|
+
"type": "string"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"type": "integer"
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
},
|
|
307
|
+
"type": "array",
|
|
308
|
+
"title": "Location"
|
|
309
|
+
},
|
|
310
|
+
"msg": {
|
|
311
|
+
"type": "string",
|
|
312
|
+
"title": "Message"
|
|
313
|
+
},
|
|
314
|
+
"type": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"title": "Error Type"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"type": "object",
|
|
320
|
+
"required": [
|
|
321
|
+
"loc",
|
|
322
|
+
"msg",
|
|
323
|
+
"type"
|
|
324
|
+
],
|
|
325
|
+
"title": "ValidationError"
|
|
326
|
+
},
|
|
327
|
+
"WritefileWithUUID": {
|
|
328
|
+
"properties": {
|
|
329
|
+
"file_path": {
|
|
330
|
+
"type": "string",
|
|
331
|
+
"title": "File Path"
|
|
332
|
+
},
|
|
333
|
+
"file_content": {
|
|
334
|
+
"type": "string",
|
|
335
|
+
"title": "File Content"
|
|
336
|
+
},
|
|
337
|
+
"user_id": {
|
|
338
|
+
"type": "string",
|
|
339
|
+
"format": "uuid",
|
|
340
|
+
"title": "User Id"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"type": "object",
|
|
344
|
+
"required": [
|
|
345
|
+
"file_path",
|
|
346
|
+
"file_content",
|
|
347
|
+
"user_id"
|
|
348
|
+
],
|
|
349
|
+
"title": "WritefileWithUUID"
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
You're a cli assistant.
|
|
2
|
+
|
|
3
|
+
Instructions:
|
|
4
|
+
|
|
5
|
+
- You should use the provided bash execution tool to run script to complete objective.
|
|
6
|
+
- Do not use sudo. Do not use interactive commands.
|
|
7
|
+
- Ask user for confirmation before running anything major
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
To execute bash commands OR write files use the provided api.
|
|
11
|
+
|
|
12
|
+
Instructions for `BashCommand`:
|
|
13
|
+
- Execute a bash command. This is stateful (beware with subsequent calls).
|
|
14
|
+
- Do not use interactive commands like nano. Prefer writing simpler commands.
|
|
15
|
+
- Status of the command and the current working directory will always be returned at the end.
|
|
16
|
+
- Optionally `exit shell has restarted` is the output, in which case environment resets, you can run fresh commands.
|
|
17
|
+
- The first line might be `(...truncated)` if the output is too long.
|
|
18
|
+
- Always run `pwd` if you get any file or directory not found error to make sure you're not lost.
|
|
19
|
+
|
|
20
|
+
Instructions for `Write File`
|
|
21
|
+
- Write content to a file. Provide file path and content. Use this instead of BashCommand for writing files.
|
|
22
|
+
- This doesn't create any directories, please create directories using `mkdir -p` BashCommand.
|
|
23
|
+
- Important: all relative paths are relative to last CWD.
|
|
24
|
+
|
|
25
|
+
Instructions for `BashInteraction`
|
|
26
|
+
- Interact with running program using this tool
|
|
27
|
+
- Special keys like arrows, interrupts, enter, etc.
|
|
28
|
+
- Send text input to the running program.
|
|
29
|
+
|
|
30
|
+
Instructions for `ResetShell`
|
|
31
|
+
- Resets the shell. Use only if all interrupts and prompt reset attempts have failed repeatedly.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
Always critically think and debate with yourself to solve the problem. Understand the context and the code by reading as much resources as possible before writing a single piece of code.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
Ask the user for the user_id `UUID` if they haven't provided in the first message.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
authors = [{ name = "Aman Rusia", email = "gapypi@arcfu.com" }]
|
|
3
3
|
name = "wcgw"
|
|
4
|
-
version = "0.
|
|
4
|
+
version = "1.0.1"
|
|
5
5
|
description = "What could go wrong giving full shell access to chatgpt?"
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
requires-python = ">=3.10, <3.13"
|
|
@@ -22,6 +22,8 @@ dependencies = [
|
|
|
22
22
|
"uvicorn>=0.31.0",
|
|
23
23
|
"websockets>=13.1",
|
|
24
24
|
"pydantic>=2.9.2",
|
|
25
|
+
"semantic-version>=2.10.0",
|
|
26
|
+
"nltk>=3.9.1",
|
|
25
27
|
]
|
|
26
28
|
|
|
27
29
|
[project.urls]
|
|
@@ -34,6 +36,7 @@ build-backend = "hatchling.build"
|
|
|
34
36
|
[project.scripts]
|
|
35
37
|
wcgw_local = "wcgw:app"
|
|
36
38
|
wcgw = "wcgw:listen"
|
|
39
|
+
wcgw_relay = "wcgw.relay.serve:run"
|
|
37
40
|
|
|
38
41
|
[tool.uv]
|
|
39
42
|
dev-dependencies = [
|
|
@@ -41,4 +44,5 @@ dev-dependencies = [
|
|
|
41
44
|
"types-toml>=0.10.8.20240310",
|
|
42
45
|
"autoflake",
|
|
43
46
|
"ipython>=8.12.3",
|
|
47
|
+
"gunicorn>=23.0.0",
|
|
44
48
|
]
|
|
@@ -20,16 +20,15 @@ import petname # type: ignore[import-untyped]
|
|
|
20
20
|
from typer import Typer
|
|
21
21
|
import uuid
|
|
22
22
|
|
|
23
|
+
from ..types_ import BashCommand, BashInteraction, ReadImage, Writefile, ResetShell
|
|
24
|
+
|
|
23
25
|
from .common import Models, discard_input
|
|
24
26
|
from .common import CostData, History
|
|
25
27
|
from .openai_utils import get_input_cost, get_output_cost
|
|
26
|
-
from .tools import
|
|
28
|
+
from .tools import ImageData
|
|
27
29
|
|
|
28
30
|
from .tools import (
|
|
29
|
-
BASH_CLF_OUTPUT,
|
|
30
|
-
Confirmation,
|
|
31
31
|
DoneFlag,
|
|
32
|
-
Writefile,
|
|
33
32
|
get_tool_output,
|
|
34
33
|
SHELL,
|
|
35
34
|
start_shell,
|
|
@@ -156,27 +155,32 @@ def loop(
|
|
|
156
155
|
|
|
157
156
|
tools = [
|
|
158
157
|
openai.pydantic_function_tool(
|
|
159
|
-
|
|
158
|
+
BashCommand,
|
|
160
159
|
description="""
|
|
161
|
-
- Execute a bash
|
|
162
|
-
- Execute commands using `execute_command` attribute. You can run python/node/other REPL code lines using `execute_command` too.
|
|
160
|
+
- Execute a bash command. This is stateful (beware with subsequent calls).
|
|
163
161
|
- Do not use interactive commands like nano. Prefer writing simpler commands.
|
|
164
|
-
-
|
|
165
|
-
- The last line is `(pending)` if the program is still running or waiting for your input. You can then send input using `send_ascii` attributes. You get status by sending new line `send_ascii: ["Enter"]` or `send_ascii: [10]`.
|
|
166
|
-
- Optionally the last line is `(won't exit)` in which case you need to kill the process if you want to run a new command.
|
|
162
|
+
- Status of the command and the current working directory will always be returned at the end.
|
|
167
163
|
- Optionally `exit shell has restarted` is the output, in which case environment resets, you can run fresh commands.
|
|
168
164
|
- The first line might be `(...truncated)` if the output is too long.
|
|
169
165
|
- Always run `pwd` if you get any file or directory not found error to make sure you're not lost.
|
|
170
|
-
- You can run python/node/other REPL code lines using `execute_command` too. NOTE: `execute_command` doesn't create a new shell, it uses the same shell.
|
|
171
166
|
""",
|
|
167
|
+
),
|
|
168
|
+
openai.pydantic_function_tool(
|
|
169
|
+
BashInteraction,
|
|
170
|
+
description="""
|
|
171
|
+
- Interact with running program using this tool.""",
|
|
172
172
|
),
|
|
173
173
|
openai.pydantic_function_tool(
|
|
174
174
|
Writefile,
|
|
175
|
-
description="Write content to a file. Provide file path and content. Use this instead of
|
|
175
|
+
description="Write content to a file. Provide file path and content. Use this instead of BashCommand for writing files.",
|
|
176
176
|
),
|
|
177
177
|
openai.pydantic_function_tool(
|
|
178
178
|
ReadImage, description="Read an image from the shell."
|
|
179
179
|
),
|
|
180
|
+
openai.pydantic_function_tool(
|
|
181
|
+
ResetShell,
|
|
182
|
+
description="Resets the shell. Use only if all interrupts and prompt reset attempts have failed repeatedly.",
|
|
183
|
+
),
|
|
180
184
|
]
|
|
181
185
|
uname_sysname = os.uname().sysname
|
|
182
186
|
uname_machine = os.uname().machine
|