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,187 @@
1
+ # Human Commands
2
+
3
+ English | [中文](commands.zh.md)
4
+
5
+ The human-command registry service from [`dsh-commands`](../../packages/interaction/commands). Interactive adapters use it to discover and directly execute plugin-owned commands for an exact agent without creating a model message. The [command Agent Note](../../.agents/notes/implemented/feature/2026-07-19-plugin-command-registration.md) owns dispatch and lifecycle rationale; the [package README](../../packages/interaction/commands/README.md) owns composition and limitations.
6
+
7
+ Source: [`packages/interaction/commands/src/index.ts`](../../packages/interaction/commands/src/index.ts)
8
+
9
+ ## Input metadata
10
+
11
+ The service exposes one optional unstructured-input hint. Command availability follows plugin composition: every adapter consuming the registry sees every effective definition.
12
+
13
+ ```ts type-equiv
14
+ /** Immutable metadata for a command's optional unstructured input. */
15
+ interface CommandInputDescriptor {
16
+ /** Placeholder shown before the user supplies free-form input. */
17
+ readonly hint: string
18
+ }
19
+ ```
20
+
21
+ ## Definition
22
+
23
+ `CommandDefinition` is the plugin-authored registration. The registry validates and freezes a detached effective definition.
24
+
25
+ ```ts type-equiv
26
+ /** Plugin-owned command registration. */
27
+ interface CommandDefinition {
28
+ /** Lowercase command name without the leading slash. */
29
+ readonly name: string
30
+ /** Human-readable summary used in discovery UI. */
31
+ readonly description: string
32
+ /** Optional free-form input hint advertised to capable clients. */
33
+ readonly input?: CommandInputDescriptor
34
+ /**
35
+ * Whether `command/run` records `rawInput`. Defaults to true. A command
36
+ * whose domain event owns the payload sets this false to avoid duplicating
37
+ * that payload in the session log.
38
+ */
39
+ readonly recordInput?: boolean
40
+ /** Execute against the receiving agent without sending the command to the model. */
41
+ readonly handler: (invocation: CommandInvocation) => CommandResult | Promise<CommandResult>
42
+ }
43
+ ```
44
+
45
+ ## Invocation and result
46
+
47
+ The adapter owns cancellation and passes the exact target agent. `rawInput` begins immediately after the parsed name and retains the adapter-delivered separator and suffix. Results are direct UI outcomes, not tool results or session events.
48
+
49
+ ```ts type-equiv
50
+ /** Invocation passed to one registered command handler. */
51
+ interface CommandInvocation {
52
+ /** Pairing id already written to this invocation's `command/run` event. */
53
+ readonly commandId: CommandId
54
+ /** Exact agent whose UI received the command. */
55
+ readonly agent: Agent
56
+ /** Exact text following the registered command name, including separator whitespace. */
57
+ readonly rawInput: string
58
+ /** Cancellation signal owned by the dispatching UI request. */
59
+ readonly signal: AbortSignal
60
+ }
61
+ ```
62
+
63
+ ```ts type-equiv
64
+ /** Expected command outcome rendered directly by the dispatching UI. */
65
+ type CommandResult =
66
+ | {
67
+ readonly kind: 'success'
68
+ readonly text?: string
69
+ /** Earlier authoritative domain event that owns a richer presentation. */
70
+ readonly sourceEventSeq?: number
71
+ }
72
+ | { readonly kind: 'error'; readonly text: string }
73
+ ```
74
+
75
+ `sourceEventSeq` is optional and success-only. When present, it names an earlier non-command event in the receiving session log; `command/done` persists the same reference so a client can combine the command lifecycle with that domain projection without parsing `text` or relying on adjacent rows.
76
+
77
+ ## Discovery and parsing views
78
+
79
+ Adapters receive handler-free immutable descriptors after scope resolution. `parseCommand()` returns `ParsedCommand` before registry resolution; syntax-valid input can still name an unavailable command.
80
+
81
+ ```ts type-equiv
82
+ /** Handler-free immutable command view returned to UI adapters. */
83
+ interface CommandDescriptor {
84
+ /** Lowercase command name without the leading slash. */
85
+ readonly name: string
86
+ /** Human-readable summary used in discovery UI. */
87
+ readonly description: string
88
+ /** Optional free-form input hint advertised to capable clients. */
89
+ readonly input?: CommandInputDescriptor
90
+ }
91
+ ```
92
+
93
+ ```ts type-equiv
94
+ /** Syntactically valid slash command before registry resolution. */
95
+ interface ParsedCommand {
96
+ /** Lowercase command name without the leading slash. */
97
+ readonly name: string
98
+ /** Exact text following the command name. */
99
+ readonly rawInput: string
100
+ }
101
+ ```
102
+
103
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
104
+
105
+ <a id="cordis-surface"></a>
106
+
107
+ ## Cordis API
108
+
109
+ 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).
110
+
111
+ <a id="ctxcommands--commandruntime"></a>
112
+
113
+ ### `ctx.commands` — `CommandRuntime`
114
+
115
+ Human-command registry. Plain-context definitions are global; definitions registered through a command-injected child of an agent context shadow globals for that agent.
116
+
117
+ ```ts cordis-catalog
118
+ /**
119
+ * Register a global or calling-agent-scoped command.
120
+ * @param definition - discovery metadata and direct UI handler.
121
+ * @returns the exact effect disposer that unregisters this definition.
122
+ */
123
+ register(definition: CommandDefinition): () => void
124
+
125
+ /**
126
+ * List the effective immutable command descriptors for one agent.
127
+ * @param agent - exact receiving agent and scoped-layer key.
128
+ * @returns name-sorted descriptors after scoped shadowing.
129
+ */
130
+ @Remote list(agent: Agent): readonly CommandDescriptor[]
131
+
132
+ /**
133
+ * Resolve one effective command definition.
134
+ * @param agent - exact receiving agent and scoped-layer key.
135
+ * @param name - command name without a slash.
136
+ * @returns the scoped shadow or global definition.
137
+ */
138
+ find(agent: Agent, name: string): CommandDefinition | undefined
139
+
140
+ /**
141
+ * Parse and execute a known command without sending it to the model.
142
+ *
143
+ * A resolved command's lifecycle is logged: `command/run` is appended
144
+ * before the handler is invoked and `command/done` after settlement (a
145
+ * thrown or aborted handler settles as `kind: 'error'`). Both are direct
146
+ * log-only appends — no turn wraps them, and persistence drains them at
147
+ * ordinary checkpoints. Admission misses (syntax or unknown name) log
148
+ * nothing — they never entered a handler. A `command/run` append failure
149
+ * fails the execution loud; a `command/done` append failure on the
150
+ * handler-failure path is contained so the handler's own error stays the
151
+ * reported failure.
152
+ *
153
+ * @param agent - exact receiving agent.
154
+ * @param line - complete slash-command line.
155
+ * @param signal - cancellation signal owned by the UI request.
156
+ * @returns the settled execution (result + lifecycle pairing id), or
157
+ * `undefined` when syntax or name does not resolve.
158
+ */
159
+ @Remote async execute( agent: Agent, line: string, signal: AbortSignal, ): Promise<CommandExecution | undefined>
160
+ ```
161
+
162
+ Types: [Agent](core.md)
163
+
164
+ Source: [`packages/interaction/commands/src/index.ts:225`](../../packages/interaction/commands/src/index.ts)
165
+
166
+ <a id="commands-events"></a>
167
+
168
+ ### `commands/*` events
169
+
170
+ <a id="commandschange--emit"></a>
171
+
172
+ #### `commands/change` — emit
173
+
174
+ A command was registered or unregistered. This is an unfiltered registry notification because a global or scoped change may affect any UI view. Observer failures are contained and cannot veto the registry mutation.
175
+
176
+ ```ts cordis-catalog
177
+ /**
178
+ * A command was registered or unregistered. This is an unfiltered registry
179
+ * notification because a global or scoped change may affect any UI view.
180
+ * Observer failures are contained and cannot veto the registry mutation.
181
+ * @mode emit
182
+ */
183
+ 'commands/change'(): void
184
+ ```
185
+
186
+ Source: [`packages/interaction/commands/src/types.ts:72`](../../packages/interaction/commands/src/types.ts)
187
+ <!-- END GENERATED cordis-surface -->
@@ -0,0 +1,187 @@
1
+ # 用户命令
2
+
3
+ [English](commands.md) | 中文
4
+
5
+ [`dsh-commands`](../../packages/interaction/commands) 提供的用户命令注册表服务。交互式适配器用它发现插件拥有的命令,并针对确切的 agent(智能体)直接执行这些命令,而不创建模型消息。[命令 Agent Note](../../.agents/notes/implemented/feature/2026-07-19-plugin-command-registration.md) 负责分发与生命周期的决策依据;[包 README](../../packages/interaction/commands/README.md) 负责组合方式与限制。
6
+
7
+ 来源:[`packages/interaction/commands/src/index.ts`](../../packages/interaction/commands/src/index.ts)
8
+
9
+ ## 输入元数据
10
+
11
+ 该服务公开一个可选的非结构化输入提示。命令的可用性由插件组合决定:每个消费注册表的适配器都会看到全部生效定义。
12
+
13
+ ```ts type-equiv
14
+ /** Immutable metadata for a command's optional unstructured input. */
15
+ interface CommandInputDescriptor {
16
+ /** Placeholder shown before the user supplies free-form input. */
17
+ readonly hint: string
18
+ }
19
+ ```
20
+
21
+ ## 定义
22
+
23
+ `CommandDefinition` 是由插件编写的注册定义。注册表会验证并冻结一份与原始注册对象脱离的生效定义。
24
+
25
+ ```ts type-equiv
26
+ /** Plugin-owned command registration. */
27
+ interface CommandDefinition {
28
+ /** Lowercase command name without the leading slash. */
29
+ readonly name: string
30
+ /** Human-readable summary used in discovery UI. */
31
+ readonly description: string
32
+ /** Optional free-form input hint advertised to capable clients. */
33
+ readonly input?: CommandInputDescriptor
34
+ /**
35
+ * Whether `command/run` records `rawInput`. Defaults to true. A command
36
+ * whose domain event owns the payload sets this false to avoid duplicating
37
+ * that payload in the session log.
38
+ */
39
+ readonly recordInput?: boolean
40
+ /** Execute against the receiving agent without sending the command to the model. */
41
+ readonly handler: (invocation: CommandInvocation) => CommandResult | Promise<CommandResult>
42
+ }
43
+ ```
44
+
45
+ ## 调用与结果
46
+
47
+ 取消由适配器负责,适配器会传入确切的目标 agent。`rawInput` 紧接在解析后的名称之后,并保留适配器传入的分隔符与后缀。结果会直接呈现给 UI,而不是工具结果或会话事件。
48
+
49
+ ```ts type-equiv
50
+ /** Invocation passed to one registered command handler. */
51
+ interface CommandInvocation {
52
+ /** Pairing id already written to this invocation's `command/run` event. */
53
+ readonly commandId: CommandId
54
+ /** Exact agent whose UI received the command. */
55
+ readonly agent: Agent
56
+ /** Exact text following the registered command name, including separator whitespace. */
57
+ readonly rawInput: string
58
+ /** Cancellation signal owned by the dispatching UI request. */
59
+ readonly signal: AbortSignal
60
+ }
61
+ ```
62
+
63
+ ```ts type-equiv
64
+ /** Expected command outcome rendered directly by the dispatching UI. */
65
+ type CommandResult =
66
+ | {
67
+ readonly kind: 'success'
68
+ readonly text?: string
69
+ /** Earlier authoritative domain event that owns a richer presentation. */
70
+ readonly sourceEventSeq?: number
71
+ }
72
+ | { readonly kind: 'error'; readonly text: string }
73
+ ```
74
+
75
+ `sourceEventSeq` 是可选字段,且只用于成功结果。存在时,它指向接收会话日志中更早的一条非命令事件;`command/done` 会持久化同一引用,让客户端能够将命令生命周期与该领域投影合并,而无须解析 `text` 或依赖相邻行。
76
+
77
+ ## 发现与解析视图
78
+
79
+ 作用域解析后,适配器会获得不含处理器的不可变描述符。`parseCommand()` 在注册表解析前返回 `ParsedCommand`;语法有效的输入仍可能指向不可用的命令。
80
+
81
+ ```ts type-equiv
82
+ /** Handler-free immutable command view returned to UI adapters. */
83
+ interface CommandDescriptor {
84
+ /** Lowercase command name without the leading slash. */
85
+ readonly name: string
86
+ /** Human-readable summary used in discovery UI. */
87
+ readonly description: string
88
+ /** Optional free-form input hint advertised to capable clients. */
89
+ readonly input?: CommandInputDescriptor
90
+ }
91
+ ```
92
+
93
+ ```ts type-equiv
94
+ /** Syntactically valid slash command before registry resolution. */
95
+ interface ParsedCommand {
96
+ /** Lowercase command name without the leading slash. */
97
+ readonly name: string
98
+ /** Exact text following the command name. */
99
+ readonly rawInput: string
100
+ }
101
+ ```
102
+
103
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
104
+
105
+ <a id="cordis-surface"></a>
106
+
107
+ ## Cordis API
108
+
109
+ 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).
110
+
111
+ <a id="ctxcommands--commandruntime"></a>
112
+
113
+ ### `ctx.commands` — `CommandRuntime`
114
+
115
+ Human-command registry. Plain-context definitions are global; definitions registered through a command-injected child of an agent context shadow globals for that agent.
116
+
117
+ ```ts cordis-catalog
118
+ /**
119
+ * Register a global or calling-agent-scoped command.
120
+ * @param definition - discovery metadata and direct UI handler.
121
+ * @returns the exact effect disposer that unregisters this definition.
122
+ */
123
+ register(definition: CommandDefinition): () => void
124
+
125
+ /**
126
+ * List the effective immutable command descriptors for one agent.
127
+ * @param agent - exact receiving agent and scoped-layer key.
128
+ * @returns name-sorted descriptors after scoped shadowing.
129
+ */
130
+ @Remote list(agent: Agent): readonly CommandDescriptor[]
131
+
132
+ /**
133
+ * Resolve one effective command definition.
134
+ * @param agent - exact receiving agent and scoped-layer key.
135
+ * @param name - command name without a slash.
136
+ * @returns the scoped shadow or global definition.
137
+ */
138
+ find(agent: Agent, name: string): CommandDefinition | undefined
139
+
140
+ /**
141
+ * Parse and execute a known command without sending it to the model.
142
+ *
143
+ * A resolved command's lifecycle is logged: `command/run` is appended
144
+ * before the handler is invoked and `command/done` after settlement (a
145
+ * thrown or aborted handler settles as `kind: 'error'`). Both are direct
146
+ * log-only appends — no turn wraps them, and persistence drains them at
147
+ * ordinary checkpoints. Admission misses (syntax or unknown name) log
148
+ * nothing — they never entered a handler. A `command/run` append failure
149
+ * fails the execution loud; a `command/done` append failure on the
150
+ * handler-failure path is contained so the handler's own error stays the
151
+ * reported failure.
152
+ *
153
+ * @param agent - exact receiving agent.
154
+ * @param line - complete slash-command line.
155
+ * @param signal - cancellation signal owned by the UI request.
156
+ * @returns the settled execution (result + lifecycle pairing id), or
157
+ * `undefined` when syntax or name does not resolve.
158
+ */
159
+ @Remote async execute( agent: Agent, line: string, signal: AbortSignal, ): Promise<CommandExecution | undefined>
160
+ ```
161
+
162
+ Types: [Agent](core.md)
163
+
164
+ Source: [`packages/interaction/commands/src/index.ts:225`](../../packages/interaction/commands/src/index.ts)
165
+
166
+ <a id="commands-events"></a>
167
+
168
+ ### `commands/*` events
169
+
170
+ <a id="commandschange--emit"></a>
171
+
172
+ #### `commands/change` — emit
173
+
174
+ A command was registered or unregistered. This is an unfiltered registry notification because a global or scoped change may affect any UI view. Observer failures are contained and cannot veto the registry mutation.
175
+
176
+ ```ts cordis-catalog
177
+ /**
178
+ * A command was registered or unregistered. This is an unfiltered registry
179
+ * notification because a global or scoped change may affect any UI view.
180
+ * Observer failures are contained and cannot veto the registry mutation.
181
+ * @mode emit
182
+ */
183
+ 'commands/change'(): void
184
+ ```
185
+
186
+ Source: [`packages/interaction/commands/src/types.ts:72`](../../packages/interaction/commands/src/types.ts)
187
+ <!-- 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/compaction.md
5
+ compaction.md: 95a3d4b844c6126a09d4fdaafdedcf987b21d1c6
6
+ compaction.zh.md: 3b72bb4f81675119d869fb2f7439f4640e6a5a86
@@ -0,0 +1,238 @@
1
+ # Compaction
2
+
3
+ English | [中文](compaction.zh.md)
4
+
5
+ The compaction seam — a [capability seam](../../.agents/notes/implemented/architecture/2026-06-13-capability-seams.md) split like bash: Service Definition ([dsh-compaction](../../packages/compaction/compaction), `ctx.compaction`), Service Provider (a backend such as [dsh-compaction-basic](../../packages/compaction/compaction-basic)), and human Consumer ([dsh-command-compact](../../packages/compaction/command-compact)). Compaction is **one optional capability**, not part of the agent-loop spine — so its vocabulary lives here, not in [core.md](core.md). A tokenizer- or template-based backend is a sibling package implementing the same interface. Unlike bash, the interface necessarily depends on `dsh-session` and `dsh-llm`: its verbs act on an agent-owned `Session`, and its durable summary event uses the `ContentBlock` vocabulary (see the [compaction capability-seam Agent Note](../../.agents/notes/implemented/feature/2026-06-18-compaction-capability-seam.md)).
6
+
7
+ Source: [`packages/compaction/compaction/src/types.ts`](../../packages/compaction/compaction/src/types.ts)
8
+
9
+ ## The `compaction/*` session events
10
+
11
+ Compaction extends [`SessionEventMap`](session.md) with three event types via declaration merging. All three are **log-only** — they record the lock, summary, selected range, shadowed event seqs, token count, and model call without joining the surface. `SurfaceEventType` is deliberately NOT extended (only message-producing events reach the model), so the summary itself rides on a separate `user/message` with `surfaceOp: { op: 'replace', start, end }` — the only surface mutation performed by summary compaction. The [Agent Note](../../.agents/notes/implemented/feature/2026-06-18-compaction-capability-seam.md) owns the rationale for reusing `user/message`.
12
+
13
+ | Event | Payload | Role |
14
+ |---|---|---|
15
+ | `compaction/start` | `{ turn }` | acquires the log-recorded lock; a number identifies the open automatic turn, while `null` identifies a standalone manual attempt |
16
+ | `compaction/summary` | `{ summary, rawOutput?, llmStreamCall?, shadowedRange, shadowedSeqs, shadowedTokenCount, provider, model, maxTokens?, usage? }` | the safe summary projection, optional complete provider output and usage, an `llmStreamCall: true` marker when producing the result consumed exactly one call through this context's `ctx.llm.stream()` (which requires complete `rawOutput`), the shadowed surface-boundary pair (`start`/`end` seqs — a position span, not a numeric interval), the shadowed seqs in surface order, the estimated token count, and the summarize call's envelope (`provider`, `model`, plus its generation cap when one applied) — logged so the one-shot request is reconstructable from log + code (the reconstructability Agent Note); unmarked `rawOutput` does not identify the call path |
17
+ | `compaction/end` | `{ turn, error? }` | releases the lock with the same numeric-or-null owner (`error` records an unsuccessful attempt) |
18
+
19
+ The lock brackets the **whole** operation: `compaction/start` is appended first, then summarization, the `compaction/summary` record, and the `user/message` replacement all land, and only then `compaction/end`. Releasing the lock last turns a crash mid-operation into a detectable orphaned lock (a `compaction/start` with no matching `compaction/end`) rather than a `compaction/end` that falsely claims compaction finished.
20
+
21
+ The markers are lock time points, not an exclusive container. An unrelated idle injection can appear between a standalone manual start and end while summarization is pending. The manual path revalidates only its selected positional span, so that injected context survives after the replacement checkpoint. A live unmatched start blocks every entry point; an unmatched start before a newer `session/end-seed` is stale evidence from a prior lifecycle and is ignored.
22
+
23
+ These variants are merged inside a `declare module '@deepseek-ai/dsh-session/types'` block, so — unlike the top-level types on the other subsystem pages — they are not pasted as a drift-checked ` ```ts type-equiv ` block (the `verify-type-equiv` extractor matches only top-level declarations by name). The payload table above is the catalog entry; follow the source link for the authoritative fields.
24
+
25
+ ## `CompactionResult`
26
+
27
+ What a successful compaction returns to its caller: the bookkeeping-event seqs, safe summary projection, shadowed range and seqs, and estimated token count.
28
+
29
+ ```ts type-equiv
30
+ /** Result of a successful compaction operation. */
31
+ interface CompactionResult {
32
+ /** Stable identity shared by this compaction's complete durable lifecycle. */
33
+ compactionId: CompactionId
34
+ /** Human command that initiated this compaction, when it was manual. */
35
+ sourceCommandId?: CommandId
36
+ /** The seq of the appended `compaction/start` event. */
37
+ startSeq: number
38
+ /** The seq of the appended `compaction/summary` event. */
39
+ summarySeq: number
40
+ /** The seq of the appended `compaction/end` event. */
41
+ endSeq: number
42
+ /** The summary content blocks produced by the backend. */
43
+ summary: ContentBlock[]
44
+ /**
45
+ * The surface-boundary pair that was shadowed: the seqs of the first
46
+ * (`start`) and last (`end`) surface nodes of the replaced range. A
47
+ * surface-POSITION span, not a numeric seq interval — after a prior replace
48
+ * lands a fresh high-seq summary node at an older range's position, `start`
49
+ * can be GREATER than `end`. {@link CompactionResult.shadowedSeqs} is the
50
+ * authoritative set of shadowed nodes, in surface order.
51
+ */
52
+ shadowedRange: { start: number; end: number }
53
+ /** The seqs of all shadowed surface nodes, in surface order. */
54
+ shadowedSeqs: number[]
55
+ /** Estimated token count of the shadowed content. */
56
+ shadowedTokenCount: number
57
+ }
58
+ ```
59
+
60
+ ## The service
61
+
62
+ Automatic callers state why policy is running; implementations may treat confirmed overflow more aggressively than ordinary pressure.
63
+
64
+ ```ts type-equiv
65
+ /** Why automatic policy is asking a backend to consider compaction. */
66
+ type CompactionTrigger = 'pressure' | 'context-overflow'
67
+ ```
68
+
69
+ `CompactionEngine` exposes `compactIfNeeded(agent, trigger, signal)` for automatic `pressure` or `context-overflow` policy, `compactNow(agent, signal)` for one useful idle-session reduction even below pressure, and `compactRegion(...)` for an explicit inclusive surface range. `compactNow()` runs as agent maintenance between turns, returns `null` without writing when no useful range exists, records a standalone `turn: null` bracket before summarization, and flushes a closed attempt before later queued prompts may derive from the new surface. Every backend creates its replacement `user/message` source with `compactCheckpointSource(compactionId, sourceCommandId?)`; client and wire consumers import that constructor, `CompactionCheckpointSource`, and `isCompactCheckpointSource()` from the cordis-free `@deepseek-ai/dsh-compaction/checkpoint` subpath, while the package root re-exports them for host consumers. The required transaction identity correlates the replacement checkpoint, while the predicate keeps recognition independent of any one backend. Implementations must forward the supplied signal to summarization. The seam owns no pricing API: the singleton [`ctx.tokenMeter`](token-meter.md) directly owns estimation and replay, while `dsh-compaction-basic` owns retention, event sequencing, routed summarization calls, and their configuration.
70
+
71
+ Expected manual failures use `ManualCompactionErrorCode`:
72
+
73
+ ```ts type-equiv
74
+ /** Expected failure classes for an explicit idle-session compaction request. */
75
+ type ManualCompactionErrorCode =
76
+ | 'busy'
77
+ | 'cancelled'
78
+ | 'changed'
79
+ | 'summary'
80
+ | 'commit'
81
+ | 'persistence'
82
+ ```
83
+
84
+ `changed` and `summary` leave the conversation surface unchanged but still close and persist the failed attempt in the log. `commit` may follow partial mutation; `persistence` means the in-memory bracket closed but its flush failed. Cancellation remains separate and throws the exact abort reason after required cleanup.
85
+
86
+ Pressure compaction runs at serial `agent/pre-step` before request derivation. Once pressure or canonical overflow qualifies, compaction-basic invokes optional [`ctx.toolResultPruner`](../../packages/compaction/compaction-tool-result-pruner/README.md) before range selection, remeasures through `ctx.tokenMeter`, and can advance the surface without a summary. Failed-request recovery runs through `agent/request-error` after the failed step closes and returns a retry action only when the surface replacement generation advances, even if later summary work throws after pruning; cancellation still wins. Region boundaries preserve tool-call/result pairing but not whole turns, allowing early closed steps of one oversized turn to compact. `dsh-compaction-basic` owns thresholds, retained-tail policy, overflow caps, and failure handling.
87
+
88
+ The Service Definition exports `toolPairingBalancedBefore(session, seq)` and `toolPairingBalancedAfter(session, seq)` for the tool-call/result pairing checks before and after a seq. Both validate current surface membership and reject missing seqs and orphan results; the [package contract](../../packages/compaction/compaction/README.md#tool-pairing-boundaries) defines their cache behavior.
89
+
90
+ ## Tool-result pruning outcomes
91
+
92
+ The optional tool-result pruning service reports each durable content replacement and the aggregate Unicode-code-point reduction. Its public result types live in [`compaction-tool-result-pruner/src/types.ts`](../../packages/compaction/compaction-tool-result-pruner/src/types.ts).
93
+
94
+ ```ts type-equiv
95
+ /** Cited source event and size accounting for one landed surface replacement. */
96
+ interface PrunedEntry {
97
+ /** Full-fidelity tool-result event shadowed by the replacement. */
98
+ readonly originalSeq: number
99
+ /** Newly appended pruned tool-result event. */
100
+ readonly replacementSeq: number
101
+ /** Tool call shared by the original and replacement. */
102
+ readonly callId: CallId
103
+ /** Original text size in Unicode code points. */
104
+ readonly charsBefore: number
105
+ /** Replacement text size in Unicode code points. */
106
+ readonly charsAfter: number
107
+ }
108
+ ```
109
+
110
+ ```ts type-equiv
111
+ /** Aggregate outcome of one stable-surface pruning pass. */
112
+ interface PruneResult {
113
+ /** Replacements in the snapshotted surface order. */
114
+ readonly pruned: readonly PrunedEntry[]
115
+ /** Total Unicode code points removed across replacements. */
116
+ readonly charsRemoved: number
117
+ }
118
+ ```
119
+
120
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
121
+
122
+ <a id="cordis-surface"></a>
123
+
124
+ ## Cordis API
125
+
126
+ 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).
127
+
128
+ <a id="ctxcompaction--compactionengine-abstract-seam"></a>
129
+
130
+ ### `ctx.compaction` — `CompactionEngine` (abstract seam)
131
+
132
+ Abstract compaction service. Implementations own trigger policy, retention, and summarization, and may consume a separate measurement service. A successful run replaces the selected surface span with one summary node and prevents concurrent compaction of the same session. The replacement user message uses compactCheckpointSource with the transaction identity so consumers recognize and correlate it independently of the backend. Load one implementation per context as `ctx.compaction`.
133
+
134
+ ```ts cordis-catalog
135
+ /**
136
+ * Consider automatic compaction for one explicit trigger. Pressure policy
137
+ * uses the latest durable routed request, while context-overflow policy may
138
+ * force a useful balanced reduction even below the normal threshold. Return
139
+ * `null` when no safe range can be compacted. A single oversized retained
140
+ * unit or request envelope cannot be repaired through surface compaction.
141
+ *
142
+ * @param agent - agent context owning the session surface and routing options.
143
+ * @param trigger - normal pressure or provider-confirmed context overflow.
144
+ * @param signal - cancellation signal; model-backed implementations must forward it.
145
+ * @returns the compaction result, or `null` if no compaction was needed.
146
+ */
147
+ abstract compactIfNeeded( agent: CompactionAgentContext, trigger: CompactionTrigger, signal: AbortSignal, ): Promise<CompactionResult | null>
148
+
149
+ /**
150
+ * Explicitly compact useful history even below automatic pressure thresholds.
151
+ * Implementations synchronously start an idle task before any asynchronous
152
+ * work, select a useful range without writing on a no-op, then
153
+ * append a standalone `compaction/start` before summarization. That durable
154
+ * marker is the compaction lock until one `compaction/end` attempt. Later waking
155
+ * prompts remain accepted in FIFO order and start only after the optional
156
+ * durability checkpoint and idle-task settlement. Context injected while the
157
+ * summary runs may sit between the marker pair; only the selected span must
158
+ * remain stable.
159
+ *
160
+ * @param agent - idle agent whose durable history should be compacted.
161
+ * @param signal - cancellation scoped to this compaction request.
162
+ * @param sourceCommandId - initiating command identity for a manual compaction.
163
+ * @returns the compaction result, or `null` when no safe useful range exists.
164
+ * @throws {@link ManualCompactionError} for expected busy, agent-cancellation,
165
+ * changed-span, summarization/shrink, commit-stage, or persistence failures;
166
+ * an aborted request preserves its exact abort reason. Failed attempts remain
167
+ * visible in the log.
168
+ */
169
+ abstract compactNow( agent: ManualCompactAgentContext, signal: AbortSignal, sourceCommandId?: CommandId, ): Promise<CompactionResult | null>
170
+
171
+ /**
172
+ * Forcibly compact a range of surface nodes into a single summary node.
173
+ * `start` and `end` name an inclusive span by surface position, not numeric seq
174
+ * order; replacements can make visible seqs non-monotonic. Both edges must be
175
+ * balanced so assistant tool calls remain paired with their results. A model-
176
+ * backed implementation forwards cancellation and rejects active, missing,
177
+ * reversed, or unbalanced ranges. The target session is `agent.session`.
178
+ * Its replacement user message must use {@link compactCheckpointSource} with
179
+ * the transaction's `CompactionId`.
180
+ * Use {@link toolPairingBalancedBefore} and {@link toolPairingBalancedAfter}
181
+ * for the edge checks.
182
+ *
183
+ * @param start - first surface seq, inclusive.
184
+ * @param end - last surface seq, inclusive.
185
+ * @param agent - context whose session is mutated and whose routing options guide summarization.
186
+ * @param signal - optional cancellation; model-backed implementations must forward it.
187
+ * @throws when compaction is active or the range is missing, reversed, or unbalanced.
188
+ * @returns the appended event seqs, summary, replaced range, and token accounting.
189
+ */
190
+ abstract compactRegion( start: number, end: number, agent: CompactionAgentContext, signal?: AbortSignal, ): Promise<CompactionResult>
191
+ ```
192
+
193
+ Types: [CommandId](commands.md)
194
+
195
+ Source: [`packages/compaction/compaction/src/index.ts:96`](../../packages/compaction/compaction/src/index.ts)
196
+
197
+ <a id="ctxtoolresultpruner--toolresultpruner"></a>
198
+
199
+ ### `ctx.toolResultPruner` — `ToolResultPruner`
200
+
201
+ Deterministic head/middle/tail pruning for current tool-result surface nodes.
202
+
203
+ ```ts cordis-catalog
204
+ /**
205
+ * Measure text content in Unicode code points; non-text blocks cost zero.
206
+ * @param blocks - tool-result content to measure.
207
+ * @returns total Unicode code points across text blocks.
208
+ */
209
+ measureContent(blocks: readonly ContentBlock[]): number
210
+
211
+ /**
212
+ * Replace an over-budget text middle while retaining rich-block order.
213
+ * Text slicing is by Unicode code point, not UTF-16 code unit, so a retained
214
+ * boundary cannot split a surrogate pair. Grapheme clusters may still split.
215
+ * @param blocks - original tool-result content.
216
+ * @returns pruned content, or `null` when the text is within budget.
217
+ */
218
+ pruneContent(blocks: readonly ContentBlock[]): ContentBlock[] | null
219
+
220
+ /**
221
+ * Prune every over-budget tool result from one stable current-surface snapshot.
222
+ * Each replacement preserves the complete event data except for `content`,
223
+ * cites the shadowed node so replay can recover the replacement input, and is
224
+ * immediately preceded by a `compaction/prune` shadow-price event pricing the
225
+ * shadowed node through the injected token meter, so pure consumers can
226
+ * subtract it without per-node state.
227
+ * @param session - session whose current surface is rewritten.
228
+ * @returns landed replacements and aggregate Unicode-code-point savings.
229
+ * @throws when the session rejects a replacement; replacements committed
230
+ * earlier in the pass remain durable.
231
+ */
232
+ pruneSession(session: Session): PruneResult
233
+ ```
234
+
235
+ Types: [ContentBlock](llm-streaming.md) · [Session](session.md)
236
+
237
+ Source: [`packages/compaction/compaction-tool-result-pruner/src/index.ts:44`](../../packages/compaction/compaction-tool-result-pruner/src/index.ts)
238
+ <!-- END GENERATED cordis-surface -->