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.
Files changed (83) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -2
  3. package/dist/agents/{resolve.js → baseagent.js} +34 -5
  4. package/dist/agents/claude-runner.js +120 -27
  5. package/dist/agents/codex-app-server-client.js +364 -0
  6. package/dist/agents/codex-runner.js +1069 -141
  7. package/dist/agents/gemini-runner.js +2 -2
  8. package/dist/agents/runner-types.js +28 -0
  9. package/dist/aun/aid/store.js +1 -1
  10. package/dist/aun/storage/download.js +1 -1
  11. package/dist/aun/storage/upload.js +13 -1
  12. package/dist/channels/aun.js +406 -293
  13. package/dist/channels/dingtalk.js +77 -140
  14. package/dist/channels/feishu.js +97 -150
  15. package/dist/channels/qqbot.js +75 -138
  16. package/dist/channels/wechat.js +75 -136
  17. package/dist/channels/wecom.js +75 -138
  18. package/dist/cli/agent.js +8 -5
  19. package/dist/cli/index.js +177 -44
  20. package/dist/cli/init.js +33 -6
  21. package/dist/cli/model.js +1 -1
  22. package/dist/cli/stats.js +558 -0
  23. package/dist/cli/version.js +87 -0
  24. package/dist/cli/watch-msg.js +5 -2
  25. package/dist/config-store.js +12 -6
  26. package/dist/core/channel-loader.js +84 -82
  27. package/dist/core/command-handler.js +473 -114
  28. package/dist/core/evolagent-registry.js +1 -0
  29. package/dist/core/evolagent.js +1 -1
  30. package/dist/core/interaction-router.js +8 -0
  31. package/dist/core/message/command-handler-agent-control.js +63 -1
  32. package/dist/core/message/im-renderer.js +35 -13
  33. package/dist/core/message/items-formatter.js +9 -1
  34. package/dist/core/message/message-bridge.js +49 -21
  35. package/dist/core/message/message-log.js +1 -0
  36. package/dist/core/message/message-processor.js +295 -35
  37. package/dist/core/message/message-queue.js +2 -2
  38. package/dist/core/message/pending-hints.js +232 -0
  39. package/dist/core/message/response-depth.js +56 -0
  40. package/dist/core/model/model-catalog.js +1 -1
  41. package/dist/core/model/model-scope.js +2 -2
  42. package/dist/core/permission.js +9 -12
  43. package/dist/core/relation/peer-identity.js +16 -1
  44. package/dist/core/session/adapters/codex-session-file-adapter.js +4 -2
  45. package/dist/core/session/session-manager.js +27 -13
  46. package/dist/core/session/session-title.js +26 -0
  47. package/dist/core/stats/billing.js +151 -0
  48. package/dist/core/stats/budget.js +93 -0
  49. package/dist/core/stats/db.js +314 -0
  50. package/dist/core/stats/eck-vars.js +84 -0
  51. package/dist/core/stats/index.js +10 -0
  52. package/dist/core/stats/normalizer.js +78 -0
  53. package/dist/core/stats/query.js +760 -0
  54. package/dist/core/stats/writer.js +115 -0
  55. package/dist/core/trigger/manager.js +34 -0
  56. package/dist/core/trigger/parser.js +9 -3
  57. package/dist/core/trigger/scheduler.js +20 -17
  58. package/dist/{agents → eck}/manifest-engine.js +20 -1
  59. package/dist/{agents → eck}/message-renderer.js +24 -1
  60. package/dist/index.js +130 -8
  61. package/dist/ipc.js +17 -1
  62. package/dist/utils/cross-platform.js +23 -5
  63. package/dist/utils/ecweb-pair.js +20 -0
  64. package/dist/utils/stats.js +14 -0
  65. package/kits/docs/evolclaw/INDEX.md +3 -1
  66. package/kits/docs/evolclaw/fs-architecture.md +1215 -0
  67. package/kits/docs/evolclaw/fs.md +131 -0
  68. package/kits/docs/evolclaw/group-fs.md +209 -0
  69. package/kits/docs/evolclaw/stats.md +70 -0
  70. package/kits/docs/venues/aun-group.md +29 -6
  71. package/kits/docs/venues/group.md +5 -4
  72. package/kits/eck_manifest.json +12 -0
  73. package/kits/eck_message_manifest.json +30 -3
  74. package/kits/rules/05-venue.md +1 -1
  75. package/kits/templates/message-fragments/inject-default.md +2 -0
  76. package/kits/templates/system-fragments/response-depth.md +16 -0
  77. package/package.json +4 -4
  78. package/dist/agents/baseagent-normalize.js +0 -19
  79. package/dist/core/relation/peer-key.js +0 -16
  80. package/dist/evolclaw-config.js +0 -11
  81. package/dist/utils/channel-helpers.js +0 -46
  82. /package/dist/core/{cache/file-cache.js → daemon-file-cache.js} +0 -0
  83. /package/dist/{agents → eck}/kit-renderer.js +0 -0
