evolcore 0.0.50 → 0.0.51

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 (448) hide show
  1. package/CHANGELOG.md +39 -2
  2. package/bin/ec-build.mjs +60 -0
  3. package/bin/ecmsg.js +65 -63
  4. package/dist/ability/caller/command.js +24 -15
  5. package/dist/ability/caller/contract.js +24 -9
  6. package/dist/ability/caller/credential-files.js +132 -0
  7. package/dist/ability/caller/daemon.js +32 -7
  8. package/dist/ability/caller/schema-view.js +157 -0
  9. package/dist/ability/caller/service.js +202 -63
  10. package/dist/ability/interop-v1.js +156 -113
  11. package/dist/agent-template/jobs.js +14 -110
  12. package/dist/agent-template/runtime.js +331 -193
  13. package/dist/agent-template/service.js +1029 -1104
  14. package/dist/agent-template/share.js +103 -0
  15. package/dist/agent-template/tool-runner.js +25 -0
  16. package/dist/agent-template/types.js +10 -3
  17. package/dist/agents/claude/availability.js +94 -0
  18. package/dist/agents/claude/capability-provider.js +154 -0
  19. package/dist/agents/claude/index.js +145 -0
  20. package/dist/agents/{claude-runner.js → claude/runner.js} +74 -158
  21. package/dist/agents/claude/session-file-adapter.js +246 -0
  22. package/dist/agents/codex/app-server-client.js +90 -10
  23. package/dist/agents/codex/availability.js +164 -0
  24. package/dist/agents/codex/capability-provider.js +138 -0
  25. package/dist/agents/codex/cli.js +38 -0
  26. package/dist/agents/codex/index.js +345 -0
  27. package/dist/agents/codex/mcp-elicitation.js +135 -0
  28. package/dist/agents/{codex-runner.js → codex/runner.js} +648 -382
  29. package/dist/agents/codex/session-file-adapter.js +834 -0
  30. package/dist/agents/dsh/availability.js +28 -0
  31. package/dist/agents/dsh/capability-provider.js +56 -0
  32. package/dist/agents/dsh/desktop-locations.ps1 +66 -0
  33. package/dist/agents/dsh/desktop-probe.cjs +37 -0
  34. package/dist/agents/dsh/index.js +98 -0
  35. package/dist/agents/dsh/installation.js +400 -0
  36. package/dist/agents/dsh/resources.js +755 -0
  37. package/dist/agents/dsh/runner.js +1183 -0
  38. package/dist/agents/dsh/runtime/README.md +243 -0
  39. package/dist/agents/dsh/runtime/authorization.js +23 -0
  40. package/dist/agents/dsh/runtime/bridge.js +837 -0
  41. package/dist/agents/dsh/runtime/config.js +271 -0
  42. package/dist/agents/dsh/runtime/entry.js +229 -0
  43. package/dist/agents/dsh/runtime/session-inspector.js +340 -0
  44. package/dist/agents/dsh/runtime/tool-policy.js +49 -0
  45. package/dist/agents/dsh/session-file-adapter.js +145 -0
  46. package/dist/agents/ecagent/index.js +215 -0
  47. package/dist/agents/{ecagent-runner.js → ecagent/runner.js} +592 -106
  48. package/dist/agents/ecagent/session-file-adapter.js +134 -0
  49. package/dist/agents/gemini/index.js +55 -10
  50. package/dist/agents/gemini/{gemini-runner.js → runner.js} +4 -9
  51. package/dist/aun/ability-device-routing.js +11 -17
  52. package/dist/aun/aid/agentmd.js +27 -1
  53. package/dist/aun/aid/managed-operation.js +6 -4
  54. package/dist/aun/group/invite-service.js +1 -1
  55. package/dist/aun/menu/client.js +1 -1
  56. package/dist/aun/msg/history.js +1 -1
  57. package/dist/aun/msg/managed-operation.js +93 -21
  58. package/dist/aun/msg/p2p.js +6 -6
  59. package/dist/aun/service-proxy.js +1 -1
  60. package/dist/aun/storage/index.js +242 -0
  61. package/dist/build-identity.json +1 -1
  62. package/dist/channels/aun.js +180 -43
  63. package/dist/channels/daemon.js +3 -2
  64. package/dist/channels/dingtalk.js +1 -1
  65. package/dist/channels/feishu.js +9 -9
  66. package/dist/channels/qqbot.js +1 -1
  67. package/dist/channels/wechat.js +2 -2
  68. package/dist/channels/wecom.js +1 -1
  69. package/dist/{agents/claude-gateway → claude-gateway}/agent-registration.js +13 -13
  70. package/dist/{agents/claude-gateway → claude-gateway}/binding.js +3 -3
  71. package/dist/{agents/claude-gateway → claude-gateway}/inbox.js +1 -1
  72. package/dist/{agents/claude-gateway → claude-gateway}/index.js +2 -2
  73. package/dist/{agents/claude-gateway → claude-gateway}/listing.js +3 -3
  74. package/dist/{agents/claude-gateway → claude-gateway}/router.js +4 -4
  75. package/dist/{agents/claude-gateway → claude-gateway}/sessions.js +2 -2
  76. package/dist/{agents/claude-gateway → claude-gateway}/terminal.js +1 -1
  77. package/dist/{agents/claude-gateway → claude-gateway}/transcript.js +1 -1
  78. package/dist/cli/ability-command.js +8 -5
  79. package/dist/cli/ability-output.js +182 -0
  80. package/dist/cli/agent-command.js +1 -1
  81. package/dist/cli/agent-create.js +123 -42
  82. package/dist/cli/agent-template.js +400 -29
  83. package/dist/cli/agent.js +14 -11
  84. package/dist/cli/aun-commands.js +167 -111
  85. package/dist/cli/daemon-commands.js +38 -8
  86. package/dist/cli/data-command.js +1 -1
  87. package/dist/cli/debug-mode.js +9 -0
  88. package/dist/cli/directory.js +1 -2
  89. package/dist/cli/ecmsg-gateway.js +55 -19
  90. package/dist/cli/fs-command.js +67 -39
  91. package/dist/cli/index.js +25 -11
  92. package/dist/cli/init.js +124 -29
  93. package/dist/cli/managed-command-guard.js +2 -0
  94. package/dist/cli/model.js +1 -1
  95. package/dist/cli/restart-monitor.js +2 -2
  96. package/dist/cli/services-command.js +24 -1
  97. package/dist/cli/skill-command.js +4 -4
  98. package/dist/cli/task-context.js +24 -14
  99. package/dist/cli/team-workspace-command.js +50 -52
  100. package/dist/cli/thread-command.js +3 -2
  101. package/dist/cli/trigger-command.js +47 -12
  102. package/dist/cli/watch-logs.js +2 -1
  103. package/dist/config/boot-log.js +3 -0
  104. package/dist/config/builtin-role-templates.js +1 -1
  105. package/dist/config/config-field-policy.js +10 -6
  106. package/dist/config/config-manager.js +33 -12
  107. package/dist/config/gateway-config.js +21 -37
  108. package/dist/config/invoke-ipc-service.js +1 -1
  109. package/dist/config/owner-config.js +5 -3
  110. package/dist/config/peer-book-store.js +2 -3
  111. package/dist/config/peer-book.js +2 -2
  112. package/dist/config/peer-role-resolver.js +2 -2
  113. package/dist/config/provider-identity-migration.js +24 -105
  114. package/dist/config/provider-ipc-service.js +13 -3
  115. package/dist/config/provider-local-sync.js +4 -1
  116. package/dist/config/provider-menu-request.js +21 -3
  117. package/dist/config/provider-templates.js +1 -1
  118. package/dist/config/providers-config.js +39 -15
  119. package/dist/config/providers-import.js +3 -3
  120. package/dist/config/providers-management.js +74 -99
  121. package/dist/config/schema-migration.js +177 -11
  122. package/dist/config/schema-registry.js +1 -1
  123. package/dist/config-store.js +38 -50
  124. package/dist/core/{agent-application-service.js → agent/agent-application-service.js} +9 -9
  125. package/dist/core/{agent-create-status.js → agent/agent-create-status.js} +112 -4
  126. package/dist/core/{agent-creation-claim.js → agent/agent-creation-claim.js} +3 -3
  127. package/dist/core/{agent-ipc-registration.js → agent/agent-ipc-registration.js} +102 -25
  128. package/dist/core/{agent-reload-coordinator.js → agent/agent-reload-coordinator.js} +61 -1
  129. package/dist/core/{agent-runtime.js → agent/agent-runtime.js} +53 -27
  130. package/dist/core/{evolagent-registry.js → agent/evolagent-registry.js} +12 -12
  131. package/dist/core/{evolagent.js → agent/evolagent.js} +11 -11
  132. package/dist/core/auth/agent-delegation.js +1 -8
  133. package/dist/core/auth/delegation-authorization.js +28 -0
  134. package/dist/core/auth/operation-authorizer.js +7 -4
  135. package/dist/core/auth/operation-catalog.js +34 -5
  136. package/dist/core/baseagent/baseagent-availability.js +197 -0
  137. package/dist/core/baseagent/baseagent-capability-adapter.js +288 -0
  138. package/dist/core/baseagent/baseagent-config-shared.js +56 -0
  139. package/dist/core/baseagent/baseagent-identity.js +68 -0
  140. package/dist/core/{baseagent-loader.js → baseagent/baseagent-loader.js} +62 -6
  141. package/dist/core/baseagent/baseagent-model-defaults.js +26 -0
  142. package/dist/{agents → core/baseagent}/baseagent-plugin-descriptor.js +107 -24
  143. package/dist/core/baseagent/baseagent-plugin-loader.js +367 -0
  144. package/dist/core/baseagent/baseagent.js +157 -0
  145. package/dist/{agents → core/baseagent}/runner-types.js +36 -4
  146. package/dist/core/capability/capability-manager.js +79 -30
  147. package/dist/core/capability/providers/claude-capability-provider.js +2 -154
  148. package/dist/core/capability/providers/codex-capability-provider.js +2 -136
  149. package/dist/core/{channel-loader.js → channel/channel-loader.js} +226 -38
  150. package/dist/core/{channel-runtime.js → channel/channel-runtime.js} +18 -18
  151. package/dist/core/command/agent-control.js +60 -15
  152. package/dist/core/command/agent-template-menu.js +21 -9
  153. package/dist/core/command/agentmd-menu-request.js +19 -8
  154. package/dist/core/command/agentmd-menu.js +14 -5
  155. package/dist/core/command/command-handler.js +127 -57
  156. package/dist/core/command/context-policy-menu.js +122 -0
  157. package/dist/core/command/data-root-resolver.js +157 -20
  158. package/dist/core/command/memory-slash.js +6 -6
  159. package/dist/core/command/menu-catalog.js +80 -20
  160. package/dist/core/command/menu-handler.js +305 -25
  161. package/dist/core/command/menu-protocol.js +42 -8
  162. package/dist/core/command/menu-query-batch.js +9 -5
  163. package/dist/core/command/provider-menu.js +7 -11
  164. package/dist/core/command/role-menu.js +1 -1
  165. package/dist/core/command/skill-slash.js +17 -5
  166. package/dist/core/command/slash-gate.js +2 -4
  167. package/dist/core/command/slash-handler.js +127 -96
  168. package/dist/core/command/team-workspace-team.js +3 -3
  169. package/dist/core/command/topic-slash.js +10 -10
  170. package/dist/core/{daemon-bootstrap.js → daemon/daemon-bootstrap.js} +14 -14
  171. package/dist/core/{daemon-control.js → daemon/daemon-control.js} +46 -20
  172. package/dist/core/{daemon-lifecycle.js → daemon/daemon-lifecycle.js} +15 -15
  173. package/dist/core/{host-snapshot.js → daemon/host-snapshot.js} +3 -3
  174. package/dist/core/{ipc-registration.js → daemon/ipc-registration.js} +98 -38
  175. package/dist/core/{lifecycle-notice.js → daemon/lifecycle-notice.js} +4 -5
  176. package/dist/core/file-integrity/store.js +1 -1
  177. package/dist/core/handoff/ipc-registration.js +3 -3
  178. package/dist/core/handoff/runtime.js +1 -1
  179. package/dist/{agents → core/inference}/request-identity.js +2 -2
  180. package/dist/core/inference/text-inference.js +4 -4
  181. package/dist/core/{bootstrap-messages.js → initialization/bootstrap-messages.js} +10 -10
  182. package/dist/core/{bootstrap-service.js → initialization/bootstrap-service.js} +24 -23
  183. package/dist/core/initialization/service.js +54 -9
  184. package/dist/core/invoke/executors/media.js +1 -1
  185. package/dist/core/invoke/executors/text.js +1 -1
  186. package/dist/core/memory/consolidation-context.js +1 -1
  187. package/dist/core/memory/consolidation-trigger.js +9 -3
  188. package/dist/core/memory/consolidation.js +4 -4
  189. package/dist/core/memory/memory-admin.js +6 -6
  190. package/dist/core/memory/memory-writer.js +1 -1
  191. package/dist/core/memory/relation-idle-monitor.js +1 -1
  192. package/dist/core/message/aun-ipc-sender.js +114 -75
  193. package/dist/core/message/aun-request-registry.js +13 -5
  194. package/dist/core/message/auto-mention-gate.js +1 -1
  195. package/dist/core/message/contact-admission.js +1 -1
  196. package/dist/core/message/im-renderer.js +19 -0
  197. package/dist/core/{interaction-router.js → message/interaction-router.js} +4 -4
  198. package/dist/core/message/items-formatter.js +5 -5
  199. package/dist/core/message/message-admission.js +1 -1
  200. package/dist/core/message/message-bridge.js +135 -54
  201. package/dist/core/message/message-queue.js +83 -4
  202. package/dist/core/message/message-utils.js +1 -1
  203. package/dist/core/message/peer-mode.js +1 -1
  204. package/dist/core/message/response-engine.js +347 -163
  205. package/dist/core/message/send-options.js +9 -6
  206. package/dist/core/message/send-routing.js +45 -109
  207. package/dist/core/message/stream-idle-monitor.js +1 -1
  208. package/dist/core/{data-migration.js → migration/data-migration.js} +29 -1
  209. package/dist/core/model/catalog-service.js +29 -8
  210. package/dist/core/model/model-capabilities.js +88 -0
  211. package/dist/core/model/model-catalog.js +14 -3
  212. package/dist/core/model/model-diagnostics.js +4 -4
  213. package/dist/core/ownership/owner-resolver.js +95 -15
  214. package/dist/core/{pack-auth.js → pack/pack-auth.js} +30 -3
  215. package/dist/core/{pack-install.js → pack/pack-install.js} +95 -17
  216. package/dist/core/permission/approval-gateway.js +9 -18
  217. package/dist/core/permission/ec-command-parser.js +70 -34
  218. package/dist/core/permission/managed-file.js +234 -0
  219. package/dist/core/permission/protected-paths.js +56 -0
  220. package/dist/core/permission/sandbox-runtime.js +267 -3
  221. package/dist/core/permission/session-path-grants.js +1 -1
  222. package/dist/core/permission/shell-environment.js +15 -1
  223. package/dist/core/plugin/plugin-lifecycle.js +442 -0
  224. package/dist/core/session/adapters/claude-session-file-adapter.js +2 -246
  225. package/dist/core/session/adapters/codex-session-file-adapter.js +2 -566
  226. package/dist/core/session/adapters/ecagent-session-file-adapter.js +2 -134
  227. package/dist/core/{background-session → session/background}/session-cleanup.js +2 -2
  228. package/dist/core/{background-session → session/background}/types.js +1 -1
  229. package/dist/core/session/session-file-health.js +2 -272
  230. package/dist/core/session/session-idle-monitor.js +1 -1
  231. package/dist/core/session/session-manager.js +29 -2
  232. package/dist/core/session/session-terminal.js +185 -0
  233. package/dist/core/session/session-title.js +8 -11
  234. package/dist/core/{system-session → session/system}/memory.js +43 -9
  235. package/dist/core/{system-session → session/system}/registry.js +1 -1
  236. package/dist/core/{system-session → session/system}/types.js +1 -1
  237. package/dist/core/skill/index-generator.js +1 -0
  238. package/dist/core/task/task-activity-store.js +112 -0
  239. package/dist/core/task/task-recovery-service.js +2 -2
  240. package/dist/core/thread/ipc-operation.js +2 -2
  241. package/dist/core/thread/thread-operation.js +2 -1
  242. package/dist/core/thread/thread-route.js +5 -3
  243. package/dist/core/thread/thread-service.js +14 -4
  244. package/dist/directory/{owner-directory-admission.js → admission.js} +3 -3
  245. package/dist/directory/{owner-directory-cache.js → cache.js} +90 -8
  246. package/dist/directory/{owner-directory-markdown.js → markdown.js} +2 -2
  247. package/dist/directory/{owner-directory-query-operation.js → query-operation.js} +83 -9
  248. package/dist/directory/{owner-directory-search.js → search.js} +50 -2
  249. package/dist/directory/{owner-directory-store.js → store.js} +2 -2
  250. package/dist/eck/kit-renderer.js +1 -1
  251. package/dist/eck/manifest-engine.js +64 -2
  252. package/dist/eck/message-renderer.js +35 -0
  253. package/dist/ecweb/basic-settings-service.js +9 -3
  254. package/dist/{contracts → ecweb/contracts}/ecweb-service-protocol.js +2 -1
  255. package/dist/ecweb/dsh-native-service.js +413 -0
  256. package/dist/ecweb/providers-service.js +1 -1
  257. package/dist/ecweb/runtime/lifecycle.js +1 -1
  258. package/dist/ecweb/runtime/supervisor.js +1 -1
  259. package/dist/event-center/center-config.js +2 -2
  260. package/dist/event-center/dispatcher.js +1 -1
  261. package/dist/event-center/ipc-operation.js +12 -3
  262. package/dist/event-center/pack-loader.js +2 -2
  263. package/dist/event-center/registry.js +6 -6
  264. package/dist/event-center/runtime.js +2 -2
  265. package/dist/index.js +71 -42
  266. package/dist/ipc.js +103 -10
  267. package/dist/outputs/authorization.js +27 -0
  268. package/dist/outputs/events.js +10 -1
  269. package/dist/outputs/panel-cards.js +960 -0
  270. package/dist/paths.js +12 -0
  271. package/dist/pay/command.js +1 -1
  272. package/dist/pay/runtime.js +18 -10
  273. package/dist/response-system/engines/v1/proactive-flow.js +1 -1
  274. package/dist/services/dispatcher.js +2 -2
  275. package/dist/services/host/main.js +10 -1
  276. package/dist/services/host/protocol.js +9 -2
  277. package/dist/services/host/resident.js +37 -0
  278. package/dist/services/host-client.js +12 -0
  279. package/dist/services/host-recycle.js +8 -3
  280. package/dist/services/host-runtime.js +54 -15
  281. package/dist/services/index.js +83 -19
  282. package/dist/services/ipc-operation.js +303 -38
  283. package/dist/services/pack-manager.js +2 -2
  284. package/dist/services/router.js +43 -3
  285. package/dist/services/script-runner.js +34 -25
  286. package/dist/services/service-payload.js +28 -1
  287. package/dist/services/validation.js +28 -2
  288. package/dist/stats/context-usage.js +110 -0
  289. package/dist/stats/model-resolver.js +103 -17
  290. package/dist/stats/query.js +5 -0
  291. package/dist/trigger/application-service.js +3 -2
  292. package/dist/trigger/authorization.js +36 -33
  293. package/dist/trigger/ipc-service.js +4 -4
  294. package/dist/trigger/local-files.js +8 -176
  295. package/dist/trigger/manager.js +2 -2
  296. package/dist/trigger/parser.js +48 -0
  297. package/dist/trigger/scheduler.js +14 -2
  298. package/dist/trigger/script-executor.js +21 -0
  299. package/dist/trigger/script-sandbox.js +57 -243
  300. package/dist/trigger/system-definitions.js +25 -0
  301. package/dist/trigger/validation.js +1 -1
  302. package/dist/utils/atomic-write.js +88 -1
  303. package/dist/utils/cross-platform.js +4 -42
  304. package/dist/utils/error-dict.json +22 -1
  305. package/dist/utils/error-utils.js +193 -6
  306. package/dist/utils/evolcore-version.js +2 -2
  307. package/dist/utils/host-info.js +1 -1
  308. package/dist/utils/logger.js +3 -1
  309. package/dist/utils/media-cache.js +99 -4
  310. package/dist/utils/startup-trace.js +20 -4
  311. package/dist/utils/welcome.js +64 -20
  312. package/ecagent/README.md +35 -0
  313. package/ecagent/dist/agent-loop.js +80 -30
  314. package/ecagent/dist/harness/env/nodejs.d.ts +16 -0
  315. package/ecagent/dist/harness/env/nodejs.js +49 -20
  316. package/ecagent/dist/harness/messages.js +3 -2
  317. package/ecagent/dist/harness/types.d.ts +1 -0
  318. package/ecagent/dist/runtime/types.d.ts +2 -0
  319. package/ecagent/dist/runtime/utils/validation.d.ts +7 -1
  320. package/ecagent/dist/runtime/utils/validation.js +42 -0
  321. package/ecagent/dist/types.d.ts +2 -0
  322. package/kits/docs/INDEX.md +1 -1
  323. package/kits/docs/channels/feishu.md +1 -1
  324. package/kits/docs/evolcore/INDEX.md +10 -7
  325. package/kits/docs/evolcore/agent-create.md +2 -0
  326. package/kits/docs/evolcore/agent.md +100 -13
  327. package/kits/docs/evolcore/aid.md +19 -3
  328. package/kits/docs/evolcore/config.md +94 -0
  329. package/kits/docs/evolcore/ctl.md +2 -1
  330. package/kits/docs/evolcore/ec-capabilities.md +7 -10
  331. package/kits/docs/evolcore/ecweb-lifecycle.md +5 -1
  332. package/kits/docs/evolcore/event.md +1 -1
  333. package/kits/docs/evolcore/fs.md +49 -3
  334. package/kits/docs/evolcore/group.md +3 -3
  335. package/kits/docs/evolcore/memory-consolidation.md +1 -1
  336. package/kits/docs/evolcore/menu-protocol.md +24 -2
  337. package/kits/docs/evolcore/model.md +9 -1
  338. package/kits/docs/evolcore/msg.md +30 -28
  339. package/kits/docs/evolcore/pay.md +8 -20
  340. package/kits/docs/evolcore/plugin.md +74 -0
  341. package/kits/docs/evolcore/provider.md +8 -2
  342. package/kits/docs/evolcore/rpc.md +2 -2
  343. package/kits/docs/evolcore/skill.md +17 -1
  344. package/kits/docs/evolcore/stats.md +5 -0
  345. package/kits/docs/evolcore/storage.md +22 -0
  346. package/kits/docs/evolcore/thread-chain.md +19 -10
  347. package/kits/docs/evolcore/tool-authorization.md +4 -0
  348. package/kits/docs/evolcore/trigger.md +89 -13
  349. package/kits/docs/identity/AID_PROFILE_SPEC.md +1 -1
  350. package/kits/docs/venues/feishu-group.md +3 -2
  351. package/kits/docs/venues/feishu-private.md +3 -2
  352. package/kits/rules/02-navigation.md +20 -13
  353. package/kits/rules/06-channel.md +18 -2
  354. package/kits/schemas/_meta.json +8 -4
  355. package/kits/schemas/agent-config.schema.23.json +19 -3
  356. package/kits/schemas/agent-config.schema.24.json +986 -0
  357. package/kits/schemas/agent-config.schema.25.json +986 -0
  358. package/kits/schemas/daemon.schema.11.json +487 -0
  359. package/kits/schemas/daemon.schema.12.json +505 -0
  360. package/kits/schemas/defaults.schema.8.json +484 -0
  361. package/kits/schemas/providers.schema.1.json +1 -1
  362. package/kits/schemas/providers.schema.2.json +1 -1
  363. package/kits/schemas/providers.schema.3.json +8 -2
  364. package/kits/skills/.switches.json +4 -0
  365. package/kits/skills/ability/SKILL.md +194 -27
  366. package/kits/skills/ability/STRUCTURE.md +5 -0
  367. package/kits/skills/agent-output-cards/SKILL.md +90 -54
  368. package/kits/skills/agent-output-cards/examples/html-surface.json +11 -0
  369. package/kits/skills/agent-output-cards/examples/meeting-followups.json +16 -0
  370. package/kits/skills/agent-output-cards/examples/meeting-latest.json +24 -0
  371. package/kits/skills/agent-output-cards/examples/project-metrics.json +16 -0
  372. package/kits/skills/agent-output-cards/examples/quick-links.json +18 -0
  373. package/kits/skills/agent-output-cards/examples/surface.html +8 -0
  374. package/kits/skills/agent-template-project/SKILL.md +51 -0
  375. package/kits/skills/agent-template-project/references/01-collect-and-pack.md +174 -0
  376. package/kits/skills/agent-template-project/references/02-upload-and-share.md +109 -0
  377. package/kits/skills/agent-template-project/references/03-download-and-install.md +189 -0
  378. package/kits/skills/agent-template-project/references/04-upgrade-and-recovery.md +74 -0
  379. package/kits/skills/agent-template-project/references/05-publish-to-platform.md +62 -0
  380. package/kits/skills/ec-group/SKILL.md +3 -3
  381. package/kits/skills/ec-group-collaboration/SKILL.md +4 -4
  382. package/kits/skills/ec-identity/SKILL.md +9 -6
  383. package/kits/skills/ec-pay/SKILL.md +163 -41
  384. package/kits/skills/ec-provider/SKILL.md +5 -5
  385. package/kits/skills/ec-service-call/SKILL.md +3 -0
  386. package/kits/skills/ec-skill/SKILL.md +25 -9
  387. package/kits/skills/ec-skill/scripts/cli.mjs +7 -7
  388. package/kits/skills/ec-skill/scripts/skill.mjs +55 -41
  389. package/kits/skills/ec-skill/scripts/template/SKILL.md.tmpl +9 -0
  390. package/kits/skills/ec-trigger/SKILL.md +2 -2
  391. package/kits/skills/personal-assistant/SKILL.md +22 -22
  392. package/kits/skills/personal-assistant/references/03-data-flow-and-gaps.md +1 -1
  393. package/kits/skills/scrapling-article-fetch/SKILL.md +5 -5
  394. package/kits/skills/thread-ops/SKILL.md +19 -9
  395. package/kits/skills/wechat-article-media-download/SKILL.md +2 -2
  396. package/kits/skills/wechat-article-reader/SKILL.md +2 -2
  397. package/kits/templates/system-fragments/commands.md +1 -1
  398. package/kits/templates/system-fragments/personal-assistant.md +2 -2
  399. package/kits/templates/system-fragments/reply.md +14 -9
  400. package/kits/templates/system-fragments/session.md +1 -1
  401. package/kits/templates/system-fragments/thread.md +10 -5
  402. package/package.json +6 -5
  403. package/scripts/agent-template/index.mjs +7 -1
  404. package/scripts/agent-template/inspect.mjs +81 -35
  405. package/scripts/agent-template/overlay.mjs +110 -4
  406. package/scripts/agent-template/shared/common.mjs +36 -4
  407. package/scripts/agent-template/shared/plan.mjs +4 -2
  408. package/scripts/agent-template/shared/service-packs.mjs +104 -0
  409. package/scripts/agent-template/shared/team-schema.json +467 -54
  410. package/scripts/agent-template/shared/template-contract.mjs +70 -68
  411. package/scripts/agent-template/shared/template-package.mjs +153 -36
  412. package/scripts/agent-template/shared/template-runtime.mjs +76 -64
  413. package/scripts/agent-template/shared/template.mjs +11 -46
  414. package/scripts/agent-template/team-pack.mjs +451 -35
  415. package/scripts/agent-template/team-preview.mjs +75 -226
  416. package/scripts/aid-batch/identity-batch.mjs +1 -1
  417. package/dist/agents/baseagent-availability.js +0 -176
  418. package/dist/agents/baseagent-capability-adapter.js +0 -102
  419. package/dist/agents/baseagent-plugin-loader.js +0 -145
  420. package/dist/agents/baseagent.js +0 -816
  421. package/dist/agents/codex/catalog.js +0 -80
  422. package/dist/agents/ecagent-plugin-lazy.js +0 -41
  423. package/dist/agents/tool-time-context.js +0 -55
  424. package/dist/core/legacy-rename.js +0 -41
  425. package/dist/core/plugin-lifecycle.js +0 -137
  426. package/dist/core/rate-window.js +0 -53
  427. package/dist/core/runner-reload-transaction.js +0 -60
  428. package/dist/core/runtime-lock.js +0 -90
  429. package/dist/core/soul.js +0 -66
  430. package/dist/core/system-session/grants.js +0 -40
  431. package/dist/directory/owner-directory-agentmd-sync.js +0 -89
  432. package/dist/directory/owner-directory-request-operation.js +0 -79
  433. package/dist/directory/owner-directory-text.js +0 -60
  434. package/kits/skills/ec-pay/references/pay-cli.md +0 -110
  435. /package/dist/agents/gemini/{gemini-capability-provider.js → capability-provider.js} +0 -0
  436. /package/dist/agents/gemini/{gemini-session-file-adapter.js → session-file-adapter.js} +0 -0
  437. /package/dist/{agents/claude-gateway → claude-gateway}/types.js +0 -0
  438. /package/dist/core/{system-channels.js → channel/system-channels.js} +0 -0
  439. /package/dist/core/{daemon-file-cache.js → daemon/daemon-file-cache.js} +0 -0
  440. /package/dist/core/{event-bus.js → event/event-bus.js} +0 -0
  441. /package/dist/core/{event-catalog.js → event/event-catalog.js} +0 -0
  442. /package/dist/core/{pack-ledger.js → pack/pack-ledger.js} +0 -0
  443. /package/dist/directory/{owner-directory-identity.js → identity.js} +0 -0
  444. /package/dist/directory/{owner-directory-policy.js → policy.js} +0 -0
  445. /package/dist/directory/{owner-directory-remarks.js → remarks.js} +0 -0
  446. /package/dist/directory/{owner-directory-scope.js → scope.js} +0 -0
  447. /package/dist/{contracts → ecweb/contracts}/ecweb-instance.js +0 -0
  448. /package/kits/templates/{bootstrap-welcome.md → bootstrap-intro.md} +0 -0
