txcode-sdk 0.6.0__tar.gz → 0.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.
Files changed (174) hide show
  1. {txcode_sdk-0.6.0/src/txcode_sdk.egg-info → txcode_sdk-0.7.0}/PKG-INFO +1 -1
  2. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/pyproject.toml +1 -1
  3. txcode_sdk-0.6.0/src/txcode_sdk/provider/openai_provider.py → txcode_sdk-0.7.0/src/txcode_sdk/provider/base.py +159 -225
  4. txcode_sdk-0.7.0/src/txcode_sdk/provider/deepseek_provider.py +121 -0
  5. txcode_sdk-0.7.0/src/txcode_sdk/provider/openai_provider.py +94 -0
  6. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0/src/txcode_sdk.egg-info}/PKG-INFO +1 -1
  7. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk.egg-info/SOURCES.txt +1 -0
  8. txcode_sdk-0.7.0/tests/test_deepseek_provider.py +161 -0
  9. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_provider_model.py +4 -6
  10. txcode_sdk-0.6.0/src/txcode_sdk/provider/base.py +0 -38
  11. txcode_sdk-0.6.0/src/txcode_sdk/provider/deepseek_provider.py +0 -13
  12. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/LICENSE +0 -0
  13. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/README.md +0 -0
  14. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/setup.cfg +0 -0
  15. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/setup.py +0 -0
  16. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/example/__init__.py +0 -0
  17. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/example/code_example.py +0 -0
  18. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/example/code_session.py +0 -0
  19. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/example/code_tool.py +0 -0
  20. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/example/constants.py +0 -0
  21. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/example/query_session.py +0 -0
  22. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/example/ws_server.py +0 -0
  23. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/__init__.py +0 -0
  24. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/_compat/__init__.py +0 -0
  25. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/_compat/dataclasses.py +0 -0
  26. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/_compat/resources.py +0 -0
  27. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/__init__.py +0 -0
  28. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/base_agent.py +0 -0
  29. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/chat/__init__.py +0 -0
  30. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/chat/agent_tool.py +0 -0
  31. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/chat/chat_agent.py +0 -0
  32. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/chat/prompts/__init__.py +0 -0
  33. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/chat/prompts/role.txt +0 -0
  34. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/code/__init__.py +0 -0
  35. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/code/agent_tool.py +0 -0
  36. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/code/code_agent.py +0 -0
  37. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/code/prompts/__init__.py +0 -0
  38. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/code/prompts/role.txt +0 -0
  39. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/common/__init__.py +0 -0
  40. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/common/common_agent.py +0 -0
  41. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/common/prompt/__init__.py +0 -0
  42. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/common/prompt/role.txt +0 -0
  43. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/design/__init__.py +0 -0
  44. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/design/agent_tool.py +0 -0
  45. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/design/design_agent.py +0 -0
  46. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/design/prompts/__init__.py +0 -0
  47. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/design/prompts/role.txt +0 -0
  48. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/discuss/__init__.py +0 -0
  49. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/discuss/agent_tool.py +0 -0
  50. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/discuss/discuss_agent.py +0 -0
  51. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/discuss/prompts/__init__.py +0 -0
  52. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/discuss/prompts/role.txt +0 -0
  53. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/dream/__init__.py +0 -0
  54. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/dream/agent_tool.py +0 -0
  55. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/dream/dream_agent.py +0 -0
  56. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/dream/prompts/__init__.py +0 -0
  57. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/dream/prompts/role.txt +0 -0
  58. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/mem/__init__.py +0 -0
  59. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/mem/agent_tool.py +0 -0
  60. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/mem/mem_agent.py +0 -0
  61. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/mem/prompts/__init__.py +0 -0
  62. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/mem/prompts/role.txt +0 -0
  63. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/name/__init__.py +0 -0
  64. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/name/name_agent.py +0 -0
  65. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/name/prompts/__init__.py +0 -0
  66. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/name/prompts/role.txt +0 -0
  67. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/plan/__init__.py +0 -0
  68. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/plan/agent_tool.py +0 -0
  69. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/plan/plan_agent.py +0 -0
  70. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/plan/prompts/__init__.py +0 -0
  71. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/plan/prompts/role.txt +0 -0
  72. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/shell/__init__.py +0 -0
  73. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/shell/agent_tool.py +0 -0
  74. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/shell/prompts/__init__.py +0 -0
  75. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/shell/prompts/role.txt +0 -0
  76. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/shell/shell_agent.py +0 -0
  77. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/skill/__init__.py +0 -0
  78. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/skill/agent_tool.py +0 -0
  79. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/skill/prompts/__init__.py +0 -0
  80. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/skill/prompts/role.txt +0 -0
  81. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/skill/skill_agent.py +0 -0
  82. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/summarizer/__init__.py +0 -0
  83. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/summarizer/prompts/__init__.py +0 -0
  84. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/summarizer/prompts/role.txt +0 -0
  85. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/summarizer/summarizer_agent.py +0 -0
  86. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/task/__init__.py +0 -0
  87. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/task/agent_tool.py +0 -0
  88. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/task/prompts/__init__.py +0 -0
  89. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/task/prompts/role.txt +0 -0
  90. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/task/task_agent.py +0 -0
  91. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/test/__init__.py +0 -0
  92. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/test/agent_tool.py +0 -0
  93. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/test/prompts/__init__.py +0 -0
  94. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/test/prompts/role.txt +0 -0
  95. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/test/test_agent.py +0 -0
  96. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/agent/tool_registry.py +0 -0
  97. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/client.py +0 -0
  98. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/compact/__init__.py +0 -0
  99. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/compact/compressor.py +0 -0
  100. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/hooks/__init__.py +0 -0
  101. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/hooks/handlers/__init__.py +0 -0
  102. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/hooks/handlers/base.py +0 -0
  103. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/hooks/handlers/memory.py +0 -0
  104. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/hooks/processor.py +0 -0
  105. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/hooks/queue.py +0 -0
  106. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/hooks/types.py +0 -0
  107. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/provider/__init__.py +0 -0
  108. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/provider/router.py +0 -0
  109. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/provider/txcode_ai.py +0 -0
  110. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/__init__.py +0 -0
  111. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/__main__.py +0 -0
  112. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/config_store.py +0 -0
  113. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/handler.py +0 -0
  114. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/http.py +0 -0
  115. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/hub_client.py +0 -0
  116. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/json_store.py +0 -0
  117. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/plan_code.py +0 -0
  118. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/project_manager.py +0 -0
  119. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/provider_config.py +0 -0
  120. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/server.py +0 -0
  121. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/skill_manager.py +0 -0
  122. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/spec_manager.py +0 -0
  123. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/websocket.py +0 -0
  124. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/server/zip_utils.py +0 -0
  125. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/session/__init__.py +0 -0
  126. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/session/manager.py +0 -0
  127. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/skills/__init__.py +0 -0
  128. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/specs/__init__.py +0 -0
  129. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/__init__.py +0 -0
  130. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/bash.txt +0 -0
  131. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/bash_tool.py +0 -0
  132. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/edit_file.py +0 -0
  133. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/edit_file.txt +0 -0
  134. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/glob.txt +0 -0
  135. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/glob_tool.py +0 -0
  136. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/grep.txt +0 -0
  137. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/grep_tool.py +0 -0
  138. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/memory_tool.py +0 -0
  139. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/read_file.py +0 -0
  140. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/read_file.txt +0 -0
  141. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/todo_read.py +0 -0
  142. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/todo_read.txt +0 -0
  143. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/todo_write.py +0 -0
  144. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/todo_write.txt +0 -0
  145. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/web_shell_exec.py +0 -0
  146. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/web_shell_exec.txt +0 -0
  147. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/write_file.py +0 -0
  148. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/tools/write_file.txt +0 -0
  149. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk/types.py +0 -0
  150. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk.egg-info/dependency_links.txt +0 -0
  151. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk.egg-info/entry_points.txt +0 -0
  152. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/src/txcode_sdk.egg-info/top_level.txt +0 -0
  153. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_cli.py +0 -0
  154. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_client.py +0 -0
  155. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_compat.py +0 -0
  156. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_design_agent.py +0 -0
  157. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_discuss_agent.py +0 -0
  158. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_dream_agent.py +0 -0
  159. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_http_api.py +0 -0
  160. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_http_ext_api.py +0 -0
  161. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_json_store.py +0 -0
  162. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_name_agent.py +0 -0
  163. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_plan_agent.py +0 -0
  164. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_project_manager.py +0 -0
  165. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_provider_config.py +0 -0
  166. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_session.py +0 -0
  167. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_session_query.py +0 -0
  168. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_shell_agent.py +0 -0
  169. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_skill_agent.py +0 -0
  170. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_test_agent.py +0 -0
  171. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_tools.py +0 -0
  172. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_txcode_ai.py +0 -0
  173. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_websocket_protocol.py +0 -0
  174. {txcode_sdk-0.6.0 → txcode_sdk-0.7.0}/tests/test_ws_server.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txcode-sdk
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: AI Agent SDK with built-in tools for Python projects
5
5
  Author: homecommunity
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "txcode-sdk"
7
- version = "0.6.0"
7
+ version = "0.7.0"
8
8
  description = "AI Agent SDK with built-in tools for Python projects"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -1,225 +1,159 @@
1
- """OpenAI Provider:基于自研 TxCodeAI(urllib)实现,零 openai SDK 依赖。"""
2
-
3
- import base64
4
- import json
5
- import mimetypes
6
- from datetime import datetime, timezone
7
- from pathlib import Path
8
- from typing import Any, AsyncGenerator, Dict, List, Optional, Union
9
-
10
- from .base import BaseProvider
11
- from .txcode_ai import TxCodeAI
12
- from ..types import (
13
- ChatMessage,
14
- ImageContent,
15
- ProviderResponse,
16
- TextContent,
17
- TokenUsage,
18
- )
19
-
20
-
21
- def _resolve_image_url(url: str) -> str:
22
- if url.startswith("data:"):
23
- return url
24
- path = Path(url)
25
- if path.is_file():
26
- mime_type, _ = mimetypes.guess_type(str(path))
27
- mime_type = mime_type or "image/png"
28
- with open(path, "rb") as f:
29
- b64 = base64.b64encode(f.read()).decode("utf-8")
30
- return f"data:{mime_type};base64,{b64}"
31
- return url
32
-
33
-
34
- class OpenAIProvider(BaseProvider):
35
- def __init__(
36
- self,
37
- api_key: str,
38
- base_url: str = "https://api.openai.com/v1",
39
- model: str = "gpt-4",
40
- ):
41
- self._model = model
42
- self._base_url = base_url
43
- self._client = TxCodeAI(
44
- api_key=api_key,
45
- base_url=base_url,
46
- default_headers={
47
- "HTTP-Referer": "https://www.homecommunity.cn",
48
- "X-Title": "txcode",
49
- },
50
- )
51
-
52
- def get_model(self) -> str:
53
- return self._model
54
-
55
- def set_model(self, model: str):
56
- """原地切换模型(base_url/api_key 不变,DeepSeekProvider 继承生效)。"""
57
- self._model = model
58
-
59
- def get_base_url(self) -> str:
60
- return self._base_url
61
-
62
- def _write_log(self, log_context: dict, event: str, extra: dict):
63
- work_dir = log_context.get("work_dir", ".")
64
- log_dir = Path(work_dir) / ".txcode" / "log"
65
- log_dir.mkdir(parents=True, exist_ok=True)
66
- entry = {
67
- "timestamp": datetime.now(timezone.utc).isoformat(),
68
- "session_id": log_context.get("session_id", ""),
69
- "agent_type": log_context.get("agent_type", ""),
70
- "iteration": log_context.get("iteration", 0),
71
- "event": event,
72
- **extra,
73
- }
74
- with open(log_dir / "txcode_access.log", "a", encoding="utf-8") as f:
75
- f.write(json.dumps(entry, ensure_ascii=False, indent=2) + "\n")
76
-
77
- async def chat(
78
- self,
79
- messages: List[ChatMessage],
80
- tools: Optional[List[dict]] = None,
81
- abort_signal: Any = None,
82
- log_context: Optional[dict] = None,
83
- ) -> ProviderResponse:
84
- resolved = await self._resolve_messages(messages)
85
- kwargs: Dict[str, Any] = {
86
- "model": self._model,
87
- "messages": resolved,
88
- "temperature": 0.7,
89
- "max_tokens": 65536,
90
- }
91
- if tools:
92
- kwargs["tools"] = tools
93
- kwargs["tool_choice"] = "auto"
94
-
95
- if log_context:
96
- self._write_log(log_context, "request", {
97
- "model": self._model,
98
- "messages": resolved,
99
- "tools": tools or [],
100
- })
101
-
102
- response = await self._client.chat_completions(**kwargs)
103
- parsed = self._parse_response(response)
104
-
105
- if log_context:
106
- self._write_log(log_context, "response", {
107
- "model": self._model,
108
- "finish_reason": parsed.finish_reason,
109
- "content": parsed.content or "",
110
- "tool_calls": parsed.tool_calls or [],
111
- "usage": {
112
- "prompt_tokens": parsed.usage.prompt_tokens,
113
- "completion_tokens": parsed.usage.completion_tokens,
114
- "total_tokens": parsed.usage.total_tokens,
115
- } if parsed.usage else None,
116
- })
117
-
118
- return parsed
119
-
120
- async def chat_stream(
121
- self,
122
- messages: List[ChatMessage],
123
- tools: Optional[List[dict]] = None,
124
- abort_signal: Any = None,
125
- ) -> AsyncGenerator[str, None]:
126
- resolved = await self._resolve_messages(messages)
127
- kwargs: Dict[str, Any] = {
128
- "model": self._model,
129
- "messages": resolved,
130
- "temperature": 0.7,
131
- "max_tokens": 2000,
132
- "stream": True,
133
- }
134
- if tools:
135
- kwargs["tools"] = tools
136
-
137
- async for chunk in self._client.chat_completions_stream(**kwargs):
138
- choices = chunk.get("choices") or []
139
- if not choices:
140
- continue
141
- delta = choices[0].get("delta") or {}
142
- content = delta.get("content")
143
- if content:
144
- yield content
145
-
146
- async def _resolve_messages(self, messages: List[ChatMessage]) -> List[dict]:
147
- resolved: List[dict] = []
148
- for msg in messages:
149
- formatted = self._format_message(msg)
150
- formatted["content"] = await self._resolve_content_images(msg.content)
151
- resolved.append(formatted)
152
- return resolved
153
-
154
- def _format_message(self, msg: ChatMessage) -> dict:
155
- formatted: dict = {"role": msg.role}
156
- content = msg.content
157
- if isinstance(content, list):
158
- formatted["content"] = [c.to_dict() if hasattr(c, "to_dict") else c for c in content]
159
- else:
160
- formatted["content"] = content
161
-
162
- if msg.name:
163
- formatted["name"] = msg.name
164
- if msg.tool_call_id:
165
- formatted["tool_call_id"] = msg.tool_call_id
166
- if msg.tool_calls:
167
- formatted["tool_calls"] = msg.tool_calls
168
- if msg.reasoning_content:
169
- formatted["reasoning_content"] = msg.reasoning_content
170
- return formatted
171
-
172
- async def _resolve_content_images(self, content: Union[str, list]) -> Union[str, list]:
173
- if isinstance(content, str):
174
- return content
175
- resolved: list = []
176
- for c in content:
177
- if isinstance(c, ImageContent):
178
- resolved.append(ImageContent(url=_resolve_image_url(c.image_url["url"])).to_dict())
179
- elif hasattr(c, "to_dict"):
180
- resolved.append(c.to_dict())
181
- else:
182
- resolved.append(c)
183
- return resolved
184
-
185
- def _parse_response(self, response: dict) -> ProviderResponse:
186
- choices = response.get("choices") or []
187
- if not choices:
188
- raise RuntimeError("Invalid response: no choices")
189
- choice = choices[0]
190
- msg = choice.get("message") or {}
191
-
192
- usage = None
193
- usage_data = response.get("usage")
194
- if usage_data:
195
- usage = TokenUsage(
196
- prompt_tokens=usage_data.get("prompt_tokens", 0),
197
- completion_tokens=usage_data.get("completion_tokens", 0),
198
- total_tokens=usage_data.get("total_tokens", 0),
199
- )
200
-
201
- result = ProviderResponse(
202
- content=msg.get("content") or "",
203
- finish_reason=choice.get("finish_reason") or "stop",
204
- usage=usage,
205
- )
206
-
207
- reasoning = msg.get("reasoning_content") or response.get("reasoning")
208
- if reasoning:
209
- result.reasoning = reasoning
210
-
211
- tool_calls = msg.get("tool_calls")
212
- if tool_calls:
213
- result.tool_calls = [
214
- {
215
- "id": tc.get("id", ""),
216
- "type": tc.get("type", "function"),
217
- "function": {
218
- "name": (tc.get("function") or {}).get("name", ""),
219
- "arguments": (tc.get("function") or {}).get("arguments", ""),
220
- },
221
- }
222
- for tc in tool_calls
223
- ]
224
-
225
- return result
1
+ """BaseProvider 抽象基类(ReAct 循环的 Provider 接口 + 公共实现)。
2
+
3
+ 公共能力(get_model/set_model/get_base_url/日志/消息格式化/响应解析)在此实现,
4
+ OpenAIProvider 与 DeepSeekProvider 等具体 Provider 继承本类,仅保留各自的请求差异。
5
+ """
6
+
7
+ import base64
8
+ import json
9
+ import mimetypes
10
+ from abc import ABC, abstractmethod
11
+ from datetime import datetime, timezone
12
+ from pathlib import Path
13
+ from typing import Any, AsyncGenerator, Dict, List, Optional, Union
14
+
15
+ from ..types import ChatMessage, ImageContent, ProviderResponse, TokenUsage
16
+
17
+
18
+ def _resolve_image_url(url: str) -> str:
19
+ if url.startswith("data:"):
20
+ return url
21
+ path = Path(url)
22
+ if path.is_file():
23
+ mime_type, _ = mimetypes.guess_type(str(path))
24
+ mime_type = mime_type or "image/png"
25
+ with open(path, "rb") as f:
26
+ b64 = base64.b64encode(f.read()).decode("utf-8")
27
+ return f"data:{mime_type};base64,{b64}"
28
+ return url
29
+
30
+
31
+ class BaseProvider(ABC):
32
+ def __init__(self, base_url: str = "", model: str = ""):
33
+ self._base_url = base_url
34
+ self._model = model
35
+
36
+ @abstractmethod
37
+ async def chat(
38
+ self,
39
+ messages: List[ChatMessage],
40
+ tools: Optional[List[dict]] = None,
41
+ abort_signal: Any = None,
42
+ log_context: Optional[dict] = None,
43
+ ) -> ProviderResponse:
44
+ ...
45
+
46
+ @abstractmethod
47
+ async def chat_stream(
48
+ self,
49
+ messages: List[ChatMessage],
50
+ tools: Optional[List[dict]] = None,
51
+ abort_signal: Any = None,
52
+ ) -> AsyncGenerator[str, None]:
53
+ ...
54
+
55
+ def get_model(self) -> str:
56
+ return getattr(self, "_model", "")
57
+
58
+ def get_base_url(self) -> str:
59
+ return getattr(self, "_base_url", "")
60
+
61
+ def set_model(self, model: str):
62
+ """运行期切换模型(base_url/api_key 不变,子类公共实现)。"""
63
+ self._model = model
64
+
65
+ def _write_log(self, log_context: dict, event: str, extra: dict):
66
+ work_dir = log_context.get("work_dir", ".")
67
+ log_dir = Path(work_dir) / ".txcode" / "log"
68
+ log_dir.mkdir(parents=True, exist_ok=True)
69
+ entry = {
70
+ "timestamp": datetime.now(timezone.utc).isoformat(),
71
+ "session_id": log_context.get("session_id", ""),
72
+ "agent_type": log_context.get("agent_type", ""),
73
+ "iteration": log_context.get("iteration", 0),
74
+ "event": event,
75
+ **extra,
76
+ }
77
+ with open(log_dir / "txcode_access.log", "a", encoding="utf-8") as f:
78
+ f.write(json.dumps(entry, ensure_ascii=False, indent=2) + "\n")
79
+
80
+ async def _resolve_messages(self, messages: List[ChatMessage]) -> List[dict]:
81
+ resolved: List[dict] = []
82
+ for msg in messages:
83
+ formatted = self._format_message(msg)
84
+ formatted["content"] = await self._resolve_content_images(msg.content)
85
+ resolved.append(formatted)
86
+ return resolved
87
+
88
+ def _format_message(self, msg: ChatMessage) -> dict:
89
+ formatted: dict = {"role": msg.role}
90
+ content = msg.content
91
+ if isinstance(content, list):
92
+ formatted["content"] = [c.to_dict() if hasattr(c, "to_dict") else c for c in content]
93
+ else:
94
+ formatted["content"] = content
95
+
96
+ if msg.name:
97
+ formatted["name"] = msg.name
98
+ if msg.tool_call_id:
99
+ formatted["tool_call_id"] = msg.tool_call_id
100
+ if msg.tool_calls:
101
+ formatted["tool_calls"] = msg.tool_calls
102
+ if msg.reasoning_content:
103
+ formatted["reasoning_content"] = msg.reasoning_content
104
+ return formatted
105
+
106
+ async def _resolve_content_images(self, content: Union[str, list]) -> Union[str, list]:
107
+ if isinstance(content, str):
108
+ return content
109
+ resolved: list = []
110
+ for c in content:
111
+ if isinstance(c, ImageContent):
112
+ resolved.append(ImageContent(url=_resolve_image_url(c.image_url["url"])).to_dict())
113
+ elif hasattr(c, "to_dict"):
114
+ resolved.append(c.to_dict())
115
+ else:
116
+ resolved.append(c)
117
+ return resolved
118
+
119
+ def _parse_response(self, response: dict) -> ProviderResponse:
120
+ choices = response.get("choices") or []
121
+ if not choices:
122
+ raise RuntimeError("Invalid response: no choices")
123
+ choice = choices[0]
124
+ msg = choice.get("message") or {}
125
+
126
+ usage = None
127
+ usage_data = response.get("usage")
128
+ if usage_data:
129
+ usage = TokenUsage(
130
+ prompt_tokens=usage_data.get("prompt_tokens", 0),
131
+ completion_tokens=usage_data.get("completion_tokens", 0),
132
+ total_tokens=usage_data.get("total_tokens", 0),
133
+ )
134
+
135
+ result = ProviderResponse(
136
+ content=msg.get("content") or "",
137
+ finish_reason=choice.get("finish_reason") or "stop",
138
+ usage=usage,
139
+ )
140
+
141
+ reasoning = msg.get("reasoning_content") or response.get("reasoning")
142
+ if reasoning:
143
+ result.reasoning = reasoning
144
+
145
+ tool_calls = msg.get("tool_calls")
146
+ if tool_calls:
147
+ result.tool_calls = [
148
+ {
149
+ "id": tc.get("id", ""),
150
+ "type": tc.get("type", "function"),
151
+ "function": {
152
+ "name": (tc.get("function") or {}).get("name", ""),
153
+ "arguments": (tc.get("function") or {}).get("arguments", ""),
154
+ },
155
+ }
156
+ for tc in tool_calls
157
+ ]
158
+
159
+ return result
@@ -0,0 +1,121 @@
1
+ """DeepSeek Provider:对齐 TS 端 deepseek.provider.ts 行为,直接继承 BaseProvider。
2
+
3
+ - chat:开启思考模式(thinking.enabled + reasoning_effort: max),默认 max_tokens 65536
4
+ - chat_stream:关闭思考模式(thinking.disabled),默认 max_tokens 2000
5
+ - assistant 消息无 reasoning_content 时补 "null" 占位,规避 DeepSeek API 校验错误
6
+ - reasoning 提取优先级:msg.reasoning_content → msg.reasoning → response.reasoning → msg.content
7
+ """
8
+
9
+ from typing import Any, AsyncGenerator, Dict, List, Optional
10
+
11
+ from ..types import ChatMessage, ProviderResponse
12
+ from .base import BaseProvider
13
+ from .txcode_ai import TxCodeAI
14
+
15
+
16
+ class DeepSeekProvider(BaseProvider):
17
+ def __init__(
18
+ self,
19
+ api_key: str,
20
+ base_url: str = "https://api.deepseek.com/v1",
21
+ model: str = "deepseek-chat",
22
+ ):
23
+ super().__init__(base_url=base_url, model=model)
24
+ self._client = TxCodeAI(
25
+ api_key=api_key,
26
+ base_url=base_url,
27
+ default_headers={
28
+ "HTTP-Referer": "https://www.homecommunity.cn",
29
+ "X-Title": "txcode",
30
+ },
31
+ )
32
+
33
+ async def chat(
34
+ self,
35
+ messages: List[ChatMessage],
36
+ tools: Optional[List[dict]] = None,
37
+ abort_signal: Any = None,
38
+ log_context: Optional[dict] = None,
39
+ ) -> ProviderResponse:
40
+ resolved = await self._resolve_messages(messages)
41
+ kwargs: Dict[str, Any] = {
42
+ "model": self._model,
43
+ "messages": resolved,
44
+ "max_tokens": 65536,
45
+ "thinking": {"type": "enabled"},
46
+ "reasoning_effort": "max",
47
+ }
48
+ if tools:
49
+ kwargs["tools"] = tools
50
+ kwargs["tool_choice"] = "auto"
51
+
52
+ if log_context:
53
+ self._write_log(log_context, "request", {
54
+ "model": self._model,
55
+ "messages": resolved,
56
+ "tools": tools or [],
57
+ })
58
+
59
+ response = await self._client.chat_completions(**kwargs)
60
+ parsed = self._parse_response(response)
61
+
62
+ if log_context:
63
+ self._write_log(log_context, "response", {
64
+ "model": self._model,
65
+ "finish_reason": parsed.finish_reason,
66
+ "content": parsed.content or "",
67
+ "tool_calls": parsed.tool_calls or [],
68
+ "usage": {
69
+ "prompt_tokens": parsed.usage.prompt_tokens,
70
+ "completion_tokens": parsed.usage.completion_tokens,
71
+ "total_tokens": parsed.usage.total_tokens,
72
+ } if parsed.usage else None,
73
+ })
74
+
75
+ return parsed
76
+
77
+ async def chat_stream(
78
+ self,
79
+ messages: List[ChatMessage],
80
+ tools: Optional[List[dict]] = None,
81
+ abort_signal: Any = None,
82
+ ) -> AsyncGenerator[str, None]:
83
+ resolved = await self._resolve_messages(messages)
84
+ kwargs: Dict[str, Any] = {
85
+ "model": self._model,
86
+ "messages": resolved,
87
+ "max_tokens": 2000,
88
+ "stream": True,
89
+ "thinking": {"type": "disabled"},
90
+ }
91
+ if tools:
92
+ kwargs["tools"] = tools
93
+
94
+ async for chunk in self._client.chat_completions_stream(**kwargs):
95
+ choices = chunk.get("choices") or []
96
+ if not choices:
97
+ continue
98
+ delta = choices[0].get("delta") or {}
99
+ content = delta.get("content")
100
+ if content:
101
+ yield content
102
+
103
+ def _format_message(self, msg: ChatMessage) -> dict:
104
+ formatted = super()._format_message(msg)
105
+ if msg.role == "assistant" and not formatted.get("reasoning_content"):
106
+ formatted["reasoning_content"] = "null"
107
+ return formatted
108
+
109
+ def _parse_response(self, response: dict) -> ProviderResponse:
110
+ result = super()._parse_response(response)
111
+ choice = (response.get("choices") or [{}])[0]
112
+ msg = choice.get("message") or {}
113
+ reasoning = (
114
+ msg.get("reasoning_content")
115
+ or msg.get("reasoning")
116
+ or response.get("reasoning")
117
+ or (msg.get("content") or "")
118
+ )
119
+ if reasoning:
120
+ result.reasoning = reasoning
121
+ return result
@@ -0,0 +1,94 @@
1
+ """OpenAI Provider:基于自研 TxCodeAI(urllib)实现,零 openai SDK 依赖。"""
2
+
3
+ from typing import Any, AsyncGenerator, Dict, List, Optional
4
+
5
+ from ..types import ChatMessage, ProviderResponse
6
+ from .base import BaseProvider
7
+ from .txcode_ai import TxCodeAI
8
+
9
+
10
+ class OpenAIProvider(BaseProvider):
11
+ def __init__(
12
+ self,
13
+ api_key: str,
14
+ base_url: str = "https://api.openai.com/v1",
15
+ model: str = "gpt-4",
16
+ ):
17
+ super().__init__(base_url=base_url, model=model)
18
+ self._client = TxCodeAI(
19
+ api_key=api_key,
20
+ base_url=base_url,
21
+ default_headers={
22
+ "HTTP-Referer": "https://www.homecommunity.cn",
23
+ "X-Title": "txcode",
24
+ },
25
+ )
26
+
27
+ async def chat(
28
+ self,
29
+ messages: List[ChatMessage],
30
+ tools: Optional[List[dict]] = None,
31
+ abort_signal: Any = None,
32
+ log_context: Optional[dict] = None,
33
+ ) -> ProviderResponse:
34
+ resolved = await self._resolve_messages(messages)
35
+ kwargs: Dict[str, Any] = {
36
+ "model": self._model,
37
+ "messages": resolved,
38
+ "temperature": 0.7,
39
+ "max_tokens": 65536,
40
+ }
41
+ if tools:
42
+ kwargs["tools"] = tools
43
+ kwargs["tool_choice"] = "auto"
44
+
45
+ if log_context:
46
+ self._write_log(log_context, "request", {
47
+ "model": self._model,
48
+ "messages": resolved,
49
+ "tools": tools or [],
50
+ })
51
+
52
+ response = await self._client.chat_completions(**kwargs)
53
+ parsed = self._parse_response(response)
54
+
55
+ if log_context:
56
+ self._write_log(log_context, "response", {
57
+ "model": self._model,
58
+ "finish_reason": parsed.finish_reason,
59
+ "content": parsed.content or "",
60
+ "tool_calls": parsed.tool_calls or [],
61
+ "usage": {
62
+ "prompt_tokens": parsed.usage.prompt_tokens,
63
+ "completion_tokens": parsed.usage.completion_tokens,
64
+ "total_tokens": parsed.usage.total_tokens,
65
+ } if parsed.usage else None,
66
+ })
67
+
68
+ return parsed
69
+
70
+ async def chat_stream(
71
+ self,
72
+ messages: List[ChatMessage],
73
+ tools: Optional[List[dict]] = None,
74
+ abort_signal: Any = None,
75
+ ) -> AsyncGenerator[str, None]:
76
+ resolved = await self._resolve_messages(messages)
77
+ kwargs: Dict[str, Any] = {
78
+ "model": self._model,
79
+ "messages": resolved,
80
+ "temperature": 0.7,
81
+ "max_tokens": 65536,
82
+ "stream": True,
83
+ }
84
+ if tools:
85
+ kwargs["tools"] = tools
86
+
87
+ async for chunk in self._client.chat_completions_stream(**kwargs):
88
+ choices = chunk.get("choices") or []
89
+ if not choices:
90
+ continue
91
+ delta = choices[0].get("delta") or {}
92
+ content = delta.get("content")
93
+ if content:
94
+ yield content
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txcode-sdk
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: AI Agent SDK with built-in tools for Python projects
5
5
  Author: homecommunity
6
6
  License: MIT
@@ -147,6 +147,7 @@ src/txcode_sdk/tools/write_file.txt
147
147
  tests/test_cli.py
148
148
  tests/test_client.py
149
149
  tests/test_compat.py
150
+ tests/test_deepseek_provider.py
150
151
  tests/test_design_agent.py
151
152
  tests/test_discuss_agent.py
152
153
  tests/test_dream_agent.py