ruvector 0.2.33 → 0.2.34
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.
- package/bin/cli.js +14 -2
- package/bin/mcp-server.js +16 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -2183,13 +2183,25 @@ const embedCmd = program.command('embed').description('Generate embeddings from
|
|
|
2183
2183
|
|
|
2184
2184
|
embedCmd
|
|
2185
2185
|
.command('text')
|
|
2186
|
-
.description('Embed a text string')
|
|
2187
|
-
.argument('
|
|
2186
|
+
.description('Embed a text string ("-" or --stdin reads from stdin; --input-file reads from a file — keeps sensitive text off argv)')
|
|
2187
|
+
.argument('[text]', 'Text to embed, or "-" to read from stdin')
|
|
2188
|
+
.option('--stdin', 'Read the text from stdin instead of argv')
|
|
2189
|
+
.option('--input-file <path>', 'Read the text from a file instead of argv')
|
|
2188
2190
|
.option('--adaptive', 'Use adaptive embedder with LoRA')
|
|
2189
2191
|
.option('--domain <domain>', 'Domain for prototype learning')
|
|
2190
2192
|
.option('-o, --output <file>', 'Output file for embedding')
|
|
2191
2193
|
.action(async (text, opts) => {
|
|
2192
2194
|
try {
|
|
2195
|
+
// #641: raw text on argv leaks via the process table; offer stdin/file input.
|
|
2196
|
+
if (opts.inputFile) {
|
|
2197
|
+
text = fs.readFileSync(opts.inputFile, 'utf8').replace(/\r?\n$/, '');
|
|
2198
|
+
} else if (opts.stdin || text === '-') {
|
|
2199
|
+
text = fs.readFileSync(0, 'utf8').replace(/\r?\n$/, '');
|
|
2200
|
+
}
|
|
2201
|
+
if (!text) {
|
|
2202
|
+
console.error(chalk.red('No text to embed. Pass a text argument, "-" / --stdin, or --input-file <path>.'));
|
|
2203
|
+
process.exit(1);
|
|
2204
|
+
}
|
|
2193
2205
|
const { performance } = require('perf_hooks');
|
|
2194
2206
|
const start = performance.now();
|
|
2195
2207
|
|
package/bin/mcp-server.js
CHANGED
|
@@ -1275,9 +1275,10 @@ const TOOLS = [
|
|
|
1275
1275
|
properties: {
|
|
1276
1276
|
path: { type: 'string', description: 'File path for the new .rvf store' },
|
|
1277
1277
|
dimension: { type: 'number', description: 'Vector dimensionality (e.g. 128, 384, 768, 1536)' },
|
|
1278
|
+
dimensions: { type: 'number', description: 'Alias for dimension' },
|
|
1278
1279
|
metric: { type: 'string', description: 'Distance metric: cosine, l2, or dotproduct', default: 'cosine' }
|
|
1279
1280
|
},
|
|
1280
|
-
required: ['path'
|
|
1281
|
+
required: ['path']
|
|
1281
1282
|
}
|
|
1282
1283
|
},
|
|
1283
1284
|
{
|
|
@@ -3257,12 +3258,23 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
3257
3258
|
case 'rvf_create': {
|
|
3258
3259
|
try {
|
|
3259
3260
|
const safePath = validateRvfPath(args.path);
|
|
3261
|
+
// The @ruvector/rvf SDK option is `dimensions` (plural); accept the
|
|
3262
|
+
// singular `dimension` this tool has always advertised too (#641).
|
|
3263
|
+
const dimensions = args.dimensions ?? args.dimension;
|
|
3264
|
+
if (!Number.isInteger(dimensions) || dimensions <= 0) {
|
|
3265
|
+
throw new Error(`Missing or invalid dimension: expected a positive integer, got ${JSON.stringify(dimensions)}`);
|
|
3266
|
+
}
|
|
3260
3267
|
const { createRvfStore } = require('../dist/core/rvf-wrapper.js');
|
|
3261
|
-
const store = await createRvfStore(safePath, {
|
|
3262
|
-
const status = store.status ? await store.status() : {
|
|
3268
|
+
const store = await createRvfStore(safePath, { dimensions, metric: args.metric || 'cosine' });
|
|
3269
|
+
const status = store.status ? await store.status() : { dimensions };
|
|
3263
3270
|
return { content: [{ type: 'text', text: JSON.stringify({ success: true, path: safePath, ...status }, null, 2) }] };
|
|
3264
3271
|
} catch (e) {
|
|
3265
|
-
|
|
3272
|
+
// Only suggest installing the package when it is actually missing (#641).
|
|
3273
|
+
const payload = { success: false, error: e.message };
|
|
3274
|
+
if (/not installed|cannot find module/i.test(e.message)) {
|
|
3275
|
+
payload.hint = 'Install @ruvector/rvf: npm install @ruvector/rvf';
|
|
3276
|
+
}
|
|
3277
|
+
return { content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }], isError: true };
|
|
3266
3278
|
}
|
|
3267
3279
|
}
|
|
3268
3280
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ruvector",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"description": "Self-learning vector database for Node.js \u2014 hybrid search, Graph RAG, FlashAttention-3, HNSW, 50+ attention mechanisms",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|