dsh-plugin-guide 0.3.1 → 0.3.3

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 (371) hide show
  1. package/README.es.md +1 -1
  2. package/README.hi.md +1 -1
  3. package/README.md +1 -1
  4. package/README.pt.md +1 -1
  5. package/README.zh.md +1 -1
  6. package/SKILL.md +1 -1
  7. package/dist/dsh-plugin-dev.js +5 -5
  8. package/guide/links.md +1 -1
  9. package/guide/plugin-dev-guide.md +1 -1
  10. package/guide/quick-reference.es.md +2 -2
  11. package/guide/quick-reference.hi.md +1 -1
  12. package/guide/quick-reference.md +2 -2
  13. package/guide/quick-reference.pt.md +2 -2
  14. package/guide/quick-reference.zh-CN.md +2 -2
  15. package/package.json +3 -3
  16. package/references/cordis-paper-and-community.md +1 -1
  17. package/references/official-docs/AGENTS.md +28 -23
  18. package/references/official-docs/README.i18n.yaml +2 -2
  19. package/references/official-docs/README.md +1 -1
  20. package/references/official-docs/README.zh.md +19 -9
  21. package/references/official-docs/SNAPSHOT.md +5 -5
  22. package/references/official-docs/THIRD_PARTY_NOTICES.md +36 -13
  23. package/references/official-docs/docs/AGENTS.md +4 -4
  24. package/references/official-docs/docs/agent-lifecycle.i18n.yaml +2 -2
  25. package/references/official-docs/docs/agent-lifecycle.md +1 -1
  26. package/references/official-docs/docs/agent-lifecycle.zh.md +2 -2
  27. package/references/official-docs/docs/api-gateway.i18n.yaml +2 -2
  28. package/references/official-docs/docs/api-gateway.md +8 -8
  29. package/references/official-docs/docs/api-gateway.zh.md +8 -8
  30. package/references/official-docs/docs/architecture.i18n.yaml +2 -2
  31. package/references/official-docs/docs/architecture.md +25 -8
  32. package/references/official-docs/docs/architecture.zh.md +38 -21
  33. package/references/official-docs/docs/capability-seams.i18n.yaml +2 -2
  34. package/references/official-docs/docs/capability-seams.md +134 -67
  35. package/references/official-docs/docs/capability-seams.zh.md +134 -67
  36. package/references/official-docs/docs/config-catalog.i18n.yaml +2 -2
  37. package/references/official-docs/docs/config-catalog.md +731 -403
  38. package/references/official-docs/docs/config-catalog.zh.md +747 -419
  39. package/references/official-docs/docs/cookbook/adding-a-package.i18n.yaml +2 -2
  40. package/references/official-docs/docs/cookbook/adding-a-package.md +3 -4
  41. package/references/official-docs/docs/cookbook/adding-a-package.zh.md +9 -8
  42. package/references/official-docs/docs/cookbook/{adding-a-conversation-node.i18n.yaml → adding-a-remote-api.i18n.yaml} +3 -3
  43. package/references/official-docs/docs/cookbook/adding-a-remote-api.md +197 -0
  44. package/references/official-docs/docs/cookbook/adding-a-remote-api.zh.md +197 -0
  45. package/references/official-docs/docs/cookbook/adding-a-settings-card.i18n.yaml +6 -0
  46. package/references/official-docs/docs/cookbook/adding-a-settings-card.md +102 -0
  47. package/references/official-docs/docs/cookbook/adding-a-settings-card.zh.md +102 -0
  48. package/references/official-docs/docs/cookbook/adding-a-tool.i18n.yaml +2 -2
  49. package/references/official-docs/docs/cookbook/adding-a-tool.md +11 -4
  50. package/references/official-docs/docs/cookbook/adding-a-tool.zh.md +16 -9
  51. package/references/official-docs/docs/cookbook/adding-a-vendored-package.i18n.yaml +2 -2
  52. package/references/official-docs/docs/cookbook/adding-a-vendored-package.md +2 -2
  53. package/references/official-docs/docs/cookbook/adding-a-vendored-package.zh.md +4 -4
  54. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.i18n.yaml +2 -2
  55. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.md +1 -1
  56. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.zh.md +3 -3
  57. package/references/official-docs/docs/cookbook/extension-cookbook.i18n.yaml +2 -2
  58. package/references/official-docs/docs/cookbook/extension-cookbook.md +9 -8
  59. package/references/official-docs/docs/cookbook/extension-cookbook.zh.md +17 -14
  60. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.i18n.yaml +1 -1
  61. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.zh.md +1 -1
  62. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.i18n.yaml +1 -1
  63. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +1 -1
  64. package/references/official-docs/docs/cordis-api/context.i18n.yaml +1 -1
  65. package/references/official-docs/docs/cordis-api/context.zh.md +1 -1
  66. package/references/official-docs/docs/cordis-api/events.i18n.yaml +1 -1
  67. package/references/official-docs/docs/cordis-api/events.zh.md +1 -1
  68. package/references/official-docs/docs/cordis-api/inherited.md +1 -1
  69. package/references/official-docs/docs/cordis-primer.i18n.yaml +2 -2
  70. package/references/official-docs/docs/cordis-primer.md +2 -1
  71. package/references/official-docs/docs/cordis-primer.zh.md +3 -2
  72. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.i18n.yaml +1 -1
  73. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.zh.md +4 -4
  74. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.i18n.yaml +1 -1
  75. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.zh.md +4 -4
  76. package/references/official-docs/docs/cordis-tutorial/03-services.i18n.yaml +1 -1
  77. package/references/official-docs/docs/cordis-tutorial/03-services.zh.md +4 -4
  78. package/references/official-docs/docs/cordis-tutorial/04-events.i18n.yaml +1 -1
  79. package/references/official-docs/docs/cordis-tutorial/04-events.zh.md +4 -4
  80. package/references/official-docs/docs/cordis-tutorial/05-config.i18n.yaml +1 -1
  81. package/references/official-docs/docs/cordis-tutorial/05-config.zh.md +2 -2
  82. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.i18n.yaml +1 -1
  83. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.zh.md +3 -3
  84. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.i18n.yaml +2 -2
  85. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.md +5 -4
  86. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.zh.md +11 -10
  87. package/references/official-docs/docs/cordis-tutorial/index.i18n.yaml +1 -1
  88. package/references/official-docs/docs/cordis-tutorial/index.zh.md +10 -10
  89. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.i18n.yaml +6 -0
  90. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.md +159 -0
  91. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.zh.md +159 -0
  92. package/references/official-docs/docs/defensive-patterns.i18n.yaml +1 -1
  93. package/references/official-docs/docs/defensive-patterns.zh.md +3 -1
  94. package/references/official-docs/docs/development.i18n.yaml +2 -2
  95. package/references/official-docs/docs/development.md +9 -13
  96. package/references/official-docs/docs/development.zh.md +23 -21
  97. package/references/official-docs/docs/event-producer-consumer.i18n.yaml +2 -2
  98. package/references/official-docs/docs/event-producer-consumer.md +55 -46
  99. package/references/official-docs/docs/event-producer-consumer.zh.md +55 -46
  100. package/references/official-docs/docs/glossary.i18n.yaml +2 -2
  101. package/references/official-docs/docs/glossary.md +1 -1
  102. package/references/official-docs/docs/glossary.zh.md +1 -1
  103. package/references/official-docs/docs/graph-atlas.i18n.yaml +2 -2
  104. package/references/official-docs/docs/graph-atlas.md +0 -2
  105. package/references/official-docs/docs/graph-atlas.zh.md +7 -9
  106. package/references/official-docs/docs/i18n/README.i18n.yaml +2 -2
  107. package/references/official-docs/docs/i18n/README.md +7 -7
  108. package/references/official-docs/docs/i18n/README.zh.md +11 -9
  109. package/references/official-docs/docs/i18n/style-samples.md +3 -3
  110. package/references/official-docs/docs/i18n/translation-prompt.md +3 -3
  111. package/references/official-docs/docs/i18n/translation-rules.i18n.yaml +2 -2
  112. package/references/official-docs/docs/i18n/translation-rules.md +2 -2
  113. package/references/official-docs/docs/i18n/translation-rules.zh.md +3 -3
  114. package/references/official-docs/docs/module-graph.i18n.yaml +2 -2
  115. package/references/official-docs/docs/module-graph.md +660 -909
  116. package/references/official-docs/docs/module-graph.zh.md +662 -911
  117. package/references/official-docs/docs/persistence-catalog.i18n.yaml +2 -2
  118. package/references/official-docs/docs/persistence-catalog.md +185 -53
  119. package/references/official-docs/docs/persistence-catalog.zh.md +193 -61
  120. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.i18n.yaml +2 -2
  121. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.md +2 -2
  122. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.zh.md +3 -3
  123. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.i18n.yaml +2 -2
  124. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.md +2 -2
  125. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +2 -2
  126. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.i18n.yaml +2 -2
  127. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.md +2 -2
  128. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.zh.md +2 -2
  129. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.i18n.yaml +2 -2
  130. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +1 -1
  131. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +2 -2
  132. package/references/official-docs/docs/postmortem/README.i18n.yaml +1 -1
  133. package/references/official-docs/docs/postmortem/README.zh.md +5 -5
  134. package/references/official-docs/docs/rescope.i18n.yaml +2 -2
  135. package/references/official-docs/docs/rescope.md +2 -2
  136. package/references/official-docs/docs/rescope.zh.md +3 -3
  137. package/references/official-docs/docs/subsystems/README.i18n.yaml +2 -2
  138. package/references/official-docs/docs/subsystems/README.md +8 -2
  139. package/references/official-docs/docs/subsystems/README.zh.md +53 -47
  140. package/references/official-docs/docs/subsystems/agent-team.i18n.yaml +6 -0
  141. package/references/official-docs/docs/subsystems/agent-team.md +207 -0
  142. package/references/official-docs/docs/subsystems/agent-team.zh.md +207 -0
  143. package/references/official-docs/docs/subsystems/approval.i18n.yaml +2 -2
  144. package/references/official-docs/docs/subsystems/approval.md +12 -12
  145. package/references/official-docs/docs/subsystems/approval.zh.md +13 -13
  146. package/references/official-docs/docs/subsystems/attachment.i18n.yaml +2 -2
  147. package/references/official-docs/docs/subsystems/attachment.md +90 -7
  148. package/references/official-docs/docs/subsystems/attachment.zh.md +90 -7
  149. package/references/official-docs/docs/subsystems/client-modules.i18n.yaml +2 -2
  150. package/references/official-docs/docs/subsystems/client-modules.md +69 -19
  151. package/references/official-docs/docs/subsystems/client-modules.zh.md +69 -19
  152. package/references/official-docs/docs/subsystems/code-runtime.i18n.yaml +2 -2
  153. package/references/official-docs/docs/subsystems/code-runtime.md +12 -8
  154. package/references/official-docs/docs/subsystems/code-runtime.zh.md +13 -9
  155. package/references/official-docs/docs/subsystems/commands.i18n.yaml +2 -2
  156. package/references/official-docs/docs/subsystems/commands.md +30 -7
  157. package/references/official-docs/docs/subsystems/commands.zh.md +31 -8
  158. package/references/official-docs/docs/subsystems/compaction.i18n.yaml +2 -2
  159. package/references/official-docs/docs/subsystems/compaction.md +14 -14
  160. package/references/official-docs/docs/subsystems/compaction.zh.md +19 -19
  161. package/references/official-docs/docs/subsystems/conversation.i18n.yaml +6 -0
  162. package/references/official-docs/docs/{cookbook/adding-a-conversation-node.md → subsystems/conversation.md} +49 -24
  163. package/references/official-docs/docs/{cookbook/adding-a-conversation-node.zh.md → subsystems/conversation.zh.md} +49 -24
  164. package/references/official-docs/docs/subsystems/core.i18n.yaml +2 -2
  165. package/references/official-docs/docs/subsystems/core.md +114 -36
  166. package/references/official-docs/docs/subsystems/core.zh.md +145 -65
  167. package/references/official-docs/docs/subsystems/credentials.i18n.yaml +2 -2
  168. package/references/official-docs/docs/subsystems/credentials.md +207 -11
  169. package/references/official-docs/docs/subsystems/credentials.zh.md +207 -11
  170. package/references/official-docs/docs/subsystems/extensions.i18n.yaml +2 -2
  171. package/references/official-docs/docs/subsystems/extensions.md +27 -9
  172. package/references/official-docs/docs/subsystems/extensions.zh.md +30 -12
  173. package/references/official-docs/docs/subsystems/feedback.i18n.yaml +2 -2
  174. package/references/official-docs/docs/subsystems/feedback.md +6 -6
  175. package/references/official-docs/docs/subsystems/feedback.zh.md +6 -6
  176. package/references/official-docs/docs/subsystems/filesystem.i18n.yaml +2 -2
  177. package/references/official-docs/docs/subsystems/filesystem.md +17 -7
  178. package/references/official-docs/docs/subsystems/filesystem.zh.md +19 -9
  179. package/references/official-docs/docs/subsystems/goal.i18n.yaml +2 -2
  180. package/references/official-docs/docs/subsystems/goal.md +4 -4
  181. package/references/official-docs/docs/subsystems/goal.zh.md +8 -8
  182. package/references/official-docs/docs/subsystems/invariants.i18n.yaml +2 -2
  183. package/references/official-docs/docs/subsystems/invariants.md +2 -2
  184. package/references/official-docs/docs/subsystems/invariants.zh.md +5 -5
  185. package/references/official-docs/docs/subsystems/jobs.i18n.yaml +2 -2
  186. package/references/official-docs/docs/subsystems/jobs.md +3 -3
  187. package/references/official-docs/docs/subsystems/jobs.zh.md +6 -6
  188. package/references/official-docs/docs/subsystems/llm-streaming.i18n.yaml +2 -2
  189. package/references/official-docs/docs/subsystems/llm-streaming.md +193 -22
  190. package/references/official-docs/docs/subsystems/llm-streaming.zh.md +199 -28
  191. package/references/official-docs/docs/subsystems/lsp.i18n.yaml +2 -2
  192. package/references/official-docs/docs/subsystems/lsp.md +2 -2
  193. package/references/official-docs/docs/subsystems/lsp.zh.md +3 -3
  194. package/references/official-docs/docs/subsystems/permission-presets.i18n.yaml +2 -2
  195. package/references/official-docs/docs/subsystems/permission-presets.md +8 -8
  196. package/references/official-docs/docs/subsystems/permission-presets.zh.md +8 -8
  197. package/references/official-docs/docs/subsystems/persistence.i18n.yaml +2 -2
  198. package/references/official-docs/docs/subsystems/persistence.md +183 -173
  199. package/references/official-docs/docs/subsystems/persistence.zh.md +182 -172
  200. package/references/official-docs/docs/subsystems/plan.i18n.yaml +2 -2
  201. package/references/official-docs/docs/subsystems/plan.md +4 -4
  202. package/references/official-docs/docs/subsystems/plan.zh.md +10 -10
  203. package/references/official-docs/docs/subsystems/sandbox.i18n.yaml +2 -2
  204. package/references/official-docs/docs/subsystems/sandbox.md +5 -3
  205. package/references/official-docs/docs/subsystems/sandbox.zh.md +8 -6
  206. package/references/official-docs/docs/subsystems/schedule.i18n.yaml +2 -2
  207. package/references/official-docs/docs/subsystems/schedule.md +9 -3
  208. package/references/official-docs/docs/subsystems/schedule.zh.md +11 -5
  209. package/references/official-docs/docs/subsystems/scope.i18n.yaml +1 -1
  210. package/references/official-docs/docs/subsystems/scope.zh.md +1 -1
  211. package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +2 -2
  212. package/references/official-docs/docs/subsystems/session-projection.md +148 -75
  213. package/references/official-docs/docs/subsystems/session-projection.zh.md +148 -75
  214. package/references/official-docs/docs/subsystems/session-query.i18n.yaml +2 -2
  215. package/references/official-docs/docs/subsystems/session-query.md +30 -16
  216. package/references/official-docs/docs/subsystems/session-query.zh.md +31 -17
  217. package/references/official-docs/docs/subsystems/session-reference.i18n.yaml +2 -2
  218. package/references/official-docs/docs/subsystems/session-reference.md +94 -7
  219. package/references/official-docs/docs/subsystems/session-reference.zh.md +95 -8
  220. package/references/official-docs/docs/subsystems/session-telemetry.i18n.yaml +2 -2
  221. package/references/official-docs/docs/subsystems/session-telemetry.md +5 -6
  222. package/references/official-docs/docs/subsystems/session-telemetry.zh.md +9 -10
  223. package/references/official-docs/docs/subsystems/session-title.i18n.yaml +2 -2
  224. package/references/official-docs/docs/subsystems/session-title.md +8 -8
  225. package/references/official-docs/docs/subsystems/session-title.zh.md +10 -10
  226. package/references/official-docs/docs/subsystems/session.i18n.yaml +2 -2
  227. package/references/official-docs/docs/subsystems/session.md +376 -71
  228. package/references/official-docs/docs/subsystems/session.zh.md +392 -85
  229. package/references/official-docs/docs/subsystems/settings.i18n.yaml +2 -2
  230. package/references/official-docs/docs/subsystems/settings.md +105 -10
  231. package/references/official-docs/docs/subsystems/settings.zh.md +105 -10
  232. package/references/official-docs/docs/subsystems/shell.i18n.yaml +2 -2
  233. package/references/official-docs/docs/subsystems/shell.md +3 -3
  234. package/references/official-docs/docs/subsystems/shell.zh.md +11 -11
  235. package/references/official-docs/docs/subsystems/skills.i18n.yaml +2 -2
  236. package/references/official-docs/docs/subsystems/skills.md +26 -3
  237. package/references/official-docs/docs/subsystems/skills.zh.md +29 -6
  238. package/references/official-docs/docs/subsystems/slots.i18n.yaml +6 -0
  239. package/references/official-docs/docs/subsystems/slots.md +175 -0
  240. package/references/official-docs/docs/subsystems/slots.zh.md +175 -0
  241. package/references/official-docs/docs/subsystems/spill.i18n.yaml +2 -2
  242. package/references/official-docs/docs/subsystems/spill.md +4 -4
  243. package/references/official-docs/docs/subsystems/spill.zh.md +6 -6
  244. package/references/official-docs/docs/subsystems/storage.i18n.yaml +2 -2
  245. package/references/official-docs/docs/subsystems/storage.md +38 -7
  246. package/references/official-docs/docs/subsystems/storage.zh.md +41 -10
  247. package/references/official-docs/docs/subsystems/subagent.i18n.yaml +2 -2
  248. package/references/official-docs/docs/subsystems/subagent.md +148 -116
  249. package/references/official-docs/docs/subsystems/subagent.zh.md +158 -124
  250. package/references/official-docs/docs/subsystems/subprocess.i18n.yaml +2 -2
  251. package/references/official-docs/docs/subsystems/subprocess.md +3 -3
  252. package/references/official-docs/docs/subsystems/subprocess.zh.md +5 -5
  253. package/references/official-docs/docs/subsystems/system-prompt.i18n.yaml +2 -2
  254. package/references/official-docs/docs/subsystems/system-prompt.md +21 -8
  255. package/references/official-docs/docs/subsystems/system-prompt.zh.md +23 -10
  256. package/references/official-docs/docs/subsystems/terminal.i18n.yaml +2 -2
  257. package/references/official-docs/docs/subsystems/terminal.md +2 -2
  258. package/references/official-docs/docs/subsystems/terminal.zh.md +4 -4
  259. package/references/official-docs/docs/subsystems/todo.i18n.yaml +6 -0
  260. package/references/official-docs/docs/subsystems/todo.md +32 -0
  261. package/references/official-docs/docs/subsystems/todo.zh.md +32 -0
  262. package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +2 -2
  263. package/references/official-docs/docs/subsystems/token-meter.md +29 -14
  264. package/references/official-docs/docs/subsystems/token-meter.zh.md +30 -15
  265. package/references/official-docs/docs/subsystems/tools.i18n.yaml +2 -2
  266. package/references/official-docs/docs/subsystems/tools.md +46 -46
  267. package/references/official-docs/docs/subsystems/tools.zh.md +54 -54
  268. package/references/official-docs/docs/subsystems/typert.i18n.yaml +2 -2
  269. package/references/official-docs/docs/subsystems/typert.md +65 -58
  270. package/references/official-docs/docs/subsystems/typert.zh.md +67 -60
  271. package/references/official-docs/docs/subsystems/user-questions.i18n.yaml +2 -2
  272. package/references/official-docs/docs/subsystems/user-questions.md +35 -35
  273. package/references/official-docs/docs/subsystems/user-questions.zh.md +35 -35
  274. package/references/official-docs/docs/subsystems/web-client.i18n.yaml +6 -0
  275. package/references/official-docs/docs/subsystems/web-client.md +95 -0
  276. package/references/official-docs/docs/subsystems/web-client.zh.md +95 -0
  277. package/references/official-docs/docs/subsystems/web-server.i18n.yaml +2 -2
  278. package/references/official-docs/docs/subsystems/web-server.md +55 -9
  279. package/references/official-docs/docs/subsystems/web-server.zh.md +56 -10
  280. package/references/official-docs/docs/subsystems/web.i18n.yaml +2 -2
  281. package/references/official-docs/docs/subsystems/web.md +14 -7
  282. package/references/official-docs/docs/subsystems/web.zh.md +16 -9
  283. package/references/official-docs/docs/subsystems/webhook.i18n.yaml +6 -0
  284. package/references/official-docs/docs/subsystems/webhook.md +70 -0
  285. package/references/official-docs/docs/subsystems/webhook.zh.md +70 -0
  286. package/references/official-docs/docs/subsystems/workflow.i18n.yaml +2 -2
  287. package/references/official-docs/docs/subsystems/workflow.md +8 -8
  288. package/references/official-docs/docs/subsystems/workflow.zh.md +13 -13
  289. package/references/official-docs/docs/subsystems/workspace.i18n.yaml +2 -2
  290. package/references/official-docs/docs/subsystems/workspace.md +98 -5
  291. package/references/official-docs/docs/subsystems/workspace.zh.md +102 -9
  292. package/references/official-docs/docs/testing.i18n.yaml +2 -2
  293. package/references/official-docs/docs/testing.md +15 -10
  294. package/references/official-docs/docs/testing.zh.md +15 -10
  295. package/references/official-docs/docs/tool-catalog.i18n.yaml +2 -2
  296. package/references/official-docs/docs/tool-catalog.md +413 -61
  297. package/references/official-docs/docs/tool-catalog.zh.md +418 -63
  298. package/references/official-docs/docs/tool-execution-pipeline.i18n.yaml +2 -2
  299. package/references/official-docs/docs/tool-execution-pipeline.md +1 -1
  300. package/references/official-docs/docs/tool-execution-pipeline.zh.md +1 -1
  301. package/references/official-docs/docs/user/develop/basic/config.i18n.yaml +2 -2
  302. package/references/official-docs/docs/user/develop/basic/config.md +1 -1
  303. package/references/official-docs/docs/user/develop/basic/config.zh.md +4 -4
  304. package/references/official-docs/docs/user/develop/basic/index.i18n.yaml +1 -1
  305. package/references/official-docs/docs/user/develop/basic/index.zh.md +5 -5
  306. package/references/official-docs/docs/user/develop/basic/publish.i18n.yaml +2 -2
  307. package/references/official-docs/docs/user/develop/basic/publish.md +3 -3
  308. package/references/official-docs/docs/user/develop/basic/publish.zh.md +7 -7
  309. package/references/official-docs/docs/user/develop/basic/tool.i18n.yaml +2 -2
  310. package/references/official-docs/docs/user/develop/basic/tool.md +3 -3
  311. package/references/official-docs/docs/user/develop/basic/tool.zh.md +4 -4
  312. package/references/official-docs/docs/user/develop/framework/events.i18n.yaml +2 -2
  313. package/references/official-docs/docs/user/develop/framework/events.md +2 -2
  314. package/references/official-docs/docs/user/develop/framework/events.zh.md +3 -3
  315. package/references/official-docs/docs/user/develop/framework/index.i18n.yaml +1 -1
  316. package/references/official-docs/docs/user/develop/framework/index.zh.md +3 -3
  317. package/references/official-docs/docs/user/develop/framework/service.i18n.yaml +2 -2
  318. package/references/official-docs/docs/user/develop/framework/service.md +1 -1
  319. package/references/official-docs/docs/user/develop/framework/service.zh.md +3 -3
  320. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.i18n.yaml +6 -0
  321. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.md +15 -0
  322. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.zh.md +15 -0
  323. package/references/official-docs/docs/user/develop/practice/index.i18n.yaml +2 -2
  324. package/references/official-docs/docs/user/develop/practice/index.md +1 -1
  325. package/references/official-docs/docs/user/develop/practice/index.zh.md +3 -3
  326. package/references/official-docs/docs/user/develop/practice/llm-adapter.i18n.yaml +2 -2
  327. package/references/official-docs/docs/user/develop/practice/llm-adapter.md +4 -3
  328. package/references/official-docs/docs/user/develop/practice/llm-adapter.zh.md +4 -3
  329. package/references/official-docs/docs/user/guide/github-review.i18n.yaml +6 -0
  330. package/references/official-docs/docs/user/guide/github-review.md +102 -0
  331. package/references/official-docs/docs/user/guide/github-review.zh.md +102 -0
  332. package/references/official-docs/docs/user/guide/index.i18n.yaml +2 -2
  333. package/references/official-docs/docs/user/guide/index.md +2 -2
  334. package/references/official-docs/docs/user/guide/index.zh.md +8 -8
  335. package/references/official-docs/docs/user/guide/mcp-memory.i18n.yaml +6 -0
  336. package/references/official-docs/docs/user/guide/mcp-memory.md +101 -0
  337. package/references/official-docs/docs/user/guide/mcp-memory.zh.md +101 -0
  338. package/references/official-docs/docs/user/guide/providers.i18n.yaml +2 -2
  339. package/references/official-docs/docs/user/guide/providers.md +40 -1
  340. package/references/official-docs/docs/user/guide/providers.zh.md +41 -2
  341. package/references/official-docs/docs/user/guide/python-sdk.i18n.yaml +2 -2
  342. package/references/official-docs/docs/user/guide/python-sdk.md +80 -34
  343. package/references/official-docs/docs/user/guide/python-sdk.zh.md +87 -41
  344. package/references/official-docs/docs/user/guide/schedule.i18n.yaml +6 -0
  345. package/references/official-docs/docs/user/guide/schedule.md +21 -0
  346. package/references/official-docs/docs/user/guide/schedule.zh.md +21 -0
  347. package/references/official-docs/docs/web-styling.i18n.yaml +2 -2
  348. package/references/official-docs/docs/web-styling.md +3 -0
  349. package/references/official-docs/docs/web-styling.zh.md +5 -2
  350. package/references/official-docs/packages/AGENTS.md +4 -3
  351. package/references/official-docs/packages/README.md +104 -59
  352. package/references/official-docs/vendor/README.md +1 -0
  353. package/references/official-docs/website-docs.ts +52 -11
  354. package/references/sources.md +2 -2
  355. package/references/website-pages.md +3 -3
  356. package/scripts/download-sources.ps1 +1 -1
  357. package/scripts/sync-official-docs.ps1 +19 -11
  358. package/scripts/verify-kit.ps1 +0 -4
  359. package/templates/js/README.es.md +1 -1
  360. package/templates/js/README.hi.md +1 -1
  361. package/templates/js/README.md +1 -1
  362. package/templates/js/README.pt.md +1 -1
  363. package/templates/js/README.zh.md +1 -1
  364. package/templates/js/package.json +4 -4
  365. package/templates/ts/README.es.md +1 -1
  366. package/templates/ts/README.hi.md +1 -1
  367. package/templates/ts/README.md +1 -1
  368. package/templates/ts/README.pt.md +1 -1
  369. package/templates/ts/README.zh.md +1 -1
  370. package/templates/ts/package.json +4 -4
  371. package/references/official-docs/examples/AGENTS.md +0 -20
