@claude-flow/cli 3.38.21 → 3.38.23

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.
@@ -1 +1 @@
1
- 3.38.21
1
+ 3.38.20
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "manifest": {
3
- "version": "3.38.21",
3
+ "version": "3.38.23",
4
4
  "files": {
5
5
  "auto-memory-hook.mjs": "85fe05c757421c52137c0bc8545a0896bab6b4714538c2a11d1d0835bfcc8c1c",
6
- "hook-handler.cjs": "dae295fb9ae2626b89899c19a20cc911541af82b52d2eeb9b214d618b96e9a86",
6
+ "hook-handler.cjs": "209d9fafe10e17d1be0866727f6f9cf9ac66f9a0793f1c793a4f58319e8e4583",
7
7
  "intelligence.cjs": "30e42ed7ec4ca5a94ac54fdb1330d2d47ac5f3fdeeef207753574723a9e77b5c",
8
8
  "statusline.cjs": "4a48353b4f1566fa4379b00fd0321b6676a22b6cc91fbbd8380ac5183d619468"
9
9
  }
10
10
  },
11
- "signature": "wxXkWxgHyxCi4QwBfHeomKd+yB4yFN7BGjt34e4fo/Y8TuhUuRqSiw7y+WV2euDa734J/lEx9mP7xMwg4dw2Cw==",
11
+ "signature": "TJPmjOW/sxuw75iuKo1IeJNrgRT42msZz/euuryYE/SLd5XPUmROZLfMgzl0yvDyvHeOYZ3j+P3VI62fCFZ1DQ==",
12
12
  "algorithm": "ed25519"
13
13
  }
@@ -587,9 +587,20 @@ const handlers = {
587
587
 
588
588
  // Hooks must ALWAYS exit 0 — Claude Code treats non-zero as "hook error"
589
589
  // and skips all subsequent hooks for the event.
590
- process.exitCode = 0;
591
- main().catch((e) => {
592
- try { console.log(`[WARN] Hook handler error: ${e.message}`); } catch (_) {}
593
- }).finally(() => {
594
- process.exit(0);
595
- });
590
+ //
591
+ // Only dispatch when run directly (node hook-handler.cjs <cmd>). When
592
+ // require()'d by a test, expose the internals instead of reading stdin and
593
+ // calling process.exit — the 2026-06-15 fix (cb1e93e8d) added this guard and
594
+ // the exports for tests/hook-handler-runwithtimeout.test.cjs; the 2026-07-04
595
+ // helper sync (a5f86ad0a) dropped both, so the test died with
596
+ // "runWithTimeout is not a function" once the Test Suite job ran again.
597
+ if (require.main === module) {
598
+ process.exitCode = 0;
599
+ main().catch((e) => {
600
+ try { console.log(`[WARN] Hook handler error: ${e.message}`); } catch (_) {}
601
+ }).finally(() => {
602
+ process.exit(0);
603
+ });
604
+ }
605
+
606
+ module.exports = { runWithTimeout, INTELLIGENCE_TIMEOUT_MS };
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "generation": 6,
4
- "generatedAt": "2026-09-02T13:38:52.286Z",
5
- "gitSha": "b3db0180",
4
+ "generatedAt": "2026-09-07T17:34:20.768Z",
5
+ "gitSha": "6acc6891",
6
6
  "catalog": {
7
7
  "agents": 167,
8
8
  "tools": 397,
@@ -583,6 +583,10 @@ const searchCommand = {
583
583
  score: e.score,
584
584
  namespace: e.namespace,
585
585
  provenanceType: e.provenanceType,
586
+ // Dream Cycle 2026-09-03: thread the already-computed
587
+ // embedding through so SmartRetrieval's MMR step can use
588
+ // cosine similarity instead of a text-overlap proxy.
589
+ embedding: e.embedding,
586
590
  })),
587
591
  };
588
592
  };
@@ -40,7 +40,7 @@ declare const STDERR_REDIRECT_PREFIXES: string[];
40
40
  declare const AGENTDB_MOCK_FALLBACK_DROP_PREFIXES: string[];
