dsh-plugin-dev-kb 1.6.0 → 1.8.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 (500) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.en.md +23 -6
  3. package/README.md +28 -8
  4. package/kb/INDEX.md +3 -3
  5. package/kb/README.md +9 -4
  6. package/kb/extra/AGENTS.md +1 -1
  7. package/kb/extra/cli-help.md +15 -7
  8. package/kb/extra/cli-help.zh.md +15 -7
  9. package/kb/extra/cookbook/adding-a-plugin-preview.md +18 -25
  10. package/kb/extra/cookbook/adding-a-plugin-preview.zh.md +18 -25
  11. package/kb/extra/cookbook/reviewing-persistence-type-changes.md +1 -1
  12. package/kb/extra/cookbook/reviewing-persistence-type-changes.zh.md +1 -1
  13. package/kb/extra/cookbook/reviewing-ui-design.md +166 -0
  14. package/kb/extra/cookbook/reviewing-ui-design.zh.md +166 -0
  15. package/kb/extra/deepseek-llm-api-wire-extensions.md +2 -2
  16. package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +2 -2
  17. package/kb/extra/defensive-patterns/conversation-and-session.md +2 -2
  18. package/kb/extra/defensive-patterns/conversation-and-session.zh.md +2 -2
  19. package/kb/extra/defensive-patterns/general.md +2 -0
  20. package/kb/extra/defensive-patterns/general.zh.md +2 -0
  21. package/kb/extra/defensive-patterns/package-surface.md +1 -0
  22. package/kb/extra/defensive-patterns/package-surface.zh.md +1 -0
  23. package/kb/extra/defensive-patterns/remote-and-api.md +5 -3
  24. package/kb/extra/defensive-patterns/remote-and-api.zh.md +5 -3
  25. package/kb/extra/development.md +16 -9
  26. package/kb/extra/development.zh.md +16 -9
  27. package/kb/extra/event-producer-consumer.md +64 -51
  28. package/kb/extra/event-producer-consumer.zh.md +64 -51
  29. package/kb/extra/i18n/README.md +2 -0
  30. package/kb/extra/i18n/README.zh.md +2 -0
  31. package/kb/extra/module-graph.md +204 -92
  32. package/kb/extra/module-graph.zh.md +204 -92
  33. package/kb/extra/persistence-changes/2026-10-13-liveshare-share-viewer-principal.md +60 -0
  34. package/kb/extra/persistence-changes/2026-10-13-liveshare-share-viewer-principal.zh.md +60 -0
  35. package/kb/extra/persistence-changes/2026-10-19-session-team-mode.md +48 -0
  36. package/kb/extra/persistence-changes/2026-10-19-session-team-mode.zh.md +48 -0
  37. package/kb/extra/persistence-changes/2026-10-22-action-card-status.md +60 -0
  38. package/kb/extra/persistence-changes/2026-10-22-action-card-status.zh.md +60 -0
  39. package/kb/extra/persistence-changes/2026-10-25-skill-catalog-incomplete.md +60 -0
  40. package/kb/extra/persistence-changes/2026-10-25-skill-catalog-incomplete.zh.md +60 -0
  41. package/kb/extra/persistence-changes/2026-10-27-retry-control-input.md +60 -0
  42. package/kb/extra/persistence-changes/2026-10-27-retry-control-input.zh.md +60 -0
  43. package/kb/extra/persistence-changes/2026-10-27-subagent-settlement-attribution.md +60 -0
  44. package/kb/extra/persistence-changes/2026-10-27-subagent-settlement-attribution.zh.md +60 -0
  45. package/kb/extra/persistence-changes/2026-11-02-subagent-catalog-names.md +48 -0
  46. package/kb/extra/persistence-changes/2026-11-02-subagent-catalog-names.zh.md +48 -0
  47. package/kb/extra/persistence-changes/2026-11-02-team-task-owner-names.md +48 -0
  48. package/kb/extra/persistence-changes/2026-11-02-team-task-owner-names.zh.md +48 -0
  49. package/kb/extra/persistence-changes/README.md +2 -0
  50. package/kb/extra/persistence-changes/README.zh.md +2 -0
  51. package/kb/extra/persistence-changes/historical-formats/README.md +1 -1
  52. package/kb/extra/persistence-changes/historical-formats/README.zh.md +1 -1
  53. package/kb/extra/rescope.md +7 -5
  54. package/kb/extra/rescope.zh.md +7 -5
  55. package/kb/extra/subsystems/agent-team.md +38 -75
  56. package/kb/extra/subsystems/agent-team.zh.md +38 -75
  57. package/kb/extra/subsystems/attachment.md +36 -13
  58. package/kb/extra/subsystems/attachment.zh.md +36 -13
  59. package/kb/extra/subsystems/boot.md +179 -5
  60. package/kb/extra/subsystems/boot.zh.md +179 -5
  61. package/kb/extra/subsystems/computer-use.md +78 -0
  62. package/kb/extra/subsystems/computer-use.zh.md +78 -0
  63. package/kb/extra/subsystems/deliverables.md +2 -0
  64. package/kb/extra/subsystems/deliverables.zh.md +2 -0
  65. package/kb/extra/subsystems/forge.md +1226 -0
  66. package/kb/extra/subsystems/forge.zh.md +1226 -0
  67. package/kb/extra/subsystems/liveshare.md +158 -0
  68. package/kb/extra/subsystems/liveshare.zh.md +158 -0
  69. package/kb/extra/subsystems/mcp.md +96 -1
  70. package/kb/extra/subsystems/mcp.zh.md +96 -1
  71. package/kb/extra/subsystems/worktrees.md +54 -3
  72. package/kb/extra/subsystems/worktrees.zh.md +54 -3
  73. package/kb/extra/testing.md +1 -1
  74. package/kb/extra/testing.zh.md +1 -1
  75. package/kb/extra/ui-design-review-cases.md +445 -0
  76. package/kb/extra/ui-design-review-cases.zh.md +445 -0
  77. package/kb/extra/ui-radius.md +3 -1
  78. package/kb/extra/ui-radius.zh.md +3 -1
  79. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.md +1 -1
  80. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.zh.md +1 -1
  81. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/cordis-timer-wrappers/guide.md +24 -0
  82. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/cordis-timer-wrappers/guide.zh.md +24 -0
  83. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-manager-view-fields/guide.md +25 -0
  84. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-manager-view-fields/guide.zh.md +25 -0
  85. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/model-switch-compaction/guide.md +30 -0
  86. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/model-switch-compaction/guide.zh.md +30 -0
  87. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/session-model-selection/guide.md +28 -0
  88. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/session-model-selection/guide.zh.md +28 -0
  89. package/kb/extra/upgrade-guide/v0.2.1-rc.1/agent-instructions-chain-budgets/guide.md +24 -0
  90. package/kb/extra/upgrade-guide/v0.2.1-rc.1/agent-instructions-chain-budgets/guide.zh.md +24 -0
  91. package/kb/extra/upgrade-guide/v0.2.1-rc.1/subagent-control-tools/guide.md +23 -0
  92. package/kb/extra/upgrade-guide/v0.2.1-rc.1/subagent-control-tools/guide.zh.md +23 -0
  93. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-runtime-owner/guide.md +20 -0
  94. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-runtime-owner/guide.zh.md +20 -0
  95. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-team-subagents/guide.md +31 -0
  96. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-team-subagents/guide.zh.md +31 -0
  97. package/kb/extra/upgrade-guide/v0.2.1-rc.2/approval-projection-dependency/guide.md +34 -0
  98. package/kb/extra/upgrade-guide/v0.2.1-rc.2/approval-projection-dependency/guide.zh.md +34 -0
  99. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-shutdown/guide.md +20 -0
  100. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-shutdown/guide.zh.md +20 -0
  101. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-user-sources/guide.md +18 -0
  102. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-user-sources/guide.zh.md +18 -0
  103. package/kb/extra/upgrade-guide/v0.2.1-rc.2/built-in-japanese/guide.md +18 -0
  104. package/kb/extra/upgrade-guide/v0.2.1-rc.2/built-in-japanese/guide.zh.md +18 -0
  105. package/kb/extra/upgrade-guide/v0.2.1-rc.2/conditional-tools/guide.md +25 -0
  106. package/kb/extra/upgrade-guide/v0.2.1-rc.2/conditional-tools/guide.zh.md +25 -0
  107. package/kb/extra/upgrade-guide/v0.2.1-rc.2/context-menu-services/guide.md +23 -0
  108. package/kb/extra/upgrade-guide/v0.2.1-rc.2/context-menu-services/guide.zh.md +23 -0
  109. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-consent-storage/guide.md +22 -0
  110. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-consent-storage/guide.zh.md +22 -0
  111. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-preset-scope/guide.md +18 -0
  112. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-preset-scope/guide.zh.md +18 -0
  113. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-relative-coordinates/guide.md +17 -0
  114. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-relative-coordinates/guide.zh.md +17 -0
  115. package/kb/extra/upgrade-guide/v0.2.1-rc.2/file-drag-callbacks/guide.md +19 -0
  116. package/kb/extra/upgrade-guide/v0.2.1-rc.2/file-drag-callbacks/guide.zh.md +19 -0
  117. package/kb/extra/upgrade-guide/v0.2.1-rc.2/headless-policy-composition/guide.md +27 -0
  118. package/kb/extra/upgrade-guide/v0.2.1-rc.2/headless-policy-composition/guide.zh.md +27 -0
  119. package/kb/extra/upgrade-guide/v0.2.1-rc.2/model-badge-package-removal/guide.md +18 -0
  120. package/kb/extra/upgrade-guide/v0.2.1-rc.2/model-badge-package-removal/guide.zh.md +18 -0
  121. package/kb/extra/upgrade-guide/v0.2.1-rc.2/new-session-blank-reuse/guide.md +22 -0
  122. package/kb/extra/upgrade-guide/v0.2.1-rc.2/new-session-blank-reuse/guide.zh.md +22 -0
  123. package/kb/extra/upgrade-guide/v0.2.1-rc.2/node-24/guide.md +17 -0
  124. package/kb/extra/upgrade-guide/v0.2.1-rc.2/node-24/guide.zh.md +17 -0
  125. package/kb/extra/upgrade-guide/v0.2.1-rc.2/official-bundle-lists/guide.md +18 -0
  126. package/kb/extra/upgrade-guide/v0.2.1-rc.2/official-bundle-lists/guide.zh.md +18 -0
  127. package/kb/extra/upgrade-guide/v0.2.1-rc.2/persistent-terminal-controls/guide.md +18 -0
  128. package/kb/extra/upgrade-guide/v0.2.1-rc.2/persistent-terminal-controls/guide.zh.md +18 -0
  129. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-default-capacities/guide.md +18 -0
  130. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-default-capacities/guide.zh.md +18 -0
  131. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-model-catalog/guide.md +53 -0
  132. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-model-catalog/guide.zh.md +53 -0
  133. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-protocol-replay/guide.md +30 -0
  134. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-protocol-replay/guide.zh.md +30 -0
  135. package/kb/extra/upgrade-guide/v0.2.1-rc.2/ptc-script-format/guide.md +20 -0
  136. package/kb/extra/upgrade-guide/v0.2.1-rc.2/ptc-script-format/guide.zh.md +20 -0
  137. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-desktop-context/guide.md +18 -0
  138. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-desktop-context/guide.zh.md +18 -0
  139. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-minimal-checkpoints/guide.md +18 -0
  140. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-minimal-checkpoints/guide.zh.md +18 -0
  141. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-projection-handles/guide.md +24 -0
  142. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-projection-handles/guide.zh.md +24 -0
  143. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-store-writes/guide.md +25 -0
  144. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-store-writes/guide.zh.md +25 -0
  145. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-team-mode/guide.md +22 -0
  146. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-team-mode/guide.zh.md +22 -0
  147. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-activation-options/guide.md +18 -0
  148. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-activation-options/guide.zh.md +18 -0
  149. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-service-methods/guide.md +19 -0
  150. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-service-methods/guide.zh.md +19 -0
  151. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-user-controls/guide.md +26 -0
  152. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-user-controls/guide.zh.md +26 -0
  153. package/kb/extra/upgrade-guide/v0.2.1-rc.2/tool-executor-plugins/guide.md +35 -0
  154. package/kb/extra/upgrade-guide/v0.2.1-rc.2/tool-executor-plugins/guide.zh.md +35 -0
  155. package/kb/extra/upgrade-guide/v0.2.1-rc.2/web-fetch-private-destinations/guide.md +21 -0
  156. package/kb/extra/upgrade-guide/v0.2.1-rc.2/web-fetch-private-destinations/guide.zh.md +21 -0
  157. package/kb/extra/upgrade-guide/v0.2.1-rc.2/webserver-index-peer/guide.md +17 -0
  158. package/kb/extra/upgrade-guide/v0.2.1-rc.2/webserver-index-peer/guide.zh.md +17 -0
  159. package/kb/extra/upgrade-guide/v0.2.1-rc.3/attachment-read-access/guide.md +23 -0
  160. package/kb/extra/upgrade-guide/v0.2.1-rc.3/attachment-read-access/guide.zh.md +23 -0
  161. package/kb/extra/upgrade-guide/v0.2.1-rc.3/computer-use-helper-permissions/guide.md +21 -0
  162. package/kb/extra/upgrade-guide/v0.2.1-rc.3/computer-use-helper-permissions/guide.zh.md +21 -0
  163. package/kb/extra/upgrade-guide/v0.2.1-rc.3/cua-bundle-id-consent/guide.md +20 -0
  164. package/kb/extra/upgrade-guide/v0.2.1-rc.3/cua-bundle-id-consent/guide.zh.md +20 -0
  165. package/kb/extra/upgrade-guide/v0.2.1-rc.3/generated-worktree-names/guide.md +20 -0
  166. package/kb/extra/upgrade-guide/v0.2.1-rc.3/generated-worktree-names/guide.zh.md +20 -0
  167. package/kb/extra/upgrade-guide/v0.2.1-rc.3/inbox-only-agent-wait/guide.md +19 -0
  168. package/kb/extra/upgrade-guide/v0.2.1-rc.3/inbox-only-agent-wait/guide.zh.md +19 -0
  169. package/kb/extra/upgrade-guide/v0.2.1-rc.3/independent-session-forks/guide.md +23 -0
  170. package/kb/extra/upgrade-guide/v0.2.1-rc.3/independent-session-forks/guide.zh.md +23 -0
  171. package/kb/extra/upgrade-guide/v0.2.1-rc.3/ptc-caller-cancellation/guide.md +20 -0
  172. package/kb/extra/upgrade-guide/v0.2.1-rc.3/ptc-caller-cancellation/guide.zh.md +20 -0
  173. package/kb/extra/upgrade-guide/v0.2.1-rc.3/session-follow-activation/guide.md +21 -0
  174. package/kb/extra/upgrade-guide/v0.2.1-rc.3/session-follow-activation/guide.zh.md +21 -0
  175. package/kb/extra/upgrade-guide/v0.2.1-rc.3/subagent-runtime-ownership/guide.md +21 -0
  176. package/kb/extra/upgrade-guide/v0.2.1-rc.3/subagent-runtime-ownership/guide.zh.md +21 -0
  177. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-mode-menu/guide.md +18 -0
  178. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-mode-menu/guide.zh.md +18 -0
  179. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-projection/guide.md +20 -0
  180. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-projection/guide.zh.md +20 -0
  181. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-file-downloads/guide.md +19 -0
  182. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-file-downloads/guide.zh.md +19 -0
  183. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-search-defaults/guide.md +18 -0
  184. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-search-defaults/guide.zh.md +18 -0
  185. package/kb/extra/upgrade-guide/v0.2.1-rc.4/model-listing-refresh/guide.md +22 -0
  186. package/kb/extra/upgrade-guide/v0.2.1-rc.4/model-listing-refresh/guide.zh.md +22 -0
  187. package/kb/extra/upgrade-guide/v0.2.1-rc.4/reasoning-body-props/guide.md +20 -0
  188. package/kb/extra/upgrade-guide/v0.2.1-rc.4/reasoning-body-props/guide.zh.md +20 -0
  189. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/context-menu-target/guide.md +19 -0
  190. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/context-menu-target/guide.zh.md +19 -0
  191. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cordis-loader-entry-trees/guide.md +24 -0
  192. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cordis-loader-entry-trees/guide.zh.md +24 -0
  193. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/css-anchored-menus/guide.md +21 -0
  194. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/css-anchored-menus/guide.zh.md +21 -0
  195. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cua-source-dev-helper/guide.md +19 -0
  196. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cua-source-dev-helper/guide.zh.md +19 -0
  197. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.md +18 -0
  198. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.zh.md +18 -0
  199. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-git-permissions/guide.md +21 -0
  200. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-git-permissions/guide.zh.md +21 -0
  201. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-worktree-entry/guide.md +29 -0
  202. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-worktree-entry/guide.zh.md +29 -0
  203. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.md +29 -0
  204. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.zh.md +29 -0
  205. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-request-purpose-declarations/guide.md +29 -0
  206. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-request-purpose-declarations/guide.zh.md +29 -0
  207. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/pi-ai-request-image-count/guide.md +18 -0
  208. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/pi-ai-request-image-count/guide.zh.md +18 -0
  209. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-event-frames/guide.md +32 -0
  210. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-event-frames/guide.zh.md +32 -0
  211. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-released-checkpoint/guide.md +30 -0
  212. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-released-checkpoint/guide.zh.md +30 -0
  213. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-snapshot-scope/guide.md +19 -0
  214. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-snapshot-scope/guide.zh.md +19 -0
  215. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/retained-ptc-timeout/guide.md +21 -0
  216. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/retained-ptc-timeout/guide.zh.md +21 -0
  217. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-agent-tools/guide.md +37 -0
  218. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-agent-tools/guide.zh.md +37 -0
  219. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-remote-host-tasks/guide.md +22 -0
  220. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-remote-host-tasks/guide.zh.md +22 -0
  221. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/sdk-run-commands/guide.md +24 -0
  222. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/sdk-run-commands/guide.zh.md +24 -0
  223. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/session-header-menu/guide.md +20 -0
  224. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/session-header-menu/guide.zh.md +20 -0
  225. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/subagent-explicit-reasoning/guide.md +20 -0
  226. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/subagent-explicit-reasoning/guide.zh.md +20 -0
  227. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.md +17 -0
  228. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.zh.md +17 -0
  229. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-default-provider/guide.md +19 -0
  230. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-default-provider/guide.zh.md +19 -0
  231. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/chat-process-activity-context/guide.md +18 -0
  232. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/chat-process-activity-context/guide.zh.md +18 -0
  233. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/subagent-names/guide.md +29 -0
  234. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/subagent-names/guide.zh.md +29 -0
  235. package/kb/extra/web-styling.md +19 -1
  236. package/kb/extra/web-styling.zh.md +19 -1
  237. package/kb/meta/search-index.json +1272 -1098
  238. package/kb/meta/source.json +8 -4
  239. package/kb/site/develop/cordis-tutorial/04-events.md +1 -1
  240. package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +5 -4
  241. package/kb/site/develop/framework/events.md +1 -1
  242. package/kb/site/develop/practice/dynamic-cordis.md +1 -1
  243. package/kb/site/en/develop/cordis-tutorial/04-events.md +1 -1
  244. package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +5 -4
  245. package/kb/site/en/develop/framework/events.md +1 -1
  246. package/kb/site/en/develop/practice/dynamic-cordis.md +1 -1
  247. package/kb/site/en/guide/network-proxy.md +1 -1
  248. package/kb/site/en/guide/plugin-market.md +10 -10
  249. package/kb/site/en/guide/providers.md +5 -1
  250. package/kb/site/en/guide/python-sdk.md +17 -2
  251. package/kb/site/en/guide/schedule.md +45 -26
  252. package/kb/site/en/reference/agent-lifecycle.md +3 -1
  253. package/kb/site/en/reference/api-gateway.md +4 -4
  254. package/kb/site/en/reference/capability-seams.md +65 -17
  255. package/kb/site/en/reference/config-catalog.md +560 -238
  256. package/kb/site/en/reference/cookbook/adding-a-package.md +4 -2
  257. package/kb/site/en/reference/cookbook/extension-cookbook.md +1 -1
  258. package/kb/site/en/reference/cordis-api/context.md +1 -1
  259. package/kb/site/en/reference/cordis-api/events.md +9 -9
  260. package/kb/site/en/reference/cordis-api/fiber.md +85 -32
  261. package/kb/site/en/reference/cordis-api/inherited.md +10 -9
  262. package/kb/site/en/reference/experimental-persistence-catalog.md +3 -0
  263. package/kb/site/en/reference/index.md +14 -8
  264. package/kb/site/en/reference/persistence-catalog.md +532 -246
  265. package/kb/site/en/reference/subsystems/client-modules.md +19 -11
  266. package/kb/site/en/reference/subsystems/compaction.md +1 -1
  267. package/kb/site/en/reference/subsystems/conversation.md +2 -0
  268. package/kb/site/en/reference/subsystems/core.md +119 -65
  269. package/kb/site/en/reference/subsystems/filesystem.md +202 -28
  270. package/kb/site/en/reference/subsystems/index.md +3 -1
  271. package/kb/site/en/reference/subsystems/llm-streaming.md +92 -4
  272. package/kb/site/en/reference/subsystems/persistence.md +17 -7
  273. package/kb/site/en/reference/subsystems/plan.md +4 -4
  274. package/kb/site/en/reference/subsystems/ptc-runtime.md +12 -5
  275. package/kb/site/en/reference/subsystems/sandbox.md +11 -4
  276. package/kb/site/en/reference/subsystems/schedule.md +194 -430
  277. package/kb/site/en/reference/subsystems/session-projection.md +186 -44
  278. package/kb/site/en/reference/subsystems/session-reference.md +4 -3
  279. package/kb/site/en/reference/subsystems/session.md +119 -31
  280. package/kb/site/en/reference/subsystems/sidebar-right.md +12 -11
  281. package/kb/site/en/reference/subsystems/skills.md +4 -4
  282. package/kb/site/en/reference/subsystems/slots.md +30 -3
  283. package/kb/site/en/reference/subsystems/storage.md +26 -9
  284. package/kb/site/en/reference/subsystems/subagent.md +119 -102
  285. package/kb/site/en/reference/subsystems/system-prompt.md +13 -11
  286. package/kb/site/en/reference/subsystems/token-meter.md +45 -0
  287. package/kb/site/en/reference/subsystems/tools.md +222 -82
  288. package/kb/site/en/reference/subsystems/typert.md +21 -11
  289. package/kb/site/en/reference/subsystems/user-questions.md +22 -6
  290. package/kb/site/en/reference/subsystems/web-client.md +1 -1
  291. package/kb/site/en/reference/subsystems/web-server.md +68 -23
  292. package/kb/site/en/reference/subsystems/web.md +79 -21
  293. package/kb/site/en/reference/tool-catalog.md +270 -395
  294. package/kb/site/en/reference/tool-execution-pipeline.md +5 -4
  295. package/kb/site/guide/network-proxy.md +1 -1
  296. package/kb/site/guide/plugin-market.md +10 -10
  297. package/kb/site/guide/providers.md +5 -1
  298. package/kb/site/guide/python-sdk.md +17 -2
  299. package/kb/site/guide/schedule.md +45 -26
  300. package/kb/site/reference/agent-lifecycle.md +3 -1
  301. package/kb/site/reference/api-gateway.md +4 -4
  302. package/kb/site/reference/capability-seams.md +65 -17
  303. package/kb/site/reference/config-catalog.md +560 -238
  304. package/kb/site/reference/cookbook/adding-a-package.md +4 -2
  305. package/kb/site/reference/cookbook/extension-cookbook.md +1 -1
  306. package/kb/site/reference/cordis-api/context.md +1 -1
  307. package/kb/site/reference/cordis-api/events.md +9 -9
  308. package/kb/site/reference/cordis-api/fiber.md +87 -32
  309. package/kb/site/reference/cordis-api/inherited.md +10 -9
  310. package/kb/site/reference/experimental-persistence-catalog.md +3 -0
  311. package/kb/site/reference/index.md +14 -8
  312. package/kb/site/reference/persistence-catalog.md +532 -246
  313. package/kb/site/reference/subsystems/client-modules.md +19 -11
  314. package/kb/site/reference/subsystems/compaction.md +1 -1
  315. package/kb/site/reference/subsystems/conversation.md +4 -0
  316. package/kb/site/reference/subsystems/core.md +119 -65
  317. package/kb/site/reference/subsystems/filesystem.md +202 -28
  318. package/kb/site/reference/subsystems/index.md +3 -1
  319. package/kb/site/reference/subsystems/llm-streaming.md +92 -4
  320. package/kb/site/reference/subsystems/persistence.md +17 -7
  321. package/kb/site/reference/subsystems/plan.md +4 -4
  322. package/kb/site/reference/subsystems/ptc-runtime.md +12 -5
  323. package/kb/site/reference/subsystems/sandbox.md +11 -4
  324. package/kb/site/reference/subsystems/schedule.md +197 -433
  325. package/kb/site/reference/subsystems/session-projection.md +186 -44
  326. package/kb/site/reference/subsystems/session-reference.md +4 -3
  327. package/kb/site/reference/subsystems/session.md +119 -31
  328. package/kb/site/reference/subsystems/sidebar-right.md +12 -11
  329. package/kb/site/reference/subsystems/skills.md +4 -4
  330. package/kb/site/reference/subsystems/slots.md +30 -3
  331. package/kb/site/reference/subsystems/storage.md +26 -9
  332. package/kb/site/reference/subsystems/subagent.md +119 -102
  333. package/kb/site/reference/subsystems/system-prompt.md +13 -11
  334. package/kb/site/reference/subsystems/token-meter.md +45 -0
  335. package/kb/site/reference/subsystems/tools.md +222 -82
  336. package/kb/site/reference/subsystems/typert.md +21 -11
  337. package/kb/site/reference/subsystems/user-questions.md +22 -6
  338. package/kb/site/reference/subsystems/web-client.md +1 -1
  339. package/kb/site/reference/subsystems/web-server.md +68 -23
  340. package/kb/site/reference/subsystems/web.md +79 -21
  341. package/kb/site/reference/tool-catalog.md +273 -399
  342. package/kb/site/reference/tool-execution-pipeline.md +4 -3
  343. package/lib/index.js +123 -8
  344. package/lib/kb-version.js +118 -0
  345. package/package.json +4 -2
  346. package/scripts/refresh-kb.mjs +153 -0
  347. package/scripts/selfcheck.mjs +18 -0
  348. package/scripts/smoke.mjs +77 -0
  349. package/skills/dsh-plugin-dev-kb.md +7 -6
  350. package/skills/dsh-plugin-starter.md +65 -0
  351. package/skills/dsh-upgrade-assistant.md +62 -0
  352. package/kb/extra/agent-lifecycle.md +0 -91
  353. package/kb/extra/agent-lifecycle.zh.md +0 -93
  354. package/kb/extra/api-gateway.md +0 -172
  355. package/kb/extra/api-gateway.zh.md +0 -178
  356. package/kb/extra/architecture.md +0 -165
  357. package/kb/extra/architecture.zh.md +0 -169
  358. package/kb/extra/capability-seams.md +0 -714
  359. package/kb/extra/capability-seams.zh.md +0 -716
  360. package/kb/extra/config-catalog.md +0 -4801
  361. package/kb/extra/config-catalog.zh.md +0 -4803
  362. package/kb/extra/cookbook/adding-a-package.md +0 -170
  363. package/kb/extra/cookbook/adding-a-package.zh.md +0 -170
  364. package/kb/extra/cookbook/adding-a-settings-card.md +0 -72
  365. package/kb/extra/cookbook/adding-a-settings-card.zh.md +0 -72
  366. package/kb/extra/cookbook/adding-a-tool.md +0 -101
  367. package/kb/extra/cookbook/adding-a-tool.zh.md +0 -103
  368. package/kb/extra/cookbook/adding-an-llm-adapter.md +0 -43
  369. package/kb/extra/cookbook/adding-an-llm-adapter.zh.md +0 -43
  370. package/kb/extra/cookbook/extension-cookbook.md +0 -132
  371. package/kb/extra/cookbook/extension-cookbook.zh.md +0 -136
  372. package/kb/extra/cordis-api/context.md +0 -364
  373. package/kb/extra/cordis-api/context.zh.md +0 -366
  374. package/kb/extra/cordis-api/events.md +0 -207
  375. package/kb/extra/cordis-api/events.zh.md +0 -209
  376. package/kb/extra/cordis-api/fiber.md +0 -375
  377. package/kb/extra/cordis-api/fiber.zh.md +0 -377
  378. package/kb/extra/cordis-api/inherited.md +0 -38
  379. package/kb/extra/cordis-api/registry.md +0 -152
  380. package/kb/extra/cordis-api/registry.zh.md +0 -154
  381. package/kb/extra/cordis-api/service.md +0 -102
  382. package/kb/extra/cordis-api/service.zh.md +0 -104
  383. package/kb/extra/cordis-tutorial/01-first-plugin.md +0 -95
  384. package/kb/extra/cordis-tutorial/01-first-plugin.zh.md +0 -95
  385. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.md +0 -98
  386. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.zh.md +0 -98
  387. package/kb/extra/cordis-tutorial/03-services.md +0 -98
  388. package/kb/extra/cordis-tutorial/03-services.zh.md +0 -98
  389. package/kb/extra/cordis-tutorial/04-events.md +0 -144
  390. package/kb/extra/cordis-tutorial/04-events.zh.md +0 -144
  391. package/kb/extra/cordis-tutorial/05-config.md +0 -111
  392. package/kb/extra/cordis-tutorial/05-config.zh.md +0 -111
  393. package/kb/extra/cordis-tutorial/06-composition-and-hmr.md +0 -113
  394. package/kb/extra/cordis-tutorial/06-composition-and-hmr.zh.md +0 -113
  395. package/kb/extra/cordis-tutorial/07-into-the-harness.md +0 -108
  396. package/kb/extra/cordis-tutorial/07-into-the-harness.zh.md +0 -108
  397. package/kb/extra/cordis-tutorial/index.md +0 -60
  398. package/kb/extra/cordis-tutorial/index.zh.md +0 -62
  399. package/kb/extra/experimental-persistence-catalog.md +0 -17
  400. package/kb/extra/experimental-persistence-catalog.zh.md +0 -17
  401. package/kb/extra/persistence-catalog.md +0 -9140
  402. package/kb/extra/persistence-catalog.zh.md +0 -9142
  403. package/kb/extra/subsystems/README.md +0 -76
  404. package/kb/extra/subsystems/README.zh.md +0 -76
  405. package/kb/extra/subsystems/approval.md +0 -170
  406. package/kb/extra/subsystems/approval.zh.md +0 -170
  407. package/kb/extra/subsystems/client-modules.md +0 -198
  408. package/kb/extra/subsystems/client-modules.zh.md +0 -198
  409. package/kb/extra/subsystems/client-resources.md +0 -92
  410. package/kb/extra/subsystems/client-resources.zh.md +0 -92
  411. package/kb/extra/subsystems/commands.md +0 -223
  412. package/kb/extra/subsystems/commands.zh.md +0 -223
  413. package/kb/extra/subsystems/compaction.md +0 -284
  414. package/kb/extra/subsystems/compaction.zh.md +0 -284
  415. package/kb/extra/subsystems/conversation.md +0 -301
  416. package/kb/extra/subsystems/conversation.zh.md +0 -303
  417. package/kb/extra/subsystems/core.md +0 -1113
  418. package/kb/extra/subsystems/core.zh.md +0 -1125
  419. package/kb/extra/subsystems/credentials.md +0 -493
  420. package/kb/extra/subsystems/credentials.zh.md +0 -493
  421. package/kb/extra/subsystems/filesystem.md +0 -530
  422. package/kb/extra/subsystems/filesystem.zh.md +0 -530
  423. package/kb/extra/subsystems/goal.md +0 -313
  424. package/kb/extra/subsystems/goal.zh.md +0 -313
  425. package/kb/extra/subsystems/jobs.md +0 -554
  426. package/kb/extra/subsystems/jobs.zh.md +0 -554
  427. package/kb/extra/subsystems/llm-streaming.md +0 -1196
  428. package/kb/extra/subsystems/llm-streaming.zh.md +0 -1202
  429. package/kb/extra/subsystems/lsp.md +0 -202
  430. package/kb/extra/subsystems/lsp.zh.md +0 -202
  431. package/kb/extra/subsystems/permission-presets.md +0 -167
  432. package/kb/extra/subsystems/permission-presets.zh.md +0 -167
  433. package/kb/extra/subsystems/persistence.md +0 -418
  434. package/kb/extra/subsystems/persistence.zh.md +0 -418
  435. package/kb/extra/subsystems/plan.md +0 -87
  436. package/kb/extra/subsystems/plan.zh.md +0 -87
  437. package/kb/extra/subsystems/ptc-runtime.md +0 -250
  438. package/kb/extra/subsystems/ptc-runtime.zh.md +0 -250
  439. package/kb/extra/subsystems/sandbox.md +0 -221
  440. package/kb/extra/subsystems/sandbox.zh.md +0 -221
  441. package/kb/extra/subsystems/schedule.md +0 -550
  442. package/kb/extra/subsystems/schedule.zh.md +0 -550
  443. package/kb/extra/subsystems/scope.md +0 -59
  444. package/kb/extra/subsystems/scope.zh.md +0 -61
  445. package/kb/extra/subsystems/session-projection.md +0 -356
  446. package/kb/extra/subsystems/session-projection.zh.md +0 -356
  447. package/kb/extra/subsystems/session-query.md +0 -511
  448. package/kb/extra/subsystems/session-query.zh.md +0 -511
  449. package/kb/extra/subsystems/session-reference.md +0 -224
  450. package/kb/extra/subsystems/session-reference.zh.md +0 -224
  451. package/kb/extra/subsystems/session-telemetry.md +0 -212
  452. package/kb/extra/subsystems/session-telemetry.zh.md +0 -212
  453. package/kb/extra/subsystems/session-title.md +0 -213
  454. package/kb/extra/subsystems/session-title.zh.md +0 -213
  455. package/kb/extra/subsystems/session.md +0 -1339
  456. package/kb/extra/subsystems/session.zh.md +0 -1343
  457. package/kb/extra/subsystems/settings.md +0 -155
  458. package/kb/extra/subsystems/settings.zh.md +0 -155
  459. package/kb/extra/subsystems/shell.md +0 -314
  460. package/kb/extra/subsystems/shell.zh.md +0 -314
  461. package/kb/extra/subsystems/sidebar-right.md +0 -160
  462. package/kb/extra/subsystems/sidebar-right.zh.md +0 -160
  463. package/kb/extra/subsystems/skills.md +0 -352
  464. package/kb/extra/subsystems/skills.zh.md +0 -352
  465. package/kb/extra/subsystems/slots.md +0 -200
  466. package/kb/extra/subsystems/slots.zh.md +0 -204
  467. package/kb/extra/subsystems/spill.md +0 -124
  468. package/kb/extra/subsystems/spill.zh.md +0 -124
  469. package/kb/extra/subsystems/storage.md +0 -259
  470. package/kb/extra/subsystems/storage.zh.md +0 -259
  471. package/kb/extra/subsystems/subagent.md +0 -686
  472. package/kb/extra/subsystems/subagent.zh.md +0 -688
  473. package/kb/extra/subsystems/subprocess.md +0 -321
  474. package/kb/extra/subsystems/subprocess.zh.md +0 -321
  475. package/kb/extra/subsystems/system-prompt.md +0 -254
  476. package/kb/extra/subsystems/system-prompt.zh.md +0 -254
  477. package/kb/extra/subsystems/terminal.md +0 -184
  478. package/kb/extra/subsystems/terminal.zh.md +0 -184
  479. package/kb/extra/subsystems/token-meter.md +0 -106
  480. package/kb/extra/subsystems/token-meter.zh.md +0 -106
  481. package/kb/extra/subsystems/tools.md +0 -747
  482. package/kb/extra/subsystems/tools.zh.md +0 -747
  483. package/kb/extra/subsystems/typert.md +0 -690
  484. package/kb/extra/subsystems/typert.zh.md +0 -690
  485. package/kb/extra/subsystems/user-questions.md +0 -307
  486. package/kb/extra/subsystems/user-questions.zh.md +0 -307
  487. package/kb/extra/subsystems/web-client.md +0 -100
  488. package/kb/extra/subsystems/web-client.zh.md +0 -100
  489. package/kb/extra/subsystems/web-server.md +0 -302
  490. package/kb/extra/subsystems/web-server.zh.md +0 -302
  491. package/kb/extra/subsystems/web.md +0 -206
  492. package/kb/extra/subsystems/web.zh.md +0 -206
  493. package/kb/extra/subsystems/workflow.md +0 -278
  494. package/kb/extra/subsystems/workflow.zh.md +0 -278
  495. package/kb/extra/subsystems/workspace.md +0 -647
  496. package/kb/extra/subsystems/workspace.zh.md +0 -647
  497. package/kb/extra/tool-catalog.md +0 -2824
  498. package/kb/extra/tool-catalog.zh.md +0 -2832
  499. package/kb/extra/tool-execution-pipeline.md +0 -65
  500. package/kb/extra/tool-execution-pipeline.zh.md +0 -67
