@1mcp/agent 0.35.0-beta.2 → 0.35.0-beta.4

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 (351) hide show
  1. package/README.md +5 -2
  2. package/build/admin/assets/admin-AboutRuntimeWorkspace-CM2ZafTJ.js +1 -0
  3. package/build/admin/assets/admin-BackendLogsWorkspace-CvJs1npx.js +1 -0
  4. package/build/admin/assets/admin-OAuthServicesWorkspace-BswG57Gm.js +1 -0
  5. package/build/admin/assets/admin-PresetAuthoringWorkspace-BIIRs_EN.js +1 -0
  6. package/build/admin/assets/admin-console-Brz9bnhv.css +1 -0
  7. package/build/admin/assets/{admin-console-C5_zD_qW.css → admin-console-DmRyrCWD.css} +1 -1
  8. package/build/admin/assets/admin-console-MT8QZmIC.js +3 -0
  9. package/build/admin/assets/admin-icons-D-JtMXSq.js +1 -0
  10. package/build/admin/assets/admin-mantine-DSFdoMaN.js +53 -0
  11. package/build/admin/assets/admin-react-BSaWeqgv.js +8 -0
  12. package/build/admin/assets/admin-rolldown-runtime-Bh1tDfsg.js +1 -0
  13. package/build/admin/favicon.svg +4 -0
  14. package/build/admin/index.html +8 -2
  15. package/build/auth/oauthAuthorizationFlow.d.ts +2 -2
  16. package/build/auth/oauthAuthorizationFlow.d.ts.map +1 -1
  17. package/build/auth/oauthAuthorizationFlow.js +1 -1
  18. package/build/auth/oauthAuthorizationFlow.js.map +1 -1
  19. package/build/auth/sdkOAuthServerProvider.d.ts +4 -3
  20. package/build/auth/sdkOAuthServerProvider.d.ts.map +1 -1
  21. package/build/auth/sdkOAuthServerProvider.js +132 -17
  22. package/build/auth/sdkOAuthServerProvider.js.map +1 -1
  23. package/build/auth/sessionTypes.d.ts +42 -5
  24. package/build/auth/sessionTypes.d.ts.map +1 -1
  25. package/build/auth/sessionTypes.js +33 -1
  26. package/build/auth/sessionTypes.js.map +1 -1
  27. package/build/auth/storage/fileStorageService.d.ts +18 -1
  28. package/build/auth/storage/fileStorageService.d.ts.map +1 -1
  29. package/build/auth/storage/fileStorageService.js +253 -3
  30. package/build/auth/storage/fileStorageService.js.map +1 -1
  31. package/build/auth/storage/oauthStorageService.d.ts +4 -1
  32. package/build/auth/storage/oauthStorageService.d.ts.map +1 -1
  33. package/build/auth/storage/oauthStorageService.js +8 -1
  34. package/build/auth/storage/oauthStorageService.js.map +1 -1
  35. package/build/auth/storage/refreshTokenFamilyRepository.d.ts +36 -0
  36. package/build/auth/storage/refreshTokenFamilyRepository.d.ts.map +1 -0
  37. package/build/auth/storage/refreshTokenFamilyRepository.js +167 -0
  38. package/build/auth/storage/refreshTokenFamilyRepository.js.map +1 -0
  39. package/build/auth/storage/sessionRepository.d.ts +14 -1
  40. package/build/auth/storage/sessionRepository.d.ts.map +1 -1
  41. package/build/auth/storage/sessionRepository.js +32 -9
  42. package/build/auth/storage/sessionRepository.js.map +1 -1
  43. package/build/commands/inspect/inspect.d.ts +1 -0
  44. package/build/commands/inspect/inspect.d.ts.map +1 -1
  45. package/build/commands/inspect/inspect.js +6 -10
  46. package/build/commands/inspect/inspect.js.map +1 -1
  47. package/build/commands/inspect/inspectUtils.d.ts +4 -0
  48. package/build/commands/inspect/inspectUtils.d.ts.map +1 -1
  49. package/build/commands/inspect/inspectUtils.js +12 -0
  50. package/build/commands/inspect/inspectUtils.js.map +1 -1
  51. package/build/commands/instructions/instructionsUtils.d.ts +2 -0
  52. package/build/commands/instructions/instructionsUtils.d.ts.map +1 -1
  53. package/build/commands/instructions/instructionsUtils.js +7 -3
  54. package/build/commands/instructions/instructionsUtils.js.map +1 -1
  55. package/build/commands/proxy/proxy.d.ts.map +1 -1
  56. package/build/commands/proxy/proxy.js +2 -0
  57. package/build/commands/proxy/proxy.js.map +1 -1
  58. package/build/commands/run/run.d.ts +1 -0
  59. package/build/commands/run/run.d.ts.map +1 -1
  60. package/build/commands/run/run.js +90 -8
  61. package/build/commands/run/run.js.map +1 -1
  62. package/build/commands/serve/asyncLoadingOptions.d.ts +30 -0
  63. package/build/commands/serve/asyncLoadingOptions.d.ts.map +1 -0
  64. package/build/commands/serve/asyncLoadingOptions.js +34 -0
  65. package/build/commands/serve/asyncLoadingOptions.js.map +1 -0
  66. package/build/commands/serve/index.d.ts +14 -1
  67. package/build/commands/serve/index.d.ts.map +1 -1
  68. package/build/commands/serve/index.js +24 -15
  69. package/build/commands/serve/index.js.map +1 -1
  70. package/build/commands/serve/serve.d.ts +5 -1
  71. package/build/commands/serve/serve.d.ts.map +1 -1
  72. package/build/commands/serve/serve.js +37 -8
  73. package/build/commands/serve/serve.js.map +1 -1
  74. package/build/commands/serve/serveBackground.d.ts.map +1 -1
  75. package/build/commands/serve/serveBackground.js +3 -0
  76. package/build/commands/serve/serveBackground.js.map +1 -1
  77. package/build/commands/serve/templateContextTrust.d.ts +12 -0
  78. package/build/commands/serve/templateContextTrust.d.ts.map +1 -0
  79. package/build/commands/serve/templateContextTrust.js +23 -0
  80. package/build/commands/serve/templateContextTrust.js.map +1 -0
  81. package/build/commands/shared/apiClient.d.ts +4 -1
  82. package/build/commands/shared/apiClient.d.ts.map +1 -1
  83. package/build/commands/shared/apiClient.js +8 -2
  84. package/build/commands/shared/apiClient.js.map +1 -1
  85. package/build/commands/shared/clientSurfaceAttachment.d.ts +14 -1
  86. package/build/commands/shared/clientSurfaceAttachment.d.ts.map +1 -1
  87. package/build/commands/shared/clientSurfaceAttachment.js +78 -10
  88. package/build/commands/shared/clientSurfaceAttachment.js.map +1 -1
  89. package/build/commands/shared/commandRunner.d.ts +1 -0
  90. package/build/commands/shared/commandRunner.d.ts.map +1 -1
  91. package/build/commands/shared/commandRunner.js +10 -2
  92. package/build/commands/shared/commandRunner.js.map +1 -1
  93. package/build/commands/shared/filterSelectionQuery.d.ts +8 -0
  94. package/build/commands/shared/filterSelectionQuery.d.ts.map +1 -0
  95. package/build/commands/shared/filterSelectionQuery.js +12 -0
  96. package/build/commands/shared/filterSelectionQuery.js.map +1 -0
  97. package/build/commands/shared/inspectApiSchemas.d.ts +83 -0
  98. package/build/commands/shared/inspectApiSchemas.d.ts.map +1 -0
  99. package/build/commands/shared/inspectApiSchemas.js +40 -0
  100. package/build/commands/shared/inspectApiSchemas.js.map +1 -0
  101. package/build/commands/shared/serveClient.d.ts +2 -1
  102. package/build/commands/shared/serveClient.d.ts.map +1 -1
  103. package/build/commands/shared/serveClient.js +3 -1
  104. package/build/commands/shared/serveClient.js.map +1 -1
  105. package/build/commands/shared/serveTargetResolver.d.ts +4 -0
  106. package/build/commands/shared/serveTargetResolver.d.ts.map +1 -1
  107. package/build/commands/shared/serveTargetResolver.js +25 -9
  108. package/build/commands/shared/serveTargetResolver.js.map +1 -1
  109. package/build/commands/wait/index.d.ts +3 -0
  110. package/build/commands/wait/index.d.ts.map +1 -0
  111. package/build/commands/wait/index.js +20 -0
  112. package/build/commands/wait/index.js.map +1 -0
  113. package/build/commands/wait/wait.d.ts +39 -0
  114. package/build/commands/wait/wait.d.ts.map +1 -0
  115. package/build/commands/wait/wait.js +162 -0
  116. package/build/commands/wait/wait.js.map +1 -0
  117. package/build/config/configLoader.d.ts.map +1 -1
  118. package/build/config/configLoader.js +12 -0
  119. package/build/config/configLoader.js.map +1 -1
  120. package/build/constants/auth.d.ts +10 -1
  121. package/build/constants/auth.d.ts.map +1 -1
  122. package/build/constants/auth.js +11 -1
  123. package/build/constants/auth.js.map +1 -1
  124. package/build/constants/mcp.d.ts +7 -1
  125. package/build/constants/mcp.d.ts.map +1 -1
  126. package/build/constants/mcp.js +9 -1
  127. package/build/constants/mcp.js.map +1 -1
  128. package/build/core/capabilities/capabilityAggregator.d.ts.map +1 -1
  129. package/build/core/capabilities/capabilityAggregator.js +10 -9
  130. package/build/core/capabilities/capabilityAggregator.js.map +1 -1
  131. package/build/core/capabilities/capabilityCatalog.d.ts +28 -5
  132. package/build/core/capabilities/capabilityCatalog.d.ts.map +1 -1
  133. package/build/core/capabilities/capabilityCatalog.js +98 -23
  134. package/build/core/capabilities/capabilityCatalog.js.map +1 -1
  135. package/build/core/capabilities/capabilityPagination.d.ts +40 -0
  136. package/build/core/capabilities/capabilityPagination.d.ts.map +1 -0
  137. package/build/core/capabilities/capabilityPagination.js +285 -0
  138. package/build/core/capabilities/capabilityPagination.js.map +1 -0
  139. package/build/core/capabilities/capabilityVisibility.d.ts +13 -0
  140. package/build/core/capabilities/capabilityVisibility.d.ts.map +1 -0
  141. package/build/core/capabilities/capabilityVisibility.js +14 -0
  142. package/build/core/capabilities/capabilityVisibility.js.map +1 -0
  143. package/build/core/capabilities/internalCapabilitiesProvider.d.ts +2 -1
  144. package/build/core/capabilities/internalCapabilitiesProvider.d.ts.map +1 -1
  145. package/build/core/capabilities/internalCapabilitiesProvider.js +2 -2
  146. package/build/core/capabilities/internalCapabilitiesProvider.js.map +1 -1
  147. package/build/core/capabilities/lazyLoadingOrchestrator.d.ts +5 -23
  148. package/build/core/capabilities/lazyLoadingOrchestrator.d.ts.map +1 -1
  149. package/build/core/capabilities/lazyLoadingOrchestrator.js +25 -44
  150. package/build/core/capabilities/lazyLoadingOrchestrator.js.map +1 -1
  151. package/build/core/capabilities/metaToolProvider.d.ts +6 -21
  152. package/build/core/capabilities/metaToolProvider.d.ts.map +1 -1
  153. package/build/core/capabilities/metaToolProvider.js +18 -70
  154. package/build/core/capabilities/metaToolProvider.js.map +1 -1
  155. package/build/core/capabilities/toolRegistry.d.ts +5 -1
  156. package/build/core/capabilities/toolRegistry.d.ts.map +1 -1
  157. package/build/core/capabilities/toolRegistry.js +11 -3
  158. package/build/core/capabilities/toolRegistry.js.map +1 -1
  159. package/build/core/client/clientManager.d.ts +9 -0
  160. package/build/core/client/clientManager.d.ts.map +1 -1
  161. package/build/core/client/clientManager.js +87 -0
  162. package/build/core/client/clientManager.js.map +1 -1
  163. package/build/core/client/recreateHttpTransportOptions.d.ts +14 -0
  164. package/build/core/client/recreateHttpTransportOptions.d.ts.map +1 -0
  165. package/build/core/client/recreateHttpTransportOptions.js +2 -0
  166. package/build/core/client/recreateHttpTransportOptions.js.map +1 -0
  167. package/build/core/client/transportRecreator.d.ts +8 -1
  168. package/build/core/client/transportRecreator.d.ts.map +1 -1
  169. package/build/core/client/transportRecreator.js +11 -2
  170. package/build/core/client/transportRecreator.js.map +1 -1
  171. package/build/core/context/templateContextTrust.d.ts +66 -0
  172. package/build/core/context/templateContextTrust.d.ts.map +1 -0
  173. package/build/core/context/templateContextTrust.js +184 -0
  174. package/build/core/context/templateContextTrust.js.map +1 -0
  175. package/build/core/instructions/templateTypes.d.ts +2 -2
  176. package/build/core/instructions/templateTypes.d.ts.map +1 -1
  177. package/build/core/protocol/notificationHandlers.d.ts.map +1 -1
  178. package/build/core/protocol/notificationHandlers.js +26 -4
  179. package/build/core/protocol/notificationHandlers.js.map +1 -1
  180. package/build/core/protocol/promptRequestHandlers.d.ts.map +1 -1
  181. package/build/core/protocol/promptRequestHandlers.js +20 -11
  182. package/build/core/protocol/promptRequestHandlers.js.map +1 -1
  183. package/build/core/protocol/requestHandlerUtils.d.ts +7 -0
  184. package/build/core/protocol/requestHandlerUtils.d.ts.map +1 -1
  185. package/build/core/protocol/requestHandlerUtils.js +43 -7
  186. package/build/core/protocol/requestHandlerUtils.js.map +1 -1
  187. package/build/core/protocol/resourceRequestHandlers.d.ts.map +1 -1
  188. package/build/core/protocol/resourceRequestHandlers.js +38 -18
  189. package/build/core/protocol/resourceRequestHandlers.js.map +1 -1
  190. package/build/core/protocol/toolRequestHandlers.d.ts.map +1 -1
  191. package/build/core/protocol/toolRequestHandlers.js +73 -30
  192. package/build/core/protocol/toolRequestHandlers.js.map +1 -1
  193. package/build/core/runtime/runtimeIdentityService.d.ts +1 -0
  194. package/build/core/runtime/runtimeIdentityService.d.ts.map +1 -1
  195. package/build/core/runtime/runtimeIdentityService.js +4 -1
  196. package/build/core/runtime/runtimeIdentityService.js.map +1 -1
  197. package/build/core/server/agentConfig.d.ts +4 -0
  198. package/build/core/server/agentConfig.d.ts.map +1 -1
  199. package/build/core/server/agentConfig.js +3 -0
  200. package/build/core/server/agentConfig.js.map +1 -1
  201. package/build/core/server/clientInstanceFactory.d.ts.map +1 -1
  202. package/build/core/server/clientInstanceFactory.js +12 -3
  203. package/build/core/server/clientInstanceFactory.js.map +1 -1
  204. package/build/core/server/connectionManager.d.ts +0 -6
  205. package/build/core/server/connectionManager.d.ts.map +1 -1
  206. package/build/core/server/connectionManager.js +2 -39
  207. package/build/core/server/connectionManager.js.map +1 -1
  208. package/build/core/server/connectionResolver.d.ts.map +1 -1
  209. package/build/core/server/connectionResolver.js +35 -1
  210. package/build/core/server/connectionResolver.js.map +1 -1
  211. package/build/core/server/requestContextPreparation.d.ts +2 -1
  212. package/build/core/server/requestContextPreparation.d.ts.map +1 -1
  213. package/build/core/server/requestContextPreparation.js.map +1 -1
  214. package/build/core/server/runtimeScopeOwnership.js +1 -1
  215. package/build/core/server/runtimeScopeOwnership.js.map +1 -1
  216. package/build/core/server/templateServerManager.d.ts.map +1 -1
  217. package/build/core/server/templateServerManager.js +2 -0
  218. package/build/core/server/templateServerManager.js.map +1 -1
  219. package/build/core/tools/internal/schemas/discovery.d.ts +1 -1
  220. package/build/core/tools/internal/schemas/index.d.ts +7 -7
  221. package/build/core/tools/internal/schemas/installation.d.ts +3 -3
  222. package/build/core/tools/internal/schemas/management.d.ts +3 -3
  223. package/build/core/types/server.d.ts +2 -0
  224. package/build/core/types/server.d.ts.map +1 -1
  225. package/build/core/types/server.js.map +1 -1
  226. package/build/core/types/transport.d.ts +12 -0
  227. package/build/core/types/transport.d.ts.map +1 -1
  228. package/build/core/types/transport.js +23 -5
  229. package/build/core/types/transport.js.map +1 -1
  230. package/build/domains/admin/adminConfiguredServerService.d.ts +80 -0
  231. package/build/domains/admin/adminConfiguredServerService.d.ts.map +1 -1
  232. package/build/domains/admin/adminConfiguredServerService.js +507 -1
  233. package/build/domains/admin/adminConfiguredServerService.js.map +1 -1
  234. package/build/domains/backend-logs/backendLogBroker.d.ts +47 -0
  235. package/build/domains/backend-logs/backendLogBroker.d.ts.map +1 -0
  236. package/build/domains/backend-logs/backendLogBroker.js +249 -0
  237. package/build/domains/backend-logs/backendLogBroker.js.map +1 -0
  238. package/build/domains/backend-logs/backendLogProjection.d.ts +9 -0
  239. package/build/domains/backend-logs/backendLogProjection.d.ts.map +1 -0
  240. package/build/domains/backend-logs/backendLogProjection.js +40 -0
  241. package/build/domains/backend-logs/backendLogProjection.js.map +1 -0
  242. package/build/domains/backend-logs/backendLogRuntime.d.ts +4 -0
  243. package/build/domains/backend-logs/backendLogRuntime.d.ts.map +1 -0
  244. package/build/domains/backend-logs/backendLogRuntime.js +11 -0
  245. package/build/domains/backend-logs/backendLogRuntime.js.map +1 -0
  246. package/build/domains/backend-logs/backendLogSanitizer.d.ts +2 -0
  247. package/build/domains/backend-logs/backendLogSanitizer.d.ts.map +1 -0
  248. package/build/domains/backend-logs/backendLogSanitizer.js +30 -0
  249. package/build/domains/backend-logs/backendLogSanitizer.js.map +1 -0
  250. package/build/domains/backend-logs/backendLogSource.d.ts +8 -0
  251. package/build/domains/backend-logs/backendLogSource.d.ts.map +1 -0
  252. package/build/domains/backend-logs/backendLogSource.js +22 -0
  253. package/build/domains/backend-logs/backendLogSource.js.map +1 -0
  254. package/build/domains/backend-logs/backendLogTypes.d.ts +49 -0
  255. package/build/domains/backend-logs/backendLogTypes.d.ts.map +1 -0
  256. package/build/domains/backend-logs/backendLogTypes.js +2 -0
  257. package/build/domains/backend-logs/backendLogTypes.js.map +1 -0
  258. package/build/domains/config-change/configChange.d.ts +2 -1
  259. package/build/domains/config-change/configChange.d.ts.map +1 -1
  260. package/build/domains/config-change/configChange.js +88 -0
  261. package/build/domains/config-change/configChange.js.map +1 -1
  262. package/build/domains/config-change/types.d.ts +5 -1
  263. package/build/domains/config-change/types.d.ts.map +1 -1
  264. package/build/domains/installation/serverInstallationSourceResolution.js +2 -0
  265. package/build/domains/installation/serverInstallationSourceResolution.js.map +1 -1
  266. package/build/domains/installation/serverInstallationTypes.d.ts +8 -0
  267. package/build/domains/installation/serverInstallationTypes.d.ts.map +1 -1
  268. package/build/domains/installation/serverInstallationWorkflow.js +16 -3
  269. package/build/domains/installation/serverInstallationWorkflow.js.map +1 -1
  270. package/build/domains/runtime-targets/runtimeIdentityVerification.d.ts +8 -1
  271. package/build/domains/runtime-targets/runtimeIdentityVerification.d.ts.map +1 -1
  272. package/build/domains/runtime-targets/runtimeIdentityVerification.js +62 -3
  273. package/build/domains/runtime-targets/runtimeIdentityVerification.js.map +1 -1
  274. package/build/domains/runtime-targets/runtimeProbe.d.ts +34 -0
  275. package/build/domains/runtime-targets/runtimeProbe.d.ts.map +1 -0
  276. package/build/domains/runtime-targets/runtimeProbe.js +71 -0
  277. package/build/domains/runtime-targets/runtimeProbe.js.map +1 -0
  278. package/build/index.d.ts.map +1 -1
  279. package/build/index.js +3 -0
  280. package/build/index.js.map +1 -1
  281. package/build/transport/http/middlewares/httpRequestLogger.d.ts.map +1 -1
  282. package/build/transport/http/middlewares/httpRequestLogger.js +3 -2
  283. package/build/transport/http/middlewares/httpRequestLogger.js.map +1 -1
  284. package/build/transport/http/routes/adminRoutes.d.ts +2 -0
  285. package/build/transport/http/routes/adminRoutes.d.ts.map +1 -1
  286. package/build/transport/http/routes/adminRoutes.js +288 -31
  287. package/build/transport/http/routes/adminRoutes.js.map +1 -1
  288. package/build/transport/http/routes/inspectHelpers.d.ts +11 -4
  289. package/build/transport/http/routes/inspectHelpers.d.ts.map +1 -1
  290. package/build/transport/http/routes/inspectHelpers.js +21 -2
  291. package/build/transport/http/routes/inspectHelpers.js.map +1 -1
  292. package/build/transport/http/routes/inspectRequestContext.d.ts.map +1 -1
  293. package/build/transport/http/routes/inspectRequestContext.js +13 -4
  294. package/build/transport/http/routes/inspectRequestContext.js.map +1 -1
  295. package/build/transport/http/routes/inspectRoutes.d.ts.map +1 -1
  296. package/build/transport/http/routes/inspectRoutes.js +55 -4
  297. package/build/transport/http/routes/inspectRoutes.js.map +1 -1
  298. package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
  299. package/build/transport/http/routes/streamableHttpRoutes.js +13 -4
  300. package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
  301. package/build/transport/http/routes/toolRoutes.d.ts.map +1 -1
  302. package/build/transport/http/routes/toolRoutes.js +37 -29
  303. package/build/transport/http/routes/toolRoutes.js.map +1 -1
  304. package/build/transport/http/server.d.ts.map +1 -1
  305. package/build/transport/http/server.js +3 -1
  306. package/build/transport/http/server.js.map +1 -1
  307. package/build/transport/http/storage/streamableSessionRepository.d.ts.map +1 -1
  308. package/build/transport/http/storage/streamableSessionRepository.js +2 -0
  309. package/build/transport/http/storage/streamableSessionRepository.js.map +1 -1
  310. package/build/transport/http/streamableSessionLifecycle.d.ts +3 -1
  311. package/build/transport/http/streamableSessionLifecycle.d.ts.map +1 -1
  312. package/build/transport/http/streamableSessionLifecycle.js +23 -6
  313. package/build/transport/http/streamableSessionLifecycle.js.map +1 -1
  314. package/build/transport/http/utils/contextExtractor.d.ts +14 -16
  315. package/build/transport/http/utils/contextExtractor.d.ts.map +1 -1
  316. package/build/transport/http/utils/contextExtractor.js +124 -33
  317. package/build/transport/http/utils/contextExtractor.js.map +1 -1
  318. package/build/transport/http/utils/templateContextAuthority.d.ts +13 -0
  319. package/build/transport/http/utils/templateContextAuthority.d.ts.map +1 -0
  320. package/build/transport/http/utils/templateContextAuthority.js +121 -0
  321. package/build/transport/http/utils/templateContextAuthority.js.map +1 -0
  322. package/build/transport/managedStdioStderr.d.ts +17 -1
  323. package/build/transport/managedStdioStderr.d.ts.map +1 -1
  324. package/build/transport/managedStdioStderr.js +129 -5
  325. package/build/transport/managedStdioStderr.js.map +1 -1
  326. package/build/transport/managedStdioStderrOptions.d.ts +2 -0
  327. package/build/transport/managedStdioStderrOptions.d.ts.map +1 -1
  328. package/build/transport/restartableStdioTransport.js +1 -1
  329. package/build/transport/restartableStdioTransport.js.map +1 -1
  330. package/build/transport/stdioProxyTransport.d.ts +3 -0
  331. package/build/transport/stdioProxyTransport.d.ts.map +1 -1
  332. package/build/transport/stdioProxyTransport.js +7 -2
  333. package/build/transport/stdioProxyTransport.js.map +1 -1
  334. package/build/transport/transportFactory.d.ts +6 -2
  335. package/build/transport/transportFactory.d.ts.map +1 -1
  336. package/build/transport/transportFactory.js +43 -15
  337. package/build/transport/transportFactory.js.map +1 -1
  338. package/build/types/serverStatus.d.ts +3 -0
  339. package/build/types/serverStatus.d.ts.map +1 -0
  340. package/build/types/serverStatus.js +13 -0
  341. package/build/types/serverStatus.js.map +1 -0
  342. package/build/utils/validation/urlDetection.d.ts +12 -9
  343. package/build/utils/validation/urlDetection.d.ts.map +1 -1
  344. package/build/utils/validation/urlDetection.js +233 -31
  345. package/build/utils/validation/urlDetection.js.map +1 -1
  346. package/package.json +4 -3
  347. package/build/admin/assets/admin-console-CbHHoqLr.js +0 -61
  348. package/build/utils/ui/pagination.d.ts +0 -35
  349. package/build/utils/ui/pagination.d.ts.map +0 -1
  350. package/build/utils/ui/pagination.js +0 -166
  351. package/build/utils/ui/pagination.js.map +0 -1
