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,6 +1,6 @@
1
1
  import { parsePermissionApprovalDecision } from '../permission/approval-gateway.js';
2
- import { hasModelSwitcher, hasPermissionController } from '../../agents/runner-types.js';
3
- import { normalizeBaseagent, resolveBaseagentModelSelection } from '../../agents/baseagent.js';
2
+ import { hasModelSwitcher, hasPermissionController } from '../baseagent/runner-types.js';
3
+ import { normalizeBaseagent, resolveBaseagentModelSelection } from '../baseagent/baseagent.js';
4
4
  import { buildEnvelope, isDeliveryTargetForChannel } from '../message/message-utils.js';
5
5
  import { resolvePaths, getPackageRoot, daemonControlDir } from '../../paths.js';
6
6
  import { logger } from '../../utils/logger.js';
@@ -36,24 +36,26 @@ import { displaySessionTitle } from '../session/session-title.js';
36
36
  import { chatmodeFieldForPeer, isChatMode, isPrivateChatmodeRoleLocked, resolveChatModeForField } from '../message/peer-mode.js';
37
37
  import { normalizePermissionMode as normalizePermissionModeContract, PUBLIC_PERMISSION_MODES } from '../permission/mode.js';
38
38
  import { isManagementRole } from '../../config/builtin-roles.js';
39
- import { isSystemControlChannel } from '../system-channels.js';
39
+ import { assertDeclaredBaseagentCapability } from '../baseagent/baseagent-capability-adapter.js';
40
+ import { isSystemControlChannel } from '../channel/system-channels.js';
40
41
  import { resolveCliEntry, launchMonitorAndConfirm, isProcessRunning } from '../../utils/cross-platform.js';
41
42
  import { hasLiveRestartMonitor } from '../../utils/instance-registry.js';
42
43
  import { guardIdleCommand, guardGroupSlashCommand, guardKnownCommand, guardRoleCommand, guardThreadCommand, isRecognizedSlashCommand, normalizeSlashContent, parseFullAccessCommand, probeSessionActivity, } from './slash-gate.js';
43
44
  import { MAX_AUN_ATTACHMENT_SIZE } from '../../aun/msg/upload.js';
45
+ import { formatCompactingNotice, readLastModelCallContextUsage } from '../../stats/context-usage.js';
44
46
  import { DEFAULT_SESSION_LOOP_SECONDS, MAX_SESSION_LOOP_PROMPT_LENGTH, MAX_SESSION_LOOP_SECONDS, MIN_SESSION_LOOP_SECONDS, refreshSessionLoopTarget, resolveCurrentSessionLoopTarget, resolveSessionLoopTarget, sessionLoopPayload, validateIdleSeconds, writeSessionLoopConfig, } from '../session/session-idle-monitor.js';
45
47
  const allEfforts = CONFIGURABLE_EFFORTS;
46
48
  const PERMISSION_MODE_KEYS = PUBLIC_PERMISSION_MODES;
