dsh-agent-plugins-market 0.9.0 → 0.9.2

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 (358) hide show
  1. package/README.md +64 -154
  2. package/README.zh.md +74 -164
  3. package/assets/dsh-agent-plugins.png +0 -0
  4. package/client/client.js +5371 -1085
  5. package/client/client.js.map +1 -1
  6. package/lib/index.js +2 -257
  7. package/lib/{application → packages/market-bundle/src/application}/catalog.js +207 -41
  8. package/lib/{application → packages/market-bundle/src/application}/details.js +73 -29
  9. package/lib/packages/market-bundle/src/application/extension-inventory.js +408 -0
  10. package/lib/packages/market-bundle/src/application/extension-project.js +64 -0
  11. package/lib/packages/market-bundle/src/application/resource-inventory.js +96 -0
  12. package/lib/packages/market-bundle/src/application/server-config.js +9 -0
  13. package/lib/packages/market-bundle/src/application/suite-queries.js +86 -0
  14. package/lib/packages/market-bundle/src/index.js +372 -0
  15. package/lib/{runtime/host → packages/market-bundle/src/platform}/feedback-tool.js +2 -2
  16. package/lib/{runtime/host → packages/market-bundle/src/platform}/settings-namespace.js +55 -7
  17. package/lib/packages/market-bundle/src/platform/settings-schema.js +25 -0
  18. package/lib/packages/market-bundle/src/routes-extension-presets.js +161 -0
  19. package/lib/packages/market-bundle/src/routes-resources.js +127 -0
  20. package/lib/{routes.js → packages/market-bundle/src/routes.js} +225 -21
  21. package/lib/packages/market-bundle/src/runtime-adapters.js +57 -0
  22. package/lib/packages/market-bundle/src/session-extension.js +337 -0
  23. package/lib/{application → packages/market-catalog/src/application}/catalog-context.js +7 -4
  24. package/lib/{application → packages/market-catalog/src/application}/install-store.js +3 -3
  25. package/lib/{application → packages/market-catalog/src/application}/snapshot-cache.js +100 -11
  26. package/lib/{application → packages/market-catalog/src/application}/source-store.js +24 -11
  27. package/lib/{application → packages/market-catalog/src/application}/state/state-store.js +1 -1
  28. package/lib/{application → packages/market-catalog/src/application}/state/storage-migration.js +1 -1
  29. package/lib/packages/market-catalog/src/index.js +19 -0
  30. package/lib/{catalog → packages/market-catalog/src/scanning}/archive.js +1 -1
  31. package/lib/{catalog → packages/market-catalog/src/scanning}/codex-mcp.js +1 -1
  32. package/lib/{catalog → packages/market-catalog/src/scanning}/component-files.js +2 -2
  33. package/lib/{catalog → packages/market-catalog/src/scanning}/manifests.js +2 -2
  34. package/lib/{catalog → packages/market-catalog/src/scanning}/native-project.js +1 -1
  35. package/lib/{catalog → packages/market-catalog/src/scanning}/paths.js +1 -1
  36. package/lib/{catalog → packages/market-catalog/src/scanning}/plugin-variables.js +21 -1
  37. package/lib/{catalog → packages/market-catalog/src/scanning}/scan-resolvers.js +35 -2
  38. package/lib/{catalog → packages/market-catalog/src/scanning}/skills-parse.js +40 -10
  39. package/lib/{catalog → packages/market-catalog/src/scanning}/validate.js +15 -2
  40. package/lib/packages/market-contracts/src/contracts/extension-presets.js +125 -0
  41. package/lib/{contracts → packages/market-contracts/src/contracts}/market.js +33 -5
  42. package/lib/packages/market-contracts/src/contracts/mcp-overrides.js +2 -0
  43. package/lib/packages/market-contracts/src/contracts/resource-window.js +29 -0
  44. package/lib/packages/market-contracts/src/contracts/settings.js +130 -0
  45. package/lib/packages/market-contracts/src/contracts/surface-toggles.js +29 -0
  46. package/lib/packages/market-contracts/src/contracts/translation.js +28 -0
  47. package/lib/packages/market-contracts/src/index.js +4 -0
  48. package/lib/{model → packages/market-contracts/src/model}/layouts.js +11 -0
  49. package/lib/{application → packages/market-contracts/src/ports}/ports.js +3 -0
  50. package/lib/{application/mcp/mcp-redaction.js → packages/market-contracts/src/redaction.js} +17 -1
  51. package/lib/{application → packages/market-lsp/src/application}/lsp/lsp-direct-config.js +2 -2
  52. package/lib/{application → packages/market-lsp/src/application}/lsp/lsp-server-state.js +1 -1
  53. package/lib/{application → packages/market-lsp/src/application}/lsp/lsp-status.js +20 -3
  54. package/lib/{application → packages/market-lsp/src/application}/lsp/profile-seam.js +1 -1
  55. package/lib/packages/market-lsp/src/application/lsp/validation.js +46 -0
  56. package/lib/{application → packages/market-lsp/src/application}/lsp-service.js +61 -3
  57. package/lib/packages/market-lsp/src/index.js +8 -0
  58. package/lib/{runtime → packages/market-lsp/src/runtime}/lsp/lsp-mounts.js +79 -40
  59. package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-backend.js +0 -16
  60. package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-config.js +104 -21
  61. package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-direct-config.js +12 -4
  62. package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-overrides.js +4 -4
  63. package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-status.js +49 -10
  64. package/lib/packages/market-mcp/src/application/mcp/validation.js +63 -0
  65. package/lib/{application → packages/market-mcp/src/application}/mcp-service.js +111 -91
  66. package/lib/packages/market-mcp/src/index.js +10 -0
  67. package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/bridge.js +12 -9
  68. package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/connection.js +1 -1
  69. package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/oauth.js +1 -1
  70. package/lib/packages/market-mcp/src/runtime/mcp/bridge/tool-ownership.js +26 -0
  71. package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/tools.js +1 -1
  72. package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-auth-record.js +35 -4
  73. package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-mounts.js +35 -4
  74. package/lib/packages/market-runtime/src/adapter-contracts.js +1 -0
  75. package/lib/packages/market-runtime/src/application/command-resources.js +74 -0
  76. package/lib/packages/market-runtime/src/application/extension-authorization.js +27 -0
  77. package/lib/packages/market-runtime/src/application/extension-hook-selection.js +56 -0
  78. package/lib/packages/market-runtime/src/application/extension-suite-declarations.js +57 -0
  79. package/lib/packages/market-runtime/src/application/extension-suite-selection.js +84 -0
  80. package/lib/packages/market-runtime/src/application/fs-probe.js +43 -0
  81. package/lib/packages/market-runtime/src/application/panel-resources.js +370 -0
  82. package/lib/{application → packages/market-runtime/src/application}/panels/user-hooks.js +2 -2
  83. package/lib/{application → packages/market-runtime/src/application}/panels/user-store.js +53 -13
  84. package/lib/{application → packages/market-runtime/src/application}/project-agent-roles.js +20 -11
  85. package/lib/packages/market-runtime/src/application/state/extension-presets.js +144 -0
  86. package/lib/packages/market-runtime/src/application/state/resource-favorites.js +90 -0
  87. package/lib/packages/market-runtime/src/application/state/resource-filters.js +2 -0
  88. package/lib/packages/market-runtime/src/application/state/surface-toggles.js +10 -0
  89. package/lib/packages/market-runtime/src/application/state/workspace-policy.js +56 -0
  90. package/lib/packages/market-runtime/src/catalog-port.js +1 -0
  91. package/lib/packages/market-runtime/src/extension-service.js +1 -0
  92. package/lib/packages/market-runtime/src/index.js +31 -0
  93. package/lib/{runtime → packages/market-runtime/src/runtime}/agents/agent-role-router.js +74 -79
  94. package/lib/packages/market-runtime/src/runtime/agents/agent-teams-seat.js +58 -0
  95. package/lib/{runtime → packages/market-runtime/src/runtime}/agents/subagent-catalog.js +89 -21
  96. package/lib/packages/market-runtime/src/runtime/agents/team-coordination.js +51 -0
  97. package/lib/packages/market-runtime/src/runtime/agents/teammate-role-runtime.js +241 -0
  98. package/lib/packages/market-runtime/src/runtime/agents/teammate-role-tool.js +130 -0
  99. package/lib/{runtime → packages/market-runtime/src/runtime}/core/reconcile-scheduler.js +2 -2
  100. package/lib/packages/market-runtime/src/runtime/core/reconciler.js +457 -0
  101. package/lib/packages/market-runtime/src/runtime/host/command-name-allocator.js +168 -0
  102. package/lib/packages/market-runtime/src/runtime/host/extension-progress.js +120 -0
  103. package/lib/packages/market-runtime/src/runtime/host/extension-runtime.js +405 -0
  104. package/lib/packages/market-runtime/src/runtime/host/extension-session-state.js +839 -0
  105. package/lib/packages/market-runtime/src/runtime/host/extension-tool-gates.js +96 -0
  106. package/lib/{runtime → packages/market-runtime/src/runtime}/host/failure-detail.js +1 -1
  107. package/lib/{runtime → packages/market-runtime/src/runtime}/host/host-locale.js +2 -0
  108. package/lib/packages/market-runtime/src/runtime/host/menu-row-identities.js +38 -0
  109. package/lib/packages/market-runtime/src/runtime/host/resource-filter-service.js +81 -0
  110. package/lib/packages/market-runtime/src/runtime/host/scoped-contributors.js +304 -0
  111. package/lib/packages/market-runtime/src/runtime/host/surface-toggle-service.js +15 -0
  112. package/lib/packages/market-runtime/src/runtime/panels/user-commands.js +211 -0
  113. package/lib/{runtime → packages/market-runtime/src/runtime}/panels/user-panels.js +34 -14
  114. package/lib/packages/market-runtime/src/runtime/surfaces/commands-mounts.js +256 -0
  115. package/lib/packages/market-runtime/src/runtime/surfaces/extension-hooks.js +294 -0
  116. package/lib/packages/market-runtime/src/runtime/surfaces/hook-dry-run.js +122 -0
  117. package/lib/{runtime → packages/market-runtime/src/runtime}/surfaces/hooks-mounts.js +1 -1
  118. package/lib/{runtime → packages/market-runtime/src/runtime}/surfaces/project-runtime.js +23 -13
  119. package/lib/packages/market-runtime/src/runtime/surfaces/skills-provider.js +241 -0
  120. package/lib/packages/market-translation/src/application/state/translation-cache.js +122 -0
  121. package/lib/packages/market-translation/src/application/translation/chain.js +99 -0
  122. package/lib/packages/market-translation/src/application/translation/document.js +384 -0
  123. package/lib/packages/market-translation/src/application/translation/localizer.js +642 -0
  124. package/lib/packages/market-translation/src/application/translation/service.js +113 -0
  125. package/lib/packages/market-translation/src/application/translation/unit.js +19 -0
  126. package/lib/packages/market-translation/src/index.js +4 -0
  127. package/lib/packages/market-translation/src/runtime/host/llm-translator.js +278 -0
  128. package/lib/packages/market-translation/src/runtime/host/machine-translator.js +152 -0
  129. package/lib/packages/market-translation/src/runtime/host/text-masking.js +96 -0
  130. package/lib/packages/market-translation/src/runtime/host/translation-providers.js +116 -0
  131. package/lib/types/index.d.ts +2 -130
  132. package/lib/types/{application → packages/market-bundle/src/application}/catalog.d.ts +117 -22
  133. package/lib/types/packages/market-bundle/src/application/details.d.ts +24 -0
  134. package/lib/types/packages/market-bundle/src/application/extension-inventory.d.ts +45 -0
  135. package/lib/types/packages/market-bundle/src/application/extension-project.d.ts +26 -0
  136. package/lib/types/packages/market-bundle/src/application/resource-inventory.d.ts +42 -0
  137. package/lib/types/packages/market-bundle/src/application/server-config.d.ts +9 -0
  138. package/lib/types/packages/market-bundle/src/application/suite-queries.d.ts +84 -0
  139. package/lib/types/packages/market-bundle/src/index.d.ts +125 -0
  140. package/lib/types/{runtime/host → packages/market-bundle/src/platform}/settings-namespace.d.ts +44 -9
  141. package/lib/types/{application/mcp/mcp-backend.d.ts → packages/market-bundle/src/platform/settings-schema.d.ts} +13 -28
  142. package/lib/types/packages/market-bundle/src/routes-extension-presets.d.ts +15 -0
  143. package/lib/types/packages/market-bundle/src/routes-resources.d.ts +17 -0
  144. package/lib/types/packages/market-bundle/src/routes.d.ts +32 -0
  145. package/lib/types/packages/market-bundle/src/runtime-adapters.d.ts +42 -0
  146. package/lib/types/packages/market-bundle/src/session-extension.d.ts +62 -0
  147. package/lib/types/{application → packages/market-catalog/src/application}/catalog-context.d.ts +11 -3
  148. package/lib/types/{application → packages/market-catalog/src/application}/install-store.d.ts +1 -1
  149. package/lib/types/{application → packages/market-catalog/src/application}/regions.d.ts +1 -1
  150. package/lib/types/{application → packages/market-catalog/src/application}/snapshot-cache.d.ts +44 -2
  151. package/lib/types/{application → packages/market-catalog/src/application}/source-store.d.ts +12 -3
  152. package/lib/types/{application → packages/market-catalog/src/application}/state/state-store.d.ts +1 -1
  153. package/lib/types/packages/market-catalog/src/index.d.ts +22 -0
  154. package/lib/types/{catalog → packages/market-catalog/src/scanning}/archive.d.ts +1 -1
  155. package/lib/types/{catalog → packages/market-catalog/src/scanning}/codex-mcp.d.ts +1 -1
  156. package/lib/types/{catalog → packages/market-catalog/src/scanning}/component-files.d.ts +1 -1
  157. package/lib/types/{catalog → packages/market-catalog/src/scanning}/lsp-spec.d.ts +1 -1
  158. package/lib/types/{catalog → packages/market-catalog/src/scanning}/manifests.d.ts +3 -3
  159. package/lib/types/{catalog → packages/market-catalog/src/scanning}/native-project.d.ts +2 -2
  160. package/lib/types/{catalog → packages/market-catalog/src/scanning}/plugin-variables.d.ts +12 -1
  161. package/lib/types/{catalog → packages/market-catalog/src/scanning}/project-config.d.ts +2 -2
  162. package/lib/types/{catalog → packages/market-catalog/src/scanning}/project-hooks.d.ts +2 -2
  163. package/lib/types/{catalog → packages/market-catalog/src/scanning}/scan-pipeline.d.ts +1 -1
  164. package/lib/types/{catalog → packages/market-catalog/src/scanning}/scan-resolvers.d.ts +3 -3
  165. package/lib/types/{catalog → packages/market-catalog/src/scanning}/source-catalog.d.ts +1 -1
  166. package/lib/types/{catalog → packages/market-catalog/src/scanning}/suite-components.d.ts +1 -1
  167. package/lib/types/{catalog → packages/market-catalog/src/scanning}/suite-scanner.d.ts +1 -1
  168. package/lib/types/{catalog → packages/market-catalog/src/scanning}/surfaces.d.ts +1 -1
  169. package/lib/types/{catalog → packages/market-catalog/src/scanning}/validate.d.ts +1 -1
  170. package/lib/types/packages/market-contracts/src/contracts/extension-presets.d.ts +237 -0
  171. package/lib/types/{contracts → packages/market-contracts/src/contracts}/market.d.ts +87 -16
  172. package/lib/types/packages/market-contracts/src/contracts/mcp-overrides.d.ts +39 -0
  173. package/lib/types/{contracts → packages/market-contracts/src/contracts}/mcp-status.d.ts +9 -0
  174. package/lib/types/packages/market-contracts/src/contracts/resource-window.d.ts +70 -0
  175. package/lib/types/packages/market-contracts/src/contracts/settings.d.ts +121 -0
  176. package/lib/types/packages/market-contracts/src/contracts/surface-toggles.d.ts +28 -0
  177. package/lib/types/packages/market-contracts/src/contracts/translation.d.ts +81 -0
  178. package/lib/types/{runtime → packages/market-contracts/src}/host/plugin-message-source.d.ts +1 -1
  179. package/lib/types/packages/market-contracts/src/index.d.ts +5 -0
  180. package/lib/types/{model → packages/market-contracts/src/model}/layouts.d.ts +7 -0
  181. package/lib/types/{model → packages/market-contracts/src/model}/types.d.ts +2 -2
  182. package/lib/types/packages/market-contracts/src/ports/ports.d.ts +183 -0
  183. package/lib/types/{application → packages/market-contracts/src/ports}/queries.d.ts +27 -6
  184. package/lib/types/{application/mcp/mcp-redaction.d.ts → packages/market-contracts/src/redaction.d.ts} +2 -0
  185. package/lib/types/{application → packages/market-lsp/src/application}/lsp/lsp-direct-config.d.ts +1 -1
  186. package/lib/types/{application → packages/market-lsp/src/application}/lsp/lsp-status.d.ts +21 -5
  187. package/lib/types/packages/market-lsp/src/application/lsp/validation.d.ts +8 -0
  188. package/lib/types/{application → packages/market-lsp/src/application}/lsp-service.d.ts +19 -6
  189. package/lib/types/packages/market-lsp/src/index.d.ts +8 -0
  190. package/lib/types/{runtime → packages/market-lsp/src/runtime}/lsp/lsp-mounts.d.ts +26 -6
  191. package/lib/types/packages/market-mcp/src/application/mcp/mcp-backend.d.ts +28 -0
  192. package/lib/types/{application → packages/market-mcp/src/application}/mcp/mcp-bridge-config.d.ts +1 -1
  193. package/lib/types/{application → packages/market-mcp/src/application}/mcp/mcp-config.d.ts +2 -2
  194. package/lib/types/{application → packages/market-mcp/src/application}/mcp/mcp-direct-config.d.ts +6 -1
  195. package/lib/types/{application → packages/market-mcp/src/application}/mcp/mcp-overrides.d.ts +4 -38
  196. package/lib/types/packages/market-mcp/src/application/mcp/mcp-status.d.ts +40 -0
  197. package/lib/types/{application/server-config.d.ts → packages/market-mcp/src/application/mcp/validation.d.ts} +2 -10
  198. package/lib/types/{application → packages/market-mcp/src/application}/mcp-service.d.ts +22 -16
  199. package/lib/types/packages/market-mcp/src/index.d.ts +12 -0
  200. package/lib/types/packages/market-mcp/src/runtime/mcp/bridge/tool-ownership.d.ts +14 -0
  201. package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-auth-record.d.ts +4 -0
  202. package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-mounts.d.ts +19 -3
  203. package/lib/types/packages/market-runtime/src/adapter-contracts.d.ts +89 -0
  204. package/lib/types/{application → packages/market-runtime/src/application}/agent-roles.d.ts +2 -0
  205. package/lib/types/packages/market-runtime/src/application/command-resources.d.ts +26 -0
  206. package/lib/types/packages/market-runtime/src/application/extension-authorization.d.ts +12 -0
  207. package/lib/types/packages/market-runtime/src/application/extension-hook-selection.d.ts +23 -0
  208. package/lib/types/packages/market-runtime/src/application/extension-suite-declarations.d.ts +10 -0
  209. package/lib/types/packages/market-runtime/src/application/extension-suite-selection.d.ts +30 -0
  210. package/lib/types/packages/market-runtime/src/application/fs-probe.d.ts +12 -0
  211. package/lib/types/packages/market-runtime/src/application/panel-resources.d.ts +100 -0
  212. package/lib/types/{application → packages/market-runtime/src/application}/panels/user-hooks.d.ts +1 -1
  213. package/lib/types/packages/market-runtime/src/application/project-agent-roles.d.ts +10 -0
  214. package/lib/types/packages/market-runtime/src/application/state/extension-presets.d.ts +24 -0
  215. package/lib/types/packages/market-runtime/src/application/state/resource-favorites.d.ts +9 -0
  216. package/lib/types/packages/market-runtime/src/application/state/resource-filters.d.ts +2 -0
  217. package/lib/types/packages/market-runtime/src/application/state/surface-toggles.d.ts +6 -0
  218. package/lib/types/packages/market-runtime/src/application/state/workspace-policy.d.ts +19 -0
  219. package/lib/types/packages/market-runtime/src/catalog-port.d.ts +30 -0
  220. package/lib/types/packages/market-runtime/src/extension-service.d.ts +14 -0
  221. package/lib/types/packages/market-runtime/src/index.d.ts +41 -0
  222. package/lib/types/{runtime → packages/market-runtime/src/runtime}/agents/agent-role-router.d.ts +66 -31
  223. package/lib/types/packages/market-runtime/src/runtime/agents/agent-teams-seat.d.ts +41 -0
  224. package/lib/types/{runtime → packages/market-runtime/src/runtime}/agents/subagent-catalog.d.ts +34 -2
  225. package/lib/types/packages/market-runtime/src/runtime/agents/team-coordination.d.ts +8 -0
  226. package/lib/types/packages/market-runtime/src/runtime/agents/teammate-role-runtime.d.ts +74 -0
  227. package/lib/types/packages/market-runtime/src/runtime/agents/teammate-role-tool.d.ts +6 -0
  228. package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/reconcile-scheduler.d.ts +5 -2
  229. package/lib/types/packages/market-runtime/src/runtime/core/reconciler.d.ts +141 -0
  230. package/lib/types/packages/market-runtime/src/runtime/host/command-name-allocator.d.ts +132 -0
  231. package/lib/types/packages/market-runtime/src/runtime/host/extension-progress.d.ts +91 -0
  232. package/lib/types/packages/market-runtime/src/runtime/host/extension-runtime.d.ts +77 -0
  233. package/lib/types/packages/market-runtime/src/runtime/host/extension-session-state.d.ts +242 -0
  234. package/lib/types/packages/market-runtime/src/runtime/host/extension-tool-gates.d.ts +38 -0
  235. package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/host-locale.d.ts +1 -1
  236. package/lib/types/packages/market-runtime/src/runtime/host/menu-row-identities.d.ts +50 -0
  237. package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/model-catalog.d.ts +1 -1
  238. package/lib/types/packages/market-runtime/src/runtime/host/resource-filter-service.d.ts +34 -0
  239. package/lib/types/packages/market-runtime/src/runtime/host/scoped-contributors.d.ts +58 -0
  240. package/lib/types/packages/market-runtime/src/runtime/host/surface-toggle-service.d.ts +10 -0
  241. package/lib/types/packages/market-runtime/src/runtime/panels/user-commands.d.ts +74 -0
  242. package/lib/types/{runtime → packages/market-runtime/src/runtime}/panels/user-panels.d.ts +7 -1
  243. package/lib/types/packages/market-runtime/src/runtime/surfaces/commands-mounts.d.ts +81 -0
  244. package/lib/types/packages/market-runtime/src/runtime/surfaces/extension-hooks.d.ts +59 -0
  245. package/lib/types/packages/market-runtime/src/runtime/surfaces/hook-dry-run.d.ts +91 -0
  246. package/lib/types/{runtime → packages/market-runtime/src/runtime}/surfaces/hooks-mounts.d.ts +1 -1
  247. package/lib/types/{runtime → packages/market-runtime/src/runtime}/surfaces/project-runtime.d.ts +8 -5
  248. package/lib/types/packages/market-runtime/src/runtime/surfaces/skills-provider.d.ts +71 -0
  249. package/lib/types/packages/market-translation/src/application/state/translation-cache.d.ts +56 -0
  250. package/lib/types/packages/market-translation/src/application/translation/chain.d.ts +47 -0
  251. package/lib/types/packages/market-translation/src/application/translation/document.d.ts +54 -0
  252. package/lib/types/packages/market-translation/src/application/translation/localizer.d.ts +325 -0
  253. package/lib/types/packages/market-translation/src/application/translation/service.d.ts +89 -0
  254. package/lib/types/packages/market-translation/src/application/translation/unit.d.ts +35 -0
  255. package/lib/types/packages/market-translation/src/index.d.ts +4 -0
  256. package/lib/types/packages/market-translation/src/runtime/host/llm-translator.d.ts +30 -0
  257. package/lib/types/packages/market-translation/src/runtime/host/machine-translator.d.ts +52 -0
  258. package/lib/types/packages/market-translation/src/runtime/host/text-masking.d.ts +42 -0
  259. package/lib/types/packages/market-translation/src/runtime/host/translation-providers.d.ts +42 -0
  260. package/locale/en.json +6 -0
  261. package/locale/zh.json +6 -0
  262. package/package.json +47 -10
  263. package/schemas/README.md +4 -4
  264. package/schemas/agent-plugins/spec.md +2 -2
  265. package/schemas/com.deepseek.harness/spec.md +1 -1
  266. package/schemas/skill-collection/spec.md +10 -2
  267. package/lib/application/panel-resources.js +0 -161
  268. package/lib/application/server-config.js +0 -109
  269. package/lib/contracts/settings.js +0 -63
  270. package/lib/runtime/core/reconciler.js +0 -100
  271. package/lib/runtime/panels/user-commands.js +0 -105
  272. package/lib/runtime/surfaces/commands-mounts.js +0 -186
  273. package/lib/runtime/surfaces/skills-provider.js +0 -160
  274. package/lib/types/application/details.d.ts +0 -7
  275. package/lib/types/application/mcp/mcp-status.d.ts +0 -24
  276. package/lib/types/application/panel-resources.d.ts +0 -28
  277. package/lib/types/application/ports.d.ts +0 -86
  278. package/lib/types/application/project-agent-roles.d.ts +0 -3
  279. package/lib/types/contracts/settings.d.ts +0 -59
  280. package/lib/types/routes.d.ts +0 -16
  281. package/lib/types/runtime/core/reconciler.d.ts +0 -58
  282. package/lib/types/runtime/panels/user-commands.d.ts +0 -27
  283. package/lib/types/runtime/surfaces/commands-mounts.d.ts +0 -48
  284. package/lib/types/runtime/surfaces/skills-provider.d.ts +0 -23
  285. /package/lib/{application → packages/market-catalog/src/application}/deadline.js +0 -0
  286. /package/lib/{application → packages/market-catalog/src/application}/json-file.js +0 -0
  287. /package/lib/{application → packages/market-catalog/src/application}/regions.js +0 -0
  288. /package/lib/{catalog → packages/market-catalog/src/scanning}/fs-probes.js +0 -0
  289. /package/lib/{catalog → packages/market-catalog/src/scanning}/git.js +0 -0
  290. /package/lib/{catalog → packages/market-catalog/src/scanning}/lsp-spec.js +0 -0
  291. /package/lib/{catalog → packages/market-catalog/src/scanning}/project-config.js +0 -0
  292. /package/lib/{catalog → packages/market-catalog/src/scanning}/project-hooks.js +0 -0
  293. /package/lib/{catalog → packages/market-catalog/src/scanning}/scan-pipeline.js +0 -0
  294. /package/lib/{catalog → packages/market-catalog/src/scanning}/source-catalog.js +0 -0
  295. /package/lib/{catalog → packages/market-catalog/src/scanning}/suite-components.js +0 -0
  296. /package/lib/{catalog → packages/market-catalog/src/scanning}/suite-scanner.js +0 -0
  297. /package/lib/{catalog → packages/market-catalog/src/scanning}/surfaces.js +0 -0
  298. /package/lib/{contracts → packages/market-contracts/src/contracts}/lsp-status.js +0 -0
  299. /package/lib/{contracts → packages/market-contracts/src/contracts}/lsp.js +0 -0
  300. /package/lib/{contracts → packages/market-contracts/src/contracts}/mcp-status.js +0 -0
  301. /package/lib/{contracts → packages/market-contracts/src/contracts}/mcp.js +0 -0
  302. /package/lib/{runtime → packages/market-contracts/src}/host/plugin-message-source.js +0 -0
  303. /package/lib/{model → packages/market-contracts/src/model}/command-names.js +0 -0
  304. /package/lib/{model → packages/market-contracts/src/model}/preset-source.js +0 -0
  305. /package/lib/{model → packages/market-contracts/src/model}/types.js +0 -0
  306. /package/lib/{application → packages/market-contracts/src/ports}/queries.js +0 -0
  307. /package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-bridge-config.js +0 -0
  308. /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/host-contract.js +0 -0
  309. /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/host-seams.js +0 -0
  310. /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/plugin-identity.js +0 -0
  311. /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/projection.js +0 -0
  312. /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/transport.js +0 -0
  313. /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-credentials.js +0 -0
  314. /package/lib/{application → packages/market-runtime/src/application}/agent-roles.js +0 -0
  315. /package/lib/{runtime → packages/market-runtime/src/runtime}/agents/agent-role-names.js +0 -0
  316. /package/lib/{runtime → packages/market-runtime/src/runtime}/core/context.js +0 -0
  317. /package/lib/{runtime → packages/market-runtime/src/runtime}/core/mount-lifecycle.js +0 -0
  318. /package/lib/{runtime → packages/market-runtime/src/runtime}/core/source-auto-update.js +0 -0
  319. /package/lib/{runtime → packages/market-runtime/src/runtime}/core/timer-seat.js +0 -0
  320. /package/lib/{runtime → packages/market-runtime/src/runtime}/host/model-catalog.js +0 -0
  321. /package/lib/{runtime → packages/market-runtime/src/runtime}/host/shell-path.js +0 -0
  322. /package/lib/{runtime → packages/market-runtime/src/runtime}/host/tool-registry-observer.js +0 -0
  323. /package/lib/{runtime → packages/market-runtime/src/runtime}/surfaces/dynamic-context.js +0 -0
  324. /package/lib/types/{runtime/host → packages/market-bundle/src/platform}/feedback-tool.d.ts +0 -0
  325. /package/lib/types/{application → packages/market-catalog/src/application}/deadline.d.ts +0 -0
  326. /package/lib/types/{application → packages/market-catalog/src/application}/json-file.d.ts +0 -0
  327. /package/lib/types/{application → packages/market-catalog/src/application}/state/storage-migration.d.ts +0 -0
  328. /package/lib/types/{catalog → packages/market-catalog/src/scanning}/fs-probes.d.ts +0 -0
  329. /package/lib/types/{catalog → packages/market-catalog/src/scanning}/git.d.ts +0 -0
  330. /package/lib/types/{catalog → packages/market-catalog/src/scanning}/paths.d.ts +0 -0
  331. /package/lib/types/{catalog → packages/market-catalog/src/scanning}/skills-parse.d.ts +0 -0
  332. /package/lib/types/{contracts → packages/market-contracts/src/contracts}/lsp-status.d.ts +0 -0
  333. /package/lib/types/{contracts → packages/market-contracts/src/contracts}/lsp.d.ts +0 -0
  334. /package/lib/types/{contracts → packages/market-contracts/src/contracts}/mcp.d.ts +0 -0
  335. /package/lib/types/{model → packages/market-contracts/src/model}/command-names.d.ts +0 -0
  336. /package/lib/types/{model → packages/market-contracts/src/model}/preset-source.d.ts +0 -0
  337. /package/lib/types/{application → packages/market-lsp/src/application}/lsp/lsp-server-state.d.ts +0 -0
  338. /package/lib/types/{application → packages/market-lsp/src/application}/lsp/profile-seam.d.ts +0 -0
  339. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/bridge.d.ts +0 -0
  340. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/connection.d.ts +0 -0
  341. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/host-contract.d.ts +0 -0
  342. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/host-seams.d.ts +0 -0
  343. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/oauth.d.ts +0 -0
  344. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/plugin-identity.d.ts +0 -0
  345. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/projection.d.ts +0 -0
  346. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/tools.d.ts +0 -0
  347. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/transport.d.ts +0 -0
  348. /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-credentials.d.ts +0 -0
  349. /package/lib/types/{application → packages/market-runtime/src/application}/panels/user-store.d.ts +0 -0
  350. /package/lib/types/{runtime → packages/market-runtime/src/runtime}/agents/agent-role-names.d.ts +0 -0
  351. /package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/context.d.ts +0 -0
  352. /package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/mount-lifecycle.d.ts +0 -0
  353. /package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/source-auto-update.d.ts +0 -0
  354. /package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/timer-seat.d.ts +0 -0
  355. /package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/failure-detail.d.ts +0 -0
  356. /package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/shell-path.d.ts +0 -0
  357. /package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/tool-registry-observer.d.ts +0 -0
  358. /package/lib/types/{runtime → packages/market-runtime/src/runtime}/surfaces/dynamic-context.d.ts +0 -0