@@ -1,15 +1,19 @@
1
+ import { panelResourceVersion } from '../../outputs/panel-cards.js';
1
2
  import { memoryHelpEntries } from './memory-slash.js';
2
3
  import { executeProviderMenu } from './provider-menu.js';
3
4
  import { executePrivateMentionMenu, validatePrivateMentionMenuRequest } from './private-mention-menu.js';
5
+ import { executeContextPolicyMenu, validateContextPolicyMenuRequest } from './context-policy-menu.js';
4
6
  import { executeTemplateMenu, executeProviderModelCatalog } from './agent-template-menu.js';
5
- import { getBaseagentSnapshot, loadedBaseagentIds } from '../../agents/baseagent-availability.js';
6
- import { resolveBaseagentModelSelection } from '../../agents/baseagent.js';
7
+ import { getBaseagentSnapshot, loadedBaseagentIds } from '../baseagent/baseagent-availability.js';
8
+ import { executePluginMenu } from '../plugin/plugin-lifecycle.js';
9
+ import { normalizeBaseagent, resolveBaseagentModelSelection, resolveOpenaiConfig } from '../baseagent/baseagent.js';
10
+ import { buildModelRequestHeaders } from '../inference/request-identity.js';
7
11
  import { normalizePeer, writeAgentModelConfig } from '../model/config-scope.js';