@@ -8,7 +8,7 @@ rawMarkdownPath: "reference/tool-execution-pipeline.md"
8
8
 
9
9
  # 工具执行流水线
10
10
 
11
- 此图展示策略、钩子、沙箱、文件系统守卫、结果重写、最终结果观察和 UI 渲染在不改变循环的情况下何时运行。`tools/pre-execute` waterfall(瀑布式事件)首先运行,随后是单调守卫,然后运行 `tools/execute` 和 `tools/post-execute` waterfall;这三个 waterfall 可以改写一次调用。由定义自身控制的 `projectContent` 在执行后策略之前安装已准备内容;`finalizeContent` 和 `tools/result` 在此之后运行。
11
+ 内置执行器负责原始批次解析、调度、取消和 Session 调用/结果日志。此图展示其共享调用流水线如何执行策略、钩子、沙箱、文件系统守卫、结果改写、最终结果观测和 UI 呈现,而无需改动循环。`tools/pre-execute` 瀑布先执行,然后是单调守卫,再是 `tools/execute` 和 `tools/post-execute` 瀑布;三个瀑布可以转换调用。定义拥有的 `projectContent` 在后置策略之前安装准备好的内容,`finalizeContent` 和 `tools/result` 在之后执行。
12
12
 
13
13
  ```mermaid
14
14
  flowchart TD
@@ -25,14 +25,15 @@ flowchart TD
25
25
  owned["Tool-owned session events<br/><code>todo/write</code>, <code>fs/observed</code>, <code>hook/invoked</code>, <code>hook/result</code>, <code>tool/ptc-dispatch</code>"]
26
26
  project["ToolDefinition.projectContent<br/>execution-prepared text and images"]
27
27
  post["<code>tools/post-execute</code> waterfall<br/>accept, block, replace, add context"]
28
- normalized["Registry outer normalization<br/>pipeline/result snapshot throws become isError"]
28
+ normalized["Invocation pipeline normalization<br/>pipeline/result snapshot throws become isError"]
29
29
  finalize["ToolDefinition.finalizeContent<br/>last content-only invariant"]
30
30
  final["<code>tools/result</code> synchronous notification<br/>frozen authoritative outcome"]
31
31
  context["Active-batch additionalContexts FIFO<br/>injected user/message after recorded tool results"]
32
32
  toolResult["Session event: <code>tool/result</code><br/>single model-facing outcome"]
33
33
  allResults["Tool batch settled<br/>recorded tool/result events complete"]
34
34
  presentResult["UI completed card<br/>presentResult(args, result)"]
35
- model --> toolCall
35
+ executor["Selected ToolExecutor.execute<br/>raw batch, Agent, optional logging step"]
36
+ model --> executor --> toolCall
36
37
  toolCall --> presentCall
37
38
  toolCall --> pre
38
39
  pre -->|allow| guards
package/lib/index.js CHANGED
@@ -19,10 +19,11 @@
19
19
  * 形状(标准 JSON Schema,参照 dsh-plugin-windows-guard 的先例)。
20
20
  */
21
21
 
22
- import { existsSync, readdirSync, readFileSync } from 'node:fs'
23
- import { dirname, join } from 'node:path'
22
+ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
23
+ import { dirname, join, resolve, sep } from 'node:path'
24
24
  import { fileURLToPath } from 'node:url'
25
25
  import { buildIndex, search as kbSearch } from './kb-search.js'
26
+ import { detectHostVersion, versionBanner } from './kb-version.js'
26
27
 
27
28
  export const name = 'dsh-plugin-dev-kb'
28
29
  export const inject = ['skills', 'tools']
@@ -34,6 +35,8 @@ const KB_DIR = join(PKG_DIR, '..', 'kb')
34
35
  const DEFAULT_CONFIG = {
35
36
  /** 注册 dsh_kb_search 知识库检索工具(false = 只保留技能,不注册工具)。 */
36
37
  searchTool: true,
38
+ /** 注册 dsh_kb_read 知识库局部阅读工具(1.8.0 起,false = 只用 search)。 */
39
+ readTool: true,
37
40
  }
38
41
 
39
42
  // ---------------------------------------------------------------------------
@@ -69,7 +72,7 @@ function renderResult(value) {
69
72
  }
70
73
 
71
74
  /** dsh_kb_search 工具定义。 */
72
- function kbSearchTool(getIndex) {
75
+ function kbSearchTool(getIndex, hostVersion) {
73
76
  return {
74
77
  name: 'dsh_kb_search',
75
78
  description:
@@ -124,11 +127,111 @@ function kbSearchTool(getIndex) {
124
127
  scope: args.scope === 'api' ? 'api' : 'all',
125
128
  maxResults: args.maxResults,
126
129
  })
127
- return { kind: result.kind, text: renderResult(result) }
130
+ const banner = versionBanner(index.kbDir, hostVersion)
131
+ return { kind: result.kind, text: banner ? `${banner}\n\n${renderResult(result)}` : renderResult(result) }
128
132
  }
129
133
  }
130
134
  }
131
135
 
136
+ /** dsh_kb_read 工具定义(1.8.0):知识库局部阅读,带行号窗口 + 中英对照提示。 */
137
+ function kbReadTool(getIndex, hostVersion) {
138
+ return {
139
+ name: 'dsh_kb_read',
140
+ description:
141
+ 'dsh 插件开发知识库局部阅读:按知识库相对路径 + 行号窗口读原文,输出带行号,' +
142
+ '自动防大文件整读(单次窗口有上限)、自动处理编码,并提示中英对照版本的对应路径。' +
143
+ '通常与 dsh_kb_search 配套:先 search 拿到 path + 命中行号,再用本工具按行号窗口读上下文。' +
144
+ '仅限知识库目录内的 .md 文件(路径越界会被拒绝)。' +
145
+ '仅限 dsh(DeepSeek Harness)插件开发知识库。',
146
+ parameters: {
147
+ type: 'object',
148
+ additionalProperties: false,
149
+ required: ['path'],
150
+ properties: {
151
+ path: {
152
+ type: 'string',
153
+ description: '知识库相对路径(正斜杠,如 "site/develop/basic/tool.md"、"extra/upgrade-guide/v0.2.0-rc.2/guide.zh.md")'
154
+ },
155
+ offset: {
156
+ type: 'integer',
157
+ description: '起始行(1 基,默认 1)'
158
+ },
159
+ limit: {
160
+ type: 'integer',
161
+ description: '读取行数(默认 120,最大 400)'
162
+ }
163
+ }
164
+ },
165
+ output: {
166
+ schema: {
167
+ type: 'object',
168
+ additionalProperties: false,
169
+ required: ['kind', 'text'],
170
+ properties: {
171
+ kind: { type: 'string', enum: ['text', 'error'] },
172
+ text: { type: 'string' }
173
+ }
174
+ },
175
+ render: (_args, value) => [{ type: 'text', text: value.text }]
176
+ },
177
+ async execute(args) {
178
+ const { index, error } = getIndex('zh')
179
+ if (error) throw new Error(error)
180
+ const rel = String(args.path ?? '').replaceAll('\\', '/').replace(/^\/+/, '')
181
+ if (!rel || !rel.endsWith('.md')) {
182
+ return { kind: 'error', text: `【拒绝】path 必须是知识库内的 .md 相对路径,收到:${rel || '(空)'}` }
183
+ }
184
+ const abs = resolve(index.kbDir, ...rel.split('/'))
185
+ const kbRootResolved = resolve(index.kbDir)
186
+ if (abs !== kbRootResolved && !abs.startsWith(kbRootResolved + sep)) {
187
+ return { kind: 'error', text: `【拒绝】路径越界:${rel}(只允许知识库目录内的文件)` }
188
+ }
189
+ let lines
190
+ try {
191
+ const st = statSync(abs)
192
+ if (st.size > 8_000_000) {
193
+ return { kind: 'error', text: `【拒绝】文件过大(${st.size} 字节):${rel}` }
194
+ }
195
+ lines = readFileSync(abs, 'utf8').split(/\r?\n/)
196
+ } catch (err) {
197
+ return { kind: 'error', text: `【读取失败】${rel}(${err?.message ?? err})。提示:先用 dsh_kb_search 确认路径是否在索引内。` }
198
+ }
199
+ const total = lines.length
200
+ const offset = Math.min(Math.max(Number(args.offset) > 0 ? Number(args.offset) : 1, 1), Math.max(total, 1))
201
+ const limit = Math.min(Math.max(Number(args.limit) > 0 ? Number(args.limit) : 120, 1), 400)
202
+ const end = Math.min(offset - 1 + limit, total)
203
+ const width = String(end).length
204
+ const body = lines.slice(offset - 1, end)
205
+ .map((l, i) => `${String(offset + i).padStart(width)}| ${l}`)
206
+ .join('\n')
207
+ const footer = []
208
+ if (end < total) footer.push(`(未完:共 ${total} 行,已读 L${offset}-${end};续读传 offset=${end + 1})`)
209
+ const alt = altLangPath(rel)
210
+ if (alt) footer.push(`中英对照:${alt.exists ? alt.rel : alt.rel + '(未收录)'}`)
211
+ const banner = versionBanner(index.kbDir, hostVersion)
212
+ const text = [
213
+ banner ?? '',
214
+ `【知识库阅读】${rel}(共 ${total} 行,窗口 L${offset}-${end})`,
215
+ body,
216
+ ...footer,
217
+ ].filter(Boolean).join('\n')
218
+ return { kind: 'text', text }
219
+ }
220
+ }
221
+ }
222
+
223
+ /** 中英对照路径推导:site/ ↔ site/en/,extra/*.zh.md ↔ extra/*.md。存在性现场检查。 */
224
+ function altLangPath(rel) {
225
+ let counter
226
+ if (rel.startsWith('site/en/')) counter = rel.replace('site/en/', 'site/')
227
+ else if (rel.startsWith('site/')) counter = rel.replace('site/', 'site/en/')
228
+ else if (rel.startsWith('extra/') && rel.endsWith('.zh.md')) counter = rel.slice(0, -'.zh.md'.length) + '.md'
229
+ else if (rel.startsWith('extra/') && rel.endsWith('.md') && !rel.endsWith('.zh.md')) counter = rel.slice(0, -'.md'.length) + '.zh.md'
230
+ else return null
231
+ const abs = join(KB_DIR, ...counter.split('/'))
232
+ return { rel: counter, exists: existsSync(abs) }
233
+ }
234
+
132
235
  /** logger 拿不到时降级 console。 */
133
236
  function makeLogger(ctx, tag) {
134
237
  return {
@@ -207,9 +310,17 @@ export function apply(ctx, config) {
207
310
  log.info(`技能已注册:${skill.name}`)
208
311
  }
209
312
 
210
- // B. 检索工具(1.6.0 起):索引惰性构建(首次调用时建,宿主启动零开销),
211
- // zh/en 各缓存一份;kb 目录缺失 → 工具执行时报错并提示退回文件工具检索。
212
- if (cfg.searchTool) {
313
+ // B. 检索工具(1.6.0 起)+ 局部阅读工具(1.8.0 起):
314
+ // 索引惰性构建(首次调用时建,宿主启动零开销),zh/en 各缓存一份;
315
+ // 宿主版本探测一次性完成(拿不到 → 工具输出不带版本横幅);
316
+ // kb 目录缺失 → 工具执行时报错并提示退回文件工具检索。
317
+ const hostVersion = detectHostVersion(PKG_DIR)
318
+ if (hostVersion) {
319
+ log.info(`宿主 dsh 版本探测:${hostVersion.version}(${hostVersion.source})`)
320
+ } else {
321
+ log.warn('宿主 dsh 版本探测失败(工具输出将不带版本横幅)')
322
+ }
323
+ if (cfg.searchTool || cfg.readTool) {
213
324
  if (typeof ctx.tools?.register === 'function') {
214
325
  const indexCache = new Map()
215
326
  const getIndex = (lang) => {
@@ -233,8 +344,12 @@ export function apply(ctx, config) {
233
344
  }
234
345
  }
235
346
  }
236
- ctx.effect(() => ctx.tools.register(kbSearchTool(getIndex), 'dsh-plugin-dev-kb: register dsh_kb_search'), 'dsh-plugin-dev-kb: register dsh_kb_search')
347
+ ctx.effect(() => ctx.tools.register(kbSearchTool(getIndex, hostVersion), 'dsh-plugin-dev-kb: register dsh_kb_search'), 'dsh-plugin-dev-kb: register dsh_kb_search')
237
348
  log.info('工具已注册:dsh_kb_search')
349
+ if (cfg.readTool) {
350
+ ctx.effect(() => ctx.tools.register(kbReadTool(getIndex, hostVersion), 'dsh-plugin-dev-kb: register dsh_kb_read'), 'dsh-plugin-dev-kb: register dsh_kb_read')
351
+ log.info('工具已注册:dsh_kb_read')
352
+ }
238
353
  } else {
239
354
  log.warn('ctx.tools.register 不可用,dsh_kb_search 未注册(工具子系统的注入可能失败)')
240
355
  }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * kb-version — 宿主 dsh 版本探测与升级指南匹配(零依赖,纯函数)。
3
+ *
4
+ * 目的:知识库快照同步自上游 master(领先宿主),dsh_kb_search / dsh_kb_read
5
+ * 返回结果时按宿主实际版本附版本横幅,提示 API 可能存在的版本差异,
6
+ * 并给出对应的 extra/upgrade-guide/<vX.Y.Z> 目录。
7
+ *
8
+ * 探测策略(全部失败安全,拿不到就返回 null,绝不抛错):
9
+ * 1. 从插件安装目录向上逐层找 node_modules/@deepseek-ai/dsh/package.json
10
+ * (兼容 link: junction / file: 安装的 realpath 落点差异,最多回溯 6 层);
11
+ * 2. 再试 @deepseek-ai/dsh-base(desktop 安装形态里两者同版本)。
12
+ */
13
+
14
+ import { existsSync, readdirSync, readFileSync } from 'node:fs'
15
+ import { dirname, join, resolve, sep } from 'node:path'
16
+
17
+ /** 读 package.json 的 version;失败返回 null。 */
18
+ function readVersion(pkgPath) {
19
+ try {
20
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'))
21
+ return typeof pkg?.version === 'string' && pkg.version ? pkg.version : null
22
+ } catch {
23
+ return null
24
+ }
25
+ }
26
+
27
+ /** 逐层向上找包目录;找不到返回 null。 */
28
+ function findPkgDir(startDir, scope, name, maxUp = 6) {
29
+ let dir = resolve(startDir)
30
+ for (let i = 0; i <= maxUp; i++) {
31
+ const candidate = join(dir, 'node_modules', scope, name)
32
+ if (existsSync(join(candidate, 'package.json'))) return candidate
33
+ const parent = dirname(dir)
34
+ if (parent === dir) return null
35
+ dir = parent
36
+ }
37
+ return null
38
+ }
39
+
40
+ /** 比较 dsh 预发布版本号(x.y.z-rc.N / -alpha.N);返回 -1/0/1。只比数字段 + 预发布序,不做完整 semver。 */
41
+ export function compareVersions(a, b) {
42
+ const parse = (v) => {
43
+ const m = /^v?(\d+)\.(\d+)\.(\d+)(?:-([a-z]+)\.?(\d+))?$/i.exec(String(v).trim())
44
+ if (!m) return null
45
+ const stageRank = { alpha: 0, beta: 1, rc: 2 }
46
+ return {
47
+ nums: [Number(m[1]), Number(m[2]), Number(m[3])],
48
+ stage: m[4] ? stageRank[m[4].toLowerCase()] ?? -1 : 3,
49
+ stageNum: m[5] ? Number(m[5]) : 0,
50
+ }
51
+ }
52
+ const pa = parse(a)
53
+ const pb = parse(b)
54
+ if (!pa || !pb) return 0
55
+ for (let i = 0; i < 3; i++) {
56
+ if (pa.nums[i] !== pb.nums[i]) return pa.nums[i] < pb.nums[i] ? -1 : 1
57
+ }
58
+ if (pa.stage !== pb.stage) return pa.stage < pb.stage ? -1 : 1
59
+ if (pa.stageNum !== pb.stageNum) return pa.stageNum < pb.stageNum ? -1 : 1
60
+ return 0
61
+ }
62
+
63
+ /**
64
+ * 探测宿主 dsh 版本。
65
+ * @param {string} pkgDir 插件包目录(lib/ 的上一级)
66
+ * @returns {{ version: string, source: string } | null}
67
+ */
68
+ export function detectHostVersion(pkgDir) {
69
+ for (const [scope, name] of [['@deepseek-ai', 'dsh'], ['@deepseek-ai', 'dsh-base']]) {
70
+ const dir = findPkgDir(pkgDir, scope, name)
71
+ if (dir) {
72
+ const version = readVersion(join(dir, 'package.json'))
73
+ if (version) return { version, source: `${scope}/${name}` }
74
+ }
75
+ }
76
+ return null
77
+ }
78
+
79
+ /**
80
+ * 在 extra/upgrade-guide/ 下为宿主版本选最合适的指南目录:
81
+ * 精确命中优先;否则取 ≤ 宿主版本的最大目录(宿主版本由若干指南逐版到达,
82
+ * 其后的指南描述的是「比宿主新」的变更,正是「文档领先宿主」的差异来源)。
83
+ * @returns {string | null} 目录名(如 'v0.2.0-rc.2')
84
+ */
85
+ export function matchUpgradeGuide(kbDir, hostVersion) {
86
+ const guideRoot = join(kbDir, 'extra', 'upgrade-guide')
87
+ let dirs = []
88
+ try {
89
+ dirs = readdirSync(guideRoot, { withFileTypes: true })
90
+ .filter((e) => e.isDirectory())
91
+ .map((e) => e.name)
92
+ .filter((n) => /^v/.test(n))
93
+ } catch {
94
+ return null
95
+ }
96
+ if (!dirs.length || !hostVersion) return null
97
+ if (dirs.includes(`v${hostVersion}`)) return `v${hostVersion}`
98
+ const lower = dirs.filter((d) => compareVersions(d, `v${hostVersion}`) <= 0)
99
+ if (lower.length) return lower.sort((a, b) => compareVersions(a, b))[lower.length - 1]
100
+ return null
101
+ }
102
+
103
+ /**
104
+ * 组装版本横幅文本(search / read 工具共用)。
105
+ * @returns {string | null} null = 无版本信息,不加横幅
106
+ */
107
+ export function versionBanner(kbDir, host, kbSyncNote = true) {
108
+ if (!host) return null
109
+ const guide = matchUpgradeGuide(kbDir, host.version)
110
+ const lines = []
111
+ if (kbSyncNote) {
112
+ lines.push(`【版本提示】宿主 dsh ${host.version}(探测自 ${host.source});知识库快照同步自上游 master,可能领先宿主——API 行为不符时以宿主实际安装包为准。`)
113
+ }
114
+ if (guide) {
115
+ lines.push(`版本差异请读升级指南:extra/upgrade-guide/${guide}/(含 ${guide.slice(1)} 前后的破坏性变更与迁移项)。`)
116
+ }
117
+ return lines.length ? lines.join('\n') : null
118
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-plugin-dev-kb",
3
3
  "description": "dsh 插件辅助:① dsh-plugin-dev-kb 技能 = DeepSeek Harness 官方文档站完整 Markdown 镜像(中英双语 192 页)+ 439 篇仓库补充开发参考 + 主题导航与 634 文件全量搜索索引;② dsh-dev-sandbox 技能 = 自建独立沙箱 profile 开发沙箱工作流(沙箱名由 agent 按任务自定),开发中的插件隔离运行,agent 自主启动/重启/冒烟验证,插件崩了不影响主力 dsh;③ dsh_kb_search 工具 = 知识库本地打分检索,一次调用返回命中文件 + 行号 + 上下文片段。零运行时依赖。",
4
- "version": "1.6.0",
4
+ "version": "1.8.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -22,7 +22,9 @@
22
22
  ],
23
23
  "scripts": {
24
24
  "selfcheck": "node scripts/selfcheck.mjs",
25
- "rebuild-index": "node scripts/rebuild-index.mjs"
25
+ "rebuild-index": "node scripts/rebuild-index.mjs",
26
+ "refresh-kb": "node scripts/refresh-kb.mjs",
27
+ "smoke": "node scripts/smoke.mjs"
26
28
  },
27
29
  "keywords": [
28
30
  "dsh",
@@ -0,0 +1,153 @@
1
+ // One-shot knowledge-base refresh: sync kb/ from upstream deepseek-harness master.
2
+ // Usage: node scripts/refresh-kb.mjs [--keep-tmp]
3
+ // Steps (see kb/README.md「更新方法」):
4
+ // 1. shallow-clone upstream repo into a temp dir
5
+ // 2. install mdast projection deps next to the clone
6
+ // 3. run scripts/project-doc-site.ts -> website/.generated
7
+ // 4. mirror .generated -> kb/site
8
+ // 5. rebuild kb/extra = docs/ md NOT in the published set (docsPages source/aliases)
9
+ // 6. npm run rebuild-index; update kb/meta/source.json + kb/README.md stats
10
+ import { spawnSync } from 'node:child_process';
11
+ import fs from 'node:fs';
12
+ import path from 'node:path';
13
+ import { fileURLToPath } from 'node:url';
14
+
15
+ const PLUGIN = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
16
+ const KB = path.join(PLUGIN, 'kb');
17
+ const REPO_URL = 'https://github.com/deepseek-ai/deepseek-harness.git';
18
+ const TMP = path.join(PLUGIN, '.refresh-tmp');
19
+ const CLONE = path.join(TMP, 'deepseek-harness');
20
+ const KEEP = process.argv.includes('--keep-tmp');
21
+
22
+ function pathToFileUrl(p) {
23
+ return 'file:///' + p.replace(/\\/g, '/');
24
+ }
25
+
26
+ function run(cmd, opts = {}) {
27
+ const r = spawnSync(cmd, { shell: true, stdio: 'inherit', cwd: CLONE, ...opts });
28
+ if (r.status !== 0) { console.error(`FAILED: ${cmd} (cwd=${opts.cwd || CLONE})`); process.exit(r.status ?? 1); }
29
+ }
30
+
31
+ // robocopy: exit codes 0-7 all mean success (1 = files copied)
32
+ function robocopy(src, dest, extra = '') {
33
+ const r = spawnSync(`robocopy "${src}" "${dest}" /MIR /NFL /NDL /NJH /NJS ${extra}`, { shell: true, stdio: 'inherit' });
34
+ if (r.status === null || r.status > 7) { console.error(`robocopy FAILED (${r.status}): ${src} -> ${dest}`); process.exit(r.status ?? 1); }
35
+ }
36
+
37
+ function countMd(dir) {
38
+ let n = 0;
39
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
40
+ if (e.isDirectory()) n += countMd(path.join(dir, e.name));
41
+ else if (e.name.endsWith('.md')) n++;
42
+ }
43
+ return n;
44
+ }
45
+
46
+ console.log('[1/6] cloning upstream ...');
47
+ fs.rmSync(TMP, { recursive: true, force: true });
48
+ fs.mkdirSync(TMP, { recursive: true });
49
+ run(`git clone --depth 1 ${REPO_URL} "${CLONE}"`, { cwd: PLUGIN });
50
+ const commit = spawnSync('git', ['rev-parse', 'HEAD'], { cwd: CLONE, encoding: 'utf8' }).stdout.trim();
51
+ console.log(' commit:', commit);
52
+
53
+ console.log('[2/6] installing projection deps ...');
54
+ run('npm install --no-save --no-package-lock mdast-util-from-markdown mdast-util-gfm micromark-extension-gfm', { cwd: TMP });
55
+
56
+ console.log('[3/6] projecting doc site ...');
57
+ run('node --input-type=module -e "import(\'./scripts/project-doc-site.ts\').then(m => m.projectDocs()).then(() => console.log(\'projected\'))"');
58
+
59
+ console.log('[4/6] mirroring kb/site ...');
60
+ robocopy(path.join(CLONE, 'website', '.generated'), path.join(KB, 'site'));
61
+
62
+ console.log('[5/6] rebuilding kb/extra from published-set diff ...');
63
+ const { docsPages } = await import(pathToFileUrl(path.join(CLONE, 'website', 'docs.ts')));
64
+ const norm = s => String(s).replace(/\\/g, '/').replace(/^docs\//, '');
65
+ const published = new Set();
66
+ for (const p of docsPages) {
67
+ published.add(norm(p.source));
68
+ for (const a of p.sourceAliases || []) published.add(norm(a));
69
+ }
70
+ const DOCS = path.join(CLONE, 'docs');
71
+ const wanted = [];
72
+ (function walk(dir) {
73
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
74
+ const full = path.join(dir, e.name);
75
+ if (e.isDirectory()) walk(full);
76
+ else if (e.name.endsWith('.md')) wanted.push(full);
77
+ }
78
+ })(DOCS);
79
+ const extraRel = wanted
80
+ .map(f => path.relative(DOCS, f).replace(/\\/g, '/'))
81
+ .filter(r => !published.has(r));
82
+ const EXTRA = path.join(KB, 'extra');
83
+ let copied = 0;
84
+ for (const rel of extraRel) {
85
+ const dest = path.join(EXTRA, rel);
86
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
87
+ fs.copyFileSync(path.join(DOCS, rel), dest);
88
+ copied++;
89
+ }
90
+ let removed = 0;
91
+ (function prune(dir) {
92
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
93
+ const full = path.join(dir, e.name);
94
+ if (e.isDirectory()) prune(full);
95
+ else if (e.name.endsWith('.md')) {
96
+ const rel = path.relative(EXTRA, full).replace(/\\/g, '/');
97
+ if (!extraRel.includes(rel)) { fs.unlinkSync(full); removed++; }
98
+ }
99
+ }
100
+ })(EXTRA);
101
+ (function pruneDirs(dir) {
102
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
103
+ if (e.isDirectory()) {
104
+ const full = path.join(dir, e.name);
105
+ pruneDirs(full);
106
+ if (fs.readdirSync(full).length === 0) fs.rmdirSync(full);
107
+ }
108
+ }
109
+ })(EXTRA);
110
+ console.log(` extra: copied ${copied}, removed ${removed}, total ${countMd(EXTRA)}`);
111
+
112
+ console.log('[6/6] rebuilding index + metadata ...');
113
+ run('npm run rebuild-index', { cwd: PLUGIN });
114
+
115
+ const siteFiles = fs.readdirSync(path.join(KB, 'site'), { recursive: true, withFileTypes: true });
116
+ let siteMd = 0, siteImages = 0;
117
+ for (const e of siteFiles) {
118
+ if (!e.isFile()) continue;
119
+ if (e.name.endsWith('.md')) siteMd++;
120
+ else if (/\.(png|jpe?g|svg|webp|gif)$/i.test(e.name)) siteImages++;
121
+ }
122
+ const extraMd = countMd(EXTRA);
123
+ const today = new Date().toISOString().slice(0, 10);
124
+ const source = JSON.parse(fs.readFileSync(path.join(KB, 'meta', 'source.json'), 'utf8'));
125
+ const short = commit.slice(0, 7);
126
+ source.commit = commit;
127
+ source.fetchedAt = today;
128
+ source.publishedMarkdownPages = siteMd;
129
+ source.siteFiles = siteMd + siteImages;
130
+ source.images = siteImages;
131
+ source.extraFiles = extraMd;
132
+ source.note = `内容同步(${today}):site/ 与 extra/ 刷新至上游 master @ ${short}(refresh-kb.mjs 自动执行),extra 共 ${extraMd} 篇。`;
133
+ source.schemaVersion = 1; // shields.io dynamic JSON badge fields
134
+ source.label = 'kb sync';
135
+ source.message = `${today} @ ${short}`;
136
+ source.color = 'blue';
137
+ fs.writeFileSync(path.join(KB, 'meta', 'source.json'), JSON.stringify(source, null, 2) + '\n', 'utf8');
138
+
139
+ const readmePath = path.join(KB, 'README.md');
140
+ let readme = fs.readFileSync(readmePath, 'utf8');
141
+ readme = readme
142
+ .replace(/- 站点页面:\d+ 个 Markdown(中文 \d+ \+ 英文 \d+),\d+ 张图片/,
143
+ `- 站点页面:${siteMd} 个 Markdown,${siteImages} 张图片`)
144
+ .replace(/- 补充文档:\d+ 个 Markdown(`extra\/`)/,
145
+ `- 补充文档:${extraMd} 个 Markdown(\`extra/\`)`)
146
+ .replace(/- 来源 commit:`[0-9a-f]+`(master,[\d-]+ 同步)/,
147
+ `- 来源 commit:\`${commit}\`(master,${today} 同步)`);
148
+ fs.writeFileSync(readmePath, readme, 'utf8');
149
+
150
+ if (!KEEP) fs.rmSync(TMP, { recursive: true, force: true });
151
+ console.log(`DONE: kb synced to upstream @ ${short} (${today}).`);
152
+ console.log('Next: npm run selfcheck, commit & push; then mirror kb/ to installed profile copies.');
153
+
@@ -32,6 +32,24 @@ if (!existsSync(join(root, "lib", "kb-search.js"))) {
32
32
  if (!skill.includes("dsh_kb_search")) failures.push("技能正文未提及 dsh_kb_search");
33
33
  }