47
- function formatSessionPolicyStatus(name, scope, enabled, updated = false) {
48
- return `${updated ? '✅ ' : ''}${name} 当前生效:${enabled ? '开启' : '关闭'}(${scope})`;
49
+ function formatSessionPolicyStatus(name, scope, enabled) {
50
+ return `${name} 当前生效:${enabled ? '开启' : '关闭'}(${scope})`;
49
51
  }
50
52
  function formatUpgradeEvent(event) {
51
53
  if (event.event === 'upgrade.progress')
52
- return `⏳ ${event.message}`;
54
+ return event.message;
53
55
  if (event.status === 'no-update')
54
- return '✓ 当前 EvolCore 已是最新版本';
56
+ return '当前 EvolCore 已是最新版本';
55
57
  if (event.status === 'restart-started')
56
- return '✅ 升级包已准备完成,服务正在重启';
58
+ return '升级包已准备完成,服务正在重启';
57
59
  if (event.status === 'timeout')
58
60
  return `❌ 升级超时:${event.reason ?? event.message}`;
59
61
  if (event.status === 'failed')
@@ -387,7 +389,7 @@ async function getGitWorkingDirInfo(projectPath) {
387
389
  return null; // git 命令失败时静默返回 null
388
390
  }
389
391
  }
390
- export async function handleSlashCommand(content, channel, channelId, sendMessage, userId, threadId, chatType, source, messageId, selfAID, overrideIdentity, overrideSubject, replyContext, applyGroupSlashPolicy = false) {
392
+ export async function handleSlashCommand(content, channel, channelId, sendMessage, userId, threadId, chatType, source, messageId, selfAID, overrideIdentity, overrideSubject, replyContext, applyGroupSlashPolicy = false, submitLoopPrompt) {
391
393
  // 卡片回调的 chatType 不可靠(飞书 bot 单聊 chatId 也是 oc_ 前缀),
392
394
  // 不应覆盖 session 中已有的正确值
393
395
  if (source === 'card-trigger')
@@ -637,9 +639,52 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
637
639
  return { kind: 'command.error', text: `❌ 秒数必须是 ${MIN_SESSION_LOOP_SECONDS}-${MAX_SESSION_LOOP_SECONDS} 的整数` };
638
640
  next = { enabled: true, idleSeconds: seconds };
639
641
  }
642
+ const writeLoop = (current) => {
643
+ if (next.enabled)
644
+ this.assertSessionLoopTrigger(current.session);
645
+ const updated = writeSessionLoopConfig(this.sessionManager, current, next);
646
+ if (!next.enabled)
647
+ this.sessionManager.consumeSessionLoopOnce(updated.session.id);
648
+ const payload = sessionLoopPayload(updated);
649
+ return {
650
+ kind: 'system.notice',
651
+ text: formatSessionPolicyStatus('idle 触发', updated.level, payload.value === true)
652
+ + (payload.value ? `(${payload.idleSeconds} 秒)` : ';已取消待执行的单次触发'),
653
+ subtype: 'session.loop.updated',
654
+ };
655
+ };
640
656
  try {
641
657
  const latest = await refreshSessionLoopTarget(this.sessionManager, route, target);
642
658
  if (oncePrompt) {
659
+ const sessionId = latest.session.id;
660
+ const idle = submitLoopPrompt && probeSessionActivity(this.messageQueue.getSessionSnapshot(sessionId), {
661
+ paused: () => this.processor?.isPauseRequested?.(sessionId) ?? false,
662
+ activeStream: () => {
663
+ const runner = this.getLoadedAgent(channel, latest.session.baseagent);
664
+ return runner?.hasActiveStream(sessionId) || runner?.hasActiveOperation?.(sessionId) === true
665
+ || runner?.getExecutionState?.(sessionId) === 'interrupting';
666
+ },
667
+ pendingInteraction: () => (this.interactionRouter?.getPending(sessionId).length ?? 0) > 0,
668
+ }) === 'idle';
669
+ if (submitLoopPrompt && idle) {
670
+ submitLoopPrompt({
671
+ prompt: oncePrompt,
672
+ sessionId,
673
+ enableLoop: async () => {
674
+ try {
675
+ const current = await refreshSessionLoopTarget(this.sessionManager, route, latest);
676
+ return writeLoop(current);
677
+ }
678
+ catch (error) {
679
+ return {
680
+ kind: 'command.error',
681
+ text: `指令已提交,开启 loop 失败:${error instanceof Error ? error.message : String(error)}`,
682
+ };
683
+ }
684
+ },
685
+ });
686
+ return null;
687
+ }
643
688
  this.assertSessionLoopTrigger(latest.session, true);
644
689
  this.sessionManager.updateSessionLoopOnce(latest.session.id, {
645
690
  idleSeconds: DEFAULT_SESSION_LOOP_SECONDS,
@@ -650,24 +695,14 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
650
695
  return null;
651
696
  return {
652
697
  kind: 'system.notice',
653
- text: `✅ 单次 idle 触发(${latest.level})已安排;闲置时长:${DEFAULT_SESSION_LOOP_SECONDS} 秒;提示词:${oncePrompt.replace(/\s+/g, ' ').slice(0, 120)}`,
698
+ text: `单次 idle 触发(${latest.level})已安排;闲置时长:${DEFAULT_SESSION_LOOP_SECONDS} 秒;提示词:${oncePrompt.replace(/\s+/g, ' ').slice(0, 120)}`,
654
699
  subtype: 'session.loop.once.updated',
655
700
  };
656
701
  }
657
- if (next.enabled)
658
- this.assertSessionLoopTrigger(latest.session);
659
- const updated = writeSessionLoopConfig(this.sessionManager, latest, next);
660
- if (!next.enabled)
661
- this.sessionManager.consumeSessionLoopOnce(updated.session.id);
662
- const payload = sessionLoopPayload(updated);
702
+ const result = writeLoop(latest);
663
703
  if (this.shouldSuppressCardTriggerResult(source, channel))
664
704
  return null;
665
- return {
666
- kind: 'system.notice',
667
- text: formatSessionPolicyStatus('idle 触发', updated.level, payload.value === true, true)
668
- + (payload.value ? `(${payload.idleSeconds} 秒)` : ';已取消待执行的单次触发'),
669
- subtype: 'session.loop.updated',
670
- };
705
+ return result;
671
706
  }
672
707
  catch (error) {
673
708
  return { kind: 'command.error', text: `❌ ${error instanceof Error ? error.message : String(error)}` };
@@ -691,7 +726,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
691
726
  return { kind: 'command.error', text: '❌ /fa 需要同一身份同时具备 Agent Owner 和 daemon Owner 权限' };
692
727
  }
693
728
  const status = sessionFullAccessStatus(commandSession, principalId);
694
- const formatStatus = (current, updated = false) => formatSessionPolicyStatus('fullaccess', current.scope, current.effective, updated)
729
+ const formatStatus = (current) => formatSessionPolicyStatus('fullaccess', current.scope, current.effective)
695
730
  + ';Agent 全局:' + (current.globalEnabled ? '开启' : '关闭')
696
731
  + ';作用域设置:' + (current.localEnabled ? '开启' : '关闭')
697
732
  + (current.globalEnabled ? '(被全局覆盖)' : '');
@@ -742,7 +777,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
742
777
  });
743
778
  return {
744
779
  kind: 'system.notice',
745
- text: formatStatus(sessionFullAccessStatus(updatedSession, principalId), true),
780
+ text: formatStatus(sessionFullAccessStatus(updatedSession, principalId)),
746
781
  subtype: 'session.fullaccess.updated',
747
782
  };
748
783
  }
@@ -873,7 +908,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
873
908
  ' /baseagent - 查看 Agent 后端',
874
909
  ' /perm - 查看权限模式',
875
910
  ' /mention - 查看群聊 @ 处理模式',
876
- ...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
911
+ ...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的闲置触发`] : []),
877
912
  ' /ask <选项> - 回答待处理问题',
878
913
  ' /pause - 在下一次工具调用前暂停任务',
879
914
  ' /resume - 继续已暂停的任务',
@@ -905,7 +940,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
905
940
  const appendProcessCommands = (lines) => {
906
941
  if (!isDaemonOwner)
907
942
  return;
908
- lines.push('', '🛠️ 进程级运维:', ' /restart - 重启服务', ' /upgrade - 检查版本更新', ' /update [status] - 执行版本升级或查询当前升级状态', ' /reload [aid] - 热重载 Agent 配置', ' /fa [on|off|<任务信息>] - 查看/切换会话 fullaccess,或单次执行任务', ' /pair - 获取远程控制配对码', ' /diag <问题描述> - 邀请或追加远程诊断;/diag stop 撤销授权');
943
+ lines.push('', '进程级运维:', ' /restart - 重启服务', ' /upgrade - 检查版本更新', ' /update [status] - 执行版本升级或查询当前升级状态', ' /reload [aid] - 热重载 Agent 配置', ' /fa [on|off|<任务信息>] - 查看/切换会话 fullaccess,或单次执行任务', ' /pair - 获取远程控制配对码', ' /diag <问题描述> - 邀请或追加远程诊断;/diag stop 撤销授权');
909
944
  };
910
945
  if (!isAdmin && activeChatType === 'group') {
911
946
  const lines = [
@@ -920,12 +955,12 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
920
955
  '',
921
956
  '💬 聊天设置:',
922
957
  ...(canReadChatmode || canSetChatmode ? [` /chatmode${canSetChatmode ? ` [${chatmodeChoices}]` : ''} - 查看${canSetChatmode ? '或切换' : ''}会话模式`] : []),
923
- ...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
958
+ ...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的闲置触发`] : []),
924
959
  ...(canReadMentionmode || canSetMentionmode ? [` /mention${canSetMentionmode ? ' [mention-only|disabled]' : ''} - 查看${canSetMentionmode ? '或切换' : ''}群聊 @ 处理模式`] : []),