@@ -0,0 +1,96 @@
1
+ const PANEL_FACE = { skills: 'skills', commands: 'commands', agents: 'agents' };
2
+ /** Build one window payload from the live stores. */
3
+ export async function buildResourceWindow(deps) {
4
+ const [overview, mcp, lsp, skills, commands, agents, favorites] = await Promise.all([
5
+ deps.catalog.overview(),
6
+ deps.catalog.mcpStatus(),
7
+ deps.catalog.lspStatus(),
8
+ deps.panels.skills.list(),
9
+ deps.panels.commands.list(),
10
+ deps.panels.agents.list(),
11
+ deps.filters.favorites()
12
+ ]);
13
+ const filters = deps.filters.currentFilters();
14
+ // The row state is the conjunction of the two levels: the user-level
15
+ // (global) state the settings pages control, and this workspace's own
16
+ // filter. The window mirrors global while it follows it and can only
17
+ // filter further, never re-enable what the user level turned off.
18
+ const enabled = (face, entryId) => !(filters.offEntries[face]?.includes(entryId) ?? false);
19
+ const entries = [];
20
+ // Market tab: installed suites (user dimension), one row per suite.
21
+ for (const suite of overview.suites) {
22
+ if (!suite.installed || suite.dimension !== 'user')
23
+ continue;
24
+ const id = `market:${suite.sourceId}/${suite.suiteId}`;
25
+ entries.push({
26
+ id,
27
+ face: 'market',
28
+ name: suite.name,
29
+ ...(suite.version === undefined ? {} : { version: suite.version }),
30
+ source: suite.sourceId,
31
+ description: suite.description,
32
+ counts: [
33
+ { label: 'skills', count: suite.surfaces.skills },
34
+ { label: 'mcp', count: suite.surfaces.mcp },
35
+ { label: 'hooks', count: suite.surfaces.hooks },
36
+ { label: 'commands', count: suite.surfaces.commands },
37
+ { label: 'agents', count: suite.surfaces.agents },
38
+ { label: 'lsp', count: suite.surfaces.lsp }
39
+ ].filter(count => count.count > 0),
40
+ enabled: enabled('market', id) && suite.enabled !== false,
41
+ ...(suite.enabled === false ? { globalDisabled: true } : {})
42
+ });
43
+ }
44
+ // Panel faces: user entries plus suite-provided entries, one row each.
45
+ const panelRows = (kind, rows) => {
46
+ for (const entry of rows) {
47
+ const id = `${PANEL_FACE[kind]}:${entry.origin === 'plugin' ? (entry.id ?? entry.name) : entry.name}`;
48
+ const duplicate = entries.some(existing => existing.id === id);
49
+ if (duplicate)
50
+ continue;
51
+ entries.push({
52
+ id,
53
+ face: PANEL_FACE[kind],
54
+ name: entry.name,
55
+ source: entry.origin === 'plugin' ? (entry.suiteName ?? 'plugin') : 'user',
56
+ description: entry.description,
57
+ enabled: enabled(PANEL_FACE[kind], id) && !entry.disabled,
58
+ ...(entry.disabled === true ? { globalDisabled: true } : {})
59
+ });
60
+ }
61
+ };
62
+ panelRows('skills', skills);
63
+ panelRows('commands', commands);
64
+ panelRows('agents', agents);
65
+ // MCP tab: every row the status surface reports (suite and direct).
66
+ for (const row of mcp.entries) {
67
+ const id = `mcp:${row.name}`;
68
+ entries.push({
69
+ id,
70
+ face: 'mcp',
71
+ name: row.name,
72
+ source: row.source ?? 'direct',
73
+ description: row.transport,
74
+ enabled: enabled('mcp', id) && row.state !== 'disabled',
75
+ ...(row.state === 'disabled' ? { globalDisabled: true } : {})
76
+ });
77
+ }
78
+ // LSP tab: every row the LSP status surface reports (suite and direct).
79
+ for (const row of lsp.entries) {
80
+ const id = `lsp:${row.id}`;
81
+ entries.push({
82
+ id,
83
+ face: 'lsp',
84
+ name: row.serverKey,
85
+ source: row.kind === 'direct' ? 'direct' : row.suiteName,
86
+ description: row.command,
87
+ enabled: enabled('lsp', id) && row.state !== 'disabled',
88
+ ...(row.state === 'disabled' ? { globalDisabled: true } : {})
89
+ });
90
+ }
91
+ return {
92
+ workspace: deps.workspace ?? process.cwd(),
93
+ entries,
94
+ favorites
95
+ };
96
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Compatibility barrel for the service-configuration helpers that used to live
3
+ * here. Each declaration now belongs to the domain that owns it: MCP validation
4
+ * and redaction-restore to market-mcp, LSP validation and the override layer to
5
+ * market-lsp. The re-exports stay so existing importers and tests keep their
6
+ * current specifier; new code imports the owning module directly.
7
+ */
8
+ export { McpConfigError, restoreRedactedConfig, validateServerMcp } from '../../../market-mcp/src/index.js';
9
+ export { applyLspOverrides, loadLspOverrides, lspConfig, saveLspOverride, validateServerLsp } from '../../../market-lsp/src/index.js';
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Suite presentation queries: one suite's detail, one suite document, and that
3
+ * document's translation.
4
+ *
5
+ * The three reads share one lookup — a source-qualified identity resolved in the
6
+ * user snapshot, or in one project's when the caller names a workspace — and one
7
+ * presentation composed over it. They live here rather than on the facade
8
+ * because the facade composes collaborators and forwards, while these reads
9
+ * carry the rule themselves: which snapshot answers, what the detail shows, and
10
+ * how a document's translation is keyed.
11
+ *
12
+ * Every dependency arrives as a function on {@link SuiteQueryPorts}. The facade
13
+ * passes closures, so a caller that replaces one of its own methods (a test
14
+ * stubbing the localization callbacks or the user snapshot read) is still the
15
+ * one called here.
16
+ * @module application/suite-queries
17
+ */
18
+ import { qualifiedSuiteId, stripFrontmatter } from '../../../market-catalog/src/index.js';
19
+ import { loadSuiteOverrides } from '../../../market-mcp/src/index.js';
20
+ import { pluginResourceId } from '../../../market-runtime/src/index.js';
21
+ import { buildSuiteDetail, readSuiteDocument } from './details.js';
22
+ export class SuiteQueries {
23
+ ports;
24
+ constructor(ports) {
25
+ this.ports = ports;
26
+ }
27
+ /** One suite's full detail for the market detail modal. */
28
+ async suiteDetail(sourceId, suiteId, projectCwd) {
29
+ const suite = await this.suiteOf(sourceId, suiteId, projectCwd);
30
+ const suiteKey = qualifiedSuiteId(sourceId, suiteId);
31
+ const detail = await buildSuiteDetail(suite, this.ports.installed(sourceId, suiteId), this.ports.mcpDiagnostics(), await loadSuiteOverrides(this.ports.dataRoot(), suiteKey));
32
+ // The detail modal renders the same name and description as the card, so it
33
+ // takes the same translations (and queues the same cache misses).
34
+ const localized = this.ports.translateFields('market', suiteKey, { name: detail.name, description: detail.description ?? undefined }, this.ports.localePreference());
35
+ return { ...detail, ...localized.fields, ...(localized.pending > 0 ? { translationPending: localized.pending } : {}) };
36
+ }
37
+ /**
38
+ * One suite document's authored text for the market detail modal — a skill, a
39
+ * command, or an agent, all through the one reader.
40
+ *
41
+ * The suite comes from the same snapshot {@link suiteDetail} answers from, and
42
+ * the text is re-read from the checkout the scan found it in: the request
43
+ * names an identity, never a path, so this route cannot be spent on a file of
44
+ * a page's choosing.
45
+ */
46
+ async suiteDocument(sourceId, suiteId, kind, name, projectCwd) {
47
+ const suite = await this.suiteOf(sourceId, suiteId, projectCwd);
48
+ return { name, content: await readSuiteDocument(suite, kind, name) };
49
+ }
50
+ /**
51
+ * Translate one suite document for the market detail page.
52
+ *
53
+ * The suite comes from the same snapshot {@link suiteDetail} and
54
+ * {@link suiteDocument} answer from, and the document is re-read from the
55
+ * checkout the scan found it in: the request names an identity and never
56
+ * carries text, so this path cannot be spent on content of a page's choosing.
57
+ *
58
+ * The translation is keyed exactly as the user panel keys the same file
59
+ * ({@link pluginResourceId}, on the document's own surface), so one document
60
+ * is one cache entry however it was opened — whichever surface translated it
61
+ * first, the other reads it back without paying a provider again.
62
+ *
63
+ * Frontmatter is stripped for the reason the panel strips it: a provider
64
+ * asked to translate YAML answers with YAML that no longer parses. The reader
65
+ * still sees the authored block above the document, because the row renders
66
+ * the file and this section renders only its translation.
67
+ * @param sourceId - the source the suite belongs to.
68
+ * @param suiteId - the suite's id inside that source.
69
+ * @param kind - which document surface the name belongs to.
70
+ * @param name - the document's name inside that surface.
71
+ * @returns the assembled body and how many chunks are still in flight.
72
+ */
73
+ async suiteDocumentTranslation(sourceId, suiteId, kind, name, projectCwd, retry = false) {
74
+ const suite = await this.suiteOf(sourceId, suiteId, projectCwd);
75
+ const text = await readSuiteDocument(suite, kind, name);
76
+ return this.ports.translateDocument(kind, pluginResourceId(sourceId, suiteId, kind, name), stripFrontmatter(text), this.ports.localePreference(), retry);
77
+ }
78
+ /** The normalized suite a source-qualified identity names, or a miss. */
79
+ async suiteOf(sourceId, suiteId, projectCwd) {
80
+ const snapshot = projectCwd === undefined ? await this.ports.readUserCatalog() : await this.ports.readProjectCatalog(projectCwd);
81
+ const suite = snapshot.suites.find(entry => entry.sourceId === sourceId && entry.id === suiteId);
82
+ if (suite === undefined)
83
+ throw new Error(`suite "${suiteId}" not found in source "${sourceId}"`);
84
+ return suite;
85
+ }
86
+ }
@@ -0,0 +1,372 @@
1
+ /**
2
+ * dsh-agent-plugins-market host entry: the Agent Plugins Market manager.
3
+ *
4
+ * Function plugin (named exports, no default export). It registers one skill
5
+ * provider feeding enabled suites into `ctx.skills`, reconciles enabled
6
+ * suites' `mcp.json` servers into live self-built bridge mounts (stdio,
7
+ * Streamable HTTP with OAuth, and legacy SSE — no host MCP client needed),
8
+ * and mounts the market page's HTTP routes on the web server. Skills and MCP
9
+ * tools are exposed through the host's native model surfaces; this plugin
10
+ * does not register a redundant suite-inventory model tool.
11
+ *
12
+ * Requires `ctx.skills` (the dsh skill registry). MCP mounting is
13
+ * self-contained: suites' MCP servers mount through the market's own bridge
14
+ * plugin on the host `tools` registry.
15
+ */
16
+ import { createSessionExtensions } from './session-extension.js';
17
+ import z from '@deepseek-ai/schemastery';
18
+ import { MarketSettingsFields } from './platform/settings-schema.js';
19
+ import { Catalog } from './application/catalog.js';
20
+ import { settlesWithin } from '../../market-catalog/src/index.js';
21
+ import { RuntimeReconciler } from '../../market-runtime/src/index.js';
22
+ import { ReconcileScheduler } from '../../market-runtime/src/index.js';
23
+ import { MarketSettingsNamespace } from './platform/settings-namespace.js';
24
+ import { SurfaceToggleService } from '../../market-runtime/src/index.js';
25
+ import { ALL_SURFACES_ON } from '../../market-contracts/src/contracts/surface-toggles.js';
26
+ import { deleteMcpAuthGrant } from '../../market-mcp/src/index.js';
27
+ import { inspectToolRegistry, toolsServiceOf } from '../../market-runtime/src/index.js';
28
+ import { createLlmTranslator } from '../../market-translation/src/index.js';
29
+ import { createTranslationProviders } from '../../market-translation/src/index.js';
30
+ import { migratePluginStorage } from '../../market-catalog/src/index.js';
31
+ import { mountAgentRoleTool } from '../../market-runtime/src/index.js';
32
+ import { mountUnlessAgentTeams } from '../../market-runtime/src/index.js';
33
+ import { mountTeammateRoleTool } from '../../market-runtime/src/index.js';
34
+ import { mountTeamCoordination } from '../../market-runtime/src/index.js';
35
+ import { readExtensionSuiteDeclarations } from '../../market-runtime/src/index.js';
36
+ import { loadUserMcpSuite } from '../../market-mcp/src/index.js';
37
+ import { loadUserHooksSuite } from '../../market-runtime/src/index.js';
38
+ import { createPanelResources } from '../../market-runtime/src/index.js';
39
+ import { resolveAgentsRoot, resolveDataRoot, resolveUserRoot } from '../../market-catalog/src/index.js';
40
+ import { mountSuiteRoutes } from './routes.js';
41
+ import { mountResourceRoutes } from './routes-resources.js';
42
+ import { ResourceFilterService } from '../../market-runtime/src/index.js';
43
+ import { loadLspServers } from '../../market-lsp/src/index.js';
44
+ import { loadDisabledLspServers } from '../../market-lsp/src/index.js';
45
+ import { bindHostLocale, LOCALE_SETTINGS_ENTRY, readHostLocalePreference, readLocalePreference, setHostLocaleSource } from '../../market-runtime/src/index.js';
46
+ import { createUserPanelStores } from '../../market-runtime/src/index.js';
47
+ import { SourceAutoUpdater } from '../../market-runtime/src/index.js';
48
+ import { UserPanelSkillProvider } from '../../market-runtime/src/index.js';
49
+ import { collectMenuRowIdentities } from '../../market-runtime/src/index.js';
50
+ import { presetSourceRef } from '../../market-contracts/src/model/preset-source.js';
51
+ import { createRuntimeMounts } from './runtime-adapters.js';
52
+ export const name = 'dsh-agent-plugins-market';
53
+ export const inject = ['skills', 'commands'];
54
+ export const Config = z.object({
55
+ userRoot: z.union([z.string(), z.const(undefined)]),
56
+ dataRoot: z.union([z.string(), z.const(undefined)]),
57
+ sources: z.any(),
58
+ git: z.object({
59
+ proxy: z.string(),
60
+ insteadOf: z.dict(z.string(), z.any()),
61
+ timeoutMs: z.natural(),
62
+ cloneRetry: z.boolean(),
63
+ fallbackTarball: z.boolean(),
64
+ allowHttpArchives: z.boolean()
65
+ }),
66
+ mcpEnhanced: MarketSettingsFields.mcpEnhanced.volatile(),
67
+ scanProjectLayouts: MarketSettingsFields.scanProjectLayouts.volatile(),
68
+ downloadRegion: MarketSettingsFields.downloadRegion.volatile(),
69
+ feedbackEnabled: MarketSettingsFields.feedbackEnabled.volatile(),
70
+ autoUpdateSources: MarketSettingsFields.autoUpdateSources.volatile(),
71
+ translationEnabled: MarketSettingsFields.translationEnabled.volatile(),
72
+ agentPresetsEnabled: MarketSettingsFields.agentPresetsEnabled.volatile()
73
+ });
74
+ const undefinedRef = { get: () => undefined };
75
+ export async function apply(ctx, config = {
76
+ mcpEnhanced: undefinedRef,
77
+ scanProjectLayouts: undefinedRef,
78
+ downloadRegion: undefinedRef,
79
+ feedbackEnabled: undefinedRef,
80
+ autoUpdateSources: undefinedRef,
81
+ translationEnabled: undefinedRef,
82
+ agentPresetsEnabled: undefinedRef
83
+ }) {
84
+ const userRoot = resolveUserRoot(config.userRoot);
85
+ const dataRoot = resolveDataRoot(config.dataRoot, userRoot);
86
+ const agentsRoot = resolveAgentsRoot();
87
+ const migration = await migratePluginStorage(config);
88
+ if (migration.conflicts.length > 0)
89
+ throw new Error(`Plugin storage migration conflicts (original files retained): ${migration.conflicts.join(', ')}`);
90
+ let userPanelControl;
91
+ // Host runtime copy resolves from the harness `locale.preference` setting.
92
+ const hostLocale = { t: bindHostLocale(undefined) };
93
+ /**
94
+ * The host locale preference the panel and status surfaces render in.
95
+ *
96
+ * Held beside the host copy above rather than re-read per call: the host
97
+ * answers the preference by projecting every active profile entry's live
98
+ * configuration, so one read is a whole-profile scan. Both values come from
99
+ * one read and are refreshed by the same three points — activation, the
100
+ * settings service landing, and the `locale` entry's own document update — so
101
+ * the panels follow a language switch exactly as the copy the plugin renders
102
+ * does, and no per-entity read pays a projection for a value that has not
103
+ * moved. A change that fires no settings-document event leaves both stale
104
+ * together, which is the freshness the host copy already lives with.
105
+ */
106
+ let localePreference = 'zh';
107
+ const refreshHostLocale = () => {
108
+ const preference = readLocalePreference();
109
+ hostLocale.t = bindHostLocale(preference);
110
+ localePreference = preference ?? 'zh';
111
+ userPanelControl?.invalidate();
112
+ };
113
+ // The preference is the `locale` entry's live configuration, projected by the
114
+ // host settings service. Resolve that service through the store from this
115
+ // entry's own context, and register the wiring as an effect so it lives
116
+ // exactly as long as this fiber: a context captured from an injection
117
+ // callback throws `cannot get required service "settings" in inactive
118
+ // context` once a profile reload disposes that fiber, and the unhandled
119
+ // rejection ends the host. Re-read once the service lands, because it may
120
+ // mount after this plugin.
121
+ ctx.effect(() => setHostLocaleSource(() => readHostLocalePreference(ctx.get('settings'))), 'dsh-agent-plugins-market: host locale source');
122
+ refreshHostLocale();
123
+ ctx.inject(['settings'], () => {
124
+ refreshHostLocale();
125
+ });
126
+ // A language switch writes the `locale` entry's form; re-read so the copy the
127
+ // market renders follows it without a reload.
128
+ ctx.effect(() => ctx.on('settings/document-updated', (ns) => {
129
+ if (ns === LOCALE_SETTINGS_ENTRY)
130
+ refreshHostLocale();
131
+ }), 'dsh-agent-plugins-market: host locale refresh');
132
+ const runtime = new RuntimeReconciler(ctx, dataRoot, createRuntimeMounts(ctx, dataRoot), key => hostLocale.t(key));
133
+ const sessionExtensions = createSessionExtensions({ ctx, dataRoot, agentsRoot, runtime, hostLocale });
134
+ // User panel stores (skills / commands / agent personas) and their runtime
135
+ // contributions: one extra skill provider plus one command mount registry.
136
+ const panels = createUserPanelStores(agentsRoot);
137
+ let disposed = false;
138
+ const scheduler = new ReconcileScheduler(ctx, runtime, {
139
+ // Always the full enabled set. A switched-off surface is gated inside the
140
+ // reconciler's own mount branch, never by filtering here: MCP, commands and
141
+ // LSP all mount from this one snapshot, so dropping a suite for one switch
142
+ // would unmount that suite's mounts on the other two. A market-face entry
143
+ // filter is the one deliberate exception: its row IS the suite, so denying
144
+ // it in this workspace means the suite mounts nothing here — the same
145
+ // semantics as the global enable switch, one workspace deep.
146
+ enabledSuites: () => catalog.enabledUserSuites(),
147
+ declarations: () => readUserDeclarations(),
148
+ publishMcpDiagnostics: diagnostics => {
149
+ catalog.mcpDiagnostics = diagnostics;
150
+ }
151
+ });
152
+ runtime.setAgentScopedContributors();
153
+ /**
154
+ * How long the change pipeline holds the queue on one stage. A mount that
155
+ * stops responding — a stdio server that never finishes its handshake, a
156
+ * browser authorization nobody completed — delays its own surface only; the
157
+ * stage keeps running while the pipeline moves on to the next change.
158
+ */
159
+ const CHANGE_STAGE_DEADLINE_MS = 20_000;
160
+ /** Run one pipeline stage, logging its failure or its overrun instead of holding the pipeline. */
161
+ const runStage = async (stage, work) => {
162
+ const running = (async () => await work())();
163
+ void running.catch(error => {
164
+ ctx.logger?.warn(`[dsh-agent-plugins-market] ${stage} failed: ${error instanceof Error ? error.message : String(error)}`);
165
+ });
166
+ if (!(await settlesWithin(running, CHANGE_STAGE_DEADLINE_MS))) {
167
+ ctx.logger?.warn(`[dsh-agent-plugins-market] ${stage} is still running after ${CHANGE_STAGE_DEADLINE_MS}ms; the change pipeline continues without waiting for it`);
168
+ }
169
+ };
170
+ /**
171
+ * Catalog change pipeline: invalidate the derived skill and command
172
+ * surfaces, refresh the project mounts, then reconcile every runtime mount.
173
+ * `CatalogContext` schedules it in the background, so a stage that overruns
174
+ * costs freshness, never the mutation that asked for it.
175
+ */
176
+ const onChanged = async () => {
177
+ if (disposed)
178
+ return;
179
+ // A catalog change can revoke a globally managed resource, so every agent's
180
+ // cached inventory is dropped before the mounts below reconcile: the next
181
+ // authorization call denies until the new catalog has been read.
182
+ sessionExtensions.invalidate(() => userPanelControl?.invalidate());
183
+ await runStage('runtime mounts', () => scheduler.request());
184
+ await runStage('extension contributors', () => sessionExtensions.refresh());
185
+ };
186
+ // Background source updates: off until the settings switch says otherwise.
187
+ const autoUpdate = new SourceAutoUpdater(ctx, () => catalog.refreshSource());
188
+ const settings = new MarketSettingsNamespace(ctx, config, dataRoot, hostLocale, {
189
+ setScanProjectLayouts: enabled => catalog.setScanProjectLayouts(enabled),
190
+ refreshMcpMounts: () => {
191
+ void onChanged().catch(() => { });
192
+ },
193
+ setAutoUpdateSources: enabled => autoUpdate.setEnabled(enabled),
194
+ syncTranslationEnabled: () => {
195
+ catalog.syncTranslationEnabled();
196
+ }
197
+ },
198
+ // The cached preference above, not a fresh host read: the translation default
199
+ // follows the language, and this reader is called on every settings read.
200
+ () => localePreference);
201
+ // Legacy surface and entry routes share one committed workspace policy.
202
+ const resourceFilters = new ResourceFilterService(dataRoot, process.cwd(), { onFiltersChanged: onChanged });
203
+ const surfaceToggles = new SurfaceToggleService(resourceFilters);
204
+ void resourceFilters.reload().catch(error => ctx.logger.warn('workspace policy: ' + String(error)));
205
+ // The credentials store powers the MCP re-authorize action (dropping a grant
206
+ // record forces the next mount through a fresh browser authorization). Every
207
+ // port below is read at call time: this plugin's apply may run before the
208
+ // credentials, tools and settings services provision, and a snapshot taken
209
+ // here would be permanently undefined even after the service is live.
210
+ // Read at call time: the tools service provisions after apply() returns.
211
+ let toolsRegistry = toolsServiceOf(ctx);
212
+ const ports = {
213
+ mcpToolSnapshot: () => inspectToolRegistry(toolsRegistry),
214
+ credentialsStore: {
215
+ deleteGrantRecord: async (serverName) => {
216
+ const store = ctx.get?.('credentials');
217
+ await deleteMcpAuthGrant(store, serverName);
218
+ }
219
+ },
220
+ // Re-authorize must rebuild the live bridge, not just drop the grant: the
221
+ // registry flags the mount and the following reconcile tears it down and
222
+ // remounts, so the server's 401 restarts the browser authorization.
223
+ mcpRemount: (suiteId, serverKey) => runtime.forceMcpRemount(suiteId, serverKey),
224
+ mcpRemountAll: () => runtime.forceMcpRemountAll(),
225
+ mcpServerOwner: serverName => runtime.mcpServerOwner(serverName),
226
+ lspStatusSource: runtime.lsp,
227
+ mcpBackend: () => settings.backend(),
228
+ setMcpBackend: backend => settings.setBackend(backend),
229
+ downloadRegion: () => settings.downloadRegion(),
230
+ localePreference: () => localePreference,
231
+ // Read per call, like every port here: the registries change on each
232
+ // reconcile and the panels on each edit, so a snapshot would serve rows the
233
+ // menu no longer has. Attribution is by the panel's own listing, so the
234
+ // text a row translates is the text the panel already cached.
235
+ menuRowIdentities: () => collectMenuRowIdentities({
236
+ panels: resources,
237
+ commands: sessionExtensions.commandRegistrations()
238
+ }),
239
+ // Built unconditionally: every provider reads its host services per call,
240
+ // and the settings switch is read live by the localizer. Capturing the
241
+ // switch here froze it at apply time, so turning translation on after load
242
+ // left an empty chain and nothing was ever translated.
243
+ translationProviders: createTranslationProviders({ host: ctx, llm: createLlmTranslator(ctx) }),
244
+ translationEnabled: () => settings.translationEnabled(),
245
+ // Folded into every cache key. Constant while the chain is unchanged, so
246
+ // switching translation off and on again reuses what is already cached
247
+ // instead of re-paying for every text under a second key space.
248
+ translationProviderIdentity: () => 'google|microsoft|llm'
249
+ };
250
+ const catalog = new Catalog({ userRoot, dataRoot, agentsRoot, onChanged, ports, ...(config.git === undefined ? {} : { git: config.git }) });
251
+ await catalog.load();
252
+ const readUserDeclarations = async () => {
253
+ const [installed, direct] = await Promise.all([catalog.installedSuiteDeclarations(), Promise.all([loadUserMcpSuite(agentsRoot), loadUserHooksSuite(agentsRoot)])]);
254
+ return [...installed, ...(await readExtensionSuiteDeclarations(direct))];
255
+ };
256
+ // Translation is lazy by design: nothing is translated until a panel read
257
+ // asks for it, so a deployment that never opens the market pays nothing. The
258
+ // model-backed provider needs the host model services, and those provision
259
+ // *after* apply() returns, which is exactly why no warm-up is scheduled here —
260
+ // the read path resolves them per call.
261
+ // Configured seeds first, then the record this plugin presets: the market
262
+ // lists the first-party collection on the first open, and the ordinary
263
+ // refresh path clones it. Registration performs no network access.
264
+ await catalog.mergeSources([...(config.sources ?? []), presetSourceRef()]);
265
+ const resources = createPanelResources(catalog, panels);
266
+ // Session extension presets. One runtime owns the session selection, the
267
+ // route surface and the per-agent tool gates; every inventory read comes
268
+ // from the live catalog, and a catalog change re-reads it for every agent,
269
+ // so a global disable or uninstall denies the next call instead of waiting
270
+ // for a panel poll. A gate is attached per agent and only ever released for
271
+ // that agent: shared MCP/LSP servers are not torn down by one session.
272
+ // The runtime reads the agents service, so it is constructed inside the fiber
273
+ // that has it: a profile without the service never loads presets at all,
274
+ // rather than half-loading and failing every session. The routes mount from a
275
+ // scope nested in that one, so the service exists before the first request.
276
+ sessionExtensions.mount({ catalog, panels, resources, readUserDeclarations });
277
+ runtime.setMcpOverridesProvider(async () => catalog.allMcpOverrides((await readUserDeclarations()).map(candidate => candidate.suite)));
278
+ runtime.lsp.setDirectProvider(async () => {
279
+ // An empty table is the lsp-off state: the seam stays mounted (the plugin
280
+ // owns it unconditionally) but serves no servers.
281
+ const { servers } = await loadLspServers(agentsRoot);
282
+ return servers;
283
+ });
284
+ runtime.lsp.setDisabledProvider(() => loadDisabledLspServers(dataRoot));
285
+ runtime.setMcpBackendProvider(() => catalog.mcpBackend());
286
+ // The namespace must be registered after the catalog exists: the host
287
+ // resolves the inject callback synchronously when the settings service is
288
+ // already mounted, and the registration reads back the project-layout switch.
289
+ settings.mount();
290
+ ctx.inject(['tools'], toolsCtx => {
291
+ toolsRegistry = toolsCtx.tools;
292
+ // Foreign-namespace guard: a native host MCP client (or another plugin)
293
+ // owning `mcp__<serverName>__` names makes the mount registry skip its
294
+ // own server with a clear diagnostic instead of failing mid-registration.
295
+ runtime.setMcpToolNamesProvider(() => inspectToolRegistry(toolsRegistry).map(tool => tool.name));
296
+ });
297
+ void Promise.resolve()
298
+ .then(async () => {
299
+ await scheduler.request();
300
+ })
301
+ .catch(() => { });
302
+ // The global provider supplies defaults; agent-scoped providers enforce saved preset choices.
303
+ ctx.skills.registerProvider(control => {
304
+ userPanelControl = control;
305
+ return new UserPanelSkillProvider(panels.skills);
306
+ });
307
+ // Both entry points read the same live user/project role set. Team owns the
308
+ // enhanced entry's member identities and all subsequent collaboration.
309
+ const listRoles = sessionExtensions.roles;
310
+ ctx.inject(['tools', 'llm', 'subagents', 'agents'], hostCtx => {
311
+ hostCtx.effect(() => mountUnlessAgentTeams(hostCtx, () => mountAgentRoleTool(hostCtx, listRoles)), 'dsh-agent-plugins-market: agent role routing');
312
+ });
313
+ // Coordination also serves native teammates and does not depend on role discovery.
314
+ ctx.inject(['agents', 'agentTeams', 'systemPrompt'], teamCtx => {
315
+ teamCtx.effect(() => mountTeamCoordination(teamCtx), 'dsh-agent-plugins-market: Team coordination');
316
+ });
317
+ ctx.inject(['tools', 'llm', 'subagents', 'agents', 'agentTeams', 'sessions', 'sessionQuery', 'systemPrompt'], teamCtx => {
318
+ teamCtx.effect(() => mountTeammateRoleTool(teamCtx, listRoles), 'dsh-agent-plugins-market: role teammates');
319
+ });
320
+ ctx.inject(['webServer', 'loader'], hostCtx => {
321
+ // With the market switch off the market routes never mount, so the panel
322
+ // is unreachable for this workspace until the switch returns on and the
323
+ // refresh chain remounts them. The resource-window routes stay mounted
324
+ // either way: the window is the meta-surface that owns all six switches,
325
+ // and taking it down with one of them would strand the user.
326
+ hostCtx.effect(() => {
327
+ const disposeSuite = mountSuiteRoutes(hostCtx, catalog, resources, surfaceToggles, sessionExtensions.session());
328
+ const disposeResources = mountResourceRoutes(hostCtx, {
329
+ catalog,
330
+ panels: resources,
331
+ filters: resourceFilters,
332
+ workspace: process.cwd(),
333
+ setEntry: (face, entryId, enabled) => resourceFilters.setEntry(face, entryId, enabled),
334
+ applyFavorite: async (id) => {
335
+ const favorite = (await resourceFilters.favorites()).find(entry => entry.id === id);
336
+ if (favorite === undefined)
337
+ throw new Error('favorite not found');
338
+ const offEntries = {};
339
+ for (const entry of favorite.offEntries) {
340
+ const separator = entry.indexOf(':');
341
+ const face = entry.slice(0, separator);
342
+ if (!(face in favorite.surfaces))
343
+ continue;
344
+ (offEntries[face] ??= []).push(entry);
345
+ }
346
+ await resourceFilters.applyFilters(favorite.surfaces, offEntries);
347
+ },
348
+ resetWorkspace: async () => {
349
+ await resourceFilters.applyFilters({ ...ALL_SURFACES_ON }, {});
350
+ },
351
+ saveFavorite: async (name) => {
352
+ const filters = resourceFilters.currentFilters();
353
+ const offEntries = Object.entries(filters.offEntries).flatMap(([, ids]) => ids ?? []);
354
+ return (await resourceFilters.saveFavorite({ name, surfaces: filters.toggles, offEntries })).id;
355
+ },
356
+ deleteFavorite: id => resourceFilters.deleteFavorite(id)
357
+ });
358
+ return () => {
359
+ disposeSuite?.();
360
+ disposeResources();
361
+ };
362
+ }, 'dsh-agent-plugins-market: http routes');
363
+ });
364
+ ctx.effect(() => () => {
365
+ disposed = true;
366
+ scheduler.dispose();
367
+ autoUpdate.dispose();
368
+ settings.dispose();
369
+ catalog.dispose();
370
+ void runtime.dispose().catch(error => ctx.logger.warn('runtime disposal: ' + String(error)));
371
+ }, 'dsh-agent-plugins-market: lifecycle');
372
+ }
@@ -23,8 +23,8 @@ import { join } from 'node:path';
23
23
  import { promisify } from 'node:util';
24
24
  import { writeFileAtomic } from '@deepseek-ai/dsh-atomic-write';
25
25
  import { defineTool } from '@deepseek-ai/dsh-tools';
26
- import { platformBrowserOpener } from '../mcp/bridge/oauth.js';
27
- import { toolsServiceOf } from './tool-registry-observer.js';
26
+ import { platformBrowserOpener } from '../../../market-mcp/src/index.js';
27
+ import { toolsServiceOf } from '../../../market-runtime/src/index.js';
28
28
  const execFileAsync = promisify(execFile);
29
29
  /** The GitHub repository experience feedback files issues against. */
30
30
  export const FEEDBACK_REPO_OWNER = 'Sivan757';