evolclaw 2.8.2 → 3.0.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/dist/agents/claude-runner.js +105 -30
- package/dist/agents/codex-runner.js +15 -7
- package/dist/agents/gemini-runner.js +14 -5
- package/dist/agents/resolve.js +134 -0
- package/dist/agents/templates.js +3 -3
- package/dist/aun/aid/agentmd.js +186 -0
- package/dist/aun/aid/client.js +134 -0
- package/dist/aun/aid/identity.js +131 -0
- package/dist/aun/aid/index.js +3 -0
- package/dist/aun/aid/types.js +1 -0
- package/dist/aun/aid/validation.js +21 -0
- package/dist/aun/msg/group.js +291 -0
- package/dist/aun/msg/index.js +4 -0
- package/dist/aun/msg/p2p.js +144 -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 +1064 -279
- package/dist/channels/dingtalk.js +58 -5
- package/dist/channels/feishu.js +266 -30
- package/dist/channels/qqbot.js +67 -12
- package/dist/channels/wechat.js +61 -4
- package/dist/channels/wecom.js +58 -5
- package/dist/cli/agent.js +800 -0
- package/dist/cli/index.js +4253 -0
- package/dist/{utils → cli}/init-channel.js +211 -621
- package/dist/cli/init.js +178 -0
- package/dist/config-store.js +613 -0
- package/dist/core/baseagent-loader.js +48 -0
- package/dist/core/channel-loader.js +162 -11
- package/dist/core/command-handler.js +1090 -838
- package/dist/core/evolagent-registry.js +191 -360
- package/dist/core/evolagent.js +203 -234
- package/dist/core/interaction-router.js +52 -5
- package/dist/core/message/im-renderer.js +480 -0
- package/dist/core/message/items-formatter.js +61 -0
- package/dist/core/message/message-bridge.js +104 -56
- package/dist/core/message/message-log.js +91 -0
- package/dist/core/message/message-processor.js +326 -145
- package/dist/core/message/message-queue.js +5 -5
- package/dist/core/permission.js +21 -8
- 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 +704 -775
- 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/{templates → data}/prompts.md +34 -1
- package/dist/index.js +437 -273
- package/dist/ipc.js +49 -0
- package/dist/paths.js +82 -9
- package/dist/types.js +8 -2
- package/dist/utils/atomic-write.js +79 -0
- package/dist/utils/channel-helpers.js +46 -0
- package/dist/utils/cross-platform.js +0 -18
- package/dist/utils/instance-registry.js +433 -0
- package/dist/utils/log-writer.js +216 -0
- package/dist/utils/logger.js +24 -77
- package/dist/utils/media-cache.js +23 -0
- package/dist/utils/{upgrade.js → npm-ops.js} +52 -21
- package/dist/utils/process-introspect.js +144 -0
- package/dist/utils/stats.js +192 -0
- package/dist/watch-msg.js +529 -0
- package/evolclaw-install-aun.md +114 -46
- package/kits/aun/meta.md +25 -0
- package/kits/aun/role.md +25 -0
- package/kits/channels/aun.md +25 -0
- package/kits/evolclaw/commands.md +31 -0
- package/kits/evolclaw/identity-tools.md +26 -0
- package/kits/evolclaw/self-summary.md +29 -0
- package/kits/evolclaw/tools.md +25 -0
- package/kits/templates/group.md +20 -0
- package/kits/templates/private.md +9 -0
- package/kits/templates/system-fragments/personal-context.md +3 -0
- package/kits/templates/system-fragments/self-intro.md +5 -0
- package/kits/templates/system-fragments/speaker-intro.md +5 -0
- package/kits/templates/system-fragments/venue-intro.md +5 -0
- package/package.json +7 -5
- package/data/evolclaw.sample.json +0 -60
- package/dist/channels/aun-ops.js +0 -275
- package/dist/cli.js +0 -2178
- package/dist/config.js +0 -576
- package/dist/core/agent-loader.js +0 -39
- 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/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/channels/wechat.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolvePaths } from '../paths.js';
|
|
|
5
5
|
import { logger } from '../utils/logger.js';
|
|
6
6
|
import { sanitizeFileName, saveToUploads, safeFetch } from '../utils/media-cache.js';
|
|
7
7
|
import { markdownToPlainText } from '../utils/rich-content-renderer.js';
|
|
8
|
+
import { formatItemsAsText } from '../core/message/items-formatter.js';
|
|
8
9
|
const CHANNEL_VERSION = '1.0.0';
|
|
9
10
|
const ILINK_APP_ID = 'bot';
|
|
10
11
|
// iLink-App-ClientVersion: major<<16 | minor<<8 | patch (uint32)
|
|
@@ -382,7 +383,7 @@ export class WechatChannel {
|
|
|
382
383
|
const authMsg = `⚠️ 微信 token 已过期,通道暂停 ${pauseMin} 分钟后自动重试。\n如需立即恢复,请运行: evolclaw init wechat`;
|
|
383
384
|
if (this.eventBus) {
|
|
384
385
|
this.eventBus.publish({
|
|
385
|
-
type: 'channel:
|
|
386
|
+
type: 'channel:error',
|
|
386
387
|
channel: 'wechat',
|
|
387
388
|
status: 'auth_error',
|
|
388
389
|
message: authMsg,
|
|
@@ -705,7 +706,7 @@ export class WechatChannel {
|
|
|
705
706
|
});
|
|
706
707
|
}
|
|
707
708
|
}
|
|
708
|
-
import { normalizeChannelInstances, getChannelShowActivities } from '../
|
|
709
|
+
import { normalizeChannelInstances, getChannelShowActivities } from '../utils/channel-helpers.js';
|
|
709
710
|
export class WechatChannelPlugin {
|
|
710
711
|
name = 'wechat';
|
|
711
712
|
isEnabled(config) {
|
|
@@ -729,8 +730,46 @@ export class WechatChannelPlugin {
|
|
|
729
730
|
});
|
|
730
731
|
const adapter = {
|
|
731
732
|
channelName: inst.name,
|
|
732
|
-
|
|
733
|
-
|
|
733
|
+
capabilities: { file: false, image: false, interaction: false, markdown: false, thought: false, status: true },
|
|
734
|
+
send: async (envelope, payload) => {
|
|
735
|
+
const channelId = envelope.channelId;
|
|
736
|
+
switch (payload.kind) {
|
|
737
|
+
case 'result.text':
|
|
738
|
+
case 'command.result':
|
|
739
|
+
case 'command.error':
|
|
740
|
+
case 'system.notice':
|
|
741
|
+
case 'system.error':
|
|
742
|
+
case 'result.error':
|
|
743
|
+
await channel.sendMessage(channelId, payload.text);
|
|
744
|
+
return;
|
|
745
|
+
case 'result.file': {
|
|
746
|
+
const name = payload.fileName || payload.filePath;
|
|
747
|
+
await channel.sendMessage(channelId, `\ud83d\udcce \u6587\u4ef6\u5df2\u751f\u6210\uff1a${name}\n\u8def\u5f84\uff1a${payload.filePath}`);
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
case 'result.image':
|
|
751
|
+
return;
|
|
752
|
+
case 'activity.batch': {
|
|
753
|
+
const text = formatItemsAsText(payload.items);
|
|
754
|
+
if (text)
|
|
755
|
+
await channel.sendMessage(channelId, text);
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
case 'interaction':
|
|
759
|
+
if (payload.fallbackText)
|
|
760
|
+
await channel.sendMessage(channelId, payload.fallbackText);
|
|
761
|
+
return;
|
|
762
|
+
case 'status.started':
|
|
763
|
+
case 'status.completed':
|
|
764
|
+
case 'status.interrupted':
|
|
765
|
+
case 'status.error':
|
|
766
|
+
case 'status.timeout':
|
|
767
|
+
case 'custom':
|
|
768
|
+
return;
|
|
769
|
+
default:
|
|
770
|
+
logger.warn(`[WeChat] Unhandled payload kind: ${payload.kind}`);
|
|
771
|
+
}
|
|
772
|
+
},
|
|
734
773
|
};
|
|
735
774
|
const policy = {
|
|
736
775
|
canSwitchProject: (chatType, identity) => identity === 'owner' || identity === 'admin',
|
|
@@ -774,6 +813,24 @@ export class WechatChannelPlugin {
|
|
|
774
813
|
connect: () => channel.connect(),
|
|
775
814
|
disconnect: () => channel.disconnect(),
|
|
776
815
|
onProjectPathRequest: (channelId) => Promise.resolve(config.projects?.defaultPath || process.cwd()),
|
|
816
|
+
registerBridge(bridge, channelType) {
|
|
817
|
+
bridge.register(adapter.channelName, (handler) => channel.onMessage(async (channelId, content, peerId, images, chatType) => {
|
|
818
|
+
await handler({
|
|
819
|
+
channel: adapter.channelName,
|
|
820
|
+
channelType,
|
|
821
|
+
channelId,
|
|
822
|
+
content,
|
|
823
|
+
images,
|
|
824
|
+
chatType: chatType || 'private',
|
|
825
|
+
peerId: peerId || '',
|
|
826
|
+
});
|
|
827
|
+
}), (channelId, text) => channel.sendMessage(channelId, text), adapter, channelType);
|
|
828
|
+
},
|
|
829
|
+
registerHooks(ctx) {
|
|
830
|
+
if (channel.setEventBus) {
|
|
831
|
+
channel.setEventBus(ctx.eventBus);
|
|
832
|
+
}
|
|
833
|
+
},
|
|
777
834
|
});
|
|
778
835
|
}
|
|
779
836
|
return result;
|
package/dist/channels/wecom.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
2
|
import { logger } from '../utils/logger.js';
|
|
3
|
-
import { requireOptional } from '../utils/
|
|
4
|
-
import { normalizeChannelInstances, getChannelShowActivities } from '../
|
|
3
|
+
import { requireOptional } from '../utils/npm-ops.js';
|
|
4
|
+
import { normalizeChannelInstances, getChannelShowActivities } from '../utils/channel-helpers.js';
|
|
5
|
+
import { formatItemsAsText } from '../core/message/items-formatter.js';
|
|
5
6
|
// ── WecomChannel ───────────────────────────────────────────────────────────────
|
|
6
7
|
export class WecomChannel {
|
|
7
8
|
config;
|
|
@@ -489,9 +490,46 @@ export class WecomChannelPlugin {
|
|
|
489
490
|
});
|
|
490
491
|
const adapter = {
|
|
491
492
|
channelName: inst.name,
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
493
|
+
capabilities: { file: true, image: true, interaction: false, markdown: true, thought: false, status: false },
|
|
494
|
+
send: async (envelope, payload) => {
|
|
495
|
+
const ctx = envelope.replyContext;
|
|
496
|
+
const channelId = envelope.channelId;
|
|
497
|
+
switch (payload.kind) {
|
|
498
|
+
case 'result.text':
|
|
499
|
+
case 'command.result':
|
|
500
|
+
case 'command.error':
|
|
501
|
+
case 'system.notice':
|
|
502
|
+
case 'system.error':
|
|
503
|
+
case 'result.error':
|
|
504
|
+
await channel.sendMessage(channelId, payload.text);
|
|
505
|
+
return;
|
|
506
|
+
case 'result.file':
|
|
507
|
+
await channel.sendFile(channelId, payload.filePath);
|
|
508
|
+
return;
|
|
509
|
+
case 'result.image':
|
|
510
|
+
await channel.sendImage(channelId, payload.data);
|
|
511
|
+
return;
|
|
512
|
+
case 'activity.batch': {
|
|
513
|
+
const text = formatItemsAsText(payload.items);
|
|
514
|
+
if (text)
|
|
515
|
+
await channel.sendMessage(channelId, text);
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
case 'interaction':
|
|
519
|
+
if (payload.fallbackText)
|
|
520
|
+
await channel.sendMessage(channelId, payload.fallbackText);
|
|
521
|
+
return;
|
|
522
|
+
case 'status.started':
|
|
523
|
+
case 'status.completed':
|
|
524
|
+
case 'status.interrupted':
|
|
525
|
+
case 'status.error':
|
|
526
|
+
case 'status.timeout':
|
|
527
|
+
case 'custom':
|
|
528
|
+
return;
|
|
529
|
+
default:
|
|
530
|
+
logger.warn(`[WeCom] Unhandled payload kind: ${payload.kind}`);
|
|
531
|
+
}
|
|
532
|
+
},
|
|
495
533
|
};
|
|
496
534
|
const policy = {
|
|
497
535
|
canSwitchProject: (_chatType, identity) => identity === 'owner' || identity === 'admin',
|
|
@@ -536,6 +574,21 @@ export class WecomChannelPlugin {
|
|
|
536
574
|
connect: () => channel.connect(),
|
|
537
575
|
disconnect: () => channel.disconnect(),
|
|
538
576
|
onProjectPathRequest: () => Promise.resolve(config.projects?.defaultPath || process.cwd()),
|
|
577
|
+
registerBridge(bridge, channelType) {
|
|
578
|
+
bridge.register(adapter.channelName, (handler) => channel.onMessage(async (event) => {
|
|
579
|
+
handler({
|
|
580
|
+
channel: adapter.channelName,
|
|
581
|
+
channelType,
|
|
582
|
+
channelId: event.channelId,
|
|
583
|
+
content: event.content,
|
|
584
|
+
images: event.images,
|
|
585
|
+
chatType: event.chatType || 'private',
|
|
586
|
+
peerId: event.peerId || '',
|
|
587
|
+
peerName: event.peerName,
|
|
588
|
+
messageId: event.messageId,
|
|
589
|
+
});
|
|
590
|
+
}), (channelId, text) => channel.sendMessage(channelId, text), adapter, channelType);
|
|
591
|
+
},
|
|
539
592
|
});
|
|
540
593
|
}
|
|
541
594
|
return result;
|