8
12
  import { formatPeerKey } from '../relation/peer-identity.js';
9
13
  import { writeChatmodeConfig } from './chatmode-config.js';
10
14
  import { modelMatches, getCatalog, getBaseagentCatalog, resolveCatalogModel, assertCatalogSelectable, CONFIGURABLE_EFFORTS, configurableEfforts } from '../model/model-catalog.js';
11
15
  import { constrainResolvedModelForRole, filterModelsForRole, validateModelSelectionForRole } from '../model/model-permission.js';
12
- import { hasModelSwitcher } from '../../agents/runner-types.js';
16
+ import { hasModelSwitcher } from '../baseagent/runner-types.js';
13
17
  import { resolvePaths, getPackageRoot, daemonControlDir, resolveRoot } from '../../paths.js';
14
18
  import { buildEnvelope, isDeliveryTarget, isDeliveryTargetForChannel, replyContextFromSession } from '../message/message-utils.js';
15
19
  import { isMainSession, isTopicSession, sessionLocalTopicId, sessionTopicThreadId } from '../thread/topic-id.js';
@@ -36,11 +40,13 @@ import { fieldSchemaDefault } from '../../config/schema-registry.js';
36
40
  import { agentCreateCapabilities, execAgentAction, execAgentQuery, execAgentOptions, execAidAvatar, resolveProjectPath } from './agent-control.js';
