claude-flow 3.32.0 → 3.32.2

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 (34) hide show
  1. package/.claude/helpers/statusline.cjs +38 -31
  2. package/.claude/proven-config.json +1 -1
  3. package/.claude-plugin/scripts/ruflo-hook.cjs +2 -2
  4. package/.claude-plugin/scripts/ruflo-hook.sh +17 -2
  5. package/package.json +186 -185
  6. package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
  7. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +20 -9
  8. package/v3/@claude-flow/cli/dist/src/commands/init.d.ts +5 -0
  9. package/v3/@claude-flow/cli/dist/src/commands/init.js +30 -1
  10. package/v3/@claude-flow/cli/dist/src/commands/security.js +16 -11
  11. package/v3/@claude-flow/cli/dist/src/funnel/insights.d.ts +1 -0
  12. package/v3/@claude-flow/cli/dist/src/funnel/insights.js +4 -4
  13. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.d.ts +6 -1
  14. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.js +29 -20
  15. package/v3/@claude-flow/cli/dist/src/init/executor.js +2 -2
  16. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +13 -1
  17. package/v3/@claude-flow/cli/dist/src/security/builtin-aidefence.d.ts +34 -0
  18. package/v3/@claude-flow/cli/dist/src/security/builtin-aidefence.js +86 -0
  19. package/v3/@claude-flow/cli/dist/src/services/fable-harness.d.ts +1 -0
  20. package/v3/@claude-flow/cli/package.json +9 -8
  21. package/.claude/helpers/.helpers-version +0 -1
  22. package/.claude/helpers/helpers.manifest.json +0 -13
  23. package/.claude/helpers/hidden-hook.vbs +0 -43
  24. package/.claude/settings.local.json +0 -78
  25. package/v3/@claude-flow/cli/dist/src/ruvector/flash-attention.d.ts +0 -195
  26. package/v3/@claude-flow/cli/dist/src/ruvector/flash-attention.js +0 -643
  27. package/v3/@claude-flow/cli/dist/src/ruvector/moe-router.d.ts +0 -206
  28. package/v3/@claude-flow/cli/dist/src/ruvector/moe-router.js +0 -626
  29. package/v3/@claude-flow/cli/dist/src/services/event-stream.d.ts +0 -25
  30. package/v3/@claude-flow/cli/dist/src/services/event-stream.js +0 -27
  31. package/v3/@claude-flow/cli/dist/src/services/loop-worker-runner.d.ts +0 -16
  32. package/v3/@claude-flow/cli/dist/src/services/loop-worker-runner.js +0 -34
  33. package/v3/@claude-flow/cli/dist/src/services/runtime-capabilities.d.ts +0 -22
  34. package/v3/@claude-flow/cli/dist/src/services/runtime-capabilities.js +0 -45