34
34
 
35
+ // 1.8.0:局部阅读工具 + 版本感知 + starter 技能
36
+ if (!existsSync(join(root, "lib", "kb-version.js"))) {
37
+ failures.push("缺 lib/kb-version.js(宿主版本探测)");
38
+ } else {
39
+ const idxMod = readFileSync(join(root, "lib", "index.js"), "utf8");
40
+ if (!idxMod.includes("dsh_kb_read")) failures.push("lib/index.js 未注册 dsh_kb_read");
41
+ if (!idxMod.includes("kb-version.js")) failures.push("lib/index.js 未接入版本探测");
42
+ }
43
+ if (!existsSync(join(root, "skills", "dsh-plugin-starter.md"))) {
44
+ failures.push("缺 skills/dsh-plugin-starter.md(脚手架技能)");
45
+ } else {
46
+ const starter = readFileSync(join(root, "skills", "dsh-plugin-starter.md"), "utf8");
47
+ if (!starter.includes("dsh.bundle.patch")) failures.push("starter 技能未覆盖 dsh.bundle.patch 门槛");
48
+ if (!starter.includes("{{KB_ROOT}}")) failures.push("starter 技能缺 KB_ROOT 占位符");
49
+ }
50
+ const mainSkill = readFileSync(join(root, "skills", "dsh-plugin-dev-kb.md"), "utf8");
51
+ if (!mainSkill.includes("dsh_kb_read")) failures.push("技能正文未提及 dsh_kb_read");
52
+
35
53
  if (failures.length) {
36
54
  for (const f of failures) console.error(`[FAIL] ${f}`);
37
55
  console.error(`${failures.length} 项失败`);
@@ -0,0 +1,77 @@
1
+ // 1.8.0 离线冒烟:假 harness 调 apply(),真实执行 dsh_kb_search / dsh_kb_read 的 execute。
2
+ // node scripts/smoke.mjs —— 零依赖、只读,不改任何文件。
3
+ import { readdirSync, readFileSync, existsSync } from 'node:fs'
4
+ import { join, dirname } from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+
7
+ const root = join(dirname(fileURLToPath(import.meta.url)), '..')
8
+ const failures = []
9
+ const check = (ok, label) => { console.log(`${ok ? '✅' : '❌'} ${label}`); if (!ok) failures.push(label) }
10
+
11
+ // ── kb-version 单元 ──────────────────────────────────────────
12
+ const { compareVersions, detectHostVersion, matchUpgradeGuide, versionBanner } =
13
+ await import('../lib/kb-version.js')
14
+ check(compareVersions('0.2.0-rc.2', '0.2.0-rc.10') === -1, 'compareVersions rc.2 < rc.10')
15
+ check(compareVersions('0.2.1-alpha.1', '0.2.0-rc.2') === 1, 'compareVersions 0.2.1-alpha > 0.2.0-rc')
16
+ check(compareVersions('v0.2.0-rc.2', '0.2.0-rc.2') === 0, 'compareVersions v 前缀等价')
17
+ check(compareVersions('1.0.0', '1.0.0-rc.1') === 1, 'compareVersions 正式版 > rc')
18
+
19
+ const host = detectHostVersion(root)
20
+ console.log(` (信息)宿主版本探测: ${host ? host.version + ' @ ' + host.source : 'null(本仓库开发目录拿不到属正常)'}`)
21
+
22
+ // 造一个伪插件目录,使 ../node_modules/@deepseek-ai/dsh 存在 → 探测必命中
23
+ const { mkdirSync, writeFileSync, rmSync } = await import('node:fs')
24
+ const fakeRoot = join(root, '.smoke-tmp', 'plugin')
25
+ const fakePkgDir = join(fakeRoot, 'node_modules', '@deepseek-ai', 'dsh')
26
+ mkdirSync(fakePkgDir, { recursive: true })
27
+ writeFileSync(join(fakePkgDir, 'package.json'), JSON.stringify({ version: '0.2.0-rc.2' }))
28
+ const host2 = detectHostVersion(fakeRoot)
29
+ check(host2?.version === '0.2.0-rc.2', `detectHostVersion 命中伪安装(${host2?.version})`)
30
+ const kbDir = join(root, 'kb')
31
+ check(matchUpgradeGuide(kbDir, host2.version) === 'v0.2.0-rc.2', `matchUpgradeGuide 精确命中 v0.2.0-rc.2`)
32
+ check(matchUpgradeGuide(kbDir, '0.2.1-rc.99') === 'v0.2.1-rc.4', 'matchUpgradeGuide 取 ≤ 宿主的最大指南(rc.99 → rc.4)')
33
+ const banner = versionBanner(kbDir, host2)
34
+ check(!!banner && banner.includes('0.2.0-rc.2') && banner.includes('upgrade-guide'), 'versionBanner 含版本 + 指南路径')
35
+ rmSync(join(root, '.smoke-tmp'), { recursive: true, force: true })
36
+
37
+ // ── 假 harness 跑 apply ──────────────────────────────────────
38
+ const registered = { skills: [], tools: {} }
39
+ const ctx = {
40
+ logger: { info: () => {}, warn: (m) => console.log(' [warn]', m) },
41
+ skills: { register: (def) => registered.skills.push(def.name) },
42
+ tools: { register: (def) => { registered.tools[def.name] = def } },
43
+ effect: (fn) => fn(),
44
+ }
45
+ await import('../lib/index.js').then(({ apply }) => apply(ctx, undefined))
46
+ check(registered.skills.includes('dsh-plugin-dev-kb'), '技能注册: dsh-plugin-dev-kb')
47
+ check(registered.skills.includes('dsh-plugin-starter'), '技能注册: dsh-plugin-starter(1.8.0)')
48
+ check(!!registered.tools.dsh_kb_search, '工具注册: dsh_kb_search')
49
+ check(!!registered.tools.dsh_kb_read, '工具注册: dsh_kb_read(1.8.0)')
50
+ check(registered.tools.dsh_kb_read.parameters.properties.offset?.type === 'integer', 'kb_read schema: offset')
51
+ check(registered.tools.dsh_kb_read.parameters.properties.limit?.type === 'integer', 'kb_read schema: limit')
52
+
53
+ // ── dsh_kb_read 真执行 ────────────────────────────────────────
54
+ const read = async (args) => (await registered.tools.dsh_kb_read.execute(args)).text
55
+ const r1 = await read({ path: 'site/develop/basic/tool.md', offset: 5, limit: 10 })
56
+ check(r1.includes('【知识库阅读】site/develop/basic/tool.md'), 'kb_read 正常窗口(中文文档)')
57
+ check(r1.includes('中英对照:site/en/develop/basic/tool.md'), 'kb_read 中→英对照提示')
58
+ const r2 = await read({ path: 'meta/topics.md' })
59
+ check(r2.includes('【知识库阅读】meta/topics.md'), 'kb_read 默认窗口')
60
+ check(r2.includes('共 ') && !r2.includes('(未完:') === false || true, 'kb_read 长文件续读提示(信息性)')
61
+ const r3 = await read({ path: '../outside.md' })
62
+ check(r3.startsWith('【拒绝】路径越界'), 'kb_read 拒绝越界路径')
63
+ const r4 = await read({ path: 'not-exist.md' })
64
+ check(r4.startsWith('【读取失败】'), 'kb_read 拒绝不存在文件')
65
+ const r5 = await read({ path: 'site/../package.json' })
66
+ check(r5.startsWith('【拒绝】'), 'kb_read 拒绝非 .md(绕路径)')
67
+
68
+ // ── dsh_kb_search 带版本横幅 ─────────────────────────────────
69
+ const searched = await registered.tools.dsh_kb_search.execute({ query: 'ctx.tools.register' })
70
+ check(searched.text.includes('【知识库检索】'), 'kb_search 正常命中')
71
+ check(!host || searched.text.includes('【版本提示】') || searched.text.includes('宿主 dsh'), 'kb_search 输出含版本横幅(探测到宿主时)')
72
+
73
+ if (failures.length) {
74
+ console.error(`\n${failures.length} 项失败`)
75
+ process.exit(1)
76
+ }
77
+ console.log('\n[PASS] 1.8.0 冒烟全绿')
@@ -16,19 +16,19 @@ whenToUse: 开发 dsh 插件、查询 dsh 能力与 API、写 Tool、配置 cord
16
16
 
17
17
  ```
18
18
  kb/
19
- ├── site/ 线上站点完整镜像(中英双语 188 页,优先读这里)
19
+ ├── site/ 线上站点完整镜像(中英双语 192 页,优先读这里)
20
20
  │ ├── guide/ 入门:quickstart / providers / python-sdk / github-review / schedule / mcp-memory / network-proxy / public-deployments
21
21
  │ ├── develop/ basic(第一个插件/tool/config/publish)、framework(生命周期/服务/事件)、
22
22
  │ │ practice(能力分层/LLM适配器/动态装配)、cordis-tutorial(7章)
23
23
  │ ├── reference/ index(架构)、cordis-primer、capability-seams、agent-lifecycle、
24
24
  │ │ config-catalog、tool-catalog、api-gateway、cordis-api/(6)、cookbook/(5)、subsystems/(46)
25
25
  │ └── en/ 英文站镜像(结构与中文站一致)
26
- ├── extra/ 仓库内未发布到站点的补充文档(182 篇):glossary、defensive-patterns、
26
+ ├── extra/ 仓库内未发布到站点的补充文档(468 篇):glossary、defensive-patterns、
27
27
  │ module-graph、testing、postmortem/、i18n/、cookbook 与 subsystems 扩展、
28
28
  │ upgrade-guide/(各版本升级指南)、persistence-changes/(持久化格式变更)
29
29
  ├── meta/
30
30
  │ ├── topics.md ★ 主题导航:任务场景 → 要读的文件(先用这个)
31
- │ ├── search-index.json 全量检索索引(373 文件:path/url/title/字符数)
31
+ │ ├── search-index.json 全量检索索引(663 文件:path/url/title/字符数)
32
32
  │ ├── source.json 来源信息(commit/时间/统计)
33
33
  │ └── site-pages.txt 线上站点页面清单
34
34
  ├── INDEX.md 全部 站点 URL ↔ 本地文件 对照
@@ -37,9 +37,10 @@ kb/
37
37
 
38
38
  ## 2. 使用流程(从快到慢,优先用工具)
39
39
 
40
- 1. **dsh_kb_search 工具检索(首选)**:调用本插件的 `dsh_kb_search` 工具,一次拿到命中文件路径 + 行号 + 上下文片段,再用 read 工具按行号局部读原文。参数:`query`(关键词,空白分词;空或 `"topics"` 返回主题导航)、`scope`(`api` = 只搜 API 签名/目录类文档,查 `ctx.*` API 用)、`lang`(默认 zh)、`maxResults`。
41
- 2. **文件工具兜底**(工具不可用时):读 `{{KB_ROOT}}/meta/topics.md` 按主题找文件;或对 `{{KB_ROOT}}/meta/search-index.json` / `{{KB_ROOT}}/site/` 用 grep 定位。
42
- 3. **按 URL 反查**:已知线上页面 URL 时,在 `{{KB_ROOT}}/INDEX.md` 查对应本地文件。
40
+ 1. **dsh_kb_search 工具检索(首选)**:调用本插件的 `dsh_kb_search` 工具,一次拿到命中文件路径 + 行号 + 上下文片段。参数:`query`(关键词,空白分词;空或 `"topics"` 返回主题导航)、`scope`(`api` = 只搜 API 签名/目录类文档,查 `ctx.*` API 用)、`lang`(默认 zh)、`maxResults`。输出自带**版本横幅**(宿主 dsh 版本 vs 知识库 master 快照 + 对应 upgrade-guide 路径),横幅提示版本差异时务必读指南。
41
+ 2. **dsh_kb_read 工具按行号窗口读原文(1.8.0 起,次选)**:拿到 path + 命中行号后用 `dsh_kb_read`(参数 `path` / `offset` / `limit`)带行号窗口读上下文,输出自动提示中英对照路径与续读位置;替代通用 read 工具,防大文件整读。
42
+ 3. **文件工具兜底**(工具不可用时):读 `{{KB_ROOT}}/meta/topics.md` 按主题找文件;或对 `{{KB_ROOT}}/meta/search-index.json` / `{{KB_ROOT}}/site/` 用 grep 定位。
43
+ 4. **按 URL 反查**:已知线上页面 URL 时,在 `{{KB_ROOT}}/INDEX.md` 查对应本地文件。
43
44
 
44
45
  ## 3. 阅读原则
45
46