wcgw 2.7.2__tar.gz → 2.8.0__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-2.7.2 → wcgw-2.8.0}/PKG-INFO +1 -1
- {wcgw-2.7.2 → wcgw-2.8.0}/gpt_action_json_schema.json +61 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/gpt_instructions.txt +4 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/pyproject.toml +1 -1
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/anthropic_client.py +8 -16
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/mcp_server/server.py +29 -51
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/memory.py +23 -4
- wcgw-2.8.0/src/wcgw/client/modes.py +242 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/openai_client.py +8 -17
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/tools.py +225 -49
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/types_.py +51 -7
- wcgw-2.8.0/tests/client/test_memory.py +162 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/test_tools_extended.py +50 -2
- wcgw-2.8.0/tests/client/test_tools_file_ops.py +132 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/test_tools_shell.py +8 -3
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/test_tools_validation.py +22 -1
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_command_validation.py +1 -1
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_user_interaction.py +26 -16
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_write_file.py +6 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/uv.lock +1 -1
- wcgw-2.7.2/tests/client/test_memory.py +0 -78
- wcgw-2.7.2/tests/client/test_tools_file_ops.py +0 -155
- {wcgw-2.7.2 → wcgw-2.8.0}/.github/workflows/python-publish.yml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/.github/workflows/python-tests.yml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/.github/workflows/python-types.yml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/.gitignore +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/.gitmodules +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/.python-version +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/.vscode/settings.json +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/LICENSE +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/README.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/openai.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/.git +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/.github/workflows/main-checks.yml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/.github/workflows/publish-pypi.yml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/.github/workflows/pull-request-checks.yml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/.github/workflows/shared.yml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/.gitignore +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/.python-version +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/CODE_OF_CONDUCT.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/CONTRIBUTING.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/LICENSE +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/README.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/RELEASE.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/SECURITY.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/README.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-prompt/.python-version +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-prompt/README.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-prompt/mcp_simple_prompt/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-prompt/mcp_simple_prompt/__main__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-prompt/mcp_simple_prompt/server.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-prompt/pyproject.toml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-resource/.python-version +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-resource/README.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-resource/mcp_simple_resource/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-resource/mcp_simple_resource/__main__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-resource/mcp_simple_resource/server.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-resource/pyproject.toml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-tool/.python-version +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-tool/README.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-tool/mcp_simple_tool/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-tool/mcp_simple_tool/__main__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-tool/mcp_simple_tool/server.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/examples/servers/simple-tool/pyproject.toml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/pyproject.toml +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/client/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/client/__main__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/client/session.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/client/sse.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/client/stdio.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/py.typed +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/server/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/server/__main__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/server/models.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/server/session.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/server/sse.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/server/stdio.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/server/websocket.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/shared/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/shared/context.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/shared/exceptions.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/shared/memory.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/shared/progress.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/shared/session.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/shared/version.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/src/mcp_wcgw/types.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/client/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/client/test_session.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/client/test_stdio.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/conftest.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/server/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/server/test_session.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/server/test_stdio.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/shared/test_memory.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/tests/test_types.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/mcp_wcgw/uv.lock +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/__main__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/cli.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/common.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/computer_use.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/diff-instructions.txt +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/file_ops/diff_edit.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/file_ops/search_replace.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/mcp_server/Readme.md +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/mcp_server/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/openai_utils.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/repo_ops/display_tree.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/repo_ops/path_prob.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/repo_ops/paths_model.vocab +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/repo_ops/paths_tokens.model +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/repo_ops/repo_context.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/client/sys_utils.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/relay/serve.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/src/wcgw/relay/static/privacy.txt +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/static/claude-ss.jpg +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/static/computer-use.jpg +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/static/example.jpg +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/static/rocket-icon.png +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/static/ss1.png +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/file_ops/test_diff_edit.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/file_ops/test_search_replace.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/repo_ops/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/repo_ops/test_display_tree.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/repo_ops/test_display_tree_simple.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/repo_ops/test_path_prob.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/repo_ops/test_repo_context.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/test_anthropic_client_utils.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/test_openai_utils.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/test_tools_basic.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/test_tools_files.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/__init__.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_docker_operations.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_error_handling.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_execute_bash.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_file_operations.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_files/test1.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_files/test2.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_files/test_file.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_is_int.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_knowledge_transfer.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_large_blocks.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_render_terminal.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/client/tools/test_terminal_output.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/conftest.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/test_anthropic_client.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/test_basic.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/test_common.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/test_computer_use.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/test_computer_use_base.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/test_computer_use_shell.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/test_sys_utils.py +0 -0
- {wcgw-2.7.2 → wcgw-2.8.0}/tests/test_tools.py +0 -0
|
@@ -408,6 +408,47 @@
|
|
|
408
408
|
],
|
|
409
409
|
"title": "BashInteractionWithUUID"
|
|
410
410
|
},
|
|
411
|
+
"CodeWriterMode": {
|
|
412
|
+
"properties": {
|
|
413
|
+
"allowed_globs": {
|
|
414
|
+
"anyOf": [
|
|
415
|
+
{
|
|
416
|
+
"type": "string",
|
|
417
|
+
"const": "all"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"items": {
|
|
421
|
+
"type": "string"
|
|
422
|
+
},
|
|
423
|
+
"type": "array"
|
|
424
|
+
}
|
|
425
|
+
],
|
|
426
|
+
"title": "Allowed Globs"
|
|
427
|
+
},
|
|
428
|
+
"allowed_commands": {
|
|
429
|
+
"anyOf": [
|
|
430
|
+
{
|
|
431
|
+
"type": "string",
|
|
432
|
+
"const": "all"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"items": {
|
|
436
|
+
"type": "string"
|
|
437
|
+
},
|
|
438
|
+
"type": "array"
|
|
439
|
+
}
|
|
440
|
+
],
|
|
441
|
+
"title": "Allowed Commands"
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
"additionalProperties": false,
|
|
445
|
+
"type": "object",
|
|
446
|
+
"required": [
|
|
447
|
+
"allowed_globs",
|
|
448
|
+
"allowed_commands"
|
|
449
|
+
],
|
|
450
|
+
"title": "CodeWriterMode"
|
|
451
|
+
},
|
|
411
452
|
"CommandWithUUID": {
|
|
412
453
|
"properties": {
|
|
413
454
|
"command": {
|
|
@@ -520,6 +561,25 @@
|
|
|
520
561
|
"type": "string",
|
|
521
562
|
"title": "Task Id To Resume"
|
|
522
563
|
},
|
|
564
|
+
"mode_name": {
|
|
565
|
+
"type": "string",
|
|
566
|
+
"enum": [
|
|
567
|
+
"wcgw",
|
|
568
|
+
"architect",
|
|
569
|
+
"code_writer"
|
|
570
|
+
],
|
|
571
|
+
"title": "Mode Name"
|
|
572
|
+
},
|
|
573
|
+
"code_writer_config": {
|
|
574
|
+
"anyOf": [
|
|
575
|
+
{
|
|
576
|
+
"$ref": "#/components/schemas/CodeWriterMode"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"type": "null"
|
|
580
|
+
}
|
|
581
|
+
]
|
|
582
|
+
},
|
|
523
583
|
"user_id": {
|
|
524
584
|
"type": "string",
|
|
525
585
|
"format": "uuid",
|
|
@@ -532,6 +592,7 @@
|
|
|
532
592
|
"any_workspace_path",
|
|
533
593
|
"initial_files_to_read",
|
|
534
594
|
"task_id_to_resume",
|
|
595
|
+
"mode_name",
|
|
535
596
|
"user_id"
|
|
536
597
|
],
|
|
537
598
|
"title": "InitializeWithUUID"
|
|
@@ -15,6 +15,10 @@ Instructions for `Initialize`:
|
|
|
15
15
|
- If the user has mentioned a folder or file with unclear project root, use the file or folder as `any_workspace_path`.
|
|
16
16
|
- If user has mentioned any files use `initial_files_to_read` to read, use absolute paths only.
|
|
17
17
|
- If `any_workspace_path` is provided, a tree structure of the workspace will be shown.
|
|
18
|
+
- Leave `any_workspace_path` as empty if no file or folder is mentioned.
|
|
19
|
+
- By default use mode `wcgw`
|
|
20
|
+
- In code-writer mode, set the commands and globs which user asked to set, otherwise use 'all'.
|
|
21
|
+
- In order to change the mode later, call this tool again but be sure to not provide any other argument like task_id_to_resume unnecessarily.
|
|
18
22
|
|
|
19
23
|
Instructions for `BashCommand`:
|
|
20
24
|
- Execute a bash command. This is stateful (beware with subsequent calls).
|
|
@@ -130,7 +130,7 @@ def loop(
|
|
|
130
130
|
memory = None
|
|
131
131
|
if resume:
|
|
132
132
|
try:
|
|
133
|
-
_, memory = load_memory(
|
|
133
|
+
_, memory, _ = load_memory(
|
|
134
134
|
resume,
|
|
135
135
|
8000,
|
|
136
136
|
lambda x: default_enc.encode(x).ids,
|
|
@@ -166,6 +166,7 @@ def loop(
|
|
|
166
166
|
- The control will return to you in 5 seconds regardless of the status. For heavy commands, keep checking status using BashInteraction till they are finished.
|
|
167
167
|
- Run long running commands in background using screen instead of "&".
|
|
168
168
|
- Use longer wait_for_seconds if the command is expected to run for a long time.
|
|
169
|
+
- Do not use 'cat' to read files, use ReadFiles tool instead.
|
|
169
170
|
""",
|
|
170
171
|
),
|
|
171
172
|
ToolParam(
|
|
@@ -281,22 +282,13 @@ Saves provided description and file contents of all the relevant file paths or g
|
|
|
281
282
|
),
|
|
282
283
|
]
|
|
283
284
|
|
|
284
|
-
|
|
285
|
-
os.getcwd(),
|
|
285
|
+
system = initialize(
|
|
286
|
+
os.getcwd(),
|
|
287
|
+
[],
|
|
288
|
+
resume if (memory and resume) else "",
|
|
289
|
+
max_tokens=8000,
|
|
290
|
+
mode="wcgw",
|
|
286
291
|
)
|
|
287
|
-
system = f"""
|
|
288
|
-
You're an expert software engineer with shell and code knowledge.
|
|
289
|
-
|
|
290
|
-
Instructions:
|
|
291
|
-
|
|
292
|
-
- You should use the provided bash execution, reading and writing file tools to complete objective.
|
|
293
|
-
- First understand about the project by getting the folder structure (ignoring .git, node_modules, venv, etc.)
|
|
294
|
-
- Always read relevant files before editing.
|
|
295
|
-
- Do not provide code snippets unless asked by the user, instead directly add/edit the code.
|
|
296
|
-
- Do not install new tools/packages before ensuring no such tools/package or an alternative already exists.
|
|
297
|
-
|
|
298
|
-
{initial_info}
|
|
299
|
-
"""
|
|
300
292
|
|
|
301
293
|
with open(os.path.join(os.path.dirname(__file__), "diff-instructions.txt")) as f:
|
|
302
294
|
system += f.read()
|
|
@@ -28,6 +28,7 @@ from ...types_ import (
|
|
|
28
28
|
)
|
|
29
29
|
from .. import tools
|
|
30
30
|
from ..computer_use import SLEEP_TIME_MAX_S
|
|
31
|
+
from ..modes import get_kt_prompt
|
|
31
32
|
from ..tools import DoneFlag, default_enc, get_tool_output, which_tool_name
|
|
32
33
|
|
|
33
34
|
COMPUTER_USE_ON_DOCKER_ENABLED = False
|
|
@@ -45,48 +46,35 @@ async def handle_read_resource(uri: AnyUrl) -> str:
|
|
|
45
46
|
raise ValueError("No resources available")
|
|
46
47
|
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return [
|
|
49
|
+
PROMPTS = {
|
|
50
|
+
"KnowledgeTransfer": (
|
|
51
51
|
types.Prompt(
|
|
52
52
|
name="KnowledgeTransfer",
|
|
53
53
|
description="Prompt for invoking ContextSave tool in order to do a comprehensive knowledge transfer of a coding task. Prompts to save detailed error log and instructions.",
|
|
54
|
-
)
|
|
55
|
-
|
|
54
|
+
),
|
|
55
|
+
get_kt_prompt,
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@server.list_prompts() # type: ignore
|
|
61
|
+
async def handle_list_prompts() -> list[types.Prompt]:
|
|
62
|
+
return [x[0] for x in PROMPTS.values()]
|
|
56
63
|
|
|
57
64
|
|
|
58
65
|
@server.get_prompt() # type: ignore
|
|
59
66
|
async def handle_get_prompt(
|
|
60
67
|
name: str, arguments: dict[str, str] | None
|
|
61
68
|
) -> types.GetPromptResult:
|
|
62
|
-
messages = [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
types.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Save all information necessary for a person to understand the task and the problems.
|
|
72
|
-
|
|
73
|
-
Format the `description` field using Markdown with the following sections.
|
|
74
|
-
- "# Objective" section containing project and task objective.
|
|
75
|
-
- "# All user instructions" section should be provided containing all instructions user shared in the conversation.
|
|
76
|
-
- "# Current status of the task" should be provided containing only what is already achieved, not what's remaining.
|
|
77
|
-
- "# All issues with snippets" section containing snippets of error, traceback, file snippets, commands, etc. But no comments or solutions.
|
|
78
|
-
- Be very verbose in the all issues with snippets section providing as much error context as possible.
|
|
79
|
-
- "# Build and development instructions" section containing instructions to build or run project or run tests, or envrionment related information. Only include what's known. Leave empty if unknown.
|
|
80
|
-
- After the tool completes succesfully, tell me the task id and the file path the tool generated (important!)
|
|
81
|
-
- This tool marks end of your conversation, do not run any further tools after calling this.
|
|
82
|
-
|
|
83
|
-
Provide all relevant file paths in order to understand and solve the the task. Err towards providing more file paths than fewer.
|
|
84
|
-
|
|
85
|
-
(Note to self: this conversation can then be resumed later asking "Resume `<generated id>`" which should call Initialize tool)
|
|
86
|
-
""",
|
|
87
|
-
),
|
|
88
|
-
)
|
|
89
|
-
]
|
|
69
|
+
messages = [
|
|
70
|
+
types.PromptMessage(
|
|
71
|
+
role="user",
|
|
72
|
+
content=types.TextContent(
|
|
73
|
+
type="text",
|
|
74
|
+
text=PROMPTS[name][1](),
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
]
|
|
90
78
|
return types.GetPromptResult(messages=messages)
|
|
91
79
|
|
|
92
80
|
|
|
@@ -117,6 +105,9 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
|
117
105
|
- If user has mentioned any files use `initial_files_to_read` to read, use absolute paths only.
|
|
118
106
|
- If `any_workspace_path` is provided, a tree structure of the workspace will be shown.
|
|
119
107
|
- Leave `any_workspace_path` as empty if no file or folder is mentioned.
|
|
108
|
+
- By default use mode "wcgw"
|
|
109
|
+
- In "code-writer" mode, set the commands and globs which user asked to set, otherwise use 'all'.
|
|
110
|
+
- In order to change the mode later, call this tool again but be sure to not provide any other argument like task_id_to_resume unnecessarily.
|
|
120
111
|
""",
|
|
121
112
|
),
|
|
122
113
|
ToolParam(
|
|
@@ -263,6 +254,8 @@ async def handle_call_tool(
|
|
|
263
254
|
except ValidationError:
|
|
264
255
|
|
|
265
256
|
def try_json(x: str) -> Any:
|
|
257
|
+
if not isinstance(x, str):
|
|
258
|
+
return x
|
|
266
259
|
try:
|
|
267
260
|
return json.loads(x)
|
|
268
261
|
except json.JSONDecodeError:
|
|
@@ -284,24 +277,9 @@ async def handle_call_tool(
|
|
|
284
277
|
if isinstance(output_or_done, str):
|
|
285
278
|
if issubclass(tool_type, Initialize):
|
|
286
279
|
output_or_done += """
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
Instructions:
|
|
291
|
-
|
|
292
|
-
- You should use the provided bash execution, reading and writing file tools to complete objective.
|
|
293
|
-
- First understand about the project by getting the folder structure (ignoring .git, node_modules, venv, etc.)
|
|
294
|
-
- Always read relevant files before editing.
|
|
295
|
-
- Do not provide code snippets unless asked by the user, instead directly add/edit the code.
|
|
296
|
-
- Do not install new tools/packages before ensuring no such tools/package or an alternative already exists.
|
|
297
|
-
- Do not use artifacts if you have access to the repository and not asked by the user to provide artifacts/snippets. Directly create/update using shell tools.
|
|
298
|
-
- Do not use Ctrl-c or Ctrl-z or interrupt commands without asking the user, because often the program don't show any update but they still are running.
|
|
299
|
-
- Do not use echo to write multi-line files, always use FileEdit tool to update a code.
|
|
300
|
-
|
|
301
|
-
Additional instructions:
|
|
302
|
-
Always run `pwd` if you get any file or directory not found error to make sure you're not lost, or to get absolute cwd.
|
|
303
|
-
|
|
304
|
-
Always write production ready, syntactically correct code.
|
|
280
|
+
- Additional important note: as soon as you encounter "The user has chosen to disallow the tool call.", immediately stop doing everything and ask user for the reason.
|
|
281
|
+
|
|
282
|
+
Initialize call done.
|
|
305
283
|
"""
|
|
306
284
|
|
|
307
285
|
content.append(types.TextContent(type="text", text=output_or_done))
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import os
|
|
2
3
|
import re
|
|
3
4
|
import shlex
|
|
4
|
-
from typing import Callable, Optional
|
|
5
|
+
from typing import Any, Callable, Optional
|
|
5
6
|
|
|
6
7
|
from ..types_ import ContextSave
|
|
7
8
|
|
|
@@ -30,7 +31,11 @@ def format_memory(task_memory: ContextSave, relevant_files: str) -> str:
|
|
|
30
31
|
return memory_data
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
def save_memory(
|
|
34
|
+
def save_memory(
|
|
35
|
+
task_memory: ContextSave,
|
|
36
|
+
relevant_files: str,
|
|
37
|
+
bash_state_dict: Optional[dict[str, Any]] = None,
|
|
38
|
+
) -> str:
|
|
34
39
|
app_dir = get_app_dir_xdg()
|
|
35
40
|
memory_dir = os.path.join(app_dir, "memory")
|
|
36
41
|
os.makedirs(memory_dir, exist_ok=True)
|
|
@@ -45,6 +50,12 @@ def save_memory(task_memory: ContextSave, relevant_files: str) -> str:
|
|
|
45
50
|
with open(memory_file_full, "w") as f:
|
|
46
51
|
f.write(memory_data)
|
|
47
52
|
|
|
53
|
+
# Save bash state if provided
|
|
54
|
+
if bash_state_dict is not None:
|
|
55
|
+
state_file = os.path.join(memory_dir, f"{task_id}_bash_state.json")
|
|
56
|
+
with open(state_file, "w") as f:
|
|
57
|
+
json.dump(bash_state_dict, f, indent=2)
|
|
58
|
+
|
|
48
59
|
return memory_file_full
|
|
49
60
|
|
|
50
61
|
|
|
@@ -53,7 +64,7 @@ def load_memory[T](
|
|
|
53
64
|
max_tokens: Optional[int],
|
|
54
65
|
encoder: Callable[[str], list[T]],
|
|
55
66
|
decoder: Callable[[list[T]], str],
|
|
56
|
-
) -> tuple[str, str]:
|
|
67
|
+
) -> tuple[str, str, Optional[dict[str, Any]]]:
|
|
57
68
|
app_dir = get_app_dir_xdg()
|
|
58
69
|
memory_dir = os.path.join(app_dir, "memory")
|
|
59
70
|
memory_file = os.path.join(memory_dir, f"{task_id}.txt")
|
|
@@ -75,4 +86,12 @@ def load_memory[T](
|
|
|
75
86
|
parsed_ = shlex.split(matched_path)
|
|
76
87
|
if parsed_ and len(parsed_) == 1:
|
|
77
88
|
project_root_path = parsed_[0]
|
|
78
|
-
|
|
89
|
+
|
|
90
|
+
# Try to load bash state if exists
|
|
91
|
+
state_file = os.path.join(memory_dir, f"{task_id}_bash_state.json")
|
|
92
|
+
bash_state: Optional[dict[str, Any]] = None
|
|
93
|
+
if os.path.exists(state_file):
|
|
94
|
+
with open(state_file) as f:
|
|
95
|
+
bash_state = json.load(f)
|
|
96
|
+
|
|
97
|
+
return project_root_path, data, bash_state
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Any, Literal, NamedTuple
|
|
3
|
+
|
|
4
|
+
from ..types_ import Modes, ModesConfig
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class BashCommandMode(NamedTuple):
|
|
8
|
+
bash_mode: Literal["normal_mode", "restricted_mode"]
|
|
9
|
+
allowed_commands: Literal["all", "none"]
|
|
10
|
+
|
|
11
|
+
def serialize(self) -> dict[str, Any]:
|
|
12
|
+
return {"bash_mode": self.bash_mode, "allowed_commands": self.allowed_commands}
|
|
13
|
+
|
|
14
|
+
@classmethod
|
|
15
|
+
def deserialize(cls, data: dict[str, Any]) -> "BashCommandMode":
|
|
16
|
+
return cls(data["bash_mode"], data["allowed_commands"])
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class FileEditMode(NamedTuple):
|
|
20
|
+
allowed_globs: Literal["all"] | list[str]
|
|
21
|
+
|
|
22
|
+
def serialize(self) -> dict[str, Any]:
|
|
23
|
+
return {"allowed_globs": self.allowed_globs}
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def deserialize(cls, data: dict[str, Any]) -> "FileEditMode":
|
|
27
|
+
return cls(data["allowed_globs"])
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class WriteIfEmptyMode(NamedTuple):
|
|
31
|
+
allowed_globs: Literal["all"] | list[str]
|
|
32
|
+
|
|
33
|
+
def serialize(self) -> dict[str, Any]:
|
|
34
|
+
return {"allowed_globs": self.allowed_globs}
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def deserialize(cls, data: dict[str, Any]) -> "WriteIfEmptyMode":
|
|
38
|
+
return cls(data["allowed_globs"])
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass
|
|
42
|
+
class ModeImpl:
|
|
43
|
+
bash_command_mode: BashCommandMode
|
|
44
|
+
file_edit_mode: FileEditMode
|
|
45
|
+
write_if_empty_mode: WriteIfEmptyMode
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def code_writer_prompt(
|
|
49
|
+
allowed_file_edit_globs: Literal["all"] | list[str],
|
|
50
|
+
all_write_new_globs: Literal["all"] | list[str],
|
|
51
|
+
allowed_commands: Literal["all"] | list[str],
|
|
52
|
+
) -> str:
|
|
53
|
+
base = """
|
|
54
|
+
You have to run in "code_writer" mode.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
path_prompt = """
|
|
58
|
+
- You are allowed to run FileEdit in the provided repository only.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
if allowed_file_edit_globs != "all":
|
|
62
|
+
if allowed_file_edit_globs:
|
|
63
|
+
path_prompt = f"""
|
|
64
|
+
- You are allowed to run FileEdit for files matching only the following globs: {', '.join(allowed_file_edit_globs)}
|
|
65
|
+
"""
|
|
66
|
+
else:
|
|
67
|
+
path_prompt = """
|
|
68
|
+
- You are not allowed to run FileEdit.
|
|
69
|
+
"""
|
|
70
|
+
base += path_prompt
|
|
71
|
+
|
|
72
|
+
path_prompt = """
|
|
73
|
+
- You are allowed to run WriteIfEmpty in the provided repository only.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
if all_write_new_globs != "all":
|
|
77
|
+
if all_write_new_globs:
|
|
78
|
+
path_prompt = f"""
|
|
79
|
+
- You are allowed to run WriteIfEmpty files matching only the following globs: {', '.join(allowed_file_edit_globs)}
|
|
80
|
+
"""
|
|
81
|
+
else:
|
|
82
|
+
path_prompt = """
|
|
83
|
+
- You are not allowed to run WriteIfEmpty.
|
|
84
|
+
"""
|
|
85
|
+
base += path_prompt
|
|
86
|
+
|
|
87
|
+
run_command_common = """
|
|
88
|
+
- Do not use Ctrl-c or Ctrl-z or interrupt commands without asking the user, because often the programs don't show any update but they still are running.
|
|
89
|
+
- Do not use echo to write multi-line files, always use FileEdit tool to update a code.
|
|
90
|
+
- Do not provide code snippets unless asked by the user, instead directly add/edit the code.
|
|
91
|
+
- You should use the provided bash execution, reading and writing file tools to complete objective.
|
|
92
|
+
- First understand about the project by getting the folder structure (ignoring .git, node_modules, venv, etc.)
|
|
93
|
+
- Do not use artifacts if you have access to the repository and not asked by the user to provide artifacts/snippets. Directly create/update using wcgw tools.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
command_prompt = f"""
|
|
97
|
+
- You are only allowed to run commands for project setup, code writing, editing, updating, testing, running and debugging related to the project.
|
|
98
|
+
- Do not run anything that adds or removes packages, changes system configuration or environment.
|
|
99
|
+
{run_command_common}
|
|
100
|
+
"""
|
|
101
|
+
if allowed_commands != "all":
|
|
102
|
+
if allowed_commands:
|
|
103
|
+
command_prompt = f"""
|
|
104
|
+
- You are only allowed to run the following commands: {', '.join(allowed_commands)}
|
|
105
|
+
{run_command_common}
|
|
106
|
+
"""
|
|
107
|
+
else:
|
|
108
|
+
command_prompt = """
|
|
109
|
+
- You are not allowed to run any commands.
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
base += command_prompt
|
|
113
|
+
return base
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
WCGW_PROMPT = """
|
|
117
|
+
---
|
|
118
|
+
You're an expert software engineer with shell and code knowledge.
|
|
119
|
+
|
|
120
|
+
Instructions:
|
|
121
|
+
|
|
122
|
+
- You should use the provided bash execution, reading and writing file tools to complete objective.
|
|
123
|
+
- First understand about the project by getting the folder structure (ignoring .git, node_modules, venv, etc.)
|
|
124
|
+
- Do not provide code snippets unless asked by the user, instead directly add/edit the code.
|
|
125
|
+
- Do not install new tools/packages before ensuring no such tools/package or an alternative already exists.
|
|
126
|
+
- Do not use artifacts if you have access to the repository and not asked by the user to provide artifacts/snippets. Directly create/update using wcgw tools
|
|
127
|
+
- Do not use Ctrl-c or Ctrl-z or interrupt commands without asking the user, because often the programs don't show any update but they still are running.
|
|
128
|
+
- Do not use echo to write multi-line files, always use FileEdit tool to update a code.
|
|
129
|
+
|
|
130
|
+
Additional instructions:
|
|
131
|
+
Always run `pwd` if you get any file or directory not found error to make sure you're not lost, or to get absolute cwd.
|
|
132
|
+
|
|
133
|
+
Always write production ready, syntactically correct code.
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
"""
|
|
137
|
+
ARCHITECT_PROMPT = """You have to run in "architect" mode. This means
|
|
138
|
+
- You are not allowed to edit or update any file. You are not allowed to create any file.
|
|
139
|
+
- You are not allowed to run any commands that may change disk, system configuration, packages or environment. Only read-only commands are allowed.
|
|
140
|
+
- Only run commands that allows you to explore the repository, understand the system or read anything of relevance.
|
|
141
|
+
- Do not use Ctrl-c or Ctrl-z or interrupt commands without asking the user, because often the programs don't show any update but they still are running.
|
|
142
|
+
- You are not allowed to change directory (bash will run in -r mode)
|
|
143
|
+
|
|
144
|
+
Your response should be in self-critique and brainstorm style.
|
|
145
|
+
- Read as many relevant files as possible.
|
|
146
|
+
- Be comprehensive in your understanding and search of relevant files.
|
|
147
|
+
- First understand about the project by getting the folder structure (ignoring .git, node_modules, venv, etc.)
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
DEFAULT_MODES: dict[Modes, ModeImpl] = {
|
|
152
|
+
Modes.wcgw: ModeImpl(
|
|
153
|
+
bash_command_mode=BashCommandMode("normal_mode", "all"),
|
|
154
|
+
write_if_empty_mode=WriteIfEmptyMode("all"),
|
|
155
|
+
file_edit_mode=FileEditMode("all"),
|
|
156
|
+
),
|
|
157
|
+
Modes.architect: ModeImpl(
|
|
158
|
+
bash_command_mode=BashCommandMode("restricted_mode", "all"),
|
|
159
|
+
write_if_empty_mode=WriteIfEmptyMode([]),
|
|
160
|
+
file_edit_mode=FileEditMode([]),
|
|
161
|
+
),
|
|
162
|
+
Modes.code_writer: ModeImpl(
|
|
163
|
+
bash_command_mode=BashCommandMode("normal_mode", "all"),
|
|
164
|
+
write_if_empty_mode=WriteIfEmptyMode("all"),
|
|
165
|
+
file_edit_mode=FileEditMode("all"),
|
|
166
|
+
),
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def modes_to_state(
|
|
171
|
+
mode: ModesConfig,
|
|
172
|
+
) -> tuple[BashCommandMode, FileEditMode, WriteIfEmptyMode, Modes]:
|
|
173
|
+
# First get default mode config
|
|
174
|
+
if isinstance(mode, str):
|
|
175
|
+
mode_impl = DEFAULT_MODES[Modes[mode]] # converts str to Modes enum
|
|
176
|
+
mode_name = Modes[mode]
|
|
177
|
+
else:
|
|
178
|
+
# For CodeWriterMode, use code_writer as base and override
|
|
179
|
+
mode_impl = DEFAULT_MODES[Modes.code_writer]
|
|
180
|
+
# Override with custom settings from CodeWriterMode
|
|
181
|
+
mode_impl = ModeImpl(
|
|
182
|
+
bash_command_mode=BashCommandMode(
|
|
183
|
+
mode_impl.bash_command_mode.bash_mode,
|
|
184
|
+
"all" if mode.allowed_commands else "none",
|
|
185
|
+
),
|
|
186
|
+
file_edit_mode=FileEditMode(mode.allowed_globs),
|
|
187
|
+
write_if_empty_mode=WriteIfEmptyMode(mode.allowed_globs),
|
|
188
|
+
)
|
|
189
|
+
mode_name = Modes.code_writer
|
|
190
|
+
return (
|
|
191
|
+
mode_impl.bash_command_mode,
|
|
192
|
+
mode_impl.file_edit_mode,
|
|
193
|
+
mode_impl.write_if_empty_mode,
|
|
194
|
+
mode_name,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
WCGW_KT = """Use `ContextSave` tool to do a knowledge transfer of the task in hand.
|
|
199
|
+
Write detailed description in order to do a KT.
|
|
200
|
+
Save all information necessary for a person to understand the task and the problems.
|
|
201
|
+
|
|
202
|
+
Format the `description` field using Markdown with the following sections.
|
|
203
|
+
- "# Objective" section containing project and task objective.
|
|
204
|
+
- "# All user instructions" section should be provided containing all instructions user shared in the conversation.
|
|
205
|
+
- "# Current status of the task" should be provided containing only what is already achieved, not what's remaining.
|
|
206
|
+
- "# All issues with snippets" section containing snippets of error, traceback, file snippets, commands, etc. But no comments or solutions.
|
|
207
|
+
- Be very verbose in the all issues with snippets section providing as much error context as possible.
|
|
208
|
+
- "# Build and development instructions" section containing instructions to build or run project or run tests, or envrionment related information. Only include what's known. Leave empty if unknown.
|
|
209
|
+
- Any other relevant sections following the above.
|
|
210
|
+
- After the tool completes succesfully, tell me the task id and the file path the tool generated (important!)
|
|
211
|
+
- This tool marks end of your conversation, do not run any further tools after calling this.
|
|
212
|
+
|
|
213
|
+
Provide all relevant file paths in order to understand and solve the the task. Err towards providing more file paths than fewer.
|
|
214
|
+
|
|
215
|
+
(Note to self: this conversation can then be resumed later asking "Resume wcgw task `<generated id>`" which should call Initialize tool)
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
ARCHITECT_KT = """Use `ContextSave` tool to do a knowledge transfer of the task in hand.
|
|
220
|
+
Write detailed description in order to do a KT.
|
|
221
|
+
Save all information necessary for a person to understand the task and the problems.
|
|
222
|
+
|
|
223
|
+
Format the `description` field using Markdown with the following sections.
|
|
224
|
+
- "# Objective" section containing project and task objective.
|
|
225
|
+
- "# All user instructions" section should be provided containing all instructions user shared in the conversation.
|
|
226
|
+
- "# Designed plan" should be provided containing the designed plan as discussed.
|
|
227
|
+
- Any other relevant sections following the above.
|
|
228
|
+
- After the tool completes succesfully, tell me the task id and the file path the tool generated (important!)
|
|
229
|
+
- This tool marks end of your conversation, do not run any further tools after calling this.
|
|
230
|
+
|
|
231
|
+
Provide all relevant file paths in order to understand and solve the the task. Err towards providing more file paths than fewer.
|
|
232
|
+
|
|
233
|
+
(Note to self: this conversation can then be resumed later asking "Resume wcgw task `<generated id>`" which should call Initialize tool)
|
|
234
|
+
"""
|
|
235
|
+
|
|
236
|
+
KTS = {Modes.wcgw: WCGW_KT, Modes.architect: ARCHITECT_KT, Modes.code_writer: WCGW_KT}
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def get_kt_prompt() -> str:
|
|
240
|
+
from .tools import BASH_STATE
|
|
241
|
+
|
|
242
|
+
return KTS[BASH_STATE.mode]
|
|
@@ -125,7 +125,7 @@ def loop(
|
|
|
125
125
|
memory = None
|
|
126
126
|
if resume:
|
|
127
127
|
try:
|
|
128
|
-
_, memory = load_memory(
|
|
128
|
+
_, memory, _ = load_memory(
|
|
129
129
|
resume,
|
|
130
130
|
8000,
|
|
131
131
|
lambda x: default_enc.encode(x).ids,
|
|
@@ -176,6 +176,7 @@ def loop(
|
|
|
176
176
|
- Always run `pwd` if you get any file or directory not found error to make sure you're not lost.
|
|
177
177
|
- The control will return to you in 5 seconds regardless of the status. For heavy commands, keep checking status using BashInteraction till they are finished.
|
|
178
178
|
- Run long running commands in background using screen instead of "&".
|
|
179
|
+
- Do not use 'cat' to read files, use ReadFiles tool instead.
|
|
179
180
|
""",
|
|
180
181
|
),
|
|
181
182
|
openai.pydantic_function_tool(
|
|
@@ -226,23 +227,13 @@ Saves provided description and file contents of all the relevant file paths or g
|
|
|
226
227
|
),
|
|
227
228
|
]
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
os.getcwd(),
|
|
230
|
+
system = initialize(
|
|
231
|
+
os.getcwd(),
|
|
232
|
+
[],
|
|
233
|
+
resume if (memory and resume) else "",
|
|
234
|
+
max_tokens=8000,
|
|
235
|
+
mode="wcgw",
|
|
231
236
|
)
|
|
232
|
-
system = f"""
|
|
233
|
-
You're an expert software engineer with shell and code knowledge.
|
|
234
|
-
|
|
235
|
-
Instructions:
|
|
236
|
-
|
|
237
|
-
- You should use the provided bash execution, reading and writing file tools to complete objective.
|
|
238
|
-
- First understand about the project by getting the folder structure (ignoring .git, node_modules, venv, etc.)
|
|
239
|
-
- Always read relevant files before editing.
|
|
240
|
-
- Do not provide code snippets unless asked by the user, instead directly add/edit the code.
|
|
241
|
-
- Do not install new tools/packages before ensuring no such tools/package or an alternative already exists.
|
|
242
|
-
|
|
243
|
-
{initial_info}
|
|
244
|
-
|
|
245
|
-
"""
|
|
246
237
|
|
|
247
238
|
with open(os.path.join(os.path.dirname(__file__), "diff-instructions.txt")) as f:
|
|
248
239
|
system += f.read()
|