@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.
Files changed (58) hide show
  1. package/dist/python-src/.env +1 -1
  2. package/dist/python-src/README.md +48 -1
  3. package/dist/python-src/_workspace/.autodev/config.json +12 -0
  4. package/dist/python-src/_workspace/.autodev/cron/jobs.json +4 -0
  5. package/dist/python-src/entry.py +21 -1
  6. package/dist/python-src/main.py +763 -42
  7. package/dist/python-src/pyproject.toml +1 -0
  8. package/dist/python-src/run.sh +9 -0
  9. package/dist/python-src/src/agents/token_tracker.py +4 -4
  10. package/dist/python-src/src/claw/bus/queue.py +1 -1
  11. package/dist/python-src/src/claw/channels/__init__.py +2 -2
  12. package/dist/python-src/src/claw/channels/base.py +2 -2
  13. package/dist/python-src/src/claw/channels/feishu.py +57 -16
  14. package/dist/python-src/src/claw/channels/manager.py +2 -2
  15. package/dist/python-src/src/claw/config/__init__.py +3 -0
  16. package/dist/python-src/src/claw/config/loader.py +38 -0
  17. package/dist/python-src/src/claw/config/schema.py +14 -29
  18. package/dist/python-src/src/claw/cron/__init__.py +3 -0
  19. package/dist/python-src/src/claw/cron/service.py +171 -0
  20. package/dist/python-src/src/claw/cron/types_.py +14 -0
  21. package/dist/python-src/src/claw/heartbeat/__init__.py +2 -0
  22. package/dist/python-src/src/claw/heartbeat/service.py +55 -0
  23. package/dist/python-src/src/claw/run.py +82 -0
  24. package/dist/python-src/src/claw/tools/base.py +23 -0
  25. package/dist/python-src/src/claw/tools/channel.py +0 -0
  26. package/dist/python-src/src/claw/tools/cron.py +138 -0
  27. package/dist/python-src/src/claw/utils/__init__.py +2 -0
  28. package/dist/python-src/src/claw/utils/helpers.py +27 -0
  29. package/dist/python-src/src/core/context.py +158 -0
  30. package/dist/python-src/src/managers/manager_agent.py +9 -9
  31. package/dist/python-src/src/managers/manager_command.py +62 -0
  32. package/dist/python-src/src/managers/manager_context.py +1 -1
  33. package/dist/python-src/src/managers/manager_instruction.py +7 -7
  34. package/dist/python-src/src/managers/manager_skill.py +3 -3
  35. package/dist/python-src/src/managers/sandbox.py +3 -3
  36. package/dist/python-src/src/middlewares/dynamic_content.py +2 -2
  37. package/dist/python-src/src/middlewares/hitl.py +3 -3
  38. package/dist/python-src/src/middlewares/memory.py +2 -2
  39. package/dist/python-src/src/middlewares/subagents.py +4 -4
  40. package/dist/python-src/src/middlewares/summary.py +37 -37
  41. package/dist/python-src/src/stream/file_write_parser.py +3 -3
  42. package/dist/python-src/src/stream/formatter.py +19 -19
  43. package/dist/python-src/src/stream/handler.py +4 -4
  44. package/dist/python-src/src/stream/handler_with_tracker.py +10 -10
  45. package/dist/python-src/src/trackers/token/pricing.py +2 -2
  46. package/dist/python-src/src/trackers/token/report.py +4 -4
  47. package/dist/python-src/src/trackers/token/tracker.py +8 -8
  48. package/dist/python-src/src/tui/chatui.py +10 -10
  49. package/dist/python-src/src/tui/clawtui.py +230 -0
  50. package/dist/python-src/src/tui/commands/__init__.py +3 -0
  51. package/dist/python-src/src/tui/commands/base.py +6 -0
  52. package/dist/python-src/src/tui/commands/instruction.py +5 -0
  53. package/dist/python-src/src/tui/components/tlist.py +7 -7
  54. package/dist/python-src/src/tui/components/tscroll_panel.py +73 -44
  55. package/dist/python-src/src/tui/components/tscroll_panel_old.py +58 -0
  56. package/dist/python-src/src/tui/utils/trender.py +21 -21
  57. package/dist/python-src/uv.lock +1969 -1958
  58. package/package.json +1 -1
@@ -3,4 +3,4 @@ OPENAI_API_KEY=sk-4c9334245f5f4e7aa4009650ef0438b0
3
3
  OPENAI_API_BASE=https://dashscope.aliyuncs.com/compatible-mode/v1
4
4
  DEFAULT_MODEL=qwen-plus
5
5
 
6
- # MAX_TOKENS_BEFORE_SUMMARY=1000000
6
+ MAX_TOKENS_BEFORE_SUMMARY=1000000
@@ -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
@@ -0,0 +1,12 @@
1
+ {
2
+ "channels": {
3
+ "feishu": {
4
+ "enabled": true,
5
+ "appId": "cli_a909847e1278dcbd",
6
+ "appSecret": "bE0usuE0MKUJVDWOo9olib5X8PKv66pK",
7
+ "encryptKey": "",
8
+ "verificationToken": "",
9
+ "allowFrom": []
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": 1,
3
+ "jobs": []
4
+ }
@@ -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))