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,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/subprocess.md
5
+ subprocess.md: af6770e8c04f79ab1981967d5a3bca5a39b954be
6
+ subprocess.zh.md: 19f20e7fcd675d87cf768258d1ab9c37bf80a836
@@ -0,0 +1,324 @@
1
+ # Subprocess
2
+
3
+ English | [中文](subprocess.zh.md)
4
+
5
+ The subprocess seam is split across a Service Definition ([dsh-subprocess](../../packages/subprocess/subprocess), `ctx.subprocess`) and Service Provider ([dsh-subprocess-local](../../packages/subprocess/subprocess-local)); its Consumers are other capability seams and out-of-process backends: the [bash executor family](shell.md) uses collected batch output, LSP uses raw protocol pipes, the PTY backend uses the terminal primitive, and the ACP subagent backend uses piped ndjson plus inherited stderr. This seam owns the managed `DSH_*` environment namespace, the shared credential scrub (`scrubbedParentEnv`), and the `CollectedOutput` shape; [dsh-shell](../../packages/shell/shell) re-exports the vocabulary so bash consumers keep one import root.
6
+
7
+ Source: [`packages/subprocess/subprocess/src/types.ts`](../../packages/subprocess/subprocess/src/types.ts) and [`packages/subprocess/subprocess/src/index.ts`](../../packages/subprocess/subprocess/src/index.ts)
8
+
9
+ ## Executable lookup
10
+
11
+ One provider's spawn working directories, executable paths, ordinary processes, and terminal sessions inhabit the same path and process namespace as the mounted filesystem provider. `resolveExecutable(command, env?, signal?)` verifies absolute executable paths or resolves bare names through the provider's scrubbed `PATH` plus deliberate overrides.
12
+
13
+ ## Managed environment namespace and captured output
14
+
15
+ `DSH_*` variables are Harness-owned child-process facts; implementations discard ambient `DSH_*` names before the caller's explicit `env` merges, so a current fact arrives only as a deliberate string entry, while an explicit `undefined` tombstone removes an ordinary ambient value. Each collected stream reports its truncation and spill-recovery state through `CollectedOutput`.
16
+
17
+ ```ts type-equiv
18
+ /** One environment key inside the managed {@link DSH_ENV_PREFIX} namespace. */
19
+ type DshEnvironmentKey = `${typeof DSH_ENV_PREFIX}${string}`
20
+ ```
21
+
22
+ ```ts type-equiv
23
+ /** Trusted DeepSeek Harness variables for one child-process execution. */
24
+ type DshEnvironment = Readonly<Record<DshEnvironmentKey, string>>
25
+ ```
26
+
27
+ ```ts type-equiv
28
+ /** One captured stream: the (possibly truncated) text plus recovery info. */
29
+ interface CollectedOutput {
30
+ /** Collected text — the TAIL of the stream when truncated. */
31
+ text: string
32
+ /** True when bytes were dropped from `text`. */
33
+ truncated: boolean
34
+ /** Path to a file holding the COMPLETE stream, when truncated and available. */
35
+ spillPath?: string
36
+ }
37
+ ```
38
+
39
+ ## Node-shaped stdio dispositions
40
+
41
+ Each stream's disposition is explicit, chosen per consumer: raw pipes for protocol framing (LSP JSON-RPC, ACP ndjson), inherit for pass-through diagnostics, and collect mode for bounded batch output — with the spill file optional, so a diagnostic tail (a language server's stderr) buffers without leaving files behind.
42
+
43
+ ```ts type-equiv
44
+ /**
45
+ * stdin disposition. `'ignore'` leaves fd 0 on `/dev/null`; `'pipe'` exposes
46
+ * {@link SubprocessHandle.stdin} for the caller's ongoing protocol writes;
47
+ * `{ data }` writes the bytes and closes (the batch shape).
48
+ */
49
+ type SubprocessStdinMode = 'ignore' | 'pipe' | { readonly data: string }
50
+ ```
51
+
52
+ ```ts type-equiv
53
+ /**
54
+ * Bounded in-memory collection for one output stream, with an optional
55
+ * full-stream spill file. Omitting `spill` keeps only the in-memory tail —
56
+ * the diagnostic-tail shape (a language server's stderr); including it makes
57
+ * the complete stream recoverable up to its cap (the bash tool shape).
58
+ */
59
+ interface SubprocessCollect {
60
+ /** In-memory cap in bytes; overflow keeps the TAIL. */
61
+ maxBytes: number
62
+ /** Full-stream spill file; absent disables spilling entirely. */
63
+ spill?: {
64
+ /** Whole-stream byte cap; a larger stream discards its now-incomplete spill. */
65
+ maxBytes: number
66
+ }
67
+ }
68
+ ```
69
+
70
+ ```ts type-equiv
71
+ /**
72
+ * stdout/stderr disposition. `'pipe'` exposes the raw `Readable` for the
73
+ * caller's protocol decoding; `'inherit'` passes the parent's descriptor
74
+ * through (child diagnostics land on the harness's own stream); a
75
+ * {@link SubprocessCollect} object buffers boundedly with offset-based reads.
76
+ */
77
+ type SubprocessOutputMode = 'pipe' | 'inherit' | SubprocessCollect
78
+ ```
79
+
80
+ ```ts type-equiv
81
+ /** Per-stream stdio dispositions, all explicit — this seam applies no defaults. */
82
+ interface SubprocessStdio {
83
+ stdin: SubprocessStdinMode
84
+ stdout: SubprocessOutputMode
85
+ stderr: SubprocessOutputMode
86
+ }
87
+ ```
88
+
89
+ ## The fully-explicit spawn spec
90
+
91
+ The seam applies no defaults: every disposition, limit, and directory is explicit on the spec, so the caller's own config — not a hidden subprocess-service default — decides them. `argv` is never shell-interpreted.
92
+
93
+ ```ts type-equiv
94
+ /**
95
+ * A fully-specified spawn request. This seam applies no defaults: every
96
+ * disposition, limit, and directory is explicit, so the caller's own config —
97
+ * not a hidden subprocess-service default — decides them (the `dsh-shell`
98
+ * request/spec split is the owning template).
99
+ */
100
+ interface SubprocessSpawnSpec {
101
+ /** Executable and arguments; `argv[0]` is the program. Never shell-interpreted here. */
102
+ argv: readonly string[]
103
+ /** Working directory for the child. */
104
+ cwd: string
105
+ /** Per-stream stdio dispositions. */
106
+ stdio: SubprocessStdio
107
+ /**
108
+ * Positive finite grace period in milliseconds, no greater than
109
+ * `MAX_TIMER_DELAY_MS`, for the {@link SubprocessHandle.terminate} escalation
110
+ * and for draining still-open collected pipes after the process exits (an
111
+ * inherited descriptor held by a surviving descendant cannot hold the
112
+ * outcome open indefinitely).
113
+ */
114
+ graceMs: number
115
+ /**
116
+ * Abort signal — starts the terminate escalation on the process tree when
117
+ * it fires. The caller owns deadlines and cause classification; this seam
118
+ * only reacts to the abort.
119
+ */
120
+ signal?: AbortSignal | undefined
121
+ /**
122
+ * Explicit environment entries merged onto the implementation's scrubbed
123
+ * parent base (see `scrubbedParentEnv`), with no namespace validation. A
124
+ * string is a deliberate caller opt-in, so a forwarded credential-shaped
125
+ * entry or current `DSH_*` fact survives the scrub; `undefined` is a
126
+ * tombstone that removes an ordinary ambient entry from the child.
127
+ */
128
+ env?: NodeJS.ProcessEnv | undefined
129
+ }
130
+ ```
131
+
132
+ ## Handles: streams, readers, and tree-scoped termination
133
+
134
+ A spawn returns a live handle immediately. Collect-mode readers take whole-stream byte offsets and never consume, so independent readers cannot steal one another's deltas; piped streams belong to the caller. Termination is tree-scoped on every platform: `terminate()` — the only termination verb — escalates SIGTERM→grace→SIGKILL, and `waitForExit()` observes the whole tree — enough for a consumer to build its own teardown ladder (the ACP backend's stdin-EOF-first `disposeAcpChild` is the template).
135
+
136
+ ```ts type-equiv
137
+ /**
138
+ * A live child process rooted in its own process tree. Collected output
139
+ * remains readable after exit; piped streams belong to the caller.
140
+ *
141
+ * Termination is tree-scoped everywhere: POSIX signals the detached process
142
+ * group (falling back to the direct child when the group is gone), Windows
143
+ * terminates the tree via `taskkill /T`, so helper processes cannot outlive
144
+ * the handle unnoticed.
145
+ */
146
+ interface SubprocessHandle {
147
+ /** Process id (tree root); -1 when the spawn itself failed. */
148
+ readonly pid: number
149
+ /** The child's stdin, present iff spawned with `stdin: 'pipe'`. */
150
+ readonly stdin: Writable | undefined
151
+ /** The child's raw stdout, present iff spawned with `stdout: 'pipe'`. */
152
+ readonly stdout: Readable | undefined
153
+ /** The child's raw stderr, present iff spawned with `stderr: 'pipe'`. */
154
+ readonly stderr: Readable | undefined
155
+ /** Offset-based readers for collect-mode streams (also readable after exit). */
156
+ readonly collected: SubprocessCollectedOutputs
157
+ /** Resolves at process close with exit facts; rejects only for spawn-level failures. */
158
+ readonly done: Promise<SubprocessOutcome>
159
+ /**
160
+ * Begin the SIGTERM → `graceMs` → SIGKILL escalation on the process tree
161
+ * (Windows force-terminates immediately) — the seam's only termination
162
+ * verb. Idempotent, a no-op once the tree is gone (the pid may be reused),
163
+ * and also triggered by the spec's abort signal.
164
+ */
165
+ terminate(): void
166
+ /**
167
+ * Wait until the process tree has exited — the tree, not just the direct
168
+ * child, so a still-running helper is observable before teardown returns.
169
+ * @param signal - optional bound for the wait.
170
+ * @returns `true` when the tree exited, `false` when the signal aborted first.
171
+ */
172
+ waitForExit(signal?: AbortSignal): Promise<boolean>
173
+ }
174
+ ```
175
+
176
+ ```ts type-equiv
177
+ /**
178
+ * Cursor-free incremental access to one collected output stream. Offsets are
179
+ * whole-stream byte coordinates owned by the caller, so independent readers
180
+ * cannot consume one another's output; `readFrom(0)` after settlement is the
181
+ * batch result (`lossy` then means the in-memory tail lost its head — the
182
+ * {@link CollectedOutput.truncated} fact).
183
+ */
184
+ interface SubprocessOutputReader {
185
+ /**
186
+ * Read everything captured since `fromByte`. When that offset has slid out
187
+ * of the in-memory tail window the read is `lossy` — it returns the whole
188
+ * retained tail and the gap is only recoverable from the spill file.
189
+ * @param fromByte - whole-stream offset to resume from (a prior read's `nextOffset`; 0 for the first read).
190
+ * @returns the delta text, the next offset, the `lossy` flag, and the spill path when one exists.
191
+ */
192
+ readFrom(fromByte: number): SubprocessOutputRead
193
+ }
194
+ ```
195
+
196
+ ```ts type-equiv
197
+ /** One incremental {@link SubprocessOutputReader.readFrom} read. */
198
+ interface SubprocessOutputRead {
199
+ /** Stream text from the requested offset (the whole retained tail when lossy). */
200
+ text: string
201
+ /** Whole-stream offset to resume from on the next read. */
202
+ nextOffset: number
203
+ /** True when the requested offset slid out of the in-memory tail window. */
204
+ lossy: boolean
205
+ /** Path to the full-stream spill file, when one was created and remains intact. */
206
+ spillPath?: string
207
+ }
208
+ ```
209
+
210
+ ```ts type-equiv
211
+ /** Offset-based readers for the streams spawned in collect mode. */
212
+ interface SubprocessCollectedOutputs {
213
+ /** Present iff stdout is a {@link SubprocessCollect}. */
214
+ readonly stdout?: SubprocessOutputReader
215
+ /** Present iff stderr is a {@link SubprocessCollect}. */
216
+ readonly stderr?: SubprocessOutputReader
217
+ }
218
+ ```
219
+
220
+
221
+ ## Outcomes carry exit facts only
222
+
223
+ `done` reports Node's close-event vocabulary and no cause classification — the service kills on abort but never decides why (the caller reads the deadline signal it owns, e.g. the bash executor's `timedOut`/`aborted` split). Collected output stays readable through `handle.collected` after settlement, so batch and streaming callers share one access path.
224
+
225
+ ```ts type-equiv
226
+ /**
227
+ * Exit facts of one closed process — Node's `close`-event vocabulary.
228
+ * Deliberately carries NO timeout or cancellation classification (the caller
229
+ * reads the signal it owns to classify causes) and NO output: collected
230
+ * streams stay readable through {@link SubprocessHandle.collected} after
231
+ * settlement, so batch and streaming callers share one access path.
232
+ */
233
+ interface SubprocessOutcome {
234
+ /** Exit code; null when the process died from a signal. */
235
+ exitCode: number | null
236
+ /** Terminating signal (e.g. 'SIGTERM'); null on normal exit. */
237
+ signal: NodeJS.Signals | null
238
+ }
239
+ ```
240
+
241
+ ## Terminal-process primitive
242
+
243
+ `spawnTerminal(spec)` is the non-pipe process primitive. The provider allocates the controlling terminal and owns UTF-8 text transport, foreground-process-group inspection and signalling, and one awaited TERM-to-KILL operation that reaches quiescence for every session member the provider can still observe; providers document substrate-specific observability limits. The PTY backend remains responsible for prompt detection, readiness inference, scrollback, sandbox policy, and persistent-session ownership; ordinary `spawn()` cannot reconstruct controlling-terminal semantics.
244
+
245
+ The terminal spec fully specifies argv, cwd, environment overrides, dimensions, cleanup grace, and optional allocation cancellation. Its handle exposes `pid`, ordered output, `done`, `write`, `inspectForeground`, `signalForeground`, and awaited `terminate`; the exact public shapes are generated into the [`ctx.subprocess` service catalog](#ctxsubprocess--subprocessruntime-abstract-seam).
246
+
247
+ ## Service behavior
248
+
249
+ The abstract [`SubprocessRuntime`](../../packages/subprocess/subprocess/src/index.ts) Service Definition specifies execution-world coordinates, executable lookup, ordinary `spawn`, and `spawnTerminal`. [`LocalSubprocessRuntime`](../../packages/subprocess/subprocess-local/src/index.ts) provides them with detached process trees, per-disposition wiring, credential scrubbing, `node-pty`, platform process inspection, and terminate-and-join disposal. See [`dsh-subprocess`](../../packages/subprocess/subprocess/README.md) for the Service Definition contract and [`dsh-subprocess-local`](../../packages/subprocess/subprocess-local/README.md) for local mechanics.
250
+
251
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
252
+
253
+ <a id="cordis-surface"></a>
254
+
255
+ ## Cordis API
256
+
257
+ 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).
258
+
259
+ <a id="ctxe2b--e2bruntime"></a>
260
+
261
+ ### `ctx.e2b` — `E2BRuntime`
262
+
263
+ Creates one lazily consumable E2B SDK handle and deletes the sandbox at timeout or disposal. Creation begins at plugin construction; adapters await getSandbox before their first operation.
264
+
265
+ ```ts cordis-catalog
266
+ /**
267
+ * Return the shared live SDK handle.
268
+ * @returns the created sandbox after the configured cwd exists.
269
+ * @throws when E2B rejects creation or the service is disposing.
270
+ */
271
+ async getSandbox(): Promise<Sandbox>
272
+ ```
273
+
274
+ Source: [`packages/e2b/e2b/src/index.ts:74`](../../packages/e2b/e2b/src/index.ts)
275
+
276
+ <a id="ctxsubprocess--subprocessruntime-abstract-seam"></a>
277
+
278
+ ### `ctx.subprocess` — `SubprocessRuntime` (abstract seam)
279
+
280
+ Abstract subprocess service. Subclass, implement spawn, and load the subclass as a plugin — it registers as `ctx.subprocess` (one implementation per context; loading a second throws, which is cordis' standard duplicate-service behavior).
281
+
282
+ Implementations must honor these semantics:
283
+
284
+ - Executable paths belong to one execution world shared with the mounted filesystem provider.
285
+ - spawn returns immediately with a live handle; `done` resolves at process close with exit facts and rejects only for spawn-level failures.
286
+ - Collect-mode readers are offset-based and non-consuming, so independent readers never consume one another's output; lossy reads report truncation and the spill file holding the complete stream when one exists. Piped streams are handed to the caller raw and never buffered here.
287
+ - SubprocessHandle.terminate (and the spec's abort signal) escalates SIGTERM→grace→SIGKILL — the only termination verb — tree-scoped on every platform. SubprocessHandle.waitForExit observes whole-tree liveness, so a consumer-owned teardown ladder can hold each tier on real quiescence.
288
+ - Disposal of the service terminates all still-running managed processes and awaits their exit.
289
+ - spawnTerminal owns terminal allocation, text transport, foreground groups, signalling, and whole-session quiescence behind one awaited termination method; readiness and persistent-shell policy stay in the PTY consumer. Its output stream ends after queued terminal output when the top-level process exits.
290
+
291
+ ```ts cordis-catalog
292
+ /**
293
+ * Resolve one configured executable in this provider's execution world.
294
+ * Absolute paths are verified; bare names use the provider's scrubbed PATH
295
+ * plus explicit environment overrides. Relative paths containing separators
296
+ * are rejected: the resolution base is undefined, so providers fail loud
297
+ * instead of guessing.
298
+ * @param command - absolute executable path or bare PATH name.
299
+ * @param env - explicit environment entries used for lookup.
300
+ * @param signal - aborts remote or local lookup.
301
+ * @returns a canonical executable path.
302
+ */
303
+ abstract resolveExecutable( command: string, env?: Readonly<Record<string, string>>, signal?: AbortSignal, ): Promise<string>
304
+
305
+ /**
306
+ * Start one managed child process from a fully-specified spec; this seam
307
+ * applies no defaults.
308
+ * @param spec - argv, directory, stdio dispositions, grace, cancellation, and environment.
309
+ * @returns the live process handle (streams/readers, signalling, outcome promise).
310
+ */
311
+ abstract spawn(spec: SubprocessSpawnSpec): SubprocessHandle
312
+
313
+ /**
314
+ * Allocate a real terminal and start one owned process session. This is the
315
+ * only non-pipe process primitive: implementations own terminal byte I/O,
316
+ * foreground groups, signals, and complete session-tree cleanup.
317
+ * @param spec - fully specified argv, cwd, environment, dimensions, grace, and allocation cancellation.
318
+ * @returns the live terminal handle after allocation succeeds.
319
+ */
320
+ abstract spawnTerminal(spec: SubprocessTerminalSpawnSpec): Promise<SubprocessTerminalHandle>
321
+ ```
322
+
323
+ Source: [`packages/subprocess/subprocess/src/index.ts:102`](../../packages/subprocess/subprocess/src/index.ts)
324
+ <!-- END GENERATED cordis-surface -->
@@ -0,0 +1,324 @@
1
+ # 子进程
2
+
3
+ [English](subprocess.md) | 中文
4
+
5
+ 子进程 seam 分为 Service Definition([dsh-subprocess](../../packages/subprocess/subprocess),`ctx.subprocess`)与 Service Provider([dsh-subprocess-local](../../packages/subprocess/subprocess-local));它的 Consumer 是其他能力 seam 与进程外后端:[bash 执行器家族](shell.md)使用收集模式的批量输出,LSP 使用原始协议管道,PTY 后端使用终端原语,ACP(Agent Client Protocol)subagent 后端则使用通过管道传输的 ndjson,并让 stderr 采用 inherit。该 seam 拥有受管的 `DSH_*` 环境命名空间、共享的凭据清除(`scrubbedParentEnv`)与 `CollectedOutput` 形状;[dsh-shell](../../packages/shell/shell) 重导出这套词汇,使 bash 消费方保持单一导入入口。
6
+
7
+ 源码:[`packages/subprocess/subprocess/src/types.ts`](../../packages/subprocess/subprocess/src/types.ts) 与 [`packages/subprocess/subprocess/src/index.ts`](../../packages/subprocess/subprocess/src/index.ts)
8
+
9
+ ## 可执行文件查找
10
+
11
+ 一个提供方的 spawn 工作目录、可执行文件路径、普通进程与终端会话,和挂载的文件系统提供方处于同一路径与进程命名空间。`resolveExecutable(command, env?, signal?)` 验证绝对可执行文件路径,或通过提供方清理后的 `PATH` 加有意覆盖来解析裸名称。
12
+
13
+ ## 受管环境命名空间与捕获的输出
14
+
15
+ `DSH_*` 变量是归 Harness 所有的子进程事实;实现会在合并调用方显式 `env` 之前丢弃环境中已有的 `DSH_*` 名称,因此当前事实只会以有意提供的字符串条目形式到达,而显式的 `undefined` tombstone 会删除普通环境中已有的值。每条被收集的流都通过 `CollectedOutput` 报告自身的截断与 spill 恢复状态。
16
+
17
+ ```ts type-equiv
18
+ /** One environment key inside the managed {@link DSH_ENV_PREFIX} namespace. */
19
+ type DshEnvironmentKey = `${typeof DSH_ENV_PREFIX}${string}`
20
+ ```
21
+
22
+ ```ts type-equiv
23
+ /** Trusted DeepSeek Harness variables for one child-process execution. */
24
+ type DshEnvironment = Readonly<Record<DshEnvironmentKey, string>>
25
+ ```
26
+
27
+ ```ts type-equiv
28
+ /** One captured stream: the (possibly truncated) text plus recovery info. */
29
+ interface CollectedOutput {
30
+ /** Collected text — the TAIL of the stream when truncated. */
31
+ text: string
32
+ /** True when bytes were dropped from `text`. */
33
+ truncated: boolean
34
+ /** Path to a file holding the COMPLETE stream, when truncated and available. */
35
+ spillPath?: string
36
+ }
37
+ ```
38
+
39
+ ## Node 风格的 stdio 处置方式(disposition)
40
+
41
+ 每条流的处置方式都显式给出,由各消费方自行选择:原始管道用于协议分帧(LSP JSON-RPC、ACP ndjson),inherit 用于直通的诊断输出,收集模式用于有界的批量输出;其中 spill 文件是可选的,因此诊断尾部(语言服务器的 stderr)可以只在内存中缓冲,不留下任何文件。
42
+
43
+ ```ts type-equiv
44
+ /**
45
+ * stdin disposition. `'ignore'` leaves fd 0 on `/dev/null`; `'pipe'` exposes
46
+ * {@link SubprocessHandle.stdin} for the caller's ongoing protocol writes;
47
+ * `{ data }` writes the bytes and closes (the batch shape).
48
+ */
49
+ type SubprocessStdinMode = 'ignore' | 'pipe' | { readonly data: string }
50
+ ```
51
+
52
+ ```ts type-equiv
53
+ /**
54
+ * Bounded in-memory collection for one output stream, with an optional
55
+ * full-stream spill file. Omitting `spill` keeps only the in-memory tail —
56
+ * the diagnostic-tail shape (a language server's stderr); including it makes
57
+ * the complete stream recoverable up to its cap (the bash tool shape).
58
+ */
59
+ interface SubprocessCollect {
60
+ /** In-memory cap in bytes; overflow keeps the TAIL. */
61
+ maxBytes: number
62
+ /** Full-stream spill file; absent disables spilling entirely. */
63
+ spill?: {
64
+ /** Whole-stream byte cap; a larger stream discards its now-incomplete spill. */
65
+ maxBytes: number
66
+ }
67
+ }
68
+ ```
69
+
70
+ ```ts type-equiv
71
+ /**
72
+ * stdout/stderr disposition. `'pipe'` exposes the raw `Readable` for the
73
+ * caller's protocol decoding; `'inherit'` passes the parent's descriptor
74
+ * through (child diagnostics land on the harness's own stream); a
75
+ * {@link SubprocessCollect} object buffers boundedly with offset-based reads.
76
+ */
77
+ type SubprocessOutputMode = 'pipe' | 'inherit' | SubprocessCollect
78
+ ```
79
+
80
+ ```ts type-equiv
81
+ /** Per-stream stdio dispositions, all explicit — this seam applies no defaults. */
82
+ interface SubprocessStdio {
83
+ stdin: SubprocessStdinMode
84
+ stdout: SubprocessOutputMode
85
+ stderr: SubprocessOutputMode
86
+ }
87
+ ```
88
+
89
+ ## 完全显式的 spawn spec
90
+
91
+ 该 seam 不应用任何默认值:每项处置方式、限制与目录都在 spec 上显式给出,因此由调用方自己的配置决定它们,而不是由某个隐藏的子进程服务默认值决定。`argv` 绝不经过 shell 解释。
92
+
93
+ ```ts type-equiv
94
+ /**
95
+ * A fully-specified spawn request. This seam applies no defaults: every
96
+ * disposition, limit, and directory is explicit, so the caller's own config —
97
+ * not a hidden subprocess-service default — decides them (the `dsh-shell`
98
+ * request/spec split is the owning template).
99
+ */
100
+ interface SubprocessSpawnSpec {
101
+ /** Executable and arguments; `argv[0]` is the program. Never shell-interpreted here. */
102
+ argv: readonly string[]
103
+ /** Working directory for the child. */
104
+ cwd: string
105
+ /** Per-stream stdio dispositions. */
106
+ stdio: SubprocessStdio
107
+ /**
108
+ * Positive finite grace period in milliseconds, no greater than
109
+ * `MAX_TIMER_DELAY_MS`, for the {@link SubprocessHandle.terminate} escalation
110
+ * and for draining still-open collected pipes after the process exits (an
111
+ * inherited descriptor held by a surviving descendant cannot hold the
112
+ * outcome open indefinitely).
113
+ */
114
+ graceMs: number
115
+ /**
116
+ * Abort signal — starts the terminate escalation on the process tree when
117
+ * it fires. The caller owns deadlines and cause classification; this seam
118
+ * only reacts to the abort.
119
+ */
120
+ signal?: AbortSignal | undefined
121
+ /**
122
+ * Explicit environment entries merged onto the implementation's scrubbed
123
+ * parent base (see `scrubbedParentEnv`), with no namespace validation. A
124
+ * string is a deliberate caller opt-in, so a forwarded credential-shaped
125
+ * entry or current `DSH_*` fact survives the scrub; `undefined` is a
126
+ * tombstone that removes an ordinary ambient entry from the child.
127
+ */
128
+ env?: NodeJS.ProcessEnv | undefined
129
+ }
130
+ ```
131
+
132
+ ## 句柄:流、读取器与以进程树为范围的终止
133
+
134
+ spawn 会立即返回一个活动句柄。收集模式的读取器接受全流字节偏移量且从不消费,因此独立的读取器不会抢走彼此的增量;管道化的流归调用方所有。终止在每个平台上都以进程树为范围:`terminate()`(唯一的终止动词)执行 SIGTERM→宽限期→SIGKILL 升级,`waitForExit()` 观察整棵进程树。这足以让消费方构建自己的分级清理流程;ACP 后端的 `disposeAcpChild` 会先关闭 stdin,让子进程收到 EOF,是仓库内的参考实现。
135
+
136
+ ```ts type-equiv
137
+ /**
138
+ * A live child process rooted in its own process tree. Collected output
139
+ * remains readable after exit; piped streams belong to the caller.
140
+ *
141
+ * Termination is tree-scoped everywhere: POSIX signals the detached process
142
+ * group (falling back to the direct child when the group is gone), Windows
143
+ * terminates the tree via `taskkill /T`, so helper processes cannot outlive
144
+ * the handle unnoticed.
145
+ */
146
+ interface SubprocessHandle {
147
+ /** Process id (tree root); -1 when the spawn itself failed. */
148
+ readonly pid: number
149
+ /** The child's stdin, present iff spawned with `stdin: 'pipe'`. */
150
+ readonly stdin: Writable | undefined
151
+ /** The child's raw stdout, present iff spawned with `stdout: 'pipe'`. */
152
+ readonly stdout: Readable | undefined
153
+ /** The child's raw stderr, present iff spawned with `stderr: 'pipe'`. */
154
+ readonly stderr: Readable | undefined
155
+ /** Offset-based readers for collect-mode streams (also readable after exit). */
156
+ readonly collected: SubprocessCollectedOutputs
157
+ /** Resolves at process close with exit facts; rejects only for spawn-level failures. */
158
+ readonly done: Promise<SubprocessOutcome>
159
+ /**
160
+ * Begin the SIGTERM → `graceMs` → SIGKILL escalation on the process tree
161
+ * (Windows force-terminates immediately) — the seam's only termination
162
+ * verb. Idempotent, a no-op once the tree is gone (the pid may be reused),
163
+ * and also triggered by the spec's abort signal.
164
+ */
165
+ terminate(): void
166
+ /**
167
+ * Wait until the process tree has exited — the tree, not just the direct
168
+ * child, so a still-running helper is observable before teardown returns.
169
+ * @param signal - optional bound for the wait.
170
+ * @returns `true` when the tree exited, `false` when the signal aborted first.
171
+ */
172
+ waitForExit(signal?: AbortSignal): Promise<boolean>
173
+ }
174
+ ```
175
+
176
+ ```ts type-equiv
177
+ /**
178
+ * Cursor-free incremental access to one collected output stream. Offsets are
179
+ * whole-stream byte coordinates owned by the caller, so independent readers
180
+ * cannot consume one another's output; `readFrom(0)` after settlement is the
181
+ * batch result (`lossy` then means the in-memory tail lost its head — the
182
+ * {@link CollectedOutput.truncated} fact).
183
+ */
184
+ interface SubprocessOutputReader {
185
+ /**
186
+ * Read everything captured since `fromByte`. When that offset has slid out
187
+ * of the in-memory tail window the read is `lossy` — it returns the whole
188
+ * retained tail and the gap is only recoverable from the spill file.
189
+ * @param fromByte - whole-stream offset to resume from (a prior read's `nextOffset`; 0 for the first read).
190
+ * @returns the delta text, the next offset, the `lossy` flag, and the spill path when one exists.
191
+ */
192
+ readFrom(fromByte: number): SubprocessOutputRead
193
+ }
194
+ ```
195
+
196
+ ```ts type-equiv
197
+ /** One incremental {@link SubprocessOutputReader.readFrom} read. */
198
+ interface SubprocessOutputRead {
199
+ /** Stream text from the requested offset (the whole retained tail when lossy). */
200
+ text: string
201
+ /** Whole-stream offset to resume from on the next read. */
202
+ nextOffset: number
203
+ /** True when the requested offset slid out of the in-memory tail window. */
204
+ lossy: boolean
205
+ /** Path to the full-stream spill file, when one was created and remains intact. */
206
+ spillPath?: string
207
+ }
208
+ ```
209
+
210
+ ```ts type-equiv
211
+ /** Offset-based readers for the streams spawned in collect mode. */
212
+ interface SubprocessCollectedOutputs {
213
+ /** Present iff stdout is a {@link SubprocessCollect}. */
214
+ readonly stdout?: SubprocessOutputReader
215
+ /** Present iff stderr is a {@link SubprocessCollect}. */
216
+ readonly stderr?: SubprocessOutputReader
217
+ }
218
+ ```
219
+
220
+
221
+ ## 结果只承载退出事实
222
+
223
+ `done` 报告 Node close 事件的词汇,不携带原因分类:服务会在中止时终止进程,但绝不判定原因(调用方读取归自己所有的 deadline 信号,例如 bash 执行器的 `timedOut`/`aborted` 拆分)。收集到的输出在结算后仍可经 `handle.collected` 读取,因此批量与流式调用方共用一条访问路径。
224
+
225
+ ```ts type-equiv
226
+ /**
227
+ * Exit facts of one closed process — Node's `close`-event vocabulary.
228
+ * Deliberately carries NO timeout or cancellation classification (the caller
229
+ * reads the signal it owns to classify causes) and NO output: collected
230
+ * streams stay readable through {@link SubprocessHandle.collected} after
231
+ * settlement, so batch and streaming callers share one access path.
232
+ */
233
+ interface SubprocessOutcome {
234
+ /** Exit code; null when the process died from a signal. */
235
+ exitCode: number | null
236
+ /** Terminating signal (e.g. 'SIGTERM'); null on normal exit. */
237
+ signal: NodeJS.Signals | null
238
+ }
239
+ ```
240
+
241
+ ## 终端进程原语
242
+
243
+ `spawnTerminal(spec)` 是非管道进程原语。提供方分配控制终端,并负责 UTF-8 文本传输、前台进程组检查与信号发送,以及一项须等待的 TERM→KILL 操作;该操作会使提供方仍可观察到的每个会话成员完全停稳,提供方则会记录执行基底特有的可观察性限制。PTY 后端仍负责提示符检测、就绪推断、scrollback、沙箱策略和持久会话所有权;普通 `spawn()` 无法重建控制终端语义。
244
+
245
+ 终端 spec 完全指定 argv、cwd、环境覆盖、尺寸、清理宽限期与可选的分配取消。其句柄公开 `pid`、有序输出、`done`、`write`、`inspectForeground`、`signalForeground` 和须等待的 `terminate`;确切的公共形状生成到 [`ctx.subprocess` 服务目录](#ctxsubprocess--subprocessruntime-abstract-seam)中。
246
+
247
+ ## 服务行为
248
+
249
+ 抽象的 [`SubprocessRuntime`](../../packages/subprocess/subprocess/src/index.ts) Service Definition 规定执行世界坐标、可执行文件查找、普通 `spawn` 与 `spawnTerminal`。[`LocalSubprocessRuntime`](../../packages/subprocess/subprocess-local/src/index.ts) 以 detached 进程树、按处置方式接线、凭据清除、`node-pty`、平台进程检查,以及先终止再等待退出的资源释放提供这些能力。Service Definition 约定见 [`dsh-subprocess`](../../packages/subprocess/subprocess/README.md),本地机制见 [`dsh-subprocess-local`](../../packages/subprocess/subprocess-local/README.md)。
250
+
251
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
252
+
253
+ <a id="cordis-surface"></a>
254
+
255
+ ## Cordis API
256
+
257
+ 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).
258
+
259
+ <a id="ctxe2b--e2bruntime"></a>
260
+
261
+ ### `ctx.e2b` — `E2BRuntime`
262
+
263
+ Creates one lazily consumable E2B SDK handle and deletes the sandbox at timeout or disposal. Creation begins at plugin construction; adapters await getSandbox before their first operation.
264
+
265
+ ```ts cordis-catalog
266
+ /**
267
+ * Return the shared live SDK handle.
268
+ * @returns the created sandbox after the configured cwd exists.
269
+ * @throws when E2B rejects creation or the service is disposing.
270
+ */
271
+ async getSandbox(): Promise<Sandbox>
272
+ ```
273
+
274
+ Source: [`packages/e2b/e2b/src/index.ts:74`](../../packages/e2b/e2b/src/index.ts)
275
+
276
+ <a id="ctxsubprocess--subprocessruntime-abstract-seam"></a>
277
+
278
+ ### `ctx.subprocess` — `SubprocessRuntime` (abstract seam)
279
+
280
+ Abstract subprocess service. Subclass, implement spawn, and load the subclass as a plugin — it registers as `ctx.subprocess` (one implementation per context; loading a second throws, which is cordis' standard duplicate-service behavior).
281
+
282
+ Implementations must honor these semantics:
283
+
284
+ - Executable paths belong to one execution world shared with the mounted filesystem provider.
285
+ - spawn returns immediately with a live handle; `done` resolves at process close with exit facts and rejects only for spawn-level failures.
286
+ - Collect-mode readers are offset-based and non-consuming, so independent readers never consume one another's output; lossy reads report truncation and the spill file holding the complete stream when one exists. Piped streams are handed to the caller raw and never buffered here.
287
+ - SubprocessHandle.terminate (and the spec's abort signal) escalates SIGTERM→grace→SIGKILL — the only termination verb — tree-scoped on every platform. SubprocessHandle.waitForExit observes whole-tree liveness, so a consumer-owned teardown ladder can hold each tier on real quiescence.
288
+ - Disposal of the service terminates all still-running managed processes and awaits their exit.
289
+ - spawnTerminal owns terminal allocation, text transport, foreground groups, signalling, and whole-session quiescence behind one awaited termination method; readiness and persistent-shell policy stay in the PTY consumer. Its output stream ends after queued terminal output when the top-level process exits.
290
+
291
+ ```ts cordis-catalog
292
+ /**
293
+ * Resolve one configured executable in this provider's execution world.
294
+ * Absolute paths are verified; bare names use the provider's scrubbed PATH
295
+ * plus explicit environment overrides. Relative paths containing separators
296
+ * are rejected: the resolution base is undefined, so providers fail loud
297
+ * instead of guessing.
298
+ * @param command - absolute executable path or bare PATH name.
299
+ * @param env - explicit environment entries used for lookup.
300
+ * @param signal - aborts remote or local lookup.
301
+ * @returns a canonical executable path.
302
+ */
303
+ abstract resolveExecutable( command: string, env?: Readonly<Record<string, string>>, signal?: AbortSignal, ): Promise<string>
304
+
305
+ /**
306
+ * Start one managed child process from a fully-specified spec; this seam
307
+ * applies no defaults.
308
+ * @param spec - argv, directory, stdio dispositions, grace, cancellation, and environment.
309
+ * @returns the live process handle (streams/readers, signalling, outcome promise).
310
+ */
311
+ abstract spawn(spec: SubprocessSpawnSpec): SubprocessHandle
312
+
313
+ /**
314
+ * Allocate a real terminal and start one owned process session. This is the
315
+ * only non-pipe process primitive: implementations own terminal byte I/O,
316
+ * foreground groups, signals, and complete session-tree cleanup.
317
+ * @param spec - fully specified argv, cwd, environment, dimensions, grace, and allocation cancellation.
318
+ * @returns the live terminal handle after allocation succeeds.
319
+ */
320
+ abstract spawnTerminal(spec: SubprocessTerminalSpawnSpec): Promise<SubprocessTerminalHandle>
321
+ ```
322
+
323
+ Source: [`packages/subprocess/subprocess/src/index.ts:102`](../../packages/subprocess/subprocess/src/index.ts)
324
+ <!-- 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/system-prompt.md
5
+ system-prompt.md: 8a6006d0b96552b52d0b050c304a11a95add8d9e
6
+ system-prompt.zh.md: 02be9eed795d3a6c8e43403048f135d493b6509d