37
41
  import { readInitialization } from '../../cli/agent-create.js';
38
42
  import { agentMdMenuService } from './agentmd-menu.js';
43
+ import { isAgentMdWriteAction } from './agentmd-menu-request.js';
39
44
  import { isValidAid } from '../../aun/aid/validation.js';
40
45
  import { gatewayList, gatewayUpdate, gatewayDelete, gatewayTest, gatewayModels, gatewaySetPrice } from '../../config/gateway-config.js';
41
46
  import { displaySessionTitle } from '../session/session-title.js';
42
47
  import { buildTranscriptTurns } from '../session/session-transcript.js';
43
48
  import { buildForkHistorySnapshot, pageForkHistory } from '../session/session-manager.js';
49
+ import { openSessionInTerminal, resolveSessionTerminalProjectPath } from '../session/session-terminal.js';
44
50
  import { isCapabilityType, listCapabilityOptions, queryCapabilityTypes, resolveCapabilityContext, updateCapabilityPolicy, } from '../capability/capability-manager.js';
45
51
  import { normalizeCliArgv, parseCliIntent, parseLegacyCliCommand, validateCliArgv, withDefaultRelationContext } from './cli-intent-parser.js';
46
52
  import { auditCommandAuthorization, auditFullAccessEvent, hashArgv } from '../auth/authorization-audit.js';
