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
@@ -21,15 +21,77 @@
21
21
  */
22
22
  import { createHash } from 'node:crypto';
23
23
  import { DEFAULT_STARTUP_TIMEOUT_MS, DEFAULT_TOOL_CALL_TIMEOUT_MS } from './mcp-bridge-config.js';
24
- import { resolveCwd } from '../../catalog/validate.js';
25
- import { qualifiedSuiteId, suiteDataDir } from '../../catalog/paths.js';
24
+ import { resolveCwd } from '../../../../market-catalog/src/index.js';
25
+ import { qualifiedSuiteId, suiteDataDir } from '../../../../market-catalog/src/index.js';
26
26
  import { applyOverride } from './mcp-overrides.js';
27
27
  import { isUserMcpSuite } from './mcp-direct-config.js';
28
- import { PLUGIN_ROOT_VARIABLES, PLUGIN_DATA_VARIABLES } from '../../model/layouts.js';
28
+ import { PLUGIN_ROOT_VARIABLES, PLUGIN_DATA_VARIABLES } from '../../../../market-contracts/src/model/layouts.js';
29
29
  /** The max length the bridge accepts for a serverName. */
30
30
  const SERVER_NAME_MAX = 32;
31
- const PLACEHOLDER = /\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g;
32
31
  const BUILTIN_PLACEHOLDERS = new Set([...PLUGIN_ROOT_VARIABLES, ...PLUGIN_DATA_VARIABLES]);