@@ -0,0 +1,249 @@
1
+ import { sanitizeBackendLogContent } from './backendLogSanitizer.js';
2
+ const DEFAULT_PER_SOURCE_BYTES = 1024 * 1024;
3
+ const DEFAULT_GLOBAL_BYTES = 32 * 1024 * 1024;
4
+ const DEFAULT_SUBSCRIBER_QUEUE_BYTES = 256 * 1024;
5
+ export class BackendLogBroker {
6
+ perSourceBytes;
7
+ globalBytesLimit;
8
+ subscriberQueueBytes;
9
+ now;
10
+ measureEntry;
11
+ sources = new Map();
12
+ retainedBySource = new Map();
13
+ bytesBySource = new Map();
14
+ retainedGlobal = [];
15
+ retainedGlobalHead = 0;
16
+ subscribers = new Set();
17
+ nextSequence = 1;
18
+ globalBytes = 0;
19
+ constructor(options = {}) {
20
+ this.perSourceBytes = options.perSourceBytes ?? DEFAULT_PER_SOURCE_BYTES;
21
+ this.globalBytesLimit = options.globalBytes ?? DEFAULT_GLOBAL_BYTES;
22
+ this.subscriberQueueBytes = options.subscriberQueueBytes ?? DEFAULT_SUBSCRIBER_QUEUE_BYTES;
23
+ this.now = options.now ?? (() => new Date());
24
+ this.measureEntry = options.measureEntry ?? ((entry) => Buffer.byteLength(JSON.stringify(entry)));
25
+ }
26
+ registerSource(source) {
27
+ const current = this.sources.get(source.id);
28
+ this.sources.set(source.id, current ? { ...current, ...source } : source);
29
+ this.enqueueSourceUpdate({ sourceId: source.id, source: this.sources.get(source.id), removed: false });
30
+ }
31
+ updateSource(sourceId, update) {
32
+ const source = this.sources.get(sourceId);
33
+ if (!source)
34
+ return;
35
+ this.sources.set(sourceId, { ...source, ...update });
36
+ this.enqueueSourceUpdate({ sourceId, source: this.sources.get(sourceId), removed: false });
37
+ this.removeEndedSourceWithoutHistory(sourceId);
38
+ }
39
+ publish(input) {
40
+ const source = this.sources.get(input.sourceId);
41
+ if (!source)
42
+ throw new Error(`Backend log source is not registered: ${input.sourceId}`);
43
+ if (source.capture !== 'managed')
44
+ throw new Error(`Backend log source is not captured: ${input.sourceId}`);
45
+ const entry = {
46
+ sequence: this.nextSequence++,
47
+ timestamp: this.now().toISOString(),
48
+ sourceId: source.id,
49
+ canonicalName: source.canonicalName,
50
+ displayName: source.displayName,
51
+ sourceKind: source.kind,
52
+ kind: input.kind,
53
+ content: sanitizeBackendLogContent(input.content),
54
+ ...(input.count === undefined ? {} : { count: input.count }),
55
+ truncated: input.truncated ?? false,
56
+ };
57
+ const retained = { entry, bytes: Math.max(1, this.measureEntry(entry)), evicted: false };
58
+ const sourceEntries = this.retainedBySource.get(source.id) ?? [];
59
+ sourceEntries.push(retained);
60
+ this.retainedBySource.set(source.id, sourceEntries);
61
+ this.bytesBySource.set(source.id, (this.bytesBySource.get(source.id) ?? 0) + retained.bytes);
62
+ this.retainedGlobal.push(retained);
63
+ this.globalBytes += retained.bytes;
64
+ this.evictSource(source.id);
65
+ this.evictGlobal();
66
+ this.enqueueForSubscribers(retained);
67
+ return entry;
68
+ }
69
+ snapshot(sourceId) {
70
+ const retained = sourceId === undefined
71
+ ? this.retainedEntries()
72
+ : (this.retainedBySource.get(sourceId) ?? []).filter((entry) => !entry.evicted);
73
+ return {
74
+ sequence: this.nextSequence - 1,
75
+ sources: [...this.sources.values()].sort((left, right) => left.id.localeCompare(right.id)),
76
+ entries: retained.map(({ entry }) => entry),
77
+ };
78
+ }
79
+ replayAfter(sequence) {
80
+ const entries = this.retainedEntries();
81
+ const oldestSequence = entries[0]?.entry.sequence;
82
+ if (sequence > this.nextSequence - 1 ||
83
+ (oldestSequence !== undefined && sequence < oldestSequence - 1) ||
84
+ (oldestSequence === undefined && sequence < this.nextSequence - 1)) {
85
+ return { kind: 'gap', snapshot: this.snapshot() };
86
+ }
87
+ return {
88
+ kind: 'replay',
89
+ entries: entries.filter(({ entry }) => entry.sequence > sequence).map(({ entry }) => entry),
90
+ };
91
+ }
92
+ subscribe(input) {
93
+ const subscriber = { ...input, queue: [], queuedBytes: 0, immediate: null, closed: false };
94
+ this.subscribers.add(subscriber);
95
+ return () => this.closeSubscriber(subscriber);
96
+ }
97
+ clear() {
98
+ for (const subscriber of [...this.subscribers])
99
+ this.disconnectSubscriber(subscriber, 'broker-reset');
100
+ this.sources.clear();
101
+ this.retainedBySource.clear();
102
+ this.bytesBySource.clear();
103
+ this.retainedGlobal.length = 0;
104
+ this.retainedGlobalHead = 0;
105
+ this.globalBytes = 0;
106
+ this.nextSequence = 1;
107
+ }
108
+ retainedEntries() {
109
+ return this.retainedGlobal.slice(this.retainedGlobalHead).filter((retained) => !retained.evicted);
110
+ }
111
+ evictSource(sourceId) {
112
+ const entries = this.retainedBySource.get(sourceId);
113
+ if (!entries)
114
+ return;
115
+ let bytes = this.bytesBySource.get(sourceId) ?? 0;
116
+ while (entries.length > 0 && bytes > this.perSourceBytes) {
117
+ const evicted = entries.shift();
118
+ evicted.evicted = true;
119
+ bytes -= evicted.bytes;
120
+ this.globalBytes -= evicted.bytes;
121
+ }
122
+ if (entries.length === 0) {
123
+ this.retainedBySource.delete(sourceId);
124
+ this.bytesBySource.delete(sourceId);
125
+ }
126
+ else {
127
+ this.bytesBySource.set(sourceId, bytes);
128
+ }
129
+ this.removeEndedSourceWithoutHistory(sourceId);
130
+ }
131
+ evictGlobal() {
132
+ while (this.retainedGlobal[this.retainedGlobalHead]?.evicted)
133
+ this.retainedGlobalHead++;
134
+ while (this.globalBytes > this.globalBytesLimit) {
135
+ const oldest = this.retainedGlobal[this.retainedGlobalHead++];
136
+ if (!oldest)
137
+ break;
138
+ const sourceId = oldest.entry.sourceId;
139
+ const entries = this.retainedBySource.get(sourceId);
140
+ if (entries) {
141
+ const entryIndex = entries.indexOf(oldest);
142
+ if (entryIndex >= 0)
143
+ entries.splice(entryIndex, 1);
144
+ }
145
+ oldest.evicted = true;
146
+ this.globalBytes -= oldest.bytes;
147
+ const sourceBytes = Math.max(0, (this.bytesBySource.get(sourceId) ?? 0) - oldest.bytes);
148
+ if (!entries || entries.length === 0) {
149
+ this.retainedBySource.delete(sourceId);
150
+ this.bytesBySource.delete(sourceId);
151
+ }
152
+ else {
153
+ this.bytesBySource.set(sourceId, sourceBytes);
154
+ }
155
+ this.removeEndedSourceWithoutHistory(sourceId);
156
+ while (this.retainedGlobal[this.retainedGlobalHead]?.evicted)
157
+ this.retainedGlobalHead++;
158
+ }
159
+ this.compactGlobalQueue();
160
+ }
161
+ compactGlobalQueue() {
162
+ if (this.retainedGlobalHead < 1024 || this.retainedGlobalHead * 2 < this.retainedGlobal.length)
163
+ return;
164
+ this.retainedGlobal.splice(0, this.retainedGlobalHead);
165
+ this.retainedGlobalHead = 0;
166
+ }
167
+ removeEndedSourceWithoutHistory(sourceId) {
168
+ const source = this.sources.get(sourceId);
169
+ if (source?.kind === 'template' && source.lifecycle === 'ended' && !this.retainedBySource.has(sourceId)) {
170
+ this.sources.delete(sourceId);
171
+ this.enqueueSourceUpdate({ sourceId, removed: true });
172
+ }
173
+ }
174
+ enqueueForSubscribers(retained) {
175
+ for (const subscriber of [...this.subscribers]) {
176
+ this.enqueueSubscriberEvent(subscriber, { kind: 'entry', retained, bytes: retained.bytes });
177
+ }
178
+ }
179
+ enqueueSourceUpdate(update) {
180
+ const bytes = Buffer.byteLength(JSON.stringify(update));
181
+ for (const subscriber of [...this.subscribers]) {
182
+ this.enqueueSubscriberEvent(subscriber, { kind: 'source', update, bytes });
183
+ }
184
+ }
185
+ enqueueSubscriberEvent(subscriber, event) {
186
+ subscriber.queue.push(event);
187
+ subscriber.queuedBytes += event.bytes;
188
+ if (subscriber.queuedBytes > this.subscriberQueueBytes) {
189
+ this.closeSubscriber(subscriber);
190
+ if (subscriber.onDisconnect) {
191
+ const notify = subscriber.onDisconnect;
192
+ const immediate = setImmediate(() => {
193
+ try {
194
+ notify('slow-subscriber');
195
+ }
196
+ catch {
197
+ // Subscriber failures must not escape the scheduled callback.
198
+ }
199
+ });
200
+ immediate.unref?.();
201
+ }
202
+ return;
203
+ }
204
+ if (subscriber.immediate)
205
+ return;
206
+ subscriber.immediate = setImmediate(() => this.flushSubscriber(subscriber));
207
+ subscriber.immediate.unref?.();
208
+ }
209
+ flushSubscriber(subscriber) {
210
+ subscriber.immediate = null;
211
+ if (subscriber.closed)
212
+ return;
213
+ const queued = subscriber.queue;
214
+ subscriber.queue = [];
215
+ subscriber.queuedBytes = 0;
216
+ try {
217
+ for (const event of queued) {
218
+ if (event.kind === 'entry')
219
+ subscriber.onEvent(event.retained.entry);
220
+ else
221
+ subscriber.onSourceUpdate?.(event.update);
222
+ }
223
+ }
224
+ catch {
225
+ this.closeSubscriber(subscriber);
226
+ }
227
+ }
228
+ disconnectSubscriber(subscriber, reason) {
229
+ this.closeSubscriber(subscriber);
230
+ try {
231
+ subscriber.onDisconnect?.(reason);
232
+ }
233
+ catch {
234
+ // Subscriber failures must not escape broker lifecycle operations.
235
+ }
236
+ }
237
+ closeSubscriber(subscriber) {
238
+ if (subscriber.closed)
239
+ return;
240
+ subscriber.closed = true;
241
+ if (subscriber.immediate)
242
+ clearImmediate(subscriber.immediate);
243
+ subscriber.immediate = null;
244
+ subscriber.queue = [];
245
+ subscriber.queuedBytes = 0;
246
+ this.subscribers.delete(subscriber);
247
+ }
248
+ }
249
+ //# sourceMappingURL=backendLogBroker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogBroker.js","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogBroker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAUrE,MAAM,wBAAwB,GAAG,IAAI,GAAG,IAAI,CAAC;AAC7C,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9C,MAAM,8BAA8B,GAAG,GAAG,GAAG,IAAI,CAAC;AA6BlD,MAAM,OAAO,gBAAgB;IACV,cAAc,CAAS;IACvB,gBAAgB,CAAS;IACzB,oBAAoB,CAAS;IAC7B,GAAG,CAAa;IAChB,YAAY,CAAqC;IACjD,OAAO,GAAG,IAAI,GAAG,EAA4B,CAAC;IAC9C,gBAAgB,GAAG,IAAI,GAAG,EAA2B,CAAC;IACtD,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,cAAc,GAAoB,EAAE,CAAC;IAC9C,kBAAkB,GAAG,CAAC,CAAC;IACd,WAAW,GAAG,IAAI,GAAG,EAAc,CAAC;IAC7C,YAAY,GAAG,CAAC,CAAC;IACjB,WAAW,GAAG,CAAC,CAAC;IAExB,YAAY,UAAmC,EAAE;QAC/C,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,wBAAwB,CAAC;QACzE,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,WAAW,IAAI,oBAAoB,CAAC;QACpE,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,IAAI,8BAA8B,CAAC;QAC3F,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC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C,MAAM,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { ManagedStdioStderrEvent } from '../../transport/managedStdioStderrEvent.js';
2
+ import type { ManagedStdioStderrMetadata } from '../../transport/managedStdioStderrMetadata.js';
3
+ import type { BackendLogBroker } from './backendLogBroker.js';
4
+ import type { BackendLogSource } from './backendLogTypes.js';
5
+ export declare function createBackendLogProjection(input: {
6
+ broker: BackendLogBroker;
7
+ source: BackendLogSource;
8
+ }): (event: ManagedStdioStderrEvent, metadata: ManagedStdioStderrMetadata) => void;
9
+ //# sourceMappingURL=backendLogProjection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogProjection.d.ts","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogProjection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAE/F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAuB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAElF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,IAC9F,OAAO,uBAAuB,EAAE,UAAU,0BAA0B,KAAG,IAAI,CAgBpF"}
@@ -0,0 +1,40 @@
1
+ import { warnIf } from '../../logger/logger.js';
2
+ import { ManagedStdioStderrEvent } from '../../transport/managedStdioStderrEvent.js';
3
+ export function createBackendLogProjection(input) {
4
+ return (event, metadata) => {
5
+ const projected = projectManagedStderrEvent(event, metadata);
6
+ const entry = input.broker.publish({ sourceId: input.source.id, ...projected });
7
+ warnIf(() => ({
8
+ message: `[${entry.displayName}] ${entry.content}`,
9
+ meta: {
10
+ serverName: entry.canonicalName,
11
+ source: 'backend-stderr',
12
+ backendLogSequence: entry.sequence,
13
+ backendLogSourceId: entry.sourceId,
14
+ backendLogEventKind: entry.kind,
15
+ ...(entry.count === undefined ? {} : { count: entry.count }),
16
+ ...(entry.truncated ? { truncated: true } : {}),
17
+ },
18
+ }));
19
+ };
20
+ }
21
+ function projectManagedStderrEvent(event, metadata) {
22
+ if (event === ManagedStdioStderrEvent.Repeated) {
23
+ const count = metadata.repeatCount ?? 0;
24
+ return {
25
+ kind: 'repeated',
26
+ content: `Previous backend stderr line repeated ${count} times`,
27
+ count,
28
+ };
29
+ }
30
+ if (event === ManagedStdioStderrEvent.Suppressed) {
31
+ const count = metadata.suppressedCount ?? 0;
32
+ return {
33
+ kind: 'suppressed',
34
+ content: `Suppressed ${count} backend stderr lines`,
35
+ count,
36
+ };
37
+ }
38
+ return { kind: 'line', content: metadata.line ?? '', truncated: metadata.truncated };
39
+ }
40
+ //# sourceMappingURL=backendLogProjection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogProjection.js","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogProjection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAMpF,MAAM,UAAU,0BAA0B,CAAC,KAA6D;IACtG,OAAO,CAAC,KAA8B,EAAE,QAAoC,EAAQ,EAAE;QACpF,MAAM,SAAS,GAAG,yBAAyB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;QAChF,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;YACZ,OAAO,EAAE,IAAI,KAAK,CAAC,WAAW,KAAK,KAAK,CAAC,OAAO,EAAE;YAClD,IAAI,EAAE;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BackendLogBroker;
3
+ export declare function resetBackendLogBroker(): BackendLogBroker;
4
+ //# sourceMappingURL=backendLogRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogRuntime.d.ts","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD;AAED,wBAAgB,qBAAqB,IAAI,gBAAgB,CAIxD"}
@@ -0,0 +1,11 @@
1
+ import { BackendLogBroker } from './backendLogBroker.js';
2
+ let runtimeBroker = new BackendLogBroker();
3
+ export function getBackendLogBroker() {
4
+ return runtimeBroker;
5
+ }
6
+ export function resetBackendLogBroker() {
7
+ runtimeBroker.clear();
8
+ runtimeBroker = new BackendLogBroker();
9
+ return runtimeBroker;
10
+ }
11
+ //# sourceMappingURL=backendLogRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogRuntime.js","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,IAAI,aAAa,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAE3C,MAAM,UAAU,mBAAmB;IACjC,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,aAAa,CAAC,KAAK,EAAE,CAAC;IACtB,aAAa,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACvC,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function sanitizeBackendLogContent(content: string): string;
2
+ //# sourceMappingURL=backendLogSanitizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogSanitizer.d.ts","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogSanitizer.ts"],"names":[],"mappings":"AAKA,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKjE"}
@@ -0,0 +1,30 @@
1
+ const BEARER_TOKEN = /\b(bearer\s+)([^\s,;]+)/giu;
2
+ const SECRET_ASSIGNMENT = /\b(api[_-]?key|password|passwd|client[_-]?secret|access[_-]?token|refresh[_-]?token|id[_-]?token|token|oauth[_-]?code)(\s*[:=]\s*)([^\s&,;]+)/giu;
3
+ const URL_PASSWORD = /(https?:\/\/[^\s/:@]+:)([^\s/@]+)(@)/giu;
4
+ export function sanitizeBackendLogContent(content) {
5
+ return stripTerminalControls(content)
6
+ .replace(URL_PASSWORD, '$1[REDACTED]$3')
7
+ .replace(BEARER_TOKEN, '$1[REDACTED]')
8
+ .replace(SECRET_ASSIGNMENT, '$1$2[REDACTED]');
9
+ }
10
+ function stripTerminalControls(content) {
11
+ let sanitized = '';
12
+ for (let index = 0; index < content.length; index++) {
13
+ const code = content.charCodeAt(index);
14
+ if (code === 0x1b && content[index + 1] === '[') {
15
+ index += 2;
16
+ while (index < content.length) {
17
+ const sequenceCode = content.charCodeAt(index);
18
+ if (sequenceCode >= 0x40 && sequenceCode <= 0x7e)
19
+ break;
20
+ index++;
21
+ }
22
+ continue;
23
+ }
24
+ if ((code >= 0 && code < 0x20 && code !== 0x09) || (code >= 0x7f && code <= 0x9f))
25
+ continue;
26
+ sanitized += content[index];
27
+ }
28
+ return sanitized;
29
+ }
30
+ //# sourceMappingURL=backendLogSanitizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogSanitizer.js","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogSanitizer.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAClD,MAAM,iBAAiB,GACrB,kJAAkJ,CAAC;AACrJ,MAAM,YAAY,GAAG,yCAAyC,CAAC;AAE/D,MAAM,UAAU,yBAAyB,CAAC,OAAe;IACvD,OAAO,qBAAqB,CAAC,OAAO,CAAC;SAClC,OAAO,CAAC,YAAY,EAAE,gBAAgB,CAAC;SACvC,OAAO,CAAC,YAAY,EAAE,cAAc,CAAC;SACrC,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAe;IAC5C,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAChD,KAAK,IAAI,CAAC,CAAC;YACX,OAAO,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;gBAC9B,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBAC/C,IAAI,YAAY,IAAI,IAAI,IAAI,YAAY,IAAI,IAAI;oBAAE,MAAM;gBACxD,KAAK,EAAE,CAAC;YACV,CAAC;YACD,SAAS;QACX,CAAC;QACD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC;YAAE,SAAS;QAC5F,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { BackendLogCapture, BackendLogSource } from './backendLogTypes.js';
2
+ export declare function staticBackendLogSource(name: string, capture?: BackendLogCapture): BackendLogSource;
3
+ export declare function templateBackendLogSource(input: {
4
+ templateName: string;
5
+ instanceId: string;
6
+ capture?: BackendLogCapture;
7
+ }): BackendLogSource;
8
+ //# sourceMappingURL=backendLogSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogSource.d.ts","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogSource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,iBAA6B,GAAG,gBAAgB,CAS7G;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,GAAG,gBAAgB,CASnB"}
@@ -0,0 +1,22 @@
1
+ import { formatTemplateInstanceId } from '../../core/server/templateIdentity.js';
2
+ export function staticBackendLogSource(name, capture = 'managed') {
3
+ return {
4
+ id: `static:${name}`,
5
+ canonicalName: name,
6
+ displayName: name,
7
+ kind: 'static',
8
+ capture,
9
+ lifecycle: 'active',
10
+ };
11
+ }
12
+ export function templateBackendLogSource(input) {
13
+ return {
14
+ id: `template:${input.instanceId}`,
15
+ canonicalName: input.instanceId,
16
+ displayName: `${input.templateName} (${formatTemplateInstanceId(input.instanceId)})`,
17
+ kind: 'template',
18
+ capture: input.capture ?? 'managed',
19
+ lifecycle: 'active',
20
+ };
21
+ }
22
+ //# sourceMappingURL=backendLogSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogSource.js","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAIhF,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,UAA6B,SAAS;IACzF,OAAO;QACL,EAAE,EAAE,UAAU,IAAI,EAAE;QACpB,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,QAAQ;QACd,OAAO;QACP,SAAS,EAAE,QAAQ;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,KAIxC;IACC,OAAO;QACL,EAAE,EAAE,YAAY,KAAK,CAAC,UAAU,EAAE;QAClC,aAAa,EAAE,KAAK,CAAC,UAAU;QAC/B,WAAW,EAAE,GAAG,KAAK,CAAC,YAAY,KAAK,wBAAwB,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG;QACpF,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,SAAS;QACnC,SAAS,EAAE,QAAQ;KACpB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ export type BackendLogSourceKind = 'static' | 'template';
2
+ export type BackendLogCapture = 'managed' | 'not-captured';
3
+ export type BackendLogSourceLifecycle = 'active' | 'ended';
4
+ export type BackendLogEventKind = 'line' | 'repeated' | 'suppressed';
5
+ export interface BackendLogSource {
6
+ readonly id: string;
7
+ readonly canonicalName: string;
8
+ readonly displayName: string;
9
+ readonly kind: BackendLogSourceKind;
10
+ readonly capture: BackendLogCapture;
11
+ readonly lifecycle: BackendLogSourceLifecycle;
12
+ }
13
+ export interface BackendLogEntry {
14
+ readonly sequence: number;
15
+ readonly timestamp: string;
16
+ readonly sourceId: string;
17
+ readonly canonicalName: string;
18
+ readonly displayName: string;
19
+ readonly sourceKind: BackendLogSourceKind;
20
+ readonly kind: BackendLogEventKind;
21
+ readonly content: string;
22
+ readonly count?: number;
23
+ readonly truncated: boolean;
24
+ }
25
+ export interface BackendLogSnapshot {
26
+ readonly sequence: number;
27
+ readonly sources: BackendLogSource[];
28
+ readonly entries: BackendLogEntry[];
29
+ }
30
+ export interface BackendLogSourceUpdate {
31
+ readonly sourceId: string;
32
+ readonly source?: BackendLogSource;
33
+ readonly removed: boolean;
34
+ }
35
+ export interface BackendLogPublishInput {
36
+ readonly sourceId: string;
37
+ readonly kind: BackendLogEventKind;
38
+ readonly content: string;
39
+ readonly count?: number;
40
+ readonly truncated?: boolean;
41
+ }
42
+ export type BackendLogReplay = {
43
+ readonly kind: 'replay';
44
+ readonly entries: BackendLogEntry[];
45
+ } | {
46
+ readonly kind: 'gap';
47
+ readonly snapshot: BackendLogSnapshot;
48
+ };
49
+ //# sourceMappingURL=backendLogTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogTypes.d.ts","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,UAAU,CAAC;AACzD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,cAAc,CAAC;AAC3D,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC3D,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC;AAErE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;CAC/C;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAA;CAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=backendLogTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backendLogTypes.js","sourceRoot":"","sources":["../../../src/domains/backend-logs/backendLogTypes.ts"],"names":[],"mappings":""}
@@ -1,9 +1,10 @@
1
1
  import type { MCPServerParams } from '../../core/types/index.js';
