wcgw 3.0.4__tar.gz → 3.0.6__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-3.0.4 → wcgw-3.0.6}/PKG-INFO +1 -1
- {wcgw-3.0.4 → wcgw-3.0.6}/gpt_action_json_schema.json +3 -3
- {wcgw-3.0.4 → wcgw-3.0.6}/pyproject.toml +1 -1
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/bash_state/bash_state.py +53 -31
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/tools.py +42 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/relay/serve.py +1 -1
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/types_.py +2 -2
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw_cli/anthropic_client.py +0 -11
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw_cli/openai_client.py +0 -11
- {wcgw-3.0.4 → wcgw-3.0.6}/tests/test_mcp_server.py +4 -4
- {wcgw-3.0.4 → wcgw-3.0.6}/tests/test_tools.py +23 -23
- {wcgw-3.0.4 → wcgw-3.0.6}/uv.lock +1 -1
- {wcgw-3.0.4 → wcgw-3.0.6}/.github/workflows/python-publish.yml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/.github/workflows/python-tests.yml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/.github/workflows/python-types.yml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/.gitignore +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/.gitmodules +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/.python-version +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/.vscode/settings.json +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/Dockerfile +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/LICENSE +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/README.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/gpt_instructions.txt +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/openai.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/.git +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/.github/workflows/main-checks.yml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/.github/workflows/publish-pypi.yml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/.github/workflows/pull-request-checks.yml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/.github/workflows/shared.yml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/.gitignore +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/.python-version +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/CODE_OF_CONDUCT.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/CONTRIBUTING.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/LICENSE +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/README.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/RELEASE.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/SECURITY.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/README.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-prompt/.python-version +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-prompt/README.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-prompt/mcp_simple_prompt/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-prompt/mcp_simple_prompt/__main__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-prompt/mcp_simple_prompt/server.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-prompt/pyproject.toml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-resource/.python-version +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-resource/README.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-resource/mcp_simple_resource/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-resource/mcp_simple_resource/__main__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-resource/mcp_simple_resource/server.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-resource/pyproject.toml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-tool/.python-version +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-tool/README.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-tool/mcp_simple_tool/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-tool/mcp_simple_tool/__main__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-tool/mcp_simple_tool/server.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-tool/pyproject.toml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/pyproject.toml +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/client/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/client/__main__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/client/session.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/client/sse.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/client/stdio.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/py.typed +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/server/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/server/__main__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/server/models.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/server/session.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/server/sse.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/server/stdio.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/server/websocket.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/shared/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/shared/context.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/shared/exceptions.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/shared/memory.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/shared/progress.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/shared/session.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/shared/version.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/src/mcp_wcgw/types.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/client/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/client/test_session.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/client/test_stdio.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/conftest.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/server/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/server/test_session.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/server/test_stdio.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/shared/test_memory.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/tests/test_types.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/uv.lock +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/common.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/diff-instructions.txt +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/encoder/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/file_ops/diff_edit.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/file_ops/search_replace.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/mcp_server/Readme.md +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/mcp_server/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/mcp_server/server.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/memory.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/modes.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/repo_ops/display_tree.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/repo_ops/path_prob.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/repo_ops/paths_model.vocab +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/repo_ops/paths_tokens.model +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/repo_ops/repo_context.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/client/tool_prompts.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/py.typed +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/relay/client.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw/relay/static/privacy.txt +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw_cli/__init__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw_cli/__main__.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw_cli/cli.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/src/wcgw_cli/openai_utils.py +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/static/claude-ss.jpg +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/static/computer-use.jpg +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/static/example.jpg +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/static/rocket-icon.png +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/static/ss1.png +0 -0
- {wcgw-3.0.4 → wcgw-3.0.6}/tests/test_edit.py +0 -0
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
},
|
|
311
311
|
"CommandWithUUID": {
|
|
312
312
|
"properties": {
|
|
313
|
-
"
|
|
313
|
+
"action_json": {
|
|
314
314
|
"anyOf": [
|
|
315
315
|
{
|
|
316
316
|
"$ref": "#/components/schemas/Command"
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
"$ref": "#/components/schemas/SendAscii"
|
|
329
329
|
}
|
|
330
330
|
],
|
|
331
|
-
"title": "
|
|
331
|
+
"title": "ActionJson"
|
|
332
332
|
},
|
|
333
333
|
"wait_for_seconds": {
|
|
334
334
|
"anyOf": [
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
"additionalProperties": false,
|
|
351
351
|
"type": "object",
|
|
352
352
|
"required": [
|
|
353
|
-
"
|
|
353
|
+
"action_json",
|
|
354
354
|
"user_id"
|
|
355
355
|
],
|
|
356
356
|
"title": "CommandWithUUID"
|
|
@@ -78,7 +78,9 @@ def get_tmpdir() -> str:
|
|
|
78
78
|
|
|
79
79
|
def check_if_screen_command_available() -> bool:
|
|
80
80
|
try:
|
|
81
|
-
subprocess.run(
|
|
81
|
+
subprocess.run(
|
|
82
|
+
["which", "screen"], capture_output=True, check=True, timeout=0.2
|
|
83
|
+
)
|
|
82
84
|
return True
|
|
83
85
|
except (subprocess.CalledProcessError, FileNotFoundError):
|
|
84
86
|
return False
|
|
@@ -137,7 +139,7 @@ def cleanup_all_screens_with_name(name: str, console: Console) -> None:
|
|
|
137
139
|
|
|
138
140
|
def start_shell(
|
|
139
141
|
is_restricted_mode: bool, initial_dir: str, console: Console, over_screen: bool
|
|
140
|
-
) -> tuple[pexpect.spawn, str]:
|
|
142
|
+
) -> tuple["pexpect.spawn[str]", str]:
|
|
141
143
|
cmd = "/bin/bash"
|
|
142
144
|
if is_restricted_mode:
|
|
143
145
|
cmd += " -r"
|
|
@@ -232,6 +234,7 @@ class BashState:
|
|
|
232
234
|
use_screen: bool,
|
|
233
235
|
whitelist_for_overwrite: Optional[set[str]] = None,
|
|
234
236
|
) -> None:
|
|
237
|
+
self._last_command: str = ""
|
|
235
238
|
self.console = console
|
|
236
239
|
self._cwd = working_dir or os.getcwd()
|
|
237
240
|
self._bash_command_mode: BashCommandMode = bash_command_mode or BashCommandMode(
|
|
@@ -253,13 +256,17 @@ class BashState:
|
|
|
253
256
|
output = self._shell.expect(pattern, timeout)
|
|
254
257
|
return output
|
|
255
258
|
|
|
256
|
-
def send(self, s: str | bytes) -> int:
|
|
259
|
+
def send(self, s: str | bytes, set_as_command: Optional[str]) -> int:
|
|
257
260
|
self.close_bg_expect_thread()
|
|
261
|
+
if set_as_command is not None:
|
|
262
|
+
self._last_command = set_as_command
|
|
258
263
|
output = self._shell.send(s)
|
|
259
264
|
return output
|
|
260
265
|
|
|
261
|
-
def sendline(self, s: str | bytes) -> int:
|
|
266
|
+
def sendline(self, s: str | bytes, set_as_command: Optional[str]) -> int:
|
|
262
267
|
self.close_bg_expect_thread()
|
|
268
|
+
if set_as_command is not None:
|
|
269
|
+
self._last_command = set_as_command
|
|
263
270
|
output = self._shell.sendline(s)
|
|
264
271
|
return output
|
|
265
272
|
|
|
@@ -273,7 +280,10 @@ class BashState:
|
|
|
273
280
|
|
|
274
281
|
@property
|
|
275
282
|
def before(self) -> Optional[str]:
|
|
276
|
-
|
|
283
|
+
before = self._shell.before
|
|
284
|
+
if before and before.startswith(self._last_command):
|
|
285
|
+
return before[len(self._last_command) :]
|
|
286
|
+
return before
|
|
277
287
|
|
|
278
288
|
def run_bg_expect_thread(self) -> None:
|
|
279
289
|
"""
|
|
@@ -333,11 +343,11 @@ class BashState:
|
|
|
333
343
|
def ensure_env_and_bg_jobs(self) -> Optional[int]:
|
|
334
344
|
quick_timeout = 0.2 if not self.over_screen else 1
|
|
335
345
|
# First reset the prompt in case venv was sourced or other reasons.
|
|
336
|
-
self.sendline(PROMPT_STATEMENT)
|
|
346
|
+
self.sendline(PROMPT_STATEMENT, set_as_command=PROMPT_STATEMENT)
|
|
337
347
|
self.expect(PROMPT_CONST, timeout=quick_timeout)
|
|
338
348
|
# Reset echo also if it was enabled
|
|
339
349
|
command = "jobs | wc -l"
|
|
340
|
-
self.sendline(command)
|
|
350
|
+
self.sendline(command, set_as_command=command)
|
|
341
351
|
before = ""
|
|
342
352
|
counts = 0
|
|
343
353
|
while not _is_int(before): # Consume all previous output
|
|
@@ -365,6 +375,7 @@ class BashState:
|
|
|
365
375
|
|
|
366
376
|
def _init_shell(self) -> None:
|
|
367
377
|
self._state: Literal["repl"] | datetime.datetime = "repl"
|
|
378
|
+
self._last_command = ""
|
|
368
379
|
# Ensure self._cwd exists
|
|
369
380
|
os.makedirs(self._cwd, exist_ok=True)
|
|
370
381
|
try:
|
|
@@ -404,6 +415,7 @@ class BashState:
|
|
|
404
415
|
def set_repl(self) -> None:
|
|
405
416
|
self._state = "repl"
|
|
406
417
|
self._pending_output = ""
|
|
418
|
+
self._last_command = ""
|
|
407
419
|
|
|
408
420
|
@property
|
|
409
421
|
def state(self) -> BASH_CLF_OUTPUT:
|
|
@@ -420,7 +432,7 @@ class BashState:
|
|
|
420
432
|
return PROMPT_CONST
|
|
421
433
|
|
|
422
434
|
def update_cwd(self) -> str:
|
|
423
|
-
self.sendline("pwd")
|
|
435
|
+
self.sendline("pwd", set_as_command="pwd")
|
|
424
436
|
self.expect(PROMPT_CONST, timeout=0.2)
|
|
425
437
|
before_val = self.before
|
|
426
438
|
if not isinstance(before_val, str):
|
|
@@ -505,8 +517,8 @@ class BashState:
|
|
|
505
517
|
|
|
506
518
|
|
|
507
519
|
WAITING_INPUT_MESSAGE = """A command is already running. NOTE: You can't run multiple shell sessions, likely a previous program hasn't exited.
|
|
508
|
-
1. Get its output using
|
|
509
|
-
2. Use `send_ascii` or `send_specials` to give inputs to the running program
|
|
520
|
+
1. Get its output using status check.
|
|
521
|
+
2. Use `send_ascii` or `send_specials` to give inputs to the running program OR
|
|
510
522
|
3. kill the previous program by sending ctrl+c first using `send_ascii` or `send_specials`
|
|
511
523
|
4. Interrupt and run the process in background by re-running it using screen
|
|
512
524
|
"""
|
|
@@ -538,6 +550,11 @@ def _incremental_text(text: str, last_pending_output: str) -> str:
|
|
|
538
550
|
# text = render_terminal_output(text[-100_000:])
|
|
539
551
|
text = text[-100_000:]
|
|
540
552
|
|
|
553
|
+
if not last_pending_output:
|
|
554
|
+
# This is the first call. We need to offset the position where this program
|
|
555
|
+
# is being rendered for the new screen versions
|
|
556
|
+
# Caveat: no difference in output between a program with leading whitespace and one without.
|
|
557
|
+
return rstrip(render_terminal_output(text)).lstrip()
|
|
541
558
|
last_rendered_lines = render_terminal_output(last_pending_output)
|
|
542
559
|
last_pending_output_rendered = "\n".join(last_rendered_lines)
|
|
543
560
|
if not last_rendered_lines:
|
|
@@ -575,12 +592,15 @@ def get_status(bash_state: BashState) -> str:
|
|
|
575
592
|
|
|
576
593
|
def is_status_check(arg: BashCommand) -> bool:
|
|
577
594
|
return (
|
|
578
|
-
isinstance(arg.
|
|
595
|
+
isinstance(arg.action_json, StatusCheck)
|
|
596
|
+
or (
|
|
597
|
+
isinstance(arg.action_json, SendSpecials)
|
|
598
|
+
and arg.action_json.send_specials == ["Enter"]
|
|
599
|
+
)
|
|
579
600
|
or (
|
|
580
|
-
isinstance(arg.
|
|
581
|
-
and arg.
|
|
601
|
+
isinstance(arg.action_json, SendAscii)
|
|
602
|
+
and arg.action_json.send_ascii == [10]
|
|
582
603
|
)
|
|
583
|
-
or (isinstance(arg.action, SendAscii) and arg.action.send_ascii == [10])
|
|
584
604
|
)
|
|
585
605
|
|
|
586
606
|
|
|
@@ -595,8 +615,8 @@ def execute_bash(
|
|
|
595
615
|
output, cost = _execute_bash(bash_state, enc, bash_arg, max_tokens, timeout_s)
|
|
596
616
|
|
|
597
617
|
# Remove echo if it's a command
|
|
598
|
-
if isinstance(bash_arg.
|
|
599
|
-
command = bash_arg.
|
|
618
|
+
if isinstance(bash_arg.action_json, Command):
|
|
619
|
+
command = bash_arg.action_json.command.strip()
|
|
600
620
|
if output.startswith(command):
|
|
601
621
|
output = output[len(command) :]
|
|
602
622
|
|
|
@@ -614,7 +634,7 @@ def _execute_bash(
|
|
|
614
634
|
) -> tuple[str, float]:
|
|
615
635
|
try:
|
|
616
636
|
is_interrupt = False
|
|
617
|
-
command_data = bash_arg.
|
|
637
|
+
command_data = bash_arg.action_json
|
|
618
638
|
|
|
619
639
|
if isinstance(command_data, Command):
|
|
620
640
|
if bash_state.bash_command_mode.allowed_commands == "none":
|
|
@@ -632,8 +652,8 @@ def _execute_bash(
|
|
|
632
652
|
)
|
|
633
653
|
|
|
634
654
|
for i in range(0, len(command), 128):
|
|
635
|
-
bash_state.send(command[i : i + 128])
|
|
636
|
-
bash_state.send(bash_state.linesep)
|
|
655
|
+
bash_state.send(command[i : i + 128], set_as_command=None)
|
|
656
|
+
bash_state.send(bash_state.linesep, set_as_command=command)
|
|
637
657
|
|
|
638
658
|
elif isinstance(command_data, StatusCheck):
|
|
639
659
|
bash_state.console.print("Checking status")
|
|
@@ -646,8 +666,10 @@ def _execute_bash(
|
|
|
646
666
|
|
|
647
667
|
bash_state.console.print(f"Interact text: {command_data.send_text}")
|
|
648
668
|
for i in range(0, len(command_data.send_text), 128):
|
|
649
|
-
bash_state.send(
|
|
650
|
-
|
|
669
|
+
bash_state.send(
|
|
670
|
+
command_data.send_text[i : i + 128], set_as_command=None
|
|
671
|
+
)
|
|
672
|
+
bash_state.send(bash_state.linesep, set_as_command=None)
|
|
651
673
|
|
|
652
674
|
elif isinstance(command_data, SendSpecials):
|
|
653
675
|
if not command_data.send_specials:
|
|
@@ -658,15 +680,15 @@ def _execute_bash(
|
|
|
658
680
|
)
|
|
659
681
|
for char in command_data.send_specials:
|
|
660
682
|
if char == "Key-up":
|
|
661
|
-
bash_state.send("\033[A")
|
|
683
|
+
bash_state.send("\033[A", set_as_command=None)
|
|
662
684
|
elif char == "Key-down":
|
|
663
|
-
bash_state.send("\033[B")
|
|
685
|
+
bash_state.send("\033[B", set_as_command=None)
|
|
664
686
|
elif char == "Key-left":
|
|
665
|
-
bash_state.send("\033[D")
|
|
687
|
+
bash_state.send("\033[D", set_as_command=None)
|
|
666
688
|
elif char == "Key-right":
|
|
667
|
-
bash_state.send("\033[C")
|
|
689
|
+
bash_state.send("\033[C", set_as_command=None)
|
|
668
690
|
elif char == "Enter":
|
|
669
|
-
bash_state.send("\n")
|
|
691
|
+
bash_state.send("\n", set_as_command=None)
|
|
670
692
|
elif char == "Ctrl-c":
|
|
671
693
|
bash_state.sendintr()
|
|
672
694
|
is_interrupt = True
|
|
@@ -674,7 +696,7 @@ def _execute_bash(
|
|
|
674
696
|
bash_state.sendintr()
|
|
675
697
|
is_interrupt = True
|
|
676
698
|
elif char == "Ctrl-z":
|
|
677
|
-
bash_state.send("\x1a")
|
|
699
|
+
bash_state.send("\x1a", set_as_command=None)
|
|
678
700
|
else:
|
|
679
701
|
raise Exception(f"Unknown special character: {char}")
|
|
680
702
|
|
|
@@ -686,7 +708,7 @@ def _execute_bash(
|
|
|
686
708
|
f"Sending ASCII sequence: {command_data.send_ascii}"
|
|
687
709
|
)
|
|
688
710
|
for ascii_char in command_data.send_ascii:
|
|
689
|
-
bash_state.send(chr(ascii_char))
|
|
711
|
+
bash_state.send(chr(ascii_char), set_as_command=None)
|
|
690
712
|
if ascii_char == 3:
|
|
691
713
|
is_interrupt = True
|
|
692
714
|
else:
|
|
@@ -747,9 +769,9 @@ def _execute_bash(
|
|
|
747
769
|
incremental_text = (
|
|
748
770
|
incremental_text
|
|
749
771
|
+ """---
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
772
|
+
----
|
|
773
|
+
Failure interrupting.
|
|
774
|
+
You may want to try Ctrl-c again or program specific exit interactive commands.
|
|
753
775
|
"""
|
|
754
776
|
)
|
|
755
777
|
|
|
@@ -20,6 +20,7 @@ from typing import (
|
|
|
20
20
|
TypeVar,
|
|
21
21
|
)
|
|
22
22
|
|
|
23
|
+
import rich
|
|
23
24
|
from openai.types.chat import (
|
|
24
25
|
ChatCompletionMessageParam,
|
|
25
26
|
)
|
|
@@ -31,6 +32,7 @@ from wcgw.client.bash_state.bash_state import get_status
|
|
|
31
32
|
from ..types_ import (
|
|
32
33
|
BashCommand,
|
|
33
34
|
CodeWriterMode,
|
|
35
|
+
Command,
|
|
34
36
|
Console,
|
|
35
37
|
ContextSave,
|
|
36
38
|
FileEdit,
|
|
@@ -797,3 +799,43 @@ def read_file(
|
|
|
797
799
|
content += f"\n(...truncated)\n---\nI've saved the continuation in a new file. Please read: `{rest}`"
|
|
798
800
|
truncated = True
|
|
799
801
|
return content, truncated, tokens_counts
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
if __name__ == "__main__":
|
|
805
|
+
with BashState(
|
|
806
|
+
rich.console.Console(style="blue", highlight=False, markup=False),
|
|
807
|
+
"",
|
|
808
|
+
None,
|
|
809
|
+
None,
|
|
810
|
+
None,
|
|
811
|
+
None,
|
|
812
|
+
True,
|
|
813
|
+
None,
|
|
814
|
+
) as BASH_STATE:
|
|
815
|
+
print(
|
|
816
|
+
get_tool_output(
|
|
817
|
+
Context(BASH_STATE, BASH_STATE.console),
|
|
818
|
+
Initialize(
|
|
819
|
+
type="first_call",
|
|
820
|
+
any_workspace_path="",
|
|
821
|
+
initial_files_to_read=[],
|
|
822
|
+
task_id_to_resume="",
|
|
823
|
+
mode_name="wcgw",
|
|
824
|
+
code_writer_config=None,
|
|
825
|
+
),
|
|
826
|
+
default_enc,
|
|
827
|
+
0,
|
|
828
|
+
lambda x, y: ("", 0),
|
|
829
|
+
None,
|
|
830
|
+
)
|
|
831
|
+
)
|
|
832
|
+
print(
|
|
833
|
+
get_tool_output(
|
|
834
|
+
Context(BASH_STATE, BASH_STATE.console),
|
|
835
|
+
BashCommand(action_json=Command(command="pwd")),
|
|
836
|
+
default_enc,
|
|
837
|
+
0,
|
|
838
|
+
lambda x, y: ("", 0),
|
|
839
|
+
None,
|
|
840
|
+
)
|
|
841
|
+
)
|
|
@@ -179,7 +179,7 @@ async def bash_command(command: CommandWithUUID) -> str:
|
|
|
179
179
|
await clients[user_id](
|
|
180
180
|
Mdata(
|
|
181
181
|
data=BashCommand(
|
|
182
|
-
|
|
182
|
+
action_json=command.action_json, wait_for_seconds=command.wait_for_seconds
|
|
183
183
|
),
|
|
184
184
|
user_id=user_id,
|
|
185
185
|
)
|
|
@@ -19,7 +19,7 @@ class CodeWriterMode(BaseModel):
|
|
|
19
19
|
allowed_globs: Literal["all"] | list[str]
|
|
20
20
|
allowed_commands: Literal["all"] | list[str]
|
|
21
21
|
|
|
22
|
-
def
|
|
22
|
+
def model_post_init(self, _: Any) -> None:
|
|
23
23
|
# Patch frequently wrong output trading off accuracy
|
|
24
24
|
# in rare case there's a file named 'all' or a command named 'all'
|
|
25
25
|
if len(self.allowed_commands) == 1:
|
|
@@ -99,7 +99,7 @@ class SendAscii(BaseModel):
|
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
class BashCommand(BaseModel):
|
|
102
|
-
|
|
102
|
+
action_json: Command | StatusCheck | SendText | SendSpecials | SendAscii
|
|
103
103
|
wait_for_seconds: Optional[float] = None
|
|
104
104
|
|
|
105
105
|
|
|
@@ -227,17 +227,6 @@ def loop(
|
|
|
227
227
|
mode="wcgw",
|
|
228
228
|
)
|
|
229
229
|
|
|
230
|
-
with open(
|
|
231
|
-
os.path.join(
|
|
232
|
-
os.path.dirname(__file__),
|
|
233
|
-
"..",
|
|
234
|
-
"wcgw",
|
|
235
|
-
"client",
|
|
236
|
-
"diff-instructions.txt",
|
|
237
|
-
)
|
|
238
|
-
) as f:
|
|
239
|
-
system += f.read()
|
|
240
|
-
|
|
241
230
|
if history:
|
|
242
231
|
if (
|
|
243
232
|
(last_msg := history[-1])["role"] == "user"
|
|
@@ -191,17 +191,6 @@ def loop(
|
|
|
191
191
|
mode="wcgw",
|
|
192
192
|
)
|
|
193
193
|
|
|
194
|
-
with open(
|
|
195
|
-
os.path.join(
|
|
196
|
-
os.path.dirname(__file__),
|
|
197
|
-
"..",
|
|
198
|
-
"wcgw",
|
|
199
|
-
"client",
|
|
200
|
-
"diff-instructions.txt",
|
|
201
|
-
)
|
|
202
|
-
) as f:
|
|
203
|
-
system += f.read()
|
|
204
|
-
|
|
205
194
|
if not history:
|
|
206
195
|
history = [{"role": "system", "content": system}]
|
|
207
196
|
else:
|
|
@@ -140,10 +140,10 @@ async def test_handle_list_tools():
|
|
|
140
140
|
assert properties["initial_files_to_read"]["type"] == "array"
|
|
141
141
|
elif tool.name == "BashCommand":
|
|
142
142
|
properties = tool.inputSchema["properties"]
|
|
143
|
-
assert "
|
|
143
|
+
assert "action_json" in properties
|
|
144
144
|
assert "wait_for_seconds" in properties
|
|
145
145
|
# Check type field has all the command types
|
|
146
|
-
type_properties = properties["
|
|
146
|
+
type_properties = properties["action_json"]["anyOf"]
|
|
147
147
|
type_refs = set(p["$ref"].split("/")[-1] for p in type_properties)
|
|
148
148
|
required_types = {
|
|
149
149
|
"Command",
|
|
@@ -180,7 +180,7 @@ async def test_handle_call_tool(setup_bash_state):
|
|
|
180
180
|
assert "Initialize" in result[0].text
|
|
181
181
|
|
|
182
182
|
# Test JSON string argument handling
|
|
183
|
-
json_args = {"
|
|
183
|
+
json_args = {"action_json": {"command": "ls"}, "wait_for_seconds": None}
|
|
184
184
|
result = await handle_call_tool("BashCommand", json_args)
|
|
185
185
|
assert isinstance(result, list)
|
|
186
186
|
|
|
@@ -200,7 +200,7 @@ async def test_handle_call_tool(setup_bash_state):
|
|
|
200
200
|
side_effect=Exception("Test error"),
|
|
201
201
|
):
|
|
202
202
|
result = await handle_call_tool(
|
|
203
|
-
"BashCommand", {"
|
|
203
|
+
"BashCommand", {"action_json": {"command": "ls"}, "wait_for_seconds": None}
|
|
204
204
|
)
|
|
205
205
|
assert "GOT EXCEPTION" in result[0].text
|
|
206
206
|
|
|
@@ -275,7 +275,7 @@ def test_bash_command(context: Context, temp_dir: str) -> None:
|
|
|
275
275
|
get_tool_output(context, init_args, default_enc, 1.0, lambda x, y: ("", 0.0), None)
|
|
276
276
|
|
|
277
277
|
# Test when nothing is running
|
|
278
|
-
cmd = BashCommand(
|
|
278
|
+
cmd = BashCommand(action_json=StatusCheck(status_check=True))
|
|
279
279
|
outputs, _ = get_tool_output(
|
|
280
280
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
281
281
|
)
|
|
@@ -283,14 +283,14 @@ def test_bash_command(context: Context, temp_dir: str) -> None:
|
|
|
283
283
|
assert "No running command to check status of" in outputs[0]
|
|
284
284
|
|
|
285
285
|
# Start a command and check status
|
|
286
|
-
cmd = BashCommand(
|
|
286
|
+
cmd = BashCommand(action_json=Command(command="sleep 1"), wait_for_seconds=0.1)
|
|
287
287
|
outputs, _ = get_tool_output(
|
|
288
288
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
289
289
|
)
|
|
290
290
|
assert "status = still running" in outputs[0]
|
|
291
291
|
|
|
292
292
|
# Check status while command is running
|
|
293
|
-
status_check = BashCommand(
|
|
293
|
+
status_check = BashCommand(action_json=StatusCheck(status_check=True))
|
|
294
294
|
outputs, _ = get_tool_output(
|
|
295
295
|
context, status_check, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
296
296
|
)
|
|
@@ -298,7 +298,7 @@ def test_bash_command(context: Context, temp_dir: str) -> None:
|
|
|
298
298
|
assert "status = process exited" in outputs[0]
|
|
299
299
|
|
|
300
300
|
# Test simple command
|
|
301
|
-
cmd = BashCommand(
|
|
301
|
+
cmd = BashCommand(action_json=Command(command="echo 'hello world'"))
|
|
302
302
|
outputs, _ = get_tool_output(
|
|
303
303
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
304
304
|
)
|
|
@@ -321,7 +321,7 @@ def test_interaction_commands(context: Context, temp_dir: str) -> None:
|
|
|
321
321
|
get_tool_output(context, init_args, default_enc, 1.0, lambda x, y: ("", 0.0), None)
|
|
322
322
|
|
|
323
323
|
# Test text interaction
|
|
324
|
-
cmd = BashCommand(
|
|
324
|
+
cmd = BashCommand(action_json=SendText(send_text="hello"))
|
|
325
325
|
outputs, _ = get_tool_output(
|
|
326
326
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
327
327
|
)
|
|
@@ -329,7 +329,7 @@ def test_interaction_commands(context: Context, temp_dir: str) -> None:
|
|
|
329
329
|
assert isinstance(outputs[0], str)
|
|
330
330
|
|
|
331
331
|
# Test special keys
|
|
332
|
-
cmd = BashCommand(
|
|
332
|
+
cmd = BashCommand(action_json=SendSpecials(send_specials=["Enter"]))
|
|
333
333
|
outputs, _ = get_tool_output(
|
|
334
334
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
335
335
|
)
|
|
@@ -338,7 +338,7 @@ def test_interaction_commands(context: Context, temp_dir: str) -> None:
|
|
|
338
338
|
assert "status = process exited" in outputs[0]
|
|
339
339
|
|
|
340
340
|
# Send ctrl-c
|
|
341
|
-
cmd = BashCommand(
|
|
341
|
+
cmd = BashCommand(action_json=SendAscii(send_ascii=[3])) # Ctrl-C
|
|
342
342
|
outputs, _ = get_tool_output(
|
|
343
343
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
344
344
|
)
|
|
@@ -347,28 +347,28 @@ def test_interaction_commands(context: Context, temp_dir: str) -> None:
|
|
|
347
347
|
assert "status = process exited" in outputs[0]
|
|
348
348
|
|
|
349
349
|
# Test interactions with long running command
|
|
350
|
-
cmd = BashCommand(
|
|
350
|
+
cmd = BashCommand(action_json=Command(command="sleep 1"), wait_for_seconds=0.1)
|
|
351
351
|
outputs, _ = get_tool_output(
|
|
352
352
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
353
353
|
)
|
|
354
354
|
assert "status = still running" in outputs[0]
|
|
355
355
|
|
|
356
356
|
# Check status with special keys
|
|
357
|
-
cmd = BashCommand(
|
|
357
|
+
cmd = BashCommand(action_json=SendSpecials(send_specials=["Enter"]))
|
|
358
358
|
outputs, _ = get_tool_output(
|
|
359
359
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
360
360
|
)
|
|
361
361
|
assert "status = process exited" in outputs[0]
|
|
362
362
|
|
|
363
363
|
# Test interrupting command
|
|
364
|
-
cmd = BashCommand(
|
|
364
|
+
cmd = BashCommand(action_json=Command(command="sleep 1"), wait_for_seconds=0.1)
|
|
365
365
|
outputs, _ = get_tool_output(
|
|
366
366
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
367
367
|
)
|
|
368
368
|
assert "status = still running" in outputs[0]
|
|
369
369
|
|
|
370
370
|
# Send Ctrl-C
|
|
371
|
-
cmd = BashCommand(
|
|
371
|
+
cmd = BashCommand(action_json=SendSpecials(send_specials=["Ctrl-c"]))
|
|
372
372
|
outputs, _ = get_tool_output(
|
|
373
373
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
374
374
|
)
|
|
@@ -553,7 +553,7 @@ def test_reinitialize(context: Context, temp_dir: str) -> None:
|
|
|
553
553
|
assert context.bash_state.file_edit_mode.allowed_globs == [temp_dir + "/" + "*.py"]
|
|
554
554
|
|
|
555
555
|
# Verify mode was actually changed by trying a command not in allowed list
|
|
556
|
-
cmd = BashCommand(
|
|
556
|
+
cmd = BashCommand(action_json=Command(command="touch test.txt"))
|
|
557
557
|
outputs, _ = get_tool_output(
|
|
558
558
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
559
559
|
)
|
|
@@ -618,7 +618,7 @@ def test_file_io(context: Context, temp_dir: str) -> None:
|
|
|
618
618
|
with open(test_file, "w") as f:
|
|
619
619
|
f.write("hello world")
|
|
620
620
|
|
|
621
|
-
cmd = BashCommand(
|
|
621
|
+
cmd = BashCommand(action_json=Command(command=f"cat {test_file}"))
|
|
622
622
|
outputs, _ = get_tool_output(
|
|
623
623
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
624
624
|
)
|
|
@@ -631,13 +631,13 @@ def test_command_interrupt(context: Context, temp_dir: str) -> None:
|
|
|
631
631
|
"""Test Ctrl-C interruption."""
|
|
632
632
|
_test_init(context, temp_dir)
|
|
633
633
|
|
|
634
|
-
cmd = BashCommand(
|
|
634
|
+
cmd = BashCommand(action_json=Command(command="sleep 5"), wait_for_seconds=0.1)
|
|
635
635
|
outputs, _ = get_tool_output(
|
|
636
636
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
637
637
|
)
|
|
638
638
|
assert "status = still running" in outputs[0]
|
|
639
639
|
|
|
640
|
-
cmd = BashCommand(
|
|
640
|
+
cmd = BashCommand(action_json=SendSpecials(send_specials=["Ctrl-c"]))
|
|
641
641
|
outputs, _ = get_tool_output(
|
|
642
642
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
643
643
|
)
|
|
@@ -648,7 +648,7 @@ def test_command_suspend(context: Context, temp_dir: str) -> None:
|
|
|
648
648
|
"""Test Ctrl-Z suspension."""
|
|
649
649
|
_test_init(context, temp_dir)
|
|
650
650
|
|
|
651
|
-
cmd = BashCommand(
|
|
651
|
+
cmd = BashCommand(action_json=Command(command="sleep 5"), wait_for_seconds=0.1)
|
|
652
652
|
outputs, _ = get_tool_output(
|
|
653
653
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
654
654
|
)
|
|
@@ -659,16 +659,16 @@ def test_text_input(context: Context, temp_dir: str) -> None:
|
|
|
659
659
|
"""Test sending text to a program."""
|
|
660
660
|
_test_init(context, temp_dir)
|
|
661
661
|
|
|
662
|
-
cmd = BashCommand(
|
|
662
|
+
cmd = BashCommand(action_json=Command(command="cat"))
|
|
663
663
|
get_tool_output(context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None)
|
|
664
664
|
|
|
665
|
-
cmd = BashCommand(
|
|
665
|
+
cmd = BashCommand(action_json=SendText(send_text="hello"))
|
|
666
666
|
outputs, _ = get_tool_output(
|
|
667
667
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
668
668
|
)
|
|
669
669
|
assert "hello" in str(outputs[0])
|
|
670
670
|
|
|
671
|
-
cmd = BashCommand(
|
|
671
|
+
cmd = BashCommand(action_json=SendSpecials(send_specials=["Ctrl-d"]))
|
|
672
672
|
outputs, _ = get_tool_output(
|
|
673
673
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
674
674
|
)
|
|
@@ -679,16 +679,16 @@ def test_ascii_input(context: Context, temp_dir: str) -> None:
|
|
|
679
679
|
"""Test sending ASCII codes."""
|
|
680
680
|
_test_init(context, temp_dir)
|
|
681
681
|
|
|
682
|
-
cmd = BashCommand(
|
|
682
|
+
cmd = BashCommand(action_json=Command(command="cat"))
|
|
683
683
|
get_tool_output(context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None)
|
|
684
684
|
|
|
685
|
-
cmd = BashCommand(
|
|
685
|
+
cmd = BashCommand(action_json=SendAscii(send_ascii=[65, 66, 67])) # ABC
|
|
686
686
|
outputs, _ = get_tool_output(
|
|
687
687
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
688
688
|
)
|
|
689
689
|
assert "ABC" in str(outputs[0])
|
|
690
690
|
|
|
691
|
-
cmd = BashCommand(
|
|
691
|
+
cmd = BashCommand(action_json=SendAscii(send_ascii=[3])) # Ctrl-C
|
|
692
692
|
outputs, _ = get_tool_output(
|
|
693
693
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
694
694
|
)
|
|
@@ -779,7 +779,7 @@ def test_error_cases(context: Context, temp_dir: str) -> None:
|
|
|
779
779
|
assert "Success" in outputs[0] # Should succeed as it creates directories
|
|
780
780
|
|
|
781
781
|
# Test invalid bash command
|
|
782
|
-
cmd = BashCommand(
|
|
782
|
+
cmd = BashCommand(action_json=Command(command="nonexistentcommand"))
|
|
783
783
|
outputs, _ = get_tool_output(
|
|
784
784
|
context, cmd, default_enc, 1.0, lambda x, y: ("", 0.0), None
|
|
785
785
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-resource/.python-version
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-tool/mcp_simple_tool/__init__.py
RENAMED
|
File without changes
|
{wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-tool/mcp_simple_tool/__main__.py
RENAMED
|
File without changes
|
{wcgw-3.0.4 → wcgw-3.0.6}/src/mcp_wcgw_fork/examples/servers/simple-tool/mcp_simple_tool/server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|