41
41
  declare const shouldRedirectToStderr: (msg: unknown) => boolean;
42
42
  declare const isAgentdbMockFallbackNoise: (msg: unknown) => boolean;
43
- declare const origWarn: (...data: any[]) => void;
44
- declare const origLog: (...data: any[]) => void;
45
- declare const origError: (...data: any[]) => void;
43
+ declare const origWarn: (message?: any, ...optionalParams: any[]) => void;
44
+ declare const origLog: (message?: any, ...optionalParams: any[]) => void;
45
+ declare const origError: (message?: any, ...optionalParams: any[]) => void;
46
46
  //# sourceMappingURL=log-filters.d.ts.map
@@ -485,6 +485,10 @@ export const memoryTools = [
485
485
  score: e.score,
486
486
  namespace: e.namespace,
487
487
  provenanceType: e.provenanceType,
488
+ // Dream Cycle 2026-09-03: thread the already-computed
489
+ // embedding through so SmartRetrieval's MMR step can use
490
+ // cosine similarity instead of a text-overlap proxy.
491
+ embedding: e.embedding,
488
492
  })),
489
493
  };
490
494
  };
@@ -476,6 +476,11 @@ export declare function searchEntries(options: {
476
476
  score: number;
477
477
  namespace: string;
478
478
  provenanceType?: string;
479
+ /** Dream Cycle 2026-09-03: the query-time cosine score above already
480
+ * consumes this vector — surfaced so SmartRetrieval's MMR step can
481
+ * reuse it instead of falling back to a text-overlap proxy. Internal
482
+ * plumbing only; CLI/MCP response mappers do not forward this field. */
483
+ embedding?: number[];
479
484
  }[];
480
485
  searchTime: number;
481
486
  error?: string;
@@ -2693,10 +2693,11 @@ export async function searchEntries(options) {
2693
2693
  continue;
2694
2694
  }
2695
2695
  let score = 0;
2696
+ let parsedEmbedding;
2696
2697
  if (embeddingJson) {
2697
2698
  try {
2698
- const embedding = JSON.parse(embeddingJson);
2699
- score = cosineSim(queryEmbedding, embedding);
2699
+ parsedEmbedding = JSON.parse(embeddingJson);
2700
+ score = cosineSim(queryEmbedding, parsedEmbedding);
2700
2701
  }
2701
2702
  catch { /* skip */ }
2702
2703
  }
@@ -2708,6 +2709,7 @@ export async function searchEntries(options) {
2708
2709
  score,
2709
2710
  namespace: candidate.namespace,
2710
2711
  provenanceType: provenanceTypeVal || 'unknown',
2712
+ embedding: parsedEmbedding,
2711
2713
  });
2712
2714
  }
2713
2715
  }
@@ -2809,13 +2811,15 @@ export async function searchEntries(options) {
2809
2811
  for (const row of entries[0].values) {
2810
2812
  const [id, key, ns, content, embeddingJson, provenanceTypeVal] = row;
2811
2813
  let score = 0;
2814
+ let parsedEmbedding;
2812
2815
  if (embeddingJson) {
2813
2816
  try {
2814
- const embedding = JSON.parse(embeddingJson);
2815
- score = cosineSim(queryEmbedding, embedding);
2817
+ parsedEmbedding = JSON.parse(embeddingJson);
2818
+ score = cosineSim(queryEmbedding, parsedEmbedding);
2816
2819
  }
2817
2820
  catch {
2818
2821
  // Invalid embedding, use keyword score
2822
+ parsedEmbedding = undefined;
2819
2823
  }
2820
2824
  }
2821
2825
  // Fallback to keyword matching
@@ -2835,6 +2839,7 @@ export async function searchEntries(options) {
2835
2839
  score,
2836
2840
  namespace: ns || 'default',
2837
2841
  provenanceType: provenanceTypeVal || 'unknown',
2842
+ embedding: parsedEmbedding,
2838
2843
  });
2839
2844
  }
