Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

742 B
Raw Blame
// Realtime delivery follows the foreground tab. Microphone publishing keeps
// its own non-stealing lease until that tab explicitly releases the device.
export async function tryAcquireVoicePublisherLease(
  tenantId: string,
  locks = globalThis.navigator?.locks,
): Promise<(() => void) | undefined> {
  if (!locks) return () => undefined;
  return new Promise((resolve, reject) => {
    void locks
      .request(
        `linger:voice-publisher:${tenantId}`,
        { mode: "exclusive", ifAvailable: true },
        async (lock) => {
          if (!lock) {
            resolve(undefined);
            return;
          }
          await new Promise<void>((release) => resolve(release));
        },
      )
      .catch(reject);
  });
}