32
+ function isPlaceholderNameStart(character) {
33
+ return (character >= 'A' && character <= 'Z') || (character >= 'a' && character <= 'z') || character === '_';
34
+ }
35
+ function isPlaceholderNamePart(character) {
36
+ return isPlaceholderNameStart(character) || (character >= '0' && character <= '9');
37
+ }
38
+ /**
39
+ * Find the next reference at or after `from`.
40
+ *
41
+ * Scanned rather than matched: a value arrives from a third-party suite, and
42
+ * the pattern that described this grammar let the engine retry the fallback
43
+ * body from every `$` it saw, so a value of many `${{A:-` runs cost time
44
+ * quadratic in its length. The cursor only moves forward.
45
+ */
46
+ function nextPlaceholder(value, from) {
47
+ let cursor = from;
48
+ while (cursor < value.length) {
49
+ const start = value.indexOf('${', cursor);
50
+ if (start === -1)
51
+ return undefined;
52
+ const first = value[start + 2];
53
+ if (first === undefined || !isPlaceholderNameStart(first)) {
54
+ cursor = start + 2;
55
+ continue;
56
+ }
57
+ let at = start + 3;
58
+ while (at < value.length) {
59
+ const character = value[at];
60
+ if (character === undefined || !isPlaceholderNamePart(character))
61
+ break;
62
+ at += 1;
63
+ }
64
+ const name = value.slice(start + 2, at);
65
+ let fallback;
66
+ if (value[at] === ':' && value[at + 1] === '-') {
67
+ const close = value.indexOf('}', at + 2);
68
+ if (close === -1) {
69
+ cursor = start + 2;
70
+ continue;
71
+ }
72
+ fallback = value.slice(at + 2, close);
73
+ at = close;
74
+ }
75
+ if (value[at] !== '}') {
76
+ cursor = start + 2;
77
+ continue;
78
+ }
79
+ return { index: start, text: value.slice(start, at + 1), name, fallback };
80
+ }
81
+ return undefined;
82
+ }
83
+ /** Every reference in one value, in order. */
84
+ function placeholderMatches(value) {
85
+ const matches = [];
86
+ let cursor = 0;
87
+ for (;;) {
88
+ const match = nextPlaceholder(value, cursor);
89
+ if (match === undefined)
90
+ return matches;
91
+ matches.push(match);
92
+ cursor = match.index + match.text.length;
93
+ }
94
+ }
33
95
  /**
34
96
  * Build one mount request per supported mcp.json server, expanding built-in
35
97
  * variables (and, for user-owned data, `${NAME}` credential references)
@@ -216,10 +278,9 @@ export function credentialRefsInServer(server) {
216
278
  }
217
279
  const refs = new Set();
218
280
  for (const value of values) {
219
- for (const match of value.matchAll(PLACEHOLDER)) {
220
- const name = match[1];
221
- if (name !== undefined && !BUILTIN_PLACEHOLDERS.has(name))
222
- refs.add(name);
281
+ for (const match of placeholderMatches(value)) {
282
+ if (!BUILTIN_PLACEHOLDERS.has(match.name))
283
+ refs.add(match.name);
223
284
  }
224
285
  }
225
286
  return [...refs].sort();
@@ -343,13 +404,9 @@ function expander(suite, pluginData, resolver, portable) {
343
404
  let cursor = 0;
344
405
  let output = '';
345
406
  const missing = [];
346
- for (const match of value.matchAll(PLACEHOLDER)) {
347
- const index = match.index ?? 0;
348
- const name = match[1];
349
- if (name === undefined)
350
- continue;
407
+ for (const match of placeholderMatches(value)) {
408
+ const { index, name, fallback } = match;
351
409
  output += value.slice(cursor, index);
352
- const fallback = match[2];
353
410
  let replacement;
354
411
  if (PLUGIN_ROOT_VARIABLES.has(name))
355
412
  replacement = suite.root;
@@ -366,11 +423,11 @@ function expander(suite, pluginData, resolver, portable) {
366
423
  }
367
424
  else {
368
425
  // §9.2: unrecognized placeholder-like text stays literal.
369
- replacement = match[0];
426
+ replacement = match.text;
370
427
  }
371
428
  }
372
429
  output += replacement;
373
- cursor = index + match[0].length;
430
+ cursor = index + match.text.length;
374
431
  }
375
432
  output += value.slice(cursor);
376
433
  return { value: output, missing };
@@ -405,12 +462,38 @@ function unique(values) {
405
462
  function joinInside(root, segment) {
406
463
  return `${root.replace(/[\\/]$/, '')}/${segment}`;
407
464
  }
408
- /** Sanitize one token into `[A-Za-z0-9_-]`. */
465
+ /**
466
+ * Sanitize one token into `[A-Za-z0-9_-]`.
467
+ *
468
+ * One pass over the characters, collapsing any run of other characters into a
469
+ * single `_` and dropping leading and trailing ones. The previous chain of
470
+ * three patterns over input that arrives from a third-party suite made a
471
+ * separator-only token cost time quadratic in its length.
472
+ */
409
473
  function sanitizeToken(raw) {
410
- const cleaned = raw
411
- .replace(/[^A-Za-z0-9_-]+/g, '_')
412
- .replace(/_+/g, '_')
413
- .replace(/^_+|_+$/g, '');
474
+ const accepted = (character) => (character >= 'A' && character <= 'Z') || (character >= 'a' && character <= 'z') || (character >= '0' && character <= '9') || character === '-';
475
+ const parts = [];
476
+ let rejected = false;
477
+ for (const character of raw) {
478
+ if (character === '_' || accepted(character)) {
479
+ // `_` is both an accepted character and the replacement, so a run of them
480
+ // collapses to one, exactly as the `[^A-Za-z0-9_-]+` then `_+` pair did.
481
+ if (character === '_' && (rejected || parts[parts.length - 1] === '_'))
482
+ continue;
483
+ if (rejected && parts.length > 0)
484
+ parts.push('_');
485
+ rejected = false;
486
+ parts.push(character);
487
+ }
488
+ else {
489
+ rejected = true;
490
+ }
491
+ }
492
+ let cleaned = parts.join('');
493
+ while (cleaned.startsWith('_'))
494
+ cleaned = cleaned.slice(1);
495
+ while (cleaned.endsWith('_'))
496
+ cleaned = cleaned.slice(0, -1);
414
497
  return cleaned === '' ? 'server' : cleaned;
415
498
  }
416
499
  /**
@@ -1,7 +1,7 @@
1
1
  import { join } from 'node:path';
2
- import { readJsonFile, writeJsonDocument } from '../json-file.js';
3
- import { MCP_SCHEMA_ID, validateMcpJson } from '../../catalog/validate.js';
4
- import { effectiveSurfaces } from '../../model/types.js';
2
+ import { readJsonFile, writeJsonDocument } from '../../../../market-catalog/src/index.js';
3
+ import { MCP_SCHEMA_ID, validateMcpJson } from '../../../../market-catalog/src/index.js';
4
+ import { effectiveSurfaces } from '../../../../market-contracts/src/model/types.js';
5
5
  export const USER_MCP_SOURCE = '@user-mcp';
6
6
  export const USER_MCP_SUITE = 'user-mcp';
7
7
  /**
@@ -78,6 +78,14 @@ function isRecord(value) {
78
78
  }
79
79
  /** Add one service atomically; reject collisions and malformed config before writing. */
