@brandon_9527/tcode 1.0.8 → 1.0.10
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.
- package/dist/python-src/.env +1 -1
- package/dist/python-src/README.md +48 -1
- package/dist/python-src/_workspace/.autodev/config.json +12 -0
- package/dist/python-src/_workspace/.autodev/cron/jobs.json +4 -0
- package/dist/python-src/entry.py +21 -1
- package/dist/python-src/main.py +763 -42
- package/dist/python-src/pyproject.toml +1 -0
- package/dist/python-src/run.sh +9 -0
- package/dist/python-src/src/agents/token_tracker.py +4 -4
- package/dist/python-src/src/claw/bus/queue.py +1 -1
- package/dist/python-src/src/claw/channels/__init__.py +2 -2
- package/dist/python-src/src/claw/channels/base.py +2 -2
- package/dist/python-src/src/claw/channels/feishu.py +57 -16
- package/dist/python-src/src/claw/channels/manager.py +2 -2
- package/dist/python-src/src/claw/config/__init__.py +3 -0
- package/dist/python-src/src/claw/config/loader.py +38 -0
- package/dist/python-src/src/claw/config/schema.py +14 -29
- package/dist/python-src/src/claw/cron/__init__.py +3 -0
- package/dist/python-src/src/claw/cron/service.py +171 -0
- package/dist/python-src/src/claw/cron/types_.py +14 -0
- package/dist/python-src/src/claw/heartbeat/__init__.py +2 -0
- package/dist/python-src/src/claw/heartbeat/service.py +55 -0
- package/dist/python-src/src/claw/run.py +82 -0
- package/dist/python-src/src/claw/tools/base.py +23 -0
- package/dist/python-src/src/claw/tools/channel.py +0 -0
- package/dist/python-src/src/claw/tools/cron.py +138 -0
- package/dist/python-src/src/claw/utils/__init__.py +2 -0
- package/dist/python-src/src/claw/utils/helpers.py +27 -0
- package/dist/python-src/src/core/context.py +158 -0
- package/dist/python-src/src/managers/manager_agent.py +9 -9
- package/dist/python-src/src/managers/manager_command.py +62 -0
- package/dist/python-src/src/managers/manager_context.py +1 -1
- package/dist/python-src/src/managers/manager_instruction.py +7 -7
- package/dist/python-src/src/managers/manager_skill.py +3 -3
- package/dist/python-src/src/managers/sandbox.py +3 -3
- package/dist/python-src/src/middlewares/dynamic_content.py +2 -2
- package/dist/python-src/src/middlewares/hitl.py +3 -3
- package/dist/python-src/src/middlewares/memory.py +2 -2
- package/dist/python-src/src/middlewares/subagents.py +4 -4
- package/dist/python-src/src/middlewares/summary.py +37 -37
- package/dist/python-src/src/stream/file_write_parser.py +3 -3
- package/dist/python-src/src/stream/formatter.py +19 -19
- package/dist/python-src/src/stream/handler.py +4 -4
- package/dist/python-src/src/stream/handler_with_tracker.py +10 -10
- package/dist/python-src/src/trackers/token/pricing.py +2 -2
- package/dist/python-src/src/trackers/token/report.py +4 -4
- package/dist/python-src/src/trackers/token/tracker.py +8 -8
- package/dist/python-src/src/tui/chatui.py +10 -10
- package/dist/python-src/src/tui/clawtui.py +230 -0
- package/dist/python-src/src/tui/commands/__init__.py +3 -0
- package/dist/python-src/src/tui/commands/base.py +6 -0
- package/dist/python-src/src/tui/commands/instruction.py +5 -0
- package/dist/python-src/src/tui/components/tlist.py +7 -7
- package/dist/python-src/src/tui/components/tscroll_panel.py +73 -44
- package/dist/python-src/src/tui/components/tscroll_panel_old.py +58 -0
- package/dist/python-src/src/tui/utils/trender.py +21 -21
- package/dist/python-src/uv.lock +1969 -1958
- package/package.json +1 -1
package/dist/python-src/.env
CHANGED
|
@@ -4,4 +4,51 @@ uv sync
|
|
|
4
4
|
# 测试子命令
|
|
5
5
|
uv run entry.py hello "TestUser" -b "1990/01/01"
|
|
6
6
|
uv run entry.py calc add 10 20
|
|
7
|
-
uv run entry.py calc average 1 2 3 4 5
|
|
7
|
+
uv run entry.py calc average 1 2 3 4 5
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## run
|
|
12
|
+
|
|
13
|
+
chmod +x run.sh
|
|
14
|
+
alias mini_claw="/Users/brandon/workspace/coder/ai-tcode/tcode/run.sh"
|
|
15
|
+
|
|
16
|
+
$ mini_claw
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
"appId": "cli_a909847e1278dcbd",
|
|
21
|
+
"appSecret": "bE0usuE0MKUJVDWOo9olib5X8PKv66pK",
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
mini_claw --mode claw \
|
|
26
|
+
--app-id "cli_a909847e1278dcbd" \
|
|
27
|
+
--app-secret "bE0usuE0MKUJVDWOo9olib5X8PKv66pK" \
|
|
28
|
+
--api-key "sk-4c9334245f5f4e7aa4009650ef0438b0" \
|
|
29
|
+
--base-url "https://dashscope.aliyuncs.com/compatible-mode/v1" \
|
|
30
|
+
--model "qwen-plus"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
mini_claw --mode claw \
|
|
35
|
+
--app-id cli_a909847e1278dcbd \
|
|
36
|
+
--app-secret bE0usuE0MKUJVDWOo9olib5X8PKv66pK \
|
|
37
|
+
--api-key sk-4c9334245f5f4e7aa4009650ef0438b0 \
|
|
38
|
+
--base-url https://dashscope.aliyuncs.com/compatible-mode/v1 \
|
|
39
|
+
--model qwen-plus
|
|
40
|
+
|
|
41
|
+
tcode --mode claw \
|
|
42
|
+
--app-id cli_a909847e1278dcbd \
|
|
43
|
+
--app-secret bE0usuE0MKUJVDWOo9olib5X8PKv66pK \
|
|
44
|
+
--api-key sk-4c9334245f5f4e7aa4009650ef0438b0 \
|
|
45
|
+
--base-url https://dashscope.aliyuncs.com/compatible-mode/v1 \
|
|
46
|
+
--model qwen-plus
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/app/node_modules/@brandon_9527/tcode/dist/build/linux-arm64/dist/tcode --mode claw \
|
|
50
|
+
--app-id cli_a909847e1278dcbd \
|
|
51
|
+
--app-secret bE0usuE0MKUJVDWOo9olib5X8PKv66pK \
|
|
52
|
+
--api-key sk-4c9334245f5f4e7aa4009650ef0438b0 \
|
|
53
|
+
--base-url https://dashscope.aliyuncs.com/compatible-mode/v1 \
|
|
54
|
+
--model qwen-plus
|
package/dist/python-src/entry.py
CHANGED
|
@@ -37,7 +37,8 @@ from main import (
|
|
|
37
37
|
asingle_agent,
|
|
38
38
|
team_main,
|
|
39
39
|
run_once,
|
|
40
|
-
teminal_chat
|
|
40
|
+
teminal_chat,
|
|
41
|
+
claw_main
|
|
41
42
|
)
|
|
42
43
|
|
|
43
44
|
app = typer.Typer()
|
|
@@ -53,10 +54,27 @@ def root(
|
|
|
53
54
|
mode: str = typer.Option("team", "-m", "--mode", help="运行模式,single或team"),
|
|
54
55
|
# ====================== 新增:接收 max_tokens 参数 ======================
|
|
55
56
|
max_tokens: int = typer.Option(None, "--max-in-tokens", help="覆盖环境变量 MAX_TOKENS_BEFORE_SUMMARY"),
|
|
57
|
+
api_key: str = typer.Option(None, "--api-key", help="llm 服务 API_KEY"),
|
|
58
|
+
base_url:str = typer.Option(None, "--base-url", help="llm 服务 base_url"),
|
|
59
|
+
model: str = typer.Option(None, "--model", help="llm 服务 model"),
|
|
60
|
+
# ====================== 新增:接收 claw 相关参数 ======================
|
|
61
|
+
app_id: str = typer.Option(None, "--app-id", help="claw 服务 app_id"),
|
|
62
|
+
app_secret:str = typer.Option(None, "--app-secret", help="claw 服务 app_secret"),
|
|
63
|
+
|
|
56
64
|
):
|
|
57
65
|
if max_tokens is not None:
|
|
58
66
|
os.environ["MAX_TOKENS_BEFORE_SUMMARY"] = str(max_tokens)
|
|
59
67
|
# print(f"✅ 已强制覆盖 MAX_TOKENS_BEFORE_SUMMARY = {max_tokens}")
|
|
68
|
+
if api_key is not None:
|
|
69
|
+
os.environ["OPENAI_API_KEY"] = api_key
|
|
70
|
+
if base_url is not None:
|
|
71
|
+
os.environ["OPENAI_API_BASE"] = base_url
|
|
72
|
+
if model is not None:
|
|
73
|
+
os.environ["DEFAULT_MODEL"] = model
|
|
74
|
+
if app_id is not None:
|
|
75
|
+
os.environ["APP_ID"] = app_id
|
|
76
|
+
if app_secret is not None:
|
|
77
|
+
os.environ["APP_SECRET"] = app_secret
|
|
60
78
|
|
|
61
79
|
if ctx.invoked_subcommand is None:
|
|
62
80
|
if not prompt:
|
|
@@ -64,6 +82,8 @@ def root(
|
|
|
64
82
|
asyncio.run(asingle_agent())
|
|
65
83
|
elif mode == "team":
|
|
66
84
|
asyncio.run(team_main())
|
|
85
|
+
elif mode == 'claw':
|
|
86
|
+
claw_main()
|
|
67
87
|
|
|
68
88
|
# 同步环境执行异步任务
|
|
69
89
|
asyncio.run(run_once(prompt, verbose))
|