2840
2845
  }
@@ -376,17 +376,28 @@ export class EnhancedModelRouter {
376
376
  }
377
377
  // Step 6: Determine tier based on complexity
378
378
  const { haiku, sonnet } = this.config.complexityThresholds;
379
- // ADR-149 — forward the per-model fields from baseResult onto every
380
- // tier-2/3 return. This keeps the cost-optimal pick alive end-to-end:
381
- // if the neural backend picked Ling for a cheap task, the enhanced
382
- // router surfaces `modelId: 'inclusionai/ling-2.6-flash'` alongside
383
- // `model: 'haiku'` so downstream consumers can dispatch via OpenRouter.
384
- const neuralFields = {
385
- ...(baseResult.modelId ? { modelId: baseResult.modelId } : {}),
386
- ...(baseResult.routedBy ? { routedBy: baseResult.routedBy } : {}),
387
- ...(baseResult.provider ? { provider: baseResult.provider } : {}),
388
- ...(baseResult.openrouterModel ? { openrouterModel: baseResult.openrouterModel } : {}),
389
- };
379
+ // ADR-149 — forward the per-model fields from baseResult onto the
380
+ // tier-2/3 return, but ONLY when the tier being returned here still
381
+ // matches the tier baseResult.model was chosen for. `finalComplexity`
382
+ // (AST-adjusted / tier3-keyword-boosted, Step 5-6 above) can escalate
383
+ // the returned tier past what the base bandit router saw when it picked
384
+ // `modelId` — forwarding it unconditionally would attach a cheaper
385
+ // tier's concrete model (e.g. `inclusionai/ling-2.6-flash`, chosen for
386
+ // 'haiku') to an escalated 'opus' decision. `agent-execute-core.ts`
387
+ // treats a present `modelId` as an override that skips tier-based
388
+ // dispatch entirely, so a stale, wrong-tier `modelId` silently defeats
389
+ // the escalation this function just computed. Dropping the mismatched
390
+ // fields (rather than trying to re-resolve modelId for the new tier)
391
+ // keeps this fix small and fail-safe: an escalated decision falls back
392
+ // to the plain `model` field, never to a cheaper model's identity.
393
+ const neuralFieldsFor = (model) => baseResult.model === model
394
+ ? {
395
+ ...(baseResult.modelId ? { modelId: baseResult.modelId } : {}),
396
+ ...(baseResult.routedBy ? { routedBy: baseResult.routedBy } : {}),
397
+ ...(baseResult.provider ? { provider: baseResult.provider } : {}),
398
+ ...(baseResult.openrouterModel ? { openrouterModel: baseResult.openrouterModel } : {}),
399
+ }
400
+ : {};
390
401
  if (finalComplexity < haiku) {
391
402
  return {
392
403
  tier: 2,
@@ -398,7 +409,7 @@ export class EnhancedModelRouter {
398
409
  canSkipLLM: false,
399
410
  estimatedLatencyMs: 500,
400
411
  estimatedCost: 0.0002,
401
- ...neuralFields,
412
+ ...neuralFieldsFor('haiku'),
402
413
  };
403
414
  }
404
415
  if (finalComplexity < sonnet) {
@@ -412,7 +423,7 @@ export class EnhancedModelRouter {
412
423
  canSkipLLM: false,
413
424
  estimatedLatencyMs: 2000,
414
425
  estimatedCost: 0.003,
415
- ...neuralFields,
426
+ ...neuralFieldsFor('sonnet'),
416
427
  };
417
428
  }
418
429
  return {
@@ -425,7 +436,7 @@ export class EnhancedModelRouter {
425
436
  canSkipLLM: false,
426
437
  estimatedLatencyMs: 5000,
427
438
  estimatedCost: 0.015,
428
- ...neuralFields,
439
+ ...neuralFieldsFor('opus'),
429
440
  };
430
441
  }
431
442
  /**
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.38.21",
3
+ "version": "3.38.23",
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",