dsh-plugin-guide 0.3.15 → 0.3.17

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 (446) hide show
  1. package/README-es.md +43 -40
  2. package/README-hi.md +43 -40
  3. package/README-pt.md +43 -40
  4. package/README-zh.md +43 -40
  5. package/README.md +19 -15
  6. package/dist/dsh-plugin-dev.js +230 -6
  7. package/guide/plugin-dev-guide.md +1 -1
  8. package/guide/release-engineering.md +7 -5
  9. package/guide/release-engineering.zh-CN.md +7 -5
  10. package/guide/unfixed-issues.md +4 -2
  11. package/package.json +5 -4
  12. package/references/official-docs/AGENTS.md +74 -49
  13. package/references/official-docs/README.i18n.yaml +2 -2
  14. package/references/official-docs/README.zh.md +12 -0
  15. package/references/official-docs/SNAPSHOT.md +4 -4
  16. package/references/official-docs/THIRD_PARTY_NOTICES.md +86 -30
  17. package/references/official-docs/docs/AGENTS.md +7 -6
  18. package/references/official-docs/docs/agent-lifecycle.i18n.yaml +2 -2
  19. package/references/official-docs/docs/agent-lifecycle.md +12 -5
  20. package/references/official-docs/docs/agent-lifecycle.zh.md +12 -5
  21. package/references/official-docs/docs/api-gateway.i18n.yaml +2 -2
  22. package/references/official-docs/docs/api-gateway.md +2 -2
  23. package/references/official-docs/docs/api-gateway.zh.md +2 -2
  24. package/references/official-docs/docs/architecture.i18n.yaml +2 -2
  25. package/references/official-docs/docs/architecture.md +26 -12
  26. package/references/official-docs/docs/architecture.zh.md +28 -14
  27. package/references/official-docs/docs/capability-seams.i18n.yaml +2 -2
  28. package/references/official-docs/docs/capability-seams.md +111 -31
  29. package/references/official-docs/docs/capability-seams.zh.md +111 -31
  30. package/references/official-docs/docs/config-catalog.i18n.yaml +2 -2
  31. package/references/official-docs/docs/config-catalog.md +674 -202
  32. package/references/official-docs/docs/config-catalog.zh.md +691 -219
  33. package/references/official-docs/docs/cookbook/adding-a-session-format-version.i18n.yaml +6 -0
  34. package/references/official-docs/docs/cookbook/adding-a-session-format-version.md +111 -0
  35. package/references/official-docs/docs/cookbook/adding-a-session-format-version.zh.md +111 -0
  36. package/references/official-docs/docs/cookbook/adding-a-settings-card.md +8 -8
  37. package/references/official-docs/docs/cookbook/adding-a-settings-card.zh.md +9 -9
  38. package/references/official-docs/docs/cookbook/adding-a-tool.i18n.yaml +2 -2
  39. package/references/official-docs/docs/cookbook/adding-a-tool.md +2 -2
  40. package/references/official-docs/docs/cookbook/adding-a-tool.zh.md +4 -4
  41. package/references/official-docs/docs/cookbook/adding-a-vendored-package.i18n.yaml +2 -2
  42. package/references/official-docs/docs/cookbook/adding-a-vendored-package.md +1 -1
  43. package/references/official-docs/docs/cookbook/adding-a-vendored-package.zh.md +1 -1
  44. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.zh.md +1 -1
  45. package/references/official-docs/docs/cookbook/extension-cookbook.i18n.yaml +2 -2
  46. package/references/official-docs/docs/cookbook/extension-cookbook.md +3 -3
  47. package/references/official-docs/docs/cookbook/extension-cookbook.zh.md +5 -5
  48. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.i18n.yaml +2 -2
  49. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.md +1 -1
  50. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +1 -1
  51. package/references/official-docs/docs/cookbook/reviewing-persistence-type-changes.i18n.yaml +6 -0
  52. package/references/official-docs/docs/cookbook/reviewing-persistence-type-changes.md +108 -0
  53. package/references/official-docs/docs/cookbook/reviewing-persistence-type-changes.zh.md +108 -0
  54. package/references/official-docs/docs/cordis-api/fiber.i18n.yaml +2 -2
  55. package/references/official-docs/docs/cordis-api/fiber.md +3 -3
  56. package/references/official-docs/docs/cordis-api/fiber.zh.md +3 -3
  57. package/references/official-docs/docs/cordis-api/inherited.md +0 -3
  58. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.i18n.yaml +2 -2
  59. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.md +2 -2
  60. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.zh.md +2 -2
  61. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.i18n.yaml +2 -2
  62. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.md +14 -15
  63. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.zh.md +15 -16
  64. package/references/official-docs/docs/dependency-catalog.json +7312 -0
  65. package/references/official-docs/docs/development.i18n.yaml +2 -2
  66. package/references/official-docs/docs/development.md +13 -3
  67. package/references/official-docs/docs/development.zh.md +16 -6
  68. package/references/official-docs/docs/event-producer-consumer.i18n.yaml +2 -2
  69. package/references/official-docs/docs/event-producer-consumer.md +50 -39
  70. package/references/official-docs/docs/event-producer-consumer.zh.md +55 -44
  71. package/references/official-docs/docs/glossary.i18n.yaml +2 -2
  72. package/references/official-docs/docs/glossary.md +1 -1
  73. package/references/official-docs/docs/glossary.zh.md +1 -1
  74. package/references/official-docs/docs/i18n/README.i18n.yaml +2 -2
  75. package/references/official-docs/docs/i18n/README.md +8 -3
  76. package/references/official-docs/docs/i18n/README.zh.md +8 -3
  77. package/references/official-docs/docs/i18n/style-samples.md +1 -1
  78. package/references/official-docs/docs/i18n/translation-prompt.md +5 -5
  79. package/references/official-docs/docs/i18n/translation-rules.zh.md +2 -2
  80. package/references/official-docs/docs/module-graph.i18n.yaml +2 -2
  81. package/references/official-docs/docs/module-graph.md +303 -120
  82. package/references/official-docs/docs/module-graph.zh.md +303 -120
  83. package/references/official-docs/docs/persistence-catalog.i18n.yaml +2 -2
  84. package/references/official-docs/docs/persistence-catalog.md +5699 -64
  85. package/references/official-docs/docs/persistence-catalog.zh.md +5708 -73
  86. package/references/official-docs/docs/persistence-changes/2026-09-11-initial.i18n.yaml +6 -0
  87. package/references/official-docs/docs/persistence-changes/2026-09-11-initial.md +280 -0
  88. package/references/official-docs/docs/persistence-changes/2026-09-11-initial.schema.json +13557 -0
  89. package/references/official-docs/docs/persistence-changes/2026-09-11-initial.zh.md +280 -0
  90. package/references/official-docs/docs/persistence-changes/2026-09-12-auto-review-error-metadata.i18n.yaml +6 -0
  91. package/references/official-docs/docs/persistence-changes/2026-09-12-auto-review-error-metadata.md +52 -0
  92. package/references/official-docs/docs/persistence-changes/2026-09-12-auto-review-error-metadata.schema.json +910 -0
  93. package/references/official-docs/docs/persistence-changes/2026-09-12-auto-review-error-metadata.zh.md +52 -0
  94. package/references/official-docs/docs/persistence-changes/2026-09-14-image-offload.i18n.yaml +6 -0
  95. package/references/official-docs/docs/persistence-changes/2026-09-14-image-offload.md +96 -0
  96. package/references/official-docs/docs/persistence-changes/2026-09-14-image-offload.schema.json +8478 -0
  97. package/references/official-docs/docs/persistence-changes/2026-09-14-image-offload.zh.md +96 -0
  98. package/references/official-docs/docs/persistence-changes/2026-09-14-workspace-changes-event.i18n.yaml +6 -0
  99. package/references/official-docs/docs/persistence-changes/2026-09-14-workspace-changes-event.md +48 -0
  100. package/references/official-docs/docs/persistence-changes/2026-09-14-workspace-changes-event.schema.json +72 -0
  101. package/references/official-docs/docs/persistence-changes/2026-09-14-workspace-changes-event.zh.md +48 -0
  102. package/references/official-docs/docs/persistence-changes/README.i18n.yaml +6 -0
  103. package/references/official-docs/docs/persistence-changes/README.md +74 -0
  104. package/references/official-docs/docs/persistence-changes/README.zh.md +74 -0
  105. package/references/official-docs/docs/persistence-changes/historical-formats/README.i18n.yaml +6 -0
  106. package/references/official-docs/docs/persistence-changes/historical-formats/README.md +74 -0
  107. package/references/official-docs/docs/persistence-changes/historical-formats/README.zh.md +74 -0
  108. package/references/official-docs/docs/persistence-changes/historical-formats/v0.i18n.yaml +6 -0
  109. package/references/official-docs/docs/persistence-changes/historical-formats/v0.md +5105 -0
  110. package/references/official-docs/docs/persistence-changes/historical-formats/v0.schema.json +49308 -0
  111. package/references/official-docs/docs/persistence-changes/historical-formats/v0.zh.md +5105 -0
  112. package/references/official-docs/docs/persistence-changes/historical-formats/v1.i18n.yaml +6 -0
  113. package/references/official-docs/docs/persistence-changes/historical-formats/v1.md +5107 -0
  114. package/references/official-docs/docs/persistence-changes/historical-formats/v1.schema.json +49411 -0
  115. package/references/official-docs/docs/persistence-changes/historical-formats/v1.zh.md +5107 -0
  116. package/references/official-docs/docs/persistence-changes/historical-formats/v2.i18n.yaml +6 -0
  117. package/references/official-docs/docs/persistence-changes/historical-formats/v2.md +5362 -0
  118. package/references/official-docs/docs/persistence-changes/historical-formats/v2.schema.json +56466 -0
  119. package/references/official-docs/docs/persistence-changes/historical-formats/v2.zh.md +5362 -0
  120. package/references/official-docs/docs/persistence-changes/releases/README.i18n.yaml +6 -0
  121. package/references/official-docs/docs/persistence-changes/releases/README.md +103 -0
  122. package/references/official-docs/docs/persistence-changes/releases/README.zh.md +103 -0
  123. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.1.i18n.yaml +6 -0
  124. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.1.md +201 -0
  125. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.1.schema.json +39868 -0
  126. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.1.zh.md +201 -0
  127. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.2.i18n.yaml +6 -0
  128. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.2.md +261 -0
  129. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.2.schema.json +43342 -0
  130. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.2.zh.md +261 -0
  131. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.3.i18n.yaml +6 -0
  132. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.3.md +126 -0
  133. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.3.schema.json +19452 -0
  134. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.3.zh.md +126 -0
  135. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.4.i18n.yaml +6 -0
  136. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.4.md +75 -0
  137. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.4.schema.json +5 -0
  138. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.4.zh.md +75 -0
  139. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.5.i18n.yaml +6 -0
  140. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.5.md +75 -0
  141. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.5.schema.json +5 -0
  142. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.0.1-rc.5.zh.md +75 -0
  143. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.1.i18n.yaml +6 -0
  144. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.1.md +75 -0
  145. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.1.schema.json +5 -0
  146. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.1.zh.md +75 -0
  147. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.2.i18n.yaml +6 -0
  148. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.2.md +75 -0
  149. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.2.schema.json +5 -0
  150. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.2.zh.md +75 -0
  151. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.3.i18n.yaml +6 -0
  152. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.3.md +75 -0
  153. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.3.schema.json +5 -0
  154. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.3.zh.md +75 -0
  155. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.5.i18n.yaml +6 -0
  156. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.5.md +75 -0
  157. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.5.schema.json +5 -0
  158. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.5.zh.md +75 -0
  159. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.6.i18n.yaml +6 -0
  160. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.6.md +75 -0
  161. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.6.schema.json +5 -0
  162. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.6.zh.md +75 -0
  163. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.7.i18n.yaml +6 -0
  164. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.7.md +82 -0
  165. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.7.schema.json +5320 -0
  166. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.7.zh.md +82 -0
  167. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.8.i18n.yaml +6 -0
  168. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.8.md +110 -0
  169. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.8.schema.json +21258 -0
  170. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.0-rc.8.zh.md +110 -0
  171. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.1-rc.1.i18n.yaml +6 -0
  172. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.1-rc.1.md +82 -0
  173. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.1-rc.1.schema.json +417 -0
  174. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.1-rc.1.zh.md +82 -0
  175. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.1-rc.2.i18n.yaml +6 -0
  176. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.1-rc.2.md +119 -0
  177. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.1-rc.2.schema.json +29672 -0
  178. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.1-rc.2.zh.md +119 -0
  179. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.1.i18n.yaml +6 -0
  180. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.1.md +295 -0
  181. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.1.schema.json +48429 -0
  182. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.1.zh.md +295 -0
  183. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.2.i18n.yaml +6 -0
  184. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.2.md +286 -0
  185. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.2.schema.json +49347 -0
  186. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.2.zh.md +286 -0
  187. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.3.i18n.yaml +6 -0
  188. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.3.md +75 -0
  189. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.3.schema.json +5 -0
  190. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.3.zh.md +75 -0
  191. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.4.i18n.yaml +6 -0
  192. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.4.md +95 -0
  193. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.4.schema.json +17642 -0
  194. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.4.zh.md +95 -0
  195. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.5.i18n.yaml +6 -0
  196. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.5.md +75 -0
  197. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.5.schema.json +5 -0
  198. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-alpha.5.zh.md +75 -0
  199. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-rc.1.i18n.yaml +6 -0
  200. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-rc.1.md +75 -0
  201. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-rc.1.schema.json +5 -0
  202. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.2-rc.1.zh.md +75 -0
  203. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.3-alpha.1.i18n.yaml +6 -0
  204. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.3-alpha.1.md +154 -0
  205. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.3-alpha.1.schema.json +38678 -0
  206. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.3-alpha.1.zh.md +154 -0
  207. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.3-alpha.2.i18n.yaml +6 -0
  208. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.3-alpha.2.md +86 -0
  209. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.3-alpha.2.schema.json +783 -0
  210. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.3-alpha.2.zh.md +86 -0
  211. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-alpha.1.i18n.yaml +6 -0
  212. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-alpha.1.md +139 -0
  213. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-alpha.1.schema.json +24597 -0
  214. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-alpha.1.zh.md +139 -0
  215. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-alpha.2.i18n.yaml +6 -0
  216. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-alpha.2.md +95 -0
  217. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-alpha.2.schema.json +2132 -0
  218. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-alpha.2.zh.md +95 -0
  219. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-rc.1.i18n.yaml +6 -0
  220. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-rc.1.md +75 -0
  221. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-rc.1.schema.json +5 -0
  222. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-rc.1.zh.md +75 -0
  223. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-rc.2.i18n.yaml +6 -0
  224. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-rc.2.md +75 -0
  225. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-rc.2.schema.json +5 -0
  226. package/references/official-docs/docs/persistence-changes/releases/dsh-v0.1.5-rc.2.zh.md +75 -0
  227. package/references/official-docs/docs/persistence-changes/releases/manifest.json +162 -0
  228. package/references/official-docs/docs/persistence-schema.json +61480 -0
  229. package/references/official-docs/docs/postmortem/README.i18n.yaml +1 -1
  230. package/references/official-docs/docs/postmortem/README.md +1 -1
  231. package/references/official-docs/docs/postmortem/README.zh.md +1 -1
  232. package/references/official-docs/docs/rescope.i18n.yaml +2 -2
  233. package/references/official-docs/docs/rescope.md +2 -2
  234. package/references/official-docs/docs/rescope.zh.md +2 -2
  235. package/references/official-docs/docs/session-format-status.i18n.yaml +6 -0
  236. package/references/official-docs/docs/session-format-status.md +49 -0
  237. package/references/official-docs/docs/session-format-status.zh.md +49 -0
  238. package/references/official-docs/docs/subsystems/README.i18n.yaml +2 -2
  239. package/references/official-docs/docs/subsystems/README.md +12 -3
  240. package/references/official-docs/docs/subsystems/README.zh.md +23 -14
  241. package/references/official-docs/docs/subsystems/agent-team.i18n.yaml +2 -2
  242. package/references/official-docs/docs/subsystems/agent-team.md +1 -1
  243. package/references/official-docs/docs/subsystems/agent-team.zh.md +2 -2
  244. package/references/official-docs/docs/subsystems/approval.i18n.yaml +2 -2
  245. package/references/official-docs/docs/subsystems/approval.md +1 -1
  246. package/references/official-docs/docs/subsystems/approval.zh.md +1 -1
  247. package/references/official-docs/docs/subsystems/attachment.i18n.yaml +2 -2
  248. package/references/official-docs/docs/subsystems/attachment.md +17 -7
  249. package/references/official-docs/docs/subsystems/attachment.zh.md +17 -7
  250. package/references/official-docs/docs/subsystems/{code-runtime.i18n.yaml → boot.i18n.yaml} +3 -3
  251. package/references/official-docs/docs/subsystems/boot.md +223 -0
  252. package/references/official-docs/docs/subsystems/boot.zh.md +223 -0
  253. package/references/official-docs/docs/subsystems/browser-use.i18n.yaml +6 -0
  254. package/references/official-docs/docs/subsystems/browser-use.md +67 -0
  255. package/references/official-docs/docs/subsystems/browser-use.zh.md +67 -0
  256. package/references/official-docs/docs/subsystems/client-modules.i18n.yaml +2 -2
  257. package/references/official-docs/docs/subsystems/client-modules.md +20 -10
  258. package/references/official-docs/docs/subsystems/client-modules.zh.md +21 -11
  259. package/references/official-docs/docs/subsystems/client-resources.i18n.yaml +6 -0
  260. package/references/official-docs/docs/subsystems/client-resources.md +92 -0
  261. package/references/official-docs/docs/subsystems/client-resources.zh.md +92 -0
  262. package/references/official-docs/docs/subsystems/commands.i18n.yaml +2 -2
  263. package/references/official-docs/docs/subsystems/commands.md +4 -0
  264. package/references/official-docs/docs/subsystems/commands.zh.md +5 -1
  265. package/references/official-docs/docs/subsystems/compaction.i18n.yaml +2 -2
  266. package/references/official-docs/docs/subsystems/compaction.md +48 -2
  267. package/references/official-docs/docs/subsystems/compaction.zh.md +50 -4
  268. package/references/official-docs/docs/subsystems/computer-use.i18n.yaml +6 -0
  269. package/references/official-docs/docs/subsystems/computer-use.md +56 -0
  270. package/references/official-docs/docs/subsystems/computer-use.zh.md +56 -0
  271. package/references/official-docs/docs/subsystems/conversation.zh.md +1 -1
  272. package/references/official-docs/docs/subsystems/core.i18n.yaml +2 -2
  273. package/references/official-docs/docs/subsystems/core.md +106 -60
  274. package/references/official-docs/docs/subsystems/core.zh.md +109 -63
  275. package/references/official-docs/docs/subsystems/deliverables.i18n.yaml +6 -0
  276. package/references/official-docs/docs/subsystems/deliverables.md +178 -0
  277. package/references/official-docs/docs/subsystems/deliverables.zh.md +178 -0
  278. package/references/official-docs/docs/subsystems/extensions.zh.md +1 -1
  279. package/references/official-docs/docs/subsystems/feedback.i18n.yaml +2 -2
  280. package/references/official-docs/docs/subsystems/feedback.md +165 -31
  281. package/references/official-docs/docs/subsystems/feedback.zh.md +165 -31
  282. package/references/official-docs/docs/subsystems/filesystem.i18n.yaml +2 -2
  283. package/references/official-docs/docs/subsystems/filesystem.md +15 -0
  284. package/references/official-docs/docs/subsystems/filesystem.zh.md +16 -1
  285. package/references/official-docs/docs/subsystems/goal.i18n.yaml +2 -2
  286. package/references/official-docs/docs/subsystems/goal.md +37 -1
  287. package/references/official-docs/docs/subsystems/goal.zh.md +38 -2
  288. package/references/official-docs/docs/subsystems/invariants.i18n.yaml +2 -2
  289. package/references/official-docs/docs/subsystems/invariants.md +1 -1
  290. package/references/official-docs/docs/subsystems/invariants.zh.md +3 -3
  291. package/references/official-docs/docs/subsystems/jobs.i18n.yaml +1 -1
  292. package/references/official-docs/docs/subsystems/jobs.md +1 -1
  293. package/references/official-docs/docs/subsystems/jobs.zh.md +1 -1
  294. package/references/official-docs/docs/subsystems/llm-streaming.i18n.yaml +2 -2
  295. package/references/official-docs/docs/subsystems/llm-streaming.md +35 -15
  296. package/references/official-docs/docs/subsystems/llm-streaming.zh.md +37 -17
  297. package/references/official-docs/docs/subsystems/lsp.i18n.yaml +2 -2
  298. package/references/official-docs/docs/subsystems/lsp.md +1 -1
  299. package/references/official-docs/docs/subsystems/lsp.zh.md +1 -1
  300. package/references/official-docs/docs/subsystems/mcp.i18n.yaml +6 -0
  301. package/references/official-docs/docs/subsystems/mcp.md +139 -0
  302. package/references/official-docs/docs/subsystems/mcp.zh.md +139 -0
  303. package/references/official-docs/docs/subsystems/office-to-pdf.i18n.yaml +6 -0
  304. package/references/official-docs/docs/subsystems/office-to-pdf.md +87 -0
  305. package/references/official-docs/docs/subsystems/office-to-pdf.zh.md +87 -0
  306. package/references/official-docs/docs/subsystems/permission-presets.i18n.yaml +2 -2
  307. package/references/official-docs/docs/subsystems/permission-presets.md +62 -27
  308. package/references/official-docs/docs/subsystems/permission-presets.zh.md +62 -27
  309. package/references/official-docs/docs/subsystems/persistence.i18n.yaml +2 -2
  310. package/references/official-docs/docs/subsystems/persistence.md +36 -15
  311. package/references/official-docs/docs/subsystems/persistence.zh.md +36 -15
  312. package/references/official-docs/docs/subsystems/plan.zh.md +2 -2
  313. package/references/official-docs/docs/subsystems/ptc-runtime.i18n.yaml +6 -0
  314. package/references/official-docs/docs/subsystems/ptc-runtime.md +232 -0
  315. package/references/official-docs/docs/subsystems/ptc-runtime.zh.md +232 -0
  316. package/references/official-docs/docs/subsystems/sandbox.i18n.yaml +2 -2
  317. package/references/official-docs/docs/subsystems/sandbox.md +5 -4
  318. package/references/official-docs/docs/subsystems/sandbox.zh.md +7 -6
  319. package/references/official-docs/docs/subsystems/schedule.i18n.yaml +2 -2
  320. package/references/official-docs/docs/subsystems/schedule.md +2 -2
  321. package/references/official-docs/docs/subsystems/schedule.zh.md +3 -3
  322. package/references/official-docs/docs/subsystems/scope.i18n.yaml +2 -2
  323. package/references/official-docs/docs/subsystems/scope.md +1 -1
  324. package/references/official-docs/docs/subsystems/scope.zh.md +1 -1
  325. package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +2 -2
  326. package/references/official-docs/docs/subsystems/session-projection.md +1 -1
  327. package/references/official-docs/docs/subsystems/session-projection.zh.md +2 -2
  328. package/references/official-docs/docs/subsystems/session-reference.i18n.yaml +2 -2
  329. package/references/official-docs/docs/subsystems/session-reference.md +11 -6
  330. package/references/official-docs/docs/subsystems/session-reference.zh.md +11 -6
  331. package/references/official-docs/docs/subsystems/session-telemetry.i18n.yaml +2 -2
  332. package/references/official-docs/docs/subsystems/session-telemetry.md +22 -6
  333. package/references/official-docs/docs/subsystems/session-telemetry.zh.md +23 -7
  334. package/references/official-docs/docs/subsystems/session-title.i18n.yaml +2 -2
  335. package/references/official-docs/docs/subsystems/session-title.md +5 -5
  336. package/references/official-docs/docs/subsystems/session-title.zh.md +5 -5
  337. package/references/official-docs/docs/subsystems/session.i18n.yaml +2 -2
  338. package/references/official-docs/docs/subsystems/session.md +149 -61
  339. package/references/official-docs/docs/subsystems/session.zh.md +150 -62
  340. package/references/official-docs/docs/subsystems/shell.i18n.yaml +2 -2
  341. package/references/official-docs/docs/subsystems/shell.md +19 -15
  342. package/references/official-docs/docs/subsystems/shell.zh.md +20 -16
  343. package/references/official-docs/docs/subsystems/sidebar-right.i18n.yaml +6 -0
  344. package/references/official-docs/docs/subsystems/sidebar-right.md +153 -0
  345. package/references/official-docs/docs/subsystems/sidebar-right.zh.md +153 -0
  346. package/references/official-docs/docs/subsystems/skills.i18n.yaml +2 -2
  347. package/references/official-docs/docs/subsystems/skills.md +4 -6
  348. package/references/official-docs/docs/subsystems/skills.zh.md +4 -6
  349. package/references/official-docs/docs/subsystems/slots.i18n.yaml +2 -2
  350. package/references/official-docs/docs/subsystems/slots.md +52 -38
  351. package/references/official-docs/docs/subsystems/slots.zh.md +53 -39
  352. package/references/official-docs/docs/subsystems/spill.i18n.yaml +2 -2
  353. package/references/official-docs/docs/subsystems/spill.md +13 -6
  354. package/references/official-docs/docs/subsystems/spill.zh.md +13 -6
  355. package/references/official-docs/docs/subsystems/ssh.i18n.yaml +6 -0
  356. package/references/official-docs/docs/subsystems/ssh.md +135 -0
  357. package/references/official-docs/docs/subsystems/ssh.zh.md +135 -0
  358. package/references/official-docs/docs/subsystems/storage.zh.md +2 -2
  359. package/references/official-docs/docs/subsystems/subagent.i18n.yaml +2 -2
  360. package/references/official-docs/docs/subsystems/subagent.md +33 -16
  361. package/references/official-docs/docs/subsystems/subagent.zh.md +32 -15
  362. package/references/official-docs/docs/subsystems/subprocess.i18n.yaml +2 -2
  363. package/references/official-docs/docs/subsystems/subprocess.md +41 -44
  364. package/references/official-docs/docs/subsystems/subprocess.zh.md +41 -44
  365. package/references/official-docs/docs/subsystems/system-prompt.i18n.yaml +2 -2
  366. package/references/official-docs/docs/subsystems/system-prompt.md +6 -2
  367. package/references/official-docs/docs/subsystems/system-prompt.zh.md +7 -3
  368. package/references/official-docs/docs/subsystems/todo.zh.md +1 -1
  369. package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +2 -2
  370. package/references/official-docs/docs/subsystems/token-meter.md +2 -1
  371. package/references/official-docs/docs/subsystems/token-meter.zh.md +2 -1
  372. package/references/official-docs/docs/subsystems/tools.i18n.yaml +2 -2
  373. package/references/official-docs/docs/subsystems/tools.md +28 -12
  374. package/references/official-docs/docs/subsystems/tools.zh.md +28 -12
  375. package/references/official-docs/docs/subsystems/typert.i18n.yaml +2 -2
  376. package/references/official-docs/docs/subsystems/typert.md +6 -5
  377. package/references/official-docs/docs/subsystems/typert.zh.md +6 -5
  378. package/references/official-docs/docs/subsystems/user-questions.i18n.yaml +2 -2
  379. package/references/official-docs/docs/subsystems/user-questions.md +2 -0
  380. package/references/official-docs/docs/subsystems/user-questions.zh.md +2 -0
  381. package/references/official-docs/docs/subsystems/web-client.i18n.yaml +2 -2
  382. package/references/official-docs/docs/subsystems/web-client.md +5 -5
  383. package/references/official-docs/docs/subsystems/web-client.zh.md +6 -6
  384. package/references/official-docs/docs/subsystems/web-server.i18n.yaml +2 -2
  385. package/references/official-docs/docs/subsystems/web-server.md +64 -0
  386. package/references/official-docs/docs/subsystems/web-server.zh.md +65 -1
  387. package/references/official-docs/docs/subsystems/webhook.i18n.yaml +1 -1
  388. package/references/official-docs/docs/subsystems/webhook.md +2 -2
  389. package/references/official-docs/docs/subsystems/workflow.i18n.yaml +2 -2
  390. package/references/official-docs/docs/subsystems/workflow.md +8 -8
  391. package/references/official-docs/docs/subsystems/workflow.zh.md +10 -10
  392. package/references/official-docs/docs/subsystems/workspace.i18n.yaml +2 -2
  393. package/references/official-docs/docs/subsystems/workspace.md +199 -1
  394. package/references/official-docs/docs/subsystems/workspace.zh.md +199 -1
  395. package/references/official-docs/docs/testing.i18n.yaml +2 -2
  396. package/references/official-docs/docs/testing.md +5 -4
  397. package/references/official-docs/docs/testing.zh.md +5 -4
  398. package/references/official-docs/docs/tool-catalog.i18n.yaml +2 -2
  399. package/references/official-docs/docs/tool-catalog.md +452 -187
  400. package/references/official-docs/docs/tool-catalog.zh.md +454 -189
  401. package/references/official-docs/docs/tool-execution-pipeline.i18n.yaml +2 -2
  402. package/references/official-docs/docs/tool-execution-pipeline.md +2 -2
  403. package/references/official-docs/docs/tool-execution-pipeline.zh.md +2 -2
  404. package/references/official-docs/docs/user/develop/basic/index.zh.md +1 -1
  405. package/references/official-docs/docs/user/develop/basic/publish.i18n.yaml +2 -2
  406. package/references/official-docs/docs/user/develop/basic/publish.md +2 -2
  407. package/references/official-docs/docs/user/develop/basic/publish.zh.md +5 -5
  408. package/references/official-docs/docs/user/develop/framework/index.i18n.yaml +2 -2
  409. package/references/official-docs/docs/user/develop/framework/index.md +1 -1
  410. package/references/official-docs/docs/user/develop/framework/index.zh.md +1 -1
  411. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.i18n.yaml +2 -2
  412. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.md +8 -8
  413. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.zh.md +8 -8
  414. package/references/official-docs/docs/user/guide/index.zh.md +2 -2
  415. package/references/official-docs/docs/user/guide/mcp-memory.zh.md +1 -1
  416. package/references/official-docs/docs/user/guide/network-proxy.i18n.yaml +2 -2
  417. package/references/official-docs/docs/user/guide/network-proxy.md +1 -1
  418. package/references/official-docs/docs/user/guide/network-proxy.zh.md +1 -1
  419. package/references/official-docs/docs/user/guide/providers.i18n.yaml +2 -2
  420. package/references/official-docs/docs/user/guide/providers.md +12 -8
  421. package/references/official-docs/docs/user/guide/providers.zh.md +14 -10
  422. package/references/official-docs/docs/user/guide/python-sdk.i18n.yaml +2 -2
  423. package/references/official-docs/docs/user/guide/python-sdk.md +59 -23
  424. package/references/official-docs/docs/user/guide/python-sdk.zh.md +60 -24
  425. package/references/official-docs/docs/web-styling.i18n.yaml +2 -2
  426. package/references/official-docs/docs/web-styling.md +2 -1
  427. package/references/official-docs/docs/web-styling.zh.md +3 -2
  428. package/references/official-docs/packages/AGENTS.md +1 -1
  429. package/references/official-docs/packages/README.md +12 -7
  430. package/references/official-docs/vendor/README.md +15 -11
  431. package/references/official-docs/website-docs.ts +4 -2
  432. package/scripts/sync-official-docs.ps1 +5 -5
  433. package/templates/js/README-es.md +1 -1
  434. package/templates/js/README-hi.md +1 -1
  435. package/templates/js/README-pt.md +1 -1
  436. package/templates/js/README-zh.md +1 -1
  437. package/templates/js/README.md +1 -1
  438. package/templates/js/package.json +2 -2
  439. package/templates/ts/README-es.md +1 -1
  440. package/templates/ts/README-hi.md +1 -1
  441. package/templates/ts/README-pt.md +1 -1
  442. package/templates/ts/README-zh.md +1 -1
  443. package/templates/ts/README.md +1 -1
  444. package/templates/ts/package.json +2 -2
  445. package/references/official-docs/docs/subsystems/code-runtime.md +0 -195
  446. package/references/official-docs/docs/subsystems/code-runtime.zh.md +0 -195
