sophhub 0.4.2 → 0.4.4
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/agents/ai-cs-admin/.config.json +6 -1
- package/agents/ai-cs-qa/.config.json +9 -1
- package/agents/ai-cs-qa/AGENTS.md +43 -15
- package/agents/ai-cs-qa/scripts/setup_links.sh +39 -0
- package/agents/vip-admin/.config.json +51 -0
- package/agents/vip-admin/AGENTS.md +331 -0
- package/agents/vip-admin/BOOTSTRAP.md +21 -0
- package/agents/vip-admin/HEARTBEAT.md +19 -0
- package/agents/vip-admin/IDENTITY.md +6 -0
- package/agents/vip-admin/MEMORY.md +29 -0
- package/agents/vip-admin/SOUL.md +25 -0
- package/agents/vip-admin/TOOLS.md +102 -0
- package/agents/vip-admin/USER.md +17 -0
- package/agents/vip-qa/.config.json +58 -0
- package/agents/vip-qa/AGENTS.md +312 -0
- package/agents/vip-qa/BOOTSTRAP.md +74 -0
- package/agents/vip-qa/HEARTBEAT.md +23 -0
- package/agents/vip-qa/IDENTITY.md +6 -0
- package/agents/vip-qa/MEMORY.md +23 -0
- package/agents/vip-qa/SOUL.md +34 -0
- package/agents/vip-qa/TOOLS.md +41 -0
- package/agents/vip-qa/USER.md +16 -0
- package/agents/vip-qa/scripts/setup_links.sh +39 -0
- package/package.json +1 -1
- package/skills/agent-install/skill.json +27 -0
- package/skills/agent-install/src/SKILL.md +238 -0
- package/skills/agent-install/src/pyproject.toml +6 -0
- package/skills/agent-install/src/scripts/backup_agent.py +120 -0
- package/skills/agent-install/src/scripts/check_installed.py +479 -0
- package/skills/agent-install/src/scripts/common.py +487 -0
- package/skills/agent-install/src/scripts/copy_agent_files.py +59 -0
- package/skills/agent-install/src/scripts/list_agents.py +285 -0
- package/skills/agent-install/src/scripts/resolve_install_params.py +90 -0
- package/skills/agent-install/src/scripts/update_agent_md.py +76 -0
- package/skills/agent-install/src/scripts/update_openclaw.py +183 -0
- package/skills/agent-install/src/scripts/verify_download.py +148 -0
- package/skills/bot-api-status/skill.json +36 -0
- package/skills/bot-api-status/src/SKILL.md +89 -0
- package/skills/bot-api-status/src/pyproject.toml +5 -0
- package/skills/bot-api-status/src/scripts/secret.py +481 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
import json
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from common import load_json
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
REQUIRED_FILES = [
|
|
13
|
+
".config.json",
|
|
14
|
+
"AGENTS.md",
|
|
15
|
+
"BOOTSTRAP.md",
|
|
16
|
+
"IDENTITY.md",
|
|
17
|
+
"SOUL.md",
|
|
18
|
+
"TOOLS.md",
|
|
19
|
+
"USER.md",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def inspect_candidate(agent_id: str, directory: Path) -> dict[str, object]:
|
|
24
|
+
config_path = directory / ".config.json"
|
|
25
|
+
if not config_path.is_file():
|
|
26
|
+
return {
|
|
27
|
+
"directory": str(directory),
|
|
28
|
+
"ok": False,
|
|
29
|
+
"reason": "config_missing",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
config = load_json(config_path)
|
|
34
|
+
except Exception as exc: # noqa: BLE001
|
|
35
|
+
return {
|
|
36
|
+
"directory": str(directory),
|
|
37
|
+
"ok": False,
|
|
38
|
+
"reason": "config_invalid",
|
|
39
|
+
"error": str(exc),
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
config_agent_id = config.get("agent_id")
|
|
43
|
+
missing_files = [name for name in REQUIRED_FILES if not (directory / name).is_file()]
|
|
44
|
+
missing_fields = [name for name in ("agent_id", "version", "workspace", "agent_dependencies") if name not in config]
|
|
45
|
+
|
|
46
|
+
if config_agent_id != agent_id:
|
|
47
|
+
return {
|
|
48
|
+
"directory": str(directory),
|
|
49
|
+
"ok": False,
|
|
50
|
+
"reason": "agent_id_mismatch",
|
|
51
|
+
"config_agent_id": config_agent_id,
|
|
52
|
+
"missing_files": missing_files,
|
|
53
|
+
"missing_fields": missing_fields,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if missing_fields:
|
|
57
|
+
return {
|
|
58
|
+
"directory": str(directory),
|
|
59
|
+
"ok": False,
|
|
60
|
+
"reason": "config_fields_missing",
|
|
61
|
+
"config_agent_id": config_agent_id,
|
|
62
|
+
"missing_files": missing_files,
|
|
63
|
+
"missing_fields": missing_fields,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if missing_files:
|
|
67
|
+
return {
|
|
68
|
+
"directory": str(directory),
|
|
69
|
+
"ok": False,
|
|
70
|
+
"reason": "required_files_missing",
|
|
71
|
+
"config_agent_id": config_agent_id,
|
|
72
|
+
"missing_files": missing_files,
|
|
73
|
+
"missing_fields": missing_fields,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
"directory": str(directory),
|
|
78
|
+
"ok": True,
|
|
79
|
+
"reason": "valid",
|
|
80
|
+
"config_agent_id": config_agent_id,
|
|
81
|
+
"version": config.get("version"),
|
|
82
|
+
"workspace": config.get("workspace"),
|
|
83
|
+
"agent_dependencies": config.get("agent_dependencies", []),
|
|
84
|
+
"missing_files": [],
|
|
85
|
+
"missing_fields": [],
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def candidate_directories(download_path: Path, agent_id: str) -> list[Path]:
|
|
90
|
+
candidates = [download_path / agent_id, download_path]
|
|
91
|
+
unique: list[Path] = []
|
|
92
|
+
seen: set[str] = set()
|
|
93
|
+
for candidate in candidates:
|
|
94
|
+
resolved = str(candidate)
|
|
95
|
+
if resolved not in seen:
|
|
96
|
+
unique.append(candidate)
|
|
97
|
+
seen.add(resolved)
|
|
98
|
+
return unique
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def verify_download(agent_id: str, download_path: Path) -> dict[str, object]:
|
|
102
|
+
inspections = []
|
|
103
|
+
for directory in candidate_directories(download_path, agent_id):
|
|
104
|
+
inspections.append(inspect_candidate(agent_id, directory))
|
|
105
|
+
|
|
106
|
+
valid = next((item for item in inspections if item["ok"]), None)
|
|
107
|
+
if valid:
|
|
108
|
+
return {
|
|
109
|
+
"ok": True,
|
|
110
|
+
"agent_id": agent_id,
|
|
111
|
+
"download_path": str(download_path),
|
|
112
|
+
"agent_directory": valid["directory"],
|
|
113
|
+
"version": valid["version"],
|
|
114
|
+
"workspace": valid["workspace"],
|
|
115
|
+
"agent_dependencies": valid["agent_dependencies"],
|
|
116
|
+
"message": "Agent 下载成功,关键配置文件校验通过。",
|
|
117
|
+
"inspections": inspections,
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
first_error = inspections[0] if inspections else {"reason": "unknown"}
|
|
121
|
+
return {
|
|
122
|
+
"ok": False,
|
|
123
|
+
"agent_id": agent_id,
|
|
124
|
+
"download_path": str(download_path),
|
|
125
|
+
"message": "Agent 下载结果校验失败,请检查下载目录和 Agent 包内容。",
|
|
126
|
+
"reason": first_error.get("reason"),
|
|
127
|
+
"inspections": inspections,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def main() -> int:
|
|
132
|
+
parser = argparse.ArgumentParser(description="校验 Agent 下载结果")
|
|
133
|
+
parser.add_argument("--agent-id", required=True, help="Agent ID")
|
|
134
|
+
parser.add_argument(
|
|
135
|
+
"--path",
|
|
136
|
+
required=True,
|
|
137
|
+
help="sophhub agent download 使用的目标目录",
|
|
138
|
+
)
|
|
139
|
+
args = parser.parse_args()
|
|
140
|
+
|
|
141
|
+
result = verify_download(args.agent_id, Path(args.path).expanduser().resolve())
|
|
142
|
+
json.dump(result, sys.stdout, indent=2, ensure_ascii=False)
|
|
143
|
+
sys.stdout.write("\n")
|
|
144
|
+
return 0 if result["ok"] else 1
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
if __name__ == "__main__":
|
|
148
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bot-api-status",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"types": [
|
|
5
|
+
"store"
|
|
6
|
+
],
|
|
7
|
+
"displayName": "BOT-API",
|
|
8
|
+
"description": "查看当前 Agent 的 bot api 状态,同时也支持开启、关闭、重置密钥",
|
|
9
|
+
"changelog": [
|
|
10
|
+
{
|
|
11
|
+
"changes": [
|
|
12
|
+
"修正 SKILL 中 bot-api 链接路径说明(account_id 占位,与脚本一致)",
|
|
13
|
+
"pyproject.toml 中 [project].version 与 skill 版本对齐",
|
|
14
|
+
"统一中文「密钥」用词"
|
|
15
|
+
],
|
|
16
|
+
"date": "2026-04-22",
|
|
17
|
+
"version": "1.0.2"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"changes": [
|
|
21
|
+
"pyproject.toml 中 [project].name 更正为 bot-api-status"
|
|
22
|
+
],
|
|
23
|
+
"date": "2026-04-22",
|
|
24
|
+
"version": "1.0.1"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"changes": [
|
|
28
|
+
"初次提交"
|
|
29
|
+
],
|
|
30
|
+
"date": "2026-04-22",
|
|
31
|
+
"version": "1.0.0"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"createdAt": "2026-04-22",
|
|
35
|
+
"updatedAt": "2026-04-22"
|
|
36
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bot-api-status
|
|
3
|
+
description: 管理当前 Agent 的 bot-api。Use when the user asks to create, delete, query bot-api status or API Secret, or reset bot-api secret for the current Agent.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 当前 Agent 的 Bot API 管理
|
|
7
|
+
|
|
8
|
+
## 用法
|
|
9
|
+
|
|
10
|
+
### 查询
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv run {baseDir}/scripts/secret.py status --json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### 开启
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
uv run {baseDir}/scripts/secret.py create --json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 关闭
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
uv run {baseDir}/scripts/secret.py delete --json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 重置
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uv run {baseDir}/scripts/secret.py reset --json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 输出模板
|
|
35
|
+
|
|
36
|
+
链接形态包含两种:
|
|
37
|
+
|
|
38
|
+
- 非流式:`{{BASEURL}}/bot-api/v2/<account_id>/chat`
|
|
39
|
+
- 流式:`{{BASEURL}}/bot-api/v2/<account_id>/chat-stream`
|
|
40
|
+
|
|
41
|
+
其中 `<account_id>` 与 openclaw 配置里 `channels.bot-api.accounts` 的账号 id 一致。
|
|
42
|
+
|
|
43
|
+
### 查询
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
📋 🤖 bot-api 状态:<🟢 开启 / ⚪ 关闭>
|
|
47
|
+
|
|
48
|
+
🔗 非流式链接:{{BASEURL}}/bot-api/v2/<account_id>/chat
|
|
49
|
+
🔗 流式链接:{{BASEURL}}/bot-api/v2/<account_id>/chat-stream
|
|
50
|
+
🔑 密钥:<api_secret 或 📭 暂无>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 开启
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
✨ 🤖 bot-api 已创建
|
|
57
|
+
|
|
58
|
+
🔗 非流式链接:{{BASEURL}}/bot-api/v2/<account_id>/chat
|
|
59
|
+
🔗 流式链接:{{BASEURL}}/bot-api/v2/<account_id>/chat-stream
|
|
60
|
+
🔑 密钥:<api_secret>
|
|
61
|
+
|
|
62
|
+
🔒 请妥善保管,勿对外转发或截图。
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 关闭
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
🛑 🤖 bot-api 已关闭
|
|
69
|
+
|
|
70
|
+
📴 当前 Agent 不再通过 bot-api 对外提供服务。
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 重置
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
🔄 🤖 bot-api 密钥已更新
|
|
77
|
+
|
|
78
|
+
🔑 新密钥:<new_secret>
|
|
79
|
+
🔗 非流式链接:{{BASEURL}}/bot-api/v2/<account_id>/chat
|
|
80
|
+
🔗 流式链接:{{BASEURL}}/bot-api/v2/<account_id>/chat-stream
|
|
81
|
+
|
|
82
|
+
🔒 请妥善保管,勿对外转发或截图。
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 失败
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
⚠️ 获取BASEURL失败,刷新页面或者重新登录后重试。
|
|
89
|
+
```
|