925
960
  ] : []),
926
961
  ...(canReadPermission || canAnswerPermission ? [
927
962
  '',
928
- '🔐 权限管理:',
963
+ '权限管理:',
929
964
  ...(canReadPermission ? [' /perm - 查看当前权限模式'] : []),
930
965
  ...(canAnswerPermission ? [' /perm <动作> - 审批权限请求(按授权卡选项)'] : []),
931
966
  ] : []),
@@ -943,7 +978,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
943
978
  const lines = [
944
979
  '可用命令:',
945
980
  '',
946
- '🔄 会话管理:',
981
+ '会话管理:',
947
982
  ' /new [名称] - 创建新会话(清空历史请用此命令,可选命名)',
948
983
  ' /s [cli|名称|序号|uuid] - 列出或切换会话(cli 查看未导入的 CLI 会话)',
949
984
  ' /name <新名称> - 重命名当前会话',
@@ -965,10 +1000,10 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
965
1000
  '💬 聊天设置:',
966
1001
  ` /chatmode${canSetChatmode ? ` [${chatmodeChoices}]` : ''} - 查看${canSetChatmode ? '或切换' : ''}会话模式`,
967
1002
  ] : []),
968
- ...(canReadLoop ? ['', ` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
1003
+ ...(canReadLoop ? ['', ` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的闲置触发`] : []),
969
1004
  ...(canReadPermission || canAnswerPermission ? [
970
1005
  '',
971
- '🔐 权限管理:',
1006
+ '权限管理:',
972
1007
  ...(canReadPermission ? [' /perm - 查看当前权限模式'] : []),
973
1008
  ...(canAnswerPermission ? [' /perm <动作> - 审批权限请求(按授权卡选项)'] : []),
974
1009
  ] : []),
@@ -988,10 +1023,10 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
988
1023
  const lines = [
989
1024
  '可用命令:',
990
1025
  '',
991
- '📁 项目:',
1026
+ '项目:',
992
1027
  ' /pwd - 显示当前项目路径',
993
1028
  '',
994
- '🔄 会话管理:',
1029
+ '会话管理:',
995
1030
  ' /new [名称] - 创建新会话(清空历史请用此命令,可选命名)',
996
1031
  ' /s [cli|名称|序号|uuid] - 列出或切换会话(cli 查看未导入的 CLI 会话)',
997
1032
  ' /name <新名称> - 重命名当前会话',
@@ -1013,19 +1048,19 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
1013
1048
  ' /activity [all|text|none] - 查看/控制中间输出显示模式',
1014
1049
  ...(canReadChatmode || canSetChatmode ? [` /chatmode${canSetChatmode ? ` [${chatmodeChoices}]` : ''} - 查看${canSetChatmode ? '/切换' : ''}会话模式(被动响应或主动推进)`] : []),
1015
1050
  ...(canReadMentionmode || canSetMentionmode ? [` /mention${canSetMentionmode ? ' [mention-only|disabled]' : ''} - 查看${canSetMentionmode ? '/切换' : ''}群聊 @ 处理模式`] : []),
1016
- ...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
1051
+ ...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的闲置触发`] : []),
1017
1052
  '',
1018
- '🧠 上下文:',
1053
+ '上下文:',
1019
1054
  ' /memory - 记忆概览与维护',
1020
1055
  ' /skill - 技能列表与索引刷新',
1021
1056
  ' /thread - 话题列表、更名与 summary',
1022
1057
  '',
1023
- '🔐 权限管理:',
1058
+ '权限管理:',
1024
1059
  ...(canReadPermission ? [' /perm - 查看当前权限模式'] : []),
1025
1060
  ...(canReadPermission ? [' 权限模式请通过角色策略编辑器修改'] : []),
1026
1061
  ...(canAnswerPermission ? [' /perm <动作> - 审批权限请求(按授权卡选项)'] : []),
1027
1062
  '',
1028
- '🛠️ 运维:',
1063
+ '运维:',
1029
1064
  ' /status - 显示会话状态',
1030
1065
  ' /pause - 在下一次工具调用前暂停当前任务',
1031
1066
  ' /resume - 继续暂停或异常中断的当前任务',
@@ -1097,7 +1132,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
1097
1132
  const loopHelp = canReadLoop || canUpdateLoop ? [{
1098
1133
  command: '/loop',
1099
1134
  ...(canUpdateLoop ? { args: '[on [seconds]|off|<提示词>]' } : {}),
1100
- description: '查看或设置闲置触发;自定义提示词闲置 300 秒后单次执行',
1135
+ description: '查看或设置闲置触发。带提示词时,空闲会话先提交提示词再开启 loop,忙碌会话闲置 300 秒后执行一次',
1101
1136
  category: '聊天设置',
1102
1137
  roles: [identity.role],
1103
1138
  }] : [];
