claude-flow 3.6.0 → 3.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -505,7 +505,7 @@ export const agentdbConsolidate = {
505
505
  // ===== agentdb_batch — Batch operations (insert, update, delete) =====
506
506
  export const agentdbBatch = {
507
507
  name: 'agentdb_batch',
508
- description: 'Batch operations on memory entries (insert, update, delete)',
508
+ description: 'Batch operations on AgentDB episodes (insert, update, delete). Note: entries are stored in the AgentDB episodes table, not the memory_search namespace. Use memory_store for entries that should be searchable via memory_search.',
509
509
  inputSchema: {
510
510
  type: 'object',
511
511
  properties: {
@@ -5,7 +5,7 @@
5
5
  * @module @claude-flow/cli/mcp-tools/transfer-tools
6
6
  * @version 3.0.0
7
7
  */
8
- import { validateIdentifier, validateText } from './validate-input.js';
8
+ import { validateIdentifier, validatePackageName, validateText } from './validate-input.js';
9
9
  /**
10
10
  * Helper to create MCP tool result
11
11
  */
@@ -363,7 +363,7 @@ export const transferTools = [
363
363
  },
364
364
  handler: async (input) => {
365
365
  {
366
- const v = validateIdentifier(input.name, 'name');
366
+ const v = validatePackageName(input.name, 'name');
367
367
  if (!v.valid)
368
368
  return createResult({ error: v.error }, true);
369
369
  }
@@ -21,6 +21,10 @@ export declare function validateIdentifier(value: unknown, label: string): Valid
21
21
  * Allows ~, ^, and / which are standard git revision selectors.
22
22
  */
23
23
  export declare function validateGitRef(value: unknown, label: string): ValidationResult;
24
+ /**
25
+ * Validate an npm package name (allows @scope/name format).
26
+ */
27
+ export declare function validatePackageName(value: unknown, label: string): ValidationResult;
24
28
  /**
25
29
  * Validate a file path (prevents traversal and shell injection).
26
30
  */
@@ -11,6 +11,7 @@ const SHELL_META = /[;&|`$(){}[\]<>!#\\]/;
11
11
  const PATH_TRAVERSAL = /\.\.[/\\]/;
12
12
  const IDENTIFIER_RE = /^[a-zA-Z0-9_][a-zA-Z0-9_\-.:]{0,127}$/;
13
13
  const GIT_REF_RE = /^[a-zA-Z0-9_][a-zA-Z0-9_\-.:~^/]{0,255}$/;
14
+ const NPM_PACKAGE_RE = /^(@[a-zA-Z0-9_\-]+\/)?[a-zA-Z0-9_\-][a-zA-Z0-9_\-.]{0,213}$/;
14
15
  /**
15
16
  * Validate an identifier (agent ID, agent type, namespace, key, etc.)
16
17
  * Rejects shell metacharacters and path traversal.
@@ -52,6 +53,24 @@ export function validateGitRef(value, label) {
52
53
  }
53
54
  return { valid: true, sanitized: value };
54
55
  }
56
+ /**
57
+ * Validate an npm package name (allows @scope/name format).
58
+ */
59
+ export function validatePackageName(value, label) {
60
+ if (typeof value !== 'string' || value.length === 0) {
61
+ return { valid: false, sanitized: '', error: `${label} must be a non-empty string` };
62
+ }
63
+ if (value.length > 214) {
64
+ return { valid: false, sanitized: '', error: `${label} exceeds 214 characters` };
65
+ }
66
+ if (SHELL_META.test(value)) {
67
+ return { valid: false, sanitized: '', error: `${label} contains disallowed characters` };
68
+ }
69
+ if (!NPM_PACKAGE_RE.test(value)) {
70
+ return { valid: false, sanitized: '', error: `${label} contains invalid characters (expected npm package name, e.g. @scope/name)` };
71
+ }
72
+ return { valid: true, sanitized: value };
73
+ }
55
74
  /**
56
75
  * Validate a file path (prevents traversal and shell injection).
57
76
  */
@@ -1432,12 +1432,22 @@ export async function bridgeBatchOperation(params) {
1432
1432
  let result;
1433
1433
  switch (params.operation) {
1434
1434
  case 'insert': {
1435
- // insertEpisodes expects [{content, metadata?, embedding?}]
1435
+ if (typeof batch.insertEpisodes !== 'function') {
1436
+ return { success: false, error: 'BatchOperations.insertEpisodes not available — embedder may not be initialized. Use memory_store instead.' };
1437
+ }
1436
1438
  const episodes = params.entries.map((e) => ({
1437
1439
  content: e.value || e.content || JSON.stringify(e),
1438
1440
  metadata: e.metadata || { key: e.key },
1439
1441
  }));
1440
- result = await batch.insertEpisodes(episodes);
1442
+ try {
1443
+ result = await batch.insertEpisodes(episodes);
1444
+ }
1445
+ catch (insertErr) {
1446
+ if (insertErr?.message?.includes('null') || insertErr?.message?.includes('embedBatch')) {
1447
+ return { success: false, error: 'Embedder not initialized for batch insert. Use memory_store for individual entries or run embeddings_init first.' };
1448
+ }
1449
+ throw insertErr;
1450
+ }
1441
1451
  break;
1442
1452
  }
1443
1453
  case 'delete': {
@@ -107,7 +107,12 @@ export async function createHnswRouter(config) {
107
107
  return ok;
108
108
  },
109
109
  route(query, k = 3) {
110
- return router.route(query, k);
110
+ const raw = router.route(query, k);
111
+ return Array.from(raw).map((r) => ({
112
+ name: r.name ?? r.pattern_name ?? '',
113
+ score: r.score ?? r.distance ?? 0,
114
+ metadata: r.metadata ? (typeof r.metadata === 'string' ? JSON.parse(r.metadata) : r.metadata) : undefined,
115
+ }));
111
116
  },
112
117
  clear() {
113
118
  router.clear();
@@ -187,14 +192,21 @@ export async function createMicroLora(config) {
187
192
  const feedback = new mod.AdaptFeedbackWasm();
188
193
  feedback.quality = quality;
189
194
  feedback.learningRate = learningRate;
190
- // Note: feedback.success not on prototype in v2.0.2, set via property
191
195
  try {
192
196
  feedback.success = success;
193
197
  }
194
198
  catch { /* v2.0.2 quirk */ }
195
- // Create a dummy input vector matching the configured inputDim
196
199
  const input = new Float32Array(config.inputDim);
197
- lora.adapt(input, feedback);
200
+ try {
201
+ lora.adapt(input, feedback);
202
+ }
203
+ catch (e) {
204
+ if (e?.message?.includes('Input size mismatch')) {
205
+ throw new Error(`MicroLoRA adapt failed: WASM expects inputDim=768 but this adapter was created with inputDim=${config.inputDim}. ` +
206
+ `Recreate with inputDim=768 or a multiple of 768.`);
207
+ }
208
+ throw e;
209
+ }
198
210
  },
199
211
  applyUpdates(gradients) {
200
212
  lora.applyUpdates(gradients);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",