{"_id":"@cutos/ai-face-service","name":"@cutos/ai-face-service","dist-tags":{"latest":"4.0.0"},"versions":{"4.0.0":{"name":"@cutos/ai-face-service","version":"4.0.0","description":"CUTOS 4.0 Gateway-backed AI face service SDK.","type":"module","main":"dist/index.js","module":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","clean":"node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"","prepack":"npm run build"},"keywords":["CUTOS","AI","face","service","Gateway"],"author":{"name":"SipTimes"},"license":"SipTimes","dependencies":{"@cutos/gw-client":"^1.0.9"},"devDependencies":{"typescript":"^5.5.4"},"_id":"@cutos/ai-face-service@4.0.0","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-epZr8sVhiwLRoyfru8qkFYyoxYBXA1USppeAnKwskLIUAdnhYO1T8U06CBt0roY1Os4muqYqf2IaEEOs+Mg81A==","shasum":"36e97c372f7b5955da5b87cd5be0d7da951a553c","tarball":"https://registry.npmjs.org/@cutos/ai-face-service/-/ai-face-service-4.0.0.tgz","fileCount":14,"unpackedSize":23991,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIATS5ey408L9VsUSA692R/6PewT0dz5HJot0q3lCLwKvAiAq7gGab9vsHTs9T7c7hWOY91G27ux6Fp+9v5fE4agV/Q=="}]},"_npmUser":{"name":"siptimes","email":"tech@siptimes.com"},"directories":{},"maintainers":[{"name":"siptimes","email":"tech@siptimes.com"},{"name":"kdreaming","email":"kdream0319@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-face-service_4.0.0_1785054460144_0.00025322304620578606"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-26T08:27:39.957Z","4.0.0":"2026-07-26T08:27:40.338Z","modified":"2026-07-26T08:27:40.695Z"},"maintainers":[{"name":"siptimes","email":"tech@siptimes.com"},{"name":"kdreaming","email":"kdream0319@gmail.com"}],"description":"CUTOS 4.0 Gateway-backed AI face service SDK.","keywords":["CUTOS","AI","face","service","Gateway"],"author":{"name":"SipTimes"},"license":"SipTimes","readme":"# CUTOS AI Face Service\n\n`@cutos/ai-face-service` is the CUTOS 4.0 SDK for the Gateway-backed AI face service. It provides face collection creation, registration, lookup, search, comparison, removal, and clearing.\n\nThis package does not perform browser-side face detection. Use `@cutos/ai-face-detector` to detect and capture a face, then send its `fullFrame` or `face` image to this service.\n\n## Gateway Compatibility\n\nThe SDK preserves the existing `@cutos/gw-client` protocol and the `ai-face2` Gateway service. The LWA owns Gateway connection setup and passes its connected `IPC` instance to `FaceService`.\n\nBy default, the service uses the existing `default` face collection for the current Gateway. Set `lwaName` to opt into an LWA-specific collection.\n\n`create`, `register`, `search`, `compare`, and `unregister` use the original service protocol. `userId`, saved images, `getByUserId`, `list`, and `clear` require an `ai-face2` deployment that includes the face-record management commands.\n\n## Install\n\n```bash\nnpm install @cutos/ai-face-service @cutos/gw-client\n```\n\n## Usage\n\n```ts\nimport { CoreAPI } from '@cutos/core'\nimport { IPC } from '@cutos/gw-client'\nimport { FaceService } from '@cutos/ai-face-service'\n\nconst device = await CoreAPI.getDeviceInfo()\nconst gateway = new IPC(device.gwUrl, {\n  gwi: device.gwi,\n  username: device.id,\n  token: device.token,\n})\n\nconst faces = new FaceService(gateway)\nawait faces.init()\n\nconst id = await faces.register(faceImage, { userId: 'u-1001', saveImage: true })\nconst record = await faces.getByUserId('u-1001', { includeImage: true })\nconst match = await faces.search(faceImage)\nconst score = await faces.compare(imageA, imageB)\nawait faces.unregister(id)\n```\n\n`faceImage`, `imageA`, and `imageB` accept either a raw base64 string or a `data:image/...;base64,...` URL.\n\n`userId` is optional, but unique within the selected collection when supplied. Registration images are only persisted when `saveImage` is `true`; `getByUserId` and `list` only return them when `includeImage` is `true`. Search results never return saved registration images. `clear()` removes every registered face from the selected collection.\n\n```ts\nconst records = await faces.list({ limit: 20 })\nawait faces.clear()\n```\n\n## Development\n\n```bash\nnpm run build\nnpm pack\n```\n","readmeFilename":"README.md","_rev":"1-56236e79bbd1c74a6720d445d3907e07"}