@frontmcp/sdk 1.12.0 → 1.12.2

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 (328) hide show
  1. package/agent/agent.instance.d.ts +3 -0
  2. package/agent/agent.instance.d.ts.map +1 -1
  3. package/agent/agent.registry.d.ts.map +1 -1
  4. package/agent/flows/call-agent.flow.d.ts +1 -1
  5. package/agent/flows/call-agent.flow.d.ts.map +1 -1
  6. package/answer/answer-budget.d.ts.map +1 -1
  7. package/answer/client-profile.d.ts.map +1 -1
  8. package/auth/auth-ui/auth-ui.registry.d.ts.map +1 -1
  9. package/auth/auth.registry.d.ts.map +1 -1
  10. package/auth/authorized-apps.utils.d.ts +8 -0
  11. package/auth/authorized-apps.utils.d.ts.map +1 -1
  12. package/auth/flows/form-body.utils.d.ts.map +1 -1
  13. package/auth/flows/oauth.authorize.flow.d.ts +3 -1
  14. package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
  15. package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
  16. package/auth/flows/oauth.register.flow.d.ts +5 -0
  17. package/auth/flows/oauth.register.flow.d.ts.map +1 -1
  18. package/auth/flows/oauth.token.flow.d.ts +3 -2
  19. package/auth/flows/oauth.token.flow.d.ts.map +1 -1
  20. package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
  21. package/auth/session/session-store.factory.d.ts.map +1 -1
  22. package/browser/agent/agent.instance.mjs +4 -0
  23. package/browser/agent/agent.registry.mjs +2 -2
  24. package/browser/agent/flows/call-agent.flow.mjs +10 -6
  25. package/browser/answer/answer-budget.mjs +35 -7
  26. package/browser/answer/client-profile.mjs +3 -3
  27. package/browser/auth/auth-ui/auth-ui.registry.mjs +8 -0
  28. package/browser/auth/auth.registry.mjs +4 -0
  29. package/browser/auth/authorized-apps.utils.mjs +5 -0
  30. package/browser/auth/flows/form-body.utils.mjs +4 -2
  31. package/browser/auth/flows/oauth.authorize.flow.mjs +38 -6
  32. package/browser/auth/flows/oauth.callback.flow.mjs +30 -16
  33. package/browser/auth/flows/oauth.register.flow.mjs +17 -5
  34. package/browser/auth/flows/oauth.token.flow.mjs +17 -8
  35. package/browser/auth/instances/instance.local-primary-auth.mjs +11 -2
  36. package/browser/auth/session/session-store.factory.mjs +5 -1
  37. package/browser/builtin/authorities/authorities-not-configured.mjs +5 -0
  38. package/browser/channel/channel-notification.service.mjs +16 -12
  39. package/browser/channel/channel.instance.mjs +9 -12
  40. package/browser/channel/channel.utils.mjs +18 -3
  41. package/browser/channel/flows/send-channel-notification.flow.mjs +4 -2
  42. package/browser/common/metadata/app.metadata.mjs +2 -1
  43. package/browser/common/metadata/event.metadata.mjs +10 -10
  44. package/browser/common/schemas/http-output.schema.mjs +6 -1
  45. package/browser/common/types/options/metrics/schema.mjs +2 -1
  46. package/browser/common/utils/content-disposition.utils.mjs +7 -0
  47. package/browser/common/utils/forward-headers.utils.mjs +5 -5
  48. package/browser/common/utils/issuer-subject.utils.mjs +17 -0
  49. package/browser/completion/flows/complete.flow.mjs +9 -1
  50. package/browser/context/frontmcp-context.mjs +5 -1
  51. package/browser/direct/connect.mjs +14 -4
  52. package/browser/direct/direct-server.mjs +3 -1
  53. package/browser/duty/duty.lifecycle.mjs +5 -3
  54. package/browser/duty/lease-store.mjs +6 -2
  55. package/browser/elicitation/flows/elicitation-request.flow.mjs +3 -2
  56. package/browser/elicitation/flows/elicitation-result.flow.mjs +5 -4
  57. package/browser/elicitation/questions/question-scope.helper.mjs +4 -2
  58. package/browser/elicitation/store/elicitation-store.factory.mjs +17 -9
  59. package/browser/elicitation/store/encrypted-elicitation.store.mjs +1 -1
  60. package/browser/elicitation/store/storage-elicitation.store.mjs +83 -63
  61. package/browser/errors/error-handler.mjs +4 -4
  62. package/browser/errors/event.errors.mjs +3 -1
  63. package/browser/errors/misconfiguration.mjs +7 -1
  64. package/browser/errors/transport.errors.mjs +1 -1
  65. package/browser/esm-loader/esm-cache.mjs +5 -1
  66. package/browser/esm-loader/esm-module-loader.mjs +6 -6
  67. package/browser/esm-loader/version-resolver.mjs +1 -1
  68. package/browser/event/event-scope.helper.mjs +13 -5
  69. package/browser/event/flows/event-poll.flow.mjs +1 -1
  70. package/browser/event/flows/event-publish-http.flow.mjs +24 -4
  71. package/browser/event/flows/event-stream.flow.mjs +1 -1
  72. package/browser/ext-apps/ext-apps.handler.mjs +26 -14
  73. package/browser/flows/flow.registry.mjs +2 -1
  74. package/browser/front-mcp/authorities-rules.check.mjs +16 -0
  75. package/browser/front-mcp/front-mcp.mjs +8 -2
  76. package/browser/index.cjs +2064 -1344
  77. package/browser/job/execution/job-execution.manager.mjs +5 -5
  78. package/browser/job/job-permission.guard.mjs +7 -0
  79. package/browser/job/job-run-access.mjs +12 -2
  80. package/browser/job/tools/list-jobs.tool.mjs +2 -7
  81. package/browser/job/tools/remove-job.tool.mjs +6 -0
  82. package/browser/job/tools/update-job.tool.mjs +3 -0
  83. package/browser/logger/instances/instance.console-logger.mjs +14 -4
  84. package/browser/logger/instances/instance.file-logger.mjs +3 -2
  85. package/browser/logger/session-id-hash.mjs +8 -0
  86. package/browser/metrics/metrics.service.mjs +2 -1
  87. package/browser/offload/offload-worker.globals.mjs +3 -3
  88. package/browser/offload/worker-jobs.mjs +9 -2
  89. package/browser/offload/worker-resources.mjs +7 -1
  90. package/browser/plugin/enforced-metadata.check.mjs +24 -7
  91. package/browser/prompt/flows/get-prompt.flow.mjs +10 -3
  92. package/browser/prompt/flows/prompts-list.flow.mjs +1 -1
  93. package/browser/provider/provider.registry.mjs +21 -10
  94. package/browser/remote-mcp/mcp-client.service.mjs +4 -3
  95. package/browser/remote-mcp/remote-entries.mjs +15 -1
  96. package/browser/remote-mcp/remote-oauth.mjs +29 -2
  97. package/browser/resource/flows/read-resource.flow.mjs +23 -13
  98. package/browser/resource/flows/resource-templates-list.flow.mjs +1 -1
  99. package/browser/resource/flows/resources-list.flow.mjs +1 -1
  100. package/browser/resource/flows/subscribe-resource.flow.mjs +9 -1
  101. package/browser/resource/resource.instance.mjs +10 -1
  102. package/browser/scope/flows/http.request.flow.mjs +15 -3
  103. package/browser/scope/optional-dependency.util.mjs +1 -13
  104. package/browser/scope/scope.instance.mjs +39 -30
  105. package/browser/server/security/replaceable-directory.mjs +7 -2
  106. package/browser/server/security/resolve-allowed-hosts.mjs +3 -3
  107. package/browser/server/server.validation.mjs +3 -5
  108. package/browser/skill/cache/skill-http-cache.catalog.mjs +18 -0
  109. package/browser/skill/flows/http/llm-full-txt.flow.mjs +3 -2
  110. package/browser/skill/flows/http/llm-txt.flow.mjs +3 -2
  111. package/browser/skill/flows/load-skill.flow.mjs +10 -3
  112. package/browser/skill/hooks/skill-tool.hook.mjs +7 -7
  113. package/browser/skill/sep-2640/sep-2640.resource-helpers.mjs +29 -10
  114. package/browser/skill/session/skill-session.manager.mjs +32 -35
  115. package/browser/skill/session/skill-session.types.mjs +2 -0
  116. package/browser/skill/skill-authorities.helper.mjs +11 -4
  117. package/browser/skill/skill-directory-loader.mjs +15 -1
  118. package/browser/skill/skill-filter.helper.mjs +35 -7
  119. package/browser/skill/skill-md-parser.mjs +17 -2
  120. package/browser/skill/skill.instance.mjs +7 -0
  121. package/browser/storage/sqlite-on-edge.mjs +28 -0
  122. package/browser/task/store/task-store.factory.mjs +8 -3
  123. package/browser/tool/flows/call-tool.flow.mjs +29 -14
  124. package/browser/tool/flows/tools-list.flow.mjs +1 -4
  125. package/browser/transport/adapters/transport.local.adapter.mjs +3 -2
  126. package/browser/transport/event-stores/event-store.factory.mjs +5 -1
  127. package/browser/transport/event-stores/redis.event-store.mjs +13 -9
  128. package/browser/transport/flows/handle.streamable-http.flow.mjs +13 -6
  129. package/browser/transport/in-memory-server.mjs +5 -3
  130. package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +25 -6
  131. package/browser/transport/mcp-20260728/dispatcher.mjs +4 -9
  132. package/browser/transport/mcp-handlers/index.mjs +19 -1
  133. package/browser/transport/mcp-handlers/skills-list-request.handler.mjs +2 -1
  134. package/browser/transport/mcp-handlers/skills-mcp.types.mjs +3 -1
  135. package/browser/transport/web-fetch-handler.mjs +3 -3
  136. package/browser/transport/web-response.renderer.mjs +5 -4
  137. package/browser/transport/web-standard-mcp.mjs +2 -2
  138. package/browser/worker/worker.lifecycle.mjs +7 -4
  139. package/browser/workflow/tools/list-workflows.tool.mjs +6 -7
  140. package/browser/workflow/tools/register-workflow.tool.mjs +3 -2
  141. package/browser/workflow/tools/remove-workflow.tool.mjs +6 -0
  142. package/browser/workflow/tools/runtime-workflow.limits.mjs +5 -0
  143. package/browser/workflow/tools/update-workflow.tool.mjs +6 -2
  144. package/browser/workflow/trigger/workflow-webhook.routes.mjs +15 -6
  145. package/browser/workflow/trigger/workflow-webhook.signature.mjs +5 -8
  146. package/builtin/authorities/authorities-not-configured.d.ts +3 -0
  147. package/builtin/authorities/authorities-not-configured.d.ts.map +1 -0
  148. package/channel/channel-notification.service.d.ts +8 -3
  149. package/channel/channel-notification.service.d.ts.map +1 -1
  150. package/channel/channel.instance.d.ts +10 -8
  151. package/channel/channel.instance.d.ts.map +1 -1
  152. package/channel/channel.utils.d.ts +6 -1
  153. package/channel/channel.utils.d.ts.map +1 -1
  154. package/channel/flows/send-channel-notification.flow.d.ts +1 -1
  155. package/channel/flows/send-channel-notification.flow.d.ts.map +1 -1
  156. package/common/entries/channel.entry.d.ts +1 -1
  157. package/common/entries/channel.entry.d.ts.map +1 -1
  158. package/common/metadata/app.metadata.d.ts +11 -3
  159. package/common/metadata/app.metadata.d.ts.map +1 -1
  160. package/common/metadata/channel.metadata.d.ts +7 -4
  161. package/common/metadata/channel.metadata.d.ts.map +1 -1
  162. package/common/metadata/duty.metadata.d.ts +1 -1
  163. package/common/metadata/duty.metadata.d.ts.map +1 -1
  164. package/common/metadata/event.metadata.d.ts +15 -12
  165. package/common/metadata/event.metadata.d.ts.map +1 -1
  166. package/common/metadata/front-mcp.metadata.d.ts +59 -59
  167. package/common/metadata/worker.metadata.d.ts +1 -1
  168. package/common/metadata/worker.metadata.d.ts.map +1 -1
  169. package/common/schemas/http-output.schema.d.ts +1 -1
  170. package/common/schemas/http-output.schema.d.ts.map +1 -1
  171. package/common/types/options/http/interfaces.d.ts +3 -2
  172. package/common/types/options/http/interfaces.d.ts.map +1 -1
  173. package/common/types/options/metrics/interfaces.d.ts +3 -2
  174. package/common/types/options/metrics/interfaces.d.ts.map +1 -1
  175. package/common/types/options/metrics/schema.d.ts +1 -1
  176. package/common/types/options/metrics/schema.d.ts.map +1 -1
  177. package/common/utils/content-disposition.utils.d.ts +6 -0
  178. package/common/utils/content-disposition.utils.d.ts.map +1 -0
  179. package/common/utils/issuer-subject.utils.d.ts +8 -0
  180. package/common/utils/issuer-subject.utils.d.ts.map +1 -0
  181. package/completion/flows/complete.flow.d.ts.map +1 -1
  182. package/context/frontmcp-context.d.ts +5 -1
  183. package/context/frontmcp-context.d.ts.map +1 -1
  184. package/direct/connect.d.ts.map +1 -1
  185. package/direct/direct-server.d.ts.map +1 -1
  186. package/duty/duty.lifecycle.d.ts +1 -1
  187. package/duty/duty.lifecycle.d.ts.map +1 -1
  188. package/duty/lease-store.d.ts +4 -2
  189. package/duty/lease-store.d.ts.map +1 -1
  190. package/elicitation/flows/elicitation-request.flow.d.ts.map +1 -1
  191. package/elicitation/flows/elicitation-result.flow.d.ts.map +1 -1
  192. package/elicitation/questions/question-scope.helper.d.ts +4 -1
  193. package/elicitation/questions/question-scope.helper.d.ts.map +1 -1
  194. package/elicitation/store/elicitation-store.factory.d.ts.map +1 -1
  195. package/elicitation/store/elicitation.store.d.ts +8 -8
  196. package/elicitation/store/storage-elicitation.store.d.ts +11 -11
  197. package/elicitation/store/storage-elicitation.store.d.ts.map +1 -1
  198. package/errors/duty.errors.d.ts +1 -1
  199. package/errors/duty.errors.d.ts.map +1 -1
  200. package/errors/error-handler.d.ts.map +1 -1
  201. package/errors/event.errors.d.ts +9 -2
  202. package/errors/event.errors.d.ts.map +1 -1
  203. package/errors/misconfiguration.d.ts +10 -0
  204. package/errors/misconfiguration.d.ts.map +1 -1
  205. package/errors/worker.errors.d.ts +1 -1
  206. package/esm/index.mjs +63 -59
  207. package/esm-loader/esm-cache.d.ts.map +1 -1
  208. package/esm-loader/esm-module-loader.d.ts.map +1 -1
  209. package/event/event-scope.helper.d.ts.map +1 -1
  210. package/event/flows/event-publish-http.flow.d.ts +5 -2
  211. package/event/flows/event-publish-http.flow.d.ts.map +1 -1
  212. package/ext-apps/ext-apps.handler.d.ts +3 -0
  213. package/ext-apps/ext-apps.handler.d.ts.map +1 -1
  214. package/flows/flow.registry.d.ts.map +1 -1
  215. package/front-mcp/authorities-rules.check.d.ts +2 -1
  216. package/front-mcp/authorities-rules.check.d.ts.map +1 -1
  217. package/front-mcp/front-mcp.d.ts +3 -0
  218. package/front-mcp/front-mcp.d.ts.map +1 -1
  219. package/index.js +68 -64
  220. package/job/execution/job-execution.manager.d.ts.map +1 -1
  221. package/job/job-permission.guard.d.ts +2 -0
  222. package/job/job-permission.guard.d.ts.map +1 -1
  223. package/job/job-run-access.d.ts +7 -3
  224. package/job/job-run-access.d.ts.map +1 -1
  225. package/job/store/job-state.interface.d.ts +2 -0
  226. package/job/store/job-state.interface.d.ts.map +1 -1
  227. package/job/tools/list-jobs.tool.d.ts.map +1 -1
  228. package/job/tools/remove-job.tool.d.ts.map +1 -1
  229. package/job/tools/update-job.tool.d.ts.map +1 -1
  230. package/logger/instances/instance.console-logger.d.ts +1 -1
  231. package/logger/instances/instance.console-logger.d.ts.map +1 -1
  232. package/logger/instances/instance.file-logger.d.ts +2 -1
  233. package/logger/instances/instance.file-logger.d.ts.map +1 -1
  234. package/logger/session-id-hash.d.ts +3 -0
  235. package/logger/session-id-hash.d.ts.map +1 -0
  236. package/metrics/metrics.service.d.ts.map +1 -1
  237. package/offload/offload-worker.globals.d.ts +2 -2
  238. package/offload/offload-worker.globals.d.ts.map +1 -1
  239. package/offload/worker-jobs.d.ts.map +1 -1
  240. package/package.json +10 -10
  241. package/plugin/enforced-metadata.check.d.ts +3 -3
  242. package/plugin/enforced-metadata.check.d.ts.map +1 -1
  243. package/prompt/flows/get-prompt.flow.d.ts +1 -0
  244. package/prompt/flows/get-prompt.flow.d.ts.map +1 -1
  245. package/prompt/flows/prompts-list.flow.d.ts +2 -1
  246. package/prompt/flows/prompts-list.flow.d.ts.map +1 -1
  247. package/provider/provider.registry.d.ts +2 -0
  248. package/provider/provider.registry.d.ts.map +1 -1
  249. package/provider/provider.utils.d.ts +2 -2
  250. package/provider/provider.utils.d.ts.map +1 -1
  251. package/remote-mcp/mcp-client.service.d.ts.map +1 -1
  252. package/remote-mcp/mcp-client.types.d.ts +2 -0
  253. package/remote-mcp/mcp-client.types.d.ts.map +1 -1
  254. package/remote-mcp/remote-entries.d.ts.map +1 -1
  255. package/remote-mcp/remote-oauth.d.ts +4 -2
  256. package/remote-mcp/remote-oauth.d.ts.map +1 -1
  257. package/resource/flows/read-resource.flow.d.ts +1 -0
  258. package/resource/flows/read-resource.flow.d.ts.map +1 -1
  259. package/resource/flows/resource-templates-list.flow.d.ts.map +1 -1
  260. package/resource/flows/resources-list.flow.d.ts +2 -1
  261. package/resource/flows/resources-list.flow.d.ts.map +1 -1
  262. package/resource/flows/subscribe-resource.flow.d.ts.map +1 -1
  263. package/resource/resource.instance.d.ts.map +1 -1
  264. package/scope/flows/http.request.flow.d.ts +2 -0
  265. package/scope/flows/http.request.flow.d.ts.map +1 -1
  266. package/scope/optional-dependency.util.d.ts +1 -12
  267. package/scope/optional-dependency.util.d.ts.map +1 -1
  268. package/scope/scope.instance.d.ts.map +1 -1
  269. package/server/security/replaceable-directory.d.ts +4 -1
  270. package/server/security/replaceable-directory.d.ts.map +1 -1
  271. package/server/security/resolve-allowed-hosts.d.ts.map +1 -1
  272. package/server/server.validation.d.ts.map +1 -1
  273. package/shared/shared-endpoint.d.ts.map +1 -1
  274. package/skill/cache/skill-http-cache.catalog.d.ts +6 -0
  275. package/skill/cache/skill-http-cache.catalog.d.ts.map +1 -0
  276. package/skill/flows/http/llm-full-txt.flow.d.ts.map +1 -1
  277. package/skill/flows/http/llm-txt.flow.d.ts.map +1 -1
  278. package/skill/flows/load-skill.flow.d.ts.map +1 -1
  279. package/skill/hooks/skill-tool.hook.d.ts +2 -0
  280. package/skill/hooks/skill-tool.hook.d.ts.map +1 -1
  281. package/skill/sep-2640/sep-2640.resource-helpers.d.ts +5 -4
  282. package/skill/sep-2640/sep-2640.resource-helpers.d.ts.map +1 -1
  283. package/skill/session/skill-session.manager.d.ts +2 -0
  284. package/skill/session/skill-session.manager.d.ts.map +1 -1
  285. package/skill/session/skill-session.types.d.ts +6 -0
  286. package/skill/session/skill-session.types.d.ts.map +1 -1
  287. package/skill/skill-authorities.helper.d.ts +4 -5
  288. package/skill/skill-authorities.helper.d.ts.map +1 -1
  289. package/skill/skill-directory-loader.d.ts.map +1 -1
  290. package/skill/skill-filter.helper.d.ts +15 -15
  291. package/skill/skill-filter.helper.d.ts.map +1 -1
  292. package/skill/skill-md-parser.d.ts.map +1 -1
  293. package/skill/skill.instance.d.ts +5 -0
  294. package/skill/skill.instance.d.ts.map +1 -1
  295. package/storage/sqlite-on-edge.d.ts +5 -0
  296. package/storage/sqlite-on-edge.d.ts.map +1 -0
  297. package/task/store/task-store.factory.d.ts.map +1 -1
  298. package/tool/flows/call-tool.flow.d.ts +5 -2
  299. package/tool/flows/call-tool.flow.d.ts.map +1 -1
  300. package/tool/flows/tools-list.flow.d.ts +2 -1
  301. package/tool/flows/tools-list.flow.d.ts.map +1 -1
  302. package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
  303. package/transport/event-stores/event-store.factory.d.ts.map +1 -1
  304. package/transport/event-stores/redis.event-store.d.ts.map +1 -1
  305. package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
  306. package/transport/in-memory-server.d.ts.map +1 -1
  307. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +8 -2
  308. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -1
  309. package/transport/mcp-20260728/dispatcher.d.ts +3 -1
  310. package/transport/mcp-20260728/dispatcher.d.ts.map +1 -1
  311. package/transport/mcp-handlers/index.d.ts +32 -24
  312. package/transport/mcp-handlers/index.d.ts.map +1 -1
  313. package/transport/mcp-handlers/skills-list-request.handler.d.ts.map +1 -1
  314. package/transport/mcp-handlers/skills-mcp.types.d.ts +2 -0
  315. package/transport/mcp-handlers/skills-mcp.types.d.ts.map +1 -1
  316. package/transport/web-fetch-handler.d.ts +10 -8
  317. package/transport/web-fetch-handler.d.ts.map +1 -1
  318. package/transport/web-response.renderer.d.ts.map +1 -1
  319. package/worker/worker.lifecycle.d.ts +2 -2
  320. package/worker/worker.lifecycle.d.ts.map +1 -1
  321. package/workflow/tools/list-workflows.tool.d.ts.map +1 -1
  322. package/workflow/tools/register-workflow.tool.d.ts.map +1 -1
  323. package/workflow/tools/remove-workflow.tool.d.ts.map +1 -1
  324. package/workflow/tools/runtime-workflow.limits.d.ts +3 -0
  325. package/workflow/tools/runtime-workflow.limits.d.ts.map +1 -0
  326. package/workflow/tools/update-workflow.tool.d.ts.map +1 -1
  327. package/workflow/trigger/workflow-webhook.signature.d.ts +8 -5
  328. package/workflow/trigger/workflow-webhook.signature.d.ts.map +1 -1
