shadow-claw 1.29.0 → 1.30.0

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 (277) hide show
  1. package/.agents/skills/main/skill-creator/SKILL.md +3 -2
  2. package/.agents/skills/main/skill-creator/references/frontmatter-spec.md +5 -3
  3. package/.well-known/agent-skills/index.json +1 -1
  4. package/.well-known/mcp/server-card.json +1 -1
  5. package/.well-known/mcp.json +1 -1
  6. package/dist/lib/{app-routes-CqBOeA5q.js → app-routes-BAEMLu9g.js} +3 -2
  7. package/dist/lib/app-routes-BAEMLu9g.js.map +1 -0
  8. package/dist/lib/{bundler-8JNIKwOs.js → bundler-CsL7hHMq.js} +4 -9
  9. package/dist/lib/{bundler-8JNIKwOs.js.map → bundler-CsL7hHMq.js.map} +1 -1
  10. package/dist/lib/components/index.js +26 -26
  11. package/dist/lib/components/settings/shadow-claw-accounts.js +1 -1
  12. package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
  13. package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
  14. package/dist/lib/components/settings/shadow-claw-git.js +1 -1
  15. package/dist/lib/components/settings/shadow-claw-integrations.js +1 -1
  16. package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
  17. package/dist/lib/components/settings/shadow-claw-mcp-remote.js +1 -1
  18. package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
  19. package/dist/lib/components/settings/shadow-claw-notifications.js +1 -1
  20. package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
  21. package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
  22. package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
  23. package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
  24. package/dist/lib/components/shadow-claw-a2ui.js +1 -1
  25. package/dist/lib/components/shadow-claw-accounts.js +1 -1
  26. package/dist/lib/components/shadow-claw-channel-config.js +1 -1
  27. package/dist/lib/components/shadow-claw-channels.js +1 -1
  28. package/dist/lib/components/shadow-claw-chat.js +1 -1
  29. package/dist/lib/components/shadow-claw-control-plane.js +1 -1
  30. package/dist/lib/components/shadow-claw-conversations.js +1 -1
  31. package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
  32. package/dist/lib/components/shadow-claw-files.js +1 -1
  33. package/dist/lib/components/shadow-claw-git.js +1 -1
  34. package/dist/lib/components/shadow-claw-integrations.js +1 -1
  35. package/dist/lib/components/shadow-claw-llm.js +1 -1
  36. package/dist/lib/components/shadow-claw-mcp-remote.js +1 -1
  37. package/dist/lib/components/shadow-claw-networking.js +1 -1
  38. package/dist/lib/components/shadow-claw-notifications.js +1 -1
  39. package/dist/lib/components/shadow-claw-page-header.js +1 -1
  40. package/dist/lib/components/shadow-claw-pages.js +1 -1
  41. package/dist/lib/components/shadow-claw-peerjs.js +1 -1
  42. package/dist/lib/components/shadow-claw-settings.js +1 -1
  43. package/dist/lib/components/shadow-claw-storage.js +1 -1
  44. package/dist/lib/components/shadow-claw-task-server.js +1 -1
  45. package/dist/lib/components/shadow-claw-tasks.js +1 -1
  46. package/dist/lib/components/shadow-claw-terminal.js +1 -1
  47. package/dist/lib/components/shadow-claw-tools.js +1 -1
  48. package/dist/lib/components/shadow-claw-webvm.js +1 -1
  49. package/dist/lib/components/shadow-claw.js +1 -1
  50. package/dist/lib/{config--CFrw3J3.js → config-DjZ9QWc4.js} +2 -2
  51. package/dist/lib/{config--CFrw3J3.js.map → config-DjZ9QWc4.js.map} +1 -1
  52. package/dist/lib/{configurePeerJs-DG4hliKp.js → configurePeerJs-H0WaoT0w.js} +3 -3
  53. package/dist/lib/{configurePeerJs-DG4hliKp.js.map → configurePeerJs-H0WaoT0w.js.map} +1 -1
  54. package/dist/lib/{connections-DwjzwVz0.js → connections-BURqMIUv.js} +2 -2
  55. package/dist/lib/{connections-DwjzwVz0.js.map → connections-BURqMIUv.js.map} +1 -1
  56. package/dist/lib/content/markdown-links.d.ts +19 -0
  57. package/dist/lib/core/app-routes.d.ts +1 -0
  58. package/dist/lib/{downloadGroupFile-DmcBQU1n.js → downloadGroupFile-B8J4up2a.js} +2 -2
  59. package/dist/lib/{downloadGroupFile-DmcBQU1n.js.map → downloadGroupFile-B8J4up2a.js.map} +1 -1
  60. package/dist/lib/{file-viewer-C3YKnq_-.js → file-viewer-CwvhxAAG.js} +5 -5
  61. package/dist/lib/{file-viewer-C3YKnq_-.js.map → file-viewer-CwvhxAAG.js.map} +1 -1
  62. package/dist/lib/{getGroupDir-m0f-ekgX.js → getGroupDir-QrN2aTo8.js} +4 -4
  63. package/dist/lib/{getGroupDir-m0f-ekgX.js.map → getGroupDir-QrN2aTo8.js.map} +1 -1
  64. package/dist/lib/{git-C-Q6-IVe.js → git-DhZoe1SE.js} +3 -3
  65. package/dist/lib/{git-C-Q6-IVe.js.map → git-DhZoe1SE.js.map} +1 -1
  66. package/dist/lib/{iframe-sanitizer-CUqHuWQ-.js → iframe-sanitizer-Bujgq14T.js} +2 -2
  67. package/dist/lib/{iframe-sanitizer-CUqHuWQ-.js.map → iframe-sanitizer-Bujgq14T.js.map} +1 -1
  68. package/dist/lib/index.js +27 -27
  69. package/dist/lib/{initChatSplitResize-yyBTU6h9.js → initChatSplitResize-BjiWoqC_.js} +2 -2
  70. package/dist/lib/{initChatSplitResize-yyBTU6h9.js.map → initChatSplitResize-BjiWoqC_.js.map} +1 -1
  71. package/dist/lib/{initControlPlane-DnpAzphg.js → initControlPlane-C9JxQCDh.js} +16 -16
  72. package/dist/lib/{initControlPlane-DnpAzphg.js.map → initControlPlane-C9JxQCDh.js.map} +1 -1
  73. package/dist/lib/{markdown-DgdSt2GD.js → markdown-DYHmNjC4.js} +126 -5
  74. package/dist/lib/markdown-DYHmNjC4.js.map +1 -0
  75. package/dist/lib/{mcp-reconnect-C86MR3z8.js → mcp-reconnect-BxJ77WSb.js} +2 -2
  76. package/dist/lib/{mcp-reconnect-C86MR3z8.js.map → mcp-reconnect-BxJ77WSb.js.map} +1 -1
  77. package/dist/lib/{memoryStorage-UR8E8K-H.js → memoryStorage-D3FBwO9T.js} +2 -2
  78. package/dist/lib/{memoryStorage-UR8E8K-H.js.map → memoryStorage-D3FBwO9T.js.map} +1 -1
  79. package/dist/lib/{orchestrator-ClXbJ4Mb.js → orchestrator-C6dc-2OQ.js} +130 -27
  80. package/dist/lib/{orchestrator-ClXbJ4Mb.js.map → orchestrator-C6dc-2OQ.js.map} +1 -1
  81. package/dist/lib/{orchestrator-CjEau_RG.js → orchestrator-DVkyd8K9.js} +27 -17
  82. package/dist/lib/orchestrator-DVkyd8K9.js.map +1 -0
  83. package/dist/lib/{peerjs-BdfpltIe.js → peerjs-BUS9O04I.js} +274 -60
  84. package/dist/lib/peerjs-BUS9O04I.js.map +1 -0
  85. package/dist/lib/{push-client-DjwKknNg.js → push-client-4JsQGmQa.js} +3 -3
  86. package/dist/lib/{push-client-DjwKknNg.js.map → push-client-4JsQGmQa.js.map} +1 -1
  87. package/dist/lib/{readGroupFileBytes-C8oOe8Iu.js → readGroupFileBytes-CSA7u-nJ.js} +2 -2
  88. package/dist/lib/{readGroupFileBytes-C8oOe8Iu.js.map → readGroupFileBytes-CSA7u-nJ.js.map} +1 -1
  89. package/dist/lib/{shadow-claw-DcPGKenn.js → shadow-claw-BMoF8Auf.js} +11 -11
  90. package/dist/lib/{shadow-claw-DcPGKenn.js.map → shadow-claw-BMoF8Auf.js.map} +1 -1
  91. package/dist/lib/{shadow-claw-a2ui-CpZUTzlh.js → shadow-claw-a2ui-2I5nffIn.js} +2 -2
  92. package/dist/lib/{shadow-claw-a2ui-CpZUTzlh.js.map → shadow-claw-a2ui-2I5nffIn.js.map} +1 -1
  93. package/dist/lib/{shadow-claw-accounts-03oJ__XC.js → shadow-claw-accounts-BCjlgvzy.js} +3 -3
  94. package/dist/lib/{shadow-claw-accounts-03oJ__XC.js.map → shadow-claw-accounts-BCjlgvzy.js.map} +1 -1
  95. package/dist/lib/{shadow-claw-channel-config-DEL-aZ7N.js → shadow-claw-channel-config-CxQAmlDE.js} +3 -3
  96. package/dist/lib/{shadow-claw-channel-config-DEL-aZ7N.js.map → shadow-claw-channel-config-CxQAmlDE.js.map} +1 -1
  97. package/dist/lib/{shadow-claw-channels-BgaJiPdE.js → shadow-claw-channels-CuYMUVAG.js} +3 -3
  98. package/dist/lib/{shadow-claw-channels-BgaJiPdE.js.map → shadow-claw-channels-CuYMUVAG.js.map} +1 -1
  99. package/dist/lib/{shadow-claw-chat-mXPQZbwT.js → shadow-claw-chat-RFtPmmyl.js} +13 -12
  100. package/dist/lib/shadow-claw-chat-RFtPmmyl.js.map +1 -0
  101. package/dist/lib/{shadow-claw-control-plane-DO6foOLV.js → shadow-claw-control-plane-siqmRzR1.js} +7 -7
  102. package/dist/lib/{shadow-claw-control-plane-DO6foOLV.js.map → shadow-claw-control-plane-siqmRzR1.js.map} +1 -1
  103. package/dist/lib/{shadow-claw-conversations-BLwHTwdW.js → shadow-claw-conversations-DygK5y1e.js} +7 -7
  104. package/dist/lib/{shadow-claw-conversations-BLwHTwdW.js.map → shadow-claw-conversations-DygK5y1e.js.map} +1 -1
  105. package/dist/lib/{shadow-claw-file-viewer-BSbZvSl-.js → shadow-claw-file-viewer-DGMA7d7H.js} +11 -11
  106. package/dist/lib/shadow-claw-file-viewer-DGMA7d7H.js.map +1 -0
  107. package/dist/lib/{shadow-claw-files-BLVr9Pua.js → shadow-claw-files-CgD1B9J7.js} +8 -8
  108. package/dist/lib/{shadow-claw-files-BLVr9Pua.js.map → shadow-claw-files-CgD1B9J7.js.map} +1 -1
  109. package/dist/lib/{shadow-claw-git-CHC1H86J.js → shadow-claw-git-Bw1jGRrf.js} +6 -6
  110. package/dist/lib/{shadow-claw-git-CHC1H86J.js.map → shadow-claw-git-Bw1jGRrf.js.map} +1 -1
  111. package/dist/lib/{shadow-claw-integrations-Ds-CLPhj.js → shadow-claw-integrations-ChaXtvsg.js} +4 -4
  112. package/dist/lib/{shadow-claw-integrations-Ds-CLPhj.js.map → shadow-claw-integrations-ChaXtvsg.js.map} +1 -1
  113. package/dist/lib/{shadow-claw-llm-CKXfxd3D.js → shadow-claw-llm-CDM4Akjc.js} +6 -6
  114. package/dist/lib/{shadow-claw-llm-CKXfxd3D.js.map → shadow-claw-llm-CDM4Akjc.js.map} +1 -1
  115. package/dist/lib/{shadow-claw-mcp-remote-CT5Q-54E.js → shadow-claw-mcp-remote-BLxs_Z4I.js} +4 -4
  116. package/dist/lib/{shadow-claw-mcp-remote-CT5Q-54E.js.map → shadow-claw-mcp-remote-BLxs_Z4I.js.map} +1 -1
  117. package/dist/lib/{shadow-claw-networking-dpYvfchh.js → shadow-claw-networking-BYt-kMSI.js} +2 -2
  118. package/dist/lib/{shadow-claw-networking-dpYvfchh.js.map → shadow-claw-networking-BYt-kMSI.js.map} +1 -1
  119. package/dist/lib/{shadow-claw-notifications-_YeAVPga.js → shadow-claw-notifications-Dpe4EtZI.js} +3 -3
  120. package/dist/lib/{shadow-claw-notifications-_YeAVPga.js.map → shadow-claw-notifications-Dpe4EtZI.js.map} +1 -1
  121. package/dist/lib/{shadow-claw-page-header-Cti2fzf-.js → shadow-claw-page-header-P4EvWyUr.js} +2 -2
  122. package/dist/lib/{shadow-claw-page-header-Cti2fzf-.js.map → shadow-claw-page-header-P4EvWyUr.js.map} +1 -1
  123. package/dist/lib/{shadow-claw-pages-DVzZriZ7.js → shadow-claw-pages-DWd_c4d6.js} +10 -10
  124. package/dist/lib/{shadow-claw-pages-DVzZriZ7.js.map → shadow-claw-pages-DWd_c4d6.js.map} +1 -1
  125. package/dist/lib/{shadow-claw-peerjs-BvixjeBz.js → shadow-claw-peerjs-D928817m.js} +3 -3
  126. package/dist/lib/{shadow-claw-peerjs-BvixjeBz.js.map → shadow-claw-peerjs-D928817m.js.map} +1 -1
  127. package/dist/lib/{shadow-claw-settings-DV9-gD4Q.js → shadow-claw-settings-C8OPrSqs.js} +8 -8
  128. package/dist/lib/{shadow-claw-settings-DV9-gD4Q.js.map → shadow-claw-settings-C8OPrSqs.js.map} +1 -1
  129. package/dist/lib/{shadow-claw-storage-Bv__kXG6.js → shadow-claw-storage-CZ2uZJNw.js} +5 -5
  130. package/dist/lib/{shadow-claw-storage-Bv__kXG6.js.map → shadow-claw-storage-CZ2uZJNw.js.map} +1 -1
  131. package/dist/lib/{shadow-claw-task-server-DNOe8PWK.js → shadow-claw-task-server-CLT018BX.js} +2 -2
  132. package/dist/lib/{shadow-claw-task-server-DNOe8PWK.js.map → shadow-claw-task-server-CLT018BX.js.map} +1 -1
  133. package/dist/lib/{shadow-claw-tasks-qmcDT4PU.js → shadow-claw-tasks-D5h-lGmq.js} +9 -8
  134. package/dist/lib/shadow-claw-tasks-D5h-lGmq.js.map +1 -0
  135. package/dist/lib/{shadow-claw-terminal-0QUWP8of.js → shadow-claw-terminal-Cy1O6KVM.js} +2 -2
  136. package/dist/lib/{shadow-claw-terminal-0QUWP8of.js.map → shadow-claw-terminal-Cy1O6KVM.js.map} +1 -1
  137. package/dist/lib/{shadow-claw-tools-Bs_bmI6-.js → shadow-claw-tools-CVD06bCR.js} +9 -9
  138. package/dist/lib/{shadow-claw-tools-Bs_bmI6-.js.map → shadow-claw-tools-CVD06bCR.js.map} +1 -1
  139. package/dist/lib/{shadow-claw-webvm-DYaoL7QY.js → shadow-claw-webvm-DoGl5ZSJ.js} +3 -3
  140. package/dist/lib/{shadow-claw-webvm-DYaoL7QY.js.map → shadow-claw-webvm-DoGl5ZSJ.js.map} +1 -1
  141. package/dist/lib/subsystems/channels/peerjs.d.ts +37 -4
  142. package/dist/lib/subsystems/channels/room.d.ts +4 -0
  143. package/dist/lib/{syncWebMcpRegistration-BhbqI6R2.js → syncWebMcpRegistration-BeYkQEvj.js} +5 -5
  144. package/dist/lib/{syncWebMcpRegistration-BhbqI6R2.js.map → syncWebMcpRegistration-BeYkQEvj.js.map} +1 -1
  145. package/dist/lib/tools-C3Kft940.js +1 -0
  146. package/dist/lib/{tools-DBaMRiEu.js → tools-DKzPWc0q.js} +2 -2
  147. package/dist/lib/{tools-DBaMRiEu.js.map → tools-DKzPWc0q.js.map} +1 -1
  148. package/dist/lib/{tools-DwwB9RBa.js → tools-DqcJe8LS.js} +5 -5
  149. package/dist/lib/{tools-DwwB9RBa.js.map → tools-DqcJe8LS.js.map} +1 -1
  150. package/dist/lib/{trusted-types-Dx0RZlrd.js → trusted-types-Oz7xXJAY.js} +4 -4
  151. package/dist/lib/{trusted-types-Dx0RZlrd.js.map → trusted-types-Oz7xXJAY.js.map} +1 -1
  152. package/dist/lib/utils/index.js +1 -1
  153. package/dist/lib/utils/namespacedStorage.js +1 -1
  154. package/dist/lib/utils/utils.js +1 -1
  155. package/dist/lib/{webmcp-j_1_T3wf.js → webmcp-BC8_WafM.js} +4 -4
  156. package/dist/lib/{webmcp-j_1_T3wf.js.map → webmcp-BC8_WafM.js.map} +1 -1
  157. package/dist/lib/worker/utils/system-prompt.d.ts +4 -1
  158. package/dist/public/.agents/skills/main/skill-creator/SKILL.md +3 -2
  159. package/dist/public/.agents/skills/main/skill-creator/references/frontmatter-spec.md +5 -3
  160. package/dist/public/.well-known/agent-skills/index.json +1 -1
  161. package/dist/public/.well-known/mcp/server-card.json +1 -1
  162. package/dist/public/.well-known/mcp.json +1 -1
  163. package/dist/public/agent.worker.js +18 -17
  164. package/dist/public/app-routes-BMQ4HFaM.js +1 -0
  165. package/dist/public/{bundler-Ca-Xwln8.js → bundler-0if-QelV.js} +4 -4
  166. package/dist/public/{config-CrHchneq.js → config-Bnwx4EfS.js} +1 -1
  167. package/dist/public/{configurePeerJs-B470pdeU.js → configurePeerJs-DkyGvwk_.js} +1 -1
  168. package/dist/public/{connections-DvbgdkaB.js → connections-6575KDGE.js} +1 -1
  169. package/dist/public/{custom-element-security-FU04Cq05.js → custom-element-security-BQJQ_oKz.js} +1 -1
  170. package/dist/public/docs/example/article/index.html +2 -2
  171. package/dist/public/docs/publishing/index.html +2 -2
  172. package/dist/public/docs/skill-creator/index.html +2 -2
  173. package/dist/public/docs/subsystems/skills.md +3 -1
  174. package/dist/public/{downloadGroupFile-D8KRJGGL.js → downloadGroupFile-Wo1Sxdhr.js} +1 -1
  175. package/dist/public/{e2e-bridge-CSW0S5Yz.js → e2e-bridge-CvLCUU2O.js} +1 -1
  176. package/dist/public/{file-viewer-Cs-riNvy.js → file-viewer-CIjqAvNF.js} +1 -1
  177. package/dist/public/{getGroupDir-P1h9wl6S.js → getGroupDir-BwprrdrQ.js} +1 -1
  178. package/dist/public/{git-7Vq_SJSp.js → git-BSnY2D-A.js} +2 -2
  179. package/dist/public/{iframe-sanitizer-y2Z1pPwY.js → iframe-sanitizer-viROQkRn.js} +1 -1
  180. package/dist/public/index.html +2 -2
  181. package/dist/public/index.js +1 -1
  182. package/dist/public/{initChatSplitResize-CzV2E7Ul.js → initChatSplitResize-BA18wLQQ.js} +1 -1
  183. package/dist/public/{initControlPlane-BqCY0NQy.js → initControlPlane-L96uJkRA.js} +1 -1
  184. package/dist/public/main/index.html +2 -2
  185. package/dist/public/main/memory/index.html +2 -2
  186. package/dist/public/{markdown-Cw7vCtTg.js → markdown-DGjZAm_w.js} +17 -14
  187. package/dist/public/{mcp-reconnect-9emsqGRe.js → mcp-reconnect-CBHuaYdF.js} +1 -1
  188. package/dist/public/{memoryStorage-C0KvLNUp.js → memoryStorage-C1llaYus.js} +1 -1
  189. package/dist/public/orchestrator-C0VOoTiK.js +15 -0
  190. package/dist/public/{orchestrator-DpkkeD6T.js → orchestrator-DMWi--Dc.js} +20 -19
  191. package/dist/public/peerjs-Bf6ZxfbA.js +1 -0
  192. package/dist/public/{push-client-CHjSbrWs.js → push-client-BD4YalBa.js} +1 -1
  193. package/dist/public/service-worker.js +1 -1
  194. package/dist/public/{shadow-claw-BBPV_9X8.js → shadow-claw-DRy-D4Qi.js} +2 -2
  195. package/dist/public/{shadow-claw-accounts-xUOLBsQZ.js → shadow-claw-accounts-DnfmA8cb.js} +1 -1
  196. package/dist/public/{shadow-claw-channels-BJvrKQjg.js → shadow-claw-channels-8UkycZAa.js} +1 -1
  197. package/dist/public/{shadow-claw-chat-BG2EaRaw.js → shadow-claw-chat-Cf5LUiul.js} +9 -9
  198. package/dist/public/{shadow-claw-control-plane-BBa7WbTg.js → shadow-claw-control-plane-UsBF-Nvd.js} +2 -2
  199. package/dist/public/{shadow-claw-conversations-CFaWFmkm.js → shadow-claw-conversations-Aoe61Y21.js} +1 -1
  200. package/dist/public/{shadow-claw-file-viewer-Z-GIKaE9.js → shadow-claw-file-viewer-D28dSSEn.js} +6 -6
  201. package/dist/public/{shadow-claw-files-BBx4iMsk.js → shadow-claw-files-CaDUlPEU.js} +1 -1
  202. package/dist/public/{shadow-claw-git-vTOKatwd.js → shadow-claw-git-DYNcZMWA.js} +2 -2
  203. package/dist/public/{shadow-claw-integrations-BBVnO0Fc.js → shadow-claw-integrations-BJf_hQVv.js} +1 -1
  204. package/dist/public/{shadow-claw-llm-Ce1Ax6-x.js → shadow-claw-llm-BqK2SIRf.js} +2 -2
  205. package/dist/public/{shadow-claw-mcp-remote-Bkx0gsmF.js → shadow-claw-mcp-remote-B_dDG990.js} +1 -1
  206. package/dist/public/{shadow-claw-networking-q4XIzdB5.js → shadow-claw-networking-D8LxOofv.js} +1 -1
  207. package/dist/public/{shadow-claw-notifications-D2cz0gmm.js → shadow-claw-notifications-DpVyiNG_.js} +1 -1
  208. package/dist/public/{shadow-claw-page-header-BccSHItx.js → shadow-claw-page-header-DdC7bJuW.js} +1 -1
  209. package/dist/public/{shadow-claw-pages-3335lmSC.js → shadow-claw-pages-CYMl4J-6.js} +3 -3
  210. package/dist/public/{shadow-claw-settings-4ptYuJwO.js → shadow-claw-settings-Da_8Oy3O.js} +3 -3
  211. package/dist/public/{shadow-claw-storage-bIrPKFhF.js → shadow-claw-storage-DXIm86_-.js} +1 -1
  212. package/dist/public/{shadow-claw-task-server-5yqVBxy1.js → shadow-claw-task-server-BCceBD0G.js} +1 -1
  213. package/dist/public/{shadow-claw-tasks-DcqYHPLZ.js → shadow-claw-tasks-BW1QZ5L3.js} +19 -19
  214. package/dist/public/{shadow-claw-terminal-fARaDONr.js → shadow-claw-terminal-vqfsxhcK.js} +1 -1
  215. package/dist/public/{shadow-claw-tools-paEAhcJr.js → shadow-claw-tools-l0Jsa7UJ.js} +1 -1
  216. package/dist/public/{shadow-claw-webvm-CbzH_vyX.js → shadow-claw-webvm-CDPOWZm7.js} +1 -1
  217. package/dist/public/skills/main/skill-creator/SKILL.md +3 -2
  218. package/dist/public/skills/main/skill-creator/references/frontmatter-spec.md +5 -3
  219. package/dist/public/static-main-manifest.json +2 -2
  220. package/dist/public/{syncWebMcpRegistration-CWSYaHex.js → syncWebMcpRegistration-5b5FkP9_.js} +1 -1
  221. package/dist/public/tools-B-PzsLc2.js +1 -0
  222. package/dist/public/{tools-C8x3nmo4.js → tools-CcgG5XuA.js} +1 -1
  223. package/dist/public/{tools-DvckJZG2.js → tools-VSOY66vs.js} +1 -1
  224. package/dist/public/{webmcp-DAjmliCx.js → webmcp-DBONjQWd.js} +1 -1
  225. package/dist/server.js +2 -2
  226. package/package.json +2 -2
  227. package/src/__mocks__/marked.cjs +14 -0
  228. package/src/components/shadow-claw-chat/shadow-claw-chat.test.ts +17 -0
  229. package/src/components/shadow-claw-chat/shadow-claw-chat.ts +5 -1
  230. package/src/components/shadow-claw-file-viewer/shadow-claw-file-viewer.test.ts +78 -0
  231. package/src/components/shadow-claw-file-viewer/shadow-claw-file-viewer.ts +6 -2
  232. package/src/components/shadow-claw-pages/utils/resolveWorkspaceLinkPath.test.ts +56 -0
  233. package/src/components/shadow-claw-tasks/shadow-claw-tasks.test.ts +22 -0
  234. package/src/components/shadow-claw-tasks/shadow-claw-tasks.ts +5 -1
  235. package/src/content/markdown-links.test.ts +109 -0
  236. package/src/content/markdown-links.ts +187 -0
  237. package/src/content/markdown.test.ts +33 -0
  238. package/src/content/markdown.ts +6 -1
  239. package/src/core/app-routes.test.ts +65 -0
  240. package/src/core/app-routes.ts +1 -1
  241. package/src/core/orchestrator/orchestrator.ts +3 -0
  242. package/src/core/orchestrator/utils/compactContext.ts +2 -0
  243. package/src/core/orchestrator/utils/invokeAgent.ts +1 -0
  244. package/src/subsystems/accounts/service-accounts.test.ts +0 -1
  245. package/src/subsystems/channels/peerjs.test.ts +479 -1
  246. package/src/subsystems/channels/peerjs.ts +420 -75
  247. package/src/subsystems/channels/room.test.ts +35 -0
  248. package/src/subsystems/channels/room.ts +15 -0
  249. package/src/subsystems/skills/activateSkill.test.ts +38 -5
  250. package/src/subsystems/skills/activateSkill.ts +25 -3
  251. package/src/subsystems/skills/parseSkill.test.ts +71 -0
  252. package/src/subsystems/skills/parseSkill.ts +185 -25
  253. package/src/subsystems/tools/files.ts +4 -4
  254. package/src/worker/tools/spawn-subagent/spawn-subagent.test.ts +22 -23
  255. package/src/worker/tools/workspace/send-file.test.ts +24 -1
  256. package/src/worker/tools/workspace/send-file.ts +6 -3
  257. package/src/worker/utils/handleCompact.test.ts +3 -4
  258. package/src/worker/utils/handleInvoke.test.ts +13 -11
  259. package/src/worker/utils/handleInvoke.ts +3 -0
  260. package/src/worker/utils/handleMessage.test.ts +0 -1
  261. package/src/worker/utils/post.test.ts +3 -4
  262. package/src/worker/utils/sandboxedEval.test.ts +1 -2
  263. package/src/worker/utils/system-prompt.test.ts +59 -0
  264. package/src/worker/utils/system-prompt.ts +21 -1
  265. package/src/worker/utils/withRetry.test.ts +3 -16
  266. package/dist/lib/app-routes-CqBOeA5q.js.map +0 -1
  267. package/dist/lib/markdown-DgdSt2GD.js.map +0 -1
  268. package/dist/lib/orchestrator-CjEau_RG.js.map +0 -1
  269. package/dist/lib/peerjs-BdfpltIe.js.map +0 -1
  270. package/dist/lib/shadow-claw-chat-mXPQZbwT.js.map +0 -1
  271. package/dist/lib/shadow-claw-file-viewer-BSbZvSl-.js.map +0 -1
  272. package/dist/lib/shadow-claw-tasks-qmcDT4PU.js.map +0 -1
  273. package/dist/lib/tools-D4Pp-nUw.js +0 -1
  274. package/dist/public/app-routes-Bs-riIvr.js +0 -1
  275. package/dist/public/orchestrator-BWkHHO9Y.js +0 -15
  276. package/dist/public/peerjs-tf2EmWjB.js +0 -1
  277. package/dist/public/tools-COduyYJ0.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"webmcp-j_1_T3wf.js","names":[],"sources":["../../node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js","../../node_modules/@cfworker/json-schema/dist/esm/pointer.js","../../node_modules/@cfworker/json-schema/dist/esm/dereference.js","../../node_modules/@cfworker/json-schema/dist/esm/format.js","../../node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js","../../node_modules/@cfworker/json-schema/dist/esm/validate.js","../../node_modules/@cfworker/json-schema/dist/esm/validator.js","../../node_modules/@mcp-b/webmcp-polyfill/dist/index.js","../../src/subsystems/mcp/webmcp.ts"],"sourcesContent":["export function deepCompareStrict(a, b) {\n const typeofa = typeof a;\n if (typeofa !== typeof b) {\n return false;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b)) {\n return false;\n }\n const length = a.length;\n if (length !== b.length) {\n return false;\n }\n for (let i = 0; i < length; i++) {\n if (!deepCompareStrict(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n if (typeofa === 'object') {\n if (!a || !b) {\n return a === b;\n }\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n const length = aKeys.length;\n if (length !== bKeys.length) {\n return false;\n }\n for (const k of aKeys) {\n if (!deepCompareStrict(a[k], b[k])) {\n return false;\n }\n }\n return true;\n }\n return a === b;\n}\n","export function encodePointer(p) {\n return encodeURI(escapePointer(p));\n}\nexport function escapePointer(p) {\n return p.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n","import { encodePointer } from './pointer.js';\nexport const schemaKeyword = {\n additionalItems: true,\n unevaluatedItems: true,\n items: true,\n contains: true,\n additionalProperties: true,\n unevaluatedProperties: true,\n propertyNames: true,\n not: true,\n if: true,\n then: true,\n else: true\n};\nexport const schemaArrayKeyword = {\n prefixItems: true,\n items: true,\n allOf: true,\n anyOf: true,\n oneOf: true\n};\nexport const schemaMapKeyword = {\n $defs: true,\n definitions: true,\n properties: true,\n patternProperties: true,\n dependentSchemas: true\n};\nexport const ignoredKeyword = {\n id: true,\n $id: true,\n $ref: true,\n $schema: true,\n $anchor: true,\n $vocabulary: true,\n $comment: true,\n default: true,\n enum: true,\n const: true,\n required: true,\n type: true,\n maximum: true,\n minimum: true,\n exclusiveMaximum: true,\n exclusiveMinimum: true,\n multipleOf: true,\n maxLength: true,\n minLength: true,\n pattern: true,\n format: true,\n maxItems: true,\n minItems: true,\n uniqueItems: true,\n maxProperties: true,\n minProperties: true\n};\nexport let initialBaseURI = typeof self !== 'undefined' &&\n self.location &&\n self.location.origin !== 'null'\n ?\n new URL(self.location.origin + self.location.pathname + location.search)\n : new URL('https://github.com/cfworker');\nexport function dereference(schema, lookup = Object.create(null), baseURI = initialBaseURI, basePointer = '') {\n if (schema && typeof schema === 'object' && !Array.isArray(schema)) {\n const id = schema.$id || schema.id;\n if (id) {\n const url = new URL(id, baseURI.href);\n if (url.hash.length > 1) {\n lookup[url.href] = schema;\n }\n else {\n url.hash = '';\n if (basePointer === '') {\n baseURI = url;\n }\n else {\n dereference(schema, lookup, baseURI);\n }\n }\n }\n }\n else if (schema !== true && schema !== false) {\n return lookup;\n }\n const schemaURI = baseURI.href + (basePointer ? '#' + basePointer : '');\n if (lookup[schemaURI] !== undefined) {\n throw new Error(`Duplicate schema URI \"${schemaURI}\".`);\n }\n lookup[schemaURI] = schema;\n if (schema === true || schema === false) {\n return lookup;\n }\n if (schema.__absolute_uri__ === undefined) {\n Object.defineProperty(schema, '__absolute_uri__', {\n enumerable: false,\n value: schemaURI\n });\n }\n if (schema.$ref && schema.__absolute_ref__ === undefined) {\n const url = new URL(schema.$ref, baseURI.href);\n url.hash = url.hash;\n Object.defineProperty(schema, '__absolute_ref__', {\n enumerable: false,\n value: url.href\n });\n }\n if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === undefined) {\n const url = new URL(schema.$recursiveRef, baseURI.href);\n url.hash = url.hash;\n Object.defineProperty(schema, '__absolute_recursive_ref__', {\n enumerable: false,\n value: url.href\n });\n }\n if (schema.$anchor) {\n const url = new URL('#' + schema.$anchor, baseURI.href);\n lookup[url.href] = schema;\n }\n for (let key in schema) {\n if (ignoredKeyword[key]) {\n continue;\n }\n const keyBase = `${basePointer}/${encodePointer(key)}`;\n const subSchema = schema[key];\n if (Array.isArray(subSchema)) {\n if (schemaArrayKeyword[key]) {\n const length = subSchema.length;\n for (let i = 0; i < length; i++) {\n dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);\n }\n }\n }\n else if (schemaMapKeyword[key]) {\n for (let subKey in subSchema) {\n dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);\n }\n }\n else {\n dereference(subSchema, lookup, baseURI, keyBase);\n }\n }\n return lookup;\n}\n","const DATE = /^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/;\nconst DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nconst TIME = /^(\\d\\d):(\\d\\d):(\\d\\d)(\\.\\d+)?(z|[+-]\\d\\d(?::?\\d\\d)?)?$/i;\nconst HOSTNAME = /^(?=.{1,253}\\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\\.?$/i;\nconst URIREF = /^(?:[a-z][a-z0-9+\\-.]*:)?(?:\\/?\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}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\})*$/i;\nconst URL_ = /^(?:(?:https?|ftp):\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu;\nconst UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;\nconst JSON_POINTER = /^(?:\\/(?:[^~/]|~0|~1)*)*$/;\nconst JSON_POINTER_URI_FRAGMENT = /^#(?:\\/(?:[a-z0-9_\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;\nconst RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/;\nconst EMAIL = (input) => {\n if (input[0] === '\"')\n return false;\n const [name, host, ...rest] = input.split('@');\n if (!name ||\n !host ||\n rest.length !== 0 ||\n name.length > 64 ||\n host.length > 253)\n return false;\n if (name[0] === '.' || name.endsWith('.') || name.includes('..'))\n return false;\n if (!/^[a-z0-9.-]+$/i.test(host) ||\n !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name))\n return false;\n return host\n .split('.')\n .every(part => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));\n};\nconst IPV4 = /^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$/;\nconst IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))$/i;\nconst DURATION = (input) => input.length > 1 &&\n input.length < 80 &&\n (/^P\\d+([.,]\\d+)?W$/.test(input) ||\n (/^P[\\dYMDTHS]*(\\d[.,]\\d+)?[YMDHS]$/.test(input) &&\n /^P([.,\\d]+Y)?([.,\\d]+M)?([.,\\d]+D)?(T([.,\\d]+H)?([.,\\d]+M)?([.,\\d]+S)?)?$/.test(input)));\nfunction bind(r) {\n return r.test.bind(r);\n}\nexport const format = {\n date,\n time: time.bind(undefined, false),\n 'date-time': date_time,\n duration: DURATION,\n uri,\n 'uri-reference': bind(URIREF),\n 'uri-template': bind(URITEMPLATE),\n url: bind(URL_),\n email: EMAIL,\n hostname: bind(HOSTNAME),\n ipv4: bind(IPV4),\n ipv6: bind(IPV6),\n regex: regex,\n uuid: bind(UUID),\n 'json-pointer': bind(JSON_POINTER),\n 'json-pointer-uri-fragment': bind(JSON_POINTER_URI_FRAGMENT),\n 'relative-json-pointer': bind(RELATIVE_JSON_POINTER)\n};\nfunction isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\nfunction date(str) {\n const matches = str.match(DATE);\n if (!matches)\n return false;\n const year = +matches[1];\n const month = +matches[2];\n const day = +matches[3];\n return (month >= 1 &&\n month <= 12 &&\n day >= 1 &&\n day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]));\n}\nfunction time(full, str) {\n const matches = str.match(TIME);\n if (!matches)\n return false;\n const hour = +matches[1];\n const minute = +matches[2];\n const second = +matches[3];\n const timeZone = !!matches[5];\n return (((hour <= 23 && minute <= 59 && second <= 59) ||\n (hour == 23 && minute == 59 && second == 60)) &&\n (!full || timeZone));\n}\nconst DATE_TIME_SEPARATOR = /t|\\s/i;\nfunction date_time(str) {\n const dateTime = str.split(DATE_TIME_SEPARATOR);\n return dateTime.length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9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\\?(?:[a-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;\nfunction uri(str) {\n return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);\n}\nconst Z_ANCHOR = /[^\\\\]\\\\Z/;\nfunction regex(str) {\n if (Z_ANCHOR.test(str))\n return false;\n try {\n new RegExp(str, 'u');\n return true;\n }\n catch (e) {\n return false;\n }\n}\n","export function ucs2length(s) {\n let result = 0;\n let length = s.length;\n let index = 0;\n let charCode;\n while (index < length) {\n result++;\n charCode = s.charCodeAt(index++);\n if (charCode >= 0xd800 && charCode <= 0xdbff && index < length) {\n charCode = s.charCodeAt(index);\n if ((charCode & 0xfc00) == 0xdc00) {\n index++;\n }\n }\n }\n return result;\n}\n","import { deepCompareStrict } from './deep-compare-strict.js';\nimport { dereference } from './dereference.js';\nimport { format } from './format.js';\nimport { encodePointer } from './pointer.js';\nimport { ucs2length } from './ucs2-length.js';\nexport function validate(instance, schema, draft = '2019-09', lookup = dereference(schema), shortCircuit = true, recursiveAnchor = null, instanceLocation = '#', schemaLocation = '#', evaluated = Object.create(null)) {\n if (schema === true) {\n return { valid: true, errors: [] };\n }\n if (schema === false) {\n return {\n valid: false,\n errors: [\n {\n instanceLocation,\n keyword: 'false',\n keywordLocation: instanceLocation,\n error: 'False boolean schema.'\n }\n ]\n };\n }\n const rawInstanceType = typeof instance;\n let instanceType;\n switch (rawInstanceType) {\n case 'boolean':\n case 'number':\n case 'string':\n instanceType = rawInstanceType;\n break;\n case 'object':\n if (instance === null) {\n instanceType = 'null';\n }\n else if (Array.isArray(instance)) {\n instanceType = 'array';\n }\n else {\n instanceType = 'object';\n }\n break;\n default:\n throw new Error(`Instances of \"${rawInstanceType}\" type are not supported.`);\n }\n const { $ref, $recursiveRef, $recursiveAnchor, type: $type, const: $const, enum: $enum, required: $required, not: $not, anyOf: $anyOf, allOf: $allOf, oneOf: $oneOf, if: $if, then: $then, else: $else, format: $format, properties: $properties, patternProperties: $patternProperties, additionalProperties: $additionalProperties, unevaluatedProperties: $unevaluatedProperties, minProperties: $minProperties, maxProperties: $maxProperties, propertyNames: $propertyNames, dependentRequired: $dependentRequired, dependentSchemas: $dependentSchemas, dependencies: $dependencies, prefixItems: $prefixItems, items: $items, additionalItems: $additionalItems, unevaluatedItems: $unevaluatedItems, contains: $contains, minContains: $minContains, maxContains: $maxContains, minItems: $minItems, maxItems: $maxItems, uniqueItems: $uniqueItems, minimum: $minimum, maximum: $maximum, exclusiveMinimum: $exclusiveMinimum, exclusiveMaximum: $exclusiveMaximum, multipleOf: $multipleOf, minLength: $minLength, maxLength: $maxLength, pattern: $pattern, __absolute_ref__, __absolute_recursive_ref__ } = schema;\n const errors = [];\n if ($recursiveAnchor === true && recursiveAnchor === null) {\n recursiveAnchor = schema;\n }\n if ($recursiveRef === '#') {\n const refSchema = recursiveAnchor === null\n ? lookup[__absolute_recursive_ref__]\n : recursiveAnchor;\n const keywordLocation = `${schemaLocation}/$recursiveRef`;\n const result = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: '$recursiveRef',\n keywordLocation,\n error: 'A subschema had errors.'\n }, ...result.errors);\n }\n }\n if ($ref !== undefined) {\n const uri = __absolute_ref__ || $ref;\n const refSchema = lookup[uri];\n if (refSchema === undefined) {\n let message = `Unresolved $ref \"${$ref}\".`;\n if (__absolute_ref__ && __absolute_ref__ !== $ref) {\n message += ` Absolute URI \"${__absolute_ref__}\".`;\n }\n message += `\\nKnown schemas:\\n- ${Object.keys(lookup).join('\\n- ')}`;\n throw new Error(message);\n }\n const keywordLocation = `${schemaLocation}/$ref`;\n const result = validate(instance, refSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: '$ref',\n keywordLocation,\n error: 'A subschema had errors.'\n }, ...result.errors);\n }\n if (draft === '4' || draft === '7') {\n return { valid: errors.length === 0, errors };\n }\n }\n if (Array.isArray($type)) {\n let length = $type.length;\n let valid = false;\n for (let i = 0; i < length; i++) {\n if (instanceType === $type[i] ||\n ($type[i] === 'integer' &&\n instanceType === 'number' &&\n instance % 1 === 0 &&\n instance === instance)) {\n valid = true;\n break;\n }\n }\n if (!valid) {\n errors.push({\n instanceLocation,\n keyword: 'type',\n keywordLocation: `${schemaLocation}/type`,\n error: `Instance type \"${instanceType}\" is invalid. Expected \"${$type.join('\", \"')}\".`\n });\n }\n }\n else if ($type === 'integer') {\n if (instanceType !== 'number' || instance % 1 || instance !== instance) {\n errors.push({\n instanceLocation,\n keyword: 'type',\n keywordLocation: `${schemaLocation}/type`,\n error: `Instance type \"${instanceType}\" is invalid. Expected \"${$type}\".`\n });\n }\n }\n else if ($type !== undefined && instanceType !== $type) {\n errors.push({\n instanceLocation,\n keyword: 'type',\n keywordLocation: `${schemaLocation}/type`,\n error: `Instance type \"${instanceType}\" is invalid. Expected \"${$type}\".`\n });\n }\n if ($const !== undefined) {\n if (instanceType === 'object' || instanceType === 'array') {\n if (!deepCompareStrict(instance, $const)) {\n errors.push({\n instanceLocation,\n keyword: 'const',\n keywordLocation: `${schemaLocation}/const`,\n error: `Instance does not match ${JSON.stringify($const)}.`\n });\n }\n }\n else if (instance !== $const) {\n errors.push({\n instanceLocation,\n keyword: 'const',\n keywordLocation: `${schemaLocation}/const`,\n error: `Instance does not match ${JSON.stringify($const)}.`\n });\n }\n }\n if ($enum !== undefined) {\n if (instanceType === 'object' || instanceType === 'array') {\n if (!$enum.some(value => deepCompareStrict(instance, value))) {\n errors.push({\n instanceLocation,\n keyword: 'enum',\n keywordLocation: `${schemaLocation}/enum`,\n error: `Instance does not match any of ${JSON.stringify($enum)}.`\n });\n }\n }\n else if (!$enum.some(value => instance === value)) {\n errors.push({\n instanceLocation,\n keyword: 'enum',\n keywordLocation: `${schemaLocation}/enum`,\n error: `Instance does not match any of ${JSON.stringify($enum)}.`\n });\n }\n }\n if ($not !== undefined) {\n const keywordLocation = `${schemaLocation}/not`;\n const result = validate(instance, $not, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation);\n if (result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'not',\n keywordLocation,\n error: 'Instance matched \"not\" schema.'\n });\n }\n }\n let subEvaluateds = [];\n if ($anyOf !== undefined) {\n const keywordLocation = `${schemaLocation}/anyOf`;\n const errorsLength = errors.length;\n let anyValid = false;\n for (let i = 0; i < $anyOf.length; i++) {\n const subSchema = $anyOf[i];\n const subEvaluated = Object.create(evaluated);\n const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);\n errors.push(...result.errors);\n anyValid = anyValid || result.valid;\n if (result.valid) {\n subEvaluateds.push(subEvaluated);\n }\n }\n if (anyValid) {\n errors.length = errorsLength;\n }\n else {\n errors.splice(errorsLength, 0, {\n instanceLocation,\n keyword: 'anyOf',\n keywordLocation,\n error: 'Instance does not match any subschemas.'\n });\n }\n }\n if ($allOf !== undefined) {\n const keywordLocation = `${schemaLocation}/allOf`;\n const errorsLength = errors.length;\n let allValid = true;\n for (let i = 0; i < $allOf.length; i++) {\n const subSchema = $allOf[i];\n const subEvaluated = Object.create(evaluated);\n const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);\n errors.push(...result.errors);\n allValid = allValid && result.valid;\n if (result.valid) {\n subEvaluateds.push(subEvaluated);\n }\n }\n if (allValid) {\n errors.length = errorsLength;\n }\n else {\n errors.splice(errorsLength, 0, {\n instanceLocation,\n keyword: 'allOf',\n keywordLocation,\n error: `Instance does not match every subschema.`\n });\n }\n }\n if ($oneOf !== undefined) {\n const keywordLocation = `${schemaLocation}/oneOf`;\n const errorsLength = errors.length;\n const matches = $oneOf.filter((subSchema, i) => {\n const subEvaluated = Object.create(evaluated);\n const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);\n errors.push(...result.errors);\n if (result.valid) {\n subEvaluateds.push(subEvaluated);\n }\n return result.valid;\n }).length;\n if (matches === 1) {\n errors.length = errorsLength;\n }\n else {\n errors.splice(errorsLength, 0, {\n instanceLocation,\n keyword: 'oneOf',\n keywordLocation,\n error: `Instance does not match exactly one subschema (${matches} matches).`\n });\n }\n }\n if (instanceType === 'object' || instanceType === 'array') {\n Object.assign(evaluated, ...subEvaluateds);\n }\n if ($if !== undefined) {\n const keywordLocation = `${schemaLocation}/if`;\n const conditionResult = validate(instance, $if, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated).valid;\n if (conditionResult) {\n if ($then !== undefined) {\n const thenResult = validate(instance, $then, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/then`, evaluated);\n if (!thenResult.valid) {\n errors.push({\n instanceLocation,\n keyword: 'if',\n keywordLocation,\n error: `Instance does not match \"then\" schema.`\n }, ...thenResult.errors);\n }\n }\n }\n else if ($else !== undefined) {\n const elseResult = validate(instance, $else, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/else`, evaluated);\n if (!elseResult.valid) {\n errors.push({\n instanceLocation,\n keyword: 'if',\n keywordLocation,\n error: `Instance does not match \"else\" schema.`\n }, ...elseResult.errors);\n }\n }\n }\n if (instanceType === 'object') {\n if ($required !== undefined) {\n for (const key of $required) {\n if (!(key in instance)) {\n errors.push({\n instanceLocation,\n keyword: 'required',\n keywordLocation: `${schemaLocation}/required`,\n error: `Instance does not have required property \"${key}\".`\n });\n }\n }\n }\n const keys = Object.keys(instance);\n if ($minProperties !== undefined && keys.length < $minProperties) {\n errors.push({\n instanceLocation,\n keyword: 'minProperties',\n keywordLocation: `${schemaLocation}/minProperties`,\n error: `Instance does not have at least ${$minProperties} properties.`\n });\n }\n if ($maxProperties !== undefined && keys.length > $maxProperties) {\n errors.push({\n instanceLocation,\n keyword: 'maxProperties',\n keywordLocation: `${schemaLocation}/maxProperties`,\n error: `Instance does not have at least ${$maxProperties} properties.`\n });\n }\n if ($propertyNames !== undefined) {\n const keywordLocation = `${schemaLocation}/propertyNames`;\n for (const key in instance) {\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(key, $propertyNames, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'propertyNames',\n keywordLocation,\n error: `Property name \"${key}\" does not match schema.`\n }, ...result.errors);\n }\n }\n }\n if ($dependentRequired !== undefined) {\n const keywordLocation = `${schemaLocation}/dependantRequired`;\n for (const key in $dependentRequired) {\n if (key in instance) {\n const required = $dependentRequired[key];\n for (const dependantKey of required) {\n if (!(dependantKey in instance)) {\n errors.push({\n instanceLocation,\n keyword: 'dependentRequired',\n keywordLocation,\n error: `Instance has \"${key}\" but does not have \"${dependantKey}\".`\n });\n }\n }\n }\n }\n }\n if ($dependentSchemas !== undefined) {\n for (const key in $dependentSchemas) {\n const keywordLocation = `${schemaLocation}/dependentSchemas`;\n if (key in instance) {\n const result = validate(instance, $dependentSchemas[key], draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`, evaluated);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'dependentSchemas',\n keywordLocation,\n error: `Instance has \"${key}\" but does not match dependant schema.`\n }, ...result.errors);\n }\n }\n }\n }\n if ($dependencies !== undefined) {\n const keywordLocation = `${schemaLocation}/dependencies`;\n for (const key in $dependencies) {\n if (key in instance) {\n const propsOrSchema = $dependencies[key];\n if (Array.isArray(propsOrSchema)) {\n for (const dependantKey of propsOrSchema) {\n if (!(dependantKey in instance)) {\n errors.push({\n instanceLocation,\n keyword: 'dependencies',\n keywordLocation,\n error: `Instance has \"${key}\" but does not have \"${dependantKey}\".`\n });\n }\n }\n }\n else {\n const result = validate(instance, propsOrSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'dependencies',\n keywordLocation,\n error: `Instance has \"${key}\" but does not match dependant schema.`\n }, ...result.errors);\n }\n }\n }\n }\n }\n const thisEvaluated = Object.create(null);\n let stop = false;\n if ($properties !== undefined) {\n const keywordLocation = `${schemaLocation}/properties`;\n for (const key in $properties) {\n if (!(key in instance)) {\n continue;\n }\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(instance[key], $properties[key], draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(key)}`);\n if (result.valid) {\n evaluated[key] = thisEvaluated[key] = true;\n }\n else {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'properties',\n keywordLocation,\n error: `Property \"${key}\" does not match schema.`\n }, ...result.errors);\n if (stop)\n break;\n }\n }\n }\n if (!stop && $patternProperties !== undefined) {\n const keywordLocation = `${schemaLocation}/patternProperties`;\n for (const pattern in $patternProperties) {\n const regex = new RegExp(pattern, 'u');\n const subSchema = $patternProperties[pattern];\n for (const key in instance) {\n if (!regex.test(key)) {\n continue;\n }\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(instance[key], subSchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(pattern)}`);\n if (result.valid) {\n evaluated[key] = thisEvaluated[key] = true;\n }\n else {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'patternProperties',\n keywordLocation,\n error: `Property \"${key}\" matches pattern \"${pattern}\" but does not match associated schema.`\n }, ...result.errors);\n }\n }\n }\n }\n if (!stop && $additionalProperties !== undefined) {\n const keywordLocation = `${schemaLocation}/additionalProperties`;\n for (const key in instance) {\n if (thisEvaluated[key]) {\n continue;\n }\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(instance[key], $additionalProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);\n if (result.valid) {\n evaluated[key] = true;\n }\n else {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'additionalProperties',\n keywordLocation,\n error: `Property \"${key}\" does not match additional properties schema.`\n }, ...result.errors);\n }\n }\n }\n else if (!stop && $unevaluatedProperties !== undefined) {\n const keywordLocation = `${schemaLocation}/unevaluatedProperties`;\n for (const key in instance) {\n if (!evaluated[key]) {\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(instance[key], $unevaluatedProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);\n if (result.valid) {\n evaluated[key] = true;\n }\n else {\n errors.push({\n instanceLocation,\n keyword: 'unevaluatedProperties',\n keywordLocation,\n error: `Property \"${key}\" does not match unevaluated properties schema.`\n }, ...result.errors);\n }\n }\n }\n }\n }\n else if (instanceType === 'array') {\n if ($maxItems !== undefined && instance.length > $maxItems) {\n errors.push({\n instanceLocation,\n keyword: 'maxItems',\n keywordLocation: `${schemaLocation}/maxItems`,\n error: `Array has too many items (${instance.length} > ${$maxItems}).`\n });\n }\n if ($minItems !== undefined && instance.length < $minItems) {\n errors.push({\n instanceLocation,\n keyword: 'minItems',\n keywordLocation: `${schemaLocation}/minItems`,\n error: `Array has too few items (${instance.length} < ${$minItems}).`\n });\n }\n const length = instance.length;\n let i = 0;\n let stop = false;\n if ($prefixItems !== undefined) {\n const keywordLocation = `${schemaLocation}/prefixItems`;\n const length2 = Math.min($prefixItems.length, length);\n for (; i < length2; i++) {\n const result = validate(instance[i], $prefixItems[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);\n evaluated[i] = true;\n if (!result.valid) {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'prefixItems',\n keywordLocation,\n error: `Items did not match schema.`\n }, ...result.errors);\n if (stop)\n break;\n }\n }\n }\n if ($items !== undefined) {\n const keywordLocation = `${schemaLocation}/items`;\n if (Array.isArray($items)) {\n const length2 = Math.min($items.length, length);\n for (; i < length2; i++) {\n const result = validate(instance[i], $items[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);\n evaluated[i] = true;\n if (!result.valid) {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'items',\n keywordLocation,\n error: `Items did not match schema.`\n }, ...result.errors);\n if (stop)\n break;\n }\n }\n }\n else {\n for (; i < length; i++) {\n const result = validate(instance[i], $items, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);\n evaluated[i] = true;\n if (!result.valid) {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'items',\n keywordLocation,\n error: `Items did not match schema.`\n }, ...result.errors);\n if (stop)\n break;\n }\n }\n }\n if (!stop && $additionalItems !== undefined) {\n const keywordLocation = `${schemaLocation}/additionalItems`;\n for (; i < length; i++) {\n const result = validate(instance[i], $additionalItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);\n evaluated[i] = true;\n if (!result.valid) {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'additionalItems',\n keywordLocation,\n error: `Items did not match additional items schema.`\n }, ...result.errors);\n }\n }\n }\n }\n if ($contains !== undefined) {\n if (length === 0 && $minContains === undefined) {\n errors.push({\n instanceLocation,\n keyword: 'contains',\n keywordLocation: `${schemaLocation}/contains`,\n error: `Array is empty. It must contain at least one item matching the schema.`\n });\n }\n else if ($minContains !== undefined && length < $minContains) {\n errors.push({\n instanceLocation,\n keyword: 'minContains',\n keywordLocation: `${schemaLocation}/minContains`,\n error: `Array has less items (${length}) than minContains (${$minContains}).`\n });\n }\n else {\n const keywordLocation = `${schemaLocation}/contains`;\n const errorsLength = errors.length;\n let contained = 0;\n for (let j = 0; j < length; j++) {\n const result = validate(instance[j], $contains, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${j}`, keywordLocation);\n if (result.valid) {\n evaluated[j] = true;\n contained++;\n }\n else {\n errors.push(...result.errors);\n }\n }\n if (contained >= ($minContains || 0)) {\n errors.length = errorsLength;\n }\n if ($minContains === undefined &&\n $maxContains === undefined &&\n contained === 0) {\n errors.splice(errorsLength, 0, {\n instanceLocation,\n keyword: 'contains',\n keywordLocation,\n error: `Array does not contain item matching schema.`\n });\n }\n else if ($minContains !== undefined && contained < $minContains) {\n errors.push({\n instanceLocation,\n keyword: 'minContains',\n keywordLocation: `${schemaLocation}/minContains`,\n error: `Array must contain at least ${$minContains} items matching schema. Only ${contained} items were found.`\n });\n }\n else if ($maxContains !== undefined && contained > $maxContains) {\n errors.push({\n instanceLocation,\n keyword: 'maxContains',\n keywordLocation: `${schemaLocation}/maxContains`,\n error: `Array may contain at most ${$maxContains} items matching schema. ${contained} items were found.`\n });\n }\n }\n }\n if (!stop && $unevaluatedItems !== undefined) {\n const keywordLocation = `${schemaLocation}/unevaluatedItems`;\n for (i; i < length; i++) {\n if (evaluated[i]) {\n continue;\n }\n const result = validate(instance[i], $unevaluatedItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);\n evaluated[i] = true;\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'unevaluatedItems',\n keywordLocation,\n error: `Items did not match unevaluated items schema.`\n }, ...result.errors);\n }\n }\n }\n if ($uniqueItems) {\n for (let j = 0; j < length; j++) {\n const a = instance[j];\n const ao = typeof a === 'object' && a !== null;\n for (let k = 0; k < length; k++) {\n if (j === k) {\n continue;\n }\n const b = instance[k];\n const bo = typeof b === 'object' && b !== null;\n if (a === b || (ao && bo && deepCompareStrict(a, b))) {\n errors.push({\n instanceLocation,\n keyword: 'uniqueItems',\n keywordLocation: `${schemaLocation}/uniqueItems`,\n error: `Duplicate items at indexes ${j} and ${k}.`\n });\n j = Number.MAX_SAFE_INTEGER;\n k = Number.MAX_SAFE_INTEGER;\n }\n }\n }\n }\n }\n else if (instanceType === 'number') {\n if (draft === '4') {\n if ($minimum !== undefined &&\n (($exclusiveMinimum === true && instance <= $minimum) ||\n instance < $minimum)) {\n errors.push({\n instanceLocation,\n keyword: 'minimum',\n keywordLocation: `${schemaLocation}/minimum`,\n error: `${instance} is less than ${$exclusiveMinimum ? 'or equal to ' : ''} ${$minimum}.`\n });\n }\n if ($maximum !== undefined &&\n (($exclusiveMaximum === true && instance >= $maximum) ||\n instance > $maximum)) {\n errors.push({\n instanceLocation,\n keyword: 'maximum',\n keywordLocation: `${schemaLocation}/maximum`,\n error: `${instance} is greater than ${$exclusiveMaximum ? 'or equal to ' : ''} ${$maximum}.`\n });\n }\n }\n else {\n if ($minimum !== undefined && instance < $minimum) {\n errors.push({\n instanceLocation,\n keyword: 'minimum',\n keywordLocation: `${schemaLocation}/minimum`,\n error: `${instance} is less than ${$minimum}.`\n });\n }\n if ($maximum !== undefined && instance > $maximum) {\n errors.push({\n instanceLocation,\n keyword: 'maximum',\n keywordLocation: `${schemaLocation}/maximum`,\n error: `${instance} is greater than ${$maximum}.`\n });\n }\n if ($exclusiveMinimum !== undefined && instance <= $exclusiveMinimum) {\n errors.push({\n instanceLocation,\n keyword: 'exclusiveMinimum',\n keywordLocation: `${schemaLocation}/exclusiveMinimum`,\n error: `${instance} is less than ${$exclusiveMinimum}.`\n });\n }\n if ($exclusiveMaximum !== undefined && instance >= $exclusiveMaximum) {\n errors.push({\n instanceLocation,\n keyword: 'exclusiveMaximum',\n keywordLocation: `${schemaLocation}/exclusiveMaximum`,\n error: `${instance} is greater than or equal to ${$exclusiveMaximum}.`\n });\n }\n }\n if ($multipleOf !== undefined) {\n const remainder = instance % $multipleOf;\n if (Math.abs(0 - remainder) >= 1.1920929e-7 &&\n Math.abs($multipleOf - remainder) >= 1.1920929e-7) {\n errors.push({\n instanceLocation,\n keyword: 'multipleOf',\n keywordLocation: `${schemaLocation}/multipleOf`,\n error: `${instance} is not a multiple of ${$multipleOf}.`\n });\n }\n }\n }\n else if (instanceType === 'string') {\n const length = $minLength === undefined && $maxLength === undefined\n ? 0\n : ucs2length(instance);\n if ($minLength !== undefined && length < $minLength) {\n errors.push({\n instanceLocation,\n keyword: 'minLength',\n keywordLocation: `${schemaLocation}/minLength`,\n error: `String is too short (${length} < ${$minLength}).`\n });\n }\n if ($maxLength !== undefined && length > $maxLength) {\n errors.push({\n instanceLocation,\n keyword: 'maxLength',\n keywordLocation: `${schemaLocation}/maxLength`,\n error: `String is too long (${length} > ${$maxLength}).`\n });\n }\n if ($pattern !== undefined && !new RegExp($pattern, 'u').test(instance)) {\n errors.push({\n instanceLocation,\n keyword: 'pattern',\n keywordLocation: `${schemaLocation}/pattern`,\n error: `String does not match pattern.`\n });\n }\n if ($format !== undefined &&\n format[$format] &&\n !format[$format](instance)) {\n errors.push({\n instanceLocation,\n keyword: 'format',\n keywordLocation: `${schemaLocation}/format`,\n error: `String does not match format \"${$format}\".`\n });\n }\n }\n return { valid: errors.length === 0, errors };\n}\n","import { dereference } from './dereference.js';\nimport { validate } from './validate.js';\nexport class Validator {\n schema;\n draft;\n shortCircuit;\n lookup;\n constructor(schema, draft = '2019-09', shortCircuit = true) {\n this.schema = schema;\n this.draft = draft;\n this.shortCircuit = shortCircuit;\n this.lookup = dereference(schema);\n }\n validate(instance) {\n return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);\n }\n addSchema(schema, id) {\n if (id) {\n schema = { ...schema, $id: id };\n }\n dereference(schema, this.lookup);\n }\n}\n","import { Validator } from \"@cfworker/json-schema\";\n\n//#region src/index.ts\nconst FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE = \"Failed to parse input arguments\";\nconst TOOL_INVOCATION_FAILED_MESSAGE = \"Tool was executed but the invocation failed. For example, the script function threw an error\";\nconst TOOL_CANCELLED_MESSAGE = \"Tool was cancelled\";\nconst DEFAULT_INPUT_SCHEMA = {\n\ttype: \"object\",\n\tproperties: {}\n};\nconst STANDARD_JSON_SCHEMA_TARGETS = [\"draft-2020-12\", \"draft-07\"];\nconst POLYFILL_MARKER_PROPERTY = \"__isWebMCPPolyfill\";\nconst STANDARD_VALIDATOR_SYMBOL = Symbol(\"standardValidator\");\nconst installState = {\n\tinstalled: false,\n\tpreviousNavigatorModelContextDescriptor: void 0,\n\tpreviousNavigatorModelContextTestingDescriptor: void 0,\n\tpreviousDocumentModelContextDescriptor: void 0,\n\tinstalledNavigatorModelContext: false,\n\tinstalledNavigatorModelContextTesting: false,\n\tinstalledDocumentModelContext: false\n};\nvar StrictWebMCPContext = class extends EventTarget {\n\ttools = /* @__PURE__ */ new Map();\n\ttestingShim = null;\n\t_ontoolchange = null;\n\tunregisterToolDeprecationWarned = false;\n\tget ontoolchange() {\n\t\treturn this._ontoolchange;\n\t}\n\tset ontoolchange(handler) {\n\t\tthis._ontoolchange = handler;\n\t}\n\tregisterTool(tool, options) {\n\t\tconst signal = options?.signal;\n\t\tif (signal?.aborted) {\n\t\t\tconsole.warn(`[WebMCPPolyfill] registerTool(\"${tool?.name ?? \"<unknown>\"}\") skipped: options.signal was already aborted.`);\n\t\t\treturn;\n\t\t}\n\t\tconst normalized = normalizeToolDescriptor(tool, this.tools);\n\t\tthis.tools.set(normalized.name, normalized);\n\t\tthis.notifyToolsChanged();\n\t\tif (signal) signal.addEventListener(\"abort\", () => {\n\t\t\tif (this.tools.delete(normalized.name)) this.notifyToolsChanged();\n\t\t}, { once: true });\n\t}\n\tunregisterTool(nameOrTool) {\n\t\tthis.warnUnregisterToolDeprecationOnce();\n\t\tconst name = getToolNameForUnregister(nameOrTool);\n\t\tif (this.tools.delete(name)) this.notifyToolsChanged();\n\t}\n\tgetTools() {\n\t\treturn Promise.resolve(this.getRegisteredToolInfos());\n\t}\n\texecuteTool(tool, inputArgsJson, options) {\n\t\treturn this.executeToolByName(tool.name, inputArgsJson, options, false);\n\t}\n\tgetTestingShim() {\n\t\tif (!this.testingShim) this.testingShim = new PolyfillTestingShim(this);\n\t\treturn this.testingShim;\n\t}\n\t/** @internal Used by PolyfillTestingShim */\n\tgetToolInfos() {\n\t\treturn [...this.tools.values()].map((tool) => {\n\t\t\tlet inputSchema;\n\t\t\ttry {\n\t\t\t\tinputSchema = JSON.stringify(tool.inputSchema ?? { type: \"object\" });\n\t\t\t} catch {\n\t\t\t\tinputSchema = \"{\\\"type\\\":\\\"object\\\"}\";\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tname: tool.name,\n\t\t\t\tdescription: tool.description,\n\t\t\t\tinputSchema\n\t\t\t};\n\t\t});\n\t}\n\t/** @internal Used by getTools() */\n\tgetRegisteredToolInfos() {\n\t\treturn this.getToolInfos().map((toolInfo) => {\n\t\t\tconst tool = this.tools.get(toolInfo.name);\n\t\t\treturn {\n\t\t\t\t...toolInfo,\n\t\t\t\ttitle: tool?.title ?? \"\",\n\t\t\t\torigin: globalThis.location?.origin ?? \"\",\n\t\t\t\twindow: globalThis.window\n\t\t\t};\n\t\t});\n\t}\n\t/** @internal Used by PolyfillTestingShim */\n\tasync executeToolForTesting(toolName, inputArgsJson, options) {\n\t\treturn this.executeToolByName(toolName, inputArgsJson, options, true);\n\t}\n\tasync executeToolByName(toolName, inputArgsJson, options, normalizeResult) {\n\t\tif (options?.signal?.aborted) throw createUnknownError(TOOL_CANCELLED_MESSAGE);\n\t\tconst tool = this.tools.get(toolName);\n\t\tif (!tool) throw createUnknownError(`Tool not found: ${toolName}`);\n\t\tconst args = parseInputArgsJson(inputArgsJson);\n\t\tconst validationError = await validateArgsForTool(args, tool);\n\t\tif (validationError) throw createUnknownError(validationError);\n\t\tlet contextActive = true;\n\t\tconst client = { requestUserInteraction: async (callback) => {\n\t\t\tif (!contextActive) throw new Error(`ModelContextClient for tool \"${toolName}\" is no longer active after execute() resolved`);\n\t\t\tif (typeof callback !== \"function\") throw new TypeError(\"requestUserInteraction(callback) requires a function callback\");\n\t\t\treturn callback();\n\t\t} };\n\t\ttry {\n\t\t\tconst execution = tool.execute(args, client);\n\t\t\tconst rawResult = await withAbortSignal(Promise.resolve(execution), options?.signal);\n\t\t\tif (normalizeResult) return toSerializedTestingResult(normalizeToolResponse(rawResult));\n\t\t\tconst serialized = JSON.stringify(rawResult);\n\t\t\treturn serialized === void 0 ? null : serialized;\n\t\t} catch (error) {\n\t\t\tthrow createUnknownError(error instanceof Error ? `${TOOL_INVOCATION_FAILED_MESSAGE}: ${error.message}` : TOOL_INVOCATION_FAILED_MESSAGE);\n\t\t} finally {\n\t\t\tcontextActive = false;\n\t\t}\n\t}\n\tnotifyToolsChanged() {\n\t\tqueueMicrotask(() => {\n\t\t\tconst event = new Event(\"toolchange\");\n\t\t\ttry {\n\t\t\t\tthis._ontoolchange?.call(this, event);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn(\"[WebMCPPolyfill] navigator.modelContext.ontoolchange handler threw:\", error);\n\t\t\t}\n\t\t\tthis.dispatchEvent(event);\n\t\t\tthis.testingShim?.dispatchToolChange();\n\t\t});\n\t}\n\twarnUnregisterToolDeprecationOnce() {\n\t\tif (this.unregisterToolDeprecationWarned) return;\n\t\tthis.unregisterToolDeprecationWarned = true;\n\t\tconsole.warn(\"[WebMCPPolyfill] navigator.modelContext.unregisterTool() is deprecated. The April 23, 2026 WebMCP draft removed it in favor of registerTool(tool, { signal }) — pass an AbortSignal and abort it to unregister.\");\n\t}\n};\n/**\n* EventTarget-based testing shim matching the native Chromium ModelContextTesting surface.\n*\n* Fires `toolchange` events and supports the `ontoolchange` handler property,\n* matching the native Chromium 148 API. The deprecated `registerToolsChangedCallback`\n* is kept as a compat layer that wraps `addEventListener`.\n*/\nvar PolyfillTestingShim = class extends EventTarget {\n\tcontext;\n\t_ontoolchange = null;\n\tconstructor(context) {\n\t\tsuper();\n\t\tthis.context = context;\n\t}\n\tlistTools() {\n\t\treturn this.context.getToolInfos();\n\t}\n\texecuteTool(toolName, inputArgsJson, options) {\n\t\treturn this.context.executeToolForTesting(toolName, inputArgsJson, options);\n\t}\n\tgetCrossDocumentScriptToolResult() {\n\t\treturn Promise.resolve(\"[]\");\n\t}\n\tget ontoolchange() {\n\t\treturn this._ontoolchange;\n\t}\n\tset ontoolchange(handler) {\n\t\tthis._ontoolchange = handler;\n\t}\n\t/**\n\t* @deprecated Use `addEventListener('toolchange', callback)` instead.\n\t* Kept for backward compatibility with older polyfill consumers.\n\t*/\n\tregisterToolsChangedCallback(callback) {\n\t\tif (typeof callback !== \"function\") throw new TypeError(\"Failed to execute 'registerToolsChangedCallback' on 'ModelContextTesting': parameter 1 is not of type 'Function'.\");\n\t\tthis.addEventListener(\"toolchange\", callback);\n\t}\n\t/** @internal Called by StrictWebMCPContext when tools change. */\n\tdispatchToolChange() {\n\t\tconst event = new Event(\"toolchange\");\n\t\ttry {\n\t\t\tthis._ontoolchange?.call(this, event);\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"[WebMCPPolyfill] ontoolchange handler threw:\", error);\n\t\t}\n\t\tthis.dispatchEvent(event);\n\t\tthis.dispatchEvent(new Event(\"toolschanged\"));\n\t}\n};\nfunction createUnknownError(message) {\n\ttry {\n\t\treturn new DOMException(message, \"UnknownError\");\n\t} catch {\n\t\tconst error = new Error(message);\n\t\terror.name = \"UnknownError\";\n\t\treturn error;\n\t}\n}\nfunction parseInputArgsJson(inputArgsJson) {\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(inputArgsJson);\n\t} catch {\n\t\tthrow createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);\n\t}\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) throw createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);\n\treturn parsed;\n}\nfunction getToolNameForUnregister(nameOrTool) {\n\tif (typeof nameOrTool === \"string\") return nameOrTool;\n\tif (isPlainObject(nameOrTool) && typeof nameOrTool.name === \"string\") return nameOrTool.name;\n\tthrow new TypeError(\"Failed to execute 'unregisterTool' on 'ModelContext': parameter 1 must be a string or an object with a string name.\");\n}\nfunction isPlainObject(value) {\n\treturn Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction getStandardProps(value) {\n\tif (!isPlainObject(value)) return null;\n\tconst standard = value[\"~standard\"];\n\tif (!isPlainObject(standard)) return null;\n\treturn standard;\n}\nfunction isStandardInputValidatorSchema(value) {\n\tconst standard = getStandardProps(value);\n\treturn Boolean(standard && standard.version === 1 && typeof standard.validate === \"function\");\n}\nfunction isStandardInputJsonSchema(value) {\n\tconst standard = getStandardProps(value);\n\tif (!standard || standard.version !== 1 || !isPlainObject(standard.jsonSchema)) return false;\n\treturn typeof standard.jsonSchema.input === \"function\";\n}\nfunction createStandardValidatorFromJsonSchema(schema) {\n\treturn { \"~standard\": {\n\t\tversion: 1,\n\t\tvendor: \"@mcp-b/webmcp-polyfill-json-schema\",\n\t\tvalidate(value) {\n\t\t\tif (!isPlainObject(value)) return { issues: [{ message: \"expected object arguments\" }] };\n\t\t\tconst issue = validateArgsWithSchema(value, schema);\n\t\t\tif (issue) return { issues: [issue] };\n\t\t\treturn { value };\n\t\t}\n\t} };\n}\nfunction convertStandardInputSchema(schema) {\n\tfor (const target of STANDARD_JSON_SCHEMA_TARGETS) try {\n\t\tconst converted = schema[\"~standard\"].jsonSchema.input({ target });\n\t\tvalidateInputSchema(converted);\n\t\treturn converted;\n\t} catch (error) {\n\t\tconsole.warn(`[WebMCPPolyfill] Standard JSON Schema conversion failed for target \"${target}\":`, error);\n\t}\n\tthrow new Error(\"Failed to convert Standard JSON Schema inputSchema to a JSON Schema object\");\n}\nfunction normalizeInputSchema(inputSchema) {\n\tif (inputSchema === void 0) {\n\t\tconst normalized = DEFAULT_INPUT_SCHEMA;\n\t\treturn {\n\t\t\tinputSchema: normalized,\n\t\t\tstandardValidator: createStandardValidatorFromJsonSchema(normalized)\n\t\t};\n\t}\n\tif (isStandardInputJsonSchema(inputSchema)) {\n\t\tconst converted = convertStandardInputSchema(inputSchema);\n\t\treturn {\n\t\t\tinputSchema: converted,\n\t\t\tstandardValidator: createStandardValidatorFromJsonSchema(converted)\n\t\t};\n\t}\n\tif (isStandardInputValidatorSchema(inputSchema)) return {\n\t\tinputSchema: DEFAULT_INPUT_SCHEMA,\n\t\tstandardValidator: inputSchema\n\t};\n\tvalidateInputSchema(inputSchema);\n\tif (Object.keys(inputSchema).length === 0) return {\n\t\tinputSchema: DEFAULT_INPUT_SCHEMA,\n\t\tstandardValidator: createStandardValidatorFromJsonSchema(DEFAULT_INPUT_SCHEMA)\n\t};\n\tconst normalizedSchema = inputSchema.type === void 0 ? {\n\t\ttype: \"object\",\n\t\t...inputSchema\n\t} : inputSchema;\n\treturn {\n\t\tinputSchema: normalizedSchema,\n\t\tstandardValidator: createStandardValidatorFromJsonSchema(normalizedSchema)\n\t};\n}\nfunction validateInputSchema(schema) {\n\tif (!isPlainObject(schema)) throw new Error(\"inputSchema must be a JSON Schema object\");\n\tvalidateJsonSchemaNode(schema, \"$\");\n}\nfunction validateJsonSchemaNode(node, path) {\n\tconst typeValue = node.type;\n\tif (typeValue !== void 0 && typeof typeValue !== \"string\" && !(Array.isArray(typeValue) && typeValue.every((entry) => typeof entry === \"string\" && entry.length > 0))) throw new Error(`Invalid JSON Schema at ${path}: \"type\" must be a string or string[]`);\n\tconst requiredValue = node.required;\n\tif (requiredValue !== void 0 && !(Array.isArray(requiredValue) && requiredValue.every((entry) => typeof entry === \"string\"))) throw new Error(`Invalid JSON Schema at ${path}: \"required\" must be an array of strings`);\n\tconst propertiesValue = node.properties;\n\tif (propertiesValue !== void 0) {\n\t\tif (!isPlainObject(propertiesValue)) throw new Error(`Invalid JSON Schema at ${path}: \"properties\" must be an object`);\n\t\tfor (const [key, value] of Object.entries(propertiesValue)) {\n\t\t\tif (!isPlainObject(value)) throw new Error(`Invalid JSON Schema at ${path}.properties.${key}: expected object schema`);\n\t\t\tvalidateJsonSchemaNode(value, `${path}.properties.${key}`);\n\t\t}\n\t}\n\tconst itemsValue = node.items;\n\tif (itemsValue !== void 0) if (Array.isArray(itemsValue)) for (const [index, value] of itemsValue.entries()) {\n\t\tif (!isPlainObject(value)) throw new Error(`Invalid JSON Schema at ${path}.items[${index}]: expected object schema`);\n\t\tvalidateJsonSchemaNode(value, `${path}.items[${index}]`);\n\t}\n\telse if (isPlainObject(itemsValue)) validateJsonSchemaNode(itemsValue, `${path}.items`);\n\telse throw new Error(`Invalid JSON Schema at ${path}: \"items\" must be an object or object[]`);\n\tfor (const keyword of [\n\t\t\"allOf\",\n\t\t\"anyOf\",\n\t\t\"oneOf\"\n\t]) {\n\t\tconst value = node[keyword];\n\t\tif (value === void 0) continue;\n\t\tif (!Array.isArray(value)) throw new Error(`Invalid JSON Schema at ${path}: \"${keyword}\" must be an array`);\n\t\tfor (const [index, entry] of value.entries()) {\n\t\t\tif (!isPlainObject(entry)) throw new Error(`Invalid JSON Schema at ${path}.${keyword}[${index}]: expected object schema`);\n\t\t\tvalidateJsonSchemaNode(entry, `${path}.${keyword}[${index}]`);\n\t\t}\n\t}\n\tconst notValue = node.not;\n\tif (notValue !== void 0) {\n\t\tif (!isPlainObject(notValue)) throw new Error(`Invalid JSON Schema at ${path}: \"not\" must be an object schema`);\n\t\tvalidateJsonSchemaNode(notValue, `${path}.not`);\n\t}\n\ttry {\n\t\tJSON.stringify(node);\n\t} catch {\n\t\tthrow new Error(`Invalid JSON Schema at ${path}: schema must be JSON-serializable`);\n\t}\n}\nfunction normalizeToolDescriptor(tool, existing) {\n\tif (!tool || typeof tool !== \"object\") throw new TypeError(\"registerTool(tool) requires a tool object\");\n\tif (typeof tool.name !== \"string\" || tool.name.length === 0) throw new TypeError(\"Tool \\\"name\\\" must be a non-empty string\");\n\tif (typeof tool.description !== \"string\" || tool.description.length === 0) throw new TypeError(\"Tool \\\"description\\\" must be a non-empty string\");\n\tif (typeof tool.execute !== \"function\") throw new TypeError(\"Tool \\\"execute\\\" must be a function\");\n\tif (existing.has(tool.name)) throw new Error(`Tool already registered: ${tool.name}`);\n\tconst normalizedInputSchema = normalizeInputSchema(tool.inputSchema);\n\tconst annotations = tool.annotations;\n\tconst normalizedAnnotations = annotations ? {\n\t\t...annotations,\n\t\t...annotations.readOnlyHint === \"true\" ? { readOnlyHint: true } : annotations.readOnlyHint === \"false\" ? { readOnlyHint: false } : {},\n\t\t...annotations.destructiveHint === \"true\" ? { destructiveHint: true } : annotations.destructiveHint === \"false\" ? { destructiveHint: false } : {},\n\t\t...annotations.idempotentHint === \"true\" ? { idempotentHint: true } : annotations.idempotentHint === \"false\" ? { idempotentHint: false } : {},\n\t\t...annotations.openWorldHint === \"true\" ? { openWorldHint: true } : annotations.openWorldHint === \"false\" ? { openWorldHint: false } : {}\n\t} : void 0;\n\treturn {\n\t\t...tool,\n\t\t...normalizedAnnotations ? { annotations: normalizedAnnotations } : {},\n\t\tinputSchema: normalizedInputSchema.inputSchema,\n\t\t[STANDARD_VALIDATOR_SYMBOL]: normalizedInputSchema.standardValidator\n\t};\n}\nfunction validateArgsWithSchema(args, schema) {\n\tconst result = new Validator(schema, \"2020-12\", true).validate(args);\n\tif (result.valid) return null;\n\tconst error = result.errors[result.errors.length - 1];\n\tif (!error) return { message: \"Input validation failed\" };\n\treturn { message: error.error };\n}\nfunction formatStandardIssuePath(path) {\n\tif (!path || path.length === 0) return null;\n\tconst segments = path.map((segment) => {\n\t\tif (isPlainObject(segment) && \"key\" in segment) return segment.key;\n\t\treturn segment;\n\t}).map((segment) => String(segment)).filter((segment) => segment.length > 0);\n\tif (segments.length === 0) return null;\n\treturn segments.join(\".\");\n}\nasync function validateArgsWithStandardSchema(args, schema) {\n\tlet result;\n\ttry {\n\t\tresult = await Promise.resolve(schema[\"~standard\"].validate(args));\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? `: ${error.message}` : \"\";\n\t\tconsole.error(\"[WebMCPPolyfill] Standard Schema validation threw unexpectedly:\", error);\n\t\treturn `Input validation error: schema validation failed${detail}`;\n\t}\n\tif (!result.issues || result.issues.length === 0) return null;\n\tconst firstIssue = result.issues[0];\n\tif (!firstIssue) return \"Input validation error\";\n\tconst path = formatStandardIssuePath(firstIssue?.path);\n\tif (path) return `Input validation error: ${firstIssue.message} at ${path}`;\n\treturn `Input validation error: ${firstIssue.message}`;\n}\nasync function validateArgsForTool(args, tool) {\n\treturn validateArgsWithStandardSchema(args, tool[STANDARD_VALIDATOR_SYMBOL]);\n}\nfunction isCallToolResult(value) {\n\treturn isPlainObject(value) && Array.isArray(value.content);\n}\nfunction isJsonPrimitive(value) {\n\treturn value === null || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\n}\nfunction isJsonValue(value) {\n\tif (isJsonPrimitive(value)) return Number.isFinite(value) || typeof value !== \"number\";\n\tif (Array.isArray(value)) return value.every((entry) => isJsonValue(entry));\n\tif (!isPlainObject(value)) return false;\n\treturn Object.values(value).every((entry) => isJsonValue(entry));\n}\nfunction toStructuredContent(value) {\n\tif (!isPlainObject(value) || !isJsonValue(value)) return;\n\treturn value;\n}\nfunction serializeTextContent(value) {\n\tif (typeof value === \"string\") return value;\n\ttry {\n\t\treturn JSON.stringify(value) ?? String(value);\n\t} catch {\n\t\treturn String(value);\n\t}\n}\nfunction normalizeToolResponse(value) {\n\tif (isCallToolResult(value)) return value;\n\tconst structuredContent = toStructuredContent(value);\n\treturn {\n\t\tcontent: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: serializeTextContent(value)\n\t\t}],\n\t\t...structuredContent ? { structuredContent } : {},\n\t\tisError: false\n\t};\n}\nfunction getFirstTextBlock(result) {\n\tfor (const block of result.content ?? []) if (block.type === \"text\" && \"text\" in block && typeof block.text === \"string\") return block.text;\n\treturn null;\n}\nfunction toSerializedTestingResult(result) {\n\tif (result.isError) throw createUnknownError(getFirstTextBlock(result)?.replace(/^Error:\\s*/i, \"\").trim() || TOOL_INVOCATION_FAILED_MESSAGE);\n\tconst metadata = result.metadata;\n\tif (metadata && typeof metadata === \"object\" && metadata.willNavigate) return null;\n\ttry {\n\t\treturn JSON.stringify(result);\n\t} catch {\n\t\tthrow createUnknownError(TOOL_INVOCATION_FAILED_MESSAGE);\n\t}\n}\nfunction withAbortSignal(operation, signal) {\n\tif (!signal) return operation;\n\tif (signal.aborted) return Promise.reject(createUnknownError(TOOL_CANCELLED_MESSAGE));\n\treturn new Promise((resolve, reject) => {\n\t\tconst onAbort = () => {\n\t\t\tcleanup();\n\t\t\treject(createUnknownError(TOOL_CANCELLED_MESSAGE));\n\t\t};\n\t\tconst cleanup = () => {\n\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t};\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\toperation.then((value) => {\n\t\t\tcleanup();\n\t\t\tresolve(value);\n\t\t}, (error) => {\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t});\n\t});\n}\nfunction getNavigator() {\n\tif (typeof navigator !== \"undefined\") return navigator;\n\treturn null;\n}\nfunction getDocument() {\n\tif (typeof document !== \"undefined\") return document;\n\treturn null;\n}\nfunction defineNavigatorProperty(target, key, value) {\n\tObject.defineProperty(target, key, {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\twritable: false,\n\t\tvalue\n\t});\n}\nfunction defineDocumentModelContextProperty(target, value) {\n\tObject.defineProperty(target, \"modelContext\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\twritable: false,\n\t\tvalue\n\t});\n}\nlet navigatorModelContextDeprecationWarned = false;\nfunction defineDeprecatedNavigatorModelContext(target, value) {\n\tObject.defineProperty(target, \"modelContext\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\tif (!navigatorModelContextDeprecationWarned) {\n\t\t\t\tnavigatorModelContextDeprecationWarned = true;\n\t\t\t\tconsole.warn(\"[WebMCPPolyfill] navigator.modelContext is deprecated. The May 27, 2026 WebMCP draft moved the modelContext getter from Navigator to Document — use document.modelContext instead. See https://github.com/webmachinelearning/webmcp/pull/184.\");\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t});\n}\nfunction initializeWebMCPPolyfill(options) {\n\tconst nav = getNavigator();\n\tconst doc = getDocument();\n\tif (!nav && !doc) return;\n\tconst documentModelContext = doc?.modelContext;\n\tif (Boolean(documentModelContext)) return;\n\tconst navigatorModelContext = nav?.modelContext;\n\tconst hasNavigatorModelContext = Boolean(navigatorModelContext);\n\tif (installState.installed) cleanupWebMCPPolyfill();\n\tif (doc && navigatorModelContext) {\n\t\tinstallState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, \"modelContext\");\n\t\tdefineDocumentModelContextProperty(doc, navigatorModelContext);\n\t\tinstallState.installedDocumentModelContext = true;\n\t\tinstallState.installed = true;\n\t\treturn;\n\t}\n\tif (hasNavigatorModelContext) return;\n\tconst context = new StrictWebMCPContext();\n\tconst modelContext = context;\n\tmodelContext[POLYFILL_MARKER_PROPERTY] = true;\n\tif (doc) {\n\t\tinstallState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, \"modelContext\");\n\t\tdefineDocumentModelContextProperty(doc, modelContext);\n\t\tinstallState.installedDocumentModelContext = true;\n\t}\n\tif (nav) {\n\t\tinstallState.previousNavigatorModelContextDescriptor = Object.getOwnPropertyDescriptor(nav, \"modelContext\");\n\t\tinstallState.previousNavigatorModelContextTestingDescriptor = Object.getOwnPropertyDescriptor(nav, \"modelContextTesting\");\n\t\tnavigatorModelContextDeprecationWarned = false;\n\t\tdefineDeprecatedNavigatorModelContext(nav, modelContext);\n\t\tinstallState.installedNavigatorModelContext = true;\n\t\tconst installTestingShim = options?.installTestingShim ?? \"if-missing\";\n\t\tconst hasModelContextTesting = Boolean(nav.modelContextTesting);\n\t\tif (installTestingShim === \"always\" || (installTestingShim === true || installTestingShim === \"if-missing\") && !hasModelContextTesting) {\n\t\t\tdefineNavigatorProperty(nav, \"modelContextTesting\", context.getTestingShim());\n\t\t\tinstallState.installedNavigatorModelContextTesting = true;\n\t\t}\n\t}\n\tinstallState.installed = true;\n}\nfunction cleanupWebMCPPolyfill() {\n\tif (!installState.installed) return;\n\tconst restore = (target, key, previousDescriptor) => {\n\t\tif (previousDescriptor) {\n\t\t\tObject.defineProperty(target, key, previousDescriptor);\n\t\t\treturn;\n\t\t}\n\t\tdelete target[key];\n\t};\n\tconst nav = getNavigator();\n\tconst doc = getDocument();\n\tif (doc && installState.installedDocumentModelContext) restore(doc, \"modelContext\", installState.previousDocumentModelContextDescriptor);\n\tif (nav && installState.installedNavigatorModelContext) restore(nav, \"modelContext\", installState.previousNavigatorModelContextDescriptor);\n\tif (nav && installState.installedNavigatorModelContextTesting) restore(nav, \"modelContextTesting\", installState.previousNavigatorModelContextTestingDescriptor);\n\tinstallState.installed = false;\n\tinstallState.previousDocumentModelContextDescriptor = void 0;\n\tinstallState.previousNavigatorModelContextDescriptor = void 0;\n\tinstallState.previousNavigatorModelContextTestingDescriptor = void 0;\n\tinstallState.installedDocumentModelContext = false;\n\tinstallState.installedNavigatorModelContext = false;\n\tinstallState.installedNavigatorModelContextTesting = false;\n\tnavigatorModelContextDeprecationWarned = false;\n}\nif (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n\tconst options = window.__webMCPPolyfillOptions;\n\tif (options?.autoInitialize !== false) try {\n\t\tinitializeWebMCPPolyfill(options);\n\t} catch (error) {\n\t\tconsole.error(\"[WebMCPPolyfill] Auto-initialization failed:\", error);\n\t}\n}\n\n//#endregion\nexport { cleanupWebMCPPolyfill, initializeWebMCPPolyfill, initializeWebMCPPolyfill as initializeWebModelContextPolyfill, isPlainObject, validateArgsWithSchema };\n//# sourceMappingURL=index.js.map","import { initializeWebMCPPolyfill } from \"@mcp-b/webmcp-polyfill\";\n\nimport { DEFAULT_GROUP_ID } from \"../../config/config.js\";\nimport { TOOL_DEFINITIONS, type ToolDefinition } from \"../tools/tools.js\";\n\nexport type WebMcpMode = \"polyfill\" | \"native\";\n\nconst registeredToolControllers: Map<string, AbortController> = new Map();\nconst registeredToolNames: Set<string> = new Set();\n\nlet currentMode: WebMcpMode = \"polyfill\";\n\n/**\n * Set the WebMCP mode (polyfill vs native).\n *\n * - `\"polyfill\"` (default): Uses `@mcp-b/webmcp-polyfill` for a pure-JS\n * `document.modelContext` that works in all browsers.\n * - `\"native\"`: Uses Chrome's native `document.modelContext` from\n * `chrome://flags/#enable-webmcp-testing`. Requires the flag to be\n * enabled. May crash in early Canary builds.\n *\n * Detection follows Chrome's recommended compat pattern:\n * `document.modelContext || navigator.modelContext`\n * `navigator.modelContext` was deprecated in Chrome 150 and removed in\n * Chrome 152.0.7943.0, but the fallback keeps older clients working.\n */\nexport function setWebMcpMode(mode: WebMcpMode): void {\n currentMode = mode;\n}\n\nexport function getWebMcpMode(): WebMcpMode {\n return currentMode;\n}\n\n/**\n * Install the `@mcp-b/webmcp-polyfill` onto `document.modelContext`.\n *\n * The polyfill itself bails out when Chrome's native `document.modelContext`\n * is already present — it does NOT override the native API. We call it\n * unconditionally; if the polyfill is already installed it will detect the\n * existing install via its own `installState` guard and return quickly.\n */\nfunction ensurePolyfill(): void {\n try {\n initializeWebMCPPolyfill();\n } catch (err) {\n console.warn(\"WebMCP polyfill initialization failed:\", err);\n }\n}\n\n/**\n * Access the WebMCP ModelContext API.\n *\n * In polyfill mode: installs the `@mcp-b/webmcp-polyfill` which surfaces\n * `document.modelContext`.\n * In native mode: follows Chrome's recommended feature-detection pattern:\n * `document.modelContext || navigator.modelContext`\n * `navigator.modelContext` was deprecated in Chrome 150 and removed in\n * Chrome 152.0.7943.0, but the fallback preserves compatibility with\n * earlier builds that may still be in the wild.\n */\nfunction getModelContextApi(): any {\n if (typeof document === \"undefined\" && typeof navigator === \"undefined\") {\n return null;\n }\n\n if (currentMode === \"polyfill\") {\n ensurePolyfill();\n }\n\n try {\n const modelContext: unknown =\n typeof document !== \"undefined\" &&\n typeof (document as any).modelContext !== \"undefined\"\n ? Reflect.get(document, \"modelContext\")\n : typeof navigator !== \"undefined\" &&\n typeof (navigator as any).modelContext !== \"undefined\"\n ? Reflect.get(navigator, \"modelContext\")\n : undefined;\n\n if (!modelContext || typeof modelContext !== \"object\") {\n return null;\n }\n\n const api = modelContext as {\n registerTool?: unknown;\n unregisterTool?: unknown;\n getTools?: unknown;\n executeTool?: unknown;\n };\n\n if (typeof api.registerTool !== \"function\") {\n return null;\n }\n\n return api;\n } catch (err) {\n console.warn(\"WebMCP modelContext access failed:\", err);\n\n return null;\n }\n}\n\n/**\n * Safely parse or normalize WebMCP input schema.\n *\n * Starting in Chrome 154.0.8014.0 (PR #241), `RegisteredTool#inputSchema` returns\n * a JavaScript object (a deep copy of the schema provided at registration).\n * In Chrome < 154.0.8014.0, `RegisteredTool#inputSchema` returned a stringified JSON schema (DOMString).\n *\n * This function provides backwards-compatible schema parsing:\n * - If inputSchema is a string: attempts JSON.parse.\n * - If inputSchema is an object: returns the object.\n * - Fallbacks gracefully to an empty object schema if null, undefined, or invalid JSON.\n */\nexport function parseWebMcpInputSchema(\n inputSchema: unknown,\n): Record<string, unknown> {\n if (typeof inputSchema === \"string\") {\n try {\n const parsed = JSON.parse(inputSchema);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n } catch {\n // Fallback on JSON parse error\n }\n\n return { type: \"object\", properties: {} };\n }\n\n if (\n inputSchema &&\n typeof inputSchema === \"object\" &&\n !Array.isArray(inputSchema)\n ) {\n return inputSchema as Record<string, unknown>;\n }\n\n return { type: \"object\", properties: {} };\n}\n\nexport interface WebMcpExecuteContext {\n signal?: AbortSignal;\n}\n\nexport interface WebMcpRegisteredTool {\n name: string;\n description?: string;\n inputSchema?: unknown;\n annotations?: Record<string, unknown>;\n execute?: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => Promise<unknown>;\n}\n\nexport interface NormalizedWebMcpRegisteredTool {\n name: string;\n description?: string;\n inputSchema: Record<string, unknown>;\n annotations?: Record<string, unknown>;\n execute?: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => Promise<unknown>;\n}\n\n/**\n * Safely extract AbortSignal from execute options/context.\n * Supports Chrome 153+ options object `{ signal }` (PR #247), direct AbortSignal instances,\n * or undefined for backward compatibility with Chrome < 153 and legacy callers.\n */\nexport function extractAbortSignal(\n context?: WebMcpExecuteContext | AbortSignal,\n): AbortSignal | undefined {\n if (!context) {\n return undefined;\n }\n\n if (typeof AbortSignal !== \"undefined\" && context instanceof AbortSignal) {\n return context;\n }\n\n if (\n typeof context === \"object\" &&\n \"signal\" in context &&\n typeof AbortSignal !== \"undefined\" &&\n context.signal instanceof AbortSignal\n ) {\n return context.signal;\n }\n\n return undefined;\n}\n\n/**\n * Retrieve tools registered on the WebMCP ModelContext API.\n *\n * Practicing graceful degradation:\n * - Feature-detects `getTools()` on `document.modelContext` / `navigator.modelContext`.\n * - If `getTools()` is absent (older browser builds or polyfills without getTools),\n * returns an empty array `[]` without throwing.\n * - Normalizes `RegisteredTool#inputSchema` so caller receives a JavaScript object\n * whether running on Chrome 154+ (native object) or Chrome < 154 (DOMString JSON).\n */\nexport async function getWebMcpTools(): Promise<\n NormalizedWebMcpRegisteredTool[]\n> {\n const modelContext = getModelContextApi() as {\n getTools?: () => Promise<WebMcpRegisteredTool[]>;\n } | null;\n\n if (!modelContext || typeof modelContext.getTools !== \"function\") {\n return [];\n }\n\n try {\n const rawTools = await modelContext.getTools();\n if (!Array.isArray(rawTools)) {\n return [];\n }\n\n return rawTools.map((tool) => ({\n name: tool.name,\n ...(tool.description ? { description: tool.description } : {}),\n inputSchema: parseWebMcpInputSchema(tool.inputSchema),\n ...(tool.annotations ? { annotations: tool.annotations } : {}),\n ...(tool.execute ? { execute: tool.execute } : {}),\n }));\n } catch (err) {\n console.warn(\"Failed to retrieve WebMCP tools via getTools():\", err);\n\n return [];\n }\n}\n\n/**\n * Feature detection for the WebMCP imperative API.\n *\n * To test this integration in Google Chrome, use the Model Context Tool\n * Inspector extension:\n * https://chromewebstore.google.com/detail/model-context-tool-inspec/gbpdfapgefenggkahomfgkhfehlcenpd\n */\nexport function isWebMcpSupported(): boolean {\n return !!getModelContextApi();\n}\n\n/**\n * Register ShadowClaw tools with the WebMCP ModelContext API.\n *\n * Both the `@mcp-b/webmcp-polyfill` and Chrome's native API support\n * `registerTool(tool, { signal })`. We always use AbortController signals so\n * that unregistration works identically regardless of which implementation is\n * actually active.\n *\n * Key correctness detail: `initializeWebMCPPolyfill()` is a no-op when\n * Chrome's native `document.modelContext` already exists — it does NOT\n * override the native API. In that situation we are talking to the native\n * Chrome API even in \"polyfill\" mode. The native Chrome API only supports\n * signal-based unregistration, so using AbortController signals everywhere\n * prevents \"Duplicate tool name\" errors when tools are re-configured.\n */\nexport async function registerWebMcpTools(\n agentWorker: Worker | null,\n _emit: (message: any) => Promise<void> | void,\n groupId: string = DEFAULT_GROUP_ID,\n tools?: ToolDefinition[],\n): Promise<boolean> {\n const activeTools = Array.isArray(tools) ? tools : TOOL_DEFINITIONS;\n\n if (activeTools.length === 0) {\n return true;\n }\n\n const modelContext = getModelContextApi();\n if (!modelContext) {\n return false;\n }\n\n for (const def of activeTools) {\n if (registeredToolNames.has(def.name)) {\n continue;\n }\n\n const controller = new AbortController();\n registeredToolControllers.set(def.name, controller);\n registeredToolNames.add(def.name);\n\n try {\n const toolDef: any = {\n name: def.name,\n description: def.description,\n inputSchema: parseWebMcpInputSchema(def.input_schema),\n annotations: {\n readOnlyHint: false,\n untrustedContentHint: true,\n },\n execute: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => {\n if (!agentWorker) {\n throw new Error(\"Cannot execute tool: agent worker is not ready\");\n }\n\n const signal = extractAbortSignal(context);\n\n if (signal?.aborted) {\n return Promise.reject(new Error(\"Tool execution aborted\"));\n }\n\n return new Promise((resolve, reject) => {\n const callId =\n Date.now().toString(36) + Math.random().toString(36).slice(2);\n\n let timeout: ReturnType<typeof setTimeout> | null = null;\n\n const cleanup = () => {\n if (timeout !== null) {\n clearTimeout(timeout);\n timeout = null;\n }\n agentWorker?.removeEventListener(\"message\", handler);\n if (signal && onAbort) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n };\n\n const onAbort = () => {\n cleanup();\n reject(new Error(\"Tool execution aborted\"));\n };\n\n if (signal) {\n signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n\n timeout = setTimeout(() => {\n cleanup();\n reject(new Error(\"Timeout waiting for tool execution\"));\n }, 600000);\n\n const handler = (event: MessageEvent) => {\n const data = event.data;\n if (\n data &&\n data.type === \"execute-tool-result\" &&\n data.callId === callId\n ) {\n cleanup();\n\n if (data.error) {\n reject(new Error(data.error));\n } else {\n resolve(data.result);\n }\n }\n };\n\n agentWorker.addEventListener(\"message\", handler);\n\n agentWorker.postMessage({\n type: \"execute-tool\",\n callId,\n payload: { name: def.name, input: input || {}, groupId },\n });\n });\n },\n };\n\n // Always use AbortController signals — both the polyfill and the native\n // Chrome API honour { signal } for lifecycle management.\n await modelContext.registerTool(toolDef, { signal: controller.signal });\n\n // Yield to the event loop between registrations.\n await new Promise((resolve) => setTimeout(resolve, 0));\n } catch (err) {\n registeredToolControllers.delete(def.name);\n registeredToolNames.delete(def.name);\n\n // Treat duplicate-registration errors as a no-op. The polyfill throws\n // \"Tool already registered: <name>\" and the native Chrome API throws\n // \"Duplicate tool name\" — both mean the tool is already present.\n const isDuplicate =\n err instanceof Error &&\n (err.message.includes(\"already registered\") ||\n err.message.includes(\"Duplicate tool name\"));\n\n if (!isDuplicate) {\n console.error(`Failed to register tool ${def.name}:`, err);\n\n throw err;\n }\n }\n }\n\n return true;\n}\n\n/**\n * Unregister previously registered ShadowClaw WebMCP tools.\n *\n * Aborts every AbortController associated with a registered tool. This works\n * for both the polyfill (which listens for the `abort` event on the signal it\n * was given) and Chrome's native API (which also uses signal-based lifecycle).\n * The deprecated `unregisterTool(name)` is intentionally NOT called here\n * because it is absent from the native Chrome API and causes silent failures\n * that prevent proper cleanup.\n */\nexport function unregisterWebMcpTools() {\n for (const controller of registeredToolControllers.values()) {\n try {\n controller.abort();\n } catch {\n // Ignore unregister errors in experimental API contexts.\n }\n }\n\n registeredToolControllers.clear();\n registeredToolNames.clear();\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7],"mappings":";;;;;;AAAA,SAAgB,kBAAkB,GAAG,GAAG;CACpC,MAAM,UAAU,OAAO;CACvB,IAAI,YAAY,OAAO,GACnB,OAAO;CAEX,IAAI,MAAM,QAAQ,CAAC,GAAG;EAClB,IAAI,CAAC,MAAM,QAAQ,CAAC,GAChB,OAAO;EAEX,MAAM,SAAS,EAAE;EACjB,IAAI,WAAW,EAAE,QACb,OAAO;EAEX,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,KACxB,IAAI,CAAC,kBAAkB,EAAE,IAAI,EAAE,EAAE,GAC7B,OAAO;EAGf,OAAO;CACX;CACA,IAAI,YAAY,UAAU;EACtB,IAAI,CAAC,KAAK,CAAC,GACP,OAAO,MAAM;EAEjB,MAAM,QAAQ,OAAO,KAAK,CAAC;EAC3B,MAAM,QAAQ,OAAO,KAAK,CAAC;EAE3B,IADe,MAAM,WACN,MAAM,QACjB,OAAO;EAEX,KAAK,MAAM,KAAK,OACZ,IAAI,CAAC,kBAAkB,EAAE,IAAI,EAAE,EAAE,GAC7B,OAAO;EAGf,OAAO;CACX;CACA,OAAO,MAAM;AACjB;;;;ACtCA,SAAgB,cAAc,GAAG;CAC7B,OAAO,UAAU,cAAc,CAAC,CAAC;AACrC;AACA,SAAgB,cAAc,GAAG;CAC7B,OAAO,EAAE,QAAQ,MAAM,IAAI,CAAC,CAAC,QAAQ,OAAO,IAAI;AACpD;;;;ACSA,MAAa,qBAAqB;CAC9B,aAAa;CACb,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;AACX;AACA,MAA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Y,WAAW,SAAS,CAAC,CAAC;EACvD,SAAS,KAAK;GACZ,0BAA0B,OAAO,IAAI,IAAI;GACzC,oBAAoB,OAAO,IAAI,IAAI;GAUnC,IAAI,EAJF,eAAe,UACd,IAAI,QAAQ,SAAS,oBAAoB,KACxC,IAAI,QAAQ,SAAS,qBAAqB,KAE5B;IAChB,QAAQ,MAAM,2BAA2B,IAAI,KAAK,IAAI,GAAG;IAEzD,MAAM;GACR;EACF;CACF;CAEA,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,wBAAwB;CACtC,KAAK,MAAM,cAAc,0BAA0B,OAAO,GACxD,IAAI;EACF,WAAW,MAAM;CACnB,QAAQ,CAER;CAGF,0BAA0B,MAAM;CAChC,oBAAoB,MAAM;AAC5B"}
1
+ {"version":3,"file":"webmcp-BC8_WafM.js","names":[],"sources":["../../node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js","../../node_modules/@cfworker/json-schema/dist/esm/pointer.js","../../node_modules/@cfworker/json-schema/dist/esm/dereference.js","../../node_modules/@cfworker/json-schema/dist/esm/format.js","../../node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js","../../node_modules/@cfworker/json-schema/dist/esm/validate.js","../../node_modules/@cfworker/json-schema/dist/esm/validator.js","../../node_modules/@mcp-b/webmcp-polyfill/dist/index.js","../../src/subsystems/mcp/webmcp.ts"],"sourcesContent":["export function deepCompareStrict(a, b) {\n const typeofa = typeof a;\n if (typeofa !== typeof b) {\n return false;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b)) {\n return false;\n }\n const length = a.length;\n if (length !== b.length) {\n return false;\n }\n for (let i = 0; i < length; i++) {\n if (!deepCompareStrict(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n if (typeofa === 'object') {\n if (!a || !b) {\n return a === b;\n }\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n const length = aKeys.length;\n if (length !== bKeys.length) {\n return false;\n }\n for (const k of aKeys) {\n if (!deepCompareStrict(a[k], b[k])) {\n return false;\n }\n }\n return true;\n }\n return a === b;\n}\n","export function encodePointer(p) {\n return encodeURI(escapePointer(p));\n}\nexport function escapePointer(p) {\n return p.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n","import { encodePointer } from './pointer.js';\nexport const schemaKeyword = {\n additionalItems: true,\n unevaluatedItems: true,\n items: true,\n contains: true,\n additionalProperties: true,\n unevaluatedProperties: true,\n propertyNames: true,\n not: true,\n if: true,\n then: true,\n else: true\n};\nexport const schemaArrayKeyword = {\n prefixItems: true,\n items: true,\n allOf: true,\n anyOf: true,\n oneOf: true\n};\nexport const schemaMapKeyword = {\n $defs: true,\n definitions: true,\n properties: true,\n patternProperties: true,\n dependentSchemas: true\n};\nexport const ignoredKeyword = {\n id: true,\n $id: true,\n $ref: true,\n $schema: true,\n $anchor: true,\n $vocabulary: true,\n $comment: true,\n default: true,\n enum: true,\n const: true,\n required: true,\n type: true,\n maximum: true,\n minimum: true,\n exclusiveMaximum: true,\n exclusiveMinimum: true,\n multipleOf: true,\n maxLength: true,\n minLength: true,\n pattern: true,\n format: true,\n maxItems: true,\n minItems: true,\n uniqueItems: true,\n maxProperties: true,\n minProperties: true\n};\nexport let initialBaseURI = typeof self !== 'undefined' &&\n self.location &&\n self.location.origin !== 'null'\n ?\n new URL(self.location.origin + self.location.pathname + location.search)\n : new URL('https://github.com/cfworker');\nexport function dereference(schema, lookup = Object.create(null), baseURI = initialBaseURI, basePointer = '') {\n if (schema && typeof schema === 'object' && !Array.isArray(schema)) {\n const id = schema.$id || schema.id;\n if (id) {\n const url = new URL(id, baseURI.href);\n if (url.hash.length > 1) {\n lookup[url.href] = schema;\n }\n else {\n url.hash = '';\n if (basePointer === '') {\n baseURI = url;\n }\n else {\n dereference(schema, lookup, baseURI);\n }\n }\n }\n }\n else if (schema !== true && schema !== false) {\n return lookup;\n }\n const schemaURI = baseURI.href + (basePointer ? '#' + basePointer : '');\n if (lookup[schemaURI] !== undefined) {\n throw new Error(`Duplicate schema URI \"${schemaURI}\".`);\n }\n lookup[schemaURI] = schema;\n if (schema === true || schema === false) {\n return lookup;\n }\n if (schema.__absolute_uri__ === undefined) {\n Object.defineProperty(schema, '__absolute_uri__', {\n enumerable: false,\n value: schemaURI\n });\n }\n if (schema.$ref && schema.__absolute_ref__ === undefined) {\n const url = new URL(schema.$ref, baseURI.href);\n url.hash = url.hash;\n Object.defineProperty(schema, '__absolute_ref__', {\n enumerable: false,\n value: url.href\n });\n }\n if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === undefined) {\n const url = new URL(schema.$recursiveRef, baseURI.href);\n url.hash = url.hash;\n Object.defineProperty(schema, '__absolute_recursive_ref__', {\n enumerable: false,\n value: url.href\n });\n }\n if (schema.$anchor) {\n const url = new URL('#' + schema.$anchor, baseURI.href);\n lookup[url.href] = schema;\n }\n for (let key in schema) {\n if (ignoredKeyword[key]) {\n continue;\n }\n const keyBase = `${basePointer}/${encodePointer(key)}`;\n const subSchema = schema[key];\n if (Array.isArray(subSchema)) {\n if (schemaArrayKeyword[key]) {\n const length = subSchema.length;\n for (let i = 0; i < length; i++) {\n dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);\n }\n }\n }\n else if (schemaMapKeyword[key]) {\n for (let subKey in subSchema) {\n dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);\n }\n }\n else {\n dereference(subSchema, lookup, baseURI, keyBase);\n }\n }\n return lookup;\n}\n","const DATE = /^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/;\nconst DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nconst TIME = /^(\\d\\d):(\\d\\d):(\\d\\d)(\\.\\d+)?(z|[+-]\\d\\d(?::?\\d\\d)?)?$/i;\nconst HOSTNAME = /^(?=.{1,253}\\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\\.?$/i;\nconst URI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})*)*)?(?:\\?(?:[a-z0-9\\-._~!$&'\"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\\-._~!$&'\"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;\nconst URITEMPLATE = /^(?:(?:[^\\x00-\\x20\"'<>%\\\\^`{|}]|%[0-9a-f]{2})|\\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?)*\\})*$/i;\nconst URL_ = /^(?:(?:https?|ftp):\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu;\nconst UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;\nconst JSON_POINTER = /^(?:\\/(?:[^~/]|~0|~1)*)*$/;\nconst JSON_POINTER_URI_FRAGMENT = /^#(?:\\/(?:[a-z0-9_\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;\nconst RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/;\nconst EMAIL = (input) => {\n if (input[0] === '\"')\n return false;\n const [name, host, ...rest] = input.split('@');\n if (!name ||\n !host ||\n rest.length !== 0 ||\n name.length > 64 ||\n host.length > 253)\n return false;\n if (name[0] === '.' || name.endsWith('.') || name.includes('..'))\n return false;\n if (!/^[a-z0-9.-]+$/i.test(host) ||\n !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name))\n return false;\n return host\n .split('.')\n .every(part => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));\n};\nconst IPV4 = /^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$/;\nconst IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))$/i;\nconst DURATION = (input) => input.length > 1 &&\n input.length < 80 &&\n (/^P\\d+([.,]\\d+)?W$/.test(input) ||\n (/^P[\\dYMDTHS]*(\\d[.,]\\d+)?[YMDHS]$/.test(input) &&\n /^P([.,\\d]+Y)?([.,\\d]+M)?([.,\\d]+D)?(T([.,\\d]+H)?([.,\\d]+M)?([.,\\d]+S)?)?$/.test(input)));\nfunction bind(r) {\n return r.test.bind(r);\n}\nexport const format = {\n date,\n time: time.bind(undefined, false),\n 'date-time': date_time,\n duration: DURATION,\n uri,\n 'uri-reference': bind(URIREF),\n 'uri-template': bind(URITEMPLATE),\n url: bind(URL_),\n email: EMAIL,\n hostname: bind(HOSTNAME),\n ipv4: bind(IPV4),\n ipv6: bind(IPV6),\n regex: regex,\n uuid: bind(UUID),\n 'json-pointer': bind(JSON_POINTER),\n 'json-pointer-uri-fragment': bind(JSON_POINTER_URI_FRAGMENT),\n 'relative-json-pointer': bind(RELATIVE_JSON_POINTER)\n};\nfunction isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\nfunction date(str) {\n const matches = str.match(DATE);\n if (!matches)\n return false;\n const year = +matches[1];\n const month = +matches[2];\n const day = +matches[3];\n return (month >= 1 &&\n month <= 12 &&\n day >= 1 &&\n day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]));\n}\nfunction time(full, str) {\n const matches = str.match(TIME);\n if (!matches)\n return false;\n const hour = +matches[1];\n const minute = +matches[2];\n const second = +matches[3];\n const timeZone = !!matches[5];\n return (((hour <= 23 && minute <= 59 && second <= 59) ||\n (hour == 23 && minute == 59 && second == 60)) &&\n (!full || timeZone));\n}\nconst DATE_TIME_SEPARATOR = /t|\\s/i;\nfunction date_time(str) {\n const dateTime = str.split(DATE_TIME_SEPARATOR);\n return dateTime.length == 2 && date(dateTime[0]) && time(true, dateTime[1]);\n}\nconst NOT_URI_FRAGMENT = /\\/|:/;\nconst URI_PATTERN = /^(?:[a-z][a-z0-9+\\-.]*:)(?:\\/?\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\\.[a-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)|(?:[a-z0-9\\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\\d*)?(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\\?(?:[a-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;\nfunction uri(str) {\n return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);\n}\nconst Z_ANCHOR = /[^\\\\]\\\\Z/;\nfunction regex(str) {\n if (Z_ANCHOR.test(str))\n return false;\n try {\n new RegExp(str, 'u');\n return true;\n }\n catch (e) {\n return false;\n }\n}\n","export function ucs2length(s) {\n let result = 0;\n let length = s.length;\n let index = 0;\n let charCode;\n while (index < length) {\n result++;\n charCode = s.charCodeAt(index++);\n if (charCode >= 0xd800 && charCode <= 0xdbff && index < length) {\n charCode = s.charCodeAt(index);\n if ((charCode & 0xfc00) == 0xdc00) {\n index++;\n }\n }\n }\n return result;\n}\n","import { deepCompareStrict } from './deep-compare-strict.js';\nimport { dereference } from './dereference.js';\nimport { format } from './format.js';\nimport { encodePointer } from './pointer.js';\nimport { ucs2length } from './ucs2-length.js';\nexport function validate(instance, schema, draft = '2019-09', lookup = dereference(schema), shortCircuit = true, recursiveAnchor = null, instanceLocation = '#', schemaLocation = '#', evaluated = Object.create(null)) {\n if (schema === true) {\n return { valid: true, errors: [] };\n }\n if (schema === false) {\n return {\n valid: false,\n errors: [\n {\n instanceLocation,\n keyword: 'false',\n keywordLocation: instanceLocation,\n error: 'False boolean schema.'\n }\n ]\n };\n }\n const rawInstanceType = typeof instance;\n let instanceType;\n switch (rawInstanceType) {\n case 'boolean':\n case 'number':\n case 'string':\n instanceType = rawInstanceType;\n break;\n case 'object':\n if (instance === null) {\n instanceType = 'null';\n }\n else if (Array.isArray(instance)) {\n instanceType = 'array';\n }\n else {\n instanceType = 'object';\n }\n break;\n default:\n throw new Error(`Instances of \"${rawInstanceType}\" type are not supported.`);\n }\n const { $ref, $recursiveRef, $recursiveAnchor, type: $type, const: $const, enum: $enum, required: $required, not: $not, anyOf: $anyOf, allOf: $allOf, oneOf: $oneOf, if: $if, then: $then, else: $else, format: $format, properties: $properties, patternProperties: $patternProperties, additionalProperties: $additionalProperties, unevaluatedProperties: $unevaluatedProperties, minProperties: $minProperties, maxProperties: $maxProperties, propertyNames: $propertyNames, dependentRequired: $dependentRequired, dependentSchemas: $dependentSchemas, dependencies: $dependencies, prefixItems: $prefixItems, items: $items, additionalItems: $additionalItems, unevaluatedItems: $unevaluatedItems, contains: $contains, minContains: $minContains, maxContains: $maxContains, minItems: $minItems, maxItems: $maxItems, uniqueItems: $uniqueItems, minimum: $minimum, maximum: $maximum, exclusiveMinimum: $exclusiveMinimum, exclusiveMaximum: $exclusiveMaximum, multipleOf: $multipleOf, minLength: $minLength, maxLength: $maxLength, pattern: $pattern, __absolute_ref__, __absolute_recursive_ref__ } = schema;\n const errors = [];\n if ($recursiveAnchor === true && recursiveAnchor === null) {\n recursiveAnchor = schema;\n }\n if ($recursiveRef === '#') {\n const refSchema = recursiveAnchor === null\n ? lookup[__absolute_recursive_ref__]\n : recursiveAnchor;\n const keywordLocation = `${schemaLocation}/$recursiveRef`;\n const result = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: '$recursiveRef',\n keywordLocation,\n error: 'A subschema had errors.'\n }, ...result.errors);\n }\n }\n if ($ref !== undefined) {\n const uri = __absolute_ref__ || $ref;\n const refSchema = lookup[uri];\n if (refSchema === undefined) {\n let message = `Unresolved $ref \"${$ref}\".`;\n if (__absolute_ref__ && __absolute_ref__ !== $ref) {\n message += ` Absolute URI \"${__absolute_ref__}\".`;\n }\n message += `\\nKnown schemas:\\n- ${Object.keys(lookup).join('\\n- ')}`;\n throw new Error(message);\n }\n const keywordLocation = `${schemaLocation}/$ref`;\n const result = validate(instance, refSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: '$ref',\n keywordLocation,\n error: 'A subschema had errors.'\n }, ...result.errors);\n }\n if (draft === '4' || draft === '7') {\n return { valid: errors.length === 0, errors };\n }\n }\n if (Array.isArray($type)) {\n let length = $type.length;\n let valid = false;\n for (let i = 0; i < length; i++) {\n if (instanceType === $type[i] ||\n ($type[i] === 'integer' &&\n instanceType === 'number' &&\n instance % 1 === 0 &&\n instance === instance)) {\n valid = true;\n break;\n }\n }\n if (!valid) {\n errors.push({\n instanceLocation,\n keyword: 'type',\n keywordLocation: `${schemaLocation}/type`,\n error: `Instance type \"${instanceType}\" is invalid. Expected \"${$type.join('\", \"')}\".`\n });\n }\n }\n else if ($type === 'integer') {\n if (instanceType !== 'number' || instance % 1 || instance !== instance) {\n errors.push({\n instanceLocation,\n keyword: 'type',\n keywordLocation: `${schemaLocation}/type`,\n error: `Instance type \"${instanceType}\" is invalid. Expected \"${$type}\".`\n });\n }\n }\n else if ($type !== undefined && instanceType !== $type) {\n errors.push({\n instanceLocation,\n keyword: 'type',\n keywordLocation: `${schemaLocation}/type`,\n error: `Instance type \"${instanceType}\" is invalid. Expected \"${$type}\".`\n });\n }\n if ($const !== undefined) {\n if (instanceType === 'object' || instanceType === 'array') {\n if (!deepCompareStrict(instance, $const)) {\n errors.push({\n instanceLocation,\n keyword: 'const',\n keywordLocation: `${schemaLocation}/const`,\n error: `Instance does not match ${JSON.stringify($const)}.`\n });\n }\n }\n else if (instance !== $const) {\n errors.push({\n instanceLocation,\n keyword: 'const',\n keywordLocation: `${schemaLocation}/const`,\n error: `Instance does not match ${JSON.stringify($const)}.`\n });\n }\n }\n if ($enum !== undefined) {\n if (instanceType === 'object' || instanceType === 'array') {\n if (!$enum.some(value => deepCompareStrict(instance, value))) {\n errors.push({\n instanceLocation,\n keyword: 'enum',\n keywordLocation: `${schemaLocation}/enum`,\n error: `Instance does not match any of ${JSON.stringify($enum)}.`\n });\n }\n }\n else if (!$enum.some(value => instance === value)) {\n errors.push({\n instanceLocation,\n keyword: 'enum',\n keywordLocation: `${schemaLocation}/enum`,\n error: `Instance does not match any of ${JSON.stringify($enum)}.`\n });\n }\n }\n if ($not !== undefined) {\n const keywordLocation = `${schemaLocation}/not`;\n const result = validate(instance, $not, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation);\n if (result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'not',\n keywordLocation,\n error: 'Instance matched \"not\" schema.'\n });\n }\n }\n let subEvaluateds = [];\n if ($anyOf !== undefined) {\n const keywordLocation = `${schemaLocation}/anyOf`;\n const errorsLength = errors.length;\n let anyValid = false;\n for (let i = 0; i < $anyOf.length; i++) {\n const subSchema = $anyOf[i];\n const subEvaluated = Object.create(evaluated);\n const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);\n errors.push(...result.errors);\n anyValid = anyValid || result.valid;\n if (result.valid) {\n subEvaluateds.push(subEvaluated);\n }\n }\n if (anyValid) {\n errors.length = errorsLength;\n }\n else {\n errors.splice(errorsLength, 0, {\n instanceLocation,\n keyword: 'anyOf',\n keywordLocation,\n error: 'Instance does not match any subschemas.'\n });\n }\n }\n if ($allOf !== undefined) {\n const keywordLocation = `${schemaLocation}/allOf`;\n const errorsLength = errors.length;\n let allValid = true;\n for (let i = 0; i < $allOf.length; i++) {\n const subSchema = $allOf[i];\n const subEvaluated = Object.create(evaluated);\n const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);\n errors.push(...result.errors);\n allValid = allValid && result.valid;\n if (result.valid) {\n subEvaluateds.push(subEvaluated);\n }\n }\n if (allValid) {\n errors.length = errorsLength;\n }\n else {\n errors.splice(errorsLength, 0, {\n instanceLocation,\n keyword: 'allOf',\n keywordLocation,\n error: `Instance does not match every subschema.`\n });\n }\n }\n if ($oneOf !== undefined) {\n const keywordLocation = `${schemaLocation}/oneOf`;\n const errorsLength = errors.length;\n const matches = $oneOf.filter((subSchema, i) => {\n const subEvaluated = Object.create(evaluated);\n const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);\n errors.push(...result.errors);\n if (result.valid) {\n subEvaluateds.push(subEvaluated);\n }\n return result.valid;\n }).length;\n if (matches === 1) {\n errors.length = errorsLength;\n }\n else {\n errors.splice(errorsLength, 0, {\n instanceLocation,\n keyword: 'oneOf',\n keywordLocation,\n error: `Instance does not match exactly one subschema (${matches} matches).`\n });\n }\n }\n if (instanceType === 'object' || instanceType === 'array') {\n Object.assign(evaluated, ...subEvaluateds);\n }\n if ($if !== undefined) {\n const keywordLocation = `${schemaLocation}/if`;\n const conditionResult = validate(instance, $if, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated).valid;\n if (conditionResult) {\n if ($then !== undefined) {\n const thenResult = validate(instance, $then, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/then`, evaluated);\n if (!thenResult.valid) {\n errors.push({\n instanceLocation,\n keyword: 'if',\n keywordLocation,\n error: `Instance does not match \"then\" schema.`\n }, ...thenResult.errors);\n }\n }\n }\n else if ($else !== undefined) {\n const elseResult = validate(instance, $else, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/else`, evaluated);\n if (!elseResult.valid) {\n errors.push({\n instanceLocation,\n keyword: 'if',\n keywordLocation,\n error: `Instance does not match \"else\" schema.`\n }, ...elseResult.errors);\n }\n }\n }\n if (instanceType === 'object') {\n if ($required !== undefined) {\n for (const key of $required) {\n if (!(key in instance)) {\n errors.push({\n instanceLocation,\n keyword: 'required',\n keywordLocation: `${schemaLocation}/required`,\n error: `Instance does not have required property \"${key}\".`\n });\n }\n }\n }\n const keys = Object.keys(instance);\n if ($minProperties !== undefined && keys.length < $minProperties) {\n errors.push({\n instanceLocation,\n keyword: 'minProperties',\n keywordLocation: `${schemaLocation}/minProperties`,\n error: `Instance does not have at least ${$minProperties} properties.`\n });\n }\n if ($maxProperties !== undefined && keys.length > $maxProperties) {\n errors.push({\n instanceLocation,\n keyword: 'maxProperties',\n keywordLocation: `${schemaLocation}/maxProperties`,\n error: `Instance does not have at least ${$maxProperties} properties.`\n });\n }\n if ($propertyNames !== undefined) {\n const keywordLocation = `${schemaLocation}/propertyNames`;\n for (const key in instance) {\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(key, $propertyNames, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'propertyNames',\n keywordLocation,\n error: `Property name \"${key}\" does not match schema.`\n }, ...result.errors);\n }\n }\n }\n if ($dependentRequired !== undefined) {\n const keywordLocation = `${schemaLocation}/dependantRequired`;\n for (const key in $dependentRequired) {\n if (key in instance) {\n const required = $dependentRequired[key];\n for (const dependantKey of required) {\n if (!(dependantKey in instance)) {\n errors.push({\n instanceLocation,\n keyword: 'dependentRequired',\n keywordLocation,\n error: `Instance has \"${key}\" but does not have \"${dependantKey}\".`\n });\n }\n }\n }\n }\n }\n if ($dependentSchemas !== undefined) {\n for (const key in $dependentSchemas) {\n const keywordLocation = `${schemaLocation}/dependentSchemas`;\n if (key in instance) {\n const result = validate(instance, $dependentSchemas[key], draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`, evaluated);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'dependentSchemas',\n keywordLocation,\n error: `Instance has \"${key}\" but does not match dependant schema.`\n }, ...result.errors);\n }\n }\n }\n }\n if ($dependencies !== undefined) {\n const keywordLocation = `${schemaLocation}/dependencies`;\n for (const key in $dependencies) {\n if (key in instance) {\n const propsOrSchema = $dependencies[key];\n if (Array.isArray(propsOrSchema)) {\n for (const dependantKey of propsOrSchema) {\n if (!(dependantKey in instance)) {\n errors.push({\n instanceLocation,\n keyword: 'dependencies',\n keywordLocation,\n error: `Instance has \"${key}\" but does not have \"${dependantKey}\".`\n });\n }\n }\n }\n else {\n const result = validate(instance, propsOrSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`);\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'dependencies',\n keywordLocation,\n error: `Instance has \"${key}\" but does not match dependant schema.`\n }, ...result.errors);\n }\n }\n }\n }\n }\n const thisEvaluated = Object.create(null);\n let stop = false;\n if ($properties !== undefined) {\n const keywordLocation = `${schemaLocation}/properties`;\n for (const key in $properties) {\n if (!(key in instance)) {\n continue;\n }\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(instance[key], $properties[key], draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(key)}`);\n if (result.valid) {\n evaluated[key] = thisEvaluated[key] = true;\n }\n else {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'properties',\n keywordLocation,\n error: `Property \"${key}\" does not match schema.`\n }, ...result.errors);\n if (stop)\n break;\n }\n }\n }\n if (!stop && $patternProperties !== undefined) {\n const keywordLocation = `${schemaLocation}/patternProperties`;\n for (const pattern in $patternProperties) {\n const regex = new RegExp(pattern, 'u');\n const subSchema = $patternProperties[pattern];\n for (const key in instance) {\n if (!regex.test(key)) {\n continue;\n }\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(instance[key], subSchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(pattern)}`);\n if (result.valid) {\n evaluated[key] = thisEvaluated[key] = true;\n }\n else {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'patternProperties',\n keywordLocation,\n error: `Property \"${key}\" matches pattern \"${pattern}\" but does not match associated schema.`\n }, ...result.errors);\n }\n }\n }\n }\n if (!stop && $additionalProperties !== undefined) {\n const keywordLocation = `${schemaLocation}/additionalProperties`;\n for (const key in instance) {\n if (thisEvaluated[key]) {\n continue;\n }\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(instance[key], $additionalProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);\n if (result.valid) {\n evaluated[key] = true;\n }\n else {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'additionalProperties',\n keywordLocation,\n error: `Property \"${key}\" does not match additional properties schema.`\n }, ...result.errors);\n }\n }\n }\n else if (!stop && $unevaluatedProperties !== undefined) {\n const keywordLocation = `${schemaLocation}/unevaluatedProperties`;\n for (const key in instance) {\n if (!evaluated[key]) {\n const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;\n const result = validate(instance[key], $unevaluatedProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);\n if (result.valid) {\n evaluated[key] = true;\n }\n else {\n errors.push({\n instanceLocation,\n keyword: 'unevaluatedProperties',\n keywordLocation,\n error: `Property \"${key}\" does not match unevaluated properties schema.`\n }, ...result.errors);\n }\n }\n }\n }\n }\n else if (instanceType === 'array') {\n if ($maxItems !== undefined && instance.length > $maxItems) {\n errors.push({\n instanceLocation,\n keyword: 'maxItems',\n keywordLocation: `${schemaLocation}/maxItems`,\n error: `Array has too many items (${instance.length} > ${$maxItems}).`\n });\n }\n if ($minItems !== undefined && instance.length < $minItems) {\n errors.push({\n instanceLocation,\n keyword: 'minItems',\n keywordLocation: `${schemaLocation}/minItems`,\n error: `Array has too few items (${instance.length} < ${$minItems}).`\n });\n }\n const length = instance.length;\n let i = 0;\n let stop = false;\n if ($prefixItems !== undefined) {\n const keywordLocation = `${schemaLocation}/prefixItems`;\n const length2 = Math.min($prefixItems.length, length);\n for (; i < length2; i++) {\n const result = validate(instance[i], $prefixItems[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);\n evaluated[i] = true;\n if (!result.valid) {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'prefixItems',\n keywordLocation,\n error: `Items did not match schema.`\n }, ...result.errors);\n if (stop)\n break;\n }\n }\n }\n if ($items !== undefined) {\n const keywordLocation = `${schemaLocation}/items`;\n if (Array.isArray($items)) {\n const length2 = Math.min($items.length, length);\n for (; i < length2; i++) {\n const result = validate(instance[i], $items[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);\n evaluated[i] = true;\n if (!result.valid) {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'items',\n keywordLocation,\n error: `Items did not match schema.`\n }, ...result.errors);\n if (stop)\n break;\n }\n }\n }\n else {\n for (; i < length; i++) {\n const result = validate(instance[i], $items, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);\n evaluated[i] = true;\n if (!result.valid) {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'items',\n keywordLocation,\n error: `Items did not match schema.`\n }, ...result.errors);\n if (stop)\n break;\n }\n }\n }\n if (!stop && $additionalItems !== undefined) {\n const keywordLocation = `${schemaLocation}/additionalItems`;\n for (; i < length; i++) {\n const result = validate(instance[i], $additionalItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);\n evaluated[i] = true;\n if (!result.valid) {\n stop = shortCircuit;\n errors.push({\n instanceLocation,\n keyword: 'additionalItems',\n keywordLocation,\n error: `Items did not match additional items schema.`\n }, ...result.errors);\n }\n }\n }\n }\n if ($contains !== undefined) {\n if (length === 0 && $minContains === undefined) {\n errors.push({\n instanceLocation,\n keyword: 'contains',\n keywordLocation: `${schemaLocation}/contains`,\n error: `Array is empty. It must contain at least one item matching the schema.`\n });\n }\n else if ($minContains !== undefined && length < $minContains) {\n errors.push({\n instanceLocation,\n keyword: 'minContains',\n keywordLocation: `${schemaLocation}/minContains`,\n error: `Array has less items (${length}) than minContains (${$minContains}).`\n });\n }\n else {\n const keywordLocation = `${schemaLocation}/contains`;\n const errorsLength = errors.length;\n let contained = 0;\n for (let j = 0; j < length; j++) {\n const result = validate(instance[j], $contains, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${j}`, keywordLocation);\n if (result.valid) {\n evaluated[j] = true;\n contained++;\n }\n else {\n errors.push(...result.errors);\n }\n }\n if (contained >= ($minContains || 0)) {\n errors.length = errorsLength;\n }\n if ($minContains === undefined &&\n $maxContains === undefined &&\n contained === 0) {\n errors.splice(errorsLength, 0, {\n instanceLocation,\n keyword: 'contains',\n keywordLocation,\n error: `Array does not contain item matching schema.`\n });\n }\n else if ($minContains !== undefined && contained < $minContains) {\n errors.push({\n instanceLocation,\n keyword: 'minContains',\n keywordLocation: `${schemaLocation}/minContains`,\n error: `Array must contain at least ${$minContains} items matching schema. Only ${contained} items were found.`\n });\n }\n else if ($maxContains !== undefined && contained > $maxContains) {\n errors.push({\n instanceLocation,\n keyword: 'maxContains',\n keywordLocation: `${schemaLocation}/maxContains`,\n error: `Array may contain at most ${$maxContains} items matching schema. ${contained} items were found.`\n });\n }\n }\n }\n if (!stop && $unevaluatedItems !== undefined) {\n const keywordLocation = `${schemaLocation}/unevaluatedItems`;\n for (i; i < length; i++) {\n if (evaluated[i]) {\n continue;\n }\n const result = validate(instance[i], $unevaluatedItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);\n evaluated[i] = true;\n if (!result.valid) {\n errors.push({\n instanceLocation,\n keyword: 'unevaluatedItems',\n keywordLocation,\n error: `Items did not match unevaluated items schema.`\n }, ...result.errors);\n }\n }\n }\n if ($uniqueItems) {\n for (let j = 0; j < length; j++) {\n const a = instance[j];\n const ao = typeof a === 'object' && a !== null;\n for (let k = 0; k < length; k++) {\n if (j === k) {\n continue;\n }\n const b = instance[k];\n const bo = typeof b === 'object' && b !== null;\n if (a === b || (ao && bo && deepCompareStrict(a, b))) {\n errors.push({\n instanceLocation,\n keyword: 'uniqueItems',\n keywordLocation: `${schemaLocation}/uniqueItems`,\n error: `Duplicate items at indexes ${j} and ${k}.`\n });\n j = Number.MAX_SAFE_INTEGER;\n k = Number.MAX_SAFE_INTEGER;\n }\n }\n }\n }\n }\n else if (instanceType === 'number') {\n if (draft === '4') {\n if ($minimum !== undefined &&\n (($exclusiveMinimum === true && instance <= $minimum) ||\n instance < $minimum)) {\n errors.push({\n instanceLocation,\n keyword: 'minimum',\n keywordLocation: `${schemaLocation}/minimum`,\n error: `${instance} is less than ${$exclusiveMinimum ? 'or equal to ' : ''} ${$minimum}.`\n });\n }\n if ($maximum !== undefined &&\n (($exclusiveMaximum === true && instance >= $maximum) ||\n instance > $maximum)) {\n errors.push({\n instanceLocation,\n keyword: 'maximum',\n keywordLocation: `${schemaLocation}/maximum`,\n error: `${instance} is greater than ${$exclusiveMaximum ? 'or equal to ' : ''} ${$maximum}.`\n });\n }\n }\n else {\n if ($minimum !== undefined && instance < $minimum) {\n errors.push({\n instanceLocation,\n keyword: 'minimum',\n keywordLocation: `${schemaLocation}/minimum`,\n error: `${instance} is less than ${$minimum}.`\n });\n }\n if ($maximum !== undefined && instance > $maximum) {\n errors.push({\n instanceLocation,\n keyword: 'maximum',\n keywordLocation: `${schemaLocation}/maximum`,\n error: `${instance} is greater than ${$maximum}.`\n });\n }\n if ($exclusiveMinimum !== undefined && instance <= $exclusiveMinimum) {\n errors.push({\n instanceLocation,\n keyword: 'exclusiveMinimum',\n keywordLocation: `${schemaLocation}/exclusiveMinimum`,\n error: `${instance} is less than ${$exclusiveMinimum}.`\n });\n }\n if ($exclusiveMaximum !== undefined && instance >= $exclusiveMaximum) {\n errors.push({\n instanceLocation,\n keyword: 'exclusiveMaximum',\n keywordLocation: `${schemaLocation}/exclusiveMaximum`,\n error: `${instance} is greater than or equal to ${$exclusiveMaximum}.`\n });\n }\n }\n if ($multipleOf !== undefined) {\n const remainder = instance % $multipleOf;\n if (Math.abs(0 - remainder) >= 1.1920929e-7 &&\n Math.abs($multipleOf - remainder) >= 1.1920929e-7) {\n errors.push({\n instanceLocation,\n keyword: 'multipleOf',\n keywordLocation: `${schemaLocation}/multipleOf`,\n error: `${instance} is not a multiple of ${$multipleOf}.`\n });\n }\n }\n }\n else if (instanceType === 'string') {\n const length = $minLength === undefined && $maxLength === undefined\n ? 0\n : ucs2length(instance);\n if ($minLength !== undefined && length < $minLength) {\n errors.push({\n instanceLocation,\n keyword: 'minLength',\n keywordLocation: `${schemaLocation}/minLength`,\n error: `String is too short (${length} < ${$minLength}).`\n });\n }\n if ($maxLength !== undefined && length > $maxLength) {\n errors.push({\n instanceLocation,\n keyword: 'maxLength',\n keywordLocation: `${schemaLocation}/maxLength`,\n error: `String is too long (${length} > ${$maxLength}).`\n });\n }\n if ($pattern !== undefined && !new RegExp($pattern, 'u').test(instance)) {\n errors.push({\n instanceLocation,\n keyword: 'pattern',\n keywordLocation: `${schemaLocation}/pattern`,\n error: `String does not match pattern.`\n });\n }\n if ($format !== undefined &&\n format[$format] &&\n !format[$format](instance)) {\n errors.push({\n instanceLocation,\n keyword: 'format',\n keywordLocation: `${schemaLocation}/format`,\n error: `String does not match format \"${$format}\".`\n });\n }\n }\n return { valid: errors.length === 0, errors };\n}\n","import { dereference } from './dereference.js';\nimport { validate } from './validate.js';\nexport class Validator {\n schema;\n draft;\n shortCircuit;\n lookup;\n constructor(schema, draft = '2019-09', shortCircuit = true) {\n this.schema = schema;\n this.draft = draft;\n this.shortCircuit = shortCircuit;\n this.lookup = dereference(schema);\n }\n validate(instance) {\n return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);\n }\n addSchema(schema, id) {\n if (id) {\n schema = { ...schema, $id: id };\n }\n dereference(schema, this.lookup);\n }\n}\n","import { Validator } from \"@cfworker/json-schema\";\n\n//#region src/index.ts\nconst FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE = \"Failed to parse input arguments\";\nconst TOOL_INVOCATION_FAILED_MESSAGE = \"Tool was executed but the invocation failed. For example, the script function threw an error\";\nconst TOOL_CANCELLED_MESSAGE = \"Tool was cancelled\";\nconst DEFAULT_INPUT_SCHEMA = {\n\ttype: \"object\",\n\tproperties: {}\n};\nconst STANDARD_JSON_SCHEMA_TARGETS = [\"draft-2020-12\", \"draft-07\"];\nconst POLYFILL_MARKER_PROPERTY = \"__isWebMCPPolyfill\";\nconst STANDARD_VALIDATOR_SYMBOL = Symbol(\"standardValidator\");\nconst installState = {\n\tinstalled: false,\n\tpreviousNavigatorModelContextDescriptor: void 0,\n\tpreviousNavigatorModelContextTestingDescriptor: void 0,\n\tpreviousDocumentModelContextDescriptor: void 0,\n\tinstalledNavigatorModelContext: false,\n\tinstalledNavigatorModelContextTesting: false,\n\tinstalledDocumentModelContext: false\n};\nvar StrictWebMCPContext = class extends EventTarget {\n\ttools = /* @__PURE__ */ new Map();\n\ttestingShim = null;\n\t_ontoolchange = null;\n\tunregisterToolDeprecationWarned = false;\n\tget ontoolchange() {\n\t\treturn this._ontoolchange;\n\t}\n\tset ontoolchange(handler) {\n\t\tthis._ontoolchange = handler;\n\t}\n\tregisterTool(tool, options) {\n\t\tconst signal = options?.signal;\n\t\tif (signal?.aborted) {\n\t\t\tconsole.warn(`[WebMCPPolyfill] registerTool(\"${tool?.name ?? \"<unknown>\"}\") skipped: options.signal was already aborted.`);\n\t\t\treturn;\n\t\t}\n\t\tconst normalized = normalizeToolDescriptor(tool, this.tools);\n\t\tthis.tools.set(normalized.name, normalized);\n\t\tthis.notifyToolsChanged();\n\t\tif (signal) signal.addEventListener(\"abort\", () => {\n\t\t\tif (this.tools.delete(normalized.name)) this.notifyToolsChanged();\n\t\t}, { once: true });\n\t}\n\tunregisterTool(nameOrTool) {\n\t\tthis.warnUnregisterToolDeprecationOnce();\n\t\tconst name = getToolNameForUnregister(nameOrTool);\n\t\tif (this.tools.delete(name)) this.notifyToolsChanged();\n\t}\n\tgetTools() {\n\t\treturn Promise.resolve(this.getRegisteredToolInfos());\n\t}\n\texecuteTool(tool, inputArgsJson, options) {\n\t\treturn this.executeToolByName(tool.name, inputArgsJson, options, false);\n\t}\n\tgetTestingShim() {\n\t\tif (!this.testingShim) this.testingShim = new PolyfillTestingShim(this);\n\t\treturn this.testingShim;\n\t}\n\t/** @internal Used by PolyfillTestingShim */\n\tgetToolInfos() {\n\t\treturn [...this.tools.values()].map((tool) => {\n\t\t\tlet inputSchema;\n\t\t\ttry {\n\t\t\t\tinputSchema = JSON.stringify(tool.inputSchema ?? { type: \"object\" });\n\t\t\t} catch {\n\t\t\t\tinputSchema = \"{\\\"type\\\":\\\"object\\\"}\";\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tname: tool.name,\n\t\t\t\tdescription: tool.description,\n\t\t\t\tinputSchema\n\t\t\t};\n\t\t});\n\t}\n\t/** @internal Used by getTools() */\n\tgetRegisteredToolInfos() {\n\t\treturn this.getToolInfos().map((toolInfo) => {\n\t\t\tconst tool = this.tools.get(toolInfo.name);\n\t\t\treturn {\n\t\t\t\t...toolInfo,\n\t\t\t\ttitle: tool?.title ?? \"\",\n\t\t\t\torigin: globalThis.location?.origin ?? \"\",\n\t\t\t\twindow: globalThis.window\n\t\t\t};\n\t\t});\n\t}\n\t/** @internal Used by PolyfillTestingShim */\n\tasync executeToolForTesting(toolName, inputArgsJson, options) {\n\t\treturn this.executeToolByName(toolName, inputArgsJson, options, true);\n\t}\n\tasync executeToolByName(toolName, inputArgsJson, options, normalizeResult) {\n\t\tif (options?.signal?.aborted) throw createUnknownError(TOOL_CANCELLED_MESSAGE);\n\t\tconst tool = this.tools.get(toolName);\n\t\tif (!tool) throw createUnknownError(`Tool not found: ${toolName}`);\n\t\tconst args = parseInputArgsJson(inputArgsJson);\n\t\tconst validationError = await validateArgsForTool(args, tool);\n\t\tif (validationError) throw createUnknownError(validationError);\n\t\tlet contextActive = true;\n\t\tconst client = { requestUserInteraction: async (callback) => {\n\t\t\tif (!contextActive) throw new Error(`ModelContextClient for tool \"${toolName}\" is no longer active after execute() resolved`);\n\t\t\tif (typeof callback !== \"function\") throw new TypeError(\"requestUserInteraction(callback) requires a function callback\");\n\t\t\treturn callback();\n\t\t} };\n\t\ttry {\n\t\t\tconst execution = tool.execute(args, client);\n\t\t\tconst rawResult = await withAbortSignal(Promise.resolve(execution), options?.signal);\n\t\t\tif (normalizeResult) return toSerializedTestingResult(normalizeToolResponse(rawResult));\n\t\t\tconst serialized = JSON.stringify(rawResult);\n\t\t\treturn serialized === void 0 ? null : serialized;\n\t\t} catch (error) {\n\t\t\tthrow createUnknownError(error instanceof Error ? `${TOOL_INVOCATION_FAILED_MESSAGE}: ${error.message}` : TOOL_INVOCATION_FAILED_MESSAGE);\n\t\t} finally {\n\t\t\tcontextActive = false;\n\t\t}\n\t}\n\tnotifyToolsChanged() {\n\t\tqueueMicrotask(() => {\n\t\t\tconst event = new Event(\"toolchange\");\n\t\t\ttry {\n\t\t\t\tthis._ontoolchange?.call(this, event);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn(\"[WebMCPPolyfill] navigator.modelContext.ontoolchange handler threw:\", error);\n\t\t\t}\n\t\t\tthis.dispatchEvent(event);\n\t\t\tthis.testingShim?.dispatchToolChange();\n\t\t});\n\t}\n\twarnUnregisterToolDeprecationOnce() {\n\t\tif (this.unregisterToolDeprecationWarned) return;\n\t\tthis.unregisterToolDeprecationWarned = true;\n\t\tconsole.warn(\"[WebMCPPolyfill] navigator.modelContext.unregisterTool() is deprecated. The April 23, 2026 WebMCP draft removed it in favor of registerTool(tool, { signal }) — pass an AbortSignal and abort it to unregister.\");\n\t}\n};\n/**\n* EventTarget-based testing shim matching the native Chromium ModelContextTesting surface.\n*\n* Fires `toolchange` events and supports the `ontoolchange` handler property,\n* matching the native Chromium 148 API. The deprecated `registerToolsChangedCallback`\n* is kept as a compat layer that wraps `addEventListener`.\n*/\nvar PolyfillTestingShim = class extends EventTarget {\n\tcontext;\n\t_ontoolchange = null;\n\tconstructor(context) {\n\t\tsuper();\n\t\tthis.context = context;\n\t}\n\tlistTools() {\n\t\treturn this.context.getToolInfos();\n\t}\n\texecuteTool(toolName, inputArgsJson, options) {\n\t\treturn this.context.executeToolForTesting(toolName, inputArgsJson, options);\n\t}\n\tgetCrossDocumentScriptToolResult() {\n\t\treturn Promise.resolve(\"[]\");\n\t}\n\tget ontoolchange() {\n\t\treturn this._ontoolchange;\n\t}\n\tset ontoolchange(handler) {\n\t\tthis._ontoolchange = handler;\n\t}\n\t/**\n\t* @deprecated Use `addEventListener('toolchange', callback)` instead.\n\t* Kept for backward compatibility with older polyfill consumers.\n\t*/\n\tregisterToolsChangedCallback(callback) {\n\t\tif (typeof callback !== \"function\") throw new TypeError(\"Failed to execute 'registerToolsChangedCallback' on 'ModelContextTesting': parameter 1 is not of type 'Function'.\");\n\t\tthis.addEventListener(\"toolchange\", callback);\n\t}\n\t/** @internal Called by StrictWebMCPContext when tools change. */\n\tdispatchToolChange() {\n\t\tconst event = new Event(\"toolchange\");\n\t\ttry {\n\t\t\tthis._ontoolchange?.call(this, event);\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"[WebMCPPolyfill] ontoolchange handler threw:\", error);\n\t\t}\n\t\tthis.dispatchEvent(event);\n\t\tthis.dispatchEvent(new Event(\"toolschanged\"));\n\t}\n};\nfunction createUnknownError(message) {\n\ttry {\n\t\treturn new DOMException(message, \"UnknownError\");\n\t} catch {\n\t\tconst error = new Error(message);\n\t\terror.name = \"UnknownError\";\n\t\treturn error;\n\t}\n}\nfunction parseInputArgsJson(inputArgsJson) {\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(inputArgsJson);\n\t} catch {\n\t\tthrow createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);\n\t}\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) throw createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);\n\treturn parsed;\n}\nfunction getToolNameForUnregister(nameOrTool) {\n\tif (typeof nameOrTool === \"string\") return nameOrTool;\n\tif (isPlainObject(nameOrTool) && typeof nameOrTool.name === \"string\") return nameOrTool.name;\n\tthrow new TypeError(\"Failed to execute 'unregisterTool' on 'ModelContext': parameter 1 must be a string or an object with a string name.\");\n}\nfunction isPlainObject(value) {\n\treturn Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction getStandardProps(value) {\n\tif (!isPlainObject(value)) return null;\n\tconst standard = value[\"~standard\"];\n\tif (!isPlainObject(standard)) return null;\n\treturn standard;\n}\nfunction isStandardInputValidatorSchema(value) {\n\tconst standard = getStandardProps(value);\n\treturn Boolean(standard && standard.version === 1 && typeof standard.validate === \"function\");\n}\nfunction isStandardInputJsonSchema(value) {\n\tconst standard = getStandardProps(value);\n\tif (!standard || standard.version !== 1 || !isPlainObject(standard.jsonSchema)) return false;\n\treturn typeof standard.jsonSchema.input === \"function\";\n}\nfunction createStandardValidatorFromJsonSchema(schema) {\n\treturn { \"~standard\": {\n\t\tversion: 1,\n\t\tvendor: \"@mcp-b/webmcp-polyfill-json-schema\",\n\t\tvalidate(value) {\n\t\t\tif (!isPlainObject(value)) return { issues: [{ message: \"expected object arguments\" }] };\n\t\t\tconst issue = validateArgsWithSchema(value, schema);\n\t\t\tif (issue) return { issues: [issue] };\n\t\t\treturn { value };\n\t\t}\n\t} };\n}\nfunction convertStandardInputSchema(schema) {\n\tfor (const target of STANDARD_JSON_SCHEMA_TARGETS) try {\n\t\tconst converted = schema[\"~standard\"].jsonSchema.input({ target });\n\t\tvalidateInputSchema(converted);\n\t\treturn converted;\n\t} catch (error) {\n\t\tconsole.warn(`[WebMCPPolyfill] Standard JSON Schema conversion failed for target \"${target}\":`, error);\n\t}\n\tthrow new Error(\"Failed to convert Standard JSON Schema inputSchema to a JSON Schema object\");\n}\nfunction normalizeInputSchema(inputSchema) {\n\tif (inputSchema === void 0) {\n\t\tconst normalized = DEFAULT_INPUT_SCHEMA;\n\t\treturn {\n\t\t\tinputSchema: normalized,\n\t\t\tstandardValidator: createStandardValidatorFromJsonSchema(normalized)\n\t\t};\n\t}\n\tif (isStandardInputJsonSchema(inputSchema)) {\n\t\tconst converted = convertStandardInputSchema(inputSchema);\n\t\treturn {\n\t\t\tinputSchema: converted,\n\t\t\tstandardValidator: createStandardValidatorFromJsonSchema(converted)\n\t\t};\n\t}\n\tif (isStandardInputValidatorSchema(inputSchema)) return {\n\t\tinputSchema: DEFAULT_INPUT_SCHEMA,\n\t\tstandardValidator: inputSchema\n\t};\n\tvalidateInputSchema(inputSchema);\n\tif (Object.keys(inputSchema).length === 0) return {\n\t\tinputSchema: DEFAULT_INPUT_SCHEMA,\n\t\tstandardValidator: createStandardValidatorFromJsonSchema(DEFAULT_INPUT_SCHEMA)\n\t};\n\tconst normalizedSchema = inputSchema.type === void 0 ? {\n\t\ttype: \"object\",\n\t\t...inputSchema\n\t} : inputSchema;\n\treturn {\n\t\tinputSchema: normalizedSchema,\n\t\tstandardValidator: createStandardValidatorFromJsonSchema(normalizedSchema)\n\t};\n}\nfunction validateInputSchema(schema) {\n\tif (!isPlainObject(schema)) throw new Error(\"inputSchema must be a JSON Schema object\");\n\tvalidateJsonSchemaNode(schema, \"$\");\n}\nfunction validateJsonSchemaNode(node, path) {\n\tconst typeValue = node.type;\n\tif (typeValue !== void 0 && typeof typeValue !== \"string\" && !(Array.isArray(typeValue) && typeValue.every((entry) => typeof entry === \"string\" && entry.length > 0))) throw new Error(`Invalid JSON Schema at ${path}: \"type\" must be a string or string[]`);\n\tconst requiredValue = node.required;\n\tif (requiredValue !== void 0 && !(Array.isArray(requiredValue) && requiredValue.every((entry) => typeof entry === \"string\"))) throw new Error(`Invalid JSON Schema at ${path}: \"required\" must be an array of strings`);\n\tconst propertiesValue = node.properties;\n\tif (propertiesValue !== void 0) {\n\t\tif (!isPlainObject(propertiesValue)) throw new Error(`Invalid JSON Schema at ${path}: \"properties\" must be an object`);\n\t\tfor (const [key, value] of Object.entries(propertiesValue)) {\n\t\t\tif (!isPlainObject(value)) throw new Error(`Invalid JSON Schema at ${path}.properties.${key}: expected object schema`);\n\t\t\tvalidateJsonSchemaNode(value, `${path}.properties.${key}`);\n\t\t}\n\t}\n\tconst itemsValue = node.items;\n\tif (itemsValue !== void 0) if (Array.isArray(itemsValue)) for (const [index, value] of itemsValue.entries()) {\n\t\tif (!isPlainObject(value)) throw new Error(`Invalid JSON Schema at ${path}.items[${index}]: expected object schema`);\n\t\tvalidateJsonSchemaNode(value, `${path}.items[${index}]`);\n\t}\n\telse if (isPlainObject(itemsValue)) validateJsonSchemaNode(itemsValue, `${path}.items`);\n\telse throw new Error(`Invalid JSON Schema at ${path}: \"items\" must be an object or object[]`);\n\tfor (const keyword of [\n\t\t\"allOf\",\n\t\t\"anyOf\",\n\t\t\"oneOf\"\n\t]) {\n\t\tconst value = node[keyword];\n\t\tif (value === void 0) continue;\n\t\tif (!Array.isArray(value)) throw new Error(`Invalid JSON Schema at ${path}: \"${keyword}\" must be an array`);\n\t\tfor (const [index, entry] of value.entries()) {\n\t\t\tif (!isPlainObject(entry)) throw new Error(`Invalid JSON Schema at ${path}.${keyword}[${index}]: expected object schema`);\n\t\t\tvalidateJsonSchemaNode(entry, `${path}.${keyword}[${index}]`);\n\t\t}\n\t}\n\tconst notValue = node.not;\n\tif (notValue !== void 0) {\n\t\tif (!isPlainObject(notValue)) throw new Error(`Invalid JSON Schema at ${path}: \"not\" must be an object schema`);\n\t\tvalidateJsonSchemaNode(notValue, `${path}.not`);\n\t}\n\ttry {\n\t\tJSON.stringify(node);\n\t} catch {\n\t\tthrow new Error(`Invalid JSON Schema at ${path}: schema must be JSON-serializable`);\n\t}\n}\nfunction normalizeToolDescriptor(tool, existing) {\n\tif (!tool || typeof tool !== \"object\") throw new TypeError(\"registerTool(tool) requires a tool object\");\n\tif (typeof tool.name !== \"string\" || tool.name.length === 0) throw new TypeError(\"Tool \\\"name\\\" must be a non-empty string\");\n\tif (typeof tool.description !== \"string\" || tool.description.length === 0) throw new TypeError(\"Tool \\\"description\\\" must be a non-empty string\");\n\tif (typeof tool.execute !== \"function\") throw new TypeError(\"Tool \\\"execute\\\" must be a function\");\n\tif (existing.has(tool.name)) throw new Error(`Tool already registered: ${tool.name}`);\n\tconst normalizedInputSchema = normalizeInputSchema(tool.inputSchema);\n\tconst annotations = tool.annotations;\n\tconst normalizedAnnotations = annotations ? {\n\t\t...annotations,\n\t\t...annotations.readOnlyHint === \"true\" ? { readOnlyHint: true } : annotations.readOnlyHint === \"false\" ? { readOnlyHint: false } : {},\n\t\t...annotations.destructiveHint === \"true\" ? { destructiveHint: true } : annotations.destructiveHint === \"false\" ? { destructiveHint: false } : {},\n\t\t...annotations.idempotentHint === \"true\" ? { idempotentHint: true } : annotations.idempotentHint === \"false\" ? { idempotentHint: false } : {},\n\t\t...annotations.openWorldHint === \"true\" ? { openWorldHint: true } : annotations.openWorldHint === \"false\" ? { openWorldHint: false } : {}\n\t} : void 0;\n\treturn {\n\t\t...tool,\n\t\t...normalizedAnnotations ? { annotations: normalizedAnnotations } : {},\n\t\tinputSchema: normalizedInputSchema.inputSchema,\n\t\t[STANDARD_VALIDATOR_SYMBOL]: normalizedInputSchema.standardValidator\n\t};\n}\nfunction validateArgsWithSchema(args, schema) {\n\tconst result = new Validator(schema, \"2020-12\", true).validate(args);\n\tif (result.valid) return null;\n\tconst error = result.errors[result.errors.length - 1];\n\tif (!error) return { message: \"Input validation failed\" };\n\treturn { message: error.error };\n}\nfunction formatStandardIssuePath(path) {\n\tif (!path || path.length === 0) return null;\n\tconst segments = path.map((segment) => {\n\t\tif (isPlainObject(segment) && \"key\" in segment) return segment.key;\n\t\treturn segment;\n\t}).map((segment) => String(segment)).filter((segment) => segment.length > 0);\n\tif (segments.length === 0) return null;\n\treturn segments.join(\".\");\n}\nasync function validateArgsWithStandardSchema(args, schema) {\n\tlet result;\n\ttry {\n\t\tresult = await Promise.resolve(schema[\"~standard\"].validate(args));\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? `: ${error.message}` : \"\";\n\t\tconsole.error(\"[WebMCPPolyfill] Standard Schema validation threw unexpectedly:\", error);\n\t\treturn `Input validation error: schema validation failed${detail}`;\n\t}\n\tif (!result.issues || result.issues.length === 0) return null;\n\tconst firstIssue = result.issues[0];\n\tif (!firstIssue) return \"Input validation error\";\n\tconst path = formatStandardIssuePath(firstIssue?.path);\n\tif (path) return `Input validation error: ${firstIssue.message} at ${path}`;\n\treturn `Input validation error: ${firstIssue.message}`;\n}\nasync function validateArgsForTool(args, tool) {\n\treturn validateArgsWithStandardSchema(args, tool[STANDARD_VALIDATOR_SYMBOL]);\n}\nfunction isCallToolResult(value) {\n\treturn isPlainObject(value) && Array.isArray(value.content);\n}\nfunction isJsonPrimitive(value) {\n\treturn value === null || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\n}\nfunction isJsonValue(value) {\n\tif (isJsonPrimitive(value)) return Number.isFinite(value) || typeof value !== \"number\";\n\tif (Array.isArray(value)) return value.every((entry) => isJsonValue(entry));\n\tif (!isPlainObject(value)) return false;\n\treturn Object.values(value).every((entry) => isJsonValue(entry));\n}\nfunction toStructuredContent(value) {\n\tif (!isPlainObject(value) || !isJsonValue(value)) return;\n\treturn value;\n}\nfunction serializeTextContent(value) {\n\tif (typeof value === \"string\") return value;\n\ttry {\n\t\treturn JSON.stringify(value) ?? String(value);\n\t} catch {\n\t\treturn String(value);\n\t}\n}\nfunction normalizeToolResponse(value) {\n\tif (isCallToolResult(value)) return value;\n\tconst structuredContent = toStructuredContent(value);\n\treturn {\n\t\tcontent: [{\n\t\t\ttype: \"text\",\n\t\t\ttext: serializeTextContent(value)\n\t\t}],\n\t\t...structuredContent ? { structuredContent } : {},\n\t\tisError: false\n\t};\n}\nfunction getFirstTextBlock(result) {\n\tfor (const block of result.content ?? []) if (block.type === \"text\" && \"text\" in block && typeof block.text === \"string\") return block.text;\n\treturn null;\n}\nfunction toSerializedTestingResult(result) {\n\tif (result.isError) throw createUnknownError(getFirstTextBlock(result)?.replace(/^Error:\\s*/i, \"\").trim() || TOOL_INVOCATION_FAILED_MESSAGE);\n\tconst metadata = result.metadata;\n\tif (metadata && typeof metadata === \"object\" && metadata.willNavigate) return null;\n\ttry {\n\t\treturn JSON.stringify(result);\n\t} catch {\n\t\tthrow createUnknownError(TOOL_INVOCATION_FAILED_MESSAGE);\n\t}\n}\nfunction withAbortSignal(operation, signal) {\n\tif (!signal) return operation;\n\tif (signal.aborted) return Promise.reject(createUnknownError(TOOL_CANCELLED_MESSAGE));\n\treturn new Promise((resolve, reject) => {\n\t\tconst onAbort = () => {\n\t\t\tcleanup();\n\t\t\treject(createUnknownError(TOOL_CANCELLED_MESSAGE));\n\t\t};\n\t\tconst cleanup = () => {\n\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t};\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\toperation.then((value) => {\n\t\t\tcleanup();\n\t\t\tresolve(value);\n\t\t}, (error) => {\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t});\n\t});\n}\nfunction getNavigator() {\n\tif (typeof navigator !== \"undefined\") return navigator;\n\treturn null;\n}\nfunction getDocument() {\n\tif (typeof document !== \"undefined\") return document;\n\treturn null;\n}\nfunction defineNavigatorProperty(target, key, value) {\n\tObject.defineProperty(target, key, {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\twritable: false,\n\t\tvalue\n\t});\n}\nfunction defineDocumentModelContextProperty(target, value) {\n\tObject.defineProperty(target, \"modelContext\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\twritable: false,\n\t\tvalue\n\t});\n}\nlet navigatorModelContextDeprecationWarned = false;\nfunction defineDeprecatedNavigatorModelContext(target, value) {\n\tObject.defineProperty(target, \"modelContext\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\tif (!navigatorModelContextDeprecationWarned) {\n\t\t\t\tnavigatorModelContextDeprecationWarned = true;\n\t\t\t\tconsole.warn(\"[WebMCPPolyfill] navigator.modelContext is deprecated. The May 27, 2026 WebMCP draft moved the modelContext getter from Navigator to Document — use document.modelContext instead. See https://github.com/webmachinelearning/webmcp/pull/184.\");\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t});\n}\nfunction initializeWebMCPPolyfill(options) {\n\tconst nav = getNavigator();\n\tconst doc = getDocument();\n\tif (!nav && !doc) return;\n\tconst documentModelContext = doc?.modelContext;\n\tif (Boolean(documentModelContext)) return;\n\tconst navigatorModelContext = nav?.modelContext;\n\tconst hasNavigatorModelContext = Boolean(navigatorModelContext);\n\tif (installState.installed) cleanupWebMCPPolyfill();\n\tif (doc && navigatorModelContext) {\n\t\tinstallState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, \"modelContext\");\n\t\tdefineDocumentModelContextProperty(doc, navigatorModelContext);\n\t\tinstallState.installedDocumentModelContext = true;\n\t\tinstallState.installed = true;\n\t\treturn;\n\t}\n\tif (hasNavigatorModelContext) return;\n\tconst context = new StrictWebMCPContext();\n\tconst modelContext = context;\n\tmodelContext[POLYFILL_MARKER_PROPERTY] = true;\n\tif (doc) {\n\t\tinstallState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, \"modelContext\");\n\t\tdefineDocumentModelContextProperty(doc, modelContext);\n\t\tinstallState.installedDocumentModelContext = true;\n\t}\n\tif (nav) {\n\t\tinstallState.previousNavigatorModelContextDescriptor = Object.getOwnPropertyDescriptor(nav, \"modelContext\");\n\t\tinstallState.previousNavigatorModelContextTestingDescriptor = Object.getOwnPropertyDescriptor(nav, \"modelContextTesting\");\n\t\tnavigatorModelContextDeprecationWarned = false;\n\t\tdefineDeprecatedNavigatorModelContext(nav, modelContext);\n\t\tinstallState.installedNavigatorModelContext = true;\n\t\tconst installTestingShim = options?.installTestingShim ?? \"if-missing\";\n\t\tconst hasModelContextTesting = Boolean(nav.modelContextTesting);\n\t\tif (installTestingShim === \"always\" || (installTestingShim === true || installTestingShim === \"if-missing\") && !hasModelContextTesting) {\n\t\t\tdefineNavigatorProperty(nav, \"modelContextTesting\", context.getTestingShim());\n\t\t\tinstallState.installedNavigatorModelContextTesting = true;\n\t\t}\n\t}\n\tinstallState.installed = true;\n}\nfunction cleanupWebMCPPolyfill() {\n\tif (!installState.installed) return;\n\tconst restore = (target, key, previousDescriptor) => {\n\t\tif (previousDescriptor) {\n\t\t\tObject.defineProperty(target, key, previousDescriptor);\n\t\t\treturn;\n\t\t}\n\t\tdelete target[key];\n\t};\n\tconst nav = getNavigator();\n\tconst doc = getDocument();\n\tif (doc && installState.installedDocumentModelContext) restore(doc, \"modelContext\", installState.previousDocumentModelContextDescriptor);\n\tif (nav && installState.installedNavigatorModelContext) restore(nav, \"modelContext\", installState.previousNavigatorModelContextDescriptor);\n\tif (nav && installState.installedNavigatorModelContextTesting) restore(nav, \"modelContextTesting\", installState.previousNavigatorModelContextTestingDescriptor);\n\tinstallState.installed = false;\n\tinstallState.previousDocumentModelContextDescriptor = void 0;\n\tinstallState.previousNavigatorModelContextDescriptor = void 0;\n\tinstallState.previousNavigatorModelContextTestingDescriptor = void 0;\n\tinstallState.installedDocumentModelContext = false;\n\tinstallState.installedNavigatorModelContext = false;\n\tinstallState.installedNavigatorModelContextTesting = false;\n\tnavigatorModelContextDeprecationWarned = false;\n}\nif (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n\tconst options = window.__webMCPPolyfillOptions;\n\tif (options?.autoInitialize !== false) try {\n\t\tinitializeWebMCPPolyfill(options);\n\t} catch (error) {\n\t\tconsole.error(\"[WebMCPPolyfill] Auto-initialization failed:\", error);\n\t}\n}\n\n//#endregion\nexport { cleanupWebMCPPolyfill, initializeWebMCPPolyfill, initializeWebMCPPolyfill as initializeWebModelContextPolyfill, isPlainObject, validateArgsWithSchema };\n//# sourceMappingURL=index.js.map","import { initializeWebMCPPolyfill } from \"@mcp-b/webmcp-polyfill\";\n\nimport { DEFAULT_GROUP_ID } from \"../../config/config.js\";\nimport { TOOL_DEFINITIONS, type ToolDefinition } from \"../tools/tools.js\";\n\nexport type WebMcpMode = \"polyfill\" | \"native\";\n\nconst registeredToolControllers: Map<string, AbortController> = new Map();\nconst registeredToolNames: Set<string> = new Set();\n\nlet currentMode: WebMcpMode = \"polyfill\";\n\n/**\n * Set the WebMCP mode (polyfill vs native).\n *\n * - `\"polyfill\"` (default): Uses `@mcp-b/webmcp-polyfill` for a pure-JS\n * `document.modelContext` that works in all browsers.\n * - `\"native\"`: Uses Chrome's native `document.modelContext` from\n * `chrome://flags/#enable-webmcp-testing`. Requires the flag to be\n * enabled. May crash in early Canary builds.\n *\n * Detection follows Chrome's recommended compat pattern:\n * `document.modelContext || navigator.modelContext`\n * `navigator.modelContext` was deprecated in Chrome 150 and removed in\n * Chrome 152.0.7943.0, but the fallback keeps older clients working.\n */\nexport function setWebMcpMode(mode: WebMcpMode): void {\n currentMode = mode;\n}\n\nexport function getWebMcpMode(): WebMcpMode {\n return currentMode;\n}\n\n/**\n * Install the `@mcp-b/webmcp-polyfill` onto `document.modelContext`.\n *\n * The polyfill itself bails out when Chrome's native `document.modelContext`\n * is already present — it does NOT override the native API. We call it\n * unconditionally; if the polyfill is already installed it will detect the\n * existing install via its own `installState` guard and return quickly.\n */\nfunction ensurePolyfill(): void {\n try {\n initializeWebMCPPolyfill();\n } catch (err) {\n console.warn(\"WebMCP polyfill initialization failed:\", err);\n }\n}\n\n/**\n * Access the WebMCP ModelContext API.\n *\n * In polyfill mode: installs the `@mcp-b/webmcp-polyfill` which surfaces\n * `document.modelContext`.\n * In native mode: follows Chrome's recommended feature-detection pattern:\n * `document.modelContext || navigator.modelContext`\n * `navigator.modelContext` was deprecated in Chrome 150 and removed in\n * Chrome 152.0.7943.0, but the fallback preserves compatibility with\n * earlier builds that may still be in the wild.\n */\nfunction getModelContextApi(): any {\n if (typeof document === \"undefined\" && typeof navigator === \"undefined\") {\n return null;\n }\n\n if (currentMode === \"polyfill\") {\n ensurePolyfill();\n }\n\n try {\n const modelContext: unknown =\n typeof document !== \"undefined\" &&\n typeof (document as any).modelContext !== \"undefined\"\n ? Reflect.get(document, \"modelContext\")\n : typeof navigator !== \"undefined\" &&\n typeof (navigator as any).modelContext !== \"undefined\"\n ? Reflect.get(navigator, \"modelContext\")\n : undefined;\n\n if (!modelContext || typeof modelContext !== \"object\") {\n return null;\n }\n\n const api = modelContext as {\n registerTool?: unknown;\n unregisterTool?: unknown;\n getTools?: unknown;\n executeTool?: unknown;\n };\n\n if (typeof api.registerTool !== \"function\") {\n return null;\n }\n\n return api;\n } catch (err) {\n console.warn(\"WebMCP modelContext access failed:\", err);\n\n return null;\n }\n}\n\n/**\n * Safely parse or normalize WebMCP input schema.\n *\n * Starting in Chrome 154.0.8014.0 (PR #241), `RegisteredTool#inputSchema` returns\n * a JavaScript object (a deep copy of the schema provided at registration).\n * In Chrome < 154.0.8014.0, `RegisteredTool#inputSchema` returned a stringified JSON schema (DOMString).\n *\n * This function provides backwards-compatible schema parsing:\n * - If inputSchema is a string: attempts JSON.parse.\n * - If inputSchema is an object: returns the object.\n * - Fallbacks gracefully to an empty object schema if null, undefined, or invalid JSON.\n */\nexport function parseWebMcpInputSchema(\n inputSchema: unknown,\n): Record<string, unknown> {\n if (typeof inputSchema === \"string\") {\n try {\n const parsed = JSON.parse(inputSchema);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n } catch {\n // Fallback on JSON parse error\n }\n\n return { type: \"object\", properties: {} };\n }\n\n if (\n inputSchema &&\n typeof inputSchema === \"object\" &&\n !Array.isArray(inputSchema)\n ) {\n return inputSchema as Record<string, unknown>;\n }\n\n return { type: \"object\", properties: {} };\n}\n\nexport interface WebMcpExecuteContext {\n signal?: AbortSignal;\n}\n\nexport interface WebMcpRegisteredTool {\n name: string;\n description?: string;\n inputSchema?: unknown;\n annotations?: Record<string, unknown>;\n execute?: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => Promise<unknown>;\n}\n\nexport interface NormalizedWebMcpRegisteredTool {\n name: string;\n description?: string;\n inputSchema: Record<string, unknown>;\n annotations?: Record<string, unknown>;\n execute?: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => Promise<unknown>;\n}\n\n/**\n * Safely extract AbortSignal from execute options/context.\n * Supports Chrome 153+ options object `{ signal }` (PR #247), direct AbortSignal instances,\n * or undefined for backward compatibility with Chrome < 153 and legacy callers.\n */\nexport function extractAbortSignal(\n context?: WebMcpExecuteContext | AbortSignal,\n): AbortSignal | undefined {\n if (!context) {\n return undefined;\n }\n\n if (typeof AbortSignal !== \"undefined\" && context instanceof AbortSignal) {\n return context;\n }\n\n if (\n typeof context === \"object\" &&\n \"signal\" in context &&\n typeof AbortSignal !== \"undefined\" &&\n context.signal instanceof AbortSignal\n ) {\n return context.signal;\n }\n\n return undefined;\n}\n\n/**\n * Retrieve tools registered on the WebMCP ModelContext API.\n *\n * Practicing graceful degradation:\n * - Feature-detects `getTools()` on `document.modelContext` / `navigator.modelContext`.\n * - If `getTools()` is absent (older browser builds or polyfills without getTools),\n * returns an empty array `[]` without throwing.\n * - Normalizes `RegisteredTool#inputSchema` so caller receives a JavaScript object\n * whether running on Chrome 154+ (native object) or Chrome < 154 (DOMString JSON).\n */\nexport async function getWebMcpTools(): Promise<\n NormalizedWebMcpRegisteredTool[]\n> {\n const modelContext = getModelContextApi() as {\n getTools?: () => Promise<WebMcpRegisteredTool[]>;\n } | null;\n\n if (!modelContext || typeof modelContext.getTools !== \"function\") {\n return [];\n }\n\n try {\n const rawTools = await modelContext.getTools();\n if (!Array.isArray(rawTools)) {\n return [];\n }\n\n return rawTools.map((tool) => ({\n name: tool.name,\n ...(tool.description ? { description: tool.description } : {}),\n inputSchema: parseWebMcpInputSchema(tool.inputSchema),\n ...(tool.annotations ? { annotations: tool.annotations } : {}),\n ...(tool.execute ? { execute: tool.execute } : {}),\n }));\n } catch (err) {\n console.warn(\"Failed to retrieve WebMCP tools via getTools():\", err);\n\n return [];\n }\n}\n\n/**\n * Feature detection for the WebMCP imperative API.\n *\n * To test this integration in Google Chrome, use the Model Context Tool\n * Inspector extension:\n * https://chromewebstore.google.com/detail/model-context-tool-inspec/gbpdfapgefenggkahomfgkhfehlcenpd\n */\nexport function isWebMcpSupported(): boolean {\n return !!getModelContextApi();\n}\n\n/**\n * Register ShadowClaw tools with the WebMCP ModelContext API.\n *\n * Both the `@mcp-b/webmcp-polyfill` and Chrome's native API support\n * `registerTool(tool, { signal })`. We always use AbortController signals so\n * that unregistration works identically regardless of which implementation is\n * actually active.\n *\n * Key correctness detail: `initializeWebMCPPolyfill()` is a no-op when\n * Chrome's native `document.modelContext` already exists — it does NOT\n * override the native API. In that situation we are talking to the native\n * Chrome API even in \"polyfill\" mode. The native Chrome API only supports\n * signal-based unregistration, so using AbortController signals everywhere\n * prevents \"Duplicate tool name\" errors when tools are re-configured.\n */\nexport async function registerWebMcpTools(\n agentWorker: Worker | null,\n _emit: (message: any) => Promise<void> | void,\n groupId: string = DEFAULT_GROUP_ID,\n tools?: ToolDefinition[],\n): Promise<boolean> {\n const activeTools = Array.isArray(tools) ? tools : TOOL_DEFINITIONS;\n\n if (activeTools.length === 0) {\n return true;\n }\n\n const modelContext = getModelContextApi();\n if (!modelContext) {\n return false;\n }\n\n for (const def of activeTools) {\n if (registeredToolNames.has(def.name)) {\n continue;\n }\n\n const controller = new AbortController();\n registeredToolControllers.set(def.name, controller);\n registeredToolNames.add(def.name);\n\n try {\n const toolDef: any = {\n name: def.name,\n description: def.description,\n inputSchema: parseWebMcpInputSchema(def.input_schema),\n annotations: {\n readOnlyHint: false,\n untrustedContentHint: true,\n },\n execute: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => {\n if (!agentWorker) {\n throw new Error(\"Cannot execute tool: agent worker is not ready\");\n }\n\n const signal = extractAbortSignal(context);\n\n if (signal?.aborted) {\n return Promise.reject(new Error(\"Tool execution aborted\"));\n }\n\n return new Promise((resolve, reject) => {\n const callId =\n Date.now().toString(36) + Math.random().toString(36).slice(2);\n\n let timeout: ReturnType<typeof setTimeout> | null = null;\n\n const cleanup = () => {\n if (timeout !== null) {\n clearTimeout(timeout);\n timeout = null;\n }\n agentWorker?.removeEventListener(\"message\", handler);\n if (signal && onAbort) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n };\n\n const onAbort = () => {\n cleanup();\n reject(new Error(\"Tool execution aborted\"));\n };\n\n if (signal) {\n signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n\n timeout = setTimeout(() => {\n cleanup();\n reject(new Error(\"Timeout waiting for tool execution\"));\n }, 600000);\n\n const handler = (event: MessageEvent) => {\n const data = event.data;\n if (\n data &&\n data.type === \"execute-tool-result\" &&\n data.callId === callId\n ) {\n cleanup();\n\n if (data.error) {\n reject(new Error(data.error));\n } else {\n resolve(data.result);\n }\n }\n };\n\n agentWorker.addEventListener(\"message\", handler);\n\n agentWorker.postMessage({\n type: \"execute-tool\",\n callId,\n payload: { name: def.name, input: input || {}, groupId },\n });\n });\n },\n };\n\n // Always use AbortController signals — both the polyfill and the native\n // Chrome API honour { signal } for lifecycle management.\n await modelContext.registerTool(toolDef, { signal: controller.signal });\n\n // Yield to the event loop between registrations.\n await new Promise((resolve) => setTimeout(resolve, 0));\n } catch (err) {\n registeredToolControllers.delete(def.name);\n registeredToolNames.delete(def.name);\n\n // Treat duplicate-registration errors as a no-op. The polyfill throws\n // \"Tool already registered: <name>\" and the native Chrome API throws\n // \"Duplicate tool name\" — both mean the tool is already present.\n const isDuplicate =\n err instanceof Error &&\n (err.message.includes(\"already registered\") ||\n err.message.includes(\"Duplicate tool name\"));\n\n if (!isDuplicate) {\n console.error(`Failed to register tool ${def.name}:`, err);\n\n throw err;\n }\n }\n }\n\n return true;\n}\n\n/**\n * Unregister previously registered ShadowClaw WebMCP tools.\n *\n * Aborts every AbortController associated with a registered tool. This works\n * for both the polyfill (which listens for the `abort` event on the signal it\n * was given) and Chrome's native API (which also uses signal-based lifecycle).\n * The deprecated `unregisterTool(name)` is intentionally NOT called here\n * because it is absent from the native Chrome API and causes silent failures\n * that prevent proper cleanup.\n */\nexport function unregisterWebMcpTools() {\n for (const controller of registeredToolControllers.values()) {\n try {\n controller.abort();\n } catch {\n // Ignore unregister errors in experimental API contexts.\n }\n }\n\n registeredToolControllers.clear();\n registeredToolNames.clear();\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7],"mappings":";;;;;;AAAA,SAAgB,kBAAkB,GAAG,GAAG;CACpC,MAAM,UAAU,OAAO;CACvB,IAAI,YAAY,OAAO,GACnB,OAAO;CAEX,IAAI,MAAM,QAAQ,CAAC,GAAG;EAClB,IAAI,CAAC,MAAM,QAAQ,CAAC,GAChB,OAAO;EAEX,MAAM,SAAS,EAAE;EACjB,IAAI,WAAW,EAAE,QACb,OAAO;EAEX,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,KACxB,IAAI,CAAC,kBAAkB,EAAE,IAAI,EAAE,EAAE,GAC7B,OAAO;EAGf,OAAO;CACX;CACA,IAAI,YAAY,UAAU;EACtB,IAAI,CAAC,KAAK,CAAC,GACP,OAAO,MAAM;EAEjB,MAAM,QAAQ,OAAO,KAAK,CAAC;EAC3B,MAAM,QAAQ,OAAO,KAAK,CAAC;EAE3B,IADe,MAAM,WACN,MAAM,QACjB,OAAO;EAEX,KAAK,MAAM,KAAK,OACZ,IAA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