evolclaw 3.2.0 → 3.3.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.
- package/CHANGELOG.md +17 -0
- package/README.md +1 -2
- package/dist/agents/{resolve.js → baseagent.js} +34 -5
- package/dist/agents/claude-runner.js +120 -27
- package/dist/agents/codex-app-server-client.js +364 -0
- package/dist/agents/codex-runner.js +1069 -141
- package/dist/agents/gemini-runner.js +2 -2
- package/dist/agents/runner-types.js +28 -0
- package/dist/aun/aid/store.js +1 -1
- package/dist/aun/storage/download.js +1 -1
- package/dist/aun/storage/upload.js +13 -1
- package/dist/channels/aun.js +406 -293
- package/dist/channels/dingtalk.js +77 -140
- package/dist/channels/feishu.js +97 -150
- package/dist/channels/qqbot.js +75 -138
- package/dist/channels/wechat.js +75 -136
- package/dist/channels/wecom.js +75 -138
- package/dist/cli/agent.js +8 -5
- package/dist/cli/index.js +177 -44
- package/dist/cli/init.js +33 -6
- package/dist/cli/model.js +1 -1
- package/dist/cli/stats.js +558 -0
- package/dist/cli/version.js +87 -0
- package/dist/cli/watch-msg.js +5 -2
- package/dist/config-store.js +12 -6
- package/dist/core/channel-loader.js +84 -82
- package/dist/core/command-handler.js +473 -114
- package/dist/core/evolagent-registry.js +1 -0
- package/dist/core/evolagent.js +1 -1
- package/dist/core/interaction-router.js +8 -0
- package/dist/core/message/command-handler-agent-control.js +63 -1
- package/dist/core/message/im-renderer.js +35 -13
- package/dist/core/message/items-formatter.js +9 -1
- package/dist/core/message/message-bridge.js +49 -21
- package/dist/core/message/message-log.js +1 -0
- package/dist/core/message/message-processor.js +295 -35
- package/dist/core/message/message-queue.js +2 -2
- package/dist/core/message/pending-hints.js +232 -0
- package/dist/core/message/response-depth.js +56 -0
- package/dist/core/model/model-catalog.js +1 -1
- package/dist/core/model/model-scope.js +2 -2
- package/dist/core/permission.js +9 -12
- package/dist/core/relation/peer-identity.js +16 -1
- package/dist/core/session/adapters/codex-session-file-adapter.js +4 -2
- package/dist/core/session/session-manager.js +27 -13
- package/dist/core/session/session-title.js +26 -0
- package/dist/core/stats/billing.js +151 -0
- package/dist/core/stats/budget.js +93 -0
- package/dist/core/stats/db.js +314 -0
- package/dist/core/stats/eck-vars.js +84 -0
- package/dist/core/stats/index.js +10 -0
- package/dist/core/stats/normalizer.js +78 -0
- package/dist/core/stats/query.js +760 -0
- package/dist/core/stats/writer.js +115 -0
- package/dist/core/trigger/manager.js +34 -0
- package/dist/core/trigger/parser.js +9 -3
- package/dist/core/trigger/scheduler.js +20 -17
- package/dist/{agents → eck}/manifest-engine.js +20 -1
- package/dist/{agents → eck}/message-renderer.js +24 -1
- package/dist/index.js +130 -8
- package/dist/ipc.js +17 -1
- package/dist/utils/cross-platform.js +23 -5
- package/dist/utils/ecweb-pair.js +20 -0
- package/dist/utils/stats.js +14 -0
- package/kits/docs/evolclaw/INDEX.md +3 -1
- package/kits/docs/evolclaw/fs-architecture.md +1215 -0
- package/kits/docs/evolclaw/fs.md +131 -0
- package/kits/docs/evolclaw/group-fs.md +209 -0
- package/kits/docs/evolclaw/stats.md +70 -0
- package/kits/docs/venues/aun-group.md +29 -6
- package/kits/docs/venues/group.md +5 -4
- package/kits/eck_manifest.json +12 -0
- package/kits/eck_message_manifest.json +30 -3
- package/kits/rules/05-venue.md +1 -1
- package/kits/templates/message-fragments/inject-default.md +2 -0
- package/kits/templates/system-fragments/response-depth.md +16 -0
- package/package.json +4 -4
- package/dist/agents/baseagent-normalize.js +0 -19
- package/dist/core/relation/peer-key.js +0 -16
- package/dist/evolclaw-config.js +0 -11
- package/dist/utils/channel-helpers.js +0 -46
- /package/dist/core/{cache/file-cache.js → daemon-file-cache.js} +0 -0
- /package/dist/{agents → eck}/kit-renderer.js +0 -0
|
@@ -5,15 +5,33 @@ import { promisify } from 'util';
|
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
const execFileAsync = promisify(execFile);
|
|
7
7
|
export const isWindows = process.platform === 'win32';
|
|
8
|
+
const ENCODE_PATH_MAX = 200;
|
|
9
|
+
function encodePathHash(s) {
|
|
10
|
+
let h = 0;
|
|
11
|
+
for (let i = 0; i < s.length; i++)
|
|
12
|
+
h = (h << 5) - h + s.charCodeAt(i) | 0;
|
|
13
|
+
return Math.abs(h).toString(36);
|
|
14
|
+
}
|
|
8
15
|
/**
|
|
9
16
|
* Encode project path as directory name (Claude SDK convention).
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
17
|
+
* Mirrors the SDK's F0(L_(path)) logic:
|
|
18
|
+
* 1. path.resolve → realpath (if exists) → Unicode NFC
|
|
19
|
+
* 2. replace every non-alphanumeric character with '-'
|
|
20
|
+
* 3. truncate to 200 chars + hash suffix for long paths
|
|
21
|
+
* This must stay in sync with the SDK so evolclaw can locate session files.
|
|
13
22
|
*/
|
|
14
23
|
export function encodePath(projectPath) {
|
|
15
|
-
const
|
|
16
|
-
|
|
24
|
+
const resolved = path.resolve(projectPath);
|
|
25
|
+
let real = resolved;
|
|
26
|
+
try {
|
|
27
|
+
real = fs.realpathSync(resolved);
|
|
28
|
+
}
|
|
29
|
+
catch { }
|
|
30
|
+
const nfc = real.normalize('NFC');
|
|
31
|
+
const encoded = nfc.replace(/[^a-zA-Z0-9]/g, '-');
|
|
32
|
+
if (encoded.length <= ENCODE_PATH_MAX)
|
|
33
|
+
return encoded;
|
|
34
|
+
return `${encoded.slice(0, ENCODE_PATH_MAX)}-${encodePathHash(nfc)}`;
|
|
17
35
|
}
|
|
18
36
|
/**
|
|
19
37
|
* Cross-platform process liveness check.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ECWeb 配对码取码 helper(共享给 daemon 和 CLI)。
|
|
3
|
+
*
|
|
4
|
+
* 配对码是 ecweb 进程自己生成并持有的内部状态。daemon/CLI 通过 ecweb 的
|
|
5
|
+
* localhost-only HTTP 接口 GET /api/pair-code 取当前码(远程访问被 ecweb 403 拒绝)。
|
|
6
|
+
*/
|
|
7
|
+
/** 经 localhost 拉取 ecweb 当前配对码(仅本机可取)。失败返回 null。 */
|
|
8
|
+
export async function fetchEcwebPairCode(port) {
|
|
9
|
+
try {
|
|
10
|
+
const resp = await fetch(`http://127.0.0.1:${port}/api/pair-code`, {
|
|
11
|
+
signal: AbortSignal.timeout(2000),
|
|
12
|
+
});
|
|
13
|
+
if (!resp.ok)
|
|
14
|
+
return null;
|
|
15
|
+
return await resp.json();
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
package/dist/utils/stats.js
CHANGED
|
@@ -104,6 +104,8 @@ export class AidStatsCollector {
|
|
|
104
104
|
queueStatsProvider;
|
|
105
105
|
/** sessionId → 当前正在跑该 session 的 agent,task:started 写入,task:completed/error 清除 */
|
|
106
106
|
sessionToAgent = new Map();
|
|
107
|
+
/** 外部注入的持久化回调(写入 message_events 表) */
|
|
108
|
+
onMessage;
|
|
107
109
|
constructor(eventBus) {
|
|
108
110
|
if (!eventBus)
|
|
109
111
|
return;
|
|
@@ -342,6 +344,12 @@ export class AidStatsCollector {
|
|
|
342
344
|
}
|
|
343
345
|
entry.bytesReceived += byteLength;
|
|
344
346
|
entry.uniquePeers.add(fromPeer);
|
|
347
|
+
// 持久化
|
|
348
|
+
this.onMessage?.({
|
|
349
|
+
ts: Date.now(), agent_aid: aid, peer_key: `aun#${fromPeer}`,
|
|
350
|
+
direction: 'in', msg_type: isSystem ? 'system' : 'private',
|
|
351
|
+
bytes: byteLength, encrypted: encrypt, chatmode,
|
|
352
|
+
});
|
|
345
353
|
}
|
|
346
354
|
recordOutbound(aid, toPeer, byteLength, text, isSystem = false, encrypt, chatmode) {
|
|
347
355
|
const entry = this.getOrCreate(aid);
|
|
@@ -369,6 +377,12 @@ export class AidStatsCollector {
|
|
|
369
377
|
}
|
|
370
378
|
entry.bytesSent += byteLength;
|
|
371
379
|
entry.uniquePeers.add(toPeer);
|
|
380
|
+
// 持久化
|
|
381
|
+
this.onMessage?.({
|
|
382
|
+
ts: Date.now(), agent_aid: aid, peer_key: `aun#${toPeer}`,
|
|
383
|
+
direction: 'out', msg_type: isSystem ? 'system' : 'private',
|
|
384
|
+
bytes: byteLength, encrypted: encrypt, chatmode,
|
|
385
|
+
});
|
|
372
386
|
}
|
|
373
387
|
getAllSnapshots() {
|
|
374
388
|
const out = [];
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
| `ec msg` | 私聊收发消息 | 回复/发消息/拉取/撤回/查在线 | 有对端(peerId) | `msg.md` |
|
|
15
15
|
| `ec group` | 群聊收发与群管理 | 群发/建群/邀请/踢人/退群/群成员 | 群聊(groupId) | `group.md` |
|
|
16
16
|
| `ec aid` | AID 身份管理 | 身份/证书/名片/探测对端 | 任意有渠道场景 | `aid.md` |
|
|
17
|
-
| `ec
|
|
17
|
+
| `ec fs` | 网络文件系统(统一前端) | 上传/下载/看文件/列目录/分享/共享/挂载/配额 | 任意有渠道场景 | `fs.md`(架构全景 `fs-architecture.md`) |
|
|
18
|
+
| `ec storage` | 文件存储(底层调试) | 上传/下载/配额 | 任意有渠道场景 | `storage.md` |
|
|
18
19
|
| `ec agent` | EvolAgent 生命周期 | 创建/启停/热重载/改配置 | 管理员(owner/admin) | `agent.md` |
|
|
19
20
|
| `ec rpc` | 底层 AUN RPC(逃生通道) | 直接调协议方法 | 高级/兜底 | `rpc.md` |
|
|
20
21
|
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
| 命令集 | 用途 | 触发词 | 文档 |
|
|
30
31
|
|--------|------|--------|------|
|
|
31
32
|
| `ec model` | 模型管理(按作用域持久化) | 切模型/列模型/看当前/改强度 | `model.md` |
|
|
33
|
+
| `ec stats` | Token 用量与费用统计 | 用量/费用/统计/预算/token/cost | `stats.md` |
|
|
32
34
|
|
|
33
35
|
## 开发者工具(非 agent 会话能力)
|
|
34
36
|
|