ruflo 3.6.11 → 3.6.13

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 (29) hide show
  1. package/package.json +4 -1
  2. package/src/ruvocal/.claude-flow/data/pending-insights.jsonl +25 -0
  3. package/src/ruvocal/.claude-flow/neural/stats.json +6 -0
  4. package/src/ruvocal/.dockerignore +5 -1
  5. package/src/ruvocal/.gcloudignore +18 -0
  6. package/src/ruvocal/README.md +107 -133
  7. package/src/ruvocal/cloudbuild.yaml +68 -0
  8. package/src/ruvocal/config/branding.env.example +19 -0
  9. package/src/ruvocal/mcp-bridge/index.js +15 -1
  10. package/src/ruvocal/src/lib/components/FoundationBackground.svelte +242 -0
  11. package/src/ruvocal/src/lib/components/NavMenu.svelte +18 -0
  12. package/src/ruvocal/src/lib/components/RufloHelpModal.svelte +411 -0
  13. package/src/ruvocal/src/lib/components/chat/ChatWindow.svelte +122 -4
  14. package/src/ruvocal/src/lib/components/wasm/GalleryPanel.svelte +357 -0
  15. package/src/ruvocal/src/lib/constants/mcpExamples.ts +56 -77
  16. package/src/ruvocal/src/lib/constants/routerExamples.ts +51 -127
  17. package/src/ruvocal/src/lib/constants/rvagentPresets.ts +206 -0
  18. package/src/ruvocal/src/lib/server/textGeneration/mcp/wasmTools.test.ts +633 -0
  19. package/src/ruvocal/src/lib/stores/mcpServers.ts +195 -6
  20. package/src/ruvocal/src/lib/stores/wasmMcp.ts +472 -0
  21. package/src/ruvocal/src/lib/types/Settings.ts +7 -0
  22. package/src/ruvocal/src/lib/types/Tool.ts +4 -1
  23. package/src/ruvocal/src/lib/wasm/idb.ts +438 -0
  24. package/src/ruvocal/src/lib/wasm/index.ts +1213 -0
  25. package/src/ruvocal/src/lib/wasm/tests/wasm-capabilities.test.ts +565 -0
  26. package/src/ruvocal/src/lib/wasm/wasm.worker.ts +332 -0
  27. package/src/ruvocal/src/lib/wasm/workerClient.ts +166 -0
  28. package/src/ruvocal/static/wasm/rvagent_wasm.js +1539 -0
  29. package/src/ruvocal/static/wasm/rvagent_wasm_bg.wasm +0 -0
