myagent-ai 1.6.7 → 1.7.0

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.
@@ -83,58 +83,85 @@ class MainAgent(BaseAgent):
83
83
  **如果命令执行超时**: 系统会自动将超时信息反馈给你,包含命令已产生的部分输出。
84
84
  你需要分析超时原因并给出改进方案(如优化算法、添加超时参数、分批处理等)。
85
85
 
86
- ## 格式要求
87
- 当你需要执行操作时,输出 JSON 格式:
86
+ ## 输出格式(重要:流式友好)
88
87
 
89
- **step 模式**(默认,逐步执行):
90
- ```json
91
- {
92
- "thought": "说明你当前的分析和下一步计划",
93
- "mode": "step",
94
- "actions": [
95
- {"type": "code", "language": "python", "code": "代码", "timeout_seconds": 60}
96
- ]
97
- }
98
- ```
88
+ **核心原则:先用纯文本说明你的思路,只在执行操作时才输出 JSON。**
89
+
90
+ ### 情况 1:需要执行操作
91
+ 先用纯文本/markdown简要说明你的分析和计划(用户会实时看到),然后用 JSON 输出操作指令:
99
92
 
100
- **batch 模式**(多个独立操作,一次性执行):
101
- ```json
102
- {
103
- "thought": "说明为什么这些操作可以批量执行(互不依赖)",
104
- "mode": "batch",
105
- "actions": [
106
- {"type": "skill", "name": "file_read", "params": {"path": "/a.txt"}},
107
- {"type": "skill", "name": "file_read", "params": {"path": "/b.txt"}}
108
- ]
109
- }
93
+ 让我先检查一下文件内容...
94
+
95
+ ```action
96
+ {"thought": "需要查看文件内容", "mode": "step", "actions": [{"type": "skill", "name": "file_read", "params": {"path": "/a.txt"}}]}
110
97
  ```
111
98
 
112
- 如果不需要执行操作,只是回复用户,输出:
113
- ```json
114
- {
115
- "thought": "你的思考",
116
- "actions": []
117
- }
99
+ ### 情况 2:不需要执行操作
100
+ 直接用纯文本/markdown回复即可,不需要任何 JSON。
101
+
102
+ ### 情况 3:执行完操作后的总结
103
+ 操作完成后,直接用纯文本/markdown总结结果,不要再用 JSON。
104
+
105
+ ### JSON 操作指令格式
106
+ 将 JSON 放在 ```action``` 代码块中,系统会自动识别并执行:
107
+
108
+ **step 模式**(默认,逐步执行):
109
+ ```action
110
+ {"thought": "说明你当前的分析和下一步计划", "mode": "step", "actions": [{"type": "code", "language": "python", "code": "代码", "timeout_seconds": 60}]}
118
111
  ```
119
- 然后在 JSON 外面用 markdown 写你的回复。
120
112
 
121
- 或者直接用纯文本/markdown 回复,不包含 JSON。
113
+ **batch 模式**(多个独立操作):
114
+ ```action
115
+ {"thought": "说明为什么可以批量执行", "mode": "batch", "actions": [{"type": "skill", "name": "file_read", "params": {"path": "/a.txt"}}, {"type": "skill", "name": "file_read", "params": {"path": "/b.txt"}}]}
116
+ ```
122
117
 
123
118
  action type="code" 必须包含 "timeout_seconds" 字段。action type="skill" 或 "memory" 不需要此字段。
124
119
  省略 mode 字段时默认为 "step"。
125
120
 
126
- ## 任务规划模式
127
- 当用户消息中包含"当前任务计划"上下文时,你处于**任务规划模式**。请:
128
- 1. 分析用户需求,评估现有任务的完成状态
129
- 2. 每完成一个任务步骤后,更新任务状态
130
- 3. 在回复末尾用以下格式输出更新后的任务计划:
121
+ **注意**:你也可以直接输出裸 JSON(不用 ```action``` 包裹),系统同样能识别。但推荐使用 ```action``` 格式,这样你的分析文本能实时流式展示给用户。
131
122
 
