evolcore 0.0.48 → 0.0.50

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 (302) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/bin/ecmsg.js +9 -4
  3. package/dist/ability/caller/authorization.js +21 -0
  4. package/dist/ability/caller/command.js +164 -0
  5. package/dist/ability/caller/contract.js +102 -0
  6. package/dist/ability/caller/daemon.js +158 -0
  7. package/dist/ability/caller/service.js +380 -0
  8. package/dist/ability/command-contract.js +5 -0
  9. package/dist/ability/daemon.js +5 -1
  10. package/dist/ability/interop-v1.js +10 -3
  11. package/dist/ability/management.js +1 -0
  12. package/dist/agent-template/jobs.js +173 -1
  13. package/dist/agent-template/runtime.js +285 -8
  14. package/dist/agent-template/service.js +1159 -40
  15. package/dist/agent-template/types.js +2 -1
  16. package/dist/agents/baseagent-availability.js +27 -3
  17. package/dist/agents/baseagent-capability-adapter.js +102 -0
  18. package/dist/agents/baseagent-plugin-descriptor.js +274 -0
  19. package/dist/agents/baseagent-plugin-loader.js +145 -0
  20. package/dist/agents/baseagent.js +68 -2
  21. package/dist/agents/claude-gateway/agent-registration.js +389 -0
  22. package/dist/agents/claude-gateway/binding.js +96 -0
  23. package/dist/agents/claude-gateway/inbox.js +138 -0
  24. package/dist/agents/claude-gateway/index.js +125 -0
  25. package/dist/agents/claude-gateway/listing.js +330 -0
  26. package/dist/agents/claude-gateway/router.js +328 -0
  27. package/dist/agents/claude-gateway/sessions.js +128 -0
  28. package/dist/agents/claude-gateway/terminal.js +250 -0
  29. package/dist/agents/claude-gateway/transcript.js +272 -0
  30. package/dist/agents/claude-gateway/types.js +14 -0
  31. package/dist/agents/claude-runner.js +6 -10
  32. package/dist/agents/codex-runner.js +9 -2
  33. package/dist/agents/{gemini-runner.js → gemini/gemini-runner.js} +17 -17
  34. package/dist/{core/session/adapters → agents/gemini}/gemini-session-file-adapter.js +2 -2
  35. package/dist/agents/gemini/index.js +51 -0
  36. package/dist/aun/aid/control-aid.js +52 -32
  37. package/dist/aun/group/invite-service.js +6 -36
  38. package/dist/aun/group/operations.js +6 -0
  39. package/dist/aun/msg/mention-schema.js +1 -1
  40. package/dist/aun/msg/p2p.js +31 -2
  41. package/dist/aun/msg/upload.js +126 -3
  42. package/dist/build-identity.json +1 -1
  43. package/dist/channels/aun.js +1175 -457
  44. package/dist/cli/ability-command.js +42 -0
  45. package/dist/cli/agent-command.js +20 -1
  46. package/dist/cli/agent-create.js +78 -18
  47. package/dist/cli/agent-template.js +5 -3
  48. package/dist/cli/agent.js +91 -0
  49. package/dist/cli/aun-commands.js +92 -34
  50. package/dist/cli/bench.js +5 -2
  51. package/dist/cli/config.js +22 -6
  52. package/dist/cli/daemon-commands.js +245 -101
  53. package/dist/cli/directory.js +6 -1
  54. package/dist/cli/ecmsg-gateway.js +11 -9
  55. package/dist/cli/index.js +30 -5
  56. package/dist/cli/init.js +39 -63
  57. package/dist/cli/managed-command-guard.js +3 -0
  58. package/dist/cli/menu-client.js +32 -7
  59. package/dist/cli/model.js +20 -5
  60. package/dist/cli/pay-command.js +30 -0
  61. package/dist/cli/provider-command.js +6 -2
  62. package/dist/cli/quota.js +89 -0
  63. package/dist/cli/restart-monitor.js +2 -2
  64. package/dist/cli/role.js +1 -0
  65. package/dist/cli/services-command.js +12 -9
  66. package/dist/cli/team-workspace-command.js +56 -2
  67. package/dist/cli/thread-command.js +78 -12
  68. package/dist/config/access-policy.js +16 -3
  69. package/dist/config/config-field-policy.js +88 -9
  70. package/dist/config/config-manager.js +97 -47
  71. package/dist/config/config-operation-service.js +22 -1
  72. package/dist/config/gateway-config.js +9 -8
  73. package/dist/config/owner-config.js +0 -16
  74. package/dist/config/peer-role-resolver.js +1 -7
  75. package/dist/config/providers-config.js +107 -20
  76. package/dist/config/providers-management.js +45 -21
  77. package/dist/config/resolved-config-op.js +4 -44
  78. package/dist/config/schema-migration.js +78 -5
  79. package/dist/config/schema-registry.js +52 -7
  80. package/dist/config-store.js +1309 -17
  81. package/dist/core/agent-application-service.js +220 -1
  82. package/dist/core/agent-ipc-registration.js +19 -2
  83. package/dist/core/agent-reload-coordinator.js +5 -0
  84. package/dist/core/agent-runtime.js +198 -54
  85. package/dist/core/auth/agent-delegation.js +14 -0
  86. package/dist/core/auth/delegation-authorization.js +33 -26
  87. package/dist/core/auth/operation-authorizer.js +16 -1
  88. package/dist/core/auth/operation-catalog.js +59 -7
  89. package/dist/core/baseagent-loader.js +30 -3
  90. package/dist/core/capability/capability-manager.js +16 -7
  91. package/dist/core/channel-runtime.js +4 -2
  92. package/dist/core/command/agent-control.js +20 -2
  93. package/dist/core/command/agent-template-menu.js +4 -3
  94. package/dist/core/command/cli-intent-parser.js +28 -0
  95. package/dist/core/command/command-handler.js +45 -2
  96. package/dist/core/command/menu-catalog.js +20 -4
  97. package/dist/core/command/menu-file-path.js +70 -0
  98. package/dist/core/command/menu-handler.js +97 -73
  99. package/dist/core/command/menu-protocol.js +29 -0
  100. package/dist/core/command/menu-query-batch.js +2 -2
  101. package/dist/core/command/private-mention-menu.js +71 -0
  102. package/dist/core/command/remote-shell.js +565 -0
  103. package/dist/core/command/slash-handler.js +17 -26
  104. package/dist/core/command/team-workspace-bootstrap.js +2 -1
  105. package/dist/core/command/topic-slash.js +7 -1
  106. package/dist/core/daemon-bootstrap.js +0 -4
  107. package/dist/core/daemon-control.js +58 -1
  108. package/dist/core/daemon-lifecycle.js +29 -7
  109. package/dist/core/evolagent-registry.js +18 -9
  110. package/dist/core/handoff/runtime.js +1 -1
  111. package/dist/core/host-snapshot.js +8 -3
  112. package/dist/core/initialization/service.js +3 -0
  113. package/dist/core/interaction-router.js +130 -0
  114. package/dist/core/ipc-registration.js +5 -0
  115. package/dist/core/memory/consolidation-context.js +2 -1
  116. package/dist/core/memory/consolidation.js +35 -64
  117. package/dist/core/message/aun-ipc-sender.js +213 -74
  118. package/dist/core/message/aun-request-registry.js +31 -0
  119. package/dist/core/message/contact-admission.js +91 -6
  120. package/dist/core/message/contact-pending-inbound.js +113 -0
  121. package/dist/core/message/contact-thread-approval.js +212 -0
  122. package/dist/core/message/im-renderer.js +40 -1
  123. package/dist/core/message/message-admission.js +5 -39
  124. package/dist/core/message/message-bridge.js +197 -45
  125. package/dist/core/message/message-log.js +32 -0
  126. package/dist/core/message/message-queue.js +102 -18
  127. package/dist/core/message/peer-mode.js +15 -4
  128. package/dist/core/message/response-engine.js +174 -26
  129. package/dist/core/message/send-options.js +37 -3
  130. package/dist/core/message/send-routing.js +11 -7
  131. package/dist/core/model/config-scope.js +6 -14
  132. package/dist/core/model/model-catalog.js +5 -5
  133. package/dist/core/model/model-diagnostics.js +19 -0
  134. package/dist/core/model/model-fallback.js +13 -2
  135. package/dist/core/ownership/owner-resolver.js +12 -86
  136. package/dist/core/pack-auth.js +7 -0
  137. package/dist/core/pack-install.js +1 -1
  138. package/dist/core/permission/ec-command-parser.js +288 -77
  139. package/dist/core/permission/protected-paths.js +64 -9
  140. package/dist/core/permission/services-path-acl.js +458 -0
  141. package/dist/core/permission/tool-policy.js +26 -10
  142. package/dist/core/relation/peer-identity.js +13 -0
  143. package/dist/core/session/adapters/claude-session-file-adapter.js +6 -2
  144. package/dist/core/session/adapters/codex-session-file-adapter.js +4 -0
  145. package/dist/core/session/session-manager.js +47 -10
  146. package/dist/core/session/session-mapper.js +16 -0
  147. package/dist/core/skill/index-generator.js +2 -3
  148. package/dist/core/skill/switch-resolver.js +3 -0
  149. package/dist/core/task/task-recovery-service.js +1 -0
  150. package/dist/core/thread/command-parser.js +4 -1
  151. package/dist/core/thread/ipc-operation.js +4 -2
  152. package/dist/core/thread/thread-operation.js +25 -10
  153. package/dist/core/thread/thread-service.js +294 -55
  154. package/dist/core/thread/topic-id.js +67 -2
  155. package/dist/core/thread/types.js +15 -1
  156. package/dist/directory/owner-directory-admission.js +11 -8
  157. package/dist/directory/owner-directory-cache.js +19 -0
  158. package/dist/directory/owner-directory-markdown.js +1 -1
  159. package/dist/directory/owner-directory-policy.js +5 -30
  160. package/dist/directory/owner-directory-request-operation.js +5 -2
  161. package/dist/eck/kit-renderer.js +3 -2
  162. package/dist/eck/message-renderer.js +28 -5
  163. package/dist/ecweb/basic-settings-service.js +5 -9
  164. package/dist/ecweb/providers-service.js +4 -2
  165. package/dist/ecweb/runtime/supervisor.js +36 -8
  166. package/dist/event-center/center-config.js +9 -5
  167. package/dist/event-center/dispatcher.js +10 -1
  168. package/dist/event-center/ipc-operation.js +19 -0
  169. package/dist/event-center/registry.js +20 -5
  170. package/dist/event-center/runtime.js +10 -7
  171. package/dist/index.js +120 -41
  172. package/dist/ipc.js +83 -3
  173. package/dist/outputs/authorization.js +16 -0
  174. package/dist/outputs/cards.js +336 -0
  175. package/dist/outputs/events.js +3 -2
  176. package/dist/outputs/protocol.js +1 -0
  177. package/dist/outputs/service.js +2 -15
  178. package/dist/paths.js +48 -1
  179. package/dist/pay/command.js +38 -0
  180. package/dist/pay/protocol.js +136 -0
  181. package/dist/pay/runtime.js +188 -0
  182. package/dist/pay/service.js +384 -0
  183. package/dist/pay/store.js +81 -0
  184. package/dist/response-system/engines/v1/proactive-flow.js +29 -2
  185. package/dist/services/dispatcher.js +23 -5
  186. package/dist/services/host/main.js +388 -0
  187. package/dist/services/host/protocol.js +118 -0
  188. package/dist/services/host/resident.js +310 -0
  189. package/dist/services/host-client.js +386 -0
  190. package/dist/services/host-deploy.js +180 -0
  191. package/dist/services/host-launch.js +117 -0
  192. package/dist/services/host-recycle.js +203 -0
  193. package/dist/services/host-runtime.js +802 -0
  194. package/dist/services/idempotency.js +44 -86
  195. package/dist/services/index-generator.js +4 -3
  196. package/dist/services/index.js +204 -22
  197. package/dist/services/ipc-operation.js +288 -44
  198. package/dist/services/pack-manager.js +1 -0
  199. package/dist/services/script-runner.js +515 -83
  200. package/dist/services/service-payload.js +13 -7
  201. package/dist/services/validation.js +109 -4
  202. package/dist/stats/budget.js +1 -1
  203. package/dist/stats/model-resolver.js +2 -2
  204. package/dist/stats/quota-query.js +95 -0
  205. package/dist/trigger/application-service.js +6 -4
  206. package/dist/trigger/local-files.js +19 -9
  207. package/dist/trigger/scheduler.js +22 -12
  208. package/dist/trigger/script-sandbox.js +51 -8
  209. package/dist/utils/aid-bind.js +3 -0
  210. package/dist/utils/atomic-write.js +22 -8
  211. package/dist/utils/evolcore-version.js +2 -2
  212. package/dist/utils/host-info.js +173 -1
  213. package/dist/utils/logger.js +2 -2
  214. package/dist/utils/media-cache.js +190 -43
  215. package/dist/utils/npm-ops.js +43 -8
  216. package/dist/utils/restart-safety.js +14 -1
  217. package/dist/utils/system-memory.js +113 -25
  218. package/dist/utils/systemd-lifecycle.js +154 -0
  219. package/dist/utils/windows-shell-trust.js +7 -3
  220. package/dist/workbench/service.js +1 -1
  221. package/kits/docs/INDEX.md +3 -2
  222. package/kits/docs/aun/AUN/346/266/210/346/201/257/347/261/273/345/236/213/344/270/216/345/261/236/346/200/247.md +1 -0
  223. package/kits/docs/channels/aun.md +1 -1
  224. package/kits/docs/evolcore/INDEX.md +9 -6
  225. package/kits/docs/evolcore/agent.md +36 -1
  226. package/kits/docs/evolcore/aid.md +45 -3
  227. package/kits/docs/evolcore/config.md +5 -2
  228. package/kits/docs/evolcore/directory.md +8 -9
  229. package/kits/docs/evolcore/group.md +2 -1
  230. package/kits/docs/evolcore/memory-tags.md +2 -0
  231. package/kits/docs/evolcore/menu-client.md +3 -3
  232. package/kits/docs/evolcore/menu-protocol.md +7 -0
  233. package/kits/docs/evolcore/model.md +3 -0
  234. package/kits/docs/evolcore/msg.md +77 -10
  235. package/kits/docs/evolcore/pay.md +34 -0
  236. package/kits/docs/evolcore/provider.md +22 -1
  237. package/kits/docs/evolcore/quota.md +54 -0
  238. package/kits/docs/evolcore/role.md +3 -0
  239. package/kits/docs/evolcore/services.md +46 -18
  240. package/kits/docs/evolcore/stats.md +2 -0
  241. package/kits/docs/evolcore/thread-chain.md +2 -0
  242. package/kits/docs/evolcore/tool-authorization.md +10 -0
  243. package/kits/docs/evolcore/trigger.md +2 -0
  244. package/kits/rules/01-overview.md +11 -32
  245. package/kits/rules/02-navigation.md +7 -0
  246. package/kits/rules/06-channel.md +3 -3
  247. package/kits/schemas/_meta.json +38 -5
  248. package/kits/schemas/agent-config.schema.20.json +24 -0
  249. package/kits/schemas/agent-config.schema.21.json +974 -0
  250. package/kits/schemas/agent-config.schema.22.json +977 -0
  251. package/kits/schemas/agent-config.schema.23.json +958 -0
  252. package/kits/schemas/daemon.schema.10.json +373 -0
  253. package/kits/schemas/daemon.schema.9.json +12 -0
  254. package/kits/schemas/defaults.schema.7.json +472 -0
  255. package/kits/schemas/providers.schema.3.json +18 -2
  256. package/kits/schemas/relation-config.schema.13.json +289 -0
  257. package/kits/skills/.switches.json +17 -1
  258. package/kits/skills/ability/SKILL.md +229 -34
  259. package/kits/skills/ability/STRUCTURE.md +333 -0
  260. package/kits/skills/ability/references/cli.md +208 -0
  261. package/kits/skills/ability/references/development.md +107 -37
  262. package/kits/skills/ability/references/management.md +106 -46
  263. package/kits/skills/ability/references/runtime-protocol.md +65 -63
  264. package/kits/skills/agent-output-cards/SKILL.md +64 -0
  265. package/kits/skills/ec-group/SKILL.md +8 -6
  266. package/kits/skills/ec-group/TASK.md +186 -0
  267. package/kits/skills/ec-group/WORKLOG.md +180 -0
  268. package/kits/skills/ec-group-collaboration/SKILL.md +3 -3
  269. package/kits/skills/ec-pay/SKILL.md +101 -0
  270. package/kits/skills/ec-pay/references/pay-cli.md +110 -0
  271. package/kits/skills/ec-provider/SKILL.md +58 -9
  272. package/kits/skills/{ec-service-proxy → ec-proxy}/SKILL.md +8 -5
  273. package/kits/skills/ec-service-call/SKILL.md +135 -0
  274. package/kits/skills/ec-service-pack/SKILL.md +277 -0
  275. package/kits/skills/ec-trigger/SKILL.md +1 -1
  276. package/kits/templates/memory-consolidation/notes.md +2 -2
  277. package/kits/templates/memory-consolidation/workflow.md +46 -0
  278. package/kits/templates/roles/visitor.json +1 -0
  279. package/kits/templates/system-fragments/channel.md +13 -4
  280. package/kits/templates/system-fragments/commands.md +5 -3
  281. package/kits/templates/system-fragments/directory-contacts.md +3 -4
  282. package/kits/templates/system-fragments/reply.md +1 -0
  283. package/kits/templates/system-fragments/session.md +1 -1
  284. package/kits/templates/system-fragments/thread.md +27 -128
  285. package/kits/templates/system-fragments/venue.md +27 -0
  286. package/package.json +4 -5
  287. package/scripts/agent-template/inspect.mjs +79 -29
  288. package/scripts/agent-template/overlay.mjs +20 -2
  289. package/scripts/agent-template/shared/common.mjs +24 -6
  290. package/scripts/agent-template/shared/team-schema.json +23 -5
  291. package/scripts/agent-template/shared/template-contract.mjs +107 -17
  292. package/scripts/agent-template/shared/template-package.mjs +254 -29
  293. package/scripts/agent-template/shared/template-runtime.mjs +145 -2
  294. package/scripts/agent-template/shared/template.mjs +67 -9
  295. package/scripts/agent-template/team-pack.mjs +132 -41
  296. package/scripts/agent-template/team-preview.mjs +249 -5
  297. package/kits/docs/aun/ABILITY_CALLING.md +0 -280
  298. package/kits/docs/evolcore/ability.md +0 -185
  299. package/kits/skills/ability/references/calling.md +0 -56
  300. package/kits/skills/ability/references/contract-checklist.md +0 -37
  301. package/kits/skills/ability/references/recovery.md +0 -27
  302. /package/dist/{core/capability/providers → agents/gemini}/gemini-capability-provider.js +0 -0
