txcode-sdk 1.0.0__py3-none-any.whl → 1.2.0__py3-none-any.whl
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.
- example/ws_server.py +1 -13
- txcode_sdk/__init__.py +1 -1
- txcode_sdk/agent/base_agent.py +187 -399
- txcode_sdk/agent/chat/chat_agent.py +5 -5
- txcode_sdk/agent/code/code_agent.py +6 -5
- txcode_sdk/agent/common/common_agent.py +5 -5
- txcode_sdk/agent/compact_mixin.py +91 -0
- txcode_sdk/agent/design/design_agent.py +6 -5
- txcode_sdk/agent/discuss/discuss_agent.py +6 -5
- txcode_sdk/agent/dream/dream_agent.py +6 -5
- txcode_sdk/agent/factory.py +105 -0
- txcode_sdk/agent/hook_mixin.py +38 -0
- txcode_sdk/agent/message_utils.py +97 -0
- txcode_sdk/agent/name/name_agent.py +14 -1
- txcode_sdk/agent/plan/plan_agent.py +40 -39
- txcode_sdk/agent/prompt_builder.py +91 -0
- txcode_sdk/agent/shell/shell_agent.py +6 -5
- txcode_sdk/agent/step_utils.py +121 -0
- txcode_sdk/agent/task/task_agent.py +6 -5
- txcode_sdk/agent/test/test_agent.py +6 -5
- txcode_sdk/client.py +13 -116
- txcode_sdk/provider/deepseek_provider.py +125 -115
- txcode_sdk/provider/openai_provider.py +97 -87
- txcode_sdk/provider/txcode_ai.py +23 -10
- txcode_sdk/server/__main__.py +111 -68
- txcode_sdk/server/git.py +148 -0
- txcode_sdk/server/handler.py +535 -593
- txcode_sdk/server/http/__init__.py +114 -0
- txcode_sdk/server/http/chat_routes.py +64 -0
- txcode_sdk/server/http/file_routes.py +88 -0
- txcode_sdk/server/http/git_routes.py +67 -0
- txcode_sdk/server/http/http_base.py +382 -0
- txcode_sdk/server/http/plan_code_routes.py +66 -0
- txcode_sdk/server/http/project_routes.py +72 -0
- txcode_sdk/server/http/session_routes.py +65 -0
- txcode_sdk/server/http/skill_routes.py +67 -0
- txcode_sdk/server/http/spec_routes.py +89 -0
- txcode_sdk/server/http/sys_config_routes.py +308 -0
- txcode_sdk/server/plan_code.py +223 -234
- txcode_sdk/server/project_manager.py +11 -10
- txcode_sdk/server/provider_config.py +1 -5
- txcode_sdk/server/server.py +6 -0
- txcode_sdk/server/services/__init__.py +26 -0
- txcode_sdk/server/services/broadcaster.py +38 -0
- txcode_sdk/server/services/project_service.py +48 -0
- txcode_sdk/server/services/provider_service.py +126 -0
- txcode_sdk/server/skill_manager.py +3 -6
- txcode_sdk/server/spec_manager.py +5 -12
- txcode_sdk/session/manager.py +1 -32
- txcode_sdk/tools/__init__.py +13 -1
- txcode_sdk/tools/edit_file.py +13 -351
- txcode_sdk/tools/edit_replacers.py +329 -0
- txcode_sdk/tools/edit_similarity.py +20 -0
- txcode_sdk/tools/glob.py +1 -9
- txcode_sdk/tools/grep.py +1 -9
- txcode_sdk/tools/read_file.py +101 -110
- txcode_sdk/tools/write_file.py +42 -52
- txcode_sdk/types.py +159 -158
- txcode_sdk/utils/__init__.py +19 -0
- txcode_sdk/utils/format.py +43 -0
- txcode_sdk/utils/log.py +43 -0
- txcode_sdk/utils/path_util.py +30 -0
- txcode_sdk/utils/time_util.py +23 -0
- {txcode_sdk-1.0.0.dist-info → txcode_sdk-1.2.0.dist-info}/METADATA +1 -1
- {txcode_sdk-1.0.0.dist-info → txcode_sdk-1.2.0.dist-info}/RECORD +69 -45
- txcode_sdk/server/http.py +0 -1071
- txcode_sdk/tools/bash_tool.py +0 -5
- txcode_sdk/tools/glob_tool.py +0 -5
- txcode_sdk/tools/grep_tool.py +0 -5
- txcode_sdk/tools/memory_tool.py +0 -5
- {txcode_sdk-1.0.0.dist-info → txcode_sdk-1.2.0.dist-info}/WHEEL +0 -0
- {txcode_sdk-1.0.0.dist-info → txcode_sdk-1.2.0.dist-info}/entry_points.txt +0 -0
- {txcode_sdk-1.0.0.dist-info → txcode_sdk-1.2.0.dist-info}/licenses/LICENSE +0 -0
- {txcode_sdk-1.0.0.dist-info → txcode_sdk-1.2.0.dist-info}/top_level.txt +0 -0
example/ws_server.py
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
环境变量:TXCODE_API_KEY(必填)/ TXCODE_BASE_URL / TXCODE_MODEL / TXCODE_WORK_DIR
|
|
11
11
|
(CLI `txcode-sdk serve` 走 JSON 权威源装配,见 README;本示例直接读环境变量构造 client)"""
|
|
12
12
|
|
|
13
|
-
import asyncio
|
|
14
13
|
import os
|
|
15
14
|
import sys
|
|
16
15
|
|
|
@@ -18,6 +17,7 @@ from txcode_sdk import Tool, ToolResult, TxCodeClient
|
|
|
18
17
|
from txcode_sdk.server import TxCodeServer
|
|
19
18
|
from txcode_sdk.server.provider_config import ProviderConfigManager
|
|
20
19
|
from txcode_sdk.server.project_manager import ProjectManager
|
|
20
|
+
from txcode_sdk.utils.path_util import _get_event_loop
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def open_door(args, ctx):
|
|
@@ -32,18 +32,6 @@ def get_door_status(args, ctx):
|
|
|
32
32
|
return ToolResult(success=True, output="closed")
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
def _get_event_loop():
|
|
36
|
-
"""3.6/3.12 双版本兼容:已在运行 loop 则复用;否则新建(避免 3.12 弃用警告)。"""
|
|
37
|
-
if hasattr(asyncio, "get_running_loop"):
|
|
38
|
-
try:
|
|
39
|
-
return asyncio.get_running_loop()
|
|
40
|
-
except RuntimeError:
|
|
41
|
-
pass
|
|
42
|
-
loop = asyncio.new_event_loop()
|
|
43
|
-
asyncio.set_event_loop(loop)
|
|
44
|
-
return loop
|
|
45
|
-
|
|
46
|
-
|
|
47
35
|
def main() -> int:
|
|
48
36
|
api_key = os.environ.get("TXCODE_API_KEY", "").strip()
|
|
49
37
|
if not api_key:
|
txcode_sdk/__init__.py
CHANGED