@@ -53,6 +53,19 @@ interface SessionEventMap {
53
53
  * project their `content` verbatim; `source` tells them apart.
54
54
  */
55
55
  'user/message': UserMessage
56
+ /**
57
+ * The rendered system prompt on the model-visible surface. The loop appends
58
+ * the first one as surface node 0 before the step's first `user/message`.
59
+ * A prepared in-history route can append nonempty changes in a continuing
60
+ * series. An incapable route or new series normalizes text to the first system
61
+ * node. Normalization empties nonempty later nodes, then rewrites the head if
62
+ * needed, through logged per-node replacements. An empty rendering always
63
+ * clears all active system nodes, leaving no older instructions model-visible.
64
+ * Empty later nodes are dormant and project to no message; an empty head with
65
+ * no active later node records "no system prompt". Restored nonempty text follows
66
+ * the same route and series rule; empty nodes never restore older text.
67
+ */
68
+ 'system/message': { turn: number; step: number; message: SystemMessage }
56
69
  /**
57
70
  * Assembled assistant message for one step (derived history uses this).
58
71
  * Carries the step's `usage` when the adapter reported token accounting, so
@@ -86,7 +99,9 @@ interface SessionEventMap {
86
99
  'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string }
87
100
  /**
88
101
  * A completed tool call's model-facing result, optional internal failure
89
- * identity, and optional tool-private `meta` presentation payload. `meta` is
102
+ * identity and user-facing reason, and optional tool-private `meta`
103
+ * presentation payload. The reason remains outside the model-facing message.
104
+ * `meta` is
90
105
  * opaque to the core (the producing tool owns its shape and reads it back in
91
106
  * `presentResult`) but MUST be JSON-serializable: `Session.append`
92
107
  * runtime-validates all event data with `isJsonValue`, so a non-serializable
@@ -99,7 +114,11 @@ interface SessionEventMap {
99
114
  turn: number
100
115
  step: number
101
116
  message: ToolResultMessage
102
- error?: { name: string; code: string }
117
+ /**
118
+ * Optional failure identity and raw user-facing reason, outside model content;
119
+ * allowed only when the tool-result block has `isError: true`.
120
+ */
121
+ error?: { name: string; code: string; reason?: string }
103
122
  meta?: JsonValue
104
123
  }