@@ -1,78 +0,0 @@
1
- {
2
- "_comment": "Windows-only override — routes HOOKS through wscript.exe hidden-hook.vbs to work around anthropics/claude-code#14828 / #70200 (missing windowsHide/CREATE_NO_WINDOW on hook spawns). Gitignored; delete or empty to restore normal .claude/settings.json behavior. Trade-offs: (1) wscript has no stdin/stdout, so hooks routed through here run without their JSON event payload and cannot print output back to Claude Code — most ruflo hooks tolerate this. (2) statusLine is NOT overridden here because it requires stdout; it falls back to .claude/settings.json's direct node invocation, which will still flash on Windows until Claude Code adds windowsHide to its statusLine spawn. See .claude/helpers/hidden-hook.vbs.",
3
- "hooks": {
4
- "PreToolUse": [
5
- {
6
- "matcher": "Bash",
7
- "hooks": [
8
- {
9
- "type": "command",
10
- "command": "wscript.exe \"${CLAUDE_PROJECT_DIR}\\.claude\\helpers\\hidden-hook.vbs\" hook-handler.cjs pre-bash",
11
- "timeout": 5000
12
- }
13
- ]
14
- }
15
- ],
16
- "PostToolUse": [
17
- {
18
- "matcher": "Write|Edit|MultiEdit",
19
- "hooks": [
20
- {
21
- "type": "command",
22
- "command": "wscript.exe \"${CLAUDE_PROJECT_DIR}\\.claude\\helpers\\hidden-hook.vbs\" hook-handler.cjs post-edit",
23
- "timeout": 10000
24
- }
25
- ]
26
- }
27
- ],
28
- "UserPromptSubmit": [
29
- {
30
- "hooks": [
31
- {
32
- "type": "command",
33
- "command": "wscript.exe \"${CLAUDE_PROJECT_DIR}\\.claude\\helpers\\hidden-hook.vbs\" hook-handler.cjs route",
34
- "timeout": 10000
35
- }
36
- ]
37
- }
38
- ],
39
- "SessionStart": [
40
- {
41
- "hooks": [
42
- {
43
- "type": "command",
44
- "command": "wscript.exe \"${CLAUDE_PROJECT_DIR}\\.claude\\helpers\\hidden-hook.vbs\" hook-handler.cjs session-restore",
45
- "timeout": 15000
46
- },
47
- {
48
- "type": "command",
49
- "command": "wscript.exe \"${CLAUDE_PROJECT_DIR}\\.claude\\helpers\\hidden-hook.vbs\" auto-memory-hook.mjs import",
50
- "timeout": 8000
51
- }
52
- ]
53
- }
54
- ],
55
- "SessionEnd": [
56
- {
57
- "hooks": [
58
- {
59
- "type": "command",
60
- "command": "wscript.exe \"${CLAUDE_PROJECT_DIR}\\.claude\\helpers\\hidden-hook.vbs\" hook-handler.cjs session-end",
61
- "timeout": 10000
62
- }
63
- ]
64
- }
65
- ],
66
- "Stop": [
67
- {
68
- "hooks": [
69
- {
70
- "type": "command",
71
- "command": "wscript.exe \"${CLAUDE_PROJECT_DIR}\\.claude\\helpers\\hidden-hook.vbs\" auto-memory-hook.mjs sync",
72
- "timeout": 10000
73
- }
74
- ]
75
- }
76
- ]
77
- }
78
- }
@@ -1,195 +0,0 @@
1
- /**
2
- * Flash Attention Implementation for RuVector Intelligence System
3
- *
4
- * Implements block-wise attention computation for faster similarity calculations.
5
- * Achieves O(N) memory instead of O(N^2) through tiling strategy.
6
- *
7
- * Key optimizations:
8
- * - Block-wise computation to fit in L1 cache
9
- * - Fused softmax-matmul operations
10
- * - Float32Array for all operations
11
- * - Online softmax for numerical stability
12
- *
13
- * Target: 2-5x speedup on CPU vs naive attention
14
- *
15
- * Created with love by ruv.io
16
- */
17
- export interface FlashAttentionConfig {
18
- /** Block size for tiling (32-64 optimal for CPU L1 cache) */
19
- blockSize: number;
20
- /** Number of dimensions in embedding vectors */
21
- dimensions: number;
22
- /** Temperature for softmax scaling */
23
- temperature: number;
24
- /** Enable numerical stability optimizations */
25
- useStableMode: boolean;
26
- /** Use optimized CPU path (default: true) */
27
- useCPUOptimizations: boolean;
28
- }
29
- export interface AttentionResult {
30
- /** Output vectors after attention */
31
- output: Float32Array[];
32
- /** Attention weights (optional, for debugging) */
33
- weights?: Float32Array[];
34
- /** Computation time in milliseconds */
35
- computeTimeMs: number;
36
- }
37
- export interface BenchmarkResult {
38
- /** Naive attention time in milliseconds */
39
- naiveTimeMs: number;
40
- /** Flash attention time in milliseconds */
41
- flashTimeMs: number;
42
- /** Speedup factor (naive / flash) */
43
- speedup: number;
44
- /** Number of vectors benchmarked */
45
- numVectors: number;
46
- /** Dimensions of vectors */
47
- dimensions: number;
48
- /** Memory usage estimate for naive (bytes) */
49
- naiveMemoryBytes: number;
50
- /** Memory usage estimate for flash (bytes) */
51
- flashMemoryBytes: number;
52
- /** Memory reduction factor */
53
- memoryReduction: number;
54
- }
55
- export declare class FlashAttention {
56
- private config;
57
- private lastSpeedup;
58
- private benchmarkHistory;
59
- private scoreBuffer;
60
- private expBuffer;
61
- private accumBuffer;
62
- constructor(config?: Partial<FlashAttentionConfig>);
63
- /**
64
- * Main attention computation using Flash Attention algorithm
65
- *
66
- * @param queries - Query vectors [N x D]
67
- * @param keys - Key vectors [M x D]
68
- * @param values - Value vectors [M x D]
69
- * @returns Attention output [N x D]
70
- */
71
- attention(queries: Float32Array[], keys: Float32Array[], values: Float32Array[]): AttentionResult;
72
- /**
73
- * CPU-optimized attention with aggressive optimizations
74
- *
75
- * Key optimizations:
76
- * - Blocked score computation (better cache utilization)
77
- * - Top-K sparse attention (only use most relevant keys)
78
- * - Pre-allocated buffers to avoid GC pressure
79
- * - 8x loop unrolling for dot products
80
- * - Fused max-finding during score computation
81
- */
82
- private cpuOptimizedAttention;
83
- /**
84
- * Partial dot product using only first N dimensions (for screening)
85
- */
86
- private partialDotProduct;
87
- /**
88
- * Partial sort to get top-K elements (QuickSelect-like)
89
- * Only ensures first K elements are the largest, not sorted
90
- */
91
- private partialSort;
92
- /**
93
- * Swap two indices in array
94
- */
95
- private swapIndices;
96
- /**
97
- * Fast dot product with 8x unrolling
98
- */
99
- private fastDotProduct;
100
- /**
101
- * Block-wise attention computation (Flash Attention core algorithm)
102
- *
103
- * Algorithm:
104
- * For each block of queries Q_b:
105
- * For each block of keys K_b:
106
- * S_b = Q_b @ K_b.T / sqrt(d) // Block scores
107
- * P_b = softmax(S_b) // Block attention
108
- * O_b += P_b @ V_b // Accumulate output
109
- *
110
- * @param Q - Query vectors
111
- * @param K - Key vectors
112
- * @param V - Value vectors
113
- * @param blockSize - Block size for tiling
114
- */
115
- blockAttention(Q: Float32Array[], K: Float32Array[], V: Float32Array[], blockSize: number): Float32Array[];
116
- /**
117
- * Get the speedup factor from the last benchmark
118
- */
119
- getSpeedup(): number;
120
- /**
121
- * Run benchmark comparing naive vs CPU-optimized attention
122
- *
123
- * @param numVectors - Number of vectors to test
124
- * @param dimensions - Dimensions per vector
125
- * @param iterations - Number of iterations for averaging
126
- */
127
- benchmark(numVectors?: number, dimensions?: number, iterations?: number): BenchmarkResult;
128
- /**
129
- * Get benchmark history
130
- */
131
- getBenchmarkHistory(): BenchmarkResult[];
132
- /**
133
- * Get configuration
134
- */
135
- getConfig(): FlashAttentionConfig;
136
- /**
137
- * Update configuration
138
- */
139
- setConfig(config: Partial<FlashAttentionConfig>): void;
140
- /**
141
- * Naive O(N^2) attention implementation for comparison
142
- */
143
- private naiveAttention;
144
- /**
145
- * Compute block of attention scores
146
- */
147
- private computeBlockScores;
148
- /**
149
- * Online softmax with output accumulation (key to Flash Attention)
150
- *
151
- * Uses the online softmax trick to maintain numerical stability
152
- * while processing blocks incrementally.
153
- */
154
- private onlineSoftmaxAccumulate;
155
- /**
156
- * Compute dot product of two vectors
157
- */
158
- private dotProduct;
159
- /**
160
- * Stable softmax implementation
161
- */
162
- private softmax;
163
- /**
164
- * Generate random vectors for benchmarking
165
- */
166
- private generateRandomVectors;
167
- /**
168
- * Validate input arrays
169
- */
170
- private validateInputs;
171
- }
172
- /**
173
- * Get singleton FlashAttention instance
174
- *
175
- * @param config - Optional configuration (only used on first call)
176
- * @returns FlashAttention instance
177
- */
178
- export declare function getFlashAttention(config?: Partial<FlashAttentionConfig>): FlashAttention;
179
- /**
180
- * Reset singleton (for testing)
181
- */
182
- export declare function resetFlashAttention(): void;
183
- /**
184
- * Compute attention using Flash Attention
185
- */
186
- export declare function computeAttention(queries: Float32Array[], keys: Float32Array[], values: Float32Array[], config?: Partial<FlashAttentionConfig>): AttentionResult;
187
- /**
188
- * Run Flash Attention benchmark
189
- */
190
- export declare function benchmarkFlashAttention(numVectors?: number, dimensions?: number, iterations?: number): BenchmarkResult;
191
- /**
192
- * Get current speedup from last benchmark
193
- */
194
- export declare function getFlashAttentionSpeedup(): number;
195
- //# sourceMappingURL=flash-attention.d.ts.map