ruflo 3.10.36 → 3.10.37

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 (498) hide show
  1. package/README.md +416 -416
  2. package/bin/ruflo.js +77 -77
  3. package/package.json +113 -113
  4. package/src/chat-ui/Dockerfile +25 -25
  5. package/src/chat-ui/patch-mcp-url-safety.sh +28 -28
  6. package/src/config/config.example.json +76 -76
  7. package/src/mcp-bridge/Dockerfile +45 -45
  8. package/src/mcp-bridge/index.js +1692 -1692
  9. package/src/mcp-bridge/mcp-stdio-kernel.js +159 -159
  10. package/src/mcp-bridge/package.json +17 -17
  11. package/src/mcp-bridge/test-harness.js +470 -470
  12. package/src/nginx/Dockerfile +10 -10
  13. package/src/nginx/nginx.conf +67 -67
  14. package/src/nginx/static/favicon-dark.svg +4 -4
  15. package/src/nginx/static/favicon.svg +4 -4
  16. package/src/nginx/static/icon.svg +5 -5
  17. package/src/nginx/static/logo.svg +9 -9
  18. package/src/nginx/static/manifest.json +22 -22
  19. package/src/nginx/static/welcome.js +184 -184
  20. package/src/ruvocal/.claude/skills/add-model-descriptions/SKILL.md +73 -73
  21. package/src/ruvocal/.devcontainer/Dockerfile +9 -9
  22. package/src/ruvocal/.devcontainer/devcontainer.json +36 -36
  23. package/src/ruvocal/.dockerignore +16 -16
  24. package/src/ruvocal/.eslintignore +13 -13
  25. package/src/ruvocal/.eslintrc.cjs +45 -45
  26. package/src/ruvocal/.gcloudignore +18 -18
  27. package/src/ruvocal/.github/ISSUE_TEMPLATE/bug-report--chat-ui-.md +43 -43
  28. package/src/ruvocal/.github/ISSUE_TEMPLATE/config-support.md +9 -9
  29. package/src/ruvocal/.github/ISSUE_TEMPLATE/feature-request--chat-ui-.md +17 -17
  30. package/src/ruvocal/.github/ISSUE_TEMPLATE/huggingchat.md +11 -11
  31. package/src/ruvocal/.github/release.yml +16 -16
  32. package/src/ruvocal/.github/workflows/build-docs.yml +18 -18
  33. package/src/ruvocal/.github/workflows/build-image.yml +142 -142
  34. package/src/ruvocal/.github/workflows/build-pr-docs.yml +20 -20
  35. package/src/ruvocal/.github/workflows/deploy-dev.yml +63 -63
  36. package/src/ruvocal/.github/workflows/deploy-prod.yml +78 -78
  37. package/src/ruvocal/.github/workflows/lint-and-test.yml +84 -84
  38. package/src/ruvocal/.github/workflows/slugify.yaml +72 -72
  39. package/src/ruvocal/.github/workflows/trufflehog.yml +17 -17
  40. package/src/ruvocal/.github/workflows/upload-pr-documentation.yml +16 -16
  41. package/src/ruvocal/.husky/lint-stage-config.js +4 -4
  42. package/src/ruvocal/.husky/pre-commit +2 -2
  43. package/src/ruvocal/.prettierignore +14 -14
  44. package/src/ruvocal/.prettierrc +7 -7
  45. package/src/ruvocal/CLAUDE.md +126 -126
  46. package/src/ruvocal/Dockerfile +96 -96
  47. package/src/ruvocal/LICENSE +202 -202
  48. package/src/ruvocal/PRIVACY.md +41 -41
  49. package/src/ruvocal/README.md +164 -164
  50. package/src/ruvocal/chart/Chart.yaml +5 -5
  51. package/src/ruvocal/chart/env/dev.yaml +260 -260
  52. package/src/ruvocal/chart/env/prod.yaml +273 -273
  53. package/src/ruvocal/chart/templates/_helpers.tpl +22 -22
  54. package/src/ruvocal/chart/templates/config.yaml +10 -10
  55. package/src/ruvocal/chart/templates/deployment.yaml +81 -81
  56. package/src/ruvocal/chart/templates/hpa.yaml +45 -45
  57. package/src/ruvocal/chart/templates/infisical.yaml +24 -24
  58. package/src/ruvocal/chart/templates/ingress-internal.yaml +32 -32
  59. package/src/ruvocal/chart/templates/ingress.yaml +32 -32
  60. package/src/ruvocal/chart/templates/network-policy.yaml +36 -36
  61. package/src/ruvocal/chart/templates/service-account.yaml +13 -13
  62. package/src/ruvocal/chart/templates/service-monitor.yaml +17 -17
  63. package/src/ruvocal/chart/templates/service.yaml +21 -21
  64. package/src/ruvocal/chart/values.yaml +73 -73
  65. package/src/ruvocal/cloudbuild.yaml +68 -68
  66. package/src/ruvocal/config/branding.env.example +19 -19
  67. package/src/ruvocal/docker-compose.yml +21 -21
  68. package/src/ruvocal/docs/adr/ADR-029-HUGGINGFACE-CHAT-UI-CLOUD-RUN.md +1236 -1236
  69. package/src/ruvocal/docs/adr/ADR-033-RUVECTOR-RUFLO-MCP-INTEGRATION.md +111 -111
  70. package/src/ruvocal/docs/adr/ADR-034-OPTIONAL-MCP-BACKENDS.md +117 -117
  71. package/src/ruvocal/docs/adr/ADR-035-MCP-TOOL-GROUPS.md +186 -186
  72. package/src/ruvocal/docs/adr/ADR-037-AUTOPILOT-CHAT-MODE.md +1500 -1500
  73. package/src/ruvocal/docs/adr/ADR-038-RUVOCAL-FORK.md +286 -286
  74. package/src/ruvocal/docs/source/_toctree.yml +30 -30
  75. package/src/ruvocal/docs/source/configuration/common-issues.md +38 -38
  76. package/src/ruvocal/docs/source/configuration/llm-router.md +105 -105
  77. package/src/ruvocal/docs/source/configuration/mcp-tools.md +84 -84
  78. package/src/ruvocal/docs/source/configuration/metrics.md +9 -9
  79. package/src/ruvocal/docs/source/configuration/open-id.md +57 -57
  80. package/src/ruvocal/docs/source/configuration/overview.md +89 -89
  81. package/src/ruvocal/docs/source/configuration/theming.md +20 -20
  82. package/src/ruvocal/docs/source/developing/architecture.md +48 -48
  83. package/src/ruvocal/docs/source/index.md +53 -53
  84. package/src/ruvocal/docs/source/installation/docker.md +43 -43
  85. package/src/ruvocal/docs/source/installation/helm.md +43 -43
  86. package/src/ruvocal/docs/source/installation/local.md +62 -62
  87. package/src/ruvocal/entrypoint.sh +18 -18
  88. package/src/ruvocal/mcp-bridge/Dockerfile +45 -45
  89. package/src/ruvocal/mcp-bridge/cloudbuild.yaml +49 -49
  90. package/src/ruvocal/mcp-bridge/index.js +1902 -1902
  91. package/src/ruvocal/mcp-bridge/mcp-stdio-kernel.js +159 -159
  92. package/src/ruvocal/mcp-bridge/package-lock.json +762 -762
  93. package/src/ruvocal/mcp-bridge/package.json +17 -17
  94. package/src/ruvocal/mcp-bridge/test-harness.js +470 -470
  95. package/src/ruvocal/package-lock.json +11741 -11741
  96. package/src/ruvocal/package.json +121 -121
  97. package/src/ruvocal/postcss.config.js +6 -6
  98. package/src/ruvocal/rvf.manifest.json +204 -204
  99. package/src/ruvocal/scripts/config.ts +64 -64
  100. package/src/ruvocal/scripts/generate-welcome.mjs +181 -181
  101. package/src/ruvocal/scripts/populate.ts +288 -288
  102. package/src/ruvocal/scripts/samples.txt +194 -194
  103. package/src/ruvocal/scripts/setups/vitest-setup-server.ts +44 -44
  104. package/src/ruvocal/scripts/updateLocalEnv.ts +48 -48
  105. package/src/ruvocal/src/ambient.d.ts +7 -7
  106. package/src/ruvocal/src/app.d.ts +29 -29
  107. package/src/ruvocal/src/app.html +53 -53
  108. package/src/ruvocal/src/hooks.server.ts +32 -32
  109. package/src/ruvocal/src/hooks.ts +6 -6
  110. package/src/ruvocal/src/lib/APIClient.ts +148 -148
  111. package/src/ruvocal/src/lib/actions/clickOutside.ts +18 -18
  112. package/src/ruvocal/src/lib/actions/snapScrollToBottom.ts +346 -346
  113. package/src/ruvocal/src/lib/buildPrompt.ts +33 -33
  114. package/src/ruvocal/src/lib/components/AnnouncementBanner.svelte +20 -20
  115. package/src/ruvocal/src/lib/components/BackgroundGenerationPoller.svelte +168 -168
  116. package/src/ruvocal/src/lib/components/CodeBlock.svelte +73 -73
  117. package/src/ruvocal/src/lib/components/CopyToClipBoardBtn.svelte +92 -92
  118. package/src/ruvocal/src/lib/components/DeleteConversationModal.svelte +75 -75
  119. package/src/ruvocal/src/lib/components/EditConversationModal.svelte +100 -100
  120. package/src/ruvocal/src/lib/components/ExpandNavigation.svelte +22 -22
  121. package/src/ruvocal/src/lib/components/FoundationBackground.svelte +242 -242
  122. package/src/ruvocal/src/lib/components/HoverTooltip.svelte +44 -44
  123. package/src/ruvocal/src/lib/components/HtmlPreviewModal.svelte +143 -143
  124. package/src/ruvocal/src/lib/components/InfiniteScroll.svelte +50 -50
  125. package/src/ruvocal/src/lib/components/MobileNav.svelte +300 -300
  126. package/src/ruvocal/src/lib/components/Modal.svelte +115 -115
  127. package/src/ruvocal/src/lib/components/ModelCardMetadata.svelte +71 -71
  128. package/src/ruvocal/src/lib/components/NavConversationItem.svelte +151 -151
  129. package/src/ruvocal/src/lib/components/NavMenu.svelte +313 -313
  130. package/src/ruvocal/src/lib/components/Pagination.svelte +97 -97
  131. package/src/ruvocal/src/lib/components/PaginationArrow.svelte +27 -27
  132. package/src/ruvocal/src/lib/components/Portal.svelte +24 -24
  133. package/src/ruvocal/src/lib/components/RetryBtn.svelte +18 -18
  134. package/src/ruvocal/src/lib/components/RuFloUniverse.svelte +185 -185
  135. package/src/ruvocal/src/lib/components/RufloHelpModal.svelte +411 -411
  136. package/src/ruvocal/src/lib/components/ScrollToBottomBtn.svelte +47 -47
  137. package/src/ruvocal/src/lib/components/ScrollToPreviousBtn.svelte +77 -77
  138. package/src/ruvocal/src/lib/components/ShareConversationModal.svelte +182 -182
  139. package/src/ruvocal/src/lib/components/StopGeneratingBtn.svelte +69 -69
  140. package/src/ruvocal/src/lib/components/SubscribeModal.svelte +87 -87
  141. package/src/ruvocal/src/lib/components/Switch.svelte +36 -36
  142. package/src/ruvocal/src/lib/components/SystemPromptModal.svelte +44 -44
  143. package/src/ruvocal/src/lib/components/Toast.svelte +27 -27
  144. package/src/ruvocal/src/lib/components/Tooltip.svelte +30 -30
  145. package/src/ruvocal/src/lib/components/WelcomeModal.svelte +46 -46
  146. package/src/ruvocal/src/lib/components/chat/Alternatives.svelte +77 -77
  147. package/src/ruvocal/src/lib/components/chat/BlockWrapper.svelte +72 -72
  148. package/src/ruvocal/src/lib/components/chat/ChatInput.svelte +490 -490
  149. package/src/ruvocal/src/lib/components/chat/ChatIntroduction.svelte +123 -123
  150. package/src/ruvocal/src/lib/components/chat/ChatMessage.svelte +548 -548
  151. package/src/ruvocal/src/lib/components/chat/ChatWindow.svelte +1057 -1057
  152. package/src/ruvocal/src/lib/components/chat/FileDropzone.svelte +92 -92
  153. package/src/ruvocal/src/lib/components/chat/ImageLightbox.svelte +66 -66
  154. package/src/ruvocal/src/lib/components/chat/MarkdownBlock.svelte +23 -23
  155. package/src/ruvocal/src/lib/components/chat/MarkdownRenderer.svelte +69 -69
  156. package/src/ruvocal/src/lib/components/chat/MarkdownRenderer.svelte.test.ts +58 -58
  157. package/src/ruvocal/src/lib/components/chat/MessageAvatar.svelte +103 -103
  158. package/src/ruvocal/src/lib/components/chat/ModelSwitch.svelte +64 -64
  159. package/src/ruvocal/src/lib/components/chat/OpenReasoningResults.svelte +81 -81
  160. package/src/ruvocal/src/lib/components/chat/TaskGroup.svelte +88 -88
  161. package/src/ruvocal/src/lib/components/chat/ToolUpdate.svelte +273 -273
  162. package/src/ruvocal/src/lib/components/chat/UploadedFile.svelte +253 -253
  163. package/src/ruvocal/src/lib/components/chat/UrlFetchModal.svelte +203 -203
  164. package/src/ruvocal/src/lib/components/chat/VoiceRecorder.svelte +214 -214
  165. package/src/ruvocal/src/lib/components/icons/IconBurger.svelte +20 -20
  166. package/src/ruvocal/src/lib/components/icons/IconCheap.svelte +20 -20
  167. package/src/ruvocal/src/lib/components/icons/IconChevron.svelte +24 -24
  168. package/src/ruvocal/src/lib/components/icons/IconDazzled.svelte +40 -40
  169. package/src/ruvocal/src/lib/components/icons/IconFast.svelte +20 -20
  170. package/src/ruvocal/src/lib/components/icons/IconLoading.svelte +22 -22
  171. package/src/ruvocal/src/lib/components/icons/IconMCP.svelte +28 -28
  172. package/src/ruvocal/src/lib/components/icons/IconMoon.svelte +21 -21
  173. package/src/ruvocal/src/lib/components/icons/IconNew.svelte +20 -20
  174. package/src/ruvocal/src/lib/components/icons/IconOmni.svelte +90 -90
  175. package/src/ruvocal/src/lib/components/icons/IconPaperclip.svelte +24 -24
  176. package/src/ruvocal/src/lib/components/icons/IconPro.svelte +37 -37
  177. package/src/ruvocal/src/lib/components/icons/IconShare.svelte +21 -21
  178. package/src/ruvocal/src/lib/components/icons/IconSun.svelte +93 -93
  179. package/src/ruvocal/src/lib/components/icons/Logo.svelte +68 -68
  180. package/src/ruvocal/src/lib/components/icons/LogoHuggingFaceBorderless.svelte +54 -54
  181. package/src/ruvocal/src/lib/components/mcp/AddServerForm.svelte +250 -250
  182. package/src/ruvocal/src/lib/components/mcp/MCPServerManager.svelte +185 -185
  183. package/src/ruvocal/src/lib/components/mcp/ServerCard.svelte +203 -203
  184. package/src/ruvocal/src/lib/components/players/AudioPlayer.svelte +82 -82
  185. package/src/ruvocal/src/lib/components/voice/AudioWaveform.svelte +96 -96
  186. package/src/ruvocal/src/lib/components/wasm/GalleryPanel.svelte +357 -357
  187. package/src/ruvocal/src/lib/constants/mcpExamples.ts +114 -114
  188. package/src/ruvocal/src/lib/constants/mime.ts +11 -11
  189. package/src/ruvocal/src/lib/constants/pagination.ts +1 -1
  190. package/src/ruvocal/src/lib/constants/publicSepToken.ts +1 -1
  191. package/src/ruvocal/src/lib/constants/routerExamples.ts +133 -133
  192. package/src/ruvocal/src/lib/constants/rvagentPresets.ts +206 -206
  193. package/src/ruvocal/src/lib/createShareLink.ts +27 -27
  194. package/src/ruvocal/src/lib/jobs/refresh-conversation-stats.ts +297 -297
  195. package/src/ruvocal/src/lib/migrations/lock.ts +56 -56
  196. package/src/ruvocal/src/lib/migrations/migrations.spec.ts +74 -74
  197. package/src/ruvocal/src/lib/migrations/migrations.ts +109 -109
  198. package/src/ruvocal/src/lib/migrations/routines/01-update-search-assistants.ts +50 -50
  199. package/src/ruvocal/src/lib/migrations/routines/02-update-assistants-models.ts +48 -48
  200. package/src/ruvocal/src/lib/migrations/routines/04-update-message-updates.ts +151 -151
  201. package/src/ruvocal/src/lib/migrations/routines/05-update-message-files.ts +56 -56
  202. package/src/ruvocal/src/lib/migrations/routines/06-trim-message-updates.ts +56 -56
  203. package/src/ruvocal/src/lib/migrations/routines/08-update-featured-to-review.ts +32 -32
  204. package/src/ruvocal/src/lib/migrations/routines/09-delete-empty-conversations.spec.ts +214 -214
  205. package/src/ruvocal/src/lib/migrations/routines/09-delete-empty-conversations.ts +88 -88
  206. package/src/ruvocal/src/lib/migrations/routines/10-update-reports-assistantid.ts +29 -29
  207. package/src/ruvocal/src/lib/migrations/routines/index.ts +15 -15
  208. package/src/ruvocal/src/lib/server/__tests__/conversation-stop-generating.spec.ts +103 -103
  209. package/src/ruvocal/src/lib/server/abortRegistry.ts +57 -57
  210. package/src/ruvocal/src/lib/server/abortedGenerations.ts +43 -43
  211. package/src/ruvocal/src/lib/server/adminToken.ts +62 -62
  212. package/src/ruvocal/src/lib/server/api/__tests__/conversations-id.spec.ts +296 -296
  213. package/src/ruvocal/src/lib/server/api/__tests__/conversations-message.spec.ts +216 -216
  214. package/src/ruvocal/src/lib/server/api/__tests__/conversations.spec.ts +235 -235
  215. package/src/ruvocal/src/lib/server/api/__tests__/misc.spec.ts +72 -72
  216. package/src/ruvocal/src/lib/server/api/__tests__/testHelpers.ts +86 -86
  217. package/src/ruvocal/src/lib/server/api/__tests__/user-reports.spec.ts +78 -78
  218. package/src/ruvocal/src/lib/server/api/__tests__/user.spec.ts +239 -239
  219. package/src/ruvocal/src/lib/server/api/types.ts +37 -37
  220. package/src/ruvocal/src/lib/server/api/utils/requireAuth.ts +22 -22
  221. package/src/ruvocal/src/lib/server/api/utils/resolveConversation.ts +69 -69
  222. package/src/ruvocal/src/lib/server/api/utils/resolveModel.ts +27 -27
  223. package/src/ruvocal/src/lib/server/api/utils/superjsonResponse.ts +15 -15
  224. package/src/ruvocal/src/lib/server/apiToken.ts +11 -11
  225. package/src/ruvocal/src/lib/server/auth.ts +554 -554
  226. package/src/ruvocal/src/lib/server/config.ts +187 -187
  227. package/src/ruvocal/src/lib/server/conversation.ts +83 -83
  228. package/src/ruvocal/src/lib/server/database/__tests__/rvf.spec.ts +709 -709
  229. package/src/ruvocal/src/lib/server/database/postgres.ts +700 -700
  230. package/src/ruvocal/src/lib/server/database/rvf.ts +1078 -1078
  231. package/src/ruvocal/src/lib/server/database.ts +145 -145
  232. package/src/ruvocal/src/lib/server/endpoints/document.ts +68 -68
  233. package/src/ruvocal/src/lib/server/endpoints/endpoints.ts +43 -43
  234. package/src/ruvocal/src/lib/server/endpoints/images.ts +211 -211
  235. package/src/ruvocal/src/lib/server/endpoints/openai/endpointOai.ts +266 -266
  236. package/src/ruvocal/src/lib/server/endpoints/openai/openAIChatToTextGenerationStream.ts +212 -212
  237. package/src/ruvocal/src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.ts +32 -32
  238. package/src/ruvocal/src/lib/server/endpoints/preprocessMessages.ts +61 -61
  239. package/src/ruvocal/src/lib/server/exitHandler.ts +59 -59
  240. package/src/ruvocal/src/lib/server/files/downloadFile.ts +34 -34
  241. package/src/ruvocal/src/lib/server/files/uploadFile.ts +29 -29
  242. package/src/ruvocal/src/lib/server/findRepoRoot.ts +13 -13
  243. package/src/ruvocal/src/lib/server/generateFromDefaultEndpoint.ts +46 -46
  244. package/src/ruvocal/src/lib/server/hooks/error.ts +37 -37
  245. package/src/ruvocal/src/lib/server/hooks/fetch.ts +22 -22
  246. package/src/ruvocal/src/lib/server/hooks/handle.ts +250 -250
  247. package/src/ruvocal/src/lib/server/hooks/init.ts +51 -51
  248. package/src/ruvocal/src/lib/server/isURLLocal.spec.ts +31 -31
  249. package/src/ruvocal/src/lib/server/isURLLocal.ts +74 -74
  250. package/src/ruvocal/src/lib/server/logger.ts +42 -42
  251. package/src/ruvocal/src/lib/server/mcp/clientPool.spec.ts +175 -175
  252. package/src/ruvocal/src/lib/server/mcp/hf.ts +32 -32
  253. package/src/ruvocal/src/lib/server/mcp/httpClient.ts +122 -122
  254. package/src/ruvocal/src/lib/server/mcp/registry.ts +76 -76
  255. package/src/ruvocal/src/lib/server/mcp/tools.ts +196 -196
  256. package/src/ruvocal/src/lib/server/metrics.ts +255 -255
  257. package/src/ruvocal/src/lib/server/models.ts +518 -518
  258. package/src/ruvocal/src/lib/server/requestContext.ts +55 -55
  259. package/src/ruvocal/src/lib/server/router/arch.ts +230 -230
  260. package/src/ruvocal/src/lib/server/router/endpoint.ts +316 -316
  261. package/src/ruvocal/src/lib/server/router/multimodal.ts +28 -28
  262. package/src/ruvocal/src/lib/server/router/policy.ts +49 -49
  263. package/src/ruvocal/src/lib/server/router/toolsRoute.ts +51 -51
  264. package/src/ruvocal/src/lib/server/router/types.ts +21 -21
  265. package/src/ruvocal/src/lib/server/sendSlack.ts +23 -23
  266. package/src/ruvocal/src/lib/server/textGeneration/generate.ts +258 -258
  267. package/src/ruvocal/src/lib/server/textGeneration/index.ts +96 -96
  268. package/src/ruvocal/src/lib/server/textGeneration/mcp/fileRefs.ts +155 -155
  269. package/src/ruvocal/src/lib/server/textGeneration/mcp/routerResolution.ts +108 -108
  270. package/src/ruvocal/src/lib/server/textGeneration/mcp/runMcpFlow.ts +831 -831
  271. package/src/ruvocal/src/lib/server/textGeneration/mcp/toolInvocation.ts +349 -349
  272. package/src/ruvocal/src/lib/server/textGeneration/mcp/wasmTools.test.ts +633 -633
  273. package/src/ruvocal/src/lib/server/textGeneration/reasoning.ts +23 -23
  274. package/src/ruvocal/src/lib/server/textGeneration/title.ts +83 -83
  275. package/src/ruvocal/src/lib/server/textGeneration/types.ts +28 -28
  276. package/src/ruvocal/src/lib/server/textGeneration/utils/prepareFiles.ts +88 -88
  277. package/src/ruvocal/src/lib/server/textGeneration/utils/routing.ts +21 -21
  278. package/src/ruvocal/src/lib/server/textGeneration/utils/toolPrompt.ts +49 -49
  279. package/src/ruvocal/src/lib/server/urlSafety.ts +77 -77
  280. package/src/ruvocal/src/lib/server/usageLimits.ts +30 -30
  281. package/src/ruvocal/src/lib/stores/autopilotStore.svelte.ts +175 -175
  282. package/src/ruvocal/src/lib/stores/backgroundGenerations.svelte.ts +32 -32
  283. package/src/ruvocal/src/lib/stores/backgroundGenerations.ts +1 -1
  284. package/src/ruvocal/src/lib/stores/errors.ts +9 -9
  285. package/src/ruvocal/src/lib/stores/isAborted.ts +3 -3
  286. package/src/ruvocal/src/lib/stores/isPro.ts +4 -4
  287. package/src/ruvocal/src/lib/stores/loading.ts +3 -3
  288. package/src/ruvocal/src/lib/stores/mcpServers.ts +534 -534
  289. package/src/ruvocal/src/lib/stores/pendingChatInput.ts +3 -3
  290. package/src/ruvocal/src/lib/stores/pendingMessage.ts +9 -9
  291. package/src/ruvocal/src/lib/stores/settings.ts +182 -182
  292. package/src/ruvocal/src/lib/stores/shareModal.ts +13 -13
  293. package/src/ruvocal/src/lib/stores/titleUpdate.ts +8 -8
  294. package/src/ruvocal/src/lib/stores/wasmMcp.ts +472 -472
  295. package/src/ruvocal/src/lib/switchTheme.ts +124 -124
  296. package/src/ruvocal/src/lib/types/AbortedGeneration.ts +8 -8
  297. package/src/ruvocal/src/lib/types/Assistant.ts +31 -31
  298. package/src/ruvocal/src/lib/types/AssistantStats.ts +11 -11
  299. package/src/ruvocal/src/lib/types/ConfigKey.ts +4 -4
  300. package/src/ruvocal/src/lib/types/ConvSidebar.ts +9 -9
  301. package/src/ruvocal/src/lib/types/Conversation.ts +27 -27
  302. package/src/ruvocal/src/lib/types/ConversationStats.ts +13 -13
  303. package/src/ruvocal/src/lib/types/Message.ts +41 -41
  304. package/src/ruvocal/src/lib/types/MessageEvent.ts +10 -10
  305. package/src/ruvocal/src/lib/types/MessageUpdate.ts +139 -139
  306. package/src/ruvocal/src/lib/types/MigrationResult.ts +7 -7
  307. package/src/ruvocal/src/lib/types/Model.ts +23 -23
  308. package/src/ruvocal/src/lib/types/Report.ts +12 -12
  309. package/src/ruvocal/src/lib/types/Review.ts +6 -6
  310. package/src/ruvocal/src/lib/types/Semaphore.ts +19 -19
  311. package/src/ruvocal/src/lib/types/Session.ts +22 -22
  312. package/src/ruvocal/src/lib/types/Settings.ts +93 -93
  313. package/src/ruvocal/src/lib/types/SharedConversation.ts +9 -9
  314. package/src/ruvocal/src/lib/types/Template.ts +6 -6
  315. package/src/ruvocal/src/lib/types/Timestamps.ts +4 -4
  316. package/src/ruvocal/src/lib/types/TokenCache.ts +6 -6
  317. package/src/ruvocal/src/lib/types/Tool.ts +77 -77
  318. package/src/ruvocal/src/lib/types/UrlDependency.ts +5 -5
  319. package/src/ruvocal/src/lib/types/User.ts +14 -14
  320. package/src/ruvocal/src/lib/utils/PublicConfig.svelte.ts +75 -75
  321. package/src/ruvocal/src/lib/utils/auth.ts +17 -17
  322. package/src/ruvocal/src/lib/utils/chunk.ts +33 -33
  323. package/src/ruvocal/src/lib/utils/cookiesAreEnabled.ts +13 -13
  324. package/src/ruvocal/src/lib/utils/debounce.ts +17 -17
  325. package/src/ruvocal/src/lib/utils/deepestChild.ts +6 -6
  326. package/src/ruvocal/src/lib/utils/favicon.ts +21 -21
  327. package/src/ruvocal/src/lib/utils/fetchJSON.ts +23 -23
  328. package/src/ruvocal/src/lib/utils/file2base64.ts +14 -14
  329. package/src/ruvocal/src/lib/utils/formatUserCount.ts +37 -37
  330. package/src/ruvocal/src/lib/utils/generationState.spec.ts +75 -75
  331. package/src/ruvocal/src/lib/utils/generationState.ts +26 -26
  332. package/src/ruvocal/src/lib/utils/getHref.ts +41 -41
  333. package/src/ruvocal/src/lib/utils/getReturnFromGenerator.ts +7 -7
  334. package/src/ruvocal/src/lib/utils/haptics.ts +64 -64
  335. package/src/ruvocal/src/lib/utils/hashConv.ts +12 -12
  336. package/src/ruvocal/src/lib/utils/hf.ts +17 -17
  337. package/src/ruvocal/src/lib/utils/isDesktop.ts +7 -7
  338. package/src/ruvocal/src/lib/utils/isUrl.ts +8 -8
  339. package/src/ruvocal/src/lib/utils/isVirtualKeyboard.ts +16 -16
  340. package/src/ruvocal/src/lib/utils/loadAttachmentsFromUrls.ts +115 -115
  341. package/src/ruvocal/src/lib/utils/marked.spec.ts +96 -96
  342. package/src/ruvocal/src/lib/utils/marked.ts +531 -531
  343. package/src/ruvocal/src/lib/utils/mcpValidation.ts +147 -147
  344. package/src/ruvocal/src/lib/utils/mergeAsyncGenerators.ts +38 -38
  345. package/src/ruvocal/src/lib/utils/messageUpdates.spec.ts +262 -262
  346. package/src/ruvocal/src/lib/utils/messageUpdates.ts +324 -324
  347. package/src/ruvocal/src/lib/utils/mime.ts +56 -56
  348. package/src/ruvocal/src/lib/utils/models.ts +14 -14
  349. package/src/ruvocal/src/lib/utils/parseBlocks.ts +120 -120
  350. package/src/ruvocal/src/lib/utils/parseIncompleteMarkdown.ts +644 -644
  351. package/src/ruvocal/src/lib/utils/parseStringToList.ts +10 -10
  352. package/src/ruvocal/src/lib/utils/randomUuid.ts +14 -14
  353. package/src/ruvocal/src/lib/utils/searchTokens.ts +33 -33
  354. package/src/ruvocal/src/lib/utils/sha256.ts +7 -7
  355. package/src/ruvocal/src/lib/utils/stringifyError.ts +12 -12
  356. package/src/ruvocal/src/lib/utils/sum.ts +3 -3
  357. package/src/ruvocal/src/lib/utils/template.spec.ts +59 -59
  358. package/src/ruvocal/src/lib/utils/template.ts +53 -53
  359. package/src/ruvocal/src/lib/utils/timeout.ts +9 -9
  360. package/src/ruvocal/src/lib/utils/toolProgress.spec.ts +46 -46
  361. package/src/ruvocal/src/lib/utils/toolProgress.ts +11 -11
  362. package/src/ruvocal/src/lib/utils/tree/addChildren.spec.ts +102 -102
  363. package/src/ruvocal/src/lib/utils/tree/addChildren.ts +48 -48
  364. package/src/ruvocal/src/lib/utils/tree/addSibling.spec.ts +81 -81
  365. package/src/ruvocal/src/lib/utils/tree/addSibling.ts +41 -41
  366. package/src/ruvocal/src/lib/utils/tree/buildSubtree.spec.ts +110 -110
  367. package/src/ruvocal/src/lib/utils/tree/buildSubtree.ts +24 -24
  368. package/src/ruvocal/src/lib/utils/tree/convertLegacyConversation.spec.ts +31 -31
  369. package/src/ruvocal/src/lib/utils/tree/convertLegacyConversation.ts +36 -36
  370. package/src/ruvocal/src/lib/utils/tree/isMessageId.spec.ts +15 -15
  371. package/src/ruvocal/src/lib/utils/tree/isMessageId.ts +5 -5
  372. package/src/ruvocal/src/lib/utils/tree/tree.d.ts +14 -14
  373. package/src/ruvocal/src/lib/utils/tree/treeHelpers.spec.ts +167 -167
  374. package/src/ruvocal/src/lib/utils/updates.ts +39 -39
  375. package/src/ruvocal/src/lib/utils/urlParams.ts +13 -13
  376. package/src/ruvocal/src/lib/wasm/idb.ts +438 -438
  377. package/src/ruvocal/src/lib/wasm/index.ts +1213 -1213
  378. package/src/ruvocal/src/lib/wasm/tests/wasm-capabilities.test.ts +565 -565
  379. package/src/ruvocal/src/lib/wasm/wasm.worker.ts +332 -332
  380. package/src/ruvocal/src/lib/wasm/workerClient.ts +166 -166
  381. package/src/ruvocal/src/lib/workers/autopilotWorker.ts +221 -221
  382. package/src/ruvocal/src/lib/workers/detailFetchWorker.ts +100 -100
  383. package/src/ruvocal/src/lib/workers/markdownWorker.ts +61 -61
  384. package/src/ruvocal/src/routes/+error.svelte +20 -20
  385. package/src/ruvocal/src/routes/+layout.svelte +324 -324
  386. package/src/ruvocal/src/routes/+layout.ts +91 -91
  387. package/src/ruvocal/src/routes/+page.svelte +168 -168
  388. package/src/ruvocal/src/routes/.well-known/oauth-cimd/+server.ts +37 -37
  389. package/src/ruvocal/src/routes/__debug/openai/+server.ts +21 -21
  390. package/src/ruvocal/src/routes/admin/export/+server.ts +159 -159
  391. package/src/ruvocal/src/routes/admin/stats/compute/+server.ts +16 -16
  392. package/src/ruvocal/src/routes/api/conversation/[id]/+server.ts +40 -40
  393. package/src/ruvocal/src/routes/api/conversation/[id]/message/[messageId]/+server.ts +42 -42
  394. package/src/ruvocal/src/routes/api/conversations/+server.ts +48 -48
  395. package/src/ruvocal/src/routes/api/fetch-url/+server.ts +147 -147
  396. package/src/ruvocal/src/routes/api/mcp/health/+server.ts +292 -292
  397. package/src/ruvocal/src/routes/api/mcp/servers/+server.ts +32 -32
  398. package/src/ruvocal/src/routes/api/models/+server.ts +25 -25
  399. package/src/ruvocal/src/routes/api/transcribe/+server.ts +104 -104
  400. package/src/ruvocal/src/routes/api/user/+server.ts +15 -15
  401. package/src/ruvocal/src/routes/api/user/validate-token/+server.ts +20 -20
  402. package/src/ruvocal/src/routes/api/v2/conversations/+server.ts +48 -48
  403. package/src/ruvocal/src/routes/api/v2/conversations/[id]/+server.ts +94 -94
  404. package/src/ruvocal/src/routes/api/v2/conversations/[id]/message/[messageId]/+server.ts +43 -43
  405. package/src/ruvocal/src/routes/api/v2/conversations/import-share/+server.ts +23 -23
  406. package/src/ruvocal/src/routes/api/v2/debug/config/+server.ts +16 -16
  407. package/src/ruvocal/src/routes/api/v2/debug/refresh/+server.ts +30 -30
  408. package/src/ruvocal/src/routes/api/v2/export/+server.ts +196 -196
  409. package/src/ruvocal/src/routes/api/v2/feature-flags/+server.ts +14 -14
  410. package/src/ruvocal/src/routes/api/v2/models/+server.ts +38 -38
  411. package/src/ruvocal/src/routes/api/v2/models/[namespace]/+server.ts +8 -8
  412. package/src/ruvocal/src/routes/api/v2/models/[namespace]/[model]/+server.ts +8 -8
  413. package/src/ruvocal/src/routes/api/v2/models/[namespace]/[model]/subscribe/+server.ts +28 -28
  414. package/src/ruvocal/src/routes/api/v2/models/[namespace]/subscribe/+server.ts +28 -28
  415. package/src/ruvocal/src/routes/api/v2/models/old/+server.ts +7 -7
  416. package/src/ruvocal/src/routes/api/v2/models/refresh/+server.ts +33 -33
  417. package/src/ruvocal/src/routes/api/v2/public-config/+server.ts +7 -7
  418. package/src/ruvocal/src/routes/api/v2/user/+server.ts +17 -17
  419. package/src/ruvocal/src/routes/api/v2/user/billing-orgs/+server.ts +73 -73
  420. package/src/ruvocal/src/routes/api/v2/user/reports/+server.ts +17 -17
  421. package/src/ruvocal/src/routes/api/v2/user/settings/+server.ts +110 -110
  422. package/src/ruvocal/src/routes/conversation/+server.ts +115 -115
  423. package/src/ruvocal/src/routes/conversation/[id]/+page.svelte +586 -586
  424. package/src/ruvocal/src/routes/conversation/[id]/+page.ts +60 -60
  425. package/src/ruvocal/src/routes/conversation/[id]/+server.ts +740 -740
  426. package/src/ruvocal/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts +66 -66
  427. package/src/ruvocal/src/routes/conversation/[id]/share/+server.ts +69 -69
  428. package/src/ruvocal/src/routes/conversation/[id]/stop-generating/+server.ts +35 -35
  429. package/src/ruvocal/src/routes/healthcheck/+server.ts +3 -3
  430. package/src/ruvocal/src/routes/login/+server.ts +5 -5
  431. package/src/ruvocal/src/routes/login/callback/+server.ts +103 -103
  432. package/src/ruvocal/src/routes/login/callback/updateUser.spec.ts +157 -157
  433. package/src/ruvocal/src/routes/login/callback/updateUser.ts +215 -215
  434. package/src/ruvocal/src/routes/logout/+server.ts +18 -18
  435. package/src/ruvocal/src/routes/metrics/+server.ts +18 -18
  436. package/src/ruvocal/src/routes/models/+page.svelte +233 -233
  437. package/src/ruvocal/src/routes/models/[...model]/+page.svelte +161 -161
  438. package/src/ruvocal/src/routes/models/[...model]/+page.ts +14 -14
  439. package/src/ruvocal/src/routes/models/[...model]/thumbnail.png/+server.ts +64 -64
  440. package/src/ruvocal/src/routes/models/[...model]/thumbnail.png/ModelThumbnail.svelte +28 -28
  441. package/src/ruvocal/src/routes/privacy/+page.svelte +11 -11
  442. package/src/ruvocal/src/routes/r/[id]/+page.ts +34 -34
  443. package/src/ruvocal/src/routes/settings/(nav)/+layout.svelte +282 -282
  444. package/src/ruvocal/src/routes/settings/(nav)/+layout.ts +1 -1
  445. package/src/ruvocal/src/routes/settings/(nav)/+server.ts +59 -59
  446. package/src/ruvocal/src/routes/settings/(nav)/[...model]/+page.svelte +464 -464
  447. package/src/ruvocal/src/routes/settings/(nav)/[...model]/+page.ts +14 -14
  448. package/src/ruvocal/src/routes/settings/(nav)/application/+page.svelte +362 -362
  449. package/src/ruvocal/src/routes/settings/+layout.svelte +40 -40
  450. package/src/ruvocal/src/styles/highlight-js.css +195 -195
  451. package/src/ruvocal/src/styles/main.css +144 -144
  452. package/src/ruvocal/static/chatui/favicon-dark.svg +3 -3
  453. package/src/ruvocal/static/chatui/favicon-dev.svg +3 -3
  454. package/src/ruvocal/static/chatui/favicon.svg +3 -3
  455. package/src/ruvocal/static/chatui/icon.svg +3 -3
  456. package/src/ruvocal/static/chatui/logo.svg +7 -7
  457. package/src/ruvocal/static/chatui/manifest.json +54 -54
  458. package/src/ruvocal/static/chatui/welcome.js +184 -184
  459. package/src/ruvocal/static/huggingchat/favicon-dark.svg +4 -4
  460. package/src/ruvocal/static/huggingchat/favicon-dev.svg +4 -4
  461. package/src/ruvocal/static/huggingchat/favicon.svg +4 -4
  462. package/src/ruvocal/static/huggingchat/fulltext-logo.svg +1 -1
  463. package/src/ruvocal/static/huggingchat/icon.svg +4 -4
  464. package/src/ruvocal/static/huggingchat/logo.svg +4 -4
  465. package/src/ruvocal/static/huggingchat/manifest.json +54 -54
  466. package/src/ruvocal/static/huggingchat/routes.chat.json +226 -226
  467. package/src/ruvocal/static/robots.txt +10 -10
  468. package/src/ruvocal/static/wasm/rvagent_wasm.js +1539 -1539
  469. package/src/ruvocal/stub/@reflink/reflink/package.json +5 -5
  470. package/src/ruvocal/svelte.config.js +53 -53
  471. package/src/ruvocal/tailwind.config.cjs +30 -30
  472. package/src/ruvocal/tsconfig.json +19 -19
  473. package/src/ruvocal/vite.config.ts +87 -87
  474. package/src/scripts/deploy.sh +116 -116
  475. package/src/scripts/generate-config.js +245 -245
  476. package/src/scripts/generate-welcome.js +187 -187
  477. package/src/scripts/package-rvf.sh +116 -116
  478. package/src/ruvocal/.claude-flow/daemon-state.json +0 -135
  479. package/src/ruvocal/.claude-flow/data/pending-insights.jsonl +0 -0
  480. package/src/ruvocal/.claude-flow/data/ranked-context.json +0 -5
  481. package/src/ruvocal/.claude-flow/logs/daemon.log +0 -31
  482. package/src/ruvocal/.claude-flow/logs/headless/audit_1777949411822_juxau0_prompt.log +0 -989
  483. package/src/ruvocal/.claude-flow/logs/headless/audit_1777949411822_juxau0_result.log +0 -67
  484. package/src/ruvocal/.claude-flow/logs/headless/audit_1777950042278_jvj5xq_prompt.log +0 -989
  485. package/src/ruvocal/.claude-flow/logs/headless/audit_1777950042278_jvj5xq_result.log +0 -93
  486. package/src/ruvocal/.claude-flow/logs/headless/optimize_1777949531823_yt5yc2_prompt.log +0 -1498
  487. package/src/ruvocal/.claude-flow/logs/headless/optimize_1777949531823_yt5yc2_result.log +0 -93
  488. package/src/ruvocal/.claude-flow/logs/headless/testgaps_1777949771821_elw1j4_prompt.log +0 -1498
  489. package/src/ruvocal/.claude-flow/logs/headless/testgaps_1777949771821_elw1j4_result.log +0 -100
  490. package/src/ruvocal/.claude-flow/metrics/codebase-map.json +0 -11
  491. package/src/ruvocal/.claude-flow/metrics/consolidation.json +0 -6
  492. package/src/ruvocal/.claude-flow/neural/stats.json +0 -6
  493. package/src/ruvocal/.claude-flow/sessions/current.json +0 -13
  494. package/src/ruvocal/.swarm/attestation.db +0 -0
  495. package/src/ruvocal/.swarm/hnsw.index +0 -0
  496. package/src/ruvocal/.swarm/hnsw.metadata.json +0 -1
  497. package/src/ruvocal/.swarm/memory.db +0 -0
  498. package/src/ruvocal/.swarm/schema.sql +0 -305