105
124
  /**
@@ -113,8 +132,10 @@ interface SessionEventMap {
113
132
  startsSeries?: true
114
133
  }
115
134
  /**
116
- * Route metadata for the next request, logged only when the route or capacity
117
- * changes. It does not participate in request reconstruction or header equality.
135
+ * Route metadata for the next request, logged only when the route, capacity,
136
+ * or system prompt update mode changes. It does not participate in request
137
+ * reconstruction or header equality. Prompt admission uses the bound prepared
138
+ * call's capability, not this snapshot from an earlier request.
118
139
  */
119
140
  'request/context': RequestContext
120
141
  /**
@@ -149,12 +170,13 @@ interface SessionEventMap {
149
170
 
150
171
  ### 请求头事件:`request/header`
151
172
 
152
- 请求信封(即 `EpochHeader`:调用配置 + 适配器所提供默认值的标记 + 渲染后的系统提示词 + 已组装的工具 schema)会作为会话状态写入日志,因此每个对话请求都是日志的纯函数(见可重建性 Agent Note)。带有 reason `'initial'` 或 `'resume'` 的完整 `request/header` 快照记录每个 agent loop 实例的边界;请求变化时会追加 reason 为 `'change'` 的快照;未变的信封显式开启消息序列或跟随 surface 替换时,会追加 reason 为 `'series'` 的快照。如果发生变化的快照所属请求同时开启序列,它会携带 `startsSeries: true`。普通的仅追加后续 Turn,以及同一模型消息序列内的后续 Step 与重试沿用最新快照。`foldRequestHeader(events)` 通过选择最新快照重建请求头。该事件不是 `SurfaceEventType`,不产生 LLM 消息。
173
+ 请求信封(即 `EpochHeader`:调用配置 + 适配器所提供默认值的标记 + 已组装的工具 schema)会作为会话状态写入日志,因此每个对话请求都是日志的纯函数(见可重建性 Agent Note)。渲染后的系统提示词不属于请求头:它是派生历史,即 surface 第 0 号节点上的 `system/message` 事件以及任何后续的历史内系统节点([决策](../../.agents/notes/implemented/architecture/2026-09-02-system-prompt-as-surface-node.zh.md)),因此提示词变更替换或追加一个系统节点,而请求头保持不变。带有 reason `'initial'` 或 `'resume'` 的完整 `request/header` 快照记录每个 agent loop 实例的边界;请求变化时会追加 reason 为 `'change'` 的快照;未变的信封显式开启消息序列或跟随 surface 替换时,会追加 reason 为 `'series'` 的快照。如果发生变化的快照所属请求同时开启序列,它会携带 `startsSeries: true`。普通的仅追加后续 Turn,以及同一模型消息序列内的后续 Step 与重试沿用最新快照。`foldRequestHeader(events)` 通过选择最新快照重建请求头。该事件不是 `SurfaceEventType`,不产生 LLM 消息。
153
174
 
154
175
  ```ts type-equiv
155
176
  /**
156
- * Logged request state outside derived history: call config, system prompt, and
157
- * tools. The latest full `request/header` snapshot reconstructs it; canonical
177
+ * Logged request state outside derived history: call config and tools. The
178
+ * system prompt is derived history — surface node 0, a `system/message` event.
179
+ * The latest full `request/header` snapshot reconstructs the header; canonical
158
180
  * empty optional fields are absent.
159
181
  */
