Skip to content

feat(ai): namespace local voiceprints - #407

Open
abroa01 wants to merge 1 commit into
mainfrom
feat/namespaced-voiceprints
Open

feat(ai): namespace local voiceprints#407
abroa01 wants to merge 1 commit into
mainfrom
feat/namespaced-voiceprints

Conversation

@abroa01

@abroa01 abroa01 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add an optional voiceprintNamespace across Hey Ozwell verification, enrollment, and voice management
  • isolate WHO and WHAT voiceprints for users sharing the same browser profile
  • preserve existing unscoped behavior while preventing scoped users from inheriting legacy unscoped records
  • rehydrate and clear runtime voiceprint state when the namespace changes

Security

Voiceprints remain on-device in IndexedDB. The namespace separates local records; speaker verification remains a wake filter and is not an authentication mechanism.

Validation

  • pnpm typecheck
  • pnpm lint
  • pnpm format
  • focused voiceprint tests: 6 passed
  • full test suite: 567 passed across 48 files

Copilot AI lite review requested due to automatic review settings August 31, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an optional voiceprintNamespace that scopes on-device voiceprint persistence (WHO speaker centroids + WHAT wake phrase templates) so multiple users sharing the same browser profile don’t bleed enrollment into one another, while preserving legacy unscoped behavior.

Changes:

  • Added a namespaced storage key helper and extended WHAT voiceprint load/save/clear to support optional namespaces (with legacy migration only for unscoped reads).
  • Plumbed voiceprintNamespace through HandsFreeChat → Hey Ozwell hooks/components → SpeakerVerify runtime, including namespace-aware hydration and readiness gating.
  • Added focused tests validating namespace isolation and legacy/unscoped behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/components/AI/voiceprintStore.ts Adds voiceprintStorageKey and updates WHAT voiceprint persistence APIs to be namespace-aware.
src/components/AI/voiceprintStore.test.ts Adds tests for namespace isolation, selective clearing, and legacy unscoped behavior.
src/components/AI/HeyOzwell/VoiceSetup.tsx Exposes voiceprintNamespace prop and forwards it into useVoiceSetup.
src/components/AI/HeyOzwell/VoiceManager.tsx Exposes voiceprintNamespace, scopes speaker verify + WHAT clearing, and forwards into enrollment UI.
src/components/AI/HeyOzwell/useVoiceSetup.ts Uses namespaced speaker verify and loads/saves WHAT prints per namespace.
src/components/AI/HeyOzwell/useHeyOzwell.ts Loads WHAT prints by namespace and attempts to clear runtime templates on namespace changes.
src/components/AI/HeyOzwell/SpeakerVerify/useSpeakerVerify.ts Adds namespace option, loads the namespace explicitly, and gates readiness on correct namespace hydration.
src/components/AI/HeyOzwell/SpeakerVerify/lib/speaker-verify.js Implements namespace-aware WHO persistence via shared IndexedDB helpers and adds loadNamespace.
src/components/AI/HeyOzwell/HandsFreeChat.tsx Exposes voiceprintNamespace and forwards it into useHeyOzwell and VoiceManager.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +18 to +23
export function voiceprintStorageKey(key: string, namespace?: string): string {
if (namespace === undefined) return key;
if (namespace.trim().length === 0)
throw new Error('Voiceprint namespace must not be empty');
return `${key}:${encodeURIComponent(namespace)}`;
}
Comment on lines +601 to 605
wakeRef.current?.setVoiceprint('hey-ozwell', []);
wakeRef.current?.setVoiceprint("ozwell-i'm-done", []);
void loadWhatPrints(voiceprintNamespace).then((loaded) => {
if (cancelled) return;
for (const k in loaded) wakeRef.current?.setVoiceprint(k, loaded[k]);
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5b69382
Status: ✅  Deploy successful!
Preview URL: https://3b498fa2.ui-6d0.pages.dev
Branch Preview URL: https://feat-namespaced-voiceprints.ui-6d0.pages.dev

View logs

@garrity-miepub
garrity-miepub self-requested a review September 1, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants