txcode-sdk 0.1.0__tar.gz → 0.2.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 (163) hide show
  1. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/PKG-INFO +66 -58
  2. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/README.md +7 -3
  3. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/pyproject.toml +17 -11
  4. txcode_sdk-0.2.0/setup.cfg +4 -0
  5. txcode_sdk-0.2.0/setup.py +34 -0
  6. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/example/code_example.py +2 -2
  7. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/example/code_session.py +1 -1
  8. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/example/code_tool.py +1 -1
  9. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/example/constants.py +1 -1
  10. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/example/query_session.py +4 -2
  11. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/__init__.py +17 -1
  12. txcode_sdk-0.2.0/src/txcode_sdk/_compat/__init__.py +5 -0
  13. txcode_sdk-0.2.0/src/txcode_sdk/_compat/dataclasses.py +121 -0
  14. txcode_sdk-0.2.0/src/txcode_sdk/_compat/resources.py +19 -0
  15. txcode_sdk-0.2.0/src/txcode_sdk/agent/__init__.py +33 -0
  16. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/base_agent.py +31 -28
  17. txcode_sdk-0.2.0/src/txcode_sdk/agent/chat/agent_tool.py +5 -0
  18. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/chat/chat_agent.py +4 -2
  19. txcode_sdk-0.2.0/src/txcode_sdk/agent/chat/prompts/__init__.py +1 -0
  20. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/code/code_agent.py +4 -2
  21. txcode_sdk-0.2.0/src/txcode_sdk/agent/code/prompts/__init__.py +1 -0
  22. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/common/common_agent.py +5 -1
  23. txcode_sdk-0.2.0/src/txcode_sdk/agent/common/prompt/__init__.py +0 -0
  24. txcode_sdk-0.2.0/src/txcode_sdk/agent/design/__init__.py +4 -0
  25. txcode_sdk-0.2.0/src/txcode_sdk/agent/design/agent_tool.py +1 -0
  26. txcode_sdk-0.2.0/src/txcode_sdk/agent/design/design_agent.py +28 -0
  27. txcode_sdk-0.2.0/src/txcode_sdk/agent/design/prompts/__init__.py +1 -0
  28. txcode_sdk-0.2.0/src/txcode_sdk/agent/design/prompts/role.txt +36 -0
  29. txcode_sdk-0.2.0/src/txcode_sdk/agent/discuss/__init__.py +4 -0
  30. txcode_sdk-0.2.0/src/txcode_sdk/agent/discuss/agent_tool.py +1 -0
  31. txcode_sdk-0.2.0/src/txcode_sdk/agent/discuss/discuss_agent.py +28 -0
  32. txcode_sdk-0.2.0/src/txcode_sdk/agent/discuss/prompts/__init__.py +1 -0
  33. txcode_sdk-0.2.0/src/txcode_sdk/agent/discuss/prompts/role.txt +28 -0
  34. txcode_sdk-0.2.0/src/txcode_sdk/agent/dream/__init__.py +4 -0
  35. txcode_sdk-0.2.0/src/txcode_sdk/agent/dream/agent_tool.py +1 -0
  36. txcode_sdk-0.2.0/src/txcode_sdk/agent/dream/dream_agent.py +28 -0
  37. txcode_sdk-0.2.0/src/txcode_sdk/agent/dream/prompts/__init__.py +1 -0
  38. txcode_sdk-0.2.0/src/txcode_sdk/agent/dream/prompts/role.txt +21 -0
  39. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/mem/mem_agent.py +8 -8
  40. txcode_sdk-0.2.0/src/txcode_sdk/agent/mem/prompts/__init__.py +1 -0
  41. txcode_sdk-0.2.0/src/txcode_sdk/agent/name/__init__.py +3 -0
  42. txcode_sdk-0.2.0/src/txcode_sdk/agent/name/name_agent.py +55 -0
  43. txcode_sdk-0.2.0/src/txcode_sdk/agent/name/prompts/__init__.py +1 -0
  44. txcode_sdk-0.2.0/src/txcode_sdk/agent/name/prompts/role.txt +8 -0
  45. txcode_sdk-0.2.0/src/txcode_sdk/agent/plan/__init__.py +4 -0
  46. txcode_sdk-0.2.0/src/txcode_sdk/agent/plan/agent_tool.py +1 -0
  47. txcode_sdk-0.2.0/src/txcode_sdk/agent/plan/plan_agent.py +30 -0
  48. txcode_sdk-0.2.0/src/txcode_sdk/agent/plan/prompts/__init__.py +1 -0
  49. txcode_sdk-0.2.0/src/txcode_sdk/agent/plan/prompts/role.txt +47 -0
  50. txcode_sdk-0.2.0/src/txcode_sdk/agent/shell/__init__.py +4 -0
  51. txcode_sdk-0.2.0/src/txcode_sdk/agent/shell/agent_tool.py +1 -0
  52. txcode_sdk-0.2.0/src/txcode_sdk/agent/shell/prompts/__init__.py +1 -0
  53. txcode_sdk-0.2.0/src/txcode_sdk/agent/shell/prompts/role.txt +29 -0
  54. txcode_sdk-0.2.0/src/txcode_sdk/agent/shell/shell_agent.py +28 -0
  55. txcode_sdk-0.2.0/src/txcode_sdk/agent/skill/__init__.py +4 -0
  56. txcode_sdk-0.2.0/src/txcode_sdk/agent/skill/agent_tool.py +1 -0
  57. txcode_sdk-0.2.0/src/txcode_sdk/agent/skill/prompts/__init__.py +1 -0
  58. txcode_sdk-0.2.0/src/txcode_sdk/agent/skill/prompts/role.txt +62 -0
  59. txcode_sdk-0.2.0/src/txcode_sdk/agent/skill/skill_agent.py +80 -0
  60. txcode_sdk-0.2.0/src/txcode_sdk/agent/summarizer/prompts/__init__.py +1 -0
  61. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/summarizer/summarizer_agent.py +7 -7
  62. txcode_sdk-0.2.0/src/txcode_sdk/agent/task/prompts/__init__.py +1 -0
  63. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/task/task_agent.py +4 -2
  64. txcode_sdk-0.2.0/src/txcode_sdk/agent/test/__init__.py +4 -0
  65. txcode_sdk-0.2.0/src/txcode_sdk/agent/test/agent_tool.py +1 -0
  66. txcode_sdk-0.2.0/src/txcode_sdk/agent/test/prompts/__init__.py +1 -0
  67. txcode_sdk-0.2.0/src/txcode_sdk/agent/test/prompts/role.txt +21 -0
  68. txcode_sdk-0.2.0/src/txcode_sdk/agent/test/test_agent.py +32 -0
  69. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/tool_registry.py +21 -16
  70. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/client.py +122 -17
  71. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/compact/compressor.py +6 -5
  72. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/hooks/__init__.py +1 -1
  73. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/hooks/handlers/base.py +3 -2
  74. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/hooks/handlers/memory.py +1 -1
  75. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/hooks/processor.py +4 -3
  76. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/hooks/queue.py +5 -5
  77. txcode_sdk-0.2.0/src/txcode_sdk/hooks/types.py +12 -0
  78. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/provider/base.py +8 -8
  79. txcode_sdk-0.2.0/src/txcode_sdk/provider/deepseek_provider.py +13 -0
  80. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/provider/openai_provider.py +52 -40
  81. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/provider/router.py +1 -1
  82. txcode_sdk-0.2.0/src/txcode_sdk/provider/txcode_ai.py +200 -0
  83. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/session/manager.py +16 -15
  84. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/skills/__init__.py +9 -5
  85. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/specs/__init__.py +24 -14
  86. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/bash_tool.py +3 -3
  87. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/edit_file.py +12 -11
  88. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/glob_tool.py +5 -4
  89. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/grep_tool.py +5 -4
  90. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/memory_tool.py +1 -1
  91. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/read_file.py +6 -5
  92. txcode_sdk-0.2.0/src/txcode_sdk/tools/todo_read.py +40 -0
  93. txcode_sdk-0.2.0/src/txcode_sdk/tools/todo_read.txt +15 -0
  94. txcode_sdk-0.2.0/src/txcode_sdk/tools/todo_write.py +66 -0
  95. txcode_sdk-0.2.0/src/txcode_sdk/tools/todo_write.txt +47 -0
  96. txcode_sdk-0.2.0/src/txcode_sdk/tools/web_shell_exec.py +77 -0
  97. txcode_sdk-0.2.0/src/txcode_sdk/tools/web_shell_exec.txt +14 -0
  98. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/write_file.py +3 -3
  99. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/types.py +33 -30
  100. txcode_sdk-0.2.0/src/txcode_sdk.egg-info/PKG-INFO +66 -0
  101. txcode_sdk-0.2.0/src/txcode_sdk.egg-info/SOURCES.txt +143 -0
  102. txcode_sdk-0.2.0/src/txcode_sdk.egg-info/dependency_links.txt +1 -0
  103. txcode_sdk-0.2.0/src/txcode_sdk.egg-info/top_level.txt +2 -0
  104. txcode_sdk-0.2.0/tests/test_compat.py +149 -0
  105. txcode_sdk-0.2.0/tests/test_design_agent.py +47 -0
  106. txcode_sdk-0.2.0/tests/test_discuss_agent.py +35 -0
  107. txcode_sdk-0.2.0/tests/test_dream_agent.py +35 -0
  108. txcode_sdk-0.2.0/tests/test_name_agent.py +56 -0
  109. txcode_sdk-0.2.0/tests/test_plan_agent.py +54 -0
  110. txcode_sdk-0.2.0/tests/test_shell_agent.py +62 -0
  111. txcode_sdk-0.2.0/tests/test_skill_agent.py +70 -0
  112. txcode_sdk-0.2.0/tests/test_test_agent.py +126 -0
  113. txcode_sdk-0.2.0/tests/test_txcode_ai.py +208 -0
  114. txcode_sdk-0.1.0/.gitignore +0 -27
  115. txcode_sdk-0.1.0/docs/api/agent.html +0 -84
  116. txcode_sdk-0.1.0/docs/api/client.html +0 -147
  117. txcode_sdk-0.1.0/docs/api/session.html +0 -126
  118. txcode_sdk-0.1.0/docs/api/tools.html +0 -139
  119. txcode_sdk-0.1.0/docs/assets/style.css +0 -198
  120. txcode_sdk-0.1.0/docs/example/hello-world.html +0 -104
  121. txcode_sdk-0.1.0/docs/example/tool-calling.html +0 -158
  122. txcode_sdk-0.1.0/docs/guide/configuration.html +0 -118
  123. txcode_sdk-0.1.0/docs/guide/installation.html +0 -98
  124. txcode_sdk-0.1.0/docs/guide/quickstart.html +0 -99
  125. txcode_sdk-0.1.0/docs/index.html +0 -92
  126. txcode_sdk-0.1.0/src/example/README.md +0 -27
  127. txcode_sdk-0.1.0/src/txcode_sdk/agent/__init__.py +0 -17
  128. txcode_sdk-0.1.0/src/txcode_sdk/agent/chat/agent_tool.py +0 -1
  129. txcode_sdk-0.1.0/src/txcode_sdk/hooks/types.py +0 -10
  130. txcode_sdk-0.1.0/src/txcode_sdk/provider/deepseek_provider.py +0 -60
  131. txcode_sdk-0.1.0/tests/__init__.py +0 -1
  132. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/LICENSE +0 -0
  133. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/example/__init__.py +0 -0
  134. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/chat/__init__.py +0 -0
  135. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/chat/prompts/role.txt +0 -0
  136. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/code/__init__.py +0 -0
  137. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/code/agent_tool.py +0 -0
  138. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/code/prompts/role.txt +0 -0
  139. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/common/__init__.py +0 -0
  140. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/common/prompt/role.txt +0 -0
  141. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/mem/__init__.py +0 -0
  142. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/mem/agent_tool.py +0 -0
  143. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/mem/prompts/role.txt +0 -0
  144. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/summarizer/__init__.py +0 -0
  145. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/summarizer/prompts/role.txt +0 -0
  146. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/task/__init__.py +0 -0
  147. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/task/agent_tool.py +0 -0
  148. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/agent/task/prompts/role.txt +0 -0
  149. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/compact/__init__.py +0 -0
  150. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/hooks/handlers/__init__.py +0 -0
  151. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/provider/__init__.py +0 -0
  152. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/session/__init__.py +0 -0
  153. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/__init__.py +0 -0
  154. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/bash.txt +0 -0
  155. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/edit_file.txt +0 -0
  156. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/glob.txt +0 -0
  157. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/grep.txt +0 -0
  158. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/read_file.txt +0 -0
  159. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/src/txcode_sdk/tools/write_file.txt +0 -0
  160. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/tests/test_client.py +0 -0
  161. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/tests/test_session.py +0 -0
  162. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/tests/test_session_query.py +0 -0
  163. {txcode_sdk-0.1.0 → txcode_sdk-0.2.0}/tests/test_tools.py +0 -0
@@ -1,58 +1,66 @@
1
- Metadata-Version: 2.4
2
- Name: txcode-sdk
3
- Version: 0.1.0
4
- Summary: AI Agent SDK with built-in tools for Python projects
5
- Project-URL: Repository, https://github.com/homecommunity/txcode-sdk
6
- Author: homecommunity
7
- License: MIT
8
- License-File: LICENSE
9
- Keywords: agent,ai,openai,react,tools
10
- Classifier: Development Status :: 3 - Alpha
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Requires-Python: >=3.10
18
- Requires-Dist: openai>=1.0.0
19
- Requires-Dist: tiktoken>=0.5.0
20
- Description-Content-Type: text/markdown
21
-
22
- # txcode-sdk
23
-
24
- AI Agent SDK with built-in tools for Python projects.
25
-
26
- ## Installation
27
-
28
- ```bash
29
- pip install txcode-sdk
30
- ```
31
-
32
- ## Quick Start
33
-
34
- ```python
35
- import asyncio
36
- from txcode_sdk import TxCodeClient
37
-
38
- async def main():
39
- client = TxCodeClient(
40
- api_key="sk-xxx",
41
- base_url="https://api.openai.com/v1",
42
- model="gpt-4",
43
- )
44
- result = await client.chat("Hello!")
45
- print(result.answer)
46
-
47
- asyncio.run(main())
48
- ```
49
-
50
- ## Features
51
-
52
- - ReAct Agent loop with tool calling
53
- - Multiple agent types: code, chat, common, task
54
- - 6 built-in tools: read_file, write_file, edit_file, glob, grep, bash
55
- - Session management with JSON file persistence
56
- - Context compression for long conversations
57
- - Multimodal input support (images)
58
- - Extensible custom tools
1
+ Metadata-Version: 2.4
2
+ Name: txcode-sdk
3
+ Version: 0.2.0
4
+ Summary: AI Agent SDK with built-in tools for Python projects
5
+ Author: homecommunity
6
+ License: MIT
7
+ Project-URL: Repository, https://github.com/homecommunity/txcode-sdk
8
+ Keywords: ai,agent,openai,tools,react
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.6
14
+ Classifier: Programming Language :: Python :: 3.7
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.6
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Dynamic: license-file
24
+ Dynamic: requires-python
25
+
26
+ # txcode-sdk
27
+
28
+ AI Agent SDK with built-in tools for Python projects.
29
+
30
+ ## Installation
31
+
32
+ - 要求:**Python >= 3.6**(含 3.6/3.7/3.8/3.9/3.10/3.11/3.12)
33
+ - **零第三方运行时依赖**(仅标准库,适合门禁设备等离线环境)
34
+
35
+ ```bash
36
+ pip install txcode-sdk
37
+ ```
38
+
39
+ ## Quick Start
40
+
41
+ ```python
42
+ import asyncio
43
+ from txcode_sdk import TxCodeClient
44
+
45
+ async def main():
46
+ client = TxCodeClient(
47
+ api_key="sk-xxx",
48
+ base_url="https://api.openai.com/v1",
49
+ model="gpt-4",
50
+ )
51
+ result = await client.chat("Hello!")
52
+ print(result.answer)
53
+
54
+ asyncio.get_event_loop().run_until_complete(main())
55
+ ```
56
+
57
+ ## Features
58
+
59
+ - ReAct Agent loop with tool calling
60
+ - Multiple agent types: code, chat, common, task, plan, shell, skill, test, design, discuss, dream, name
61
+ - 10 built-in tools: read_file, write_file, edit_file, glob, grep, bash, memory, web_shell_exec, todo_read, todo_write
62
+ - Session management with JSON file persistence
63
+ - Context compression for long conversations
64
+ - Multimodal input support (images)
65
+ - Extensible custom tools
66
+ - Self-developed HTTP client (urllib, no openai/tiktoken dependency), supports OpenAI / DeepSeek / any OpenAI-compatible API
@@ -4,6 +4,9 @@ AI Agent SDK with built-in tools for Python projects.
4
4
 
5
5
  ## Installation
6
6
 
7
+ - 要求:**Python >= 3.6**(含 3.6/3.7/3.8/3.9/3.10/3.11/3.12)
8
+ - **零第三方运行时依赖**(仅标准库,适合门禁设备等离线环境)
9
+
7
10
  ```bash
8
11
  pip install txcode-sdk
9
12
  ```
@@ -23,15 +26,16 @@ async def main():
23
26
  result = await client.chat("Hello!")
24
27
  print(result.answer)
25
28
 
26
- asyncio.run(main())
29
+ asyncio.get_event_loop().run_until_complete(main())
27
30
  ```
28
31
 
29
32
  ## Features
30
33
 
31
34
  - ReAct Agent loop with tool calling
32
- - Multiple agent types: code, chat, common, task
33
- - 6 built-in tools: read_file, write_file, edit_file, glob, grep, bash
35
+ - Multiple agent types: code, chat, common, task, plan, shell, skill, test, design, discuss, dream, name
36
+ - 10 built-in tools: read_file, write_file, edit_file, glob, grep, bash, memory, web_shell_exec, todo_read, todo_write
34
37
  - Session management with JSON file persistence
35
38
  - Context compression for long conversations
36
39
  - Multimodal input support (images)
37
40
  - Extensible custom tools
41
+ - Self-developed HTTP client (urllib, no openai/tiktoken dependency), supports OpenAI / DeepSeek / any OpenAI-compatible API
@@ -1,14 +1,14 @@
1
1
  [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
2
+ requires = ["setuptools>=40.8.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "txcode-sdk"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "AI Agent SDK with built-in tools for Python projects"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
11
- requires-python = ">=3.10"
11
+ requires-python = ">=3.6"
12
12
  authors = [
13
13
  { name = "homecommunity" }
14
14
  ]
@@ -18,18 +18,24 @@ classifiers = [
18
18
  "Intended Audience :: Developers",
19
19
  "License :: OSI Approved :: MIT License",
20
20
  "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.6",
22
+ "Programming Language :: Python :: 3.7",
23
+ "Programming Language :: Python :: 3.8",
24
+ "Programming Language :: Python :: 3.9",
21
25
  "Programming Language :: Python :: 3.10",
22
26
  "Programming Language :: Python :: 3.11",
23
27
  "Programming Language :: Python :: 3.12",
24
28
  ]
25
- dependencies = [
26
- "openai>=1.0.0",
27
- "tiktoken>=0.5.0",
28
- ]
29
+ dependencies = []
29
30
 
30
31
  [project.urls]
31
32
  Repository = "https://github.com/homecommunity/txcode-sdk"
32
33
 
33
- [tool.hatch.build.targets.wheel]
34
- packages = ["src/txcode_sdk"]
35
- include = ["src/txcode_sdk/**/*.txt"]
34
+ [tool.pytest.ini_options]
35
+ testpaths = ["tests"]
36
+
37
+ [tool.setuptools.packages.find]
38
+ where = ["src"]
39
+
40
+ [tool.setuptools.package-data]
41
+ txcode_sdk = ["**/*.txt"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,34 @@
1
+ """setuptools 传统入口(兼容老版本 pip 离线安装,Python 3.6)。
2
+
3
+ pyproject.toml 中的 [tool.setuptools] 配置与 setup.cfg 等价;
4
+ 此文件仅为老版本 pip(不支持 PEP 517)提供回退入口。
5
+ """
6
+
7
+ from setuptools import find_packages, setup
8
+
9
+ setup(
10
+ name="txcode-sdk",
11
+ version="0.2.0",
12
+ description="AI Agent SDK with built-in tools for Python projects",
13
+ long_description=open("README.md", encoding="utf-8").read(),
14
+ long_description_content_type="text/markdown",
15
+ license="MIT",
16
+ python_requires=">=3.6",
17
+ packages=find_packages("src"),
18
+ package_dir={"": "src"},
19
+ package_data={"txcode_sdk": ["**/*.txt"]},
20
+ install_requires=[],
21
+ classifiers=[
22
+ "Development Status :: 3 - Alpha",
23
+ "Intended Audience :: Developers",
24
+ "License :: OSI Approved :: MIT License",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.6",
27
+ "Programming Language :: Python :: 3.7",
28
+ "Programming Language :: Python :: 3.8",
29
+ "Programming Language :: Python :: 3.9",
30
+ "Programming Language :: Python :: 3.10",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ ],
34
+ )
@@ -38,7 +38,7 @@ async def _verify_last_message(client: TxCodeClient, session_id: str):
38
38
  print(f"\nTotal messages in session: {len(messages)}")
39
39
 
40
40
  ai_messages = [m for m in messages if m.get("role") in ("assistant", "tool")]
41
- errors: list[str] = []
41
+ errors: list = []
42
42
 
43
43
  for i, msg in enumerate(ai_messages):
44
44
  role = msg.get("role", "")
@@ -93,4 +93,4 @@ async def main():
93
93
 
94
94
 
95
95
  if __name__ == "__main__":
96
- asyncio.run(main())
96
+ asyncio.get_event_loop().run_until_complete(main())
@@ -77,4 +77,4 @@ async def main():
77
77
 
78
78
 
79
79
  if __name__ == "__main__":
80
- asyncio.run(main())
80
+ asyncio.get_event_loop().run_until_complete(main())
@@ -107,4 +107,4 @@ async def main():
107
107
 
108
108
 
109
109
  if __name__ == "__main__":
110
- asyncio.run(main())
110
+ asyncio.get_event_loop().run_until_complete(main())
@@ -1,6 +1,6 @@
1
1
  MODEL = "deepseek-v4-flash"
2
2
  BASE_URL = "https://api.deepseek.com/v1"
3
- API_KEY = "sk-5bd224ae366e467b8eabdadf9af4d3c0"
3
+ API_KEY = "xxx"
4
4
  MAX_CONTEXT_TOKENS = 150_000
5
5
  MAX_ITERATIONS = 25
6
6
  WORK_DIR = "."
@@ -29,7 +29,8 @@ def demo_get_session_messages(session_id: str):
29
29
  try:
30
30
  print(f" {pm}")
31
31
  except UnicodeEncodeError:
32
- print(f" {pm.encode('ascii', errors='replace').decode('ascii')}")
32
+ safe_pm = pm.encode("ascii", errors="replace").decode("ascii")
33
+ print(f" {safe_pm}")
33
34
 
34
35
 
35
36
  def demo_step_print():
@@ -54,7 +55,8 @@ def demo_step_print():
54
55
  try:
55
56
  print(msg)
56
57
  except UnicodeEncodeError:
57
- print(msg.encode('ascii', errors='replace').decode('ascii'))
58
+ safe_msg = msg.encode("ascii", errors="replace").decode("ascii")
59
+ print(safe_msg)
58
60
 
59
61
 
60
62
  if __name__ == "__main__":
@@ -20,6 +20,14 @@ from .types import (
20
20
  ToolResultInfo,
21
21
  )
22
22
  from .agent.summarizer import SummarizerAgent, CompactCheck as SummarizerCompactCheck, CompactResult as SummarizerCompactResult
23
+ from .agent.design import DesignAgent
24
+ from .agent.discuss import DiscussionAgent
25
+ from .agent.dream import DreamAgent
26
+ from .agent.name import NameAgent
27
+ from .agent.plan import PlanAgent
28
+ from .agent.shell import ShellAgent
29
+ from .agent.skill import SkillAgent
30
+ from .agent.test import TestAgent
23
31
 
24
32
  __all__ = [
25
33
  "TxCodeClient",
@@ -44,6 +52,14 @@ __all__ = [
44
52
  "SummarizerAgent",
45
53
  "SummarizerCompactCheck",
46
54
  "SummarizerCompactResult",
55
+ "DesignAgent",
56
+ "DiscussionAgent",
57
+ "DreamAgent",
58
+ "NameAgent",
59
+ "PlanAgent",
60
+ "ShellAgent",
61
+ "SkillAgent",
62
+ "TestAgent",
47
63
  ]
48
64
 
49
- __version__ = "0.1.0"
65
+ __version__ = "0.2.0"
@@ -0,0 +1,5 @@
1
+ """Python 3.6 兼容层:dataclasses / importlib.resources 替代实现(零第三方依赖)。"""
2
+
3
+ from . import dataclasses, resources # noqa: F401
4
+
5
+ __all__ = ["dataclasses", "resources"]
@@ -0,0 +1,121 @@
1
+ """Python 3.6 兼容的 dataclasses 迷你实现。
2
+
3
+ 仅实现本项目使用到的特性:
4
+ - ``@dataclass`` 装饰器(含 ``@dataclass()`` 括号形式)
5
+ - 字段默认值(``name: int = 0``)
6
+ - ``field(default=..., default_factory=...)``(hooks/types.py 的 metadata 用到)
7
+ - 自动生成 ``__init__`` / ``__repr__`` / ``__eq__``
8
+
9
+ 不实现 frozen / slots / order / field 校验等高级特性。
10
+ 自 Python 3.7 起标准库 dataclasses 存在,本模块仅在 3.6 环境被使用;
11
+ 为保持行为一致,3.7+ 环境下可直接改用标准库。
12
+ """
13
+
14
+
15
+ class _MISSING_TYPE(object):
16
+ def __repr__(self):
17
+ return "MISSING"
18
+
19
+
20
+ MISSING = _MISSING_TYPE()
21
+
22
+
23
+ class _Field(object):
24
+ __slots__ = ("default", "default_factory")
25
+
26
+ def __init__(self, default=MISSING, default_factory=MISSING):
27
+ self.default = default
28
+ self.default_factory = default_factory
29
+
30
+
31
+ def field(*, default=MISSING, default_factory=MISSING):
32
+ """为 dataclass 字段提供默认值 / 默认工厂的声明。"""
33
+ if default is not MISSING and default_factory is not MISSING:
34
+ raise TypeError("cannot specify both default and default_factory")
35
+ return _Field(default=default, default_factory=default_factory)
36
+
37
+
38
+ def dataclass(cls=None, *, init=True, repr=True, eq=True):
39
+ """类装饰器:根据类注解自动生成 __init__ / __repr__ / __eq__。"""
40
+
41
+ def wrap(target):
42
+ return _process_class(target, init=init, repr=repr, eq=eq)
43
+
44
+ if cls is None:
45
+ return wrap
46
+ return wrap(cls)
47
+
48
+
49
+ def _collect_fields(cls):
50
+ """按 __annotations__ 顺序收集 (name, default, default_factory)。"""
51
+ annotations = getattr(cls, "__annotations__", None) or {}
52
+ fields = []
53
+ for name in annotations:
54
+ raw = getattr(cls, name, MISSING)
55
+ if isinstance(raw, _Field):
56
+ default = raw.default
57
+ default_factory = raw.default_factory
58
+ elif raw is not MISSING:
59
+ default = raw
60
+ default_factory = MISSING
61
+ else:
62
+ default = MISSING
63
+ default_factory = MISSING
64
+ fields.append((name, default, default_factory))
65
+ return fields
66
+
67
+
68
+ def _make_init(fields):
69
+ args = []
70
+ for name, default, default_factory in fields:
71
+ if default is not MISSING:
72
+ args.append("%s=%r" % (name, default))
73
+ else:
74
+ args.append("%s=MISSING" % name)
75
+ lines = ["def __init__(self, %s):" % ", ".join(args)]
76
+ for name, default, default_factory in fields:
77
+ if default_factory is not MISSING:
78
+ lines.append(" if %s is MISSING:" % name)
79
+ lines.append(" %s = _factory_%s()" % (name, name))
80
+ lines.append(" self.%s = %s" % (name, name))
81
+ ns = {"MISSING": MISSING}
82
+ for name, default, default_factory in fields:
83
+ if default_factory is not MISSING:
84
+ ns["_factory_%s" % name] = default_factory
85
+ exec("\n".join(lines), ns)
86
+ return ns["__init__"]
87
+
88
+
89
+ def _make_repr(cls, fields):
90
+ names = [name for name, _, _ in fields]
91
+
92
+ def __repr__(self):
93
+ parts = ", ".join("%s=%r" % (name, getattr(self, name)) for name in names)
94
+ return "%s(%s)" % (cls.__name__, parts)
95
+
96
+ return __repr__
97
+
98
+
99
+ def _make_eq(fields):
100
+ names = [name for name, _, _ in fields]
101
+
102
+ def __eq__(self, other):
103
+ if other.__class__ is not self.__class__:
104
+ return NotImplemented
105
+ for name in names:
106
+ if getattr(self, name) != getattr(other, name):
107
+ return False
108
+ return True
109
+
110
+ return __eq__
111
+
112
+
113
+ def _process_class(cls, init, repr, eq):
114
+ fields = _collect_fields(cls)
115
+ if init:
116
+ cls.__init__ = _make_init(fields)
117
+ if repr:
118
+ cls.__repr__ = _make_repr(cls, fields)
119
+ if eq:
120
+ cls.__eq__ = _make_eq(fields)
121
+ return cls
@@ -0,0 +1,19 @@
1
+ """importlib.resources 的 Python 3.6 兼容封装(基于 pkgutil.get_data)。
2
+
3
+ ``pkgutil.get_data`` 自 Python 3.x 一直可用,且支持 zip 导入(wheel / zip 安装场景),
4
+ 替代 Python 3.9+ 的 ``importlib.resources.files(...).joinpath(...).read_text()``。
5
+ """
6
+
7
+ import pkgutil
8
+
9
+
10
+ def get_resource(package, filename):
11
+ """读取包内文本资源并返回字符串(UTF-8 解码)。"""
12
+ data = pkgutil.get_data(package, filename)
13
+ if data is None:
14
+ raise FileNotFoundError(
15
+ "No resource %r found in package %r" % (filename, package)
16
+ )
17
+ if isinstance(data, bytes):
18
+ return data.decode("utf-8")
19
+ return data
@@ -0,0 +1,33 @@
1
+ from .base_agent import BaseAgent
2
+ from .tool_registry import ToolRegistry, get_builtin_tools, get_builtin_tool_list
3
+ from .code.code_agent import CodeAgent
4
+ from .chat.chat_agent import ChatAgent
5
+ from .common.common_agent import CommonAgent
6
+ from .task.task_agent import TaskAgent
7
+ from .design.design_agent import DesignAgent
8
+ from .discuss.discuss_agent import DiscussionAgent
9
+ from .dream.dream_agent import DreamAgent
10
+ from .name.name_agent import NameAgent
11
+ from .plan.plan_agent import PlanAgent
12
+ from .shell.shell_agent import ShellAgent
13
+ from .skill.skill_agent import SkillAgent
14
+ from .test.test_agent import TestAgent
15
+
16
+ __all__ = [
17
+ "BaseAgent",
18
+ "ToolRegistry",
19
+ "get_builtin_tools",
20
+ "get_builtin_tool_list",
21
+ "CodeAgent",
22
+ "ChatAgent",
23
+ "CommonAgent",
24
+ "TaskAgent",
25
+ "DesignAgent",
26
+ "DiscussionAgent",
27
+ "DreamAgent",
28
+ "NameAgent",
29
+ "PlanAgent",
30
+ "ShellAgent",
31
+ "SkillAgent",
32
+ "TestAgent",
33
+ ]