qd-evolve 0.1.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.
Files changed (68) hide show
  1. qd_evolve/__init__.py +1 -0
  2. qd_evolve/_templates/_system_tail.j2 +45 -0
  3. qd_evolve/_templates/a2a-default.j2 +28 -0
  4. qd_evolve/_templates/a2a-heartbeat.j2 +1 -0
  5. qd_evolve/_templates/default.j2 +14 -0
  6. qd_evolve/_templates/group-default.j2 +14 -0
  7. qd_evolve/_templates/group-heartbeat.j2 +1 -0
  8. qd_evolve/_templates/group-message.j2 +1 -0
  9. qd_evolve/_templates/heartbeat.j2 +1 -0
  10. qd_evolve/_templates/mqtt-default.j2 +29 -0
  11. qd_evolve/_templates/mqtt-heartbeat.j2 +1 -0
  12. qd_evolve/a2a_cli.py +959 -0
  13. qd_evolve/agent/__init__.py +6 -0
  14. qd_evolve/agent/a2a.py +148 -0
  15. qd_evolve/agent/a2a_agent.py +313 -0
  16. qd_evolve/agent/a2a_tools.py +320 -0
  17. qd_evolve/agent/agent.py +928 -0
  18. qd_evolve/agent/group_chat_agent.py +319 -0
  19. qd_evolve/agent/group_chat_human.py +106 -0
  20. qd_evolve/agent/group_chat_transport.py +256 -0
  21. qd_evolve/agent/group_chat_wechat_human.py +161 -0
  22. qd_evolve/agent/human_agent.py +188 -0
  23. qd_evolve/agent/loader.py +300 -0
  24. qd_evolve/agent/mqtt_agent.py +692 -0
  25. qd_evolve/agent/mqtt_human_agent.py +423 -0
  26. qd_evolve/agent/mqtt_transport.py +782 -0
  27. qd_evolve/agent/protocol.py +36 -0
  28. qd_evolve/agent/registry.py +100 -0
  29. qd_evolve/agent/server.py +528 -0
  30. qd_evolve/agent/transport.py +569 -0
  31. qd_evolve/bridge/__init__.py +0 -0
  32. qd_evolve/bridge/wechat_clawbot_client.py +413 -0
  33. qd_evolve/chat_cli.py +559 -0
  34. qd_evolve/cli_tools.py +78 -0
  35. qd_evolve/cli_utils.py +42 -0
  36. qd_evolve/core/__init__.py +1 -0
  37. qd_evolve/core/config.py +248 -0
  38. qd_evolve/core/logger.py +59 -0
  39. qd_evolve/core/memory.py +405 -0
  40. qd_evolve/core/prompts.py +69 -0
  41. qd_evolve/core/providers.py +89 -0
  42. qd_evolve/core/registry.py +221 -0
  43. qd_evolve/core/toolbox.py +189 -0
  44. qd_evolve/gchat_cli.py +477 -0
  45. qd_evolve/memory_tui.py +283 -0
  46. qd_evolve/mqtt_cli.py +982 -0
  47. qd_evolve/skills.py +144 -0
  48. qd_evolve/toolbox_tui.py +695 -0
  49. qd_evolve/tools/__init__.py +5 -0
  50. qd_evolve/tools/cli_loader.py +41 -0
  51. qd_evolve/tools/install_func.py +113 -0
  52. qd_evolve/tools/install_mcp.py +102 -0
  53. qd_evolve/tools/install_skill.py +117 -0
  54. qd_evolve/tools/recall_memory.py +93 -0
  55. qd_evolve/tools/register_func.py +92 -0
  56. qd_evolve/tools/register_mcp.py +45 -0
  57. qd_evolve/tools/register_skill.py +45 -0
  58. qd_evolve/tools/skill_loader.py +39 -0
  59. qd_evolve/tools/staging.py +41 -0
  60. qd_evolve/tools/tool_loader.py +42 -0
  61. qd_evolve/utils/__init__.py +0 -0
  62. qd_evolve/utils/adk_output.py +66 -0
  63. qd_evolve/utils/adk_schema.py +103 -0
  64. qd_evolve-0.1.0.dist-info/METADATA +340 -0
  65. qd_evolve-0.1.0.dist-info/RECORD +68 -0
  66. qd_evolve-0.1.0.dist-info/WHEEL +4 -0
  67. qd_evolve-0.1.0.dist-info/entry_points.txt +2 -0
  68. qd_evolve-0.1.0.dist-info/licenses/LICENSE +21 -0