2
2
  import type { ConfigChangePorts, ConfigChangeService } from './types.js';
3
- export type { ConfigBackupPolicy, ConfigBackupResult, ConfigChangeOperation, ConfigChangePorts, ConfigChangeReason, ConfigChangeResult, ConfigChangeService, ConfigChangeStatus, ConfigReloadResult, ConfigReloadStatus, ConfigRetentionCleanupResult, ConfiguredServerTargetRef, ConfiguredServerTargetSource, EditConfiguredServerTargetInput, RemoveConfiguredServerTargetInput, SetConfiguredServerTargetEnabledStateInput, SetStaticConfiguredServerTargetInput, } from './types.js';
3
+ export type { ConfigBackupPolicy, ConfigBackupResult, ConfigChangeOperation, ConfigChangePorts, ConfigChangeReason, ConfigChangeResult, ConfigChangeService, ConfigChangeStatus, ConfigReloadResult, ConfigReloadStatus, ConfigRetentionCleanupResult, ConfiguredServerTargetRef, ConfiguredServerTargetSource, CreateStaticConfiguredServerTargetInput, EditConfiguredServerTargetInput, RemoveConfiguredServerTargetInput, SetConfiguredServerTargetEnabledStateInput, SetStaticConfiguredServerTargetInput, } from './types.js';
4
4
  export declare function createConfigChangeService(ports?: ConfigChangePorts): ConfigChangeService;