@@ -1,1539 +1,1539 @@
1
- /* @ts-self-types="./rvagent_wasm.d.ts" */
2
-
3
- /**
4
- * A model provider that delegates to a JavaScript callback function.
5
- *
6
- * The JS callback receives a JSON string of messages and must return
7
- * a Promise that resolves to a JSON string response.
8
- *
9
- * # JavaScript usage
10
- * ```js
11
- * const provider = new JsModelProvider(async (messagesJson) => {
12
- * const messages = JSON.parse(messagesJson);
13
- * const response = await callMyModel(messages);
14
- * return JSON.stringify(response);
15
- * });
16
- * ```
17
- */
18
- export class JsModelProvider {
19
- __destroy_into_raw() {
20
- const ptr = this.__wbg_ptr;
21
- this.__wbg_ptr = 0;
22
- JsModelProviderFinalization.unregister(this);
23
- return ptr;
24
- }
25
- free() {
26
- const ptr = this.__destroy_into_raw();
27
- wasm.__wbg_jsmodelprovider_free(ptr, 0);
28
- }
29
- /**
30
- * Send messages to the JS model provider and get a response.
31
- *
32
- * `messages_json` is a JSON-serialized array of message objects.
33
- * Returns the model's response as a JSON string.
34
- * @param {string} messages_json
35
- * @returns {Promise<string>}
36
- */
37
- complete(messages_json) {
38
- const ptr0 = passStringToWasm0(messages_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
39
- const len0 = WASM_VECTOR_LEN;
40
- const ret = wasm.jsmodelprovider_complete(this.__wbg_ptr, ptr0, len0);
41
- return takeObject(ret);
42
- }
43
- /**
44
- * Create a new provider wrapping a JavaScript async function.
45
- *
46
- * The function must accept a JSON string and return a Promise<string>.
47
- * @param {Function} callback
48
- */
49
- constructor(callback) {
50
- try {
51
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
52
- wasm.jsmodelprovider_new(retptr, addHeapObject(callback));
53
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
54
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
55
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
56
- if (r2) {
57
- throw takeObject(r1);
58
- }
59
- this.__wbg_ptr = r0 >>> 0;
60
- JsModelProviderFinalization.register(this, this.__wbg_ptr, this);
61
- return this;
62
- } finally {
63
- wasm.__wbindgen_add_to_stack_pointer(16);
64
- }
65
- }
66
- }
67
- if (Symbol.dispose) JsModelProvider.prototype[Symbol.dispose] = JsModelProvider.prototype.free;
68
-
69
- /**
70
- * rvAgent WASM — browser and Node.js agent execution.
71
- *
72
- * Create with `new WasmAgent(configJson)` from JavaScript.
73
- */
74
- export class WasmAgent {
75
- __destroy_into_raw() {
76
- const ptr = this.__wbg_ptr;
77
- this.__wbg_ptr = 0;
78
- WasmAgentFinalization.unregister(this);
79
- return ptr;
80
- }
81
- free() {
82
- const ptr = this.__destroy_into_raw();
83
- wasm.__wbg_wasmagent_free(ptr, 0);
84
- }
85
- /**
86
- * Execute a tool directly by passing a JSON tool request.
87
- * @param {string} tool_json
88
- * @returns {any}
89
- */
90
- execute_tool(tool_json) {
91
- try {
92
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
93
- const ptr0 = passStringToWasm0(tool_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
94
- const len0 = WASM_VECTOR_LEN;
95
- wasm.wasmagent_execute_tool(retptr, this.__wbg_ptr, ptr0, len0);
96
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
97
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
98
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
99
- if (r2) {
100
- throw takeObject(r1);
101
- }
102
- return takeObject(r0);
103
- } finally {
104
- wasm.__wbindgen_add_to_stack_pointer(16);
105
- }
106
- }
107
- /**
108
- * Get the number of files in the virtual filesystem.
109
- * @returns {number}
110
- */
111
- file_count() {
112
- const ret = wasm.wasmagent_file_count(this.__wbg_ptr);
113
- return ret >>> 0;
114
- }
115
- /**
116
- * Get the current agent state as JSON.
117
- * @returns {any}
118
- */
119
- get_state() {
120
- try {
121
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
122
- wasm.wasmagent_get_state(retptr, this.__wbg_ptr);
123
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
124
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
125
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
126
- if (r2) {
127
- throw takeObject(r1);
128
- }
129
- return takeObject(r0);
130
- } finally {
131
- wasm.__wbindgen_add_to_stack_pointer(16);
132
- }
133
- }
134
- /**
135
- * Get the todo list as JSON.
136
- * @returns {any}
137
- */
138
- get_todos() {
139
- try {
140
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
141
- wasm.wasmagent_get_todos(retptr, this.__wbg_ptr);
142
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
143
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
144
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
145
- if (r2) {
146
- throw takeObject(r1);
147
- }
148
- return takeObject(r0);
149
- } finally {
150
- wasm.__wbindgen_add_to_stack_pointer(16);
151
- }
152
- }
153
- /**
154
- * Get the list of available tools.
155
- * @returns {any}
156
- */
157
- get_tools() {
158
- try {
159
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160
- wasm.wasmagent_get_tools(retptr, this.__wbg_ptr);
161
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
162
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
163
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
164
- if (r2) {
165
- throw takeObject(r1);
166
- }
167
- return takeObject(r0);
168
- } finally {
169
- wasm.__wbindgen_add_to_stack_pointer(16);
170
- }
171
- }
172
- /**
173
- * Check whether the agent is stopped.
174
- * @returns {boolean}
175
- */
176
- is_stopped() {
177
- const ret = wasm.wasmagent_is_stopped(this.__wbg_ptr);
178
- return ret !== 0;
179
- }
180
- /**
181
- * Get the configured model identifier.
182
- * @returns {string}
183
- */
184
- model() {
185
- let deferred1_0;
186
- let deferred1_1;
187
- try {
188
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
189
- wasm.wasmagent_model(retptr, this.__wbg_ptr);
190
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
191
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
192
- deferred1_0 = r0;
193
- deferred1_1 = r1;
194
- return getStringFromWasm0(r0, r1);
195
- } finally {
196
- wasm.__wbindgen_add_to_stack_pointer(16);
197
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
198
- }
199
- }
200
- /**
201
- * Get the agent name, if configured.
202
- * @returns {string | undefined}
203
- */
204
- name() {
205
- try {
206
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
207
- wasm.wasmagent_name(retptr, this.__wbg_ptr);
208
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
209
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
210
- let v1;
211
- if (r0 !== 0) {
212
- v1 = getStringFromWasm0(r0, r1).slice();
213
- wasm.__wbindgen_export4(r0, r1 * 1, 1);
214
- }
215
- return v1;
216
- } finally {
217
- wasm.__wbindgen_add_to_stack_pointer(16);
218
- }
219
- }
220
- /**
221
- * Create a new WasmAgent from a JSON configuration string.
222
- *
223
- * # Example (JavaScript)
224
- * ```js
225
- * const agent = new WasmAgent('{"model": "anthropic:claude-sonnet-4-20250514"}');
226
- * ```
227
- * @param {string} config_json
228
- */
229
- constructor(config_json) {
230
- try {
231
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
232
- const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
233
- const len0 = WASM_VECTOR_LEN;
234
- wasm.wasmagent_new(retptr, ptr0, len0);
235
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
236
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
237
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
238
- if (r2) {
239
- throw takeObject(r1);
240
- }
241
- this.__wbg_ptr = r0 >>> 0;
242
- WasmAgentFinalization.register(this, this.__wbg_ptr, this);
243
- return this;
244
- } finally {
245
- wasm.__wbindgen_add_to_stack_pointer(16);
246
- }
247
- }
248
- /**
249
- * Send a prompt and get a response.
250
- *
251
- * If a model provider is set, the prompt is sent to the JS model.
252
- * Otherwise, returns an echo response for testing.
253
- * @param {string} input
254
- * @returns {Promise<any>}
255
- */
256
- prompt(input) {
257
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
258
- const len0 = WASM_VECTOR_LEN;
259
- const ret = wasm.wasmagent_prompt(this.__wbg_ptr, ptr0, len0);
260
- return takeObject(ret);
261
- }
262
- /**
263
- * Reset the agent state, clearing messages and turn count.
264
- */
265
- reset() {
266
- wasm.wasmagent_reset(this.__wbg_ptr);
267
- }
268
- /**
269
- * Attach a JavaScript model provider callback.
270
- *
271
- * The callback receives a JSON string of messages and must return
272
- * a `Promise<string>` with the model response.
273
- * @param {Function} callback
274
- */
275
- set_model_provider(callback) {
276
- try {
277
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
278
- wasm.wasmagent_set_model_provider(retptr, this.__wbg_ptr, addHeapObject(callback));
279
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
280
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
281
- if (r1) {
282
- throw takeObject(r0);
283
- }
284
- } finally {
285
- wasm.__wbindgen_add_to_stack_pointer(16);
286
- }
287
- }
288
- /**
289
- * Get the current turn count.
290
- * @returns {number}
291
- */
292
- turn_count() {
293
- const ret = wasm.wasmagent_turn_count(this.__wbg_ptr);
294
- return ret >>> 0;
295
- }
296
- /**
297
- * Get the crate version.
298
- * @returns {string}
299
- */
300
- static version() {
301
- let deferred1_0;
302
- let deferred1_1;
303
- try {
304
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
305
- wasm.wasmagent_version(retptr);
306
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
307
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
308
- deferred1_0 = r0;
309
- deferred1_1 = r1;
310
- return getStringFromWasm0(r0, r1);
311
- } finally {
312
- wasm.__wbindgen_add_to_stack_pointer(16);
313
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
314
- }
315
- }
316
- }
317
- if (Symbol.dispose) WasmAgent.prototype[Symbol.dispose] = WasmAgent.prototype.free;
318
-
319
- /**
320
- * RVF App Gallery — browse, load, and configure agent templates.
321
- *
322
- * # Example (JavaScript)
323
- * ```js
324
- * const gallery = new WasmGallery();
325
- *
326
- * // List all templates
327
- * const templates = gallery.list();
328
- *
329
- * // Search by tags
330
- * const results = gallery.search("security testing");
331
- *
332
- * // Get template details
333
- * const template = gallery.get("coder");
334
- *
335
- * // Load as RVF container
336
- * const rvfBytes = gallery.loadRvf("coder");
337
- *
338
- * // Configure template
339
- * gallery.configure("coder", { maxTurns: 100 });
340
- * ```
341
- */
342
- export class WasmGallery {
343
- __destroy_into_raw() {
344
- const ptr = this.__wbg_ptr;
345
- this.__wbg_ptr = 0;
346
- WasmGalleryFinalization.unregister(this);
347
- return ptr;
348
- }
349
- free() {
350
- const ptr = this.__destroy_into_raw();
351
- wasm.__wbg_wasmgallery_free(ptr, 0);
352
- }
353
- /**
354
- * Add a custom template to the gallery.
355
- * @param {string} template_json
356
- */
357
- addCustom(template_json) {
358
- try {
359
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
360
- const ptr0 = passStringToWasm0(template_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
361
- const len0 = WASM_VECTOR_LEN;
362
- wasm.wasmgallery_addCustom(retptr, this.__wbg_ptr, ptr0, len0);
363
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
364
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
365
- if (r1) {
366
- throw takeObject(r0);
367
- }
368
- } finally {
369
- wasm.__wbindgen_add_to_stack_pointer(16);
370
- }
371
- }
372
- /**
373
- * Configure the active template with overrides.
374
- * @param {string} config_json
375
- */
376
- configure(config_json) {
377
- try {
378
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
379
- const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
380
- const len0 = WASM_VECTOR_LEN;
381
- wasm.wasmgallery_configure(retptr, this.__wbg_ptr, ptr0, len0);
382
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
383
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
384
- if (r1) {
385
- throw takeObject(r0);
386
- }
387
- } finally {
388
- wasm.__wbindgen_add_to_stack_pointer(16);
389
- }
390
- }
391
- /**
392
- * Get the number of templates in the gallery.
393
- * @returns {number}
394
- */
395
- count() {
396
- const ret = wasm.wasmgallery_count(this.__wbg_ptr);
397
- return ret >>> 0;
398
- }
399
- /**
400
- * Export all custom templates as JSON.
401
- * @returns {any}
402
- */
403
- exportCustom() {
404
- try {
405
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
406
- wasm.wasmgallery_exportCustom(retptr, this.__wbg_ptr);
407
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
408
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
409
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
410
- if (r2) {
411
- throw takeObject(r1);
412
- }
413
- return takeObject(r0);
414
- } finally {
415
- wasm.__wbindgen_add_to_stack_pointer(16);
416
- }
417
- }
418
- /**
419
- * Get a template by ID.
420
- * @param {string} id
421
- * @returns {any}
422
- */
423
- get(id) {
424
- try {
425
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
426
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
427
- const len0 = WASM_VECTOR_LEN;
428
- wasm.wasmgallery_get(retptr, this.__wbg_ptr, ptr0, len0);
429
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
430
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
431
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
432
- if (r2) {
433
- throw takeObject(r1);
434
- }
435
- return takeObject(r0);
436
- } finally {
437
- wasm.__wbindgen_add_to_stack_pointer(16);
438
- }
439
- }
440
- /**
441
- * Get the currently active template ID.
442
- * @returns {string | undefined}
443
- */
444
- getActive() {
445
- try {
446
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
447
- wasm.wasmgallery_getActive(retptr, this.__wbg_ptr);
448
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
449
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
450
- let v1;
451
- if (r0 !== 0) {
452
- v1 = getStringFromWasm0(r0, r1).slice();
453
- wasm.__wbindgen_export4(r0, r1 * 1, 1);
454
- }
455
- return v1;
456
- } finally {
457
- wasm.__wbindgen_add_to_stack_pointer(16);
458
- }
459
- }
460
- /**
461
- * Get all categories with template counts.
462
- * @returns {any}
463
- */
464
- getCategories() {
465
- try {
466
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
467
- wasm.wasmgallery_getCategories(retptr, this.__wbg_ptr);
468
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
469
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
470
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
471
- if (r2) {
472
- throw takeObject(r1);
473
- }
474
- return takeObject(r0);
475
- } finally {
476
- wasm.__wbindgen_add_to_stack_pointer(16);
477
- }
478
- }
479
- /**
480
- * Get configuration overrides for active template.
481
- * @returns {any}
482
- */
483
- getConfig() {
484
- try {
485
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
486
- wasm.wasmgallery_getConfig(retptr, this.__wbg_ptr);
487
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
488
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
489
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
490
- if (r2) {
491
- throw takeObject(r1);
492
- }
493
- return takeObject(r0);
494
- } finally {
495
- wasm.__wbindgen_add_to_stack_pointer(16);
496
- }
497
- }
498
- /**
499
- * Import custom templates from JSON.
500
- * @param {string} templates_json
501
- * @returns {number}
502
- */
503
- importCustom(templates_json) {
504
- try {
505
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
506
- const ptr0 = passStringToWasm0(templates_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
507
- const len0 = WASM_VECTOR_LEN;
508
- wasm.wasmgallery_importCustom(retptr, this.__wbg_ptr, ptr0, len0);
509
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
510
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
511
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
512
- if (r2) {
513
- throw takeObject(r1);
514
- }
515
- return r0 >>> 0;
516
- } finally {
517
- wasm.__wbindgen_add_to_stack_pointer(16);
518
- }
519
- }
520
- /**
521
- * List all available templates.
522
- * @returns {any}
523
- */
524
- list() {
525
- try {
526
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
527
- wasm.wasmgallery_list(retptr, this.__wbg_ptr);
528
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
529
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
530
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
531
- if (r2) {
532
- throw takeObject(r1);
533
- }
534
- return takeObject(r0);
535
- } finally {
536
- wasm.__wbindgen_add_to_stack_pointer(16);
537
- }
538
- }
539
- /**
540
- * List templates by category.
541
- * @param {string} category
542
- * @returns {any}
543
- */
544
- listByCategory(category) {
545
- try {
546
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
547
- const ptr0 = passStringToWasm0(category, wasm.__wbindgen_export, wasm.__wbindgen_export2);
548
- const len0 = WASM_VECTOR_LEN;
549
- wasm.wasmgallery_listByCategory(retptr, this.__wbg_ptr, ptr0, len0);
550
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
551
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
552
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
553
- if (r2) {
554
- throw takeObject(r1);
555
- }
556
- return takeObject(r0);
557
- } finally {
558
- wasm.__wbindgen_add_to_stack_pointer(16);
559
- }
560
- }
561
- /**
562
- * Load a template as an RVF container (returns Uint8Array).
563
- * @param {string} id
564
- * @returns {Uint8Array}
565
- */
566
- loadRvf(id) {
567
- try {
568
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
569
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
570
- const len0 = WASM_VECTOR_LEN;
571
- wasm.wasmgallery_loadRvf(retptr, this.__wbg_ptr, ptr0, len0);
572
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
573
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
574
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
575
- if (r2) {
576
- throw takeObject(r1);
577
- }
578
- return takeObject(r0);
579
- } finally {
580
- wasm.__wbindgen_add_to_stack_pointer(16);
581
- }
582
- }
583
- /**
584
- * Create a new gallery with built-in templates.
585
- */
586
- constructor() {
587
- const ret = wasm.wasmgallery_new();
588
- this.__wbg_ptr = ret >>> 0;
589
- WasmGalleryFinalization.register(this, this.__wbg_ptr, this);
590
- return this;
591
- }
592
- /**
593
- * Remove a custom template by ID.
594
- * @param {string} id
595
- */
596
- removeCustom(id) {
597
- try {
598
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
599
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
600
- const len0 = WASM_VECTOR_LEN;
601
- wasm.wasmgallery_removeCustom(retptr, this.__wbg_ptr, ptr0, len0);
602
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
603
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
604
- if (r1) {
605
- throw takeObject(r0);
606
- }
607
- } finally {
608
- wasm.__wbindgen_add_to_stack_pointer(16);
609
- }
610
- }
611
- /**
612
- * Search templates by query (matches name, description, tags).
613
- * @param {string} query
614
- * @returns {any}
615
- */
616
- search(query) {
617
- try {
618
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
619
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
620
- const len0 = WASM_VECTOR_LEN;
621
- wasm.wasmgallery_search(retptr, this.__wbg_ptr, ptr0, len0);
622
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
623
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
624
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
625
- if (r2) {
626
- throw takeObject(r1);
627
- }
628
- return takeObject(r0);
629
- } finally {
630
- wasm.__wbindgen_add_to_stack_pointer(16);
631
- }
632
- }
633
- /**
634
- * Set a template as active for use.
635
- * @param {string} id
636
- */
637
- setActive(id) {
638
- try {
639
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
640
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
641
- const len0 = WASM_VECTOR_LEN;
642
- wasm.wasmgallery_setActive(retptr, this.__wbg_ptr, ptr0, len0);
643
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
644
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
645
- if (r1) {
646
- throw takeObject(r0);
647
- }
648
- } finally {
649
- wasm.__wbindgen_add_to_stack_pointer(16);
650
- }
651
- }
652
- }
653
- if (Symbol.dispose) WasmGallery.prototype[Symbol.dispose] = WasmGallery.prototype.free;
654
-
655
- /**
656
- * WASM MCP Server — runs the MCP protocol entirely in the browser.
657
- *
658
- * This server exposes rvAgent tools via MCP JSON-RPC, enabling integration
659
- * with MCP clients without requiring a separate server process.
660
- *
661
- * # Example (JavaScript)
662
- * ```js
663
- * const mcp = new WasmMcpServer("rvagent-wasm");
664
- *
665
- * // Handle request
666
- * const response = mcp.handleRequest(JSON.stringify({
667
- * jsonrpc: "2.0",
668
- * id: 1,
669
- * method: "tools/list",
670
- * params: {}
671
- * }));
672
- * console.log(response);
673
- * ```
674
- */
675
- export class WasmMcpServer {
676
- __destroy_into_raw() {
677
- const ptr = this.__wbg_ptr;
678
- this.__wbg_ptr = 0;
679
- WasmMcpServerFinalization.unregister(this);
680
- return ptr;
681
- }
682
- free() {
683
- const ptr = this.__destroy_into_raw();
684
- wasm.__wbg_wasmmcpserver_free(ptr, 0);
685
- }
686
- /**
687
- * Execute a tool by name with JSON parameters.
688
- * @param {string} name
689
- * @param {string} params_json
690
- * @returns {any}
691
- */
692
- call_tool(name, params_json) {
693
- try {
694
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
695
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
696
- const len0 = WASM_VECTOR_LEN;
697
- const ptr1 = passStringToWasm0(params_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
698
- const len1 = WASM_VECTOR_LEN;
699
- wasm.wasmmcpserver_call_tool(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
700
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
701
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
702
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
703
- if (r2) {
704
- throw takeObject(r1);
705
- }
706
- return takeObject(r0);
707
- } finally {
708
- wasm.__wbindgen_add_to_stack_pointer(16);
709
- }
710
- }
711
- /**
712
- * Get the gallery instance for direct access.
713
- * @returns {any}
714
- */
715
- gallery() {
716
- try {
717
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
718
- wasm.wasmmcpserver_gallery(retptr, this.__wbg_ptr);
719
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
720
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
721
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
722
- if (r2) {
723
- throw takeObject(r1);
724
- }
725
- return takeObject(r0);
726
- } finally {
727
- wasm.__wbindgen_add_to_stack_pointer(16);
728
- }
729
- }
730
- /**
731
- * Handle a JSON-RPC request and return a JSON-RPC response.
732
- * @param {string} request_json
733
- * @returns {any}
734
- */
735
- handle_request(request_json) {
736
- try {
737
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
738
- const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
739
- const len0 = WASM_VECTOR_LEN;
740
- wasm.wasmmcpserver_handle_request(retptr, this.__wbg_ptr, ptr0, len0);
741
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
742
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
743
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
744
- if (r2) {
745
- throw takeObject(r1);
746
- }
747
- return takeObject(r0);
748
- } finally {
749
- wasm.__wbindgen_add_to_stack_pointer(16);
750
- }
751
- }
752
- /**
753
- * Check if the server has been initialized.
754
- * @returns {boolean}
755
- */
756
- is_initialized() {
757
- const ret = wasm.wasmmcpserver_is_initialized(this.__wbg_ptr);
758
- return ret !== 0;
759
- }
760
- /**
761
- * Get the list of available tools as JSON.
762
- * @returns {any}
763
- */
764
- list_tools() {
765
- try {
766
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
767
- wasm.wasmmcpserver_list_tools(retptr, this.__wbg_ptr);
768
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
769
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
770
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
771
- if (r2) {
772
- throw takeObject(r1);
773
- }
774
- return takeObject(r0);
775
- } finally {
776
- wasm.__wbindgen_add_to_stack_pointer(16);
777
- }
778
- }
779
- /**
780
- * Get the server name.
781
- * @returns {string}
782
- */
783
- name() {
784
- let deferred1_0;
785
- let deferred1_1;
786
- try {
787
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
788
- wasm.wasmmcpserver_name(retptr, this.__wbg_ptr);
789
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
790
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
791
- deferred1_0 = r0;
792
- deferred1_1 = r1;
793
- return getStringFromWasm0(r0, r1);
794
- } finally {
795
- wasm.__wbindgen_add_to_stack_pointer(16);
796
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
797
- }
798
- }
799
- /**
800
- * Create a new WasmMcpServer with the given name.
801
- * @param {string} name
802
- */
803
- constructor(name) {
804
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
805
- const len0 = WASM_VECTOR_LEN;
806
- const ret = wasm.wasmmcpserver_new(ptr0, len0);
807
- this.__wbg_ptr = ret >>> 0;
808
- WasmMcpServerFinalization.register(this, this.__wbg_ptr, this);
809
- return this;
810
- }
811
- /**
812
- * Get the server version.
813
- * @returns {string}
814
- */
815
- version() {
816
- let deferred1_0;
817
- let deferred1_1;
818
- try {
819
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
820
- wasm.wasmmcpserver_version(retptr, this.__wbg_ptr);
821
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
822
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
823
- deferred1_0 = r0;
824
- deferred1_1 = r1;
825
- return getStringFromWasm0(r0, r1);
826
- } finally {
827
- wasm.__wbindgen_add_to_stack_pointer(16);
828
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
829
- }
830
- }
831
- }
832
- if (Symbol.dispose) WasmMcpServer.prototype[Symbol.dispose] = WasmMcpServer.prototype.free;
833
-
834
- /**
835
- * RVF Container Builder for WASM.
836
- *
837
- * Build RVF cognitive containers that package tools, prompts, skills,
838
- * orchestrator configs, MCP tools, and Ruvix capabilities.
839
- *
840
- * # Example (JavaScript)
841
- * ```js
842
- * const builder = new WasmRvfBuilder();
843
- * builder.addTool({ name: "search", description: "Web search", parameters: {} });
844
- * builder.addPrompt({ name: "coder", system_prompt: "You are a coder", version: "1.0" });
845
- * const container = builder.build();
846
- * // container is Uint8Array with RVF magic bytes
847
- * ```
848
- */
849
- export class WasmRvfBuilder {
850
- __destroy_into_raw() {
851
- const ptr = this.__wbg_ptr;
852
- this.__wbg_ptr = 0;
853
- WasmRvfBuilderFinalization.unregister(this);
854
- return ptr;
855
- }
856
- free() {
857
- const ptr = this.__destroy_into_raw();
858
- wasm.__wbg_wasmrvfbuilder_free(ptr, 0);
859
- }
860
- /**
861
- * Add Ruvix capability definitions.
862
- * @param {string} caps_json
863
- */
864
- addCapabilities(caps_json) {
865
- try {
866
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
867
- const ptr0 = passStringToWasm0(caps_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
868
- const len0 = WASM_VECTOR_LEN;
869
- wasm.wasmrvfbuilder_addCapabilities(retptr, this.__wbg_ptr, ptr0, len0);
870
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
871
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
872
- if (r1) {
873
- throw takeObject(r0);
874
- }
875
- } finally {
876
- wasm.__wbindgen_add_to_stack_pointer(16);
877
- }
878
- }
879
- /**
880
- * Add MCP tool entries.
881
- * @param {string} tools_json
882
- */
883
- addMcpTools(tools_json) {
884
- try {
885
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
886
- const ptr0 = passStringToWasm0(tools_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
887
- const len0 = WASM_VECTOR_LEN;
888
- wasm.wasmrvfbuilder_addMcpTools(retptr, this.__wbg_ptr, ptr0, len0);
889
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
890
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
891
- if (r1) {
892
- throw takeObject(r0);
893
- }
894
- } finally {
895
- wasm.__wbindgen_add_to_stack_pointer(16);
896
- }
897
- }
898
- /**
899
- * Add an agent prompt.
900
- * @param {string} prompt_json
901
- */
902
- addPrompt(prompt_json) {
903
- try {
904
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
905
- const ptr0 = passStringToWasm0(prompt_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
906
- const len0 = WASM_VECTOR_LEN;
907
- wasm.wasmrvfbuilder_addPrompt(retptr, this.__wbg_ptr, ptr0, len0);
908
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
909
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
910
- if (r1) {
911
- throw takeObject(r0);
912
- }
913
- } finally {
914
- wasm.__wbindgen_add_to_stack_pointer(16);
915
- }
916
- }
917
- /**
918
- * Add multiple prompts from JSON array.
919
- * @param {string} prompts_json
920
- */
921
- addPrompts(prompts_json) {
922
- try {
923
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
924
- const ptr0 = passStringToWasm0(prompts_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
925
- const len0 = WASM_VECTOR_LEN;
926
- wasm.wasmrvfbuilder_addPrompts(retptr, this.__wbg_ptr, ptr0, len0);
927
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
928
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
929
- if (r1) {
930
- throw takeObject(r0);
931
- }
932
- } finally {
933
- wasm.__wbindgen_add_to_stack_pointer(16);
934
- }
935
- }
936
- /**
937
- * Add a skill definition.
938
- * @param {string} skill_json
939
- */
940
- addSkill(skill_json) {
941
- try {
942
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
943
- const ptr0 = passStringToWasm0(skill_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
944
- const len0 = WASM_VECTOR_LEN;
945
- wasm.wasmrvfbuilder_addSkill(retptr, this.__wbg_ptr, ptr0, len0);
946
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
947
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
948
- if (r1) {
949
- throw takeObject(r0);
950
- }
951
- } finally {
952
- wasm.__wbindgen_add_to_stack_pointer(16);
953
- }
954
- }
955
- /**
956
- * Add multiple skills from JSON array.
957
- * @param {string} skills_json
958
- */
959
- addSkills(skills_json) {
960
- try {
961
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
962
- const ptr0 = passStringToWasm0(skills_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
963
- const len0 = WASM_VECTOR_LEN;
964
- wasm.wasmrvfbuilder_addSkills(retptr, this.__wbg_ptr, ptr0, len0);
965
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
966
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
967
- if (r1) {
968
- throw takeObject(r0);
969
- }
970
- } finally {
971
- wasm.__wbindgen_add_to_stack_pointer(16);
972
- }
973
- }
974
- /**
975
- * Add a tool definition.
976
- * @param {string} tool_json
977
- */
978
- addTool(tool_json) {
979
- try {
980
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
981
- const ptr0 = passStringToWasm0(tool_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
982
- const len0 = WASM_VECTOR_LEN;
983
- wasm.wasmrvfbuilder_addTool(retptr, this.__wbg_ptr, ptr0, len0);
984
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
985
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
986
- if (r1) {
987
- throw takeObject(r0);
988
- }
989
- } finally {
990
- wasm.__wbindgen_add_to_stack_pointer(16);
991
- }
992
- }
993
- /**
994
- * Add multiple tools from JSON array.
995
- * @param {string} tools_json
996
- */
997
- addTools(tools_json) {
998
- try {
999
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1000
- const ptr0 = passStringToWasm0(tools_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1001
- const len0 = WASM_VECTOR_LEN;
1002
- wasm.wasmrvfbuilder_addTools(retptr, this.__wbg_ptr, ptr0, len0);
1003
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1004
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1005
- if (r1) {
1006
- throw takeObject(r0);
1007
- }
1008
- } finally {
1009
- wasm.__wbindgen_add_to_stack_pointer(16);
1010
- }
1011
- }
1012
- /**
1013
- * Build the RVF container as bytes.
1014
- *
1015
- * Returns a Uint8Array containing the RVF binary:
1016
- * - Magic bytes: "RVF\x01" (4 bytes)
1017
- * - Segment count: u32 LE (4 bytes)
1018
- * - Segments: type(1) + tag(2) + len(4) + data
1019
- * - Checksum: SHA3-256 (32 bytes)
1020
- * @returns {Uint8Array}
1021
- */
1022
- build() {
1023
- try {
1024
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1025
- wasm.wasmrvfbuilder_build(retptr, this.__wbg_ptr);
1026
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1027
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1028
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1029
- if (r2) {
1030
- throw takeObject(r1);
1031
- }
1032
- return takeObject(r0);
1033
- } finally {
1034
- wasm.__wbindgen_add_to_stack_pointer(16);
1035
- }
1036
- }
1037
- /**
1038
- * Get the RVF magic bytes for detection.
1039
- * @returns {Uint8Array}
1040
- */
1041
- static getMagic() {
1042
- const ret = wasm.wasmrvfbuilder_getMagic();
1043
- return takeObject(ret);
1044
- }
1045
- /**
1046
- * Create a new RVF container builder.
1047
- */
1048
- constructor() {
1049
- const ret = wasm.wasmrvfbuilder_new();
1050
- this.__wbg_ptr = ret >>> 0;
1051
- WasmRvfBuilderFinalization.register(this, this.__wbg_ptr, this);
1052
- return this;
1053
- }
1054
- /**
1055
- * Parse an RVF container from bytes.
1056
- * @param {Uint8Array} data
1057
- * @returns {any}
1058
- */
1059
- static parse(data) {
1060
- try {
1061
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1062
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
1063
- const len0 = WASM_VECTOR_LEN;
1064
- wasm.wasmrvfbuilder_parse(retptr, ptr0, len0);
1065
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1066
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1067
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1068
- if (r2) {
1069
- throw takeObject(r1);
1070
- }
1071
- return takeObject(r0);
1072
- } finally {
1073
- wasm.__wbindgen_add_to_stack_pointer(16);
1074
- }
1075
- }
1076
- /**
1077
- * Set orchestrator configuration.
1078
- * @param {string} config_json
1079
- */
1080
- setOrchestrator(config_json) {
1081
- try {
1082
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1083
- const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1084
- const len0 = WASM_VECTOR_LEN;
1085
- wasm.wasmrvfbuilder_setOrchestrator(retptr, this.__wbg_ptr, ptr0, len0);
1086
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1087
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1088
- if (r1) {
1089
- throw takeObject(r0);
1090
- }
1091
- } finally {
1092
- wasm.__wbindgen_add_to_stack_pointer(16);
1093
- }
1094
- }
1095
- /**
1096
- * Validate an RVF container (check magic and checksum).
1097
- * @param {Uint8Array} data
1098
- * @returns {boolean}
1099
- */
1100
- static validate(data) {
1101
- try {
1102
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1103
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
1104
- const len0 = WASM_VECTOR_LEN;
1105
- wasm.wasmrvfbuilder_validate(retptr, ptr0, len0);
1106
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1107
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1108
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1109
- if (r2) {
1110
- throw takeObject(r1);
1111
- }
1112
- return r0 !== 0;
1113
- } finally {
1114
- wasm.__wbindgen_add_to_stack_pointer(16);
1115
- }
1116
- }
1117
- }
1118
- if (Symbol.dispose) WasmRvfBuilder.prototype[Symbol.dispose] = WasmRvfBuilder.prototype.free;
1119
-
1120
- function __wbg_get_imports() {
1121
- const import0 = {
1122
- __proto__: null,
1123
- __wbg___wbindgen_is_function_d633e708baf0d146: function(arg0) {
1124
- const ret = typeof(getObject(arg0)) === 'function';
1125
- return ret;
1126
- },
1127
- __wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
1128
- const ret = getObject(arg0) === undefined;
1129
- return ret;
1130
- },
1131
- __wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
1132
- const obj = getObject(arg1);
1133
- const ret = typeof(obj) === 'string' ? obj : undefined;
1134
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1135
- var len1 = WASM_VECTOR_LEN;
1136
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1137
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1138
- },
1139
- __wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
1140
- throw new Error(getStringFromWasm0(arg0, arg1));
1141
- },
1142
- __wbg__wbg_cb_unref_b6d832240a919168: function(arg0) {
1143
- getObject(arg0)._wbg_cb_unref();
1144
- },
1145
- __wbg_call_08ad0d89caa7cb79: function() { return handleError(function (arg0, arg1, arg2) {
1146
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1147
- return addHeapObject(ret);
1148
- }, arguments); },
1149
- __wbg_instanceof_Promise_44e4f673e91c710d: function(arg0) {
1150
- let result;
1151
- try {
1152
- result = getObject(arg0) instanceof Promise;
1153
- } catch (_) {
1154
- result = false;
1155
- }
1156
- const ret = result;
1157
- return ret;
1158
- },
1159
- __wbg_new_from_slice_d7e202fdbee3c396: function(arg0, arg1) {
1160
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1161
- return addHeapObject(ret);
1162
- },
1163
- __wbg_new_typed_8258a0d8488ef2a2: function(arg0, arg1) {
1164
- try {
1165
- var state0 = {a: arg0, b: arg1};
1166
- var cb0 = (arg0, arg1) => {
1167
- const a = state0.a;
1168
- state0.a = 0;
1169
- try {
1170
- return __wasm_bindgen_func_elem_535(a, state0.b, arg0, arg1);
1171
- } finally {
1172
- state0.a = a;
1173
- }
1174
- };
1175
- const ret = new Promise(cb0);
1176
- return addHeapObject(ret);
1177
- } finally {
1178
- state0.a = state0.b = 0;
1179
- }
1180
- },
1181
- __wbg_parse_6dfe891b5bafb5cd: function() { return handleError(function (arg0, arg1) {
1182
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
1183
- return addHeapObject(ret);
1184
- }, arguments); },
1185
- __wbg_queueMicrotask_2c8dfd1056f24fdc: function(arg0) {
1186
- const ret = getObject(arg0).queueMicrotask;
1187
- return addHeapObject(ret);
1188
- },
1189
- __wbg_queueMicrotask_8985ad63815852e7: function(arg0) {
1190
- queueMicrotask(getObject(arg0));
1191
- },
1192
- __wbg_resolve_5d61e0d10c14730a: function(arg0) {
1193
- const ret = Promise.resolve(getObject(arg0));
1194
- return addHeapObject(ret);
1195
- },
1196
- __wbg_static_accessor_GLOBAL_THIS_14325d8cca34bb77: function() {
1197
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
1198
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1199
- },
1200
- __wbg_static_accessor_GLOBAL_f3a1e69f9c5a7e8e: function() {
1201
- const ret = typeof global === 'undefined' ? null : global;
1202
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1203
- },
1204
- __wbg_static_accessor_SELF_50cdb5b517789aca: function() {
1205
- const ret = typeof self === 'undefined' ? null : self;
1206
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1207
- },
1208
- __wbg_static_accessor_WINDOW_d6c4126e4c244380: function() {
1209
- const ret = typeof window === 'undefined' ? null : window;
1210
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
1211
- },
1212
- __wbg_then_d4163530723f56f4: function(arg0, arg1, arg2) {
1213
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1214
- return addHeapObject(ret);
1215
- },
1216
- __wbg_then_f1c954fe00733701: function(arg0, arg1) {
1217
- const ret = getObject(arg0).then(getObject(arg1));
1218
- return addHeapObject(ret);
1219
- },
1220
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1221
- // Cast intrinsic for `Closure(Closure { dtor_idx: 64, function: Function { arguments: [Externref], shim_idx: 65, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1222
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_497, __wasm_bindgen_func_elem_498);
1223
- return addHeapObject(ret);
1224
- },
1225
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1226
- // Cast intrinsic for `Ref(String) -> Externref`.
1227
- const ret = getStringFromWasm0(arg0, arg1);
1228
- return addHeapObject(ret);
1229
- },
1230
- __wbindgen_object_clone_ref: function(arg0) {
1231
- const ret = getObject(arg0);
1232
- return addHeapObject(ret);
1233
- },
1234
- __wbindgen_object_drop_ref: function(arg0) {
1235
- takeObject(arg0);
1236
- },
1237
- };
1238
- return {
1239
- __proto__: null,
1240
- "./rvagent_wasm_bg.js": import0,
1241
- };
1242
- }
1243
-
1244
- function __wasm_bindgen_func_elem_498(arg0, arg1, arg2) {
1245
- try {
1246
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1247
- wasm.__wasm_bindgen_func_elem_498(retptr, arg0, arg1, addHeapObject(arg2));
1248
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1249
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1250
- if (r1) {
1251
- throw takeObject(r0);
1252
- }
1253
- } finally {
1254
- wasm.__wbindgen_add_to_stack_pointer(16);
1255
- }
1256
- }
1257
-
1258
- function __wasm_bindgen_func_elem_535(arg0, arg1, arg2, arg3) {
1259
- wasm.__wasm_bindgen_func_elem_535(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1260
- }
1261
-
1262
- const JsModelProviderFinalization = (typeof FinalizationRegistry === 'undefined')
1263
- ? { register: () => {}, unregister: () => {} }
1264
- : new FinalizationRegistry(ptr => wasm.__wbg_jsmodelprovider_free(ptr >>> 0, 1));
1265
- const WasmAgentFinalization = (typeof FinalizationRegistry === 'undefined')
1266
- ? { register: () => {}, unregister: () => {} }
1267
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmagent_free(ptr >>> 0, 1));
1268
- const WasmGalleryFinalization = (typeof FinalizationRegistry === 'undefined')
1269
- ? { register: () => {}, unregister: () => {} }
1270
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmgallery_free(ptr >>> 0, 1));
1271
- const WasmMcpServerFinalization = (typeof FinalizationRegistry === 'undefined')
1272
- ? { register: () => {}, unregister: () => {} }
1273
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmmcpserver_free(ptr >>> 0, 1));
1274
- const WasmRvfBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
1275
- ? { register: () => {}, unregister: () => {} }
1276
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmrvfbuilder_free(ptr >>> 0, 1));
1277
-
1278
- function addHeapObject(obj) {
1279
- if (heap_next === heap.length) heap.push(heap.length + 1);
1280
- const idx = heap_next;
1281
- heap_next = heap[idx];
1282
-
1283
- heap[idx] = obj;
1284
- return idx;
1285
- }
1286
-
1287
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1288
- ? { register: () => {}, unregister: () => {} }
1289
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
1290
-
1291
- function dropObject(idx) {
1292
- if (idx < 1028) return;
1293
- heap[idx] = heap_next;
1294
- heap_next = idx;
1295
- }
1296
-
1297
- function getArrayU8FromWasm0(ptr, len) {
1298
- ptr = ptr >>> 0;
1299
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1300
- }
1301
-
1302
- let cachedDataViewMemory0 = null;
1303
- function getDataViewMemory0() {
1304
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1305
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1306
- }
1307
- return cachedDataViewMemory0;
1308
- }
1309
-
1310
- function getStringFromWasm0(ptr, len) {
1311
- ptr = ptr >>> 0;
1312
- return decodeText(ptr, len);
1313
- }
1314
-
1315
- let cachedUint8ArrayMemory0 = null;
1316
- function getUint8ArrayMemory0() {
1317
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1318
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1319
- }
1320
- return cachedUint8ArrayMemory0;
1321
- }
1322
-
1323
- function getObject(idx) { return heap[idx]; }
1324
-
1325
- function handleError(f, args) {
1326
- try {
1327
- return f.apply(this, args);
1328
- } catch (e) {
1329
- wasm.__wbindgen_export3(addHeapObject(e));
1330
- }
1331
- }
1332
-
1333
- let heap = new Array(1024).fill(undefined);
1334
- heap.push(undefined, null, true, false);
1335
-
1336
- let heap_next = heap.length;
1337
-
1338
- function isLikeNone(x) {
1339
- return x === undefined || x === null;
1340
- }
1341
-
1342
- function makeMutClosure(arg0, arg1, dtor, f) {
1343
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
1344
- const real = (...args) => {
1345
-
1346
- // First up with a closure we increment the internal reference
1347
- // count. This ensures that the Rust closure environment won't
1348
- // be deallocated while we're invoking it.
1349
- state.cnt++;
1350
- const a = state.a;
1351
- state.a = 0;
1352
- try {
1353
- return f(a, state.b, ...args);
1354
- } finally {
1355
- state.a = a;
1356
- real._wbg_cb_unref();
1357
- }
1358
- };
1359
- real._wbg_cb_unref = () => {
1360
- if (--state.cnt === 0) {
1361
- state.dtor(state.a, state.b);
1362
- state.a = 0;
1363
- CLOSURE_DTORS.unregister(state);
1364
- }
1365
- };
1366
- CLOSURE_DTORS.register(real, state, state);
1367
- return real;
1368
- }
1369
-
1370
- function passArray8ToWasm0(arg, malloc) {
1371
- const ptr = malloc(arg.length * 1, 1) >>> 0;
1372
- getUint8ArrayMemory0().set(arg, ptr / 1);
1373
- WASM_VECTOR_LEN = arg.length;
1374
- return ptr;
1375
- }
1376
-
1377
- function passStringToWasm0(arg, malloc, realloc) {
1378
- if (realloc === undefined) {
1379
- const buf = cachedTextEncoder.encode(arg);
1380
- const ptr = malloc(buf.length, 1) >>> 0;
1381
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1382
- WASM_VECTOR_LEN = buf.length;
1383
- return ptr;
1384
- }
1385
-
1386
- let len = arg.length;
1387
- let ptr = malloc(len, 1) >>> 0;
1388
-
1389
- const mem = getUint8ArrayMemory0();
1390
-
1391
- let offset = 0;
1392
-
1393
- for (; offset < len; offset++) {
1394
- const code = arg.charCodeAt(offset);
1395
- if (code > 0x7F) break;
1396
- mem[ptr + offset] = code;
1397
- }
1398
- if (offset !== len) {
1399
- if (offset !== 0) {
1400
- arg = arg.slice(offset);
1401
- }
1402
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1403
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1404
- const ret = cachedTextEncoder.encodeInto(arg, view);
1405
-
1406
- offset += ret.written;
1407
- ptr = realloc(ptr, len, offset, 1) >>> 0;
1408
- }
1409
-
1410
- WASM_VECTOR_LEN = offset;
1411
- return ptr;
1412
- }
1413
-
1414
- function takeObject(idx) {
1415
- const ret = getObject(idx);
1416
- dropObject(idx);
1417
- return ret;
1418
- }
1419
-
1420
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1421
- cachedTextDecoder.decode();
1422
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
1423
- let numBytesDecoded = 0;
1424
- function decodeText(ptr, len) {
1425
- numBytesDecoded += len;
1426
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1427
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1428
- cachedTextDecoder.decode();
1429
- numBytesDecoded = len;
1430
- }
1431
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1432
- }
1433
-
1434
- const cachedTextEncoder = new TextEncoder();
1435
-
1436
- if (!('encodeInto' in cachedTextEncoder)) {
1437
- cachedTextEncoder.encodeInto = function (arg, view) {
1438
- const buf = cachedTextEncoder.encode(arg);
1439
- view.set(buf);
1440
- return {
1441
- read: arg.length,
1442
- written: buf.length
1443
- };
1444
- };
1445
- }
1446
-
1447
- let WASM_VECTOR_LEN = 0;
1448
-
1449
- let wasmModule, wasm;
1450
- function __wbg_finalize_init(instance, module) {
1451
- wasm = instance.exports;
1452
- wasmModule = module;
1453
- cachedDataViewMemory0 = null;
1454
- cachedUint8ArrayMemory0 = null;
1455
- return wasm;
1456
- }
1457
-
1458
- async function __wbg_load(module, imports) {
1459
- if (typeof Response === 'function' && module instanceof Response) {
1460
- if (typeof WebAssembly.instantiateStreaming === 'function') {
1461
- try {
1462
- return await WebAssembly.instantiateStreaming(module, imports);
1463
- } catch (e) {
1464
- const validResponse = module.ok && expectedResponseType(module.type);
1465
-
1466
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1467
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1468
-
1469
- } else { throw e; }
1470
- }
1471
- }
1472
-
1473
- const bytes = await module.arrayBuffer();
1474
- return await WebAssembly.instantiate(bytes, imports);
1475
- } else {
1476
- const instance = await WebAssembly.instantiate(module, imports);
1477
-
1478
- if (instance instanceof WebAssembly.Instance) {
1479
- return { instance, module };
1480
- } else {
1481
- return instance;
1482
- }
1483
- }
1484
-
1485
- function expectedResponseType(type) {
1486
- switch (type) {
1487
- case 'basic': case 'cors': case 'default': return true;
1488
- }
1489
- return false;
1490
- }
1491
- }
1492
-
1493
- function initSync(module) {
1494
- if (wasm !== undefined) return wasm;
1495
-
1496
-
1497
- if (module !== undefined) {
1498
- if (Object.getPrototypeOf(module) === Object.prototype) {
1499
- ({module} = module)
1500
- } else {
1501
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1502
- }
1503
- }
1504
-
1505
- const imports = __wbg_get_imports();
1506
- if (!(module instanceof WebAssembly.Module)) {
1507
- module = new WebAssembly.Module(module);
1508
- }
1509
- const instance = new WebAssembly.Instance(module, imports);
1510
- return __wbg_finalize_init(instance, module);
1511
- }
1512
-
1513
- async function __wbg_init(module_or_path) {
1514
- if (wasm !== undefined) return wasm;
1515
-
1516
-
1517
- if (module_or_path !== undefined) {
1518
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1519
- ({module_or_path} = module_or_path)
1520
- } else {
1521
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1522
- }
1523
- }
1524
-
1525
- if (module_or_path === undefined) {
1526
- module_or_path = new URL('rvagent_wasm_bg.wasm', import.meta.url);
1527
- }
1528
- const imports = __wbg_get_imports();
1529
-
1530
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1531
- module_or_path = fetch(module_or_path);
1532
- }
1533
-
1534
- const { instance, module } = await __wbg_load(await module_or_path, imports);
1535
-
1536
- return __wbg_finalize_init(instance, module);
1537
- }
1538
-
1539
- export { initSync, __wbg_init as default };
1
+ /* @ts-self-types="./rvagent_wasm.d.ts" */
2
+
3
+ /**
4
+ * A model provider that delegates to a JavaScript callback function.
5
+ *
6
+ * The JS callback receives a JSON string of messages and must return
7
+ * a Promise that resolves to a JSON string response.
8
+ *
9
+ * # JavaScript usage
10
+ * ```js
11
+ * const provider = new JsModelProvider(async (messagesJson) => {
12
+ * const messages = JSON.parse(messagesJson);
13
+ * const response = await callMyModel(messages);
14
+ * return JSON.stringify(response);
15
+ * });
16
+ * ```
17
+ */
18
+ export class JsModelProvider {
19
+ __destroy_into_raw() {
20
+ const ptr = this.__wbg_ptr;
21
+ this.__wbg_ptr = 0;
22
+ JsModelProviderFinalization.unregister(this);
23
+ return ptr;
24
+ }
25
+ free() {
26
+ const ptr = this.__destroy_into_raw();
27
+ wasm.__wbg_jsmodelprovider_free(ptr, 0);
28
+ }
29
+ /**
30
+ * Send messages to the JS model provider and get a response.
31
+ *
32
+ * `messages_json` is a JSON-serialized array of message objects.
33
+ * Returns the model's response as a JSON string.
34
+ * @param {string} messages_json
35
+ * @returns {Promise<string>}
36
+ */
37
+ complete(messages_json) {
38
+ const ptr0 = passStringToWasm0(messages_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
39
+ const len0 = WASM_VECTOR_LEN;
40
+ const ret = wasm.jsmodelprovider_complete(this.__wbg_ptr, ptr0, len0);
41
+ return takeObject(ret);
42
+ }
43
+ /**
44
+ * Create a new provider wrapping a JavaScript async function.
45
+ *
46
+ * The function must accept a JSON string and return a Promise<string>.
47
+ * @param {Function} callback
48
+ */
49
+ constructor(callback) {
50
+ try {
51
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
52
+ wasm.jsmodelprovider_new(retptr, addHeapObject(callback));
53
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
54
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
55
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
56
+ if (r2) {
57
+ throw takeObject(r1);
58
+ }
59
+ this.__wbg_ptr = r0 >>> 0;
60
+ JsModelProviderFinalization.register(this, this.__wbg_ptr, this);
61
+ return this;
62
+ } finally {
63
+ wasm.__wbindgen_add_to_stack_pointer(16);
64
+ }
65
+ }
66
+ }
67
+ if (Symbol.dispose) JsModelProvider.prototype[Symbol.dispose] = JsModelProvider.prototype.free;
68
+
69
+ /**
70
+ * rvAgent WASM — browser and Node.js agent execution.
71
+ *
72
+ * Create with `new WasmAgent(configJson)` from JavaScript.
73
+ */
74
+ export class WasmAgent {
75
+ __destroy_into_raw() {
76
+ const ptr = this.__wbg_ptr;
77
+ this.__wbg_ptr = 0;
78
+ WasmAgentFinalization.unregister(this);
79
+ return ptr;
80
+ }
81
+ free() {
82
+ const ptr = this.__destroy_into_raw();
83
+ wasm.__wbg_wasmagent_free(ptr, 0);
84
+ }
85
+ /**
86
+ * Execute a tool directly by passing a JSON tool request.
87
+ * @param {string} tool_json
88
+ * @returns {any}
89
+ */
90
+ execute_tool(tool_json) {
91
+ try {
92
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
93
+ const ptr0 = passStringToWasm0(tool_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
94
+ const len0 = WASM_VECTOR_LEN;
95
+ wasm.wasmagent_execute_tool(retptr, this.__wbg_ptr, ptr0, len0);
96
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
97
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
98
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
99
+ if (r2) {
100
+ throw takeObject(r1);
101
+ }
102
+ return takeObject(r0);
103
+ } finally {
104
+ wasm.__wbindgen_add_to_stack_pointer(16);
105
+ }
106
+ }
107
+ /**
108
+ * Get the number of files in the virtual filesystem.
109
+ * @returns {number}
110
+ */
111
+ file_count() {
112
+ const ret = wasm.wasmagent_file_count(this.__wbg_ptr);
113
+ return ret >>> 0;
114
+ }
115
+ /**
116
+ * Get the current agent state as JSON.
117
+ * @returns {any}
118
+ */
119
+ get_state() {
120
+ try {
121
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
122
+ wasm.wasmagent_get_state(retptr, this.__wbg_ptr);
123
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
124
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
125
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
126
+ if (r2) {
127
+ throw takeObject(r1);
128
+ }
129
+ return takeObject(r0);
130
+ } finally {
131
+ wasm.__wbindgen_add_to_stack_pointer(16);
132
+ }
133
+ }
134
+ /**
135
+ * Get the todo list as JSON.
136
+ * @returns {any}
137
+ */
138
+ get_todos() {
139
+ try {
140
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
141
+ wasm.wasmagent_get_todos(retptr, this.__wbg_ptr);
142
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
143
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
144
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
145
+ if (r2) {
146
+ throw takeObject(r1);
147
+ }
148
+ return takeObject(r0);
149
+ } finally {
150
+ wasm.__wbindgen_add_to_stack_pointer(16);
151
+ }
152
+ }
153
+ /**
154
+ * Get the list of available tools.
155
+ * @returns {any}
156
+ */
157
+ get_tools() {
158
+ try {
159
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160
+ wasm.wasmagent_get_tools(retptr, this.__wbg_ptr);
161
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
162
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
163
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
164
+ if (r2) {
165
+ throw takeObject(r1);
166
+ }
167
+ return takeObject(r0);
168
+ } finally {
169
+ wasm.__wbindgen_add_to_stack_pointer(16);
170
+ }
171
+ }
172
+ /**
173
+ * Check whether the agent is stopped.
174
+ * @returns {boolean}
175
+ */
176
+ is_stopped() {
177
+ const ret = wasm.wasmagent_is_stopped(this.__wbg_ptr);
178
+ return ret !== 0;
179
+ }
180
+ /**
181
+ * Get the configured model identifier.
182
+ * @returns {string}
183
+ */
184
+ model() {
185
+ let deferred1_0;
186
+ let deferred1_1;
187
+ try {
188
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
189
+ wasm.wasmagent_model(retptr, this.__wbg_ptr);
190
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
191
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
192
+ deferred1_0 = r0;
193
+ deferred1_1 = r1;
194
+ return getStringFromWasm0(r0, r1);
195
+ } finally {
196
+ wasm.__wbindgen_add_to_stack_pointer(16);
197
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
198
+ }
199
+ }
200
+ /**
201
+ * Get the agent name, if configured.
202
+ * @returns {string | undefined}
203
+ */
204
+ name() {
205
+ try {
206
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
207
+ wasm.wasmagent_name(retptr, this.__wbg_ptr);
208
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
209
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
210
+ let v1;
211
+ if (r0 !== 0) {
212
+ v1 = getStringFromWasm0(r0, r1).slice();
213
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
214
+ }
215
+ return v1;
216
+ } finally {
217
+ wasm.__wbindgen_add_to_stack_pointer(16);
218
+ }
219
+ }
220
+ /**
221
+ * Create a new WasmAgent from a JSON configuration string.
222
+ *
223
+ * # Example (JavaScript)
224
+ * ```js
225
+ * const agent = new WasmAgent('{"model": "anthropic:claude-sonnet-4-20250514"}');
226
+ * ```
227
+ * @param {string} config_json
228
+ */
229
+ constructor(config_json) {
230
+ try {
231
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
232
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
233
+ const len0 = WASM_VECTOR_LEN;
234
+ wasm.wasmagent_new(retptr, ptr0, len0);
235
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
236
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
237
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
238
+ if (r2) {
239
+ throw takeObject(r1);
240
+ }
241
+ this.__wbg_ptr = r0 >>> 0;
242
+ WasmAgentFinalization.register(this, this.__wbg_ptr, this);
243
+ return this;
244
+ } finally {
245
+ wasm.__wbindgen_add_to_stack_pointer(16);
246
+ }
247
+ }
248
+ /**
249
+ * Send a prompt and get a response.
250
+ *
251
+ * If a model provider is set, the prompt is sent to the JS model.
252
+ * Otherwise, returns an echo response for testing.
253
+ * @param {string} input
254
+ * @returns {Promise<any>}
255
+ */
256
+ prompt(input) {
257
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
258
+ const len0 = WASM_VECTOR_LEN;
259
+ const ret = wasm.wasmagent_prompt(this.__wbg_ptr, ptr0, len0);
260
+ return takeObject(ret);
261
+ }
262
+ /**
263
+ * Reset the agent state, clearing messages and turn count.
264
+ */
265
+ reset() {
266
+ wasm.wasmagent_reset(this.__wbg_ptr);
267
+ }
268
+ /**
269
+ * Attach a JavaScript model provider callback.
270
+ *
271
+ * The callback receives a JSON string of messages and must return
272
+ * a `Promise<string>` with the model response.
273
+ * @param {Function} callback
274
+ */
275
+ set_model_provider(callback) {
276
+ try {
277
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
278
+ wasm.wasmagent_set_model_provider(retptr, this.__wbg_ptr, addHeapObject(callback));
279
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
280
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
281
+ if (r1) {
282
+ throw takeObject(r0);
283
+ }
284
+ } finally {
285
+ wasm.__wbindgen_add_to_stack_pointer(16);
286
+ }
287
+ }
288
+ /**
289
+ * Get the current turn count.
290
+ * @returns {number}
291
+ */
292
+ turn_count() {
293
+ const ret = wasm.wasmagent_turn_count(this.__wbg_ptr);
294
+ return ret >>> 0;
295
+ }
296
+ /**
297
+ * Get the crate version.
298
+ * @returns {string}
299
+ */
300
+ static version() {
301
+ let deferred1_0;
302
+ let deferred1_1;
303
+ try {
304
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
305
+ wasm.wasmagent_version(retptr);
306
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
307
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
308
+ deferred1_0 = r0;
309
+ deferred1_1 = r1;
310
+ return getStringFromWasm0(r0, r1);
311
+ } finally {
312
+ wasm.__wbindgen_add_to_stack_pointer(16);
313
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
314
+ }
315
+ }
316
+ }
317
+ if (Symbol.dispose) WasmAgent.prototype[Symbol.dispose] = WasmAgent.prototype.free;
318
+
319
+ /**
320
+ * RVF App Gallery — browse, load, and configure agent templates.
321
+ *
322
+ * # Example (JavaScript)
323
+ * ```js
324
+ * const gallery = new WasmGallery();
325
+ *
326
+ * // List all templates
327
+ * const templates = gallery.list();
328
+ *
329
+ * // Search by tags
330
+ * const results = gallery.search("security testing");
331
+ *
332
+ * // Get template details
333
+ * const template = gallery.get("coder");
334
+ *
335
+ * // Load as RVF container
336
+ * const rvfBytes = gallery.loadRvf("coder");
337
+ *
338
+ * // Configure template
339
+ * gallery.configure("coder", { maxTurns: 100 });
340
+ * ```
341
+ */
342
+ export class WasmGallery {
343
+ __destroy_into_raw() {
344
+ const ptr = this.__wbg_ptr;
345
+ this.__wbg_ptr = 0;
346
+ WasmGalleryFinalization.unregister(this);
347
+ return ptr;
348
+ }
349
+ free() {
350
+ const ptr = this.__destroy_into_raw();
351
+ wasm.__wbg_wasmgallery_free(ptr, 0);
352
+ }
353
+ /**
354
+ * Add a custom template to the gallery.
355
+ * @param {string} template_json
356
+ */
357
+ addCustom(template_json) {
358
+ try {
359
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
360
+ const ptr0 = passStringToWasm0(template_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
361
+ const len0 = WASM_VECTOR_LEN;
362
+ wasm.wasmgallery_addCustom(retptr, this.__wbg_ptr, ptr0, len0);
363
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
364
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
365
+ if (r1) {
366
+ throw takeObject(r0);
367
+ }
368
+ } finally {
369
+ wasm.__wbindgen_add_to_stack_pointer(16);
370
+ }
371
+ }
372
+ /**
373
+ * Configure the active template with overrides.
374
+ * @param {string} config_json
375
+ */
376
+ configure(config_json) {
377
+ try {
378
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
379
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
380
+ const len0 = WASM_VECTOR_LEN;
381
+ wasm.wasmgallery_configure(retptr, this.__wbg_ptr, ptr0, len0);
382
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
383
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
384
+ if (r1) {
385
+ throw takeObject(r0);
386
+ }
387
+ } finally {
388
+ wasm.__wbindgen_add_to_stack_pointer(16);
389
+ }
390
+ }
391
+ /**
392
+ * Get the number of templates in the gallery.
393
+ * @returns {number}
394
+ */
395
+ count() {
396
+ const ret = wasm.wasmgallery_count(this.__wbg_ptr);
397
+ return ret >>> 0;
398
+ }
399
+ /**
400
+ * Export all custom templates as JSON.
401
+ * @returns {any}
402
+ */
403
+ exportCustom() {
404
+ try {
405
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
406
+ wasm.wasmgallery_exportCustom(retptr, this.__wbg_ptr);
407
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
408
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
409
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
410
+ if (r2) {
411
+ throw takeObject(r1);
412
+ }
413
+ return takeObject(r0);
414
+ } finally {
415
+ wasm.__wbindgen_add_to_stack_pointer(16);
416
+ }
417
+ }
418
+ /**
419
+ * Get a template by ID.
420
+ * @param {string} id
421
+ * @returns {any}
422
+ */
423
+ get(id) {
424
+ try {
425
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
426
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
427
+ const len0 = WASM_VECTOR_LEN;
428
+ wasm.wasmgallery_get(retptr, this.__wbg_ptr, ptr0, len0);
429
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
430
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
431
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
432
+ if (r2) {
433
+ throw takeObject(r1);
434
+ }
435
+ return takeObject(r0);
436
+ } finally {
437
+ wasm.__wbindgen_add_to_stack_pointer(16);
438
+ }
439
+ }
440
+ /**
441
+ * Get the currently active template ID.
442
+ * @returns {string | undefined}
443
+ */
444
+ getActive() {
445
+ try {
446
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
447
+ wasm.wasmgallery_getActive(retptr, this.__wbg_ptr);
448
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
449
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
450
+ let v1;
451
+ if (r0 !== 0) {
452
+ v1 = getStringFromWasm0(r0, r1).slice();
453
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
454
+ }
455
+ return v1;
456
+ } finally {
457
+ wasm.__wbindgen_add_to_stack_pointer(16);
458
+ }
459
+ }
460
+ /**
461
+ * Get all categories with template counts.
462
+ * @returns {any}
463
+ */
464
+ getCategories() {
465
+ try {
466
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
467
+ wasm.wasmgallery_getCategories(retptr, this.__wbg_ptr);
468
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
469
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
470
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
471
+ if (r2) {
472
+ throw takeObject(r1);
473
+ }
474
+ return takeObject(r0);
475
+ } finally {
476
+ wasm.__wbindgen_add_to_stack_pointer(16);
477
+ }
478
+ }
479
+ /**
480
+ * Get configuration overrides for active template.
481
+ * @returns {any}
482
+ */
483
+ getConfig() {
484
+ try {
485
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
486
+ wasm.wasmgallery_getConfig(retptr, this.__wbg_ptr);
487
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
488
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
489
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
490
+ if (r2) {
491
+ throw takeObject(r1);
492
+ }
493
+ return takeObject(r0);
494
+ } finally {
495
+ wasm.__wbindgen_add_to_stack_pointer(16);
496
+ }
497
+ }
498
+ /**
499
+ * Import custom templates from JSON.
500
+ * @param {string} templates_json
501
+ * @returns {number}
502
+ */
503
+ importCustom(templates_json) {
504
+ try {
505
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
506
+ const ptr0 = passStringToWasm0(templates_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
507
+ const len0 = WASM_VECTOR_LEN;
508
+ wasm.wasmgallery_importCustom(retptr, this.__wbg_ptr, ptr0, len0);
509
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
510
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
511
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
512
+ if (r2) {
513
+ throw takeObject(r1);
514
+ }
515
+ return r0 >>> 0;
516
+ } finally {
517
+ wasm.__wbindgen_add_to_stack_pointer(16);
518
+ }
519
+ }
520
+ /**
521
+ * List all available templates.
522
+ * @returns {any}
523
+ */
524
+ list() {
525
+ try {
526
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
527
+ wasm.wasmgallery_list(retptr, this.__wbg_ptr);
528
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
529
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
530
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
531
+ if (r2) {
532
+ throw takeObject(r1);
533
+ }
534
+ return takeObject(r0);
535
+ } finally {
536
+ wasm.__wbindgen_add_to_stack_pointer(16);
537
+ }
538
+ }
539
+ /**
540
+ * List templates by category.
541
+ * @param {string} category
542
+ * @returns {any}
543
+ */
544
+ listByCategory(category) {
545
+ try {
546
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
547
+ const ptr0 = passStringToWasm0(category, wasm.__wbindgen_export, wasm.__wbindgen_export2);
548
+ const len0 = WASM_VECTOR_LEN;
549
+ wasm.wasmgallery_listByCategory(retptr, this.__wbg_ptr, ptr0, len0);
550
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
551
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
552
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
553
+ if (r2) {
554
+ throw takeObject(r1);
555
+ }
556
+ return takeObject(r0);
557
+ } finally {
558
+ wasm.__wbindgen_add_to_stack_pointer(16);
559
+ }
560
+ }
561
+ /**
562
+ * Load a template as an RVF container (returns Uint8Array).
563
+ * @param {string} id
564
+ * @returns {Uint8Array}
565
+ */
566
+ loadRvf(id) {
567
+ try {
568
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
569
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
570
+ const len0 = WASM_VECTOR_LEN;
571
+ wasm.wasmgallery_loadRvf(retptr, this.__wbg_ptr, ptr0, len0);
572
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
573
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
574
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
575
+ if (r2) {
576
+ throw takeObject(r1);
577
+ }
578
+ return takeObject(r0);
579
+ } finally {
580
+ wasm.__wbindgen_add_to_stack_pointer(16);
581
+ }
582
+ }
583
+ /**
584
+ * Create a new gallery with built-in templates.
585
+ */
586
+ constructor() {
587
+ const ret = wasm.wasmgallery_new();
588
+ this.__wbg_ptr = ret >>> 0;
589
+ WasmGalleryFinalization.register(this, this.__wbg_ptr, this);
590
+ return this;
591
+ }
592
+ /**
593
+ * Remove a custom template by ID.
594
+ * @param {string} id
595
+ */
596
+ removeCustom(id) {
597
+ try {
598
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
599
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
600
+ const len0 = WASM_VECTOR_LEN;
601
+ wasm.wasmgallery_removeCustom(retptr, this.__wbg_ptr, ptr0, len0);
602
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
603
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
604
+ if (r1) {
605
+ throw takeObject(r0);
606
+ }
607
+ } finally {
608
+ wasm.__wbindgen_add_to_stack_pointer(16);
609
+ }
610
+ }
611
+ /**
612
+ * Search templates by query (matches name, description, tags).
613
+ * @param {string} query
614
+ * @returns {any}
615
+ */
616
+ search(query) {
617
+ try {
618
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
619
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
620
+ const len0 = WASM_VECTOR_LEN;
621
+ wasm.wasmgallery_search(retptr, this.__wbg_ptr, ptr0, len0);
622
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
623
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
624
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
625
+ if (r2) {
626
+ throw takeObject(r1);
627
+ }
628
+ return takeObject(r0);
629
+ } finally {
630
+ wasm.__wbindgen_add_to_stack_pointer(16);
631
+ }
632
+ }
633
+ /**
634
+ * Set a template as active for use.
635
+ * @param {string} id
636
+ */
637
+ setActive(id) {
638
+ try {
639
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
640
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
641
+ const len0 = WASM_VECTOR_LEN;
642
+ wasm.wasmgallery_setActive(retptr, this.__wbg_ptr, ptr0, len0);
643
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
644
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
645
+ if (r1) {
646
+ throw takeObject(r0);
647
+ }
648
+ } finally {
649
+ wasm.__wbindgen_add_to_stack_pointer(16);
650
+ }
651
+ }
652
+ }
653
+ if (Symbol.dispose) WasmGallery.prototype[Symbol.dispose] = WasmGallery.prototype.free;
654
+
655
+ /**
656
+ * WASM MCP Server — runs the MCP protocol entirely in the browser.
657
+ *
658
+ * This server exposes rvAgent tools via MCP JSON-RPC, enabling integration
659
+ * with MCP clients without requiring a separate server process.
660
+ *
661
+ * # Example (JavaScript)
662
+ * ```js
663
+ * const mcp = new WasmMcpServer("rvagent-wasm");
664
+ *
665
+ * // Handle request
666
+ * const response = mcp.handleRequest(JSON.stringify({
667
+ * jsonrpc: "2.0",
668
+ * id: 1,
669
+ * method: "tools/list",
670
+ * params: {}
671
+ * }));
672
+ * console.log(response);
673
+ * ```
674
+ */
675
+ export class WasmMcpServer {
676
+ __destroy_into_raw() {
677
+ const ptr = this.__wbg_ptr;
678
+ this.__wbg_ptr = 0;
679
+ WasmMcpServerFinalization.unregister(this);
680
+ return ptr;
681
+ }
682
+ free() {
683
+ const ptr = this.__destroy_into_raw();
684
+ wasm.__wbg_wasmmcpserver_free(ptr, 0);
685
+ }
686
+ /**
687
+ * Execute a tool by name with JSON parameters.
688
+ * @param {string} name
689
+ * @param {string} params_json
690
+ * @returns {any}
691
+ */
692
+ call_tool(name, params_json) {
693
+ try {
694
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
695
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
696
+ const len0 = WASM_VECTOR_LEN;
697
+ const ptr1 = passStringToWasm0(params_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
698
+ const len1 = WASM_VECTOR_LEN;
699
+ wasm.wasmmcpserver_call_tool(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
700
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
701
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
702
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
703
+ if (r2) {
704
+ throw takeObject(r1);
705
+ }
706
+ return takeObject(r0);
707
+ } finally {
708
+ wasm.__wbindgen_add_to_stack_pointer(16);
709
+ }
710
+ }
711
+ /**
712
+ * Get the gallery instance for direct access.
713
+ * @returns {any}
714
+ */
715
+ gallery() {
716
+ try {
717
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
718
+ wasm.wasmmcpserver_gallery(retptr, this.__wbg_ptr);
719
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
720
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
721
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
722
+ if (r2) {
723
+ throw takeObject(r1);
724
+ }
725
+ return takeObject(r0);
726
+ } finally {
727
+ wasm.__wbindgen_add_to_stack_pointer(16);
728
+ }
729
+ }
730
+ /**
731
+ * Handle a JSON-RPC request and return a JSON-RPC response.
732
+ * @param {string} request_json
733
+ * @returns {any}
734
+ */
735
+ handle_request(request_json) {
736
+ try {
737
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
738
+ const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
739
+ const len0 = WASM_VECTOR_LEN;
740
+ wasm.wasmmcpserver_handle_request(retptr, this.__wbg_ptr, ptr0, len0);
741
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
742
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
743
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
744
+ if (r2) {
745
+ throw takeObject(r1);
746
+ }
747
+ return takeObject(r0);
748
+ } finally {
749
+ wasm.__wbindgen_add_to_stack_pointer(16);
750
+ }
751
+ }
752
+ /**
753
+ * Check if the server has been initialized.
754
+ * @returns {boolean}
755
+ */
756
+ is_initialized() {
757
+ const ret = wasm.wasmmcpserver_is_initialized(this.__wbg_ptr);
758
+ return ret !== 0;
759
+ }
760
+ /**
761
+ * Get the list of available tools as JSON.
762
+ * @returns {any}
763
+ */
764
+ list_tools() {
765
+ try {
766
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
767
+ wasm.wasmmcpserver_list_tools(retptr, this.__wbg_ptr);
768
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
769
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
770
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
771
+ if (r2) {
772
+ throw takeObject(r1);
773
+ }
774
+ return takeObject(r0);
775
+ } finally {
776
+ wasm.__wbindgen_add_to_stack_pointer(16);
777
+ }
778
+ }
779
+ /**
780
+ * Get the server name.
781
+ * @returns {string}
782
+ */
783
+ name() {
784
+ let deferred1_0;
785
+ let deferred1_1;
786
+ try {
787
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
788
+ wasm.wasmmcpserver_name(retptr, this.__wbg_ptr);
789
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
790
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
791
+ deferred1_0 = r0;
792
+ deferred1_1 = r1;
793
+ return getStringFromWasm0(r0, r1);
794
+ } finally {
795
+ wasm.__wbindgen_add_to_stack_pointer(16);
796
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
797
+ }
798
+ }
799
+ /**
800
+ * Create a new WasmMcpServer with the given name.
801
+ * @param {string} name
802
+ */
803
+ constructor(name) {
804
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
805
+ const len0 = WASM_VECTOR_LEN;
806
+ const ret = wasm.wasmmcpserver_new(ptr0, len0);
807
+ this.__wbg_ptr = ret >>> 0;
808
+ WasmMcpServerFinalization.register(this, this.__wbg_ptr, this);
809
+ return this;
810
+ }
811
+ /**
812
+ * Get the server version.
813
+ * @returns {string}
814
+ */
815
+ version() {
816
+ let deferred1_0;
817
+ let deferred1_1;
818
+ try {
819
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
820
+ wasm.wasmmcpserver_version(retptr, this.__wbg_ptr);
821
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
822
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
823
+ deferred1_0 = r0;
824
+ deferred1_1 = r1;
825
+ return getStringFromWasm0(r0, r1);
826
+ } finally {
827
+ wasm.__wbindgen_add_to_stack_pointer(16);
828
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
829
+ }
830
+ }
831
+ }
832
+ if (Symbol.dispose) WasmMcpServer.prototype[Symbol.dispose] = WasmMcpServer.prototype.free;
833
+
834
+ /**
835
+ * RVF Container Builder for WASM.
836
+ *
837
+ * Build RVF cognitive containers that package tools, prompts, skills,
838
+ * orchestrator configs, MCP tools, and Ruvix capabilities.
839
+ *
840
+ * # Example (JavaScript)
841
+ * ```js
842
+ * const builder = new WasmRvfBuilder();
843
+ * builder.addTool({ name: "search", description: "Web search", parameters: {} });
844
+ * builder.addPrompt({ name: "coder", system_prompt: "You are a coder", version: "1.0" });
845
+ * const container = builder.build();
846
+ * // container is Uint8Array with RVF magic bytes
847
+ * ```
848
+ */
849
+ export class WasmRvfBuilder {
850
+ __destroy_into_raw() {
851
+ const ptr = this.__wbg_ptr;
852
+ this.__wbg_ptr = 0;
853
+ WasmRvfBuilderFinalization.unregister(this);
854
+ return ptr;
855
+ }
856
+ free() {
857
+ const ptr = this.__destroy_into_raw();
858
+ wasm.__wbg_wasmrvfbuilder_free(ptr, 0);
859
+ }
860
+ /**
861
+ * Add Ruvix capability definitions.
862
+ * @param {string} caps_json
863
+ */
864
+ addCapabilities(caps_json) {
865
+ try {
866
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
867
+ const ptr0 = passStringToWasm0(caps_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
868
+ const len0 = WASM_VECTOR_LEN;
869
+ wasm.wasmrvfbuilder_addCapabilities(retptr, this.__wbg_ptr, ptr0, len0);
870
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
871
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
872
+ if (r1) {
873
+ throw takeObject(r0);
874
+ }
875
+ } finally {
876
+ wasm.__wbindgen_add_to_stack_pointer(16);
877
+ }
878
+ }
879
+ /**
880
+ * Add MCP tool entries.
881
+ * @param {string} tools_json
882
+ */
883
+ addMcpTools(tools_json) {
884
+ try {
885
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
886
+ const ptr0 = passStringToWasm0(tools_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
887
+ const len0 = WASM_VECTOR_LEN;
888
+ wasm.wasmrvfbuilder_addMcpTools(retptr, this.__wbg_ptr, ptr0, len0);
889
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
890
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
891
+ if (r1) {
892
+ throw takeObject(r0);
893
+ }
894
+ } finally {
895
+ wasm.__wbindgen_add_to_stack_pointer(16);
896
+ }
897
+ }
898
+ /**
899
+ * Add an agent prompt.
900
+ * @param {string} prompt_json
901
+ */
902
+ addPrompt(prompt_json) {
903
+ try {
904
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
905
+ const ptr0 = passStringToWasm0(prompt_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
906
+ const len0 = WASM_VECTOR_LEN;
907
+ wasm.wasmrvfbuilder_addPrompt(retptr, this.__wbg_ptr, ptr0, len0);
908
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
909
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
910
+ if (r1) {
911
+ throw takeObject(r0);
912
+ }
913
+ } finally {
914
+ wasm.__wbindgen_add_to_stack_pointer(16);
915
+ }
916
+ }
917
+ /**
918
+ * Add multiple prompts from JSON array.
919
+ * @param {string} prompts_json
920
+ */
921
+ addPrompts(prompts_json) {
922
+ try {
923
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
924
+ const ptr0 = passStringToWasm0(prompts_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
925
+ const len0 = WASM_VECTOR_LEN;
926
+ wasm.wasmrvfbuilder_addPrompts(retptr, this.__wbg_ptr, ptr0, len0);
927
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
928
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
929
+ if (r1) {
930
+ throw takeObject(r0);
931
+ }
932
+ } finally {
933
+ wasm.__wbindgen_add_to_stack_pointer(16);
934
+ }
935
+ }
936
+ /**
937
+ * Add a skill definition.
938
+ * @param {string} skill_json
939
+ */
940
+ addSkill(skill_json) {
941
+ try {
942
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
943
+ const ptr0 = passStringToWasm0(skill_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
944
+ const len0 = WASM_VECTOR_LEN;
945
+ wasm.wasmrvfbuilder_addSkill(retptr, this.__wbg_ptr, ptr0, len0);
946
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
947
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
948
+ if (r1) {
949
+ throw takeObject(r0);
950
+ }
951
+ } finally {
952
+ wasm.__wbindgen_add_to_stack_pointer(16);
953
+ }
954
+ }
955
+ /**
956
+ * Add multiple skills from JSON array.
957
+ * @param {string} skills_json
958
+ */
959
+ addSkills(skills_json) {
960
+ try {
961
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
962
+ const ptr0 = passStringToWasm0(skills_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
963
+ const len0 = WASM_VECTOR_LEN;
964
+ wasm.wasmrvfbuilder_addSkills(retptr, this.__wbg_ptr, ptr0, len0);
965
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
966
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
967
+ if (r1) {
968
+ throw takeObject(r0);
969
+ }
970
+ } finally {
971
+ wasm.__wbindgen_add_to_stack_pointer(16);
972
+ }
973
+ }
974
+ /**
975
+ * Add a tool definition.
976
+ * @param {string} tool_json
977
+ */
978
+ addTool(tool_json) {
979
+ try {
980
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
981
+ const ptr0 = passStringToWasm0(tool_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
982
+ const len0 = WASM_VECTOR_LEN;
983
+ wasm.wasmrvfbuilder_addTool(retptr, this.__wbg_ptr, ptr0, len0);
984
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
985
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
986
+ if (r1) {
987
+ throw takeObject(r0);
988
+ }
989
+ } finally {
990
+ wasm.__wbindgen_add_to_stack_pointer(16);
991
+ }
992
+ }
993
+ /**
994
+ * Add multiple tools from JSON array.
995
+ * @param {string} tools_json
996
+ */
997
+ addTools(tools_json) {
998
+ try {
999
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1000
+ const ptr0 = passStringToWasm0(tools_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1001
+ const len0 = WASM_VECTOR_LEN;
1002
+ wasm.wasmrvfbuilder_addTools(retptr, this.__wbg_ptr, ptr0, len0);
1003
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1004
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1005
+ if (r1) {
1006
+ throw takeObject(r0);
1007
+ }
1008
+ } finally {
1009
+ wasm.__wbindgen_add_to_stack_pointer(16);
1010
+ }
1011
+ }
1012
+ /**
1013
+ * Build the RVF container as bytes.
1014
+ *
1015
+ * Returns a Uint8Array containing the RVF binary:
1016
+ * - Magic bytes: "RVF\x01" (4 bytes)
1017
+ * - Segment count: u32 LE (4 bytes)
1018
+ * - Segments: type(1) + tag(2) + len(4) + data
1019
+ * - Checksum: SHA3-256 (32 bytes)
1020
+ * @returns {Uint8Array}
1021
+ */
1022
+ build() {
1023
+ try {
1024
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1025
+ wasm.wasmrvfbuilder_build(retptr, this.__wbg_ptr);
1026
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1027
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1028
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1029
+ if (r2) {
1030
+ throw takeObject(r1);
1031
+ }
1032
+ return takeObject(r0);
1033
+ } finally {
1034
+ wasm.__wbindgen_add_to_stack_pointer(16);
1035
+ }
1036
+ }
1037
+ /**
1038
+ * Get the RVF magic bytes for detection.
1039
+ * @returns {Uint8Array}
1040
+ */
1041
+ static getMagic() {
1042
+ const ret = wasm.wasmrvfbuilder_getMagic();
1043
+ return takeObject(ret);
1044
+ }
1045
+ /**
1046
+ * Create a new RVF container builder.
1047
+ */
1048
+ constructor() {
1049
+ const ret = wasm.wasmrvfbuilder_new();
1050
+ this.__wbg_ptr = ret >>> 0;
1051
+ WasmRvfBuilderFinalization.register(this, this.__wbg_ptr, this);
1052
+ return this;
1053
+ }
1054
+ /**
1055
+ * Parse an RVF container from bytes.
1056
+ * @param {Uint8Array} data
1057
+ * @returns {any}
1058
+ */
1059
+ static parse(data) {
1060
+ try {
1061
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1062
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
1063
+ const len0 = WASM_VECTOR_LEN;
1064
+ wasm.wasmrvfbuilder_parse(retptr, ptr0, len0);
1065
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1066
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1067
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1068
+ if (r2) {
1069
+ throw takeObject(r1);
1070
+ }
1071
+ return takeObject(r0);
1072
+ } finally {
1073
+ wasm.__wbindgen_add_to_stack_pointer(16);
1074
+ }
1075
+ }
1076
+ /**
1077
+ * Set orchestrator configuration.
1078
+ * @param {string} config_json
1079
+ */
1080
+ setOrchestrator(config_json) {
1081
+ try {
1082
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1083
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1084
+ const len0 = WASM_VECTOR_LEN;
1085
+ wasm.wasmrvfbuilder_setOrchestrator(retptr, this.__wbg_ptr, ptr0, len0);
1086
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1087
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1088
+ if (r1) {
1089
+ throw takeObject(r0);
1090
+ }
1091
+ } finally {
1092
+ wasm.__wbindgen_add_to_stack_pointer(16);
1093
+ }
1094
+ }
1095
+ /**
1096
+ * Validate an RVF container (check magic and checksum).
1097
+ * @param {Uint8Array} data
1098
+ * @returns {boolean}
1099
+ */
1100
+ static validate(data) {
1101
+ try {
1102
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1103
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
1104
+ const len0 = WASM_VECTOR_LEN;
1105
+ wasm.wasmrvfbuilder_validate(retptr, ptr0, len0);
1106
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1107
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1108
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1109
+ if (r2) {
1110
+ throw takeObject(r1);
1111
+ }
1112
+ return r0 !== 0;
1113
+ } finally {
1114
+ wasm.__wbindgen_add_to_stack_pointer(16);
1115
+ }
1116
+ }
1117
+ }
1118
+ if (Symbol.dispose) WasmRvfBuilder.prototype[Symbol.dispose] = WasmRvfBuilder.prototype.free;
1119
+
1120
+ function __wbg_get_imports() {
1121
+ const import0 = {
1122
+ __proto__: null,
1123
+ __wbg___wbindgen_is_function_d633e708baf0d146: function(arg0) {
1124
+ const ret = typeof(getObject(arg0)) === 'function';
1125
+ return ret;
1126
+ },
1127
+ __wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
1128
+ const ret = getObject(arg0) === undefined;
1129
+ return ret;
1130
+ },
1131
+ __wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
1132
+ const obj = getObject(arg1);
1133
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1134
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1135
+ var len1 = WASM_VECTOR_LEN;
1136
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1137
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1138
+ },
1139
+ __wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
1140
+ throw new Error(getStringFromWasm0(arg0, arg1));
1141
+ },
1142
+ __wbg__wbg_cb_unref_b6d832240a919168: function(arg0) {
1143
+ getObject(arg0)._wbg_cb_unref();
1144
+ },
1145
+ __wbg_call_08ad0d89caa7cb79: function() { return handleError(function (arg0, arg1, arg2) {
1146
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1147
+ return addHeapObject(ret);
1148
+ }, arguments); },
1149
+ __wbg_instanceof_Promise_44e4f673e91c710d: function(arg0) {
1150
+ let result;
1151
+ try {
1152
+ result = getObject(arg0) instanceof Promise;
1153
+ } catch (_) {
1154
+ result = false;
1155
+ }
1156
+ const ret = result;
1157
+ return ret;
1158
+ },
1159
+ __wbg_new_from_slice_d7e202fdbee3c396: function(arg0, arg1) {
1160
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1161
+ return addHeapObject(ret);
1162
+ },
1163
+ __wbg_new_typed_8258a0d8488ef2a2: function(arg0, arg1) {
1164
+ try {
1165
+ var state0 = {a: arg0, b: arg1};
1166
+ var cb0 = (arg0, arg1) => {
1167
+ const a = state0.a;
1168
+ state0.a = 0;
1169
+ try {
1170
+ return __wasm_bindgen_func_elem_535(a, state0.b, arg0, arg1);
1171
+ } finally {
1172
+ state0.a = a;
1173
+ }
1174
+ };
1175
+ const ret = new Promise(cb0);
1176
+ return addHeapObject(ret);
1177
+ } finally {
1178
+ state0.a = state0.b = 0;
1179
+ }
1180
+ },
1181
+ __wbg_parse_6dfe891b5bafb5cd: function() { return handleError(function (arg0, arg1) {
1182
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
1183
+ return addHeapObject(ret);
1184
+ }, arguments); },
1185
+ __wbg_queueMicrotask_2c8dfd1056f24fdc: function(arg0) {
1186
+ const ret = getObject(arg0).queueMicrotask;
1187
+ return addHeapObject(ret);
1188
+ },
1189
+ __wbg_queueMicrotask_8985ad63815852e7: function(arg0) {
1190
+ queueMicrotask(getObject(arg0));
1191
+ },
1192
+ __wbg_resolve_5d61e0d10c14730a: function(arg0) {
1193
+ const ret = Promise.resolve(getObject(arg0));
1194
+ return addHeapObject(ret);
1195
+ },
1196
+ __wbg_static_accessor_GLOBAL_THIS_14325d8cca34bb77: function() {
1197
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1198
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1199
+ },
1200
+ __wbg_static_accessor_GLOBAL_f3a1e69f9c5a7e8e: function() {
1201
+ const ret = typeof global === 'undefined' ? null : global;
1202
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1203
+ },
1204
+ __wbg_static_accessor_SELF_50cdb5b517789aca: function() {
1205
+ const ret = typeof self === 'undefined' ? null : self;
1206
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1207
+ },
1208
+ __wbg_static_accessor_WINDOW_d6c4126e4c244380: function() {
1209
+ const ret = typeof window === 'undefined' ? null : window;
1210
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1211
+ },
1212
+ __wbg_then_d4163530723f56f4: function(arg0, arg1, arg2) {
1213
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1214
+ return addHeapObject(ret);
1215
+ },
1216
+ __wbg_then_f1c954fe00733701: function(arg0, arg1) {
1217
+ const ret = getObject(arg0).then(getObject(arg1));
1218
+ return addHeapObject(ret);
1219
+ },
1220
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1221
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 64, function: Function { arguments: [Externref], shim_idx: 65, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1222
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_497, __wasm_bindgen_func_elem_498);
1223
+ return addHeapObject(ret);
1224
+ },
1225
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1226
+ // Cast intrinsic for `Ref(String) -> Externref`.
1227
+ const ret = getStringFromWasm0(arg0, arg1);
1228
+ return addHeapObject(ret);
1229
+ },
1230
+ __wbindgen_object_clone_ref: function(arg0) {
1231
+ const ret = getObject(arg0);
1232
+ return addHeapObject(ret);
1233
+ },
1234
+ __wbindgen_object_drop_ref: function(arg0) {
1235
+ takeObject(arg0);
1236
+ },
1237
+ };
1238
+ return {
1239
+ __proto__: null,
1240
+ "./rvagent_wasm_bg.js": import0,
1241
+ };
1242
+ }
1243
+
1244
+ function __wasm_bindgen_func_elem_498(arg0, arg1, arg2) {
1245
+ try {
1246
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1247
+ wasm.__wasm_bindgen_func_elem_498(retptr, arg0, arg1, addHeapObject(arg2));
1248
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1249
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1250
+ if (r1) {
1251
+ throw takeObject(r0);
1252
+ }
1253
+ } finally {
1254
+ wasm.__wbindgen_add_to_stack_pointer(16);
1255
+ }
1256
+ }
1257
+
1258
+ function __wasm_bindgen_func_elem_535(arg0, arg1, arg2, arg3) {
1259
+ wasm.__wasm_bindgen_func_elem_535(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1260
+ }
1261
+
1262
+ const JsModelProviderFinalization = (typeof FinalizationRegistry === 'undefined')
1263
+ ? { register: () => {}, unregister: () => {} }
1264
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsmodelprovider_free(ptr >>> 0, 1));
1265
+ const WasmAgentFinalization = (typeof FinalizationRegistry === 'undefined')
1266
+ ? { register: () => {}, unregister: () => {} }
1267
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmagent_free(ptr >>> 0, 1));
1268
+ const WasmGalleryFinalization = (typeof FinalizationRegistry === 'undefined')
1269
+ ? { register: () => {}, unregister: () => {} }
1270
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmgallery_free(ptr >>> 0, 1));
1271
+ const WasmMcpServerFinalization = (typeof FinalizationRegistry === 'undefined')
1272
+ ? { register: () => {}, unregister: () => {} }
1273
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmmcpserver_free(ptr >>> 0, 1));
1274
+ const WasmRvfBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
1275
+ ? { register: () => {}, unregister: () => {} }
1276
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmrvfbuilder_free(ptr >>> 0, 1));
1277
+
1278
+ function addHeapObject(obj) {
1279
+ if (heap_next === heap.length) heap.push(heap.length + 1);
1280
+ const idx = heap_next;
1281
+ heap_next = heap[idx];
1282
+
1283
+ heap[idx] = obj;
1284
+ return idx;
1285
+ }
1286
+
1287
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1288
+ ? { register: () => {}, unregister: () => {} }
1289
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
1290
+
1291
+ function dropObject(idx) {
1292
+ if (idx < 1028) return;
1293
+ heap[idx] = heap_next;
1294
+ heap_next = idx;
1295
+ }
1296
+
1297
+ function getArrayU8FromWasm0(ptr, len) {
1298
+ ptr = ptr >>> 0;
1299
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1300
+ }
1301
+
1302
+ let cachedDataViewMemory0 = null;
1303
+ function getDataViewMemory0() {
1304
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1305
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1306
+ }
1307
+ return cachedDataViewMemory0;
1308
+ }
1309
+
1310
+ function getStringFromWasm0(ptr, len) {
1311
+ ptr = ptr >>> 0;
1312
+ return decodeText(ptr, len);
1313
+ }
1314
+
1315
+ let cachedUint8ArrayMemory0 = null;
1316
+ function getUint8ArrayMemory0() {
1317
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1318
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1319
+ }
1320
+ return cachedUint8ArrayMemory0;
1321
+ }
1322
+
1323
+ function getObject(idx) { return heap[idx]; }
1324
+
1325
+ function handleError(f, args) {
1326
+ try {
1327
+ return f.apply(this, args);
1328
+ } catch (e) {
1329
+ wasm.__wbindgen_export3(addHeapObject(e));
1330
+ }
1331
+ }
1332
+
1333
+ let heap = new Array(1024).fill(undefined);
1334
+ heap.push(undefined, null, true, false);
1335
+
1336
+ let heap_next = heap.length;
1337
+
1338
+ function isLikeNone(x) {
1339
+ return x === undefined || x === null;
1340
+ }
1341
+
1342
+ function makeMutClosure(arg0, arg1, dtor, f) {
1343
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
1344
+ const real = (...args) => {
1345
+
1346
+ // First up with a closure we increment the internal reference
1347
+ // count. This ensures that the Rust closure environment won't
1348
+ // be deallocated while we're invoking it.
1349
+ state.cnt++;
1350
+ const a = state.a;
1351
+ state.a = 0;
1352
+ try {
1353
+ return f(a, state.b, ...args);
1354
+ } finally {
1355
+ state.a = a;
1356
+ real._wbg_cb_unref();
1357
+ }
1358
+ };
1359
+ real._wbg_cb_unref = () => {
1360
+ if (--state.cnt === 0) {
1361
+ state.dtor(state.a, state.b);
1362
+ state.a = 0;
1363
+ CLOSURE_DTORS.unregister(state);
1364
+ }
1365
+ };
1366
+ CLOSURE_DTORS.register(real, state, state);
1367
+ return real;
1368
+ }
1369
+
1370
+ function passArray8ToWasm0(arg, malloc) {
1371
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1372
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1373
+ WASM_VECTOR_LEN = arg.length;
1374
+ return ptr;
1375
+ }
1376
+
1377
+ function passStringToWasm0(arg, malloc, realloc) {
1378
+ if (realloc === undefined) {
1379
+ const buf = cachedTextEncoder.encode(arg);
1380
+ const ptr = malloc(buf.length, 1) >>> 0;
1381
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1382
+ WASM_VECTOR_LEN = buf.length;
1383
+ return ptr;
1384
+ }
1385
+
1386
+ let len = arg.length;
1387
+ let ptr = malloc(len, 1) >>> 0;
1388
+
1389
+ const mem = getUint8ArrayMemory0();
1390
+
1391
+ let offset = 0;
1392
+
1393
+ for (; offset < len; offset++) {
1394
+ const code = arg.charCodeAt(offset);
1395
+ if (code > 0x7F) break;
1396
+ mem[ptr + offset] = code;
1397
+ }
1398
+ if (offset !== len) {
1399
+ if (offset !== 0) {
1400
+ arg = arg.slice(offset);
1401
+ }
1402
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1403
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1404
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1405
+
1406
+ offset += ret.written;
1407
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1408
+ }
1409
+
1410
+ WASM_VECTOR_LEN = offset;
1411
+ return ptr;
1412
+ }
1413
+
1414
+ function takeObject(idx) {
1415
+ const ret = getObject(idx);
1416
+ dropObject(idx);
1417
+ return ret;
1418
+ }
1419
+
1420
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1421
+ cachedTextDecoder.decode();
1422
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1423
+ let numBytesDecoded = 0;
1424
+ function decodeText(ptr, len) {
1425
+ numBytesDecoded += len;
1426
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1427
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1428
+ cachedTextDecoder.decode();
1429
+ numBytesDecoded = len;
1430
+ }
1431
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1432
+ }
1433
+
1434
+ const cachedTextEncoder = new TextEncoder();
1435
+
1436
+ if (!('encodeInto' in cachedTextEncoder)) {
1437
+ cachedTextEncoder.encodeInto = function (arg, view) {
1438
+ const buf = cachedTextEncoder.encode(arg);
1439
+ view.set(buf);
1440
+ return {
1441
+ read: arg.length,
1442
+ written: buf.length
1443
+ };
1444
+ };
1445
+ }
1446
+
1447
+ let WASM_VECTOR_LEN = 0;
1448
+
1449
+ let wasmModule, wasm;
1450
+ function __wbg_finalize_init(instance, module) {
1451
+ wasm = instance.exports;
1452
+ wasmModule = module;
1453
+ cachedDataViewMemory0 = null;
1454
+ cachedUint8ArrayMemory0 = null;
1455
+ return wasm;
1456
+ }
1457
+
1458
+ async function __wbg_load(module, imports) {
1459
+ if (typeof Response === 'function' && module instanceof Response) {
1460
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1461
+ try {
1462
+ return await WebAssembly.instantiateStreaming(module, imports);
1463
+ } catch (e) {
1464
+ const validResponse = module.ok && expectedResponseType(module.type);
1465
+
1466
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1467
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1468
+
1469
+ } else { throw e; }
1470
+ }
1471
+ }
1472
+
1473
+ const bytes = await module.arrayBuffer();
1474
+ return await WebAssembly.instantiate(bytes, imports);
1475
+ } else {
1476
+ const instance = await WebAssembly.instantiate(module, imports);
1477
+
1478
+ if (instance instanceof WebAssembly.Instance) {
1479
+ return { instance, module };
1480
+ } else {
1481
+ return instance;
1482
+ }
1483
+ }
1484
+
1485
+ function expectedResponseType(type) {
1486
+ switch (type) {
1487
+ case 'basic': case 'cors': case 'default': return true;
1488
+ }
1489
+ return false;
1490
+ }
1491
+ }
1492
+
1493
+ function initSync(module) {
1494
+ if (wasm !== undefined) return wasm;
1495
+
1496
+
1497
+ if (module !== undefined) {
1498
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1499
+ ({module} = module)
1500
+ } else {
1501
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1502
+ }
1503
+ }
1504
+
1505
+ const imports = __wbg_get_imports();
1506
+ if (!(module instanceof WebAssembly.Module)) {
1507
+ module = new WebAssembly.Module(module);
1508
+ }
1509
+ const instance = new WebAssembly.Instance(module, imports);
1510
+ return __wbg_finalize_init(instance, module);
1511
+ }
1512
+
1513
+ async function __wbg_init(module_or_path) {
1514
+ if (wasm !== undefined) return wasm;
1515
+
1516
+
1517
+ if (module_or_path !== undefined) {
1518
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1519
+ ({module_or_path} = module_or_path)
1520
+ } else {
1521
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1522
+ }
1523
+ }
1524
+
1525
+ if (module_or_path === undefined) {
1526
+ module_or_path = new URL('rvagent_wasm_bg.wasm', import.meta.url);
1527
+ }
1528
+ const imports = __wbg_get_imports();
1529
+
1530
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1531
+ module_or_path = fetch(module_or_path);
1532
+ }
1533
+
1534
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1535
+
1536
+ return __wbg_finalize_init(instance, module);
1537
+ }
1538
+
1539
+ export { initSync, __wbg_init as default };