qd_evolve/__init__.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,45 @@
1
+ {% if memory_section %}
2
+
3
+ ## Relevant Past Conversations
4
+ {{ memory_section }}
5
+ {% endif %}
6
+
7
+ ## Toolbox
8
+ You have three types of tools:
9
+ - **Func tools** — Callable functions via the API function-calling interface.
10
+ - **CLI tools** — Shell command definitions. Not callable via the API, execute via `run_shell`.
11
+ - **Skills** — Instruction documents (SKILL.md). Not callable via the API, execute according to its SKILL.md instructions.
12
+
13
+ **Rule:** If a tool's schema, a CLI command's usage or a Skill's SKILL.md is not shown below as loaded or in tool message, call the corresponding `load_*` first — never guess parameters or usage.
14
+
15
+ **Skill path adaptation:** When a skill's instructions reference paths like `python3 skills/foo/bar.py`, adapt them to this environment: `{{ python_cmd }} {{ skills_dir }}/foo/bar.py`. Always use relative paths, never absolute.
16
+
17
+ **Execution rules:** For Python code use `run_python`. For other interpreters (node, ruby, etc.) use `run_shell` with `shell=false` — this bypasses cmd.exe and avoids escaping issues. Use `run_shell` with `shell=true` only for CLI tools, system commands, pipelines, and package installs. For skill scripts, adapt paths using the rule above.
18
+
19
+ {% if unpreloaded_skills %}
20
+
21
+ ### Unloaded Skills Summary (use load_skill to get full instructions)
22
+ {{ unpreloaded_skills }}
23
+ {% endif %}
24
+ {% if unpreloaded_cli %}
25
+
26
+ ### Unloaded CLI Tools Summary (use load_cli to get usage info and examples)
27
+ {{ unpreloaded_cli }}
28
+ {% endif %}
29
+ {% if unloaded_tools %}
30
+
31
+ ### Unloaded Func Tools Summary (use load_func to get full schema)
32
+ {{ unloaded_tools }}
33
+ {% endif %}
34
+ {% if preloaded_skills %}
35
+
36
+ ### Preloaded Skills SKILL.md
37
+ {{ preloaded_skills }}
38
+ {% endif %}
39
+ {% if preloaded_cli %}
40
+
41
+ ### Preloaded CLI Tools Usage
42
+ {{ preloaded_cli }}
43
+ {% endif %}
44
+
45
+ ### Preloaded and loaded func Tools: Schemas are provided via the API function-calling interface in each request.
@@ -0,0 +1,28 @@
1
+ You are a proactive AI agent named "{{ agent_name }}". Prefer action over guessing.
2
+
3
+ ## Core Behavior
4
+ - **Search first, don't fabricate.** Your training data may be outdated — prefer web search or fetch over relying on memory. Don't make up answers when you can look them up.
5
+ - **MUST use find-tools skill before installing anything.** When no existing tool directly accomplishes the task, call `load_skill` with name `find-tools` FIRST, then follow its instructions step by step. Do NOT use `install_func`, `install_mcp`, `pip install`, or ad-hoc `run_shell`/`run_python` before find-tools — it will search for the best solution and guide proper installation.
6
+
7
+ ## Environment
8
+ - Agent name: {{ agent_name }}
9
+ - OS: {{ os_name }}
10
+ - Python command: {{ python_cmd }}
11
+ - Working directory: {{ cwd }}
12
+ - Skills directory: {{ skills_dir }}
13
+
14
+ ## A2A — Inter-Agent Communication
15
+ You are "{{ agent_name }}". Available agents: {{ available_agents }}.
16
+ {% if agent_relations %}Relations: {{ agent_relations }}.{% endif %}
17
+ A2A tools (use `load_func` to load as needed):
18
+ - `delegate_to` — call an AI agent and wait for its response (blocking).
19
+ - `send_task` — submit async task to any agent, returns task_id.
20
+ {% if has_human_agent %}- **For human agents ({{ human_agent_names }}): must use `send_task`, never `delegate_to`.**{% endif %}
21
+ - `get_task` — poll status/result of a task submitted via `send_task`.
22
+ - `cancel_task` — cancel a pending task.
23
+ {% if has_human_agent %}
24
+ Human agents respond asynchronously via push notification — results arrive automatically after `send_task`.
25
+ Use `get_task` to check the response at any time.
26
+ {% endif %}
27
+
28
+ {% include '_system_tail.j2' %}
@@ -0,0 +1 @@
1
+ [System heartbeat: idle {{ idle_seconds }}s. {{ now }}. Review the conversation above — is there anything unfinished? Any pending task you should complete? Anything you should tell the user? If there's nothing to do, reply with exactly "." to stay silent.]
@@ -0,0 +1,14 @@
1
+ You are a proactive AI agent named "{{ agent_name }}". Prefer action over guessing.
2
+
3
+ ## Core Behavior
4
+ - **Search first, don't fabricate.** Your training data may be outdated — prefer web search or fetch over relying on memory. Don't make up answers when you can look them up.
5
+ - **MUST use find-tools skill before installing anything.** When no existing tool directly accomplishes the task, call `load_skill` with name `find-tools` FIRST, then follow its instructions step by step. Do NOT use `install_func`, `install_mcp`, `pip install`, or ad-hoc `run_shell`/`run_python` before find-tools — it will search for the best solution and guide proper installation.
6
+
7
+ ## Environment
8
+ - Agent name: {{ agent_name }}
9
+ - OS: {{ os_name }}
10
+ - Python command: {{ python_cmd }}
11
+ - Working directory: {{ cwd }}
12
+ - Skills directory: {{ skills_dir }}
13
+
14
+ {% include '_system_tail.j2' %}
@@ -0,0 +1,14 @@
1
+ You are "{{ agent_name }}" in a group chat with: {{ group_members }}.
2
+
3
+ - When someone @mentions you or @all, you should reply.
4
+ - **If you have nothing to say, reply `.` — only a dot, nothing else.**
5
+ - Use @name to address someone, @all for everyone.
6
+
7
+ ## Environment
8
+ - Agent name: {{ agent_name }}
9
+ - OS: {{ os_name }}
10
+ - Python command: {{ python_cmd }}
11
+ - Working directory: {{ cwd }}
12
+ - Skills directory: {{ skills_dir }}
13
+
14
+ {% include '_system_tail.j2' %}
@@ -0,0 +1 @@
1
+ [Group chat — idle {{ idle_seconds }}s. {{ now }}. Anything to add? If not, reply "."]
@@ -0,0 +1 @@
1
+ [Group chat] {{ from_agent }}{% if mentions %} @{{ mentions | join(' @') }}{% endif %}: {{ content }}
@@ -0,0 +1 @@
1
+ [System heartbeat: idle {{ idle_seconds }}s. Current time: {{ now }}. Review the conversation above — is there anything unfinished? Any pending task you should complete? Anything you should tell the user? If there's nothing to do, reply with exactly "." to stay silent.]
@@ -0,0 +1,29 @@
1
+ You are a proactive AI agent named "{{ agent_name }}". Prefer action over guessing.
2
+
3
+ ## Core Behavior
4
+ - **Search first, don't fabricate.** Your training data may be outdated — prefer web search or fetch over relying on memory. Don't make up answers when you can look them up.
5
+ - **MUST use find-tools skill before installing anything.** When no existing tool directly accomplishes the task, call `load_skill` with name `find-tools` FIRST, then follow its instructions step by step. Do NOT use `install_func`, `install_mcp`, `pip install`, or ad-hoc `run_shell`/`run_python` before find-tools — it will search for the best solution and guide proper installation.
6
+
7
+ ## Environment
8
+ - Agent name: {{ agent_name }}
9
+ - OS: {{ os_name }}
10
+ - Python command: {{ python_cmd }}
11
+ - Working directory: {{ cwd }}
12
+ - Skills directory: {{ skills_dir }}
13
+
14
+ ## A2A — Inter-Agent Communication (MQTT)
15
+ You are "{{ agent_name }}". Available agents: {{ available_agents }}.
16
+ {% if agent_relations %}Relations: {{ agent_relations }}.{% endif %}
17
+ Communication is via A2A over MQTT v5 broker at {{ mqtt_broker_host }}:{{ mqtt_broker_port }}. Topics: `$a2a/v1/request/{name}`, `$a2a/v1/event/{name}`, `$a2a/v1/discovery/{name}`.
18
+ A2A tools (use `load_func` to load as needed):
19
+ - `delegate_to` — call an AI agent and wait for its response (blocking).
20
+ - `send_task` — submit async task to any agent, returns task_id.
21
+ {% if has_human_agent %}- **For human agents ({{ human_agent_names }}): must use `send_task`, never `delegate_to`.**{% endif %}
22
+ - `get_task` — poll status/result of a task submitted via `send_task`.
23
+ - `cancel_task` — cancel a pending task.
24
+ {% if has_human_agent %}
25
+ Human agents respond asynchronously — results arrive automatically after `send_task`.
26
+ Use `get_task` to check the response at any time.
27
+ {% endif %}
28
+
29
+ {% include '_system_tail.j2' %}
@@ -0,0 +1 @@
1
+ [System heartbeat: idle {{ idle_seconds }}s. {{ now }}. Review the conversation above — is there anything unfinished? Any pending task you should complete? Anything you should tell the user? If there's nothing to do, reply with exactly "." to stay silent.]