evolclaw 2.8.3 → 3.1.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/README.md +21 -12
- package/bin/ec.js +29 -0
- package/dist/agents/baseagent-normalize.js +19 -0
- package/dist/agents/claude-runner.js +108 -46
- package/dist/agents/codex-runner.js +13 -14
- package/dist/agents/gemini-runner.js +15 -17
- package/dist/agents/kit-renderer.js +281 -0
- package/dist/agents/resolve.js +134 -0
- package/dist/aun/aid/agentmd.js +186 -0
- package/dist/aun/aid/client.js +134 -0
- package/dist/aun/aid/identity.js +159 -0
- package/dist/aun/aid/index.js +3 -0
- package/dist/aun/aid/lifecycle-log.js +33 -0
- package/dist/aun/aid/types.js +1 -0
- package/dist/aun/aid/validation.js +21 -0
- package/dist/aun/msg/group.js +293 -0
- package/dist/aun/msg/index.js +4 -0
- package/dist/aun/msg/p2p.js +147 -0
- package/dist/aun/msg/payload-type.js +27 -0
- package/dist/aun/msg/upload.js +98 -0
- package/dist/aun/outbox.js +138 -0
- package/dist/aun/rpc/caller.js +42 -0
- package/dist/aun/rpc/connection.js +34 -0
- package/dist/aun/rpc/index.js +2 -0
- package/dist/aun/storage/download.js +29 -0
- package/dist/aun/storage/index.js +3 -0
- package/dist/aun/storage/manage.js +10 -0
- package/dist/aun/storage/upload.js +35 -0
- package/dist/channels/aun.js +1340 -349
- package/dist/channels/dingtalk.js +59 -5
- package/dist/channels/feishu.js +381 -32
- package/dist/channels/qqbot.js +68 -12
- package/dist/channels/wechat.js +63 -4
- package/dist/channels/wecom.js +59 -5
- package/dist/cli/agent.js +800 -0
- package/dist/cli/bench.js +1219 -0
- package/dist/cli/index.js +4513 -0
- package/dist/{utils → cli}/init-channel.js +211 -621
- package/dist/cli/init.js +178 -0
- package/dist/cli/link-rules.js +245 -0
- package/dist/cli/net-check.js +640 -0
- package/dist/cli/watch-msg.js +589 -0
- package/dist/config-store.js +645 -0
- package/dist/core/{agent-loader.js → baseagent-loader.js} +6 -12
- package/dist/core/channel-loader.js +176 -12
- package/dist/core/command-handler.js +883 -848
- package/dist/core/evolagent-registry.js +191 -371
- package/dist/core/evolagent.js +202 -238
- package/dist/core/interaction-router.js +52 -5
- package/dist/core/message/im-renderer.js +486 -0
- package/dist/core/message/items-formatter.js +68 -0
- package/dist/core/message/message-bridge.js +109 -56
- package/dist/core/message/message-log.js +93 -0
- package/dist/core/message/message-processor.js +430 -212
- package/dist/core/message/message-queue.js +13 -6
- package/dist/core/permission.js +116 -11
- package/dist/core/session/adapters/codex-session-file-adapter.js +24 -2
- package/dist/core/session/session-fs-store.js +230 -0
- package/dist/core/session/session-manager.js +740 -777
- package/dist/core/session/session-mapper.js +87 -0
- package/dist/core/trigger/manager.js +122 -0
- package/dist/core/trigger/parser.js +128 -0
- package/dist/core/trigger/scheduler.js +224 -0
- 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 +560 -283
- package/dist/ipc.js +49 -0
- package/dist/net-check.js +640 -0
- package/dist/paths.js +73 -9
- package/dist/types.js +8 -2
- package/dist/utils/aid-lifecycle-log.js +33 -0
- package/dist/utils/atomic-write.js +89 -0
- package/dist/utils/channel-helpers.js +46 -0
- package/dist/utils/cross-platform.js +17 -26
- package/dist/utils/error-utils.js +10 -2
- package/dist/utils/instance-registry.js +434 -0
- package/dist/utils/log-writer.js +217 -0
- package/dist/utils/logger.js +34 -77
- package/dist/utils/media-cache.js +23 -0
- package/dist/utils/npm-ops.js +163 -0
- package/dist/utils/process-introspect.js +122 -0
- package/dist/utils/stats.js +192 -0
- package/dist/watch-msg.js +544 -0
- package/evolclaw-install-aun.md +127 -47
- 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/aun.md +25 -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/AGENT_CMD.md +31 -0
- package/kits/docs/evolclaw/MSG_GROUP.md +30 -0
- package/kits/docs/evolclaw/MSG_PRIVATE.md +25 -0
- package/kits/docs/evolclaw/self-summary.md +29 -0
- package/kits/docs/evolclaw/tools.md +25 -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/identity/identity-tools.md +26 -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 +43 -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 +10 -6
- package/data/evolclaw.sample.json +0 -60
- package/dist/agents/templates.js +0 -122
- package/dist/channels/aun-ops.js +0 -275
- package/dist/cli.js +0 -2178
- package/dist/config.js +0 -591
- package/dist/core/agent-registry.js +0 -450
- package/dist/core/evolagent-schema.js +0 -72
- package/dist/core/message/stream-flusher.js +0 -238
- package/dist/core/message/thought-emitter.js +0 -162
- package/dist/core/reload-hooks.js +0 -87
- package/dist/prompts/templates.js +0 -122
- package/dist/templates/prompts.md +0 -104
- package/dist/templates/skills.md +0 -66
- package/dist/utils/channel-fingerprint.js +0 -59
- package/dist/utils/error-dict.js +0 -63
- package/dist/utils/format.js +0 -32
- package/dist/utils/init.js +0 -645
- package/dist/utils/migrate-project.js +0 -122
- package/dist/utils/reload-hooks.js +0 -87
- package/dist/utils/stats-collector.js +0 -99
- package/dist/utils/upgrade.js +0 -100
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { BASEAGENT_CAPS } from './baseagent-caps.js';
|
|
4
|
+
const MAX_DEPTH = 5;
|
|
5
|
+
export function resolveEckInjection(agentConfig, projectPath, kitsRulesPath) {
|
|
6
|
+
const caps = BASEAGENT_CAPS[agentConfig.baseAgent]
|
|
7
|
+
?? { autoLoadsRules: false, supportsSystemPrompt: true };
|
|
8
|
+
if (!caps.autoLoadsRules) {
|
|
9
|
+
return { shouldInject: true, reason: 'baseagent-no-autoload' };
|
|
10
|
+
}
|
|
11
|
+
const symlinkActive = detectEckSymlink(projectPath, kitsRulesPath);
|
|
12
|
+
if (symlinkActive) {
|
|
13
|
+
return { shouldInject: false, reason: 'symlink-active' };
|
|
14
|
+
}
|
|
15
|
+
return { shouldInject: true, reason: 'symlink-not-found' };
|
|
16
|
+
}
|
|
17
|
+
export function detectEckSymlink(projectPath, kitsRulesPath) {
|
|
18
|
+
let dir = projectPath;
|
|
19
|
+
let depth = 0;
|
|
20
|
+
while (depth < MAX_DEPTH) {
|
|
21
|
+
const eckDir = path.join(dir, '.claude', 'rules', 'eck');
|
|
22
|
+
if (fs.existsSync(eckDir)) {
|
|
23
|
+
try {
|
|
24
|
+
const realPath = fs.realpathSync(eckDir);
|
|
25
|
+
const kitsRulesReal = fs.realpathSync(kitsRulesPath);
|
|
26
|
+
if (pathEquals(realPath, kitsRulesReal)) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// detection failure → conservatively assume not loaded
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const parent = path.dirname(dir);
|
|
35
|
+
if (parent === dir)
|
|
36
|
+
break;
|
|
37
|
+
dir = parent;
|
|
38
|
+
depth++;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
function pathEquals(a, b) {
|
|
43
|
+
if (process.platform === 'win32') {
|
|
44
|
+
return path.resolve(a).toLowerCase() === path.resolve(b).toLowerCase();
|
|
45
|
+
}
|
|
46
|
+
return path.resolve(a) === path.resolve(b);
|
|
47
|
+
}
|
package/dist/eck/init.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { resolvePaths, kitsDocsDir, agentDir, getPackageRoot } from '../paths.js';
|
|
4
|
+
import { atomicWriteText } from '../utils/atomic-write.js';
|
|
5
|
+
import { logger } from '../utils/logger.js';
|
|
6
|
+
export function initEck() {
|
|
7
|
+
const p = resolvePaths();
|
|
8
|
+
const eckDir = p.eckDir;
|
|
9
|
+
fs.mkdirSync(eckDir, { recursive: true });
|
|
10
|
+
initEckRuntime(eckDir);
|
|
11
|
+
initEckPathRegistry(eckDir);
|
|
12
|
+
}
|
|
13
|
+
export function initAgentIndex(aid) {
|
|
14
|
+
const indexDir = path.join(agentDir(aid), 'index');
|
|
15
|
+
fs.mkdirSync(indexDir, { recursive: true });
|
|
16
|
+
const indexFile = path.join(indexDir, 'INDEX.md');
|
|
17
|
+
const guideFile = path.join(indexDir, 'GUIDE.md');
|
|
18
|
+
if (!fs.existsSync(indexFile)) {
|
|
19
|
+
const template = loadTemplate('INDEX.template.md');
|
|
20
|
+
if (template) {
|
|
21
|
+
atomicWriteText(indexFile, renderTemplate(template, { AID: aid }));
|
|
22
|
+
logger.info(`[eck] Created ${indexFile}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!fs.existsSync(guideFile)) {
|
|
26
|
+
const template = loadTemplate('GUIDE.template.md');
|
|
27
|
+
if (template) {
|
|
28
|
+
atomicWriteText(guideFile, renderTemplate(template, { AID: aid }));
|
|
29
|
+
logger.info(`[eck] Created ${guideFile}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function initEckRuntime(eckDir) {
|
|
34
|
+
const runtimeFile = path.join(eckDir, 'runtime.md');
|
|
35
|
+
if (fs.existsSync(runtimeFile))
|
|
36
|
+
return;
|
|
37
|
+
const template = loadTemplate('runtime.template.md');
|
|
38
|
+
if (!template)
|
|
39
|
+
return;
|
|
40
|
+
const vars = {
|
|
41
|
+
EVOLCLAW_HOME: resolvePaths().root,
|
|
42
|
+
PACKAGE_ROOT: getPackageRoot(),
|
|
43
|
+
};
|
|
44
|
+
atomicWriteText(runtimeFile, renderTemplate(template, vars));
|
|
45
|
+
logger.info(`[eck] Created ${runtimeFile}`);
|
|
46
|
+
}
|
|
47
|
+
function initEckPathRegistry(eckDir) {
|
|
48
|
+
const registryFile = path.join(eckDir, 'path-registry.md');
|
|
49
|
+
if (fs.existsSync(registryFile))
|
|
50
|
+
return;
|
|
51
|
+
const template = loadTemplate('path-registry.template.md');
|
|
52
|
+
if (!template)
|
|
53
|
+
return;
|
|
54
|
+
const vars = {
|
|
55
|
+
EVOLCLAW_HOME: resolvePaths().root,
|
|
56
|
+
PACKAGE_ROOT: getPackageRoot(),
|
|
57
|
+
};
|
|
58
|
+
atomicWriteText(registryFile, renderTemplate(template, vars));
|
|
59
|
+
logger.info(`[eck] Created ${registryFile}`);
|
|
60
|
+
}
|
|
61
|
+
function loadTemplate(filename) {
|
|
62
|
+
const templatePath = path.join(kitsDocsDir(), 'eck_templates', filename);
|
|
63
|
+
try {
|
|
64
|
+
return fs.readFileSync(templatePath, 'utf-8');
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
logger.warn(`[eck] Template not found: ${templatePath}`);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function renderTemplate(template, vars) {
|
|
72
|
+
let result = template;
|
|
73
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
74
|
+
result = result.replaceAll(`{{${key}}}`, value);
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { kitsRulesDir } from '../paths.js';
|
|
4
|
+
let _cachedRules = null;
|
|
5
|
+
export function loadRulesForInjection() {
|
|
6
|
+
if (_cachedRules !== null)
|
|
7
|
+
return _cachedRules;
|
|
8
|
+
const rulesDir = kitsRulesDir();
|
|
9
|
+
if (!fs.existsSync(rulesDir)) {
|
|
10
|
+
_cachedRules = '';
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
const files = fs.readdirSync(rulesDir)
|
|
14
|
+
.filter(f => f.endsWith('.md'))
|
|
15
|
+
.sort();
|
|
16
|
+
const parts = [];
|
|
17
|
+
for (const file of files) {
|
|
18
|
+
try {
|
|
19
|
+
parts.push(fs.readFileSync(path.join(rulesDir, file), 'utf-8'));
|
|
20
|
+
}
|
|
21
|
+
catch { /* skip unreadable files */ }
|
|
22
|
+
}
|
|
23
|
+
_cachedRules = parts.join('\n\n');
|
|
24
|
+
return _cachedRules;
|
|
25
|
+
}
|
|
26
|
+
export function invalidateRulesCache() {
|
|
27
|
+
_cachedRules = null;
|
|
28
|
+
}
|