@@ -2,13 +2,13 @@
2
2
 
3
3
  [English](session.md) | 中文
4
4
 
5
- [dsh-session](../../packages/core/session) 的内存事件溯源模型。`Session` 是一份由类型化 `SessionEvent` 组成的**仅追加日志**,是 agent(智能体)完整交互历史的唯一真源。LLM(大语言模型)消息历史从日志*派生*而来,从不单独存储;回放即从同一组事件重新派生。日志如何实现**持久化**(持久化 seam、后端、崩溃恢复)是兄弟文档 [persistence.md](persistence.md) 的关注点。
5
+ [dsh-session](../../packages/core/session) 的内存事件溯源模型。`Session` 是一份由类型化 `SessionEvent` 组成的**仅追加日志**,是 agent(智能体)完整交互历史的唯一真源。LLM(大语言模型)消息历史从日志*派生*而来,从不单独存储;回放即从同一组事件重新派生。日志如何实现**持久化**(持久化 seam、后端、崩溃恢复)是兄弟文档 [persistence.md](persistence.zh.md) 的关注点。
6
6
 
7
7
  源码:[`packages/core/session/src/types.ts`](../../packages/core/session/src/types.ts)
8
8
 
9
9
  ## `SessionEventMap`:事件词汇
10
10
 
11
- 仅追加的事件类型。可通过声明合并扩展:插件通过 declaration merging 声明额外的事件类型。例如[压缩(compaction) seam](compaction.md) 添加了 `compaction/start` / `compaction/summary` / `compaction/end`,`@deepseek-ai/dsh-hook-protocol` 为钩子桥接添加了仅记录日志的 `hook/invoked` / `hook/result` 记录。与 `compaction/*` 一样,这些都不是 `SurfaceEventType`(没有 `surfaceOp`)。生成的[持久化日志事件目录](../persistence-catalog.md)列举了所有成员(核心与合并扩展的),包含其 payload、surface 标记与声明位置。
11
+ 仅追加的事件类型。可通过声明合并扩展:插件通过 declaration merging 声明额外的事件类型。例如[压缩(compaction) seam](compaction.zh.md) 添加了 `compaction/start` / `compaction/summary` / `compaction/end`,`@deepseek-ai/dsh-hook-protocol` 为钩子桥接添加了仅记录日志的 `hook/invoked` / `hook/result` 记录。与 `compaction/*` 一样,这些都不是 `SurfaceEventType`(没有 `surfaceOp`)。生成的[持久化日志事件目录](../persistence-catalog.zh.md)列举了所有成员(核心与合并扩展的),包含其 payload、surface 标记与声明位置。
12
12
 
13
13
  ```ts type-equiv
14
14
  /** A user-role specialization of the one shared message representation. */
@@ -59,15 +59,19 @@ interface SessionEventMap {
59
59
  * Assembled assistant message for one step (derived history uses this).
60
60
  * Carries the step's `usage` when the adapter reported token accounting, so
61
61
  * the model output and its accounting travel together (there is no separate
62
- * usage record). `usage` is absent when the adapter reported none.
62
+ * usage record). `usage` is absent when the adapter reported none. A turn
63
+ * cancelled mid-stream finalizes its delivered text/reasoning prefix as this
64
+ * event with `interrupted: true`; undispatched tool calls are absent. The
65
+ * marker distinguishes that prefix without re-deriving interruption from turn
66
+ * boundaries. An aborted turn with no such event streamed no visible content.
63
67
  */
64
- 'assistant/message': { turn: number; step: number; message: AssistantMessage; usage?: TokenUsage }
68
+ 'assistant/message': { turn: number; step: number; message: AssistantMessage; usage?: TokenUsage; interrupted?: true }
65
69
  /**
66
70
  * The model requested one tool invocation: `name` with the raw `arguments`
67
71
  * JSON string exactly as the model produced it (unparsed). `callId` pairs the
68
72
  * call with its `tool/result`.
69
73
  */
70
- 'tool/call': { turn: number; step: number; callId: CallId; name: string; arguments: string }
74
+ 'tool/call': { turn: number; step: number; callId: ToolCallId; name: string; arguments: string }
71
75
  /**
72
76
  * A completed tool call's model-facing result, optional internal failure
73
77
  * identity, and optional tool-private `meta` presentation payload. `meta` is
@@ -86,13 +90,16 @@ interface SessionEventMap {
86
90
  error?: { name: string; code: string }
87
91
  meta?: JsonValue
88
92
  }
89
- /** Whole-list snapshot; latest write wins on replay. Log-only UI state; never derived history. */
90
- 'todo/write': { todos: TodoItem[] }
91
93
  /**
92
94
  * Full header for the next request, appended inside its step before dispatch.
93
95
  * It is log-only; the latest snapshot reconstructs the request header.
94
96
  */
95
- 'request/header': { header: EpochHeader; reason: RequestHeaderReason }
97
+ 'request/header': {
98
+ header: EpochHeader
99
+ reason: RequestHeaderReason
100
+ /** A changed header also begins a distinct model-message series. */
101
+ startsSeries?: true
102
+ }
96
103
  /**
97
104
  * Route metadata for the next request, logged only when the route or capacity
98
105
  * changes. It does not participate in request reconstruction or header equality.
@@ -126,34 +133,11 @@ interface SessionEventMap {
126
133
 
127
134
  `UserMessage` 是普通提示词、注入上下文、steering(中途引导)与实时收件箱事件共享的带标识且冻结的 user-role 值。事件包装层只会增加事件本地的位置或结果事实;条目待处理期间,loop 只额外附加驱动器自有的路由状态。
128
135
 
129
- ### `TodoItem`:一条待办项
130
-
131
- 这是 `todo/write` 事件全量列表快照中的单元。它有意保持精简:一行 `content` 加一个三态 `status`(没有 id、优先级或 `activeForm`);列表在每次写入时整体替换,因此条目无需稳定标识。见 [todo_write Agent Note](../../.agents/notes/implemented/feature/2026-06-29-todo-write-tool.md)。
132
-
133
- ```ts type-equiv
134
- /**
135
- * One entry in an agent's todo list — the unit of the `todo/write`
136
- * {@link SessionEventMap} event's whole-list snapshot.
137
- *
138
- * Deliberately minimal: a human-readable `content` line and a three-state
139
- * `status`. No id, priority, or `activeForm` — the list is replaced wholesale
140
- * on every write (last-write-wins), so entries need no stable identity. The
141
- * three statuses describe the complete portable lifecycle needed by model and
142
- * UI consumers.
143
- */
144
- interface TodoItem {
145
- /** What this task is — a short imperative line shown in the UI. */
146
- content: string
147
- /** Lifecycle state. `in_progress` marks a task being worked now; parallel work may mark several. */
148
- status: 'pending' | 'in_progress' | 'completed'
149
- }
150
- ```
151
-
152
136
  <a id="the-request-header-event-requestheader"></a>
153
137
 
154
138
  ### 请求头事件:`request/header`
155
139
 
156
- 请求信封(即 `EpochHeader`:调用配置 + 适配器所提供默认值的标记 + 渲染后的系统提示词 + 已组装的工具 schema)会作为会话状态写入日志,因此每个对话请求都是日志的纯函数(见可重建性 Agent Note)。带有 reason `'initial'` 或 `'resume'` 的完整 `request/header` 快照记录每个 agent loop 实例的边界;之后请求发生变化时,系统会以 reason `'change'` 记录另一份完整快照。`foldRequestHeader(events)` 通过选择最新快照重建请求头。该事件不是 `SurfaceEventType`,不产生 LLM 消息。
140
+ 请求信封(即 `EpochHeader`:调用配置 + 适配器所提供默认值的标记 + 渲染后的系统提示词 + 已组装的工具 schema)会作为会话状态写入日志,因此每个对话请求都是日志的纯函数(见可重建性 Agent Note)。带有 reason `'initial'` 或 `'resume'` 的完整 `request/header` 快照记录每个 agent loop 实例的边界;请求变化时会追加 reason `'change'` 的快照;未变的信封显式开启消息序列或跟随 surface 替换时,会追加 reason 为 `'series'` 的快照。如果发生变化的快照所属请求同时开启序列,它会携带 `startsSeries: true`。普通的仅追加后续 Turn,以及同一模型消息序列内的后续 Step 与重试沿用最新快照。`foldRequestHeader(events)` 通过选择最新快照重建请求头。该事件不是 `SurfaceEventType`,不产生 LLM 消息。
157
141
 
158
142
  ```ts type-equiv
159
143
  /**
@@ -195,6 +179,28 @@ interface RequestContext {
195
179
 
196
180
  基于 `type` 的真正可辨识联合(而非独立的 `type`/`data` 联合),因此 `switch (event.type)` 能直接收窄 `event.data`,无需类型断言。`seq` 是日志中的单调递增位置(`seq = log.length`);`time` 为 epoch 毫秒。
197
181
 
182
+ ```ts type-equiv
183
+ /** Sequence number of one existing event in a Session log. */
184
+ type SessionSeq = BrandedNumber<'SessionSeq'>
185
+ ```
186
+
187
+ ```ts type-equiv
188
+ /** A Session log gap, prefix length, or read offset, which may equal the event count. */
189
+ type SessionLogOffset = BrandedNumber<'SessionLogOffset'>
190
+ ```
191
+
192
+ ```ts type-equiv
193
+ /** Inclusive Session event watermark, or `-1` before any event exists. */
194
+ type SessionSeqCursor = SessionSeq | -1
195
+ ```
196
+
197
+ ```ts type-equiv
198
+ /** One existing Session event position, or explicit absence. */
199
+ type OptionalSessionSeq = SessionSeq | null
200
+ ```
201
+
202
+ `SessionSeq(value)` 与 `SessionLogOffset(value)` 只接纳非负安全整数,并拒绝负零。它们仅添加编译期品牌,不改变序列化后的数值;算术会返回普通 `number`,调用方必须按结果的预期角色通过对应构造器重新接纳。
203
+
198
204
  ```ts type-equiv
199
205
  /**
200
206
  * One immutable entry in the session log.
@@ -213,10 +219,21 @@ type SessionEvent<T extends SessionEventType = SessionEventType> = {
213
219
  [K in SessionEventType]: {
214
220
  type: K
215
221
  /** Monotonic sequence number within the session. */
216
- seq: number
222
+ seq: SessionSeq
217
223
  /** Unix epoch milliseconds. */
218
224
  time: number
219
225
  data: SessionEventMap[K]
226
+ /**
227
+ * Marks an event a reader may safely skip when it does not recognize
228
+ * `type`. Absent means required: a reader meeting an unrecognized type
229
+ * without this marker MUST refuse to reconstruct the session instead of
230
+ * silently dropping the event, because an unrecognized required event may
231
+ * change how the rest of the log is interpreted. A writer sets `true` only
232
+ * on purely informational records whose loss cannot affect reconstruction;
233
+ * defaulting to required means a forgotten marker over-refuses (an
234
+ * inconvenience) rather than silently resuming a gutted session.
235
+ */
236
+ ignorable?: true
220
237
  } & (K extends SurfaceEventType ? {
221
238
  /**
222
239
  * Seq numbers of earlier events that this event cites as sources
@@ -226,7 +243,7 @@ type SessionEvent<T extends SessionEventType = SessionEventType> = {
226
243
  * provider stream; when the field is absent, the event does not record which
227
244
  * earlier events produced the message.
228
245
  */
229
- sourceEventSeqs?: number[]
246
+ sourceEventSeqs?: SessionSeq[]
230
247
  /** How this event entered the surface; absent for non-surface events. */
231
248
  surfaceOp?: SurfaceOp
232
249
  } : object)
@@ -237,9 +254,11 @@ type SessionEvent<T extends SessionEventType = SessionEventType> = {
237
254
 
238
255
  对于 `assistant/message`,存在的 `sourceEventSeqs: []` 表示提供方流已知且完整地为空;旧格式或外部事件缺少该字段时,没有记录这条消息由哪些早期事件产生。agent loop 会为每次成功的模型调用写入该字段;其他 surface 事件只要包含该字段,其列表就必须非空。
239
256
 
257
+ <a id="surface-types"></a>
258
+
240
259
  ## Surface 类型
241
260
 
242
- 三种产生消息的类型(`SurfaceEventType`:`user/message`、`assistant/message`、`tool/result`)携带 surface 元数据,用来声明它们如何加入有序的派生 surface。见 [session surface Agent Note](../../.agents/notes/implemented/architecture/2026-06-18-session-surface.md)。
261
+ 三种产生消息的类型(`SurfaceEventType`:`user/message`、`assistant/message`、`tool/result`)携带 surface 元数据,用来声明它们如何加入有序的派生 surface。见 [session surface Agent Note](../../.agents/notes/implemented/architecture/2026-06-18-session-surface.zh.md)。
243
262
 
244
263
  ### `SurfaceEventType`:事件类型中产生消息的子集
245
264
 
@@ -273,7 +292,7 @@ type SurfaceEventType =
273
292
  */
274
293
  type SurfaceOp =
275
294
  | 'append'
276
- | { op: 'replace'; start: number; end: number }
295
+ | { op: 'replace'; start: SessionSeq; end: SessionSeq }
277
296
  ```
278
297
 
279
298
  `'append'` 是常规的尾部追加路径。`replace` 会遮蔽从 `start` 到 `end`(含两端)的 surface 条目(两者都必须是有效的 surface seq;`start === end` 时仅替换单个条目),并在原位置插入新事件。
@@ -293,11 +312,11 @@ interface SurfaceIntent {
293
312
  * absent, the event does not record which earlier events produced the message.
294
313
  * Other surface events require a non-empty set when this field is present.
295
314
  */
296
- sourceEventSeqs?: number[]
315
+ sourceEventSeqs?: SessionSeq[]
297
316
  }
298
317
  ```
299
318
 
300
- 对 `SurfaceEventType` 事件必填:每个产生消息的事件都必须声明它如何加入 surface(派生模型历史的唯一来源)。面向人类的 transcript(文本记录)是另一个投影,读取的是日志中追加来源的事件,因为 surface 会有意遮蔽替换所概括的范围(见 [dsh-session](../../packages/core/session/README.md) 的 `isAppendSurfaceEvent`)。非 surface 类型在编译期拒绝此参数。
319
+ 对 `SurfaceEventType` 事件必填:每个产生消息的事件都必须声明它如何加入 surface(派生模型历史的唯一来源)。面向人类的 transcript(文本记录)是另一个投影,读取的是日志中追加来源的事件,因为 surface 会有意遮蔽替换所概括的范围(见 [dsh-session](../../packages/core/session/README.zh.md) 的 `isAppendSurfaceEvent`)。非 surface 类型在编译期拒绝此参数。
301
320
 
302
321
  只有 `assistant/message` 可以携带存在但为空的 `sourceEventSeqs`;字段不存在时,该事件没有记录这条消息由哪些早期事件产生,但提供方仍可能发出过分片。
303
322
 
@@ -311,7 +330,7 @@ interface SurfaceIntent {
311
330
  /** Readonly live projection of the message-producing session events. */
312
331
  interface SessionSurface {
313
332
  /** Current surface event sequences in model-visible order. */
314
- readonly nodes: readonly number[]
333
+ readonly nodes: readonly SessionSeq[]
315
334
  /** Monotonic count of committed positional replacements. */
316
335
  readonly replaceGeneration: number
317
336
  }
@@ -325,13 +344,13 @@ interface SessionSurface {
325
344
  /** One replacement operation observed while folding a session surface. */
326
345
  interface SurfaceFoldReplacement {
327
346
  /** Seq of the event that replaced the prior surface range. */
328
- seq: number
347
+ seq: SessionSeq
329
348
  /** Declared inclusive start seq of the replaced surface range. */
330
- start: number
349
+ start: SessionSeq
331
350
  /** Declared inclusive end seq of the replaced surface range. */
332
- end: number
351
+ end: SessionSeq
333
352
  /** Actual surface entries removed by the operation, in surface order. */
334
- shadowedSeqs: number[]
353
+ shadowedSeqs: SessionSeq[]
335
354
  }
336
355
  ```
337
356
 
@@ -339,7 +358,7 @@ interface SurfaceFoldReplacement {
339
358
  /** Complete result of replaying the surface operations in a session log. */
340
359
  interface SurfaceFoldResult {
341
360
  /** Current surface event sequences in model-visible order. */
342
- nodes: number[]
361
+ nodes: SessionSeq[]
343
362
  /** Replacement operations in event order. */
344
363
  replacements: SurfaceFoldReplacement[]
345
364
  }
@@ -363,13 +382,15 @@ declare class Session {
363
382
  get surface(): SessionSurface;
364
383
  /**
365
384
  * Detached, deep-frozen creation metadata (format version, cwd, lineage,
366
- * seed boundary). Supplied by the store via `ctx.sessions.create()`. When a
385
+ * and whether fork history exists). Supplied by the store via `ctx.sessions.create()`. When a
367
386
  * `Session` is created without a store-owned header, a minimal header is
368
387
  * synthesized (stamped with the current {@link SESSION_FORMAT_VERSION}) so
369
388
  * `session.header` is always present. Kept out of the event log — it is a
370
389
  * storage concern, not replayable conversation state.
371
390
  */
372
391
  readonly header: SessionHeader;
392
+ /** Number of leading events inherited from this Session's fork parent. */
393
+ readonly inheritedEventCount: SessionLogOffset;
373
394
  /** The session identity, derived from its durable header's single copy. */
374
395
  get id(): SessionId;
375
396
  /**
@@ -378,9 +399,9 @@ declare class Session {
378
399
  * construction — replay, fork, or resume — and were never published on the
379
400
  * `session/event` firehose (constructor seeds do not emit), so consumers
380
401
  * that replay the log as a publication substitute (telemetry adoption)
381
- * start here. Distinct from `header.seedLength`, the DURABLE fork-lineage
382
- * boundary: a resumed session's constructor seed is its full stored log,
383
- * while its header keeps the original fork value — this field is the
402
+ * start here. Distinct from {@link inheritedEventCount}, the DURABLE
403
+ * fork-lineage cut: a resumed session's constructor seed is its full stored
404
+ * log, while the inherited count keeps the original fork value — this field is the
384
405
  * in-process construction fact.
385
406
  *
386
407
  * Not persisted itself: a seeded session projects it into the log as the
@@ -393,17 +414,23 @@ declare class Session {
393
414
  * When this lifecycle appends the marker, it occupies this seq before the
394
415
  * store attaches and therefore does not publish either. Otherwise this seq
395
416
  * holds an ordinary published write.
396
- */
397
- readonly firstLiveSeq: number;
417
+ */
418
+ readonly firstLiveSeq: SessionLogOffset;
398
419
  /**
399
420
  * Create a detached session by validating and snapshotting borrowed seed
400
421
  * events and storage metadata.
401
422
  * @param id - session identity.
402
423
  * @param seed - optional borrowed replay or fork events.
403
424
  * @param header - optional borrowed storage metadata.
425
+ * @param inheritedEventCount - exact fork-inherited prefix length for a seeded header.
404
426
  * @returns a detached session.
405
427
  */
406
- static create(id: SessionId, seed?: readonly SessionEvent[], header?: SessionHeader): Session;
428
+ static create(
429
+ id: SessionId,
430
+ seed?: readonly SessionEvent[],
431
+ header?: SessionHeader,
432
+ inheritedEventCount?: SessionLogOffset,
433
+ ): Session;
407
434
  /**
408
435
  * Restore a detached session by taking ownership of fresh persistence values.
409
436
  * The storage format, event envelopes, sequence continuity, surface transitions,
@@ -411,18 +438,46 @@ declare class Session {
411
438
  * @param id - restored session identity.
412
439
  * @param seed - fresh detached events whose ownership is transferred.
413
440
  * @param header - fresh detached metadata whose ownership is transferred.
441
+ * @param inheritedEventCount - exact fork-inherited prefix length decoded from storage.
414
442
  * @returns a restored detached session.
415
443
  */
416
- static fromRestore(id: SessionId, seed: readonly SessionEvent[], header: SessionHeader): Session;
444
+ static fromRestore(
445
+ id: SessionId,
446
+ seed: readonly SessionEvent[],
447
+ header: SessionHeader,
448
+ inheritedEventCount: SessionLogOffset,
449
+ ): Session;
417
450
  /**
418
- * An immutable snapshot of the append-only event log. The snapshot is reused
419
- * until the next append; a previously returned array does not grow later.
420
- * Events and their nested data are deep-frozen at acceptance, so neither a
421
- * cast nor ordinary JavaScript can rewrite durable history.
451
+ * Return the immutable event stored at one exact sequence number.
452
+ * @param seq - event sequence number.
453
+ * @returns the accepted event, or undefined when the log does not contain it.
422
454
  */
423
- get events(): readonly SessionEvent[];
455
+ eventAt(seq: SessionSeq): SessionEvent | undefined;
456
+ /**
457
+ * Materialize an immutable snapshot of a half-open event sequence range.
458
+ * A full current snapshot is reused until the next append; every previously
459
+ * returned snapshot remains stable after later appends.
460
+ * @param fromSeq - non-negative inclusive sequence number; defaults to the log start.
461
+ * @param toSeqExclusive - non-negative exclusive sequence number; defaults to the current end.
462
+ * @returns a frozen array of the selected deeply frozen events.
463
+ */
464
+ snapshotEvents(
465
+ fromSeq: SessionLogOffset = SessionLogOffset(0),
466
+ toSeqExclusive: SessionLogOffset = this.seq,
467
+ ): readonly SessionEvent[];
468
+ /**
469
+ * Return this Session's events after its fork-inherited prefix.
470
+ * @returns a fresh array containing child-owned events in log order.
471
+ */
472
+ ownEvents(): readonly SessionEvent[];
473
+ /**
474
+ * Whether one existing event position is outside the fork-inherited prefix.
475
+ * @param seq - event position in this Session.
476
+ * @returns true when the event belongs to this Session rather than its parent.
477
+ */
478
+ isOwnSeq(seq: SessionSeq): boolean;
424
479
  /** The next event's sequence number — always the log length (the `seq = log.length` contiguity contract). */
425
- get seq(): number;
480
+ get seq(): SessionLogOffset;
426
481
  /**
427
482
  * Append one typed event to the log and synchronously notify observers via
428
483
  * the store-owned, module-private publication hooks. The hot path never blocks
@@ -450,7 +505,7 @@ declare class Session {
450
505
  * Map/Set/Date/class instance), or when the candidate violates the
451
506
  * canonical surface contract (marker shape and eligibility, unique
452
507
  * earlier source-event references, positional replacement validity, and complete
453
- * shadowed-node coverage). One recursive pass reads, validates, and
508
+ * shadowed-node coverage). One iterative pass reads, validates, and
454
509
  * copies each nested value once, so a stateful getter cannot supply one value
455
510
  * to validation and another to storage. The event log is the durable source
456
511
  * of truth, so a bad event fails at the append site rather than later during
@@ -467,7 +522,7 @@ declare class Session {
467
522
  * The {@link EpochHeader} in force after the log's last header event — the
468
523
  * header the NEXT request will be compared against — or undefined before
469
524
  * the first `request/header` snapshot. The live, incrementally-maintained
470
- * form of `foldRequestHeader(session.events)`: each header event is folded
525
+ * form of `foldRequestHeader(session.snapshotEvents())`: each header event is folded
471
526
  * once, when first seen, so a per-step read costs O(new events).
472
527
  * @returns the folded header, or undefined when no header event exists yet.
473
528
  */
@@ -522,7 +577,7 @@ declare class Session {
522
577
 
523
578
  `ctx.sessions.create(id, { seed, meta })` 是底层的回放/fork 原语。对于普通的活跃会话 fork,`SessionStore` 暴露一个策略 API:
524
579
 
525
- - `fork(source, boundary?, childSessionId?)` 接受一个活跃的 `Session` 对象或活跃的 `SessionId`,选取到 `boundary` seq(含)为止的源事件(默认为当前最后一个事件),要求所选前缀结束时没有开放轮次,然后创建一个活跃的子会话,包含深克隆的种子事件和子会话元数据(`parentSession`、`seedLength` 及继承的 `cwd`)。
580
+ - `fork(source, boundary?, childSessionId?)` 接受一个活跃的 `Session` 对象或活跃的 `SessionId`,选取到 `SessionSeq` boundary(含)为止的源事件(默认为当前最后一个事件),要求所选前缀结束时没有开放轮次,然后创建一个活跃的子会话,包含深克隆的 seed event、`parentSession`、`isSeeded: true`、精确 `inheritedEventCount` 及继承的 `cwd`。
526
581
 
527
582
  显式 `boundary` 允许调用者从任意稳定的轮次间位置 fork,包括之前的 `turn/end` 或更晚的独立纯日志事件,即使源会话有更新的事件或正在进行的轮次。API 拒绝结束于开放轮次内的前缀,而不是静默截断。更广泛的执行关系健全性检查留在既有的 `dsh-invariants` 插件和持久化修复路径中,不在 `fork()` 中重复。`dsh-subagent-fork-in-process` 保留其已完成前缀截断逻辑,因为工具调用时的委托通常在父轮次仍然打开时启动;普通的会话分支应显式指定请求的 boundary。
528
583
 
@@ -530,7 +585,7 @@ declare class Session {
530
585
 
531
586
  ## 轮次的结束原因:`TurnEndReasonMap`
532
587
 
533
- `turn/start` 没有 trigger 字段。已进入的 `user/message` 批次记录进入每个步骤的内容,`llm/retry` 记录请求恢复,idle 注入则保持待处理,直到唤醒交付抵达后续 pre-step。实时轮次会保留停止驱动器的类型化 [`AgentCancelCause`](core.md#the-agent-handle);只有在导入受支持的粗粒度取消记录且记录未保存调用方时,持久化才使用额外的 `{ kind: 'legacy' }` 原因。
588
+ `turn/start` 没有 trigger 字段。已进入的 `user/message` 批次记录进入每个步骤的内容,`llm/retry` 记录请求恢复,idle 注入则保持待处理,直到唤醒交付抵达后续 pre-step。实时轮次会保留停止驱动器的类型化 [`AgentCancelCause`](core.zh.md#the-agent-handle);只有在导入受支持的粗粒度取消记录且记录未保存调用方时,持久化才使用额外的 `{ kind: 'legacy' }` 原因。
534
589
 
535
590
  ```ts type-equiv
536
591
  /** Durable cancellation cause, including imports whose original coarse record carried no cause. */
@@ -556,24 +611,26 @@ interface TurnEndReasonMap {
556
611
  /** At least one step reached its output-token ceiling, even if a plugin continued the turn. */
557
612
  'max-tokens': { kind: 'max-tokens' }
558
613
  /**
559
- * A persistence backend closed a crash-orphaned turn on reload. The loop never
560
- * emits this marker, and the events recorded before the crash remain intact.
614
+ * A crash-orphaned turn was closed after the fact: agent-loop resume appends
615
+ * this closer for a stored log whose last turn never ended, and session-query
616
+ * synthesizes it on cold reads. The loop never emits this marker live, and
617
+ * the events recorded before the crash remain intact.
561
618
  */
562
619
  interrupted: { kind: 'interrupted' }
563
620
  }
564
621
  ```
565
622
 
566
- `max-tokens` 与模型调用中同名的 `FinishReason` 对应:只要轮次内有任何步骤以 `max-tokens` 结束,整个轮次就以 `max-tokens` 而不是 `completed` 结束(即使之后继续执行,截断事实仍优先),让消费方能够区分正常停止和截断停止。取消和错误仍是不同的结果。`interrupted` 是唯一不会由任何 loop 发出的原因:它由崩溃恢复合成(见 [persistence.md](persistence.md))。该 map 可通过合并扩展。
623
+ `max-tokens` 与模型调用中同名的 `FinishReason` 对应:只要轮次内有任何步骤以 `max-tokens` 结束,整个轮次就以 `max-tokens` 而不是 `completed` 结束(即使之后继续执行,截断事实仍优先),让消费方能够区分正常停止和截断停止。取消和错误仍是不同的结果。`interrupted` 是唯一不会由任何 loop 发出的原因:它由崩溃恢复合成(见 [persistence.md](persistence.zh.md))。该 map 可通过合并扩展。
567
624
 
568
625
  ## 执行封闭与独立事件
569
626
 
570
627
  一个轮次包围一次模型循环执行,而不是整个会话日志。AgentLoop 只会在轮次内进入 pre-step 批次时记录注入的 `user/message` 事件;插件所属的纯日志事件仍可出现在 `turn/end` 与下一个 `turn/start` 之间,占用事件 seq 但不递增轮次编号。持久化会将每个连续且已接受的事件纳入有界持久化批次,而崩溃修复只关闭确实仍处于开放状态的尾部轮次。需要即时持久性屏障的生产方会显式等待 `ctx.sessions.flush(session)`。
571
628
 
572
- 可选的 `dsh-session/invariant` 配套插件会强制核心拥有的关系:轮次与步骤编号、执行事件封闭,以及同一步骤内的工具调用/结果配对。可合并扩展事件的关系由声明它的插件拥有,因此核心不会仅因没有开放轮次就拒绝未知事件。见[独立事件决策](../../.agents/notes/implemented/simplification/2026-07-28-remove-synthetic-log-only-turns.md)。
629
+ 可选的 `dsh-session/invariant` 配套插件会强制核心拥有的关系:轮次与步骤编号、执行事件封闭,以及同一步骤内的工具调用/结果配对。可合并扩展事件的关系由声明它的插件拥有,因此核心不会仅因没有开放轮次就拒绝未知事件。见[独立事件决策](../../.agents/notes/implemented/simplification/2026-07-28-remove-synthetic-log-only-turns.zh.md)。
573
630
 
574
631
  ## 种子结束边界:`session/end-seed`
575
632
 
576
- 带种子的会话(恢复、fork 或回放)紧接构造种子之后追加这个仅日志事件,作为自己的第一次实时写入。在它之前的事件具有更小的 seq,且来自种子。它是 `firstLiveSeq` 的持久投影:该字段为持有对象的消费方回答本生命周期的写入从哪里开始,该事件则为只持有存储字节的消费方回答同一问题。payload 为空,因此位置与 `time` 承载全部含义,且不产生任何消息。`Session` 的构造函数是唯一合法的写入方。
633
+ 用显式 seed 构造的 Session(restore、fork replay)会紧接该 constructor seed 之后追加这个仅日志事件,作为自己的第一次实时写入。在它之前的事件具有更小的 seq,且经由构造进入。它是 `firstLiveSeq` 的持久投影:该字段为持有对象的 consumer 回答本 lifecycle 的写入从哪里开始,该事件则为只持有存储字节的 consumer 回答同一问题。它不定义 fork ownership;`isSeeded` 与 `inheritedEventCount` 才定义。payload 为空,因此位置与 `time` 承载全部含义,且不产生任何消息。`Session` 的构造函数是唯一合法的写入方。
577
634
 
578
635
  显式传入的空种子会在 seq 0 写入 `session/end-seed`,从而把从空日志恢复的会话与全新会话区分开来。种子本身已以 `session/end-seed` 结尾时不会重复标记,因此重新打开一个未被改动的会话不会每次拾起都增长日志。应定位存储历史中的最后一条 `session/end-seed`,而不是假定 `firstLiveSeq` 处一定有一条:在一次没有产生工作的拾起之后,该事件的 seq 会小于下一个生命周期的 `firstLiveSeq`。
579
636
 
@@ -583,17 +640,23 @@ interface TurnEndReasonMap {
583
640
 
584
641
  ## 插件贡献的仅日志事件
585
642
 
586
- 插件可以通过 declaration merging 添加额外的 `SessionEventMap` 类型。这些是**仅日志**事件:不是 `SurfaceEventType`(不携带 `surfaceOp`,不参与派生历史)。事件所有方决定它们属于一个开放的执行轮次,还是可以独立位于轮次之间,并在自己的不变量配套插件中强制所需关系。生成的[持久化日志事件目录](../persistence-catalog.md)会列出每个核心或插件贡献的事件,以及其 payload、surface 标记和声明位置;压缩 seam 的 `compaction/*` 语义在 [compaction.md](compaction.md) 中讨论。
643
+ 插件可以通过 declaration merging 添加额外的 `SessionEventMap` 类型。这些是**仅日志**事件:不是 `SurfaceEventType`(不携带 `surfaceOp`,不参与派生历史)。事件所有方决定它们属于一个开放的执行轮次,还是可以独立位于轮次之间,并在自己的不变量配套插件中强制所需关系。生成的[持久化日志事件目录](../persistence-catalog.zh.md)会列出每个核心或插件贡献的事件;压缩 seam 的 `compaction/*` 语义在 [compaction.md](compaction.zh.md) 中讨论。
587
644
 
588
- 如果同一个插件事件族中的多条事件要组装成一个 Web Client Conversation Node,该事件族中的每条 start、update、result、resource 或 interruption 事件都必须携带或独立推导出同一个稳定业务 id。此要求只约束需要关联的 Node 事件族,并不要求每条 Session 事件都有业务 id;Client 因此无须根据相邻关系猜测归属,也无须扫描历史。参见 [Conversation Node 实操手册](../cookbook/adding-a-conversation-node.md)。
645
+ 如果同一个插件事件族中的多条事件要组装成一个 Web Client Conversation Node,该事件族中的每条 start、update、result、resource 或 interruption 事件都必须携带或独立推导出同一个稳定业务 id。此要求只约束需要关联的 Node 事件族,并不要求每条 Session 事件都有业务 id;Client 因此无须根据相邻关系猜测归属,也无须扫描历史。参见 [Conversation 子系统](conversation.zh.md)。
589
646
 
590
- 钩子桥接层的 `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.md))。
647
+ 钩子桥接层的 `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))。
591
648
 
592
649
  ## 持久性约定
593
650
 
594
- 持久化后端依赖的约定如下:持久日志无损保存每个事件,**包括** `assistant/chunk`;`seq` 必须连续,因此不能从规范日志中过滤分片。后端可以为事件批次选择自己的存储编码,只要 `load` 返回与追加时完全一致的事件即可(JSONL 后端默认启用的打包分片行就是此类编码;见 [persistence.md](persistence.md))。所有 `event.data` 都必须可序列化为 JSON;`Session.append` 会从源头强制这一要求(遇到不可序列化数据时抛出),因此错误事件绝不会进入日志,`session.events` 始终与后端可持久化的内容一致。新增会携带不可序列化数据、破坏核心执行嵌套或违反事件所有方声明关系的事件类型,都会构成磁盘格式的破坏性变更。
651
+ 持久化后端依赖的约定如下:持久日志无损保存每个事件,**包括** `assistant/chunk`;`seq` 必须连续,因此不能从规范日志中过滤分片。后端可以为事件批次选择自己的存储编码,只要 handle 的 `read()` 返回与追加时完全一致的事件即可(JSONL 后端默认启用的打包分片行就是此类编码;见 [persistence.md](persistence.zh.md))。所有 `event.data` 都必须可序列化为 JSON;`Session.append` 会从源头强制这一要求(遇到不可序列化数据时抛出),因此错误事件绝不会进入日志,`session.snapshotEvents()` 始终与后端可持久化的内容一致。新增会携带不可序列化数据、破坏核心执行嵌套或违反事件所有方声明关系的事件类型,都会构成磁盘格式的破坏性变更。
652
+
653
+ 消费此约定的后端见 [persistence.md](persistence.zh.md)。
654
+
655
+ ## Remote 目录与 workspace 打开
595
656
 
596
- 消费此约定的后端见 [persistence.md](persistence.md)。
657
+ `ModelCatalog` 是 `session/modelCatalog` 返回的 Host generation 模型目录:它携带部署默认值、可路由 provider id、成功的 provider 分组与相互隔离的 provider 失败。它不由某个 Session 派生,因此与 Session projection 分开保存。
658
+
659
+ `SessionOpenWorkspacePathRequest` 携带绝对路径或已按 workspace 解析的 `path`。`SessionOpenWorkspacePathValue` 确认 Host 已接受原生交接。Session-aware Client 会在已知当前 Session cwd 时据此解析相对路径;controller 将路径原样交给打开器,并通过 Session Remote 错误词汇表报告无效请求、取消与打开器失败。
597
660
 
598
661
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
599
662
 
@@ -601,7 +664,151 @@ interface TurnEndReasonMap {
601
664
 
602
665
  ## Cordis API
603
666
 
604
- 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`) — this section is byte-identical in both language sides of the page. 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).
667
+ 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).
668
+
669
+ <a id="ctxsessioncontroller--sessioncontroller"></a>
670
+
671
+ ### `ctx.sessionController` — `SessionController`
672
+
673
+ Host service backing the generated `ctx.remote.session` namespace.
674
+
675
+ ```ts cordis-catalog
676
+ /**
677
+ * Resolve or resume one ordinary Session for another Host API domain.
678
+ * @param sessionId - Session identity whose Agent owns the operation.
679
+ * @returns the live Agent or the stable Session-domain failure.
680
+ */
681
+ resolveAgent(sessionId: SessionId): Promise<ApiSessionAgentResult>
682
+
683
+ /**
684
+ * Inspect one attached or persisted Session without activating its Agent.
685
+ * @param sessionId - durable Session identity.
686
+ * @param signal - optional caller cancellation for persistence reads.
687
+ * @returns the current attached state or persisted header and event prefix.
688
+ */
689
+ inspect( sessionId: SessionId, signal?: AbortSignal, ): Promise<SessionInspection>
690
+
691
+ /**
692
+ * Read all visible Session rows without resuming an Agent.
693
+ * @param _request - reserved empty list request.
694
+ * @param signal - cancellation for persistence reads.
695
+ * @returns visible Session summaries ordered by activity.
696
+ */
697
+ @Remote('list') async list(_request: SessionListRequest, signal: AbortSignal): Promise<SessionListValue>
698
+
699
+ /**
700
+ * Search visible Session content without resuming an Agent.
701
+ * @param request - literal message-content query.
702
+ * @param signal - cancellation for list and search reads.
703
+ * @returns authorized bounded Session search results.
704
+ */
705
+ @Remote('search') search(request: SessionSearchRequest, signal: AbortSignal): Promise<SessionSearchValue>
706
+
707
+ /**
708
+ * Create or idempotently adopt one ordinary Session.
709
+ * @param request - requested identity, location, and Agent preset.
710
+ * @returns the Session identity and resolved preset when configured.
711
+ */
712
+ @Remote('create') create(request: SessionCreateRequest): Promise<SessionCreateValue>
713
+
714
+ /**
715
+ * Select one Session-local model after explicitly resuming the Session.
716
+ * @param request - Session identity and requested model selection.
717
+ * @returns the normalized selection installed for the Session.
718
+ */
719
+ @Remote('selectModel') selectModel(request: SessionSelectModelRequest): Promise<SessionSelectModelValue>
720
+
721
+ /**
722
+ * Describe every currently routable model for Host-generation selectors.
723
+ * @returns provider-grouped models, the deployment default, and isolated provider failures.
724
+ */
725
+ @Remote('modelCatalog') modelCatalog(): Promise<ModelCatalog>
726
+
727
+ /**
728
+ * Report whether this deployment can hand a Session workspace path to a native desktop.
729
+ * @returns true when the matching open operation is available.
730
+ */
731
+ @Remote canOpenWorkspacePath(): boolean
732
+
733
+ /**
734
+ * Open one path prepared by a Session-aware caller on the Host desktop.
735
+ * @param request - path after best-effort Session workspace resolution.
736
+ * @param signal - caller lifetime; abort terminates the native command.
737
+ * @returns confirmation after the native opener accepts the path.
738
+ * @throws RemoteError when the request is invalid, cancelled, or the opener fails.
739
+ */
740
+ @Remote('openWorkspacePath') async openWorkspacePath( request: SessionOpenWorkspacePathRequest, signal: AbortSignal, ): Promise<SessionOpenWorkspacePathValue>
741
+
742
+ /**
743
+ * Rename one Session after explicitly resuming it.
744
+ * @param request - Session identity and proposed title.
745
+ * @returns the accepted title and durable event sequence.
746
+ */
747
+ @Remote('rename') rename(request: SessionRenameRequest): Promise<SessionRenameValue>
748
+
749
+ /**
750
+ * Fork one cold-readable completed-turn prefix into a new Session.
751
+ * @param request - source Session and optional event anchor.
752
+ * @returns the new Session identity.
753
+ */
754
+ @Remote('fork') fork(request: SessionForkRequest): Promise<SessionForkValue>
755
+
756
+ /**
757
+ * Admit one prompt after explicitly resuming its Session.
758
+ * @param request - Session identity, prompt content, source metadata, and delivery mode.
759
+ * @param signal - caller cancellation before prompt admission begins.
760
+ * @returns acknowledgement that the Agent accepted the prompt.
761
+ */
762
+ @Remote('prompt') prompt(request: SessionPromptRequest, signal: AbortSignal): Promise<SessionPromptValue>
763
+
764
+ /**
765
+ * Read one image proven reachable from the addressed Session log.
766
+ * @param request - Session and attachment identities used for authorization.
767
+ * @returns the durable attachment reference and base64-encoded bytes.
768
+ */
769
+ @Remote('attachment') attachment(request: SessionAttachmentRequest): Promise<SessionAttachmentValue>
770
+
771
+ /**
772
+ * Mutate one still-pending queue occurrence on a live Agent.
773
+ * @param request - Session, queue item, and requested mutation.
774
+ * @returns acknowledgement that the queue mutation was applied.
775
+ */
776
+ @Remote('updateQueue') updateQueue(request: SessionUpdateQueueRequest): SessionUpdateQueueValue
777
+
778
+ /**
779
+ * Cancel one active Agent turn without dropping its pending inbox.
780
+ * @param request - Session whose active Agent turn is cancelled.
781
+ * @returns acknowledgement that cancellation was requested.
782
+ */
783
+ @Remote('cancel') cancel(request: SessionCancelRequest): SessionCancelValue
784
+
785
+ /**
786
+ * Read one cold-safe, message-aligned Session history page.
787
+ * @param request - durable address, backward cursor, and page budget.
788
+ * @param signal - cancellation for persistence reads.
789
+ * @returns one chronological page.
790
+ */
791
+ @Remote('page') page(request: SessionPageRequest, signal: AbortSignal): Promise<SessionPage>
792
+
793
+ /**
794
+ * Follow one Session log from its opening or resume cursor.
795
+ * @param request - durable address and last committed sequence already held by the caller.
796
+ * @param signal - cancellation owned by the Remote stream carrier.
797
+ * @returns a complete opening snapshot followed by gap-free event frames.
798
+ */
799
+ @Remote({ mode: 'stream' }) follow(request: SessionFollowRequest, signal: AbortSignal): AsyncIterable<SessionFollowFrame>
800
+
801
+ /**
802
+ * Stream a complete live-control baseline followed by replacement frames.
803
+ * @param signal - cancellation owned by the Remote stream carrier.
804
+ * @returns one complete baseline followed by live replacement frames.
805
+ */
806
+ @Remote({ mode: 'stream' }) control(signal: AbortSignal): AsyncIterable<SessionControlFrame>
807
+ ```
808
+
809
+ Types: [SessionId](core.zh.md) · [SessionInspection](persistence.zh.md) · [SessionSearchRequest](session-query.zh.md)
810
+
811
+ Source: [`packages/api/session-controller/src/index.ts`](../../packages/api/session-controller/src/index.ts)
605
812
 
606
813
  <a id="ctxsessions--sessionstore"></a>
607
814
 
@@ -609,7 +816,7 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
609
816
 
610
817
  In-memory session store (`ctx.sessions`).
611
818
 
612
- Persistence is intentionally not implemented here — persistence plugins subscribe to `session/event` and flush on `session/flush` / dispose.
819
+ 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.
613
820
 
614
821
  ```ts cordis-catalog
615
822
  /**
@@ -732,12 +939,112 @@ list(): Session[]
732
939
  * `SessionStore`'s id policy.
733
940
  * @returns The created live child session.
734
941
  */
735
- fork(source: SessionForkSource, boundary?: number, childSessionId?: SessionId): Session
942
+ fork(source: SessionForkSource, boundary?: SessionSeq, childSessionId?: SessionId): Session
943
+ ```
944
+
945
+ Types: [CreateSessionOptions](persistence.zh.md) · [PrepareSessionOptions](persistence.zh.md) · [SessionId](core.zh.md)
946
+
947
+ Source: [`packages/core/session/src/index.ts`](../../packages/core/session/src/index.ts)
948
+
949
+ <a id="api-session-events"></a>
950
+
951
+ ### `api-session/*` events
952
+
953
+ <a id="api-sessionactivity--emit"></a>
954
+
955
+ #### `api-session/activity` — emit
956
+
957
+ One user-authored durable message advanced Session list activity.
958
+
959
+ ```ts cordis-catalog
960
+ /**
961
+ * One user-authored durable message advanced Session list activity.
962
+ * @mode emit
963
+ * @param sessionId - addressed Session identity.
964
+ * @param updatedAt - durable message time used for list ordering.
965
+ */
966
+ 'api-session/activity'(sessionId: SessionId, updatedAt: number): void
967
+ ```
968
+
969
+ Types: [SessionId](core.zh.md)
970
+
971
+ Source: [`packages/api/session-controller/src/types.ts`](../../packages/api/session-controller/src/types.ts)
972
+
973
+ <a id="api-sessionadded--emit"></a>
974
+
975
+ #### `api-session/added` — emit
976
+
977
+ A Session became visible to Session list consumers.
978
+
979
+ ```ts cordis-catalog
980
+ /**
981
+ * A Session became visible to Session list consumers.
982
+ * @mode emit
983
+ * @param summary - initial list row for the Session.
984
+ */
985
+ 'api-session/added'(summary: SessionSummary): void
986
+ ```
987
+
988
+ Source: [`packages/api/session-controller/src/types.ts`](../../packages/api/session-controller/src/types.ts)
989
+
990
+ <a id="api-sessionerror--emit"></a>
991
+
992
+ #### `api-session/error` — emit
993
+
994
+ One Agent failed outside a durable turn position.
995
+
996
+ ```ts cordis-catalog
997
+ /**
998
+ * One Agent failed outside a durable turn position.
999
+ * @mode emit
1000
+ * @param sessionId - Agent and Session identity.
1001
+ * @param message - user-safe failure chain.
1002
+ */
1003
+ 'api-session/error'(sessionId: SessionId, message: string): void
1004
+ ```
1005
+
1006
+ Types: [SessionId](core.zh.md)
1007
+
1008
+ Source: [`packages/api/session-controller/src/types.ts`](../../packages/api/session-controller/src/types.ts)
1009
+
1010
+ <a id="api-sessionremoved--emit"></a>
1011
+
1012
+ #### `api-session/removed` — emit
1013
+
1014
+ A Session left the live Host registry.
1015
+
1016
+ ```ts cordis-catalog
1017
+ /**
1018
+ * A Session left the live Host registry.
1019
+ * @mode emit
1020
+ * @param sessionId - removed Session identity.
1021
+ */
1022
+ 'api-session/removed'(sessionId: SessionId): void
1023
+ ```
1024
+
1025
+ Types: [SessionId](core.zh.md)
1026
+
1027
+ Source: [`packages/api/session-controller/src/types.ts`](../../packages/api/session-controller/src/types.ts)
1028
+
1029
+ <a id="api-sessionstatus--emit"></a>
1030
+
1031
+ #### `api-session/status` — emit
1032
+
1033
+ One Agent changed running state.
1034
+
1035
+ ```ts cordis-catalog
1036
+ /**
1037
+ * One Agent changed running state.
1038
+ * @mode emit
1039
+ * @param sessionId - Agent and Session identity.
1040
+ * @param running - whether the Agent is running.
1041
+ */
1042
+ 'api-session/status'(sessionId: SessionId, running: boolean): void
736
1043
  ```
737
1044
 
738
- Types: [CreateSessionOptions](persistence.md) · [PrepareSessionOptions](persistence.md) · [SessionId](core.md)
1045
+ Types: [SessionId](core.zh.md)
739
1046
 
740
- Source: [`packages/core/session/src/index.ts:792`](../../packages/core/session/src/index.ts)
1047
+ Source: [`packages/api/session-controller/src/types.ts`](../../packages/api/session-controller/src/types.ts)
741
1048
 
742
1049
  <a id="session-events"></a>
743
1050
 
@@ -764,9 +1071,9 @@ Creation announcement during session publication. A synchronous throw vetoes and
764
1071
  'session/created'(this: Scoped<Session>, session: Session): void
765
1072
  ```
766
1073
 
767
- Types: [Scoped](scope.md)
1074
+ Types: [Scoped](scope.zh.md)
768
1075
 
769
- Source: [`packages/core/session/src/index.ts:54`](../../packages/core/session/src/index.ts)
1076
+ Source: [`packages/core/session/src/index.ts`](../../packages/core/session/src/index.ts)
770
1077
 
771
1078
  <a id="sessiondisposed--emit"></a>
772
1079
 
@@ -787,9 +1094,9 @@ Emitted once when an announced session leaves the store, including publication r
787
1094
  'session/disposed'(this: Scoped<Session>, session: Session): void
788
1095
  ```
789
1096
 
790
- Types: [Scoped](scope.md)
1097
+ Types: [Scoped](scope.zh.md)
791
1098
 
792
- Source: [`packages/core/session/src/index.ts:64`](../../packages/core/session/src/index.ts)
1099
+ Source: [`packages/core/session/src/index.ts`](../../packages/core/session/src/index.ts)
793
1100
 
794
1101
  <a id="sessionevent--emit"></a>
795
1102
 
@@ -812,9 +1119,9 @@ Post-commit, fire-and-forget append feed. The listener snapshot resolves before
812
1119
  'session/event'(this: Scoped<Session>, session: Session, event: SessionEvent): void
813
1120
  ```
814
1121
 
815
- Types: [Scoped](scope.md)
1122
+ Types: [Scoped](scope.zh.md)
816
1123
 
817
- Source: [`packages/core/session/src/index.ts:76`](../../packages/core/session/src/index.ts)
1124
+ Source: [`packages/core/session/src/index.ts`](../../packages/core/session/src/index.ts)
818
1125
 
819
1126
  <a id="sessionflush--parallel"></a>
820
1127
 
@@ -834,7 +1141,7 @@ Awaited parallel durability checkpoint: every listener runs and the caller await
834
1141
  'session/flush'(this: Scoped<Session>, session: Session): Promise<void> | void
835
1142
  ```
836
1143
 
837
- Types: [Scoped](scope.md)
1144
+ Types: [Scoped](scope.zh.md)
838
1145
 
839
- Source: [`packages/core/session/src/index.ts:85`](../../packages/core/session/src/index.ts)
1146
+ Source: [`packages/core/session/src/index.ts`](../../packages/core/session/src/index.ts)
840
1147
  <!-- END GENERATED cordis-surface -->