80
80
  export async function addUserMcpServer(agentsRoot, name, server) {
81
+ const publish = await prepareUserMcpServer(agentsRoot, name, server);
82
+ await publish();
83
+ }
84
+ /**
85
+ * Validate an addition without publishing it. Call the returned atomic write
86
+ * once, within the same serialized mutation, after any policy has been saved.
87
+ */
88
+ export async function prepareUserMcpServer(agentsRoot, name, server) {
81
89
  if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/.test(name))
82
90
  throw new Error('invalid MCP server name');
83
91
  const suite = await loadUserMcpSuite(agentsRoot);
@@ -87,7 +95,7 @@ export async function addUserMcpServer(agentsRoot, name, server) {
87
95
  throw new Error(`MCP server "${name}" already exists`);
88
96
  const document = { $schema: MCP_SCHEMA_ID, mcpServers: { ...suite.mcp.servers, [name]: server } };
89
97
  await validateUserMcp(agentsRoot, document);
90
- await writeJsonDocument(userMcpPath(agentsRoot), document);
98
+ return () => writeJsonDocument(userMcpPath(agentsRoot), document);
91
99
  }
92
100
  /** The user's hand-written MCP declaration file: `<agentsRoot>/mcp.json`. */
93
101
  export function userMcpPath(agentsRoot) {
@@ -12,10 +12,10 @@
12
12
  * so keys never persist in plain text.
13
13
  */
14
14
  import { join } from 'node:path';
15
- import { readJsonFile, writeJsonDocument } from '../json-file.js';
16
- import { isSensitiveKey } from './mcp-redaction.js';
17
- /** The largest timeout a bridge config and the host timer can hold. */
18
- export const MAX_TIMEOUT_MS = 2_147_483_647;
15
+ import { readJsonFile, writeJsonDocument } from '../../../../market-catalog/src/index.js';
16
+ import { isSensitiveKey } from '../../../../market-contracts/src/redaction.js';
17
+ export { MAX_TIMEOUT_MS } from '../../../../market-contracts/src/contracts/mcp-overrides.js';
18
+ import { MAX_TIMEOUT_MS } from '../../../../market-contracts/src/contracts/mcp-overrides.js';
19
19
  /** The overrides directory under the plugin data root. */
20
20
  export function overridesDir(dataRoot) {
21
21
  return join(dataRoot, 'overrides');
@@ -1,6 +1,6 @@
1
1
  import { credentialRefsInServer, effectiveMcpServers, deriveServerName } from './mcp-config.js';
2
- import { redactMcpConfig, redactUrl } from './mcp-redaction.js';
3
- import { qualifiedSuiteId } from '../../catalog/paths.js';
2
+ import { redactMcpConfig, redactUrl } from '../../../../market-contracts/src/redaction.js';
3
+ import { qualifiedSuiteId } from '../../../../market-catalog/src/index.js';
4
4
  /**
5
5
  * Whether one effective configuration supplies its own Authorization header.
6
6
  *
@@ -14,9 +14,35 @@ export function declaresAuthHeader(config) {
14
14
  return false;
15
15
  return Object.keys(headers).some(name => name.toLowerCase() === 'authorization');
16
16
  }
17
- /** Build status rows from discovered plugin MCP definitions and observed tool names. */
18
- export function buildMcpStatus(suites, diagnostics, observed, overrides = new Map()) {
17
+ /**
18
+ * Build status rows from discovered plugin MCP definitions and observed tool names.
19
+ *
20
+ * Each tool's description is translated on the way out; a service name and a
21
+ * tool's own `name` are call identifiers and are never translated. The
22
+ * callback is optional: a caller that omits it gets the upstream text, which is
23
+ * what the contract's absent translated field means.
24
+ * @param suites - the discovered suites whose MCP declarations form the inventory.
25
+ * @param diagnostics - the latest mount diagnostics, keyed by suite and server.
26
+ * @param observed - the live host tool registry snapshot.
27
+ * @param overrides - persisted per-server overrides, keyed by qualified suite id.
28
+ * @param localization - the locale this whole inventory renders in and the
29
+ * resolver bound to it, when the deployment translates at all. Resolved once by
30
+ * the caller: a server and each of its tools is localized from this one value,
31
+ * never from a fresh read of the host preference.
32
+ * @returns the status payload with every translatable field carrying its translation.
33
+ */
34
+ export function buildMcpStatus(suites, diagnostics, observed, overrides = new Map(), localization) {
19
35
  const entries = [];
36
+ // Counted so a caller can re-read until the translated text lands, exactly as
37
+ // the market overview reports its own pending count.
38
+ let translationPending = 0;
39
+ const localize = (id, fields) => {
40
+ if (localization === undefined)
41
+ return {};
42
+ const result = localization.localizeFields('mcp', id, fields, localization.locale);
43
+ translationPending += result.pending;
44
+ return result.fields;
45
+ };
20
46
  const claimedServers = new Set();
21
47
  const knownServerNames = new Set();
22
48
  const knownDefinitions = new Map();
@@ -87,7 +113,8 @@ export function buildMcpStatus(suites, diagnostics, observed, overrides = new Ma
87
113
  transport: effective.type,
88
114
  endpoint: endpointOf(effective),
89
115
  config: redactMcpConfig(effective),
90
- tools: disabled && !orphaned ? [] : observedTools(tools),
116
+ tools: disabled && !orphaned ? [] : observedTools(tools, serverName, localization === undefined ? undefined : localize),
117
+ ...(localization === undefined ? {} : localize(serverName, { name: serverName })),
91
118
  advertisedTools: tools.length > 0,
92
119
  retryable: diagnostic?.code === 'mount-failed' || diagnostic?.code === 'unmount-failed',
93
120
  ...(effective.type === 'stdio' || effective.auth !== undefined ? {} : { oauthDefault: true }),
@@ -119,7 +146,8 @@ export function buildMcpStatus(suites, diagnostics, observed, overrides = new Ma
119
146
  transport: stale.server.type,
120
147
  endpoint: endpointOf(stale.server),
121
148
  config: redactMcpConfig(stale.server),
122
- tools: observedTools(tools),
149
+ tools: observedTools(tools, serverName, localization === undefined ? undefined : localize),
150
+ ...(localization === undefined ? {} : localize(serverName, { name: serverName })),
123
151
  reason: 'MCP tools remain after this plugin was disabled or uninstalled',
124
152
  code: 'orphaned-tools',
125
153
  ...(staleRefs.length === 0 ? {} : { credentialRefs: staleRefs })
@@ -132,7 +160,8 @@ export function buildMcpStatus(suites, diagnostics, observed, overrides = new Ma
132
160
  kind: 'direct',
133
161
  state: 'connected',
134
162
  transport: 'observed',
135
- tools: observedTools(tools)
163
+ tools: observedTools(tools, serverName, localization === undefined ? undefined : localize),
164
+ ...(localization === undefined ? {} : localize(serverName, { name: serverName }))
136
165
  });
137
166
  }
138
167
  const totals = {
@@ -145,15 +174,25 @@ export function buildMcpStatus(suites, diagnostics, observed, overrides = new Ma
145
174
  disabled: entries.filter(entry => entry.state === 'disabled').length,
146
175
  foreign: entries.filter(entry => entry.state === 'foreign').length
147
176
  };
148
- return { entries, observedAt: new Date().toISOString(), totals, directObservationOnly: true };
177
+ return {
178
+ entries,
179
+ observedAt: new Date().toISOString(),
180
+ totals,
181
+ directObservationOnly: true,
182
+ ...(translationPending === 0 ? {} : { translationPending })
183
+ };
149
184
  }
150
185
  /** One tool projection for the status wire: the input schema rides along only while it stays small. */
151
186
  const MAX_SCHEMA_CHARS = 20_000;
152
- function observedTools(tools) {
187
+ function observedTools(tools, serverId, localize) {
153
188
  return tools.map(tool => ({
154
189
  name: tool.name,
155
190
  ...(tool.description === undefined ? {} : { description: tool.description }),
156
- ...(tool.parameters === undefined || JSON.stringify(tool.parameters).length > MAX_SCHEMA_CHARS ? {} : { parameters: tool.parameters })
191
+ ...(tool.parameters === undefined || JSON.stringify(tool.parameters).length > MAX_SCHEMA_CHARS ? {} : { parameters: tool.parameters }),
192
+ // One tool per `<serverId>#<toolName>`: two servers may advertise the same
193
+ // tool name with different descriptions, and the same server may describe
194
+ // one tool differently from another.
195
+ ...(localize === undefined ? {} : localize(`${serverId}#${tool.name}`, { description: tool.description }))
157
196
  }));
158
197
  }
159
198
  function groupObservedTools(observed, knownServerNames) {
@@ -0,0 +1,63 @@
1
+ /**
2
+ * MCP configuration validation: the schema checks and the redaction-restore
3
+ * step the save path runs before anything is persisted.
4
+ *
5
+ * A service the user declared themselves is local data rather than a
6
+ * distributable package: keys this client does not know are kept as written
7
+ * instead of being rejected by the closed-set package schema, and the
8
+ * package-only rules (bare command names, plugin-relative paths) stay off.
9
+ */
10
+ import { MCP_SCHEMA_ID, validateAgainstSchema, validateMcpJson } from '../../../../market-catalog/src/index.js';
11
+ /**
12
+ * The errors the closed-set package shape produces. A user-owned service does
13
+ * not obey that shape, and the per-transport checks still require what it needs.
14
+ */
15
+ const PACKAGE_SHAPE_KEYWORDS = new Set(['additionalProperties', 'oneOf', 'required', 'const']);
16
+ /**
17
+ * A rejected MCP configuration. The message keeps the flat form the API has
18
+ * always returned, and `fields` carries the same reasons keyed by field so the
19
+ * editor can put each one beside its input.
20
+ */
21
+ export class McpConfigError extends Error {
22
+ fields;
23
+ constructor(fields) {
24
+ super(`invalid MCP configuration: ${fields.map(entry => (entry.field === '' ? entry.message : `${entry.field} ${entry.message}`)).join('; ')}`);
25
+ this.fields = fields;
26
+ this.name = 'McpConfigError';
27
+ }
28
+ }
29
+ export { restoreRedactedConfig } from '../../../../market-contracts/src/redaction.js';
30
+ /**
31
+ * Validate one service definition before it is stored.
32
+ *
33
+ * A service the user declared themselves is local data rather than a
34
+ * distributable package: keys this client does not know are kept as written
35
+ * instead of being rejected by the closed-set package schema, and the
36
+ * package-only rules (bare command names, plugin-relative paths) stay off.
37
+ */
38
+ export async function validateServerMcp(root, key, config, options) {
39
+ const userOwned = options?.userOwned === true;
40
+ const document = { $schema: MCP_SCHEMA_ID, mcpServers: { [key]: config } };
41
+ // A JSON pointer needs its own escapes so a server key containing `/` or `~`
42
+ // still yields the right prefix for the field paths below.
43
+ const pointer = `/mcpServers/${key.replaceAll('~', '~0').replaceAll('/', '~1')}`;
44
+ const structural = (await validateAgainstSchema(MCP_SCHEMA_ID, document))
45
+ .filter(error => error.instancePath === pointer || error.instancePath.startsWith(`${pointer}/`))
46
+ // The closed-set package shape reports `additionalProperties` plus the
47
+ // `oneOf`/`required` pair its failure produces; user-owned data does not
48
+ // obey it, and the per-transport checks below still require what it needs.
49
+ .filter(error => !(userOwned && PACKAGE_SHAPE_KEYWORDS.has(error.keyword)))
50
+ .map(error => ({
51
+ field: error.instancePath.slice(pointer.length).replace(/^\//, '').replaceAll('/', '.'),
52
+ message: error.message
53
+ }));
54
+ if (structural.length > 0)
55
+ throw new McpConfigError(structural);
56
+ const result = await validateMcpJson(root, document, userOwned ? { packageRules: false } : undefined);
57
+ if (result.config === undefined || result.errors.length > 0)
58
+ throw new McpConfigError(result.errors.map(message => ({ field: '', message })));
59
+ const server = result.config.servers[key];
60
+ if (server === undefined)
61
+ throw new McpConfigError([{ field: '', message: `server "${key}" was rejected` }]);
62
+ return server;
63
+ }