132
- ## 任务计划
133
- - [ ] 任务描述1
134
- - [x] 已完成的任务
135
- - [ ] 待执行的任务描述2
123
+ ## 执行模式任务追踪(重要:强制 JSON 格式)
136
124
 
137
- 保持任务简洁明确,每个任务一行。
125
+ 当你处于**执行模式**(Execution Mode)时,你**必须**在每次回复中包含一个 JSON 格式的任务进度列表。
126
+ 这个 JSON 必须放在 ```tasklist``` 代码块中,系统会自动解析并实时展示给用户。
127
+
128
+ 格式要求:
129
+ ```tasklist
130
+ [
131
+ {"text": "分析需求", "status": "done"},
132
+ {"text": "检查文件结构", "status": "done"},
133
+ {"text": "修改代码", "status": "running"},
134
+ {"text": "测试验证", "status": "pending"}
135
+ ]
136
+ ```
137
+
138
+ status 取值:
139
+ - `"pending"` — 待执行
140
+ - `"running"` — 正在执行(当前步骤,每次只能有一个)
141
+ - `"done"` — 已完成
142
+ - `"blocked"` — 被阻塞(等待依赖或其他原因)
143
+
144
+ 规则:
145
+ 1. 每次回复开头先用纯文本简要分析当前状态(这段文本会实时流式展示给用户)
146
+ 2. 然后输出 ```tasklist``` 代码块更新任务进度
147
+ 3. 如果需要执行操作,在 tasklist 之后输出 ```action``` 代码块
148
+ 4. 如果不需要执行操作(纯文本回复),在 tasklist 之后直接写总结
149
+ 5. 如果是简单任务(一步完成),也必须输出任务列表(只有一个条目)
150
+ 6. 每次只将一个任务标记为 `running`,其余为 `pending` 或 `done`
151
+ 7. 不要手动输出 markdown 格式的任务列表,只用 JSON 格式
152
+
153
+ 回复结构示例:
154
+ ```
155
+ 让我先检查一下文件内容...
156
+
157
+ ```tasklist
158
+ [{"text": "检查文件内容", "status": "running"}, {"text": "根据结果修改", "status": "pending"}]
159
+ ```
160
+
161
+ ```action
162
+ {"thought": "需要查看文件", "mode": "step", "actions": [{"type": "skill", "name": "file_read", "params": {"path": "/a.txt"}}]}
163
+ ```
164
+ ```
138
165
 
139
166
  ## 重要规则
140
167
  - 优先使用技能系统完成操作,而不是直接写代码
@@ -460,6 +460,7 @@ class DepartmentManager:
460
460
  except (json.JSONDecodeError, IOError):
461
461
  continue
462
462
 
463
+ agents_list = meta.get("agents", [])
463
464
  child_path = f"{path}/{d.name}" if path else d.name
