evolcore 0.0.12 → 0.0.13

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 (104) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/bin/ec-safe-output.js +26 -7
  3. package/dist/agents/claude-runner.js +53 -7
  4. package/dist/agents/codex-app-server-client.js +53 -5
  5. package/dist/agents/codex-runner.js +104 -59
  6. package/dist/agents/ecagent-runner.js +4 -1
  7. package/dist/aun/aid/control-aid.js +36 -13
  8. package/dist/aun/aid/store.js +13 -7
  9. package/dist/aun/group-fs-download.js +56 -0
  10. package/dist/aun/group-identity.js +1 -2
  11. package/dist/aun/msg/group.js +11 -33
  12. package/dist/aun/msg/index.js +1 -2
  13. package/dist/aun/msg/managed-operation.js +116 -55
  14. package/dist/aun/msg/upload.js +16 -1
  15. package/dist/aun/outbox.js +31 -2
  16. package/dist/aun/rpc/client.js +66 -0
  17. package/dist/aun/rpc/index.js +1 -2
  18. package/dist/aun/storage/{upload.js → client.js} +11 -2
  19. package/dist/aun/storage/index.js +1 -2
  20. package/dist/channels/aun.js +371 -136
  21. package/dist/cli/agent.js +9 -96
  22. package/dist/cli/cli-argv.js +10 -0
  23. package/dist/cli/config.js +9 -17
  24. package/dist/cli/ctl-command.js +1 -1
  25. package/dist/cli/daemon-commands.js +39 -24
  26. package/dist/cli/fs-command.js +19 -10
  27. package/dist/cli/init.js +77 -8
  28. package/dist/cli/queue-command.js +42 -0
  29. package/dist/cli/restart-monitor.js +3 -14
  30. package/dist/cli/trigger-command.js +7 -0
  31. package/dist/config/access-policy.js +1 -2
  32. package/dist/config/builtin-roles.js +5 -0
  33. package/dist/config/config-manager.js +21 -1
  34. package/dist/config/peer-role-resolver.js +6 -2
  35. package/dist/config/role-migration-startup.js +53 -0
  36. package/dist/config/role-store.js +1 -1
  37. package/dist/core/auth/agent-delegation.js +1 -1
  38. package/dist/core/auth/auth-gateway.js +29 -1
  39. package/dist/core/auth/authorization-audit.js +15 -0
  40. package/dist/core/auth/operation-authorizer.js +1 -0
  41. package/dist/core/auth/operation-catalog.js +9 -0
  42. package/dist/core/bootstrap-messages.js +9 -2
  43. package/dist/core/bootstrap-service.js +1 -0
  44. package/dist/core/command/command-handler.js +198 -51
  45. package/dist/core/command/menu-catalog.js +4 -0
  46. package/dist/core/command/menu-handler.js +85 -18
  47. package/dist/core/command/menu-protocol.js +23 -2
  48. package/dist/core/command/slash-handler.js +58 -10
  49. package/dist/core/event-catalog.js +6 -0
  50. package/dist/core/handoff/runtime.js +12 -1
  51. package/dist/core/handoff/store.js +5 -1
  52. package/dist/core/interaction-router.js +10 -0
  53. package/dist/core/message/im-renderer.js +19 -0
  54. package/dist/core/message/message-bridge.js +63 -11
  55. package/dist/core/message/message-log.js +2 -0
  56. package/dist/core/message/message-queue.js +267 -39
  57. package/dist/core/message/message-utils.js +81 -4
  58. package/dist/core/message/response-engine.js +107 -41
  59. package/dist/core/message/stream-debouncer.js +10 -2
  60. package/dist/core/permission/approval-gateway.js +1 -0
  61. package/dist/core/permission/ec-command-parser.js +93 -14
  62. package/dist/core/permission/index.js +1 -1
  63. package/dist/core/permission/mode.js +15 -0
  64. package/dist/core/permission/readonly-shell-query.js +148 -8
  65. package/dist/core/permission/sandbox-runtime.js +21 -0
  66. package/dist/core/permission/tool-policy.js +249 -27
  67. package/dist/core/protected-paths.js +107 -2
  68. package/dist/core/session/session-manager.js +21 -2
  69. package/dist/core/session/session-mapper.js +20 -1
  70. package/dist/eck/detect.js +18 -1
  71. package/dist/eck/group-rules-sync.js +15 -44
  72. package/dist/index.js +161 -86
  73. package/dist/ipc.js +16 -3
  74. package/dist/paths.js +3 -0
  75. package/dist/trigger/feedback.js +64 -11
  76. package/dist/trigger/manager.js +21 -1
  77. package/dist/trigger/parser.js +14 -2
  78. package/dist/trigger/scheduler.js +1 -0
  79. package/dist/trigger/validation.js +67 -6
  80. package/dist/utils/ecweb-supervisor.js +332 -0
  81. package/dist/utils/error-utils.js +10 -0
  82. package/kits/docs/evolcore/trigger.md +17 -1
  83. package/kits/migrations/migrate-contact-book-v2.mjs +1 -2
  84. package/kits/schemas/role-config.schema.1.json +1 -0
  85. package/kits/templates/roles/admin.json +5 -0
  86. package/kits/templates/roles/member.json +7 -1
  87. package/kits/templates/roles/visitor.json +2 -0
  88. package/package.json +1 -1
  89. package/dist/aun/msg/payload-type.js +0 -27
  90. package/dist/aun/rpc/caller.js +0 -42
  91. package/dist/aun/rpc/connection.js +0 -25
  92. package/dist/aun/storage/manage.js +0 -10
  93. package/dist/config/access-policy-domain.js +0 -18
  94. package/dist/config/config-batch-get.js +0 -11
  95. package/dist/config/owner-policy.js +0 -4
  96. package/dist/config/role-config-v4-startup.js +0 -32
  97. package/dist/config/role-config-v5-startup.js +0 -27
  98. package/dist/core/auth/trigger-authorization.js +0 -15
  99. package/dist/core/interaction-registration.js +0 -10
  100. package/dist/core/permission/execution-sandbox.js +0 -16
  101. package/dist/core/relation/peer-key.js +0 -1
  102. package/dist/core/session/session-key.js +0 -24
  103. package/dist/eck/baseagent-caps.js +0 -18
  104. package/dist/eck/rules-loader.js +0 -28
