evolcore 0.0.43-test.1 → 0.0.43-test.3

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 (200) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/README.md +22 -0
  3. package/dist/agents/claude-runner.js +26 -2
  4. package/dist/agents/codex/app-server-client.js +12 -0
  5. package/dist/agents/codex-runner.js +49 -8
  6. package/dist/agents/ecagent-runner.js +39 -15
  7. package/dist/agents/gemini-runner.js +15 -12
  8. package/dist/agents/tool-time-context.js +55 -0
  9. package/dist/aun/aid/agentmd.js +21 -1
  10. package/dist/aun/menu/client.js +1 -1
  11. package/dist/aun/model-headers.js +17 -0
  12. package/dist/aun/msg/p2p.js +7 -2
  13. package/dist/channels/aun.js +522 -50
  14. package/dist/channels/builtin-plugins.js +16 -11
  15. package/dist/channels/daemon.js +4 -0
  16. package/dist/channels/dingtalk.js +83 -31
  17. package/dist/channels/feishu.js +29 -13
  18. package/dist/channels/qqbot.js +32 -11
  19. package/dist/channels/wechat.js +13 -3
  20. package/dist/channels/wecom.js +67 -27
  21. package/dist/cli/agent-command.js +3 -86
  22. package/dist/cli/agent-create.js +20 -6
  23. package/dist/cli/agent.js +1 -79
  24. package/dist/cli/aun-commands.js +18 -19
  25. package/dist/cli/config.js +1 -1
  26. package/dist/cli/daemon-commands.js +47 -2
  27. package/dist/cli/data-command.js +9 -1
  28. package/dist/cli/debug-mode.js +1 -1
  29. package/dist/cli/diag.js +1 -1
  30. package/dist/cli/directory.js +149 -91
  31. package/dist/cli/getmeta-command.js +1 -1
  32. package/dist/cli/index.js +79 -22
  33. package/dist/cli/init.js +1 -23
  34. package/dist/cli/link-rules.js +1 -1
  35. package/dist/cli/managed-command-guard.js +0 -1
  36. package/dist/cli/pa-workspace-command.js +36 -2
  37. package/dist/cli/peer.js +3 -2
  38. package/dist/cli/restart-monitor.js +17 -3
  39. package/dist/cli/role.js +1 -1
  40. package/dist/cli/session-command.js +1 -1
  41. package/dist/cli/stats.js +2 -2
  42. package/dist/cli/task-context.js +3 -1
  43. package/dist/cli/thread-command.js +1 -1
  44. package/dist/cli/watch-msg.js +1 -1
  45. package/dist/config/builtin-role-templates.js +2 -2
  46. package/dist/config/builtin-roles.js +2 -1
  47. package/dist/config/config-field-policy.js +7 -2
  48. package/dist/config/config-manager.js +32 -10
  49. package/dist/config/peer-role-resolver.js +23 -1
  50. package/dist/config/role-schema.js +29 -4
  51. package/dist/config/role-service.js +12 -7
  52. package/dist/config/role-store.js +30 -8
  53. package/dist/config-store.js +75 -4
  54. package/dist/core/agent-ipc-registration.js +16 -59
  55. package/dist/core/auth/auth-gateway.js +14 -4
  56. package/dist/core/auth/authorization-audit.js +52 -14
  57. package/dist/core/auth/operation-authorizer.js +17 -11
  58. package/dist/core/auth/operation-catalog.js +5 -13
  59. package/dist/core/channel-loader.js +152 -16
  60. package/dist/core/channel-runtime.js +5 -0
  61. package/dist/core/command/agent-control.js +2 -1
  62. package/dist/core/command/agentmd-menu-request.js +50 -0
  63. package/dist/core/command/agentmd-menu.js +156 -0
  64. package/dist/core/command/cli-intent-parser.js +0 -8
  65. package/dist/core/command/command-handler.js +47 -40
  66. package/dist/core/command/connect-menu.js +7 -3
  67. package/dist/core/command/menu-catalog.js +16 -2
  68. package/dist/core/command/menu-handler.js +107 -14
  69. package/dist/core/command/menu-protocol.js +28 -0
  70. package/dist/core/command/role-menu.js +23 -9
  71. package/dist/core/command/slash-handler.js +139 -51
  72. package/dist/core/daemon-file-cache.js +3 -3
  73. package/dist/core/daemon-lifecycle.js +9 -1
  74. package/dist/core/evolagent-registry.js +5 -4
  75. package/dist/core/evolagent.js +10 -12
  76. package/dist/core/handoff/argv-parse.js +115 -0
  77. package/dist/core/handoff/ipc-registration.js +1 -1
  78. package/dist/core/ipc-registration.js +19 -2
  79. package/dist/core/lifecycle-notice.js +185 -0
  80. package/dist/core/memory/consolidation.js +8 -1
  81. package/dist/core/memory/relation-sweep.js +20 -8
  82. package/dist/core/message/aun-ipc-sender.js +35 -2
  83. package/dist/core/message/contact-admission.js +530 -0
  84. package/dist/core/message/im-renderer.js +111 -16
  85. package/dist/core/message/message-admission.js +29 -54
  86. package/dist/core/message/message-bridge.js +62 -8
  87. package/dist/core/message/message-utils.js +9 -5
  88. package/dist/core/message/peer-mode.js +55 -13
  89. package/dist/core/message/response-engine.js +298 -78
  90. package/dist/core/message/retry-scheduler.js +4 -0
  91. package/dist/core/ownership/owner-resolver.js +72 -34
  92. package/dist/core/permission/ec-command-parser.js +25 -38
  93. package/dist/core/permission/readonly-shell-query.js +34 -8
  94. package/dist/core/permission/tool-policy.js +50 -5
  95. package/dist/core/relation/pa-team.js +127 -0
  96. package/dist/core/role/runtime-policy.js +18 -5
  97. package/dist/core/session/session-manager.js +9 -1
  98. package/dist/core/soul.js +66 -0
  99. package/dist/core/system-session/memory.js +2 -2
  100. package/dist/core/thread/thread-service.js +6 -4
  101. package/dist/directory/contact-admission-paths.js +9 -0
  102. package/dist/directory/owner-directory-admission.js +125 -29
  103. package/dist/directory/owner-directory-cache.js +554 -58
  104. package/dist/directory/owner-directory-identity.js +60 -0
  105. package/dist/directory/owner-directory-markdown.js +154 -58
  106. package/dist/directory/owner-directory-policy.js +108 -0
  107. package/dist/directory/owner-directory-query-operation.js +399 -90
  108. package/dist/directory/owner-directory-remarks.js +29 -2
  109. package/dist/directory/owner-directory-request-operation.js +76 -0
  110. package/dist/directory/owner-directory-scope.js +35 -4
  111. package/dist/directory/owner-directory-search.js +118 -33
  112. package/dist/directory/owner-directory-store.js +117 -30
  113. package/dist/directory/owner-directory-text.js +60 -0
  114. package/dist/eck/kit-renderer.js +18 -8
  115. package/dist/eck/manifest-engine.js +55 -6
  116. package/dist/ecweb/basic-settings-service.js +2 -2
  117. package/dist/ecweb/message-context-service.js +28 -16
  118. package/dist/index.js +20 -5
  119. package/dist/ipc.js +1 -1
  120. package/dist/paths.js +29 -1
  121. package/dist/product.js +1 -0
  122. package/dist/response-system/config-resolver.js +1 -1
  123. package/dist/response-system/engines/v1/index.js +2 -1
  124. package/dist/response-system/modes/single-session/index.js +7 -2
  125. package/dist/trigger/scheduler.js +7 -4
  126. package/dist/trigger/validation.js +4 -0
  127. package/dist/utils/error-utils.js +12 -7
  128. package/dist/utils/logger.js +13 -4
  129. package/dist/utils/npm-ops.js +2 -2
  130. package/dist/utils/windows-autostart.js +1 -1
  131. package/ecagent/README.md +18 -0
  132. package/ecagent/dist/agent-loop.js +43 -1
  133. package/ecagent/dist/harness/agent-harness.d.ts +2 -0
  134. package/ecagent/dist/harness/agent-harness.js +24 -8
  135. package/ecagent/dist/harness/compaction/compaction.js +3 -0
  136. package/ecagent/dist/harness/types.d.ts +1 -0
  137. package/kits/docs/INDEX.md +1 -0
  138. package/kits/docs/channels/aun.md +1 -1
  139. package/kits/docs/context-assembly.md +21 -6
  140. package/kits/docs/eck_templates/INDEX.template.md +1 -2
  141. package/kits/docs/evolcore/INDEX.md +4 -1
  142. package/kits/docs/evolcore/agent-create.md +5 -5
  143. package/kits/docs/evolcore/agent.md +4 -9
  144. package/kits/docs/evolcore/directory.md +227 -0
  145. package/kits/docs/evolcore/ecweb-lifecycle.md +26 -0
  146. package/kits/docs/evolcore/file-navigation.md +265 -0
  147. package/kits/docs/evolcore/menu-protocol.md +55 -0
  148. package/kits/docs/evolcore/msg.md +1 -0
  149. package/kits/docs/evolcore/peer.md +2 -1
  150. package/kits/docs/evolcore/response.md +7 -1
  151. package/kits/docs/evolcore/task.md +2 -0
  152. package/kits/docs/evolcore/tool-authorization.md +1 -1
  153. package/kits/docs/evolcore/trigger.md +4 -0
  154. package/kits/docs/identity/ROLE_DETAIL.md +2 -0
  155. package/kits/docs/prompt-loading-architecture.md +6 -2
  156. package/kits/eck_manifest.auxiliary.json +1 -0
  157. package/kits/eck_manifest.json +64 -7
  158. package/kits/eck_manifest.memory.json +93 -4
  159. package/kits/rules/01-overview.md +2 -2
  160. package/kits/rules/03-identity.md +10 -9
  161. package/kits/rules/05-venue.md +2 -4
  162. package/kits/rules/06-channel.md +1 -1
  163. package/kits/schemas/_meta.json +44 -3
  164. package/kits/schemas/agent-config.schema.18.json +5 -0
  165. package/kits/schemas/agent-config.schema.19.json +924 -0
  166. package/kits/schemas/agent-config.schema.20.json +925 -0
  167. package/kits/schemas/relation-config.schema.12.json +289 -0
  168. package/kits/schemas/relation-config.schema.13.json +289 -0
  169. package/kits/schemas/role-config.schema.2.json +215 -0
  170. package/kits/schemas/role-config.schema.3.json +1038 -0
  171. package/kits/schemas/role-registry.schema.1.json +3 -2
  172. package/kits/skills/ec-skill/scripts/cli.mjs +3 -2
  173. package/kits/skills/ec-trigger/SKILL.md +4 -4
  174. package/kits/skills/personal-assistant/SKILL.md +109 -53
  175. package/kits/skills/personal-assistant/references/02-bootstrap.md +73 -30
  176. package/kits/skills/personal-assistant/scripts/clean.mjs +35 -18
  177. package/kits/skills/personal-assistant/scripts/init.mjs +41 -2
  178. package/kits/skills/personal-assistant/scripts/lib/persona.mjs +185 -0
  179. package/kits/skills/personal-assistant/scripts/migrate.mjs +55 -4
  180. package/kits/skills/personal-assistant/scripts/pa.mjs +173 -0
  181. package/kits/skills/personal-assistant/scripts/uninstall.mjs +130 -0
  182. package/kits/skills/personal-assistant/templates/persona-section.md +3 -3
  183. package/kits/templates/message-fragments/handoff-request-to-target.md +1 -1
  184. package/kits/templates/soul/00-GUIDE.md +39 -0
  185. package/kits/templates/soul/01-identity.md +5 -0
  186. package/kits/templates/soul/02-persona.md +11 -0
  187. package/kits/templates/soul/03-duties.md +5 -0
  188. package/kits/templates/soul/04-working-style.md +5 -0
  189. package/kits/templates/system-fragments/bootstrap.md +7 -7
  190. package/kits/templates/system-fragments/channel.md +2 -2
  191. package/kits/templates/system-fragments/commands.md +3 -2
  192. package/kits/templates/system-fragments/directory-contacts.md +9 -0
  193. package/kits/templates/system-fragments/memory.md +1 -1
  194. package/kits/templates/system-fragments/personal-assistant.md +50 -0
  195. package/kits/templates/system-fragments/reply.md +7 -0
  196. package/kits/templates/system-fragments/session.md +6 -2
  197. package/package.json +3 -2
  198. package/dist/cli/handoff-command.js +0 -353
  199. package/dist/directory/owner-directory-remark-operation.js +0 -147
  200. package/kits/docs/evolcore/self-summary.md +0 -29
