evolclaw 3.0.0 → 3.1.1
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/README.md +1 -1
- package/bin/ec.js +29 -0
- package/dist/agents/baseagent-normalize.js +19 -0
- package/dist/agents/claude-runner.js +47 -12
- package/dist/agents/codex-runner.js +2 -0
- package/dist/agents/gemini-runner.js +9 -9
- package/dist/agents/kit-renderer.js +281 -0
- package/dist/aun/aid/identity.js +28 -0
- package/dist/aun/aid/index.js +1 -1
- package/dist/aun/aid/lifecycle-log.js +33 -0
- package/dist/aun/msg/group.js +3 -1
- package/dist/aun/msg/p2p.js +42 -1
- package/dist/channels/aun.js +427 -146
- package/dist/channels/dingtalk.js +3 -1
- package/dist/channels/feishu.js +128 -7
- package/dist/channels/qqbot.js +3 -1
- package/dist/channels/wechat.js +4 -1
- package/dist/channels/wecom.js +3 -1
- package/dist/cli/bench.js +1219 -0
- package/dist/cli/index.js +418 -40
- package/dist/cli/init.js +3 -4
- package/dist/cli/link-rules.js +245 -0
- package/dist/cli/net-check.js +640 -0
- package/dist/cli/watch-msg.js +666 -0
- package/dist/config-store.js +82 -5
- package/dist/core/channel-loader.js +23 -10
- package/dist/core/command-handler.js +127 -99
- package/dist/core/evolagent.js +5 -10
- package/dist/core/message/im-renderer.js +93 -48
- package/dist/core/message/items-formatter.js +11 -4
- package/dist/core/message/message-bridge.js +11 -2
- package/dist/core/message/message-log.js +8 -1
- package/dist/core/message/message-processor.js +194 -127
- package/dist/core/message/message-queue.js +10 -3
- package/dist/core/permission.js +95 -3
- package/dist/core/relation/peer-identity.js +161 -0
- package/dist/core/session/session-manager.js +103 -65
- package/dist/core/trigger/manager.js +16 -0
- package/dist/core/trigger/parser.js +110 -0
- package/dist/core/trigger/scheduler.js +7 -1
- package/dist/data/error-dict.json +118 -0
- package/dist/eck/baseagent-caps.js +18 -0
- package/dist/eck/detect.js +47 -0
- package/dist/eck/init.js +77 -0
- package/dist/eck/rules-loader.js +28 -0
- package/dist/index.js +186 -19
- package/dist/net-check.js +640 -0
- package/dist/paths.js +31 -40
- package/dist/utils/aid-lifecycle-log.js +33 -0
- package/dist/utils/atomic-write.js +10 -0
- package/dist/utils/cross-platform.js +17 -8
- package/dist/utils/error-utils.js +27 -15
- package/dist/utils/instance-registry.js +6 -5
- package/dist/utils/log-writer.js +2 -1
- package/dist/utils/logger.js +10 -0
- package/dist/utils/npm-ops.js +35 -3
- package/dist/utils/process-introspect.js +16 -38
- package/dist/utils/stats.js +216 -2
- package/dist/watch-msg.js +26 -11
- package/evolclaw-install-aun.md +14 -2
- package/kits/docs/GUIDE.md +20 -0
- package/kits/docs/INDEX.md +52 -0
- package/kits/docs/aun/CHEATSHEET.md +17 -0
- package/kits/docs/aun/SYNC_PROTOCOL.md +15 -0
- package/kits/docs/channels/feishu.md +27 -0
- package/kits/docs/eck_templates/GUIDE.template.md +22 -0
- package/kits/docs/eck_templates/INDEX.template.md +28 -0
- package/kits/docs/eck_templates/path-registry.template.md +33 -0
- package/kits/docs/eck_templates/runtime.template.md +19 -0
- package/kits/docs/evolclaw/MSG_GROUP.md +30 -0
- package/kits/docs/evolclaw/MSG_PRIVATE.md +72 -0
- package/kits/docs/identity/AID_PROFILE_SPEC.md +27 -0
- package/kits/docs/identity/PATH_OPS.md +16 -0
- package/kits/docs/identity/ROLE_DETAIL.md +20 -0
- package/kits/docs/path-registry.md +43 -0
- package/kits/eck_manifest.json +95 -0
- package/kits/rules/01-overview.md +120 -0
- package/kits/rules/02-navigation.md +75 -0
- package/kits/rules/03-identity.md +34 -0
- package/kits/rules/04-relation.md +49 -0
- package/kits/rules/05-venue.md +45 -0
- package/kits/rules/06-channel.md +73 -0
- package/kits/templates/system-fragments/baseagent.md +2 -0
- package/kits/templates/system-fragments/channel.md +10 -0
- package/kits/templates/system-fragments/identity.md +12 -0
- package/kits/templates/system-fragments/relation.md +9 -0
- package/kits/templates/system-fragments/runtime.md +19 -0
- package/kits/templates/system-fragments/venue.md +5 -0
- package/package.json +7 -5
- package/dist/agents/templates.js +0 -122
- package/dist/data/prompts.md +0 -137
- package/kits/aun/meta.md +0 -25
- package/kits/aun/role.md +0 -25
- package/kits/templates/group.md +0 -20
- package/kits/templates/private.md +0 -9
- package/kits/templates/system-fragments/personal-context.md +0 -3
- package/kits/templates/system-fragments/self-intro.md +0 -5
- package/kits/templates/system-fragments/speaker-intro.md +0 -5
- package/kits/templates/system-fragments/venue-intro.md +0 -5
- /package/kits/{channels → docs/channels}/aun.md +0 -0
- /package/kits/{evolclaw/commands.md → docs/evolclaw/AGENT_CMD.md} +0 -0
- /package/kits/{evolclaw → docs/evolclaw}/self-summary.md +0 -0
- /package/kits/{evolclaw → docs/evolclaw}/tools.md +0 -0
- /package/kits/{evolclaw → docs/identity}/identity-tools.md +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# 渠道层:我通过什么通信
|
|
2
|
+
|
|
3
|
+
渠道层决定你使用什么方式收发消息。动态注入的 `$CHANNEL_TYPE` 标识当前渠道。
|
|
4
|
+
|
|
5
|
+
## 数据位置
|
|
6
|
+
|
|
7
|
+
| 位置 | 内容 |
|
|
8
|
+
|------|------|
|
|
9
|
+
| `$KITS_DOCS/channels/` | 各渠道的使用手册(只读,按需加载) |
|
|
10
|
+
| `$AGENT_DIR/channels/` | 各渠道的运行时数据(可写) |
|
|
11
|
+
|
|
12
|
+
## 通信规则
|
|
13
|
+
|
|
14
|
+
与其他主体通信时,**必须调用 CLI 命令**发消息,不要把输出当成发送给对方的内容。
|
|
15
|
+
|
|
16
|
+
### 必须使用 `ec msg send`(首选)
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 明文
|
|
20
|
+
ec msg send <self-aid> <to-aid> "<text>"
|
|
21
|
+
|
|
22
|
+
# 密文
|
|
23
|
+
ec msg send <self-aid> <to-aid> "<text>" --encrypt
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`<self-aid>` 是注入上下文里的 selfAid,`<to-aid>` 是 peerKey 解析出的对端 AID。
|
|
27
|
+
|
|
28
|
+
### 仅在无法获取 selfAid 时才用 `ec ctl send`
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
ec ctl send "<text>"
|
|
32
|
+
ec ctl send --encrypt "<text>"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 加密策略
|
|
36
|
+
|
|
37
|
+
对端发来密文消息时回复必须加密;明文消息默认明文回复。
|
|
38
|
+
|
|
39
|
+
### 命令返回值
|
|
40
|
+
|
|
41
|
+
- 成功:`ok` 或包含 `✓ 已发送 ...` 的输出(exit 0)
|
|
42
|
+
- 失败:`✗ ...` 错误信息(exit 非零)
|
|
43
|
+
|
|
44
|
+
发送成功后**继续后续处理**。一次任务可能发 0 到多条消息,不要因为看到"已发送"就反复发送同一条消息。
|
|
45
|
+
|
|
46
|
+
不同渠道有不同的命令行工具,使用方式参见各渠道文档。
|
|
47
|
+
|
|
48
|
+
## Agent 管理命令
|
|
49
|
+
|
|
50
|
+
`evolclaw agent` — agent 全生命周期管理。
|
|
51
|
+
|
|
52
|
+
触发词:创建/新建/初始化、列出/查看、启用/禁用/删除、热重载、修改配置。
|
|
53
|
+
|
|
54
|
+
详细参考:Read `$KITS_DOCS/evolclaw/AGENT_CMD.md`
|
|
55
|
+
|
|
56
|
+
## 消息命令
|
|
57
|
+
|
|
58
|
+
`evolclaw msg` / `evolclaw group` — 通信 CLI。
|
|
59
|
+
|
|
60
|
+
| 聊天类型 | 详细文档 |
|
|
61
|
+
|----------|----------|
|
|
62
|
+
| private | `$KITS_DOCS/evolclaw/MSG_PRIVATE.md` |
|
|
63
|
+
| group | `$KITS_DOCS/evolclaw/MSG_GROUP.md` |
|
|
64
|
+
|
|
65
|
+
共同约定:
|
|
66
|
+
- 以自己的 AID 为发送者
|
|
67
|
+
- 必须使用 CLI,不要在当前会话里直接输出对外消息
|
|
68
|
+
- `--format json` 所有命令通用
|
|
69
|
+
- `--app <name>` 指定应用 slot
|
|
70
|
+
|
|
71
|
+
## 各渠道文档
|
|
72
|
+
|
|
73
|
+
不同渠道的详细通信规则和命令工具使用方式:Read `$KITS_DOCS/channels/` 中的对应文档。
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[运行时]
|
|
2
|
+
项目:{{project}}
|
|
3
|
+
{{?sessionName}}
|
|
4
|
+
会话名称:{{sessionName}}
|
|
5
|
+
{{/}}
|
|
6
|
+
|
|
7
|
+
会话模式:{{sessionMode}}
|
|
8
|
+
|
|
9
|
+
{{?readonly}}
|
|
10
|
+
⚠️ 只读模式:禁止修改项目文件。如需生成文件供用户下载,请写入 .evolclaw/tmp/ 目录。
|
|
11
|
+
{{/}}
|
|
12
|
+
|
|
13
|
+
{{?sessionMode=proactive}}
|
|
14
|
+
[Proactive 模式] 你的所有文本输出都会被静默丢弃,用户永远看不到。唯一能让用户收到消息的方式:
|
|
15
|
+
调用 Bash 工具执行命令:evolclaw ctl send "<消息内容>"
|
|
16
|
+
发送文件:evolclaw ctl file <路径>
|
|
17
|
+
可多次调用发送多条消息,如果不想回复停止调用即可。
|
|
18
|
+
禁止使用 AskUserQuestion 和 ExitPlanMode 工具——proactive 模式下应由你主动用 ctl send 与用户沟通。
|
|
19
|
+
{{/}}
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "evolclaw",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Lightweight AI Agent gateway connecting Claude Agent SDK to messaging channels (Feishu, ACP) with multi-project session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"evolclaw": "./dist/cli/index.js"
|
|
8
|
+
"evolclaw": "./dist/cli/index.js",
|
|
9
|
+
"ec": "./bin/ec.js"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
11
12
|
"dist/",
|
|
13
|
+
"bin/",
|
|
12
14
|
"!dist/experimental/",
|
|
13
15
|
"kits/",
|
|
14
16
|
"!kits/.kits-version",
|
|
@@ -16,15 +18,15 @@
|
|
|
16
18
|
],
|
|
17
19
|
"scripts": {
|
|
18
20
|
"dev": "tsx watch src/index.ts",
|
|
19
|
-
"build": "tsc && node -e \"const f='dist/cli/index.js',c=require('fs').readFileSync(f,'utf8');if(!c.startsWith('#!'))require('fs').writeFileSync(f,'#!/usr/bin/env node\\n'+c)\" && node -e \"try{require('child_process').execFileSync('chmod',['+x','dist/cli/index.js'])}catch{}\" && node -e \"require('fs').mkdirSync('dist/data',{recursive:true});require('fs').copyFileSync('src/data/
|
|
21
|
+
"build": "tsc && node -e \"const f='dist/cli/index.js',c=require('fs').readFileSync(f,'utf8');if(!c.startsWith('#!'))require('fs').writeFileSync(f,'#!/usr/bin/env node\\n'+c)\" && node -e \"try{require('child_process').execFileSync('chmod',['+x','dist/cli/index.js'])}catch{}\" && node -e \"require('fs').mkdirSync('dist/data',{recursive:true});require('fs').copyFileSync('src/data/error-dict.json','dist/data/error-dict.json')\"",
|
|
20
22
|
"start": "node dist/index.js",
|
|
21
|
-
"test": "vitest run",
|
|
23
|
+
"test": "flock --nonblock /tmp/evolclaw-test.lock vitest run || { echo '\\n[ERROR] Another vitest instance is already running. Wait or kill it first.' >&2; exit 1; }",
|
|
22
24
|
"test:watch": "vitest",
|
|
23
25
|
"test:hooks": "tsx test-sdk-hooks.ts",
|
|
24
26
|
"prepublishOnly": "npm run build && npm test"
|
|
25
27
|
},
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"@agentunion/fastaun": "^0.2
|
|
29
|
+
"@agentunion/fastaun": "^0.3.2",
|
|
28
30
|
"@anthropic-ai/claude-agent-sdk": "^0.2.100",
|
|
29
31
|
"cron-parser": "^5.5.0",
|
|
30
32
|
"image-type": "^6.0.0",
|
package/dist/agents/templates.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { getPackageRoot, resolveRoot } from '../paths.js';
|
|
4
|
-
import { logger } from '../utils/logger.js';
|
|
5
|
-
const KNOWN_SECTIONS = new Set(['runtime', 'group', 'proactive', 'trigger']);
|
|
6
|
-
const SECTION_RE = /^##\s+(\w+)\s*$/;
|
|
7
|
-
let sections = null;
|
|
8
|
-
let builtinSections = null;
|
|
9
|
-
function parseTemplate(content) {
|
|
10
|
-
const result = new Map();
|
|
11
|
-
let currentSection = null;
|
|
12
|
-
let currentLines = [];
|
|
13
|
-
for (const line of content.split('\n')) {
|
|
14
|
-
// Stop parsing at horizontal rule separator (documentation follows)
|
|
15
|
-
if (/^---\s*$/.test(line)) {
|
|
16
|
-
if (currentSection) {
|
|
17
|
-
result.set(currentSection, currentLines.join('\n').trim());
|
|
18
|
-
}
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
const m = line.match(SECTION_RE);
|
|
22
|
-
if (m) {
|
|
23
|
-
if (currentSection) {
|
|
24
|
-
result.set(currentSection, currentLines.join('\n').trim());
|
|
25
|
-
}
|
|
26
|
-
const name = m[1];
|
|
27
|
-
if (KNOWN_SECTIONS.has(name)) {
|
|
28
|
-
currentSection = name;
|
|
29
|
-
currentLines = [];
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
currentSection = null;
|
|
33
|
-
currentLines = [];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else if (currentSection) {
|
|
37
|
-
currentLines.push(line);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (currentSection) {
|
|
41
|
-
result.set(currentSection, currentLines.join('\n').trim());
|
|
42
|
-
}
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
function loadBuiltinTemplate() {
|
|
46
|
-
const builtinPath = path.join(getPackageRoot(), 'dist', 'data', 'prompts.md');
|
|
47
|
-
const srcPath = path.join(getPackageRoot(), 'src', 'data', 'prompts.md');
|
|
48
|
-
const filePath = fs.existsSync(builtinPath) ? builtinPath : srcPath;
|
|
49
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
50
|
-
return parseTemplate(content);
|
|
51
|
-
}
|
|
52
|
-
export function loadPromptTemplates() {
|
|
53
|
-
builtinSections = loadBuiltinTemplate();
|
|
54
|
-
const userPath = path.join(resolveRoot(), 'data', 'prompts.md');
|
|
55
|
-
if (fs.existsSync(userPath)) {
|
|
56
|
-
try {
|
|
57
|
-
const content = fs.readFileSync(userPath, 'utf-8');
|
|
58
|
-
const parsed = parseTemplate(content);
|
|
59
|
-
sections = new Map(builtinSections);
|
|
60
|
-
for (const [key, value] of parsed) {
|
|
61
|
-
sections.set(key, value);
|
|
62
|
-
}
|
|
63
|
-
logger.info(`[PromptTemplates] Loaded user override: ${userPath}`);
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
logger.warn(`[PromptTemplates] Failed to load user override (${userPath}), using builtin:`, err);
|
|
67
|
-
sections = builtinSections;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
sections = builtinSections;
|
|
72
|
-
logger.info(`[PromptTemplates] Using builtin templates`);
|
|
73
|
-
}
|
|
74
|
-
for (const name of KNOWN_SECTIONS) {
|
|
75
|
-
if (!sections.has(name)) {
|
|
76
|
-
logger.warn(`[PromptTemplates] Section "${name}" missing, using builtin fallback`);
|
|
77
|
-
const fallback = builtinSections.get(name);
|
|
78
|
-
if (fallback)
|
|
79
|
-
sections.set(name, fallback);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function isTruthy(val) {
|
|
84
|
-
if (val === undefined || val === null || val === false || val === '' || val === 0)
|
|
85
|
-
return false;
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
function renderTemplate(template, vars) {
|
|
89
|
-
// Pass 1: conditional sections {{?key}}...{{/}}
|
|
90
|
-
let result = template.replace(/\{\{\?(\w+)\}\}([\s\S]*?)\{\{\/\}\}/g, (_match, key, body) => {
|
|
91
|
-
return isTruthy(vars[key]) ? body : '';
|
|
92
|
-
});
|
|
93
|
-
// Pass 2: variable substitution {{key}}
|
|
94
|
-
result = result.replace(/\{\{(\w+)\}\}/g, (_match, key) => {
|
|
95
|
-
const val = vars[key];
|
|
96
|
-
if (!isTruthy(val))
|
|
97
|
-
return '';
|
|
98
|
-
return String(val);
|
|
99
|
-
});
|
|
100
|
-
// Pass 3: remove blank lines
|
|
101
|
-
return result.split('\n').filter(line => line.trim() !== '').join('\n');
|
|
102
|
-
}
|
|
103
|
-
export function renderPromptSection(section, vars) {
|
|
104
|
-
if (!sections)
|
|
105
|
-
loadPromptTemplates();
|
|
106
|
-
const template = sections.get(section);
|
|
107
|
-
if (!template) {
|
|
108
|
-
logger.warn(`[PromptTemplates] Section "${section}" not found`);
|
|
109
|
-
return '';
|
|
110
|
-
}
|
|
111
|
-
return renderTemplate(template, vars);
|
|
112
|
-
}
|
|
113
|
-
/** Reset loaded templates (for testing) */
|
|
114
|
-
export function _resetTemplates() {
|
|
115
|
-
sections = null;
|
|
116
|
-
builtinSections = null;
|
|
117
|
-
}
|
|
118
|
-
/** Load templates from a raw string (for testing) */
|
|
119
|
-
export function _loadFromString(content) {
|
|
120
|
-
builtinSections = parseTemplate(content);
|
|
121
|
-
sections = builtinSections;
|
|
122
|
-
}
|
package/dist/data/prompts.md
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# EvolClaw 运行时系统提示模板
|
|
2
|
-
|
|
3
|
-
# 本文件定义 LLM 每次收到消息时注入到 system prompt 尾部的三段内容。
|
|
4
|
-
# 修改后执行 `evolclaw restart` 生效。
|
|
5
|
-
# 放在 {EVOLCLAW_HOME}/data/prompts.md 会覆盖内置默认。
|
|
6
|
-
|
|
7
|
-
## runtime
|
|
8
|
-
|
|
9
|
-
[当前环境] 会话通道: {{channel}} | 当前项目: {{project}}{{?sessionName}} | 会话名称: {{sessionName}}{{/}}{{?selfIdentity}} | 当前名称: {{selfIdentity}}{{/}} | 对端身份: {{peerRole}}{{?peerIdentity}} | 对端名称: {{peerIdentity}}{{/}}{{?peerType}} | 对端类型: {{peerType}}{{/}}{{?chatType}} | 聊天类型: {{chatType}}{{/}}{{?agent}} | 当前Agent: {{agent}}{{/}}
|
|
10
|
-
{{?readonly}}[只读模式] 禁止修改项目文件。如需生成文件供用户下载,请写入 .evolclaw/tmp/ 目录后{{readonlySendHint}}{{/}}
|
|
11
|
-
{{?fileSendCurrent}}[SEND_FILE:路径] 发送文件到当前通道{{/}}
|
|
12
|
-
{{?fileSendCross}}[SEND_FILE:{{crossPrimary}}:路径] 发送文件到指定通道(可用: {{crossTypes}}){{/}}
|
|
13
|
-
{{?capability}}[通道能力] {{capabilities}}{{/}}
|
|
14
|
-
|
|
15
|
-
## group
|
|
16
|
-
|
|
17
|
-
[群聊回复规则] 回复时必须在开头添加 @{{peerId}} 来通知对方
|
|
18
|
-
|
|
19
|
-
## proactive
|
|
20
|
-
|
|
21
|
-
[Proactive 模式] 你的所有文本输出都会被静默丢弃,用户永远看不到。唯一能让用户收到消息的方式:
|
|
22
|
-
调用 Bash 工具执行命令 :evolclaw ctl send "<消息内容>"
|
|
23
|
-
发送文件: evolclaw ctl file <路径>
|
|
24
|
-
可多次调用发送多条消息 ,如果不想回复停止调用即可。
|
|
25
|
-
禁止使用 AskUserQuestion 和 ExitPlanMode 工具——proactive 模式下应由你主动用 ctl send 与用户沟通。
|
|
26
|
-
|
|
27
|
-
## trigger
|
|
28
|
-
|
|
29
|
-
[触发器] 你可以通过 /trigger 命令设置延迟或定时任务,系统会在指定时间重新激活你执行任务。
|
|
30
|
-
|
|
31
|
-
注册触发器:
|
|
32
|
-
/trigger set --delay <时长> --prompt "<任务内容>" 延迟执行,如 30m、2h、1d
|
|
33
|
-
/trigger set --at <ISO时间> --prompt "<任务内容>" 指定时刻,如 2026-05-15T09:00
|
|
34
|
-
/trigger set --cron <表达式> --prompt "<任务内容>" 周期执行,如 "0 9 * * *"
|
|
35
|
-
|
|
36
|
-
定位参数(默认当前上下文):
|
|
37
|
-
--channel <实例名> 目标通道实例
|
|
38
|
-
--channelid <id> 目标对话 ID
|
|
39
|
-
--thread <id> 目标 thread(与 --session 互斥,需通道支持)
|
|
40
|
-
--session latest 续接最后活跃会话(默认,用户可见输出)
|
|
41
|
-
--session silent 新建独立会话静默执行(不打扰用户,适合后台任务)
|
|
42
|
-
|
|
43
|
-
其他参数:
|
|
44
|
-
--name <标识> 触发器名称(默认自动生成)
|
|
45
|
-
--agent <名称> 目标 agent(默认当前)
|
|
46
|
-
|
|
47
|
-
管理:
|
|
48
|
-
/trigger 查看活跃触发器
|
|
49
|
-
/trigger list 查看所有触发器(含历史)
|
|
50
|
-
/trigger cancel <名称> 取消触发器
|
|
51
|
-
|
|
52
|
-
使用原则:
|
|
53
|
-
- 用户要求"稍后/明天/定时"做某事时使用
|
|
54
|
-
- 你判断某任务需要延迟到特定时刻才合适时主动使用
|
|
55
|
-
- silent 适合:清理、扫描、生成文件等后台任务
|
|
56
|
-
- latest 适合:提醒用户、跟进对话、结果需要用户看到
|
|
57
|
-
- 触发器不支持修改,改内容请 cancel 后重建
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## 格式说明
|
|
63
|
-
|
|
64
|
-
模板由多个以 `## 段名` 分隔的段组成,加载器只识别 `runtime`、`group`、`proactive`、`trigger` 四段,其它段(包括本说明)会被忽略,可以随意增删。
|
|
65
|
-
|
|
66
|
-
**占位符语法:**
|
|
67
|
-
|
|
68
|
-
| 语法 | 作用 | 示例 |
|
|
69
|
-
|---|---|---|
|
|
70
|
-
| `{{var}}` | 变量替换。值为空串/undefined/null/false 时替换为空 | `{{project}}` → `evolclaw` |
|
|
71
|
-
| `{{?var}}...{{/}}` | 条件段。var 为真值时保留整段(含字面量),否则整段删除。段内可嵌套 `{{var}}` | `{{?peerId}} | @{{peerId}}{{/}}` |
|
|
72
|
-
| 空行 | 渲染后若某行只剩空白,整行自动删除 | 条件段删完后的空行会消失 |
|
|
73
|
-
|
|
74
|
-
**注入时机:**
|
|
75
|
-
|
|
76
|
-
| 段 | 触发条件 | 说明 |
|
|
77
|
-
|---|---|---|
|
|
78
|
-
| `runtime` | 每次消息 | 每条用户消息都会注入 |
|
|
79
|
-
| `group` | `chatType === 'group' && peerId` | 仅群聊消息注入 |
|
|
80
|
-
| `proactive` | `sessionMode === 'proactive'` | 仅 proactive 会话注入 |
|
|
81
|
-
| `trigger` | 非触发器来源的消息 | 让 AI 知道可以使用 /trigger 命令 |
|
|
82
|
-
|
|
83
|
-
三段以换行拼接,追加到该消息的 system prompt 末尾。
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## 参数说明
|
|
88
|
-
|
|
89
|
-
### runtime 段
|
|
90
|
-
|
|
91
|
-
| 字段 | 类型 | 说明 | 示例 |
|
|
92
|
-
|---|---|---|---|
|
|
93
|
-
| `channel` | string | 当前通道类型 | `feishu` / `wechat` / `aun` |
|
|
94
|
-
| `project` | string | 当前项目目录名(非完整路径) | `evolclaw` |
|
|
95
|
-
| `sessionName` | string? | 会话名(用户通过 `/name` 设置) | `CLI开发` |
|
|
96
|
-
| `selfIdentity` | string? | 机器人自身标识「名称 (ID)」 | `Evol (evolai.xxx.pub)` |
|
|
97
|
-
| `peerRole` | string | 对端角色 | `owner` / `admin` / `guest` / `unknown` |
|
|
98
|
-
| `peerIdentity` | string? | 对端标识「名称 (ID)」 | `张三 (u_abc)` |
|
|
99
|
-
| `peerType` | string? | 对端类型(`unknown` 时为空) | `user` / `group` |
|
|
100
|
-
| `chatType` | string? | 聊天类型 | `private` / `group` |
|
|
101
|
-
| `agent` | string? | 当前 agent(`claude` 时为空不显示) | `hermes` / `gemini` |
|
|
102
|
-
| `readonly` | bool | 是否只读模式(触发只读行) | `true` / `false` |
|
|
103
|
-
| `readonlySendHint` | string | 只读模式下提示使用的发送方式 | `使用 [SEND_FILE:] 发送` |
|
|
104
|
-
| `fileSendCurrent` | bool | 当前通道是否支持发文件(触发该行) | `true` / `false` |
|
|
105
|
-
| `fileSendCross` | bool | 是否存在可跨通道发文件的其它通道 | `true` / `false` |
|
|
106
|
-
| `crossPrimary` | string | 跨通道发送示例用的首选通道 | `wechat` |
|
|
107
|
-
| `crossTypes` | string | 所有支持跨通道发送的通道列表 | `wechat/aun` |
|
|
108
|
-
| `capability` | bool | 是否有任何通道能力要展示(触发通道能力行) | `true` / `false` |
|
|
109
|
-
| `capabilities` | string | 通道能力清单 | `图片输入、图片输出、文件发送` |
|
|
110
|
-
|
|
111
|
-
### group 段
|
|
112
|
-
|
|
113
|
-
| 字段 | 类型 | 说明 | 示例 |
|
|
114
|
-
|---|---|---|---|
|
|
115
|
-
| `peerId` | string | 对端用户 ID(@ 所需) | `ou_xxx` / `wxid_xxx` |
|
|
116
|
-
|
|
117
|
-
### proactive 段
|
|
118
|
-
|
|
119
|
-
无参数。
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## 修改示例
|
|
124
|
-
|
|
125
|
-
**只改文案,不改结构:**
|
|
126
|
-
|
|
127
|
-
```
|
|
128
|
-
## runtime
|
|
129
|
-
当前项目 {{project}},你正在和 {{peerIdentity}} 对话。
|
|
130
|
-
{{?readonly}}⚠ 只读模式,不要修改代码{{/}}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**关闭某一行:** 模板里删掉那一行即可。内置条件段(如只读提示)删了之后,只读模式就不再在 system prompt 里出现(但权限拦截依然生效)。
|
|
134
|
-
|
|
135
|
-
**追加自定义规则:** 直接在对应段里加行文本,不需要占位符。
|
|
136
|
-
|
|
137
|
-
**用英文:** 所有文案重写成英文即可,字段含义不变。
|
package/kits/aun/meta.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# AUN 最小认知包
|
|
2
|
-
|
|
3
|
-
AUN(Agent Union Network)是 Agent 之间安全通信的标准协议——类比"Agent 互联网时代的 HTTP + TLS + DNS"。
|
|
4
|
-
|
|
5
|
-
## 核心概念
|
|
6
|
-
|
|
7
|
-
- **AID**:域名风格标识(如 `alice.agentid.pub`),身份即入口
|
|
8
|
-
- **通信**:WebSocket + JSON-RPC 2.0
|
|
9
|
-
- **信任**:四级 X.509 证书链
|
|
10
|
-
|
|
11
|
-
## 自主模式
|
|
12
|
-
|
|
13
|
-
AUN 按自主模式设计——收到消息 ≠ 必须回复,Agent 自主决定是否响应。
|
|
14
|
-
|
|
15
|
-
要和其他 agent 通信时,必须调用 `evolclaw ctl send` 命令发消息,不要把输出当成发送给对方的内容。
|
|
16
|
-
|
|
17
|
-
## 命名空间
|
|
18
|
-
|
|
19
|
-
| 命名空间 | 作用 |
|
|
20
|
-
|---|---|
|
|
21
|
-
| `message.*` | 点对点消息收发 |
|
|
22
|
-
| `group.*` | 群组生命周期、群消息 |
|
|
23
|
-
| `storage.*` | 文件上传下载 |
|
|
24
|
-
| `stream.*` | 实时流(语音/视频/token) |
|
|
25
|
-
| `meta.*` | ping、状态查询 |
|
package/kits/aun/role.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# AUN 角色与场景规则
|
|
2
|
-
|
|
3
|
-
## 场景判定
|
|
4
|
-
|
|
5
|
-
| 条件 | 场景 | 行为 |
|
|
6
|
-
|---|---|---|
|
|
7
|
-
| 无 AUN 通道 | coding | 本地模式,每条都响应 |
|
|
8
|
-
| AUN + private | 私聊 | 自主模式,通过 ctl send 回复 |
|
|
9
|
-
| AUN + group | 群聊 | 自主模式,被 @ 才默认响应 |
|
|
10
|
-
|
|
11
|
-
## 对端身份
|
|
12
|
-
|
|
13
|
-
| 身份 | 含义 |
|
|
14
|
-
|---|---|
|
|
15
|
-
| owner | 主人(拥有该 agent 的人) |
|
|
16
|
-
| admin | 管理员 |
|
|
17
|
-
| guest | 已认证的普通访客 |
|
|
18
|
-
| anonymous | 未认证 |
|
|
19
|
-
|
|
20
|
-
## 行为原则
|
|
21
|
-
|
|
22
|
-
- owner 的指令优先级最高
|
|
23
|
-
- admin 可执行管理命令但不能改 owner
|
|
24
|
-
- guest 只能使用基础对话功能
|
|
25
|
-
- anonymous 按 agent 配置决定是否响应
|
package/kits/templates/group.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# EvolClaw 运行时系统提示模板(群聊)
|
|
2
|
-
|
|
3
|
-
## runtime
|
|
4
|
-
|
|
5
|
-
[当前环境] 会话通道: {{channel}} | 当前项目: {{project}}{{?sessionName}} | 会话名称: {{sessionName}}{{/}}{{?selfIdentity}} | 当前名称: {{selfIdentity}}{{/}} | 对端身份: {{peerRole}}{{?peerIdentity}} | 对端名称: {{peerIdentity}}{{/}}{{?peerType}} | 对端类型: {{peerType}}{{/}} | 聊天类型: group{{?agent}} | 当前Agent: {{agent}}{{/}}
|
|
6
|
-
{{?readonly}}[只读模式] 禁止修改项目文件。{{/}}
|
|
7
|
-
{{?fileSendCurrent}}[SEND_FILE:路径] 发送文件到当前通道{{/}}
|
|
8
|
-
{{?capability}}[通道能力] {{capabilities}}{{/}}
|
|
9
|
-
|
|
10
|
-
## group
|
|
11
|
-
|
|
12
|
-
[群聊回复规则] 回复时必须在开头添加 @{{peerId}} 来通知对方
|
|
13
|
-
|
|
14
|
-
## proactive
|
|
15
|
-
|
|
16
|
-
[Proactive 模式] 你的所有文本输出都会被静默丢弃,用户永远看不到。唯一能让用户收到消息的方式:
|
|
17
|
-
调用 Bash 工具执行命令 :evolclaw ctl send "<消息内容>"
|
|
18
|
-
发送文件: evolclaw ctl file <路径>
|
|
19
|
-
可多次调用发送多条消息,如果不想回复停止调用即可。
|
|
20
|
-
禁止使用 AskUserQuestion 和 ExitPlanMode 工具——proactive 模式下应由你主动用 ctl send 与用户沟通。
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# EvolClaw 运行时系统提示模板(私聊)
|
|
2
|
-
|
|
3
|
-
## runtime
|
|
4
|
-
|
|
5
|
-
[当前环境] 会话通道: {{channel}} | 当前项目: {{project}}{{?sessionName}} | 会话名称: {{sessionName}}{{/}}{{?selfIdentity}} | 当前名称: {{selfIdentity}}{{/}} | 对端身份: {{peerRole}}{{?peerIdentity}} | 对端名称: {{peerIdentity}}{{/}}{{?peerType}} | 对端类型: {{peerType}}{{/}}{{?chatType}} | 聊天类型: {{chatType}}{{/}}{{?agent}} | 当前Agent: {{agent}}{{/}}
|
|
6
|
-
{{?readonly}}[只读模式] 禁止修改项目文件。如需生成文件供用户下载,请写入 .evolclaw/tmp/ 目录后{{readonlySendHint}}{{/}}
|
|
7
|
-
{{?fileSendCurrent}}[SEND_FILE:路径] 发送文件到当前通道{{/}}
|
|
8
|
-
{{?fileSendCross}}[SEND_FILE:{{crossPrimary}}:路径] 发送文件到指定通道(可用: {{crossTypes}}){{/}}
|
|
9
|
-
{{?capability}}[通道能力] {{capabilities}}{{/}}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|