@@ -13,7 +13,7 @@ import { createInterface } from 'readline';
13
13
  import fs from 'fs';
14
14
  import path from 'path';
15
15
  import os from 'os';
16
- import { resolveGoogleConfig } from './resolve.js';
16
+ import { resolveGoogleConfig } from './baseagent.js';
17
17
  import { commandExists } from '../utils/cross-platform.js';
18
18
  import { GeminiSessionFileAdapter } from '../core/session/adapters/gemini-session-file-adapter.js';
19
19
  import { logger } from '../utils/logger.js';
@@ -41,7 +41,7 @@ const GEMINI_MODELS = [
41
41
  // ── Gemini Runner ──
42
42
  export class GeminiRunner {
43
43
  name = 'gemini';
44
- capabilities = { clear: true, compact: false, fork: false };
44
+ capabilities = { clear: true, compact: false, fork: false, askUserQuestion: false, planApproval: false, fileRewind: 'unsupported' };
45
45
  resolved;
46
46
  model;
47
47
  activeProcesses = new Map();
@@ -0,0 +1,28 @@
1
+ // ── 类型守卫 ──
2
+ export function hasModelSwitcher(agent) {
3
+ return typeof agent.setModel === 'function' && typeof agent.listModels === 'function';
4
+ }
5
+ export function hasPermissionController(agent) {
6
+ return typeof agent.setMode === 'function' && typeof agent.listModes === 'function';
7
+ }
8
+ export function hasCompact(agent) {
9
+ return typeof agent.compact === 'function';
10
+ }
11
+ // ── Token usage helper functions ──
12
+ export function numericToken(value) {
13
+ return typeof value === 'number' && Number.isFinite(value) ? value : 0;
14
+ }
15
+ export function contextTokensForUsage(usage, isClaudeModel) {
16
+ if (!usage)
17
+ return 0;
18
+ if (!isClaudeModel)
19
+ return numericToken(usage.input_tokens);
20
+ return numericToken(usage.input_tokens)
21
+ + numericToken(usage.cache_creation_input_tokens)
22
+ + numericToken(usage.cache_read_input_tokens);
23
+ }
24
+ export function usageForContext(usage) {
25
+ const iterations = Array.isArray(usage?.iterations) ? usage.iterations : undefined;
26
+ const lastIteration = iterations?.slice().reverse().find(it => contextTokensForUsage(it, true) > 0);
27
+ return lastIteration ?? usage;
28
+ }
@@ -39,7 +39,7 @@ export class AidLoadError extends Error {
39
39
  */
40
40
  export async function getAidStore(opts) {
41
41
  const { aunPath: defaultAunPath } = await import('../../paths.js');
42
- const { loadEvolclawConfig } = await import('../../evolclaw-config.js');
42
+ const { loadEvolclawConfig } = await import('../../config-store.js');
43
43
  const { AIDStore } = await import('@agentunion/fastaun');
44
44
  const aunPath = opts.aunPath ?? defaultAunPath();
45
45
  const encryptionSeed = loadEvolclawConfig().aun?.encryptionSeed
@@ -11,7 +11,7 @@ export async function storageDownload(aid, url, localPath, opts) {
11
11
  const ownerAid = cleaned.slice(0, slashIdx);
12
12
  const objectKey = cleaned.slice(slashIdx + 1);
13
13
  const ticketResult = await rpcCall(aid, 'storage.create_download_ticket', {
14
- owner: ownerAid,
14
+ owner_aid: ownerAid,
15
15
  object_key: objectKey,
16
16
  }, { aunPath: opts?.aunPath });
17
17
  if (!ticketResult.ok) {
@@ -27,9 +27,21 @@ export async function storageUpload(aid, localFile, remotePath, opts) {
27
27
  const completeResult = await rpcCall(aid, 'storage.complete_upload', {
28
28
  object_key: remotePath,
29
29
  sha256,
30
+ is_private: !(opts?.isPublic),
30
31
  }, { aunPath: opts?.aunPath });
31
32
  if (!completeResult.ok) {
32
33
  return { ok: false, objectKey: remotePath, error: JSON.stringify(completeResult.error) };
33
34
  }
34
- return { ok: true, objectKey: remotePath };
35
+ // 公开上传时获取可访问的 URL
36
+ let publicUrl;
37
+ if (opts?.isPublic) {
38
+ const ticketResult = await rpcCall(aid, 'storage.create_download_ticket', {
39
+ object_key: remotePath,
40
+ expire_in_seconds: 86400 * 30, // 30天
41
+ }, { aunPath: opts?.aunPath });
42
+ if (ticketResult.ok) {
43
+ publicUrl = `https://${aid}/storage/${remotePath}`;
44
+ }
45
+ }
46
+ return { ok: true, objectKey: remotePath, publicUrl };
35
47
  }