@@ -2,28 +2,69 @@ import { loadSchema } from '../../config/schema-registry.js';
2
2
  import { resolveEffective } from '../../config/config-manager.js';
3
3
  import { resolveRuntimeStringField } from '../role/runtime-policy.js';
4
4
  import { isManagementRole } from '../../config/builtin-roles.js';
5
+ import { resolveAgentLifecycle } from '../../config/lifecycle.js';
6
+ export const CHAT_MODES = ['interactive', 'proactive', 'paactive'];
7
+ export function isChatMode(value) {
8
+ return CHAT_MODES.includes(value);
9
+ }
10
+ /** PA output is supported only in active AUN human Owner conversations. */
11
+ export function supportsPaactive(params) {
12
+ const channelType = params.channelType ?? params.peerKey?.split('#')[0];
13
+ return channelType === 'aun'
14
+ && params.chatType === 'private'
15
+ && normalizePeerType(params.peerType) === 'human'
16
+ && params.role === 'owner'
17
+ && (params.lifecycle === undefined || params.lifecycle === 'active')
18
+ && (params.sessionType === undefined || params.sessionType === 'main');
19
+ }
20
+ /** Keep unsupported inherited PA settings from becoming output-as-reply mode. */
21
+ export function chatModeForScene(value, params) {
22
+ if (params.chatType === 'group' || normalizePeerType(params.peerType) === 'group')
23
+ return 'proactive';
24
+ if (value === 'paactive' && supportsPaactive(params))
25
+ return value;
26
+ if (value === 'interactive' || value === 'proactive')
27
+ return value;
28
+ if (value === 'paactive') {
29
+ const kind = normalizePeerType(params.peerType);
30
+ if (kind === 'system' || kind === 'service')
31
+ return 'interactive';
32
+ if (kind === 'agent'
33
+ || isPrivateChatmodeRoleLocked(chatmodeFieldForPeer(params.chatType, params.peerType), params.role))
34
+ return 'proactive';
35
+ }
36
+ const fallback = chatmodeFactoryDefaults()[chatmodeFieldForPeer(params.chatType, params.peerType)];
37
+ return fallback === 'paactive' ? 'interactive' : fallback;
38
+ }
5
39
  /** Resolve the effective chat mode from the ConfigManager layering context. */
