txcode-sdk 0.4.0__tar.gz → 0.4.1__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.
- {txcode_sdk-0.4.0/src/txcode_sdk.egg-info → txcode_sdk-0.4.1}/PKG-INFO +8 -6
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/README.md +7 -5
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/pyproject.toml +44 -44
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/setup.py +39 -39
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/__init__.py +1 -1
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/server/__main__.py +41 -27
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/server/handler.py +20 -0
- txcode_sdk-0.4.1/src/txcode_sdk/server/http.py +606 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/server/server.py +25 -8
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/server/websocket.py +16 -33
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1/src/txcode_sdk.egg-info}/PKG-INFO +8 -6
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk.egg-info/SOURCES.txt +2 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_cli.py +40 -9
- txcode_sdk-0.4.1/tests/test_http_api.py +682 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_ws_server.py +127 -23
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/LICENSE +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/setup.cfg +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/example/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/example/code_example.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/example/code_session.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/example/code_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/example/constants.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/example/query_session.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/example/ws_server.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/_compat/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/_compat/dataclasses.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/_compat/resources.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/base_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/chat/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/chat/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/chat/chat_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/chat/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/chat/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/code/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/code/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/code/code_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/code/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/code/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/common/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/common/common_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/common/prompt/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/common/prompt/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/design/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/design/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/design/design_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/design/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/design/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/discuss/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/discuss/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/discuss/discuss_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/discuss/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/discuss/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/dream/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/dream/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/dream/dream_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/dream/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/dream/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/mem/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/mem/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/mem/mem_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/mem/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/mem/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/name/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/name/name_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/name/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/name/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/plan/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/plan/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/plan/plan_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/plan/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/plan/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/shell/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/shell/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/shell/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/shell/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/shell/shell_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/skill/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/skill/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/skill/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/skill/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/skill/skill_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/summarizer/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/summarizer/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/summarizer/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/summarizer/summarizer_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/task/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/task/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/task/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/task/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/task/task_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/test/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/test/agent_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/test/prompts/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/test/prompts/role.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/test/test_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/agent/tool_registry.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/client.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/compact/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/compact/compressor.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/hooks/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/hooks/handlers/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/hooks/handlers/base.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/hooks/handlers/memory.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/hooks/processor.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/hooks/queue.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/hooks/types.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/provider/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/provider/base.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/provider/deepseek_provider.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/provider/openai_provider.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/provider/router.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/provider/txcode_ai.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/server/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/server/json_store.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/server/project_manager.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/server/provider_config.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/session/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/session/manager.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/skills/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/specs/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/__init__.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/bash.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/bash_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/edit_file.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/edit_file.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/glob.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/glob_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/grep.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/grep_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/memory_tool.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/read_file.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/read_file.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/todo_read.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/todo_read.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/todo_write.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/todo_write.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/web_shell_exec.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/web_shell_exec.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/write_file.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/tools/write_file.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk/types.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk.egg-info/dependency_links.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk.egg-info/entry_points.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/src/txcode_sdk.egg-info/top_level.txt +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_client.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_compat.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_design_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_discuss_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_dream_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_json_store.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_name_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_plan_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_project_manager.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_provider_config.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_provider_model.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_session.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_session_query.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_shell_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_skill_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_test_agent.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_tools.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_txcode_ai.py +0 -0
- {txcode_sdk-0.4.0 → txcode_sdk-0.4.1}/tests/test_websocket_protocol.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: txcode-sdk
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: AI Agent SDK with built-in tools for Python projects
|
|
5
5
|
Author: homecommunity
|
|
6
6
|
License: MIT
|
|
@@ -89,17 +89,19 @@ txcode-sdk serve --work-dir /opt/door-access --host 0.0.0.0 --port 41000 \
|
|
|
89
89
|
- `--host` / `--port`:默认 `0.0.0.0:41000`
|
|
90
90
|
- `--agent-type`:默认 `code`
|
|
91
91
|
- `--models`:默认供应商初始模型列表 `[显示名=]模型名` 逗号分隔(仅首次注册默认供应商时使用);缺省读 `TXCODE_MODELS`,再缺省 = 不限制
|
|
92
|
-
-
|
|
92
|
+
- `TXCODE_API_KEY`:**可选**——仅当 `~/.txcode/providers.json` 不存在且希望首次自动注册默认供应商时使用;未设置时服务以**空配置**正常启动(stderr 打印 WARN 提示),供应商由桌面端通过 WS `add_provider` / `switch_provider` 动态添加,无需重启
|
|
93
93
|
- 兜底启动:`python -m txcode_sdk.server serve --work-dir ...`(无脚本路径时同样可用)
|
|
94
94
|
|
|
95
|
-
### 启动装配(JSON 为权威源,0.4.
|
|
95
|
+
### 启动装配(JSON 为权威源,0.4.1)
|
|
96
96
|
|
|
97
97
|
服务启动时以用户层 JSON 为权威源恢复上次状态,**重启自动恢复上次激活供应商/模型与当前项目**:
|
|
98
98
|
|
|
99
99
|
1. **供应商**:加载 `~/.txcode/providers.json`——存在则取激活供应商的 `(api_key, base_url, model)` 直接构造
|
|
100
|
-
`TxCodeClient`(不读 `TXCODE_BASE_URL` / `TXCODE_MODEL
|
|
101
|
-
`TXCODE_API_KEY
|
|
102
|
-
|
|
100
|
+
`TxCodeClient`(不读 `TXCODE_BASE_URL` / `TXCODE_MODEL`);不存在(首次启动/全新环境)且设置了
|
|
101
|
+
`TXCODE_API_KEY`(可选)时以 `TXCODE_BASE_URL` / `TXCODE_MODEL` 注册默认供应商并激活(`--models` 作为初始模型列表);
|
|
102
|
+
**未设置 `TXCODE_API_KEY` 时以空配置正常启动**(占位 client,不发起任何 API 请求),
|
|
103
|
+
供应商由桌面端经 WS `add_provider` / `switch_provider` 动态添加;未配置供应商前 `chat` / `name_session`
|
|
104
|
+
会收到「No active provider configured」提示,其余能力(WS 握手、ping、配置/项目管理消息)全部可用
|
|
103
105
|
2. **项目**:加载 `~/.txcode/projects.json`——有当前项目则其 `path` 作为 work_dir(不读 `TXCODE_WORK_DIR`);
|
|
104
106
|
无当前项目则 `--work-dir` 注册为当前项目后使用
|
|
105
107
|
|
|
@@ -64,17 +64,19 @@ txcode-sdk serve --work-dir /opt/door-access --host 0.0.0.0 --port 41000 \
|
|
|
64
64
|
- `--host` / `--port`:默认 `0.0.0.0:41000`
|
|
65
65
|
- `--agent-type`:默认 `code`
|
|
66
66
|
- `--models`:默认供应商初始模型列表 `[显示名=]模型名` 逗号分隔(仅首次注册默认供应商时使用);缺省读 `TXCODE_MODELS`,再缺省 = 不限制
|
|
67
|
-
-
|
|
67
|
+
- `TXCODE_API_KEY`:**可选**——仅当 `~/.txcode/providers.json` 不存在且希望首次自动注册默认供应商时使用;未设置时服务以**空配置**正常启动(stderr 打印 WARN 提示),供应商由桌面端通过 WS `add_provider` / `switch_provider` 动态添加,无需重启
|
|
68
68
|
- 兜底启动:`python -m txcode_sdk.server serve --work-dir ...`(无脚本路径时同样可用)
|
|
69
69
|
|
|
70
|
-
### 启动装配(JSON 为权威源,0.4.
|
|
70
|
+
### 启动装配(JSON 为权威源,0.4.1)
|
|
71
71
|
|
|
72
72
|
服务启动时以用户层 JSON 为权威源恢复上次状态,**重启自动恢复上次激活供应商/模型与当前项目**:
|
|
73
73
|
|
|
74
74
|
1. **供应商**:加载 `~/.txcode/providers.json`——存在则取激活供应商的 `(api_key, base_url, model)` 直接构造
|
|
75
|
-
`TxCodeClient`(不读 `TXCODE_BASE_URL` / `TXCODE_MODEL
|
|
76
|
-
`TXCODE_API_KEY
|
|
77
|
-
|
|
75
|
+
`TxCodeClient`(不读 `TXCODE_BASE_URL` / `TXCODE_MODEL`);不存在(首次启动/全新环境)且设置了
|
|
76
|
+
`TXCODE_API_KEY`(可选)时以 `TXCODE_BASE_URL` / `TXCODE_MODEL` 注册默认供应商并激活(`--models` 作为初始模型列表);
|
|
77
|
+
**未设置 `TXCODE_API_KEY` 时以空配置正常启动**(占位 client,不发起任何 API 请求),
|
|
78
|
+
供应商由桌面端经 WS `add_provider` / `switch_provider` 动态添加;未配置供应商前 `chat` / `name_session`
|
|
79
|
+
会收到「No active provider configured」提示,其余能力(WS 握手、ping、配置/项目管理消息)全部可用
|
|
78
80
|
2. **项目**:加载 `~/.txcode/projects.json`——有当前项目则其 `path` 作为 work_dir(不读 `TXCODE_WORK_DIR`);
|
|
79
81
|
无当前项目则 `--work-dir` 注册为当前项目后使用
|
|
80
82
|
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=40.8.0", "wheel"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "txcode-sdk"
|
|
7
|
-
version = "0.4.
|
|
8
|
-
description = "AI Agent SDK with built-in tools for Python projects"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
license = { text = "MIT" }
|
|
11
|
-
requires-python = ">=3.6"
|
|
12
|
-
authors = [
|
|
13
|
-
{ name = "homecommunity" }
|
|
14
|
-
]
|
|
15
|
-
keywords = ["ai", "agent", "openai", "tools", "react"]
|
|
16
|
-
classifiers = [
|
|
17
|
-
"Development Status :: 3 - Alpha",
|
|
18
|
-
"Intended Audience :: Developers",
|
|
19
|
-
"License :: OSI Approved :: MIT License",
|
|
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",
|
|
25
|
-
"Programming Language :: Python :: 3.10",
|
|
26
|
-
"Programming Language :: Python :: 3.11",
|
|
27
|
-
"Programming Language :: Python :: 3.12",
|
|
28
|
-
]
|
|
29
|
-
dependencies = []
|
|
30
|
-
|
|
31
|
-
[project.scripts]
|
|
32
|
-
txcode-sdk = "txcode_sdk.server.__main__:main"
|
|
33
|
-
|
|
34
|
-
[project.urls]
|
|
35
|
-
Repository = "https://github.com/homecommunity/txcode-sdk"
|
|
36
|
-
|
|
37
|
-
[tool.pytest.ini_options]
|
|
38
|
-
testpaths = ["tests"]
|
|
39
|
-
|
|
40
|
-
[tool.setuptools.packages.find]
|
|
41
|
-
where = ["src"]
|
|
42
|
-
|
|
43
|
-
[tool.setuptools.package-data]
|
|
44
|
-
txcode_sdk = ["**/*.txt"]
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=40.8.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "txcode-sdk"
|
|
7
|
+
version = "0.4.1"
|
|
8
|
+
description = "AI Agent SDK with built-in tools for Python projects"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.6"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "homecommunity" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ai", "agent", "openai", "tools", "react"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
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",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
]
|
|
29
|
+
dependencies = []
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
txcode-sdk = "txcode_sdk.server.__main__:main"
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Repository = "https://github.com/homecommunity/txcode-sdk"
|
|
36
|
+
|
|
37
|
+
[tool.pytest.ini_options]
|
|
38
|
+
testpaths = ["tests"]
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.package-data]
|
|
44
|
+
txcode_sdk = ["**/*.txt"]
|
|
@@ -1,39 +1,39 @@
|
|
|
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.4.
|
|
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
|
-
entry_points={
|
|
22
|
-
"console_scripts": [
|
|
23
|
-
"txcode-sdk=txcode_sdk.server.__main__:main",
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
classifiers=[
|
|
27
|
-
"Development Status :: 3 - Alpha",
|
|
28
|
-
"Intended Audience :: Developers",
|
|
29
|
-
"License :: OSI Approved :: MIT License",
|
|
30
|
-
"Programming Language :: Python :: 3",
|
|
31
|
-
"Programming Language :: Python :: 3.6",
|
|
32
|
-
"Programming Language :: Python :: 3.7",
|
|
33
|
-
"Programming Language :: Python :: 3.8",
|
|
34
|
-
"Programming Language :: Python :: 3.9",
|
|
35
|
-
"Programming Language :: Python :: 3.10",
|
|
36
|
-
"Programming Language :: Python :: 3.11",
|
|
37
|
-
"Programming Language :: Python :: 3.12",
|
|
38
|
-
],
|
|
39
|
-
)
|
|
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.4.1",
|
|
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
|
+
entry_points={
|
|
22
|
+
"console_scripts": [
|
|
23
|
+
"txcode-sdk=txcode_sdk.server.__main__:main",
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
classifiers=[
|
|
27
|
+
"Development Status :: 3 - Alpha",
|
|
28
|
+
"Intended Audience :: Developers",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"Programming Language :: Python :: 3.6",
|
|
32
|
+
"Programming Language :: Python :: 3.7",
|
|
33
|
+
"Programming Language :: Python :: 3.8",
|
|
34
|
+
"Programming Language :: Python :: 3.9",
|
|
35
|
+
"Programming Language :: Python :: 3.10",
|
|
36
|
+
"Programming Language :: Python :: 3.11",
|
|
37
|
+
"Programming Language :: Python :: 3.12",
|
|
38
|
+
],
|
|
39
|
+
)
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
txcode-sdk serve --work-dir <目录> [--host 0.0.0.0] [--port 41000] [--agent-type code] [--models "gpt-4o,DeepSeek V3=deepseek-chat"]
|
|
5
5
|
python -m txcode_sdk.server serve --work-dir <目录>
|
|
6
6
|
|
|
7
|
-
启动装配(JSON 为权威源,0.4.
|
|
7
|
+
启动装配(JSON 为权威源,0.4.1 起):
|
|
8
8
|
- 供应商:`~/.txcode/providers.json` 存在 → 激活供应商 (api_key, base_url, model) 权威;
|
|
9
|
-
|
|
10
|
-
注册默认供应商并激活(--models
|
|
9
|
+
不存在(首次启动/全新环境)→ 设置了 TXCODE_API_KEY(可选)时以其 / TXCODE_BASE_URL /
|
|
10
|
+
TXCODE_MODEL 注册默认供应商并激活(--models 作为初始模型列表),再读回构造;
|
|
11
|
+
未设置 TXCODE_API_KEY → 以空配置正常启动(占位 client + WARN 提示),
|
|
12
|
+
供应商由桌面端经 WS add_provider / switch_provider 动态添加,无需重启。
|
|
11
13
|
- 项目:`~/.txcode/projects.json` 有当前项目 → 其 path 作为 work_dir;
|
|
12
14
|
无当前项目 → --work-dir 注册为当前项目后使用。
|
|
13
15
|
- TXCODE_BASE_URL / TXCODE_MODEL / TXCODE_MODELS 仅首次注册默认供应商时使用;
|
|
@@ -75,7 +77,11 @@ class MissingApiKeyError(Exception):
|
|
|
75
77
|
|
|
76
78
|
|
|
77
79
|
async def build_components(args, user_dir: str = None):
|
|
78
|
-
"""启动装配(JSON 为权威源):返回 (client, provider_config, project_manager, work_dir)。
|
|
80
|
+
"""启动装配(JSON 为权威源):返回 (client, provider_config, project_manager, work_dir)。
|
|
81
|
+
|
|
82
|
+
0.4.1 起无 TXCODE_API_KEY 且无 providers.json / 无激活供应商时不再抛
|
|
83
|
+
MissingApiKeyError,以占位 client(api_key 为空)空配置启动,等待桌面端 WS 添加供应商。
|
|
84
|
+
"""
|
|
79
85
|
from txcode_sdk import TxCodeClient
|
|
80
86
|
from .provider_config import ProviderConfigManager
|
|
81
87
|
from .project_manager import ProjectManager
|
|
@@ -87,31 +93,23 @@ async def build_components(args, user_dir: str = None):
|
|
|
87
93
|
providers_path = os.path.join(user_dir, "providers.json")
|
|
88
94
|
if not os.path.exists(providers_path):
|
|
89
95
|
api_key = os.environ.get("TXCODE_API_KEY", "").strip()
|
|
90
|
-
if
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
if api_key: # 有 env:注册默认供应商(行为不变);无 env:空配置启动,不抛错
|
|
97
|
+
base_url = os.environ.get("TXCODE_BASE_URL", "").strip() or DEFAULT_BASE_URL
|
|
98
|
+
model = os.environ.get("TXCODE_MODEL", "").strip() or DEFAULT_MODEL
|
|
99
|
+
models = parse_models(args.models or os.environ.get("TXCODE_MODELS", ""))
|
|
100
|
+
provider = await provider_config.add_provider(
|
|
101
|
+
name="default",
|
|
102
|
+
base_url=base_url,
|
|
103
|
+
api_key=api_key,
|
|
104
|
+
models=models or None,
|
|
93
105
|
)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
base_url=base_url,
|
|
100
|
-
api_key=api_key,
|
|
101
|
-
models=models or None,
|
|
102
|
-
)
|
|
103
|
-
try:
|
|
104
|
-
await provider_config.switch(provider["id"], model)
|
|
105
|
-
except ValueError:
|
|
106
|
-
# 模型名不在 --models 白名单:回退激活该供应商第一个模型
|
|
107
|
-
await provider_config.switch(provider["id"], None)
|
|
108
|
-
|
|
109
|
-
active_provider, active_model = provider_config.get_active()
|
|
110
|
-
if not active_provider:
|
|
111
|
-
raise MissingApiKeyError(
|
|
112
|
-
"No active provider configured in %s" % providers_path
|
|
113
|
-
)
|
|
106
|
+
try:
|
|
107
|
+
await provider_config.switch(provider["id"], model)
|
|
108
|
+
except ValueError:
|
|
109
|
+
# 模型名不在 --models 白名单:回退激活该供应商第一个模型
|
|
110
|
+
await provider_config.switch(provider["id"], None)
|
|
114
111
|
|
|
112
|
+
# work_dir 装配(先于 client 构造:占位 client 也需要 work_dir)
|
|
115
113
|
current = project_manager.get_current()
|
|
116
114
|
if current and os.path.isdir(current.get("path", "")):
|
|
117
115
|
work_dir = current["path"]
|
|
@@ -121,6 +119,22 @@ async def build_components(args, user_dir: str = None):
|
|
|
121
119
|
os.path.basename(os.path.normpath(work_dir)) or "default", work_dir
|
|
122
120
|
)
|
|
123
121
|
|
|
122
|
+
active_provider, active_model = provider_config.get_active()
|
|
123
|
+
if not active_provider:
|
|
124
|
+
# 空配置启动:占位 client(不发起真实请求)+ WARN 提示(不再抛 MissingApiKeyError)
|
|
125
|
+
client = TxCodeClient(
|
|
126
|
+
api_key="",
|
|
127
|
+
base_url=DEFAULT_BASE_URL,
|
|
128
|
+
model=DEFAULT_MODEL,
|
|
129
|
+
work_dir=work_dir,
|
|
130
|
+
agent_type=args.agent_type,
|
|
131
|
+
)
|
|
132
|
+
sys.stderr.write(
|
|
133
|
+
"[txcode-sdk] WARN: No active provider configured, "
|
|
134
|
+
"add via WS add_provider (desktop)\n"
|
|
135
|
+
)
|
|
136
|
+
return client, provider_config, project_manager, work_dir
|
|
137
|
+
|
|
124
138
|
model = active_model or (
|
|
125
139
|
(active_provider.get("models") or [{}])[0].get("name", "")
|
|
126
140
|
)
|
|
@@ -194,6 +194,15 @@ class CodeWebSocketHandler:
|
|
|
194
194
|
self.broadcast({"type": "error", "error": "sessionId is required"})
|
|
195
195
|
return
|
|
196
196
|
|
|
197
|
+
active_provider, _ = self._provider_config.get_active()
|
|
198
|
+
if not active_provider:
|
|
199
|
+
self.broadcast({
|
|
200
|
+
"type": "error",
|
|
201
|
+
"sessionId": session_id,
|
|
202
|
+
"error": "No active provider configured, please add provider first",
|
|
203
|
+
})
|
|
204
|
+
return
|
|
205
|
+
|
|
197
206
|
message = data.get("message", "")
|
|
198
207
|
agent_type = data.get("agent") or "code"
|
|
199
208
|
media_files = data.get("mediaFiles") or []
|
|
@@ -273,6 +282,9 @@ class CodeWebSocketHandler:
|
|
|
273
282
|
folder_name = data.get("folderName")
|
|
274
283
|
if not session_id or not folder_name:
|
|
275
284
|
return
|
|
285
|
+
active_provider, _ = self._provider_config.get_active()
|
|
286
|
+
if not active_provider:
|
|
287
|
+
return # 无供应商:跳过命名(不调 chat,避免空 key 请求)
|
|
276
288
|
user_input = data.get("userInput") or ""
|
|
277
289
|
try:
|
|
278
290
|
result = await self._client.chat(
|
|
@@ -476,6 +488,14 @@ class CodeWebSocketHandler:
|
|
|
476
488
|
self._abort_signals.clear()
|
|
477
489
|
self._client.set_work_dir(path)
|
|
478
490
|
|
|
491
|
+
async def switch_project(self, path: str):
|
|
492
|
+
"""公开入口:HTTP 层切换 work_dir 时复用(语义与 _switch_project 一致)。"""
|
|
493
|
+
await self._switch_project(path)
|
|
494
|
+
|
|
495
|
+
def sync_client_active(self, active):
|
|
496
|
+
"""公开入口:HTTP 层删除激活供应商/模型后同步 client(语义与 _sync_client_active 一致)。"""
|
|
497
|
+
self._sync_client_active(active)
|
|
498
|
+
|
|
479
499
|
async def _handle_open_project(self, writer, data: dict):
|
|
480
500
|
name = data.get("name")
|
|
481
501
|
path = data.get("path")
|