@@ -55,7 +61,7 @@ import { chatmodeFieldForPeer, isChatMode, isPrivateChatmodeRoleLocked, resolveC
55
61
  import { PUBLIC_PERMISSION_MODES } from '../permission/mode.js';
56
62
  import { isAgentFullAccessOwner, resolveRuntimePermissionMode, resolveRuntimeStringField, sessionFullAccessStatus, updateRelationSessionFullAccess, validateRuntimeStringFieldOverride, } from '../role/runtime-policy.js';
57
63
  import { isManagementRole } from '../../config/builtin-roles.js';
58
- import { SYSTEM_CONTROL_CHANNEL } from '../system-channels.js';
64
+ import { SYSTEM_CONTROL_CHANNEL } from '../channel/system-channels.js';
59
65
  import { logger } from '../../utils/logger.js';
60
66
  import { resolveProjectDefaultPath } from '../../utils/project-path.js';
61
67
  import { shouldSuppressRealRestart, createRestartRequest, readRestartRequest, updateRestartRequest, removeRestartRequest } from '../../utils/restart-safety.js';
@@ -1021,6 +1027,8 @@ export const SELF_MANAGE_AGENT_ACTIONS = new Set(['update', 'reload']);
1021
1027
  /** 判断 (cmdBase, action) 是否为进程级操作(仅控制 channel 可执行)。
1022
1028
  * /system 全部进程级;/agent 仅 create/delete/enable/disable 进程级;其余关系级。 */
1023
1029
  export function isProcessLevelAction(cmdBase, action) {
1030
+ if (cmdBase === '/plugins')
1031
+ return true;
1024
1032
  if (cmdBase === '/provider')
1025
1033
  return true;
1026
1034
  if (cmdBase === '/baseagent-models')
@@ -1066,6 +1074,11 @@ function gateControlScope(opts) {
1066
1074
  function buildMenuIntent(verb, cmdBase, args, action, value, fromControlChannel = false) {
1067
1075
  if (cmdBase === '/agent-data-root' || cmdBase === '/relation-data-root')
1068
1076
  return null;
1077
+ if (cmdBase === '/context-policy' && (verb === 'query' || verb === 'update'))
1078
+ return {
1079
+ operation: verb === 'update' ? 'contextpolicy.update' : 'contextpolicy.current',
1080
+ scope: 'agent', source: 'menu', args: { ...(args ?? {}), ...(value !== undefined ? { value } : {}) },
1081
+ };
1069
1082
  if (cmdBase === '/private-mention-mode' && ['query', 'options', 'update'].includes(verb)) {
1070
1083
  return { operation: `privatementionmode.${verb === 'update' ? 'update' : 'current'}`,
1071
1084
  scope: 'agent', source: 'menu', args: { ...(args ?? {}), ...(value !== undefined ? { value } : {}) } };
@@ -1130,6 +1143,8 @@ function buildMenuIntent(verb, cmdBase, args, action, value, fromControlChannel
1130
1143
  return intent('agent.access.read', 'agent');
1131
1144
  return intent(fromControlChannel && !args?.aid ? 'agent.list' : 'agent.show', fromControlChannel ? 'control' : 'agent');
1132
1145
  }
1146
+ if (cmdBase === '/connect' && args?.view === 'access')
1147
+ return intent('agent.access.read', 'agent');
1133
1148
  if (cmdBase === '/trigger')
1134
1149
  return intent(args?.view === 'history' ? 'trigger.history'
1135
1150
  : args?.view === 'detail' ? 'trigger.show' : 'trigger.list', 'relation');
@@ -1141,6 +1156,8 @@ function buildMenuIntent(verb, cmdBase, args, action, value, fromControlChannel
1141
1156
  return intent('config.read', args?.scope === 'agent' ? 'agent' : 'process');
1142
1157
  if (cmdBase === '/agent')
1143
1158
  return intent(fromControlChannel ? 'agent.list' : 'agent.show', fromControlChannel ? 'control' : 'agent');
1159
+ if (cmdBase === '/connect')
1160
+ return intent('agent.access.read', 'agent');
1144
1161
  if (cmdBase === '/capability')
1145
1162
  return intent('capability.read', 'agent');
1146
1163
  if (cmdBase === '/trigger')
@@ -1165,6 +1182,8 @@ function buildMenuIntent(verb, cmdBase, args, action, value, fromControlChannel
1165
1182
  return intent('permission.current', args?.scope === 'agent' ? 'agent' : 'relation');
1166
1183
  }
1167
1184
  if (verb === 'update') {
1185
+ if (cmdBase === '/connect')
1186
+ return intent('agent.access.write', 'agent', { action: 'set-access' });
1168
1187
  if (cmdBase === '/baseagent')
1169
1188
  return intent('agent.baseagent.update', 'agent', { baseagent: value });
1170
1189
  // 模型参数只在 Agent 级:写入一律按 agent scope 鉴权(仅 owner/admin)。
@@ -1188,6 +1207,11 @@ function buildMenuIntent(verb, cmdBase, args, action, value, fromControlChannel
1188
1207
  return intent('trigger.update', 'relation', { action: 'update' });
1189
1208
  }
1190
1209
  if (verb === 'action') {
1210
+ if (cmdBase === '/connect' && action === 'set-access')
1211
+ return intent('agent.access.write', 'agent', { action });
1212
+ if ((cmdBase === '/session' || cmdBase === '/s') && action === 'open-terminal') {
1213
+ return intent('session.terminal.open', 'agent');
1214
+ }
1191
1215
  if (cmdBase === '/file') {
1192
1216
  if (action === 'search')
1193
1217
  return intent('file.search', 'filesystem', { filePath: args?.path ?? '.' });
@@ -1238,7 +1262,7 @@ function buildMenuIntent(verb, cmdBase, args, action, value, fromControlChannel
1238
1262
  }
1239
1263
  if (cmdBase === '/aid' && action === 'avatar')
1240
1264
  return intent('ec.aid.avatar', 'agent', { action });
1241
- if (cmdBase === '/aid' && action === 'agentmd.publish')
1265
+ if (cmdBase === '/aid' && isAgentMdWriteAction(action))
1242
1266
  return intent('ec.aid.agentmd.put', 'agent', { action });
1243
1267
  if (cmdBase === '/trigger') {
1244
1268
  if (action === 'create' || action === 'set')
@@ -1830,6 +1854,28 @@ export async function getSubMenuItems(cmd, channel, channelId, userId, args, ove
1830
1854
  throw authorized;
1831
1855
  return await roleMenuOptions(authorized.context, args);
1832
1856
  }
1857
+ // The old Connect root is retained only so existing clients can reopen the
1858
+ // access-settings page. Contact/group/request options remain retired.
1859
+ if (cmdBase0 === '/connect') {
1860
+ const connectOptionsDenied = await authorizeMenuIntent.call(this, {
1861
+ intent: buildMenuIntent('options', cmdBase0, args, undefined, undefined, fromControlChannel),
1862
+ identity: subject.identity,
1863
+ subject,
1864
+ session,
1865
+ explicitChatType,
1866
+ channel,
1867
+ channelId,
1868
+ userId,
1869
+ fromControlChannel,
1870
+ source,
1871
+ });
1872
+ if (connectOptionsDenied)
1873
+ throw { code: connectOptionsDenied.code, message: connectOptionsDenied.error, data: connectOptionsDenied.data };
1874
+ if (args?.option !== undefined && args.option !== 'access') {
1875
+ throw { code: 'NOT_SUPPORTED', message: 'Connect compatibility only supports the access option' };
1876
+ }
1877
+ return [{ value: 'access', label: '访问设置', desc: '设置私聊准入与准入控制消息限额' }];
1878
+ }
1833
1879
  if (cmdBase0 === '/group') {
1834
1880
  const result = await executeGroupMenu(this, {
1835
1881
  kind: 'options', args,
@@ -1942,12 +1988,14 @@ export async function getSubMenuItems(cmd, channel, channelId, userId, args, ove
1942
1988
  // ── 关系级 /trigger list(每个 trigger 一个 MenuItem) ──
1943
1989
  if (cmd === '/trigger') {
1944
1990
  const triggerScheduler = this.getTriggerSchedulerForChannel?.(channel);
1945
- const scope = args?.options === 'all' ? 'all' : 'enabled';
1991
+ // 默认列出开与关的全部定义;args.options === 'enabled' 或 args.enabledOnly 只列已启用。
1992
+ // 旧客户端可能传 options='all',语义等同默认,保留兼容。
1993
+ const enabledOnly = args?.options === 'enabled' || args?.enabledOnly === true;
1946
1994
  const role = optionsIdentity.role;
1947
1995
  const isAdmin = isManagementRole(role) || subject.isDaemonOwner || subject.processRole === 'daemon-service';
1948
1996
  if (!triggerScheduler)
1949
1997
  return [];
1950
- const list = triggerScheduler.list({ all: scope === 'all' })
1998
+ const list = triggerScheduler.list({ enabledOnly })
1951
1999
  .filter((definition) => this.canAccessTriggerDefinition(definition, userId ?? '', channel, isAdmin));
1952
2000
  return list.map((definition) => {
1953
2001
  const view = this.definitionToTriggerView(definition, triggerScheduler);
@@ -2061,7 +2109,11 @@ export async function getSubMenuItems(cmd, channel, channelId, userId, args, ove
2061
2109
  const available = requestedAgent?.name
2062
2110
  ? (this.getAvailableBaseagentsForOwner?.(requestedAgent.name) ?? [])
2063
2111
  : this.getAvailableBaseagents(channel);
2064
- return available.map((id) => ({ value: id, label: id, selected: id === currentAgent }));
2112
+ return available.map((id) => ({
2113
+ value: id,
2114
+ label: normalizeBaseagent(id).displayName,
2115
+ selected: id === currentAgent,
2116
+ }));
2065
2117
  }
2066
2118
  if (cmd === '/model') {
2067
2119
  const target = resolveMenuModelTarget.call(this, {
@@ -2234,8 +2286,13 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2234
2286
  if (invalid)
2235
2287
  return { error: invalid.message, code: invalid.code };
2236
2288
  }
2289
+ if (cmdBase === '/context-policy') {
2290
+ const invalid = validateContextPolicyMenuRequest({ type: 'menu.query', args });
2291
+ if (invalid)
2292
+ return { error: invalid.message, code: invalid.code };
2293
+ }
2237
2294
  if (cmdBase === '/template') {
2238
- return executeTemplateMenu({ name: 'template', type: 'menu.query', args }, fromControlChannel ? authSubject : undefined, source);
2295
+ return executeTemplateMenu({ name: 'template', type: 'menu.query', id: authSubject?.requestId, args }, fromControlChannel ? authSubject : undefined, source);
2239
2296
  }
2240
2297
  if (cmdBase === '/model' && args?.scope === 'process' && args?.view === 'catalog') {
2241
2298
  return executeProviderModelCatalog({ name: 'model', type: 'menu.query', args }, fromControlChannel ? authSubject : undefined, source);
@@ -2243,6 +2300,8 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2243
2300
  if (cmdBase === '/provider') {
2244
2301
  return executeProviderMenu({ name: 'provider', cmd, type: 'menu.query', args }, fromControlChannel ? authSubject : undefined, source);
2245
2302
  }
2303
+ if (cmdBase === '/plugins')
2304
+ return executePluginMenu({ type: 'menu.query', args }, fromControlChannel ? authSubject : undefined, source);
2246
2305
  const isRequesterRoleQuery = cmdBase === '/role' && args?.view === 'requester';
2247
2306
  if (isRequesterRoleQuery && Object.keys(args).some(key => key !== 'view')) {
2248
2307
  return { error: 'role requester query only accepts args.view', code: 'INVALID_ARGUMENT' };
@@ -2277,7 +2336,7 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2277
2336
  }
2278
2337
  }
2279
2338
  }
2280
- if (transportReplyContext?.threadId && !groupResourceSession && cmdBase !== '/private-mention-mode') {
2339
+ if (transportReplyContext?.threadId && !groupResourceSession && !['/private-mention-mode', '/context-policy'].includes(cmdBase)) {
2281
2340
  try {
2282
2341
  session = await loadMenuTopicSession(this.sessionManager, channel, channelId, transportReplyContext.threadId);
2283
2342
  }
@@ -2528,6 +2587,17 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2528
2587
  return menuResultFailure(error);
2529
2588
  }
2530
2589
  }
2590
+ if (cmdBase === '/connect') {
2591
+ if (args?.view !== 'access')
2592
+ return { error: 'Connect compatibility only supports view=access', code: 'NOT_SUPPORTED' };
2593
+ const authDenied = await authorizeMenuIntent.call(this, {
2594
+ intent: buildMenuIntent('query', cmdBase, args, undefined, undefined, fromControlChannel),
2595
+ identity, subject, session, explicitChatType, channel, channelId, userId, fromControlChannel, source,
2596
+ });
2597
+ if (authDenied)
2598
+ return authDenied;
2599
+ return execAgentQuery({ ...(args ?? {}), aid: args?.aid ?? subject.selfAid, view: 'access' }, this.agentApplicationService, subject, this.runtime);
2600
+ }
2531
2601
  if (cmdBase === '/group') {
2532
2602
  return await executeGroupMenu(this, {
2533
2603
  kind: 'query', args, identity, subject, session,
@@ -2567,6 +2637,10 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2567
2637
  const meta = store.getMeta(args.taskId);
2568
2638
  if (!meta)
2569
2639
  return { error: 'Task not found', code: 'NOT_FOUND' };
2640
+ if (args.view === 'change_summary' && typeof args.threadId === 'string'
2641
+ && meta.threadId && args.threadId !== meta.threadId) {
2642
+ return { error: 'Task is not available in this session', code: 'FORBIDDEN' };
2643
+ }
2570
2644
  const groupId = session.metadata?.groupId || session.channelId;
2571
2645
  const sameSession = !(meta.selfAid !== subject.selfAid || meta.sessionId !== session.id
2572
2646
  || meta.channel !== (subject.channelType || channel.split('#')[0])
@@ -2581,9 +2655,11 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2581
2655
  }
2582
2656
  return { data: args.view === 'activities'
2583
2657
  ? store.readList(args.taskId, args.offset ?? 0, args.limit ?? 50)
2584
- : args.view === 'resource'
2585
- ? store.readResource(args.taskId, args.activityId, args.resourceId, args.offset ?? 0)
2586
- : store.readDetail(args.taskId, args.activityId) };
2658
+ : args.view === 'change_summary'
2659
+ ? store.readChangeSummary(args.taskId)
2660
+ : args.view === 'resource'
2661
+ ? store.readResource(args.taskId, args.activityId, args.resourceId, args.offset ?? 0)
2662
+ : store.readDetail(args.taskId, args.activityId) };
2587
2663
  }
2588
2664
  catch (error) {
2589
2665
  if (error?.code === 'INVALID_CONTEXT') {
@@ -2614,6 +2690,14 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2614
2690
  return menuResultFailure(error);
2615
2691
  }
2616
2692
  }
2693
+ if (cmdBase === '/context-policy') {
2694
+ try {
2695
+ return { data: await executeContextPolicyMenu('query', subject.selfAid, subject.role, args) };
2696
+ }
2697
+ catch (error) {
2698
+ return menuResultFailure(error);
2699
+ }
2700
+ }
2617
2701
  if (cmdBase === '/aid' && args?.view === 'agentmd') {
2618
2702
  try {
2619
2703
  return { data: await agentMdMenuService.query(subject, args) };
@@ -2674,12 +2758,29 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2674
2758
  protocolVersion: 1, enabled: peekServiceRouter(root.targetAid)?.enabled
2675
2759
  ?? loadRouterConfig(agentServicesDir(root.targetAid)).config.enabled,
2676
2760
  notifications: this.eventCenter?.get(root.targetAid)?.runtime.nativeOutputAvailable === true,
2761
+ }, panelCards: {
2762
+ protocolVersion: 1, enabled: peekServiceRouter(root.targetAid)?.enabled
2763
+ ?? loadRouterConfig(agentServicesDir(root.targetAid)).config.enabled,
2764
+ notifications: this.eventCenter?.get(root.targetAid)?.runtime.nativeOutputAvailable === true,
2677
2765
  } } };
2678
2766
  }
2679
2767
  catch (error) {
2680
2768
  return dataRootFailure(error);
2681
2769
  }
2682
2770
  }
2771
+ if (cmdBase === '/panel-cards-data-root') {
2772
+ if (!args || typeof args.scopeId !== 'string' || !/^[A-Za-z0-9_-]{24}$/.test(args.scopeId) ||
2773
+ Object.keys(args).some(key => key !== 'scopeId')) {
2774
+ return { error: 'panel-cards-data-root requires args.scopeId', code: 'INVALID_ARGUMENT' };
2775
+ }
2776
+ try {
2777
+ const root = dataRootResolver.issuePanelOutputRoot(subject, args.scopeId);
2778
+ return { data: { ...root, scopeId: args.scopeId } };
2779
+ }
2780
+ catch (error) {
2781
+ return dataRootFailure(error);
2782
+ }
2783
+ }
2683
2784
  if (cmdBase === '/relation-data-root') {
2684
2785
  if (args && Object.keys(args).some(key => key !== 'peerAid')) {
2685
2786
  return { error: 'relation-data-root only accepts args.peerAid', code: 'INVALID_ARGUMENT' };
@@ -2781,6 +2882,10 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2781
2882
  if ('error' in target)
2782
2883
  return target;
2783
2884
  const data = queryCapabilityTypes(target.ctx, target.config, type);
2885
+ const inventory = await getBaseagentSnapshot({ config: { ...target.config, aid: target.ctx.aid }, probe: false,
2886
+ runners: { [target.ctx.baseagent]: this.agentMap.get(`${target.ctx.aid}::${target.ctx.baseagent}`) } });
2887
+ data.baseagentCapabilities = inventory.baseagents.find(item => item.id === target.ctx.baseagent)?.capabilities ?? [];
2888
+ data.environment = process.platform;
2784
2889
  return { data: sanitizeCapabilityQueryForRole(data, identity.role) };
2785
2890
  }
2786
2891
  if (cmdBase === '/pwd') {
@@ -2858,6 +2963,8 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
2858
2963
  config: evolagent.config ?? {},
2859
2964
  loaded: this.getAvailableBaseagents(channel),
2860
2965
  probe: false,
2966
+ runners: Object.fromEntries([...this.agentMap].filter(([key]) => key.startsWith(`${evolagent.aid}::`))
2967
+ .map(([key, runner]) => [key.slice(evolagent.aid.length + 2), runner])),
2861
2968
  }) };
2862
2969
  }
2863
2970
  if (cmdBase === '/topic') {
@@ -3309,6 +3416,7 @@ export async function execMenuQuery(cmd, channel, channelId, userId, args, expli
3309
3416
  sha256,
3310
3417
  size: stat.size,
3311
3418
  mtime: stat.mtimeMs,
3419
+ ...(dataRoot?.scope === 'panel-output' ? { resourceVersion: panelResourceVersion(stat) } : {}),
3312
3420
  },
3313
3421
  };
3314
3422
  }
@@ -3324,9 +3432,16 @@ export async function execMenuUpdate(cmd, value, channel, channelId, userId, ove
3324
3432
  if (invalid)
3325
3433
  return { error: invalid.message, code: invalid.code };
3326
3434
  }
3435
+ if (cmdBase === '/context-policy') {
3436
+ const invalid = validateContextPolicyMenuRequest({ type: 'menu.update', args, value });
3437
+ if (invalid)
3438
+ return { error: invalid.message, code: invalid.code };
3439
+ }
3327
3440
  if (cmdBase === '/provider') {
3328
3441
  return executeProviderMenu({ name: 'provider', cmd, type: 'menu.update', args, value }, fromControlChannel ? authSubject : undefined, source);
3329
3442
  }
3443
+ if (cmdBase === '/plugins')
3444
+ return executePluginMenu({ type: 'menu.update', args, value }, fromControlChannel ? authSubject : undefined, source);
3330
3445
  const isEventCenterUpdate = cmdBase === '/events';
3331
3446
  const isLoopUpdate = cmdBase === '/session' && args?.resource === 'loop';
3332
3447
  const isFullAccessUpdate = cmdBase === '/session' && args?.resource === 'fullaccess';
@@ -3341,7 +3456,8 @@ export async function execMenuUpdate(cmd, value, channel, channelId, userId, ove
3341
3456
  return { error: `idleSeconds 必须是 ${MIN_SESSION_LOOP_SECONDS}-${MAX_SESSION_LOOP_SECONDS} 的整数`, code: 'INVALID_ARGUMENT' };
3342
3457
  }
3343
3458
  }
3344
- else if (!isFullAccessUpdate && !isEventCenterUpdate && typeof value !== 'string') {
3459
+ else if (!isFullAccessUpdate && !isEventCenterUpdate && cmdBase !== '/context-policy'
3460
+ && cmdBase !== '/provider' && typeof value !== 'string') {
3345
3461
  return { error: 'value 必须是字符串', code: 'INVALID_ARGUMENT' };
3346
3462
  }
3347
3463
  if (isFullAccessUpdate && (typeof value !== 'boolean'
@@ -3364,7 +3480,7 @@ export async function execMenuUpdate(cmd, value, channel, channelId, userId, ove
3364
3480
  let session = loadedContext.session;
3365
3481
  const evolagent = loadedContext.evolagent;
3366
3482
  if (transportReplyContext?.threadId) {
3367
- const modelAgentScope = (cmdBase === '/model' || cmdBase === '/effort' || cmdBase === '/private-mention-mode')
3483
+ const modelAgentScope = (cmdBase === '/model' || cmdBase === '/effort' || cmdBase === '/private-mention-mode' || cmdBase === '/context-policy')
3368
3484
  && (menuStringArg(args, 'scope') ?? 'agent') === 'agent';
3369
3485
  if (modelAgentScope) {
3370
3486
  // Model settings belong to the Agent and can be changed from a locally
@@ -3503,6 +3619,20 @@ export async function execMenuUpdate(cmd, value, channel, channelId, userId, ove
3503
3619
  return menuResultFailure(error);
3504
3620
  }
3505
3621
  }
3622
+ if (cmdBase === '/context-policy') {
3623
+ const denied = await authorizeMenuIntent.call(this, {
3624
+ intent: buildMenuIntent('update', cmdBase, args, undefined, value, fromControlChannel),
3625
+ identity, subject, session, channel, channelId, userId, fromControlChannel, source,
3626
+ });
3627
+ if (denied)
3628
+ return denied;
3629
+ try {
3630
+ return { data: await executeContextPolicyMenu('update', subject.selfAid, subject.role, args, value) };
3631
+ }
3632
+ catch (error) {
3633
+ return menuResultFailure(error);
3634
+ }
3635
+ }
3506
3636
  const arg = value.trim();
3507
3637
  if (!arg)
3508
3638
  return { error: '缺少 value 参数', code: 'MISSING_VALUE' };
@@ -3520,6 +3650,40 @@ export async function execMenuUpdate(cmd, value, channel, channelId, userId, ove
3520
3650
  return menuResultFailure(error);
3521
3651
  }
3522
3652
  }
3653
+ if (cmdBase === '/connect') {
3654
+ const connectUpdateDenied = await authorizeMenuIntent.call(this, {
3655
+ intent: buildMenuIntent('update', cmdBase, args, undefined, arg, fromControlChannel),
3656
+ identity,
3657
+ subject,
3658
+ session,
3659
+ channel,
3660
+ channelId,
3661
+ userId,
3662
+ fromControlChannel,
3663
+ source,
3664
+ });
3665
+ if (connectUpdateDenied)
3666
+ return connectUpdateDenied;
3667
+ const resource = typeof args?.resource === 'string' ? args.resource : '';
3668
+ const accessRevision = typeof args?.expectedAccessRevision === 'string'
3669
+ ? args.expectedAccessRevision
3670
+ : typeof args?.accessRevision === 'string' ? args.accessRevision : '';
3671
+ if (!resource || !accessRevision)
3672
+ return { error: 'connect access update requires resource and expectedAccessRevision', code: 'INVALID_ARGUMENT' };
3673
+ let parsed;
3674
+ try {
3675
+ parsed = typeof arg === 'string' ? JSON.parse(arg) : arg;
3676
+ }
3677
+ catch {
3678
+ return { error: 'connect access value must be valid JSON', code: 'INVALID_ARGUMENT' };
3679
+ }
3680
+ const aid = args?.aid ?? subject.selfAid;
3681
+ if (typeof aid !== 'string' || !aid)
3682
+ return { error: '缺少目标 Agent AID', code: 'MISSING_AID' };
3683
+ return execAgentAction('set-access', {
3684
+ aid, resource, value: parsed, accessRevision,
3685
+ }, subject.actorId ?? userId ?? '', this.eventBus, this.agentApplicationService, agentFullAccessMenuSubject(subject, source));
3686
+ }
3523
3687
  if (cmdBase === '/group') {
3524
3688
  return await executeGroupMenu(this, {
3525
3689
  kind: 'update', args, value: arg, identity, subject, session,
@@ -4011,6 +4175,35 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
4011
4175
  return menuResultFailure(error);
4012
4176
  }
4013
4177
  }
4178
+ if (cmdBase === '/connect') {
4179
+ if (action !== 'set-access')
4180
+ return { error: 'Connect compatibility only supports set-access', code: 'NOT_SUPPORTED' };
4181
+ const connectActionDenied = await authorizeMenuIntent.call(this, {
4182
+ intent: buildMenuIntent('action', cmdBase, args, action, undefined, fromControlChannel),
4183
+ identity: authIdentity,
4184
+ subject,
4185
+ session: authSession,
4186
+ explicitChatType,
4187
+ channel,
4188
+ channelId,
4189
+ userId,
4190
+ fromControlChannel,
4191
+ source,
4192
+ });
4193
+ if (connectActionDenied)
4194
+ return connectActionDenied;
4195
+ const resource = typeof args?.resource === 'string' ? args.resource : '';
4196
+ const accessRevision = typeof args?.expectedAccessRevision === 'string'
4197
+ ? args.expectedAccessRevision
4198
+ : typeof args?.accessRevision === 'string' ? args.accessRevision : '';
4199
+ if (!resource || !accessRevision || !Object.hasOwn(args ?? {}, 'value')) {
4200
+ return { error: 'connect set-access requires resource, value and accessRevision', code: 'INVALID_ARGUMENT' };
4201
+ }
4202
+ return execAgentAction('set-access', {
4203
+ aid: args?.aid ?? subject.selfAid,
4204
+ resource, value: args.value, accessRevision,
4205
+ }, subject.actorId ?? userId ?? '', this.eventBus, this.agentApplicationService, agentFullAccessMenuSubject(subject, source));
4206
+ }
4014
4207
  if ((cmdBase === '/agent' || cmdBase === '/aid') && !args?.aid) {
4015
4208
  const selfAid = this.getOwningAgent?.(channel)?.aid;
4016
4209
  if (selfAid)
@@ -4057,9 +4250,9 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
4057
4250
  // ── /aid AgentMD and avatar ──
4058
4251
  // Canonical avatar action; legacy agent/update patch.avatar reuses the same uploader.
4059
4252
  if (cmdBase === '/aid') {
4060
- if (action === 'agentmd.publish') {
4253
+ if (isAgentMdWriteAction(action)) {
4061
4254
  try {
4062
- const data = await agentMdMenuService.publish(subject, args ?? {});
4255
+ const data = await agentMdMenuService.publish(subject, args ?? {}, action);
4063
4256
  this.eventBus?.publish({
4064
4257
  type: 'agent:updated', aid: data.aid, nameChanged: data.nameChanged, timestamp: Date.now(),
4065
4258
  });
@@ -4315,6 +4508,7 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
4315
4508
  executionTimeoutMs: args.executionTimeoutMs,
4316
4509
  effort: args.effort,
4317
4510
  permissionMode: args.permissionMode,
4511
+ enabled: args.enabled,
4318
4512
  triggerThread,
4319
4513
  };
4320
4514
  const r = await this.registerTriggerFromParsed(parsed, channel, channelId, userId ?? '', undefined, this.resolveMenuChatType(channel, channelId, explicitChatType), undefined, isAdmin, subject.isDaemonOwner, subject.canApprovePersistentFullAccess);
@@ -4326,7 +4520,13 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
4326
4520
  : 'INVALID_ARGS';
4327
4521
  return { error: r.error, code };
4328
4522
  }
4329
- return { data: { id: r.trigger.id, name: r.trigger.name, nextFireAt: r.trigger.nextFireAt } };
4523
+ return { data: {
4524
+ id: r.trigger.id,
4525
+ name: r.trigger.name,
4526
+ enabled: r.trigger.enabled,
4527
+ nextFireAt: r.trigger.nextFireAt,
4528
+ ...(r.trigger.enabled ? {} : { enableHint: `/trigger enable ${r.trigger.id}` }),
4529
+ } };
4330
4530
  }
4331
4531
  if (action === 'cancel') {
4332
4532
  const nameOrId = args?.nameOrId;
@@ -4535,7 +4735,7 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
4535
4735
  }
4536
4736
  const actualSourceMessageId = sourceAssistantMessageId;
4537
4737
  const historySnapshot = buildForkHistorySnapshot(messages, actualSourceMessageId);
4538
- const forkedAgentSessionId = await currentAgent.forkSessionAt(current.agentSessionId, current.projectPath, actualSourceMessageId, name || undefined, { sessionId: current.id, permissionMode: subject.permissionMode, role: subject.role });
4738
+ const forkedAgentSessionId = await currentAgent.forkSessionAt(current.agentSessionId, current.projectPath, actualSourceMessageId, name || undefined, { sessionId: current.id, permissionMode: subject.permissionMode, role: subject.role, authorization: subject });
4539
4739
  const topic = await this.sessionManager.createForkedThreadSession(current, forkedAgentSessionId, targetThreadId, {
4540
4740
  name: name || undefined,
4541
4741
  creatorPeerId: userId,
@@ -4544,6 +4744,9 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
4544
4744
  historySnapshot,
4545
4745
  requestId,
4546
4746
  });
4747
+ await currentAgent.commitSessionFork?.(forkedAgentSessionId, topic, {
4748
+ sessionId: current.id, authorization: subject,
4749
+ }).catch(async (error) => { await this.sessionManager.unbindSession(topic.id); throw error; });
4547
4750
  await currentAgent.updateSessionMetadata?.(forkedAgentSessionId, {
4548
4751
  evolcoreSessionId: topic.id,
4549
4752
  sourceSessionId: current.id,
@@ -4775,6 +4978,55 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
4775
4978
  }
4776
4979
  // ── /session 系列 ──
4777
4980
  if (cmdBase === '/session' || cmdBase === '/s') {
4981
+ if (action === 'open-terminal') {
4982
+ if (fromControlChannel || channel.split('#', 1)[0] !== 'aun' || subject.chatType !== 'private') {
4983
+ return { error: '打开 Base Agent 终端仅支持 Agent AID 的 AUN 私聊请求', code: 'NOT_SUPPORTED' };
4984
+ }
4985
+ const sessionId = typeof args?.sessionId === 'string' ? args.sessionId.trim() : '';
4986
+ if (!sessionId)
4987
+ return { error: '缺少 args.sessionId', code: 'MISSING_VALUE' };
4988
+ const baseagent = evolagent?.baseagent;
4989
+ if (baseagent !== 'claude' && baseagent !== 'codex') {
4990
+ return { error: `当前 Agent 的 Base Agent 不支持终端恢复: ${baseagent || 'unknown'}`, code: 'NOT_SUPPORTED' };
4991
+ }
4992
+ const selfAid = evolagent?.aid ?? this.getOwningAgent?.(channel)?.aid;
4993
+ if (!selfAid)
4994
+ return { error: '当前 channel 无绑定 Agent', code: 'MISSING_AID' };
4995
+ const targetSession = this.sessionManager.findBoundSessionByAgentSessionId?.(sessionId, baseagent, selfAid);
4996
+ if (!targetSession)
4997
+ return { error: '找不到绑定到当前 Agent 的 Base Agent 会话', code: 'NOT_FOUND' };
4998
+ let currentProjectPath;
4999
+ try {
5000
+ currentProjectPath = resolveSessionTerminalProjectPath(session?.projectPath, targetSession.projectPath);
5001
+ }
5002
+ catch (error) {
5003
+ return { error: error instanceof Error ? error.message : String(error), code: 'PROJECT_MISMATCH' };
5004
+ }
5005
+ if (!this.sessionManager.checkSessionFileExists(currentProjectPath, sessionId, baseagent, selfAid)) {
5006
+ return { error: 'Base Agent 会话历史文件不存在', code: 'NOT_FOUND' };
5007
+ }
5008
+ try {
5009
+ const codexConfig = baseagent === 'codex'
5010
+ ? resolveEffective({ self: selfAid }, { cache: false }).baseagents?.codex
5011
+ : undefined;
5012
+ const connection = codexConfig?.provider
5013
+ ? resolveOpenaiConfig({ agents: { codex: codexConfig } })
5014
+ : undefined;
5015
+ const codexProvider = connection?.providerId ? {
5016
+ providerId: connection.providerId,
5017
+ apiKey: connection.apiKey,
5018
+ baseUrl: connection.baseUrl,
5019
+ headers: buildModelRequestHeaders({ baseagent: 'codex', baseUrl: connection.baseUrl,
5020
+ agentAid: selfAid, configuredHeaders: connection.headers }),
5021
+ queryParams: connection.queryParams,
5022
+ } : undefined;
5023
+ await openSessionInTerminal({ baseagent, sessionId, cwd: currentProjectPath, codexProvider });
5024
+ return { data: { action: 'open-terminal', success: true, baseagent, sessionId } };
5025
+ }
5026
+ catch (error) {
5027
+ return { error: error instanceof Error ? error.message : String(error), code: 'TERMINAL_OPEN_FAILED' };
5028
+ }
5029
+ }
4778
5030
  if (action === 'stop') {
4779
5031
  if (!session)
4780
5032
  return { error: '当前无活跃会话', code: 'NO_ACTIVE_SESSION' };
@@ -5410,6 +5662,18 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
5410
5662
  return denied;
5411
5663
  }
5412
5664
  }
5665
+ if (args?.resourceVersion !== undefined || args?.maxBytes !== undefined) {
5666
+ if (dataRoot?.scope !== 'panel-output' || typeof args?.resourceVersion !== 'string'
5667
+ || !/^[a-f0-9]{24}$/.test(args.resourceVersion)
5668
+ || !Number.isSafeInteger(args.maxBytes) || args.maxBytes < 1 || args.maxBytes > FILE_FETCH_MAX_SIZE) {
5669
+ return { error: 'Invalid panel resource fetch parameters', code: 'INVALID_ARGUMENT' };
5670
+ }
5671
+ if (panelResourceVersion(stat) !== args.resourceVersion) {
5672
+ return { error: 'Panel resource changed', code: 'RESOURCE_EXPIRED' };
5673
+ }
5674
+ if (stat.size > args.maxBytes)
5675
+ return { error: 'Panel resource exceeds its size limit', code: 'FILE_TOO_LARGE' };
5676
+ }
5413
5677
  if (stat.size > FILE_FETCH_MAX_SIZE) {
5414
5678
  return { error: `文件过大: ${(stat.size / 1024 / 1024).toFixed(1)} MB (限制 ${FILE_FETCH_MAX_SIZE / 1024 / 1024} MB)`, code: 'FILE_TOO_LARGE' };
5415
5679
  }
@@ -5419,7 +5683,7 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
5419
5683
  if (!adapter.capabilities?.file)
5420
5684
  return { error: '通道不支持文件发送', code: 'NOT_SUPPORTED' };
5421
5685
  const sessionReplyContext = session ? replyContextFromSession(session, this.getReplyContext(session)) : undefined;
5422
- const replyCtx = transportReplyContext
5686
+ let replyCtx = transportReplyContext
5423
5687
  ? {
5424
5688
  ...(sessionReplyContext ?? {}),
5425
5689
  ...transportReplyContext,
@@ -5429,7 +5693,16 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
5429
5693
  },
5430
5694
  }
5431
5695
  : sessionReplyContext;
5696
+ if (dataRoot?.scope === 'panel-output') {
5697
+ replyCtx = { ...replyCtx, metadata: { ...replyCtx?.metadata, encrypted: true } };
5698
+ }
5432
5699
  const sendFile = async () => {
5700
+ if (dataRoot?.scope === 'panel-output') {
5701
+ const current = dataRootResolver.resolvePath(args?.rootId, subject, args?.path, 'file');
5702
+ if (current.realPath !== realPath || panelResourceVersion(current.stat) !== panelResourceVersion(stat)) {
5703
+ throw new DataRootError('RESOURCE_EXPIRED', 'Panel resource changed');
5704
+ }
5705
+ }
5433
5706
  const receipt = await adapter.send(buildEnvelope({ channel: adapter.channelName, channelId, replyContext: replyCtx }), { kind: 'result.file', filePath: realPath, correlationId: requestId });
5434
5707
  if (receipt && typeof receipt === 'object' && receipt.status === 'failed') {
5435
5708
  throw Object.assign(new Error(receipt.error || '文件发送失败'), {
@@ -5501,6 +5774,8 @@ function menuCommandToken(cmd) {
5501
5774
  }
5502
5775
  function isProcessLevelMenu(name, cmd) {
5503
5776
  const cmdToken = menuCommandToken(cmd);
5777
+ if (name === 'plugins' || cmdToken === '/plugins')
5778
+ return true;
5504
5779
  return name === 'provider' || cmdToken === '/provider' || name === 'system' || name === 'agent' || name === 'gateway' || name === 'config' || name === 'baseagent-models' || name === 'baseagents'
5505
5780
  || cmdToken === '/system' || cmdToken === '/agent' || cmdToken === '/gateway' || cmdToken === '/config' || cmdToken === '/baseagent-models' || cmdToken === '/baseagents';
5506
5781
  }
@@ -5530,8 +5805,10 @@ async function execMenuForSystemControl(payload, context) {
5530
5805
  const isDataRootQuery = payload?.type === 'menu.query'
5531
5806
  && (name === 'agent-data-root'
5532
5807
  || name === 'relation-data-root'
5808
+ || name === 'panel-cards-data-root'
5533
5809
  || compatCmd === '/agent-data-root'
5534
- || compatCmd === '/relation-data-root');
5810
+ || compatCmd === '/relation-data-root'
5811
+ || compatCmd === '/panel-cards-data-root');
5535
5812
  const isRootedFile = (name === 'file' || compatCmd === '/file')
5536
5813
  && typeof payload?.args?.rootId === 'string';
5537
5814
  if (isFileFetch || isDataRootQuery || isRootedFile || isAgentStorageMenuRequest(payload ?? {})) {
@@ -5552,9 +5829,9 @@ async function execMenuForSystemControl(payload, context) {
5552
5829
  const isConnectRequest = name === 'connect' || compatCmd === '/connect';
5553
5830
  const requiresAgentTarget = (name === 'menu' && payload?.type === 'menu.query' && payload?.args?.view === 'queries')
5554
5831
  || isRoleRequest || isConnectRequest || [
5555
- 'observable', 'baseagent', 'model', 'effort', 'trigger', 'capability', 'group', 'aid', 'team-workspace', 'slash-commands', 'events', 'private-mention-mode',
5832
+ 'observable', 'baseagent', 'model', 'effort', 'trigger', 'capability', 'group', 'aid', 'team-workspace', 'slash-commands', 'events', 'private-mention-mode', 'context-policy',
5556
5833
  ].includes(name)
5557
- || ['/observable', '/baseagent', '/model', '/effort', '/trigger', '/capability', '/group', '/aid', '/team-workspace', '/evolhelp', '/events', '/private-mention-mode'].includes(compatCmd ?? '')
5834
+ || ['/observable', '/baseagent', '/model', '/effort', '/trigger', '/capability', '/group', '/aid', '/team-workspace', '/evolhelp', '/events', '/private-mention-mode', '/context-policy'].includes(compatCmd ?? '')
5558
5835
  || (!isProcessLevel && requestedContextKind !== undefined && requestedContextKind !== 'process');
5559
5836
  const target = isProcessLevel
5560
5837
  ? { channel: SYSTEM_CONTROL_CHANNEL }
@@ -5739,9 +6016,12 @@ async function execMenuForSystemControl(payload, context) {
5739
6016
  channelId: targetChannel,
5740
6017
  args: payload.args,
5741
6018
  });
6019
+ const actionArgs = payload.action === 'create' && (name === 'provider' || menuCommandToken(payload.cmd) === '/provider') && payload.value !== undefined
6020
+ ? { ...(execution.args ?? {}), provider: payload.value }
6021
+ : execution.args;
5742
6022
  const r = hasExplicitContext
5743
- ? await this.execMenuAction(cmd, payload.action, execution.args, targetChannel, execution.channelId, execution.subject.actorId, execution.subject.identity, execution.subject.chatType, id, true, execution.subject, context.source)
5744
- : await this.execMenuAction(cmd, payload.action, payload.args, targetChannel, targetChannel, context.actorAid, trustedIdentity, undefined, id, true, trustedSubject, context.source);
6023
+ ? await this.execMenuAction(cmd, payload.action, actionArgs, targetChannel, execution.channelId, execution.subject.actorId, execution.subject.identity, execution.subject.chatType, id, true, execution.subject, context.source)
6024
+ : await this.execMenuAction(cmd, payload.action, actionArgs, targetChannel, targetChannel, context.actorAid, trustedIdentity, undefined, id, true, trustedSubject, context.source);
5745
6025
  return ecwebResp(id, name, r);
5746
6026
  }
5747
6027
  default: