dsh-plugin-guide 0.1.0

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 (374) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE.md +26 -0
  3. package/README.es.md +139 -0
  4. package/README.hi.md +138 -0
  5. package/README.md +165 -0
  6. package/README.pt.md +139 -0
  7. package/README.zh-CN.md +164 -0
  8. package/SKILL.md +69 -0
  9. package/cordis.patch.yml +4 -0
  10. package/guide/links.md +92 -0
  11. package/guide/plugin-dev-guide.md +429 -0
  12. package/guide/quick-reference.es.md +176 -0
  13. package/guide/quick-reference.hi.md +176 -0
  14. package/guide/quick-reference.md +176 -0
  15. package/guide/quick-reference.pt.md +176 -0
  16. package/guide/quick-reference.zh-CN.md +175 -0
  17. package/index.js +58 -0
  18. package/package.json +83 -0
  19. package/references/community-ecosystem.md +201 -0
  20. package/references/community-repo-deep-dive.md +695 -0
  21. package/references/cordis-paper-and-community.md +326 -0
  22. package/references/harness-repo.md +654 -0
  23. package/references/official-docs/AGENTS.md +149 -0
  24. package/references/official-docs/BENCHMARK.md +3 -0
  25. package/references/official-docs/CLAUDE.md +1 -0
  26. package/references/official-docs/CONTRIBUTING.i18n.yaml +6 -0
  27. package/references/official-docs/CONTRIBUTING.md +23 -0
  28. package/references/official-docs/CONTRIBUTING.zh.md +23 -0
  29. package/references/official-docs/LICENSE +21 -0
  30. package/references/official-docs/README.i18n.yaml +6 -0
  31. package/references/official-docs/README.md +35 -0
  32. package/references/official-docs/README.zh.md +74 -0
  33. package/references/official-docs/SNAPSHOT.md +16 -0
  34. package/references/official-docs/THIRD_PARTY_NOTICES.md +192 -0
  35. package/references/official-docs/docs/AGENTS.md +75 -0
  36. package/references/official-docs/docs/agent-lifecycle.i18n.yaml +6 -0
  37. package/references/official-docs/docs/agent-lifecycle.md +82 -0
  38. package/references/official-docs/docs/agent-lifecycle.zh.md +84 -0
  39. package/references/official-docs/docs/api-gateway.i18n.yaml +6 -0
  40. package/references/official-docs/docs/api-gateway.md +164 -0
  41. package/references/official-docs/docs/api-gateway.zh.md +164 -0
  42. package/references/official-docs/docs/architecture.i18n.yaml +6 -0
  43. package/references/official-docs/docs/architecture.md +129 -0
  44. package/references/official-docs/docs/architecture.zh.md +133 -0
  45. package/references/official-docs/docs/capability-seams.i18n.yaml +6 -0
  46. package/references/official-docs/docs/capability-seams.md +471 -0
  47. package/references/official-docs/docs/capability-seams.zh.md +473 -0
  48. package/references/official-docs/docs/config-catalog.i18n.yaml +6 -0
  49. package/references/official-docs/docs/config-catalog.md +3151 -0
  50. package/references/official-docs/docs/config-catalog.zh.md +3152 -0
  51. package/references/official-docs/docs/cookbook/adding-a-conversation-node.i18n.yaml +6 -0
  52. package/references/official-docs/docs/cookbook/adding-a-conversation-node.md +233 -0
  53. package/references/official-docs/docs/cookbook/adding-a-conversation-node.zh.md +233 -0
  54. package/references/official-docs/docs/cookbook/adding-a-package.i18n.yaml +6 -0
  55. package/references/official-docs/docs/cookbook/adding-a-package.md +118 -0
  56. package/references/official-docs/docs/cookbook/adding-a-package.zh.md +118 -0
  57. package/references/official-docs/docs/cookbook/adding-a-tool.i18n.yaml +6 -0
  58. package/references/official-docs/docs/cookbook/adding-a-tool.md +94 -0
  59. package/references/official-docs/docs/cookbook/adding-a-tool.zh.md +96 -0
  60. package/references/official-docs/docs/cookbook/adding-a-vendored-package.i18n.yaml +6 -0
  61. package/references/official-docs/docs/cookbook/adding-a-vendored-package.md +59 -0
  62. package/references/official-docs/docs/cookbook/adding-a-vendored-package.zh.md +59 -0
  63. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.i18n.yaml +6 -0
  64. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.md +43 -0
  65. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.zh.md +43 -0
  66. package/references/official-docs/docs/cookbook/extension-cookbook.i18n.yaml +6 -0
  67. package/references/official-docs/docs/cookbook/extension-cookbook.md +129 -0
  68. package/references/official-docs/docs/cookbook/extension-cookbook.zh.md +131 -0
  69. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.i18n.yaml +6 -0
  70. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.md +64 -0
  71. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.zh.md +64 -0
  72. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.i18n.yaml +6 -0
  73. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.md +32 -0
  74. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +32 -0
  75. package/references/official-docs/docs/cordis-api/context.i18n.yaml +6 -0
  76. package/references/official-docs/docs/cordis-api/context.md +364 -0
  77. package/references/official-docs/docs/cordis-api/context.zh.md +366 -0
  78. package/references/official-docs/docs/cordis-api/events.i18n.yaml +6 -0
  79. package/references/official-docs/docs/cordis-api/events.md +207 -0
  80. package/references/official-docs/docs/cordis-api/events.zh.md +209 -0
  81. package/references/official-docs/docs/cordis-api/fiber.i18n.yaml +6 -0
  82. package/references/official-docs/docs/cordis-api/fiber.md +375 -0
  83. package/references/official-docs/docs/cordis-api/fiber.zh.md +377 -0
  84. package/references/official-docs/docs/cordis-api/inherited.md +39 -0
  85. package/references/official-docs/docs/cordis-api/registry.i18n.yaml +6 -0
  86. package/references/official-docs/docs/cordis-api/registry.md +152 -0
  87. package/references/official-docs/docs/cordis-api/registry.zh.md +154 -0
  88. package/references/official-docs/docs/cordis-api/service.i18n.yaml +6 -0
  89. package/references/official-docs/docs/cordis-api/service.md +102 -0
  90. package/references/official-docs/docs/cordis-api/service.zh.md +104 -0
  91. package/references/official-docs/docs/cordis-primer.i18n.yaml +6 -0
  92. package/references/official-docs/docs/cordis-primer.md +44 -0
  93. package/references/official-docs/docs/cordis-primer.zh.md +50 -0
  94. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.i18n.yaml +6 -0
  95. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.md +95 -0
  96. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.zh.md +95 -0
  97. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.i18n.yaml +6 -0
  98. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
  99. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.zh.md +98 -0
  100. package/references/official-docs/docs/cordis-tutorial/03-services.i18n.yaml +6 -0
  101. package/references/official-docs/docs/cordis-tutorial/03-services.md +98 -0
  102. package/references/official-docs/docs/cordis-tutorial/03-services.zh.md +98 -0
  103. package/references/official-docs/docs/cordis-tutorial/04-events.i18n.yaml +6 -0
  104. package/references/official-docs/docs/cordis-tutorial/04-events.md +144 -0
  105. package/references/official-docs/docs/cordis-tutorial/04-events.zh.md +144 -0
  106. package/references/official-docs/docs/cordis-tutorial/05-config.i18n.yaml +6 -0
  107. package/references/official-docs/docs/cordis-tutorial/05-config.md +84 -0
  108. package/references/official-docs/docs/cordis-tutorial/05-config.zh.md +84 -0
  109. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.i18n.yaml +6 -0
  110. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.md +113 -0
  111. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.zh.md +113 -0
  112. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.i18n.yaml +6 -0
  113. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.md +107 -0
  114. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.zh.md +107 -0
  115. package/references/official-docs/docs/cordis-tutorial/index.i18n.yaml +6 -0
  116. package/references/official-docs/docs/cordis-tutorial/index.md +60 -0
  117. package/references/official-docs/docs/cordis-tutorial/index.zh.md +62 -0
  118. package/references/official-docs/docs/defensive-patterns.i18n.yaml +6 -0
  119. package/references/official-docs/docs/defensive-patterns.md +33 -0
  120. package/references/official-docs/docs/defensive-patterns.zh.md +33 -0
  121. package/references/official-docs/docs/development.i18n.yaml +6 -0
  122. package/references/official-docs/docs/development.md +171 -0
  123. package/references/official-docs/docs/development.zh.md +171 -0
  124. package/references/official-docs/docs/event-producer-consumer.i18n.yaml +6 -0
  125. package/references/official-docs/docs/event-producer-consumer.md +76 -0
  126. package/references/official-docs/docs/event-producer-consumer.zh.md +78 -0
  127. package/references/official-docs/docs/glossary.i18n.yaml +6 -0
  128. package/references/official-docs/docs/glossary.md +45 -0
  129. package/references/official-docs/docs/glossary.zh.md +45 -0
  130. package/references/official-docs/docs/graph-atlas.i18n.yaml +6 -0
  131. package/references/official-docs/docs/graph-atlas.md +24 -0
  132. package/references/official-docs/docs/graph-atlas.zh.md +26 -0
  133. package/references/official-docs/docs/i18n/README.i18n.yaml +6 -0
  134. package/references/official-docs/docs/i18n/README.md +60 -0
  135. package/references/official-docs/docs/i18n/README.zh.md +60 -0
  136. package/references/official-docs/docs/i18n/style-samples.md +87 -0
  137. package/references/official-docs/docs/i18n/terminology.md +214 -0
  138. package/references/official-docs/docs/i18n/translation-prompt.md +263 -0
  139. package/references/official-docs/docs/i18n/translation-rules.i18n.yaml +6 -0
  140. package/references/official-docs/docs/i18n/translation-rules.md +69 -0
  141. package/references/official-docs/docs/i18n/translation-rules.zh.md +69 -0
  142. package/references/official-docs/docs/module-graph.i18n.yaml +6 -0
  143. package/references/official-docs/docs/module-graph.md +1638 -0
  144. package/references/official-docs/docs/module-graph.zh.md +1640 -0
  145. package/references/official-docs/docs/persistence-catalog.i18n.yaml +6 -0
  146. package/references/official-docs/docs/persistence-catalog.md +944 -0
  147. package/references/official-docs/docs/persistence-catalog.zh.md +946 -0
  148. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.i18n.yaml +6 -0
  149. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.md +113 -0
  150. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.zh.md +113 -0
  151. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.i18n.yaml +6 -0
  152. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.md +47 -0
  153. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +47 -0
  154. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.i18n.yaml +6 -0
  155. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.md +53 -0
  156. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.zh.md +53 -0
  157. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.i18n.yaml +6 -0
  158. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +55 -0
  159. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +55 -0
  160. package/references/official-docs/docs/postmortem/README.i18n.yaml +6 -0
  161. package/references/official-docs/docs/postmortem/README.md +18 -0
  162. package/references/official-docs/docs/postmortem/README.zh.md +18 -0
  163. package/references/official-docs/docs/rescope.i18n.yaml +6 -0
  164. package/references/official-docs/docs/rescope.md +53 -0
  165. package/references/official-docs/docs/rescope.zh.md +53 -0
  166. package/references/official-docs/docs/subsystems/README.i18n.yaml +6 -0
  167. package/references/official-docs/docs/subsystems/README.md +55 -0
  168. package/references/official-docs/docs/subsystems/README.zh.md +55 -0
  169. package/references/official-docs/docs/subsystems/approval.i18n.yaml +6 -0
  170. package/references/official-docs/docs/subsystems/approval.md +170 -0
  171. package/references/official-docs/docs/subsystems/approval.zh.md +170 -0
  172. package/references/official-docs/docs/subsystems/attachment.i18n.yaml +6 -0
  173. package/references/official-docs/docs/subsystems/attachment.md +115 -0
  174. package/references/official-docs/docs/subsystems/attachment.zh.md +115 -0
  175. package/references/official-docs/docs/subsystems/client-modules.i18n.yaml +6 -0
  176. package/references/official-docs/docs/subsystems/client-modules.md +118 -0
  177. package/references/official-docs/docs/subsystems/client-modules.zh.md +118 -0
  178. package/references/official-docs/docs/subsystems/code-runtime.i18n.yaml +6 -0
  179. package/references/official-docs/docs/subsystems/code-runtime.md +191 -0
  180. package/references/official-docs/docs/subsystems/code-runtime.zh.md +191 -0
  181. package/references/official-docs/docs/subsystems/commands.i18n.yaml +6 -0
  182. package/references/official-docs/docs/subsystems/commands.md +187 -0
  183. package/references/official-docs/docs/subsystems/commands.zh.md +187 -0
  184. package/references/official-docs/docs/subsystems/compaction.i18n.yaml +6 -0
  185. package/references/official-docs/docs/subsystems/compaction.md +238 -0
  186. package/references/official-docs/docs/subsystems/compaction.zh.md +238 -0
  187. package/references/official-docs/docs/subsystems/core.i18n.yaml +6 -0
  188. package/references/official-docs/docs/subsystems/core.md +1070 -0
  189. package/references/official-docs/docs/subsystems/core.zh.md +1078 -0
  190. package/references/official-docs/docs/subsystems/credentials.i18n.yaml +6 -0
  191. package/references/official-docs/docs/subsystems/credentials.md +133 -0
  192. package/references/official-docs/docs/subsystems/credentials.zh.md +133 -0
  193. package/references/official-docs/docs/subsystems/extensions.i18n.yaml +6 -0
  194. package/references/official-docs/docs/subsystems/extensions.md +364 -0
  195. package/references/official-docs/docs/subsystems/extensions.zh.md +364 -0
  196. package/references/official-docs/docs/subsystems/feedback.i18n.yaml +6 -0
  197. package/references/official-docs/docs/subsystems/feedback.md +266 -0
  198. package/references/official-docs/docs/subsystems/feedback.zh.md +266 -0
  199. package/references/official-docs/docs/subsystems/filesystem.i18n.yaml +6 -0
  200. package/references/official-docs/docs/subsystems/filesystem.md +495 -0
  201. package/references/official-docs/docs/subsystems/filesystem.zh.md +495 -0
  202. package/references/official-docs/docs/subsystems/goal.i18n.yaml +6 -0
  203. package/references/official-docs/docs/subsystems/goal.md +277 -0
  204. package/references/official-docs/docs/subsystems/goal.zh.md +277 -0
  205. package/references/official-docs/docs/subsystems/invariants.i18n.yaml +6 -0
  206. package/references/official-docs/docs/subsystems/invariants.md +88 -0
  207. package/references/official-docs/docs/subsystems/invariants.zh.md +88 -0
  208. package/references/official-docs/docs/subsystems/jobs.i18n.yaml +6 -0
  209. package/references/official-docs/docs/subsystems/jobs.md +290 -0
  210. package/references/official-docs/docs/subsystems/jobs.zh.md +290 -0
  211. package/references/official-docs/docs/subsystems/llm-streaming.i18n.yaml +6 -0
  212. package/references/official-docs/docs/subsystems/llm-streaming.md +888 -0
  213. package/references/official-docs/docs/subsystems/llm-streaming.zh.md +894 -0
  214. package/references/official-docs/docs/subsystems/lsp.i18n.yaml +6 -0
  215. package/references/official-docs/docs/subsystems/lsp.md +202 -0
  216. package/references/official-docs/docs/subsystems/lsp.zh.md +202 -0
  217. package/references/official-docs/docs/subsystems/permission-presets.i18n.yaml +6 -0
  218. package/references/official-docs/docs/subsystems/permission-presets.md +131 -0
  219. package/references/official-docs/docs/subsystems/permission-presets.zh.md +131 -0
  220. package/references/official-docs/docs/subsystems/persistence.i18n.yaml +6 -0
  221. package/references/official-docs/docs/subsystems/persistence.md +385 -0
  222. package/references/official-docs/docs/subsystems/persistence.zh.md +385 -0
  223. package/references/official-docs/docs/subsystems/plan.i18n.yaml +6 -0
  224. package/references/official-docs/docs/subsystems/plan.md +87 -0
  225. package/references/official-docs/docs/subsystems/plan.zh.md +87 -0
  226. package/references/official-docs/docs/subsystems/sandbox.i18n.yaml +6 -0
  227. package/references/official-docs/docs/subsystems/sandbox.md +218 -0
  228. package/references/official-docs/docs/subsystems/sandbox.zh.md +218 -0
  229. package/references/official-docs/docs/subsystems/schedule.i18n.yaml +6 -0
  230. package/references/official-docs/docs/subsystems/schedule.md +186 -0
  231. package/references/official-docs/docs/subsystems/schedule.zh.md +186 -0
  232. package/references/official-docs/docs/subsystems/scope.i18n.yaml +6 -0
  233. package/references/official-docs/docs/subsystems/scope.md +59 -0
  234. package/references/official-docs/docs/subsystems/scope.zh.md +59 -0
  235. package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +6 -0
  236. package/references/official-docs/docs/subsystems/session-projection.md +262 -0
  237. package/references/official-docs/docs/subsystems/session-projection.zh.md +262 -0
  238. package/references/official-docs/docs/subsystems/session-query.i18n.yaml +6 -0
  239. package/references/official-docs/docs/subsystems/session-query.md +495 -0
  240. package/references/official-docs/docs/subsystems/session-query.zh.md +495 -0
  241. package/references/official-docs/docs/subsystems/session-reference.i18n.yaml +6 -0
  242. package/references/official-docs/docs/subsystems/session-reference.md +108 -0
  243. package/references/official-docs/docs/subsystems/session-reference.zh.md +108 -0
  244. package/references/official-docs/docs/subsystems/session-telemetry.i18n.yaml +6 -0
  245. package/references/official-docs/docs/subsystems/session-telemetry.md +194 -0
  246. package/references/official-docs/docs/subsystems/session-telemetry.zh.md +194 -0
  247. package/references/official-docs/docs/subsystems/session-title.i18n.yaml +6 -0
  248. package/references/official-docs/docs/subsystems/session-title.md +204 -0
  249. package/references/official-docs/docs/subsystems/session-title.zh.md +204 -0
  250. package/references/official-docs/docs/subsystems/session.i18n.yaml +6 -0
  251. package/references/official-docs/docs/subsystems/session.md +849 -0
  252. package/references/official-docs/docs/subsystems/session.zh.md +851 -0
  253. package/references/official-docs/docs/subsystems/settings.i18n.yaml +6 -0
  254. package/references/official-docs/docs/subsystems/settings.md +310 -0
  255. package/references/official-docs/docs/subsystems/settings.zh.md +310 -0
  256. package/references/official-docs/docs/subsystems/shell.i18n.yaml +6 -0
  257. package/references/official-docs/docs/subsystems/shell.md +303 -0
  258. package/references/official-docs/docs/subsystems/shell.zh.md +303 -0
  259. package/references/official-docs/docs/subsystems/skills.i18n.yaml +6 -0
  260. package/references/official-docs/docs/subsystems/skills.md +331 -0
  261. package/references/official-docs/docs/subsystems/skills.zh.md +331 -0
  262. package/references/official-docs/docs/subsystems/spill.i18n.yaml +6 -0
  263. package/references/official-docs/docs/subsystems/spill.md +117 -0
  264. package/references/official-docs/docs/subsystems/spill.zh.md +117 -0
  265. package/references/official-docs/docs/subsystems/storage.i18n.yaml +6 -0
  266. package/references/official-docs/docs/subsystems/storage.md +229 -0
  267. package/references/official-docs/docs/subsystems/storage.zh.md +229 -0
  268. package/references/official-docs/docs/subsystems/subagent.i18n.yaml +6 -0
  269. package/references/official-docs/docs/subsystems/subagent.md +734 -0
  270. package/references/official-docs/docs/subsystems/subagent.zh.md +736 -0
  271. package/references/official-docs/docs/subsystems/subprocess.i18n.yaml +6 -0
  272. package/references/official-docs/docs/subsystems/subprocess.md +324 -0
  273. package/references/official-docs/docs/subsystems/subprocess.zh.md +324 -0
  274. package/references/official-docs/docs/subsystems/system-prompt.i18n.yaml +6 -0
  275. package/references/official-docs/docs/subsystems/system-prompt.md +207 -0
  276. package/references/official-docs/docs/subsystems/system-prompt.zh.md +207 -0
  277. package/references/official-docs/docs/subsystems/terminal.i18n.yaml +6 -0
  278. package/references/official-docs/docs/subsystems/terminal.md +184 -0
  279. package/references/official-docs/docs/subsystems/terminal.zh.md +184 -0
  280. package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +6 -0
  281. package/references/official-docs/docs/subsystems/token-meter.md +90 -0
  282. package/references/official-docs/docs/subsystems/token-meter.zh.md +90 -0
  283. package/references/official-docs/docs/subsystems/tools.i18n.yaml +6 -0
  284. package/references/official-docs/docs/subsystems/tools.md +720 -0
  285. package/references/official-docs/docs/subsystems/tools.zh.md +720 -0
  286. package/references/official-docs/docs/subsystems/typert.i18n.yaml +6 -0
  287. package/references/official-docs/docs/subsystems/typert.md +336 -0
  288. package/references/official-docs/docs/subsystems/typert.zh.md +336 -0
  289. package/references/official-docs/docs/subsystems/user-questions.i18n.yaml +6 -0
  290. package/references/official-docs/docs/subsystems/user-questions.md +178 -0
  291. package/references/official-docs/docs/subsystems/user-questions.zh.md +178 -0
  292. package/references/official-docs/docs/subsystems/web-server.i18n.yaml +6 -0
  293. package/references/official-docs/docs/subsystems/web-server.md +108 -0
  294. package/references/official-docs/docs/subsystems/web-server.zh.md +108 -0
  295. package/references/official-docs/docs/subsystems/web.i18n.yaml +6 -0
  296. package/references/official-docs/docs/subsystems/web.md +199 -0
  297. package/references/official-docs/docs/subsystems/web.zh.md +199 -0
  298. package/references/official-docs/docs/subsystems/workflow.i18n.yaml +6 -0
  299. package/references/official-docs/docs/subsystems/workflow.md +278 -0
  300. package/references/official-docs/docs/subsystems/workflow.zh.md +278 -0
  301. package/references/official-docs/docs/subsystems/workspace.i18n.yaml +6 -0
  302. package/references/official-docs/docs/subsystems/workspace.md +228 -0
  303. package/references/official-docs/docs/subsystems/workspace.zh.md +228 -0
  304. package/references/official-docs/docs/testing.i18n.yaml +6 -0
  305. package/references/official-docs/docs/testing.md +49 -0
  306. package/references/official-docs/docs/testing.zh.md +49 -0
  307. package/references/official-docs/docs/tool-catalog.i18n.yaml +6 -0
  308. package/references/official-docs/docs/tool-catalog.md +1873 -0
  309. package/references/official-docs/docs/tool-catalog.zh.md +1878 -0
  310. package/references/official-docs/docs/tool-execution-pipeline.i18n.yaml +6 -0
  311. package/references/official-docs/docs/tool-execution-pipeline.md +62 -0
  312. package/references/official-docs/docs/tool-execution-pipeline.zh.md +64 -0
  313. package/references/official-docs/docs/user/develop/basic/config.i18n.yaml +6 -0
  314. package/references/official-docs/docs/user/develop/basic/config.md +106 -0
  315. package/references/official-docs/docs/user/develop/basic/config.zh.md +106 -0
  316. package/references/official-docs/docs/user/develop/basic/index.i18n.yaml +6 -0
  317. package/references/official-docs/docs/user/develop/basic/index.md +144 -0
  318. package/references/official-docs/docs/user/develop/basic/index.zh.md +144 -0
  319. package/references/official-docs/docs/user/develop/basic/publish.i18n.yaml +6 -0
  320. package/references/official-docs/docs/user/develop/basic/publish.md +183 -0
  321. package/references/official-docs/docs/user/develop/basic/publish.zh.md +183 -0
  322. package/references/official-docs/docs/user/develop/basic/tool.i18n.yaml +6 -0
  323. package/references/official-docs/docs/user/develop/basic/tool.md +52 -0
  324. package/references/official-docs/docs/user/develop/basic/tool.zh.md +52 -0
  325. package/references/official-docs/docs/user/develop/framework/events.i18n.yaml +6 -0
  326. package/references/official-docs/docs/user/develop/framework/events.md +143 -0
  327. package/references/official-docs/docs/user/develop/framework/events.zh.md +143 -0
  328. package/references/official-docs/docs/user/develop/framework/index.i18n.yaml +6 -0
  329. package/references/official-docs/docs/user/develop/framework/index.md +137 -0
  330. package/references/official-docs/docs/user/develop/framework/index.zh.md +137 -0
  331. package/references/official-docs/docs/user/develop/framework/service.i18n.yaml +6 -0
  332. package/references/official-docs/docs/user/develop/framework/service.md +148 -0
  333. package/references/official-docs/docs/user/develop/framework/service.zh.md +150 -0
  334. package/references/official-docs/docs/user/develop/practice/index.i18n.yaml +6 -0
  335. package/references/official-docs/docs/user/develop/practice/index.md +155 -0
  336. package/references/official-docs/docs/user/develop/practice/index.zh.md +155 -0
  337. package/references/official-docs/docs/user/develop/practice/llm-adapter.i18n.yaml +6 -0
  338. package/references/official-docs/docs/user/develop/practice/llm-adapter.md +188 -0
  339. package/references/official-docs/docs/user/develop/practice/llm-adapter.zh.md +188 -0
  340. package/references/official-docs/docs/user/guide/index.i18n.yaml +6 -0
  341. package/references/official-docs/docs/user/guide/index.md +30 -0
  342. package/references/official-docs/docs/user/guide/index.zh.md +30 -0
  343. package/references/official-docs/docs/user/guide/providers-custom-form.png +0 -0
  344. package/references/official-docs/docs/user/guide/providers-custom-form.zh.png +0 -0
  345. package/references/official-docs/docs/user/guide/providers-models-page.png +0 -0
  346. package/references/official-docs/docs/user/guide/providers-models-page.zh.png +0 -0
  347. package/references/official-docs/docs/user/guide/providers.i18n.yaml +6 -0
  348. package/references/official-docs/docs/user/guide/providers.md +98 -0
  349. package/references/official-docs/docs/user/guide/providers.zh.md +98 -0
  350. package/references/official-docs/docs/user/guide/python-sdk.i18n.yaml +6 -0
  351. package/references/official-docs/docs/user/guide/python-sdk.md +104 -0
  352. package/references/official-docs/docs/user/guide/python-sdk.zh.md +104 -0
  353. package/references/official-docs/docs/user/index.i18n.yaml +6 -0
  354. package/references/official-docs/docs/user/index.md +11 -0
  355. package/references/official-docs/docs/user/index.zh.md +11 -0
  356. package/references/official-docs/docs/web-styling.i18n.yaml +6 -0
  357. package/references/official-docs/docs/web-styling.md +25 -0
  358. package/references/official-docs/docs/web-styling.zh.md +25 -0
  359. package/references/official-docs/examples/AGENTS.md +20 -0
  360. package/references/official-docs/packages/AGENTS.md +27 -0
  361. package/references/official-docs/packages/README.md +69 -0
  362. package/references/official-docs/vendor/README.md +60 -0
  363. package/references/official-docs/website-docs.ts +524 -0
  364. package/references/sources.md +137 -0
  365. package/references/upstream-cordis.md +594 -0
  366. package/references/website-pages.md +668 -0
  367. package/scripts/archive-discussions.ps1 +154 -0
  368. package/scripts/download-community-articles.ps1 +188 -0
  369. package/scripts/download-community-repos.ps1 +232 -0
  370. package/scripts/download-sources.ps1 +195 -0
  371. package/scripts/gen-topic-snapshot.ps1 +91 -0
  372. package/scripts/install-skill.ps1 +63 -0
  373. package/scripts/sync-official-docs.ps1 +130 -0
  374. package/scripts/verify-kit.ps1 +191 -0
@@ -0,0 +1,131 @@
1
+ # 权限预设
2
+
3
+ [English](permission-presets.md) | 中文
4
+
5
+ [dsh-permission-presets](../../packages/interaction/permission-presets) 的权限预设层(`ctx.permissionPresets`,`PermissionPresetService`)把两个相互独立的强制执行 knob,即[沙箱模式](sandbox.md)(`sandbox/mode`)与[审批策略](approval.md)(`approval/policy`),捆绑成具名预设,供客户端作为单个权限(Permissions)选择器提供。它是一项可选能力,不属于 agent loop(智能体循环)主干,也不拥有任何强制执行:执行、提示词叙述与回放仍然读取各自 knob的折叠结果,预设切换只记录意图,并通过每个 knob各自的规范 setter 写入。[包 README](../../packages/interaction/permission-presets/README.md) 负责组合状态与限制;[沙箱切换设计](../../.agents/notes/implemented/feature/2026-07-06-sandbox.md)负责决策依据。
6
+
7
+ 源码:[`packages/interaction/permission-presets/src/index.ts`](../../packages/interaction/permission-presets/src/index.ts)
8
+
9
+ ## 预设表
10
+
11
+ 预设是一个表键,映射到一个沙箱/审批组合,外加可选的客户端展示信息;默认预设表自带 `workspace-write`(`workspace-write` + `ask`)和 `danger-full-access`(`danger-full-access` + `never`)。
12
+
13
+ ```ts type-equiv
14
+ /** One preset's sandbox/approval bundle and optional client presentation. */
15
+ interface PresetSpec {
16
+ /** The `sandbox/mode` value the preset writes through. */
17
+ sandbox: SandboxMode
18
+ /** The `approval/policy` value the preset writes through. */
19
+ approval: ApprovalPolicy
20
+ /** The display label a client shows for this preset; the raw table key when omitted. */
21
+ name?: string
22
+ /** One user-facing sentence on what the preset means; omitted when not configured. */
23
+ description?: string
24
+ }
25
+ ```
26
+
27
+ ```ts type-equiv
28
+ /** The {@link PermissionPresetService} config: preset table and composition default. */
29
+ interface Config {
30
+ /**
31
+ * The preset table: name → knob bundle. Defaults to `workspace-write`
32
+ * (workspace-write + ask) and `danger-full-access` (danger-full-access +
33
+ * never). The name `custom` is reserved for the derived not-a-preset state.
34
+ */
35
+ presets?: Record<string, PresetSpec>
36
+ /**
37
+ * Default for new sessions. When omitted, the preset matching the composed
38
+ * sandbox and approval defaults is used.
39
+ */
40
+ defaultPreset?: string
41
+ }
42
+ ```
43
+
44
+ 该服务要求一个施加隔离的 `ctx.shell` 执行器和 `ctx.approval`,配置错误在插件加载时即失败:名为 `custom` 的表项会抛出异常(该名称保留给派生的「非预设」状态);在不施加隔离的 bash 执行器(没有 `sandboxMode` 能力事实)之上组合同样抛出异常,因为预设捆绑了一个沙箱模式。
45
+
46
+ ## 当前预设与派生的 `custom`
47
+
48
+ `current(events)` 从 knob 派生实际生效的预设,而不是只看自身事件:它折叠会话的生效沙箱模式(回退到执行器配置的模式)与生效审批策略(先回退到审批服务配置,再回退到 `ask`),优先取仍然匹配的已记录选择,其次取声明顺序中第一个匹配的表项,否则返回 `CUSTOM_PRESET`(`'custom'`)。`custom` 只是派生值:客户端可以把它显示为当前值,但它绝不是切换目标,也绝不出现在事件 payload 中。
49
+
50
+ `names` 按预设表声明顺序列出可切换的预设;`optionOf(name)` 为某个表键(label 回退为该键)或 `custom` 构建客户端渲染的选项,传入其他任何名称都会抛出异常。
51
+
52
+ ```ts type-equiv
53
+ /** The select-option shape a presentation layer advertises for one preset (or for the derived `custom` state). */
54
+ interface PresetOption {
55
+ /** Stable option value: the table key, or `custom`. */
56
+ value: string
57
+ /** The display label. */
58
+ name: string
59
+ /** One user-facing sentence on what the value means; omitted when not configured. */
60
+ description?: string
61
+ }
62
+ ```
63
+
64
+ ## 切换与 `permission/preset` 事件
65
+
66
+ `set(session, name)` 解析预设(未知名称抛出异常),在 `name` 尚不是生效预设时追加一条仅记日志的 `permission/preset` 事件,然后通过各旋钮自己的 setter([dsh-sandbox-policy](../../packages/sandbox/sandbox-policy) 的 `setSandboxMode` 与 [dsh-user-approval](../../packages/interaction/user-approval) 的 `setApprovalPolicy`)写入,且仅当该 knob的生效值发生变化时才写。同一轮次内,选择事件先于旋钮事件出现;重新选择当前生效的预设则什么都不追加。
67
+
68
+ `permission/preset` 是持久、仅记日志的用户意图:它不进入模型 transcript(文本记录),模型可见的后果由 knob 事件经各自消费方承担;它存在是为了在两个预设共享同一个旋钮组合时,让 `current()` 仍能保住用户选择的究竟是哪一个预设;`effectivePermissionPreset(events)` 折叠最后一条,回放不需要任何追赶状态。完整事件声明见[持久化日志事件目录](../persistence-catalog.md);方法签名见生成的[服务目录](#ctxpermissionpresets--permissionpresetservice)。
69
+
70
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
71
+
72
+ <a id="cordis-surface"></a>
73
+
74
+ ## Cordis API
75
+
76
+ 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).
77
+
78
+ <a id="ctxpermissionpresets--permissionpresetservice"></a>
79
+
80
+ ### `ctx.permissionPresets` — `PermissionPresetService`
81
+
82
+ Owns the deployment's permission presets and their write path. Requires a confining `ctx.shell` executor and `ctx.approval`; unmatched knob values are reported as CUSTOM_PRESET, not an error.
83
+
84
+ ```ts cordis-catalog
85
+ /**
86
+ * Resolve the preset matching the effective knob values. A still-matching
87
+ * last selection wins shared-bundle ties; otherwise the first table match
88
+ * wins, or {@link CUSTOM_PRESET} when no entry matches.
89
+ * @param events - the session's events in log order.
90
+ * @returns the effective preset name, or `custom` when nothing matches.
91
+ */
92
+ current(events: readonly SessionEvent[]): string
93
+
94
+ /**
95
+ * Build the whole select value for one folded knob state: every table
96
+ * option in declaration order, `custom` appended exactly while derived.
97
+ * @param state - the folded knob overrides.
98
+ * @returns the `permissions` projection payload.
99
+ */
100
+ selectFor(state: KnobState): PermissionSelect
101
+
102
+ /**
103
+ * Resolve a preset's knob bundle.
104
+ * @param name - the preset name to resolve.
105
+ * @returns the configured bundle.
106
+ * @throws when `name` is not in the table.
107
+ */
108
+ resolve(name: string): PresetSpec
109
+
110
+ /**
111
+ * Build the client option for a table entry or {@link CUSTOM_PRESET}. A
112
+ * missing label falls back to the table key.
113
+ * @param name - a table key, or `custom`.
114
+ * @returns the option a client renders.
115
+ * @throws when `name` is neither a table key nor `custom`.
116
+ */
117
+ optionOf(name: string): PresetOption
118
+
119
+ /**
120
+ * Record a changed preset, then update each changed knob through its own
121
+ * setter. Selecting the effective preset again appends nothing.
122
+ * @param session - the session the switch belongs to.
123
+ * @param name - the preset to switch to; unknown names throw.
124
+ */
125
+ set(session: Session, name: string): void
126
+ ```
127
+
128
+ Types: [Session](session.md) · [SessionEvent](session.md)
129
+
130
+ Source: [`packages/interaction/permission-presets/src/index.ts:159`](../../packages/interaction/permission-presets/src/index.ts)
131
+ <!-- END GENERATED cordis-surface -->
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write docs/subsystems/persistence.md
5
+ persistence.md: 5b1b224e419aca205baba69894ed64467b8fb4e1
6
+ persistence.zh.md: a91e7d66b92270c82287d054e619b665e96ea206
@@ -0,0 +1,385 @@
1
+ # Session Persistence
2
+
3
+ English | [中文](persistence.zh.md)
4
+
5
+ The **durability seam** for the event log. [session.md](session.md) describes the in-memory `Session` — the append-only `SessionEvent` log that is the source of truth. This page describes how that log is made durable: the abstract `SessionPersistence` service, its backends, the flush checkpoint, crash recovery, and the metadata header that travels alongside the log. The event vocabulary the log carries is enumerated, member by member, in the generated [persistence log event catalog](../persistence-catalog.md).
6
+
7
+ The seam is a [capability seam](../../.agents/notes/implemented/architecture/2026-06-13-capability-seams.md): one abstract service ([dsh-session-persistence](../../packages/session/session-persistence), `ctx.sessionPersistence`) defining locate/create/append, reusable Session preparation, logical load/inspect, physical suffix reads, and lightweight list/snapshot observation over the existing `SessionEvent` — **no parallel persisted event type** — and two interchangeable backends implementing the same contract. See the [session-persistence Agent Note](../../.agents/notes/implemented/architecture/2026-06-14-session-persistence.md).
8
+
9
+ ## The flush checkpoint
10
+
11
+ `session/event` is a *synchronous* notification; persistence plugins copy the event into a per-session controller without blocking the producer. The first pending event starts a fixed batching window, and later events join without resetting its deadline. Expiry starts one durable batch; events admitted during that write receive their own deadline and form a follow-up batch. `session/flush` cancels the wait and drains through quiescence, so the loop still uses it as the ordering and error-observation checkpoint before claiming the next ordinary turn. A rejected background write retains its events and pauses automatic retry; a new event starts a fresh window, while explicit flush retries immediately and reports failure through `agent/error` and the logger, never as a session event past the closed turn. Disposal performs the same final drain. The configured maximum bounds only intentional batching wait, not event-loop scheduling or backend durability latency ([decision](../../.agents/notes/implemented/architecture/2026-08-08-bounded-session-persistence-write-batching.md)).
12
+
13
+ ## Crash recovery preserves an interrupted turn
14
+
15
+ A backend that reloads a log crashed mid-turn finds an open `turn/start` with no `turn/end`. It does **not** truncate — a single turn can be huge in a long-horizon task (many steps, large tool output), and those events were durably appended before the crash. Instead it closes the orphaned turn with a synthetic `turn/end { reason: { kind: 'interrupted' } }`, keeping the interrupted execution balanced without changing any standalone events before or after it. `interrupted` is the one `TurnEndReason` no loop emits (see [session.md](session.md#why-a-turn-ended-turnendreasonmap)).
16
+
17
+ Repair applies only to cold sessions. For a live id, `SessionPersistence.load(id)` waits until the authoritative in-memory snapshot is durable and returns it only when balanced; an open live turn rejects rather than receiving synthetic interruption boundaries. HMR adopts a live prefix without closing its active turn.
18
+
19
+ `SessionPersistence.inspect(id)` constructs an immutable logical Session without publishing it or writing recovery. Cold inspection balances an interrupted turn in memory while leaving torn physical tails untouched; inspection of an already-live Session borrows its current immutable snapshot and may therefore contain an open turn. Coordinator-backed implementations retain the exact cold unpublished Session in a bounded LRU, so repeated history reads and a later `prepare(id)` share one read, decompression, validation, freeze, and Session construction. `prepare(id)` reserves the Session, commits pending repair, and returns a disposable publication handle; `load(id)` uses the same machinery to commit repair without publication. The [Session preparation decision](../../.agents/notes/implemented/architecture/2026-08-05-session-preparation.md) owns this lifecycle.
20
+
21
+ ## `SessionLocation` — optional per-session artifact target
22
+
23
+ `SessionPersistence.locate(meta)` synchronously resolves a backend-owned independent artifact without reading, creating, or flushing it. JSONL returns the absolute transcript path inside its project/session directory; SQLite returns `undefined` because sessions share one database. A returned path can therefore name a file that does not yet exist or lacks the current unflushed turn; it is a location hint, not authorization or a freshness guarantee.
24
+
25
+ ```ts type-equiv
26
+ /**
27
+ * A backend-resolved, per-session local artifact location. The path is an
28
+ * absolute target path and can name an artifact that has not materialized yet.
29
+ * Consumers must treat it as a location hint, never as an authorization token.
30
+ */
31
+ interface SessionLocation {
32
+ /** Backend-specific artifact kind, for example `jsonl`. */
33
+ readonly kind: string
34
+ /** Absolute path to this session's backend-owned artifact. */
35
+ readonly path: string
36
+ }
37
+ ```
38
+
39
+ <a id="sessionheader--metadata-beside-the-log"></a>
40
+
41
+ ## `SessionHeader` — metadata beside the log
42
+
43
+ Per-session metadata travels **separately** from the event log: format version, cwd, lineage, and the seed boundary are storage concerns, not conversation events, so they stay out of `SessionEventMap` and never reach `deriveMessages()`. The header is attached to a `Session` via `session.header`.
44
+
45
+ Source: [`packages/core/session/src/types.ts`](../../packages/core/session/src/types.ts)
46
+
47
+ ```ts type-equiv
48
+ /**
49
+ * Immutable validated storage metadata, kept outside the conversation event log.
50
+ */
51
+ interface SessionHeader {
52
+ /**
53
+ * On-disk format version, stamped from {@link SESSION_FORMAT_VERSION} when the
54
+ * session is created. A persistence backend rejects any other version on load
55
+ * (no migration — see the constant).
56
+ */
57
+ readonly version: number
58
+ /** The session's id (mirrors the {@link Session}'s id). */
59
+ readonly id: SessionId
60
+ /** Non-negative safe-integer Unix epoch milliseconds when the session was created. */
61
+ readonly createdAt: number
62
+ /** Absolute working directory the session was created in (if any). */
63
+ readonly cwd?: string
64
+ /** The session this one was forked from (seed lineage), if any. */
65
+ readonly parentSession?: SessionId
66
+ /**
67
+ * How many leading events were inherited through a seed. Persisting this
68
+ * boundary lets resume and replay distinguish parent history from child work.
69
+ */
70
+ readonly seedLength?: number
71
+ /**
72
+ * Coarse product classification for a session created as a subagent child.
73
+ * This is presentation metadata, not proof that the child is continuable.
74
+ */
75
+ readonly origin?: 'subagent'
76
+ /**
77
+ * Delegation depth: absent (zero) for a top-level session, parent depth + 1
78
+ * for a subagent child. Persisted so a recursion budget survives restart and
79
+ * resume — a runtime-only depth would reset a resumed child to top-level.
80
+ */
81
+ readonly delegationDepth?: number
82
+ /**
83
+ * Id of the agent preset this session's agent was composed from, when the
84
+ * deployment composes per session. Durable because the preset decides the
85
+ * session's tools and prompt: a resume that restored a different composition
86
+ * would replay history the model can no longer act on.
87
+ */
88
+ readonly agentPreset?: string
89
+ }
90
+ ```
91
+
92
+ ## Format refusal — logs a build cannot faithfully read
93
+
94
+ A backend refuses a log it cannot faithfully interpret with `SessionFormatUnsupportedError`, distinct from `SessionPersistenceCorruptionError` because nothing is damaged. A header `version` ahead of `SESSION_FORMAT_VERSION` names the direction ("written by a newer harness — upgrade the harness to open it"); one behind it states that this build ships no upgrade path. After legacy-shape normalization, an event type outside this build's generated vocabulary (`KNOWN_SESSION_EVENT_TYPES`, emitted by `gen-persistence-catalog`) refuses the same way unless the event's envelope carries `ignorable: true` — silently skipping an unrecognized required event could change how the rest of the log must be read. The message appends the raw log path when the backend keeps one artifact per session, so the refused text stays reachable. The JSONL backend refuses a foreign version straight from the raw header line, before validating today's header shape or decoding any event row — a structurally different future format still reports the upgrade direction, never "corrupt"; SQLite gates whole-file structure through its own `SCHEMA_VERSION` pragma first. Design rationale and the deferred upgrader chain live in the [session-log-version-mechanism note](../../.agents/notes/implemented/architecture/2026-08-10-session-log-version-mechanism.md).
95
+
96
+ ## `CreateSessionOptions` — seeding and metadata
97
+
98
+ Creating a `Session` through the store takes a `seed` (initial replay or fork history) and `meta` (the storage-level fields the store folds into a `SessionHeader`). The store fills in `version`/`id` and defaults `createdAt`; the caller may supply the validated absolute `cwd`, the `parentSession` lineage, the `seedLength` seed boundary, the optional coarse `origin`, the `delegationDepth`, the `agentPreset` the agent was composed from, and an existing `createdAt`. `origin: 'subagent'` lets product navigation hide duplicate child rows; it does not prove that a descriptor is valid or that the child can resume.
99
+
100
+ ```ts type-equiv
101
+ /**
102
+ * Options for creating a {@link Session} via the store. `seed` replays/forks
103
+ * an existing event log; `meta` carries the caller-supplied storage fields the
104
+ * store folds into a {@link SessionHeader}.
105
+ */
106
+ interface CreateSessionOptions {
107
+ /** Initial replay or fork history supplied at construction. */
108
+ readonly seed?: readonly SessionEvent[]
109
+ /**
110
+ * Storage metadata read once before publication. `seedLength` is explicit
111
+ * because a resumed seed contains the full stored log, not only its inherited prefix.
112
+ */
113
+ readonly meta?: {
114
+ readonly cwd?: string
115
+ readonly parentSession?: SessionId
116
+ readonly createdAt?: number
117
+ readonly seedLength?: number
118
+ readonly origin?: 'subagent'
119
+ readonly delegationDepth?: number
120
+ readonly agentPreset?: string
121
+ }
122
+ }
123
+ ```
124
+
125
+ Replay/fork is therefore `ctx.sessions.create(id, { seed: seedEvents })`; resuming a *persisted* session into a live agent is `ctx.agents.resume({ resumeSessionId })`.
126
+
127
+ ## `SessionRawArtifact` — verbatim stored artifact text
128
+
129
+ A backend's own artifact text for one session, byte-identical to what it durably wrote (decoded from its physical encoding). `readRaw` returns it without reconstructing from parsed events, so backend-specific serialization (chunk packing, key order, line breaks) survives. Consumers first test `supportsRawArtifacts`: `false` means the backend does not provide this capability (for example SQLite), while `readRaw(...) === undefined` means a supported backend has no materialized artifact for that session.
130
+
131
+ ```ts type-equiv
132
+ /** A backend's own raw artifact text for one session, verbatim. */
133
+ interface SessionRawArtifact {
134
+ /** The session header parsed from the artifact's own first line. */
135
+ readonly meta: SessionHeader
136
+ /** The artifact's base filename on disk, without any physical encoding suffix. */
137
+ readonly filename: string
138
+ /** The artifact's full text content, decoded from the backend's physical encoding. */
139
+ readonly content: string
140
+ }
141
+ ```
142
+
143
+ ## Preparation and restoration ownership
144
+
145
+ `SessionStore.prepare()` accepts ordinary creation options or fresh persistence graphs transferred through `RestoredSessionOptions`. The restoration branch validates and freezes the transferred header and events in place, so callers must retain no mutable aliases. `SessionPreparation` then owns the exact unpublished Session until publication or rollback; disposal is synchronous and idempotent. Persistence inspection exposes only `SessionInspection`, an immutable logical view borrowed from the same prepared Session.
146
+
147
+ ```ts type-equiv
148
+ /**
149
+ * Fresh storage values transferred to {@link SessionStore.prepare} without a
150
+ * second serialization copy. Callers retain no mutable aliases.
151
+ */
152
+ interface RestoredSessionOptions {
153
+ /** Fresh detached storage events to validate and freeze in place. */
154
+ readonly seed: SessionEvent[]
155
+ /** Fresh detached storage metadata to validate and freeze in place. */
156
+ readonly meta: SessionHeader
157
+ /** Select the persistence ownership-transfer path. */
158
+ readonly seedSource: 'persistence'
159
+ }
160
+ ```
161
+
162
+ ```ts type-equiv
163
+ /** Inputs accepted while constructing an unpublished Session. */
164
+ type PrepareSessionOptions =
165
+ | (CreateSessionOptions & { readonly seedSource?: undefined })
166
+ | RestoredSessionOptions
167
+ ```
168
+
169
+ ```ts type-equiv
170
+ /** Options for a preparation whose provider retains unpublished state. */
171
+ interface SessionPreparationOptions {
172
+ /** Release provider-owned state when the Session was not published. */
173
+ readonly release?: () => void
174
+ }
175
+ ```
176
+
177
+ ```ts public-api
178
+ /**
179
+ * One exact unpublished Session and the provider state that keeps it usable.
180
+ * Disposal is synchronous and idempotent. Providers decide whether release
181
+ * returns the Session to a cache or discards it; publication may consume that
182
+ * state before disposal, making the callback a no-op.
183
+ */
184
+ declare class SessionPreparation implements Disposable {
185
+ /** The exact Session to use for setup and publication. */
186
+ readonly session: Session;
187
+ /**
188
+ * Wrap an unpublished Session in one preparation lifetime.
189
+ * @param session - exact unpublished Session.
190
+ * @param options - optional provider release behavior.
191
+ * @returns a preparation disposed after publication or rollback.
192
+ */
193
+ static create(session: Session, options?: SessionPreparationOptions): SessionPreparation;
194
+ /** Release provider state once when this preparation leaves its caller. */
195
+ [Symbol.dispose](): void;
196
+ }
197
+ ```
198
+
199
+ ```ts type-equiv
200
+ /** Immutable logical session prepared from persistence or a live owner. */
201
+ interface SessionInspection {
202
+ /** Validated immutable session metadata. */
203
+ readonly meta: SessionHeader
204
+ /** Validated contiguous logical event log. */
205
+ readonly events: readonly SessionEvent[]
206
+ }
207
+ ```
208
+
209
+ ## Lightweight source revisions
210
+
211
+ Consumers of derived state compare a cheap opaque revision before loading a full event log. The persistence backend owns its representation and changes it transactionally with append or mutating load repair; callers compare it only for equality.
212
+
213
+ ```ts type-equiv
214
+ /**
215
+ * Backend-owned token that identifies both one storage source and one revision
216
+ * of a persisted session log.
217
+ */
218
+ type SessionPersistenceRevision = Branded<'SessionPersistenceRevision'>
219
+ ```
220
+
221
+ ```ts type-equiv
222
+ /** Lightweight immutable source identity returned without loading a full log. */
223
+ interface SessionPersistenceSnapshot {
224
+ /** Detached metadata for one materialized session. */
225
+ header: SessionHeader
226
+ /** Opaque source-qualified token that changes whenever this stored log changes. */
227
+ revision: SessionPersistenceRevision
228
+ }
229
+ ```
230
+
231
+ ## The backends
232
+
233
+ Both implement the same abstract `SessionPersistence` (locate/create/append/prepare/load/inspect/readFrom/list/listSnapshots over `SessionEvent`, with optional cancellation on observation methods) and pass the shared `runPersistenceContract` suite:
234
+
235
+ - **[dsh-session-persistence-jsonl](../../packages/session/session-persistence-jsonl)** — an append-only logical JSONL log per session, stored as checksummed concatenated Zstandard frames by default or raw lines by configuration, with crash-safe atomic writes, interrupted-turn recovery, and a read/replay path.
236
+ - **[dsh-session-persistence-sqlite](../../packages/session/session-persistence-sqlite)** — `node:sqlite`, one row per `SessionEvent`. The row fields `(session_id, seq, type, time, data, source_event_seqs, surface_op)` map 1:1 onto the event, including optional surface metadata, so there is no parallel persisted schema to keep in sync.
237
+
238
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
239
+
240
+ <a id="cordis-surface"></a>
241
+
242
+ ## Cordis API
243
+
244
+ 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).
245
+
246
+ <a id="ctxsessionpersistence--sessionpersistence-abstract-seam"></a>
247
+
248
+ ### `ctx.sessionPersistence` — `SessionPersistence` (abstract seam)
249
+
250
+ Durable append-only session storage. Implementations preserve contiguous, losslessly JSON-serializable events; append resolves only after durability, and load balances a complete interrupted tail without rewriting committed events.
251
+
252
+ ```ts cordis-catalog
253
+ /**
254
+ * Resolve this backend's independent local artifact for a session without
255
+ * reading, creating, flushing, or otherwise materializing it. Backends such
256
+ * as SQLite that do not own one artifact per session return `undefined`.
257
+ * @param meta - the immutable session header whose artifact is requested.
258
+ * @returns the backend-specific absolute location, when one exists.
259
+ */
260
+ abstract locate(meta: SessionHeader): SessionLocation | undefined
261
+
262
+ /**
263
+ * Read a session's backend-owned artifact text verbatim — the exact durable
264
+ * bytes the backend wrote (decoded from its physical encoding, e.g. a
265
+ * decompressed JSONL). The returned `content` is the raw text, not a
266
+ * reconstruction from parsed events, so it preserves backend-specific
267
+ * serialization (chunk packing, key order, line breaks). Callers first test
268
+ * {@link supportsRawArtifacts}; `undefined` then means only that the requested
269
+ * session has no materialized artifact.
270
+ * @param _id - the persisted session to read (unused by the default: no
271
+ * per-session artifact).
272
+ * @param signal - optional cancellation for backend read work.
273
+ * @returns the raw artifact plus its parsed header, or `undefined` when the
274
+ * session is absent.
275
+ * @throws when this backend does not expose per-session raw artifacts.
276
+ */
277
+ readRaw(_id: SessionId, signal?: AbortSignal): Promise<SessionRawArtifact | undefined>
278
+
279
+ /**
280
+ * Register a new session's metadata. A backend MAY defer the physical write
281
+ * until the first {@link append} (lazy materialization), in which case a
282
+ * created-but-never-appended session is absent from {@link list}
283
+ * — abandoned sessions leave nothing behind.
284
+ * @param meta - the immutable header (id, version, cwd, lineage) to record.
285
+ */
286
+ abstract create(meta: SessionHeader): Promise<void>
287
+
288
+ /**
289
+ * Durably persist a batch of events. Honors the append-only and contiguous-
290
+ * seq contracts: the first event's `seq` MUST equal the stored next-seq
291
+ * (after `load` has durably closed any interrupted turn). Rejects non-JSON-
292
+ * serializable `event.data` with an error naming the offending event type.
293
+ * @param id - the session the batch belongs to.
294
+ * @param events - the contiguous batch to persist, in seq order.
295
+ */
296
+ abstract append(id: SessionId, events: readonly SessionEvent[]): Promise<void>
297
+
298
+ /**
299
+ * Prepare the exact unpublished Session used by resume. Implementations may
300
+ * reuse object graphs retained by an earlier {@link inspect} after confirming
301
+ * their durable revision is still current; disposal releases an unpublished
302
+ * reservation. Revision retries require the durable log to remain unchanged
303
+ * for one read/check round trip; continuous external writers may delay completion.
304
+ * @param id - persisted session to prepare.
305
+ * @param signal - optional cancellation for preparation work.
306
+ * @returns one owned unpublished Session preparation.
307
+ */
308
+ async prepare(id: SessionId, signal?: AbortSignal): Promise<SessionPreparation>
309
+
310
+ /**
311
+ * Load an immutable balanced logical view and commit any required cold
312
+ * recovery. A complete interrupted final turn is preserved and durably
313
+ * closed with missing tool errors plus any open step and turn boundaries;
314
+ * only a torn final record is discarded. Unknown versions and corruption in
315
+ * the committed prefix reject. Implementations MUST NOT crash-repair an
316
+ * identity still bound to a live Session: a balanced live log may return as a
317
+ * durable snapshot, while an open live turn rejects. Returned values may be
318
+ * shared with immutable live or prepared state and must not be mutated.
319
+ * Revision-based implementations may wait for one stable read/check round trip.
320
+ * @param id - the persisted session to reload.
321
+ * @returns the header and a log ending on a balanced `turn/end`.
322
+ */
323
+ abstract load(id: SessionId): Promise<SessionInspection>
324
+
325
+ /**
326
+ * Inspect an immutable logical session without committing recovery or
327
+ * publishing it. A cold complete interrupted turn receives synthetic closers
328
+ * in memory and a torn physical tail remains untouched. An already-live
329
+ * Session instead yields its current immutable snapshot, which may contain an
330
+ * open turn and its `session/end-seed` boundary. Coordinator-backed
331
+ * implementations retain the exact cold unpublished Session for bounded
332
+ * reuse by a later {@link prepare}. A stale ready source is reloaded; a source
333
+ * already committing or reserved for resume remains exclusive, and inspection
334
+ * may borrow its immutable view. Callers borrow only the immutable header and
335
+ * log. Continuous external writers may delay revision convergence.
336
+ * @param id - the persisted session to inspect.
337
+ * @param signal - optional cancellation for queued and backend read work.
338
+ * @returns the validated header and current logical event log.
339
+ */
340
+ abstract inspect(id: SessionId, signal?: AbortSignal): Promise<SessionInspection>
341
+
342
+ /**
343
+ * Read the stored events from `fromSeq` onward — the read-from-seq
344
+ * primitive for read models that resume from a watermark (e.g. a persisted
345
+ * projection cache folding only the tail past its checkpoint). Unlike
346
+ * {@link inspect}, it is a detached physical suffix read: no preparation
347
+ * cache, torn-tail truncation, synthetic closers, or coordinator-state
348
+ * publication. Only events from the valid contiguous stored prefix are
349
+ * returned, so a torn fragment never reaches the caller. `fromSeq` at or
350
+ * beyond the stored prefix returns an empty event list (never an error).
351
+ * Backends whose medium can seek by seq
352
+ * (SQLite) read only the suffix; sequential media (JSONL, both encodings)
353
+ * still parse the whole artifact and skip forward — the primitive bounds
354
+ * what is RETURNED and refolded, not every backend's physical read.
355
+ * @param id - the persisted session to read.
356
+ * @param fromSeq - first event seq to include; a non-negative safe integer.
357
+ * @param signal - optional cancellation for queued and backend read work.
358
+ * @returns the header and the stored events with `seq >= fromSeq`.
359
+ */
360
+ abstract readFrom(id: SessionId, fromSeq: number, signal?: AbortSignal): Promise<{ meta: SessionHeader; events: SessionEvent[] }>
361
+
362
+ /**
363
+ * Lightweight listing from metadata, without a full-log parse.
364
+ * @param signal - optional cancellation for backend listing work.
365
+ * @returns one header per materialized session.
366
+ */
367
+ abstract list(signal?: AbortSignal): Promise<SessionHeader[]>
368
+
369
+ /**
370
+ * List materialized sessions with cheap per-log change tokens.
371
+ *
372
+ * Repeated observations of an unchanged log return the same revision. A
373
+ * successful mutating {@link load} repair changes the next listed revision.
374
+ * Revisions also distinguish independently backed stores so backend-local
375
+ * counters cannot compare equal across different persistence sources.
376
+ * @param signal - optional cancellation for backend snapshot-listing work.
377
+ * @returns one header and opaque revision per materialized session without loading full logs.
378
+ */
379
+ abstract listSnapshots(signal?: AbortSignal): Promise<SessionPersistenceSnapshot[]>
380
+ ```
381
+
382
+ Types: [SessionEvent](session.md) · [SessionId](core.md)
383
+
384
+ Source: [`packages/session/session-persistence/src/index.ts:84`](../../packages/session/session-persistence/src/index.ts)
385
+ <!-- END GENERATED cordis-surface -->