@@ -1236,12 +1271,12 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
1236
1271
  if (normalizedContent.startsWith('/perm')) {
1237
1272
  const args = normalizedContent.slice(5).trim();
1238
1273
  const permissionDecisionLabels = {
1239
- allow: '✓ 已授权(本次),继续执行……',
1240
- always: '✓ 已授权(当前会话临时授权 30 分钟),继续执行……',
1241
- file_60m: '✓ 已授权(同文件 60 分钟),继续执行……',
1242
- directory_60m: '✓ 已授权(当前目录及子目录 60 分钟),继续执行……',
1243
- all_directories_60m: '✓ 已授权(当前会话所有普通目录 60 分钟),继续执行……',
1244
- deny: '✓ 已拒绝',
1274
+ allow: '已授权(本次),继续执行……',
1275
+ always: '已授权(当前会话临时授权 30 分钟),继续执行……',
1276
+ file_60m: '已授权(同文件 60 分钟),继续执行……',
1277
+ directory_60m: '已授权(当前目录及子目录 60 分钟),继续执行……',
1278
+ all_directories_60m: '已授权(当前会话所有普通目录 60 分钟),继续执行……',
1279
+ deny: '已拒绝',
1245
1280
  };
1246
1281
  // Explicit request IDs are globally unique and already bound to an exact
1247
1282
  // authenticated approver in PermissionGateway. Handle this before session
@@ -1385,7 +1420,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
1385
1420
  return { kind: 'command.error', text: '❌ 当前没有待回答的问题' };
1386
1421
  const fb = await this.handleInteractionFallback('ask', args, askSession.id, userId, this.getAdapter(channel)?.channelKey);
1387
1422
  if (fb.matched)
1388
- return { kind: 'command.result', text: fb.result ?? '✓ 已回答' };
1423
+ return { kind: 'command.result', text: fb.result ?? '已回答' };
1389
1424
  return { kind: 'command.error', text: '❌ 当前没有待回答的问题' };
1390
1425
  }
1391
1426
  // /pause gates the next tool; /resume also recovers a failed backend turn.
@@ -1398,6 +1433,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
1398
1433
  return { kind: 'system.notice', text: '当前没有活跃会话', subtype: 'session.pause.idle' };
1399
1434
  }
1400
1435
  const pauseAgent = await this.ensureAgent(channel, pauseSession.baseagent);
1436
+ assertDeclaredBaseagentCapability(pauseSession.baseagent, 'X01');
1401
1437
  const hasActiveTask = pauseAgent.hasActiveStream(pauseSession.id)
1402
1438
  || this.messageQueue.isProcessing(pauseSession.id);
1403
1439
  if (!hasActiveTask) {
@@ -1407,7 +1443,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
1407
1443
  return {
1408
1444
  kind: 'system.notice',
1409
1445
  text: requested
1410
- ? '✓ 已请求暂停,任务将在下一次工具调用前暂停'
1446
+ ? '已请求暂停,任务将在下一次工具调用前暂停'
1411
1447
  : '当前任务已请求暂停或正在暂停',
1412
1448
  subtype: 'session.pause.requested',
1413
1449
  };
@@ -1497,7 +1533,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
1497
1533
  this.eventBus.publish({ type: 'agent:baseagent-changed', aid: owningAgent.aid, baseagent: args, previousBaseagent, scope: 'agent', timestamp: Date.now() });
1498
1534
  return {
1499
1535
  kind: 'command.result',
1500
- text: `✓ 新会话默认 Baseagent: ${previousBaseagent} → ${args}`
1536
+ text: `新会话默认 Baseagent: ${previousBaseagent} → ${args}`
1501
1537
  + (currentSession ? `\n当前会话继续使用 ${currentSession.baseagent}。` : ''),
1502
1538
  };
1503
1539
  }
@@ -1592,7 +1628,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
1592
1628
  });
1593
1629
  return {
1594
1630
  kind: 'command.result',
1595
- text: '✓ 已清除当前 Agent 的模型和推理强度设置',
1631
+ text: '已清除当前 Agent 的模型和推理强度设置',
1596
1632
  structured: { ok: true, scope: 'agent', self: selfAID ?? this.resolveSelfAID(channel) },
1597
1633
  };
1598
1634
  }
@@ -1873,7 +1909,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
1873
1909
  });
1874
1910
  if (this.shouldSuppressCardTriggerResult(source, channel))
1875
1911
  return null;
1876
- return { kind: 'command.result', text: `✓ 已切换\n ${changes.join('\n ')}` };
1912
+ return { kind: 'command.result', text: `已切换\n ${changes.join('\n ')}` };
1877
1913
  }
1878
1914
  // /effort 命令:查看或切换推理强度
1879
1915
  if (normalizedContent.startsWith('/effort')) {
@@ -2007,7 +2043,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2007
2043
  });
2008
2044
  if (this.shouldSuppressCardTriggerResult(source, channel))
2009
2045
  return null;
2010
- return { kind: 'command.result', text: '✓ 已清除 Agent 级推理强度,使用默认配置' };
2046
+ return { kind: 'command.result', text: '已清除 Agent 级推理强度,使用默认配置' };
2011
2047
  }
2012
2048
  // /effort <level>:切换推理强度
2013
2049
  if (!efforts.includes(args)) {
@@ -2034,7 +2070,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2034
2070
  });
2035
2071
  if (this.shouldSuppressCardTriggerResult(source, channel))
2036
2072
  return null;
2037
- return { kind: 'command.result', text: `✓ 推理强度: ${newEffort}` };
2073
+ return { kind: 'command.result', text: `推理强度: ${newEffort}` };
2038
2074
  }
2039
2075
  // /reload [aid] — 热重载 agent 配置
2040
2076
  // daemon owner:可 reload 任意 aid(无参则 reload 自身所在 agent)
