wcgw 2.6.2__tar.gz → 2.7.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.6.2 → wcgw-2.7.0}/PKG-INFO +1 -1
- {wcgw-2.6.2 → wcgw-2.7.0}/gpt_action_json_schema.json +103 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/pyproject.toml +1 -1
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/anthropic_client.py +64 -51
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/diff-instructions.txt +0 -1
- wcgw-2.7.0/src/wcgw/client/file_ops/diff_edit.py +482 -0
- wcgw-2.7.0/src/wcgw/client/file_ops/search_replace.py +119 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/mcp_server/server.py +19 -0
- wcgw-2.7.0/src/wcgw/client/memory.py +52 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/openai_client.py +42 -18
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/tools.py +76 -172
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/relay/serve.py +41 -12
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/types_.py +12 -0
- wcgw-2.7.0/tests/client/file_ops/test_diff_edit.py +222 -0
- wcgw-2.7.0/tests/client/file_ops/test_search_replace.py +178 -0
- wcgw-2.7.0/tests/client/test_tools_basic.py +29 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/test_tools_extended.py +0 -121
- wcgw-2.7.0/tests/client/test_tools_file_ops.py +155 -0
- wcgw-2.7.0/tests/client/test_tools_files.py +121 -0
- wcgw-2.7.0/tests/client/test_tools_shell.py +500 -0
- wcgw-2.7.0/tests/client/test_tools_validation.py +230 -0
- wcgw-2.7.0/tests/client/tools/__init__.py +1 -0
- wcgw-2.7.0/tests/client/tools/test_command_validation.py +125 -0
- wcgw-2.7.0/tests/client/tools/test_file_operations.py +156 -0
- wcgw-2.7.0/tests/client/tools/test_files/test1.py +4 -0
- wcgw-2.7.0/tests/client/tools/test_files/test2.py +4 -0
- wcgw-2.7.0/tests/client/tools/test_files/test_file.py +1 -0
- wcgw-2.7.0/tests/client/tools/test_knowledge_transfer.py +322 -0
- wcgw-2.7.0/tests/client/tools/test_terminal_output.py +187 -0
- wcgw-2.7.0/tests/client/tools/test_user_interaction.py +116 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/uv.lock +1 -1
- wcgw-2.6.2/tests/client/test_tools_basic.py +0 -57
- {wcgw-2.6.2 → wcgw-2.7.0}/.github/workflows/python-publish.yml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/.github/workflows/python-tests.yml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/.github/workflows/python-types.yml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/.gitignore +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/.gitmodules +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/.python-version +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/.vscode/settings.json +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/LICENSE +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/README.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/gpt_instructions.txt +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/openai.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.git +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/workflows/main-checks.yml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/workflows/publish-pypi.yml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/workflows/pull-request-checks.yml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/workflows/shared.yml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.gitignore +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.python-version +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/CODE_OF_CONDUCT.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/CONTRIBUTING.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/LICENSE +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/README.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/RELEASE.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/SECURITY.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/README.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/.python-version +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/README.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/mcp_simple_prompt/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/mcp_simple_prompt/__main__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/mcp_simple_prompt/server.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/pyproject.toml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/.python-version +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/README.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/mcp_simple_resource/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/mcp_simple_resource/__main__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/mcp_simple_resource/server.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/pyproject.toml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/.python-version +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/README.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/mcp_simple_tool/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/mcp_simple_tool/__main__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/mcp_simple_tool/server.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/pyproject.toml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/pyproject.toml +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/__main__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/session.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/sse.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/stdio.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/py.typed +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/__main__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/models.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/session.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/sse.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/stdio.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/websocket.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/context.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/exceptions.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/memory.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/progress.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/session.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/version.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/types.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/client/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/client/test_session.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/client/test_stdio.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/conftest.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/server/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/server/test_session.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/server/test_stdio.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/shared/test_memory.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/test_types.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/uv.lock +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/__main__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/cli.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/common.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/computer_use.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/mcp_server/Readme.md +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/mcp_server/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/openai_utils.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/display_tree.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/path_prob.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/paths_model.vocab +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/paths_tokens.model +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/repo_context.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/sys_utils.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/relay/static/privacy.txt +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/static/claude-ss.jpg +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/static/computer-use.jpg +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/static/example.jpg +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/static/rocket-icon.png +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/static/ss1.png +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/__init__.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/test_display_tree.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/test_display_tree_simple.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/test_path_prob.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/test_repo_context.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/test_anthropic_client_utils.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/test_openai_utils.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_anthropic_client.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_basic.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_common.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_computer_use.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_computer_use_base.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_computer_use_shell.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_sys_utils.py +0 -0
- {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_tools.py +0 -0
|
@@ -289,6 +289,46 @@
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
+
},
|
|
293
|
+
"/v1/knowledge_transfer": {
|
|
294
|
+
"post": {
|
|
295
|
+
"x-openai-isConsequential": false,
|
|
296
|
+
"summary": "Knowledge Transfer",
|
|
297
|
+
"operationId": "knowledge_transfer_v1_knowledge_transfer_post",
|
|
298
|
+
"requestBody": {
|
|
299
|
+
"content": {
|
|
300
|
+
"application/json": {
|
|
301
|
+
"schema": {
|
|
302
|
+
"$ref": "#/components/schemas/KTWithUUID"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"required": true
|
|
307
|
+
},
|
|
308
|
+
"responses": {
|
|
309
|
+
"200": {
|
|
310
|
+
"description": "Successful Response",
|
|
311
|
+
"content": {
|
|
312
|
+
"application/json": {
|
|
313
|
+
"schema": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"title": "Response Knowledge Transfer V1 Knowledge Transfer Post"
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"422": {
|
|
321
|
+
"description": "Validation Error",
|
|
322
|
+
"content": {
|
|
323
|
+
"application/json": {
|
|
324
|
+
"schema": {
|
|
325
|
+
"$ref": "#/components/schemas/HTTPValidationError"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
292
332
|
}
|
|
293
333
|
},
|
|
294
334
|
"components": {
|
|
@@ -438,6 +478,10 @@
|
|
|
438
478
|
"type": "array",
|
|
439
479
|
"title": "Initial Files To Read"
|
|
440
480
|
},
|
|
481
|
+
"task_id_to_resume": {
|
|
482
|
+
"type": "string",
|
|
483
|
+
"title": "Task Id To Resume"
|
|
484
|
+
},
|
|
441
485
|
"user_id": {
|
|
442
486
|
"type": "string",
|
|
443
487
|
"format": "uuid",
|
|
@@ -449,10 +493,69 @@
|
|
|
449
493
|
"required": [
|
|
450
494
|
"any_workspace_path",
|
|
451
495
|
"initial_files_to_read",
|
|
496
|
+
"task_id_to_resume",
|
|
452
497
|
"user_id"
|
|
453
498
|
],
|
|
454
499
|
"title": "InitializeWithUUID"
|
|
455
500
|
},
|
|
501
|
+
"KTWithUUID": {
|
|
502
|
+
"properties": {
|
|
503
|
+
"id": {
|
|
504
|
+
"type": "string",
|
|
505
|
+
"title": "Id"
|
|
506
|
+
},
|
|
507
|
+
"project_root_path": {
|
|
508
|
+
"type": "string",
|
|
509
|
+
"title": "Project Root Path"
|
|
510
|
+
},
|
|
511
|
+
"objective": {
|
|
512
|
+
"type": "string",
|
|
513
|
+
"title": "Objective"
|
|
514
|
+
},
|
|
515
|
+
"all_user_instructions": {
|
|
516
|
+
"type": "string",
|
|
517
|
+
"title": "All User Instructions"
|
|
518
|
+
},
|
|
519
|
+
"current_status_of_the_task": {
|
|
520
|
+
"type": "string",
|
|
521
|
+
"title": "Current Status Of The Task"
|
|
522
|
+
},
|
|
523
|
+
"all_issues_snippets": {
|
|
524
|
+
"type": "string",
|
|
525
|
+
"title": "All Issues Snippets"
|
|
526
|
+
},
|
|
527
|
+
"relevant_file_paths": {
|
|
528
|
+
"items": {
|
|
529
|
+
"type": "string"
|
|
530
|
+
},
|
|
531
|
+
"type": "array",
|
|
532
|
+
"title": "Relevant File Paths"
|
|
533
|
+
},
|
|
534
|
+
"build_and_development_instructions": {
|
|
535
|
+
"type": "string",
|
|
536
|
+
"title": "Build And Development Instructions"
|
|
537
|
+
},
|
|
538
|
+
"user_id": {
|
|
539
|
+
"type": "string",
|
|
540
|
+
"format": "uuid",
|
|
541
|
+
"title": "User Id"
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
"additionalProperties": false,
|
|
545
|
+
"type": "object",
|
|
546
|
+
"required": [
|
|
547
|
+
"id",
|
|
548
|
+
"project_root_path",
|
|
549
|
+
"objective",
|
|
550
|
+
"all_user_instructions",
|
|
551
|
+
"current_status_of_the_task",
|
|
552
|
+
"all_issues_snippets",
|
|
553
|
+
"relevant_file_paths",
|
|
554
|
+
"build_and_development_instructions",
|
|
555
|
+
"user_id"
|
|
556
|
+
],
|
|
557
|
+
"title": "KTWithUUID"
|
|
558
|
+
},
|
|
456
559
|
"ReadFileWithUUID": {
|
|
457
560
|
"properties": {
|
|
458
561
|
"file_paths": {
|
|
@@ -1,59 +1,51 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
import json
|
|
3
3
|
import mimetypes
|
|
4
|
-
|
|
5
|
-
import
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import tempfile
|
|
6
7
|
import traceback
|
|
7
|
-
|
|
8
|
-
import
|
|
8
|
+
import uuid
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Literal, Optional, cast
|
|
11
|
+
|
|
12
|
+
import rich
|
|
9
13
|
from anthropic import Anthropic
|
|
10
14
|
from anthropic.types import (
|
|
11
|
-
|
|
15
|
+
ImageBlockParam,
|
|
12
16
|
MessageParam,
|
|
17
|
+
TextBlockParam,
|
|
18
|
+
ToolParam,
|
|
13
19
|
ToolResultBlockParam,
|
|
14
20
|
ToolUseBlockParam,
|
|
15
|
-
ImageBlockParam,
|
|
16
|
-
TextBlockParam,
|
|
17
21
|
)
|
|
18
|
-
|
|
19
|
-
import rich
|
|
20
|
-
import petname # type: ignore[import-untyped]
|
|
22
|
+
from dotenv import load_dotenv
|
|
21
23
|
from typer import Typer
|
|
22
|
-
import uuid
|
|
23
24
|
|
|
24
25
|
from ..types_ import (
|
|
25
26
|
BashCommand,
|
|
26
27
|
BashInteraction,
|
|
27
|
-
WriteIfEmpty,
|
|
28
|
-
FileEditFindReplace,
|
|
29
28
|
FileEdit,
|
|
29
|
+
GetScreenInfo,
|
|
30
30
|
Keyboard,
|
|
31
|
+
KnowledgeTransfer,
|
|
31
32
|
Mouse,
|
|
32
33
|
ReadFiles,
|
|
33
34
|
ReadImage,
|
|
34
35
|
ResetShell,
|
|
35
36
|
ScreenShot,
|
|
36
|
-
|
|
37
|
+
WriteIfEmpty,
|
|
38
|
+
)
|
|
39
|
+
from .common import discard_input
|
|
40
|
+
from .memory import load_memory
|
|
41
|
+
from .tools import (
|
|
42
|
+
DoneFlag,
|
|
43
|
+
ImageData,
|
|
44
|
+
default_enc,
|
|
45
|
+
get_tool_output,
|
|
46
|
+
initialize,
|
|
47
|
+
which_tool_name,
|
|
37
48
|
)
|
|
38
|
-
|
|
39
|
-
from .common import Models, discard_input
|
|
40
|
-
from .common import CostData
|
|
41
|
-
from .tools import ImageData
|
|
42
|
-
from .computer_use import Computer
|
|
43
|
-
|
|
44
|
-
from .tools import DoneFlag, get_tool_output, which_tool_name, default_enc
|
|
45
|
-
|
|
46
|
-
from urllib import parse
|
|
47
|
-
import subprocess
|
|
48
|
-
import os
|
|
49
|
-
import tempfile
|
|
50
|
-
|
|
51
|
-
import toml
|
|
52
|
-
from pydantic import BaseModel
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
from dotenv import load_dotenv
|
|
56
|
-
|
|
57
49
|
|
|
58
50
|
History = list[MessageParam]
|
|
59
51
|
|
|
@@ -135,19 +127,23 @@ def loop(
|
|
|
135
127
|
|
|
136
128
|
history: History = []
|
|
137
129
|
waiting_for_assistant = False
|
|
130
|
+
memory = None
|
|
138
131
|
if resume:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
132
|
+
try:
|
|
133
|
+
memory = load_memory(resume)
|
|
134
|
+
except OSError:
|
|
135
|
+
if resume == "latest":
|
|
136
|
+
resume_path = sorted(Path(".wcgw").iterdir(), key=os.path.getmtime)[-1]
|
|
137
|
+
else:
|
|
138
|
+
resume_path = Path(resume)
|
|
139
|
+
if not resume_path.exists():
|
|
140
|
+
raise FileNotFoundError(f"File {resume} not found")
|
|
141
|
+
with resume_path.open() as f:
|
|
142
|
+
history = json.load(f)
|
|
143
|
+
if len(history) <= 2:
|
|
144
|
+
raise ValueError("Invalid history file")
|
|
145
|
+
first_message = ""
|
|
146
|
+
waiting_for_assistant = history[-1]["role"] != "assistant"
|
|
151
147
|
|
|
152
148
|
limit = 1
|
|
153
149
|
|
|
@@ -216,6 +212,25 @@ def loop(
|
|
|
216
212
|
- Use absolute file path only.
|
|
217
213
|
- Use SEARCH/REPLACE blocks to edit the file.
|
|
218
214
|
- If the edit fails due to block not matching, please retry with correct block till it matches. Re-read the file to ensure you've all the lines correct.
|
|
215
|
+
""",
|
|
216
|
+
),
|
|
217
|
+
ToolParam(
|
|
218
|
+
input_schema=KnowledgeTransfer.model_json_schema(),
|
|
219
|
+
name="KnowledgeTransfer",
|
|
220
|
+
description="""
|
|
221
|
+
Write detailed description in order to do a KT, if the user asks for it.
|
|
222
|
+
Save all information necessary for a person to understand the task and the problems.
|
|
223
|
+
|
|
224
|
+
- `all_user_instructions` should contain all instructions user shared in the conversation.
|
|
225
|
+
- `current_status_of_the_task` should contain only what is already achieved, not what's remaining.
|
|
226
|
+
- `all_issues_snippets` should only contain snippets of error, traceback, file snippets, commands, etc., no comments or solutions (important!).
|
|
227
|
+
- Be very verbose in `all_issues_snippets` providing as much error context as possible.
|
|
228
|
+
- Provide an id if the user hasn't provided one.
|
|
229
|
+
- This tool will return a text file path where the information is saved.
|
|
230
|
+
- After the tool completes succesfully, tell the user the task id and the generate file path. (important!)
|
|
231
|
+
- Leave arguments as empty string if they aren't relevant.
|
|
232
|
+
- This tool marks end of your conversation, do not run any further tools after calling this.
|
|
233
|
+
- Provide absolute file paths only in `relevant_file_paths` containing all relevant files.
|
|
219
234
|
""",
|
|
220
235
|
),
|
|
221
236
|
]
|
|
@@ -270,9 +285,10 @@ def loop(
|
|
|
270
285
|
""",
|
|
271
286
|
),
|
|
272
287
|
]
|
|
273
|
-
uname_sysname = os.uname().sysname
|
|
274
|
-
uname_machine = os.uname().machine
|
|
275
288
|
|
|
289
|
+
initial_info = initialize(
|
|
290
|
+
os.getcwd(), [], resume if (memory and resume) else "", 8000
|
|
291
|
+
)
|
|
276
292
|
system = f"""
|
|
277
293
|
You're an expert software engineer with shell and code knowledge.
|
|
278
294
|
|
|
@@ -284,10 +300,7 @@ Instructions:
|
|
|
284
300
|
- Do not provide code snippets unless asked by the user, instead directly add/edit the code.
|
|
285
301
|
- Do not install new tools/packages before ensuring no such tools/package or an alternative already exists.
|
|
286
302
|
|
|
287
|
-
|
|
288
|
-
- System: {uname_sysname}
|
|
289
|
-
- Machine: {uname_machine}
|
|
290
|
-
- Current directory: {os.getcwd()}
|
|
303
|
+
{initial_info}
|
|
291
304
|
"""
|
|
292
305
|
|
|
293
306
|
with open(os.path.join(os.path.dirname(__file__), "diff-instructions.txt")) as f:
|
|
@@ -47,7 +47,6 @@ Every *SEARCH/REPLACE block* must use this format:
|
|
|
47
47
|
|
|
48
48
|
Every "<<<<<<< SEARCH" section must *EXACTLY MATCH* the existing file content, character for character, including all comments, docstrings, whitespaces, etc.
|
|
49
49
|
|
|
50
|
-
*SEARCH/REPLACE* blocks will *only* replace the first match occurrence.
|
|
51
50
|
Including multiple unique *SEARCH/REPLACE* blocks if needed.
|
|
52
51
|
Include enough lines in each SEARCH section to uniquely match each set of lines that need to change.
|
|
53
52
|
|