@1mcp/agent 0.39.5 → 0.40.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (517) hide show
  1. package/README.md +14 -7
  2. package/build/admin/assets/{admin-BackendLogsWorkspace-BKavXT9B.js → admin-BackendLogsWorkspace-DnPzXW3E.js} +1 -1
  3. package/build/admin/assets/{admin-InstructionTemplatesWorkspace-CvG4EPdZ.js → admin-InstructionTemplatesWorkspace-B7beKEgz.js} +1 -1
  4. package/build/admin/assets/{admin-OAuthServicesWorkspace-BzrCR7Bi.js → admin-OAuthServicesWorkspace-Bu74Bzt5.js} +1 -1
  5. package/build/admin/assets/{admin-PresetAuthoringWorkspace-BboJVBFl.js → admin-PresetAuthoringWorkspace-053b1zwU.js} +1 -1
  6. package/build/admin/assets/{admin-console-BpUgmlrR.js → admin-console-DVuqABnE.js} +3 -3
  7. package/build/admin/assets/admin-icons-wOzB38gm.js +1 -0
  8. package/build/admin/assets/admin-vendor-BLZ1Mauf.js +3 -0
  9. package/build/admin/assets/admin-vendor-BdHKHno1.js +1 -0
  10. package/build/admin/assets/admin-vendor-BqYiU41k.js +51 -0
  11. package/build/admin/assets/admin-vendor-C291Vs-N.js +3 -0
  12. package/build/admin/assets/admin-vendor-VzhcFgoy.js +1 -0
  13. package/build/admin/index.html +7 -5
  14. package/build/application/backendPreparationAdmission.d.ts +77 -0
  15. package/build/application/backendPreparationAdmission.d.ts.map +1 -0
  16. package/build/application/backendPreparationAdmission.js +423 -0
  17. package/build/application/backendPreparationAdmission.js.map +1 -0
  18. package/build/application/backendPreparationCoordinator.d.ts +122 -0
  19. package/build/application/backendPreparationCoordinator.d.ts.map +1 -0
  20. package/build/application/backendPreparationCoordinator.js +885 -0
  21. package/build/application/backendPreparationCoordinator.js.map +1 -0
  22. package/build/application/projectLifecycle.d.ts +49 -0
  23. package/build/application/projectLifecycle.d.ts.map +1 -0
  24. package/build/application/projectLifecycle.js +228 -0
  25. package/build/application/projectLifecycle.js.map +1 -0
  26. package/build/cli.d.ts.map +1 -1
  27. package/build/cli.js +39 -17
  28. package/build/cli.js.map +1 -1
  29. package/build/commands/admin/index.d.ts.map +1 -1
  30. package/build/commands/admin/index.js +2 -6
  31. package/build/commands/admin/index.js.map +1 -1
  32. package/build/commands/app/index.d.ts.map +1 -1
  33. package/build/commands/app/index.js +5 -17
  34. package/build/commands/app/index.js.map +1 -1
  35. package/build/commands/auth/index.d.ts.map +1 -1
  36. package/build/commands/auth/index.js +2 -7
  37. package/build/commands/auth/index.js.map +1 -1
  38. package/build/commands/bootstrap/bootstrap.d.ts +38 -0
  39. package/build/commands/bootstrap/bootstrap.d.ts.map +1 -0
  40. package/build/commands/bootstrap/bootstrap.js +265 -0
  41. package/build/commands/bootstrap/bootstrap.js.map +1 -0
  42. package/build/commands/bootstrap/bootstrapOwnership.d.ts +13 -0
  43. package/build/commands/bootstrap/bootstrapOwnership.d.ts.map +1 -0
  44. package/build/commands/bootstrap/bootstrapOwnership.js +112 -0
  45. package/build/commands/bootstrap/bootstrapOwnership.js.map +1 -0
  46. package/build/commands/bootstrap/index.d.ts +3 -0
  47. package/build/commands/bootstrap/index.d.ts.map +1 -0
  48. package/build/commands/bootstrap/index.js +22 -0
  49. package/build/commands/bootstrap/index.js.map +1 -0
  50. package/build/commands/cliSetup/index.d.ts.map +1 -1
  51. package/build/commands/cliSetup/index.js +3 -4
  52. package/build/commands/cliSetup/index.js.map +1 -1
  53. package/build/commands/cliSetup/installPreparationSkill.d.ts +8 -0
  54. package/build/commands/cliSetup/installPreparationSkill.d.ts.map +1 -0
  55. package/build/commands/cliSetup/installPreparationSkill.js +201 -0
  56. package/build/commands/cliSetup/installPreparationSkill.js.map +1 -0
  57. package/build/commands/cliSetup/preparationSkill.generated.d.ts +2 -0
  58. package/build/commands/cliSetup/preparationSkill.generated.d.ts.map +1 -0
  59. package/build/commands/cliSetup/preparationSkill.generated.js +8 -0
  60. package/build/commands/cliSetup/preparationSkill.generated.js.map +1 -0
  61. package/build/commands/cliSetup/setupFiles.d.ts +5 -1
  62. package/build/commands/cliSetup/setupFiles.d.ts.map +1 -1
  63. package/build/commands/cliSetup/setupFiles.js +54 -37
  64. package/build/commands/cliSetup/setupFiles.js.map +1 -1
  65. package/build/commands/inspect/index.d.ts.map +1 -1
  66. package/build/commands/inspect/index.js +4 -4
  67. package/build/commands/inspect/index.js.map +1 -1
  68. package/build/commands/inspect/inspect.d.ts +2 -1
  69. package/build/commands/inspect/inspect.d.ts.map +1 -1
  70. package/build/commands/inspect/inspect.js +10 -5
  71. package/build/commands/inspect/inspect.js.map +1 -1
  72. package/build/commands/inspect/inspectUtils.js +3 -0
  73. package/build/commands/inspect/inspectUtils.js.map +1 -1
  74. package/build/commands/instructions/index.d.ts.map +1 -1
  75. package/build/commands/instructions/index.js +8 -3
  76. package/build/commands/instructions/index.js.map +1 -1
  77. package/build/commands/instructions/instructions.d.ts +3 -1
  78. package/build/commands/instructions/instructions.d.ts.map +1 -1
  79. package/build/commands/instructions/instructions.js +24 -0
  80. package/build/commands/instructions/instructions.js.map +1 -1
  81. package/build/commands/instructions/instructionsUtils.d.ts +2 -0
  82. package/build/commands/instructions/instructionsUtils.d.ts.map +1 -1
  83. package/build/commands/instructions/instructionsUtils.js +14 -4
  84. package/build/commands/instructions/instructionsUtils.js.map +1 -1
  85. package/build/commands/mcp/index.d.ts.map +1 -1
  86. package/build/commands/mcp/index.js +16 -21
  87. package/build/commands/mcp/index.js.map +1 -1
  88. package/build/commands/mcp/installSource.d.ts +3 -1
  89. package/build/commands/mcp/installSource.d.ts.map +1 -1
  90. package/build/commands/mcp/installSource.js +2 -2
  91. package/build/commands/mcp/installSource.js.map +1 -1
  92. package/build/commands/mcp/knownServerSetup.d.ts +4 -0
  93. package/build/commands/mcp/knownServerSetup.d.ts.map +1 -0
  94. package/build/commands/mcp/knownServerSetup.js +102 -0
  95. package/build/commands/mcp/knownServerSetup.js.map +1 -0
  96. package/build/commands/mcp/setup.d.ts +28 -0
  97. package/build/commands/mcp/setup.d.ts.map +1 -0
  98. package/build/commands/mcp/setup.js +56 -0
  99. package/build/commands/mcp/setup.js.map +1 -0
  100. package/build/commands/mcp/tools.d.ts.map +1 -1
  101. package/build/commands/mcp/tools.js +3 -3
  102. package/build/commands/mcp/tools.js.map +1 -1
  103. package/build/commands/preparation/index.d.ts +3 -0
  104. package/build/commands/preparation/index.d.ts.map +1 -0
  105. package/build/commands/preparation/index.js +55 -0
  106. package/build/commands/preparation/index.js.map +1 -0
  107. package/build/commands/preparation/preparation.d.ts +18 -0
  108. package/build/commands/preparation/preparation.d.ts.map +1 -0
  109. package/build/commands/preparation/preparation.js +102 -0
  110. package/build/commands/preparation/preparation.js.map +1 -0
  111. package/build/commands/preset/index.d.ts.map +1 -1
  112. package/build/commands/preset/index.js +4 -51
  113. package/build/commands/preset/index.js.map +1 -1
  114. package/build/commands/project/index.d.ts +3 -0
  115. package/build/commands/project/index.d.ts.map +1 -0
  116. package/build/commands/project/index.js +40 -0
  117. package/build/commands/project/index.js.map +1 -0
  118. package/build/commands/project/project.d.ts +34 -0
  119. package/build/commands/project/project.d.ts.map +1 -0
  120. package/build/commands/project/project.js +119 -0
  121. package/build/commands/project/project.js.map +1 -0
  122. package/build/commands/proxy/index.d.ts +2 -1
  123. package/build/commands/proxy/index.d.ts.map +1 -1
  124. package/build/commands/proxy/index.js +6 -46
  125. package/build/commands/proxy/index.js.map +1 -1
  126. package/build/commands/proxy/proxy.d.ts.map +1 -1
  127. package/build/commands/proxy/proxy.js +7 -1
  128. package/build/commands/proxy/proxy.js.map +1 -1
  129. package/build/commands/registry/index.d.ts.map +1 -1
  130. package/build/commands/registry/index.js +16 -20
  131. package/build/commands/registry/index.js.map +1 -1
  132. package/build/commands/run/index.d.ts.map +1 -1
  133. package/build/commands/run/index.js +9 -3
  134. package/build/commands/run/index.js.map +1 -1
  135. package/build/commands/run/run.d.ts +4 -1
  136. package/build/commands/run/run.d.ts.map +1 -1
  137. package/build/commands/run/run.js +80 -14
  138. package/build/commands/run/run.js.map +1 -1
  139. package/build/commands/serve/cooperativeRuntime.d.ts.map +1 -1
  140. package/build/commands/serve/cooperativeRuntime.js +2 -1
  141. package/build/commands/serve/cooperativeRuntime.js.map +1 -1
  142. package/build/commands/serve/index.d.ts.map +1 -1
  143. package/build/commands/serve/index.js +57 -39
  144. package/build/commands/serve/index.js.map +1 -1
  145. package/build/commands/serve/serveStatus.d.ts.map +1 -1
  146. package/build/commands/serve/serveStatus.js +3 -0
  147. package/build/commands/serve/serveStatus.js.map +1 -1
  148. package/build/commands/serve/serveStop.d.ts.map +1 -1
  149. package/build/commands/serve/serveStop.js +38 -6
  150. package/build/commands/serve/serveStop.js.map +1 -1
  151. package/build/commands/shared/agentSession.d.ts +5 -0
  152. package/build/commands/shared/agentSession.d.ts.map +1 -0
  153. package/build/commands/shared/agentSession.js +75 -0
  154. package/build/commands/shared/agentSession.js.map +1 -0
  155. package/build/commands/shared/apiClient.d.ts +2 -0
  156. package/build/commands/shared/apiClient.d.ts.map +1 -1
  157. package/build/commands/shared/apiClient.js +10 -6
  158. package/build/commands/shared/apiClient.js.map +1 -1
  159. package/build/commands/shared/cliContext.d.ts +2 -1
  160. package/build/commands/shared/cliContext.d.ts.map +1 -1
  161. package/build/commands/shared/cliContext.js +2 -1
  162. package/build/commands/shared/cliContext.js.map +1 -1
  163. package/build/commands/shared/clientSurfaceAttachment.d.ts +7 -1
  164. package/build/commands/shared/clientSurfaceAttachment.d.ts.map +1 -1
  165. package/build/commands/shared/clientSurfaceAttachment.js +221 -140
  166. package/build/commands/shared/clientSurfaceAttachment.js.map +1 -1
  167. package/build/commands/shared/inspectApiSchemas.d.ts +4 -4
  168. package/build/commands/shared/projectOwnerStorage.d.ts +8 -0
  169. package/build/commands/shared/projectOwnerStorage.d.ts.map +1 -0
  170. package/build/commands/shared/projectOwnerStorage.js +63 -0
  171. package/build/commands/shared/projectOwnerStorage.js.map +1 -0
  172. package/build/commands/shared/projectOwnerStore.d.ts +78 -0
  173. package/build/commands/shared/projectOwnerStore.d.ts.map +1 -0
  174. package/build/commands/shared/projectOwnerStore.js +482 -0
  175. package/build/commands/shared/projectOwnerStore.js.map +1 -0
  176. package/build/commands/shared/projectSelectionOptions.d.ts +24 -0
  177. package/build/commands/shared/projectSelectionOptions.d.ts.map +1 -0
  178. package/build/commands/shared/projectSelectionOptions.js +20 -0
  179. package/build/commands/shared/projectSelectionOptions.js.map +1 -0
  180. package/build/commands/shared/serveTargetResolver.d.ts +7 -1
  181. package/build/commands/shared/serveTargetResolver.d.ts.map +1 -1
  182. package/build/commands/shared/serveTargetResolver.js +99 -4
  183. package/build/commands/shared/serveTargetResolver.js.map +1 -1
  184. package/build/commands/target/index.d.ts.map +1 -1
  185. package/build/commands/target/index.js +6 -13
  186. package/build/commands/target/index.js.map +1 -1
  187. package/build/commands/wait/index.d.ts.map +1 -1
  188. package/build/commands/wait/index.js +3 -3
  189. package/build/commands/wait/index.js.map +1 -1
  190. package/build/commands/wait/wait.d.ts +2 -1
  191. package/build/commands/wait/wait.d.ts.map +1 -1
  192. package/build/commands/wait/wait.js.map +1 -1
  193. package/build/config/configLoader.d.ts.map +1 -1
  194. package/build/config/configLoader.js +5 -1
  195. package/build/config/configLoader.js.map +1 -1
  196. package/build/config/configManager.d.ts.map +1 -1
  197. package/build/config/configManager.js +5 -1
  198. package/build/config/configManager.js.map +1 -1
  199. package/build/config/projectConfigLoader.d.ts +4 -0
  200. package/build/config/projectConfigLoader.d.ts.map +1 -1
  201. package/build/config/projectConfigLoader.js +129 -28
  202. package/build/config/projectConfigLoader.js.map +1 -1
  203. package/build/config/projectConfigTypes.d.ts +7 -0
  204. package/build/config/projectConfigTypes.d.ts.map +1 -1
  205. package/build/config/projectConfigTypes.js +1 -0
  206. package/build/config/projectConfigTypes.js.map +1 -1
  207. package/build/constants/cliTimeouts.d.ts +4 -0
  208. package/build/constants/cliTimeouts.d.ts.map +1 -0
  209. package/build/constants/cliTimeouts.js +4 -0
  210. package/build/constants/cliTimeouts.js.map +1 -0
  211. package/build/constants/mcp.d.ts +1 -1
  212. package/build/constants/mcp.d.ts.map +1 -1
  213. package/build/constants/mcp.js +1 -1
  214. package/build/constants/mcp.js.map +1 -1
  215. package/build/core/capabilities/capabilityCatalog.d.ts +7 -0
  216. package/build/core/capabilities/capabilityCatalog.d.ts.map +1 -1
  217. package/build/core/capabilities/capabilityCatalog.js +58 -2
  218. package/build/core/capabilities/capabilityCatalog.js.map +1 -1
  219. package/build/core/capabilities/capabilityPagination.d.ts +12 -4
  220. package/build/core/capabilities/capabilityPagination.d.ts.map +1 -1
  221. package/build/core/capabilities/capabilityPagination.js +15 -2
  222. package/build/core/capabilities/capabilityPagination.js.map +1 -1
  223. package/build/core/capabilities/capabilityVisibility.d.ts +3 -0
  224. package/build/core/capabilities/capabilityVisibility.d.ts.map +1 -1
  225. package/build/core/capabilities/capabilityVisibility.js.map +1 -1
  226. package/build/core/capabilities/lazyLoadingOrchestrator.d.ts +2 -1
  227. package/build/core/capabilities/lazyLoadingOrchestrator.d.ts.map +1 -1
  228. package/build/core/capabilities/lazyLoadingOrchestrator.js +2 -2
  229. package/build/core/capabilities/lazyLoadingOrchestrator.js.map +1 -1
  230. package/build/core/capabilities/metaToolProvider.d.ts +2 -2
  231. package/build/core/capabilities/metaToolProvider.d.ts.map +1 -1
  232. package/build/core/capabilities/metaToolProvider.js +2 -2
  233. package/build/core/capabilities/metaToolProvider.js.map +1 -1
  234. package/build/core/capabilities/runtimeCapabilityCatalog.d.ts +1 -0
  235. package/build/core/capabilities/runtimeCapabilityCatalog.d.ts.map +1 -1
  236. package/build/core/capabilities/runtimeCapabilityCatalog.js +23 -9
  237. package/build/core/capabilities/runtimeCapabilityCatalog.js.map +1 -1
  238. package/build/core/context/projectOwner.d.ts +16 -0
  239. package/build/core/context/projectOwner.d.ts.map +1 -0
  240. package/build/core/context/projectOwner.js +33 -0
  241. package/build/core/context/projectOwner.js.map +1 -0
  242. package/build/core/context/projectPreparationAuthority.d.ts +37 -0
  243. package/build/core/context/projectPreparationAuthority.d.ts.map +1 -0
  244. package/build/core/context/projectPreparationAuthority.js +113 -0
  245. package/build/core/context/projectPreparationAuthority.js.map +1 -0
  246. package/build/core/instructions/inspectionGuidance.d.ts +2 -0
  247. package/build/core/instructions/inspectionGuidance.d.ts.map +1 -0
  248. package/build/core/instructions/inspectionGuidance.js +2 -0
  249. package/build/core/instructions/inspectionGuidance.js.map +1 -0
  250. package/build/core/instructions/instructionAggregator.d.ts +1 -0
  251. package/build/core/instructions/instructionAggregator.d.ts.map +1 -1
  252. package/build/core/instructions/instructionAggregator.js +2 -2
  253. package/build/core/instructions/instructionAggregator.js.map +1 -1
  254. package/build/core/instructions/instructionsDistribution.d.ts +5 -0
  255. package/build/core/instructions/instructionsDistribution.d.ts.map +1 -1
  256. package/build/core/instructions/instructionsDistribution.js +72 -15
  257. package/build/core/instructions/instructionsDistribution.js.map +1 -1
  258. package/build/core/instructions/preparationGuidance.d.ts +3 -0
  259. package/build/core/instructions/preparationGuidance.d.ts.map +1 -0
  260. package/build/core/instructions/preparationGuidance.js +14 -0
  261. package/build/core/instructions/preparationGuidance.js.map +1 -0
  262. package/build/core/instructions/sessionGuidance.d.ts +3 -0
  263. package/build/core/instructions/sessionGuidance.d.ts.map +1 -0
  264. package/build/core/instructions/sessionGuidance.js +25 -0
  265. package/build/core/instructions/sessionGuidance.js.map +1 -0
  266. package/build/core/instructions/templateTypes.d.ts +3 -1
  267. package/build/core/instructions/templateTypes.d.ts.map +1 -1
  268. package/build/core/instructions/templateTypes.js +15 -5
  269. package/build/core/instructions/templateTypes.js.map +1 -1
  270. package/build/core/protocol/requestHandlerUtils.d.ts.map +1 -1
  271. package/build/core/protocol/requestHandlerUtils.js +23 -4
  272. package/build/core/protocol/requestHandlerUtils.js.map +1 -1
  273. package/build/core/server/connectionResolver.d.ts +5 -0
  274. package/build/core/server/connectionResolver.d.ts.map +1 -1
  275. package/build/core/server/connectionResolver.js +11 -0
  276. package/build/core/server/connectionResolver.js.map +1 -1
  277. package/build/core/server/pidFileManager.d.ts +20 -5
  278. package/build/core/server/pidFileManager.d.ts.map +1 -1
  279. package/build/core/server/pidFileManager.js +34 -15
  280. package/build/core/server/pidFileManager.js.map +1 -1
  281. package/build/core/server/processIdentity.d.ts +18 -0
  282. package/build/core/server/processIdentity.d.ts.map +1 -1
  283. package/build/core/server/processIdentity.js +13 -2
  284. package/build/core/server/processIdentity.js.map +1 -1
  285. package/build/core/server/runtimeLaunchIpc.d.ts +167 -2
  286. package/build/core/server/runtimeLaunchIpc.d.ts.map +1 -1
  287. package/build/core/server/runtimeOwnershipIdentityRepair.d.ts +21 -0
  288. package/build/core/server/runtimeOwnershipIdentityRepair.d.ts.map +1 -0
  289. package/build/core/server/runtimeOwnershipIdentityRepair.js +158 -0
  290. package/build/core/server/runtimeOwnershipIdentityRepair.js.map +1 -0
  291. package/build/core/server/runtimeReplacementConfig.d.ts +167 -2
  292. package/build/core/server/runtimeReplacementConfig.d.ts.map +1 -1
  293. package/build/core/server/runtimeScopeOwnership.d.ts +21 -2
  294. package/build/core/server/runtimeScopeOwnership.d.ts.map +1 -1
  295. package/build/core/server/runtimeScopeOwnership.js +145 -16
  296. package/build/core/server/runtimeScopeOwnership.js.map +1 -1
  297. package/build/core/tools/handlers/serverManagementHandler.d.ts +413 -7
  298. package/build/core/tools/handlers/serverManagementHandler.d.ts.map +1 -1
  299. package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts +59 -1
  300. package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts.map +1 -1
  301. package/build/core/tools/internal/schemas/index.d.ts +1 -1
  302. package/build/core/tools/internal/schemas/management.d.ts +1 -1
  303. package/build/core/types/server.d.ts +7 -1
  304. package/build/core/types/server.d.ts.map +1 -1
  305. package/build/core/types/transport.d.ts +249 -3
  306. package/build/core/types/transport.d.ts.map +1 -1
  307. package/build/core/types/transport.js +27 -0
  308. package/build/core/types/transport.js.map +1 -1
  309. package/build/domains/admin/adminInstructionPreviewRuntime.d.ts.map +1 -1
  310. package/build/domains/admin/adminInstructionPreviewRuntime.js +4 -1
  311. package/build/domains/admin/adminInstructionPreviewRuntime.js.map +1 -1
  312. package/build/domains/backend-preparation/adapterRegistry.d.ts +8 -0
  313. package/build/domains/backend-preparation/adapterRegistry.d.ts.map +1 -0
  314. package/build/domains/backend-preparation/adapterRegistry.js +15 -0
  315. package/build/domains/backend-preparation/adapterRegistry.js.map +1 -0
  316. package/build/domains/backend-preparation/builtInIntegrationDefinitions.d.ts +4 -0
  317. package/build/domains/backend-preparation/builtInIntegrationDefinitions.d.ts.map +1 -0
  318. package/build/domains/backend-preparation/builtInIntegrationDefinitions.js +3 -0
  319. package/build/domains/backend-preparation/builtInIntegrationDefinitions.js.map +1 -0
  320. package/build/domains/backend-preparation/configuredCommandAdapter.d.ts +88 -0
  321. package/build/domains/backend-preparation/configuredCommandAdapter.d.ts.map +1 -0
  322. package/build/domains/backend-preparation/configuredCommandAdapter.js +196 -0
  323. package/build/domains/backend-preparation/configuredCommandAdapter.js.map +1 -0
  324. package/build/domains/backend-preparation/configuredCommandProcess.d.ts +27 -0
  325. package/build/domains/backend-preparation/configuredCommandProcess.d.ts.map +1 -0
  326. package/build/domains/backend-preparation/configuredCommandProcess.js +183 -0
  327. package/build/domains/backend-preparation/configuredCommandProcess.js.map +1 -0
  328. package/build/domains/backend-preparation/contracts.d.ts +131 -0
  329. package/build/domains/backend-preparation/contracts.d.ts.map +1 -0
  330. package/build/domains/backend-preparation/contracts.js +2 -0
  331. package/build/domains/backend-preparation/contracts.js.map +1 -0
  332. package/build/domains/backend-preparation/integrationDefinitions.d.ts +171 -0
  333. package/build/domains/backend-preparation/integrationDefinitions.d.ts.map +1 -0
  334. package/build/domains/backend-preparation/integrationDefinitions.js +246 -0
  335. package/build/domains/backend-preparation/integrationDefinitions.js.map +1 -0
  336. package/build/domains/backend-preparation/policy.d.ts +50 -0
  337. package/build/domains/backend-preparation/policy.d.ts.map +1 -0
  338. package/build/domains/backend-preparation/policy.js +58 -0
  339. package/build/domains/backend-preparation/policy.js.map +1 -0
  340. package/build/domains/backend-preparation/scheduler.d.ts +18 -0
  341. package/build/domains/backend-preparation/scheduler.d.ts.map +1 -0
  342. package/build/domains/backend-preparation/scheduler.js +62 -0
  343. package/build/domains/backend-preparation/scheduler.js.map +1 -0
  344. package/build/domains/backend-preparation/service.d.ts +67 -0
  345. package/build/domains/backend-preparation/service.d.ts.map +1 -0
  346. package/build/domains/backend-preparation/service.js +709 -0
  347. package/build/domains/backend-preparation/service.js.map +1 -0
  348. package/build/domains/config-change/configChange.js +5 -5
  349. package/build/domains/config-change/configChange.js.map +1 -1
  350. package/build/domains/installation/knownServerCatalog.d.ts +14 -0
  351. package/build/domains/installation/knownServerCatalog.d.ts.map +1 -0
  352. package/build/domains/installation/knownServerCatalog.js +56 -0
  353. package/build/domains/installation/knownServerCatalog.js.map +1 -0
  354. package/build/domains/installation/knownServerSetup.d.ts +21 -0
  355. package/build/domains/installation/knownServerSetup.d.ts.map +1 -0
  356. package/build/domains/installation/knownServerSetup.js +330 -0
  357. package/build/domains/installation/knownServerSetup.js.map +1 -0
  358. package/build/domains/installation/knownServerSetupTypes.d.ts +34 -0
  359. package/build/domains/installation/knownServerSetupTypes.d.ts.map +1 -0
  360. package/build/domains/installation/knownServerSetupTypes.js +2 -0
  361. package/build/domains/installation/knownServerSetupTypes.js.map +1 -0
  362. package/build/domains/project-selection/projectBindingScope.d.ts +7 -0
  363. package/build/domains/project-selection/projectBindingScope.d.ts.map +1 -0
  364. package/build/domains/project-selection/projectBindingScope.js +9 -0
  365. package/build/domains/project-selection/projectBindingScope.js.map +1 -0
  366. package/build/domains/project-selection/projectPolicy.d.ts +11 -0
  367. package/build/domains/project-selection/projectPolicy.d.ts.map +1 -0
  368. package/build/domains/project-selection/projectPolicy.js +104 -0
  369. package/build/domains/project-selection/projectPolicy.js.map +1 -0
  370. package/build/domains/project-selection/projectSelection.d.ts +30 -0
  371. package/build/domains/project-selection/projectSelection.d.ts.map +1 -0
  372. package/build/domains/project-selection/projectSelection.js +124 -0
  373. package/build/domains/project-selection/projectSelection.js.map +1 -0
  374. package/build/globalOptions.d.ts +9 -0
  375. package/build/globalOptions.d.ts.map +1 -1
  376. package/build/globalOptions.js +13 -11
  377. package/build/globalOptions.js.map +1 -1
  378. package/build/observability/events/registry.d.ts +67 -1
  379. package/build/observability/events/registry.d.ts.map +1 -1
  380. package/build/observability/events/registry.js +67 -1
  381. package/build/observability/events/registry.js.map +1 -1
  382. package/build/observability/privacy/fields.d.ts +4 -0
  383. package/build/observability/privacy/fields.d.ts.map +1 -1
  384. package/build/observability/privacy/fields.js +4 -0
  385. package/build/observability/privacy/fields.js.map +1 -1
  386. package/build/sdk/legacy/client/runtime/backendDispatchLifetime.d.ts.map +1 -1
  387. package/build/sdk/legacy/client/runtime/backendDispatchLifetime.js +8 -2
  388. package/build/sdk/legacy/client/runtime/backendDispatchLifetime.js.map +1 -1
  389. package/build/sdk/legacy/client/runtime/legacyTransport.d.ts +2 -0
  390. package/build/sdk/legacy/client/runtime/legacyTransport.d.ts.map +1 -1
  391. package/build/sdk/legacy/client/runtime/serveClient.d.ts +6 -1
  392. package/build/sdk/legacy/client/runtime/serveClient.d.ts.map +1 -1
  393. package/build/sdk/legacy/client/runtime/serveClient.js +16 -5
  394. package/build/sdk/legacy/client/runtime/serveClient.js.map +1 -1
  395. package/build/sdk/legacy/commands/serve.d.ts.map +1 -1
  396. package/build/sdk/legacy/commands/serve.js +73 -4
  397. package/build/sdk/legacy/commands/serve.js.map +1 -1
  398. package/build/sdk/legacy/server/protocol/projectAdmission.d.ts +4 -0
  399. package/build/sdk/legacy/server/protocol/projectAdmission.d.ts.map +1 -0
  400. package/build/sdk/legacy/server/protocol/projectAdmission.js +24 -0
  401. package/build/sdk/legacy/server/protocol/projectAdmission.js.map +1 -0
  402. package/build/sdk/legacy/server/protocol/promptRequestHandlers.d.ts.map +1 -1
  403. package/build/sdk/legacy/server/protocol/promptRequestHandlers.js +6 -3
  404. package/build/sdk/legacy/server/protocol/promptRequestHandlers.js.map +1 -1
  405. package/build/sdk/legacy/server/protocol/resourceRequestHandlers.d.ts.map +1 -1
  406. package/build/sdk/legacy/server/protocol/resourceRequestHandlers.js +6 -4
  407. package/build/sdk/legacy/server/protocol/resourceRequestHandlers.js.map +1 -1
  408. package/build/sdk/legacy/server/protocol/resourceSubscriptions.d.ts +1 -1
  409. package/build/sdk/legacy/server/protocol/resourceSubscriptions.d.ts.map +1 -1
  410. package/build/sdk/legacy/server/protocol/resourceSubscriptions.js +193 -41
  411. package/build/sdk/legacy/server/protocol/resourceSubscriptions.js.map +1 -1
  412. package/build/sdk/legacy/server/protocol/toolRequestHandlers.d.ts.map +1 -1
  413. package/build/sdk/legacy/server/protocol/toolRequestHandlers.js +93 -17
  414. package/build/sdk/legacy/server/protocol/toolRequestHandlers.js.map +1 -1
  415. package/build/sdk/legacy/server/runtime/clientInstancePool.d.ts +12 -0
  416. package/build/sdk/legacy/server/runtime/clientInstancePool.d.ts.map +1 -1
  417. package/build/sdk/legacy/server/runtime/clientInstancePool.js +117 -4
  418. package/build/sdk/legacy/server/runtime/clientInstancePool.js.map +1 -1
  419. package/build/sdk/legacy/server/runtime/connectionManager.d.ts.map +1 -1
  420. package/build/sdk/legacy/server/runtime/connectionManager.js +2 -0
  421. package/build/sdk/legacy/server/runtime/connectionManager.js.map +1 -1
  422. package/build/sdk/legacy/server/runtime/requestContextPreparation.d.ts +19 -1
  423. package/build/sdk/legacy/server/runtime/requestContextPreparation.d.ts.map +1 -1
  424. package/build/sdk/legacy/server/runtime/requestContextPreparation.js +40 -7
  425. package/build/sdk/legacy/server/runtime/requestContextPreparation.js.map +1 -1
  426. package/build/sdk/legacy/server/runtime/serverManager.d.ts +6 -2
  427. package/build/sdk/legacy/server/runtime/serverManager.d.ts.map +1 -1
  428. package/build/sdk/legacy/server/runtime/serverManager.js +85 -17
  429. package/build/sdk/legacy/server/runtime/serverManager.js.map +1 -1
  430. package/build/sdk/legacy/server/runtime/templateServerManager.d.ts +26 -4
  431. package/build/sdk/legacy/server/runtime/templateServerManager.d.ts.map +1 -1
  432. package/build/sdk/legacy/server/runtime/templateServerManager.js +260 -14
  433. package/build/sdk/legacy/server/runtime/templateServerManager.js.map +1 -1
  434. package/build/sdk/legacy/transport/http/modernInboundLegacyBridge.js +1 -1
  435. package/build/sdk/legacy/transport/http/modernInboundLegacyBridge.js.map +1 -1
  436. package/build/sdk/legacy/transport/http/streamableSessionLifecycle.d.ts.map +1 -1
  437. package/build/sdk/legacy/transport/http/streamableSessionLifecycle.js +14 -3
  438. package/build/sdk/legacy/transport/http/streamableSessionLifecycle.js.map +1 -1
  439. package/build/sdk/legacy/transport/stdioProxyTransport.d.ts +1 -0
  440. package/build/sdk/legacy/transport/stdioProxyTransport.d.ts.map +1 -1
  441. package/build/sdk/legacy/transport/stdioProxyTransport.js +2 -0
  442. package/build/sdk/legacy/transport/stdioProxyTransport.js.map +1 -1
  443. package/build/template/handlebarsTemplateRenderer.d.ts.map +1 -1
  444. package/build/template/handlebarsTemplateRenderer.js +3 -0
  445. package/build/template/handlebarsTemplateRenderer.js.map +1 -1
  446. package/build/transport/http/middlewares/projectAdmission.d.ts +5 -0
  447. package/build/transport/http/middlewares/projectAdmission.d.ts.map +1 -0
  448. package/build/transport/http/middlewares/projectAdmission.js +33 -0
  449. package/build/transport/http/middlewares/projectAdmission.js.map +1 -0
  450. package/build/transport/http/routes/apiRoutes.d.ts.map +1 -1
  451. package/build/transport/http/routes/apiRoutes.js +4 -0
  452. package/build/transport/http/routes/apiRoutes.js.map +1 -1
  453. package/build/transport/http/routes/inspectHelpers.d.ts +1 -0
  454. package/build/transport/http/routes/inspectHelpers.d.ts.map +1 -1
  455. package/build/transport/http/routes/inspectHelpers.js +2 -0
  456. package/build/transport/http/routes/inspectHelpers.js.map +1 -1
  457. package/build/transport/http/routes/inspectRequestContext.d.ts +5 -2
  458. package/build/transport/http/routes/inspectRequestContext.d.ts.map +1 -1
  459. package/build/transport/http/routes/inspectRequestContext.js +41 -19
  460. package/build/transport/http/routes/inspectRequestContext.js.map +1 -1
  461. package/build/transport/http/routes/inspectRoutes.d.ts +11 -2
  462. package/build/transport/http/routes/inspectRoutes.d.ts.map +1 -1
  463. package/build/transport/http/routes/inspectRoutes.js +94 -24
  464. package/build/transport/http/routes/inspectRoutes.js.map +1 -1
  465. package/build/transport/http/routes/instructionsRoutes.d.ts.map +1 -1
  466. package/build/transport/http/routes/instructionsRoutes.js +20 -8
  467. package/build/transport/http/routes/instructionsRoutes.js.map +1 -1
  468. package/build/transport/http/routes/modernHttpRoutes.d.ts.map +1 -1
  469. package/build/transport/http/routes/modernHttpRoutes.js +96 -13
  470. package/build/transport/http/routes/modernHttpRoutes.js.map +1 -1
  471. package/build/transport/http/routes/modernInteractionBinding.d.ts.map +1 -1
  472. package/build/transport/http/routes/modernInteractionBinding.js +3 -9
  473. package/build/transport/http/routes/modernInteractionBinding.js.map +1 -1
  474. package/build/transport/http/routes/modernSubscriptions.d.ts.map +1 -1
  475. package/build/transport/http/routes/modernSubscriptions.js +7 -5
  476. package/build/transport/http/routes/modernSubscriptions.js.map +1 -1
  477. package/build/transport/http/routes/modernTemplateContext.d.ts +2 -1
  478. package/build/transport/http/routes/modernTemplateContext.d.ts.map +1 -1
  479. package/build/transport/http/routes/modernTemplateContext.js +14 -3
  480. package/build/transport/http/routes/modernTemplateContext.js.map +1 -1
  481. package/build/transport/http/routes/modernToolHeaderRegistry.d.ts.map +1 -1
  482. package/build/transport/http/routes/modernToolHeaderRegistry.js +2 -2
  483. package/build/transport/http/routes/modernToolHeaderRegistry.js.map +1 -1
  484. package/build/transport/http/routes/preparationRoutes.d.ts +26 -0
  485. package/build/transport/http/routes/preparationRoutes.d.ts.map +1 -0
  486. package/build/transport/http/routes/preparationRoutes.js +132 -0
  487. package/build/transport/http/routes/preparationRoutes.js.map +1 -0
  488. package/build/transport/http/routes/projectRoutes.d.ts +18 -0
  489. package/build/transport/http/routes/projectRoutes.d.ts.map +1 -0
  490. package/build/transport/http/routes/projectRoutes.js +159 -0
  491. package/build/transport/http/routes/projectRoutes.js.map +1 -0
  492. package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
  493. package/build/transport/http/routes/streamableHttpRoutes.js +24 -4
  494. package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
  495. package/build/transport/http/routes/toolRoutes.d.ts.map +1 -1
  496. package/build/transport/http/routes/toolRoutes.js +163 -20
  497. package/build/transport/http/routes/toolRoutes.js.map +1 -1
  498. package/build/transport/http/utils/contextExtractor.d.ts +2 -0
  499. package/build/transport/http/utils/contextExtractor.d.ts.map +1 -1
  500. package/build/transport/http/utils/contextExtractor.js +11 -0
  501. package/build/transport/http/utils/contextExtractor.js.map +1 -1
  502. package/build/transport/http/utils/templateContextAuthority.d.ts +2 -0
  503. package/build/transport/http/utils/templateContextAuthority.d.ts.map +1 -1
  504. package/build/transport/http/utils/templateContextAuthority.js +23 -2
  505. package/build/transport/http/utils/templateContextAuthority.js.map +1 -1
  506. package/build/types/context.d.ts +13 -0
  507. package/build/types/context.d.ts.map +1 -1
  508. package/build/types/context.js.map +1 -1
  509. package/build/utils/cli/help.d.ts +7 -0
  510. package/build/utils/cli/help.d.ts.map +1 -0
  511. package/build/utils/cli/help.js +57 -0
  512. package/build/utils/cli/help.js.map +1 -0
  513. package/package.json +20 -22
  514. package/build/admin/assets/admin-icons-CYGTDZA5.js +0 -1
  515. package/build/admin/assets/admin-vendor-62eL-qdH.js +0 -1
  516. package/build/admin/assets/admin-vendor-BbMrl7MK.js +0 -3
  517. package/build/admin/assets/admin-vendor-DpjVwd81.js +0 -62
