{"_id":"@axeptio/behavior-detection","_rev":"8-55e9280f31a650bc52c179e165484678","name":"@axeptio/behavior-detection","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@axeptio/behavior-detection","version":"1.0.0","keywords":["behavior-detection","bot-detection","user-tracking","analytics"],"author":{"name":"Axeptio"},"license":"MIT","_id":"@axeptio/behavior-detection@1.0.0","maintainers":[{"name":"romainbessuges","email":"romainbessuges@gmail.com"},{"name":"axeptiotech","email":"tech@axeptio.eu"},{"name":"a_ng_d_axeptio","email":"aurelien.grimaud@axeptio.eu"},{"name":"rombat","email":"roro.devweb@gmail.com"},{"name":"pleberre","email":"philippe.leberre@axeptio.eu"},{"name":"luisfl-axeptio","email":"luis.flores.externe@axeptio.eu"},{"name":"javier.costa-axeptio","email":"javier.costa@axeptio.eu"},{"name":"matheuscavinax","email":"matheus.cavinato@axeptio.eu"}],"dist":{"shasum":"f75032e111b689801f568f3564726d470af5e66b","tarball":"https://registry.npmjs.org/@axeptio/behavior-detection/-/behavior-detection-1.0.0.tgz","fileCount":76,"integrity":"sha512-qOb6BxJDAC9kN8YTutJXmeAvre6tslqu8eKxb/UgcirPsT3Tw9/KexxX5LSIJNiLeZ97COKs2pH9YlOYswgdRA==","signatures":[{"sig":"MEQCIF4uQb/JYuTAqoljkMECdAZv3M80ARCo7p+p1pZ+hkqIAiBBe3vImAVBEqf7Us3u83QCJmVXQWYBQ+2KcHk7bXnStg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":487813},"main":"./dist/cjs/index.js","types":"./dist/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"f6a65857809c4d5e3517b3a7aedd576b888baeb3","scripts":{"test":"npm run build && node tests/adversarial/run-tests.js","build":"npm run build:cjs && npm run build:esm && npm run build:types","clean":"rm -rf dist","tryme":"npm run build && node scripts/serve.js","deploy":"node scripts/deploy.js","build:all":"npm run build && npm run build:bundle && npm run build:browser","build:cjs":"tsc --module commonjs --outDir dist/cjs","build:esm":"tsc --module es2015 --outDir dist/esm","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist","test:stress":"npm run build && node tests/adversarial/detector-stress-test.js","build:bundle":"npm run build:esm && esbuild dist/esm/index.js --bundle --minify --sourcemap --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.esm.min.js","build:browser":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --target=es2017 --tree-shaking=true --drop:console --drop:debugger --outfile=dist/behavior-detection.min.js","release:major":"npm version major && git push && git push --tags","release:minor":"npm version minor && git push && git push --tags","release:patch":"npm version patch && git push && git push --tags","test:selenium":"npm run build && node tests/adversarial/selenium-test.js","test:puppeteer":"npm run build && node tests/adversarial/puppeteer-test.js","test:playwright":"npm run build && node tests/adversarial/playwright-test.js","test:adversarial":"npm run build && node tests/adversarial/run-all.js","build:browser:dev":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --global-name=BehaviorDetector --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.min.js","test:stress:quick":"npm run build && node tests/adversarial/detector-stress-test.js --cycles=3 --duration=5000","test:stress:intense":"npm run build && node tests/adversarial/detector-stress-test.js --cycles=10 --duration=20000"},"_npmUser":{"name":"axeptiotech","email":"tech@axeptio.eu"},"_npmVersion":"10.8.2","description":"Lightweight behavior detection library to assess human likelihood of user sessions","directories":{},"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"esbuild":"latest","puppeteer":"latest","typescript":"latest","chromedriver":"latest","@playwright/test":"latest","@aws-sdk/client-s3":"^3.515.0","selenium-webdriver":"latest","@aws-sdk/client-cloudfront":"^3.515.0"},"_npmOperationalInternal":{"tmp":"tmp/behavior-detection_1.0.0_1763632908286_0.8807804412301681","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@axeptio/behavior-detection","version":"1.0.1","keywords":["behavior-detection","bot-detection","user-tracking","analytics"],"author":{"name":"Axeptio"},"license":"MIT","_id":"@axeptio/behavior-detection@1.0.1","maintainers":[{"name":"romainbessuges","email":"romainbessuges@gmail.com"},{"name":"axeptiotech","email":"tech@axeptio.eu"},{"name":"a_ng_d_axeptio","email":"aurelien.grimaud@axeptio.eu"},{"name":"rombat","email":"roro.devweb@gmail.com"},{"name":"pleberre","email":"philippe.leberre@axeptio.eu"},{"name":"luisfl-axeptio","email":"luis.flores.externe@axeptio.eu"},{"name":"javier.costa-axeptio","email":"javier.costa@axeptio.eu"},{"name":"matheuscavinax","email":"matheus.cavinato@axeptio.eu"}],"dist":{"shasum":"cfbb5ca152e7a415e82283b41bcdde4dfef52262","tarball":"https://registry.npmjs.org/@axeptio/behavior-detection/-/behavior-detection-1.0.1.tgz","fileCount":78,"integrity":"sha512-bpCUv52K15bUUSS2tEsXG4690BBKGKWI7QWn01p2dbb7ItW0t1/K7LcaY9vZZ81ZQJ6H7nv+35/SFiRGxN751g==","signatures":[{"sig":"MEQCICDiNSkQNEVYYK+B5DVVOfXCFRWYODDmgxOzWqvRKMxnAiAclqclmSInVJJyfyelz5yQdA54f1mrEBq6Fy1bSpsv5Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":494735},"main":"./dist/cjs/index.js","types":"./dist/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"f6a65857809c4d5e3517b3a7aedd576b888baeb3","scripts":{"test":"npm run build && node tests/adversarial/run-tests.js","build":"npm run build:cjs && npm run build:esm && npm run build:types","clean":"rm -rf dist","tryme":"npm run build && node scripts/serve.js","deploy":"node scripts/deploy.js","build:all":"npm run build && npm run build:bundle && npm run build:browser","build:cjs":"tsc --module commonjs --outDir dist/cjs","build:esm":"tsc --module es2015 --outDir dist/esm","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist","test:stress":"npm run build && node tests/adversarial/detector-stress-test.js","build:bundle":"npm run build:esm && esbuild dist/esm/index.js --bundle --minify --sourcemap --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.esm.min.js","build:browser":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --target=es2017 --tree-shaking=true --drop:console --drop:debugger --outfile=dist/behavior-detection.min.js","release:major":"npm version major && git push && git push --tags","release:minor":"npm version minor && git push && git push --tags","release:patch":"npm version patch && git push && git push --tags","test:selenium":"npm run build && node tests/adversarial/selenium-test.js","test:puppeteer":"npm run build && node tests/adversarial/puppeteer-test.js","test:playwright":"npm run build && node tests/adversarial/playwright-test.js","test:adversarial":"npm run build && node tests/adversarial/run-all.js","build:browser:dev":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --global-name=BehaviorDetector --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.min.js","test:stress:quick":"npm run build && node tests/adversarial/detector-stress-test.js --cycles=3 --duration=5000","test:stress:intense":"npm run build && node tests/adversarial/detector-stress-test.js --cycles=10 --duration=20000"},"_npmUser":{"name":"romainbessuges","email":"romainbessuges@gmail.com"},"_npmVersion":"10.9.3","description":"Lightweight behavior detection library to assess human likelihood of user sessions","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"latest","puppeteer":"latest","typescript":"latest","chromedriver":"latest","@playwright/test":"latest","@aws-sdk/client-s3":"^3.966.0","selenium-webdriver":"latest","@aws-sdk/client-cloudfront":"^3.966.0"},"_npmOperationalInternal":{"tmp":"tmp/behavior-detection_1.0.1_1768125376996_0.8090176670498654","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@axeptio/behavior-detection","version":"1.0.2","keywords":["behavior-detection","bot-detection","user-tracking","analytics"],"author":{"name":"Axeptio"},"license":"MIT","_id":"@axeptio/behavior-detection@1.0.2","maintainers":[{"name":"romainbessuges","email":"romainbessuges@gmail.com"},{"name":"axeptiotech","email":"tech@axeptio.eu"},{"name":"a_ng_d_axeptio","email":"aurelien.grimaud@axeptio.eu"},{"name":"rombat","email":"roro.devweb@gmail.com"},{"name":"pleberre","email":"philippe.leberre@axeptio.eu"},{"name":"luisfl-axeptio","email":"luis.flores.externe@axeptio.eu"},{"name":"javier.costa-axeptio","email":"javier.costa@axeptio.eu"},{"name":"matheuscavinax","email":"matheus.cavinato@axeptio.eu"}],"dist":{"shasum":"837eedf8b6eb036ac9dfddc33fd11f9f3f9cb82b","tarball":"https://registry.npmjs.org/@axeptio/behavior-detection/-/behavior-detection-1.0.2.tgz","fileCount":78,"integrity":"sha512-K24MmkbOqe/4ZFf5LyXHns2fSUOY/AYlRcJx6H2Pr7FFx+8MBbnfqMon4HCniWF3eSfkBg1AScdhQbApaDgtIA==","signatures":[{"sig":"MEYCIQCZTCOUsq7W27bbkzAxHhlEWAEUAWIKD6ov39cgDTIIMgIhAJlQ/Ne2Rs+cplltopKVFLRRxEEuj8hgYg8THkwjV6Df","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":495467},"main":"./dist/cjs/index.js","types":"./dist/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"f6a65857809c4d5e3517b3a7aedd576b888baeb3","scripts":{"test":"npm run build && node tests/adversarial/run-tests.js","build":"npm run build:cjs && npm run build:esm && npm run build:types","clean":"rm -rf dist","tryme":"npm run build && node scripts/serve.js","deploy":"node scripts/deploy.js","build:all":"npm run build && npm run build:bundle && npm run build:browser","build:cjs":"tsc --module commonjs --outDir dist/cjs","build:esm":"tsc --module es2015 --outDir dist/esm","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist","test:stress":"npm run build && node tests/adversarial/detector-stress-test.js","build:bundle":"npm run build:esm && esbuild dist/esm/index.js --bundle --minify --sourcemap --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.esm.min.js","build:browser":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --target=es2017 --tree-shaking=true --drop:console --drop:debugger --outfile=dist/behavior-detection.min.js","release:major":"npm version major && git push && git push --tags","release:minor":"npm version minor && git push && git push --tags","release:patch":"npm version patch && git push && git push --tags","test:selenium":"npm run build && node tests/adversarial/selenium-test.js","test:puppeteer":"npm run build && node tests/adversarial/puppeteer-test.js","test:playwright":"npm run build && node tests/adversarial/playwright-test.js","test:adversarial":"npm run build && node tests/adversarial/run-all.js","build:browser:dev":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --global-name=BehaviorDetector --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.min.js","test:stress:quick":"npm run build && node tests/adversarial/detector-stress-test.js --cycles=3 --duration=5000","test:stress:intense":"npm run build && node tests/adversarial/detector-stress-test.js --cycles=10 --duration=20000"},"_npmUser":{"name":"romainbessuges","email":"romainbessuges@gmail.com"},"_npmVersion":"10.9.3","description":"Lightweight behavior detection library to assess human likelihood of user sessions","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"latest","puppeteer":"latest","typescript":"latest","chromedriver":"latest","@playwright/test":"latest","@aws-sdk/client-s3":"^3.966.0","selenium-webdriver":"latest","@aws-sdk/client-cloudfront":"^3.966.0"},"_npmOperationalInternal":{"tmp":"tmp/behavior-detection_1.0.2_1768127476613_0.2880406856183346","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@axeptio/behavior-detection","version":"1.0.3","keywords":["behavior-detection","bot-detection","user-tracking","analytics"],"author":{"name":"Axeptio"},"license":"MIT","_id":"@axeptio/behavior-detection@1.0.3","maintainers":[{"name":"romainbessuges","email":"romainbessuges@gmail.com"},{"name":"axeptiotech","email":"tech@axeptio.eu"},{"name":"a_ng_d_axeptio","email":"aurelien.grimaud@axeptio.eu"},{"name":"rombat","email":"roro.devweb@gmail.com"},{"name":"pleberre","email":"philippe.leberre@axeptio.eu"},{"name":"luisfl-axeptio","email":"luis.flores.externe@axeptio.eu"},{"name":"javier.costa-axeptio","email":"javier.costa@axeptio.eu"},{"name":"matheuscavinax","email":"matheus.cavinato@axeptio.eu"}],"dist":{"shasum":"6f15d02b39b6f0aee9139c23a682890727d534af","tarball":"https://registry.npmjs.org/@axeptio/behavior-detection/-/behavior-detection-1.0.3.tgz","fileCount":49,"integrity":"sha512-QlmzkMnXWpShEgc6vvPAsSas+EK9TDiV8nJc1Vc+AdzgHkHhJs+YNY2Yh5t/L/nuoTEDxKy6PP0pLiN/MHZ8lA==","signatures":[{"sig":"MEQCIASvK659RUCm0izkqd4B6ux4AELTLBowU/7DWnJDljhHAiAIL0H0mSRLMMlTD2QKzLndG7EfKU5DnnXFCG4T9rJgtA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":429224},"main":"./dist/cjs/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.cjs"}},"gitHead":"f6a65857809c4d5e3517b3a7aedd576b888baeb3","scripts":{"test":"npm run build && node tests/adversarial/run-tests.cjs","build":"npm run build:esm && npm run build:cjs && npm run build:types","clean":"rm -rf dist","tryme":"npm run build && node scripts/serve.cjs","deploy":"node scripts/deploy.cjs","build:all":"npm run build && npm run build:bundle && npm run build:browser","build:cjs":"esbuild dist/esm/index.js --bundle --format=cjs --platform=node --target=es2017 --outfile=dist/cjs/index.cjs","build:esm":"tsc --module es2015 --outDir dist/esm","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist","test:stress":"npm run build && node tests/adversarial/detector-stress-test.cjs","build:bundle":"npm run build:esm && esbuild dist/esm/index.js --bundle --minify --sourcemap --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.esm.min.js","build:browser":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --target=es2017 --tree-shaking=true --drop:console --drop:debugger --outfile=dist/behavior-detection.min.js","release:major":"npm version major && git push && git push --tags","release:minor":"npm version minor && git push && git push --tags","release:patch":"npm version patch && git push && git push --tags","test:selenium":"npm run build && node tests/adversarial/selenium-test.cjs","test:puppeteer":"npm run build && node tests/adversarial/puppeteer-test.cjs","test:playwright":"npm run build && node tests/adversarial/playwright-test.cjs","test:adversarial":"npm run build && node tests/adversarial/run-all.cjs","build:browser:dev":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --global-name=BehaviorDetector --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.min.js","test:stress:quick":"npm run build && node tests/adversarial/detector-stress-test.cjs --cycles=3 --duration=5000","test:stress:intense":"npm run build && node tests/adversarial/detector-stress-test.cjs --cycles=10 --duration=20000"},"_npmUser":{"name":"romainbessuges","email":"romainbessuges@gmail.com"},"_npmVersion":"10.9.3","description":"Lightweight behavior detection library to assess human likelihood of user sessions","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"latest","puppeteer":"latest","typescript":"latest","chromedriver":"latest","@playwright/test":"latest","@aws-sdk/client-s3":"^3.966.0","selenium-webdriver":"latest","@aws-sdk/client-cloudfront":"^3.966.0"},"_npmOperationalInternal":{"tmp":"tmp/behavior-detection_1.0.3_1768128177201_0.6838146532165152","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@axeptio/behavior-detection","version":"1.1.0","keywords":["behavior-detection","bot-detection","user-tracking","analytics"],"author":{"name":"Axeptio"},"license":"MIT","_id":"@axeptio/behavior-detection@1.1.0","maintainers":[{"name":"romainbessuges","email":"romainbessuges@gmail.com"},{"name":"axeptiotech","email":"tech@axeptio.eu"},{"name":"a_ng_d_axeptio","email":"aurelien.grimaud@axeptio.eu"},{"name":"rombat","email":"roro.devweb@gmail.com"},{"name":"pleberre","email":"philippe.leberre@axeptio.eu"},{"name":"luisfl-axeptio","email":"luis.flores.externe@axeptio.eu"},{"name":"javier.costa-axeptio","email":"javier.costa@axeptio.eu"},{"name":"matheuscavinax","email":"matheus.cavinato@axeptio.eu"}],"dist":{"shasum":"0d701dd5ac2da70853836cd6d2be7b4b7804390b","tarball":"https://registry.npmjs.org/@axeptio/behavior-detection/-/behavior-detection-1.1.0.tgz","fileCount":55,"integrity":"sha512-wkp2jocoYiREmoh2OAVXN4NrG3i+6QXrRzWHsB2yDLS4Gok0kV9MZEgtmpISIAeDDQBbWYiB/24eaObhrrSbQA==","signatures":[{"sig":"MEUCIQCwhEC8+s5uGHK8rt0th8T+CeIZea1WPukk1ZjHBAkKCAIgUAz9mC8y5JMBuCdswSRcatHzlzYCq4kzogZHIjljWFU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":622980},"main":"./dist/cjs/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.cjs"}},"gitHead":"2e8c91edd231f0241f73354d89f40eeeca697dd4","scripts":{"test":"npm run build && node tests/adversarial/run-tests.cjs","build":"npm run build:esm && npm run build:cjs && npm run build:types","clean":"rm -rf dist","tryme":"npm run build && node scripts/serve.cjs","deploy":"node scripts/deploy.cjs","build:all":"npm run build && npm run build:bundle && npm run build:browser","build:cjs":"esbuild dist/esm/index.js --bundle --format=cjs --platform=node --target=es2017 --outfile=dist/cjs/index.cjs","build:esm":"tsc --module es2015 --outDir dist/esm","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist","test:stress":"npm run build && node tests/adversarial/detector-stress-test.cjs","build:bundle":"npm run build:esm && esbuild dist/esm/index.js --bundle --minify --sourcemap --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.esm.min.js","build:browser":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --target=es2017 --tree-shaking=true --drop:console --drop:debugger --outfile=dist/behavior-detection.min.js","release:major":"npm version major && git push && git push --tags","release:minor":"npm version minor && git push && git push --tags","release:patch":"npm version patch && git push && git push --tags","test:selenium":"npm run build && node tests/adversarial/selenium-test.cjs","test:puppeteer":"npm run build && node tests/adversarial/puppeteer-test.cjs","test:playwright":"npm run build && node tests/adversarial/playwright-test.cjs","test:adversarial":"npm run build && node tests/adversarial/run-all.cjs","build:browser:dev":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --global-name=BehaviorDetector --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.min.js","test:stress:quick":"npm run build && node tests/adversarial/detector-stress-test.cjs --cycles=3 --duration=5000","test:stress:intense":"npm run build && node tests/adversarial/detector-stress-test.cjs --cycles=10 --duration=20000"},"_npmUser":{"name":"romainbessuges","email":"romainbessuges@gmail.com"},"_npmVersion":"10.9.3","description":"Lightweight behavior detection library to assess human likelihood of user sessions","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"latest","puppeteer":"latest","typescript":"latest","chromedriver":"latest","@playwright/test":"latest","@aws-sdk/client-s3":"^3.966.0","selenium-webdriver":"latest","@aws-sdk/client-cloudfront":"^3.966.0"},"_npmOperationalInternal":{"tmp":"tmp/behavior-detection_1.1.0_1768141875781_0.7062706503105207","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@axeptio/behavior-detection","version":"1.1.1","keywords":["behavior-detection","bot-detection","user-tracking","analytics"],"author":{"name":"Axeptio"},"license":"MIT","_id":"@axeptio/behavior-detection@1.1.1","maintainers":[{"name":"romainbessuges","email":"romainbessuges@gmail.com"},{"name":"axeptiotech","email":"tech@axeptio.eu"},{"name":"a_ng_d_axeptio","email":"aurelien.grimaud@axeptio.eu"},{"name":"rombat","email":"roro.devweb@gmail.com"},{"name":"pleberre","email":"philippe.leberre@axeptio.eu"},{"name":"luisfl-axeptio","email":"luis.flores.externe@axeptio.eu"},{"name":"javier.costa-axeptio","email":"javier.costa@axeptio.eu"},{"name":"matheuscavinax","email":"matheus.cavinato@axeptio.eu"}],"dist":{"shasum":"15353c34ef13a8aecae68cc2fa5f31c7ba2001ae","tarball":"https://registry.npmjs.org/@axeptio/behavior-detection/-/behavior-detection-1.1.1.tgz","fileCount":55,"integrity":"sha512-YIpAhAznGWdxMeUU+bXrc4Jreu7yvr8su+RGzMr7My56m0Tp0ynA0dO+sa7CsGL6f3cODbTeTdT+mbCT+pnkTA==","signatures":[{"sig":"MEUCIQDGqvtD0ypJglRljs5XFWzuf0GhtWBkyyYxzrzTIuA9IAIgO67dMa/Wxg28zKN5U5HqhPIbqKkcXgP06zNAyGg3+To=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":626997},"main":"./dist/cjs/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.cjs"}},"gitHead":"0b6fea54d24006ec4c8a9b958d527c5f23828918","scripts":{"test":"npm run build && node tests/adversarial/run-tests.cjs","build":"npm run build:esm && npm run build:cjs && npm run build:types","clean":"rm -rf dist","tryme":"npm run build && node scripts/serve.cjs","deploy":"node scripts/deploy.cjs","build:all":"npm run build && npm run build:bundle && npm run build:browser","build:cjs":"esbuild dist/esm/index.js --bundle --format=cjs --platform=node --target=es2017 --outfile=dist/cjs/index.cjs","build:esm":"tsc --module es2015 --outDir dist/esm","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist","test:stress":"npm run build && node tests/adversarial/detector-stress-test.cjs","build:bundle":"npm run build:esm && esbuild dist/esm/index.js --bundle --minify --sourcemap --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.esm.min.js","build:browser":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --target=es2017 --tree-shaking=true --drop:console --drop:debugger --outfile=dist/behavior-detection.min.js","release:major":"npm version major && git push && git push --tags","release:minor":"npm version minor && git push && git push --tags","release:patch":"npm version patch && git push && git push --tags","test:selenium":"npm run build && node tests/adversarial/selenium-test.cjs","test:puppeteer":"npm run build && node tests/adversarial/puppeteer-test.cjs","test:playwright":"npm run build && node tests/adversarial/playwright-test.cjs","test:adversarial":"npm run build && node tests/adversarial/run-all.cjs","build:browser:dev":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --global-name=BehaviorDetector --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.min.js","test:stress:quick":"npm run build && node tests/adversarial/detector-stress-test.cjs --cycles=3 --duration=5000","test:stress:intense":"npm run build && node tests/adversarial/detector-stress-test.cjs --cycles=10 --duration=20000"},"_npmUser":{"name":"axeptiotech","email":"tech@axeptio.eu"},"_npmVersion":"10.8.2","description":"Lightweight behavior detection library to assess human likelihood of user sessions","directories":{},"_nodeVersion":"20.20.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"latest","puppeteer":"latest","typescript":"latest","chromedriver":"latest","@playwright/test":"latest","@aws-sdk/client-s3":"^3.966.0","selenium-webdriver":"latest","@aws-sdk/client-cloudfront":"^3.966.0"},"_npmOperationalInternal":{"tmp":"tmp/behavior-detection_1.1.1_1771408288800_0.2757117575594463","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@axeptio/behavior-detection","version":"1.2.0","keywords":["behavior-detection","bot-detection","user-tracking","analytics"],"author":{"name":"Axeptio"},"license":"MIT","_id":"@axeptio/behavior-detection@1.2.0","maintainers":[{"name":"romainbessuges","email":"romainbessuges@gmail.com"},{"name":"axeptiotech","email":"tech@axeptio.eu"},{"name":"a_ng_d_axeptio","email":"aurelien.grimaud@axeptio.eu"},{"name":"rombat","email":"roro.devweb@gmail.com"},{"name":"pleberre","email":"philippe.leberre@axeptio.eu"},{"name":"luisfl-axeptio","email":"luis.flores.externe@axeptio.eu"},{"name":"javier.costa-axeptio","email":"javier.costa@axeptio.eu"},{"name":"matheuscavinax","email":"matheus.cavinato@axeptio.eu"}],"dist":{"shasum":"a288834f58a56c0acbd2bd30a1b35029a2f1d543","tarball":"https://registry.npmjs.org/@axeptio/behavior-detection/-/behavior-detection-1.2.0.tgz","fileCount":55,"integrity":"sha512-GYmkH2sb/Zb/CoCLF//r2MwkKd89ArzV9ZTOMZGHFXmcluJ+ICdfDmfJn5knCLGhUlLVfyDrWj16P9+OrI0nXw==","signatures":[{"sig":"MEUCIQCVX4bOLfQtLBTdq0bWM7uA2fcS1BXMRJQOlEK7K0v2/QIgccT/l9PmL/erAlQxh9phoN9rsBiv+YhD93c7C4Ehp+4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":639946},"main":"./dist/cjs/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.cjs"}},"gitHead":"6da11b7dd4f28ede79c9416d249d28688accb12d","scripts":{"test":"npm run build && node tests/adversarial/run-tests.cjs","build":"npm run build:esm && npm run build:cjs && npm run build:types","clean":"rm -rf dist","tryme":"npm run build && node scripts/serve.cjs","deploy":"node scripts/deploy.cjs","build:all":"npm run build && npm run build:bundle && npm run build:browser","build:cjs":"esbuild dist/esm/index.js --bundle --format=cjs --platform=node --target=es2017 --outfile=dist/cjs/index.cjs","build:esm":"tsc --module es2015 --outDir dist/esm","build:types":"tsc --declaration --emitDeclarationOnly --outDir dist","test:stress":"npm run build && node tests/adversarial/detector-stress-test.cjs","build:bundle":"npm run build:esm && esbuild dist/esm/index.js --bundle --minify --sourcemap --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.esm.min.js","build:browser":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --target=es2017 --tree-shaking=true --drop:console --drop:debugger --outfile=dist/behavior-detection.min.js","release:major":"npm version major && git push && git push --tags","release:minor":"npm version minor && git push && git push --tags","release:patch":"npm version patch && git push && git push --tags","test:selenium":"npm run build && node tests/adversarial/selenium-test.cjs","test:puppeteer":"npm run build && node tests/adversarial/puppeteer-test.cjs","test:playwright":"npm run build && node tests/adversarial/playwright-test.cjs","test:adversarial":"npm run build && node tests/adversarial/run-all.cjs","build:browser:dev":"npm run build:esm && esbuild dist/esm/browser.js --bundle --minify --sourcemap --format=iife --global-name=BehaviorDetector --target=es2020 --tree-shaking=true --outfile=dist/behavior-detection.min.js","test:stress:quick":"npm run build && node tests/adversarial/detector-stress-test.cjs --cycles=3 --duration=5000","test:stress:intense":"npm run build && node tests/adversarial/detector-stress-test.cjs --cycles=10 --duration=20000"},"_npmUser":{"name":"axeptiotech","email":"tech@axeptio.eu"},"_npmVersion":"10.8.2","description":"Lightweight behavior detection library to assess human likelihood of user sessions","directories":{},"_nodeVersion":"20.20.0","_hasShrinkwrap":false,"devDependencies":{"esbuild":"latest","puppeteer":"latest","typescript":"latest","chromedriver":"latest","@playwright/test":"latest","@aws-sdk/client-s3":"^3.966.0","selenium-webdriver":"latest","@aws-sdk/client-cloudfront":"^3.966.0"},"_npmOperationalInternal":{"tmp":"tmp/behavior-detection_1.2.0_1771411865938_0.6415131167669983","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-11-20T10:01:48.197Z","modified":"2026-09-14T10:07:19.033Z","1.0.0":"2025-11-20T10:01:48.491Z","1.0.1":"2026-01-11T09:56:17.149Z","1.0.2":"2026-01-11T10:31:16.738Z","1.0.3":"2026-01-11T10:42:57.384Z","1.1.0":"2026-01-11T14:31:15.947Z","1.1.1":"2026-02-18T09:51:29.001Z","1.2.0":"2026-02-18T10:51:06.115Z"},"author":{"name":"Axeptio"},"license":"MIT","keywords":["behavior-detection","bot-detection","user-tracking","analytics"],"description":"Lightweight behavior detection library to assess human likelihood of user sessions","maintainers":[{"email":"romainbessuges@gmail.com","name":"romainbessuges"},{"email":"tech@axeptio.eu","name":"axeptiotech"},{"email":"aurelien.grimaud@axeptio.eu","name":"a_ng_d_axeptio"},{"email":"philippe.leberre@axeptio.eu","name":"pleberre"},{"email":"luis.flores.externe@axeptio.eu","name":"luisfl-axeptio"},{"email":"javier.costa@axeptio.eu","name":"javier.costa-axeptio"},{"email":"matheus.cavinato@axeptio.eu","name":"matheuscavinax"}],"readme":"# @axeptio/behavior-detection\n\n> Lightweight, privacy-first behavior detection library to distinguish human users from automated bots\n\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue)](https://www.typescriptlang.org/)\n[![Tree-shakeable](https://img.shields.io/badge/tree--shakeable-yes-brightgreen.svg)]()\n\nA sophisticated JavaScript library that analyzes user behavior patterns to determine if interactions are human-like or bot-like. Unlike traditional CAPTCHA systems, this library works silently in the background, providing a seamless user experience while offering robust bot detection capabilities.\n\n## ✨ Features\n\n- **🎯 High Accuracy**: Multi-strategy detection approach with configurable weights\n- **🤖 Automation Detection**: Immediate detection of `navigator.webdriver`, headless browsers, and automation frameworks\n- **🌲 Tree-shakeable**: Import only the strategies you need\n- **🚀 Zero Dependencies**: Lightweight and fast (< 15KB minified)\n- **📱 Cross-platform**: Works on desktop and mobile browsers\n- **🔒 Privacy-first**: All processing happens client-side, no data sent to servers\n- **⚡ Real-time**: Continuously monitors and scores user behavior\n- **🎨 Framework Agnostic**: Works with vanilla JS, React, Vue, Angular, etc.\n- **📦 Multiple Build Formats**: ESM, CommonJS, and IIFE (browser CDN)\n- **🧪 Battle-tested**: Comprehensive adversarial testing against Playwright, Puppeteer, and Selenium\n\n## 🎬 Demo\n\n![Test Harness Screenshot](docs/test-harness.png)\n\nTry the interactive test harness locally:\n\n```bash\nnpm run tryme\n```\n\nThis will build the library and open the comprehensive test harness in your browser, showing real-time detection scores and visualizations as you interact with the page.\n\n**Demo Files:**\n- `demos/test-harness.html` - Full-featured interactive test harness with real-time graphs\n- `demos/browser-demo.html` - Simple CDN usage example with auto-initialization\n- `demos/example.html` - Strategy-based usage example with detailed visualizations\n\n## 📦 Installation\n\n### NPM/Yarn\n\n```bash\nnpm install @axeptio/behavior-detection\n# or\nyarn add @axeptio/behavior-detection\n```\n\n### CDN (Browser)\n\n```html\n<script src=\"https://static.axept.io/behavior-detector.latest.js\"></script>\n```\n\n## 🚀 Quick Start\n\n### Strategy-based Usage (Recommended)\n\nImport only the strategies you need for optimal bundle size:\n\n```typescript\nimport { \n  BehaviorDetector, \n  Mouse, \n  Click, \n  Keyboard, \n  Environment,\n  Timing,\n  Visibility \n} from '@axeptio/behavior-detection';\n\nconst detector = new BehaviorDetector()\n  .addStrategy(new Mouse())\n  .addStrategy(new Click())\n  .addStrategy(new Keyboard())\n  .addStrategy(new Environment())  // Detects automation frameworks\n  .addStrategy(new Timing())       // Detects machine-like timing\n  .addStrategy(new Visibility());  // Detects hidden tab actions\n\n// Start tracking\ndetector.start();\n\n// Get score (0 = bot-like, 1 = human-like)\nconst result = await detector.score({ breakdown: true });\nconsole.log('Human likelihood:', result.score);\nconsole.log('Breakdown:', result.breakdown);\n\n// Stop tracking when done\ndetector.stop();\n```\n\n### Browser CDN Usage\n\n```html\n<!DOCTYPE html>\n<html>\n<head>\n  <title>Bot Detection Demo</title>\n</head>\n<body>\n  <h1>Interact with this page</h1>\n  <button>Click me</button>\n  <input type=\"text\" placeholder=\"Type something...\">\n\n  <script src=\"https://static.axept.io/behavior-detector.latest.js\"></script>\n  <script>\n    // Configure before the script loads (or call init after)\n    window.bdSettings = {\n      autoStart: true,\n      checkMs: 2000, // Check every 2 seconds\n      onScore: (result) => {\n        console.log('Score:', result.score);\n      },\n      ifBot: (result) => {\n        console.warn('Bot detected!', result.score);\n        // Take action: show CAPTCHA, limit features, etc.\n      },\n      ifHuman: (result) => {\n        console.log('Human confirmed!', result.score);\n      },\n      botThreshold: 0.3,  // Below this = bot\n      humanThreshold: 0.7 // Above this = human\n    };\n  </script>\n</body>\n</html>\n```\n\n### Framework Examples\n\n#### React\n\n```tsx\nimport { useEffect, useRef } from 'react';\nimport { BehaviorDetector, Mouse, Click, Scroll } from '@axeptio/behavior-detection';\n\nfunction App() {\n  const detectorRef = useRef<BehaviorDetector>();\n\n  useEffect(() => {\n    const detector = new BehaviorDetector()\n      .addStrategy(new Mouse())\n      .addStrategy(new Click())\n      .addStrategy(new Scroll());\n\n    detector.start();\n    detectorRef.current = detector;\n\n    // Check score periodically\n    const interval = setInterval(async () => {\n      const result = await detector.score();\n      if (result.score < 0.3) {\n        console.warn('Bot detected!');\n        // Show CAPTCHA or take other action\n      }\n    }, 3000);\n\n    return () => {\n      clearInterval(interval);\n      detector.stop();\n    };\n  }, []);\n\n  return <div>Your app content</div>;\n}\n```\n\n#### Vue\n\n```vue\n<template>\n  <div>Your app content</div>\n</template>\n\n<script setup>\nimport { onMounted, onUnmounted } from 'vue';\nimport { BehaviorDetector, Mouse, Click, Scroll } from '@axeptio/behavior-detection';\n\nlet detector;\nlet checkInterval;\n\nonMounted(() => {\n  detector = new BehaviorDetector()\n    .addStrategy(new Mouse())\n    .addStrategy(new Click())\n    .addStrategy(new Scroll());\n\n  detector.start();\n\n  checkInterval = setInterval(async () => {\n    const result = await detector.score();\n    if (result.score < 0.3) {\n      console.warn('Bot detected!');\n    }\n  }, 3000);\n});\n\nonUnmounted(() => {\n  clearInterval(checkInterval);\n  detector?.stop();\n});\n</script>\n```\n\n## 🎯 Detection Strategies\n\nThe library uses multiple autonomous detection strategies, each analyzing different aspects of user behavior:\n\n### 🖱️ Mouse Strategy\n\n**Weight:** 0.30 (default)\n\nAnalyzes mouse movement patterns for human-like characteristics:\n\n- **Velocity Variation**: Humans have natural acceleration/deceleration (CV ~0.8-1.2)\n- **Direction Changes**: Organic curves vs. linear interpolation\n- **Movement Smoothness**: Natural micro-corrections vs. perfect paths\n- **Entry Point Analysis**: Where mouse enters the viewport\n- **Micro-movement Detection**: Natural hand tremor (1-5px jitter)\n\n```typescript\nimport { MouseStrategy } from '@axeptio/behavior-detection';\n\nconst mouse = new MouseStrategy({\n  rollingWindow: 5000 // Keep last 5 seconds of data\n});\n\ndetector.addStrategy(mouse, 0.30); // Custom weight\n```\n\n**Bot Indicators:**\n- Constant velocity movements\n- Perfect straight lines or curves\n- Instant position jumps\n- No micro-corrections or hand tremor\n- Entry at (0,0) or exact viewport center\n- No micro-movements (1-5px) before actions\n\n### 👆 Click Strategy\n\n**Weight:** 0.30 (default)\n\nMonitors click positioning accuracy and timing on interactive elements:\n\n```typescript\nimport { ClickStrategy } from '@axeptio/behavior-detection';\n\nconst click = new ClickStrategy({\n  targetSelectors: ['button', 'a', '[role=\"button\"]']\n});\n\ndetector.addStrategy(click);\n\n// Add custom targets dynamically\nclick.addTarget('.custom-clickable');\n```\n\n**Detection Patterns:**\n- ✅ **Human**: Mouse positioned over element before click\n- ⚠️ **Suspicious**: Click at exact center (pixel-perfect)\n- ❌ **Bot**: Click without mouse movement or mouse outside element\n\n**Enhanced Detection (v1.1+):**\n\n| Signal | Human | Bot |\n|--------|-------|-----|\n| Mouse-click position delta | 0px (exact match) | > 5px (mismatched) |\n| Time since last mousemove | 50-300ms | < 10ms or > 2000ms |\n| `isTrusted` event property | `true` | `false` (programmatic) |\n\nBots using `element.click()` often have click event coordinates that don't match the last mouse position, which is a strong indicator of programmatic clicks.\n\n### 📜 Scroll Strategy\n\n**Weight:** 0.15 (default)\n\nAnalyzes scrolling behavior patterns:\n\n```typescript\nimport { ScrollStrategy } from '@axeptio/behavior-detection';\n\nconst scroll = new ScrollStrategy({\n  rollingWindow: 5000\n});\n```\n\n**Bot Indicators:**\n- Identical scroll distances (smoking gun)\n- Instant jumps (programmatic scrollTo)\n- Too consistent velocity\n- No natural acceleration/deceleration\n\n### ⌨️ Keyboard Strategy\n\n**Weight:** 0.10 (default)\n\nExamines typing patterns and timing:\n\n```typescript\nimport { KeyboardStrategy } from '@axeptio/behavior-detection';\n\nconst keyboard = new KeyboardStrategy({\n  targetSelectors: ['input[type=\"text\"]', 'textarea']\n});\n\n// Add custom input targets\nkeyboard.addTarget('#custom-input');\n```\n\n**Detection Factors:**\n- Keystroke interval variation (natural human timing has CV ~0.4-0.6)\n- Key press duration variance\n- Backspace usage (error correction = human)\n- Too fast/instant key releases (<5ms = bot)\n\n### 📱 Tap Strategy (Mobile)\n\n**Weight:** 0.35 (mobile default)\n\nMobile-specific touch interaction detection:\n\n```typescript\nimport { TapStrategy } from '@axeptio/behavior-detection';\n\nconst tap = new TapStrategy({\n  targetSelectors: ['button', 'a']\n});\n```\n\n**Analyzes:**\n- Touch pressure patterns\n- Tap duration and timing\n- Multi-touch gestures\n\n### 🌐 Environment Strategy\n\n**Weight:** 0.08 (default)\n\nFingerprints browser environment for automation indicators. This strategy provides **immediate bot detection** for the most reliable automation signals.\n\n```typescript\nimport { EnvironmentStrategy } from '@axeptio/behavior-detection';\n\nconst env = new EnvironmentStrategy();\n\n// Check if automation is detected\nif (env.isLikelyBot()) {\n  console.warn('Automation detected!');\n}\n\n// Get detailed automation indicators\nconst indicators = env.getAutomationIndicators();\nconsole.log(indicators);\n// {\n//   isWebdriver: true,        // navigator.webdriver === true\n//   hasHeadlessUA: false,     // HeadlessChrome in user agent\n//   hasChromelessRuntime: true,  // Chrome without chrome.runtime\n//   hasSoftwareRenderer: false,  // SwiftShader WebGL renderer\n//   hasAutomationGlobals: false, // Selenium, Phantom, etc. globals\n//   hasCDPInjection: false,   // Chrome DevTools Protocol injection\n//   ...\n// }\n```\n\n**Immediate Disqualification Signals (returns very low scores):**\n\n| Signal | Score | Description |\n|--------|-------|-------------|\n| `navigator.webdriver === true` | 0.05 | Most reliable automation indicator |\n| Automation globals detected | 0.10 | Selenium, Phantom, Nightmare, etc. |\n| CDP injection (`cdc_*` properties) | 0.10 | Chrome DevTools Protocol |\n| Multiple headless indicators | 0.15 | Combined headless signals |\n| HeadlessChrome in user agent | 0.20 | Explicit headless mode |\n\n**Automation Globals Detected:**\n- `__selenium_evaluate`, `__webdriver_evaluate`, `__driver_evaluate`\n- `_phantom`, `callPhantom`, `__nightmare`\n- `_Selenium_IDE_Recorder`, `domAutomation`, `domAutomationController`\n- And more...\n\n**Additional Checks:**\n- Suspicious dimensions (800x600, 1024x768)\n- Missing browser features (WebGL, localStorage)\n- Plugin/MIME type inconsistencies\n- Software WebGL renderer (SwiftShader)\n- Chrome without `chrome.runtime` (headless indicator)\n\n### 📐 Resize Strategy\n\n**Weight:** 0.02 (default)\n\nMonitors window resize behavior:\n\n```typescript\nimport { ResizeStrategy } from '@axeptio/behavior-detection';\n\nconst resize = new ResizeStrategy();\n```\n\n**Detects:**\n- Programmatic resizing patterns\n- Suspicious resize timing\n- Mouse position during resize\n\n### ⏱️ Timing Strategy\n\n**Weight:** 0.15 (default)\n\nAnalyzes timing patterns in user interactions to detect bot-like precision:\n\n```typescript\nimport { TimingStrategy } from '@axeptio/behavior-detection';\n\nconst timing = new TimingStrategy();\n```\n\n**Detection Signals:**\n\n| Signal | Human Behavior | Bot Behavior |\n|--------|---------------|--------------|\n| Pre-action stillness | Micro-movements (1-5px tremor) | Perfect stillness |\n| Mouse-to-click delay | 50-300ms with variation | 0-10ms (instant) |\n| Action intervals | Variable timing | Machine-precise (100ms, 500ms, 1000ms) |\n| Hidden tab actions | None (can't interact) | Continues while hidden |\n\n**Bot Indicators:**\n- Zero mouse movement before clicks (perfect stillness)\n- Suspiciously consistent action intervals (CV < 0.15)\n- Actions at machine-precise intervals (multiples of 100ms, 500ms)\n- Any actions while `document.hidden === true`\n\n### 👁️ Visibility Strategy\n\n**Weight:** 0.10 (default)\n\nMonitors tab visibility and focus patterns:\n\n```typescript\nimport { VisibilityStrategy } from '@axeptio/behavior-detection';\n\nconst visibility = new VisibilityStrategy();\n```\n\n**Detection Signals:**\n\n| Signal | Human Behavior | Bot Behavior |\n|--------|---------------|--------------|\n| Actions while hidden | Impossible | Continues normally |\n| Resume delay | 100-500ms to refocus | Instant (< 50ms) |\n| Focus-to-type delay | 100-500ms natural delay | Instant (< 20ms) |\n\n**Bot Indicators:**\n- Actions occurring while `document.hidden === true`\n- Instant activity resume when tab becomes visible\n- Typing immediately after focus without human reaction time\n\n## 📊 API Reference\n\n### BehaviorDetector\n\nMain class for managing detection strategies.\n\n#### Constructor\n\n```typescript\nconstructor(options?: TickOptions)\n```\n\n**Options:**\n- `interval?: number` - Tick interval in milliseconds (default: 1000)\n- `pauseOnHidden?: boolean` - Automatically pause detection when tab is hidden (default: true)\n\n#### Methods\n\n##### `addStrategy(strategy: DetectionStrategy, weight?: number): this`\n\nAdd a detection strategy with optional custom weight.\n\n```typescript\ndetector.addStrategy(new Mouse(), 0.35);\n```\n\n##### `removeStrategy(name: string): this`\n\nRemove a strategy by name.\n\n```typescript\ndetector.removeStrategy('mouse');\n```\n\n##### `setStrategyEnabled(name: string, enabled: boolean): this`\n\nEnable or disable a strategy without removing it.\n\n```typescript\ndetector.setStrategyEnabled('mouse', false);\n```\n\n##### `start(): void`\n\nStart all enabled strategies.\n\n```typescript\ndetector.start();\n```\n\n##### `stop(): void`\n\nStop all strategies and cleanup listeners.\n\n```typescript\ndetector.stop();\n```\n\n##### `reset(): void`\n\nClear all collected data without stopping.\n\n```typescript\ndetector.reset();\n```\n\n##### `score(options?: ScoreOptions): Promise<ScoreResult>`\n\nCalculate the human likelihood score.\n\n```typescript\nconst result = await detector.score({\n  breakdown: true, // Include per-strategy scores\n});\n```\n\n**ScoreOptions:**\n- `breakdown?: boolean` - Include detailed breakdown of each strategy\n\n**ScoreResult:**\n```typescript\n{\n  score: number;        // 0-1 (0=bot, 1=human)\n  breakdown?: {\n    overall: number;\n    factors: {\n      mouse?: number;\n      click?: number;\n      scroll?: number;\n      keyboard?: number;\n      environment?: number;\n      // ...\n    };\n    weights: {\n      mouse: number;\n      click: number;\n      // ...\n    };\n  };\n}\n```\n\n##### `isActive(): boolean`\n\nCheck if detector is currently tracking.\n\n```typescript\nif (detector.isActive()) {\n  console.log('Detector is running');\n}\n```\n\n##### `isPaused(): boolean`\n\nCheck if detector is currently paused due to tab visibility.\n\n```typescript\nif (detector.isPaused()) {\n  console.log('Detector is paused (tab hidden)');\n}\n```\n\nNote: A detector can be both active and paused. When the tab is hidden with `pauseOnHidden: true`, the detector remains active but is temporarily paused.\n\n##### `getEventCount(): Record<string, number>`\n\nGet event counts from all strategies.\n\n##### `getStrategyDebugInfo(): Record<string, any>`\n\nGet debug information from all strategies.\n\n##### `destroy(): void`\n\nComplete cleanup and remove all strategies.\n\n```typescript\ndetector.destroy();\n```\n\n## ⚙️ Configuration\n\n### Strategy Weights\n\nCustomize how much each strategy contributes to the final score:\n\n```typescript\nconst detector = new BehaviorDetector()\n  .addStrategy(new Mouse(), 0.40)      // 40% weight\n  .addStrategy(new Click(), 0.35)      // 35% weight\n  .addStrategy(new Scroll(), 0.15)     // 15% weight\n  .addStrategy(new Keyboard(), 0.10);  // 10% weight\n```\n\n### Desktop vs Mobile\n\nThe library automatically adjusts strategies based on device type:\n\n**Desktop (default):**\n- Mouse: 0.30\n- Click: 0.30\n- Scroll: 0.15\n- Keyboard: 0.10\n- Environment: 0.08\n- Resize: 0.02\n\n**Mobile (automatic):**\n- Tap: 0.35 (replaces click)\n- Scroll: 0.35 (increased)\n- Keyboard: 0.15\n- Environment: 0.10\n- Resize: 0.05\n\n### Tick Interval\n\nControl how often strategies receive tick updates:\n\n```typescript\nconst detector = new BehaviorDetector({\n  interval: 500 // Check every 500ms\n});\n```\n\n### Automatic Pause on Hidden Tab\n\nBy default, the detector automatically pauses when the browser tab becomes hidden (using the Page Visibility API) and resumes when the tab becomes visible again. This provides several benefits:\n\n- **Better Performance**: Saves CPU cycles when the tab isn't visible\n- **Battery Life**: Reduces power consumption on mobile devices\n- **Accuracy**: Avoids collecting misleading data from background tabs\n\n```typescript\n// Default: pause on hidden (recommended)\nconst detector = new BehaviorDetector({\n  pauseOnHidden: true  // Default\n});\n\n// Disable if you need to track background behavior\nconst detector = new BehaviorDetector({\n  pauseOnHidden: false\n});\n\n// Check if currently paused\nif (detector.isPaused()) {\n  console.log('Detection is paused (tab hidden)');\n}\n```\n\n**Browser CDN Usage:**\n\n```javascript\nwindow.bdSettings = {\n  autoStart: true,\n  pauseOnHidden: true,  // Default: true\n  // ... other settings\n};\n```\n\nThe detector remains \"active\" (via `isActive()`) while paused, but strategies and tick updates are temporarily stopped until the tab becomes visible again. All collected data is preserved during the pause.\n\n## 🎨 Browser Support\n\n- ✅ Chrome/Edge 90+\n- ✅ Firefox 88+\n- ✅ Safari 14+\n- ✅ Mobile Safari (iOS 14+)\n- ✅ Chrome Mobile (Android 90+)\n\n## 🧪 Testing & Validation\n\nThe library includes comprehensive adversarial testing against popular automation frameworks:\n\n### Run All Tests\n\n```bash\nnpm run test:adversarial\n```\n\n### Individual Framework Tests\n\n```bash\n# Test against Playwright\nnpm run test:playwright\n\n# Test against Puppeteer\nnpm run test:puppeteer\n\n# Test against Selenium\nnpm run test:selenium\n\n# Stress test (extensive scenarios)\nnpm run test:stress\n```\n\n### Test Scenarios\n\nEach framework is tested with:\n\n1. **Bot-like behavior** - Rapid actions, no delays (expected: score < 0.4)\n2. **Human-like behavior** - Natural delays and movements (expected: score > 0.6)\n3. **Stealth mode** - Automation with evasion techniques\n4. **Headless vs Headed** - Different browser modes\n\nSee [tests/adversarial/README.md](tests/adversarial/README.md) for detailed testing documentation.\n\n## 🏗️ Architecture\n\n### Strategy Pattern\n\nEach detection strategy is a fully autonomous module:\n\n```typescript\ninterface DetectionStrategy {\n  readonly name: string;\n  readonly defaultWeight: number;\n  \n  start(): void;      // Register listeners\n  stop(): void;       // Cleanup\n  reset(): void;      // Clear data\n  score(): number | undefined;  // Calculate score\n  \n  onTick?(timestamp: number): void;  // Optional polling\n  getDebugInfo?(): any;              // Optional debug data\n}\n```\n\n**Benefits:**\n- 🌲 Tree-shakeable (import only what you need)\n- 🔌 Fully autonomous (manages own listeners and state)\n- 🎯 Single responsibility\n- 🧩 Easy to extend with custom strategies\n\n### Mathematical Scoring\n\nUses smooth mathematical functions instead of magic numbers:\n\n```typescript\nimport { gaussian, sigmoid, inverseSigmoid } from './math-utils';\n\n// Gaussian: ideal value with symmetric falloff\nscore = gaussian(actualCV, idealCV, width);\n\n// Sigmoid: smooth 0-1 mapping\nscore = sigmoid(value, midpoint, steepness);\n\n// Inverse sigmoid: penalize high values\nscore = inverseSigmoid(value, midpoint, steepness);\n```\n\n## 📈 Performance\n\n- **Minimal CPU Impact**: Sampling and rolling windows prevent data buildup\n- **Memory Efficient**: ~1-2MB typical memory usage\n- **No Network Calls**: Everything runs client-side\n- **Async Scoring**: Non-blocking score calculations\n\n## 🔐 Privacy & Security\n\n- ✅ **Client-side only**: No data transmitted to servers\n- ✅ **No PII collected**: Only behavioral patterns (no keystrokes content)\n- ✅ **GDPR friendly**: No cookies, no tracking, no storage\n- ✅ **Transparent**: Open source and auditable\n\n## 🛠️ Development\n\n### Build\n\n```bash\n# Build all formats (ESM, CJS, IIFE)\nnpm run build:all\n\n# Build only ESM/CJS\nnpm run build\n\n# Build browser bundle\nnpm run build:browser\n```\n\n### Project Structure\n\n```\nbehavior-detection/\n├── src/\n│   ├── behavior-detector.ts    # Main detector class\n│   ├── strategy.ts              # Strategy interface\n│   ├── types.ts                 # TypeScript types\n│   ├── math-utils.ts            # Mathematical functions\n│   ├── browser.ts               # Browser CDN wrapper\n│   └── strategies/\n│       ├── mouse.ts             # Mouse movement + entry point detection\n│       ├── click.ts             # Click accuracy + position delta\n│       ├── scroll.ts            # Scroll behavior detection\n│       ├── keyboard.ts          # Keyboard timing detection\n│       ├── tap.ts               # Mobile tap detection\n│       ├── environment.ts       # Automation + headless detection\n│       ├── timing.ts            # Action timing patterns\n│       ├── visibility.ts        # Tab visibility behavior\n│       └── resize.ts            # Window resize detection\n├── dist/                        # Build output\n├── demos/\n│   ├── test-harness.html        # Interactive testing UI with graphs\n│   ├── browser-demo.html        # CDN usage example\n│   └── example.html             # Strategy-based usage example\n├── tests/\n│   └── adversarial/             # Automation framework tests\n└── docs/                        # Documentation assets\n```\n\n### Scripts\n\n```bash\nnpm run build           # Build library (ESM + CJS)\nnpm run build:all       # Build all formats\nnpm run build:browser   # Build browser IIFE bundle\nnpm run clean           # Clean dist directory\nnpm run tryme           # Build and start demo server\nnpm run deploy          # Deploy to CDN (AWS S3/CloudFront)\nnpm run test            # Run basic tests\nnpm run test:adversarial # Run all adversarial tests\nnpm run test:stress     # Stress test with extensive scenarios\n```\n\n## 🤝 Contributing\n\nContributions are welcome! This library can be extended with:\n\n- **New strategies**: Add detection for new behavioral patterns\n- **Improved algorithms**: Enhance existing detection logic\n- **Mobile optimizations**: Better touch/gesture detection\n- **Performance improvements**: Reduce overhead\n- **Test coverage**: Add more adversarial test scenarios\n\n### Creating Custom Strategies\n\n```typescript\nimport { DetectionStrategy } from '@axeptio/behavior-detection';\n\nexport class CustomStrategy implements DetectionStrategy {\n  readonly name = 'custom';\n  readonly defaultWeight = 0.10;\n  \n  private data: any[] = [];\n  private listener: any;\n  \n  start(): void {\n    this.listener = (e: Event) => {\n      // Collect data\n      this.data.push(/* ... */);\n    };\n    document.addEventListener('someevent', this.listener);\n  }\n  \n  stop(): void {\n    if (this.listener) {\n      document.removeEventListener('someevent', this.listener);\n    }\n  }\n  \n  reset(): void {\n    this.data = [];\n  }\n  \n  score(): number | undefined {\n    if (this.data.length < 5) return undefined;\n    \n    // Calculate and return score (0-1)\n    return 0.85;\n  }\n  \n  getDebugInfo() {\n    return {\n      eventCount: this.data.length,\n      data: this.data\n    };\n  }\n}\n```\n\n## 📝 Use Cases\n\n- **Form Protection**: Detect automated form submissions\n- **Account Security**: Identify credential stuffing attacks\n- **E-commerce**: Prevent inventory hoarding bots\n- **Analytics**: Filter bot traffic from user metrics\n- **Rate Limiting**: Adaptive limits based on behavior\n- **A/B Testing**: Exclude bots from experiments\n- **Progressive CAPTCHAs**: Only show CAPTCHA to suspicious users\n\n## 🎯 Detection Thresholds\n\nRecommended score interpretation:\n\n| Score Range | Interpretation | Action |\n|-------------|---------------|--------|\n| 0.8 - 1.0   | Very likely human | Full access |\n| 0.6 - 0.8   | Probably human | Monitor |\n| 0.3 - 0.6   | Suspicious | Add friction (CAPTCHA) |\n| 0.0 - 0.3   | Very likely bot | Block or severely limit |\n\n**Note:** Thresholds should be tuned based on your specific use case and acceptable false positive rate.\n\n## ⚠️ Limitations\n\n- **Not foolproof**: Sophisticated bots with human-like behavior can evade detection\n- **Initial period**: Requires user interaction to build confidence\n- **False positives**: Accessibility tools, keyboard-only navigation may score lower\n- **Context matters**: Some legitimate use cases (automation testing, scripts) will be flagged\n\n**Best Practice:** Use as one layer in a defense-in-depth strategy, not as the sole security measure.\n\n## 📄 License\n\nProprietary © [Axeptio](https://www.axeptio.eu)\n\n## 🙏 Acknowledgments\n\n- Inspired by research in behavioral biometrics and bot detection\n- Built with TypeScript for type safety\n- Tested against real-world automation frameworks\n- Mathematical approach based on statistical pattern recognition\n\n---\n\n**Made with ❤️ by [Axeptio](https://www.axeptio.eu)**\n\n","readmeFilename":"README.md"}