@@ -1,5 +1,5 @@
1
1
  // libs/sdk/src/skill/sep-2640/sep-2640.resource-helpers.ts
2
- import { isAbsolute, joinPath, pathResolve, readFileBuffer } from "@frontmcp/utils";
2
+ import { isAbsolute, joinPath, pathResolve, readFileBuffer, realpath } from "@frontmcp/utils";
3
3
  import { PublicMcpError, ResourceNotFoundError } from "../../errors/index.mjs";
4
4
  import { SkillBundleNotLoadedError } from "../errors/skill-bundle-not-loaded.error.mjs";
5
5
  import { findSkillCatalogSource, readySkillCatalog } from "../skill-catalog-source.mjs";
@@ -53,6 +53,9 @@ async function findAndLoadSkillByPath(scope, skillPath) {
53
53
  if (!loadResult) {
54
54
  throw new PublicMcpError(`Failed to load skill at "${skillPath}".`, "INTERNAL_ERROR", 500);
55
55
  }
56
+ if (findSkillByPath(scope, skillPath) !== entry) {
57
+ throw new ResourceNotFoundError(`skill://${skillPath}/SKILL.md`);
58
+ }
56
59
  return { loadResult, instance: entry };
57
60
  }
58
61
  async function renderSkillMd(scope, skill, authInfo) {
@@ -106,6 +109,7 @@ async function readSkillFileByPath(instance, filePath) {
106
109
  if (!baseDir) {
107
110
  throw new ResourceNotFoundError(`skill://${instance.getSkillPath()}/${filePath}`);
108
111
  }
112
+ const publishedDir = instance.getPublishedDir();
109
113
  const resources = instance.getResources();
110
114
  const candidateDirs = [
111
115
  ["references", resources?.references],
@@ -114,31 +118,41 @@ async function readSkillFileByPath(instance, filePath) {
114
118
  ["assets", resources?.assets]
115
119
  ];
116
120
  let candidatePath;
121
+ let candidateDir;
117
122
  for (const [subdir, configured] of candidateDirs) {
118
123
  if (segments[0] !== subdir) continue;
119
- const dir = configured ? isAbsolute(configured) ? configured : pathResolve(baseDir, configured) : joinPath(baseDir, subdir);
124
+ const dir = configured ? isAbsolute(configured) ? configured : pathResolve(baseDir, configured) : publishedDir ? joinPath(publishedDir, subdir) : void 0;
125
+ if (!dir) break;
120
126
  candidatePath = pathResolve(dir, ...segments.slice(1));
127
+ candidateDir = dir;
121
128
  if (!isInside(candidatePath, dir)) {
122
129
  throw new PublicMcpError(`Invalid file path "${filePath}".`, "INVALID_PARAMS", 400);
123
130
  }
124
131
  break;
125
132
  }
126
133
  if (!candidatePath) {
127
- candidatePath = pathResolve(baseDir, ...segments);
128
- if (!isInside(candidatePath, baseDir)) {
134
+ if (!publishedDir) {
135
+ throw new ResourceNotFoundError(`skill://${instance.getSkillPath()}/${filePath}`);
136
+ }
137
+ candidatePath = pathResolve(publishedDir, ...segments);
138
+ if (!isInside(candidatePath, publishedDir)) {
129
139
  throw new PublicMcpError(`Invalid file path "${filePath}".`, "INVALID_PARAMS", 400);
130
140
  }
131
141
  }
132
142
  const mimeType = guessMimeType(filePath);
143
+ const containingDir = publishedDir ?? candidateDir;
133
144
  let buffer;
134
145
  try {
135
- buffer = await readFileBuffer(candidatePath);
146
+ buffer = containingDir ? await readFileInside(candidatePath, containingDir) : void 0;
136
147
  } catch (err) {
137
148
  if (isFileMissingError(err)) {
138
149
  throw new ResourceNotFoundError(`skill://${instance.getSkillPath()}/${filePath}`);
139
150
  }
140
151
  throw err;
141
152
  }
153
+ if (buffer === void 0) {
154
+ throw new ResourceNotFoundError(`skill://${instance.getSkillPath()}/${filePath}`);
155
+ }
142
156
  if (!isTextMimeType(mimeType)) {
143
157
  const buf2 = Buffer.isBuffer(buffer) ? buffer : Buffer.from(buffer);
144
158
  return { kind: "blob", blob: buf2.toString("base64"), mimeType };
@@ -172,10 +186,11 @@ async function tryResolvedSubFile(instance, kind, tail) {
172
186
  return parseSkillMdFrontmatter(inline).body;
173
187
  }
174
188
  const absolutePath = entry.path;
175
- const resolvedPath = resolveEntryPath(instance, kind, absolutePath, filename);
176
- if (!resolvedPath) continue;
189
+ const entryFile = resolveEntryPath(instance, kind, absolutePath, filename);
190
+ if (!entryFile) continue;
177
191
  try {
178
- const buf = await readFileBuffer(resolvedPath);
192
+ const buf = entryFile.root ? await readFileInside(entryFile.filePath, entryFile.root) : await readFileBuffer(entryFile.filePath);
193
+ if (buf === void 0) continue;
179
194
  const text = (Buffer.isBuffer(buf) ? buf : Buffer.from(buf)).toString("utf-8");
180
195
  return parseSkillMdFrontmatter(text).body;
181
196
  } catch (err) {
@@ -188,7 +203,7 @@ async function tryResolvedSubFile(instance, kind, tail) {
188
203
  return void 0;
189
204
  }
190
205
  function resolveEntryPath(instance, kind, absolutePath, filename) {
191
- if (absolutePath && isAbsolute(absolutePath)) return absolutePath;
206
+ if (absolutePath && isAbsolute(absolutePath)) return { filePath: absolutePath };
192
207
  if (!filename) return void 0;
193
208
  const baseDir = instance.getBaseDir();
194
209
  const configured = instance.getResources()?.[kind];
@@ -201,7 +216,11 @@ function resolveEntryPath(instance, kind, absolutePath, filename) {
201
216
  if (!dir) return void 0;
202
217
  const resolved = pathResolve(dir, filename);
203
218
  if (!isInside(resolved, dir)) return void 0;
204
- return resolved;
219
+ return { filePath: resolved, root: instance.getPublishedDir() ?? dir };
220
+ }
221
+ async function readFileInside(filePath, root) {
222
+ const [realFile, realRoot] = await Promise.all([realpath(filePath), realpath(root)]);
223
+ return isInside(realFile, realRoot) ? readFileBuffer(realFile) : void 0;
205
224
  }
206
225
  function isFileMissingError(err) {
207
226
  if (typeof err !== "object" || err === null) return false;
@@ -1,6 +1,7 @@
1
1
  // libs/sdk/src/skill/session/skill-session.manager.ts
2
2
  import { AsyncLocalStorage, EventEmitter } from "@frontmcp/utils";
3
3
  import { SkillSessionError } from "../../errors/index.mjs";
4
+ import { sessionIdHash } from "../../logger/session-id-hash.mjs";
4
5
  import {
5
6
  createEmptySessionState
6
7
  } from "./skill-session.types.mjs";
@@ -119,6 +120,7 @@ var SkillSessionManager = class extends EventEmitter {
119
120
  } else if (session.activeSkills.size === 1) {
120
121
  session.policyMode = this.options.defaultPolicyMode;
121
122
  }
123
+ if (policy?.strictAllowlist) session.strictAllowlist = true;
122
124
  if (session.startedAt === 0) {
123
125
  session.startedAt = now;
124
126
  }
@@ -136,7 +138,7 @@ var SkillSessionManager = class extends EventEmitter {
136
138
  }
137
139
  });
138
140
  this.logger?.debug(`Skill session activated: ${skillId}`, {
139
- sessionId: session.sessionId,
141
+ sessionIdHash: sessionIdHash(session.sessionId),
140
142
  skillToolsAdded: toolNames,
141
143
  totalAllowedTools: session.allowedTools.size,
142
144
  activeSkillCount: session.activeSkills.size,
@@ -194,7 +196,7 @@ var SkillSessionManager = class extends EventEmitter {
194
196
  }
195
197
  });
196
198
  this.logger?.debug(`Skill deactivated: ${skillId}`, {
197
- sessionId: session.sessionId,
199
+ sessionIdHash: sessionIdHash(session.sessionId),
198
200
  remainingSkills: session.activeSkills.size
199
201
  });
200
202
  this.rebuildCombinedToolSets(session);
@@ -228,7 +230,7 @@ var SkillSessionManager = class extends EventEmitter {
228
230
  });
229
231
  }
230
232
  this.logger?.debug(`All skills deactivated`, {
231
- sessionId: session.sessionId,
233
+ sessionIdHash: sessionIdHash(session.sessionId),
232
234
  deactivatedSkills: skillIds,
233
235
  duration,
234
236
  toolCallCount: session.toolCallCount
@@ -250,6 +252,7 @@ var SkillSessionManager = class extends EventEmitter {
250
252
  session.approvedTools.clear();
251
253
  session.deniedTools.clear();
252
254
  session.toolCallCount = 0;
255
+ delete session.strictAllowlist;
253
256
  }
254
257
  /**
255
258
  * Check if a tool is authorized in the current session.
@@ -260,27 +263,8 @@ var SkillSessionManager = class extends EventEmitter {
260
263
  */
261
264
  checkToolAuthorization(toolName) {
262
265
  const session = this.getActiveSession();
263
- if (!session) {
264
- if (this.options.requireExplicitActivation) {
265
- return {
266
- allowed: false,
267
- reason: "no_active_skill",
268
- toolName,
269
- context: { message: "Skill must be explicitly activated" }
270
- };
271
- }
272
- return {
273
- allowed: true,
274
- reason: "no_active_skill",
275
- toolName
276
- };
277
- }
278
- if (session.activeSkills.size === 0) {
279
- return {
280
- allowed: true,
281
- reason: "no_active_skill",
282
- toolName
283
- };
266
+ if (!session || session.activeSkills.size === 0) {
267
+ return this.withoutActiveSkill(toolName);
284
268
  }
285
269
  const activeSkillIds = Array.from(session.activeSkills.keys());
286
270
  const activeSkillNames = Array.from(session.activeSkills.values()).map((s) => s.name);
@@ -306,12 +290,7 @@ var SkillSessionManager = class extends EventEmitter {
306
290
  const elapsed = Date.now() - session.startedAt;
307
291
  if (elapsed > this.options.maxSessionDuration) {
308
292
  this.deactivateSkill();
309
- return {
310
- allowed: true,
311
- reason: "no_active_skill",
312
- toolName,
313
- context: { message: "Session expired" }
314
- };
293
+ return this.withoutActiveSkill(toolName, "Session expired");
315
294
  }
316
295
  }
317
296
  if (session.deniedTools.has(toolName)) {
@@ -328,6 +307,9 @@ var SkillSessionManager = class extends EventEmitter {
328
307
  ...baseResult
329
308
  };
330
309
  }
310
+ if (session.strictAllowlist) {
311
+ return { allowed: false, reason: "not_in_allowlist", ...baseResult };
312
+ }
331
313
  if (session.approvedTools.has(toolName)) {
332
314
  return {
333
315
  allowed: true,
@@ -352,7 +334,7 @@ var SkillSessionManager = class extends EventEmitter {
352
334
  case "permissive":
353
335
  default:
354
336
  this.logger?.warn(`Tool '${toolName}' not in skill allowlist but allowed (permissive mode)`, {
355
- sessionId: session.sessionId,
337
+ sessionIdHash: sessionIdHash(session.sessionId),
356
338
  activeSkillIds
357
339
  });
358
340
  return {
@@ -363,6 +345,18 @@ var SkillSessionManager = class extends EventEmitter {
363
345
  };
364
346
  }
365
347
  }
348
+ /** The answer for a tool call made while no skill is active: refused when `requireExplicitActivation` is set. */
349
+ withoutActiveSkill(toolName, message) {
350
+ if (this.options.requireExplicitActivation) {
351
+ return {
352
+ allowed: false,
353
+ reason: "no_active_skill",
354
+ toolName,
355
+ context: { message: "Skill must be explicitly activated" }
356
+ };
357
+ }
358
+ return { allowed: true, reason: "no_active_skill", toolName, ...message && { context: { message } } };
359
+ }
366
360
  /**
367
361
  * Check if a tool is allowed without checking policy mode.
368
362
  * Simpler check for quick validation.
@@ -397,7 +391,7 @@ var SkillSessionManager = class extends EventEmitter {
397
391
  timestamp: Date.now()
398
392
  });
399
393
  this.logger?.info(`Tool dynamically approved: ${toolName}`, {
400
- sessionId: session.sessionId,
394
+ sessionIdHash: sessionIdHash(session.sessionId),
401
395
  skillId: session.activeSkillId
402
396
  });
403
397
  this.persistSession(session);
@@ -420,7 +414,7 @@ var SkillSessionManager = class extends EventEmitter {
420
414
  timestamp: Date.now()
421
415
  });
422
416
  this.logger?.info(`Tool denied: ${toolName}`, {
423
- sessionId: session.sessionId,
417
+ sessionIdHash: sessionIdHash(session.sessionId),
424
418
  skillId: session.activeSkillId
425
419
  });
426
420
  this.persistSession(session);
@@ -464,7 +458,7 @@ var SkillSessionManager = class extends EventEmitter {
464
458
  session.policyMode = mode;
465
459
  this.persistSession(session);
466
460
  this.logger?.debug(`Skill session policy mode changed to: ${mode}`, {
467
- sessionId: session.sessionId,
461
+ sessionIdHash: sessionIdHash(session.sessionId),
468
462
  skillId: session.activeSkillId
469
463
  });
470
464
  }
@@ -483,7 +477,10 @@ var SkillSessionManager = class extends EventEmitter {
483
477
  try {
484
478
  await this.store.save(session);
485
479
  } catch (error) {
486
- this.logger?.error("Failed to persist skill session", { error, sessionId: session.sessionId });
480
+ this.logger?.error("Failed to persist skill session", {
481
+ error,
482
+ sessionIdHash: sessionIdHash(session.sessionId)
483
+ });
487
484
  }
488
485
  }
489
486
  }
@@ -22,6 +22,7 @@ function serializeSessionState(state) {
22
22
  approvedTools: Array.from(state.approvedTools),
23
23
  deniedTools: Array.from(state.deniedTools),
24
24
  toolCallCount: state.toolCallCount,
25
+ strictAllowlist: state.strictAllowlist,
25
26
  metadata: state.metadata
26
27
  };
27
28
  }
@@ -48,6 +49,7 @@ function deserializeSessionState(data) {
48
49
  approvedTools: new Set(data.approvedTools),
49
50
  deniedTools: new Set(data.deniedTools),
50
51
  toolCallCount: data.toolCallCount,
52
+ strictAllowlist: data.strictAllowlist,
51
53
  metadata: data.metadata
52
54
  };
53
55
  }
@@ -1,5 +1,6 @@
1
1
  // libs/sdk/src/skill/skill-authorities.helper.ts
2
2
  import { AuthorityDeniedError, resolveRequiredScopes } from "@frontmcp/auth";
3
+ import { AUTHORITIES_NOT_CONFIGURED } from "../builtin/authorities/authorities-not-configured.mjs";
3
4
  import { isListedByAuthorities } from "../surface/entry-authorized.mjs";
4
5
  function normalizeAuthInfoForAuthorities(authInfo) {
5
6
  if (authInfo["user"]) return authInfo;
@@ -14,11 +15,17 @@ function getSkillAuthorities(skill) {
14
15
  return authorities;
15
16
  }
16
17
  async function assertSkillAuthorized(scope, skill, authInfo, input = {}) {
17
- const engine = scope.authoritiesEngine;
18
- const ctxBuilder = scope.authoritiesContextBuilder;
19
- if (!engine || !ctxBuilder) return;
20
18
  const authorities = getSkillAuthorities(skill);
21
19
  if (!authorities) return;
20
+ const engine = scope.authoritiesEngine;
21
+ const ctxBuilder = scope.authoritiesContextBuilder;
22
+ if (!engine || !ctxBuilder) {
23
+ throw new AuthorityDeniedError({
24
+ entryType: "Skill",
25
+ entryName: skill.fullName || skill.name,
26
+ deniedBy: AUTHORITIES_NOT_CONFIGURED
27
+ });
28
+ }
22
29
  const evalCtx = ctxBuilder.build(normalizeAuthInfoForAuthorities(authInfo), input);
23
30
  const result = await engine.evaluate(authorities, evalCtx);
24
31
  if (result.granted) return;
@@ -38,7 +45,7 @@ async function assertSkillAuthorized(scope, skill, authInfo, input = {}) {
38
45
  async function filterSkillsByAuthorities(scope, skills, authInfo) {
39
46
  const engine = scope.authoritiesEngine;
40
47
  const ctxBuilder = scope.authoritiesContextBuilder;
41
- if (!engine || !ctxBuilder) return [...skills];
48
+ if (!engine || !ctxBuilder) return skills.filter((skill) => !getSkillAuthorities(skill));
42
49
  const normalized = normalizeAuthInfoForAuthorities(authInfo);
43
50
  const grants = await Promise.all(
44
51
  skills.map(async (skill) => {
@@ -1,5 +1,15 @@
1
1
  // libs/sdk/src/skill/skill-directory-loader.ts
2
- import { basename, fileExists, isAbsolute, pathJoin, pathResolve, readdir, readFile, stat } from "@frontmcp/utils";
2
+ import {
3
+ basename,
4
+ fileExists,
5
+ isAbsolute,
6
+ pathJoin,
7
+ pathResolve,
8
+ readdir,
9
+ readFile,
10
+ realpath,
11
+ stat
12
+ } from "@frontmcp/utils";
3
13
  import { skillMetadataSchema } from "../common/metadata/skill.metadata.mjs";
4
14
  import { SkillKind } from "../common/records/skill.record.mjs";
5
15
  import { captureCallerDir } from "../common/utils/caller-dir.utils.mjs";
@@ -38,10 +48,14 @@ async function checkDirectory(path) {
38
48
  }
39
49
  async function findNestedSkillMd(dirPath, maxDepth = Number.POSITIVE_INFINITY) {
40
50
  const found = [];
51
+ const visited = /* @__PURE__ */ new Set();
41
52
  async function walk(current, depth, relPath) {
42
53
  if (depth > maxDepth) return;
43
54
  let entries;
44
55
  try {
56
+ const realDir = await realpath(current);
57
+ if (visited.has(realDir)) return;
58
+ visited.add(realDir);
45
59
  entries = await readdir(current);
46
60
  } catch (err) {
47
61
  if (err.code === "ENOENT") return;
@@ -1,7 +1,9 @@
1
1
  // libs/sdk/src/skill/skill-filter.helper.ts
2
+ import { isPubliclyListed, publicAccessFor } from "../auth/public-access.utils.mjs";
2
3
  import { availabilityForCall, callSurfaceOf, isOfferedOnSurface } from "../common/availability/index.mjs";
3
4
  import { getCallSurface } from "../context/call-surface.mjs";
4
- import { filterSkillsByAuthorities } from "./skill-authorities.helper.mjs";
5
+ import { isListedByAuthorities } from "../surface/entry-authorized.mjs";
6
+ import { filterSkillsByAuthorities, normalizeAuthInfoForAuthorities } from "./skill-authorities.helper.mjs";
5
7
  import { createSkillEntryResolver, skillResultId } from "./skill-entry.resolver.mjs";
6
8
  var SKILLS_HTTP_SURFACE = "mcp";
7
9
  function callerSurface(ctx, surface) {
@@ -34,14 +36,39 @@ function skillToolsForCaller(loaded, tools, ctx, surface) {
34
36
  const caller = callerSurface(ctx, surface);
35
37
  if (!tools || caller === void 0 || loaded.availableTools.length === 0) return loaded;
36
38
  const availability = new Map(tools.getTools(true).map((tool) => [tool.name, tool.metadata?.availableWhen]));
37
- const notOffered = loaded.availableTools.filter((name) => !isOfferedOnSurface(availability.get(name), caller));
38
- if (notOffered.length === 0) return loaded;
39
+ return withToolsMissing(
40
+ loaded,
41
+ loaded.availableTools.filter((name) => !isOfferedOnSurface(availability.get(name), caller))
42
+ );
43
+ }
44
+ async function skillToolsListedFor(scope, loaded, authInfo) {
45
+ const { tools, authoritiesEngine: engine, authoritiesContextBuilder: contextBuilder } = scope;
46
+ const publicAccess = publicAccessFor(scope.auth?.options, authInfo);
47
+ if (!tools || loaded.availableTools.length === 0 || !publicAccess && (!engine || !contextBuilder)) return loaded;
48
+ const toolsByName = new Map(tools.getTools(true).map((tool) => [tool.name, tool]));
49
+ const caller = normalizeAuthInfoForAuthorities(authInfo);
50
+ const listed = await Promise.all(
51
+ loaded.availableTools.map(async (name) => {
52
+ const tool = toolsByName.get(name);
53
+ if (publicAccess && !isPubliclyListed(publicAccess, "tools", [tool?.fullName ?? name, name])) return false;
54
+ const authorities = tool?.metadata?.authorities;
55
+ if (!authorities || !engine || !contextBuilder) return true;
56
+ return isListedByAuthorities(engine, contextBuilder, authorities, caller, name, scope.logger);
57
+ })
58
+ );
59
+ return withToolsMissing(
60
+ loaded,
61
+ loaded.availableTools.filter((_, index) => !listed[index])
62
+ );
63
+ }
64
+ function withToolsMissing(loaded, names) {
65
+ if (names.length === 0) return loaded;
39
66
  return {
40
67
  ...loaded,
41
- availableTools: loaded.availableTools.filter((name) => !notOffered.includes(name)),
42
- missingTools: [...loaded.missingTools, ...notOffered],
68
+ availableTools: loaded.availableTools.filter((name) => !names.includes(name)),
69
+ missingTools: [...loaded.missingTools, ...names],
43
70
  isComplete: false,
44
- warning: warningWithMissingTools(loaded.warning, loaded.skill?.name, notOffered)
71
+ warning: warningWithMissingTools(loaded.warning, loaded.skill?.name, names)
45
72
  };
46
73
  }
47
74
  var WARNING_PREFIX = /^Skill "(.*)" references /;
@@ -64,5 +91,6 @@ export {
64
91
  filterDiscoverableSkillResults,
65
92
  filterServableSkills,
66
93
  isSkillServable,
67
- skillToolsForCaller
94
+ skillToolsForCaller,
95
+ skillToolsListedFor
68
96
  };
@@ -1,6 +1,7 @@
1
1
  // libs/sdk/src/skill/skill-md-parser.ts
2
2
  import { readFile } from "@frontmcp/utils";
3
3
  import * as yaml from "../third-party/js-yaml.mjs";
4
+ import { InvalidSkillError } from "../errors/sdk.errors.mjs";
4
5
  function parseSkillMdFrontmatter(content) {
5
6
  const trimmed = content.trimStart();
6
7
  if (!trimmed.startsWith("---")) {
@@ -59,7 +60,7 @@ function skillMdFrontmatterToMetadata(frontmatter, body) {
59
60
  const specMeta = {};
60
61
  for (const [key, val] of Object.entries(meta)) {
61
62
  if (typeof val === "string") specMeta[key] = val;
62
- else specMeta[key] = JSON.stringify(val);
63
+ else specMeta[key] = metadataJson(result.name, key, val);
63
64
  }
64
65
  result.specMetadata = specMeta;
65
66
  }
@@ -147,7 +148,7 @@ function skillMdFrontmatterToMetadata(frontmatter, body) {
147
148
  for (const [key, val] of Object.entries(frontmatter)) {
148
149
  if (!knownKeys.has(key) && val !== void 0) {
149
150
  if (!result.specMetadata) result.specMetadata = {};
150
- result.specMetadata[key] = typeof val === "string" ? val : JSON.stringify(val);
151
+ result.specMetadata[key] = typeof val === "string" ? val : metadataJson(result.name, key, val);
151
152
  }
152
153
  }
153
154
  if (body.length > 0) {
@@ -155,6 +156,20 @@ function skillMdFrontmatterToMetadata(frontmatter, body) {
155
156
  }
156
157
  return result;
157
158
  }
159
+ var MAX_METADATA_JSON_LENGTH = 1e6;
160
+ function metadataJson(skillName, key, value) {
161
+ let length = 0;
162
+ return JSON.stringify(value, (name, item) => {
163
+ length += name.length + (typeof item === "string" ? item.length : 8);
164
+ if (length > MAX_METADATA_JSON_LENGTH) {
165
+ throw new InvalidSkillError(
166
+ skillName ?? "SKILL.md",
167
+ `frontmatter field "${key}" is over ${MAX_METADATA_JSON_LENGTH} characters as JSON (YAML aliases count each repeat); make it smaller`
168
+ );
169
+ }
170
+ return item;
171
+ });
172
+ }
158
173
  async function loadSkillMdFile(filePath, resources) {
159
174
  const content = await readFile(filePath, "utf-8");
160
175
  const { frontmatter, body } = parseSkillMdFrontmatter(content);
@@ -130,6 +130,13 @@ var SkillInstance = class extends SkillEntry {
130
130
  }
131
131
  return void 0;
132
132
  }
133
+ /**
134
+ * The directory whose files `skill://` serves as a whole: a skill directory's own. A skill declared in code has
135
+ * none, since its base directory is only where its relative paths resolve; it serves the resource directories it declares.
136
+ */
137
+ getPublishedDir() {
138
+ return this.record.kind === SkillKind.FILE ? dirname(this.record.filePath) || void 0 : void 0;
139
+ }
133
140
  async load() {
134
141
  if (this.cachedContent !== void 0) {
135
142
  return this.cachedContent;
@@ -0,0 +1,28 @@
1
+ var __frontmcpModule = typeof process !== "undefined" && typeof process.getBuiltinModule === "function" ? process.getBuiltinModule("module") : undefined;
2
+ const require = __frontmcpModule ? __frontmcpModule.createRequire(import.meta.url || 'file:///') : undefined;
3
+ // __frontmcpCreateRequire
4
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
+ }) : x)(function(x) {
7
+ if (typeof require !== "undefined") return require.apply(this, arguments);
8
+ throw Error('Dynamic require of "' + x + '" is not supported');
9
+ });
10
+
11
+ // libs/sdk/src/storage/sqlite-on-edge.ts
12
+ import { requireOptionalModule } from "../scope/optional-dependency.util.mjs";
13
+ var SQLITE_ON_EDGE_REMEDY = "In a Cloudflare Durable Object class that has one instance (the driver is set for the whole isolate), register @frontmcp/storage-sqlite with registerOptionalModule() and call useSqliteDriver(durableObjectSqlite(ctx.storage)) in its constructor.";
14
+ function hasSqliteDriver() {
15
+ try {
16
+ const sqliteStorage = requireOptionalModule(
17
+ "@frontmcp/storage-sqlite",
18
+ () => __require("@frontmcp/storage-sqlite")
19
+ );
20
+ return sqliteStorage.currentSqliteDriver() !== void 0;
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+ export {
26
+ SQLITE_ON_EDGE_REMEDY,
27
+ hasSqliteDriver
28
+ };
@@ -12,6 +12,8 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
12
12
  import { createMemoryStorage, createStorage, getEnv } from "@frontmcp/utils";
13
13
  import { isVercelKvProvider } from "../../common/index.mjs";
14
14
  import { normalizeRedisOptions } from "../../common/types/options/redis/schema.mjs";
15
+ import { requireOptionalModule } from "../../scope/optional-dependency.util.mjs";
16
+ import { hasSqliteDriver, SQLITE_ON_EDGE_REMEDY } from "../../storage/sqlite-on-edge.mjs";
15
17
  import { StorageTaskStore } from "./storage-task.store.mjs";
16
18
  import { isExplicitStorage } from "./task-backend.utils.mjs";
17
19
  import { resolvesToVercelKvTaskBackend } from "./task-backend.utils.mjs";
@@ -35,13 +37,16 @@ function detectStorageType(storage, configuredType) {
35
37
  }
36
38
  async function createTaskStore(options = {}) {
37
39
  const { storage: storageConfig, redis, keyPrefix = "mcp:task:", logger, isEdgeRuntime = false, sqlite } = options;
38
- if (isEdgeRuntime && sqlite) {
40
+ if (isEdgeRuntime && sqlite && !hasSqliteDriver()) {
39
41
  throw new TaskStoreNotSupportedError(
40
- "SQLite task store is not supported on Edge runtime (better-sqlite3 is a native module). Use Redis or Upstash."
42
+ `SQLite task store is not supported on Edge runtime without a SQLite driver (better-sqlite3 is a native module). ${SQLITE_ON_EDGE_REMEDY} Otherwise use Redis or Upstash.`
41
43
  );
42
44
  }
43
45
  if (sqlite) {
44
- const { SqliteTaskStore } = __require("@frontmcp/storage-sqlite");
46
+ const { SqliteTaskStore } = requireOptionalModule(
47
+ "@frontmcp/storage-sqlite",
48
+ () => __require("@frontmcp/storage-sqlite")
49
+ );
45
50
  const store2 = new SqliteTaskStore({
46
51
  path: sqlite.path,
47
52
  encryption: sqlite.encryption,