ruvector 0.1.75 → 0.1.76

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.
Binary file
Binary file
Binary file
package/bin/cli.js CHANGED
@@ -2999,14 +2999,58 @@ exec node "$RUVECTOR_CLI" "$@"
2999
2999
 
3000
3000
  // Advanced hooks (unless --minimal)
3001
3001
  if (!opts.minimal) {
3002
- // UserPromptSubmit - context suggestions on each prompt
3002
+ // Create agentic-flow fast wrapper for background workers
3003
+ let workersCmd = 'npx agentic-flow@alpha';
3004
+ if (opts.fast && !isWindows) {
3005
+ const agenticFastPath = path.join(settingsDir, 'agentic-flow-fast.sh');
3006
+ const agenticFastContent = `#!/bin/bash
3007
+ # Fast agentic-flow wrapper - avoids npx overhead
3008
+ # Usage: .claude/agentic-flow-fast.sh workers <command> [args...]
3009
+
3010
+ # Find agentic-flow CLI
3011
+ if [ -f "$PWD/node_modules/agentic-flow/bin/cli.js" ]; then
3012
+ exec node "$PWD/node_modules/agentic-flow/bin/cli.js" "$@"
3013
+ elif [ -f "$PWD/node_modules/.bin/agentic-flow" ]; then
3014
+ exec "$PWD/node_modules/.bin/agentic-flow" "$@"
3015
+ elif command -v agentic-flow &> /dev/null; then
3016
+ exec agentic-flow "$@"
3017
+ else
3018
+ exec npx agentic-flow@alpha "$@"
3019
+ fi
3020
+ `;
3021
+ fs.writeFileSync(agenticFastPath, agenticFastContent);
3022
+ fs.chmodSync(agenticFastPath, '755');
3023
+ workersCmd = '.claude/agentic-flow-fast.sh';
3024
+ // Add permission for agentic-flow fast wrapper
3025
+ if (settings.permissions && settings.permissions.allow) {
3026
+ if (!settings.permissions.allow.includes('Bash(.claude/agentic-flow-fast.sh:*)')) {
3027
+ settings.permissions.allow.push('Bash(.claude/agentic-flow-fast.sh:*)');
3028
+ }
3029
+ }
3030
+ console.log(chalk.blue(' ✓ Background workers wrapper created (.claude/agentic-flow-fast.sh)'));
3031
+ }
3032
+
3033
+ // UserPromptSubmit - context suggestions + background workers dispatch
3003
3034
  settings.hooks.UserPromptSubmit = [{
3004
- hooks: [{
3005
- type: 'command',
3006
- timeout: fastTimeouts.complex,
3007
- command: `${hookCmd} hooks suggest-context 2>/dev/null || true`
3008
- }]
3035
+ hooks: [
3036
+ {
3037
+ type: 'command',
3038
+ timeout: fastTimeouts.complex,
3039
+ command: `${hookCmd} hooks suggest-context 2>/dev/null || true`
3040
+ },
3041
+ {
3042
+ type: 'command',
3043
+ timeout: 2000,
3044
+ command: `${workersCmd} workers dispatch-prompt "$CLAUDE_USER_PROMPT" 2>/dev/null || true`
3045
+ },
3046
+ {
3047
+ type: 'command',
3048
+ timeout: 1000,
3049
+ command: `${workersCmd} workers inject-context "$CLAUDE_USER_PROMPT" 2>/dev/null || true`
3050
+ }
3051
+ ]
3009
3052
  }];
3053
+ console.log(chalk.blue(' ✓ Background workers integration (ultralearn, optimize, audit, map, etc.)'));
3010
3054
 
3011
3055
  // PreCompact - preserve important context before compaction
3012
3056
  settings.hooks.PreCompact = [
@@ -5984,6 +6028,103 @@ ${focus.description}` : null
5984
6028
  console.log(chalk.dim(`\nFocus mode "${opts.focus}": ${focus.description}`));
5985
6029
  });
5986
6030
 
6031
+ // Workers command group - Background analysis via agentic-flow
6032
+ const workersCmd = program.command('workers').description('Background analysis workers (via agentic-flow)');
6033
+
6034
+ // Helper to run agentic-flow workers command
6035
+ async function runAgenticFlow(args) {
6036
+ const { spawn } = require('child_process');
6037
+ return new Promise((resolve, reject) => {
6038
+ const proc = spawn('npx', ['agentic-flow@alpha', ...args], {
6039
+ stdio: 'inherit',
6040
+ shell: true
6041
+ });
6042
+ proc.on('close', code => code === 0 ? resolve() : reject(new Error(`Exit code ${code}`)));
6043
+ proc.on('error', reject);
6044
+ });
6045
+ }
6046
+
6047
+ workersCmd.command('dispatch')
6048
+ .description('Dispatch background worker for analysis')
6049
+ .argument('<prompt...>', 'Prompt with trigger keyword (ultralearn, optimize, audit, map, etc.)')
6050
+ .action(async (prompt) => {
6051
+ try {
6052
+ await runAgenticFlow(['workers', 'dispatch', prompt.join(' ')]);
6053
+ } catch (e) {
6054
+ console.error(chalk.red('Worker dispatch failed:'), e.message);
6055
+ }
6056
+ });
6057
+
6058
+ workersCmd.command('status')
6059
+ .description('Show worker status dashboard')
6060
+ .argument('[workerId]', 'Specific worker ID')
6061
+ .action(async (workerId) => {
6062
+ try {
6063
+ const args = ['workers', 'status'];
6064
+ if (workerId) args.push(workerId);
6065
+ await runAgenticFlow(args);
6066
+ } catch (e) {
6067
+ console.error(chalk.red('Status check failed:'), e.message);
6068
+ }
6069
+ });
6070
+
6071
+ workersCmd.command('results')
6072
+ .description('Show worker analysis results')
6073
+ .option('--json', 'Output as JSON')
6074
+ .action(async (opts) => {
6075
+ try {
6076
+ const args = ['workers', 'results'];
6077
+ if (opts.json) args.push('--json');
6078
+ await runAgenticFlow(args);
6079
+ } catch (e) {
6080
+ console.error(chalk.red('Results fetch failed:'), e.message);
6081
+ }
6082
+ });
6083
+
6084
+ workersCmd.command('triggers')
6085
+ .description('List available trigger keywords')
6086
+ .action(async () => {
6087
+ try {
6088
+ await runAgenticFlow(['workers', 'triggers']);
6089
+ } catch (e) {
6090
+ console.error(chalk.red('Triggers list failed:'), e.message);
6091
+ }
6092
+ });
6093
+
6094
+ workersCmd.command('stats')
6095
+ .description('Show worker statistics (24h)')
6096
+ .action(async () => {
6097
+ try {
6098
+ await runAgenticFlow(['workers', 'stats']);
6099
+ } catch (e) {
6100
+ console.error(chalk.red('Stats failed:'), e.message);
6101
+ }
6102
+ });
6103
+
6104
+ workersCmd.command('cleanup')
6105
+ .description('Cleanup old worker records')
6106
+ .option('--keep <days>', 'Keep records for N days', '7')
6107
+ .action(async (opts) => {
6108
+ try {
6109
+ await runAgenticFlow(['workers', 'cleanup', '--keep', opts.keep]);
6110
+ } catch (e) {
6111
+ console.error(chalk.red('Cleanup failed:'), e.message);
6112
+ }
6113
+ });
6114
+
6115
+ workersCmd.command('cancel')
6116
+ .description('Cancel a running worker')
6117
+ .argument('<workerId>', 'Worker ID to cancel')
6118
+ .action(async (workerId) => {
6119
+ try {
6120
+ await runAgenticFlow(['workers', 'cancel', workerId]);
6121
+ } catch (e) {
6122
+ console.error(chalk.red('Cancel failed:'), e.message);
6123
+ }
6124
+ });
6125
+
6126
+ console.log && false; // Force registration
6127
+
5987
6128
  // MCP Server command
5988
6129
  const mcpCmd = program.command('mcp').description('MCP (Model Context Protocol) server for Claude Code integration');
5989
6130
 
package/bin/mcp-server.js CHANGED
@@ -916,6 +916,60 @@ const TOOLS = [
916
916
  properties: {},
917
917
  required: []
918
918
  }
919
+ },
920
+ // ============================================
921
+ // BACKGROUND WORKERS TOOLS (via agentic-flow)
922
+ // ============================================
923
+ {
924
+ name: 'workers_dispatch',
925
+ description: 'Dispatch a background worker for analysis (ultralearn, optimize, audit, map, etc.)',
926
+ inputSchema: {
927
+ type: 'object',
928
+ properties: {
929
+ prompt: { type: 'string', description: 'Prompt with trigger keyword (e.g., "ultralearn authentication")' }
930
+ },
931
+ required: ['prompt']
932
+ }
933
+ },
934
+ {
935
+ name: 'workers_status',
936
+ description: 'Get background worker status dashboard',
937
+ inputSchema: {
938
+ type: 'object',
939
+ properties: {
940
+ workerId: { type: 'string', description: 'Specific worker ID (optional)' }
941
+ },
942
+ required: []
943
+ }
944
+ },
945
+ {
946
+ name: 'workers_results',
947
+ description: 'Get analysis results from completed workers',
948
+ inputSchema: {
949
+ type: 'object',
950
+ properties: {
951
+ json: { type: 'boolean', description: 'Return as JSON', default: false }
952
+ },
953
+ required: []
954
+ }
955
+ },
956
+ {
957
+ name: 'workers_triggers',
958
+ description: 'List available trigger keywords for workers',
959
+ inputSchema: {
960
+ type: 'object',
961
+ properties: {},
962
+ required: []
963
+ }
964
+ },
965
+ {
966
+ name: 'workers_stats',
967
+ description: 'Get worker statistics (24h)',
968
+ inputSchema: {
969
+ type: 'object',
970
+ properties: {},
971
+ required: []
972
+ }
919
973
  }
920
974
  ];
921
975
 
@@ -2066,6 +2120,123 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
2066
2120
  }, null, 2) }] };
2067
2121
  }
2068
2122
 
2123
+ // ============================================
2124
+ // BACKGROUND WORKERS HANDLERS (via agentic-flow)
2125
+ // ============================================
2126
+ case 'workers_dispatch': {
2127
+ const prompt = args.prompt;
2128
+ try {
2129
+ const result = execSync(`npx agentic-flow@alpha workers dispatch "${prompt.replace(/"/g, '\\"')}"`, {
2130
+ encoding: 'utf-8',
2131
+ timeout: 30000,
2132
+ stdio: ['pipe', 'pipe', 'pipe']
2133
+ });
2134
+ return { content: [{ type: 'text', text: JSON.stringify({
2135
+ success: true,
2136
+ message: 'Worker dispatched',
2137
+ output: result.trim()
2138
+ }, null, 2) }] };
2139
+ } catch (e) {
2140
+ return { content: [{ type: 'text', text: JSON.stringify({
2141
+ success: true,
2142
+ message: 'Worker dispatch attempted',
2143
+ note: 'Check workers status for progress'
2144
+ }, null, 2) }] };
2145
+ }
2146
+ }
2147
+
2148
+ case 'workers_status': {
2149
+ try {
2150
+ const cmdArgs = args.workerId ? `workers status ${args.workerId}` : 'workers status';
2151
+ const result = execSync(`npx agentic-flow@alpha ${cmdArgs}`, {
2152
+ encoding: 'utf-8',
2153
+ timeout: 15000,
2154
+ stdio: ['pipe', 'pipe', 'pipe']
2155
+ });
2156
+ return { content: [{ type: 'text', text: JSON.stringify({
2157
+ success: true,
2158
+ status: result.trim()
2159
+ }, null, 2) }] };
2160
+ } catch (e) {
2161
+ return { content: [{ type: 'text', text: JSON.stringify({
2162
+ success: false,
2163
+ error: 'Could not get worker status',
2164
+ message: e.message
2165
+ }, null, 2) }] };
2166
+ }
2167
+ }
2168
+
2169
+ case 'workers_results': {
2170
+ try {
2171
+ const cmdArgs = args.json ? 'workers results --json' : 'workers results';
2172
+ const result = execSync(`npx agentic-flow@alpha ${cmdArgs}`, {
2173
+ encoding: 'utf-8',
2174
+ timeout: 15000,
2175
+ stdio: ['pipe', 'pipe', 'pipe']
2176
+ });
2177
+ if (args.json) {
2178
+ try {
2179
+ return { content: [{ type: 'text', text: JSON.stringify({
2180
+ success: true,
2181
+ results: JSON.parse(result.trim())
2182
+ }, null, 2) }] };
2183
+ } catch {
2184
+ return { content: [{ type: 'text', text: result.trim() }] };
2185
+ }
2186
+ }
2187
+ return { content: [{ type: 'text', text: JSON.stringify({
2188
+ success: true,
2189
+ results: result.trim()
2190
+ }, null, 2) }] };
2191
+ } catch (e) {
2192
+ return { content: [{ type: 'text', text: JSON.stringify({
2193
+ success: false,
2194
+ error: 'Could not get worker results',
2195
+ message: e.message
2196
+ }, null, 2) }] };
2197
+ }
2198
+ }
2199
+
2200
+ case 'workers_triggers': {
2201
+ try {
2202
+ const result = execSync('npx agentic-flow@alpha workers triggers', {
2203
+ encoding: 'utf-8',
2204
+ timeout: 15000,
2205
+ stdio: ['pipe', 'pipe', 'pipe']
2206
+ });
2207
+ return { content: [{ type: 'text', text: JSON.stringify({
2208
+ success: true,
2209
+ triggers: result.trim()
2210
+ }, null, 2) }] };
2211
+ } catch (e) {
2212
+ // Return hardcoded list as fallback
2213
+ return { content: [{ type: 'text', text: JSON.stringify({
2214
+ success: true,
2215
+ triggers: ['ultralearn', 'optimize', 'consolidate', 'predict', 'audit', 'map', 'preload', 'deepdive', 'document', 'refactor', 'benchmark', 'testgaps']
2216
+ }, null, 2) }] };
2217
+ }
2218
+ }
2219
+
2220
+ case 'workers_stats': {
2221
+ try {
2222
+ const result = execSync('npx agentic-flow@alpha workers stats', {
2223
+ encoding: 'utf-8',
2224
+ timeout: 15000,
2225
+ stdio: ['pipe', 'pipe', 'pipe']
2226
+ });
2227
+ return { content: [{ type: 'text', text: JSON.stringify({
2228
+ success: true,
2229
+ stats: result.trim()
2230
+ }, null, 2) }] };
2231
+ } catch (e) {
2232
+ return { content: [{ type: 'text', text: JSON.stringify({
2233
+ success: false,
2234
+ error: 'Could not get worker stats',
2235
+ message: e.message
2236
+ }, null, 2) }] };
2237
+ }
2238
+ }
2239
+
2069
2240
  default:
2070
2241
  return {
2071
2242
  content: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruvector",
3
- "version": "0.1.75",
3
+ "version": "0.1.76",
4
4
  "description": "High-performance vector database for Node.js with automatic native/WASM fallback",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",