@@ -0,0 +1,66 @@
1
+ import { getAidStore, loadClient, SLOT } from '../aid/store.js';
2
+ export async function createShortConnection(aid, opts) {
3
+ const store = await getAidStore({ slotId: opts?.slotId ?? SLOT.cli, aunPath: opts?.aunPath });
4
+ try {
5
+ const client = await loadClient(store, aid);
6
+ await client.connect({ connection_kind: 'short', short_ttl_ms: 30000, auto_reconnect: false });
7
+ return {
8
+ async call(method, params) {
9
+ return client.call(method, params);
10
+ },
11
+ async close() {
12
+ try {
13
+ await client.close();
14
+ }
15
+ finally {
16
+ store.close();
17
+ }
18
+ },
19
+ };
20
+ }
21
+ catch (error) {
22
+ store.close();
23
+ throw error;
24
+ }
25
+ }
26
+ export async function rpcCall(aid, method, params, opts) {
27
+ const conn = await createShortConnection(aid, opts);
28
+ try {
29
+ const result = await conn.call(method, params);
30
+ return { ok: true, result };
31
+ }
32
+ catch (error) {
33
+ if (error.code !== undefined && error.message !== undefined) {
34
+ return { ok: false, error: { code: error.code, message: error.message, data: error.data } };
35
+ }
36
+ return { ok: false, error: { code: -1, message: String(error.message || error) } };
37
+ }
38
+ finally {
39
+ await conn.close();
40
+ }
41
+ }
42
+ export async function rpcBatch(aid, calls, opts) {
43
+ const conn = await createShortConnection(aid, opts);
44
+ const results = [];
45
+ try {
46
+ for (const { method, params } of calls) {
47
+ try {
48
+ const result = await conn.call(method, params);
49
+ results.push({ ok: true, result });
50
+ }
51
+ catch (error) {
52
+ if (error.code !== undefined && error.message !== undefined) {
53
+ results.push({ ok: false, error: { code: error.code, message: error.message, data: error.data } });
54
+ }
55
+ else {
56
+ results.push({ ok: false, error: { code: -1, message: String(error.message || error) } });
57
+ }
58
+ break;
59
+ }
60
+ }
61
+ }
62
+ finally {
63
+ await conn.close();
64
+ }
65
+ return results;
66
+ }
@@ -1,2 +1 @@
1
- export { rpcCall, rpcBatch } from './caller.js';
2
- export { createShortConnection } from './connection.js';
1
+ export { rpcCall, rpcBatch, createShortConnection } from './client.js';
@@ -46,7 +46,7 @@ export async function storageUpload(aid, localFile, remotePath, opts) {
46
46
  sha256,
47
47
  content_type: contentType,
48
48
  size_bytes: fileBuffer.length,
49
- is_private: !(opts?.isPublic),
49
+ is_private: !opts?.isPublic,
50
50
  }, { aunPath: opts?.aunPath });
51
51
  if (!completeResult.ok) {
52
52
  return { ok: false, objectKey: remotePath, error: rpcErrorToString(completeResult.error) };
@@ -56,7 +56,7 @@ export async function storageUpload(aid, localFile, remotePath, opts) {
56
56
  if (!publicUrl) {
57
57
  const ticketResult = await rpcCall(aid, 'storage.create_download_ticket', {
58
58
  object_key: remotePath,
59
- expire_in_seconds: 86400 * 30, // 30天
59
+ expire_in_seconds: 86400 * 30,
60
60
  }, { aunPath: opts?.aunPath });
61
61
  if (ticketResult.ok) {
62
62
  publicUrl = pickUrl(ticketResult.result?.url) ?? pickUrl(ticketResult.result?.download_url);
@@ -66,3 +66,12 @@ export async function storageUpload(aid, localFile, remotePath, opts) {
66
66
  }
67
67
  return { ok: true, objectKey: remotePath, publicUrl };
68
68
  }
69
+ export async function storageLs(aid, prefix, opts) {
70
+ return rpcCall(aid, 'storage.list_objects', { prefix: prefix || '' }, { aunPath: opts?.aunPath });
71
+ }
72
+ export async function storageRm(aid, remotePath, opts) {
73
+ return rpcCall(aid, 'storage.delete_object', { object_key: remotePath }, { aunPath: opts?.aunPath });
74
+ }
75
+ export async function storageQuota(aid, opts) {
76
+ return rpcCall(aid, 'storage.get_quota', {}, { aunPath: opts?.aunPath });
77
+ }
@@ -1,3 +1,2 @@
1
- export { storageUpload } from './upload.js';
1
+ export { storageUpload, storageLs, storageRm, storageQuota } from './client.js';
2
2
  export { storageDownload } from './download.js';
3
- export { storageLs, storageRm, storageQuota } from './manage.js';