@@ -2083,7 +2119,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2083
2119
  return { kind: 'command.error', text: `❌ reload 失败:${res.error}` };
2084
2120
  return {
2085
2121
  kind: 'system.notice',
2086
- text: `✅ Agent ${targetAid} 配置已重载`,
2122
+ text: `Agent ${targetAid} 配置已重载`,
2087
2123
  subtype: 'agent.reloaded',
2088
2124
  };
2089
2125
  }
@@ -2112,7 +2148,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2112
2148
  return { kind: 'command.error', text: `❌ ${result.error}` };
2113
2149
  if (this.shouldSuppressCardTriggerResult(source, channel))
2114
2150
  return null;
2115
- return { kind: 'command.result', text: `✅ 观察者模式: ${result.data.observable ? 'true' : 'false'}` };
2151
+ return { kind: 'command.result', text: `观察者模式: ${result.data.observable ? 'true' : 'false'}` };
2116
2152
  }
2117
2153
  if (normalizedContent === '/activity' || normalizedContent.startsWith('/activity ')) {
2118
2154
  const activityArg = normalizedContent.slice(9).trim();
@@ -2144,7 +2180,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2144
2180
  initiatorId: userId,
2145
2181
  kind: {
2146
2182
  kind: 'command-card',
2147
- title: '📋 中间输出模式',
2183
+ title: '中间输出模式',
2148
2184
  body: modeDescriptions.map(m => `${m.configVal === currentMode ? '✓' : '•'} **${m.key}** (${m.label})`).join('\n'),
2149
2185
  buttons: modeDescriptions.map(m => ({
2150
2186
  label: m.configVal === currentMode ? `✓ ${m.key}` : m.key,
@@ -2179,7 +2215,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2179
2215
  }
2180
2216
  const label = modeDescriptions.find(m => m.configVal === newMode)?.label || newMode;
2181
2217
  if (newMode === currentMode) {
2182
- return { kind: 'command.result', text: `📋 中间输出模式已是 ${activityArg}(${label})` };
2218
+ return { kind: 'command.result', text: `中间输出模式已是 ${activityArg}(${label})` };
2183
2219
  }
2184
2220
  // 切换操作仅 owner
2185
2221
  if (!isOwner)
@@ -2192,7 +2228,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2192
2228
  }
2193
2229
  if (this.shouldSuppressCardTriggerResult(source, channel))
2194
2230
  return null;
2195
- return { kind: 'command.result', text: `✅ 中间输出模式: ${activityArg}(${label})` };
2231
+ return { kind: 'command.result', text: `中间输出模式: ${activityArg}(${label})` };
2196
2232
  }
2197
2233
  // /chatmode 命令:私聊提供 interactive/proactive,群聊固定 proactive
2198
2234
  // - 查看:所有人可用
@@ -2216,7 +2252,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2216
2252
  initiatorId: userId,
2217
2253
  kind: {
2218
2254
  kind: 'command-card',
2219
- title: '🔄 会话模式',
2255
+ title: '会话模式',
2220
2256
  body: modes.map(m => `${m.key === currentMode ? '✓' : '•'} **${m.key}** (${m.name}) - ${m.desc}`).join('\n'),
2221
2257
  buttons: modes.map(m => ({
2222
2258
  label: m.key === currentMode ? `✓ ${m.key}` : m.key,
@@ -2267,7 +2303,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2267
2303
  return { kind: 'command.error', text: '❌ 群聊仅支持 proactive 模式' };
2268
2304
  }
2269
2305
  if (arg === currentMode) {
2270
- return { kind: 'command.result', text: `📋 当前会话模式已是 ${arg}` };
2306
+ return { kind: 'command.result', text: `当前会话模式已是 ${arg}` };
2271
2307
  }
2272
2308
  if (arg === 'interactive' && isPrivateChatmodeRoleLocked(target.field, target.role)) {
2273
2309
  return { kind: 'command.error', text: '❌ 私聊交互模式仅限 owner/admin,当前角色固定为 proactive' };
@@ -2316,7 +2352,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2316
2352
  }
2317
2353
  if (this.shouldSuppressCardTriggerResult(source, channel))
2318
2354
  return null;
2319
- return { kind: 'command.result', text: `✅ 会话模式已切换: ${arg}` };
2355
+ return { kind: 'command.result', text: `会话模式已切换: ${arg}` };
2320
2356
  }
2321
2357
  // /mention 命令:查看/切换群聊 @ 处理模式(mention-only | disabled | auto)
2322
2358
  // 写入层级按会话类型自动选择:群聊 → relation 级(当前群),私聊 → agent 级(Agent 全局默认)
@@ -2408,7 +2444,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2408
2444
  writeSlashMentionMode(mentionTarget, null);
2409
2445
  if (this.shouldSuppressCardTriggerResult(source, channel))
2410
2446
  return null;
2411
- return { kind: 'command.result', text: `✅ 已清除${scopeLabel}覆盖,将跟随上级设置` };
2447
+ return { kind: 'command.result', text: `已清除${scopeLabel}覆盖,将跟随上级设置` };
2412
2448
  }
2413
2449
  if (arg === currentMode) {
2414
2450
  return { kind: 'command.result', text: `当前已是 ${arg}` };
@@ -2416,7 +2452,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2416
2452
  writeSlashMentionMode(mentionTarget, arg);
2417
2453
  if (this.shouldSuppressCardTriggerResult(source, channel))
2418
2454
  return null;
2419
- return { kind: 'command.result', text: `✅ @ 处理模式(${scopeLabel})已切换: ${currentMode ?? '未设置'} → ${arg}` };
2455
+ return { kind: 'command.result', text: `@ 处理模式(${scopeLabel})已切换: ${currentMode ?? '未设置'} → ${arg}` };
2420
2456
  }
2421
2457
  // /stop 命令:中断当前任务
2422
2458
  if (normalizedContent.startsWith('/stop ')) {
@@ -2450,15 +2486,10 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2450
2486
  await this.processor.interruptSession(sessionKey, 'stop');
2451
2487
  return {
2452
2488
  kind: 'system.notice',
2453
- text: '✓ 已发送中断信号,任务将尽快停止',
2489
+ text: '已发送中断信号,任务将尽快停止',
2454
2490
  subtype: 'session.stopped',
2455
2491
  };
2456
2492
  }
2457
- // /clear 已移除:Claude/Codex/Gemini 对“清空当前 backend 历史”的语义不一致。
2458
- // 统一使用 /new 创建新会话来开始全新上下文。
2459
- if (normalizedContent === '/clear') {
2460
- return { kind: 'command.error', text: '⚠️ /clear 已移除\n\n请使用 /new [名称] 创建新会话来开始全新上下文。旧会话会保留,可通过 /s 查看或切换。' };
2461
- }
2462
2493
  // /renew:只支持话题会话。它废止当前 backend 绑定;下一条普通消息
2463
2494
  // 才会在新的 TurnLease 中懒创建并绑定新 backend。
2464
2495
  if (normalizedContent === '/renew' || /^\/renew\s/.test(normalizedContent)) {
@@ -2538,7 +2569,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2538
2569
  return { kind: 'system.error', text: '❌ 当前渠道无法安全记录该请求,未执行 backend 轮换', subtype: 'session.renew.claim_failed', recoverable: true };
2539
2570
  }
2540
2571
  if (outcome.kind === 'duplicate') {
2541
- return { kind: 'system.notice', text: 'ℹ️ 该请求已接收过,不再重复执行', subtype: 'session.renew.duplicate' };
2572
+ return { kind: 'system.notice', text: '该请求已接收过,不再重复执行', subtype: 'session.renew.duplicate' };
2542
2573
  }
2543
2574
  if (outcome.kind === 'busy' || outcome.kind === 'unknown') {
2544
2575
  return {
@@ -2586,7 +2617,8 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2586
2617
  return { kind: 'command.error', text: `❌ 当前 Agent (${currentSessionAgent.name}) 不支持 /compact` };
2587
2618
  }
2588
2619
  if (sendMessage) {
2589
- const text = '正在压缩会话上下文...';
2620
+ const contextUsage = await readLastModelCallContextUsage(session.id, session.agentSessionId);
2621
+ const text = formatCompactingNotice(contextUsage?.totalTokens);
2590
2622
  await sendMessage(channelId, text, this.getReplyContext(session), {
2591
2623
  kind: 'system.notice',
2592
2624
  text,
@@ -2808,7 +2840,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2808
2840
  await interruptPausedSessionBeforeReplacement(session || activeSession);
2809
2841
  const projectPath = this.getEffectiveDefaultPath(channel);
2810
2842
  if (sendMessage && session) {
2811
- const creatingText = `⏳ 正在创建新会话${sessionName ? `: ${sessionName}` : ''}...`;
2843
+ const creatingText = `正在创建新会话${sessionName ? `: ${sessionName}` : ''}...`;
2812
2844
  await sendMessage(channelId, creatingText, this.getReplyContext(session), { kind: 'system.notice', text: creatingText, subtype: 'session.creating' });
2813
2845
  }
2814
2846
  const newSessionBaseagent = this.agentRegistry?.resolveByChannel(channel)?.baseagent || this.parseDefaultBaseagent();
@@ -2859,11 +2891,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2859
2891
  }
2860
2892
  const previousAgent = getActiveAgentIfAvailable();
2861
2893
  if (session && previousAgent) {
2862
- // Reset agent backend state so the new
2863
- // session starts with a fresh conversation history
2864
- // Clearing is a pure backend lifecycle operation; model selection is
2865
- // resolved only when the new session performs its next turn.
2866
- await previousAgent.clearSession(session.id, session.agentSessionId || '', session.projectPath);
2894
+ // Release runtime resources while preserving the previous backend history.
2867
2895
  await previousAgent.closeSession(session.id);
2868
2896
  }
2869
2897
  const newAgent = this.agentRegistry?.resolveByChannel(channel);
@@ -2895,7 +2923,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2895
2923
  const backendBits = [newBaseagent, backendModel, backendEffort].filter(Boolean).join(' · ');
2896
2924
  return {
2897
2925
  kind: 'system.notice',
2898
- text: `✓ 已创建新会话${sessionName ? `: ${sessionName}` : ''} : ${backendBits}${handoffDiscardWarning ? `\n${handoffDiscardWarning}` : ''}`,
2926
+ text: `已创建新会话${sessionName ? `: ${sessionName}` : ''} : ${backendBits}${handoffDiscardWarning ? `\n${handoffDiscardWarning}` : ''}`,
2899
2927
  subtype: 'session.created',
2900
2928
  };
2901
2929
  }
@@ -2942,10 +2970,10 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2942
2970
  let status;
2943
2971
  if (ch?.getStatus) {
2944
2972
  const s = ch.getStatus();
2945
- status = s.connected ? '✓ 已连接' : '⏳ 重连中';
2973
+ status = s.connected ? '已连接' : '重连中';
2946
2974
  }
2947
2975
  else {
2948
- status = '✓ 已注册';
2976
+ status = '已注册';
2949
2977
  }
2950
2978
  if (!groups.has(type))
2951
2979
  groups.set(type, []);
@@ -2957,7 +2985,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2957
2985
  if (!isAdmin && !isDaemonOwner && !isGlobalCheckChannel) {
2958
2986
  // visitor/member: 仅显示实例通道摘要
2959
2987
  const total = [...groups.values()].flat().length;
2960
- const healthy = [...groups.values()].flat().filter(i => i.status.includes('✓')).length;
2988
+ const healthy = [...groups.values()].flat().filter(i => i.status === '已连接' || i.status === '已注册').length;
2961
2989
  lines.push(` ${healthy}/${total} 渠道正常`);
2962
2990
  return { kind: 'command.result', text: lines.join('\n') };
2963
2991
  }
@@ -2969,7 +2997,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
2969
2997
  const parts = instances.map(i => {
2970
2998
  const seg = i.name.split('#');
2971
2999
  const instName = seg.length >= 3 ? seg.slice(2).join('#') : i.name;
2972
- return `${i.status.includes('✓') ? '✓' : '⏳'} ${instName}`;
3000
+ return `${i.status} ${instName}`;
2973
3001
  });
2974
3002
  lines.push(` ${type}: ${parts.join(', ')}`);
2975
3003
  }
@@ -3292,7 +3320,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3292
3320
  });
3293
3321
  await adapter.send(envelope, {
3294
3322
  kind: 'system.notice',
3295
- text: '🔄 重启请求已接管,服务正在重启;完成后会另行通知。',
3323
+ text: '服务正在重启...',
3296
3324
  subtype: 'system.restart.pending',
3297
3325
  });
3298
3326
  // 等待消息发送完成后再延迟 kill
@@ -3543,8 +3571,8 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3543
3571
  return {
3544
3572
  kind: 'system.notice',
3545
3573
  text: isCrossChannel
3546
- ? `📎 文件已通过 ${targetLabel} 发送: ${filePath} (${sizeStr})`
3547
- : `✅ 已发送: ${filePath} (${sizeStr})`,
3574
+ ? `文件已通过 ${targetLabel} 发送: ${filePath} (${sizeStr})`
3575
+ : `已发送: ${filePath} (${sizeStr})`,
3548
3576
  subtype: 'file.sent',
3549
3577
  };
3550
3578
  }
@@ -3594,7 +3622,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3594
3622
  initiatorId: userId,
3595
3623
  kind: {
3596
3624
  kind: 'command-card',
3597
- title: `📋 ${path.basename(session.projectPath)} CLI 会话 (${cliDisplayItems.length})`,
3625
+ title: `${path.basename(session.projectPath)} CLI 会话 (${cliDisplayItems.length})`,
3598
3626
  body: bodyLines.join('\n'),
3599
3627
  buttons: cliDisplayItems.map((item) => ({
3600
3628
  label: item.uuid,
@@ -3678,7 +3706,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3678
3706
  initiatorId: userId,
3679
3707
  kind: {
3680
3708
  kind: 'command-card',
3681
- title: `📋 ${path.basename(session.projectPath)} 会话列表`,
3709
+ title: `${path.basename(session.projectPath)} 会话列表`,
3682
3710
  body: bodyLines.join('\n'),
3683
3711
  buttons: displaySessions.map(ds => {
3684
3712
  const shortId = ds.session.agentSessionId ? ds.session.agentSessionId.substring(0, 8) : ds.name;
@@ -3783,7 +3811,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3783
3811
  const imported = await this.sessionManager.importCliSession(channel, channelId, projectPath, cliSession.uuid, currentBaseagent, selfAID ?? session?.selfAID);
3784
3812
  this.eventBus.publish({ type: 'session:imported', sessionId: imported.id, agentSessionId: cliSession.uuid, projectPath });
3785
3813
  const projectName = this.getProjectName(projectPath);
3786
- return { kind: 'command.result', text: `✓ 已导入 CLI 会话: ${displaySessionTitle(imported.name, '(未命名)')}\n 项目: ${projectName}\n 将继续之前的对话历史` };
3814
+ return { kind: 'command.result', text: `已导入 CLI 会话: ${displaySessionTitle(imported.name, '(未命名)')}\n 项目: ${projectName}\n 将继续之前的对话历史` };
3787
3815
  }
3788
3816
  }
3789
3817
  }
@@ -3806,7 +3834,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3806
3834
  if (this.shouldSuppressCardTriggerResult(source, channel))
3807
3835
  return null;
3808
3836
  const { lastInputLine } = await readLastInput();
3809
- return { kind: 'command.result', text: `✓ 已切换到会话: ${displaySessionTitle(targetSession.name, sessionName)}\n 项目: ${path.basename(targetSession.projectPath)}${lastInputLine}` };
3837
+ return { kind: 'command.result', text: `已切换到会话: ${displaySessionTitle(targetSession.name, sessionName)}\n 项目: ${path.basename(targetSession.projectPath)}${lastInputLine}` };
3810
3838
  }
3811
3839
  if (targetSession.id === session.id) {
3812
3840
  return { kind: 'command.result', text: `当前已在会话: ${displaySessionTitle(targetSession.name, sessionName)}` };
@@ -3827,7 +3855,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3827
3855
  return null;
3828
3856
  const { lastInput, lastInputLine } = await readLastInput();
3829
3857
  const continueHint = lastInput ? '\n 将继续之前的对话历史' : '\n 当前会话未有发言';
3830
- return { kind: 'command.result', text: `✓ 已切换到会话: ${displaySessionTitle(targetSession.name, sessionName)}${continueHint}${lastInputLine}` };
3858
+ return { kind: 'command.result', text: `已切换到会话: ${displaySessionTitle(targetSession.name, sessionName)}${continueHint}${lastInputLine}` };
3831
3859
  }
3832
3860
  // /rename 或 /name 命令:重命名当前会话
3833
3861
  if (normalizedContent === '/rename' || normalizedContent === '/name') {
@@ -3879,7 +3907,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3879
3907
  this.eventBus.publish({ type: 'session:renamed', sessionId: session.id, oldName, newName });
3880
3908
  return {
3881
3909
  kind: 'system.notice',
3882
- text: `✓ 已将当前会话重命名为: ${newName}`,
3910
+ text: `已将当前会话重命名为: ${newName}`,
3883
3911
  subtype: 'session.renamed',
3884
3912
  };
3885
3913
  }
@@ -3928,7 +3956,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3928
3956
  const targetAgent = this.getLoadedAgent(channel, targetSession.baseagent);
3929
3957
  this.processor?.clearPauseSession?.(targetSession.id);
3930
3958
  await targetAgent?.closeSession(targetSession.id);
3931
- return { kind: 'command.result', text: `✓ 已删除会话: ${displaySessionTitle(targetSession.name, sessionName)}\n会话文件已保留,可通过 CLI 访问` };
3959
+ return { kind: 'command.result', text: `已删除会话: ${displaySessionTitle(targetSession.name, sessionName)}\n会话文件已保留,可通过 CLI 访问` };
3932
3960
  }
3933
3961
  // /fork 命令:分支当前会话
3934
3962
  if (normalizedContent === '/fork' || normalizedContent.startsWith('/fork ')) {
@@ -3946,9 +3974,12 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3946
3974
  await interruptPausedSessionBeforeReplacement(session);
3947
3975
  try {
3948
3976
  const forkedSessionId = await forkAgent.forkSession(session.agentSessionId, session.projectPath, forkName, {
3949
- sessionId: session.id, permissionMode: authSubject.permissionMode, role: authSubject.role,
3977
+ sessionId: session.id, permissionMode: authSubject.permissionMode, role: authSubject.role, authorization: authSubject,
3950
3978
  });
3951
3979
  const newSession = await this.sessionManager.createForkedSession(session, forkedSessionId, forkName);
3980
+ await forkAgent.commitSessionFork?.(forkedSessionId, newSession, {
3981
+ sessionId: session.id, authorization: authSubject,
3982
+ }).catch(async (error) => { await this.sessionManager.unbindSession(newSession.id); throw error; });
3952
3983
  await forkAgent.updateSessionMetadata?.(forkedSessionId, {
3953
3984
  gitInfo: {
3954
3985
  branch: null,
@@ -3961,7 +3992,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
3961
3992
  logger.debug('[CommandHandler] Backend fork metadata sync failed:', error);
3962
3993
  });
3963
3994
  this.eventBus.publish({ type: 'session:forked', sessionId: newSession.id, sourceSessionId: session.id, name: forkName });
3964
- return { kind: 'command.result', text: `✅ 会话已分支: ${displaySessionTitle(newSession.name, '(未命名)')}\n新会话已激活,可以继续对话\n\n使用 /s 查看所有会话,/s <名称> 切换回原会话` };
3995
+ return { kind: 'command.result', text: `会话已分支: ${displaySessionTitle(newSession.name, '(未命名)')}\n新会话已激活,可以继续对话\n\n使用 /s 查看所有会话,/s <名称> 切换回原会话` };
3965
3996
  }
3966
3997
  catch (error) {
3967
3998
  logger.error('[CommandHandler] Fork session failed:', error);
@@ -4063,14 +4094,14 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
4063
4094
  try {
4064
4095
  if (!repairSession.agentSessionId) {
4065
4096
  await this.sessionManager.resetHealthStatus(repairSession.id);
4066
- return { kind: 'command.result', text: `✓ 修复完成\n\n修复内容:\n- 未发现问题(新会话)\n- 已重置异常计数器` };
4097
+ return { kind: 'command.result', text: `修复完成\n\n修复内容:\n- 未发现问题(新会话)\n- 已重置异常计数器` };
4067
4098
  }
4068
4099
  // 通过 agent 定位 session 文件
4069
4100
  const sessionFile = repairAgent.resolveSessionFile?.(repairSession.agentSessionId, repairSession.projectPath) ?? null;
4070
4101
  if (!sessionFile) {
4071
4102
  // 文件不存在(已被删除或从未创建),直接重置
4072
4103
  await this.sessionManager.resetHealthStatus(repairSession.id);
4073
- return { kind: 'command.result', text: `✓ 修复完成\n\n修复内容:\n- 会话文件不存在(可能已被清理)\n- 已重置异常计数器` };
4104
+ return { kind: 'command.result', text: `修复完成\n\n修复内容:\n- 会话文件不存在(可能已被清理)\n- 已重置异常计数器` };
4074
4105
  }
4075
4106
  const healthCheck = await checkSessionFile(sessionFile);
4076
4107
  if (healthCheck.corrupt) {
@@ -4085,14 +4116,14 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
4085
4116
  }
4086
4117
  repairAgent.updateSessionId(repairSession.id, '');
4087
4118
  await this.sessionManager.resetHealthStatus(repairSession.id);
4088
- return { kind: 'command.result', text: `✓ 修复完成\n\n检测到问题:\n${healthCheck.issues.map((i) => `- ${i}`).join('\n')}\n\n修复操作:\n- 已备份损坏文件\n- 已删除损坏文件\n- 已重置异常计数器\n\n备份位置:${backupPath}` };
4119
+ return { kind: 'command.result', text: `修复完成\n\n检测到问题:\n${healthCheck.issues.map((i) => `- ${i}`).join('\n')}\n\n修复操作:\n- 已备份损坏文件\n- 已删除损坏文件\n- 已重置异常计数器\n\n备份位置:${backupPath}` };
4089
4120
  }
4090
4121
  if (healthCheck.issues.length > 0) {
4091
4122
  await this.sessionManager.resetHealthStatus(repairSession.id);
4092
4123
  return { kind: 'command.error', text: `⚠️ 检测到问题:\n${healthCheck.issues.map((i) => `- ${i}`).join('\n')}\n\n建议使用 /new 创建新会话\n\n已重置异常计数器,可继续使用当前会话。` };
4093
4124
  }
4094
4125
  await this.sessionManager.resetHealthStatus(repairSession.id);
4095
- return { kind: 'command.result', text: `✓ 修复完成\n\n修复内容:\n- 未发现问题\n- 已重置异常计数器` };
4126
+ return { kind: 'command.result', text: `修复完成\n\n修复内容:\n- 未发现问题\n- 已重置异常计数器` };
4096
4127
  }
4097
4128
  catch (error) {
4098
4129
  logger.error('[Repair] Failed:', error);