5
5
  export declare function fingerprintConfiguredServerTarget(serverConfig: MCPServerParams): string;
6
6
  export declare function fingerprintConfiguredServerDefaults(serverDefaults: unknown): string;
7
+ export declare function fingerprintConfiguredServerConfigDocument(config: unknown): string;
7
8
  export declare function fingerprintConfiguredServerSecretValue(value: string): string;
8
9
  export declare function isConfiguredServerTargetDisabled(value: MCPServerParams['disabled']): boolean;
9
10
  //# sourceMappingURL=configChange.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"configChange.d.ts","sourceRoot":"","sources":["../../../src/domains/config-change/configChange.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAiBhE,OAAO,KAAK,EAGV,iBAAiB,EAGjB,mBAAmB,EASpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,+BAA+B,EAC/B,iCAAiC,EACjC,0CAA0C,EAC1C,oCAAoC,GACrC,MAAM,YAAY,CAAC;AAEpB,wBAAgB,yBAAyB,CAAC,KAAK,GAAE,iBAAsB,GAAG,mBAAmB,CAE5F;AAID,wBAAgB,iCAAiC,CAAC,YAAY,EAAE,eAAe,GAAG,MAAM,CAEvF;AAED,wBAAgB,mCAAmC,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,CAEnF;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,OAAO,CAI5F"}
