@1mcp/agent 0.39.8 → 0.40.0-beta.1

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 (683) hide show
  1. package/README.md +22 -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-0aX5Dfnd.js → admin-OAuthServicesWorkspace-pgsV0qQs.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-lrFAX4EQ.js +3 -0
  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/auth/oauthDiagnostics.d.ts +4 -0
  27. package/build/auth/oauthDiagnostics.d.ts.map +1 -1
  28. package/build/auth/oauthDiagnostics.js +4 -0
  29. package/build/auth/oauthDiagnostics.js.map +1 -1
  30. package/build/auth/oauthEndpointFetch.d.ts +2 -1
  31. package/build/auth/oauthEndpointFetch.d.ts.map +1 -1
  32. package/build/auth/oauthEndpointFetch.js +17 -6
  33. package/build/auth/oauthEndpointFetch.js.map +1 -1
  34. package/build/auth/sessionTypes.d.ts +1 -1
  35. package/build/cli.d.ts.map +1 -1
  36. package/build/cli.js +48 -18
  37. package/build/cli.js.map +1 -1
  38. package/build/commands/admin/index.d.ts.map +1 -1
  39. package/build/commands/admin/index.js +2 -6
  40. package/build/commands/admin/index.js.map +1 -1
  41. package/build/commands/app/backups.d.ts.map +1 -1
  42. package/build/commands/app/backups.js +2 -1
  43. package/build/commands/app/backups.js.map +1 -1
  44. package/build/commands/app/consolidate.d.ts.map +1 -1
  45. package/build/commands/app/consolidate.js +5 -4
  46. package/build/commands/app/consolidate.js.map +1 -1
  47. package/build/commands/app/discover.d.ts.map +1 -1
  48. package/build/commands/app/discover.js +2 -1
  49. package/build/commands/app/discover.js.map +1 -1
  50. package/build/commands/app/index.d.ts.map +1 -1
  51. package/build/commands/app/index.js +35 -32
  52. package/build/commands/app/index.js.map +1 -1
  53. package/build/commands/app/restore.d.ts.map +1 -1
  54. package/build/commands/app/restore.js +6 -5
  55. package/build/commands/app/restore.js.map +1 -1
  56. package/build/commands/app/status.d.ts.map +1 -1
  57. package/build/commands/app/status.js +2 -1
  58. package/build/commands/app/status.js.map +1 -1
  59. package/build/commands/auth/index.d.ts.map +1 -1
  60. package/build/commands/auth/index.js +2 -7
  61. package/build/commands/auth/index.js.map +1 -1
  62. package/build/commands/bootstrap/bootstrap.d.ts +38 -0
  63. package/build/commands/bootstrap/bootstrap.d.ts.map +1 -0
  64. package/build/commands/bootstrap/bootstrap.js +288 -0
  65. package/build/commands/bootstrap/bootstrap.js.map +1 -0
  66. package/build/commands/bootstrap/bootstrapOwnership.d.ts +13 -0
  67. package/build/commands/bootstrap/bootstrapOwnership.d.ts.map +1 -0
  68. package/build/commands/bootstrap/bootstrapOwnership.js +144 -0
  69. package/build/commands/bootstrap/bootstrapOwnership.js.map +1 -0
  70. package/build/commands/bootstrap/index.d.ts +3 -0
  71. package/build/commands/bootstrap/index.d.ts.map +1 -0
  72. package/build/commands/bootstrap/index.js +25 -0
  73. package/build/commands/bootstrap/index.js.map +1 -0
  74. package/build/commands/cliSetup/index.d.ts.map +1 -1
  75. package/build/commands/cliSetup/index.js +17 -15
  76. package/build/commands/cliSetup/index.js.map +1 -1
  77. package/build/commands/cliSetup/installPreparationSkill.d.ts +8 -0
  78. package/build/commands/cliSetup/installPreparationSkill.d.ts.map +1 -0
  79. package/build/commands/cliSetup/installPreparationSkill.js +201 -0
  80. package/build/commands/cliSetup/installPreparationSkill.js.map +1 -0
  81. package/build/commands/cliSetup/preparationSkill.generated.d.ts +2 -0
  82. package/build/commands/cliSetup/preparationSkill.generated.d.ts.map +1 -0
  83. package/build/commands/cliSetup/preparationSkill.generated.js +8 -0
  84. package/build/commands/cliSetup/preparationSkill.generated.js.map +1 -0
  85. package/build/commands/cliSetup/setupFiles.d.ts +5 -1
  86. package/build/commands/cliSetup/setupFiles.d.ts.map +1 -1
  87. package/build/commands/cliSetup/setupFiles.js +54 -37
  88. package/build/commands/cliSetup/setupFiles.js.map +1 -1
  89. package/build/commands/inspect/index.d.ts.map +1 -1
  90. package/build/commands/inspect/index.js +5 -5
  91. package/build/commands/inspect/index.js.map +1 -1
  92. package/build/commands/inspect/inspect.d.ts +2 -1
  93. package/build/commands/inspect/inspect.d.ts.map +1 -1
  94. package/build/commands/inspect/inspect.js +14 -6
  95. package/build/commands/inspect/inspect.js.map +1 -1
  96. package/build/commands/inspect/inspectUtils.d.ts +1 -0
  97. package/build/commands/inspect/inspectUtils.d.ts.map +1 -1
  98. package/build/commands/inspect/inspectUtils.js +13 -2
  99. package/build/commands/inspect/inspectUtils.js.map +1 -1
  100. package/build/commands/instructions/index.d.ts.map +1 -1
  101. package/build/commands/instructions/index.js +8 -3
  102. package/build/commands/instructions/index.js.map +1 -1
  103. package/build/commands/instructions/instructions.d.ts +3 -1
  104. package/build/commands/instructions/instructions.d.ts.map +1 -1
  105. package/build/commands/instructions/instructions.js +24 -0
  106. package/build/commands/instructions/instructions.js.map +1 -1
  107. package/build/commands/instructions/instructionsUtils.d.ts +2 -0
  108. package/build/commands/instructions/instructionsUtils.d.ts.map +1 -1
  109. package/build/commands/instructions/instructionsUtils.js +14 -4
  110. package/build/commands/instructions/instructionsUtils.js.map +1 -1
  111. package/build/commands/mcp/add.d.ts.map +1 -1
  112. package/build/commands/mcp/add.js +2 -1
  113. package/build/commands/mcp/add.js.map +1 -1
  114. package/build/commands/mcp/enable.d.ts.map +1 -1
  115. package/build/commands/mcp/enable.js +2 -1
  116. package/build/commands/mcp/enable.js.map +1 -1
  117. package/build/commands/mcp/index.d.ts.map +1 -1
  118. package/build/commands/mcp/index.js +99 -75
  119. package/build/commands/mcp/index.js.map +1 -1
  120. package/build/commands/mcp/install.d.ts.map +1 -1
  121. package/build/commands/mcp/install.js +6 -5
  122. package/build/commands/mcp/install.js.map +1 -1
  123. package/build/commands/mcp/installSource.d.ts +3 -1
  124. package/build/commands/mcp/installSource.d.ts.map +1 -1
  125. package/build/commands/mcp/installSource.js +2 -2
  126. package/build/commands/mcp/installSource.js.map +1 -1
  127. package/build/commands/mcp/knownServerSetup.d.ts +4 -0
  128. package/build/commands/mcp/knownServerSetup.d.ts.map +1 -0
  129. package/build/commands/mcp/knownServerSetup.js +102 -0
  130. package/build/commands/mcp/knownServerSetup.js.map +1 -0
  131. package/build/commands/mcp/list.d.ts.map +1 -1
  132. package/build/commands/mcp/list.js +2 -1
  133. package/build/commands/mcp/list.js.map +1 -1
  134. package/build/commands/mcp/remove.d.ts.map +1 -1
  135. package/build/commands/mcp/remove.js +2 -1
  136. package/build/commands/mcp/remove.js.map +1 -1
  137. package/build/commands/mcp/setup.d.ts +28 -0
  138. package/build/commands/mcp/setup.d.ts.map +1 -0
  139. package/build/commands/mcp/setup.js +56 -0
  140. package/build/commands/mcp/setup.js.map +1 -0
  141. package/build/commands/mcp/status.d.ts.map +1 -1
  142. package/build/commands/mcp/status.js +2 -1
  143. package/build/commands/mcp/status.js.map +1 -1
  144. package/build/commands/mcp/tokens.d.ts.map +1 -1
  145. package/build/commands/mcp/tokens.js +5 -4
  146. package/build/commands/mcp/tokens.js.map +1 -1
  147. package/build/commands/mcp/tools.d.ts.map +1 -1
  148. package/build/commands/mcp/tools.js +20 -11
  149. package/build/commands/mcp/tools.js.map +1 -1
  150. package/build/commands/preparation/index.d.ts +3 -0
  151. package/build/commands/preparation/index.d.ts.map +1 -0
  152. package/build/commands/preparation/index.js +55 -0
  153. package/build/commands/preparation/index.js.map +1 -0
  154. package/build/commands/preparation/preparation.d.ts +18 -0
  155. package/build/commands/preparation/preparation.d.ts.map +1 -0
  156. package/build/commands/preparation/preparation.js +102 -0
  157. package/build/commands/preparation/preparation.js.map +1 -0
  158. package/build/commands/preset/delete.d.ts.map +1 -1
  159. package/build/commands/preset/delete.js +2 -1
  160. package/build/commands/preset/delete.js.map +1 -1
  161. package/build/commands/preset/edit.d.ts.map +1 -1
  162. package/build/commands/preset/edit.js +3 -2
  163. package/build/commands/preset/edit.js.map +1 -1
  164. package/build/commands/preset/index.d.ts.map +1 -1
  165. package/build/commands/preset/index.js +38 -68
  166. package/build/commands/preset/index.js.map +1 -1
  167. package/build/commands/preset/interactive.d.ts.map +1 -1
  168. package/build/commands/preset/interactive.js +2 -1
  169. package/build/commands/preset/interactive.js.map +1 -1
  170. package/build/commands/preset/list.d.ts.map +1 -1
  171. package/build/commands/preset/list.js +2 -1
  172. package/build/commands/preset/list.js.map +1 -1
  173. package/build/commands/preset/show.d.ts.map +1 -1
  174. package/build/commands/preset/show.js +2 -1
  175. package/build/commands/preset/show.js.map +1 -1
  176. package/build/commands/preset/test.d.ts.map +1 -1
  177. package/build/commands/preset/test.js +2 -1
  178. package/build/commands/preset/test.js.map +1 -1
  179. package/build/commands/preset/url.d.ts.map +1 -1
  180. package/build/commands/preset/url.js +2 -1
  181. package/build/commands/preset/url.js.map +1 -1
  182. package/build/commands/project/index.d.ts +3 -0
  183. package/build/commands/project/index.d.ts.map +1 -0
  184. package/build/commands/project/index.js +40 -0
  185. package/build/commands/project/index.js.map +1 -0
  186. package/build/commands/project/project.d.ts +34 -0
  187. package/build/commands/project/project.d.ts.map +1 -0
  188. package/build/commands/project/project.js +119 -0
  189. package/build/commands/project/project.js.map +1 -0
  190. package/build/commands/proxy/index.d.ts +2 -1
  191. package/build/commands/proxy/index.d.ts.map +1 -1
  192. package/build/commands/proxy/index.js +6 -46
  193. package/build/commands/proxy/index.js.map +1 -1
  194. package/build/commands/proxy/proxy.d.ts.map +1 -1
  195. package/build/commands/proxy/proxy.js +11 -1
  196. package/build/commands/proxy/proxy.js.map +1 -1
  197. package/build/commands/registry/index.d.ts.map +1 -1
  198. package/build/commands/registry/index.js +37 -30
  199. package/build/commands/registry/index.js.map +1 -1
  200. package/build/commands/registry/search.d.ts.map +1 -1
  201. package/build/commands/registry/search.js +2 -1
  202. package/build/commands/registry/search.js.map +1 -1
  203. package/build/commands/registry/show.d.ts.map +1 -1
  204. package/build/commands/registry/show.js +2 -1
  205. package/build/commands/registry/show.js.map +1 -1
  206. package/build/commands/registry/status.d.ts.map +1 -1
  207. package/build/commands/registry/status.js +2 -1
  208. package/build/commands/registry/status.js.map +1 -1
  209. package/build/commands/registry/versions.d.ts.map +1 -1
  210. package/build/commands/registry/versions.js +2 -1
  211. package/build/commands/registry/versions.js.map +1 -1
  212. package/build/commands/run/index.d.ts.map +1 -1
  213. package/build/commands/run/index.js +18 -4
  214. package/build/commands/run/index.js.map +1 -1
  215. package/build/commands/run/run.d.ts +6 -1
  216. package/build/commands/run/run.d.ts.map +1 -1
  217. package/build/commands/run/run.js +96 -23
  218. package/build/commands/run/run.js.map +1 -1
  219. package/build/commands/run/stdoutBudget.d.ts +10 -0
  220. package/build/commands/run/stdoutBudget.d.ts.map +1 -0
  221. package/build/commands/run/stdoutBudget.js +102 -0
  222. package/build/commands/run/stdoutBudget.js.map +1 -0
  223. package/build/commands/serve/cooperativeRuntime.d.ts.map +1 -1
  224. package/build/commands/serve/cooperativeRuntime.js +9 -1
  225. package/build/commands/serve/cooperativeRuntime.js.map +1 -1
  226. package/build/commands/serve/index.d.ts.map +1 -1
  227. package/build/commands/serve/index.js +62 -39
  228. package/build/commands/serve/index.js.map +1 -1
  229. package/build/commands/serve/serveBackground.d.ts.map +1 -1
  230. package/build/commands/serve/serveBackground.js +12 -0
  231. package/build/commands/serve/serveBackground.js.map +1 -1
  232. package/build/commands/shared/agentSession.d.ts +5 -0
  233. package/build/commands/shared/agentSession.d.ts.map +1 -0
  234. package/build/commands/shared/agentSession.js +75 -0
  235. package/build/commands/shared/agentSession.js.map +1 -0
  236. package/build/commands/shared/apiClient.d.ts +2 -0
  237. package/build/commands/shared/apiClient.d.ts.map +1 -1
  238. package/build/commands/shared/apiClient.js +10 -6
  239. package/build/commands/shared/apiClient.js.map +1 -1
  240. package/build/commands/shared/cliContext.d.ts +2 -1
  241. package/build/commands/shared/cliContext.d.ts.map +1 -1
  242. package/build/commands/shared/cliContext.js +2 -1
  243. package/build/commands/shared/cliContext.js.map +1 -1
  244. package/build/commands/shared/clientSurfaceAttachment.d.ts +7 -1
  245. package/build/commands/shared/clientSurfaceAttachment.d.ts.map +1 -1
  246. package/build/commands/shared/clientSurfaceAttachment.js +221 -140
  247. package/build/commands/shared/clientSurfaceAttachment.js.map +1 -1
  248. package/build/commands/shared/commandRunner.d.ts +2 -1
  249. package/build/commands/shared/commandRunner.d.ts.map +1 -1
  250. package/build/commands/shared/commandRunner.js +15 -3
  251. package/build/commands/shared/commandRunner.js.map +1 -1
  252. package/build/commands/shared/inspectApiSchemas.d.ts +8 -8
  253. package/build/commands/shared/productCommandFamily.d.ts +4 -0
  254. package/build/commands/shared/productCommandFamily.d.ts.map +1 -0
  255. package/build/commands/shared/productCommandFamily.js +27 -0
  256. package/build/commands/shared/productCommandFamily.js.map +1 -0
  257. package/build/commands/shared/projectOwnerStorage.d.ts +8 -0
  258. package/build/commands/shared/projectOwnerStorage.d.ts.map +1 -0
  259. package/build/commands/shared/projectOwnerStorage.js +63 -0
  260. package/build/commands/shared/projectOwnerStorage.js.map +1 -0
  261. package/build/commands/shared/projectOwnerStore.d.ts +95 -0
  262. package/build/commands/shared/projectOwnerStore.d.ts.map +1 -0
  263. package/build/commands/shared/projectOwnerStore.js +578 -0
  264. package/build/commands/shared/projectOwnerStore.js.map +1 -0
  265. package/build/commands/shared/projectSelectionOptions.d.ts +24 -0
  266. package/build/commands/shared/projectSelectionOptions.d.ts.map +1 -0
  267. package/build/commands/shared/projectSelectionOptions.js +20 -0
  268. package/build/commands/shared/projectSelectionOptions.js.map +1 -0
  269. package/build/commands/shared/serveTargetResolver.d.ts +7 -1
  270. package/build/commands/shared/serveTargetResolver.d.ts.map +1 -1
  271. package/build/commands/shared/serveTargetResolver.js +99 -4
  272. package/build/commands/shared/serveTargetResolver.js.map +1 -1
  273. package/build/commands/target/index.d.ts.map +1 -1
  274. package/build/commands/target/index.js +6 -13
  275. package/build/commands/target/index.js.map +1 -1
  276. package/build/commands/telemetry/index.d.ts +3 -0
  277. package/build/commands/telemetry/index.d.ts.map +1 -0
  278. package/build/commands/telemetry/index.js +35 -0
  279. package/build/commands/telemetry/index.js.map +1 -0
  280. package/build/commands/wait/index.d.ts.map +1 -1
  281. package/build/commands/wait/index.js +3 -3
  282. package/build/commands/wait/index.js.map +1 -1
  283. package/build/commands/wait/wait.d.ts +2 -1
  284. package/build/commands/wait/wait.d.ts.map +1 -1
  285. package/build/commands/wait/wait.js.map +1 -1
  286. package/build/config/configLoader.d.ts.map +1 -1
  287. package/build/config/configLoader.js +5 -1
  288. package/build/config/configLoader.js.map +1 -1
  289. package/build/config/configManager.d.ts.map +1 -1
  290. package/build/config/configManager.js +15 -1
  291. package/build/config/configManager.js.map +1 -1
  292. package/build/config/productTelemetryBootstrap.d.ts +12 -0
  293. package/build/config/productTelemetryBootstrap.d.ts.map +1 -0
  294. package/build/config/productTelemetryBootstrap.js +40 -0
  295. package/build/config/productTelemetryBootstrap.js.map +1 -0
  296. package/build/config/projectConfigLoader.d.ts +4 -0
  297. package/build/config/projectConfigLoader.d.ts.map +1 -1
  298. package/build/config/projectConfigLoader.js +129 -28
  299. package/build/config/projectConfigLoader.js.map +1 -1
  300. package/build/config/projectConfigTypes.d.ts +7 -0
  301. package/build/config/projectConfigTypes.d.ts.map +1 -1
  302. package/build/config/projectConfigTypes.js +1 -0
  303. package/build/config/projectConfigTypes.js.map +1 -1
  304. package/build/constants/cliTimeouts.d.ts +4 -0
  305. package/build/constants/cliTimeouts.d.ts.map +1 -0
  306. package/build/constants/cliTimeouts.js +4 -0
  307. package/build/constants/cliTimeouts.js.map +1 -0
  308. package/build/constants/mcp.d.ts +1 -1
  309. package/build/constants/mcp.d.ts.map +1 -1
  310. package/build/constants/mcp.js +1 -1
  311. package/build/constants/mcp.js.map +1 -1
  312. package/build/core/capabilities/capabilityCatalog.d.ts +7 -0
  313. package/build/core/capabilities/capabilityCatalog.d.ts.map +1 -1
  314. package/build/core/capabilities/capabilityCatalog.js +58 -2
  315. package/build/core/capabilities/capabilityCatalog.js.map +1 -1
  316. package/build/core/capabilities/capabilityPagination.d.ts +12 -4
  317. package/build/core/capabilities/capabilityPagination.d.ts.map +1 -1
  318. package/build/core/capabilities/capabilityPagination.js +15 -2
  319. package/build/core/capabilities/capabilityPagination.js.map +1 -1
  320. package/build/core/capabilities/capabilityVisibility.d.ts +3 -0
  321. package/build/core/capabilities/capabilityVisibility.d.ts.map +1 -1
  322. package/build/core/capabilities/capabilityVisibility.js.map +1 -1
  323. package/build/core/capabilities/lazyLoadingOrchestrator.d.ts +4 -1
  324. package/build/core/capabilities/lazyLoadingOrchestrator.d.ts.map +1 -1
  325. package/build/core/capabilities/lazyLoadingOrchestrator.js +6 -2
  326. package/build/core/capabilities/lazyLoadingOrchestrator.js.map +1 -1
  327. package/build/core/capabilities/metaToolProvider.d.ts +2 -2
  328. package/build/core/capabilities/metaToolProvider.d.ts.map +1 -1
  329. package/build/core/capabilities/metaToolProvider.js +2 -2
  330. package/build/core/capabilities/metaToolProvider.js.map +1 -1
  331. package/build/core/capabilities/runtimeCapabilityCatalog.d.ts +1 -0
  332. package/build/core/capabilities/runtimeCapabilityCatalog.d.ts.map +1 -1
  333. package/build/core/capabilities/runtimeCapabilityCatalog.js +33 -9
  334. package/build/core/capabilities/runtimeCapabilityCatalog.js.map +1 -1
  335. package/build/core/context/projectOwner.d.ts +16 -0
  336. package/build/core/context/projectOwner.d.ts.map +1 -0
  337. package/build/core/context/projectOwner.js +33 -0
  338. package/build/core/context/projectOwner.js.map +1 -0
  339. package/build/core/context/projectPreparationAuthority.d.ts +37 -0
  340. package/build/core/context/projectPreparationAuthority.d.ts.map +1 -0
  341. package/build/core/context/projectPreparationAuthority.js +113 -0
  342. package/build/core/context/projectPreparationAuthority.js.map +1 -0
  343. package/build/core/instructions/inspectionGuidance.d.ts +2 -0
  344. package/build/core/instructions/inspectionGuidance.d.ts.map +1 -0
  345. package/build/core/instructions/inspectionGuidance.js +2 -0
  346. package/build/core/instructions/inspectionGuidance.js.map +1 -0
  347. package/build/core/instructions/instructionAggregator.d.ts +1 -0
  348. package/build/core/instructions/instructionAggregator.d.ts.map +1 -1
  349. package/build/core/instructions/instructionAggregator.js +2 -2
  350. package/build/core/instructions/instructionAggregator.js.map +1 -1
  351. package/build/core/instructions/instructionsDistribution.d.ts +5 -0
  352. package/build/core/instructions/instructionsDistribution.d.ts.map +1 -1
  353. package/build/core/instructions/instructionsDistribution.js +72 -15
  354. package/build/core/instructions/instructionsDistribution.js.map +1 -1
  355. package/build/core/instructions/preparationGuidance.d.ts +3 -0
  356. package/build/core/instructions/preparationGuidance.d.ts.map +1 -0
  357. package/build/core/instructions/preparationGuidance.js +14 -0
  358. package/build/core/instructions/preparationGuidance.js.map +1 -0
  359. package/build/core/instructions/sessionGuidance.d.ts +3 -0
  360. package/build/core/instructions/sessionGuidance.d.ts.map +1 -0
  361. package/build/core/instructions/sessionGuidance.js +25 -0
  362. package/build/core/instructions/sessionGuidance.js.map +1 -0
  363. package/build/core/instructions/templateTypes.d.ts +3 -1
  364. package/build/core/instructions/templateTypes.d.ts.map +1 -1
  365. package/build/core/instructions/templateTypes.js +15 -5
  366. package/build/core/instructions/templateTypes.js.map +1 -1
  367. package/build/core/protocol/requestHandlerUtils.d.ts.map +1 -1
  368. package/build/core/protocol/requestHandlerUtils.js +23 -4
  369. package/build/core/protocol/requestHandlerUtils.js.map +1 -1
  370. package/build/core/server/connectionResolver.d.ts +5 -0
  371. package/build/core/server/connectionResolver.d.ts.map +1 -1
  372. package/build/core/server/connectionResolver.js +11 -0
  373. package/build/core/server/connectionResolver.js.map +1 -1
  374. package/build/core/server/runtimeLaunchIpc.d.ts +186 -15
  375. package/build/core/server/runtimeLaunchIpc.d.ts.map +1 -1
  376. package/build/core/server/runtimeReplacementConfig.d.ts +186 -15
  377. package/build/core/server/runtimeReplacementConfig.d.ts.map +1 -1
  378. package/build/core/tools/handlers/serverManagementHandler.d.ts +436 -16
  379. package/build/core/tools/handlers/serverManagementHandler.d.ts.map +1 -1
  380. package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts +63 -3
  381. package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts.map +1 -1
  382. package/build/core/tools/internal/schemas/discovery.d.ts +3 -3
  383. package/build/core/tools/internal/schemas/edit.d.ts +5 -6
  384. package/build/core/tools/internal/schemas/edit.d.ts.map +1 -1
  385. package/build/core/tools/internal/schemas/edit.js +2 -10
  386. package/build/core/tools/internal/schemas/edit.js.map +1 -1
  387. package/build/core/tools/internal/schemas/index.d.ts +18 -13
  388. package/build/core/tools/internal/schemas/index.d.ts.map +1 -1
  389. package/build/core/tools/internal/schemas/installation.d.ts +1 -1
  390. package/build/core/tools/internal/schemas/management.d.ts +9 -9
  391. package/build/core/types/server.d.ts +7 -1
  392. package/build/core/types/server.d.ts.map +1 -1
  393. package/build/core/types/transport.d.ts +285 -27
  394. package/build/core/types/transport.d.ts.map +1 -1
  395. package/build/core/types/transport.js +40 -0
  396. package/build/core/types/transport.js.map +1 -1
  397. package/build/domains/admin/adminConfiguredServerService.d.ts.map +1 -1
  398. package/build/domains/admin/adminConfiguredServerService.js +30 -14
  399. package/build/domains/admin/adminConfiguredServerService.js.map +1 -1
  400. package/build/domains/admin/adminInstructionPreviewRuntime.d.ts.map +1 -1
  401. package/build/domains/admin/adminInstructionPreviewRuntime.js +4 -1
  402. package/build/domains/admin/adminInstructionPreviewRuntime.js.map +1 -1
  403. package/build/domains/admin/adminOperationService.d.ts +1 -0
  404. package/build/domains/admin/adminOperationService.d.ts.map +1 -1
  405. package/build/domains/admin/adminOperationService.js +38 -0
  406. package/build/domains/admin/adminOperationService.js.map +1 -1
  407. package/build/domains/backend-preparation/adapterRegistry.d.ts +8 -0
  408. package/build/domains/backend-preparation/adapterRegistry.d.ts.map +1 -0
  409. package/build/domains/backend-preparation/adapterRegistry.js +15 -0
  410. package/build/domains/backend-preparation/adapterRegistry.js.map +1 -0
  411. package/build/domains/backend-preparation/builtInIntegrationDefinitions.d.ts +4 -0
  412. package/build/domains/backend-preparation/builtInIntegrationDefinitions.d.ts.map +1 -0
  413. package/build/domains/backend-preparation/builtInIntegrationDefinitions.js +3 -0
  414. package/build/domains/backend-preparation/builtInIntegrationDefinitions.js.map +1 -0
  415. package/build/domains/backend-preparation/configuredCommandAdapter.d.ts +88 -0
  416. package/build/domains/backend-preparation/configuredCommandAdapter.d.ts.map +1 -0
  417. package/build/domains/backend-preparation/configuredCommandAdapter.js +196 -0
  418. package/build/domains/backend-preparation/configuredCommandAdapter.js.map +1 -0
  419. package/build/domains/backend-preparation/configuredCommandProcess.d.ts +27 -0
  420. package/build/domains/backend-preparation/configuredCommandProcess.d.ts.map +1 -0
  421. package/build/domains/backend-preparation/configuredCommandProcess.js +183 -0
  422. package/build/domains/backend-preparation/configuredCommandProcess.js.map +1 -0
  423. package/build/domains/backend-preparation/contracts.d.ts +131 -0
  424. package/build/domains/backend-preparation/contracts.d.ts.map +1 -0
  425. package/build/domains/backend-preparation/contracts.js +2 -0
  426. package/build/domains/backend-preparation/contracts.js.map +1 -0
  427. package/build/domains/backend-preparation/integrationDefinitions.d.ts +171 -0
  428. package/build/domains/backend-preparation/integrationDefinitions.d.ts.map +1 -0
  429. package/build/domains/backend-preparation/integrationDefinitions.js +246 -0
  430. package/build/domains/backend-preparation/integrationDefinitions.js.map +1 -0
  431. package/build/domains/backend-preparation/policy.d.ts +50 -0
  432. package/build/domains/backend-preparation/policy.d.ts.map +1 -0
  433. package/build/domains/backend-preparation/policy.js +58 -0
  434. package/build/domains/backend-preparation/policy.js.map +1 -0
  435. package/build/domains/backend-preparation/scheduler.d.ts +18 -0
  436. package/build/domains/backend-preparation/scheduler.d.ts.map +1 -0
  437. package/build/domains/backend-preparation/scheduler.js +62 -0
  438. package/build/domains/backend-preparation/scheduler.js.map +1 -0
  439. package/build/domains/backend-preparation/service.d.ts +67 -0
  440. package/build/domains/backend-preparation/service.d.ts.map +1 -0
  441. package/build/domains/backend-preparation/service.js +709 -0
  442. package/build/domains/backend-preparation/service.js.map +1 -0
  443. package/build/domains/config-change/configChange.js +5 -5
  444. package/build/domains/config-change/configChange.js.map +1 -1
  445. package/build/domains/installation/knownServerCatalog.d.ts +14 -0
  446. package/build/domains/installation/knownServerCatalog.d.ts.map +1 -0
  447. package/build/domains/installation/knownServerCatalog.js +56 -0
  448. package/build/domains/installation/knownServerCatalog.js.map +1 -0
  449. package/build/domains/installation/knownServerSetup.d.ts +21 -0
  450. package/build/domains/installation/knownServerSetup.d.ts.map +1 -0
  451. package/build/domains/installation/knownServerSetup.js +330 -0
  452. package/build/domains/installation/knownServerSetup.js.map +1 -0
  453. package/build/domains/installation/knownServerSetupTypes.d.ts +34 -0
  454. package/build/domains/installation/knownServerSetupTypes.d.ts.map +1 -0
  455. package/build/domains/installation/knownServerSetupTypes.js +2 -0
  456. package/build/domains/installation/knownServerSetupTypes.js.map +1 -0
  457. package/build/domains/installation/serverInstallationSourceResolution.js +1 -0
  458. package/build/domains/installation/serverInstallationSourceResolution.js.map +1 -1
  459. package/build/domains/installation/serverInstallationTypes.d.ts +1 -0
  460. package/build/domains/installation/serverInstallationTypes.d.ts.map +1 -1
  461. package/build/domains/preset/services/presetErrorHandler.d.ts.map +1 -1
  462. package/build/domains/preset/services/presetErrorHandler.js +3 -2
  463. package/build/domains/preset/services/presetErrorHandler.js.map +1 -1
  464. package/build/domains/project-selection/projectBindingScope.d.ts +7 -0
  465. package/build/domains/project-selection/projectBindingScope.d.ts.map +1 -0
  466. package/build/domains/project-selection/projectBindingScope.js +9 -0
  467. package/build/domains/project-selection/projectBindingScope.js.map +1 -0
  468. package/build/domains/project-selection/projectPolicy.d.ts +11 -0
  469. package/build/domains/project-selection/projectPolicy.d.ts.map +1 -0
  470. package/build/domains/project-selection/projectPolicy.js +104 -0
  471. package/build/domains/project-selection/projectPolicy.js.map +1 -0
  472. package/build/domains/project-selection/projectSelection.d.ts +30 -0
  473. package/build/domains/project-selection/projectSelection.d.ts.map +1 -0
  474. package/build/domains/project-selection/projectSelection.js +124 -0
  475. package/build/domains/project-selection/projectSelection.js.map +1 -0
  476. package/build/globalOptions.d.ts +33 -11
  477. package/build/globalOptions.d.ts.map +1 -1
  478. package/build/globalOptions.js +61 -0
  479. package/build/globalOptions.js.map +1 -1
  480. package/build/observability/events/registry.d.ts +7 -1
  481. package/build/observability/events/registry.d.ts.map +1 -1
  482. package/build/observability/events/registry.js +7 -1
  483. package/build/observability/events/registry.js.map +1 -1
  484. package/build/productTelemetry/commandScope.d.ts +8 -0
  485. package/build/productTelemetry/commandScope.d.ts.map +1 -0
  486. package/build/productTelemetry/commandScope.js +50 -0
  487. package/build/productTelemetry/commandScope.js.map +1 -0
  488. package/build/productTelemetry/contract.d.ts +136 -0
  489. package/build/productTelemetry/contract.d.ts.map +1 -0
  490. package/build/productTelemetry/contract.js +103 -0
  491. package/build/productTelemetry/contract.js.map +1 -0
  492. package/build/productTelemetry/delivery.d.ts +8 -0
  493. package/build/productTelemetry/delivery.d.ts.map +1 -0
  494. package/build/productTelemetry/delivery.js +142 -0
  495. package/build/productTelemetry/delivery.js.map +1 -0
  496. package/build/productTelemetry/index.d.ts +15 -0
  497. package/build/productTelemetry/index.d.ts.map +1 -0
  498. package/build/productTelemetry/index.js +118 -0
  499. package/build/productTelemetry/index.js.map +1 -0
  500. package/build/productTelemetry/installationStore.d.ts +117 -0
  501. package/build/productTelemetry/installationStore.d.ts.map +1 -0
  502. package/build/productTelemetry/installationStore.js +400 -0
  503. package/build/productTelemetry/installationStore.js.map +1 -0
  504. package/build/productTelemetry/notice.d.ts +3 -0
  505. package/build/productTelemetry/notice.d.ts.map +1 -0
  506. package/build/productTelemetry/notice.js +13 -0
  507. package/build/productTelemetry/notice.js.map +1 -0
  508. package/build/productTelemetry/operation.d.ts +9 -0
  509. package/build/productTelemetry/operation.d.ts.map +1 -0
  510. package/build/productTelemetry/operation.js +51 -0
  511. package/build/productTelemetry/operation.js.map +1 -0
  512. package/build/productTelemetry/permissions.d.ts +8 -0
  513. package/build/productTelemetry/permissions.d.ts.map +1 -0
  514. package/build/productTelemetry/permissions.js +10 -0
  515. package/build/productTelemetry/permissions.js.map +1 -0
  516. package/build/productTelemetry/policy.d.ts +12 -0
  517. package/build/productTelemetry/policy.d.ts.map +1 -0
  518. package/build/productTelemetry/policy.js +31 -0
  519. package/build/productTelemetry/policy.js.map +1 -0
  520. package/build/productTelemetry/producer.d.ts +51 -0
  521. package/build/productTelemetry/producer.d.ts.map +1 -0
  522. package/build/productTelemetry/producer.js +214 -0
  523. package/build/productTelemetry/producer.js.map +1 -0
  524. package/build/sdk/legacy/auth/sdkOAuthClientProvider.d.ts +2 -0
  525. package/build/sdk/legacy/auth/sdkOAuthClientProvider.d.ts.map +1 -1
  526. package/build/sdk/legacy/auth/sdkOAuthClientProvider.js +30 -8
  527. package/build/sdk/legacy/auth/sdkOAuthClientProvider.js.map +1 -1
  528. package/build/sdk/legacy/client/runtime/backendDispatchLifetime.d.ts.map +1 -1
  529. package/build/sdk/legacy/client/runtime/backendDispatchLifetime.js +8 -2
  530. package/build/sdk/legacy/client/runtime/backendDispatchLifetime.js.map +1 -1
  531. package/build/sdk/legacy/client/runtime/legacyTransport.d.ts +2 -0
  532. package/build/sdk/legacy/client/runtime/legacyTransport.d.ts.map +1 -1
  533. package/build/sdk/legacy/client/runtime/serveClient.d.ts +6 -1
  534. package/build/sdk/legacy/client/runtime/serveClient.d.ts.map +1 -1
  535. package/build/sdk/legacy/client/runtime/serveClient.js +16 -5
  536. package/build/sdk/legacy/client/runtime/serveClient.js.map +1 -1
  537. package/build/sdk/legacy/commands/serve.d.ts +1 -0
  538. package/build/sdk/legacy/commands/serve.d.ts.map +1 -1
  539. package/build/sdk/legacy/commands/serve.js +41 -6
  540. package/build/sdk/legacy/commands/serve.js.map +1 -1
  541. package/build/sdk/legacy/server/protocol/projectAdmission.d.ts +4 -0
  542. package/build/sdk/legacy/server/protocol/projectAdmission.d.ts.map +1 -0
  543. package/build/sdk/legacy/server/protocol/projectAdmission.js +24 -0
  544. package/build/sdk/legacy/server/protocol/projectAdmission.js.map +1 -0
  545. package/build/sdk/legacy/server/protocol/promptRequestHandlers.d.ts.map +1 -1
  546. package/build/sdk/legacy/server/protocol/promptRequestHandlers.js +6 -3
  547. package/build/sdk/legacy/server/protocol/promptRequestHandlers.js.map +1 -1
  548. package/build/sdk/legacy/server/protocol/resourceRequestHandlers.d.ts.map +1 -1
  549. package/build/sdk/legacy/server/protocol/resourceRequestHandlers.js +6 -4
  550. package/build/sdk/legacy/server/protocol/resourceRequestHandlers.js.map +1 -1
  551. package/build/sdk/legacy/server/protocol/resourceSubscriptions.d.ts +1 -1
  552. package/build/sdk/legacy/server/protocol/resourceSubscriptions.d.ts.map +1 -1
  553. package/build/sdk/legacy/server/protocol/resourceSubscriptions.js +193 -41
  554. package/build/sdk/legacy/server/protocol/resourceSubscriptions.js.map +1 -1
  555. package/build/sdk/legacy/server/protocol/toolRequestHandlers.d.ts.map +1 -1
  556. package/build/sdk/legacy/server/protocol/toolRequestHandlers.js +93 -17
  557. package/build/sdk/legacy/server/protocol/toolRequestHandlers.js.map +1 -1
  558. package/build/sdk/legacy/server/runtime/clientInstancePool.d.ts +12 -0
  559. package/build/sdk/legacy/server/runtime/clientInstancePool.d.ts.map +1 -1
  560. package/build/sdk/legacy/server/runtime/clientInstancePool.js +117 -4
  561. package/build/sdk/legacy/server/runtime/clientInstancePool.js.map +1 -1
  562. package/build/sdk/legacy/server/runtime/connectionManager.d.ts.map +1 -1
  563. package/build/sdk/legacy/server/runtime/connectionManager.js +3 -1
  564. package/build/sdk/legacy/server/runtime/connectionManager.js.map +1 -1
  565. package/build/sdk/legacy/server/runtime/legacySdkServerAdapter.d.ts +3 -1
  566. package/build/sdk/legacy/server/runtime/legacySdkServerAdapter.d.ts.map +1 -1
  567. package/build/sdk/legacy/server/runtime/legacySdkServerAdapter.js +52 -2
  568. package/build/sdk/legacy/server/runtime/legacySdkServerAdapter.js.map +1 -1
  569. package/build/sdk/legacy/server/runtime/requestContextPreparation.d.ts +19 -1
  570. package/build/sdk/legacy/server/runtime/requestContextPreparation.d.ts.map +1 -1
  571. package/build/sdk/legacy/server/runtime/requestContextPreparation.js +40 -7
  572. package/build/sdk/legacy/server/runtime/requestContextPreparation.js.map +1 -1
  573. package/build/sdk/legacy/server/runtime/serverManager.d.ts +6 -2
  574. package/build/sdk/legacy/server/runtime/serverManager.d.ts.map +1 -1
  575. package/build/sdk/legacy/server/runtime/serverManager.js +85 -17
  576. package/build/sdk/legacy/server/runtime/serverManager.js.map +1 -1
  577. package/build/sdk/legacy/server/runtime/templateServerManager.d.ts +26 -4
  578. package/build/sdk/legacy/server/runtime/templateServerManager.d.ts.map +1 -1
  579. package/build/sdk/legacy/server/runtime/templateServerManager.js +260 -14
  580. package/build/sdk/legacy/server/runtime/templateServerManager.js.map +1 -1
  581. package/build/sdk/legacy/transport/http/modernInboundLegacyBridge.js +1 -1
  582. package/build/sdk/legacy/transport/http/modernInboundLegacyBridge.js.map +1 -1
  583. package/build/sdk/legacy/transport/http/server.d.ts +1 -1
  584. package/build/sdk/legacy/transport/http/server.d.ts.map +1 -1
  585. package/build/sdk/legacy/transport/http/server.js +5 -1
  586. package/build/sdk/legacy/transport/http/server.js.map +1 -1
  587. package/build/sdk/legacy/transport/http/streamableSessionLifecycle.d.ts.map +1 -1
  588. package/build/sdk/legacy/transport/http/streamableSessionLifecycle.js +14 -3
  589. package/build/sdk/legacy/transport/http/streamableSessionLifecycle.js.map +1 -1
  590. package/build/sdk/legacy/transport/stdioProxyTransport.d.ts +1 -0
  591. package/build/sdk/legacy/transport/stdioProxyTransport.d.ts.map +1 -1
  592. package/build/sdk/legacy/transport/stdioProxyTransport.js +2 -0
  593. package/build/sdk/legacy/transport/stdioProxyTransport.js.map +1 -1
  594. package/build/sdk/legacy/transport/transportFactory.d.ts.map +1 -1
  595. package/build/sdk/legacy/transport/transportFactory.js +2 -0
  596. package/build/sdk/legacy/transport/transportFactory.js.map +1 -1
  597. package/build/template/handlebarsTemplateRenderer.d.ts.map +1 -1
  598. package/build/template/handlebarsTemplateRenderer.js +3 -0
  599. package/build/template/handlebarsTemplateRenderer.js.map +1 -1
  600. package/build/transport/http/middlewares/projectAdmission.d.ts +5 -0
  601. package/build/transport/http/middlewares/projectAdmission.d.ts.map +1 -0
  602. package/build/transport/http/middlewares/projectAdmission.js +33 -0
  603. package/build/transport/http/middlewares/projectAdmission.js.map +1 -0
  604. package/build/transport/http/routes/adminRoutes.d.ts.map +1 -1
  605. package/build/transport/http/routes/adminRoutes.js +2 -0
  606. package/build/transport/http/routes/adminRoutes.js.map +1 -1
  607. package/build/transport/http/routes/apiRoutes.d.ts.map +1 -1
  608. package/build/transport/http/routes/apiRoutes.js +4 -0
  609. package/build/transport/http/routes/apiRoutes.js.map +1 -1
  610. package/build/transport/http/routes/inspectHelpers.d.ts +1 -0
  611. package/build/transport/http/routes/inspectHelpers.d.ts.map +1 -1
  612. package/build/transport/http/routes/inspectHelpers.js +2 -0
  613. package/build/transport/http/routes/inspectHelpers.js.map +1 -1
  614. package/build/transport/http/routes/inspectRequestContext.d.ts +5 -2
  615. package/build/transport/http/routes/inspectRequestContext.d.ts.map +1 -1
  616. package/build/transport/http/routes/inspectRequestContext.js +41 -19
  617. package/build/transport/http/routes/inspectRequestContext.js.map +1 -1
  618. package/build/transport/http/routes/inspectRoutes.d.ts +13 -2
  619. package/build/transport/http/routes/inspectRoutes.d.ts.map +1 -1
  620. package/build/transport/http/routes/inspectRoutes.js +119 -25
  621. package/build/transport/http/routes/inspectRoutes.js.map +1 -1
  622. package/build/transport/http/routes/instructionsRoutes.d.ts.map +1 -1
  623. package/build/transport/http/routes/instructionsRoutes.js +20 -8
  624. package/build/transport/http/routes/instructionsRoutes.js.map +1 -1
  625. package/build/transport/http/routes/modernHttpRoutes.d.ts.map +1 -1
  626. package/build/transport/http/routes/modernHttpRoutes.js +99 -15
  627. package/build/transport/http/routes/modernHttpRoutes.js.map +1 -1
  628. package/build/transport/http/routes/modernInteractionBinding.d.ts.map +1 -1
  629. package/build/transport/http/routes/modernInteractionBinding.js +3 -9
  630. package/build/transport/http/routes/modernInteractionBinding.js.map +1 -1
  631. package/build/transport/http/routes/modernProductTelemetry.d.ts +4 -0
  632. package/build/transport/http/routes/modernProductTelemetry.d.ts.map +1 -0
  633. package/build/transport/http/routes/modernProductTelemetry.js +65 -0
  634. package/build/transport/http/routes/modernProductTelemetry.js.map +1 -0
  635. package/build/transport/http/routes/modernSubscriptions.d.ts.map +1 -1
  636. package/build/transport/http/routes/modernSubscriptions.js +35 -17
  637. package/build/transport/http/routes/modernSubscriptions.js.map +1 -1
  638. package/build/transport/http/routes/modernTemplateContext.d.ts +2 -1
  639. package/build/transport/http/routes/modernTemplateContext.d.ts.map +1 -1
  640. package/build/transport/http/routes/modernTemplateContext.js +14 -3
  641. package/build/transport/http/routes/modernTemplateContext.js.map +1 -1
  642. package/build/transport/http/routes/modernToolHeaderRegistry.d.ts.map +1 -1
  643. package/build/transport/http/routes/modernToolHeaderRegistry.js +2 -2
  644. package/build/transport/http/routes/modernToolHeaderRegistry.js.map +1 -1
  645. package/build/transport/http/routes/preparationRoutes.d.ts +26 -0
  646. package/build/transport/http/routes/preparationRoutes.d.ts.map +1 -0
  647. package/build/transport/http/routes/preparationRoutes.js +132 -0
  648. package/build/transport/http/routes/preparationRoutes.js.map +1 -0
  649. package/build/transport/http/routes/projectRoutes.d.ts +18 -0
  650. package/build/transport/http/routes/projectRoutes.d.ts.map +1 -0
  651. package/build/transport/http/routes/projectRoutes.js +159 -0
  652. package/build/transport/http/routes/projectRoutes.js.map +1 -0
  653. package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
  654. package/build/transport/http/routes/streamableHttpRoutes.js +24 -4
  655. package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
  656. package/build/transport/http/routes/toolRoutes.d.ts.map +1 -1
  657. package/build/transport/http/routes/toolRoutes.js +163 -20
  658. package/build/transport/http/routes/toolRoutes.js.map +1 -1
  659. package/build/transport/http/utils/contextExtractor.d.ts +2 -0
  660. package/build/transport/http/utils/contextExtractor.d.ts.map +1 -1
  661. package/build/transport/http/utils/contextExtractor.js +11 -0
  662. package/build/transport/http/utils/contextExtractor.js.map +1 -1
  663. package/build/transport/http/utils/templateContextAuthority.d.ts +2 -0
  664. package/build/transport/http/utils/templateContextAuthority.d.ts.map +1 -1
  665. package/build/transport/http/utils/templateContextAuthority.js +23 -2
  666. package/build/transport/http/utils/templateContextAuthority.js.map +1 -1
  667. package/build/types/context.d.ts +13 -0
  668. package/build/types/context.d.ts.map +1 -1
  669. package/build/types/context.js.map +1 -1
  670. package/build/utils/cli/help.d.ts +7 -0
  671. package/build/utils/cli/help.d.ts.map +1 -0
  672. package/build/utils/cli/help.js +57 -0
  673. package/build/utils/cli/help.js.map +1 -0
  674. package/build/utils/security/privateFileSystem.d.ts +12 -0
  675. package/build/utils/security/privateFileSystem.d.ts.map +1 -0
  676. package/build/utils/security/privateFileSystem.js +114 -0
  677. package/build/utils/security/privateFileSystem.js.map +1 -0
  678. package/package.json +24 -24
  679. package/build/admin/assets/admin-console-DQaCpfYK.js +0 -3
  680. package/build/admin/assets/admin-icons-CYGTDZA5.js +0 -1
  681. package/build/admin/assets/admin-vendor-62eL-qdH.js +0 -1
  682. package/build/admin/assets/admin-vendor-BbMrl7MK.js +0 -3
  683. package/build/admin/assets/admin-vendor-DpjVwd81.js +0 -62