@@ -0,0 +1,357 @@
1
+ <script lang="ts">
2
+ import { onMount } from "svelte";
3
+ import {
4
+ allMcpServers,
5
+ selectedServerIds,
6
+ healthCheckServer,
7
+ loadWasmTemplate,
8
+ getWasmGalleryTemplates,
9
+ WASM_SERVER_ID,
10
+ } from "$lib/stores/mcpServers";
11
+ import {
12
+ wasmLoaded,
13
+ wasmLoading,
14
+ wasmError,
15
+ initWasmMcp,
16
+ searchGalleryTemplates,
17
+ getGalleryCategories,
18
+ saveTemplateAsRvf,
19
+ } from "$lib/stores/wasmMcp";
20
+ import type { GalleryTemplate, SearchResult } from "$lib/wasm";
21
+ import IconSearch from "~icons/carbon/Search";
22
+ import IconDownload from "~icons/carbon/Download";
23
+ import IconCheckmark from "~icons/carbon/Checkmark";
24
+ import IconCode from "~icons/carbon/Code";
25
+ import IconSearch16 from "~icons/carbon/Search";
26
+ import IconFolder from "~icons/carbon/Folder";
27
+
28
+ let searchQuery = $state("");
29
+ let selectedCategory = $state<string | null>(null);
30
+ let templates = $state<GalleryTemplate[]>([]);
31
+ let searchResults = $state<SearchResult[]>([]);
32
+ let categories = $state<Record<string, number>>({});
33
+ let loading = $state(false);
34
+
35
+ // Get WASM server from MCP servers
36
+ const wasmServer = $derived($allMcpServers.find((s) => s.id === WASM_SERVER_ID));
37
+ const isWasmEnabled = $derived($selectedServerIds.has(WASM_SERVER_ID));
38
+ const activeTemplateId = $derived(wasmServer?.wasmTemplateId);
39
+ const activeTemplateName = $derived(wasmServer?.wasmTemplateName);
40
+
41
+ // Category icons mapping
42
+ const categoryIcons: Record<string, typeof IconCode> = {
43
+ development: IconCode,
44
+ research: IconSearch16,
45
+ custom: IconFolder,
46
+ };
47
+
48
+ // Category colors
49
+ const categoryColors: Record<string, string> = {
50
+ development: "bg-blue-500",
51
+ research: "bg-purple-500",
52
+ testing: "bg-green-500",
53
+ security: "bg-red-500",
54
+ orchestration: "bg-yellow-500",
55
+ documentation: "bg-cyan-500",
56
+ devops: "bg-orange-500",
57
+ custom: "bg-gray-500",
58
+ };
59
+
60
+ function getCategoryIcon(category: string) {
61
+ return categoryIcons[category.toLowerCase()] || IconFolder;
62
+ }
63
+
64
+ function getCategoryColor(category: string) {
65
+ return categoryColors[category.toLowerCase()] || "bg-gray-500";
66
+ }
67
+
68
+ async function loadTemplates() {
69
+ if (!$wasmLoaded) return;
70
+ templates = getWasmGalleryTemplates();
71
+ categories = getGalleryCategories();
72
+ }
73
+
74
+ function handleSearch() {
75
+ if (!searchQuery.trim()) {
76
+ searchResults = [];
77
+ return;
78
+ }
79
+ searchResults = searchGalleryTemplates(searchQuery);
80
+ }
81
+
82
+ async function handleLoadTemplate(id: string) {
83
+ loading = true;
84
+ const success = await loadWasmTemplate(id);
85
+ if (success) {
86
+ loadTemplates();
87
+ }
88
+ loading = false;
89
+ }
90
+
91
+ async function handleSaveRvf(id: string) {
92
+ loading = true;
93
+ const containerId = await saveTemplateAsRvf(id);
94
+ if (containerId) {
95
+ alert(`RVF container saved with ID: ${containerId}`);
96
+ }
97
+ loading = false;
98
+ }
99
+
100
+ async function handleHealthCheck() {
101
+ if (wasmServer) {
102
+ await healthCheckServer(wasmServer);
103
+ }
104
+ }
105
+
106
+ function getFilteredTemplates(): GalleryTemplate[] {
107
+ if (searchQuery.trim()) {
108
+ const ids = new Set(searchResults.map((r) => r.id));
109
+ return templates.filter((t) => ids.has(t.id));
110
+ }
111
+ const category = selectedCategory;
112
+ if (category) {
113
+ return templates.filter((t) => t.category.toLowerCase() === category.toLowerCase());
114
+ }
115
+ return templates;
116
+ }
117
+
118
+ onMount(async () => {
119
+ if (!$wasmLoaded) {
120
+ await initWasmMcp();
121
+ }
122
+ loadTemplates();
123
+ });
124
+
125
+ $effect(() => {
126
+ if ($wasmLoaded) {
127
+ loadTemplates();
128
+ }
129
+ });
130
+
131
+ $effect(() => {
132
+ handleSearch();
133
+ });
134
+ </script>
135
+
136
+ <div class="flex flex-col h-full bg-gray-50 dark:bg-gray-900">
137
+ <!-- Header -->
138
+ <div class="p-4 border-b border-gray-200 dark:border-gray-700">
139
+ <div class="flex items-center justify-between mb-3">
140
+ <h2 class="text-lg font-semibold text-gray-900 dark:text-white">RVF Agent Gallery</h2>
141
+ {#if wasmServer}
142
+ <div class="flex items-center gap-2">
143
+ <span
144
+ class="inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium
145
+ {wasmServer.status === 'connected'
146
+ ? 'bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200'
147
+ : wasmServer.status === 'connecting'
148
+ ? 'bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200'
149
+ : wasmServer.status === 'error'
150
+ ? 'bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200'
151
+ : 'bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200'}"
152
+ >
153
+ {wasmServer.status === "connected" ? "WASM Ready" : wasmServer.status || "Disconnected"}
154
+ </span>
155
+ <button
156
+ onclick={handleHealthCheck}
157
+ class="text-xs text-blue-500 hover:text-blue-600"
158
+ disabled={loading}
159
+ >
160
+ Refresh
161
+ </button>
162
+ </div>
163
+ {/if}
164
+ </div>
165
+
166
+ {#if $wasmLoading}
167
+ <div class="flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400">
168
+ <div
169
+ class="w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"
170
+ ></div>
171
+ Loading WASM module...
172
+ </div>
173
+ {:else if $wasmError}
174
+ <div class="text-sm text-red-500 dark:text-red-400">
175
+ Error: {$wasmError}
176
+ </div>
177
+ {:else if $wasmLoaded}
178
+ <!-- Search -->
179
+ <div class="relative">
180
+ <IconSearch
181
+ class="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"
182
+ />
183
+ <input
184
+ type="text"
185
+ placeholder="Search templates..."
186
+ bind:value={searchQuery}
187
+ class="w-full pl-10 pr-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
188
+ bg-white dark:bg-gray-800 text-gray-900 dark:text-white
189
+ focus:ring-2 focus:ring-blue-500 focus:border-transparent"
190
+ />
191
+ </div>
192
+
193
+ <!-- Active Template Badge -->
194
+ {#if activeTemplateId}
195
+ <div class="mt-3 flex items-center gap-2">
196
+ <span class="text-xs text-gray-500 dark:text-gray-400">Active:</span>
197
+ <span
198
+ class="inline-flex items-center gap-1 px-2 py-1 rounded-full bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200 text-xs font-medium"
199
+ >
200
+ <IconCheckmark class="w-3 h-3" />
201
+ {activeTemplateName}
202
+ </span>
203
+ {#if wasmServer?.tools?.length}
204
+ <span class="text-xs text-gray-400">
205
+ ({wasmServer.tools.length} tools)
206
+ </span>
207
+ {/if}
208
+ </div>
209
+ {/if}
210
+ {/if}
211
+ </div>
212
+
213
+ {#if $wasmLoaded}
214
+ <!-- Categories -->
215
+ <div class="p-4 border-b border-gray-200 dark:border-gray-700">
216
+ <div class="flex flex-wrap gap-2">
217
+ <button
218
+ class="px-3 py-1.5 rounded-full text-xs font-medium transition-colors
219
+ {selectedCategory === null
220
+ ? 'bg-blue-500 text-white'
221
+ : 'bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600'}"
222
+ onclick={() => (selectedCategory = null)}
223
+ >
224
+ All ({templates.length})
225
+ </button>
226
+ {#each Object.entries(categories) as [category, count]}
227
+ <button
228
+ class="px-3 py-1.5 rounded-full text-xs font-medium transition-colors
229
+ {selectedCategory === category
230
+ ? 'bg-blue-500 text-white'
231
+ : 'bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600'}"
232
+ onclick={() => (selectedCategory = category)}
233
+ >
234
+ {category} ({count})
235
+ </button>
236
+ {/each}
237
+ </div>
238
+ </div>
239
+
240
+ <!-- Templates List -->
241
+ <div class="flex-1 overflow-y-auto p-4 space-y-3">
242
+ {#each getFilteredTemplates() as template (template.id)}
243
+ {@const CategoryIcon = getCategoryIcon(template.category)}
244
+ <div
245
+ class="p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700
246
+ hover:border-blue-300 dark:hover:border-blue-600 transition-colors"
247
+ >
248
+ <div class="flex items-start gap-3">
249
+ <!-- Category Icon -->
250
+ <div
251
+ class="flex-shrink-0 w-10 h-10 rounded-lg {getCategoryColor(
252
+ template.category
253
+ )} flex items-center justify-center"
254
+ >
255
+ <CategoryIcon class="w-5 h-5 text-white" />
256
+ </div>
257
+
258
+ <!-- Content -->
259
+ <div class="flex-1 min-w-0">
260
+ <div class="flex items-center gap-2">
261
+ <h3 class="font-medium text-gray-900 dark:text-white truncate">
262
+ {template.name}
263
+ </h3>
264
+ {#if template.builtin}
265
+ <span
266
+ class="px-1.5 py-0.5 rounded text-xs bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300"
267
+ >
268
+ Built-in
269
+ </span>
270
+ {/if}
271
+ {#if activeTemplateId === template.id}
272
+ <span
273
+ class="px-1.5 py-0.5 rounded text-xs bg-green-100 dark:bg-green-900 text-green-700 dark:text-green-300"
274
+ >
275
+ Active
276
+ </span>
277
+ {/if}
278
+ </div>
279
+ <p class="mt-1 text-sm text-gray-500 dark:text-gray-400 line-clamp-2">
280
+ {template.description}
281
+ </p>
282
+
283
+ <!-- Tags -->
284
+ <div class="mt-2 flex flex-wrap gap-1">
285
+ {#each template.tags.slice(0, 4) as tag}
286
+ <span
287
+ class="px-2 py-0.5 rounded text-xs bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300"
288
+ >
289
+ {tag}
290
+ </span>
291
+ {/each}
292
+ {#if template.tags.length > 4}
293
+ <span class="px-2 py-0.5 text-xs text-gray-400">
294
+ +{template.tags.length - 4} more
295
+ </span>
296
+ {/if}
297
+ </div>
298
+
299
+ <!-- Stats -->
300
+ <div class="mt-2 flex items-center gap-4 text-xs text-gray-400">
301
+ {#if template.tools?.length}
302
+ <span>{template.tools.length} tools</span>
303
+ {/if}
304
+ {#if template.skills?.length}
305
+ <span>{template.skills.length} skills</span>
306
+ {/if}
307
+ {#if template.mcp_tools?.length}
308
+ <span>{template.mcp_tools.length} MCP tools</span>
309
+ {/if}
310
+ {#if template.orchestrator}
311
+ <span>Multi-agent</span>
312
+ {/if}
313
+ </div>
314
+ </div>
315
+
316
+ <!-- Actions -->
317
+ <div class="flex-shrink-0 flex flex-col gap-2">
318
+ <button
319
+ onclick={() => handleLoadTemplate(template.id)}
320
+ disabled={loading || activeTemplateId === template.id}
321
+ class="px-3 py-1.5 rounded text-xs font-medium transition-colors
322
+ {activeTemplateId === template.id
323
+ ? 'bg-green-100 dark:bg-green-900 text-green-700 dark:text-green-300 cursor-default'
324
+ : 'bg-blue-500 hover:bg-blue-600 text-white'}"
325
+ >
326
+ {#if activeTemplateId === template.id}
327
+ <IconCheckmark class="w-3 h-3 inline" />
328
+ Loaded
329
+ {:else}
330
+ Load
331
+ {/if}
332
+ </button>
333
+ <button
334
+ onclick={() => handleSaveRvf(template.id)}
335
+ disabled={loading}
336
+ class="px-3 py-1.5 rounded text-xs font-medium bg-gray-100 dark:bg-gray-700
337
+ text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"
338
+ title="Save as RVF container"
339
+ >
340
+ <IconDownload class="w-3 h-3 inline" />
341
+ RVF
342
+ </button>
343
+ </div>
344
+ </div>
345
+ </div>
346
+ {:else}
347
+ <div class="text-center py-8 text-gray-500 dark:text-gray-400">
348
+ {#if searchQuery}
349
+ No templates match your search.
350
+ {:else}
351
+ No templates available.
352
+ {/if}
353
+ </div>
354
+ {/each}
355
+ </div>
356
+ {/if}
357
+ </div>
@@ -1,134 +1,113 @@
1
1
  import type { RouterExample } from "./routerExamples";
2
2
 
3
- // Examples that showcase MCP tool capabilities (web search, Hugging Face, etc.)
3
+ // Examples that showcase RuFlo MCP capabilities agents, memory,
4
+ // intelligence, dev tools, and the WASM gallery.
4
5
  export const mcpExamples: RouterExample[] = [
5
6
  {
6
- title: "Generate an image",
7
- prompt: "Generate an image of a zebra in front of a volcanic eruption",
8
- },
9
- {
10
- title: "Latest world news",
11
- prompt: "What is the latest world news?",
7
+ title: "Spawn a coding swarm",
8
+ prompt:
9
+ "Spawn a hierarchical swarm with 5 agents (architect, coder, tester, reviewer, security-auditor) to refactor a Python CLI tool to TypeScript. Use ruflo__swarm_init then ruflo__agent_spawn for each role.",
12
10
  followUps: [
13
11
  {
14
- title: "Tech focus",
15
- prompt: "What about technology news?",
16
- },
17
- {
18
- title: "San Francisco",
19
- prompt: "What's happening in San Francisco?",
12
+ title: "Show progress",
13
+ prompt: "Use ruflo__progress_summary to show the swarm's current state.",
20
14
  },
21
15
  {
22
- title: "vs last week",
23
- prompt: "How does this compare to last week's news?",
16
+ title: "Add tests",
17
+ prompt: "Spawn a tester agent to write integration tests for the swarm output.",
24
18
  },
25
19
  ],
26
20
  },
27
21
  {
28
- title: "Trending models",
29
- prompt: "What are the top trending models on Hugging Face?",
22
+ title: "Save & recall memory",
23
+ prompt:
24
+ "Use ruflo__memory_store to save: namespace='preferences', key='editor_theme', value='solarized-dark'. Then ruflo__memory_search query='theme' to verify.",
30
25
  followUps: [
31
26
  {
32
- title: "Text generation",
33
- prompt: "What about text generation models?",
34
- },
35
- {
36
- title: "Image generation",
37
- prompt: "What about text-to-image models?",
27
+ title: "List entries",
28
+ prompt: "List all entries in the 'preferences' namespace using ruflo__memory_list.",
38
29
  },
39
30
  {
40
- title: "How to use",
41
- prompt: "Show me how to use the most popular one",
31
+ title: "Semantic search",
32
+ prompt: "Find related memories with ruvector__hooks_recall query='editor settings'.",
42
33
  },
43
34
  ],
44
35
  },
45
36
  {
46
- title: "Plan a trip",
47
- prompt: "Things to do in Tokyo next week",
37
+ title: "Route a task",
38
+ prompt:
39
+ "Use ruvector__hooks_route on the task: 'add OAuth2 to a SvelteKit API'. Tell me which agent type and topology you'd recommend.",
48
40
  followUps: [
49
41
  {
50
- title: "Transport & prices",
51
- prompt: "How do I get around and how much will it cost?",
42
+ title: "Spawn the agent",
43
+ prompt: "Spawn the recommended agent with ruflo__agent_spawn.",
52
44
  },
53
45
  {
54
- title: "Weather",
55
- prompt: "What's the weather like in Tokyo next week?",
56
- },
57
- {
58
- title: "Meet people",
59
- prompt: "Where can I meet new people and make friends?",
46
+ title: "Track trajectory",
47
+ prompt: "Begin a trajectory with ruvector__hooks_trajectory_begin to record the work.",
60
48
  },
61
49
  ],
62
50
  },
63
51
  {
64
- title: "Compare technologies",
65
- prompt: "Search the web to compare React, Vue, and Svelte for building web apps in 2025",
52
+ title: "Analyze a diff",
53
+ prompt:
54
+ "Use ruflo__analyze_diff to assess risk and ruflo__analyze_diff-reviewers to suggest reviewers for the PR at github.com/ruvnet/ruflo/pull/1687.",
66
55
  followUps: [
67
56
  {
68
- title: "Performance benchmarks",
69
- prompt: "Search for recent performance benchmarks comparing these frameworks",
57
+ title: "Repo metrics",
58
+ prompt: "Get repository metrics with ruflo__github_repo_analyze for ruvnet/ruflo.",
70
59
  },
71
60
  {
72
- title: "Job market",
73
- prompt: "Search for job market trends for each of these frameworks",
74
- },
75
- {
76
- title: "Migration guides",
77
- prompt: "Search for guides on migrating from React to Svelte",
61
+ title: "Open issues",
62
+ prompt: "List recent issues with ruflo__github_issue_track for ruvnet/ruflo.",
78
63
  },
79
64
  ],
80
65
  },
81
66
  {
82
- title: "Find a dataset",
83
- prompt: "Find datasets on Hugging Face for training a sentiment analysis model",
67
+ title: "System health check",
68
+ prompt:
69
+ "Run ruflo__system_status, ruflo__performance_metrics, and ruflo__performance_bottleneck. Summarize anything concerning.",
84
70
  followUps: [
85
71
  {
86
- title: "Dataset details",
87
- prompt: "Tell me more about the largest dataset - its size, format, and how to load it",
88
- },
89
- {
90
- title: "Find models",
91
- prompt: "Find pre-trained models that were trained on this dataset",
72
+ title: "Optimize",
73
+ prompt: "Use ruflo__performance_optimize on the slowest component identified.",
92
74
  },
93
75
  {
94
- title: "Code snippet",
95
- prompt: "Show me how to load and preprocess this dataset with the datasets library",
76
+ title: "Benchmark",
77
+ prompt: "Run ruflo__performance_benchmark with --suite=all.",
96
78
  },
97
79
  ],
98
80
  },
99
81
  {
100
- title: "Gift ideas",
101
- prompt: "Search for unique gift ideas for someone who loves cooking",
82
+ title: "Browse WASM gallery",
83
+ prompt:
84
+ "Show me the templates in the WASM gallery (browser-side rvagent server) and explain what each one does.",
102
85
  followUps: [
103
86
  {
104
- title: "Budget options",
105
- prompt: "Search for gift ideas under $50",
106
- },
107
- {
108
- title: "Top rated",
109
- prompt: "Search for the top-rated cooking gadgets of this year",
110
- },
111
- {
112
- title: "DIY gifts",
113
- prompt: "Search for homemade gift ideas for cooking enthusiasts",
87
+ title: "Load a template",
88
+ prompt: "Load the most popular template into the local WASM MCP server.",
114
89
  },
115
90
  ],
116
91
  },
117
92
  {
118
- title: "Learn something new",
119
- prompt: "Search for the best resources to learn Rust programming in 2025",
93
+ title: "Plan with GOAP",
94
+ prompt:
95
+ "Use the goal-planner pattern: I want to migrate a Postgres schema with zero downtime. Decompose into ruflo agents and tasks.",
120
96
  followUps: [
121
97
  {
122
- title: "Project ideas",
123
- prompt: "Search for beginner Rust project ideas to practice with",
124
- },
125
- {
126
- title: "Find tools",
127
- prompt: "Search for the most popular Rust tools and libraries I should know about",
98
+ title: "Risk analysis",
99
+ prompt: "Run ruflo__analyze_file-risk on the migration file.",
128
100
  },
101
+ ],
102
+ },
103
+ {
104
+ title: "Train neural pattern",
105
+ prompt:
106
+ "Use ruvector__neural_train to learn from this successful pattern: 'JWT auth with refresh tokens — store refresh in httpOnly cookie, access in memory'.",
107
+ followUps: [
129
108
  {
130
- title: "Community",
131
- prompt: "Search for Rust communities and forums where I can ask questions",
109
+ title: "Predict",
110
+ prompt: "Use ruvector__neural_predict for the task 'add session-based auth'.",
132
111
  },
133
112
  ],
134
113
  },