@frontmcp/sdk 1.13.1 → 1.14.0-rc.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 (634) hide show
  1. package/agent/agent.instance.d.ts +4 -0
  2. package/agent/agent.instance.d.ts.map +1 -1
  3. package/agent/agent.scope.d.ts +3 -0
  4. package/agent/agent.scope.d.ts.map +1 -1
  5. package/agent/flows/call-agent.flow.d.ts.map +1 -1
  6. package/app/instances/app.local.instance.d.ts.map +1 -1
  7. package/app/lazy/lazy-placeholders.d.ts +6 -9
  8. package/app/lazy/lazy-placeholders.d.ts.map +1 -1
  9. package/auth/auth-ui/auth-ui.contract.d.ts +4 -1
  10. package/auth/auth-ui/auth-ui.contract.d.ts.map +1 -1
  11. package/auth/auth-ui/auth-ui.render.d.ts +5 -2
  12. package/auth/auth-ui/auth-ui.render.d.ts.map +1 -1
  13. package/auth/auth-ui/index.d.ts +1 -1
  14. package/auth/auth-ui/index.d.ts.map +1 -1
  15. package/auth/authorized-apps.utils.d.ts +2 -0
  16. package/auth/authorized-apps.utils.d.ts.map +1 -1
  17. package/auth/client-display-name.d.ts +52 -0
  18. package/auth/client-display-name.d.ts.map +1 -0
  19. package/auth/federated-steps.d.ts.map +1 -1
  20. package/auth/flows/oauth.auth-ui.flow.d.ts +1 -1
  21. package/auth/flows/oauth.authorize.flow.d.ts +7 -3
  22. package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
  23. package/auth/flows/oauth.callback.flow.d.ts +3 -8
  24. package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
  25. package/auth/flows/oauth.connect.flow.d.ts +1 -1
  26. package/auth/flows/oauth.provider-callback.flow.d.ts +9 -2
  27. package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
  28. package/auth/flows/oauth.register.flow.d.ts +24 -5
  29. package/auth/flows/oauth.register.flow.d.ts.map +1 -1
  30. package/auth/flows/oauth.token.flow.d.ts +1 -1
  31. package/auth/flows/oauth.userinfo.flow.d.ts +1 -1
  32. package/auth/flows/session.verify.flow.d.ts +20 -4
  33. package/auth/flows/session.verify.flow.d.ts.map +1 -1
  34. package/auth/flows/well-known.jwks.flow.d.ts +3 -3
  35. package/auth/flows/well-known.oauth-authorization-server.flow.d.ts +2 -2
  36. package/auth/flows/well-known.prm.flow.d.ts +5 -1
  37. package/auth/flows/well-known.prm.flow.d.ts.map +1 -1
  38. package/auth/instances/instance.local-primary-auth.d.ts +12 -3
  39. package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
  40. package/auth/instances/instance.remote-primary-auth.d.ts +2 -0
  41. package/auth/instances/instance.remote-primary-auth.d.ts.map +1 -1
  42. package/auth/session/session-store.factory.d.ts.map +1 -1
  43. package/browser/agent/agent.instance.mjs +16 -0
  44. package/browser/agent/agent.scope.mjs +9 -0
  45. package/browser/agent/flows/call-agent.flow.mjs +3 -1
  46. package/browser/app/instances/app.local.instance.mjs +6 -1
  47. package/browser/app/lazy/lazy-placeholders.mjs +3 -3
  48. package/browser/auth/auth-ui/auth-ui.render.mjs +9 -8
  49. package/browser/auth/auth-ui/index.mjs +4 -2
  50. package/browser/auth/authorized-apps.utils.mjs +15 -0
  51. package/browser/auth/client-display-name.mjs +62 -0
  52. package/browser/auth/federated-steps.mjs +3 -1
  53. package/browser/auth/flows/oauth.authorize.flow.mjs +39 -17
  54. package/browser/auth/flows/oauth.callback.flow.mjs +39 -34
  55. package/browser/auth/flows/oauth.connect.flow.mjs +1 -1
  56. package/browser/auth/flows/oauth.provider-callback.flow.mjs +84 -15
  57. package/browser/auth/flows/oauth.register.flow.mjs +9 -24
  58. package/browser/auth/flows/session.verify.flow.mjs +31 -12
  59. package/browser/auth/flows/well-known.prm.flow.mjs +22 -3
  60. package/browser/auth/instances/instance.local-primary-auth.mjs +63 -19
  61. package/browser/auth/instances/instance.remote-primary-auth.mjs +20 -0
  62. package/browser/auth/session/session-store.factory.mjs +15 -36
  63. package/browser/builtin/authorities/authorities-input.mjs +12 -0
  64. package/browser/common/decorators/front-mcp.decorator.mjs +2 -1
  65. package/browser/common/decorators/http-route.decorator.mjs +13 -1
  66. package/browser/common/index.mjs +3 -3
  67. package/browser/common/interfaces/server.interface.mjs +4 -0
  68. package/browser/common/metadata/duty.metadata.mjs +29 -6
  69. package/browser/common/metadata/event.metadata.mjs +2 -1
  70. package/browser/common/metadata/front-mcp.metadata.mjs +18 -1
  71. package/browser/common/metadata/index.mjs +1 -1
  72. package/browser/common/metadata/materialized.metadata.mjs +13 -0
  73. package/browser/common/metadata/resource.metadata.mjs +6 -5
  74. package/browser/common/metadata/workflow.metadata.mjs +1 -0
  75. package/browser/common/tokens/front-mcp.tokens.mjs +3 -0
  76. package/browser/common/tokens/resource.tokens.mjs +1 -0
  77. package/browser/common/tokens/workflow.tokens.mjs +1 -0
  78. package/browser/common/types/auth/session.types.mjs +2 -0
  79. package/browser/common/types/index.mjs +1 -1
  80. package/browser/common/types/options/http/schema.mjs +26 -2
  81. package/browser/common/types/options/index.mjs +1 -1
  82. package/browser/common/types/options/redis/connection.mjs +19 -0
  83. package/browser/common/types/options/redis/index.mjs +12 -0
  84. package/browser/common/types/options/redis/schema.mjs +145 -12
  85. package/browser/common/types/options/skills-http/schema.mjs +18 -0
  86. package/browser/common/types/options/transport/schema.mjs +21 -1
  87. package/browser/common/utils/auth-info.utils.mjs +17 -3
  88. package/browser/common/utils/guard.utils.mjs +3 -2
  89. package/browser/common/utils/index.mjs +2 -1
  90. package/browser/completion/flows/complete.flow.mjs +13 -7
  91. package/browser/direct/direct-server.mjs +15 -11
  92. package/browser/duty/duty.lifecycle.mjs +32 -5
  93. package/browser/duty/duty.runner.mjs +3 -1
  94. package/browser/duty/lease-holder.mjs +50 -3
  95. package/browser/duty/lease-store.mjs +9 -6
  96. package/browser/elicitation/flows/elicitation-request.flow.mjs +7 -1
  97. package/browser/elicitation/flows/elicitation-result.flow.mjs +8 -2
  98. package/browser/elicitation/questions/question-store.factory.mjs +2 -5
  99. package/browser/elicitation/store/elicitation-store.factory.mjs +11 -4
  100. package/browser/errors/browser-entry-point.errors.mjs +1 -0
  101. package/browser/errors/duty.errors.mjs +9 -0
  102. package/browser/errors/index.mjs +14 -2
  103. package/browser/errors/job.errors.mjs +29 -4
  104. package/browser/errors/mcp.error.mjs +61 -8
  105. package/browser/errors/provider.errors.mjs +18 -0
  106. package/browser/errors/transport.errors.mjs +38 -1
  107. package/browser/event/delivery/event-outbox.mjs +43 -9
  108. package/browser/event/event-gates.mjs +6 -2
  109. package/browser/event/event-scope.helper.mjs +8 -2
  110. package/browser/event/event-subscription-info.mjs +55 -0
  111. package/browser/event/event.registry.mjs +18 -0
  112. package/browser/event/flows/event-ended.flow.mjs +95 -0
  113. package/browser/event/flows/event-poll.flow.mjs +3 -1
  114. package/browser/event/flows/event-publish.flow.mjs +1 -0
  115. package/browser/event/flows/event-subscribe.flow.mjs +2 -9
  116. package/browser/event/flows/event-unsubscribe.flow.mjs +10 -1
  117. package/browser/event/poll/event-poll-leases.mjs +15 -3
  118. package/browser/event/replay/event-replays.mjs +2 -0
  119. package/browser/event/stream/event-stream.mjs +8 -0
  120. package/browser/event/stream/event-streams.mjs +22 -6
  121. package/browser/event/subscription/event-subscription-store.factory.mjs +3 -4
  122. package/browser/event/subscription/event-subscription-termination.mjs +2 -0
  123. package/browser/event/subscription/event-subscription.store.mjs +11 -1
  124. package/browser/event/subscription/event-subscriptions.mjs +21 -2
  125. package/browser/front-mcp/front-mcp.mjs +51 -4
  126. package/browser/ha/ha-manager.mjs +2 -1
  127. package/browser/ha/ha-redis-client.mjs +22 -0
  128. package/browser/ha/heartbeat.service.mjs +2 -1
  129. package/browser/ha/index.mjs +2 -0
  130. package/browser/ha/notification-relay.mjs +11 -3
  131. package/browser/http-route/flows/http.route.flow.mjs +148 -14
  132. package/browser/http-route/http-route.table.mjs +94 -21
  133. package/browser/http-route/people-session-store.mjs +48 -0
  134. package/browser/http-route/people-sign-in.routes.mjs +47 -5
  135. package/browser/http-route/sse-route.stream.mjs +19 -8
  136. package/browser/index.cjs +23016 -18521
  137. package/browser/index.mjs +32 -4
  138. package/browser/job/execution/job-execution.manager.mjs +293 -84
  139. package/browser/job/flows/execute-job.flow.mjs +6 -4
  140. package/browser/job/index.mjs +3 -1
  141. package/browser/job/job-admission.mjs +284 -2
  142. package/browser/job/job-attempt.mjs +2 -1
  143. package/browser/job/job-run-access.mjs +20 -0
  144. package/browser/job/job-scope.helper.mjs +37 -10
  145. package/browser/job/runner/detached-job.worker.mjs +71 -10
  146. package/browser/job/runner/job-runner.mjs +27 -1
  147. package/browser/job/store/job-definition-store.factory.mjs +13 -12
  148. package/browser/job/store/job-state-store.factory.mjs +14 -5
  149. package/browser/job/store/memory-job-state.store.mjs +91 -7
  150. package/browser/job/store/redis-job-state.store.mjs +39 -6
  151. package/browser/job/store/storage-job-state.store.mjs +35 -2
  152. package/browser/job/tools/cancel-job.tool.mjs +2 -2
  153. package/browser/job/tools/register-job.tool.mjs +5 -2
  154. package/browser/job/tools/remove-job.tool.mjs +9 -0
  155. package/browser/job/tools/update-job.tool.mjs +8 -0
  156. package/browser/notification/notification.service.mjs +22 -4
  157. package/browser/prompt/flows/get-prompt.flow.mjs +10 -3
  158. package/browser/prompt/flows/prompts-list.flow.mjs +7 -2
  159. package/browser/provider/borrow-providers.mjs +40 -0
  160. package/browser/provider/container-handle.mjs +10 -0
  161. package/browser/provider/create-container.mjs +25 -3
  162. package/browser/provider/provider.registry.mjs +43 -6
  163. package/browser/remote-mcp/remote-oauth.mjs +43 -13
  164. package/browser/resource/flows/read-resource.flow.mjs +15 -4
  165. package/browser/resource/flows/resource-templates-list.flow.mjs +7 -2
  166. package/browser/resource/flows/resources-list.flow.mjs +7 -2
  167. package/browser/resource/flows/subscribe-resource.flow.mjs +21 -5
  168. package/browser/resource/materialized/materialized-resource.context.mjs +3 -1
  169. package/browser/resource/materialized/materialized-resources.mjs +85 -29
  170. package/browser/resource/materialized/resource-store.mjs +352 -29
  171. package/browser/resource/resource.events.mjs +12 -1
  172. package/browser/resource/resource.registry.mjs +92 -3
  173. package/browser/scope/flows/http.request.flow.mjs +52 -3
  174. package/browser/scope/http-scope.helper.mjs +2 -1
  175. package/browser/scope/scope.instance.mjs +14 -16
  176. package/browser/server/custom-routes.helper.mjs +57 -6
  177. package/browser/server/security/host-validation.mjs +4 -1
  178. package/browser/server/security/resolve-allowed-hosts.mjs +26 -2
  179. package/browser/server/security/same-origin.mjs +5 -5
  180. package/browser/server/server.instance.mjs +77 -6
  181. package/browser/skill/cache/skill-http-cache.catalog.mjs +7 -6
  182. package/browser/skill/cache/skill-http-cache.factory.mjs +16 -19
  183. package/browser/skill/cache/skill-http-cache.mjs +14 -4
  184. package/browser/skill/flows/http/llm-full-txt.flow.mjs +16 -5
  185. package/browser/skill/flows/http/llm-txt.flow.mjs +1 -0
  186. package/browser/skill/flows/http/skills-api.flow.mjs +6 -5
  187. package/browser/skill/flows/load-skill.flow.mjs +9 -4
  188. package/browser/skill/skill-filter.helper.mjs +41 -4
  189. package/browser/skill/skill-http.utils.mjs +8 -8
  190. package/browser/subsystems.mjs +21 -2
  191. package/browser/surface/entry-enabled.mjs +22 -6
  192. package/browser/surface/index.mjs +8 -2
  193. package/browser/surface/live-surface.mjs +63 -3
  194. package/browser/task/helpers/task-run-context.mjs +12 -0
  195. package/browser/task/helpers/task-runner.mjs +2 -0
  196. package/browser/task/store/storage-task.store.mjs +1 -4
  197. package/browser/task/store/task-store.factory.mjs +2 -3
  198. package/browser/task/task.types.mjs +2 -0
  199. package/browser/tool/flows/call-tool.flow.mjs +59 -20
  200. package/browser/tool/flows/tools-list.flow.mjs +2 -2
  201. package/browser/tool/ui/ui-shared.mjs +5 -1
  202. package/browser/tool/ui/widget-enabled.mjs +11 -0
  203. package/browser/tool/undeclared-arguments-message.mjs +16 -12
  204. package/browser/tool/undeclared-arguments.mjs +41 -1
  205. package/browser/transport/adapters/streamable-http-transport.mjs +4 -0
  206. package/browser/transport/adapters/transport.local.adapter.mjs +26 -21
  207. package/browser/transport/adapters/transport.sse.adapter.mjs +20 -4
  208. package/browser/transport/adapters/transport.streamable-http.adapter.mjs +10 -2
  209. package/browser/transport/bus/redis-transport-bus.mjs +83 -28
  210. package/browser/transport/channel-signature.mjs +40 -0
  211. package/browser/transport/event-stores/redis.event-store.mjs +14 -27
  212. package/browser/transport/flows/handle.mcp-20260728.flow.mjs +10 -4
  213. package/browser/transport/flows/handle.streamable-http.flow.mjs +17 -10
  214. package/browser/transport/mcp-20260728/client/index.mjs +1 -1
  215. package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +77 -15
  216. package/browser/transport/mcp-20260728/index.mjs +1 -1
  217. package/browser/transport/mcp-20260728/result-decorator.mjs +14 -7
  218. package/browser/transport/mcp-20260728/subscriptions.mjs +47 -7
  219. package/browser/transport/mcp-handlers/index.mjs +11 -2
  220. package/browser/transport/relay/relay-scope.helper.mjs +34 -6
  221. package/browser/transport/session-end-channel.mjs +199 -0
  222. package/browser/transport/stream-keep-alive.mjs +70 -0
  223. package/browser/transport/transport.local.mjs +3 -0
  224. package/browser/transport/transport.registry.mjs +361 -28
  225. package/browser/transport/web-fetch-handler.mjs +64 -4
  226. package/browser/transport/web-standard-mcp.mjs +3 -1
  227. package/browser/utils/same-origin-fetch.utils.mjs +33 -0
  228. package/browser/work/index.mjs +13 -0
  229. package/browser/work/work-spans.mjs +55 -0
  230. package/browser/worker/worker.lifecycle.mjs +3 -1
  231. package/browser/workflow/engine/workflow-step.executor.mjs +32 -12
  232. package/browser/workflow/engine/workflow.engine.mjs +5 -0
  233. package/browser/workflow/tools/register-workflow.tool.mjs +5 -2
  234. package/browser/workflow/tools/remove-workflow.tool.mjs +9 -0
  235. package/browser/workflow/tools/update-workflow.tool.mjs +8 -0
  236. package/builtin/authorities/authorities-input.d.ts +3 -0
  237. package/builtin/authorities/authorities-input.d.ts.map +1 -0
  238. package/common/decorators/front-mcp.decorator.d.ts.map +1 -1
  239. package/common/decorators/http-route.decorator.d.ts +2 -1
  240. package/common/decorators/http-route.decorator.d.ts.map +1 -1
  241. package/common/entries/scope.entry.d.ts +3 -0
  242. package/common/entries/scope.entry.d.ts.map +1 -1
  243. package/common/interfaces/http-route.interface.d.ts +9 -1
  244. package/common/interfaces/http-route.interface.d.ts.map +1 -1
  245. package/common/interfaces/server.interface.d.ts +2 -0
  246. package/common/interfaces/server.interface.d.ts.map +1 -1
  247. package/common/metadata/agent.metadata.d.ts +2 -2
  248. package/common/metadata/app.metadata.d.ts +508 -52
  249. package/common/metadata/app.metadata.d.ts.map +1 -1
  250. package/common/metadata/duty.metadata.d.ts +41 -11
  251. package/common/metadata/duty.metadata.d.ts.map +1 -1
  252. package/common/metadata/enabled.metadata.d.ts +32 -0
  253. package/common/metadata/enabled.metadata.d.ts.map +1 -1
  254. package/common/metadata/event.metadata.d.ts +146 -0
  255. package/common/metadata/event.metadata.d.ts.map +1 -1
  256. package/common/metadata/front-mcp.metadata.d.ts +9578 -272
  257. package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
  258. package/common/metadata/http-route.metadata.d.ts +18 -3
  259. package/common/metadata/http-route.metadata.d.ts.map +1 -1
  260. package/common/metadata/job.metadata.d.ts +1 -1
  261. package/common/metadata/materialized.metadata.d.ts +21 -0
  262. package/common/metadata/materialized.metadata.d.ts.map +1 -1
  263. package/common/metadata/output-policy.d.ts +1 -1
  264. package/common/metadata/plugin.metadata.d.ts +2 -2
  265. package/common/metadata/resource.metadata.d.ts +8 -1
  266. package/common/metadata/resource.metadata.d.ts.map +1 -1
  267. package/common/metadata/tool.metadata.d.ts +1 -1
  268. package/common/metadata/worker.metadata.d.ts +4 -4
  269. package/common/metadata/workflow.metadata.d.ts +15 -1
  270. package/common/metadata/workflow.metadata.d.ts.map +1 -1
  271. package/common/records/job.record.d.ts +6 -0
  272. package/common/records/job.record.d.ts.map +1 -1
  273. package/common/records/workflow.record.d.ts +6 -0
  274. package/common/records/workflow.record.d.ts.map +1 -1
  275. package/common/schemas/annotated-class.schema.d.ts +1 -1
  276. package/common/schemas/http-output.schema.d.ts +24 -24
  277. package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
  278. package/common/tokens/resource.tokens.d.ts +1 -0
  279. package/common/tokens/resource.tokens.d.ts.map +1 -1
  280. package/common/tokens/workflow.tokens.d.ts +1 -0
  281. package/common/tokens/workflow.tokens.d.ts.map +1 -1
  282. package/common/types/auth/session.types.d.ts +12 -1
  283. package/common/types/auth/session.types.d.ts.map +1 -1
  284. package/common/types/options/auth/index.d.ts +1 -1
  285. package/common/types/options/auth/index.d.ts.map +1 -1
  286. package/common/types/options/elicitation/schema.d.ts +137 -0
  287. package/common/types/options/elicitation/schema.d.ts.map +1 -1
  288. package/common/types/options/http/index.d.ts +1 -1
  289. package/common/types/options/http/index.d.ts.map +1 -1
  290. package/common/types/options/http/interfaces.d.ts +79 -2
  291. package/common/types/options/http/interfaces.d.ts.map +1 -1
  292. package/common/types/options/http/schema.d.ts +15 -0
  293. package/common/types/options/http/schema.d.ts.map +1 -1
  294. package/common/types/options/redis/connection.d.ts +18 -0
  295. package/common/types/options/redis/connection.d.ts.map +1 -0
  296. package/common/types/options/redis/index.d.ts +7 -3
  297. package/common/types/options/redis/index.d.ts.map +1 -1
  298. package/common/types/options/redis/interfaces.d.ts +54 -2
  299. package/common/types/options/redis/interfaces.d.ts.map +1 -1
  300. package/common/types/options/redis/schema.d.ts +412 -2
  301. package/common/types/options/redis/schema.d.ts.map +1 -1
  302. package/common/types/options/skills-http/interfaces.d.ts +7 -0
  303. package/common/types/options/skills-http/interfaces.d.ts.map +1 -1
  304. package/common/types/options/skills-http/schema.d.ts +19 -0
  305. package/common/types/options/skills-http/schema.d.ts.map +1 -1
  306. package/common/types/options/transport/index.d.ts +1 -1
  307. package/common/types/options/transport/index.d.ts.map +1 -1
  308. package/common/types/options/transport/interfaces.d.ts +56 -0
  309. package/common/types/options/transport/interfaces.d.ts.map +1 -1
  310. package/common/types/options/transport/schema.d.ts +551 -0
  311. package/common/types/options/transport/schema.d.ts.map +1 -1
  312. package/common/utils/auth-info.utils.d.ts +29 -1
  313. package/common/utils/auth-info.utils.d.ts.map +1 -1
  314. package/common/utils/guard.utils.d.ts +6 -3
  315. package/common/utils/guard.utils.d.ts.map +1 -1
  316. package/common/utils/index.d.ts +1 -0
  317. package/common/utils/index.d.ts.map +1 -1
  318. package/completion/flows/complete.flow.d.ts +5 -1
  319. package/completion/flows/complete.flow.d.ts.map +1 -1
  320. package/context/frontmcp-context.provider.d.ts +1 -1
  321. package/direct/direct-server.d.ts +4 -2
  322. package/direct/direct-server.d.ts.map +1 -1
  323. package/direct/direct.types.d.ts +7 -0
  324. package/direct/direct.types.d.ts.map +1 -1
  325. package/duty/duty.lifecycle.d.ts +1 -1
  326. package/duty/duty.lifecycle.d.ts.map +1 -1
  327. package/duty/duty.runner.d.ts +6 -1
  328. package/duty/duty.runner.d.ts.map +1 -1
  329. package/duty/lease-holder.d.ts +26 -3
  330. package/duty/lease-holder.d.ts.map +1 -1
  331. package/duty/lease-store.d.ts +2 -0
  332. package/duty/lease-store.d.ts.map +1 -1
  333. package/elicitation/elicitation.types.d.ts +2 -0
  334. package/elicitation/elicitation.types.d.ts.map +1 -1
  335. package/elicitation/flows/elicitation-request.flow.d.ts +2 -0
  336. package/elicitation/flows/elicitation-request.flow.d.ts.map +1 -1
  337. package/elicitation/flows/elicitation-result.flow.d.ts +3 -1
  338. package/elicitation/flows/elicitation-result.flow.d.ts.map +1 -1
  339. package/elicitation/questions/question-store.factory.d.ts.map +1 -1
  340. package/elicitation/store/elicitation-store.factory.d.ts.map +1 -1
  341. package/elicitation/store/elicitation.store.d.ts +2 -0
  342. package/elicitation/store/elicitation.store.d.ts.map +1 -1
  343. package/errors/browser-entry-point.errors.d.ts +1 -0
  344. package/errors/browser-entry-point.errors.d.ts.map +1 -1
  345. package/errors/duty.errors.d.ts +4 -0
  346. package/errors/duty.errors.d.ts.map +1 -1
  347. package/errors/index.d.ts +3 -3
  348. package/errors/index.d.ts.map +1 -1
  349. package/errors/job.errors.d.ts +22 -4
  350. package/errors/job.errors.d.ts.map +1 -1
  351. package/errors/mcp.error.d.ts +15 -1
  352. package/errors/mcp.error.d.ts.map +1 -1
  353. package/errors/provider.errors.d.ts +11 -0
  354. package/errors/provider.errors.d.ts.map +1 -1
  355. package/errors/transport.errors.d.ts +33 -0
  356. package/errors/transport.errors.d.ts.map +1 -1
  357. package/esm/index.mjs +59 -54
  358. package/event/delivery/event-outbox.d.ts +15 -2
  359. package/event/delivery/event-outbox.d.ts.map +1 -1
  360. package/event/event-gates.d.ts +6 -1
  361. package/event/event-gates.d.ts.map +1 -1
  362. package/event/event-scope.helper.d.ts.map +1 -1
  363. package/event/event-subscription-info.d.ts +72 -0
  364. package/event/event-subscription-info.d.ts.map +1 -0
  365. package/event/event.registry.d.ts +7 -0
  366. package/event/event.registry.d.ts.map +1 -1
  367. package/event/flows/event-ended.flow.d.ts +57 -0
  368. package/event/flows/event-ended.flow.d.ts.map +1 -0
  369. package/event/flows/event-poll.flow.d.ts.map +1 -1
  370. package/event/flows/event-publish-http.flow.d.ts +1 -1
  371. package/event/flows/event-publish.flow.d.ts.map +1 -1
  372. package/event/flows/event-subscribe.flow.d.ts.map +1 -1
  373. package/event/flows/event-unsubscribe.flow.d.ts +4 -1
  374. package/event/flows/event-unsubscribe.flow.d.ts.map +1 -1
  375. package/event/index.d.ts +4 -2
  376. package/event/index.d.ts.map +1 -1
  377. package/event/poll/event-poll-leases.d.ts +7 -2
  378. package/event/poll/event-poll-leases.d.ts.map +1 -1
  379. package/event/replay/event-replays.d.ts.map +1 -1
  380. package/event/stream/event-stream.d.ts +4 -0
  381. package/event/stream/event-stream.d.ts.map +1 -1
  382. package/event/stream/event-streams.d.ts +8 -2
  383. package/event/stream/event-streams.d.ts.map +1 -1
  384. package/event/subscription/event-subscription-store.factory.d.ts.map +1 -1
  385. package/event/subscription/event-subscription-termination.d.ts +4 -1
  386. package/event/subscription/event-subscription-termination.d.ts.map +1 -1
  387. package/event/subscription/event-subscription.store.d.ts +6 -0
  388. package/event/subscription/event-subscription.store.d.ts.map +1 -1
  389. package/event/subscription/event-subscriptions.d.ts +21 -3
  390. package/event/subscription/event-subscriptions.d.ts.map +1 -1
  391. package/front-mcp/front-mcp.d.ts +7 -2
  392. package/front-mcp/front-mcp.d.ts.map +1 -1
  393. package/ha/ha-manager.d.ts.map +1 -1
  394. package/ha/ha-redis-client.d.ts +16 -0
  395. package/ha/ha-redis-client.d.ts.map +1 -0
  396. package/ha/heartbeat.service.d.ts +4 -2
  397. package/ha/heartbeat.service.d.ts.map +1 -1
  398. package/ha/index.d.ts +2 -1
  399. package/ha/index.d.ts.map +1 -1
  400. package/ha/notification-relay.d.ts +8 -3
  401. package/ha/notification-relay.d.ts.map +1 -1
  402. package/ha/relay-messages.d.ts +23 -4
  403. package/ha/relay-messages.d.ts.map +1 -1
  404. package/http-route/flows/http.route.flow.d.ts +23 -4
  405. package/http-route/flows/http.route.flow.d.ts.map +1 -1
  406. package/http-route/http-route.table.d.ts +15 -4
  407. package/http-route/http-route.table.d.ts.map +1 -1
  408. package/http-route/people-session-store.d.ts +26 -0
  409. package/http-route/people-session-store.d.ts.map +1 -0
  410. package/http-route/people-sign-in.routes.d.ts +12 -2
  411. package/http-route/people-sign-in.routes.d.ts.map +1 -1
  412. package/http-route/sse-route.stream.d.ts +6 -1
  413. package/http-route/sse-route.stream.d.ts.map +1 -1
  414. package/index.d.ts +25 -16
  415. package/index.d.ts.map +1 -1
  416. package/index.js +65 -60
  417. package/job/execution/job-execution.manager.d.ts +73 -7
  418. package/job/execution/job-execution.manager.d.ts.map +1 -1
  419. package/job/flows/execute-job.flow.d.ts.map +1 -1
  420. package/job/index.d.ts +2 -2
  421. package/job/index.d.ts.map +1 -1
  422. package/job/job-admission.d.ts +81 -2
  423. package/job/job-admission.d.ts.map +1 -1
  424. package/job/job-attempt.d.ts +2 -2
  425. package/job/job-attempt.d.ts.map +1 -1
  426. package/job/job-run-access.d.ts +14 -0
  427. package/job/job-run-access.d.ts.map +1 -1
  428. package/job/job-scope.helper.d.ts +20 -0
  429. package/job/job-scope.helper.d.ts.map +1 -1
  430. package/job/runner/detached-job.worker.d.ts +9 -0
  431. package/job/runner/detached-job.worker.d.ts.map +1 -1
  432. package/job/runner/job-runner.d.ts +18 -0
  433. package/job/runner/job-runner.d.ts.map +1 -1
  434. package/job/store/job-definition-store.factory.d.ts +5 -1
  435. package/job/store/job-definition-store.factory.d.ts.map +1 -1
  436. package/job/store/job-state-store.factory.d.ts +5 -1
  437. package/job/store/job-state-store.factory.d.ts.map +1 -1
  438. package/job/store/job-state.interface.d.ts +16 -0
  439. package/job/store/job-state.interface.d.ts.map +1 -1
  440. package/job/store/memory-job-state.store.d.ts +33 -2
  441. package/job/store/memory-job-state.store.d.ts.map +1 -1
  442. package/job/store/redis-job-state.store.d.ts +13 -3
  443. package/job/store/redis-job-state.store.d.ts.map +1 -1
  444. package/job/store/storage-job-state.store.d.ts +4 -0
  445. package/job/store/storage-job-state.store.d.ts.map +1 -1
  446. package/job/tools/cancel-job.tool.d.ts.map +1 -1
  447. package/job/tools/register-job.tool.d.ts.map +1 -1
  448. package/job/tools/remove-job.tool.d.ts.map +1 -1
  449. package/job/tools/update-job.tool.d.ts.map +1 -1
  450. package/mcp-registry/flows/server-card.flow.d.ts +3 -3
  451. package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts +2 -2
  452. package/mcp-registry/flows/well-known.mcp-registry-auth.flow.d.ts +1 -1
  453. package/notification/notification.service.d.ts +5 -1
  454. package/notification/notification.service.d.ts.map +1 -1
  455. package/package.json +10 -10
  456. package/prompt/flows/get-prompt.flow.d.ts.map +1 -1
  457. package/prompt/flows/prompts-list.flow.d.ts +1 -1
  458. package/prompt/flows/prompts-list.flow.d.ts.map +1 -1
  459. package/provider/borrow-providers.d.ts +15 -0
  460. package/provider/borrow-providers.d.ts.map +1 -0
  461. package/provider/container-handle.d.ts +31 -0
  462. package/provider/container-handle.d.ts.map +1 -0
  463. package/provider/create-container.d.ts +8 -2
  464. package/provider/create-container.d.ts.map +1 -1
  465. package/provider/provider.registry.d.ts +23 -4
  466. package/provider/provider.registry.d.ts.map +1 -1
  467. package/remote-mcp/remote-oauth.d.ts +3 -1
  468. package/remote-mcp/remote-oauth.d.ts.map +1 -1
  469. package/resource/flows/read-resource.flow.d.ts.map +1 -1
  470. package/resource/flows/resource-templates-list.flow.d.ts +1 -1
  471. package/resource/flows/resource-templates-list.flow.d.ts.map +1 -1
  472. package/resource/flows/resources-list.flow.d.ts +1 -1
  473. package/resource/flows/resources-list.flow.d.ts.map +1 -1
  474. package/resource/flows/subscribe-resource.flow.d.ts +1 -0
  475. package/resource/flows/subscribe-resource.flow.d.ts.map +1 -1
  476. package/resource/materialized/index.d.ts +1 -1
  477. package/resource/materialized/index.d.ts.map +1 -1
  478. package/resource/materialized/materialized-resource.context.d.ts +1 -0
  479. package/resource/materialized/materialized-resource.context.d.ts.map +1 -1
  480. package/resource/materialized/materialized-resources.d.ts +22 -4
  481. package/resource/materialized/materialized-resources.d.ts.map +1 -1
  482. package/resource/materialized/resource-store.d.ts +37 -3
  483. package/resource/materialized/resource-store.d.ts.map +1 -1
  484. package/resource/resource.events.d.ts +3 -0
  485. package/resource/resource.events.d.ts.map +1 -1
  486. package/resource/resource.registry.d.ts +17 -1
  487. package/resource/resource.registry.d.ts.map +1 -1
  488. package/scope/flows/http.request.flow.d.ts +8 -1
  489. package/scope/flows/http.request.flow.d.ts.map +1 -1
  490. package/scope/http-scope.helper.d.ts +1 -1
  491. package/scope/http-scope.helper.d.ts.map +1 -1
  492. package/scope/scope.instance.d.ts +2 -2
  493. package/scope/scope.instance.d.ts.map +1 -1
  494. package/server/adapters/express.host.adapter.d.ts +26 -0
  495. package/server/adapters/express.host.adapter.d.ts.map +1 -1
  496. package/server/adapters/polyfills/browser-express-host.d.ts +3 -0
  497. package/server/adapters/polyfills/browser-express-host.d.ts.map +1 -1
  498. package/server/adapters/polyfills/node-express-host.d.ts +1 -0
  499. package/server/adapters/polyfills/node-express-host.d.ts.map +1 -1
  500. package/server/adapters/user-content.listener.d.ts +30 -0
  501. package/server/adapters/user-content.listener.d.ts.map +1 -0
  502. package/server/custom-routes.helper.d.ts +19 -2
  503. package/server/custom-routes.helper.d.ts.map +1 -1
  504. package/server/security/host-validation.d.ts.map +1 -1
  505. package/server/security/resolve-allowed-hosts.d.ts +16 -0
  506. package/server/security/resolve-allowed-hosts.d.ts.map +1 -1
  507. package/server/security/same-origin.d.ts +2 -1
  508. package/server/security/same-origin.d.ts.map +1 -1
  509. package/server/server.instance.d.ts +11 -0
  510. package/server/server.instance.d.ts.map +1 -1
  511. package/shared/ensure-shared-server.d.ts +9 -2
  512. package/shared/ensure-shared-server.d.ts.map +1 -1
  513. package/shared/flows/shared.drain.flow.d.ts +1 -1
  514. package/shared/flows/shared.identify.flow.d.ts +6 -2
  515. package/shared/flows/shared.identify.flow.d.ts.map +1 -1
  516. package/shared/index.d.ts.map +1 -1
  517. package/shared/shared-attach.d.ts +15 -6
  518. package/shared/shared-attach.d.ts.map +1 -1
  519. package/shared/shared-embedded.d.ts +12 -2
  520. package/shared/shared-embedded.d.ts.map +1 -1
  521. package/shared/shared-endpoint.d.ts +3 -1
  522. package/shared/shared-endpoint.d.ts.map +1 -1
  523. package/shared/shared-files.d.ts +2 -0
  524. package/shared/shared-files.d.ts.map +1 -1
  525. package/shared/shared-serve.d.ts +20 -1
  526. package/shared/shared-serve.d.ts.map +1 -1
  527. package/shared/shared-server.lifecycle.d.ts +40 -10
  528. package/shared/shared-server.lifecycle.d.ts.map +1 -1
  529. package/shared/shared-server.options.d.ts +43 -6
  530. package/shared/shared-server.options.d.ts.map +1 -1
  531. package/skill/cache/skill-http-cache.catalog.d.ts +4 -4
  532. package/skill/cache/skill-http-cache.catalog.d.ts.map +1 -1
  533. package/skill/cache/skill-http-cache.d.ts +15 -2
  534. package/skill/cache/skill-http-cache.d.ts.map +1 -1
  535. package/skill/cache/skill-http-cache.factory.d.ts +12 -0
  536. package/skill/cache/skill-http-cache.factory.d.ts.map +1 -1
  537. package/skill/flows/http/llm-full-txt.flow.d.ts +1 -1
  538. package/skill/flows/http/llm-full-txt.flow.d.ts.map +1 -1
  539. package/skill/flows/http/llm-txt.flow.d.ts +1 -1
  540. package/skill/flows/http/llm-txt.flow.d.ts.map +1 -1
  541. package/skill/flows/http/skills-api.flow.d.ts +1 -1
  542. package/skill/flows/http/skills-api.flow.d.ts.map +1 -1
  543. package/skill/flows/load-skill.flow.d.ts.map +1 -1
  544. package/skill/skill-filter.helper.d.ts +16 -0
  545. package/skill/skill-filter.helper.d.ts.map +1 -1
  546. package/skill/skill-http.utils.d.ts +7 -1
  547. package/skill/skill-http.utils.d.ts.map +1 -1
  548. package/subsystems.d.ts +1 -1
  549. package/subsystems.d.ts.map +1 -1
  550. package/surface/entry-enabled.d.ts +23 -6
  551. package/surface/entry-enabled.d.ts.map +1 -1
  552. package/surface/index.d.ts +2 -2
  553. package/surface/index.d.ts.map +1 -1
  554. package/surface/live-surface.d.ts +32 -7
  555. package/surface/live-surface.d.ts.map +1 -1
  556. package/task/helpers/task-run-context.d.ts +5 -0
  557. package/task/helpers/task-run-context.d.ts.map +1 -0
  558. package/task/helpers/task-runner.d.ts.map +1 -1
  559. package/task/store/storage-task.store.d.ts.map +1 -1
  560. package/task/store/task-store.factory.d.ts.map +1 -1
  561. package/task/store/task.store.d.ts +1 -1
  562. package/task/store/task.store.d.ts.map +1 -1
  563. package/task/task.types.d.ts +1 -0
  564. package/task/task.types.d.ts.map +1 -1
  565. package/tool/flows/call-tool.flow.d.ts +10 -3
  566. package/tool/flows/call-tool.flow.d.ts.map +1 -1
  567. package/tool/flows/tools-list.flow.d.ts +1 -1
  568. package/tool/flows/tools-list.flow.d.ts.map +1 -1
  569. package/tool/ui/ui-shared.d.ts +2 -0
  570. package/tool/ui/ui-shared.d.ts.map +1 -1
  571. package/tool/ui/widget-enabled.d.ts +8 -0
  572. package/tool/ui/widget-enabled.d.ts.map +1 -0
  573. package/tool/undeclared-arguments-message.d.ts +8 -5
  574. package/tool/undeclared-arguments-message.d.ts.map +1 -1
  575. package/tool/undeclared-arguments.d.ts +6 -0
  576. package/tool/undeclared-arguments.d.ts.map +1 -1
  577. package/transport/adapters/base-sse-transport.d.ts +4 -0
  578. package/transport/adapters/base-sse-transport.d.ts.map +1 -1
  579. package/transport/adapters/polyfills/browser-sse-transport.d.ts +1 -0
  580. package/transport/adapters/polyfills/browser-sse-transport.d.ts.map +1 -1
  581. package/transport/adapters/streamable-http-transport.d.ts +4 -0
  582. package/transport/adapters/streamable-http-transport.d.ts.map +1 -1
  583. package/transport/adapters/transport.local.adapter.d.ts +3 -0
  584. package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
  585. package/transport/adapters/transport.sse.adapter.d.ts +3 -0
  586. package/transport/adapters/transport.sse.adapter.d.ts.map +1 -1
  587. package/transport/adapters/transport.streamable-http.adapter.d.ts +1 -0
  588. package/transport/adapters/transport.streamable-http.adapter.d.ts.map +1 -1
  589. package/transport/bus/redis-transport-bus.d.ts +25 -4
  590. package/transport/bus/redis-transport-bus.d.ts.map +1 -1
  591. package/transport/channel-signature.d.ts +16 -0
  592. package/transport/channel-signature.d.ts.map +1 -0
  593. package/transport/event-stores/redis.event-store.d.ts +1 -1
  594. package/transport/event-stores/redis.event-store.d.ts.map +1 -1
  595. package/transport/flows/handle.mcp-20260728.flow.d.ts +2 -1
  596. package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
  597. package/transport/flows/handle.streamable-http.flow.d.ts +1 -1
  598. package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
  599. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +8 -0
  600. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -1
  601. package/transport/mcp-20260728/result-decorator.d.ts +4 -2
  602. package/transport/mcp-20260728/result-decorator.d.ts.map +1 -1
  603. package/transport/mcp-20260728/subscriptions.d.ts +4 -0
  604. package/transport/mcp-20260728/subscriptions.d.ts.map +1 -1
  605. package/transport/mcp-handlers/index.d.ts +5 -3
  606. package/transport/mcp-handlers/index.d.ts.map +1 -1
  607. package/transport/relay/relay-scope.helper.d.ts +2 -2
  608. package/transport/relay/relay-scope.helper.d.ts.map +1 -1
  609. package/transport/session-end-channel.d.ts +81 -0
  610. package/transport/session-end-channel.d.ts.map +1 -0
  611. package/transport/stream-keep-alive.d.ts +13 -0
  612. package/transport/stream-keep-alive.d.ts.map +1 -0
  613. package/transport/transport.local.d.ts +2 -1
  614. package/transport/transport.local.d.ts.map +1 -1
  615. package/transport/transport.registry.d.ts +74 -3
  616. package/transport/transport.registry.d.ts.map +1 -1
  617. package/transport/transport.types.d.ts +6 -1
  618. package/transport/transport.types.d.ts.map +1 -1
  619. package/transport/web-fetch-handler.d.ts.map +1 -1
  620. package/transport/web-standard-mcp.d.ts.map +1 -1
  621. package/utils/same-origin-fetch.utils.d.ts +5 -0
  622. package/utils/same-origin-fetch.utils.d.ts.map +1 -0
  623. package/work/index.d.ts +2 -0
  624. package/work/index.d.ts.map +1 -0
  625. package/work/work-spans.d.ts +42 -0
  626. package/work/work-spans.d.ts.map +1 -0
  627. package/worker/worker.lifecycle.d.ts.map +1 -1
  628. package/workflow/engine/workflow-step.executor.d.ts +10 -3
  629. package/workflow/engine/workflow-step.executor.d.ts.map +1 -1
  630. package/workflow/engine/workflow.engine.d.ts +2 -0
  631. package/workflow/engine/workflow.engine.d.ts.map +1 -1
  632. package/workflow/tools/register-workflow.tool.d.ts.map +1 -1
  633. package/workflow/tools/remove-workflow.tool.d.ts.map +1 -1
  634. package/workflow/tools/update-workflow.tool.d.ts.map +1 -1