@@ -0,0 +1,144 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import path from 'node:path';
3
+ import { createProjectOwnerStorage, hasProjectOwnerState, resolveProjectOwnerStorage, temporaryProjectOwnerStorage, } from '../shared/projectOwnerStorage.js';
4
+ import { assertNoProjectOwnerCalls, assertProjectOwnerAbsent, createHookProjectOwner, hookProjectOwnerPath, isProjectOwnerEnded, markProjectOwnerEnded, markProjectOwnerReleased, readHookThreadLocatorRecord, readProjectOwner, readProjectOwnerTargets, readProjectOwnerTerminal, recordHookThreadLocator, recordProjectOwnerAssignment, removeProjectOwner, withHookIdentityLock, withProjectOwnerLock, } from '../shared/projectOwnerStore.js';
5
+ import { resolveProjectContext } from '../../config/projectConfigLoader.js';
6
+ import { getConfigDir } from '../../constants.js';
7
+ import { canonicalizeCheckoutPath } from '../../domains/project-selection/projectSelection.js';
8
+ import { z } from 'zod';
9
+ const inputSchema = z.object({
10
+ hook_event_name: z.enum(['SessionStart', 'SubagentStart', 'SessionEnd']),
11
+ session_id: z.string().min(1).max(512),
12
+ agent_id: z.string().min(1).max(512).optional(),
13
+ cwd: z.string().refine(path.isAbsolute).optional(),
14
+ });
15
+ function identity(options, input) {
16
+ const parsed = inputSchema.parse(JSON.parse(input));
17
+ if (parsed.hook_event_name !== options.event)
18
+ throw new Error('Hook event mismatch');
19
+ if (options.event === 'SessionStart' && parsed.agent_id)
20
+ throw new Error('SessionStart cannot establish worker assignment; use SubagentStart');
21
+ if (options.event === 'SubagentStart' && !parsed.agent_id)
22
+ throw new Error('Worker identity is missing');
23
+ if (options.event === 'SessionEnd' && parsed.agent_id)
24
+ throw new Error('SessionEnd does not verify worker termination');
25
+ return {
26
+ client: options.client,
27
+ sessionId: parsed.session_id,
28
+ ...(parsed.agent_id ? { agentId: parsed.agent_id } : {}),
29
+ };
30
+ }
31
+ export async function bootstrapOwner(options, input) {
32
+ if (options.event === 'SessionEnd')
33
+ throw new Error('End events cannot create ownership');
34
+ const hookIdentity = input.trim() ? identity(options, input) : undefined;
35
+ const storage = hookIdentity
36
+ ? await resolveProjectOwnerStorage(getConfigDir(options['config-dir']), hookIdentity.client, hookIdentity.agentId ?? hookIdentity.sessionId, hookIdentity.sessionId)
37
+ : undefined;
38
+ const establish = async () => {
39
+ let file = options['project-owner'];
40
+ let ownerIdentity = hookIdentity;
41
+ if (!file) {
42
+ if (!hookIdentity || !storage)
43
+ throw new Error('Missing hook owner identity');
44
+ const locator = await readHookThreadLocatorRecord(storage, hookIdentity.client, hookIdentity.agentId ?? hookIdentity.sessionId);
45
+ if (locator &&
46
+ (locator.identity.sessionId !== hookIdentity.sessionId || locator.identity.agentId !== hookIdentity.agentId))
47
+ throw new Error('Hook thread identity records disagree');
48
+ ownerIdentity = locator?.identity ?? hookIdentity;
49
+ const previous = locator?.ownerFile ?? hookProjectOwnerPath(storage, hookIdentity);
50
+ if (await isProjectOwnerEnded(previous))
51
+ ownerIdentity = { ...hookIdentity, generation: randomBytes(16).toString('hex') };
52
+ if (locator)
53
+ await readProjectOwner(previous);
54
+ file = await createHookProjectOwner(storage, ownerIdentity);
55
+ }
56
+ await readProjectOwner(file);
57
+ if (await isProjectOwnerEnded(file))
58
+ throw new Error('Session has ended; use project recover to retry recorded cleanup');
59
+ const parsed = input.trim() ? inputSchema.parse(JSON.parse(input)) : undefined;
60
+ let project = options.project;
61
+ if (options.event === 'SessionStart' && !project && !options['project-set'] && parsed?.cwd) {
62
+ project = [await canonicalizeCheckoutPath((await resolveProjectContext(parsed.cwd)).projectRoot, parsed.cwd)];
63
+ }
64
+ await recordProjectOwnerAssignment(file, {
65
+ version: 1,
66
+ worker: options.event === 'SubagentStart',
67
+ ...(project ? { project } : {}),
68
+ ...(options['project-set'] ? { 'project-set': options['project-set'] } : {}),
69
+ });
70
+ if (ownerIdentity && storage)
71
+ await recordHookThreadLocator(storage, ownerIdentity, file);
72
+ return file;
73
+ };
74
+ if (!hookIdentity || !storage)
75
+ return establish();
76
+ if (storage === temporaryProjectOwnerStorage(getConfigDir(options['config-dir'])))
77
+ await createProjectOwnerStorage(storage);
78
+ return withHookIdentityLock(storage, hookIdentity, establish);
79
+ }
80
+ export async function releaseSessionOwner(options, input, release) {
81
+ if (options.event !== 'SessionEnd')
82
+ throw new Error('Only verified SessionEnd may release ownership');
83
+ const hookIdentity = identity(options, input);
84
+ const storage = await resolveProjectOwnerStorage(getConfigDir(options['config-dir']), hookIdentity.client, hookIdentity.sessionId, hookIdentity.sessionId);
85
+ // Pin the generation before waiting for another lifecycle hook; cleanup never follows a newer locator.
86
+ const locator = await readHookThreadLocatorRecord(storage, hookIdentity.client, hookIdentity.sessionId);
87
+ const ownerIdentity = locator?.identity ?? hookIdentity;
88
+ const file = locator?.ownerFile ?? hookProjectOwnerPath(storage, hookIdentity);
89
+ if (!(await hasProjectOwnerState(storage, hookIdentity.client, hookIdentity.sessionId, hookIdentity.sessionId))) {
90
+ await assertProjectOwnerAbsent(file, hookIdentity);
91
+ return;
92
+ }
93
+ const selectedCredential = await readProjectOwner(file).catch((error) => {
94
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
95
+ return undefined;
96
+ throw error;
97
+ });
98
+ const selected = await withHookIdentityLock(storage, hookIdentity, async () => {
99
+ const currentCredential = await readProjectOwner(file).catch((error) => {
100
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
101
+ return undefined;
102
+ throw error;
103
+ });
104
+ if (currentCredential !== selectedCredential)
105
+ throw new Error('Session owner changed during terminal selection; no cleanup performed');
106
+ // An already-ended owner may be waiting on remote cleanup. Do not wait for its
107
+ // owner lock while holding the identity lock needed by a resumed startup.
108
+ if (await isProjectOwnerEnded(file))
109
+ return true;
110
+ return withProjectOwnerLock(file, async () => {
111
+ if (!currentCredential) {
112
+ await assertProjectOwnerAbsent(file, ownerIdentity);
113
+ return false;
114
+ }
115
+ await readProjectOwnerTargets(file);
116
+ await markProjectOwnerEnded(file, ownerIdentity);
117
+ return true;
118
+ });
119
+ });
120
+ if (selected)
121
+ await recoverEndedSessionOwner(file, release);
122
+ }
123
+ /** Recovery requires prior verified SessionEnd evidence, never age or a parent's lifetime. */
124
+ export async function recoverEndedSessionOwner(file, release) {
125
+ await withProjectOwnerLock(file, async () => {
126
+ if ((await readProjectOwnerTerminal(file))?.released) {
127
+ await removeProjectOwner(file);
128
+ return;
129
+ }
130
+ if (!(await isProjectOwnerEnded(file)))
131
+ throw new Error('No verified terminal record; active or abandoned owners cannot be recovered automatically');
132
+ const targets = await readProjectOwnerTargets(file);
133
+ await releaseTargets(file, targets, release);
134
+ });
135
+ }
136
+ async function releaseTargets(file, targets, release) {
137
+ await assertNoProjectOwnerCalls(file);
138
+ const results = await Promise.allSettled(targets.map((target) => release(file, target)));
139
+ if (results.some((result) => result.status === 'rejected'))
140
+ throw new Error('Session ownership cleanup is incomplete');
141
+ await markProjectOwnerReleased(file);
142
+ await removeProjectOwner(file);
143
+ }
144
+ //# sourceMappingURL=bootstrapOwnership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrapOwnership.js","sourceRoot":"","sources":["../../../src/commands/bootstrap/bootstrapOwnership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,M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YACrD,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAC/B,OAAO;QACT,CAAC;QACD,IAAI,CAAC,CAAC,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,2FAA2F,CAAC,CAAC;QAC/G,MAAM,OAAO,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,IAAY,EACZ,OAA6B,EAC7B,OAAyE;IAEzE,MAAM,yBAAyB,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACzF,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,MAAM,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Argv } from 'yargs';
2
+ export declare function setupBootstrapCommand(yargs: Argv): Argv;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/bootstrap/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CA6BvD"}
@@ -0,0 +1,25 @@
1
+ import { withProjectSelectionOptions } from '../shared/projectSelectionOptions.js';
2
+ import { withGlobalOptions } from '../../globalOptions.js';
3
+ import { runProductCommand } from '../../productTelemetry/commandScope.js';
4
+ export function setupBootstrapCommand(yargs) {
5
+ return withGlobalOptions(yargs).command('bootstrap', 'Deliver agent hook instructions', (command) => withProjectSelectionOptions(command)
6
+ .env(false)
7
+ .option('client', { type: 'string', choices: ['codex', 'claude'], demandOption: true })
8
+ .option('event', {
9
+ type: 'string',
10
+ choices: ['SessionStart', 'SubagentStart', 'SessionEnd'],
11
+ demandOption: true,
12
+ })
13
+ .option('url', { type: 'string', describe: 'Runtime URL' })
14
+ .option('context', { type: 'string', describe: 'Named Runtime Target Context' })
15
+ .option('preset', { type: 'string' })
16
+ .option('tags', { type: 'array', string: true })
17
+ .option('tag-filter', { type: 'string' })
18
+ .epilogue('Worker assignments come from dispatch instructions, never parent cwd or session identity. Disabled or untrusted hooks remain a delivery coverage gap.'), async (argv) => {
19
+ return runProductCommand('project', async () => {
20
+ const { bootstrapCommand } = await import('./bootstrap.js');
21
+ await bootstrapCommand(argv);
22
+ });
23
+ });
24
+ }
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bootstrap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAI1E,MAAM,UAAU,qBAAqB,CAAC,KAAW;IAC/C,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC,OAAO,CACrC,WAAW,EACX,iCAAiC,EACjC,CAAC,OAAO,EAAE,EAAE,CACV,2BAA2B,CAAC,OAAO,CAAC;SACjC,GAAG,CAAC,KAAK,CAAC;SAEV,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;SACtF,MAAM,CAAC,OAAO,EAAE;QACf,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,YAAY,CAAC;QACxD,YAAY,EAAE,IAAI;KACnB,CAAC;SACD,MAAM,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;SAC1D,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,8BAA8B,EAAE,CAAC;SAC/E,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;SACpC,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;SAC/C,MAAM,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;SACxC,QAAQ,CACP,uJAAuJ,CACxJ,EACL,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,OAAO,iBAAiB,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;YAC7C,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAC5D,MAAM,gBAAgB,CAAC,IAA8C,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cliSetup/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CA4DtD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cliSetup/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CA6DtD"}
@@ -1,7 +1,7 @@
1
- import { globalOptions } from '../../globalOptions.js';
1
+ import { withGlobalOptions } from '../../globalOptions.js';
2
+ import { exitProductCommand, runProductCommand } from '../../productTelemetry/commandScope.js';
2
3
  export function setupCliSetupCommand(yargs) {
3
- return yargs.command('cli-setup', 'Install 1MCP CLI hooks and reference files for Codex and Claude', (commandYargs) => commandYargs
4
- .options(globalOptions || {})
4
+ return withGlobalOptions(yargs).command('cli-setup', 'Install Codex and Claude CLI hooks and preparation skill', (commandYargs) => commandYargs
5
5
  .option('scope', {
6
6
  describe: 'Setup scope',
7
7
  type: 'string',
@@ -35,18 +35,20 @@ export function setupCliSetupCommand(yargs) {
35
35
  .example('$0 cli-setup --codex', 'Install global Codex hooks and reference files')
36
36
  .example('$0 cli-setup --claude --scope repo --repo-root .', 'Install repo-local Claude hooks and reference files')
37
37
  .example('$0 cli-setup --codex --scope all', 'Install global and repo-local Codex setup')
38
- .epilogue('This command writes hook config and lightweight startup-file references. Errors are written to stderr only.'), async (argv) => {
39
- const { configureGlobalLogger } = await import('../../logger/configureGlobalLogger.js');
40
- const { cliSetupCommand } = await import('./cliSetup.js');
41
- configureGlobalLogger(argv, 'stdio');
42
- try {
43
- await cliSetupCommand(argv);
44
- }
45
- catch (error) {
46
- const message = error instanceof Error ? error.message : String(error);
47
- process.stderr.write(`${message}\n`);
48
- process.exit(1);
49
- }
38
+ .epilogue('This command writes hook config, startup-file references, and the preparation setup skill. It does not activate backend preparation. Errors are written to stderr only.'), async (argv) => {
39
+ return runProductCommand('config', async () => {
40
+ const { configureGlobalLogger } = await import('../../logger/configureGlobalLogger.js');
41
+ const { cliSetupCommand } = await import('./cliSetup.js');
42
+ configureGlobalLogger(argv, 'stdio');
43
+ try {
44
+ await cliSetupCommand(argv);
45
+ }
46
+ catch (error) {
47
+ const message = error instanceof Error ? error.message : String(error);
48
+ process.stderr.write(`${message}\n`);
49
+ exitProductCommand(1);
50
+ }
51
+ });
50
52
  });
51
53
  }
52
54
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cliSetup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD,MAAM,UAAU,oBAAoB,CAAC,KAAW;IAC9C,OAAO,KAAK,CAAC,OAAO,CAClB,WAAW,EACX,iEAAiE,EACjE,CAAC,YAAY,EAAE,EAAE,CACf,YAAY;SACT,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,OAAO,EAAE;QACf,QAAQ,EAAE,aAAa;QACvB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC;QAClC,OAAO,EAAE,QAAQ;KAClB,CAAC;SACD,MAAM,CAAC,OAAO,EAAE;QACf,QAAQ,EAAE,oCAAoC;QAC9C,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,QAAQ,EAAE;QAChB,QAAQ,EAAE,qCAAqC;QAC/C,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,QAAQ,EAAE,4CAA4C;QACtD,IAAI,EAAE,QAAQ;KACf,CAAC;SACD,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3D,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,0DAA0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AAI,EAAE,EAAE;QACb,OAAO,iBAAiB,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;YAC5C,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CAAC,sCAAsC,CAAC,CAAC;YACvF,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;YAE1D,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACrC,IAAI,CAAC;gBACH,MAAM,eAAe,CAAC,IAA6C,CAAC,CAAC;YACvE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;gBACrC,kBAAkB,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface SkillInstallResult {
2
+ path: string;
3
+ changed: boolean;
4
+ status: 'installed' | 'updated' | 'unchanged' | 'conflict';
5
+ reason?: string;
6
+ }
7
+ export declare function installPreparationSkill(scopeRoot: string, skillsRelativePath: string, files?: Readonly<Record<string, string>>): Promise<SkillInstallResult>;
8
+ //# sourceMappingURL=installPreparationSkill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installPreparationSkill.d.ts","sourceRoot":"","sources":["../../../src/commands/cliSetup/installPreparationSkill.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAwDD,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,EAC1B,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAyB,GAC9D,OAAO,CAAC,kBAAkB,CAAC,CA8B7B"}
@@ -0,0 +1,201 @@
1
+ import { createHash, randomUUID } from 'node:crypto';
2
+ import { lstat, mkdir, readFile, rename, rm, rmdir, stat, unlink, writeFile } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { z } from 'zod';
5
+ import { preparationSkillFiles } from './preparationSkill.generated.js';
6
+ const SKILL_NAME = '1mcp-preparation-setup';
7
+ const MANIFEST = '.1mcp-managed.json';
8
+ const relativeFile = z.string().refine((value) => {
9
+ if (value === MANIFEST)
10
+ return false;
11
+ return value.split('/').every((part) => /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(part));
12
+ });
13
+ const manifestSchema = z.object({
14
+ schemaVersion: z.literal(1),
15
+ skill: z.literal(SKILL_NAME),
16
+ files: z.record(relativeFile, z.string().regex(/^[a-f0-9]{64}$/)),
17
+ pendingFiles: z.record(relativeFile, z.string().regex(/^[a-f0-9]{64}$/)).optional(),
18
+ });
19
+ function digest(content) {
20
+ return createHash('sha256').update(content).digest('hex');
21
+ }
22
+ function isMissing(error) {
23
+ return error instanceof Error && 'code' in error && error.code === 'ENOENT';
24
+ }
25
+ async function statIfPresent(file) {
26
+ try {
27
+ return await lstat(file);
28
+ }
29
+ catch (error) {
30
+ if (isMissing(error))
31
+ return undefined;
32
+ throw error;
33
+ }
34
+ }
35
+ // Check every component below the selected scope, including dangling symlinks.
36
+ async function pathConflict(root, file, directory) {
37
+ // The caller selected this root; aliases to it are valid, unlike redirects beneath it.
38
+ try {
39
+ if (!(await stat(root)).isDirectory())
40
+ return `Expected a directory: ${root}`;
41
+ }
42
+ catch (error) {
43
+ if (isMissing(error))
44
+ return undefined;
45
+ throw error;
46
+ }
47
+ const relative = path.relative(root, file);
48
+ const parts = relative ? relative.split(path.sep) : [];
49
+ let current = root;
50
+ for (let index = 0; index < parts.length; index++) {
51
+ current = path.join(current, parts[index]);
52
+ const stat = await statIfPresent(current);
53
+ if (!stat)
54
+ return undefined;
55
+ if (stat.isSymbolicLink())
56
+ return `Symlink preserved: ${current}`;
57
+ const needsDirectory = index < parts.length - 1 || directory;
58
+ if (needsDirectory && !stat.isDirectory())
59
+ return `Expected a directory: ${current}`;
60
+ if (!needsDirectory && !stat.isFile())
61
+ return `Expected a regular file: ${current}`;
62
+ }
63
+ return undefined;
64
+ }
65
+ async function writeAtomically(file, content) {
66
+ await mkdir(path.dirname(file), { recursive: true, mode: 0o700 });
67
+ const temporary = `${file}.${randomUUID()}.tmp`;
68
+ try {
69
+ await writeFile(temporary, content, { flag: 'wx', mode: 0o600 });
70
+ await rename(temporary, file);
71
+ }
72
+ finally {
73
+ await unlink(temporary).catch((error) => {
74
+ if (!isMissing(error))
75
+ throw error;
76
+ });
77
+ }
78
+ }
79
+ export async function installPreparationSkill(scopeRoot, skillsRelativePath, files = preparationSkillFiles) {
80
+ const root = path.resolve(scopeRoot);
81
+ const destination = path.join(root, skillsRelativePath, SKILL_NAME);
82
+ const conflict = (reason) => ({
83
+ path: destination,
84
+ changed: false,
85
+ status: 'conflict',
86
+ reason,
87
+ });
88
+ const directoryConflict = await pathConflict(root, destination, true);
89
+ if (directoryConflict)
90
+ return conflict(directoryConflict);
91
+ await mkdir(path.dirname(destination), { recursive: true, mode: 0o700 });
92
+ const lockPath = `${destination}.install-lock`;
93
+ try {
94
+ await mkdir(lockPath, { mode: 0o700 });
95
+ }
96
+ catch (error) {
97
+ if (error instanceof Error && 'code' in error && error.code === 'EEXIST') {
98
+ return conflict(`Installation lock exists: ${lockPath}. Confirm its installer stopped before removing the lock and retrying.`);
99
+ }
100
+ throw error;
101
+ }
102
+ try {
103
+ return await installUnderLock(root, destination, lockPath, files);
104
+ }
105
+ finally {
106
+ await rm(path.join(lockPath, 'staging'), { recursive: true, force: true });
107
+ await rmdir(lockPath);
108
+ }
109
+ }
110
+ async function installUnderLock(root, destination, lockPath, files) {
111
+ const conflict = (reason) => ({
112
+ path: destination,
113
+ changed: false,
114
+ status: 'conflict',
115
+ reason,
116
+ });
117
+ const directoryConflict = await pathConflict(root, destination, true);
118
+ if (directoryConflict)
119
+ return conflict(directoryConflict);
120
+ const exists = await statIfPresent(destination);
121
+ const manifestPath = path.join(destination, MANIFEST);
122
+ let previous = {};
123
+ let previousManifest;
124
+ let pending;
125
+ if (exists) {
126
+ const manifestConflict = await pathConflict(root, manifestPath, false);
127
+ if (manifestConflict)
128
+ return conflict(manifestConflict);
129
+ if (!(await statIfPresent(manifestPath)))
130
+ return conflict('Existing skill has no 1MCP ownership manifest');
131
+ previousManifest = await readFile(manifestPath, 'utf8');
132
+ try {
133
+ const manifest = manifestSchema.parse(JSON.parse(previousManifest));
134
+ previous = manifest.files;
135
+ pending = manifest.pendingFiles;
136
+ }
137
+ catch {
138
+ return conflict('Invalid 1MCP ownership manifest; existing skill preserved');
139
+ }
140
+ if (!previous['SKILL.md'])
141
+ return conflict('Ownership manifest does not identify SKILL.md');
142
+ }
143
+ // Preflight the whole skill so one conflict cannot leave a partially upgraded recipe guide.
144
+ const contents = new Map();
145
+ for (const relative of new Set([...Object.keys(previous), ...Object.keys(pending ?? {}), ...Object.keys(files)])) {
146
+ relativeFile.parse(relative);
147
+ const file = path.join(destination, relative);
148
+ const fileConflict = await pathConflict(root, file, false);
149
+ if (fileConflict)
150
+ return conflict(fileConflict);
151
+ if (!(await statIfPresent(file))) {
152
+ // A missing pending addition may have been published and then deleted by the user.
153
+ if (!previous[relative] && pending?.[relative])
154
+ return conflict(`Pending managed file is missing: ${relative}`);
155
+ if (!previous[relative])
156
+ continue;
157
+ if (pending && !Object.hasOwn(pending, relative))
158
+ continue;
159
+ return conflict(`Managed file was removed: ${relative}`);
160
+ }
161
+ const content = await readFile(file, 'utf8');
162
+ if (!previous[relative] && !pending?.[relative])
163
+ return conflict(`Unmanaged file preserved: ${relative}`);
164
+ const hash = digest(content);
165
+ if (hash !== previous[relative] && hash !== pending?.[relative])
166
+ return conflict(`Locally edited file preserved: ${relative}`);
167
+ contents.set(relative, content);
168
+ }
169
+ const nextManifest = `${JSON.stringify({
170
+ schemaVersion: 1,
171
+ skill: SKILL_NAME,
172
+ files: Object.fromEntries(Object.entries(files).map(([file, content]) => [file, digest(content)])),
173
+ }, null, 2)}\n`;
174
+ if (previousManifest === nextManifest)
175
+ return { path: destination, changed: false, status: 'unchanged' };
176
+ const writeRoot = exists ? destination : path.join(lockPath, 'staging');
177
+ if (exists) {
178
+ // Journal both accepted and intended bytes before replacing any managed file.
179
+ await writeAtomically(manifestPath, `${JSON.stringify({
180
+ schemaVersion: 1,
181
+ skill: SKILL_NAME,
182
+ files: Object.fromEntries([...contents].map(([file, content]) => [file, digest(content)])),
183
+ pendingFiles: Object.fromEntries(Object.entries(files).map(([file, content]) => [file, digest(content)])),
184
+ }, null, 2)}\n`);
185
+ }
186
+ for (const [relative, content] of Object.entries(files)) {
187
+ if (contents.get(relative) === content)
188
+ continue;
189
+ await writeAtomically(path.join(writeRoot, relative), content);
190
+ }
191
+ for (const relative of contents.keys()) {
192
+ if (Object.hasOwn(files, relative))
193
+ continue;
194
+ await unlink(path.join(destination, relative));
195
+ }
196
+ await writeAtomically(path.join(writeRoot, MANIFEST), nextManifest);
197
+ if (!exists)
198
+ await rename(writeRoot, destination);
199
+ return { path: destination, changed: true, status: exists ? 'updated' : 'installed' };
200
+ }
201
+ //# sourceMappingURL=installPreparationSkill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installPreparationSkill.js","sourceRoot":"","sources":["../../../src/commands/cliSetup/installPreparationSkill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAA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,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AACxF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const preparationSkillFiles: Readonly<Record<string, string>>;
2
+ //# sourceMappingURL=preparationSkill.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preparationSkill.generated.d.ts","sourceRoot":"","sources":["../../../src/commands/cliSetup/preparationSkill.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASlE,CAAC"}
@@ -0,0 +1,8 @@
1
+ // Generated by scripts/generate-preparation-skill.mjs. Edit skills/1mcp-preparation-setup instead.
2
+ export const preparationSkillFiles = {
3
+ 'references/code-review-graph.md': "# Code Review Graph\n\nInspect the installed version's public build/update and status interfaces. Match the readiness probe's expected file set to the actual parser-supported source universe. Some YAML files produce no graph nodes; a generic extension scan can otherwise demand synchronization forever even after a successful native build.\n\nVerify supported additions, edits, and deletions, including untracked files. Do not drop YAML wholesale to silence a mismatch: supported Ansible or Spring content may still need indexing. If the public CLI skips a supported source class, identify the gap; use another documented native interface only after version-specific verification.\n\nCheck completed-build markers, checkout identity, source hashes, and coverage together. Node counts or a build SHA alone cannot establish dirty-source freshness. Use the installed CLI's documented output flags rather than assuming `--json` exists.\n\nAn earlier 2.3.9 integration stored absolute checkout paths. Do not seed another worktree by copying that database; initialize the target natively unless the installed version provides verified relocation support. Native operation-wide writer ownership and cancellation require their own evidence, even when fixture tests pass.\n",
4
+ 'references/codegraph.md': "# CodeGraph\n\nInspect the installed version's native initialization, synchronization, status, and locking interfaces. Define which source files and extraction versions the readiness check covers. Watcher configuration matters: a disabled watcher requires explicit freshness checks and synchronization.\n\n## Optional worktree seeding\n\nUse seeding only after verifying the installed version stores portable relative paths and supports a compatible snapshot. Confirm repository identity, index schema/extraction version, integrity, and native writer ownership. A matching commit alone does not establish compatibility or dirty-source freshness.\n\nFor compatible SQLite indexes, use the SQLite online backup interface to obtain a consistent snapshot. Do not copy a live database file, WAL, lock, or process state blindly. Preserve an existing destination index. Put the optimization in the recipe's helper rather than modifying 1MCP runtime code.\n\nAfter seeding, always run native synchronization and the readiness probe. Verify worktree-only symbol additions, edits, and deletion through fresh 1MCP queries, and confirm the original checkout remains isolated. If portability cannot be established, use ordinary native initialization; if a writer conflict exists, report the conflict rather than bypassing it.\n\nEarlier experiments on CodeGraph 1.6.2 demonstrated relative-path seeding but did not establish universal writer coordination or cancellation guarantees. Recheck the installed version; do not copy machine-specific executable paths or treat those experiments as current acceptance.\n",
5
+ 'references/serena.md': "# Serena\n\nSeparate project configuration creation, language-server dependencies/startup, indexing/cache warmup, and onboarding. Choose and document the requested scope. A create-only recipe may report configuration readiness, but must not claim that the language server, symbol index, or onboarding is ready.\n\nUse the installed version's public project commands and preserve existing project settings. Verify that rerunning initialization leaves user configuration intact and identify how concurrent native configuration writers are coordinated. Keep dependency installation separate unless authorized; never mark onboarding complete on the user's behalf merely to satisfy a probe.\n\nAfter configuration preparation, verify a real symbol lookup in the selected checkout through 1MCP. Missing dependencies or failed language-server startup remain native usability gaps even if the configuration probe passes. Gate only operations for which the recipe's declared scope is appropriate.\n\nDo not copy running language-server state or caches between worktrees without native portability support. Earlier Serena 2.0.0 experiments covered create-only preparation, not general language/platform readiness or cancellation. Recheck current behavior before adopting that approach.\n",
6
+ 'SKILL.md': '---\nname: 1mcp-preparation-setup\ndescription: Configure 1MCP backend preparation for selected projects and worktrees. Use when installing or adapting a preparation recipe, authoring a missing recipe or helper, enabling automatic preparation, or diagnosing recipe readiness. Covers dynamic MCP backends; ordinary MCP server launch setup uses mcp setup.\n---\n\n# Set up backend preparation\n\nDeliver a configured recipe and evidence for its declared readiness scope. Installing this skill alone changes no backend settings. Use the installed 1MCP CLI and its current help and instructions; recipe support and native backend behavior vary by version.\n\n## Establish the target\n\nIdentify the runtime (`--url` or `--context`, plus configuration location and filters), assigned checkout or selected project-set member, configured server name, native version, current recipe and effective permissions. Normal local calls use the verified startup or worker assignment and omit `--project` and `--project-owner`. Keep any explicit target override through discovery, preparation, schema inspection, and invocation; an override does not change the session default.\n\nFollow current bootstrap guidance for ownership. Codex hosts with trustworthy thread lookup resolve their own owner automatically; hosts without that integration use their own bootstrap-provided `--project-owner` reference. Each worker needs its own explicit assignment and owner. Explicit `--url` calls remain credentialless unless an owner is explicitly supplied; local credentials do not authorize remote lifecycle controls. Resolve missing assignment before project-specific work.\n\nReuse current hook-delivered instructions; otherwise fetch scoped `1mcp instructions`. Inspect the server and applicable instructions, then tool schemas before invoking tools through `1mcp run`. `1mcp project prepare inspect <server>` checks readiness even when discovery is empty and does not start preparation. Native CLI help and read-only diagnostics can establish recipe behavior; upstream MCP calls stay routed through 1MCP.\n\nRead only the matching backend reference: [CodeGraph](references/codegraph.md), [Code Review Graph](references/code-review-graph.md), or [Serena](references/serena.md). For other backends, discover their native public setup and readiness interfaces. These examples are conditional techniques, not bundled production recipes.\n\n## Resolve or author the recipe\n\nReuse a compatible supplied recipe when available. Otherwise read the current [recipe contract](https://github.com/1mcp-app/agent/blob/main/docs/development/backend-preparation-recipes.md), checking it against the installed version. In a source checkout, use its matching document and schemas. Produce a named `configured-command` JSON definition and only the helper files needed to translate native behavior into that contract.\n\n- Declare backend/version/platform compatibility, readiness scope, affected tools, supported actions, and helper identity. Keep machine-specific paths and inputs in runtime configuration. Commands use executable/argument arrays, literal placeholders, and the selected checkout as cwd; they are not shell command strings.\n- Prefer native public commands. Validate recipe shape with the installed runtime\'s schema/loading path. The demonstration fixture proves the generic contract only; it is not an integration for a native indexer.\n- Probes and optional progress commands must be read-only and bounded. For an index, check checkout identity, completeness, supported source coverage, and freshness including dirty and untracked additions, edits, and deletions. A file existing or a successful action exit is insufficient.\n- Map verified states to `ready`, `required` with its supported action, or `conflict`. In the current contract, unknown readiness comes from an unmapped exit or failed check, not a configured `state: "unknown"`. Never translate uncertainty into ready.\n- Establish native writer coordination and attached-process cancellation behavior. Preserve foreign locks and work. Do not infer those guarantees from 1MCP process containment or fixture success.\n- Bump recipe/helper revisions when behavior changes; declare helper files so identity reflects their content. Avoid changing helpers during admitted jobs.\n\nIf native guarantees remain unverified, explain the specific limitation and affected scope. Experimental installation is allowed when the user explicitly accepts it, including acceptance already given in this task. Experimental status never licenses a false readiness result. A request to inspect or draft alone does not authorize activation.\n\n## Apply authorized configuration\n\nBack up the current configuration and compare it again before applying a scoped change. Preserve unrelated fields and existing explicit backend/project disables. Attach the named definition by matching ID and absolute file path to the existing server/template; keep `allowedActions` separate from the recipe\'s declared actions.\n\nFor requested automatic preparation across authorized checkouts, use a named definition with `activation: "setup"`. For project-only automatic preparation, retain project opt-in and update the effective `.1mcprc` by configured server name, respecting linked-worktree inheritance. Clarify activation scope only when it cannot be inferred from the request. Do not combine named and inline integration definitions.\n\nAuthorize only the requested actions. Installation, paid services, rebuilds, wider checkout access, and removal of explicit disables require their own applicable authorization. A denied action is not a reason to widen permissions. Read back effective runtime configuration and readiness after installation; a written file does not establish that the runtime loaded it.\n\n## Verify and close out\n\nUse an isolated checkout for source-changing checks. Verify the declared scope with a cold checkout, an already-ready checkout, supported source changes, and checkout isolation. Test conflict and failure behavior without interfering with foreign processes. If native concurrency/cancellation cannot be exercised, report that gap explicitly.\n\n1. Inspect readiness for the exact target and operation. Start permitted work with `1mcp project prepare start <server>` only when needed.\n2. Follow the returned job with `status` or bounded `wait --wait-ms 5000`. Keep the same runtime, project, owner, filters, and operation. A job performs one action; terminal failure or another required action needs diagnosis and deliberate retry, not a retry loop.\n3. Verify the post-action probe. Refresh server discovery and inspect the tool schema, then submit a fresh tool call. Preparation never replays the original request. Check that the returned result belongs to the selected checkout and reflects the test source.\n4. Release only task-owned bindings when their work is finished. For disposable checkout removal, follow current `project release` and manager/operator `project drain` guidance; require confirmed completion before removal and preserve other owners. Turn completion alone is not session termination. Do not add Git or client hooks as a side effect of recipe setup.\n\nReport changed paths, activation scope and allowed actions, configuration/readback evidence, probe and real-tool results, and any unverified guarantees. Distinguish installed configuration, recipe readiness, and native usability. For rollback, disable just the server\'s `preparation.enabled` or the selected project\'s preparation preference; restore backups only after checking for intervening unrelated changes. Name retained verification resources and their blockers instead of claiming cleanup finished.\n',
7
+ };
8
+ //# sourceMappingURL=preparationSkill.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preparationSkill.generated.js","sourceRoot":"","sources":["../../../src/commands/cliSetup/preparationSkill.generated.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,MAAM,CAAC,MAAM,qBAAqB,GAAqC;IACrE,iCAAiC,EAC/B,kvCAAkvC;IACpvC,yBAAyB,EACvB,gkDAAgkD;IAClkD,sBAAsB,EACpB,+vCAA+vC;IACjwC,UAAU,EACR,ujPAAujP;CAC1jP,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { renderManagedDocContent, renderStartupDocManagedBlock, upsertStartupDocManagedBlock } from '../../core/instructions/instructionsDistribution.js';
2
+ import { type SkillInstallResult } from './installPreparationSkill.js';
2
3
  export declare const CLI_SETUP_TARGETS: readonly ["codex", "claude"];
3
4
  export type CliSetupTarget = (typeof CLI_SETUP_TARGETS)[number];
4
5
  export declare const CLI_SETUP_SCOPES: readonly ["global", "repo", "all"];
@@ -11,7 +12,9 @@ interface WriteCliSetupOptions {
11
12
  export interface CliSetupWriteResult {
12
13
  path: string;
13
14
  changed: boolean;
14
- kind: 'hook' | 'startup-doc' | 'managed-doc';
15
+ kind: 'hook' | 'startup-doc' | 'managed-doc' | 'skill';
16
+ status?: SkillInstallResult['status'];
17
+ reason?: string;
15
18
  target: CliSetupTarget;
16
19
  scope: Exclude<CliSetupScope, 'all'>;
17
20
  }
@@ -19,4 +22,5 @@ export declare function resolveCliSetupScope(rawScope?: string): CliSetupScope;
19
22
  export declare function writeCliSetupFiles(options: WriteCliSetupOptions): Promise<CliSetupWriteResult[]>;
20
23
  export declare function formatCliSetupOutput(results: CliSetupWriteResult[]): string;
21
24
  export { renderManagedDocContent, renderStartupDocManagedBlock, upsertStartupDocManagedBlock };
25
+ export declare function upsertHooks(existing: Record<string, unknown>, target: CliSetupTarget): Record<string, unknown>;
22
26
  //# sourceMappingURL=setupFiles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setupFiles.d.ts","sourceRoot":"","sources":["../../../src/commands/cliSetup/setupFiles.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAE5B,4BAA4B,EAC7B,MAAM,oDAAoD,CAAC;AAK5D,eAAO,MAAM,iBAAiB,8BAA+B,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,gBAAgB,oCAAqC,CAAC;AACnE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAe9D,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC;IAC7C,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;CACtC;AAsBD,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAWrE;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAiBtG;AA2BD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAO3E;A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