better-dsh 0.2.3-e → 0.2.3-g

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 (270) hide show
  1. package/docs/50_test-reports/2026-09-13-preact-ui-shell/345/256/236/346/265/213/346/212/245/345/221/212.md +1 -1
  2. package/docs/50_test-reports/2026-09-14-4999-skill/346/270/205/345/215/225/344/270/216lsp-gate/345/256/236/346/265/213/346/212/245/345/221/212.md +54 -0
  3. package/docs/specs/agent/spec.md +54 -0
  4. package/docs/specs/ast/spec.md +34 -0
  5. package/docs/specs/compaction-recall/spec.md +46 -0
  6. package/docs/specs/ctx/spec.md +107 -0
  7. package/docs/specs/dsh/spec.md +47 -0
  8. package/docs/specs/dvc/spec.md +87 -0
  9. package/docs/specs/escalation-guidance/spec.md +44 -0
  10. package/docs/specs/fs-scheme-resolution/spec.md +37 -0
  11. package/docs/specs/hash-edit/spec.md +41 -0
  12. package/docs/specs/http-read/spec.md +73 -0
  13. package/docs/specs/kernel-provisioning/spec.md +53 -0
  14. package/docs/specs/lsp/spec.md +121 -0
  15. package/docs/specs/mobile-layout/spec.md +108 -0
  16. package/docs/specs/model-failover/spec.md +20 -0
  17. package/docs/specs/preact-ui-shell/spec.md +22 -0
  18. package/docs/specs/repl-dispatch-resilience/spec.md +21 -0
  19. package/docs/specs/skill/spec.md +58 -0
  20. package/docs/specs/tool-surface/spec.md +222 -0
  21. package/docs/specs/url-schema/spec.md +148 -0
  22. package/docs/specs/web-trust-fence/spec.md +43 -0
  23. package/dsh-docs/AGENTS.md +75 -0
  24. package/dsh-docs/agent-lifecycle.md +84 -0
  25. package/dsh-docs/agent-lifecycle.zh.md +86 -0
  26. package/dsh-docs/api-gateway.md +164 -0
  27. package/dsh-docs/api-gateway.zh.md +164 -0
  28. package/dsh-docs/architecture.md +150 -0
  29. package/dsh-docs/architecture.zh.md +154 -0
  30. package/dsh-docs/capability-seams.md +543 -0
  31. package/dsh-docs/capability-seams.zh.md +545 -0
  32. package/dsh-docs/config-catalog.md +3473 -0
  33. package/dsh-docs/config-catalog.zh.md +3474 -0
  34. package/dsh-docs/cookbook/adding-a-package.md +117 -0
  35. package/dsh-docs/cookbook/adding-a-package.zh.md +119 -0
  36. package/dsh-docs/cookbook/adding-a-remote-api.md +197 -0
  37. package/dsh-docs/cookbook/adding-a-remote-api.zh.md +197 -0
  38. package/dsh-docs/cookbook/adding-a-settings-card.md +102 -0
  39. package/dsh-docs/cookbook/adding-a-settings-card.zh.md +102 -0
  40. package/dsh-docs/cookbook/adding-a-tool.md +101 -0
  41. package/dsh-docs/cookbook/adding-a-tool.zh.md +103 -0
  42. package/dsh-docs/cookbook/adding-a-vendored-package.md +59 -0
  43. package/dsh-docs/cookbook/adding-a-vendored-package.zh.md +59 -0
  44. package/dsh-docs/cookbook/adding-an-llm-adapter.md +43 -0
  45. package/dsh-docs/cookbook/adding-an-llm-adapter.zh.md +43 -0
  46. package/dsh-docs/cookbook/extension-cookbook.md +132 -0
  47. package/dsh-docs/cookbook/extension-cookbook.zh.md +136 -0
  48. package/dsh-docs/cookbook/maintaining-dsh-code-review.md +64 -0
  49. package/dsh-docs/cookbook/maintaining-dsh-code-review.zh.md +64 -0
  50. package/dsh-docs/cookbook/responding-to-pr-review-on-a-stack.md +32 -0
  51. package/dsh-docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +32 -0
  52. package/dsh-docs/cordis-api/context.md +364 -0
  53. package/dsh-docs/cordis-api/context.zh.md +366 -0
  54. package/dsh-docs/cordis-api/events.md +207 -0
  55. package/dsh-docs/cordis-api/events.zh.md +209 -0
  56. package/dsh-docs/cordis-api/fiber.md +375 -0
  57. package/dsh-docs/cordis-api/fiber.zh.md +377 -0
  58. package/dsh-docs/cordis-api/inherited.md +39 -0
  59. package/dsh-docs/cordis-api/registry.md +152 -0
  60. package/dsh-docs/cordis-api/registry.zh.md +154 -0
  61. package/dsh-docs/cordis-api/service.md +102 -0
  62. package/dsh-docs/cordis-api/service.zh.md +104 -0
  63. package/dsh-docs/cordis-primer.md +45 -0
  64. package/dsh-docs/cordis-primer.zh.md +51 -0
  65. package/dsh-docs/cordis-tutorial/01-first-plugin.md +95 -0
  66. package/dsh-docs/cordis-tutorial/01-first-plugin.zh.md +95 -0
  67. package/dsh-docs/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
  68. package/dsh-docs/cordis-tutorial/02-lifecycle-and-effects.zh.md +98 -0
  69. package/dsh-docs/cordis-tutorial/03-services.md +98 -0
  70. package/dsh-docs/cordis-tutorial/03-services.zh.md +98 -0
  71. package/dsh-docs/cordis-tutorial/04-events.md +144 -0
  72. package/dsh-docs/cordis-tutorial/04-events.zh.md +144 -0
  73. package/dsh-docs/cordis-tutorial/05-config.md +84 -0
  74. package/dsh-docs/cordis-tutorial/05-config.zh.md +84 -0
  75. package/dsh-docs/cordis-tutorial/06-composition-and-hmr.md +113 -0
  76. package/dsh-docs/cordis-tutorial/06-composition-and-hmr.zh.md +113 -0
  77. package/dsh-docs/cordis-tutorial/07-into-the-harness.md +108 -0
  78. package/dsh-docs/cordis-tutorial/07-into-the-harness.zh.md +108 -0
  79. package/dsh-docs/cordis-tutorial/index.md +60 -0
  80. package/dsh-docs/cordis-tutorial/index.zh.md +62 -0
  81. package/dsh-docs/deepseek-llm-api-wire-extensions.md +163 -0
  82. package/dsh-docs/deepseek-llm-api-wire-extensions.zh.md +163 -0
  83. package/dsh-docs/defensive-patterns.md +33 -0
  84. package/dsh-docs/defensive-patterns.zh.md +35 -0
  85. package/dsh-docs/development.md +167 -0
  86. package/dsh-docs/development.zh.md +173 -0
  87. package/dsh-docs/event-producer-consumer.md +86 -0
  88. package/dsh-docs/event-producer-consumer.zh.md +88 -0
  89. package/dsh-docs/glossary.md +45 -0
  90. package/dsh-docs/glossary.zh.md +45 -0
  91. package/dsh-docs/graph-atlas.md +22 -0
  92. package/dsh-docs/graph-atlas.zh.md +24 -0
  93. package/dsh-docs/i18n/README.md +60 -0
  94. package/dsh-docs/i18n/README.zh.md +62 -0
  95. package/dsh-docs/i18n/style-samples.md +87 -0
  96. package/dsh-docs/i18n/terminology.md +214 -0
  97. package/dsh-docs/i18n/translation-prompt.md +263 -0
  98. package/dsh-docs/i18n/translation-rules.md +69 -0
  99. package/dsh-docs/i18n/translation-rules.zh.md +69 -0
  100. package/dsh-docs/module-graph.md +1411 -0
  101. package/dsh-docs/module-graph.zh.md +1413 -0
  102. package/dsh-docs/persistence-catalog.md +1075 -0
  103. package/dsh-docs/persistence-catalog.zh.md +1077 -0
  104. package/dsh-docs/postmortem/0001-acp-default-export-drops-inject.md +113 -0
  105. package/dsh-docs/postmortem/0001-acp-default-export-drops-inject.zh.md +113 -0
  106. package/dsh-docs/postmortem/0002-js-expression-disabled-filesystem-tools.md +47 -0
  107. package/dsh-docs/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +47 -0
  108. package/dsh-docs/postmortem/0003-web-agent-gui-feedback-loop.md +53 -0
  109. package/dsh-docs/postmortem/0003-web-agent-gui-feedback-loop.zh.md +53 -0
  110. package/dsh-docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +55 -0
  111. package/dsh-docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +55 -0
  112. package/dsh-docs/postmortem/README.md +18 -0
  113. package/dsh-docs/postmortem/README.zh.md +18 -0
  114. package/dsh-docs/rescope.md +53 -0
  115. package/dsh-docs/rescope.zh.md +53 -0
  116. package/dsh-docs/subsystems/README.md +61 -0
  117. package/dsh-docs/subsystems/README.zh.md +61 -0
  118. package/dsh-docs/subsystems/agent-team.md +207 -0
  119. package/dsh-docs/subsystems/agent-team.zh.md +207 -0
  120. package/dsh-docs/subsystems/approval.md +170 -0
  121. package/dsh-docs/subsystems/approval.zh.md +170 -0
  122. package/dsh-docs/subsystems/attachment.md +351 -0
  123. package/dsh-docs/subsystems/attachment.zh.md +351 -0
  124. package/dsh-docs/subsystems/client-modules.md +168 -0
  125. package/dsh-docs/subsystems/client-modules.zh.md +168 -0
  126. package/dsh-docs/subsystems/code-runtime.md +195 -0
  127. package/dsh-docs/subsystems/code-runtime.zh.md +195 -0
  128. package/dsh-docs/subsystems/commands.md +219 -0
  129. package/dsh-docs/subsystems/commands.zh.md +219 -0
  130. package/dsh-docs/subsystems/compaction.md +238 -0
  131. package/dsh-docs/subsystems/compaction.zh.md +238 -0
  132. package/dsh-docs/subsystems/conversation.md +258 -0
  133. package/dsh-docs/subsystems/conversation.zh.md +258 -0
  134. package/dsh-docs/subsystems/core.md +1209 -0
  135. package/dsh-docs/subsystems/core.zh.md +1219 -0
  136. package/dsh-docs/subsystems/credentials.md +329 -0
  137. package/dsh-docs/subsystems/credentials.zh.md +329 -0
  138. package/dsh-docs/subsystems/extensions.md +382 -0
  139. package/dsh-docs/subsystems/extensions.zh.md +382 -0
  140. package/dsh-docs/subsystems/feedback.md +266 -0
  141. package/dsh-docs/subsystems/feedback.zh.md +266 -0
  142. package/dsh-docs/subsystems/filesystem.md +505 -0
  143. package/dsh-docs/subsystems/filesystem.zh.md +505 -0
  144. package/dsh-docs/subsystems/goal.md +277 -0
  145. package/dsh-docs/subsystems/goal.zh.md +277 -0
  146. package/dsh-docs/subsystems/invariants.md +88 -0
  147. package/dsh-docs/subsystems/invariants.zh.md +88 -0
  148. package/dsh-docs/subsystems/jobs.md +290 -0
  149. package/dsh-docs/subsystems/jobs.zh.md +290 -0
  150. package/dsh-docs/subsystems/llm-streaming.md +1080 -0
  151. package/dsh-docs/subsystems/llm-streaming.zh.md +1086 -0
  152. package/dsh-docs/subsystems/lsp.md +202 -0
  153. package/dsh-docs/subsystems/lsp.zh.md +202 -0
  154. package/dsh-docs/subsystems/permission-presets.md +131 -0
  155. package/dsh-docs/subsystems/permission-presets.zh.md +131 -0
  156. package/dsh-docs/subsystems/persistence.md +395 -0
  157. package/dsh-docs/subsystems/persistence.zh.md +395 -0
  158. package/dsh-docs/subsystems/plan.md +87 -0
  159. package/dsh-docs/subsystems/plan.zh.md +87 -0
  160. package/dsh-docs/subsystems/sandbox.md +220 -0
  161. package/dsh-docs/subsystems/sandbox.zh.md +220 -0
  162. package/dsh-docs/subsystems/schedule.md +192 -0
  163. package/dsh-docs/subsystems/schedule.zh.md +192 -0
  164. package/dsh-docs/subsystems/scope.md +59 -0
  165. package/dsh-docs/subsystems/scope.zh.md +59 -0
  166. package/dsh-docs/subsystems/session-projection.md +354 -0
  167. package/dsh-docs/subsystems/session-projection.zh.md +354 -0
  168. package/dsh-docs/subsystems/session-query.md +509 -0
  169. package/dsh-docs/subsystems/session-query.zh.md +509 -0
  170. package/dsh-docs/subsystems/session-reference.md +219 -0
  171. package/dsh-docs/subsystems/session-reference.zh.md +219 -0
  172. package/dsh-docs/subsystems/session-telemetry.md +194 -0
  173. package/dsh-docs/subsystems/session-telemetry.zh.md +194 -0
  174. package/dsh-docs/subsystems/session-title.md +204 -0
  175. package/dsh-docs/subsystems/session-title.zh.md +204 -0
  176. package/dsh-docs/subsystems/session.md +1155 -0
  177. package/dsh-docs/subsystems/session.zh.md +1159 -0
  178. package/dsh-docs/subsystems/settings.md +405 -0
  179. package/dsh-docs/subsystems/settings.zh.md +405 -0
  180. package/dsh-docs/subsystems/shell.md +303 -0
  181. package/dsh-docs/subsystems/shell.zh.md +303 -0
  182. package/dsh-docs/subsystems/skills.md +354 -0
  183. package/dsh-docs/subsystems/skills.zh.md +354 -0
  184. package/dsh-docs/subsystems/slots.md +175 -0
  185. package/dsh-docs/subsystems/slots.zh.md +175 -0
  186. package/dsh-docs/subsystems/spill.md +117 -0
  187. package/dsh-docs/subsystems/spill.zh.md +117 -0
  188. package/dsh-docs/subsystems/storage.md +260 -0
  189. package/dsh-docs/subsystems/storage.zh.md +260 -0
  190. package/dsh-docs/subsystems/subagent.md +766 -0
  191. package/dsh-docs/subsystems/subagent.zh.md +770 -0
  192. package/dsh-docs/subsystems/subprocess.md +324 -0
  193. package/dsh-docs/subsystems/subprocess.zh.md +324 -0
  194. package/dsh-docs/subsystems/system-prompt.md +220 -0
  195. package/dsh-docs/subsystems/system-prompt.zh.md +220 -0
  196. package/dsh-docs/subsystems/terminal.md +184 -0
  197. package/dsh-docs/subsystems/terminal.zh.md +184 -0
  198. package/dsh-docs/subsystems/todo.md +32 -0
  199. package/dsh-docs/subsystems/todo.zh.md +32 -0
  200. package/dsh-docs/subsystems/token-meter.md +105 -0
  201. package/dsh-docs/subsystems/token-meter.zh.md +105 -0
  202. package/dsh-docs/subsystems/tools.md +720 -0
  203. package/dsh-docs/subsystems/tools.zh.md +720 -0
  204. package/dsh-docs/subsystems/typert.md +343 -0
  205. package/dsh-docs/subsystems/typert.zh.md +343 -0
  206. package/dsh-docs/subsystems/user-questions.md +178 -0
  207. package/dsh-docs/subsystems/user-questions.zh.md +178 -0
  208. package/dsh-docs/subsystems/web-client.md +95 -0
  209. package/dsh-docs/subsystems/web-client.zh.md +95 -0
  210. package/dsh-docs/subsystems/web-server.md +154 -0
  211. package/dsh-docs/subsystems/web-server.zh.md +154 -0
  212. package/dsh-docs/subsystems/web.md +206 -0
  213. package/dsh-docs/subsystems/web.zh.md +206 -0
  214. package/dsh-docs/subsystems/webhook.md +70 -0
  215. package/dsh-docs/subsystems/webhook.zh.md +70 -0
  216. package/dsh-docs/subsystems/workflow.md +278 -0
  217. package/dsh-docs/subsystems/workflow.zh.md +278 -0
  218. package/dsh-docs/subsystems/workspace.md +321 -0
  219. package/dsh-docs/subsystems/workspace.zh.md +321 -0
  220. package/dsh-docs/testing.md +54 -0
  221. package/dsh-docs/testing.zh.md +54 -0
  222. package/dsh-docs/tool-catalog.md +2225 -0
  223. package/dsh-docs/tool-catalog.zh.md +2233 -0
  224. package/dsh-docs/tool-execution-pipeline.md +62 -0
  225. package/dsh-docs/tool-execution-pipeline.zh.md +64 -0
  226. package/dsh-docs/user/develop/basic/config.md +106 -0
  227. package/dsh-docs/user/develop/basic/config.zh.md +106 -0
  228. package/dsh-docs/user/develop/basic/index.md +144 -0
  229. package/dsh-docs/user/develop/basic/index.zh.md +144 -0
  230. package/dsh-docs/user/develop/basic/publish.md +183 -0
  231. package/dsh-docs/user/develop/basic/publish.zh.md +183 -0
  232. package/dsh-docs/user/develop/basic/tool.md +52 -0
  233. package/dsh-docs/user/develop/basic/tool.zh.md +52 -0
  234. package/dsh-docs/user/develop/framework/events.md +143 -0
  235. package/dsh-docs/user/develop/framework/events.zh.md +143 -0
  236. package/dsh-docs/user/develop/framework/index.md +137 -0
  237. package/dsh-docs/user/develop/framework/index.zh.md +137 -0
  238. package/dsh-docs/user/develop/framework/service.md +148 -0
  239. package/dsh-docs/user/develop/framework/service.zh.md +150 -0
  240. package/dsh-docs/user/develop/practice/dynamic-cordis.md +15 -0
  241. package/dsh-docs/user/develop/practice/dynamic-cordis.zh.md +15 -0
  242. package/dsh-docs/user/develop/practice/index.md +155 -0
  243. package/dsh-docs/user/develop/practice/index.zh.md +155 -0
  244. package/dsh-docs/user/develop/practice/llm-adapter.md +189 -0
  245. package/dsh-docs/user/develop/practice/llm-adapter.zh.md +189 -0
  246. package/dsh-docs/user/guide/github-review.md +102 -0
  247. package/dsh-docs/user/guide/github-review.zh.md +102 -0
  248. package/dsh-docs/user/guide/index.md +30 -0
  249. package/dsh-docs/user/guide/index.zh.md +30 -0
  250. package/dsh-docs/user/guide/mcp-memory.md +101 -0
  251. package/dsh-docs/user/guide/mcp-memory.zh.md +101 -0
  252. package/dsh-docs/user/guide/network-proxy.md +85 -0
  253. package/dsh-docs/user/guide/network-proxy.zh.md +85 -0
  254. package/dsh-docs/user/guide/providers.md +190 -0
  255. package/dsh-docs/user/guide/providers.zh.md +190 -0
  256. package/dsh-docs/user/guide/python-sdk.md +150 -0
  257. package/dsh-docs/user/guide/python-sdk.zh.md +150 -0
  258. package/dsh-docs/user/guide/schedule.md +21 -0
  259. package/dsh-docs/user/guide/schedule.zh.md +21 -0
  260. package/dsh-docs/user/index.md +11 -0
  261. package/dsh-docs/user/index.zh.md +11 -0
  262. package/dsh-docs/web-styling.md +29 -0
  263. package/dsh-docs/web-styling.zh.md +29 -0
  264. package/lib/client/index.js +268 -38
  265. package/lib/fs-aware/sandbox-plugin.js +1 -1
  266. package/lib/index.js +1112 -1261
  267. package/lib/lsp-server-registry-B8DNonhS.js +3 -0
  268. package/lib/lsp-server-registry-BexQagaK.js +943 -0
  269. package/lib/{wrap-DC8O3SYz.js → wrap-JFjcWwZf.js} +42 -16
  270. package/package.json +2 -1