160
182
  interface EpochHeader {
@@ -162,18 +184,16 @@ interface EpochHeader {
162
184
  config: LlmCallConfig
163
185
  /** Effective config fields materialized from the exact adapter rather than proposed by a caller. */
164
186
  adapterDefaults?: LlmCallConfigAdapterDefaults
165
- /** Rendered system prompt text; absent for a system-less request. */
166
- system?: string
167
187
  /** Assembled tool schemas; absent for a tool-less request. */
168
188
  tools?: ToolSchema[]
169
189
  }
170
190
  ```
171
191
 
172
- 规范形式:空系统提示词和空工具列表都表示为字段缺失,与请求构建方式一致。包含旧版 `request/header-delta` 事件或完整快照原因为 `fallback` 的旧版 v0 日志,会在 seed、append 和持久化加载边界被拒绝,而不会以不完整方式回放。
192
+ 当前事件接纳要求 `request/header.header` 为规范形式:禁止任何 `system` 字段,必须省略 `tools: []` 与 `adapterDefaults: {}`。仅含空白的系统消息内容、`config.stop: []` 与嵌套扩展保持不变。seed、append 与当前持久化读取拒绝非规范 header,而不会静默规范化;[V3 信封决策](../../.agents/notes/implemented/architecture/2026-09-06-v3-canonical-session-envelopes.zh.md)负责历史转换。包含旧版 `request/header-delta` 事件或完整快照原因为 `fallback` 的旧版 v0 日志,会被拒绝,而不会以不完整方式回放。
173
193
 
174
194
  ### 路由容量事件:`request/context`
175
195
 
176
- 请求所解析到的路由的上下文元数据是独立的已记录状态,在同一步骤内紧随 `request/header` 追加,且仅在提供方、模型或容量与上一条记录不同时追加。它保持在 `EpochHeader` 之外,因为该类型是 `headerEquals` 逐字段比较的重建约定。容量描述的是路由,不是请求输入,把它折叠进去会让一次容量变化被登记为请求信封的 `change`,也会把适配器元数据拉进 loop 的重建不变式。与 `request/header` 一样,它不是 `SurfaceEventType`,也不产生 LLM 消息。`session.requestContext()` 以增量方式归并最新一条记录。适配器不公布容量的路由会以缺失 `contextWindow` 的形式记录,因此新记录可以清除较早路由的容量。
196
+ 请求所解析到的路由的上下文元数据是独立的已记录状态,在同一步骤内紧随 `request/header` 追加,且仅在提供方、模型、容量或 `systemPromptUpdate` 模式与上一条记录不同时追加。它保持在 `EpochHeader` 之外,因为该类型是 `headerEquals` 逐字段比较的重建约定。容量与更新模式描述的是路由,不是请求输入,把它们折叠进去会让一次路由变化被登记为请求信封的 `change`,也会把适配器元数据拉进 loop 的重建不变式。与 `request/header` 一样,它不是 `SurfaceEventType`,也不产生 LLM 消息。`session.requestContext()` 以增量方式归并最新一条记录;agent loop 在决定变化后的系统提示词是替换最新的系统节点还是追加到已缓存历史之后时,读取该记录的 `systemPromptUpdate`([决策规则](../../packages/core/agent-loop/README.zh.md#understand-the-implementation))。适配器不公布容量的路由会以缺失 `contextWindow` 的形式记录,因此新记录可以清除较早路由的容量;未声明更新模式的路由同样会清除较早路由的 `systemPromptUpdate`。
177
197
 
178
198
  ```ts type-equiv
179
199
  /** Registration-bound metadata for one resolved model route. */
@@ -184,6 +204,8 @@ interface RequestContext {
184
204
  model: string
185
205
  /** Maximum combined request and response context in tokens, when advertised. */
186
206
  contextWindow?: number
207
+ /** `'in-history'` when the route reads the latest `system` message at any position as the effective system prompt. */
208
+ systemPromptUpdate?: SystemPromptUpdate
187
209
  }
188
210
  ```
189
211
 
@@ -221,7 +243,7 @@ type OptionalSessionSeq = SessionSeq | null
221
243
  * unions), so `switch (event.type)` narrows `event.data` without casts.
222
244
  *
223
245
  * The {@link sourceEventSeqs} and {@link surfaceOp} fields are conditional:
224
- * they only exist on {@link SurfaceEventType} variants (`user/message`,
246
+ * they only exist on {@link SurfaceEventType} variants (`system/message`, `user/message`,
225
247
  * `assistant/message`, `tool/result`).
226
248
  * Non-surface events (boundary markers, attempts, errors) never carry
227
249
  * surface metadata — the compiler enforces this at `Session.append()`
@@ -246,28 +268,22 @@ type SessionEvent<T extends SessionEventType = SessionEventType> = {
246
268
  * inconvenience) rather than silently resuming a gutted session.
247
269
  */
248
270
  ignorable?: true
249
- } & (K extends SurfaceEventType ? {
250
- /**
251
- * Seq numbers of earlier events that this event cites as sources, such as
252
- * the surface nodes shadowed by a compaction replacement. A v2
253
- * `assistant/message` embeds its provider stream and cannot carry this field.
254
- */
255
- sourceEventSeqs?: SessionSeq[]
256
- /** How this event entered the surface; absent for non-surface events. */
257
- surfaceOp?: SurfaceOp
258
- } : object)
271
+ } & (K extends SurfaceEventType ? SurfaceIntent<K> : {
272
+ surfaceOp?: never
273
+ sourceEventSeqs?: never
274
+ })
259
275
  }[T]
260
276
  ```
261
277
 
262
278
  `SessionEventType = keyof SessionEventMap`。由于 `SessionEventMap` 可通过合并扩展,对 `SessionEvent` 的 switch 语句禁止使用 `assertNever`:插件添加的变体是合法的未知值;处理已知 case 后在 `default` 中放行。
263
279
 
264
- V2 `assistant/message` 嵌入 provider stream,不能携带 `sourceEventSeqs`。User 与 tool surface event 可以在 provenance replacement operation 需要时引用完整且非空的唯一较早 event 集合。
280
+ 每个 surface 事件都要求 `surfaceOp`;已知仅日志事件禁止两个 surface 元数据字段。原生未知或已退役的可忽略信封保持不透明。`assistant/message` 嵌入其提供方 stream,并禁止 `sourceEventSeqs`。System、user 与 tool surface 事件可以在来源归属或替换覆盖需要时引用完整、非空且唯一的较早事件集合。`tool/result` 仅在工具结果块带有 `isError: true` 时可以携带 `data.error`;失败结果的失败身份仍可省略。
265
281
 
266
282
  <a id="surface-types"></a>
267
283
 
268
284
  ## Surface 类型
269
285
 
270
- 三种产生消息的类型(`SurfaceEventType`:`user/message`、`assistant/message`、`tool/result`)携带 surface 元数据,用来声明它们如何加入有序的派生 surface。见 [session surface Agent Note](../../.agents/notes/implemented/architecture/2026-06-18-session-surface.zh.md)。
286
+ 四种产生消息的类型(`SurfaceEventType`:`system/message`、`user/message`、`assistant/message`、`tool/result`)携带 surface 元数据,用来声明它们如何加入有序的派生 surface。`system/message` 承载渲染后的系统提示词:循环把第一条追加为 surface 第 0 号节点,并在提示词变化时恰好替换最新的系统节点,或在历史内路由上追加一条新的;surface 折叠拒绝任何其他覆盖第 0 号节点 `system/message` 的替换,而后续系统节点是普通历史,压缩替换可以遮蔽它。见 [session surface Agent Note](../../.agents/notes/implemented/architecture/2026-06-18-session-surface.zh.md)。
271
287
 
272
288
  ### `SurfaceEventType`:事件类型中产生消息的子集
273
289
 
@@ -275,10 +291,11 @@ V2 `assistant/message` 嵌入 provider stream,不能携带 `sourceEventSeqs`
275
291
  /**
276
292
  * The subset of {@link SessionEventType} values whose events produce LLM
277
293
  * messages and are eligible to appear on the ordered surface. Only these
278
- * event types may carry {@link SurfaceOp}; user and tool events may also cite
294
+ * event types may carry {@link SurfaceOp}; system, user, and tool events may also cite
279
295
  * earlier sources through {@link SessionEvent.sourceEventSeqs}.
280
296
  */
281
297
  type SurfaceEventType =
298
+ | 'system/message'
282
299
  | 'user/message'
283
300
  | 'assistant/message'
284
301
  | 'tool/result'
@@ -293,19 +310,19 @@ type SurfaceEventType =
293
310
  *
294
311
  * - `'append'`: added to the tail — normal path for user/assistant/tool
295
312
  * messages.
296
- * - `{ op: 'replace', start, end }`: replaces surface nodes from `start`
297
- * (inclusive) through `end` (inclusive) with this node. Both must exist as
298
- * surface nodes in the current surface. `start === end` replaces a single
313
+ * - `{ op: 'replace', startSeq, endSeq }`: replaces surface nodes from `startSeq`
314
+ * (inclusive) through `endSeq` (inclusive) with this node. Both must exist as
315
+ * surface nodes in the current surface. `startSeq === endSeq` replaces a single
299
316
  * node. The node's {@link SessionEvent.sourceEventSeqs} must include every
300
317
  * shadowed surface node. Used by compaction; any surface-replacing producer
301
318
  * may use it.
302
319
  */
303
320
  type SurfaceOp =
304
321
  | 'append'
305
- | { op: 'replace'; start: SessionSeq; end: SessionSeq }
322
+ | { op: 'replace'; startSeq: SessionSeq; endSeq: SessionSeq }
306
323
  ```
307
324
 
308
- `'append'` 是常规的尾部追加路径。`replace` 会遮蔽从 `start` `end`(含两端)的 surface 条目(两者都必须是有效的 surface seq;`start === end` 时仅替换单个条目),并在原位置插入新事件。
325
+ `'append'` 是常规的尾部追加路径。`replace` 恰好包含 `op`、`startSeq` `endSeq`,不接受别名或额外键。它遮蔽这两个当前 surface 事件序号之间的闭区间,并在原位置插入新事件;相同端点仅替换一个条目。端点必须早于替换事件,但它们的相对顺序按 surface 顺序而非数值序号顺序确定。
309
326
 
310
327
  ### `SurfaceIntent`:`session.append()` 的参数
311
328
 
@@ -317,7 +334,7 @@ type SurfaceOp =
317
334
  type SurfaceIntent<T extends SurfaceEventType = SurfaceEventType> = {
318
335
  surfaceOp: SurfaceOp
319
336
  } & (T extends 'assistant/message' ? {
320
- /** V2 Assistant messages embed their provider stream instead of citing source events. */
337
+ /** Assistant messages embed their provider stream instead of citing source events. */
321
338
  sourceEventSeqs?: never
322
339
  } : {
323
340
  /** Complete non-empty set of known earlier source-event seqs. */
@@ -325,15 +342,51 @@ type SurfaceIntent<T extends SurfaceEventType = SurfaceEventType> = {
325
342
  })
326
343
  ```
327
344
 
328
- 对 `SurfaceEventType` 事件必填:每个产生消息的事件都必须声明它如何加入 surface(派生模型历史的唯一来源)。面向人类的 transcript(文本记录)是另一个投影,读取的是日志中追加来源的事件,因为 surface 会有意遮蔽替换所概括的范围(见 [dsh-session](../../packages/core/session/README-zh.md) 的 `isAppendSurfaceEvent`)。非 surface 类型在编译期拒绝此参数。
345
+ 对 `SurfaceEventType` 事件必填:每个产生消息的事件都必须声明它如何加入 surface(派生模型历史的唯一来源)。面向人类的 transcript(文本记录)是另一个投影,读取的是日志中追加来源的事件,因为 surface 会有意遮蔽替换所概括的范围(见 [dsh-session](../../packages/core/session/README.zh.md) 的 `isAppendSurfaceEvent`)。非 surface 类型在编译期拒绝此参数。
329
346
 
330
347
  `assistant/message` 不能携带 `sourceEventSeqs`;它的 `stream` 拥有精确 provider 证据。其他 surface event 不引用较早 event 时省略该字段,需要引用时使用完整非空 list。
331
348
 
349
+ <a id="plugin-owned-message-projections"></a>
350
+ ### 插件拥有的消息投影
351
+
352
+ 修改内容的插件用 `@messageProjection` 标记事件声明,并通过 `ctx.sessions.registerMessageProjection()` 注册纯处理器。Session 在提交前通过处理器校验完整决策,应用其不可变消息更新,并推进 `contentGeneration`。缺少处理器时拒绝操作,包括恢复和独立折叠,卸载已经使用的处理器后也会拒绝读取缓存。独立读取器将处理器显式传给 `foldSurface(events, projections)`,并通过 `deriveEventMessage()` 应用 `projectedMessages`。当前格式目录为离线读取器装配第一方处理器。[图片省略插件](compaction.zh.md#image-offload)拥有图片专用的事件及解释逻辑。
353
+
354
+ ```ts type-equiv
355
+ /** Readonly history immediately before a message-projection event. */
356
+ interface SessionMessageProjectionContext {
357
+ /** Current message-producing event sequences in model-visible order. */
358
+ nodes: readonly SessionSeq[]
359
+ /** Contiguous event window; entries at or beyond the candidate seq are not committed inputs. */
360
+ events: readonly SessionEvent[]
361
+ /** Absolute sequence of the window's first event. */
362
+ baseSeq: SessionLogOffset
363
+ /** Previously projected messages keyed by their original event sequences. */
364
+ messages: ReadonlyMap<SessionSeq, Message>
365
+ }
366
+ ```
367
+
368
+ ```ts type-equiv
369
+ /** Pure interpretation of one plugin-owned event that changes existing message content. */
370
+ interface SessionMessageProjection<T extends SessionEventType = SessionEventType> {
371
+ /** Event interpreted by this definition; declare it with `@messageProjection` in SessionEventMap. */
372
+ type: T
373
+ /**
374
+ * Validate the complete durable decision before returning any updates. Preserve
375
+ * message identities and publish immutable copies without mutating the input.
376
+ * @param event - candidate event, not yet applied to the supplied history.
377
+ * @param context - history preceding this decision.
378
+ * @returns changed current messages keyed by their original sequences.
379
+ * @throws when the durable decision cannot be applied to this history.
380
+ */
381
+ project(event: SessionEvent<T>, context: SessionMessageProjectionContext): ReadonlyMap<SessionSeq, Message>
382
+ }
383
+ ```
384
+
332
385
  ### `SessionSurface`:实时只读 surface 投影
333
386
 
334
387
  `Session.surface` 返回会话稳定的 `SessionSurface` 视图。同一个增量管理器在提交前校验追加候选事件,并根据已提交事件推进该投影;调用方可以观察成员关系和替换代次,但不能调用校验。
335
388
 
336
- `SurfaceManager(log, baseSeq?)` 也可以折叠一个连续的已加载窗口,其第一个事件的绝对序号为 `baseSeq`。每个事件在该绝对序号空间中仍保持连续;如果替换跨过窗口头部,由于其声明的范围并不存在,该替换会失败。
389
+ `SurfaceManager(log, baseSeq?, projections?)` 也可以折叠一个连续的已加载窗口,其第一个事件的绝对序号为 `baseSeq`。每个事件在该绝对序号空间中仍保持连续;如果替换跨过窗口头部,由于其声明的范围并不存在,该替换会失败。
337
390
 
338
391
  ```ts type-equiv
339
392
  /** Readonly live projection of the message-producing session events. */
@@ -342,12 +395,14 @@ interface SessionSurface {
342
395
  readonly nodes: readonly SessionSeq[]
343
396
  /** Monotonic count of committed positional replacements. */
344
397
  readonly replaceGeneration: number
398
+ /** Monotonic count of committed replacements and plugin-owned message changes. */
399
+ readonly contentGeneration: number
345
400
  }
346
401
  ```
347
402
 
348
403
  ### `SurfaceFoldReplacement` 与 `SurfaceFoldResult`:完整的 surface 回放
349
404
 
350
- `foldSurface(events)` 返回一份独立的当前事件 seq 列表,以及每个声明的替换范围实际遮蔽的 seq。实时管理器复用同一套状态转换,但不保留替换历史。每提交一次替换,其 `replaceGeneration` 就递增一次,使增量消费方能够区分纯尾部增长与重写。
405
+ `foldSurface(events, projections)` 返回一份独立的当前事件 seq 列表,以及每个声明的替换范围实际遮蔽的 seq。实时管理器复用同一套状态转换,但不保留替换历史。每提交一次替换,其 `replaceGeneration` 就递增一次,使增量消费方能够区分纯尾部增长与重写。
351
406
 
352
407
  ```ts type-equiv
353
408
  /** One replacement operation observed while folding a session surface. */
@@ -370,6 +425,8 @@ interface SurfaceFoldResult {
370
425
  nodes: SessionSeq[]
371
426
  /** Replacement operations in event order. */
372
427
  replacements: SurfaceFoldReplacement[]
428
+ /** Immutable projected messages, keyed by their original event sequences. */
429
+ projectedMessages: ReadonlyMap<SessionSeq, Message>
373
430
  }
374
431
  ```
375
432
 
@@ -424,7 +481,7 @@ declare class Session {
424
481
  * When this lifecycle appends the marker, it occupies this seq before the
425
482
  * store attaches and therefore does not publish either. Otherwise this seq
426
483
  * holds an ordinary published write.
427
- */
484
+ */
428
485
  readonly firstLiveSeq: SessionLogOffset;
429
486
  /**
430
487
  * Create a detached session by validating and snapshotting borrowed seed
@@ -433,32 +490,44 @@ declare class Session {
433
490
  * @param seed - optional borrowed replay or fork events.
434
491
  * @param header - optional borrowed storage metadata.
435
492
  * @param inheritedEventCount - exact fork-inherited prefix length for a seeded header.
493
+ * @param projections - pure interpreters for plugin-owned message changes.
436
494
  * @returns a detached session.
495
+ * @throws when a seed event requires a missing message interpreter or fails validation.
437
496
  */
438
497
  static create(
439
498
  id: SessionId,
440
499
  seed?: readonly SessionEvent[],
441
500
  header?: SessionHeader,
442
501
  inheritedEventCount?: SessionLogOffset,
443
- ): Session;
502
+ projections?: readonly SessionMessageProjection[],
503
+ ): Session;
444
504
  /**
445
- * Restore a detached session by taking ownership of fresh persistence values.
446
- * The storage format, event envelopes, sequence continuity, surface transitions,
447
- * and header fields are validated before the restored objects are frozen.
505
+ * Restore a detached session by adopting an independently owned or deeply frozen seed.
506
+ * Runtime-required event fields, event envelopes, sequence continuity, surface
507
+ * transitions, and header fields are validated without copying or freezing events.
508
+ * Embedded Assistant streams remain opaque until a stream consumer or storage
509
+ * verifier reads them.
448
510
  * @param id - restored session identity.
449
- * @param seed - fresh detached events whose ownership is transferred.
450
- * @param header - fresh detached metadata whose ownership is transferred.
511
+ * @param seed - independently owned or deeply frozen events.
512
+ * @param header - independently owned storage metadata.
451
513
  * @param inheritedEventCount - exact fork-inherited prefix length decoded from storage.
514
+ * @param eventState - aliasing state carried from the operation that produced the seed.
515
+ * @param projections - pure interpreters for plugin-owned message changes.
452
516
  * @returns a restored detached session.
517
+ * @throws when a seed event requires a missing message interpreter or fails validation.
453
518
  */
454
519
  static fromRestore(
455
520
  id: SessionId,
456
521
  seed: readonly SessionEvent[],
457
522
  header: SessionHeader,
458
523
  inheritedEventCount: SessionLogOffset,
459
- ): Session;
524
+ eventState: SessionSeedEventState,
525
+ projections?: readonly SessionMessageProjection[],
526
+ ): Session;
460
527
  /**
461
528
  * Return the immutable event stored at one exact sequence number.
529
+ * @deprecated Existing logic may remain unmigrated for now, but new calls are prohibited.
530
+ * See the [Agent Note](../../../../.agents/notes/implemented/architecture/2026-09-09-deprecate-synchronous-session-event-reads.md).
462
531
  * @param seq - event sequence number.
463
532
  * @returns the accepted event, or undefined when the log does not contain it.
464
533
  */
@@ -467,6 +536,8 @@ declare class Session {
467
536
  * Materialize an immutable snapshot of a half-open event sequence range.
468
537
  * A full current snapshot is reused until the next append; every previously
469
538
  * returned snapshot remains stable after later appends.
539
+ * @deprecated Existing logic may remain unmigrated for now, but new calls are prohibited.
540
+ * See the [Agent Note](../../../../.agents/notes/implemented/architecture/2026-09-09-deprecate-synchronous-session-event-reads.md).
470
541
  * @param fromSeq - non-negative inclusive sequence number; defaults to the log start.
471
542
  * @param toSeqExclusive - non-negative exclusive sequence number; defaults to the current end.
472
543
  * @returns a frozen array of the selected deeply frozen events.
@@ -474,9 +545,11 @@ declare class Session {
474
545
  snapshotEvents(
475
546
  fromSeq: SessionLogOffset = SessionLogOffset(0),
476
547
  toSeqExclusive: SessionLogOffset = this.seq,
477
- ): readonly SessionEvent[];
548
+ ): readonly SessionEvent[];
478
549
  /**
479
550
  * Return this Session's events after its fork-inherited prefix.
551
+ * @deprecated Existing logic may remain unmigrated for now, but new calls are prohibited.
552
+ * See the [Agent Note](../../../../.agents/notes/implemented/architecture/2026-09-09-deprecate-synchronous-session-event-reads.md).
480
553
  * @returns a fresh array containing child-owned events in log order.
481
554
  */
482
555
  ownEvents(): readonly SessionEvent[];
@@ -514,6 +587,7 @@ declare class Session {
514
587
  * (BigInt, function, symbol, undefined, negative zero, non-finite number,
515
588
  * circular reference, sparse array, or an exotic object such as
516
589
  * Map/Set/Date/class instance), or when the candidate violates the
590
+ * request-header empty-field or tool-error consistency rules, or the
517
591
  * canonical surface contract (marker shape and eligibility, unique
518
592
  * earlier source-event references, positional replacement validity, and complete
519
593
  * shadowed-node coverage). One iterative pass reads, validates, and
@@ -528,7 +602,7 @@ declare class Session {
528
602
  type: T,
529
603
  data: SessionEventMap[T],
530
604
  ...opts: T extends SurfaceEventType ? [opts: SurfaceIntent<T>] : []
531
- ): SessionEvent<T>;
605
+ ): SessionEvent<T>;
532
606
  /**
533
607
  * The {@link EpochHeader} in force after the log's last header event — the
534
608
  * header the NEXT request will be compared against — or undefined before
@@ -551,21 +625,21 @@ declare class Session {
551
625
  * append records its `surfaceOp`, so a raw event with no marker (a chunk, a
552
626
  * turn boundary) is correctly absent, and a compaction `replace` deletes the
553
627
  * shadowed nodes from the derivation. The projection rules are
554
- * {@link deriveEventMessage}, folded per node.
628
+ * {@link deriveEventMessage}, with logged message projections applied
629
+ * without changing node membership or message identity.
555
630
  *
556
- * CACHED: each surface node is projected exactly once, when first seen — a
557
- * call costs O(new nodes), and a surface rewrite (a `replace`;
558
- * {@link SessionSurface.replaceGeneration}) rebuilds. The returned array is
631
+ * CACHED: pure tail growth costs O(new nodes); a replacement or message projection
632
+ * ({@link SessionSurface.contentGeneration}) rebuilds. The returned array is
559
633
  * a fresh snapshot per call (later appends never grow an array a caller
560
634
  * already holds); the `Message` objects in it are SHARED and **deep-frozen**.
561
- * Their content reuses the already frozen durable event data, so the cache
562
- * needs no second deep clone and consumers still cannot mutate the log.
635
+ * Unchanged content reuses frozen event data; projected blocks are frozen
636
+ * derived copies. Consumers cannot mutate the log through either form.
563
637
  * @returns a fresh array of the shared, frozen derived history.
564
638
  */
565
639
  deriveMessages(): Message[];
566
640
  /**
567
- * Instance face of the pure per-node `deriveEventMessage` export from
568
- * `surface.ts`.
641
+ * Project one event with all committed message projections applied.
642
+ * The original durable event remains unchanged.
569
643
  * @param event - the event to project.
570
644
  * @returns the derived message, or null when the event produces none.
571
645
  */
@@ -643,7 +717,7 @@ interface TurnEndReasonMap {
643
717
 
644
718
  新 fork constructor 要求 seed 等于 inherited prefix,并在精确持久 cut 追加 `session/end-seed { inherited: true }`。restore 会保留该 tagged marker,并且只在完整 stored seed 尚未以 marker 结尾时追加普通 `session/end-seed {}`。两种形式都只进入 log 且不产生 message;`Session` constructor 是唯一合法 writer。
645
719
 
646
- 对于 fork lineage,定位 payload 携带 `inherited: true` 的最后一个 marker;v2 decoding 只在 `SessionHeader.isSeeded` 为 true 时要求该 marker,并从其 seq 推导 `inheritedEventCount`。对于 lifecycle ownership,定位任一形式的最后一个 `session/end-seed`。重新打开已经以任一 marker 结尾的 seed 时,不会再追加普通 marker。
720
+ 对于 fork lineage,定位 payload 携带 `inherited: true` 的最后一个 marker;当前格式 decoding 只在 `SessionHeader.isSeeded` 为 true 时要求该 marker,并从其 seq 推导 `inheritedEventCount`。对于 lifecycle ownership,定位任一形式的最后一个 `session/end-seed`。重新打开已经以任一 marker 结尾的 seed 时,不会再追加普通 marker。
647
721
 
648
722
  它之所以必要,是因为种子历史与实时工作在字节层面完全相同,这会让任何拥有独立开/闭括号的插件失效:一个未配对的 `compaction/start`,无论写入方是在压缩中途崩溃、还是此刻正在压缩,读起来都一样。在 `session/end-seed` 之前的开启标记来自构造种子,并且属于一个已结束的生命周期,无论结束原因为何(崩溃、进程接替,或从仍在运行的父会话 fork 出来),因此其所有方可以视之为已死。这只覆盖*本*会话继承的括号:另一个并发存活的会话可能在同一段历史上持有开放括号,而它自己的边界在别处,因此容忍并发写入方还需要日志之外的存活信号。核心写入该边界但不从中读取任何内容——括号的词汇表仍归其所属插件,这也正是崩溃修复只关闭轮次/步骤/工具边界而从不处理 `compaction/*` 的原因。
649
723
 
@@ -655,11 +729,11 @@ interface TurnEndReasonMap {
655
729
 
656
730
  如果同一个插件事件族中的多条事件要组装成一个 Web Client Conversation Node,该事件族中的每条 start、update、result、resource 或 interruption 事件都必须携带或独立推导出同一个稳定业务 id。此要求只约束需要关联的 Node 事件族,并不要求每条 Session 事件都有业务 id;Client 因此无须根据相邻关系猜测归属,也无须扫描历史。参见 [Conversation 子系统](conversation.zh.md)。
657
731
 
658
- 钩子桥接层的 `hook/invoked` / `hook/result` 对(来自 `@deepseek-ai/dsh-hook-protocol`)通过 `handlerId` 关联。`UserPromptSubmit`、`PreToolUse`、`PostToolUse` 与 `Stop` 在 loop 已打开的轮次内触发,因此其 `hook/*` 记录天然位于轮次之内。`SessionStart` 不生成 `hook/*` 记录,因为它在轮次 1 之前运行;其上下文会在 inbox 中保持待处理,直到唤醒交付打开一个轮次(见[钩子桥接 Agent Note](../../.agents/notes/implemented/feature/2026-06-30-hook-bridges.zh.md))。
732
+ 钩子桥接层的 `hook/invoked` / `hook/result` 对(来自 `@deepseek-ai/dsh-hook-protocol`)通过 `handlerId` 关联。`UserPromptSubmit`、`PreToolUse`、`PostToolUse` 与 `Stop` 在 loop 已打开的轮次内触发,因此其 `hook/*` 记录天然位于轮次之内。`SessionStart` 不生成 `hook/*` 记录,因为它在轮次 1 之前运行;其上下文会在 inbox 中保持待处理,直到唤醒交付打开一个轮次。
659
733
 
660
734
  ## 持久性约定
661
735
 
662
- 持久化后端依赖的约定如下:持久日志无损保存每个事件,每个 Assistant attempt 都是一个 `assistant/message` 或 `assistant/attempt`,其嵌入式紧凑 stream 会保留原始带时间 chunk。`seq` 在这些 settlement 与所有交错事件之间保持连续。后端可以为事件批次选择自己的存储 framing,只要句柄的 `read()` 返回与追加时完全一致的事件即可;当前 JSONL v2 每个事件写一行(见 [persistence.md](persistence.zh.md))。所有 `event.data` 都必须可序列化为 JSON;`Session.append` 会从源头强制这一要求(遇到不可序列化数据时抛出),因此错误事件绝不会进入日志,`session.snapshotEvents()` 始终与后端可持久化的内容一致。新增会携带不可序列化数据、破坏核心执行嵌套或违反事件所有方声明关系的事件类型,都会构成磁盘格式的破坏性变更。
736
+ 持久化后端依赖的约定如下:持久日志无损保存每个事件,每个 Assistant attempt 都是一个 `assistant/message` 或 `assistant/attempt`,其嵌入式紧凑 stream 会保留原始带时间 chunk。`seq` 在这些 settlement 与所有交错事件之间保持连续。后端可以为事件批次选择自己的存储 framing,只要句柄的 `read()` 返回与追加时完全一致的事件即可;当前 JSONL 每个事件写一行(见 [persistence.md](persistence.zh.md))。所有 `event.data` 都必须可序列化为 JSON;`Session.append` 会从源头强制这一要求(遇到不可序列化数据时抛出),因此错误事件绝不会进入日志,`session.snapshotEvents()` 始终与后端可持久化的内容一致。新增会携带不可序列化数据、破坏核心执行嵌套或违反事件所有方声明关系的事件类型,都会构成磁盘格式的破坏性变更。
663
737
 
664
738
  消费此约定的后端见 [persistence.md](persistence.zh.md)。
665
739
 
@@ -667,7 +741,7 @@ interface TurnEndReasonMap {
667
741
 
668
742
  `ModelCatalog` 是 `session/modelCatalog` 返回的 Host generation 模型目录:它携带部署默认值、可路由 provider id、成功的 provider 分组与相互隔离的 provider 失败。它不由某个 Session 派生,因此与 Session projection 分开保存。
669
743
 
670
- `SessionOpenWorkspacePathRequest` 携带绝对路径或已按 workspace 解析的 `path`。`SessionOpenWorkspacePathValue` 确认 Host 已接受原生交接。Session-aware Client 会在已知当前 Session cwd 时据此解析相对路径;controller 将路径原样交给打开器,并通过 Session Remote 错误词汇表报告无效请求、取消与打开器失败。
744
+ `SessionOpenWorkspacePathRequest` 携带绝对路径或已按 workspace 解析的 `path`。`SessionOpenWorkspacePathValue` 确认 Host 已接受原生交接。Session-aware Client 会在已知当前 Session cwd 时据此解析相对路径;controller 将路径原样交给打开器,并通过 Session Remote 错误词汇表报告无效请求、取消与打开器失败。 可选的 `action: "reveal"` 选择文件管理器导航;省略时使用默认应用打开。
671
745
 
672
746
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
673
747
 
@@ -741,6 +815,12 @@ inspect( sessionId: SessionId, signal?: AbortSignal, ): Promise<SessionInspectio
741
815
  */
742
816
  @Remote canOpenWorkspacePath(): boolean
743
817
 
818
+ /**
819
+ * Describe the serving desktop for authenticated file-action routes.
820
+ * @returns Host name, configured availability, and platform-specific file-manager behavior.
821
+ */
822
+ workspaceDesktop(): { name: string; available: boolean; fileManager: 'finder' | 'explorer' | 'directory' | null }
823
+
744
824
  /**
745
825
  * Open one path prepared by a Session-aware caller on the Host desktop.
746
826
  * @param request - path after best-effort Session workspace resolution.
@@ -780,11 +860,11 @@ inspect( sessionId: SessionId, signal?: AbortSignal, ): Promise<SessionInspectio
780
860
  @Remote('attachment') attachment(request: SessionAttachmentRequest): Promise<SessionAttachmentValue>
781
861
 
782
862
  /**
783
- * Mutate one still-pending queue occurrence on a live Agent.
863
+ * Mutate one still-pending queue occurrence, resuming a cold Agent first.
784
864
  * @param request - Session, queue item, and requested mutation.
785
865
  * @returns acknowledgement that the queue mutation was applied.
786
866
  */
787
- @Remote('updateQueue') updateQueue(request: SessionUpdateQueueRequest): SessionUpdateQueueValue
867
+ @Remote('updateQueue') updateQueue(request: SessionUpdateQueueRequest): Promise<SessionUpdateQueueValue>
788
868
 
789
869
  /**
790
870
  * Cancel one active Agent turn without dropping its pending inbox.
@@ -831,6 +911,15 @@ In-memory session store (`ctx.sessions`).
831
911
  Persistence is intentionally not implemented here — the agent lifecycle attaches a session-log writer to each published session's write handle; a session published outside that lifecycle persists nothing.
832
912
 
833
913
  ```ts cordis-catalog
914
+ /**
915
+ * Register one event interpreter for live creation, restore, and fork.
916
+ * Disposing the contribution makes sessions that used it refuse further derivation.
917
+ * @param projection - pure definition owned by the event's plugin.
918
+ * @returns the fiber-owned disposer.
919
+ * @throws when another definition already owns this event type.
920
+ */
921
+ registerMessageProjection(projection: SessionMessageProjection): () => Promise<void>
922
+
834
923
  /**
835
924
  * Create a session owned by the calling fiber: disposing that fiber stops
836
925
  * event notification and removes the session from the store. `options.seed`
@@ -865,10 +954,9 @@ create(id?: SessionId, options?: CreateSessionOptions): Session
865
954
  *
866
955
  * @param id - the session id; omitted, the store mints `session-<n>`.
867
956
  * @param options - seed events and/or creation metadata for the header. With
868
- * `seedSource: 'persistence'`, metadata and events must be fresh detached
869
- * graphs whose ownership transfers to this call: they are validated and
870
- * frozen in place through {@link Session.fromRestore}, so the caller must
871
- * retain no mutable aliases.
957
+ * `eventState`, every seed event is either independently owned or any
958
+ * shared value is deeply frozen; {@link Session.fromRestore} validates and
959
+ * adopts those values without copying or freezing them.
872
960
  * @returns the constructed session, NOT yet in the store.
873
961
  * @throws if a session with `id` already exists, metadata is not a plain
874
962
  * lossless-JSON record with valid scalar fields, or `meta.cwd` is a
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write docs/subsystems/shell.md
5
- shell.md: 554adcfb1b37a5e2fe787a78dbb61a1206f80cf9
6
- shell.zh.md: f15b57cc0050bb8f38d2652ddb9ad0e250568663
5
+ shell.md: de04083093a1e53aedd310f388f778638d858ce7
6
+ shell.zh.md: d68b1b2cfba3214a23e9120f19fc9a029a181a18
@@ -1,8 +1,8 @@
1
- # Bash Executor
1
+ # Shell Executor
2
2
 
3
3
  English | [中文](shell.zh.md)
4
4
 
5
- The bash execution seam is split across a Service Definition ([dsh-shell](../../packages/shell/shell), `ctx.shell`), Service Providers ([dsh-bash-local](../../packages/shell/bash-local) and [dsh-bash-sandbox](../../packages/shell/bash-sandbox)), and Consumer ([dsh-tool-bash](../../packages/shell/tool-bash), the `bash` schema). Generic background-job ids, ownership, and controls live in [jobs.md](jobs.md); this seam returns a task-free process handle. Raw process-group mechanics live behind the [subprocess seam](subprocess.md).
5
+ The shell execution seam uses [dsh-shell](../../packages/shell/shell) as its Service Definition on `ctx.shell`. The [shell package group](../../packages/shell/README.md) lists its Bash and PowerShell providers and model-facing Consumers. Generic background-job ids, ownership, and controls live in [jobs.md](jobs.md); this seam returns a process handle without job registration. Managed-range mechanics live behind the [subprocess seam](subprocess.md).
6
6
 
7
7
  Source: [`packages/shell/shell/src/types.ts`](../../packages/shell/shell/src/types.ts)
8
8
 
@@ -98,7 +98,7 @@ interface ShellExecSpec {
98
98
  }
99
99
  ```
100
100
 
101
- `stdin` and `env` are trusted in-process plugin inputs and are not exposed by `dsh-tool-bash`. The local executor scrubs ambient credentials before merging explicit caller-supplied env. See [the bash-stdin-env Agent Note](../../.agents/notes/implemented/architecture/2026-06-30-bash-stdin-env-trusted-plugin-api.md).
101
+ `stdin` and `env` are trusted in-process plugin inputs and are not exposed by `dsh-tool-bash`. The local executor scrubs ambient credentials before merging explicit caller-supplied env.
102
102
 
103
103
  `stdoutMaxBytes` is also trusted-plugin-only. It lets a foreground consumer request complete stdout up to a bounded parser budget without changing stderr, background jobs, or the model-facing bash tool's ordinary output cap.
104
104
 
@@ -107,11 +107,11 @@ interface ShellExecSpec {
107
107
  The outcome of one completed (or killed) foreground run. Orthogonal outcomes are reported **independently** — a process can both time out AND exit 0 because it trapped the signal — so `timedOut`, `aborted`, `signal`, and `exitCode` are each their own field; a caller never reads a cut-short run as a clean success.
108
108
 
109
109
  ```ts type-equiv
110
- /** The outcome of one completed (or killed) foreground run. */
110
+ /** The outcome of a foreground run, including timeout during preparation. */
111
111
  interface ShellRunResult {
112
- /** Exit code; null when the process died from a signal. */
112
+ /** Exit code; null when preparation expired or the process died from a signal. */
113
113
  exitCode: number | null
114
- /** Terminating signal (e.g. 'SIGTERM'); null on normal exit. */
114
+ /** Terminating signal, or null when none was reported, including preparation expiry. */
115
115
  signal: NodeJS.Signals | null
116
116
  /**
117
117
  * True when the executor's own timeout was the FIRST cause to cut the command
@@ -166,7 +166,7 @@ The `SANDBOX_UNAVAILABLE` error code (owned by the [sandbox seam](sandbox.md)) i
166
166
 
167
167
  ## Background processes: `ShellProcess`
168
168
 
169
- `start()` returns a handle with no id or owner. `dsh-tool-bash` adapts it into `ctx.jobs.start()` hooks; the generic runtime then owns job identity and lifecycle. `done` resolves when the process closes and never rejects, reads remain valid after settlement, and sandbox facts are stamped before `done` resolves.
169
+ `start()` resolves with a handle after asynchronous launch preparation; cancellation or preparation failure rejects before publication. The handle has no id or owner. `dsh-tool-bash` adapts it into `ctx.jobs.start()` hooks; the generic runtime then owns job identity and lifecycle. `done` resolves when the underlying process settles and never rejects; a subprocess provider rejection becomes a `killed` process with a stage-neutral error on stderr. Reads remain valid after settlement, and sandbox facts are stamped before `done` resolves.
170
170
 
171
171
  ```ts type-equiv
172
172
  /**
@@ -182,7 +182,10 @@ interface ShellProcess {
182
182
  exitCode: number | null
183
183
  /** Terminating signal name, when signal-killed. */
184
184
  signal: NodeJS.Signals | null
185
- /** Resolves when the underlying process closes (never rejects — a spawn failure settles as `killed` with the error on stderr). */
185
+ /**
186
+ * Resolves when the underlying process settles (never rejects — provider
187
+ * rejection settles as `killed` with a stage-neutral error on stderr).
188
+ */
186
189
  readonly done: Promise<void>
187
190
  /** Sandbox facts, stamped once a confined process settles. */
188
191
  sandbox?: ShellSandboxInfo
@@ -193,7 +196,7 @@ interface ShellProcess {
193
196
  */
194
197
  readOutput(): ShellProcessRead
195
198
  /**
196
- * Kill the process group. Returns false when it had already finished
199
+ * Terminate the provider-managed range. Returns false when it had already finished
197
200
  * (no-op); idempotent.
198
201
  */
199
202
  kill(): boolean
@@ -218,7 +221,7 @@ interface ShellProcessRead {
218
221
 
219
222
  ## The service
220
223
 
221
- `ShellExecutor` owns `resolve`, foreground `run`, background-process `start`, and the `sandboxMode` capability fact. `dsh-bash-local` owns command defaulting, timeout/abort classification, the terminal environment, and the background read merge; process groups, bounded collectors, spill files, credential scrubbing, and disposal quiescence are the [subprocess service](subprocess.md)'s. `dsh-tool-bash` owns model-facing rendering and adapts background handles into the [generic job runtime](jobs.md). `dsh-shell` owns the shell tools' shared exit-status contract: the exported `parseExitStatus`/`ParsedExitStatus` inverts the `[exit code: N]` / `[killed by signal: X]` markers `dsh-tool-bash`'s `renderResult` and `dsh-tool-pwsh`'s `renderPwshResult` append, and both tools' `presentResult` use it to split the rendered text into the terminal card's output body and its exit-status pill.
224
+ `ShellExecutor` owns `resolve`, foreground `run`, background-process `start`, and the `sandboxMode` capability fact. `dsh-bash-local` owns command defaulting, timeout/abort classification, the terminal environment, and the background read merge; managed-range termination, bounded collectors, spill files, credential scrubbing, and disposal quiescence are the [subprocess service](subprocess.md)'s. `dsh-tool-bash` owns model-facing rendering and adapts background handles into the [generic job runtime](jobs.md). `dsh-shell` owns the shell tools' shared exit-status contract: the exported `parseExitStatus`/`ParsedExitStatus` inverts the `[exit code: N]` / `[killed by signal: X]` markers `dsh-tool-bash`'s `renderResult` and `dsh-tool-pwsh`'s `renderPwshResult` append, and both tools' `presentResult` use it to split the rendered text into the terminal card's output body and its exit-status pill.
222
225
 
223
226
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
224
227
 
@@ -237,7 +240,7 @@ Abstract bash execution service. Subclass, implement the abstract methods, and l
237
240
  Implementations must honor these semantics:
238
241
 
239
242
  - run rejects only for infrastructure failures. Nonzero exits, timeout kills, and abort kills resolve with a ShellRunResult.
240
- - start returns immediately; no timeout applies to background processes. `done` settles at process close and never rejects; spawn failures settle as `killed` with the error on stderr.
243
+ - start resolves after launch preparation; cancellation or setup failure rejects before publishing a handle. No timeout applies to background processes. Once published, `done` settles at process close and never rejects; subprocess provider failures settle as `killed` with the error on stderr.
241
244
  - ShellProcess.readOutput is incremental: consecutive reads never repeat output. Lossy reads report truncation and available spill files.
242
245
  - A still-running background process is stopped and awaited when its owning composition tears down. With the subprocess seam that boundary is `ctx.subprocess` disposal, so a background process survives an executor-only reload.
243
246
 
@@ -251,19 +254,20 @@ Implementations must honor these semantics:
251
254
  abstract resolve(request: ShellExecRequest): ShellExecSpec
252
255
 
253
256
  /**
254
- * Run a command in the foreground; resolves when it finishes.
257
+ * Run preparation and the foreground command under the resolved timeout.
255
258
  * @param spec - a resolved spec from {@link resolve}, never a raw request.
256
259
  * @returns the outcome; nonzero exits, timeout kills, and abort kills
257
260
  * resolve with a descriptive result rather than reject.
261
+ * @throws on preparation failure or caller cancellation before process publication.
258
262
  */
259
263
  abstract run(spec: ShellExecSpec): Promise<ShellRunResult>
260
264
 
261
265
  /**
262
- * Start a background process and return its handle immediately.
266
+ * Prepare a background process asynchronously and publish its live handle.
263
267
  * @param spec - a resolved spec from {@link resolve}, never a raw request.
264
- * @returns the live process handle (reads, kill, quiescence promise).
268
+ * @returns the live process handle after preparation; cancellation or setup failure rejects.
265
269
  */
266
- abstract start(spec: ShellExecSpec): ShellProcess
270
+ abstract start(spec: ShellExecSpec): Promise<ShellProcess>
267
271
  ```
268
272
 
269
273
  Source: [`packages/shell/shell/src/index.ts`](../../packages/shell/shell/src/index.ts)