@@ -0,0 +1,330 @@
1
+ import { constants, readFileSync } from 'node:fs';
2
+ import { access, realpath, stat } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import ConfigContext from '../../config/configContext.js';
5
+ import { getRuntimeParentEnvironment } from '../../config/runtimeBootstrap.js';
6
+ import { transportConfigSchema } from '../../core/types/transport.js';
7
+ import { createConfigChangeService, fingerprintConfiguredServerConfigDocument, fingerprintConfiguredServerDefaults, fingerprintConfiguredServerTarget, } from '../config-change/configChange.js';
8
+ import { z } from 'zod';
9
+ import { knownServerExamples } from './knownServerCatalog.js';
10
+ import { isValidServerName } from './validators/serverNameValidator.js';
11
+ const checkoutMarker = '{{{project.path}}}';
12
+ const literalPath = z
13
+ .string()
14
+ .min(1)
15
+ .refine((value) => !/[${}]/u.test(value) &&
16
+ [...value].every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127), {
17
+ message: 'Use a literal path without control characters, environment references, or template markers.',
18
+ });
19
+ const absolutePath = literalPath.refine(path.isAbsolute, { message: 'Provide an absolute path.' });
20
+ const knownSourceSchema = z
21
+ .object({
22
+ type: z.literal('known'),
23
+ exampleId: z.string().min(1),
24
+ localName: z.string().refine(isValidServerName, { message: 'Invalid local server name.' }).optional(),
25
+ executable: absolutePath.optional(),
26
+ checkout: absolutePath.optional(),
27
+ })
28
+ .strict();
29
+ function readKnownConfiguration() {
30
+ const configPath = ConfigContext.getInstance().getResolvedConfigPath();
31
+ let content;
32
+ try {
33
+ content = readFileSync(configPath, 'utf8');
34
+ }
35
+ catch (error) {
36
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
37
+ return { mcpServers: {} };
38
+ throw error;
39
+ }
40
+ const server = z.custom((value) => value !== null && typeof value === 'object' && !Array.isArray(value));
41
+ return z
42
+ .object({
43
+ mcpServers: z.record(z.string(), server).optional(),
44
+ mcpTemplates: z.record(z.string(), server).optional(),
45
+ })
46
+ .loose()
47
+ .parse(JSON.parse(content));
48
+ }
49
+ export async function resolveKnownServerExecutable(executable) {
50
+ if (!literalPath.safeParse(executable).success)
51
+ return undefined;
52
+ if (!path.isAbsolute(executable) && path.basename(executable) !== executable)
53
+ return undefined;
54
+ const candidates = path.isAbsolute(executable)
55
+ ? [executable]
56
+ : (getRuntimeParentEnvironment().PATH ?? '')
57
+ .split(path.delimiter)
58
+ .filter((directory) => path.isAbsolute(directory))
59
+ .map((directory) => path.join(directory, executable));
60
+ for (const candidate of candidates) {
61
+ if (!absolutePath.safeParse(candidate).success)
62
+ continue;
63
+ try {
64
+ await access(candidate, constants.X_OK);
65
+ if (!(await stat(candidate)).isFile())
66
+ continue;
67
+ const canonical = await realpath(candidate);
68
+ if (!absolutePath.safeParse(canonical).success)
69
+ continue;
70
+ const launcher = path.join(await realpath(path.dirname(candidate)), path.basename(candidate));
71
+ if (!absolutePath.safeParse(launcher).success)
72
+ continue;
73
+ return launcher;
74
+ }
75
+ catch {
76
+ continue;
77
+ }
78
+ }
79
+ return undefined;
80
+ }
81
+ export function createKnownServerSetupWorkflow(ports = {}) {
82
+ return {
83
+ run: (input) => setupKnownServer(input, ports),
84
+ };
85
+ }
86
+ export async function setupKnownServer(input, ports = {}) {
87
+ const base = {
88
+ status: 'invalid_input',
89
+ mode: input.mode,
90
+ sourceType: 'known',
91
+ warnings: [],
92
+ };
93
+ const parsed = knownSourceSchema.safeParse(input.source);
94
+ if (!parsed.success) {
95
+ return { ...base, fieldErrors: z.flattenError(parsed.error).fieldErrors };
96
+ }
97
+ const expectedFingerprint = z.string().min(1).optional().safeParse(input.expectedSetupFingerprint);
98
+ if (!expectedFingerprint.success) {
99
+ return {
100
+ ...base,
101
+ fieldErrors: { expectedSetupFingerprint: ['Provide a nonempty setup fingerprint from preview.'] },
102
+ };
103
+ }
104
+ const source = parsed.data;
105
+ const example = knownServerExamples.find((entry) => entry.id === source.exampleId);
106
+ if (!example) {
107
+ return {
108
+ ...base,
109
+ status: 'not_found',
110
+ error: `Unknown example '${source.exampleId}'. Choose ${knownServerExamples.map((entry) => entry.id).join(', ')}.`,
111
+ };
112
+ }
113
+ const targetName = source.localName ?? example.id;
114
+ const targetSource = source.checkout === undefined ? 'mcpTemplates' : 'mcpServers';
115
+ const result = {
116
+ ...base,
117
+ targetName,
118
+ targetSource,
119
+ exampleId: example.id,
120
+ metadata: { localName: targetName },
121
+ warnings: [
122
+ 'Maintained setup examples do not enable automatic preparation. Existing custom preparation recipes are preserved; setup does not verify their native readiness.',
123
+ 'Executable identity does not establish backend version compatibility or operation-specific readiness.',
124
+ ...example.nativeNextSteps,
125
+ ],
126
+ };
127
+ try {
128
+ const configuration = structuredClone((ports.readConfiguration ?? readKnownConfiguration)());
129
+ const configurationFingerprint = fingerprintConfiguredServerConfigDocument(configuration);
130
+ if (input.mode === 'apply' &&
131
+ expectedFingerprint.data !== undefined &&
132
+ !expectedFingerprint.data.startsWith(`${configurationFingerprint}.`)) {
133
+ return {
134
+ ...result,
135
+ status: 'setup_conflict',
136
+ error: 'Known server setup changed after preview. Review a new preview before applying.',
137
+ };
138
+ }
139
+ const otherSource = targetSource === 'mcpServers' ? 'mcpTemplates' : 'mcpServers';
140
+ if (Object.hasOwn(configuration[otherSource] ?? {}, targetName)) {
141
+ return {
142
+ ...result,
143
+ status: 'template_conflict',
144
+ error: `Target '${targetName}' exists in ${otherSource}; setup cannot convert target sources, even with force.`,
145
+ };
146
+ }
147
+ const existing = Object.hasOwn(configuration[targetSource] ?? {}, targetName)
148
+ ? configuration[targetSource]?.[targetName]
149
+ : undefined;
150
+ const inheritedEnv = z
151
+ .object({ env: z.unknown().optional() })
152
+ .loose()
153
+ .parse(configuration.serverDefaults ?? {}).env;
154
+ let exampleEnv = Array.isArray(inheritedEnv) ? undefined : example.env;
155
+ if (exampleEnv && inheritedEnv !== null && typeof inheritedEnv === 'object') {
156
+ const missingDefaults = Object.entries(exampleEnv).filter(([key]) => !Object.hasOwn(inheritedEnv, key));
157
+ exampleEnv = missingDefaults.length > 0 ? Object.fromEntries(missingDefaults) : undefined;
158
+ }
159
+ if (example.env && (Array.isArray(inheritedEnv) || Array.isArray(existing?.env))) {
160
+ result.warnings.push('Preserved array-form environment inheritance; example environment defaults are not added. Review native download and daemon settings before starting the backend.');
161
+ }
162
+ const requestedExecutable = source.executable ?? existing?.command ?? example.executable;
163
+ const executable = await (ports.resolveExecutable ?? resolveKnownServerExecutable)(requestedExecutable);
164
+ if (!executable) {
165
+ const error = `Executable '${requestedExecutable}' is missing or not executable. ${example.prerequisites.join(' ')} Supply --executable with an absolute launcher path.`;
166
+ return {
167
+ ...result,
168
+ error,
169
+ fieldErrors: { executable: [error] },
170
+ };
171
+ }
172
+ if (!absolutePath.safeParse(executable).success) {
173
+ const error = 'Resolved executable must be an absolute literal launcher path.';
174
+ return { ...result, error, fieldErrors: { executable: [error] } };
175
+ }
176
+ let checkout = checkoutMarker;
177
+ if (source.checkout !== undefined) {
178
+ checkout = await realpath(source.checkout);
179
+ if (!absolutePath.safeParse(checkout).success || !(await stat(checkout)).isDirectory()) {
180
+ return { ...result, error: 'Checkout must resolve to a literal directory path.' };
181
+ }
182
+ }
183
+ let config = {
184
+ ...example.config,
185
+ type: 'stdio',
186
+ command: executable,
187
+ args: example.args.map((argument) => (argument === checkoutMarker ? checkout : argument)),
188
+ cwd: checkout,
189
+ ...(exampleEnv ? { env: { ...exampleEnv } } : {}),
190
+ };
191
+ if (existing) {
192
+ if (existing.type !== 'stdio' && existing.type !== undefined) {
193
+ return { ...result, status: 'exists', error: 'Known setup cannot convert an existing non-stdio target.' };
194
+ }
195
+ if (targetSource === 'mcpTemplates') {
196
+ const checkoutIndex = example.args.indexOf(checkoutMarker);
197
+ if (existing.cwd !== checkoutMarker || existing.args?.[checkoutIndex] !== checkoutMarker) {
198
+ return {
199
+ ...result,
200
+ error: `Existing template is not reusable: cwd and the checkout argument must both use ${checkoutMarker}. Reconfigure these explicit fields through the existing config edit workflow.`,
201
+ };
202
+ }
203
+ }
204
+ const compatible = existing.command === executable;
205
+ if (!compatible && !input.force) {
206
+ return {
207
+ ...result,
208
+ status: 'exists',
209
+ error: `Target '${targetName}' has a different launch configuration. Use force to reconfigure it.`,
210
+ };
211
+ }
212
+ config = {
213
+ ...example.config,
214
+ ...existing,
215
+ ...(example.config?.template ? { template: { ...example.config.template, ...existing.template } } : {}),
216
+ command: executable,
217
+ ...(exampleEnv ? { env: Array.isArray(existing.env) ? existing.env : { ...exampleEnv, ...existing.env } } : {}),
218
+ };
219
+ const matchesLaunch = example.args.every((argument, index) => argument === checkoutMarker || existing.args?.[index] === argument);
220
+ if (!matchesLaunch) {
221
+ if (!input.force) {
222
+ return {
223
+ ...result,
224
+ status: 'exists',
225
+ error: 'Existing custom launch arguments differ from the example. Use force to explicitly preserve this unverified custom launch configuration.',
226
+ };
227
+ }
228
+ result.warnings.push('Preserved custom launch configuration is not a verified example recipe.');
229
+ }
230
+ if (source.checkout !== undefined) {
231
+ const checkoutIndex = example.args.indexOf(checkoutMarker);
232
+ if (!matchesLaunch || existing.args?.[checkoutIndex] === undefined) {
233
+ return {
234
+ ...result,
235
+ error: 'Existing custom launch arguments cannot be rebound safely. Reconfigure the target explicitly before changing its checkout.',
236
+ };
237
+ }
238
+ const args = [...existing.args];
239
+ args[checkoutIndex] = checkout;
240
+ config = { ...config, args, cwd: checkout };
241
+ }
242
+ }
243
+ const validated = transportConfigSchema.safeParse(config);
244
+ if (!validated.success) {
245
+ return {
246
+ ...result,
247
+ error: 'Candidate server configuration is invalid.',
248
+ fieldErrors: z.flattenError(validated.error).fieldErrors,
249
+ };
250
+ }
251
+ result.setupFingerprint = `${configurationFingerprint}.${fingerprintConfiguredServerConfigDocument({
252
+ targetName,
253
+ targetSource,
254
+ exampleId: example.id,
255
+ serverConfig: config,
256
+ })}`;
257
+ if (input.mode === 'apply' &&
258
+ expectedFingerprint.data !== undefined &&
259
+ expectedFingerprint.data !== result.setupFingerprint) {
260
+ return {
261
+ ...result,
262
+ status: 'setup_conflict',
263
+ error: 'Known server setup changed after preview. Review a new preview before applying.',
264
+ };
265
+ }
266
+ if (existing) {
267
+ if (fingerprintConfiguredServerTarget(existing) === fingerprintConfiguredServerTarget(config)) {
268
+ return { ...result, status: 'unchanged', config };
269
+ }
270
+ if (!input.force) {
271
+ return {
272
+ ...result,
273
+ status: 'exists',
274
+ config,
275
+ error: `Target '${targetName}' already exists. Use force to reconfigure it.`,
276
+ };
277
+ }
278
+ }
279
+ if (input.mode === 'preview')
280
+ return { ...result, status: 'preview', config };
281
+ const service = createConfigChangeService();
282
+ let change;
283
+ if (existing) {
284
+ change = await (ports.editTarget ?? service.editConfiguredServerTarget.bind(service))({
285
+ sourceName: targetName,
286
+ targetName,
287
+ targetSource,
288
+ serverConfig: config,
289
+ expectedSourceFingerprint: fingerprintConfiguredServerTarget(existing),
290
+ expectedGlobalConfigFingerprint: fingerprintConfiguredServerDefaults(configuration.serverDefaults),
291
+ });
292
+ }
293
+ else {
294
+ const create = targetSource === 'mcpTemplates'
295
+ ? (ports.createTemplate ?? service.createTemplateConfiguredServerTarget.bind(service))
296
+ : (ports.createStatic ?? service.createStaticConfiguredServerTarget.bind(service));
297
+ change = await create({
298
+ targetName,
299
+ serverConfig: config,
300
+ backup: input.backup ?? 'skip',
301
+ expectedConfigFingerprint: configurationFingerprint,
302
+ });
303
+ }
304
+ let status = 'failed';
305
+ if (change.status === 'changed')
306
+ status = 'applied';
307
+ if (change.status === 'unchanged')
308
+ status = 'unchanged';
309
+ if (change.status === 'destination_conflict')
310
+ status = 'exists';
311
+ if (change.status === 'template_conflict')
312
+ status = 'template_conflict';
313
+ return {
314
+ ...result,
315
+ status,
316
+ config,
317
+ configChange: change,
318
+ warnings: [...result.warnings, ...change.warnings],
319
+ error: change.error,
320
+ };
321
+ }
322
+ catch {
323
+ return {
324
+ ...result,
325
+ status: 'failed',
326
+ error: 'Known server setup failed. Check the executable, checkout directory, and configuration access; no dependency installation was attempted.',
327
+ };
328
+ }
329
+ }
330
+ //# sourceMappingURL=knownServerSetup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knownServerSetup.js","sourceRoot":"","sources":["../../../src/domains/installation/knownServerSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI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C,kCAAkC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YACvF,MAAM,GAAG,MAAM,MAAM,CAAC;gBACpB,UAAU;gBACV,YAAY,EAAE,MAAM;gBACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,MAAM;gBAC9B,yBAAyB,EAAE,wBAAwB;aACpD,CAAC,CAAC;QACL,CAAC;QACD,IAAI,MAAM,GAAqC,QAAQ,CAAC;QACxD,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;YAAE,MAAM,GAAG,SAAS,CAAC;QACpD,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW;YAAE,MAAM,GAAG,WAAW,CAAC;QACxD,IAAI,MAAM,CAAC,MAAM,KAAK,sBAAsB;YAAE,MAAM,GAAG,QAAQ,CAAC;QAChE,IAAI,MAAM,CAAC,MAAM,KAAK,mBAAmB;YAAE,MAAM,GAAG,mBAAmB,CAAC;QACxE,OAAO;YACL,GAAG,MAAM;YACT,MAAM;YACN,MAAM;YACN,YAAY,EAAE,MAAM;YACpB,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC;YAClD,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,GAAG,MAAM;YACT,MAAM,EAAE,QAAQ;YAChB,KAAK,EACH,0IAA0I;SAC7I,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { MCPServerParams } from '../../core/types/index.js';
2
+ import type { ConfigBackupPolicy, ConfigChangeResult } from '../config-change/configChange.js';
3
+ export interface KnownServerSetupSource {
4
+ type: 'known';
5
+ exampleId: string;
6
+ localName?: string;
7
+ executable?: string;
8
+ checkout?: string;
9
+ }
10
+ export interface KnownServerSetupInput {
11
+ mode: 'preview' | 'apply';
12
+ source: KnownServerSetupSource;
13
+ force?: boolean;
14
+ backup?: ConfigBackupPolicy;
15
+ expectedSetupFingerprint?: string;
16
+ }
17
+ export interface KnownServerSetupResult {
18
+ status: 'preview' | 'applied' | 'unchanged' | 'exists' | 'template_conflict' | 'setup_conflict' | 'invalid_input' | 'not_found' | 'failed';
19
+ mode: 'preview' | 'apply';
20
+ sourceType: 'known';
21
+ setupFingerprint?: string;
22
+ exampleId?: string;
23
+ targetSource?: 'mcpServers' | 'mcpTemplates';
24
+ targetName?: string;
25
+ config?: MCPServerParams;
26
+ metadata?: {
27
+ localName: string;
28
+ };
29
+ configChange?: ConfigChangeResult;
30
+ warnings: string[];
31
+ fieldErrors?: Record<string, string[]>;
32
+ error?: string;
33
+ }
34
+ //# sourceMappingURL=knownServerSetupTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knownServerSetupTypes.d.ts","sourceRoot":"","sources":["../../../src/domains/installation/knownServerSetupTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAEzG,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,MAAM,EAAE,sBAAsB,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EACF,SAAS,GACT,SAAS,GACT,WAAW,GACX,QAAQ,GACR,mBAAmB,GACnB,gBAAgB,GAChB,eAAe,GACf,WAAW,GACX,QAAQ,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=knownServerSetupTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knownServerSetupTypes.js","sourceRoot":"","sources":["../../../src/domains/installation/knownServerSetupTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { ContextData } from '../../types/context.js';
2
+ export declare function withProjectBinding<T>(bindingId: string, context: ContextData | undefined, action: () => T): T;
3
+ export declare function getProjectBinding(): {
4
+ bindingId: string;
5
+ context?: ContextData;
6
+ } | undefined;
7
+ //# sourceMappingURL=projectBindingScope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectBindingScope.d.ts","sourceRoot":"","sources":["../../../src/domains/project-selection/projectBindingScope.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzD,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAE7G;AAED,wBAAgB,iBAAiB,IAAI;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,WAAW,CAAA;CAAE,GAAG,SAAS,CAE5F"}
@@ -0,0 +1,9 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks';
2
+ const projectBindingScope = new AsyncLocalStorage();
3
+ export function withProjectBinding(bindingId, context, action) {
4
+ return projectBindingScope.run({ bindingId, context }, action);
5
+ }
6
+ export function getProjectBinding() {
7
+ return projectBindingScope.getStore();
8
+ }
9
+ //# sourceMappingURL=projectBindingScope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectBindingScope.js","sourceRoot":"","sources":["../../../src/domains/project-selection/projectBindingScope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,mBAAmB,GAAG,IAAI,iBAAiB,EAAgD,CAAC;AAElG,MAAM,UAAU,kBAAkB,CAAI,SAAiB,EAAE,OAAgC,EAAE,MAAe;IACxG,OAAO,mBAAmB,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,mBAAmB,CAAC,QAAQ,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { InboundConnectionConfig } from '../../core/types/server.js';
2
+ import type { MCPServerParams } from '../../core/types/transport.js';
3
+ import type { ContextData } from '../../types/context.js';
4
+ export declare function hasExplicitProjectFilterSelection(filterConfig: InboundConnectionConfig): boolean;
5
+ /** Resolve defaults from the selected checkout on the runtime. Client JSON carries no effective-policy assertions. */
6
+ export declare function resolveProjectPolicies(context: ContextData, filterConfig?: InboundConnectionConfig): Promise<InboundConnectionConfig[]>;
7
+ export declare function isProjectBackendVisible(config: MCPServerParams | undefined, context: ContextData | undefined, policies: readonly InboundConnectionConfig[]): boolean;
8
+ /** Explain target ambiguity only for configured backends admitted by the request's existing filter. */
9
+ export declare function projectSelectionDiagnostic(config: MCPServerParams | undefined, context: ContextData | undefined, filterConfig: InboundConnectionConfig): string | undefined;
10
+ export declare function projectToolArguments(config: MCPServerParams | undefined, context: ContextData | undefined, args: unknown): unknown;
11
+ //# sourceMappingURL=projectPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectPolicy.d.ts","sourceRoot":"","sources":["../../../src/domains/project-selection/projectPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzD,wBAAgB,iCAAiC,CAAC,YAAY,EAAE,uBAAuB,GAAG,OAAO,CAUhG;AAED,sHAAsH;AACtH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,WAAW,EACpB,YAAY,GAAE,uBAA4B,GACzC,OAAO,CAAC,uBAAuB,EAAE,CAAC,CA2BpC;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,GAC3C,OAAO,CAWT;AAED,uGAAuG;AACvG,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,YAAY,EAAE,uBAAuB,GACpC,MAAM,GAAG,SAAS,CAWpB;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,IAAI,EAAE,OAAO,GACZ,OAAO,CAsBT"}
@@ -0,0 +1,104 @@
1
+ import { normalizeTags, resolveProjectContext } from '../../config/projectConfigLoader.js';
2
+ import { resolveFilterSelection } from '../../core/filtering/filterSelection.js';
3
+ import { TemplateFilteringService } from '../../core/filtering/templateFilteringService.js';
4
+ import { PresetManager } from '../preset/manager/presetManager.js';
5
+ import { requireProjectTarget, resolveProjectSelection } from './projectSelection.js';
6
+ export function hasExplicitProjectFilterSelection(filterConfig) {
7
+ const mode = filterConfig.projectFilterMode ?? filterConfig.tagFilterMode;
8
+ if (mode === 'none')
9
+ return false;
10
+ if (mode !== undefined)
11
+ return true;
12
+ return (filterConfig.presetName !== undefined ||
13
+ filterConfig.tagQuery !== undefined ||
14
+ filterConfig.tagExpression !== undefined ||
15
+ (filterConfig.tags?.length ?? 0) > 0);
16
+ }
17
+ /** Resolve defaults from the selected checkout on the runtime. Client JSON carries no effective-policy assertions. */
18
+ export async function resolveProjectPolicies(context, filterConfig = {}) {
19
+ const selection = resolveProjectSelection(context);
20
+ if (selection.kind === 'unresolved')
21
+ return [];
22
+ // Preserve the existing explicit-selector precedence for a single checkout.
23
+ // Combined selection always retains each runtime-derived member policy.
24
+ if (selection.kind === 'single' && hasExplicitProjectFilterSelection(filterConfig)) {
25
+ const { tags, tagExpression, tagQuery, tagFilterMode, presetName } = filterConfig;
26
+ return [{ tags, tagExpression, tagQuery, tagFilterMode, presetName }];
27
+ }
28
+ return Promise.all(selection.projects.map(async (project) => {
29
+ const { projectConfig } = await resolveProjectContext(project.path);
30
+ let filters = {};
31
+ if (projectConfig?.preset !== undefined) {
32
+ filters = { preset: projectConfig.preset };
33
+ }
34
+ else if (projectConfig?.filter !== undefined) {
35
+ filters = { filter: projectConfig.filter };
36
+ }
37
+ else if (projectConfig?.tags !== undefined) {
38
+ filters = { tags: normalizeTags(projectConfig.tags)?.join(',') };
39
+ }
40
+ const result = resolveFilterSelection(filters, {
41
+ presetLookup: { getPreset: (name) => PresetManager.getInstance().getPreset(name) ?? undefined },
42
+ });
43
+ if (!result.ok)
44
+ throw new Error(`Invalid project filter for ${project.label}: ${result.error.message}`);
45
+ return result.selection.compatibility;
46
+ }));
47
+ }
48
+ export function isProjectBackendVisible(config, context, policies) {
49
+ if (!config)
50
+ return true;
51
+ const mode = config.projectTarget?.mode ?? (config.template ? 'single' : 'independent');
52
+ if (mode === 'independent')
53
+ return true;
54
+ if (!context)
55
+ return !config.projectTarget;
56
+ const selected = resolveProjectSelection(context);
57
+ if (selected.kind === 'unresolved')
58
+ return false;
59
+ if (selected.kind === 'native-set' && mode !== 'native-set')
60
+ return false;
61
+ return policies.every((policy) => TemplateFilteringService.getMatchingTemplates([['backend', config]], policy).length === 1);
62
+ }
63
+ /** Explain target ambiguity only for configured backends admitted by the request's existing filter. */
64
+ export function projectSelectionDiagnostic(config, context, filterConfig) {
65
+ if (!config || !context || config.disabled)
66
+ return undefined;
67
+ const mode = config.projectTarget?.mode ?? (config.template ? 'single' : 'independent');
68
+ if (mode === 'independent')
69
+ return undefined;
70
+ if (TemplateFilteringService.getMatchingTemplates([['backend', config]], filterConfig).length === 0)
71
+ return undefined;
72
+ try {
73
+ requireProjectTarget(context, mode);
74
+ }
75
+ catch (error) {
76
+ return error instanceof Error ? error.message : String(error);
77
+ }
78
+ return undefined;
79
+ }
80
+ export function projectToolArguments(config, context, args) {
81
+ if (!config?.projectTarget)
82
+ return args;
83
+ const { mode, argument } = config.projectTarget;
84
+ if (mode === 'independent')
85
+ return args;
86
+ if (!context)
87
+ throw new Error('Project Selection is unresolved. Use --project <checkout> or --project-set <file>');
88
+ const selected = requireProjectTarget(context, mode);
89
+ if (!argument) {
90
+ if (!config.template)
91
+ throw new Error('This checkout-specific static backend has no target argument. Configure a target-bound template or an explicit projectTarget.argument.');
92
+ return args;
93
+ }
94
+ if (args !== undefined && (args === null || typeof args !== 'object' || Array.isArray(args))) {
95
+ throw new Error('Project-targeted tool arguments must be an object');
96
+ }
97
+ const supplied = args;
98
+ const target = mode === 'native-set' ? selected.map((project) => project.path) : selected[0].path;
99
+ if (supplied?.[argument] !== undefined && JSON.stringify(supplied[argument]) !== JSON.stringify(target)) {
100
+ throw new Error(`Tool argument '${argument}' conflicts with the explicit Project Selection`);
101
+ }
102
+ return { ...supplied, [argument]: target };
103
+ }
104
+ //# sourceMappingURL=projectPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectPolicy.js","sourceRoot":"","sources":["../../../src/domains/project-selection/projectPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC1F,OAAO,EAA6B,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAC3G,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAG3F,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAG7E,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEtF,MAAM,UAAU,iCAAiC,CAAC,YAAqC;IACrF,MAAM,IAAI,GAAG,YAAY,CAAC,iBAAiB,IAAI,YAAY,CAAC,aAAa,CAAC;IAC1E,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IAClC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,CACL,YAAY,CAAC,UAAU,KAAK,SAAS;QACrC,YAAY,CAAC,QAAQ,KAAK,SAAS;QACnC,YAAY,CAAC,aAAa,KAAK,SAAS;QACxC,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CACrC,CAAC;AACJ,CAAC;AAED,sHAAsH;AACtH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAoB,EACpB,eAAwC,EAAE;IAE1C,MAAM,SAAS,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACnD,IAAI,SAAS,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,EAAE,CAAC;IAC/C,4EAA4E;IAC5E,wEAAwE;IACxE,IAAI,SAAS,CAAC,IAAI,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,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,QAAQ,GAAG,IAA2C,CAAC;IAC7D,MAAM,MAAM,GAAG,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClG,IAAI,QAAQ,EAAE,CAAC,QAAQ,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACxG,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,iDAAiD,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { ContextData, ProjectSet, ProjectSetMember } from '../../types/context.js';
2
+ import { z } from 'zod';
3
+ export declare const projectSetSchema: z.ZodObject<{
4
+ name: z.ZodOptional<z.ZodString>;
5
+ projects: z.ZodArray<z.ZodObject<{
6
+ label: z.ZodString;
7
+ path: z.ZodString;
8
+ }, z.core.$strict>>;
9
+ selection: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ }, z.core.$strict>;
11
+ export type ResolvedProjectSelection = {
12
+ kind: 'unresolved';
13
+ availableLabels: string[];
14
+ } | {
15
+ kind: 'single';
16
+ projects: [ProjectSetMember];
17
+ } | {
18
+ kind: 'native-set';
19
+ projects: ProjectSetMember[];
20
+ };
21
+ export declare function resolveProjectSelection(context: Pick<ContextData, 'project' | 'projectSet'>): ResolvedProjectSelection;
22
+ export declare function canonicalizeProjectSet(value: unknown, baseDirectory: string, resolveCheckout?: typeof canonicalizeCheckoutPath): Promise<ProjectSet>;
23
+ export declare function canonicalizeCheckoutPath(checkout: string, baseDirectory: string): Promise<string>;
24
+ /** The only saved state is a user-selected file; this never updates a runtime-global current project. */
25
+ export declare function loadProjectSet(file: string, selection?: string[], resolveCheckout?: typeof canonicalizeCheckoutPath): Promise<ProjectSet>;
26
+ export declare function withProjectSelection(context: ContextData, projectSet: ProjectSet): ContextData;
27
+ /** Private routing identity. The canonical authentication/transport session remains unchanged. */
28
+ export declare function createProjectBindingId(sessionId: string, context: ContextData, bindingConfiguration?: unknown): string;
29
+ export declare function requireProjectTarget(context: ContextData, mode: 'independent' | 'single' | 'native-set'): ProjectSetMember[];
30
+ //# sourceMappingURL=projectSelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectSelection.d.ts","sourceRoot":"","sources":["../../../src/domains/project-selection/projectSelection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIvF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;;;;;kBAuBO,CAAC;AAErC,MAAM,MAAM,wBAAwB,GAChC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,eAAe,EAAE,MAAM,EAAE,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,CAAC,gBAAgB,CAAC,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;AAEzD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,YAAY,CAAC,GACnD,wBAAwB,CAa1B;AAED,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,MAAM,EACrB,eAAe,kCAA2B,GACzC,OAAO,CAAC,UAAU,CAAC,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