@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,709 @@
1
+ import { BackendPolicySchema, BackendReadyReadinessSchema, PreparationFailureSchema, preparationKey, PreparationOptionsSchema, PreparationTargetSchema, } from './policy.js';
2
+ import { PreparationScheduler } from './scheduler.js';
3
+ export class BackendPreparationService {
4
+ registry;
5
+ options;
6
+ scheduler;
7
+ jobs = new Map();
8
+ identities = new Map();
9
+ sequence = 0;
10
+ shuttingDown = false;
11
+ constructor(registry, options = {}) {
12
+ this.registry = registry;
13
+ this.options = PreparationOptionsSchema.parse(options);
14
+ this.scheduler = new PreparationScheduler(this.options.concurrency, this.options.queueCapacity);
15
+ }
16
+ async inspect(target, operation, options = {}) {
17
+ const resolved = PreparationTargetSchema.parse(target);
18
+ const adapter = this.registry.get(resolved.backendName);
19
+ if (!adapter)
20
+ return this.unsupported(resolved.backendName);
21
+ const waitMs = PreparationOptionsSchema.shape.requestWaitMs.parse(options.waitMs ?? this.options.requestWaitMs);
22
+ return this.probe(adapter, resolved, operation, waitMs, options.signal);
23
+ }
24
+ /** Explicit status inspection is read-only and never admits, retries, or changes a job. */
25
+ async inspectProgress(target, operation, options = {}) {
26
+ const resolved = PreparationTargetSchema.parse(target);
27
+ const adapter = this.registry.get(resolved.backendName);
28
+ if (!adapter?.progress)
29
+ return undefined;
30
+ const waitMs = PreparationOptionsSchema.shape.requestWaitMs.parse(options.waitMs ?? this.options.requestWaitMs);
31
+ if (waitMs === 0 || options.signal?.aborted)
32
+ return undefined;
33
+ const controller = new AbortController();
34
+ return new Promise((resolve) => {
35
+ let settled = false;
36
+ const finish = (progress) => {
37
+ if (settled)
38
+ return;
39
+ settled = true;
40
+ clearTimeout(timer);
41
+ options.signal?.removeEventListener('abort', stop);
42
+ resolve(progress);
43
+ };
44
+ const stop = () => {
45
+ controller.abort();
46
+ finish();
47
+ };
48
+ const timer = setTimeout(stop, waitMs);
49
+ options.signal?.addEventListener('abort', stop, { once: true });
50
+ try {
51
+ void adapter.progress(resolved, operation, { signal: controller.signal, waitMs }).then(finish, () => finish());
52
+ }
53
+ catch {
54
+ finish();
55
+ }
56
+ });
57
+ }
58
+ /** Recovery only reconciles native evidence. A persisted running flag never starts or kills work. */
59
+ async recover(target, operation, advisory, options = {}) {
60
+ const resolved = PreparationTargetSchema.parse(target);
61
+ const adapter = this.registry.get(resolved.backendName);
62
+ if (!adapter)
63
+ return this.unsupported(resolved.backendName);
64
+ if (!adapter.reconcile)
65
+ return {
66
+ state: 'conflict',
67
+ instructions: 'Native ownership reconciliation is unavailable; inspect prerequisites before explicit preparation.',
68
+ };
69
+ const waitMs = PreparationOptionsSchema.shape.requestWaitMs.parse(options.waitMs ?? this.options.requestWaitMs);
70
+ return this.readReadiness((signal) => adapter.reconcile(resolved, operation, advisory, { signal, waitMs }), (error) => adapter.classifyFailure(error), waitMs, options.signal);
71
+ }
72
+ async prepare(target, operation, policy, action, options = {}) {
73
+ if (this.shuttingDown)
74
+ return this.shutdownResult();
75
+ const resolved = Object.freeze(PreparationTargetSchema.parse(target));
76
+ const authority = BackendPolicySchema.parse(policy);
77
+ const active = this.activeJob(resolved, authority, action, operation);
78
+ if (active)
79
+ return { state: 'job', status: this.snapshot(active) };
80
+ const adapter = this.registry.get(resolved.backendName);
81
+ if (!adapter)
82
+ return this.unsupported(resolved.backendName);
83
+ const waitMs = PreparationOptionsSchema.shape.requestWaitMs.parse(options.waitMs ?? this.options.requestWaitMs);
84
+ const readiness = await this.probe(adapter, resolved, operation, waitMs, options.signal);
85
+ return this.prepareInspected(resolved, operation, authority, adapter, readiness, action, undefined, options.beforeAdmission, options.validateAdmission);
86
+ }
87
+ async prepareInspected(resolved, operation, authority, adapter, readiness, action, replacement, beforeAdmission, validateAdmission) {
88
+ if (this.shuttingDown)
89
+ return this.shutdownResult();
90
+ const active = this.activeJob(resolved, authority, action, operation);
91
+ if (active)
92
+ return { state: 'job', status: this.snapshot(active) };
93
+ if (readiness.state === 'conflict')
94
+ return readiness;
95
+ if (readiness.state === 'unsupported')
96
+ return readiness;
97
+ if (readiness.state === 'unknown')
98
+ return readiness;
99
+ if (readiness.state === 'ready') {
100
+ if (!action) {
101
+ this.clearResolvedFailure(resolved, operation, authority, readiness);
102
+ return { state: 'ready', readiness };
103
+ }
104
+ }
105
+ const selected = action ?? (readiness.state === 'required' ? readiness.action : undefined);
106
+ if (!selected)
107
+ return { state: 'forbidden', instructions: 'No permitted preparation action was selected.' };
108
+ if (!authority.allowedActions.includes(selected))
109
+ return { state: 'forbidden', instructions: `Runtime policy does not permit ${selected}.` };
110
+ const key = `${preparationKey(resolved, authority, this.options, operation)}:${selected}`;
111
+ // Another compatible inspection may have admitted a job while this inspection was pending.
112
+ const failed = action ? undefined : this.failedJob(resolved, authority, operation);
113
+ if (failed)
114
+ return { state: 'job', status: this.snapshot(failed) };
115
+ const admitted = this.findJob(key);
116
+ if (admitted && admitted !== replacement && admitted.status.state !== 'ready') {
117
+ if (replacement)
118
+ return {
119
+ state: 'busy',
120
+ instructions: `Retry of ${replacement.status.id} (${replacement.status.action}) did not start: ${admitted.status.id} owns ${selected}. Check or explicitly retry that operation; both records are preserved.`,
121
+ };
122
+ if (admitted.status.action !== selected)
123
+ return {
124
+ state: 'busy',
125
+ instructions: `Preparation ${admitted.status.id} reserves ${selected} while performing ${admitted.status.action}; wait before explicitly selecting ${selected} again.`,
126
+ };
127
+ return { state: 'job', status: this.snapshot(admitted) };
128
+ }
129
+ if (!replacement)
130
+ this.releaseCompletedRecords();
131
+ if (this.jobs.size - (replacement ? 1 : 0) >= this.options.maxRecords)
132
+ return {
133
+ state: 'busy',
134
+ instructions: 'Preparation status capacity reached; use a new runtime after reconciling retained operations.',
135
+ };
136
+ if (validateAdmission) {
137
+ await validateAdmission();
138
+ // Validation may have yielded to another caller, shutdown, or a completed job.
139
+ // Repeat identity/capacity checks, then run the synchronous mutation guard with no further await.
140
+ return this.prepareInspected(resolved, operation, authority, adapter, readiness, action, replacement, beforeAdmission);
141
+ }
142
+ let complete;
143
+ const completion = new Promise((resolve) => {
144
+ complete = resolve;
145
+ });
146
+ const job = {
147
+ status: {
148
+ id: `preparation-${++this.sequence}`,
149
+ target: resolved,
150
+ operation,
151
+ action: selected,
152
+ state: 'queued',
153
+ attempt: 1,
154
+ executionDeadlineMs: authority.executionDeadlineMs ?? this.options.executionDeadlineMs,
155
+ readiness,
156
+ },
157
+ adapter,
158
+ policy: authority,
159
+ controller: new AbortController(),
160
+ listeners: new Set(),
161
+ settling: false,
162
+ createdAt: Date.now(),
163
+ retrying: false,
164
+ completion,
165
+ complete,
166
+ automatic: action === undefined,
167
+ };
168
+ if (!this.scheduler.schedule(job.status.id, async (wasQueued) => {
169
+ try {
170
+ await this.execute(job, wasQueued);
171
+ }
172
+ finally {
173
+ job.complete();
174
+ }
175
+ }, JSON.stringify([resolved.checkoutRoot, resolved.backendName]), beforeAdmission)) {
176
+ return { state: 'busy', instructions: 'Preparation queue is full; submit a new request later.' };
177
+ }
178
+ if (replacement)
179
+ this.removeRecord(replacement);
180
+ this.jobs.set(job.status.id, job);
181
+ this.identities.set(key, job.status.id);
182
+ return { state: 'job', status: this.snapshot(job) };
183
+ }
184
+ /** Never receives an operation callback, so pending calls cannot be queued or replayed. */
185
+ async admit(target, operation, policy, preferences, options = {}) {
186
+ if (this.shuttingDown)
187
+ return this.shutdownResult();
188
+ const resolved = Object.freeze(PreparationTargetSchema.parse(target));
189
+ const authority = BackendPolicySchema.parse(policy);
190
+ const waitMs = PreparationOptionsSchema.shape.requestWaitMs.parse(options.waitMs ?? this.options.requestWaitMs);
191
+ const expiresAt = Date.now() + waitMs;
192
+ const remaining = () => Math.max(0, expiresAt - Date.now());
193
+ const active = this.activeJob(resolved, authority, undefined, operation);
194
+ let result;
195
+ if (active) {
196
+ result = { state: 'job', status: this.snapshot(active) };
197
+ }
198
+ else {
199
+ const adapter = this.registry.get(resolved.backendName);
200
+ if (!adapter)
201
+ return this.unsupported(resolved.backendName);
202
+ const readiness = await this.probe(adapter, resolved, operation, remaining(), options.signal);
203
+ const joined = this.activeJob(resolved, authority, undefined, operation);
204
+ if (joined)
205
+ result = { state: 'job', status: this.snapshot(joined) };
206
+ else {
207
+ if (readiness.state === 'ready') {
208
+ this.clearResolvedFailure(resolved, operation, authority, readiness);
209
+ return { state: 'ready', readiness };
210
+ }
211
+ if (readiness.state === 'unsupported')
212
+ return readiness;
213
+ if (readiness.state === 'conflict')
214
+ return readiness;
215
+ if (readiness.state === 'unknown')
216
+ return readiness;
217
+ if (!preferences[resolved.backendName]?.enabled)
218
+ return { state: 'disabled', instructions: readiness.instructions };
219
+ result = await this.prepareInspected(resolved, operation, authority, adapter, readiness, undefined, undefined, options.beforeAdmission, options.validateAdmission);
220
+ }
221
+ }
222
+ if (result.state !== 'job')
223
+ return result;
224
+ if (result.status.state === 'failed')
225
+ return result;
226
+ if (result.status.state === 'not_ready')
227
+ return result;
228
+ if (result.status.state === 'cancelled')
229
+ return result;
230
+ return this.pending(result.status, `Preparation ${result.status.id} is ${result.status.state}. Check status or wait, then submit the original operation again.`);
231
+ }
232
+ pending(status, instructions) {
233
+ return {
234
+ state: 'pending',
235
+ status,
236
+ operationExecuted: false,
237
+ operationQueued: false,
238
+ instructions: `${instructions} The original operation has not executed and will not be replayed.`,
239
+ };
240
+ }
241
+ /** All admitted jobs, including automatic jobs with no public control handle. */
242
+ activeStatuses() {
243
+ return [...this.jobs.values()]
244
+ .filter((job) => ['queued', 'running', 'cancelling'].includes(job.status.state))
245
+ .map((job) => this.snapshot(job));
246
+ }
247
+ status(id) {
248
+ const job = this.jobs.get(id);
249
+ return job ? this.snapshot(job) : undefined;
250
+ }
251
+ async wait(id, options = {}) {
252
+ const job = this.jobs.get(id);
253
+ if (!job)
254
+ return undefined;
255
+ const waitMs = PreparationOptionsSchema.shape.requestWaitMs.parse(options.waitMs ?? this.options.requestWaitMs);
256
+ if (this.terminal(job))
257
+ return this.snapshot(job);
258
+ if (options.signal?.aborted)
259
+ return this.snapshot(job);
260
+ if (job.listeners.size >= 1024)
261
+ return this.snapshot(job);
262
+ await new Promise((resolve) => {
263
+ const finish = () => {
264
+ clearTimeout(timer);
265
+ job.listeners.delete(changed);
266
+ options.signal?.removeEventListener('abort', finish);
267
+ resolve();
268
+ };
269
+ const changed = () => {
270
+ if (this.terminal(job))
271
+ finish();
272
+ };
273
+ const timer = setTimeout(finish, waitMs);
274
+ job.listeners.add(changed);
275
+ options.signal?.addEventListener('abort', finish, { once: true });
276
+ });
277
+ return this.snapshot(job);
278
+ }
279
+ cancel(id) {
280
+ const job = this.jobs.get(id);
281
+ if (!job)
282
+ return undefined;
283
+ if (this.terminal(job))
284
+ return this.snapshot(job);
285
+ if (this.scheduler.cancelQueued(id)) {
286
+ this.update(job, { state: 'cancelled' });
287
+ job.complete();
288
+ return this.snapshot(job);
289
+ }
290
+ this.update(job, { state: 'cancelling' });
291
+ job.controller.abort();
292
+ return this.snapshot(job);
293
+ }
294
+ /** Explicit retry creates a new compatible identity when the execution budget changes. */
295
+ async retry(id, policy, options = {}) {
296
+ const job = this.jobs.get(id);
297
+ if (!job)
298
+ return { state: 'unsupported', instructions: 'Unknown preparation operation.' };
299
+ if (this.shuttingDown)
300
+ return this.shutdownResult();
301
+ if (job.retrying)
302
+ return { state: 'busy', instructions: 'Explicit retry inspection is already in progress.' };
303
+ if (job.settling)
304
+ return { state: 'busy', instructions: 'Owned preparation work has not stopped yet.' };
305
+ if (!this.terminal(job))
306
+ return { state: 'job', status: this.snapshot(job) };
307
+ const authority = BackendPolicySchema.parse(policy ?? job.policy);
308
+ const deadline = authority.executionDeadlineMs ?? this.options.executionDeadlineMs;
309
+ if (job.status.failure?.code === 'execution_deadline') {
310
+ if (deadline <= job.status.executionDeadlineMs)
311
+ return {
312
+ state: 'forbidden',
313
+ instructions: 'Execution deadline exhausted; explicitly select a larger execution budget before retrying.',
314
+ };
315
+ }
316
+ job.retrying = true;
317
+ try {
318
+ const waitMs = PreparationOptionsSchema.shape.requestWaitMs.parse(options.waitMs ?? this.options.requestWaitMs);
319
+ const readiness = await this.probe(job.adapter, job.status.target, job.status.operation, waitMs, options.signal);
320
+ if (readiness.state === 'required' && readiness.action !== job.status.action) {
321
+ if (!authority.allowedActions.includes(readiness.action))
322
+ return { state: 'forbidden', instructions: `Runtime policy does not permit ${readiness.action}.` };
323
+ const destination = this.findJob(`${preparationKey(job.status.target, authority, this.options, job.status.operation)}:${readiness.action}`);
324
+ if (destination && destination.status.state !== 'ready')
325
+ return {
326
+ state: 'busy',
327
+ instructions: `Retry of ${job.status.id} did not start: ${destination.status.id} already owns ${readiness.action}. Both records are preserved.`,
328
+ };
329
+ // A further required action is a separate job, explicitly admitted by retry.
330
+ // Preserve the previous action's terminal record rather than rewriting history.
331
+ return await this.prepareInspected(job.status.target, job.status.operation, authority, job.adapter, readiness, readiness.action, undefined, options.beforeAdmission, options.validateAdmission);
332
+ }
333
+ if (!authority.allowedActions.includes(job.status.action))
334
+ return { state: 'forbidden', instructions: `Runtime policy does not permit ${job.status.action}.` };
335
+ return await this.prepareInspected(job.status.target, job.status.operation, authority, job.adapter, readiness, job.status.action, job, options.beforeAdmission, options.validateAdmission);
336
+ }
337
+ finally {
338
+ job.retrying = false;
339
+ }
340
+ }
341
+ /** Stop admission and wait for actual owned work settlement, including expired jobs. */
342
+ async shutdown() {
343
+ this.shuttingDown = true;
344
+ const completions = [];
345
+ for (const job of this.jobs.values()) {
346
+ if (job.settling)
347
+ job.controller.abort();
348
+ if (!this.terminal(job))
349
+ this.cancel(job.status.id);
350
+ completions.push(job.completion);
351
+ }
352
+ await Promise.all(completions);
353
+ }
354
+ /** Only restores a validated stable failure; it confers no process ownership or repair authority. */
355
+ importFailure(target, operation, policy, action, failure, state = 'failed') {
356
+ if (this.shuttingDown)
357
+ return undefined;
358
+ const resolved = Object.freeze(PreparationTargetSchema.parse(target));
359
+ const authority = BackendPolicySchema.parse(policy);
360
+ const diagnostic = PreparationFailureSchema.parse(failure);
361
+ if (!operation)
362
+ throw new Error('Preparation operation is required');
363
+ if (!authority.allowedActions.includes(action))
364
+ return undefined;
365
+ const adapter = this.registry.get(resolved.backendName);
366
+ if (!adapter)
367
+ return undefined;
368
+ const key = `${preparationKey(resolved, authority, this.options, operation)}:${action}`;
369
+ if (this.findJob(key))
370
+ return undefined;
371
+ if (this.activeJob(resolved, authority, undefined, operation))
372
+ return undefined;
373
+ this.releaseCompletedRecords();
374
+ if (this.jobs.size >= this.options.maxRecords)
375
+ return undefined;
376
+ const job = {
377
+ status: {
378
+ id: `preparation-${++this.sequence}`,
379
+ target: resolved,
380
+ operation,
381
+ action,
382
+ state,
383
+ attempt: 1,
384
+ executionDeadlineMs: authority.executionDeadlineMs ?? this.options.executionDeadlineMs,
385
+ failure: diagnostic,
386
+ },
387
+ adapter,
388
+ policy: authority,
389
+ controller: new AbortController(),
390
+ listeners: new Set(),
391
+ settling: false,
392
+ createdAt: Date.now(),
393
+ finishedAt: Date.now(),
394
+ retrying: false,
395
+ completion: Promise.resolve(),
396
+ complete: () => { },
397
+ automatic: false,
398
+ };
399
+ this.jobs.set(job.status.id, job);
400
+ this.identities.set(key, job.status.id);
401
+ return this.snapshot(job);
402
+ }
403
+ /** Caller supplies fresh native evidence; advisory state alone cannot resolve a failure. */
404
+ clearResolvedFailure(target, operation, policy, readiness) {
405
+ const resolved = PreparationTargetSchema.parse(target);
406
+ const authority = BackendPolicySchema.parse(policy);
407
+ BackendReadyReadinessSchema.parse(readiness);
408
+ const base = preparationKey(resolved, authority, this.options, operation);
409
+ let cleared = 0;
410
+ for (const action of authority.allowedActions) {
411
+ const job = this.findJob(`${base}:${action}`);
412
+ if (!job)
413
+ continue;
414
+ if (job.status.state !== 'failed' && job.status.state !== 'not_ready')
415
+ continue;
416
+ if (job.status.operation !== operation)
417
+ continue;
418
+ if (job.settling)
419
+ continue;
420
+ if (job.retrying)
421
+ continue;
422
+ this.removeRecord(job);
423
+ cleared++;
424
+ }
425
+ return cleared;
426
+ }
427
+ removeRecord(job) {
428
+ this.jobs.delete(job.status.id);
429
+ for (const [key, id] of this.identities) {
430
+ if (id === job.status.id)
431
+ this.identities.delete(key);
432
+ }
433
+ }
434
+ shutdownResult() {
435
+ return { state: 'busy', instructions: 'Preparation runtime is shutting down; no new work can start.' };
436
+ }
437
+ async execute(job, wasQueued) {
438
+ if (job.controller.signal.aborted) {
439
+ this.update(job, { state: 'cancelled' });
440
+ return;
441
+ }
442
+ job.settling = true;
443
+ this.update(job, { state: 'running' });
444
+ const expiresAt = Date.now() + job.status.executionDeadlineMs;
445
+ const deadline = setTimeout(() => {
446
+ if (job.status.state === 'cancelling')
447
+ return;
448
+ this.update(job, {
449
+ state: 'failed',
450
+ failure: {
451
+ code: 'execution_deadline',
452
+ message: 'Preparation execution deadline exhausted.',
453
+ retryable: false,
454
+ instructions: 'Wait for owned work to stop, then explicitly retry with a larger execution budget.',
455
+ },
456
+ });
457
+ job.controller.abort();
458
+ }, job.status.executionDeadlineMs);
459
+ try {
460
+ if (wasQueued) {
461
+ if (job.automatic) {
462
+ if (!(await this.reconcileQueuedReadiness(job, expiresAt)))
463
+ return;
464
+ }
465
+ }
466
+ await this.runAttempts(job);
467
+ if (job.controller.signal.aborted) {
468
+ if (job.status.state !== 'failed')
469
+ this.update(job, { state: 'cancelled' });
470
+ return;
471
+ }
472
+ const readiness = await this.probe(job.adapter, job.status.target, job.status.operation, Math.max(0, expiresAt - Date.now()), job.controller.signal);
473
+ if (job.controller.signal.aborted) {
474
+ if (job.status.state !== 'failed')
475
+ this.update(job, { state: 'cancelled' });
476
+ return;
477
+ }
478
+ if (readiness.state !== 'ready') {
479
+ this.update(job, {
480
+ state: 'not_ready',
481
+ readiness,
482
+ failure: {
483
+ code: readiness.state === 'required' ? 'further_action_required' : 'not_ready',
484
+ message: 'Preparation completed without verified readiness.',
485
+ retryable: false,
486
+ instructions: readiness.instructions,
487
+ },
488
+ });
489
+ return;
490
+ }
491
+ this.update(job, { state: 'ready', readiness });
492
+ }
493
+ catch (error) {
494
+ if (job.status.state === 'failed')
495
+ return;
496
+ if (job.controller.signal.aborted) {
497
+ this.update(job, { state: 'cancelled' });
498
+ return;
499
+ }
500
+ this.update(job, { state: 'failed', failure: job.adapter.classifyFailure(error) });
501
+ }
502
+ finally {
503
+ clearTimeout(deadline);
504
+ job.settling = false;
505
+ }
506
+ }
507
+ async reconcileQueuedReadiness(job, expiresAt) {
508
+ const readiness = await this.probe(job.adapter, job.status.target, job.status.operation, Math.max(0, expiresAt - Date.now()), job.controller.signal);
509
+ if (job.controller.signal.aborted) {
510
+ if (job.status.state !== 'failed')
511
+ this.update(job, { state: 'cancelled' });
512
+ return false;
513
+ }
514
+ if (readiness.state === 'ready') {
515
+ this.update(job, { state: 'ready', readiness });
516
+ return false;
517
+ }
518
+ if (readiness.state !== 'required') {
519
+ this.update(job, {
520
+ state: 'failed',
521
+ readiness,
522
+ failure: {
523
+ code: 'not_ready',
524
+ message: 'Queued preparation could not verify native readiness.',
525
+ retryable: false,
526
+ instructions: readiness.instructions,
527
+ },
528
+ });
529
+ return false;
530
+ }
531
+ if (!job.policy.allowedActions.includes(readiness.action)) {
532
+ this.update(job, {
533
+ state: 'failed',
534
+ readiness,
535
+ failure: {
536
+ code: 'action_forbidden',
537
+ message: `Runtime policy does not permit ${readiness.action}.`,
538
+ retryable: false,
539
+ instructions: readiness.instructions,
540
+ },
541
+ });
542
+ return false;
543
+ }
544
+ this.moveActionIdentity(job, readiness.action);
545
+ this.update(job, { action: readiness.action, readiness });
546
+ return true;
547
+ }
548
+ moveActionIdentity(job, action) {
549
+ const base = preparationKey(job.status.target, job.policy, this.options, job.status.operation);
550
+ const destinationKey = `${base}:${action}`;
551
+ const destination = this.findJob(destinationKey);
552
+ if (destination === job)
553
+ return;
554
+ if (destination) {
555
+ // Keep the inferred job's original reservation when another explicit job owns this action.
556
+ if (destination.status.state !== 'ready')
557
+ return;
558
+ }
559
+ const oldKey = `${base}:${job.status.action}`;
560
+ if (this.identities.get(oldKey) === job.status.id)
561
+ this.identities.delete(oldKey);
562
+ this.identities.set(destinationKey, job.status.id);
563
+ }
564
+ async runAttempts(job) {
565
+ const retryLimit = job.policy.transientRetryLimit ?? 0;
566
+ for (let retry = 0;; retry++) {
567
+ try {
568
+ await job.adapter.prepare(job.status.target, job.status.action, {
569
+ signal: job.controller.signal,
570
+ executionDeadlineMs: job.status.executionDeadlineMs,
571
+ operation: job.status.operation,
572
+ });
573
+ return;
574
+ }
575
+ catch (error) {
576
+ if (job.controller.signal.aborted)
577
+ throw error;
578
+ const failure = job.adapter.classifyFailure(error);
579
+ if (!failure.retryable)
580
+ throw error;
581
+ if (retry >= retryLimit)
582
+ throw error;
583
+ this.update(job, { attempt: job.status.attempt + 1 });
584
+ }
585
+ }
586
+ }
587
+ releaseCompletedRecords() {
588
+ if (this.jobs.size < this.options.maxRecords)
589
+ return;
590
+ for (const [id, job] of this.jobs) {
591
+ if (job.settling)
592
+ continue;
593
+ if (job.retrying)
594
+ continue;
595
+ if (job.status.state !== 'ready' && job.status.state !== 'cancelled')
596
+ continue;
597
+ this.jobs.delete(id);
598
+ for (const [key, mappedId] of this.identities) {
599
+ if (mappedId === id)
600
+ this.identities.delete(key);
601
+ }
602
+ return;
603
+ }
604
+ }
605
+ failedJob(target, policy, operation) {
606
+ const base = preparationKey(target, policy, this.options, operation);
607
+ for (const action of policy.allowedActions) {
608
+ const job = this.findJob(`${base}:${action}`);
609
+ if (job?.status.state === 'failed' || job?.status.state === 'not_ready')
610
+ return job;
611
+ }
612
+ return undefined;
613
+ }
614
+ activeJob(target, policy, action, operation) {
615
+ const base = preparationKey(target, policy, this.options, operation);
616
+ const actions = action ? [action] : policy.allowedActions;
617
+ for (const selected of actions) {
618
+ const job = this.findJob(`${base}:${selected}`);
619
+ if (action) {
620
+ if (job?.status.action !== action)
621
+ continue;
622
+ }
623
+ if (job && !this.terminal(job))
624
+ return job;
625
+ if (job?.settling)
626
+ return job;
627
+ }
628
+ return undefined;
629
+ }
630
+ async probe(adapter, target, operation, waitMs, signal) {
631
+ return this.readReadiness((signal) => adapter.inspect(target, operation, { signal, waitMs }), (error) => adapter.classifyFailure(error), waitMs, signal);
632
+ }
633
+ async readReadiness(inspect, classifyFailure, waitMs, signal) {
634
+ const controller = new AbortController();
635
+ return new Promise((resolve) => {
636
+ let settled = false;
637
+ const finish = (readiness) => {
638
+ if (settled)
639
+ return;
640
+ settled = true;
641
+ clearTimeout(timer);
642
+ signal?.removeEventListener('abort', stop);
643
+ resolve(readiness);
644
+ };
645
+ const stop = () => {
646
+ controller.abort();
647
+ finish({
648
+ state: 'unknown',
649
+ reason: signal?.aborted ? 'caller_disconnected' : 'inspection_timeout',
650
+ instructions: 'Readiness inspection did not complete within the caller budget; no backend operation executed. Inspect again before preparing.',
651
+ });
652
+ };
653
+ const timer = setTimeout(stop, waitMs);
654
+ if (signal?.aborted) {
655
+ stop();
656
+ return;
657
+ }
658
+ if (waitMs === 0) {
659
+ stop();
660
+ return;
661
+ }
662
+ signal?.addEventListener('abort', stop, { once: true });
663
+ const failed = (error) => {
664
+ if (settled)
665
+ return;
666
+ try {
667
+ const failure = classifyFailure(error);
668
+ finish({ state: 'conflict', instructions: failure.instructions });
669
+ }
670
+ catch {
671
+ finish({
672
+ state: 'unsupported',
673
+ instructions: 'The readiness adapter failed and could not classify the failure. Check adapter configuration and native prerequisites; no backend operation executed.',
674
+ });
675
+ }
676
+ };
677
+ try {
678
+ void inspect(controller.signal).then(finish, failed);
679
+ }
680
+ catch (error) {
681
+ failed(error);
682
+ }
683
+ });
684
+ }
685
+ findJob(key) {
686
+ const id = this.identities.get(key);
687
+ return id ? this.jobs.get(id) : undefined;
688
+ }
689
+ snapshot(job) {
690
+ return structuredClone({ ...job.status, elapsedMs: Math.max(0, (job.finishedAt ?? Date.now()) - job.createdAt) });
691
+ }
692
+ update(job, fields) {
693
+ job.status = { ...job.status, ...fields };
694
+ if (this.terminal(job))
695
+ job.finishedAt ??= Date.now();
696
+ for (const listener of job.listeners)
697
+ listener();
698
+ }
699
+ terminal(job) {
700
+ return ['ready', 'not_ready', 'failed', 'cancelled'].includes(job.status.state);
701
+ }
702
+ unsupported(backendName) {
703
+ return {
704
+ state: 'unsupported',
705
+ instructions: `No preparation adapter is registered for ${backendName}; prepare it using supported native instructions.`,
706
+ };
707
+ }
708
+ }
709
+ //# sourceMappingURL=service.js.map