@@ -9,6 +9,7 @@ import { ConfigTarget, assertAgentAidAvailable, read as readConfig } from '../co
9
9
  import { invalidateKitCache } from '../eck/kit-renderer.js';
10
10
  import { logger } from '../utils/logger.js';
11
11
  import fs from 'fs';
12
+ import { agentProjectChangeGate } from '../config-store.js';
12
13
  import path from 'path';
13
14
  import { resolvePaths } from '../paths.js';
14
15
  import { ownerResolver } from './ownership/owner-resolver.js';
@@ -17,6 +18,7 @@ import { getAidStore, loadClient } from '../aun/aid/store.js';
17
18
  import { isValidAid } from '../aun/aid/validation.js';
18
19
  import { readPreparedTemplateIdentity } from '../agent-template/runtime.js';
19
20
  import { readAgentCreationClaim } from './agent-creation-claim.js';
21
+ import { getCcAgentAid } from '../agents/claude-gateway/agent-registration.js';
20
22
  export function loadStartupAgentRegistry(agentRegistry) {
21
23
  agentRegistry.loadAll();
22
24
  const agentInfos = agentRegistry.list();
@@ -44,9 +46,9 @@ export function loadStartupAgentRegistry(agentRegistry) {
44
46
  const owners = duplicate.agents.map(owner => `${owner.aid}(${owner.channelName})`).join(', ');
45
47
  logger.warn(`⚠ Duplicate channel credential: ${duplicate.fingerprint} claimed by ${owners}.`);
46
48
  }
47
- const primaryAgent = agentRegistry.runnableAgents()[0];
49
+ const primaryAgent = agentRegistry.runnableAgents().find(agent => agent.aid !== getCcAgentAid());
48
50
  const runtimeStatus = { state: primaryAgent ? 'starting' : 'empty' };
49
- if (!primaryAgent && agentInfos.length > 0) {
51
+ if (!primaryAgent && agentInfos.some(agent => agent.aid !== getCcAgentAid())) {
50
52
  runtimeStatus.state = 'error';
51
53
  runtimeStatus.error = 'No runnable self-agent (all are error/disabled).';
52
54
  logger.warn(`[startup] ${runtimeStatus.error} Control Plane will remain available.`);
@@ -74,7 +76,7 @@ export function createOnDemandAgentRunners(deps) {
74
76
  await deps.coordinator.runRunnerOperation(aid, async () => {
75
77
  assertRunning();
76
78
  const agent = deps.agentRegistry.get(aid);
77
- const available = agent && agent.config.enabled !== false && agent.status !== 'disabled' && agent.status !== 'stopped'
79
+ const available = agent && !agentProjectChangeGate(aid) && agent.config.enabled !== false && agent.status !== 'disabled' && agent.status !== 'stopped'
78
80
  ? deps.agentLoader.enabledBaseagents(agent) : [];
79
81
  if (!agent || !available.includes(baseagent)) {
80
82
  throw new BaseagentRunnerUnavailableError(aid, baseagent, available);
@@ -165,7 +167,7 @@ export async function createStartupAgentRunners({ agentRegistry, agentLoader, se
165
167
  throw error;
166
168
  }
167
169
  activeSettled.add(agent.aid);
168
- if (!instances.some(instance => instance.baseagent === agent.baseagent)) {
170
+ if (agent.aid !== getCcAgentAid() && !instances.some(instance => instance.baseagent === agent.baseagent)) {
169
171
  agent.status = 'error';
170
172
  agent.error = creationErrors.filter(error => error.evolagentName === agent.name)
171
173
  .map(({ baseagent, message }) => `${baseagent}: ${message}`).join('; ')
@@ -189,9 +191,9 @@ export async function createStartupAgentRunners({ agentRegistry, agentLoader, se
189
191
  throw error;
190
192
  }
191
193
  await activeReady(agent, instances, timing);
192
- if (primaryAgent?.aid === agent.aid
194
+ if (agent.aid !== getCcAgentAid() && (primaryAgent?.aid === agent.aid
193
195
  ? !instances.some(instance => instance.baseagent === primaryBaseagent)
194
- : !instances.some(instance => instance.baseagent === agent.baseagent)) {
196
+ : !instances.some(instance => instance.baseagent === agent.baseagent))) {
195
197
  const errors = creationErrors.filter(error => error.evolagentName === agent.name);
196
198
  agent.status = 'error';
197
199
  agent.error = errors.length > 0
@@ -416,6 +418,7 @@ export function createAgentInitializationRuntime({ agentRegistry, agentMap, chan
416
418
  const isConnected = (aid) => channelInstances.some(instance => instance.channelType === 'aun'
417
419
  && instance.channel.getAidState?.()?.aid === aid
418
420
  && instance.channel.getAidState?.()?.status === 'connected');
421
+ const ownerObservers = new Map();
419
422
  return new AgentInitializationService({
420
423
  preparedIdentity: (aid, ownerAid) => {
421
424
  return readAgentCreationClaim(aid)?.teamJobId ? readPreparedTemplateIdentity(aid, ownerAid) : undefined;
@@ -468,7 +471,16 @@ export function createAgentInitializationRuntime({ agentRegistry, agentMap, chan
468
471
  },
469
472
  checkOwner: (aid, ownerAid) => isConnected(aid)
470
473
  ? checkInitializationOwner(aid, ownerAid, readInitialization(aid)?.mode === 'one_shot' ? 1 : undefined)
471
- : checkBootstrapInitializationOwner(aid, ownerAid),
474
+ : ownerObservers.get(aid)?.check(ownerAid) ?? checkBootstrapInitializationOwner(aid, ownerAid),
475
+ watchOwner: (aid, onChange) => {
476
+ const observer = createInitializationOwnerObserver(aid, onChange);
477
+ ownerObservers.set(aid, observer);
478
+ return async () => {
479
+ if (ownerObservers.get(aid) === observer)
480
+ ownerObservers.delete(aid);
481
+ await observer.close();
482
+ };
483
+ },
472
484
  publish: async (aid, content, ownerAid) => {
473
485
  const { agentmdPut, agentmdPutInitializationProfile } = await import('../aun/aid/agentmd.js');
474
486
  if (ownerAid)
@@ -738,6 +750,16 @@ const AUDITED_WORKFLOW_SHA256 = {
738
750
  '0.5.35': '55b6d41331b4dfc6b377be9f4ff28d322af5e06fc4539c5d0120cb15419623f6',
739
751
  // 0.5.36 retains the audited workflow; installed SDK preflight and execute boundaries were revalidated.
740
752
  '0.5.36': '55b6d41331b4dfc6b377be9f4ff28d322af5e06fc4539c5d0120cb15419623f6',
753
+ // 0.5.37 ships byte-identical workflow bytes and dependencies (errors/ownership-v21) plus an
754
+ // unchanged injection block in client.js; the only ownership-related delta records the
755
+ // X-AUN-Owner-MD-SHA256 header after a completed agent.md download, leaving read/execute
756
+ // ordering untouched.
757
+ '0.5.37': '55b6d41331b4dfc6b377be9f4ff28d322af5e06fc4539c5d0120cb15419623f6',
758
+ // 0.5.38 changes exactly one thing: the `yaml` import moves from a static import to a lazy
759
+ // createRequire call inside parseOwnershipMessage, so the module no longer loads yaml at import
760
+ // time. No read/verify/execute ordering moved; start()/capture() still only read and verify, and
761
+ // every persist and notification still happens inside execute().
762
+ '0.5.38': '56d834587a3211a36e20a2574357b172f1d223b48b4d393b7b83989e2955d55d',
741
763
  };
742
764
  export function initializationBindPreflightFailure(error) {
743
765
  if (!(error instanceof Error) || error.code !== 'ECONNRESET')
@@ -758,46 +780,164 @@ export function initializationBindPreflightFailure(error) {
758
780
  }
759
781
  }
760
782
  /** Initial binding precedes the daemon channel; use an independent short slot. */
761
- async function withInitializationClient(aid, action) {
783
+ async function openInitializationClient(aid, subscribe) {
762
784
  let store;
763
785
  let client;
764
- let actionStarted = false;
786
+ const close = async () => {
787
+ // A close failure must not discard an exact task already returned by bind.
788
+ try {
789
+ await client?.close();
790
+ }
791
+ catch { /* preserve operation result */ }
792
+ try {
793
+ store?.close();
794
+ }
795
+ catch { /* preserve operation result */ }
796
+ };
765
797
  try {
766
798
  store = await getAidStore({ slotId: 'evolcore-initialization' });
767
799
  client = await loadClient(store, aid);
768
800
  if (client.currentAid?.aid !== aid || !client.currentAid.isCertValid() || !client.currentAid.isPrivateKeyValid()) {
769
801
  throw Object.assign(new Error('Initialization identity is unavailable'), { code: 'INITIALIZE_IDENTITY_UNAVAILABLE' });
770
802
  }
803
+ subscribe?.(client);
771
804
  await client.connect({ connection_kind: 'short', short_ttl_ms: 120_000,
772
805
  background_sync: false, auto_reconnect: false, connect_timeout: 10, call_timeout: 30 });
773
- // An entered bind can have remote effects. Its adapter may only mark an
774
- // audited read-only preflight as not started; all other failures stay unknown.
775
- actionStarted = true;
776
- return await action(client, store);
806
+ return { client, store, close };
777
807
  }
778
808
  catch (error) {
779
- if (!actionStarted) {
780
- const original = error instanceof Error ? error : new Error(String(error));
781
- throw Object.assign(new Error(original.message), {
782
- code: 'INITIALIZE_BIND_NOT_STARTED',
783
- cause: error,
784
- causeCode: error?.code,
785
- });
786
- }
787
- throw error;
809
+ await close();
810
+ const original = error instanceof Error ? error : new Error(String(error));
811
+ throw Object.assign(new Error(original.message), {
812
+ code: 'INITIALIZE_BIND_NOT_STARTED', cause: error,
813
+ causeCode: error?.code,
814
+ });
815
+ }
816
+ }
817
+ async function withInitializationClient(aid, action) {
818
+ const connection = await openInitializationClient(aid);
819
+ try {
820
+ return await action(connection.client, connection.store);
788
821
  }
789
822
  finally {
790
- // A close failure must not discard the exact task already returned by bind.
791
- try {
792
- await client?.close();
793
- }
794
- catch { /* preserve operation result */ }
795
- try {
796
- store?.close();
797
- }
798
- catch { /* preserve operation result */ }
823
+ await connection.close();
799
824
  }
800
825
  }
826
+ /** Keep an event-capable short connection until hot-load, rebuilding it after loss or expiry. */
827
+ export function createInitializationOwnerObserver(aid, onChange) {
828
+ let current;
829
+ let stopped = false;
830
+ let retiring = Promise.resolve();
831
+ const retire = (entry) => {
832
+ if (entry.closed)
833
+ return retiring;
834
+ entry.closed = true;
835
+ if (current === entry)
836
+ current = undefined;
837
+ clearTimeout(entry.timer);
838
+ for (const subscription of entry.subscriptions)
839
+ subscription.unsubscribe();
840
+ const closing = entry.ready.then(connection => connection.close(), () => { });
841
+ retiring = Promise.allSettled([retiring, closing]).then(() => { });
842
+ return retiring;
843
+ };
844
+ const connection = () => {
845
+ if (stopped)
846
+ throw new Error('Initialization Owner observer is closed');
847
+ if (current)
848
+ return current;
849
+ const previousRetirement = retiring;
850
+ const entry = {
851
+ closed: false, subscriptions: [],
852
+ ready: Promise.resolve().then(async () => {
853
+ await previousRetirement;
854
+ if (stopped || entry.closed)
855
+ throw new Error('Initialization Owner observer is closed');
856
+ const opened = await openInitializationClient(aid, client => {
857
+ if (stopped || entry.closed)
858
+ throw new Error('Initialization Owner observer is closed');
859
+ const changed = () => {
860
+ if (!stopped && !entry.closed && current === entry)
861
+ onChange();
862
+ };
863
+ for (const event of ['ownership.request', 'ownership.pending', 'ownership.progress', 'ownership.completed',
864
+ 'ownership.rejected', 'ownership.stopped', 'ownership.error', 'ownership.action_required']) {
865
+ entry.subscriptions.push(client.on(event, payload => {
866
+ if (payload && typeof payload === 'object' && 'sub_aid' in payload && payload.sub_aid === aid)
867
+ changed();
868
+ }));
869
+ }
870
+ entry.subscriptions.push(client.on('agentmd.changed', payload => { if (payload === aid)
871
+ changed(); }));
872
+ entry.subscriptions.push(client.on('agent_md_changed', payload => {
873
+ if (payload && typeof payload === 'object' && 'aid' in payload && payload.aid === aid)
874
+ changed();
875
+ }));
876
+ entry.subscriptions.push(client.on('storage.object_changed', payload => {
877
+ if (payload && typeof payload === 'object' && 'owner_aid' in payload && payload.owner_aid === aid
878
+ && 'object_key' in payload && typeof payload.object_key === 'string'
879
+ && payload.object_key.replace(/^\/+/, '') === 'agent.md')
880
+ changed();
881
+ }));
882
+ for (const event of ['state_change', 'connection.state']) {
883
+ entry.subscriptions.push(client.on(event, payload => {
884
+ if (stopped || entry.closed || current !== entry)
885
+ return;
886
+ const state = typeof payload === 'string' ? payload
887
+ : payload && typeof payload === 'object'
888
+ ? ('state' in payload ? payload.state : 'status' in payload ? payload.status : undefined) : undefined;
889
+ if (entry.timer && typeof state === 'string' && state !== 'ready' && state !== 'connected') {
890
+ void retire(entry);
891
+ if (!stopped)
892
+ onChange();
893
+ }
894
+ }));
895
+ }
896
+ });
897
+ if (!entry.closed) {
898
+ // Renew before the gateway's 120-second short-session TTL.
899
+ entry.timer = setTimeout(() => {
900
+ if (stopped || entry.closed || current !== entry)
901
+ return;
902
+ void retire(entry);
903
+ if (!stopped)
904
+ onChange();
905
+ }, 110_000);
906
+ entry.timer.unref?.();
907
+ }
908
+ return opened;
909
+ }),
910
+ };
911
+ current = entry;
912
+ // Setup can finish after cancellation, or fail before the worker starts its check.
913
+ void entry.ready.catch(() => { void retire(entry); });
914
+ return entry;
915
+ };
916
+ connection();
917
+ return {
918
+ check: async (ownerAid) => {
919
+ let entry;
920
+ try {
921
+ entry = connection();
922
+ const { client } = await entry.ready;
923
+ if (stopped || entry.closed)
924
+ throw new Error('Initialization Owner observer is closed');
925
+ return await readBootstrapInitializationOwner(client, aid, ownerAid);
926
+ }
927
+ catch (error) {
928
+ if (entry)
929
+ await retire(entry);
930
+ return unavailableInitializationOwner(error);
931
+ }
932
+ },
933
+ close: async () => {
934
+ stopped = true;
935
+ if (current)
936
+ await retire(current);
937
+ await retiring;
938
+ },
939
+ };
940
+ }
801
941
  export async function bindInitializationOwner(aid, ownerAid) {
802
942
  return withInitializationClient(aid, async (client, store) => {
803
943
  const { assertHumanAgentOwner } = await import('../aun/aid/agentmd.js');
@@ -826,30 +966,34 @@ export async function bindAgentCreationOwner(aid, ownerAid) {
826
966
  /** Each bootstrap observation has a new SDK client and no cached consensus. */
827
967
  export async function checkBootstrapInitializationOwner(aid, ownerAid) {
828
968
  try {
829
- return await withInitializationClient(aid, async (client) => {
830
- const view = await client.checkOwnershipConsensus(aid, true);
831
- const checkedAt = Date.now();
832
- const details = {
833
- ...(['consensus', 'released', 'unbound', 'single_sided', 'invalid', 'unavailable', 'not_applicable'].includes(view.status)
834
- ? { consensusStatus: view.status } : {}),
835
- ...(Number.isSafeInteger(view.relation_version) && view.relation_version >= 0 ? { relationVersion: view.relation_version } : {}),
836
- ...(['locked', 'unlocked'].includes(view.lock) ? { lock: view.lock } : {}),
837
- ...(view.code ? { code: initializationErrorCode(view, 'INITIALIZE_OWNER_CHECK_FAILED') } : {}),
838
- ...(typeof view.retryable === 'boolean' ? { retryable: view.retryable } : {}),
839
- };
840
- if (view.status === 'consensus' && view.sub_aid === aid && view.lock === 'locked'
841
- && view.relation_version === 1 && typeof view.owner_aid === 'string' && isValidAid(view.owner_aid) && view.owner_aid !== aid) {
842
- return { status: view.owner_aid === ownerAid ? 'confirmed' : 'conflict', ownerAid: view.owner_aid, checkedAt, ...details };
843
- }
844
- return { status: 'pending', checkedAt, ...details };
845
- });
969
+ return await withInitializationClient(aid, client => readBootstrapInitializationOwner(client, aid, ownerAid));
846
970
  }
847
971
  catch (error) {
848
- // An unavailable observation never confirms a relation or replays bind.
849
- const codeSource = error?.code === 'INITIALIZE_BIND_NOT_STARTED'
850
- ? { code: error.causeCode }
851
- : error;
852
- return { status: 'pending', consensusStatus: 'unavailable',
853
- code: initializationErrorCode(codeSource, 'INITIALIZE_OWNER_CHECK_FAILED'), retryable: true };
972
+ return unavailableInitializationOwner(error);
973
+ }
974
+ }
975
+ async function readBootstrapInitializationOwner(client, aid, ownerAid) {
976
+ const view = await client.checkOwnershipConsensus(aid, true);
977
+ const checkedAt = Date.now();
978
+ const details = {
979
+ ...(['consensus', 'released', 'unbound', 'single_sided', 'invalid', 'unavailable', 'not_applicable'].includes(view.status)
980
+ ? { consensusStatus: view.status } : {}),
981
+ ...(Number.isSafeInteger(view.relation_version) && view.relation_version >= 0 ? { relationVersion: view.relation_version } : {}),
982
+ ...(['locked', 'unlocked'].includes(view.lock) ? { lock: view.lock } : {}),
983
+ ...(view.code ? { code: initializationErrorCode(view, 'INITIALIZE_OWNER_CHECK_FAILED') } : {}),
984
+ ...(typeof view.retryable === 'boolean' ? { retryable: view.retryable } : {}),
985
+ };
986
+ if (view.status === 'consensus' && view.sub_aid === aid && view.lock === 'locked'
987
+ && view.relation_version === 1 && typeof view.owner_aid === 'string' && isValidAid(view.owner_aid) && view.owner_aid !== aid) {
988
+ return { status: view.owner_aid === ownerAid ? 'confirmed' : 'conflict', ownerAid: view.owner_aid, checkedAt, ...details };
854
989
  }
990
+ return { status: 'pending', checkedAt, ...details };
991
+ }
992
+ function unavailableInitializationOwner(error) {
993
+ // An unavailable observation never confirms a relation or replays bind.
994
+ const codeSource = error?.code === 'INITIALIZE_BIND_NOT_STARTED'
995
+ ? { code: error.causeCode }
996
+ : error;
997
+ return { status: 'pending', consensusStatus: 'unavailable',
998
+ code: initializationErrorCode(codeSource, 'INITIALIZE_OWNER_CHECK_FAILED'), retryable: true };
855
999
  }
@@ -47,6 +47,20 @@ export class AgentDelegationRegistry {
47
47
  getRuntimeEpoch() {
48
48
  return this.runtimeEpoch;
49
49
  }
50
+ /** In-process continuation only; never accepts a grant reconstructed from IPC. */
51
+ isCurrentTaskGrant(grant) {
52
+ if (this.activeHashBySession.get(grant.sessionId) !== grant.tokenHash || this.grantsByHash.get(grant.tokenHash) !== grant)
53
+ return false;
54
+ if (grant.executionIdentity?.source === 'agent-policy') {
55
+ try {
56
+ assertAgentPolicyAuthorization(grant.executionIdentity);
57
+ }
58
+ catch {
59
+ return false;
60
+ }
61
+ }
62
+ return true;
63
+ }
50
64
  /** 发行正常 task delegation token */
51
65
  issue(input) {
52
66
  if (input.executionIdentity && !isValidFullAccessExecutionIdentity(input.executionIdentity)) {
@@ -199,35 +199,42 @@ export function createDelegatedInvokeOperationExecutor({ agentDelegationRegistry
199
199
  });
200
200
  };
201
201
  }
202
+ /** Resolve task identity once; each operation still authorizes its own target and scope. */
203
+ export async function resolveDelegatedIdentity(params, dependencies, invalidSessionCode = 'INVALID_DELEGATION') {
204
+ const validation = params.delegationGrant
205
+ ? { ok: true, grant: params.delegationGrant }
206
+ : dependencies.agentDelegationRegistry?.validate(params.delegationToken, params.sessionId, params.delegationCommandHash);
207
+ if (!validation?.ok)
208
+ return {
209
+ ok: false, code: validation?.code ?? 'DELEGATION_REQUIRED',
210
+ error: validation?.reason ?? 'Valid task delegation is required',
211
+ };
212
+ const grant = validation.grant;
213
+ const session = await dependencies.sessionManager.getSessionById(params.sessionId);
214
+ if (!session || session.selfAID !== grant.selfAid || grant.sessionId !== params.sessionId) {
215
+ return { ok: false, code: invalidSessionCode, error: 'Delegation does not match the current session' };
216
+ }
217
+ let conversationId;
218
+ try {
219
+ conversationId = parsePeerKey(grant.peerKey).channelId;
220
+ }
221
+ catch {
222
+ return { ok: false, code: 'INVALID_DELEGATION', error: 'delegation contains an invalid relation key' };
223
+ }
224
+ const subject = buildAuthSubject({
225
+ selfAid: grant.selfAid, sessionId: params.sessionId, actorId: grant.actorId,
226
+ channel: grant.channel, channelType: grant.channelType, channelId: conversationId,
227
+ chatType: grant.chatType, conversationId, processOwners: dependencies.getProcessOwners(),
228
+ ...trustedExecutionIdentityInput(grant),
229
+ });
230
+ return { ok: true, grant, session, subject };
231
+ }
202
232
  export function createDelegationAuthorizer({ agentDelegationRegistry, sessionManager, getProcessOwners, }) {
203
233
  return async function authorizeManagedAgentOperation(params, operation) {
204
- const delegation = params.delegationGrant
205
- ? { ok: true, grant: params.delegationGrant }
206
- : agentDelegationRegistry.validate(params.delegationToken, params.sessionId, params.delegationCommandHash);
234
+ const delegation = await resolveDelegatedIdentity(params, { agentDelegationRegistry, sessionManager, getProcessOwners });
207
235
  if (!delegation.ok)
208
- return { ok: false, code: delegation.code, error: delegation.reason };
209
- const session = await sessionManager.getSessionById(params.sessionId);
210
- if (!session || session.selfAID !== delegation.grant.selfAid) {
211
- return { ok: false, code: 'INVALID_DELEGATION', error: 'delegation does not match the current session' };
212
- }
213
- let conversationId;
214
- try {
215
- conversationId = parsePeerKey(delegation.grant.peerKey).channelId;
216
- }
217
- catch {
218
- return { ok: false, code: 'INVALID_DELEGATION', error: 'delegation contains an invalid relation key' };
219
- }
220
- const subject = buildAuthSubject({
221
- selfAid: delegation.grant.selfAid,
222
- actorId: delegation.grant.actorId,
223
- channel: delegation.grant.channel,
224
- channelType: delegation.grant.channelType,
225
- channelId: conversationId,
226
- chatType: delegation.grant.chatType,
227
- conversationId,
228
- processOwners: getProcessOwners(),
229
- ...trustedExecutionIdentityInput(delegation.grant),
230
- });
236
+ return delegation;
237
+ const { subject } = delegation;
231
238
  if (params.targetAid
232
239
  && params.targetAid !== delegation.grant.selfAid
233
240
  && subject.dataScope !== 'daemon'
@@ -8,7 +8,11 @@ import { formatPeerKey, parsePeerKey } from '../relation/peer-identity.js';
8
8
  import { sameGroupAid } from '../../aun/group/identity.js';
9
9
  import { ownerResolver } from '../ownership/owner-resolver.js';
10
10
  const DAEMON_OWNER_PROCESS_OPERATIONS = new Set([
11
- ...['inspect', 'build', 'push', 'pull', 'preview', 'deploy', 'status', 'resume', 'cancel', 'capabilities'].map(action => 'agent.template.' + action),
11
+ ...['preview', 'move', 'status', 'recover', 'resolve'].map(action => 'agent.project.' + action),
12
+ 'agent.start', 'agent.stop',
13
+ ...['inspect', 'build', 'push', 'pull', 'preview', 'deploy', 'status', 'resume', 'cancel', 'capabilities',
14
+ 'register-team', 'team-members', 'prepare-member-install', 'resume-member-join',
15
+ 'update-status', 'check-update', 'bind-update-source', 'confirm-update-source', 'preview-update', 'read-update-notice'].map(action => 'agent.template.' + action),
12
16
  'model.provider.catalog',
13
17
  'agent.list',
14
18
  'agent.create',
@@ -183,6 +187,17 @@ function authorizeCommandInternal(ctx, resolvedConfigCommand) {
183
187
  if (!authorizationTarget.ok) {
184
188
  return denyDecision(ctx, 'SCOPE_MISMATCH', authorizationTarget.reason, operation, intent.scope, opMeta.dangerous);
185
189
  }
190
+ if (operation === 'ability.remote.call' && ctx.permissionMode === 'readonly') {
191
+ return denyDecision(ctx, 'NOT_ALLOWED', 'Remote Ability calls require a writable task; readonly may inspect contracts and preview only', operation, intent.scope, opMeta.dangerous, 'remote-ability-readonly');
192
+ }
193
+ // Remote Ability is a protocol client, not local plugin administration or
194
+ // social messaging. Provider policy decides capability access. Task mode,
195
+ // current-Agent binding and approved delegated execution still apply.
196
+ if (operation.startsWith('ability.remote.')) {
197
+ if (intent.scope !== 'agent')
198
+ return denyDecision(ctx, 'SCOPE_MISMATCH', 'Remote Ability uses the current Agent scope', operation, intent.scope, opMeta.dangerous);
199
+ return { allow: true, operation, scope: intent.scope, role, dangerous: opMeta.dangerous, matchedRule: 'remote-ability-protocol' };
200
+ }
186
201
  if (ctx.source === 'agent-tool' && opMeta.minimumPermissionMode === 'request'
187
202
  && !['request', 'bypass'].includes(ctx.permissionMode ?? '')) {
188
203
  return denyDecision(ctx, 'NOT_ALLOWED', 'This operation requires a request or bypass task', operation, intent.scope, opMeta.dangerous, 'catalog-task-mode');
@@ -156,6 +156,12 @@ const PROVIDER_OPERATIONS = ['list', 'show', 'templates', 'create', 'import', 'u
156
156
  allowDelegatedRead: ['list', 'show', 'templates'].includes(action) },
157
157
  }));
158
158
  const OPERATIONS = [
159
+ ...['request', 'status', 'cancel', 'verify', 'refresh', 'update', 'complete'].map(kind => ({
160
+ id: `ec.pay.${kind}`, category: kind === 'status' ? 'read' : 'write-own',
161
+ dangerous: false, defaultScopes: ['agent'], sources: ['agent-tool'],
162
+ description: `Manage website payment ${kind}`, minimumAgentRole: 'owner',
163
+ requiredChatType: 'private', requiredChannelType: 'aun',
164
+ })),
159
165
  { id: 'invoke.execute', category: 'process', dangerous: false, defaultScopes: ['process'],
160
166
  description: 'Invoke an already configured Provider', sources: ['agent-tool', 'control'],
161
167
  authorizationPolicy: { authority: 'daemon-owner', scope: 'process', channel: 'control', allowDelegatedRead: true } },
@@ -192,6 +198,14 @@ const OPERATIONS = [
192
198
  dangerous: action !== 'read', defaultScopes: ['agent'], description: 'Manage AID ability plugins: ' + action,
193
199
  sources: ['agent-tool', 'control', 'ecweb'],
194
200
  })),
201
+ ...['list', 'discover', 'info', 'devices', 'preview', 'call', 'result'].map(action => ({
202
+ id: 'ability.remote.' + action,
203
+ category: action === 'call' ? 'write-own' : 'read',
204
+ dangerous: action === 'call', defaultScopes: ['agent'],
205
+ authorizationTarget: 'current-agent',
206
+ description: 'Use remote AID Ability: ' + action,
207
+ sources: ['agent-tool'],
208
+ })),
195
209
  {
196
210
  id: 'ec.directory.query',
197
211
  category: 'read',
@@ -237,13 +251,25 @@ const OPERATIONS = [
237
251
  description: '启动、停止、重载或守护本地服务',
238
252
  sources: ['agent-tool'],
239
253
  },
240
- ...['inspect', 'build', 'push', 'pull', 'preview', 'deploy', 'status', 'resume', 'cancel', 'capabilities'].map(action => ({
254
+ ...['inspect', 'build', 'push', 'pull', 'preview', 'deploy', 'status', 'resume', 'cancel', 'capabilities',
255
+ 'register-team', 'team-members', 'prepare-member-install', 'resume-member-join',
256
+ 'update-status', 'check-update', 'bind-update-source', 'confirm-update-source', 'preview-update', 'read-update-notice'].map(action => ({
241
257
  id: 'agent.template.' + action, category: 'process',
242
- dangerous: !['status', 'capabilities'].includes(action), defaultScopes: ['process'],
258
+ dangerous: !['status', 'capabilities', 'team-members', 'update-status', 'check-update'].includes(action), defaultScopes: ['process'],
243
259
  description: 'Agent template ' + action, sources: ['menu', 'control', 'agent-tool', 'ecweb'],
244
260
  })),
245
261
  { id: 'model.provider.catalog', category: 'process', dangerous: false, defaultScopes: ['process'],
246
262
  description: 'Read a Provider model catalog without changing Agent configuration', sources: ['menu', 'control', 'ecweb'] },
263
+ ...['preview', 'move', 'status', 'recover', 'resolve'].map(action => ({
264
+ id: 'agent.project.' + action, category: 'process',
265
+ dangerous: !['preview', 'status'].includes(action), defaultScopes: ['process'],
266
+ description: 'Agent project ' + action, sources: ['menu', 'control', 'agent-tool', 'ecweb'],
267
+ })),
268
+ ...['stop', 'start'].map(action => ({
269
+ id: 'agent.' + action, category: 'process', dangerous: true,
270
+ defaultScopes: ['process'], description: 'Explicit Agent ' + action,
271
+ sources: ['agent-tool', 'control', 'ecweb', 'menu'],
272
+ })),
247
273
  {
248
274
  id: 'baseagent.models.list',
249
275
  category: 'read',
@@ -376,6 +402,23 @@ const OPERATIONS = [
376
402
  description: 'Update group mention mode',
377
403
  sources: ['slash', 'menu'],
378
404
  },
405
+ {
406
+ id: 'privatementionmode.current',
407
+ category: 'read',
408
+ dangerous: false,
409
+ defaultScopes: ['agent'],
410
+ description: 'Read Agent private mention mode',
411
+ sources: ['menu'],
412
+ },
413
+ {
414
+ id: 'privatementionmode.update',
415
+ category: 'write-agent',
416
+ dangerous: false,
417
+ defaultScopes: ['agent'],
418
+ minimumAgentRole: 'owner',
419
+ description: 'Update Agent private mention mode',
420
+ sources: ['menu'],
421
+ },
379
422
  {
380
423
  id: 'group.list',
381
424
  category: 'read',
@@ -888,10 +931,10 @@ const OPERATIONS = [
888
931
  description: '重建技能索引文件',
889
932
  sources: ['agent-tool', 'slash', 'menu', 'control'],
890
933
  },
891
- ...['list', 'list-peers', 'show', 'history', 'check-index', 'summary-show', 'summary-log', 'create', 'rename', 'label', 'status', 'delete', 'summary-set', 'summary-clear', 'rebuild-index'].map(action => ({
934
+ ...['list', 'list-peers', 'show', 'history', 'check-index', 'summary-show', 'summary-log', 'create', 'rename', 'label', 'status', 'delete', 'summary-set', 'summary-clear', 'rebuild-index', 'reconcile-status'].map(action => ({
892
935
  id: `ec.thread.${action}`,
893
936
  category: (['list', 'list-peers', 'show', 'history', 'check-index', 'summary-show', 'summary-log'].includes(action)
894
- ? 'read' : action === 'rebuild-index' ? 'write-agent' : 'write-own'),
937
+ ? 'read' : ['rebuild-index', 'reconcile-status'].includes(action) ? 'write-agent' : 'write-own'),
895
938
  dangerous: false,
896
939
  defaultScopes: ['relation', 'agent'],
897
940
  description: `${action} managed conversation threads`,
@@ -1024,6 +1067,15 @@ const OPERATIONS = [
1024
1067
  authorizationPolicy: { authority: 'trusted-fullaccess' },
1025
1068
  },
1026
1069
  // ── Stats Operations ──
1070
+ {
1071
+ id: 'quota.read',
1072
+ category: 'read',
1073
+ dangerous: false,
1074
+ defaultScopes: ['relation'],
1075
+ description: '查询 Agent 与当前关系的生效额度及余额',
1076
+ sources: ['agent-tool'],
1077
+ authorizationTarget: 'current-agent',
1078
+ },
1027
1079
  {
1028
1080
  id: 'stats.summary',
1029
1081
  category: 'read',
@@ -1321,7 +1373,7 @@ const OPERATIONS = [
1321
1373
  category: 'write-own',
1322
1374
  dangerous: false,
1323
1375
  defaultScopes: ['relation', 'agent'],
1324
- description: '通过 ec msg send 发送私聊消息',
1376
+ description: '通过 ecmsg send 发送私聊消息',
1325
1377
  sources: ['agent-tool'],
1326
1378
  },
1327
1379
  {
@@ -1337,7 +1389,7 @@ const OPERATIONS = [
1337
1389
  category: 'write-own',
1338
1390
  dangerous: false,
1339
1391
  defaultScopes: ['relation', 'agent'],
1340
- description: '通过 ec msg file 发送私聊文件',
1392
+ description: '通过 ecmsg send --file 发送私聊文件',
1341
1393
  sources: ['agent-tool'],
1342
1394
  },
1343
1395
  {
@@ -1345,7 +1397,7 @@ const OPERATIONS = [
1345
1397
  category: 'write-own',
1346
1398
  dangerous: false,
1347
1399
  defaultScopes: ['relation', 'agent'],
1348
- description: '通过 ec group send 发送群组消息',
1400
+ description: '通过 ecmsg send 发送群组消息',
1349
1401
  sources: ['agent-tool'],
1350
1402
  },
1351
1403
  {