{"_id":"@attenlabs/sas-js","_rev":"6-1c545ae3e9e65b883df88f163ac21eef","name":"@attenlabs/sas-js","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@attenlabs/sas-js","version":"0.1.0","keywords":["sd-attention","attention","sas","audio","video","vad","realtime","websocket"],"author":{"name":"Attention Labs","email":"omar@attentionlabs.ai"},"license":"MIT","_id":"@attenlabs/sas-js@0.1.0","maintainers":[{"name":"omar_e","email":"omar@attentionlabs.ai"}],"homepage":"https://attentionlabs.ai","dist":{"shasum":"3cfd6c25cc8994d4c775092711dcbd2c211ce9f1","tarball":"https://registry.npmjs.org/@attenlabs/sas-js/-/sas-js-0.1.0.tgz","fileCount":28,"integrity":"sha512-yGrIpadXSIYDWSokE7yClJkPjvVPPYX/7+BviDGX6LH+taAjojfknKvNUueNJZl7xyZr8sabshvOv+it8loAXw==","signatures":[{"sig":"MEQCICp7k19ykAoRqptAg6rJ/+R3HAp5/NG1V3C+yVgR6pAFAiBhDGSnqHHUkoZ1EWxe2055m+md8JPCXvjVcBAFGZdZkA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57521},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./audio-processor.js":"./dist/audio-processor.js"},"gitHead":"5cbc80896288a7b1f8fd1a54cc076a69c1172279","scripts":{"build":"npx tsc && cp src/audio-processor.js dist/audio-processor.js","clean":"rm -rf dist","prebuild":"node scripts/embed-worklet.mjs","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"omar_e","email":"omar@attentionlabs.ai"},"_npmVersion":"10.9.3","description":"Browser JS SDK for the SD Attention Server (SAS). Streams microphone + webcam to the inference server and emits typed events for predictions, VAD, conversation state, and speech audio ready for downstream LLM use.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.0"},"_npmOperationalInternal":{"tmp":"tmp/sas-js_0.1.0_1777149751565_0.3478663623948639","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Renamed to @attenlabs/saa-js. Please install @attenlabs/saa-js instead."},"0.1.1":{"name":"@attenlabs/sas-js","version":"0.1.1","keywords":["sd-attention","attention","sas","audio","video","vad","realtime","websocket"],"author":{"name":"Attention Labs","email":"omar@attentionlabs.ai"},"license":"MIT","_id":"@attenlabs/sas-js@0.1.1","maintainers":[{"name":"omar_e","email":"omar@attentionlabs.ai"}],"homepage":"https://attentionlabs.ai","dist":{"shasum":"4fce5f7133f2a386f4cee581b7c6efbd1c379da3","tarball":"https://registry.npmjs.org/@attenlabs/sas-js/-/sas-js-0.1.1.tgz","fileCount":28,"integrity":"sha512-BQ/vK98RXyCkpPIbF1ensLQdSufbNMBBKXEMSKsNNEg28MeqhMU3u4DK1RfP/YuD8C068hRcsfabb6x/qgnXcw==","signatures":[{"sig":"MEUCIQDP9NNef7Ya76QTbjdAnFRTBYyU1oXUn6zcFmZxaGvjcAIgaHUIfnqFq2R9+b3DQM8AmDf9nxCUlRQO3FpE07Kkp68=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55011},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./audio-processor.js":"./dist/audio-processor.js"},"gitHead":"5cbc80896288a7b1f8fd1a54cc076a69c1172279","scripts":{"build":"npx tsc && cp src/audio-processor.js dist/audio-processor.js","clean":"rm -rf dist","prebuild":"node scripts/embed-worklet.mjs","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"omar_e","email":"omar@attentionlabs.ai"},"_npmVersion":"10.9.3","description":"Browser JS SDK for the SD Attention Server (SAS). Streams microphone + webcam to the inference server and emits typed events for predictions, VAD, conversation state, and speech audio ready for downstream LLM use.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.0"},"_npmOperationalInternal":{"tmp":"tmp/sas-js_0.1.1_1777302595067_0.6749534199397083","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Renamed to @attenlabs/saa-js. Please install @attenlabs/saa-js instead."},"0.1.2":{"name":"@attenlabs/sas-js","version":"0.1.2","keywords":["sd-attention","attention","sas","audio","video","vad","realtime","websocket"],"author":{"name":"Attention Labs","email":"omar@attentionlabs.ai"},"license":"MIT","_id":"@attenlabs/sas-js@0.1.2","maintainers":[{"name":"omar_e","email":"omar@attentionlabs.ai"}],"homepage":"https://attentionlabs.ai","dist":{"shasum":"8e35513bcd99b3ad0be09e2050cb79621eb63982","tarball":"https://registry.npmjs.org/@attenlabs/sas-js/-/sas-js-0.1.2.tgz","fileCount":28,"integrity":"sha512-wucCjkU9Lt05vM5hby+KqEG5h5J9vejg9dUbmkjJSluhrBMcskQ+bibgUmy8eu3XRUHi7HbLUxVHEBzZ/lTsgQ==","signatures":[{"sig":"MEUCIQDPG+bZqLiDZvRJuvdGo69/EbPVUyw71nTztj3+w3ZtxQIgNY27hUTyXB6zBwOXHr+NPrRp7l7fciI2YMQiUkekcmU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55281},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./audio-processor.js":"./dist/audio-processor.js"},"gitHead":"c035340ab3c4524449d7b58ff6275addb42d54e0","scripts":{"build":"npx tsc && cp src/audio-processor.js dist/audio-processor.js","clean":"rm -rf dist","prebuild":"node scripts/embed-worklet.mjs","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"omar_e","email":"omar@attentionlabs.ai"},"_npmVersion":"10.9.3","description":"Browser JS SDK for the SD Attention Server (SAS). Streams microphone + webcam to the inference server and emits typed events for predictions, VAD, conversation state, and speech audio ready for downstream LLM use.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.0"},"_npmOperationalInternal":{"tmp":"tmp/sas-js_0.1.2_1778199569812_0.7028497747345306","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Renamed to @attenlabs/saa-js. Please install @attenlabs/saa-js instead."},"0.2.0":{"name":"@attenlabs/sas-js","version":"0.2.0","keywords":["sd-attention","attention","sas","audio","video","vad","realtime","websocket"],"author":{"name":"Attention Labs","email":"omar@attentionlabs.ai"},"license":"MIT","_id":"@attenlabs/sas-js@0.2.0","maintainers":[{"name":"omar_e","email":"omar@attentionlabs.ai"}],"homepage":"https://attentionlabs.ai","dist":{"shasum":"1c440f8dae25ff8106f211b7c523357dedb52f7d","tarball":"https://registry.npmjs.org/@attenlabs/sas-js/-/sas-js-0.2.0.tgz","fileCount":28,"integrity":"sha512-MLWVlA04Sb643Ujwa6FoQXJoNQzYYe4GSvK0As0PcxXpdXCGu8nrqKvj4D8O+NGBk/SMPso6D02It6BXxOo5zQ==","signatures":[{"sig":"MEUCIQCkEtFkoHifwGPFAu/knr1OEFRuOi43zqhbBI//Dt1aZQIgXAXqnbPreg7q8RijgT0OHp5xgCL7vJhfuWyd5PTU6QM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57983},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./audio-processor.js":"./dist/audio-processor.js"},"gitHead":"ddc7bd79acb195ab063679c860ca90fc9be2db71","scripts":{"build":"npx tsc && cp src/audio-processor.js dist/audio-processor.js","clean":"rm -rf dist","prebuild":"node scripts/embed-worklet.mjs","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"omar_e","email":"omar@attentionlabs.ai"},"_npmVersion":"10.9.3","description":"Browser JS SDK for the SD Attention Server (SAS). Streams microphone + webcam to the inference server and emits typed events for predictions, VAD, conversation state, and speech audio ready for downstream LLM use.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.0"},"_npmOperationalInternal":{"tmp":"tmp/sas-js_0.2.0_1778259509627_0.022999318842562788","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Renamed to @attenlabs/saa-js. Please install @attenlabs/saa-js instead."},"0.2.1":{"name":"@attenlabs/sas-js","version":"0.2.1","keywords":["sd-attention","attention","sas","audio","video","vad","realtime","websocket"],"author":{"name":"Attention Labs","email":"omar@attentionlabs.ai"},"license":"MIT","_id":"@attenlabs/sas-js@0.2.1","maintainers":[{"name":"omar_e","email":"omar@attentionlabs.ai"}],"homepage":"https://attentionlabs.ai","dist":{"shasum":"8d18839a994f2ff08f75a9806e99bb91ebde5582","tarball":"https://registry.npmjs.org/@attenlabs/sas-js/-/sas-js-0.2.1.tgz","fileCount":28,"integrity":"sha512-or7miVzQRHkoMwBwejSKISwisMyTfVInPWAKqVDrswbweo8/0pKN2yM+4fdASVhBmLUHOfDpl1ZPB0pdQIjLdw==","signatures":[{"sig":"MEYCIQDGJg41v65tWUIHWTG00dzguiYjsmbbqA5LWwnL3+3v2wIhAPLp4NJgj8CDB+a56d1SDVKuPcXJrY5ZKoeqQI0Izpaw","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61166},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./audio-processor.js":"./dist/audio-processor.js"},"gitHead":"4f21329b9d9e9b53de1dcc998c62ed3de1cc46e9","scripts":{"build":"npx tsc && cp src/audio-processor.js dist/audio-processor.js","clean":"rm -rf dist","prebuild":"node scripts/embed-worklet.mjs","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"omar_e","email":"omar@attentionlabs.ai"},"_npmVersion":"10.9.3","description":"Browser JS SDK for the SD Attention Server (SAS). Streams microphone + webcam to the inference server and emits typed events for predictions, VAD, conversation state, and speech audio ready for downstream LLM use.","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.0"},"_npmOperationalInternal":{"tmp":"tmp/sas-js_0.2.1_1778684992175_0.07775934762045478","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Renamed to @attenlabs/saa-js. Please install @attenlabs/saa-js instead."}},"time":{"created":"2026-04-25T20:42:31.499Z","modified":"2026-05-14T15:11:59.725Z","0.1.0":"2026-04-25T20:42:31.706Z","0.1.1":"2026-04-27T15:09:55.277Z","0.1.2":"2026-05-08T00:19:29.960Z","0.2.0":"2026-05-08T16:58:29.779Z","0.2.1":"2026-05-13T15:09:52.339Z"},"author":{"name":"Attention Labs","email":"omar@attentionlabs.ai"},"license":"MIT","homepage":"https://attentionlabs.ai","keywords":["sd-attention","attention","sas","audio","video","vad","realtime","websocket"],"description":"Browser JS SDK for the SD Attention Server (SAS). Streams microphone + webcam to the inference server and emits typed events for predictions, VAD, conversation state, and speech audio ready for downstream LLM use.","maintainers":[{"name":"omar_e","email":"omar@attentionlabs.ai"}],"readme":"# @attenlabs/sas-js\n\nJavaScript SDK for [Attention Labs](https://attentionlabs.ai) real-time attention detection.\n\n## Sign up\n\nGet your API token at [attentionlabs.ai/dashboard](https://attentionlabs.ai/dashboard).\n\n## Install\n\n```bash\nnpm install @attenlabs/sas-js\n```\n\n## Quick start\n\n```ts\nimport { AttentionClient } from \"@attenlabs/sas-js\";\n\nconst videoEl = document.querySelector(\"video\");\n\nconst client = new AttentionClient({\n  token: \"your-auth-token\",\n});\n\nclient.on(\"prediction\", ({ cls, confidence, source, numFaces }) => {\n  console.log(`${cls}: ${confidence.toFixed(2)}`);\n});\n\nclient.on(\"speechReady\", ({ audioBase64, durationSec }) => {\n  // Forward captured speech to your LLM of choice\n});\n\nawait client.start({ videoElement: videoEl });\n```\n\n## Options\n\n| Option             | Type     | Default                              | Description |\n| ------------------ | -------- | ------------------------------------ | ----------- |\n| `token`            | string   | —                                    | Your API token from the dashboard. |\n| `initialThreshold` | number   | `0.7`                                | Confidence threshold for predictions (0–1). |\n| `video.width`      | number   | `1920`                               | Capture width. |\n| `video.height`     | number   | `1080`                               | Capture height. |\n| `video.jpegQuality`| number   | `0.6`                                | JPEG quality (0–1). |\n\n## Methods\n\n| Method                      | Description |\n| --------------------------- | ----------- |\n| `start({ videoElement })`   | Start streaming. Requests mic + camera access and connects to the server. |\n| `stop()`                    | Stop streaming and disconnect. |\n| `mute()` / `unmute()`       | Pause or resume audio. |\n| `markResponding(boolean)`   | Signal that your app is responding — pauses predictions until finished. |\n| `setThreshold(value)`       | Update the confidence threshold (0–1). |\n| `on(event, listener)`       | Subscribe to an event. Returns an unsubscribe function. |\n\n## Events\n\n| Event            | Payload |\n| ---------------- | ------- |\n| `connected`      | — |\n| `started`        | — |\n| `prediction`     | `{ cls, confidence, source, numFaces }` |\n| `vad`            | `{ probability, isSpeech }` |\n| `state`          | `{ state }` — one of `listening`, `sending`, `cancelled`, `idle` |\n| `speechReady`    | `{ audioBase64, audioPcm16, durationSec }` |\n| `error`          | `{ title, message, detail }` |\n| `disconnected`   | `{ code, reason }` |\n\n## LLM integration\n\nThe SDK captures speech but does **not** route it to an LLM. Use the `speechReady` event to forward audio to any model you like.\n\nWhen your LLM starts responding, call `client.mute()` and `client.markResponding(true)`. When it finishes, call `client.unmute()` and `client.markResponding(false)`.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}