6
40
  export function resolveChatMode(params) {
7
41
  let configured;
42
+ let lifecycle = params.lifecycle;
8
43
  try {
9
- configured = resolveEffective({
44
+ const effective = resolveEffective({
10
45
  self: params.self,
11
46
  peerKey: params.peerKey,
12
- }, { cache: true }).chatmode;
47
+ }, { cache: true });
48
+ configured = effective.chatmode;
49
+ if (lifecycle === undefined)
50
+ lifecycle = resolveAgentLifecycle(effective);
13
51
  }
14
52
  catch {
15
53
  configured = undefined;
16
54
  }
17
55
  const kind = normalizePeerType(params.peerType);
56
+ // Group conversations always use proactive delivery; interactive and
57
+ // paactive are private-chat presentation modes.
58
+ if (params.chatType === 'group' || kind === 'group')
59
+ return 'proactive';
18
60
  // 运行时硬约束(非配置项):system/service 始终 interactive;agent 始终 proactive
19
61
  if (kind === 'system' || kind === 'service')
20
62
  return 'interactive';
21
63
  if (kind === 'agent')
22
64
  return 'proactive';
23
65
  const field = chatmodeFieldForPeer(params.chatType, params.peerType);
24
- // 人类私聊的角色门槛(硬约束):interactive 是「输出即回复」的高信任模式,
25
- // 只有 owner/admin 才走下面的分层配置;其余角色(含未分配/未知)直接 proactive,
26
- // 关系级或 agent 级把 chatmode.private 写成 interactive 都不生效。
66
+ // 人类私聊的基础角色门槛:owner/admin 才解析分层配置;
67
+ // paactive 另由 supportsPaactive 限定为 owner,其余角色直接 proactive。
27
68
  if (isPrivateChatmodeRoleLocked(field, params.role))
28
69
  return 'proactive';
29
70
  const decision = resolveRuntimeStringField({
@@ -33,13 +74,11 @@ export function resolveChatMode(params) {
33
74
  configuredValue: configured?.[field],
34
75
  });
35
76
  const effectiveValue = decision.effectiveValue;
36
- return effectiveValue === 'interactive' || effectiveValue === 'proactive'
37
- ? effectiveValue
38
- : chatmodeFactoryDefaults()[field];
77
+ return chatModeForScene(effectiveValue, { ...params, lifecycle });
39
78
  }
40
79
  /**
41
80
  * 人类私聊(chatmode.private)是否被角色锁定为 proactive。
42
- * owner/admin 之外的任何角色(含 null/'none'/未知)都锁定。
81
+ * interactive 需要 owner/admin;paactive 在此基础上另由 supportsPaactive 限定为 owner。
43
82
  */
44
83
  export function isPrivateChatmodeRoleLocked(field, role) {
45
84
  return field === 'private' && !isManagementRole(role);
@@ -66,6 +105,7 @@ export function resolveChatModeForField(params) {
66
105
  ...params,
67
106
  chatType: params.field === 'group' ? 'group' : 'private',
68
107
  peerType: params.field === 'nothuman' ? 'agent' : 'human',
108
+ channelType: params.channelType ?? params.peerKey?.split('#')[0] ?? 'aun',
69
109
  });
70
110
  }
