evolclaw 2.8.3 → 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.
Files changed (105) hide show
  1. package/README.md +21 -12
  2. package/dist/agents/claude-runner.js +102 -38
  3. package/dist/agents/codex-runner.js +11 -14
  4. package/dist/agents/gemini-runner.js +10 -12
  5. package/dist/agents/resolve.js +134 -0
  6. package/dist/agents/templates.js +3 -3
  7. package/dist/aun/aid/agentmd.js +186 -0
  8. package/dist/aun/aid/client.js +134 -0
  9. package/dist/aun/aid/identity.js +131 -0
  10. package/dist/aun/aid/index.js +3 -0
  11. package/dist/aun/aid/types.js +1 -0
  12. package/dist/aun/aid/validation.js +21 -0
  13. package/dist/aun/msg/group.js +291 -0
  14. package/dist/aun/msg/index.js +4 -0
  15. package/dist/aun/msg/p2p.js +144 -0
  16. package/dist/aun/msg/payload-type.js +27 -0
  17. package/dist/aun/msg/upload.js +98 -0
  18. package/dist/aun/outbox.js +138 -0
  19. package/dist/aun/rpc/caller.js +42 -0
  20. package/dist/aun/rpc/connection.js +34 -0
  21. package/dist/aun/rpc/index.js +2 -0
  22. package/dist/aun/storage/download.js +29 -0
  23. package/dist/aun/storage/index.js +3 -0
  24. package/dist/aun/storage/manage.js +10 -0
  25. package/dist/aun/storage/upload.js +35 -0
  26. package/dist/channels/aun.js +1051 -288
  27. package/dist/channels/dingtalk.js +58 -5
  28. package/dist/channels/feishu.js +266 -30
  29. package/dist/channels/qqbot.js +67 -12
  30. package/dist/channels/wechat.js +61 -4
  31. package/dist/channels/wecom.js +58 -5
  32. package/dist/cli/agent.js +800 -0
  33. package/dist/cli/index.js +4253 -0
  34. package/dist/{utils → cli}/init-channel.js +211 -621
  35. package/dist/cli/init.js +178 -0
  36. package/dist/config-store.js +613 -0
  37. package/dist/core/{agent-loader.js → baseagent-loader.js} +6 -12
  38. package/dist/core/channel-loader.js +162 -11
  39. package/dist/core/command-handler.js +858 -847
  40. package/dist/core/evolagent-registry.js +191 -371
  41. package/dist/core/evolagent.js +203 -234
  42. package/dist/core/interaction-router.js +52 -5
  43. package/dist/core/message/im-renderer.js +480 -0
  44. package/dist/core/message/items-formatter.js +61 -0
  45. package/dist/core/message/message-bridge.js +104 -56
  46. package/dist/core/message/message-log.js +91 -0
  47. package/dist/core/message/message-processor.js +309 -142
  48. package/dist/core/message/message-queue.js +3 -3
  49. package/dist/core/permission.js +21 -8
  50. package/dist/core/session/adapters/codex-session-file-adapter.js +24 -2
  51. package/dist/core/session/session-fs-store.js +230 -0
  52. package/dist/core/session/session-manager.js +704 -775
  53. package/dist/core/session/session-mapper.js +87 -0
  54. package/dist/core/trigger/manager.js +122 -0
  55. package/dist/core/trigger/parser.js +128 -0
  56. package/dist/core/trigger/scheduler.js +224 -0
  57. package/dist/{templates → data}/prompts.md +34 -1
  58. package/dist/index.js +431 -275
  59. package/dist/ipc.js +49 -0
  60. package/dist/paths.js +82 -9
  61. package/dist/types.js +8 -2
  62. package/dist/utils/atomic-write.js +79 -0
  63. package/dist/utils/channel-helpers.js +46 -0
  64. package/dist/utils/cross-platform.js +0 -18
  65. package/dist/utils/instance-registry.js +433 -0
  66. package/dist/utils/log-writer.js +216 -0
  67. package/dist/utils/logger.js +24 -77
  68. package/dist/utils/media-cache.js +23 -0
  69. package/dist/utils/{upgrade.js → npm-ops.js} +52 -21
  70. package/dist/utils/process-introspect.js +144 -0
  71. package/dist/utils/stats.js +192 -0
  72. package/dist/watch-msg.js +529 -0
  73. package/evolclaw-install-aun.md +114 -46
  74. package/kits/aun/meta.md +25 -0
  75. package/kits/aun/role.md +25 -0
  76. package/kits/channels/aun.md +25 -0
  77. package/kits/evolclaw/commands.md +31 -0
  78. package/kits/evolclaw/identity-tools.md +26 -0
  79. package/kits/evolclaw/self-summary.md +29 -0
  80. package/kits/evolclaw/tools.md +25 -0
  81. package/kits/templates/group.md +20 -0
  82. package/kits/templates/private.md +9 -0
  83. package/kits/templates/system-fragments/personal-context.md +3 -0
  84. package/kits/templates/system-fragments/self-intro.md +5 -0
  85. package/kits/templates/system-fragments/speaker-intro.md +5 -0
  86. package/kits/templates/system-fragments/venue-intro.md +5 -0
  87. package/package.json +7 -5
  88. package/data/evolclaw.sample.json +0 -60
  89. package/dist/channels/aun-ops.js +0 -275
  90. package/dist/cli.js +0 -2178
  91. package/dist/config.js +0 -591
  92. package/dist/core/agent-registry.js +0 -450
  93. package/dist/core/evolagent-schema.js +0 -72
  94. package/dist/core/message/stream-flusher.js +0 -238
  95. package/dist/core/message/thought-emitter.js +0 -162
  96. package/dist/core/reload-hooks.js +0 -87
  97. package/dist/prompts/templates.js +0 -122
  98. package/dist/templates/skills.md +0 -66
  99. package/dist/utils/channel-fingerprint.js +0 -59
  100. package/dist/utils/error-dict.js +0 -63
  101. package/dist/utils/format.js +0 -32
  102. package/dist/utils/init.js +0 -645
  103. package/dist/utils/migrate-project.js +0 -122
  104. package/dist/utils/reload-hooks.js +0 -87
  105. package/dist/utils/stats-collector.js +0 -99
@@ -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:health',
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 '../config.js';
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
- sendText: (id, text) => channel.sendMessage(id, text),
733
- sendFile: (id, filePath) => channel.sendFile(id, filePath),
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;
@@ -1,7 +1,8 @@
1
1
  import crypto from 'node:crypto';
2
2
  import { logger } from '../utils/logger.js';
3
- import { requireOptional } from '../utils/init-channel.js';
4
- import { normalizeChannelInstances, getChannelShowActivities } from '../config.js';
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
- sendText: (id, text) => channel.sendMessage(id, text),
493
- sendFile: (id, filePath) => channel.sendFile(id, filePath),
494
- sendImage: (id, png) => channel.sendImage(id, png),
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;