@@ -18,8 +18,12 @@ var LeaseHolder = class {
18
18
  held = false;
19
19
  stopped = false;
20
20
  settled = false;
21
+ /** Set by a stop whose work did not end: the lease then ends by its TTL, and a hand-over releases nothing. */
22
+ leftToExpire = false;
21
23
  reportedHeldElsewhere = false;
22
24
  leaseCheck;
25
+ /** The hand-over to a preferred process, while what ran under the lease ends: the lease is renewed meanwhile. */
26
+ handingOver;
23
27
  leaseTimer;
24
28
  leaseDeadline;
25
29
  /** Whether this process holds the lease now. */
@@ -30,6 +34,10 @@ var LeaseHolder = class {
30
34
  get stopping() {
31
35
  return this.stopped;
32
36
  }
37
+ /** Where a preferred process marks that it wants the lease. */
38
+ get preferKey() {
39
+ return `${this.options.key}:prefer`;
40
+ }
33
41
  /** Contend for the lease once now, then renew or contend again every third of the lease. */
34
42
  async start() {
35
43
  this.leaseCheck = this.checkLease();
@@ -37,16 +45,23 @@ var LeaseHolder = class {
37
45
  }
38
46
  /**
39
47
  * Stop contending, keep renewing the lease until `untilSettled` resolves (what ran under it has ended), then
40
- * release it. When it resolves `false` (what ran did not end), stop renewing without releasing: the lease then ends
41
- * by the store's TTL.
48
+ * release it. When it resolves `false` (what ran did not end), stop renewing without releasing, and without waiting
49
+ * for a hand-over in progress: the lease then ends by the store's TTL.
42
50
  */
43
51
  async stop(untilSettled) {
44
52
  this.stopped = true;
45
53
  const ended = await untilSettled() !== false;
46
54
  this.settled = true;
55
+ this.leftToExpire = !ended;
47
56
  clearTimeout(this.leaseTimer);
48
57
  await this.leaseCheck;
58
+ if (ended) await this.handingOver;
49
59
  clearTimeout(this.leaseDeadline);
60
+ if (this.options.prefer === true) {
61
+ await this.options.storage.deleteIfEquals(this.preferKey, this.id).catch((error) => {
62
+ this.reportStoreFailure(error);
63
+ });
64
+ }
50
65
  if (!this.held) return;
51
66
  this.held = false;
52
67
  if (!ended) return;
@@ -82,7 +97,12 @@ var LeaseHolder = class {
82
97
  async checkLease() {
83
98
  let nextCheckMs = this.options.leaseMs / 3;
84
99
  try {
85
- if (this.held) {
100
+ if (this.options.prefer === true && !this.stopped) await this.markPreferred();
101
+ if (this.handingOver) {
102
+ await this.options.storage.expireIfEquals(this.options.key, this.id, this.leaseSeconds);
103
+ } else if (this.held && await this.preferredElsewhere()) {
104
+ this.handOver();
105
+ } else if (this.held) {
86
106
  if (!await this.renew()) this.lose("lost its lease; another process runs it now");
87
107
  } else if (!this.stopped) {
88
108
  const acquired = await this.acquire();
@@ -99,9 +119,36 @@ var LeaseHolder = class {
99
119
  }, nextCheckMs);
100
120
  this.leaseTimer.unref?.();
101
121
  }
122
+ /** Mark the lease as wanted by this preferred process, for as long as a lease lasts; renewed at each check. */
123
+ async markPreferred() {
124
+ await this.options.storage.set(this.preferKey, this.id, { ttlSeconds: this.leaseSeconds });
125
+ }
126
+ /** Whether this process is not preferred and a preferred one wants the lease. */
127
+ async preferredElsewhere() {
128
+ const { prefer, storage } = this.options;
129
+ if (prefer !== false || !storage.get) return false;
130
+ const marked = await storage.get(this.preferKey);
131
+ return marked !== null && marked !== this.id;
132
+ }
133
+ /**
134
+ * Stop what runs under the lease, and release the lease to the preferred process once that ended; the checks renew
135
+ * it meanwhile, and start nothing under it.
136
+ */
137
+ handOver() {
138
+ this.held = false;
139
+ clearTimeout(this.leaseDeadline);
140
+ this.options.onLost();
141
+ this.handingOver = (async () => {
142
+ await this.options.settled?.();
143
+ if (this.leftToExpire) return;
144
+ await this.options.storage.deleteIfEquals(this.options.key, this.id);
145
+ this.options.logger.info(`${this.options.label} hands its lease over to a preferred process`);
146
+ })().catch((error) => this.reportStoreFailure(error)).finally(() => this.handingOver = void 0);
147
+ }
102
148
  /** Write the lease if no one holds it, then renew it to learn whether this holder's id is stored. */
103
149
  async acquire() {
104
150
  const { key, storage } = this.options;
151
+ if (await this.preferredElsewhere()) return false;
105
152
  await storage.set(key, this.id, { ttlSeconds: this.leaseSeconds, ifNotExists: true });
106
153
  this.held = await this.renew();
107
154
  return this.held;
@@ -20,8 +20,9 @@ import {
20
20
  writeFile
21
21
  } from "@frontmcp/utils";
22
22
  import {
23
- isRedisProvider,
24
- redisOptionsSchema
23
+ isRedisConnectionOptions,
24
+ redisOptionsSchema,
25
+ redisStorageConfigOf
25
26
  } from "../common/index.mjs";
26
27
  import { findProjectRoot } from "../common/types/options/sqlite/resolve.mjs";
27
28
  import { UnsafeDutyStoreError } from "../errors/duty.errors.mjs";
@@ -54,11 +55,9 @@ function registerReadinessProbe(providers, probe) {
54
55
  }
55
56
  function leaseStorageConfig(redis, kind, scope) {
56
57
  const parsed = redis === void 0 ? void 0 : redisOptionsSchema.safeParse(redis);
57
- if (parsed?.success && isRedisProvider(parsed.data)) {
58
- const { host, port, password, db, tls } = parsed.data;
58
+ if (parsed?.success && isRedisConnectionOptions(parsed.data)) {
59
59
  return {
60
- type: "redis",
61
- redis: { config: { host, port, password, db, tls } },
60
+ ...redisStorageConfigOf(parsed.data),
62
61
  prefix: scope === "cluster" ? `frontmcp:cluster:${kind}:` : `frontmcp:${kind}:${nodeOs().hostname()}:`,
63
62
  fallback: "error"
64
63
  };
@@ -80,6 +79,9 @@ function leaseKey(name, scope, serverName) {
80
79
  const cwd = process.cwd();
81
80
  return `${key}:${sha256Hex(findProjectRoot(cwd) ?? cwd)}`;
82
81
  }
82
+ function keyedLeaseKey(name, key, serverName) {
83
+ return `${nameKey(name, serverName)}:key:${sha256Hex(key)}`;
84
+ }
83
85
  async function openLeaseStore(config) {
84
86
  if (config.sqlite) await prepareLeaseFile(config.sqlite.path);
85
87
  return createStorage(config);
@@ -120,6 +122,7 @@ var LeaseClaims = class {
120
122
  export {
121
123
  LeaseClaims,
122
124
  isLongLivedProcess,
125
+ keyedLeaseKey,
123
126
  leaseKey,
124
127
  leaseStorageConfig,
125
128
  nameKey,
@@ -19,6 +19,8 @@ import { DEFAULT_ELICIT_TTL } from "../elicitation.types.mjs";
19
19
  var inputSchema = z.object({
20
20
  /** Related request ID from the transport */
21
21
  relatedRequestId: z.union([z.string(), z.number()]),
22
+ /** The JSON-RPC id the transport sends the `elicitation/create` request under */
23
+ requestId: z.union([z.string(), z.number()]).optional(),
22
24
  /** Session ID for the elicitation */
23
25
  sessionId: z.string(),
24
26
  /** Message to display to the user */
@@ -49,6 +51,7 @@ var outputSchema = z.object({
49
51
  });
50
52
  var stateSchema = z.object({
51
53
  relatedRequestId: z.union([z.string(), z.number()]),
54
+ requestId: z.union([z.string(), z.number()]).optional(),
52
55
  sessionId: z.string(),
53
56
  message: z.string(),
54
57
  requestedSchema: z.record(z.string(), z.unknown()),
@@ -77,6 +80,7 @@ var ElicitationRequestFlow = class extends FlowBase {
77
80
  const { mode = "form", ttl = DEFAULT_ELICIT_TTL, elicitationId, url } = input.options ?? {};
78
81
  this.state.set({
79
82
  relatedRequestId: input.relatedRequestId,
83
+ ...input.requestId === void 0 ? {} : { requestId: input.requestId },
80
84
  sessionId: input.sessionId,
81
85
  message: input.message,
82
86
  requestedSchema: input.requestedSchema,
@@ -106,6 +110,7 @@ var ElicitationRequestFlow = class extends FlowBase {
106
110
  async storePendingRecord() {
107
111
  this.logger.verbose("storePendingRecord:start");
108
112
  const { elicitId, sessionId, message, mode, expiresAt, requestedSchema } = this.state.required;
113
+ const { requestId } = this.state;
109
114
  const store = this.scope.elicitationStore;
110
115
  if (!store) {
111
116
  throw new ElicitationStoreNotInitializedError();
@@ -117,7 +122,8 @@ var ElicitationRequestFlow = class extends FlowBase {
117
122
  expiresAt,
118
123
  message,
119
124
  mode,
120
- requestedSchema
125
+ requestedSchema,
126
+ ...requestId === void 0 ? {} : { requestId }
121
127
  };
122
128
  await store.setPending(pendingRecord);
123
129
  this.state.set("pendingRecord", pendingRecord);
@@ -18,6 +18,8 @@ import { validateElicitationContent } from "../helpers/index.mjs";
18
18
  var inputSchema = z.object({
19
19
  /** Session ID for the elicitation */
20
20
  sessionId: z.string(),
21
+ /** The JSON-RPC id of the client's response: when given, it answers only the pending request of that id */
22
+ requestId: z.union([z.string(), z.number()]).optional(),
21
23
  /** The result from the client */
22
24
  result: z.object({
23
25
  action: z.enum(["accept", "cancel", "decline"]),
@@ -34,6 +36,7 @@ var outputSchema = z.object({
34
36
  });
35
37
  var stateSchema = z.object({
36
38
  sessionId: z.string(),
39
+ requestId: z.union([z.string(), z.number()]).optional(),
37
40
  action: z.enum(["accept", "cancel", "decline"]),
38
41
  content: z.unknown().optional(),
39
42
  pendingRecord: z.any().optional(),
@@ -55,6 +58,7 @@ var ElicitationResultFlow = class extends FlowBase {
55
58
  const input = inputSchema.parse(this.rawInput);
56
59
  this.state.set({
57
60
  sessionId: input.sessionId,
61
+ ...input.requestId === void 0 ? {} : { requestId: input.requestId },
58
62
  action: input.result.action,
59
63
  content: input.result.content
60
64
  });
@@ -70,8 +74,10 @@ var ElicitationResultFlow = class extends FlowBase {
70
74
  if (!store) {
71
75
  throw new ElicitationStoreNotInitializedError();
72
76
  }
73
- const pendingRecord = await store.getPending(sessionId);
74
- this.state.set("pendingRecord", pendingRecord ?? void 0);
77
+ const { requestId } = this.state;
78
+ const found = await store.getPending(sessionId);
79
+ const pendingRecord = found && (requestId === void 0 || found.requestId === requestId) ? found : void 0;
80
+ this.state.set("pendingRecord", pendingRecord);
75
81
  if (!pendingRecord) {
76
82
  this.logger.verbose("lookupPending:notFound", { sessionIdHash: sessionIdHash(sessionId) });
77
83
  } else {
@@ -19,7 +19,7 @@ import {
19
19
  realpath,
20
20
  writeFile
21
21
  } from "@frontmcp/utils";
22
- import { isRedisProvider, redisOptionsSchema } from "../../common/index.mjs";
22
+ import { isRedisConnectionOptions, redisOptionsSchema, redisStorageConfigOf } from "../../common/index.mjs";
23
23
  import { findReplaceableDirectory } from "../../server/security/replaceable-directory.mjs";
24
24
  import { getElicitationSecret } from "../store/elicitation-encryption.mjs";
25
25
  import { InvalidQuestionStoreError } from "./question.errors.mjs";
@@ -54,10 +54,7 @@ async function createQuestionStore(options) {
54
54
  async function resolveQuestionStorage(sources) {
55
55
  if (sources.storage) return sources.storage;
56
56
  const redis = sources.redis === void 0 ? void 0 : redisOptionsSchema.safeParse(sources.redis);
57
- if (redis?.success && isRedisProvider(redis.data)) {
58
- const { host, port, password, db, tls } = redis.data;
59
- return { type: "redis", redis: { config: { host, port, password, db, tls } } };
60
- }
57
+ if (redis?.success && isRedisConnectionOptions(redis.data)) return redisStorageConfigOf(redis.data);
61
58
  if (sources.sqlite) return { type: "sqlite", sqlite: sources.sqlite };
62
59
  const { runtime, deployment } = getRuntimeContext();
63
60
  if (runtime !== "node" || deployment === "serverless") {
@@ -10,7 +10,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
10
10
 
11
11
  // libs/sdk/src/elicitation/store/elicitation-store.factory.ts
12
12
  import { createMemoryStorage, createStorage, getEnv } from "@frontmcp/utils";
13
- import { isVercelKvProvider } from "../../common/index.mjs";
13
+ import {
14
+ isVercelKvProvider,
15
+ redisStorageConfigOf
16
+ } from "../../common/index.mjs";
14
17
  import { normalizeRedisOptions } from "../../common/types/options/redis/schema.mjs";
15
18
  import { ElicitationNotSupportedError } from "../../errors/elicitation.error.mjs";
16
19
  import { requireOptionalModule } from "../../scope/optional-dependency.util.mjs";
@@ -85,9 +88,13 @@ async function createElicitationStore(options = {}) {
85
88
  'Vercel KV is not supported for elicitation stores. Elicitation requires pub/sub for cross-node result routing, which Vercel KV does not support. Use Redis provider instead: { provider: "redis", host: "...", port: ... }'
86
89
  );
87
90
  }
88
- const { host, port, password, db, tls } = redisOptions;
89
- finalStorageConfig = { type: "redis", redis: { config: { host, port, password, db, tls } } };
90
- logger?.debug("[ElicitationStoreFactory] Converted redis option to storage config", { host, port });
91
+ finalStorageConfig = redisStorageConfigOf(redisOptions);
92
+ const { host, port, client } = redisOptions;
93
+ logger?.debug("[ElicitationStoreFactory] Converted redis option to storage config", {
94
+ host,
95
+ port,
96
+ client: client !== void 0
97
+ });
91
98
  }
92
99
  const explicitBackend = Boolean(storageConfig || redis);
93
100
  if (finalStorageConfig?.type === "vercel-kv" || !explicitBackend && getEnv("KV_REST_API_URL")) {
@@ -1,6 +1,7 @@
1
1
  // libs/sdk/src/errors/browser-entry-point.errors.ts
2
2
  import { InternalMcpError } from "./mcp.error.mjs";
3
3
  var NODE_ONLY_ENTRY_POINTS = {
4
+ bootstrap: "a page cannot listen on an HTTP port",
4
5
  runShared: "the shared local server needs stdio, a child process and a Unix socket or loopback port",
5
6
  runUnixSocket: "a page cannot listen on a Unix socket"
6
7
  };
@@ -8,6 +8,14 @@ var DutyNameConflictError = class extends InternalMcpError {
8
8
  );
9
9
  }
10
10
  };
11
+ var DutyLeaseKeyError = class extends InternalMcpError {
12
+ constructor(dutyName, reason) {
13
+ super(
14
+ `Duty "${dutyName}" could not name its lease: scope.key ${reason}; it answers the key its processes share`,
15
+ "DUTY_LEASE_KEY"
16
+ );
17
+ }
18
+ };
11
19
  var InvalidDutyCronError = class extends InternalMcpError {
12
20
  /** Names the duty, its expression and why it can't be read. */
13
21
  constructor(dutyName, expression, reason) {
@@ -37,6 +45,7 @@ var UnsafeDutyStoreError = class extends InternalMcpError {
37
45
  };
38
46
  export {
39
47
  ClusterScopeNeedsRedisError,
48
+ DutyLeaseKeyError,
40
49
  DutyNameConflictError,
41
50
  InvalidDutyCronError,
42
51
  UnsafeDutyStoreError
@@ -146,6 +146,8 @@ import {
146
146
  DependencyCycleError,
147
147
  ProviderConstructionError,
148
148
  ProviderBootstrapError,
149
+ ContainerDisposedError,
150
+ ContainerProviderScopeError,
149
151
  ProviderDependencyError,
150
152
  ProviderScopedAccessError,
151
153
  ProviderNotAvailableError,
@@ -156,6 +158,7 @@ import { InvalidDecoratorMetadataError, HookTargetNotDefinedError } from "./deco
156
158
  import {
157
159
  ClusterScopeNeedsRedisError,
158
160
  DutyNameConflictError,
161
+ DutyLeaseKeyError,
159
162
  InvalidDutyCronError,
160
163
  UnsafeDutyStoreError
161
164
  } from "./duty.errors.mjs";
@@ -203,10 +206,13 @@ import {
203
206
  TransportServiceNotAvailableError,
204
207
  SessionClaimConflictError,
205
208
  SessionOwnerUnreachableError,
209
+ SessionEndUnconfirmedError,
210
+ SessionLimitReachedError,
206
211
  UnsafeSocketDirectoryError,
207
212
  SocketInUseError,
208
213
  SocketPathConflictError,
209
- SocketPermissionError
214
+ SocketPermissionError,
215
+ UserContentConfigurationError
210
216
  } from "./transport.errors.mjs";
211
217
  import {
212
218
  EncryptionContextNotSetError,
@@ -281,7 +287,7 @@ import {
281
287
  DynamicJobDirectExecutionError,
282
288
  CallRecorderConfigurationError
283
289
  } from "./sdk.errors.mjs";
284
- export { DynamicJobRegistrationDisabledError, JobAdmissionTimeoutError, JobCancelledError, JobInterruptedError, JobNotAuthorizedError, JobRunFinishedError, JobRunNotCancellableError, JobRunNotFoundError, JobRunnerBootError, JobRunnerUnavailableError, JobStoreNotSupportedError, JobTimeoutError } from "./job.errors.mjs";
290
+ export { DynamicJobRegistrationDisabledError, JobAdmissionLostError, JobAdmissionTimeoutError, JobCancelledError, JobInterruptedError, JobNotAuthorizedError, JobRunFinishedError, JobRunNotCancellableError, JobRunNotFoundError, JobRunnerBootError, JobRunnerBusyError, JobRunnerUnavailableError, JobStoreNotSupportedError, JobTimeoutError } from "./job.errors.mjs";
285
291
  export { DuplicatePluginEntryError, DuplicatePluginError, PluginConfiguredTwiceError, UnenforcedMetadataError } from "./plugin.errors.mjs";
286
292
  export { InvalidToolUiConfigError, ToolUiConfigurationError } from "./tool-ui.errors.mjs";
287
293
  export {
@@ -306,12 +312,15 @@ export {
306
312
  CallRecorderConfigurationError,
307
313
  ClusterScopeNeedsRedisError,
308
314
  ConfigNotFoundError,
315
+ ContainerDisposedError,
316
+ ContainerProviderScopeError,
309
317
  ContextExtensionNotAvailableError,
310
318
  CredentialProviderAlreadyRegisteredError,
311
319
  CrossOriginRequestError,
312
320
  DependencyCycleError,
313
321
  DependencyNotFoundError,
314
322
  DuplicateAppIdError,
323
+ DutyLeaseKeyError,
315
324
  DutyNameConflictError,
316
325
  DynamicAdapterNameError,
317
326
  DynamicJobDirectExecutionError,
@@ -459,8 +468,10 @@ export {
459
468
  ServerNotFoundError,
460
469
  ServerlessHandlerNotInitializedError,
461
470
  SessionClaimConflictError,
471
+ SessionEndUnconfirmedError,
462
472
  SessionIdEmptyError,
463
473
  SessionIdentityRequiredError,
474
+ SessionLimitReachedError,
464
475
  SessionMissingError,
465
476
  SessionOwnerUnreachableError,
466
477
  SessionSecretRequiredError,
@@ -506,6 +517,7 @@ export {
506
517
  UnsupportedContentTypeError,
507
518
  UnsupportedHookOwnerKindError,
508
519
  UnsupportedTransportTypeError,
520
+ UserContentConfigurationError,
509
521
  VaultLoadError,
510
522
  VaultNotFoundError,
511
523
  VercelKvAsyncInitRequiredError,
@@ -33,18 +33,36 @@ var JobInterruptedError = class extends PublicMcpError {
33
33
  }
34
34
  };
35
35
  var JobRunnerUnavailableError = class extends PublicMcpError {
36
- constructor(jobName, why, remedy) {
37
- super(`Job "${jobName}" cannot use its runner: ${why}`, "JOB_RUNNER_UNAVAILABLE", 501, void 0, {
36
+ constructor(jobName, why, remedy, kind = "Job") {
37
+ super(`${kind} "${jobName}" cannot use its runner: ${why}`, "JOB_RUNNER_UNAVAILABLE", 501, void 0, {
38
38
  say: remedy
39
39
  });
40
40
  }
41
41
  };
42
42
  var JobRunnerBootError = class extends PublicMcpError {
43
- constructor(runId, cause) {
44
- super(`The detached runner of run "${runId}" did not start: ${cause}`, "JOB_RUNNER_BOOT_FAILED", 503, void 0, {
43
+ /** Why the runner did not start, as the system or its boot reported it; never sent to a caller. */
44
+ reason;
45
+ constructor(runId, reason) {
46
+ super(`The detached runner of run "${runId}" did not start`, "JOB_RUNNER_BOOT_FAILED", 503, void 0, {
45
47
  say: "Run the job again; if it keeps failing, check that the server starts from its entry",
46
48
  tool: "execute_job"
47
49
  });
50
+ this.reason = reason;
51
+ }
52
+ getInternalMessage() {
53
+ return `${this.message}: ${this.reason}`;
54
+ }
55
+ };
56
+ var JobRunnerBusyError = class extends PublicMcpError {
57
+ constructor(name, active, limit, kind = "Job") {
58
+ const holder = limit === "server" ? "this server holds" : "you hold";
59
+ super(
60
+ `${kind} "${name}" was not started: ${holder} ${active} detached runs, the most allowed at once`,
61
+ "JOB_RUNNER_BUSY",
62
+ 429,
63
+ void 0,
64
+ { say: "Retry once a detached run has ended, or ask the operator to raise jobs.detached.maxRuns" }
65
+ );
48
66
  }
49
67
  };
50
68
  var JobAdmissionTimeoutError = class extends PublicMcpError {
@@ -60,6 +78,11 @@ var JobAdmissionTimeoutError = class extends PublicMcpError {
60
78
  );
61
79
  }
62
80
  };
81
+ var JobAdmissionLostError = class extends PublicMcpError {
82
+ constructor(jobName, why) {
83
+ super(`Job "${jobName}" lost its admission slot and was stopped: ${why}`, "JOB_ADMISSION_LOST", 503);
84
+ }
85
+ };
63
86
  var JobRunNotFoundError = class extends PublicMcpError {
64
87
  constructor(runId) {
65
88
  super(`Run "${runId}" not found`, "JOB_RUN_NOT_FOUND", 404, void 0, {
@@ -99,6 +122,7 @@ var JobStoreNotSupportedError = class extends InternalMcpError {
99
122
  };
100
123
  export {
101
124
  DynamicJobRegistrationDisabledError,
125
+ JobAdmissionLostError,
102
126
  JobAdmissionTimeoutError,
103
127
  JobCancelledError,
104
128
  JobInterruptedError,
@@ -107,6 +131,7 @@ export {
107
131
  JobRunNotCancellableError,
108
132
  JobRunNotFoundError,
109
133
  JobRunnerBootError,
134
+ JobRunnerBusyError,
110
135
  JobRunnerUnavailableError,
111
136
  JobStoreNotSupportedError,
112
137
  JobTimeoutError
@@ -261,6 +261,12 @@ var InvalidResourceStoreError = class extends InternalMcpError {
261
261
  super(`resourceStore(): ${details}`, "INVALID_RESOURCE_STORE");
262
262
  }
263
263
  };
264
+ var ResourceStoreClosedError = class extends InternalMcpError {
265
+ constructor(key) {
266
+ const subject = key === void 0 ? "a key" : `key "${key}"`;
267
+ super(`resourceStore(): the store closed while ${subject} was being produced`, "RESOURCE_STORE_CLOSED");
268
+ }
269
+ };
264
270
  function availabilityRemedy(entryType, availability, missingAxes) {
265
271
  const requirements = missingAxes.map((axis) => {
266
272
  const allowed = availability?.[axis];
@@ -315,22 +321,66 @@ var InvalidResourceUriError = class extends PublicMcpError {
315
321
  super(`Invalid resource URI: ${uri}${reason ? ` (${reason})` : ""}`, "INVALID_RESOURCE_URI", 400);
316
322
  }
317
323
  };
324
+ var MAX_REPORTED_VALIDATION_ISSUES = 20;
325
+ var MAX_VALIDATION_DETAILS_CHARS = 16 * 1024;
326
+ function nestedIssueLists(issue) {
327
+ const nested = issue?.errors;
328
+ return Array.isArray(nested) && nested.every(Array.isArray) ? nested : void 0;
329
+ }
330
+ function countIssues(issue) {
331
+ let count = 0;
332
+ const pending = [issue];
333
+ while (pending.length > 0) {
334
+ count += 1;
335
+ for (const branch of nestedIssueLists(pending.pop()) ?? []) for (const nested of branch) pending.push(nested);
336
+ }
337
+ return count;
338
+ }
339
+ function keepIssues(issues, budget) {
340
+ const kept = [];
341
+ for (const issue of issues) {
342
+ if (budget.left <= 0) {
343
+ budget.omitted += countIssues(issue);
344
+ continue;
345
+ }
346
+ budget.left -= 1;
347
+ const nested = nestedIssueLists(issue);
348
+ if (nested) {
349
+ kept.push({ ...issue, errors: nested.map((branch) => keepIssues(branch, budget)) });
350
+ } else {
351
+ kept.push(issue);
352
+ }
353
+ }
354
+ return kept;
355
+ }
318
356
  var InvalidInputError = class extends PublicMcpError {
319
357
  validationErrors;
358
+ /** How many issues past {@link MAX_REPORTED_VALIDATION_ISSUES} were left out of `validationErrors`. */
359
+ omittedValidationErrors = 0;
320
360
  constructor(message = "Invalid input: validation failed", validationErrors) {
321
361
  super(message, "INVALID_INPUT", 400);
322
- this.validationErrors = validationErrors;
362
+ if (Array.isArray(validationErrors)) {
363
+ const budget = { left: MAX_REPORTED_VALIDATION_ISSUES, omitted: 0 };
364
+ this.validationErrors = keepIssues(validationErrors, budget);
365
+ this.omittedValidationErrors = budget.omitted;
366
+ } else {
367
+ this.validationErrors = validationErrors;
368
+ }
369
+ }
370
+ detailsText() {
371
+ if (!this.validationErrors) return "";
372
+ let details = JSON.stringify(this.validationErrors, null, 2) ?? "";
373
+ if (details.length > MAX_VALIDATION_DETAILS_CHARS) details = `${details.slice(0, MAX_VALIDATION_DETAILS_CHARS)}\u2026`;
374
+ const omitted = this.omittedValidationErrors ? `
375
+ (${this.omittedValidationErrors} more issue${this.omittedValidationErrors === 1 ? "" : "s"} not shown)` : "";
376
+ return `
377
+ Details: ${details}${omitted}`;
323
378
  }
324
379
  getInternalMessage() {
325
- return this.message + (this.validationErrors ? `
326
- Details: ${JSON.stringify(this.validationErrors, null, 2)}` : "");
380
+ return this.message + this.detailsText();
327
381
  }
328
382
  getPublicMessage() {
329
- if (this.validationErrors) {
330
- return `${this.message}
331
- Details: ${JSON.stringify(this.validationErrors, null, 2)}`;
332
- }
333
- return this.message;
383
+ return this.message + this.detailsText();
334
384
  }
335
385
  };
336
386
  var InvalidOutputError = class extends InternalMcpError {
@@ -666,6 +716,8 @@ export {
666
716
  InvalidPluginScopeError,
667
717
  InvalidResourceStoreError,
668
718
  InvalidResourceUriError,
719
+ MAX_REPORTED_VALIDATION_ISSUES,
720
+ MAX_VALIDATION_DETAILS_CHARS,
669
721
  MCP_ERROR_CODES,
670
722
  McpError,
671
723
  PayloadTooLargeError,
@@ -678,6 +730,7 @@ export {
678
730
  RequestContextNotAvailableError,
679
731
  ResourceNotFoundError,
680
732
  ResourceReadError,
733
+ ResourceStoreClosedError,
681
734
  SessionMissingError,
682
735
  StaleToolListError,
683
736
  ToolExecutionError,
@@ -40,6 +40,22 @@ var ProviderConstructionError = class extends InternalMcpError {
40
40
  this.originalError = cause instanceof Error ? cause : void 0;
41
41
  }
42
42
  };
43
+ var ContainerDisposedError = class extends InternalMcpError {
44
+ constructor() {
45
+ super(
46
+ "The container was disposed, so a server can't start on it: create the container again, or start the server without it",
47
+ "CONTAINER_DISPOSED"
48
+ );
49
+ }
50
+ };
51
+ var ContainerProviderScopeError = class extends InternalMcpError {
52
+ constructor(tokenName, scope) {
53
+ super(
54
+ `Provider "${tokenName}" has scope "${scope}" here, but the container built it as one instance for every caller: give it the same scope in the container, or list it in only one of them`,
55
+ "CONTAINER_PROVIDER_SCOPE"
56
+ );
57
+ }
58
+ };
43
59
  var ProviderBootstrapError = class extends InternalMcpError {
44
60
  originalError;
45
61
  constructor(tokenName, cause) {
@@ -77,6 +93,8 @@ var InvalidDependencyScopeError = class extends InternalMcpError {
77
93
  }
78
94
  };
79
95
  export {
96
+ ContainerDisposedError,
97
+ ContainerProviderScopeError,
80
98
  DependencyCycleError,
81
99
  InvalidDependencyScopeError,
82
100
  PluginDependencyError,
@@ -38,6 +38,13 @@ var UnsupportedContentTypeError = class extends PublicMcpError {
38
38
  this.contentType = contentType;
39
39
  }
40
40
  };
41
+ var SessionLimitReachedError = class extends PublicMcpError {
42
+ maxSessions;
43
+ constructor(maxSessions) {
44
+ super("The server holds as many sessions as it allows. Retry later.", "SESSION_LIMIT_REACHED", 503);
45
+ this.maxSessions = maxSessions;
46
+ }
47
+ };
41
48
  var TransportServiceNotAvailableError = class extends InternalMcpError {
42
49
  constructor() {
43
50
  super("Transport service not available", "TRANSPORT_SERVICE_NOT_AVAILABLE");
@@ -67,6 +74,28 @@ var SessionOwnerUnreachableError = class extends PublicMcpError {
67
74
  this.reason = reason;
68
75
  }
69
76
  };
77
+ var SessionEndUnconfirmedError = class extends PublicMcpError {
78
+ /** Seconds after which a retried DELETE can succeed. */
79
+ retryAfterSeconds;
80
+ /** The instance that did not confirm (a node id, or how many instances). Logged, never sent to the client. */
81
+ holder;
82
+ /** Why it is unconfirmed. Logged, never sent to the client. */
83
+ reason;
84
+ /** `not-listening`: none was asked; `timed-out`: one did not answer; `uncounted`: who to ask is unknown. */
85
+ kind;
86
+ constructor(holder, retryAfterSeconds, reason, kind) {
87
+ const retryAfter = Math.max(1, Math.ceil(retryAfterSeconds));
88
+ super(
89
+ `This MCP session is ending, but an instance of the server that holds it did not confirm that it stopped the session's requests in flight. Retry the DELETE after ${retryAfter}s.`,
90
+ "SESSION_END_UNCONFIRMED",
91
+ 503
92
+ );
93
+ this.retryAfterSeconds = retryAfter;
94
+ this.holder = holder;
95
+ this.reason = reason;
96
+ this.kind = kind;
97
+ }
98
+ };
70
99
  function octalMode(mode) {
71
100
  return `0${(mode & 4095).toString(8)}`;
72
101
  }
@@ -94,10 +123,17 @@ var SocketPermissionError = class extends InternalMcpError {
94
123
  super(`Could not make Unix socket ${socketPath} owner-only (0600): ${detail}.`, "SOCKET_PERMISSION");
95
124
  }
96
125
  };
126
+ var UserContentConfigurationError = class extends InternalMcpError {
127
+ constructor(detail) {
128
+ super(`http.userContent: ${detail}`, "USER_CONTENT_CONFIGURATION");
129
+ }
130
+ };
97
131
  export {
98
132
  InvalidTransportSessionError,
99
133
  MethodNotImplementedError,
100
134
  SessionClaimConflictError,
135
+ SessionEndUnconfirmedError,
136
+ SessionLimitReachedError,
101
137
  SessionOwnerUnreachableError,
102
138
  SocketInUseError,
103
139
  SocketPathConflictError,
@@ -108,5 +144,6 @@ export {
108
144
  TransportServiceNotAvailableError,
109
145
  UnsafeSocketDirectoryError,
110
146
  UnsupportedContentTypeError,
111
- UnsupportedTransportTypeError
147
+ UnsupportedTransportTypeError,
148
+ UserContentConfigurationError
112
149
  };