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.

Files changed (148) hide show
  1. {wcgw-2.6.2 → wcgw-2.7.0}/PKG-INFO +1 -1
  2. {wcgw-2.6.2 → wcgw-2.7.0}/gpt_action_json_schema.json +103 -0
  3. {wcgw-2.6.2 → wcgw-2.7.0}/pyproject.toml +1 -1
  4. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/anthropic_client.py +64 -51
  5. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/diff-instructions.txt +0 -1
  6. wcgw-2.7.0/src/wcgw/client/file_ops/diff_edit.py +482 -0
  7. wcgw-2.7.0/src/wcgw/client/file_ops/search_replace.py +119 -0
  8. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/mcp_server/server.py +19 -0
  9. wcgw-2.7.0/src/wcgw/client/memory.py +52 -0
  10. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/openai_client.py +42 -18
  11. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/tools.py +76 -172
  12. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/relay/serve.py +41 -12
  13. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/types_.py +12 -0
  14. wcgw-2.7.0/tests/client/file_ops/test_diff_edit.py +222 -0
  15. wcgw-2.7.0/tests/client/file_ops/test_search_replace.py +178 -0
  16. wcgw-2.7.0/tests/client/test_tools_basic.py +29 -0
  17. {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/test_tools_extended.py +0 -121
  18. wcgw-2.7.0/tests/client/test_tools_file_ops.py +155 -0
  19. wcgw-2.7.0/tests/client/test_tools_files.py +121 -0
  20. wcgw-2.7.0/tests/client/test_tools_shell.py +500 -0
  21. wcgw-2.7.0/tests/client/test_tools_validation.py +230 -0
  22. wcgw-2.7.0/tests/client/tools/__init__.py +1 -0
  23. wcgw-2.7.0/tests/client/tools/test_command_validation.py +125 -0
  24. wcgw-2.7.0/tests/client/tools/test_file_operations.py +156 -0
  25. wcgw-2.7.0/tests/client/tools/test_files/test1.py +4 -0
  26. wcgw-2.7.0/tests/client/tools/test_files/test2.py +4 -0
  27. wcgw-2.7.0/tests/client/tools/test_files/test_file.py +1 -0
  28. wcgw-2.7.0/tests/client/tools/test_knowledge_transfer.py +322 -0
  29. wcgw-2.7.0/tests/client/tools/test_terminal_output.py +187 -0
  30. wcgw-2.7.0/tests/client/tools/test_user_interaction.py +116 -0
  31. {wcgw-2.6.2 → wcgw-2.7.0}/uv.lock +1 -1
  32. wcgw-2.6.2/tests/client/test_tools_basic.py +0 -57
  33. {wcgw-2.6.2 → wcgw-2.7.0}/.github/workflows/python-publish.yml +0 -0
  34. {wcgw-2.6.2 → wcgw-2.7.0}/.github/workflows/python-tests.yml +0 -0
  35. {wcgw-2.6.2 → wcgw-2.7.0}/.github/workflows/python-types.yml +0 -0
  36. {wcgw-2.6.2 → wcgw-2.7.0}/.gitignore +0 -0
  37. {wcgw-2.6.2 → wcgw-2.7.0}/.gitmodules +0 -0
  38. {wcgw-2.6.2 → wcgw-2.7.0}/.python-version +0 -0
  39. {wcgw-2.6.2 → wcgw-2.7.0}/.vscode/settings.json +0 -0
  40. {wcgw-2.6.2 → wcgw-2.7.0}/LICENSE +0 -0
  41. {wcgw-2.6.2 → wcgw-2.7.0}/README.md +0 -0
  42. {wcgw-2.6.2 → wcgw-2.7.0}/gpt_instructions.txt +0 -0
  43. {wcgw-2.6.2 → wcgw-2.7.0}/openai.md +0 -0
  44. {wcgw-2.6.2 → wcgw-2.7.0}/src/__init__.py +0 -0
  45. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.git +0 -0
  46. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  47. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  48. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/workflows/main-checks.yml +0 -0
  49. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/workflows/publish-pypi.yml +0 -0
  50. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/workflows/pull-request-checks.yml +0 -0
  51. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.github/workflows/shared.yml +0 -0
  52. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.gitignore +0 -0
  53. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/.python-version +0 -0
  54. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/CODE_OF_CONDUCT.md +0 -0
  55. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/CONTRIBUTING.md +0 -0
  56. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/LICENSE +0 -0
  57. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/README.md +0 -0
  58. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/RELEASE.md +0 -0
  59. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/SECURITY.md +0 -0
  60. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/README.md +0 -0
  61. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/.python-version +0 -0
  62. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/README.md +0 -0
  63. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/mcp_simple_prompt/__init__.py +0 -0
  64. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/mcp_simple_prompt/__main__.py +0 -0
  65. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/mcp_simple_prompt/server.py +0 -0
  66. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-prompt/pyproject.toml +0 -0
  67. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/.python-version +0 -0
  68. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/README.md +0 -0
  69. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/mcp_simple_resource/__init__.py +0 -0
  70. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/mcp_simple_resource/__main__.py +0 -0
  71. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/mcp_simple_resource/server.py +0 -0
  72. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-resource/pyproject.toml +0 -0
  73. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/.python-version +0 -0
  74. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/README.md +0 -0
  75. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/mcp_simple_tool/__init__.py +0 -0
  76. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/mcp_simple_tool/__main__.py +0 -0
  77. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/mcp_simple_tool/server.py +0 -0
  78. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/examples/servers/simple-tool/pyproject.toml +0 -0
  79. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/pyproject.toml +0 -0
  80. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/__init__.py +0 -0
  81. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/__init__.py +0 -0
  82. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/__main__.py +0 -0
  83. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/session.py +0 -0
  84. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/sse.py +0 -0
  85. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/client/stdio.py +0 -0
  86. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/py.typed +0 -0
  87. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/__init__.py +0 -0
  88. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/__main__.py +0 -0
  89. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/models.py +0 -0
  90. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/session.py +0 -0
  91. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/sse.py +0 -0
  92. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/stdio.py +0 -0
  93. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/server/websocket.py +0 -0
  94. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/__init__.py +0 -0
  95. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/context.py +0 -0
  96. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/exceptions.py +0 -0
  97. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/memory.py +0 -0
  98. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/progress.py +0 -0
  99. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/session.py +0 -0
  100. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/shared/version.py +0 -0
  101. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/src/mcp_wcgw/types.py +0 -0
  102. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/__init__.py +0 -0
  103. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/client/__init__.py +0 -0
  104. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/client/test_session.py +0 -0
  105. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/client/test_stdio.py +0 -0
  106. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/conftest.py +0 -0
  107. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/server/__init__.py +0 -0
  108. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/server/test_session.py +0 -0
  109. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/server/test_stdio.py +0 -0
  110. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/shared/test_memory.py +0 -0
  111. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/tests/test_types.py +0 -0
  112. {wcgw-2.6.2 → wcgw-2.7.0}/src/mcp_wcgw/uv.lock +0 -0
  113. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/__init__.py +0 -0
  114. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/__init__.py +0 -0
  115. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/__main__.py +0 -0
  116. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/cli.py +0 -0
  117. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/common.py +0 -0
  118. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/computer_use.py +0 -0
  119. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/mcp_server/Readme.md +0 -0
  120. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/mcp_server/__init__.py +0 -0
  121. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/openai_utils.py +0 -0
  122. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/display_tree.py +0 -0
  123. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/path_prob.py +0 -0
  124. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/paths_model.vocab +0 -0
  125. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/paths_tokens.model +0 -0
  126. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/repo_ops/repo_context.py +0 -0
  127. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/client/sys_utils.py +0 -0
  128. {wcgw-2.6.2 → wcgw-2.7.0}/src/wcgw/relay/static/privacy.txt +0 -0
  129. {wcgw-2.6.2 → wcgw-2.7.0}/static/claude-ss.jpg +0 -0
  130. {wcgw-2.6.2 → wcgw-2.7.0}/static/computer-use.jpg +0 -0
  131. {wcgw-2.6.2 → wcgw-2.7.0}/static/example.jpg +0 -0
  132. {wcgw-2.6.2 → wcgw-2.7.0}/static/rocket-icon.png +0 -0
  133. {wcgw-2.6.2 → wcgw-2.7.0}/static/ss1.png +0 -0
  134. {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/__init__.py +0 -0
  135. {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/test_display_tree.py +0 -0
  136. {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/test_display_tree_simple.py +0 -0
  137. {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/test_path_prob.py +0 -0
  138. {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/repo_ops/test_repo_context.py +0 -0
  139. {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/test_anthropic_client_utils.py +0 -0
  140. {wcgw-2.6.2 → wcgw-2.7.0}/tests/client/test_openai_utils.py +0 -0
  141. {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_anthropic_client.py +0 -0
  142. {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_basic.py +0 -0
  143. {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_common.py +0 -0
  144. {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_computer_use.py +0 -0
  145. {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_computer_use_base.py +0 -0
  146. {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_computer_use_shell.py +0 -0
  147. {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_sys_utils.py +0 -0
  148. {wcgw-2.6.2 → wcgw-2.7.0}/tests/test_tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wcgw
3
- Version: 2.6.2
3
+ Version: 2.7.0
4
4
  Summary: Shell and coding agent on claude and chatgpt
5
5
  Project-URL: Homepage, https://github.com/rusiaaman/wcgw
6
6
  Author-email: Aman Rusia <gapypi@arcfu.com>
@@ -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,7 +1,7 @@
1
1
  [project]
2
2
  authors = [{ name = "Aman Rusia", email = "gapypi@arcfu.com" }]
3
3
  name = "wcgw"
4
- version = "2.6.2"
4
+ version = "2.7.0"
5
5
  description = "Shell and coding agent on claude and chatgpt"
6
6
  readme = "README.md"
7
7
  requires-python = ">=3.11, <3.13"
@@ -1,59 +1,51 @@
1
1
  import base64
2
2
  import json
3
3
  import mimetypes
4
- from pathlib import Path
5
- import sys
4
+ import os
5
+ import subprocess
6
+ import tempfile
6
7
  import traceback
7
- from typing import Callable, DefaultDict, Optional, cast, Literal
8
- import anthropic
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
- ToolParam,
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
- GetScreenInfo,
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
- if resume == "latest":
140
- resume_path = sorted(Path(".wcgw").iterdir(), key=os.path.getmtime)[-1]
141
- else:
142
- resume_path = Path(resume)
143
- if not resume_path.exists():
144
- raise FileNotFoundError(f"File {resume} not found")
145
- with resume_path.open() as f:
146
- history = json.load(f)
147
- if len(history) <= 2:
148
- raise ValueError("Invalid history file")
149
- first_message = ""
150
- waiting_for_assistant = history[-1]["role"] != "assistant"
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
- System information:
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