464
465
  children.append({
465
466
  "path": child_path,
@@ -467,7 +468,8 @@ class DepartmentManager:
467
468
  "emoji": meta.get("emoji", ""),
468
469
  "description": meta.get("description", ""),
469
470
  "head": meta.get("head", ""),
470
- "agent_count": len(meta.get("agents", [])),
471
+ "agents": agents_list,
472
+ "agent_count": len(agents_list),
471
473
  "chat_group_id": meta.get("chat_group_id", ""),
472
474
  "created_at": meta.get("created_at", ""),
473
475
  "updated_at": meta.get("updated_at", ""),
@@ -812,4 +812,4 @@ Web 管理后台包含以下功能模块:
812
812
 
813
813
  ### 聊天界面
814
814
 
815
- 除了管理后台,MyAgent 还提供了一个独立的聊天界面,访问地址为 `http://127.0.0.1:8765/ui/chat.html`。聊天界面提供与 CLI 模式相同的对话功能,但拥有更丰富的界面展示(如 Markdown 渲染、代码高亮、执行结果展示等),适合需要可视化交互的场景。
815
+ 除了管理后台,MyAgent 还提供了一个独立的聊天界面,访问地址为 `http://127.0.0.1:8765/ui/chat/chat_container.html`。聊天界面提供与 CLI 模式相同的对话功能,但拥有更丰富的界面展示(如 Markdown 渲染、代码高亮、执行结果展示等),适合需要可视化交互的场景。
package/main.py CHANGED
@@ -59,6 +59,7 @@ def _open_browser_kiosk(url: str):
59
59
  args=[
60
60
  "--no-sandbox",
61
61
  f"--app={url}", # app 模式: 无地址栏、无标签页
62
+ "--start-maximized",
62
63
  ],
63
64
  )
64
65
  # 保持进程运行,浏览器关闭后退出
@@ -804,7 +805,7 @@ def create_tray_icon(app: MyAgentApp, web_port: int = 8767):
804
805
  _open_browser_kiosk(f"http://127.0.0.1:{web_port}/ui/")
805
806
 
806
807
  def open_chat_ui(icon, item):
807
- _open_browser_kiosk(f"http://127.0.0.1:{web_port}/ui/chat.html")
808
+ _open_browser_kiosk(f"http://127.0.0.1:{web_port}/ui/chat/chat_container.html")
808
809
 
809
810
  def open_logs(icon, item):
810
811
  _open_path(str(app.config_mgr.logs_dir))
@@ -977,7 +978,7 @@ def run_with_tray(app: MyAgentApp, web_port: int = 8767):
977
978
 
978
979
  tray_thread = threading.Thread(target=_tray_run, daemon=True)
979
980
  tray_thread.start()
980
- app.logger.info(f"系统托盘已启动 (聊天: http://127.0.0.1:{web_port}/ui/chat.html)")
981
+ app.logger.info(f"系统托盘已启动 (聊天: http://127.0.0.1:{web_port}/ui/chat/chat_container.html)")
981
982
 
982
983
  # 启动完成通知
983
984
  _tray_notify(app, "MyAgent 已启动", f"v{get_version()} | 端口: {web_port}")
@@ -1520,7 +1521,7 @@ def main():
1520
1521
  # 非 tray 模式(纯 web 模式)自动打开浏览器
1521
1522
  if not args.tray:
1522
1523
  try:
1523
- _open_browser_kiosk(f"http://127.0.0.1:{web_port}/ui/chat.html")
1524
+ _open_browser_kiosk(f"http://127.0.0.1:{web_port}/ui/chat/chat_container.html")
1524
1525
  except Exception:
1525
1526
  pass
1526
1527
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.6.7",
3
+ "version": "1.7.0",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
@@ -0,0 +1,33 @@
1
+ # Example Skill
2
+
3
+ A demonstration skill showing the SKILL.md format used by GLM Agent Engine.
4
+
5
+ ## Description
6
+
7
+ This is an example skill that demonstrates the expected structure and format for skills in the GLM Agent ecosystem. Skills are self-contained modules that extend the agent's capabilities with specialized functionality.
8
+
9
+ ## Capability
10
+
11
+ The agent can invoke this skill when users need demonstration or testing of the skill system. It serves as both documentation and a working example for skill developers.
12
+
13
+ ## Instructions
14
+
15
+ When this skill is loaded, the agent should:
16
+ 1. Acknowledge that the example skill has been invoked
17
+ 2. Explain the skill system architecture to the user
18
+ 3. Guide the user on how to create their own custom skills
19
+
20
+ ## Skill Structure
21
+
22
+ Each skill should contain:
23
+ - `SKILL.md` - This metadata file (required)
24
+ - Supporting scripts, configs, or data files as needed
25
+ - Any language-specific setup (package.json, requirements.txt, etc.)
26
+
27
+ ## Creating Custom Skills
28
+
29
+ To create a new skill:
30
+ 1. Create a directory under `/home/z/my-project/skills/`
31
+ 2. Add a `SKILL.md` file with proper metadata
32
+ 3. Include any necessary scripts or configurations
33
+ 4. The skill will be automatically detected by the agent engine
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+ # Example skill execution script
3
+ # This demonstrates how skills can include executable logic
4
+
5
+ echo "Example Skill executed at: $(date)"
6
+ echo "Arguments: $@"
7
+ echo "Project directory: ${CLAWHUB_WORKDIR:-/home/z/my-project}"
8
+
9
+ # Your skill logic goes here
10
+ # Exit 0 for success, non-zero for failure
11
+ exit 0