1
+ {"version":3,"file":"configChange.d.ts","sourceRoot":"","sources":["../../../src/domains/config-change/configChange.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAiBhE,OAAO,KAAK,EAGV,iBAAiB,EAGjB,mBAAmB,EAUpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,uCAAuC,EACvC,+BAA+B,EAC/B,iCAAiC,EACjC,0CAA0C,EAC1C,oCAAoC,GACrC,MAAM,YAAY,CAAC;AAEpB,wBAAgB,yBAAyB,CAAC,KAAK,GAAE,iBAAsB,GAAG,mBAAmB,CAE5F;AAID,wBAAgB,iCAAiC,CAAC,YAAY,EAAE,eAAe,GAAG,MAAM,CAEvF;AAED,wBAAgB,mCAAmC,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,CAEnF;AAED,wBAAgB,yCAAyC,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAQjF;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,OAAO,CAI5F"}
@@ -18,6 +18,14 @@ export function fingerprintConfiguredServerTarget(serverConfig) {
18
18
  export function fingerprintConfiguredServerDefaults(serverDefaults) {
19
19
  return `configured_server_defaults_${keyedConfiguredServerFingerprint('defaults', stableStringify(serverDefaults ?? {}))}`;
20
20
  }
21
+ export function fingerprintConfiguredServerConfigDocument(config) {
22
+ const record = config && typeof config === 'object' && !Array.isArray(config) ? config : {};
23
+ const normalized = {
24
+ ...record,
25
+ mcpServers: record.mcpServers && typeof record.mcpServers === 'object' ? record.mcpServers : {},
26
+ };
27
+ return `configured_server_config_${keyedConfiguredServerFingerprint('config-document', stableStringify(normalized))}`;
28
+ }
21
29
  export function fingerprintConfiguredServerSecretValue(value) {
22
30
  return keyedConfiguredServerFingerprint('inline-secret', value);
23
31
  }
@@ -172,6 +180,86 @@ class DefaultConfigChangeService {
172
180
  reload: this.reloadConfig(configPath),
173
181
  };
174
182
  }
183
+ async createStaticConfiguredServerTarget(input) {
184
+ const configPath = this.resolveConfigPath();
185
+ let releaseLock;
186
+ try {
187
+ releaseLock = await acquireConfigLock(configPath, this.ports.lockTimeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS);
188
+ }
189
+ catch (error) {
190
+ if (error instanceof ConfigLockTimeoutError) {
191
+ return {
192
+ status: 'failed',
193
+ operation: 'create_static',
194
+ configPath,
195
+ target: { name: input.targetName },
196
+ changed: false,
197
+ backup: { created: false },
198
+ retentionCleanup: retentionSkipped(),
199
+ reload: { status: 'skipped' },
200
+ warnings: [],
201
+ error: error.message,
202
+ };
203
+ }
204
+ throw error;
205
+ }
206
+ let resultWithoutReload;
207
+ try {
208
+ const config = this.loadConfigForSet(configPath);
209
+ if (input.expectedConfigFingerprint !== undefined &&
210
+ fingerprintConfiguredServerConfigDocument(config) !== input.expectedConfigFingerprint) {
211
+ return {
212
+ status: 'source_conflict',
213
+ operation: 'create_static',
214
+ configPath,
215
+ target: { name: input.targetName },
216
+ changed: false,
217
+ backup: { created: false },
218
+ retentionCleanup: retentionSkipped(),
219
+ reload: { status: 'skipped' },
220
+ warnings: [],
221
+ error: 'Configured server state changed after preview',
222
+ };
223
+ }
224
+ const target = resolveConfiguredServerTarget(config, input.targetName);
225
+ if (target.source) {
226
+ const templateConflict = target.source === 'mcpTemplates';
227
+ return {
228
+ status: templateConflict ? 'template_conflict' : 'destination_conflict',
229
+ operation: 'create_static',
230
+ configPath,
231
+ target,
232
+ changed: false,
233
+ backup: { created: false },
234
+ retentionCleanup: retentionSkipped(),
235
+ reload: { status: 'skipped' },
236
+ warnings: [],
237
+ error: `Configured server target '${input.targetName}' already exists`,
238
+ };
239
+ }
240
+ const backup = this.createBackupIfNeeded(configPath, input.backup ?? 'skip');
241
+ config.mcpServers = normalizeServerRecord(config.mcpServers);
242
+ config.mcpServers[input.targetName] = input.serverConfig;
243
+ this.validateConfig(configPath, config);
244
+ this.writeConfig(configPath, config);
245
+ const retentionCleanup = this.cleanupBackups(configPath, backup);
246
+ resultWithoutReload = {
247
+ status: 'changed',
248
+ operation: 'create_static',
249
+ configPath,
250
+ target: { name: input.targetName, source: 'mcpServers' },
251
+ changed: true,
252
+ backup,
253
+ retentionCleanup,
254
+ reload: { status: 'skipped' },
255
+ warnings: retentionCleanup.warnings,
256
+ };
257
+ }
258
+ finally {
259
+ releaseLock();
260
+ }
261
+ return { ...resultWithoutReload, reload: this.reloadConfig(configPath) };
262
+ }
175
263
  async setConfiguredServerTargetEnabledState(input) {
176
264
  const configPath = this.resolveConfigPath();
177
265
  const operation = input.enabled ? 'enable' : 'disable';