@@ -0,0 +1,207 @@
1
+ # Agent Teams
2
+
3
+ [English](agent-team.md) | 中文
4
+
5
+ 实验性隐式 Root Team 领域、模型工具与宿主适配器共享的类型。[Agent Teams Agent Note](../../.agents/notes/implemented/feature/2026-08-05-agent-teams.zh.md)负责身份、mailbox、task 与共享 checkout 决策;[Team Steer 消息 Agent Note](../../.agents/notes/implemented/simplification/2026-08-30-team-send-message-steer.zh.md)负责消息调度;本页记录 [`packages/experimental/agent-team/src/types.ts`](../../packages/experimental/agent-team/src/types.ts) 中的字面持久形式。
6
+
7
+ ## 身份与 roster
8
+
9
+ `TeamId` 是具有独立[品牌](core.zh.md#branded-ids)的 Root `SessionId`。`TeamTaskId` 在 Team 内按 `task-<n>` 单调分配;`TeamMessageId` 是全局随机值。teammate 的 Session id 始终是持久身份,而 `name` 是不可变的模型/UI 标签。
10
+
11
+ ```ts type-equiv
12
+ /** Whole durable value written on every teammate lifecycle change. */
13
+ interface TeamMemberSnapshot {
14
+ readonly id: SessionId
15
+ readonly name: string
16
+ readonly description: string
17
+ readonly provider: string
18
+ readonly context: 'fresh' | 'fork'
19
+ readonly phase: TeamMemberPhase
20
+ readonly error?: string
21
+ }
22
+ ```
23
+
24
+ 每个 member 都从 `provisioning` 开始,并且只到达一个终态 roster phase:`active` 或 `failed`。运行时 `running`/`idle`/`inactive` 状态单独派生,绝不会重写该记录。
25
+
26
+ ## 持久 mailbox
27
+
28
+ Lead Session 首先存储完整 queued message。只有 target 的 pending inbox 条目或已记录用户消息完成持久化,才会写入独立 acknowledgement event,queued-minus-delivered 因而构成恢复 mailbox。
29
+
30
+ ```ts type-equiv
31
+ /** One peer message retained until its target Session records it. */
32
+ interface TeamMessageSnapshot {
33
+ readonly id: TeamMessageId
34
+ readonly senderId: SessionId
35
+ readonly senderName: string
36
+ readonly targetId: SessionId
37
+ readonly content: ContentBlock[]
38
+ }
39
+ ```
40
+
41
+ 每条消息都会尝试 Steer 投递。running target 在最近的步骤边界收到消息,idle target 启动一个轮次,inactive teammate 则冷恢复。调用方不能选择其他模式,因此持久记录不存储调度方式。
42
+
43
+ target Session 会在 pending inbox 条目和最终用户消息上保留消息身份与发送者归因。跨 inbox 与历史折叠该 source 构成 target 侧去重键;模型可见的 framing 会重复 id 和发送者。
44
+
45
+ ```ts type-equiv
46
+ /** Source retained by the target Session for durable mailbox de-duplication. */
47
+ interface TeamMessageSource {
48
+ readonly kind: 'team-message'
49
+ readonly teamId: TeamId
50
+ readonly messageId: TeamMessageId
51
+ readonly senderId: SessionId
52
+ readonly senderName: string
53
+ }
54
+ ```
55
+
56
+ ## 共享任务 DAG
57
+
58
+ 每条 task event 都存储完整快照。`revision` 是 compare-and-set 值,每次变更递增 1。`blockedBy` edge 必须指向未删除任务,并维持无环图。`writeScopes` 是规范化的提示性路径前缀,不是锁。
59
+
60
+ ```ts type-equiv
61
+ /** Whole durable task snapshot; every mutation increments {@link revision}. */
62
+ interface TeamTaskSnapshot {
63
+ readonly id: TeamTaskId
64
+ readonly revision: number
65
+ readonly subject: string
66
+ readonly description: string
67
+ readonly status: TeamTaskStatus
68
+ readonly ownerId?: SessionId
69
+ readonly blockedBy: TeamTaskId[]
70
+ readonly writeScopes: string[]
71
+ }
72
+ ```
73
+
74
+ `pending` 表示尚未开始或已经释放,`in_progress` 携带 owner,`completed` 满足 blocker,`deleted` 是保留的 tombstone。view 会添加 owner name、readiness 和 write-scope 重叠警告,但不会改变持久快照。
75
+
76
+ ## 回放
77
+
78
+ `foldTeam()` 把一个 Root Session 回放成每个 Team 操作所读取的 roster、任务板与 queued-minus-delivered mailbox。它按 `TeamId` 选取记录,因此普通 fork 继承的 event 保留 ancestor id,绝不会进入新 Root 的状态。Session event 的 `seq` 与 `time` 继续负责顺序和时间记录,Team snapshot 不再重复保存它们。roster 与 task 读取以 view 形式到达调用方,而 pending 邮件仅供投递与恢复内部使用。包 [README](../../packages/experimental/agent-team/README.zh.md)负责 operation、authorization、recovery 和限制行为。
79
+
80
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
81
+
82
+ <a id="cordis-surface"></a>
83
+
84
+ ## Cordis API
85
+
86
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
87
+
88
+ <a id="ctxagentteams--teamservice"></a>
89
+
90
+ ### `ctx.agentTeams` — `TeamService`
91
+
92
+ Agent Teams service backed by the exact live Lead Session log.
93
+
94
+ ```ts cordis-catalog
95
+ /**
96
+ * Resolve one exact live Agent's Team role.
97
+ * @param agent - exact live Agent used as the authority credential.
98
+ * @returns its root, Team identity, role, and model-facing name.
99
+ */
100
+ membership(agent: Agent): TeamMembership
101
+
102
+ /**
103
+ * List the runtime-enriched roster visible to one Team member.
104
+ * @param agent - exact live Team member.
105
+ * @returns Lead and teammate rows in creation order.
106
+ */
107
+ listMembers(agent: Agent): TeamMemberView[]
108
+
109
+ /**
110
+ * Create one named, continuable direct child of the Team Lead.
111
+ * @param caller - exact live Lead Agent.
112
+ * @param request - immutable name, description, prompt, context mode, provider, and cancellation.
113
+ * @returns the active roster row.
114
+ */
115
+ async spawnTeammate(caller: Agent, request: SpawnTeammateRequest): Promise<SpawnTeammateResult>
116
+
117
+ /**
118
+ * Queue one durable peer message, then attempt immediate delivery.
119
+ * @param caller - exact live sending Team member.
120
+ * @param request - target name, content, and pre-queue cancellation.
121
+ * @returns durable message identity and immediate-delivery observation.
122
+ */
123
+ async sendMessage(caller: Agent, request: SendTeamMessageRequest): Promise<SendTeamMessageResult>
124
+
125
+ /**
126
+ * Create one unowned pending task in the Team Lead log.
127
+ * @param caller - exact live Team member creating the task.
128
+ * @param request - task text, blockers, and advisory write scopes.
129
+ * @returns the revision-one task view.
130
+ */
131
+ async createTask(caller: Agent, request: CreateTeamTaskRequest): Promise<TeamTaskView>
132
+
133
+ /**
134
+ * Return one task, including a deleted tombstone.
135
+ * @param caller - exact live Team member reading the task.
136
+ * @param id - Team-local task identity.
137
+ * @returns the latest task value and derived readiness diagnostics.
138
+ */
139
+ getTask(caller: Agent, id: TeamTaskId): TeamTaskView
140
+
141
+ /**
142
+ * List current non-deleted tasks in numeric creation order.
143
+ * @param caller - exact live Team member reading the board.
144
+ * @returns detached current task views.
145
+ */
146
+ listTasks(caller: Agent): TeamTaskView[]
147
+
148
+ /**
149
+ * Compare-and-set one authorized task transition.
150
+ * @param caller - exact live Team member authorizing the mutation.
151
+ * @param request - task identity, expected revision, action, and action fields.
152
+ * @returns the committed next task revision.
153
+ */
154
+ async updateTask(caller: Agent, request: UpdateTeamTaskRequest): Promise<TeamTaskView>
155
+
156
+ /**
157
+ * Wait for the next Team-domain or member-status change.
158
+ * @param caller - exact live Team member waiting for activity.
159
+ * @param timeoutMs - bounded wait duration from ten seconds through one hour.
160
+ * @param signal - caller cancellation for the wait only.
161
+ * @returns one observed change or a timeout result.
162
+ */
163
+ async waitForChange(caller: Agent, timeoutMs: number, signal: AbortSignal): Promise<TeamWaitResult>
164
+
165
+ /**
166
+ * Interrupt one live teammate turn without clearing its pending inbox.
167
+ * @param caller - exact live Lead Agent.
168
+ * @param targetName - durable teammate name.
169
+ * @returns the target status sampled before cancellation.
170
+ */
171
+ interrupt(caller: Agent, targetName: string): { previousStatus: 'running' | 'idle' | 'inactive' }
172
+
173
+ /**
174
+ * Resolve a caller without throwing, used by scoped-tool installation and observers.
175
+ * @param agent - candidate exact live Agent.
176
+ * @returns Team membership, or undefined for non-Team subagents and stale identities.
177
+ */
178
+ tryMembership(agent: Agent): TeamMembership | undefined
179
+
180
+ /**
181
+ * Read the current roster and non-deleted task board through the generated Remote API.
182
+ * @param agent - exact live Team member used as the authority credential.
183
+ * @returns detached current roster and task views.
184
+ */
185
+ @Remote('view') remoteView(agent: Agent): TeamView
186
+
187
+ /**
188
+ * Create one shared task through the generated Remote API.
189
+ * @param agent - exact live Team member creating the task.
190
+ * @param request - task text, blockers, and advisory write scopes.
191
+ * @returns the revision-one task or a typed Team rejection.
192
+ */
193
+ @Remote('createTask') remoteCreateTask(agent: Agent, request: CreateTeamTaskRequest): Promise<TeamTaskMutationResult>
194
+
195
+ /**
196
+ * Apply one task mutation and preserve Team rejections as business results.
197
+ * @param agent - exact live Team member authorizing the mutation.
198
+ * @param request - task identity, expected revision, action, and action fields.
199
+ * @returns the committed task or a typed Team rejection.
200
+ */
201
+ @Remote('updateTask') remoteUpdateTask(agent: Agent, request: UpdateTeamTaskRequest): Promise<TeamTaskMutationResult>
202
+ ```
203
+
204
+ Types: [Agent](core.zh.md)
205
+
206
+ Source: [`packages/experimental/agent-team/src/index.ts`](../../packages/experimental/agent-team/src/index.ts)
207
+ <!-- END GENERATED cordis-surface -->
@@ -0,0 +1,170 @@
1
+ # User Approval
2
+
3
+ English | [中文](approval.zh.md)
4
+
5
+ The user-approval seam of [dsh-user-approval](../../packages/interaction/user-approval) answers one question: may this specific action proceed? It owns the shared request/outcome vocabulary, the `ctx.approval` dispatch service, the `approval/request` answerer waterfall, the log-only audit pair, and the per-session `ask`/`never` policy. UI channels may provide human answerers; the [ACP automation bridge](../../packages/acp/acp) provides one-shot machine decisions for its own agents. Callers such as [dsh-tools](../../packages/core/tools) and [dsh-tool-bash](../../packages/shell/tool-bash) consume the closed outcome and fail closed unless it is `allowed-once`.
6
+
7
+ Source: [`packages/interaction/user-approval/src/index.ts`](../../packages/interaction/user-approval/src/index.ts)
8
+
9
+ ## Identity and outcome
10
+
11
+ Every request receives a fresh `ApprovalRequestId`. The brand pairs the `approval/asked` and `approval/decided` audit events without making approval ids interchangeable with tool-call or agent/session ids.
12
+
13
+ ```ts type-equiv
14
+ /**
15
+ * Pairs one `approval/asked` audit event with its `approval/decided`.
16
+ * Service-issued (one fresh id per {@link ApprovalService.request} call).
17
+ */
18
+ type ApprovalRequestId = Branded<'ApprovalRequestId'>
19
+ ```
20
+
21
+ `ApprovalOutcome` is closed and fail-closed. `allowed-once` grants only the asked-about action; callers deny on `rejected`, `cancelled`, and `unavailable`. A missing, non-owning, throwing, or non-conforming answerer becomes `unavailable` rather than opening the gate.
22
+
23
+ ```ts type-equiv
24
+ /**
25
+ * Closed approval outcomes: a one-shot grant, explicit rejection, withdrawn
26
+ * request, or unavailable answerer. Callers fail closed on `unavailable`.
27
+ */
28
+ type ApprovalOutcome = 'allowed-once' | 'rejected' | 'cancelled' | 'unavailable'
29
+ ```
30
+
31
+ ## Per-session policy
32
+
33
+ `ApprovalPolicy` determines what happens before interactive answerers run. `ask` delegates to the composed answerer chain, whose no-answer default is `unavailable`; `never` deterministically returns `rejected` without dispatching any answerer. The effective value is the last `approval/policy` event in the session log, falling back to the service config. Consumers read it with `ctx.approval.effectivePolicy(session)`; `setApprovalPolicy(session, policy)` is the single write path, so replay reconstructs the override.
34
+
35
+ ```ts type-equiv
36
+ /**
37
+ * A session's approval policy — what happens to an {@link ApprovalService}
38
+ * ask BEFORE any interactive answerer sees it:
39
+ *
40
+ * - `'ask'` (the default) — delegate to the composed answerers; with none
41
+ * composed the chain falls through to the fail-closed `'unavailable'`.
42
+ * - `'never'` — never prompt anyone: every ask resolves `'rejected'`
43
+ * deterministically. The strict headless stance (CI, unattended runs) and
44
+ * the policy whose outcome is knowable without asking.
45
+ */
46
+ type ApprovalPolicy = 'ask' | 'never'
47
+ ```
48
+
49
+ Both policies contribute their complete current meaning to the cache-safe runtime-context snapshot. The sourced `user/message` is the durable model-visible input; changing approval state appends a new full snapshot after retained history without rewriting the request header's system prompt.
50
+
51
+ ## Approval request
52
+
53
+ `ApprovalRequest` identifies the agent and tool action closely enough to route and audit the question. It deliberately omits tool arguments: an answerer attaches the prompt to the already-streamed tool call through `callId` instead of rendering a second copy that could drift.
54
+
55
+ ```ts type-equiv
56
+ /**
57
+ * Readonly same-process permission question. `callId` links to an already
58
+ * presented tool call, so arguments are not duplicated here.
59
+ */
60
+ interface ApprovalRequest extends ApprovalRequestEvent {
61
+ /**
62
+ * The agent on whose behalf the question is asked. Routes the question (a
63
+ * UI answerer only answers for agents it owns) and receives the audit
64
+ * events on its session log.
65
+ */
66
+ readonly agent: Agent
67
+ /** The tool the question is about (presentation and audit). */
68
+ readonly toolName: string
69
+ /**
70
+ * The exact tool call being decided, when the asker has one — lets a UI
71
+ * attach the prompt to the tool call it already streamed.
72
+ */
73
+ readonly callId?: ToolCallId
74
+ /** The asker's human-readable explanation of WHY it is asking. */
75
+ readonly reason?: string
76
+ /**
77
+ * Aborting withdraws the question: the request settles `'cancelled'`
78
+ * immediately and a late answer from a still-pending answerer is discarded.
79
+ */
80
+ readonly signal?: AbortSignal
81
+ }
82
+ ```
83
+
84
+ ## Dispatch and audit
85
+
86
+ `ctx.approval.request(req)` requires the requesting session to be inside an open turn. It appends `approval/asked`, obtains one outcome, appends the matching `approval/decided`, and resolves with that outcome. The `never` policy is enforced inside the service before waterfall dispatch, so even an answerer registered later with `prepend` cannot bypass it. Answerers return an outcome when they own the request or call `next()` to delegate; the first answer occupies the single decision slot.
87
+
88
+ The audit events are log-only and do not enter the model transcript. Model-visible behavior is the caller's derived tool result plus the current runtime-context snapshot. Service disposal removes its context contribution; answerer listeners are independently effect-bound to their owning plugins.
89
+
90
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
91
+
92
+ <a id="cordis-surface"></a>
93
+
94
+ ## Cordis API
95
+
96
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
97
+
98
+ <a id="ctxapproval--approvalservice"></a>
99
+
100
+ ### `ctx.approval` — `ApprovalService`
101
+
102
+ Approval service that applies session policy before answerers and logs every ask/outcome pair to the requesting session. It exposes deterministic policy changes to the model through the runtime-context snapshot and switch notices.
103
+
104
+ ```ts cordis-catalog
105
+ /**
106
+ * Switch one live agent's policy and queue the transition for its next model
107
+ * step. Session initialization uses {@link setApprovalPolicy} directly
108
+ * because there is no previously visible policy to change.
109
+ * @param agent - the live agent whose policy is changing.
110
+ * @param policy - the new effective policy.
111
+ */
112
+ setPolicy(agent: Agent, policy: ApprovalPolicy): void
113
+
114
+ /**
115
+ * Ask the composed answerers to decide one readonly same-process request.
116
+ * The service borrows the request, agent, session, and live signal directly.
117
+ * The request requires an open turn because the audit pair must be enclosed
118
+ * by the durable log's commit/replay boundary; an idle ask rejects before
119
+ * appending anything. The answerer phase always produces an outcome: an
120
+ * aborted signal yields `'cancelled'`, a missing or throwing answerer yields
121
+ * `'unavailable'` (fail closed), and a rogue non-vocabulary return value is
122
+ * normalized to `'unavailable'`. A failure that prevents either audit append
123
+ * from committing still rejects because returning an unlogged decision would
124
+ * violate the pair. Session contains post-commit observer failures, so an
125
+ * authoritative append cannot reject the request or suppress its matching
126
+ * audit event.
127
+ * @param req - the pending decision (agent, tool identity, reason, signal).
128
+ * @returns the closed outcome; `'allowed-once'` is the only grant.
129
+ * @throws when no turn is open or either audit event fails before the session
130
+ * append commit point.
131
+ */
132
+ async request(req: ApprovalRequest): Promise<ApprovalOutcome>
133
+
134
+ /**
135
+ * Read the session override without applying the configured default.
136
+ * @param session - session whose log supplies the override.
137
+ * @returns the last logged policy, or `undefined` without one.
138
+ */
139
+ overrideOf(session: Session): ApprovalPolicy | undefined
140
+ ```
141
+
142
+ Types: [Agent](core.md) · [Session](session.md)
143
+
144
+ Source: [`packages/interaction/user-approval/src/index.ts`](../../packages/interaction/user-approval/src/index.ts)
145
+
146
+ <a id="approval-events"></a>
147
+
148
+ ### `approval/*` events
149
+
150
+ <a id="approvalrequest--waterfall"></a>
151
+
152
+ #### `approval/request` — waterfall
153
+
154
+ Ask composed answerers for one decision. Return an outcome to claim the request or call `next()` to delegate. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent.
155
+
156
+ ```ts cordis-catalog
157
+ /**
158
+ * Ask composed answerers for one decision. Return an outcome to claim the
159
+ * request or call `next()` to delegate. Scope-filtered dispatch
160
+ * (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent.
161
+ * @param req - pending approval request.
162
+ * @mode waterfall
163
+ */
164
+ 'approval/request'( this: Scoped<Agent>, req: ApprovalRequestEvent, next: () => Promise<ApprovalOutcome>, ): Promise<ApprovalOutcome>
165
+ ```
166
+
167
+ Types: [Agent](core.md) · [Scoped](scope.md)
168
+
169
+ Source: [`packages/interaction/user-approval/src/types.ts`](../../packages/interaction/user-approval/src/types.ts)
170
+ <!-- END GENERATED cordis-surface -->
@@ -0,0 +1,170 @@
1
+ # 用户审批
2
+
3
+ [English](approval.md) | 中文
4
+
5
+ [dsh-user-approval](../../packages/interaction/user-approval) 的用户审批 seam 回答一个问题:这个具体操作是否可以继续?它拥有共享的请求/结果词汇、`ctx.approval` 分发服务、`approval/request` 应答者 waterfall(瀑布式事件)、仅记录日志的审计事件对,以及按会话的 `ask`/`never` 策略。UI 通道可以提供人类应答者;[ACP(Agent Client Protocol)自动化桥接层](../../packages/acp/acp)为其拥有的 agent(智能体)提供一次性机器决策。调用方如 [dsh-tools](../../packages/core/tools) 和 [dsh-tool-bash](../../packages/shell/tool-bash) 消费闭合的结果,除非结果为 `allowed-once`,否则一律拒绝。
6
+
7
+ 源码:[`packages/interaction/user-approval/src/index.ts`](../../packages/interaction/user-approval/src/index.ts)
8
+
9
+ ## 标识与结果
10
+
11
+ 每个请求都会获得一个全新的 `ApprovalRequestId`。该品牌类型将 `approval/asked` 与 `approval/decided` 审计事件配对,同时不会让审批 id 与工具调用 id 或 agent/会话 id 互换。
12
+
13
+ ```ts type-equiv
14
+ /**
15
+ * Pairs one `approval/asked` audit event with its `approval/decided`.
16
+ * Service-issued (one fresh id per {@link ApprovalService.request} call).
17
+ */
18
+ type ApprovalRequestId = Branded<'ApprovalRequestId'>
19
+ ```
20
+
21
+ `ApprovalOutcome` 是闭合的,且失败时拒绝。`allowed-once` 仅授权所询问的那一个操作;调用方对 `rejected`、`cancelled` 和 `unavailable` 均执行拒绝。缺失、不负责该请求、抛异常或不合规的应答者会产生 `unavailable`,而非放行。
22
+
23
+ ```ts type-equiv
24
+ /**
25
+ * Closed approval outcomes: a one-shot grant, explicit rejection, withdrawn
26
+ * request, or unavailable answerer. Callers fail closed on `unavailable`.
27
+ */
28
+ type ApprovalOutcome = 'allowed-once' | 'rejected' | 'cancelled' | 'unavailable'
29
+ ```
30
+
31
+ ## 按会话策略
32
+
33
+ `ApprovalPolicy` 决定在交互式应答者运行之前发生什么。`ask` 委托给组合的应答者链,链的无应答默认值为 `unavailable`;`never` 确定性地返回 `rejected`,不分发任何应答者。生效值为会话日志中最后一条 `approval/policy` 事件,回退到服务配置。消费方通过 `ctx.approval.effectivePolicy(session)` 读取;`setApprovalPolicy(session, policy)` 是唯一的写入路径,因此回放能重建覆盖值。
34
+
35
+ ```ts type-equiv
36
+ /**
37
+ * A session's approval policy — what happens to an {@link ApprovalService}
38
+ * ask BEFORE any interactive answerer sees it:
39
+ *
40
+ * - `'ask'` (the default) — delegate to the composed answerers; with none
41
+ * composed the chain falls through to the fail-closed `'unavailable'`.
42
+ * - `'never'` — never prompt anyone: every ask resolves `'rejected'`
43
+ * deterministically. The strict headless stance (CI, unattended runs) and
44
+ * the policy whose outcome is knowable without asking.
45
+ */
46
+ type ApprovalPolicy = 'ask' | 'never'
47
+ ```
48
+
49
+ 两种策略都会将各自完整的当前含义贡献给缓存安全的运行时上下文快照。带来源的 `user/message` 是持久化且模型可见的输入;审批状态变化时,会在保留的历史后追加一份新的完整快照,而不改写请求头中的系统提示词。
50
+
51
+ ## 审批请求
52
+
53
+ `ApprovalRequest` 以足够精确的方式标识 agent 和工具操作,以便路由和审计该问题。它有意省略工具参数:应答者通过 `callId` 将提示附加到已流式输出的工具调用上,而非渲染另一份可能漂移的副本。
54
+
55
+ ```ts type-equiv
56
+ /**
57
+ * Readonly same-process permission question. `callId` links to an already
58
+ * presented tool call, so arguments are not duplicated here.
59
+ */
60
+ interface ApprovalRequest extends ApprovalRequestEvent {
61
+ /**
62
+ * The agent on whose behalf the question is asked. Routes the question (a
63
+ * UI answerer only answers for agents it owns) and receives the audit
64
+ * events on its session log.
65
+ */
66
+ readonly agent: Agent
67
+ /** The tool the question is about (presentation and audit). */
68
+ readonly toolName: string
69
+ /**
70
+ * The exact tool call being decided, when the asker has one — lets a UI
71
+ * attach the prompt to the tool call it already streamed.
72
+ */
73
+ readonly callId?: ToolCallId
74
+ /** The asker's human-readable explanation of WHY it is asking. */
75
+ readonly reason?: string
76
+ /**
77
+ * Aborting withdraws the question: the request settles `'cancelled'`
78
+ * immediately and a late answer from a still-pending answerer is discarded.
79
+ */
80
+ readonly signal?: AbortSignal
81
+ }
82
+ ```
83
+
84
+ ## 分发与审计
85
+
86
+ `ctx.approval.request(req)` 要求发起请求的会话处于一个尚未结束的轮次内。它追加 `approval/asked`,获取一个结果,追加对应的 `approval/decided`,然后以该结果完成。`never` 策略在服务内部、waterfall 分发之前强制执行,因此即使后来以 `prepend` 注册的应答者也无法绕过它。应答者在负责处理该请求时返回结果,否则调用 `next()` 委托;第一个应答占据唯一的决策槽位。
87
+
88
+ 审计事件仅写入日志,不进入模型 transcript(文本记录)。模型可见的行为是调用方派生的工具结果与当前运行时上下文快照。服务 dispose(资源释放)时会移除其上下文贡献;应答者监听器独立地通过 effect 绑定到其所属插件。
89
+
90
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
91
+
92
+ <a id="cordis-surface"></a>
93
+
94
+ ## Cordis API
95
+
96
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
97
+
98
+ <a id="ctxapproval--approvalservice"></a>
99
+
100
+ ### `ctx.approval` — `ApprovalService`
101
+
102
+ Approval service that applies session policy before answerers and logs every ask/outcome pair to the requesting session. It exposes deterministic policy changes to the model through the runtime-context snapshot and switch notices.
103
+
104
+ ```ts cordis-catalog
105
+ /**
106
+ * Switch one live agent's policy and queue the transition for its next model
107
+ * step. Session initialization uses {@link setApprovalPolicy} directly
108
+ * because there is no previously visible policy to change.
109
+ * @param agent - the live agent whose policy is changing.
110
+ * @param policy - the new effective policy.
111
+ */
112
+ setPolicy(agent: Agent, policy: ApprovalPolicy): void
113
+
114
+ /**
115
+ * Ask the composed answerers to decide one readonly same-process request.
116
+ * The service borrows the request, agent, session, and live signal directly.
117
+ * The request requires an open turn because the audit pair must be enclosed
118
+ * by the durable log's commit/replay boundary; an idle ask rejects before
119
+ * appending anything. The answerer phase always produces an outcome: an
120
+ * aborted signal yields `'cancelled'`, a missing or throwing answerer yields
121
+ * `'unavailable'` (fail closed), and a rogue non-vocabulary return value is
122
+ * normalized to `'unavailable'`. A failure that prevents either audit append
123
+ * from committing still rejects because returning an unlogged decision would
124
+ * violate the pair. Session contains post-commit observer failures, so an
125
+ * authoritative append cannot reject the request or suppress its matching
126
+ * audit event.
127
+ * @param req - the pending decision (agent, tool identity, reason, signal).
128
+ * @returns the closed outcome; `'allowed-once'` is the only grant.
129
+ * @throws when no turn is open or either audit event fails before the session
130
+ * append commit point.
131
+ */
132
+ async request(req: ApprovalRequest): Promise<ApprovalOutcome>
133
+
134
+ /**
135
+ * Read the session override without applying the configured default.
136
+ * @param session - session whose log supplies the override.
137
+ * @returns the last logged policy, or `undefined` without one.
138
+ */
139
+ overrideOf(session: Session): ApprovalPolicy | undefined
140
+ ```
141
+
142
+ Types: [Agent](core.zh.md) · [Session](session.zh.md)
143
+
144
+ Source: [`packages/interaction/user-approval/src/index.ts`](../../packages/interaction/user-approval/src/index.ts)
145
+
146
+ <a id="approval-events"></a>
147
+
148
+ ### `approval/*` events
149
+
150
+ <a id="approvalrequest--waterfall"></a>
151
+
152
+ #### `approval/request` — waterfall
153
+
154
+ Ask composed answerers for one decision. Return an outcome to claim the request or call `next()` to delegate. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent.
155
+
156
+ ```ts cordis-catalog
157
+ /**
158
+ * Ask composed answerers for one decision. Return an outcome to claim the
159
+ * request or call `next()` to delegate. Scope-filtered dispatch
160
+ * (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent.
161
+ * @param req - pending approval request.
162
+ * @mode waterfall
163
+ */
164
+ 'approval/request'( this: Scoped<Agent>, req: ApprovalRequestEvent, next: () => Promise<ApprovalOutcome>, ): Promise<ApprovalOutcome>
165
+ ```
166
+
167
+ Types: [Agent](core.zh.md) · [Scoped](scope.zh.md)
168
+
169
+ Source: [`packages/interaction/user-approval/src/types.ts`](../../packages/interaction/user-approval/src/types.ts)
170
+ <!-- END GENERATED cordis-surface -->