71
111
  export function normalizePeerType(value) {
@@ -93,7 +133,7 @@ export function isSystemOrServicePeer(peerType) {
93
133
  }
94
134
  /**
95
135
  * 解析某会话对端的 chatMode。优先级(高→低):
96
- * 1. 运行时硬约束:system/service 对端始终 interactive(非配置项)
136
+ * 1. 群聊固定 proactive;私聊 system/service 对端始终 interactive(非配置项)
97
137
  * 2. 合并后的 chatmode 场景表 `configured`(chatmode.{private|group|nothuman})——
98
138
  * 关系级与 agent 级同名字典,已由 ConfigManager 按 x-merge:dict 逐键合并
99
139
  * 3. schema 出厂默认表 `chatmodeFactoryDefaults()`
@@ -103,6 +143,8 @@ export function isSystemOrServicePeer(peerType) {
103
143
  */
104
144
  export function resolveChatModeForPeer(params) {
105
145
  const kind = normalizePeerType(params.peerType);
146
+ if (params.chatType === 'group' || kind === 'group')
147
+ return 'proactive';
106
148
  // 运行时硬约束(非配置项):system/service 对端始终同步交互;agent 对端始终主动响应
107
149
  if (kind === 'system' || kind === 'service')
108
150
  return 'interactive';
@@ -110,7 +152,7 @@ export function resolveChatModeForPeer(params) {
110
152
  return 'proactive';
111
153
  // 合并后的场景表 → 出厂默认表
112
154
  const field = chatmodeFieldForPeer(params.chatType, params.peerType);
113
- return params.configured?.[field] ?? chatmodeFactoryDefaults()[field];
155
+ return chatModeForScene(params.configured?.[field], params);
114
156
  }
115
157
  /**
116
158
  * chatMode 出厂默认表 —— 唯一来源是 agent-config schema 的 chatmode.default
@@ -129,10 +171,10 @@ export function chatmodeFactoryDefaults() {
129
171
  }
130
172
  export function chatmodeFieldForPeer(chatType, peerType) {
131
173
  const kind = normalizePeerType(peerType);
132
- if (kind === 'system' || kind === 'service')
133
- return 'private';
134
174
  if (chatType === 'group' || kind === 'group')
135
175
  return 'group';
176
+ if (kind === 'system' || kind === 'service')
177
+ return 'private';
136
178
  if (kind === 'agent' || kind === 'unknown')
137
179
  return 'nothuman';
138
180
  return 'private';