@frontmcp/sdk 1.13.2 → 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 (568) 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/authorized-apps.utils.d.ts +2 -0
  12. package/auth/authorized-apps.utils.d.ts.map +1 -1
  13. package/auth/client-display-name.d.ts +52 -0
  14. package/auth/client-display-name.d.ts.map +1 -0
  15. package/auth/federated-steps.d.ts.map +1 -1
  16. package/auth/flows/oauth.auth-ui.flow.d.ts +1 -1
  17. package/auth/flows/oauth.authorize.flow.d.ts +6 -3
  18. package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
  19. package/auth/flows/oauth.callback.flow.d.ts +3 -8
  20. package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
  21. package/auth/flows/oauth.connect.flow.d.ts +1 -1
  22. package/auth/flows/oauth.provider-callback.flow.d.ts +9 -2
  23. package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
  24. package/auth/flows/oauth.register.flow.d.ts +6 -4
  25. package/auth/flows/oauth.register.flow.d.ts.map +1 -1
  26. package/auth/flows/oauth.token.flow.d.ts +1 -1
  27. package/auth/flows/oauth.userinfo.flow.d.ts +1 -1
  28. package/auth/flows/session.verify.flow.d.ts +20 -4
  29. package/auth/flows/session.verify.flow.d.ts.map +1 -1
  30. package/auth/flows/well-known.jwks.flow.d.ts +3 -3
  31. package/auth/flows/well-known.oauth-authorization-server.flow.d.ts +2 -2
  32. package/auth/flows/well-known.prm.flow.d.ts +1 -1
  33. package/auth/instances/instance.local-primary-auth.d.ts +8 -0
  34. package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
  35. package/auth/instances/instance.remote-primary-auth.d.ts +2 -0
  36. package/auth/instances/instance.remote-primary-auth.d.ts.map +1 -1
  37. package/auth/session/session-store.factory.d.ts.map +1 -1
  38. package/browser/agent/agent.instance.mjs +16 -0
  39. package/browser/agent/agent.scope.mjs +9 -0
  40. package/browser/agent/flows/call-agent.flow.mjs +3 -1
  41. package/browser/app/instances/app.local.instance.mjs +6 -1
  42. package/browser/app/lazy/lazy-placeholders.mjs +3 -3
  43. package/browser/auth/authorized-apps.utils.mjs +15 -0
  44. package/browser/auth/client-display-name.mjs +62 -0
  45. package/browser/auth/federated-steps.mjs +2 -0
  46. package/browser/auth/flows/oauth.authorize.flow.mjs +25 -10
  47. package/browser/auth/flows/oauth.callback.flow.mjs +29 -31
  48. package/browser/auth/flows/oauth.provider-callback.flow.mjs +83 -14
  49. package/browser/auth/flows/oauth.register.flow.mjs +5 -24
  50. package/browser/auth/flows/session.verify.flow.mjs +31 -12
  51. package/browser/auth/instances/instance.local-primary-auth.mjs +43 -10
  52. package/browser/auth/instances/instance.remote-primary-auth.mjs +15 -0
  53. package/browser/auth/session/session-store.factory.mjs +15 -36
  54. package/browser/builtin/authorities/authorities-input.mjs +12 -0
  55. package/browser/common/decorators/front-mcp.decorator.mjs +2 -1
  56. package/browser/common/decorators/http-route.decorator.mjs +4 -0
  57. package/browser/common/index.mjs +2 -2
  58. package/browser/common/interfaces/server.interface.mjs +4 -0
  59. package/browser/common/metadata/duty.metadata.mjs +29 -6
  60. package/browser/common/metadata/event.metadata.mjs +2 -1
  61. package/browser/common/metadata/front-mcp.metadata.mjs +18 -1
  62. package/browser/common/metadata/workflow.metadata.mjs +1 -0
  63. package/browser/common/tokens/front-mcp.tokens.mjs +3 -0
  64. package/browser/common/tokens/workflow.tokens.mjs +1 -0
  65. package/browser/common/types/auth/session.types.mjs +2 -0
  66. package/browser/common/types/index.mjs +1 -1
  67. package/browser/common/types/options/http/schema.mjs +14 -6
  68. package/browser/common/types/options/index.mjs +1 -1
  69. package/browser/common/types/options/redis/connection.mjs +19 -0
  70. package/browser/common/types/options/redis/index.mjs +12 -0
  71. package/browser/common/types/options/redis/schema.mjs +145 -12
  72. package/browser/common/types/options/skills-http/schema.mjs +18 -0
  73. package/browser/common/types/options/transport/schema.mjs +10 -0
  74. package/browser/common/utils/auth-info.utils.mjs +17 -3
  75. package/browser/common/utils/guard.utils.mjs +3 -2
  76. package/browser/common/utils/index.mjs +2 -1
  77. package/browser/completion/flows/complete.flow.mjs +13 -7
  78. package/browser/duty/duty.lifecycle.mjs +32 -5
  79. package/browser/duty/duty.runner.mjs +3 -1
  80. package/browser/duty/lease-holder.mjs +50 -3
  81. package/browser/duty/lease-store.mjs +9 -6
  82. package/browser/elicitation/flows/elicitation-request.flow.mjs +7 -1
  83. package/browser/elicitation/flows/elicitation-result.flow.mjs +8 -2
  84. package/browser/elicitation/questions/question-store.factory.mjs +2 -5
  85. package/browser/elicitation/store/elicitation-store.factory.mjs +11 -4
  86. package/browser/errors/browser-entry-point.errors.mjs +1 -0
  87. package/browser/errors/duty.errors.mjs +9 -0
  88. package/browser/errors/index.mjs +11 -1
  89. package/browser/errors/job.errors.mjs +29 -4
  90. package/browser/errors/mcp.error.mjs +54 -8
  91. package/browser/errors/provider.errors.mjs +18 -0
  92. package/browser/errors/transport.errors.mjs +31 -0
  93. package/browser/event/delivery/event-outbox.mjs +43 -9
  94. package/browser/event/event-gates.mjs +6 -2
  95. package/browser/event/event-scope.helper.mjs +5 -1
  96. package/browser/event/flows/event-ended.flow.mjs +9 -3
  97. package/browser/event/flows/event-poll.flow.mjs +3 -1
  98. package/browser/event/flows/event-publish.flow.mjs +1 -0
  99. package/browser/event/flows/event-subscribe.flow.mjs +2 -9
  100. package/browser/event/flows/event-unsubscribe.flow.mjs +5 -2
  101. package/browser/event/poll/event-poll-leases.mjs +4 -3
  102. package/browser/event/replay/event-replays.mjs +2 -0
  103. package/browser/event/stream/event-stream.mjs +4 -0
  104. package/browser/event/stream/event-streams.mjs +9 -6
  105. package/browser/event/subscription/event-subscription-store.factory.mjs +3 -4
  106. package/browser/event/subscription/event-subscription-termination.mjs +1 -0
  107. package/browser/event/subscription/event-subscription.store.mjs +11 -1
  108. package/browser/event/subscription/event-subscriptions.mjs +4 -1
  109. package/browser/front-mcp/front-mcp.mjs +38 -4
  110. package/browser/ha/ha-manager.mjs +2 -1
  111. package/browser/ha/ha-redis-client.mjs +22 -0
  112. package/browser/ha/heartbeat.service.mjs +2 -1
  113. package/browser/ha/index.mjs +2 -0
  114. package/browser/ha/notification-relay.mjs +11 -3
  115. package/browser/http-route/flows/http.route.flow.mjs +78 -7
  116. package/browser/http-route/http-route.table.mjs +38 -11
  117. package/browser/http-route/people-session-store.mjs +7 -6
  118. package/browser/http-route/people-sign-in.routes.mjs +44 -3
  119. package/browser/index.cjs +21320 -17819
  120. package/browser/index.mjs +10 -3
  121. package/browser/job/execution/job-execution.manager.mjs +293 -84
  122. package/browser/job/flows/execute-job.flow.mjs +6 -4
  123. package/browser/job/index.mjs +3 -1
  124. package/browser/job/job-admission.mjs +284 -2
  125. package/browser/job/job-attempt.mjs +2 -1
  126. package/browser/job/job-run-access.mjs +20 -0
  127. package/browser/job/job-scope.helper.mjs +37 -10
  128. package/browser/job/runner/detached-job.worker.mjs +71 -10
  129. package/browser/job/runner/job-runner.mjs +27 -1
  130. package/browser/job/store/job-definition-store.factory.mjs +13 -12
  131. package/browser/job/store/job-state-store.factory.mjs +14 -5
  132. package/browser/job/store/memory-job-state.store.mjs +91 -7
  133. package/browser/job/store/redis-job-state.store.mjs +39 -6
  134. package/browser/job/store/storage-job-state.store.mjs +35 -2
  135. package/browser/job/tools/cancel-job.tool.mjs +2 -2
  136. package/browser/job/tools/register-job.tool.mjs +5 -2
  137. package/browser/job/tools/remove-job.tool.mjs +9 -0
  138. package/browser/job/tools/update-job.tool.mjs +8 -0
  139. package/browser/notification/notification.service.mjs +14 -3
  140. package/browser/prompt/flows/get-prompt.flow.mjs +10 -3
  141. package/browser/prompt/flows/prompts-list.flow.mjs +7 -2
  142. package/browser/provider/borrow-providers.mjs +40 -0
  143. package/browser/provider/container-handle.mjs +10 -0
  144. package/browser/provider/create-container.mjs +25 -3
  145. package/browser/provider/provider.registry.mjs +43 -6
  146. package/browser/remote-mcp/remote-oauth.mjs +43 -13
  147. package/browser/resource/flows/read-resource.flow.mjs +15 -4
  148. package/browser/resource/flows/resource-templates-list.flow.mjs +7 -2
  149. package/browser/resource/flows/resources-list.flow.mjs +7 -2
  150. package/browser/resource/flows/subscribe-resource.flow.mjs +21 -5
  151. package/browser/resource/materialized/materialized-resources.mjs +53 -23
  152. package/browser/resource/materialized/resource-store.mjs +97 -26
  153. package/browser/resource/resource.events.mjs +12 -1
  154. package/browser/resource/resource.registry.mjs +66 -8
  155. package/browser/scope/flows/http.request.flow.mjs +52 -3
  156. package/browser/scope/scope.instance.mjs +12 -14
  157. package/browser/server/custom-routes.helper.mjs +57 -6
  158. package/browser/server/security/resolve-allowed-hosts.mjs +26 -2
  159. package/browser/server/security/same-origin.mjs +5 -5
  160. package/browser/server/server.instance.mjs +56 -3
  161. package/browser/skill/cache/skill-http-cache.catalog.mjs +7 -6
  162. package/browser/skill/cache/skill-http-cache.factory.mjs +16 -19
  163. package/browser/skill/cache/skill-http-cache.mjs +14 -4
  164. package/browser/skill/flows/http/llm-full-txt.flow.mjs +16 -5
  165. package/browser/skill/flows/http/llm-txt.flow.mjs +1 -0
  166. package/browser/skill/flows/http/skills-api.flow.mjs +6 -5
  167. package/browser/skill/flows/load-skill.flow.mjs +9 -4
  168. package/browser/skill/skill-filter.helper.mjs +41 -4
  169. package/browser/skill/skill-http.utils.mjs +8 -8
  170. package/browser/surface/entry-enabled.mjs +22 -6
  171. package/browser/surface/index.mjs +8 -2
  172. package/browser/surface/live-surface.mjs +63 -3
  173. package/browser/task/helpers/task-run-context.mjs +12 -0
  174. package/browser/task/helpers/task-runner.mjs +2 -0
  175. package/browser/task/store/storage-task.store.mjs +1 -4
  176. package/browser/task/store/task-store.factory.mjs +2 -3
  177. package/browser/task/task.types.mjs +2 -0
  178. package/browser/tool/flows/call-tool.flow.mjs +56 -17
  179. package/browser/tool/flows/tools-list.flow.mjs +2 -2
  180. package/browser/tool/ui/ui-shared.mjs +5 -1
  181. package/browser/tool/ui/widget-enabled.mjs +11 -0
  182. package/browser/tool/undeclared-arguments-message.mjs +7 -5
  183. package/browser/tool/undeclared-arguments.mjs +8 -1
  184. package/browser/transport/adapters/streamable-http-transport.mjs +4 -0
  185. package/browser/transport/adapters/transport.local.adapter.mjs +26 -21
  186. package/browser/transport/adapters/transport.sse.adapter.mjs +15 -2
  187. package/browser/transport/adapters/transport.streamable-http.adapter.mjs +7 -1
  188. package/browser/transport/bus/redis-transport-bus.mjs +83 -28
  189. package/browser/transport/channel-signature.mjs +40 -0
  190. package/browser/transport/event-stores/redis.event-store.mjs +14 -27
  191. package/browser/transport/flows/handle.mcp-20260728.flow.mjs +4 -3
  192. package/browser/transport/flows/handle.streamable-http.flow.mjs +17 -10
  193. package/browser/transport/mcp-20260728/client/index.mjs +1 -1
  194. package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +77 -15
  195. package/browser/transport/mcp-20260728/index.mjs +1 -1
  196. package/browser/transport/mcp-20260728/result-decorator.mjs +14 -7
  197. package/browser/transport/mcp-20260728/subscriptions.mjs +27 -7
  198. package/browser/transport/mcp-handlers/index.mjs +11 -2
  199. package/browser/transport/relay/relay-scope.helper.mjs +34 -6
  200. package/browser/transport/session-end-channel.mjs +199 -0
  201. package/browser/transport/transport.local.mjs +3 -0
  202. package/browser/transport/transport.registry.mjs +352 -21
  203. package/browser/transport/web-fetch-handler.mjs +64 -4
  204. package/browser/utils/same-origin-fetch.utils.mjs +33 -0
  205. package/browser/work/index.mjs +13 -0
  206. package/browser/work/work-spans.mjs +55 -0
  207. package/browser/worker/worker.lifecycle.mjs +3 -1
  208. package/browser/workflow/engine/workflow-step.executor.mjs +32 -12
  209. package/browser/workflow/engine/workflow.engine.mjs +5 -0
  210. package/browser/workflow/tools/register-workflow.tool.mjs +5 -2
  211. package/browser/workflow/tools/remove-workflow.tool.mjs +9 -0
  212. package/browser/workflow/tools/update-workflow.tool.mjs +8 -0
  213. package/builtin/authorities/authorities-input.d.ts +3 -0
  214. package/builtin/authorities/authorities-input.d.ts.map +1 -0
  215. package/common/decorators/front-mcp.decorator.d.ts.map +1 -1
  216. package/common/decorators/http-route.decorator.d.ts.map +1 -1
  217. package/common/entries/scope.entry.d.ts +3 -0
  218. package/common/entries/scope.entry.d.ts.map +1 -1
  219. package/common/interfaces/server.interface.d.ts +2 -0
  220. package/common/interfaces/server.interface.d.ts.map +1 -1
  221. package/common/metadata/agent.metadata.d.ts +2 -2
  222. package/common/metadata/app.metadata.d.ts +500 -52
  223. package/common/metadata/app.metadata.d.ts.map +1 -1
  224. package/common/metadata/duty.metadata.d.ts +41 -11
  225. package/common/metadata/duty.metadata.d.ts.map +1 -1
  226. package/common/metadata/enabled.metadata.d.ts +32 -0
  227. package/common/metadata/enabled.metadata.d.ts.map +1 -1
  228. package/common/metadata/event.metadata.d.ts +146 -0
  229. package/common/metadata/event.metadata.d.ts.map +1 -1
  230. package/common/metadata/front-mcp.metadata.d.ts +9457 -348
  231. package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
  232. package/common/metadata/http-route.metadata.d.ts +7 -0
  233. package/common/metadata/http-route.metadata.d.ts.map +1 -1
  234. package/common/metadata/job.metadata.d.ts +1 -1
  235. package/common/metadata/output-policy.d.ts +1 -1
  236. package/common/metadata/plugin.metadata.d.ts +2 -2
  237. package/common/metadata/tool.metadata.d.ts +1 -1
  238. package/common/metadata/worker.metadata.d.ts +4 -4
  239. package/common/metadata/workflow.metadata.d.ts +15 -1
  240. package/common/metadata/workflow.metadata.d.ts.map +1 -1
  241. package/common/records/job.record.d.ts +6 -0
  242. package/common/records/job.record.d.ts.map +1 -1
  243. package/common/records/workflow.record.d.ts +6 -0
  244. package/common/records/workflow.record.d.ts.map +1 -1
  245. package/common/schemas/annotated-class.schema.d.ts +1 -1
  246. package/common/schemas/http-output.schema.d.ts +24 -24
  247. package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
  248. package/common/tokens/workflow.tokens.d.ts +1 -0
  249. package/common/tokens/workflow.tokens.d.ts.map +1 -1
  250. package/common/types/auth/session.types.d.ts +12 -1
  251. package/common/types/auth/session.types.d.ts.map +1 -1
  252. package/common/types/options/elicitation/schema.d.ts +137 -0
  253. package/common/types/options/elicitation/schema.d.ts.map +1 -1
  254. package/common/types/options/http/interfaces.d.ts +41 -4
  255. package/common/types/options/http/interfaces.d.ts.map +1 -1
  256. package/common/types/options/http/schema.d.ts +5 -2
  257. package/common/types/options/http/schema.d.ts.map +1 -1
  258. package/common/types/options/redis/connection.d.ts +18 -0
  259. package/common/types/options/redis/connection.d.ts.map +1 -0
  260. package/common/types/options/redis/index.d.ts +7 -3
  261. package/common/types/options/redis/index.d.ts.map +1 -1
  262. package/common/types/options/redis/interfaces.d.ts +54 -2
  263. package/common/types/options/redis/interfaces.d.ts.map +1 -1
  264. package/common/types/options/redis/schema.d.ts +412 -2
  265. package/common/types/options/redis/schema.d.ts.map +1 -1
  266. package/common/types/options/skills-http/interfaces.d.ts +7 -0
  267. package/common/types/options/skills-http/interfaces.d.ts.map +1 -1
  268. package/common/types/options/skills-http/schema.d.ts +19 -0
  269. package/common/types/options/skills-http/schema.d.ts.map +1 -1
  270. package/common/types/options/transport/index.d.ts +1 -1
  271. package/common/types/options/transport/index.d.ts.map +1 -1
  272. package/common/types/options/transport/interfaces.d.ts +32 -0
  273. package/common/types/options/transport/interfaces.d.ts.map +1 -1
  274. package/common/types/options/transport/schema.d.ts +548 -0
  275. package/common/types/options/transport/schema.d.ts.map +1 -1
  276. package/common/utils/auth-info.utils.d.ts +29 -1
  277. package/common/utils/auth-info.utils.d.ts.map +1 -1
  278. package/common/utils/guard.utils.d.ts +6 -3
  279. package/common/utils/guard.utils.d.ts.map +1 -1
  280. package/common/utils/index.d.ts +1 -0
  281. package/common/utils/index.d.ts.map +1 -1
  282. package/completion/flows/complete.flow.d.ts +5 -1
  283. package/completion/flows/complete.flow.d.ts.map +1 -1
  284. package/context/frontmcp-context.provider.d.ts +1 -1
  285. package/direct/direct.types.d.ts +4 -4
  286. package/direct/direct.types.d.ts.map +1 -1
  287. package/duty/duty.lifecycle.d.ts +1 -1
  288. package/duty/duty.lifecycle.d.ts.map +1 -1
  289. package/duty/duty.runner.d.ts +6 -1
  290. package/duty/duty.runner.d.ts.map +1 -1
  291. package/duty/lease-holder.d.ts +26 -3
  292. package/duty/lease-holder.d.ts.map +1 -1
  293. package/duty/lease-store.d.ts +2 -0
  294. package/duty/lease-store.d.ts.map +1 -1
  295. package/elicitation/elicitation.types.d.ts +2 -0
  296. package/elicitation/elicitation.types.d.ts.map +1 -1
  297. package/elicitation/flows/elicitation-request.flow.d.ts +2 -0
  298. package/elicitation/flows/elicitation-request.flow.d.ts.map +1 -1
  299. package/elicitation/flows/elicitation-result.flow.d.ts +3 -1
  300. package/elicitation/flows/elicitation-result.flow.d.ts.map +1 -1
  301. package/elicitation/questions/question-store.factory.d.ts.map +1 -1
  302. package/elicitation/store/elicitation-store.factory.d.ts.map +1 -1
  303. package/elicitation/store/elicitation.store.d.ts +2 -0
  304. package/elicitation/store/elicitation.store.d.ts.map +1 -1
  305. package/errors/browser-entry-point.errors.d.ts +1 -0
  306. package/errors/browser-entry-point.errors.d.ts.map +1 -1
  307. package/errors/duty.errors.d.ts +4 -0
  308. package/errors/duty.errors.d.ts.map +1 -1
  309. package/errors/index.d.ts +3 -3
  310. package/errors/index.d.ts.map +1 -1
  311. package/errors/job.errors.d.ts +22 -4
  312. package/errors/job.errors.d.ts.map +1 -1
  313. package/errors/mcp.error.d.ts +11 -1
  314. package/errors/mcp.error.d.ts.map +1 -1
  315. package/errors/provider.errors.d.ts +11 -0
  316. package/errors/provider.errors.d.ts.map +1 -1
  317. package/errors/transport.errors.d.ts +29 -0
  318. package/errors/transport.errors.d.ts.map +1 -1
  319. package/esm/index.mjs +56 -51
  320. package/event/delivery/event-outbox.d.ts +15 -2
  321. package/event/delivery/event-outbox.d.ts.map +1 -1
  322. package/event/event-gates.d.ts +6 -1
  323. package/event/event-gates.d.ts.map +1 -1
  324. package/event/event-scope.helper.d.ts.map +1 -1
  325. package/event/flows/event-ended.flow.d.ts +4 -3
  326. package/event/flows/event-ended.flow.d.ts.map +1 -1
  327. package/event/flows/event-poll.flow.d.ts.map +1 -1
  328. package/event/flows/event-publish-http.flow.d.ts +1 -1
  329. package/event/flows/event-publish.flow.d.ts.map +1 -1
  330. package/event/flows/event-subscribe.flow.d.ts.map +1 -1
  331. package/event/flows/event-unsubscribe.flow.d.ts +2 -2
  332. package/event/flows/event-unsubscribe.flow.d.ts.map +1 -1
  333. package/event/index.d.ts +1 -1
  334. package/event/index.d.ts.map +1 -1
  335. package/event/poll/event-poll-leases.d.ts +4 -2
  336. package/event/poll/event-poll-leases.d.ts.map +1 -1
  337. package/event/replay/event-replays.d.ts.map +1 -1
  338. package/event/stream/event-stream.d.ts +2 -0
  339. package/event/stream/event-stream.d.ts.map +1 -1
  340. package/event/stream/event-streams.d.ts +5 -2
  341. package/event/stream/event-streams.d.ts.map +1 -1
  342. package/event/subscription/event-subscription-store.factory.d.ts.map +1 -1
  343. package/event/subscription/event-subscription-termination.d.ts.map +1 -1
  344. package/event/subscription/event-subscription.store.d.ts +6 -0
  345. package/event/subscription/event-subscription.store.d.ts.map +1 -1
  346. package/event/subscription/event-subscriptions.d.ts +4 -4
  347. package/event/subscription/event-subscriptions.d.ts.map +1 -1
  348. package/front-mcp/front-mcp.d.ts +7 -2
  349. package/front-mcp/front-mcp.d.ts.map +1 -1
  350. package/ha/ha-manager.d.ts.map +1 -1
  351. package/ha/ha-redis-client.d.ts +16 -0
  352. package/ha/ha-redis-client.d.ts.map +1 -0
  353. package/ha/heartbeat.service.d.ts +4 -2
  354. package/ha/heartbeat.service.d.ts.map +1 -1
  355. package/ha/index.d.ts +2 -1
  356. package/ha/index.d.ts.map +1 -1
  357. package/ha/notification-relay.d.ts +8 -3
  358. package/ha/notification-relay.d.ts.map +1 -1
  359. package/ha/relay-messages.d.ts +23 -4
  360. package/ha/relay-messages.d.ts.map +1 -1
  361. package/http-route/flows/http.route.flow.d.ts +15 -4
  362. package/http-route/flows/http.route.flow.d.ts.map +1 -1
  363. package/http-route/http-route.table.d.ts +5 -1
  364. package/http-route/http-route.table.d.ts.map +1 -1
  365. package/http-route/people-session-store.d.ts +4 -2
  366. package/http-route/people-session-store.d.ts.map +1 -1
  367. package/http-route/people-sign-in.routes.d.ts +10 -0
  368. package/http-route/people-sign-in.routes.d.ts.map +1 -1
  369. package/index.d.ts +15 -14
  370. package/index.d.ts.map +1 -1
  371. package/index.js +62 -57
  372. package/job/execution/job-execution.manager.d.ts +73 -7
  373. package/job/execution/job-execution.manager.d.ts.map +1 -1
  374. package/job/flows/execute-job.flow.d.ts.map +1 -1
  375. package/job/index.d.ts +2 -2
  376. package/job/index.d.ts.map +1 -1
  377. package/job/job-admission.d.ts +81 -2
  378. package/job/job-admission.d.ts.map +1 -1
  379. package/job/job-attempt.d.ts +2 -2
  380. package/job/job-attempt.d.ts.map +1 -1
  381. package/job/job-run-access.d.ts +14 -0
  382. package/job/job-run-access.d.ts.map +1 -1
  383. package/job/job-scope.helper.d.ts +20 -0
  384. package/job/job-scope.helper.d.ts.map +1 -1
  385. package/job/runner/detached-job.worker.d.ts +9 -0
  386. package/job/runner/detached-job.worker.d.ts.map +1 -1
  387. package/job/runner/job-runner.d.ts +18 -0
  388. package/job/runner/job-runner.d.ts.map +1 -1
  389. package/job/store/job-definition-store.factory.d.ts +5 -1
  390. package/job/store/job-definition-store.factory.d.ts.map +1 -1
  391. package/job/store/job-state-store.factory.d.ts +5 -1
  392. package/job/store/job-state-store.factory.d.ts.map +1 -1
  393. package/job/store/job-state.interface.d.ts +16 -0
  394. package/job/store/job-state.interface.d.ts.map +1 -1
  395. package/job/store/memory-job-state.store.d.ts +33 -2
  396. package/job/store/memory-job-state.store.d.ts.map +1 -1
  397. package/job/store/redis-job-state.store.d.ts +13 -3
  398. package/job/store/redis-job-state.store.d.ts.map +1 -1
  399. package/job/store/storage-job-state.store.d.ts +4 -0
  400. package/job/store/storage-job-state.store.d.ts.map +1 -1
  401. package/job/tools/cancel-job.tool.d.ts.map +1 -1
  402. package/job/tools/register-job.tool.d.ts.map +1 -1
  403. package/job/tools/remove-job.tool.d.ts.map +1 -1
  404. package/job/tools/update-job.tool.d.ts.map +1 -1
  405. package/mcp-registry/flows/server-card.flow.d.ts +3 -3
  406. package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts +2 -2
  407. package/mcp-registry/flows/well-known.mcp-registry-auth.flow.d.ts +1 -1
  408. package/notification/notification.service.d.ts +5 -1
  409. package/notification/notification.service.d.ts.map +1 -1
  410. package/package.json +10 -10
  411. package/prompt/flows/get-prompt.flow.d.ts.map +1 -1
  412. package/prompt/flows/prompts-list.flow.d.ts +1 -1
  413. package/prompt/flows/prompts-list.flow.d.ts.map +1 -1
  414. package/provider/borrow-providers.d.ts +15 -0
  415. package/provider/borrow-providers.d.ts.map +1 -0
  416. package/provider/container-handle.d.ts +31 -0
  417. package/provider/container-handle.d.ts.map +1 -0
  418. package/provider/create-container.d.ts +8 -2
  419. package/provider/create-container.d.ts.map +1 -1
  420. package/provider/provider.registry.d.ts +23 -4
  421. package/provider/provider.registry.d.ts.map +1 -1
  422. package/remote-mcp/remote-oauth.d.ts +3 -1
  423. package/remote-mcp/remote-oauth.d.ts.map +1 -1
  424. package/resource/flows/read-resource.flow.d.ts.map +1 -1
  425. package/resource/flows/resource-templates-list.flow.d.ts +1 -1
  426. package/resource/flows/resource-templates-list.flow.d.ts.map +1 -1
  427. package/resource/flows/resources-list.flow.d.ts +1 -1
  428. package/resource/flows/resources-list.flow.d.ts.map +1 -1
  429. package/resource/flows/subscribe-resource.flow.d.ts +1 -0
  430. package/resource/flows/subscribe-resource.flow.d.ts.map +1 -1
  431. package/resource/materialized/materialized-resources.d.ts +15 -3
  432. package/resource/materialized/materialized-resources.d.ts.map +1 -1
  433. package/resource/materialized/resource-store.d.ts +6 -2
  434. package/resource/materialized/resource-store.d.ts.map +1 -1
  435. package/resource/resource.events.d.ts +3 -0
  436. package/resource/resource.events.d.ts.map +1 -1
  437. package/resource/resource.registry.d.ts +8 -3
  438. package/resource/resource.registry.d.ts.map +1 -1
  439. package/scope/flows/http.request.flow.d.ts +8 -1
  440. package/scope/flows/http.request.flow.d.ts.map +1 -1
  441. package/scope/scope.instance.d.ts +2 -2
  442. package/scope/scope.instance.d.ts.map +1 -1
  443. package/server/adapters/express.host.adapter.d.ts +26 -0
  444. package/server/adapters/express.host.adapter.d.ts.map +1 -1
  445. package/server/adapters/user-content.listener.d.ts +5 -1
  446. package/server/adapters/user-content.listener.d.ts.map +1 -1
  447. package/server/custom-routes.helper.d.ts +19 -2
  448. package/server/custom-routes.helper.d.ts.map +1 -1
  449. package/server/security/resolve-allowed-hosts.d.ts +16 -0
  450. package/server/security/resolve-allowed-hosts.d.ts.map +1 -1
  451. package/server/security/same-origin.d.ts +2 -1
  452. package/server/security/same-origin.d.ts.map +1 -1
  453. package/server/server.instance.d.ts +10 -0
  454. package/server/server.instance.d.ts.map +1 -1
  455. package/shared/ensure-shared-server.d.ts +9 -2
  456. package/shared/ensure-shared-server.d.ts.map +1 -1
  457. package/shared/flows/shared.drain.flow.d.ts +1 -1
  458. package/shared/flows/shared.identify.flow.d.ts +6 -2
  459. package/shared/flows/shared.identify.flow.d.ts.map +1 -1
  460. package/shared/index.d.ts.map +1 -1
  461. package/shared/shared-attach.d.ts +15 -6
  462. package/shared/shared-attach.d.ts.map +1 -1
  463. package/shared/shared-embedded.d.ts +12 -2
  464. package/shared/shared-embedded.d.ts.map +1 -1
  465. package/shared/shared-endpoint.d.ts +3 -1
  466. package/shared/shared-endpoint.d.ts.map +1 -1
  467. package/shared/shared-files.d.ts +2 -0
  468. package/shared/shared-files.d.ts.map +1 -1
  469. package/shared/shared-serve.d.ts +20 -1
  470. package/shared/shared-serve.d.ts.map +1 -1
  471. package/shared/shared-server.lifecycle.d.ts +40 -10
  472. package/shared/shared-server.lifecycle.d.ts.map +1 -1
  473. package/shared/shared-server.options.d.ts +43 -6
  474. package/shared/shared-server.options.d.ts.map +1 -1
  475. package/skill/cache/skill-http-cache.catalog.d.ts +4 -4
  476. package/skill/cache/skill-http-cache.catalog.d.ts.map +1 -1
  477. package/skill/cache/skill-http-cache.d.ts +15 -2
  478. package/skill/cache/skill-http-cache.d.ts.map +1 -1
  479. package/skill/cache/skill-http-cache.factory.d.ts +12 -0
  480. package/skill/cache/skill-http-cache.factory.d.ts.map +1 -1
  481. package/skill/flows/http/llm-full-txt.flow.d.ts +1 -1
  482. package/skill/flows/http/llm-full-txt.flow.d.ts.map +1 -1
  483. package/skill/flows/http/llm-txt.flow.d.ts +1 -1
  484. package/skill/flows/http/llm-txt.flow.d.ts.map +1 -1
  485. package/skill/flows/http/skills-api.flow.d.ts +1 -1
  486. package/skill/flows/http/skills-api.flow.d.ts.map +1 -1
  487. package/skill/flows/load-skill.flow.d.ts.map +1 -1
  488. package/skill/skill-filter.helper.d.ts +16 -0
  489. package/skill/skill-filter.helper.d.ts.map +1 -1
  490. package/skill/skill-http.utils.d.ts +7 -1
  491. package/skill/skill-http.utils.d.ts.map +1 -1
  492. package/surface/entry-enabled.d.ts +23 -6
  493. package/surface/entry-enabled.d.ts.map +1 -1
  494. package/surface/index.d.ts +2 -2
  495. package/surface/index.d.ts.map +1 -1
  496. package/surface/live-surface.d.ts +32 -7
  497. package/surface/live-surface.d.ts.map +1 -1
  498. package/task/helpers/task-run-context.d.ts +5 -0
  499. package/task/helpers/task-run-context.d.ts.map +1 -0
  500. package/task/helpers/task-runner.d.ts.map +1 -1
  501. package/task/store/storage-task.store.d.ts.map +1 -1
  502. package/task/store/task-store.factory.d.ts.map +1 -1
  503. package/task/store/task.store.d.ts +1 -1
  504. package/task/store/task.store.d.ts.map +1 -1
  505. package/task/task.types.d.ts +1 -0
  506. package/task/task.types.d.ts.map +1 -1
  507. package/tool/flows/call-tool.flow.d.ts +10 -3
  508. package/tool/flows/call-tool.flow.d.ts.map +1 -1
  509. package/tool/flows/tools-list.flow.d.ts +1 -1
  510. package/tool/flows/tools-list.flow.d.ts.map +1 -1
  511. package/tool/ui/ui-shared.d.ts +2 -0
  512. package/tool/ui/ui-shared.d.ts.map +1 -1
  513. package/tool/ui/widget-enabled.d.ts +8 -0
  514. package/tool/ui/widget-enabled.d.ts.map +1 -0
  515. package/tool/undeclared-arguments-message.d.ts.map +1 -1
  516. package/tool/undeclared-arguments.d.ts +4 -0
  517. package/tool/undeclared-arguments.d.ts.map +1 -1
  518. package/transport/adapters/streamable-http-transport.d.ts +2 -0
  519. package/transport/adapters/streamable-http-transport.d.ts.map +1 -1
  520. package/transport/adapters/transport.local.adapter.d.ts +3 -0
  521. package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
  522. package/transport/adapters/transport.sse.adapter.d.ts +3 -0
  523. package/transport/adapters/transport.sse.adapter.d.ts.map +1 -1
  524. package/transport/adapters/transport.streamable-http.adapter.d.ts +1 -0
  525. package/transport/adapters/transport.streamable-http.adapter.d.ts.map +1 -1
  526. package/transport/bus/redis-transport-bus.d.ts +25 -4
  527. package/transport/bus/redis-transport-bus.d.ts.map +1 -1
  528. package/transport/channel-signature.d.ts +16 -0
  529. package/transport/channel-signature.d.ts.map +1 -0
  530. package/transport/event-stores/redis.event-store.d.ts +1 -1
  531. package/transport/event-stores/redis.event-store.d.ts.map +1 -1
  532. package/transport/flows/handle.mcp-20260728.flow.d.ts +2 -1
  533. package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
  534. package/transport/flows/handle.streamable-http.flow.d.ts +1 -1
  535. package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
  536. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +8 -0
  537. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -1
  538. package/transport/mcp-20260728/result-decorator.d.ts +4 -2
  539. package/transport/mcp-20260728/result-decorator.d.ts.map +1 -1
  540. package/transport/mcp-20260728/subscriptions.d.ts +2 -0
  541. package/transport/mcp-20260728/subscriptions.d.ts.map +1 -1
  542. package/transport/mcp-handlers/index.d.ts +5 -3
  543. package/transport/mcp-handlers/index.d.ts.map +1 -1
  544. package/transport/relay/relay-scope.helper.d.ts +2 -2
  545. package/transport/relay/relay-scope.helper.d.ts.map +1 -1
  546. package/transport/session-end-channel.d.ts +81 -0
  547. package/transport/session-end-channel.d.ts.map +1 -0
  548. package/transport/transport.local.d.ts +2 -1
  549. package/transport/transport.local.d.ts.map +1 -1
  550. package/transport/transport.registry.d.ts +73 -2
  551. package/transport/transport.registry.d.ts.map +1 -1
  552. package/transport/transport.types.d.ts +6 -1
  553. package/transport/transport.types.d.ts.map +1 -1
  554. package/transport/web-fetch-handler.d.ts.map +1 -1
  555. package/utils/same-origin-fetch.utils.d.ts +5 -0
  556. package/utils/same-origin-fetch.utils.d.ts.map +1 -0
  557. package/work/index.d.ts +2 -0
  558. package/work/index.d.ts.map +1 -0
  559. package/work/work-spans.d.ts +42 -0
  560. package/work/work-spans.d.ts.map +1 -0
  561. package/worker/worker.lifecycle.d.ts.map +1 -1
  562. package/workflow/engine/workflow-step.executor.d.ts +10 -3
  563. package/workflow/engine/workflow-step.executor.d.ts.map +1 -1
  564. package/workflow/engine/workflow.engine.d.ts +2 -0
  565. package/workflow/engine/workflow.engine.d.ts.map +1 -1
  566. package/workflow/tools/register-workflow.tool.d.ts.map +1 -1
  567. package/workflow/tools/remove-workflow.tool.d.ts.map +1 -1
  568. 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,6 +206,8 @@ import {
203
206
  TransportServiceNotAvailableError,
204
207
  SessionClaimConflictError,
205
208
  SessionOwnerUnreachableError,
209
+ SessionEndUnconfirmedError,
210
+ SessionLimitReachedError,
206
211
  UnsafeSocketDirectoryError,
207
212
  SocketInUseError,
208
213
  SocketPathConflictError,
@@ -282,7 +287,7 @@ import {
282
287
  DynamicJobDirectExecutionError,
283
288
  CallRecorderConfigurationError
284
289
  } from "./sdk.errors.mjs";
285
- 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";
286
291
  export { DuplicatePluginEntryError, DuplicatePluginError, PluginConfiguredTwiceError, UnenforcedMetadataError } from "./plugin.errors.mjs";
287
292
  export { InvalidToolUiConfigError, ToolUiConfigurationError } from "./tool-ui.errors.mjs";
288
293
  export {
@@ -307,12 +312,15 @@ export {
307
312
  CallRecorderConfigurationError,
308
313
  ClusterScopeNeedsRedisError,
309
314
  ConfigNotFoundError,
315
+ ContainerDisposedError,
316
+ ContainerProviderScopeError,
310
317
  ContextExtensionNotAvailableError,
311
318
  CredentialProviderAlreadyRegisteredError,
312
319
  CrossOriginRequestError,
313
320
  DependencyCycleError,
314
321
  DependencyNotFoundError,
315
322
  DuplicateAppIdError,
323
+ DutyLeaseKeyError,
316
324
  DutyNameConflictError,
317
325
  DynamicAdapterNameError,
318
326
  DynamicJobDirectExecutionError,
@@ -460,8 +468,10 @@ export {
460
468
  ServerNotFoundError,
461
469
  ServerlessHandlerNotInitializedError,
462
470
  SessionClaimConflictError,
471
+ SessionEndUnconfirmedError,
463
472
  SessionIdEmptyError,
464
473
  SessionIdentityRequiredError,
474
+ SessionLimitReachedError,
465
475
  SessionMissingError,
466
476
  SessionOwnerUnreachableError,
467
477
  SessionSecretRequiredError,
@@ -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
@@ -321,22 +321,66 @@ var InvalidResourceUriError = class extends PublicMcpError {
321
321
  super(`Invalid resource URI: ${uri}${reason ? ` (${reason})` : ""}`, "INVALID_RESOURCE_URI", 400);
322
322
  }
323
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
+ }
324
356
  var InvalidInputError = class extends PublicMcpError {
325
357
  validationErrors;
358
+ /** How many issues past {@link MAX_REPORTED_VALIDATION_ISSUES} were left out of `validationErrors`. */
359
+ omittedValidationErrors = 0;
326
360
  constructor(message = "Invalid input: validation failed", validationErrors) {
327
361
  super(message, "INVALID_INPUT", 400);
328
- 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}`;
329
378
  }
330
379
  getInternalMessage() {
331
- return this.message + (this.validationErrors ? `
332
- Details: ${JSON.stringify(this.validationErrors, null, 2)}` : "");
380
+ return this.message + this.detailsText();
333
381
  }
334
382
  getPublicMessage() {
335
- if (this.validationErrors) {
336
- return `${this.message}
337
- Details: ${JSON.stringify(this.validationErrors, null, 2)}`;
338
- }
339
- return this.message;
383
+ return this.message + this.detailsText();
340
384
  }
341
385
  };
342
386
  var InvalidOutputError = class extends InternalMcpError {
@@ -672,6 +716,8 @@ export {
672
716
  InvalidPluginScopeError,
673
717
  InvalidResourceStoreError,
674
718
  InvalidResourceUriError,
719
+ MAX_REPORTED_VALIDATION_ISSUES,
720
+ MAX_VALIDATION_DETAILS_CHARS,
675
721
  MCP_ERROR_CODES,
676
722
  McpError,
677
723
  PayloadTooLargeError,
@@ -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
  }
@@ -103,6 +132,8 @@ export {
103
132
  InvalidTransportSessionError,
104
133
  MethodNotImplementedError,
105
134
  SessionClaimConflictError,
135
+ SessionEndUnconfirmedError,
136
+ SessionLimitReachedError,
106
137
  SessionOwnerUnreachableError,
107
138
  SocketInUseError,
108
139
  SocketPathConflictError,