@neuralmux/omp-superwhisper 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,9 +22,17 @@ async function getGitBranch(cwd: string): Promise<string | undefined> {
22
22
  }
23
23
  }
24
24
 
25
- export default async function superwhisperExtension(pi: ExtensionAPI): Promise<void> {
25
+ export default function superwhisperExtension(pi: ExtensionAPI): void {
26
26
  const host: HostOps = getHostOps()
27
- const { scheme } = await host.detect()
27
+ // Lazy detect on first use so the factory stays synchronous.
28
+ // OMP's extension loader does not await async factories.
29
+ let _scheme: Promise<string> | null = null
30
+ const getScheme = (): Promise<string> => {
31
+ if (!_scheme) {
32
+ _scheme = host.detect().then((d) => d.scheme)
33
+ }
34
+ return _scheme
35
+ }
28
36
 
29
37
  const DEBUG = !!process.env.SUPERWHISPER_DEBUG
30
38
  const LOG_FILE = `${MESSAGE_DIR}/debug.log`
@@ -94,9 +102,9 @@ export default async function superwhisperExtension(pi: ExtensionAPI): Promise<v
94
102
  return false
95
103
  }
96
104
 
97
- function sendDismiss(sessionId: string, source: string) {
105
+ async function sendDismiss(sessionId: string, source: string) {
98
106
  log("debug", `Sending dismiss via inbox (${source}) for session=${sessionId}`)
99
- host.deliverPayload({ kind: "dismiss", sessionId }, scheme).catch((err) => {
107
+ host.deliverPayload({ kind: "dismiss", sessionId }, await getScheme()).catch((err) => {
100
108
  log("error", `Failed to send dismiss for session=${sessionId}: ${err}`)
101
109
  })
102
110
  }
@@ -152,7 +160,7 @@ export default async function superwhisperExtension(pi: ExtensionAPI): Promise<v
152
160
  title,
153
161
  hookPid: process.pid,
154
162
  },
155
- scheme,
163
+ await getScheme(),
156
164
  )
157
165
  } catch (err) {
158
166
  log("error", `Failed to deliver Superwhisper payload — ${err}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuralmux/omp-superwhisper",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Superwhisper voice integration extension for Oh My Pi — get voice notifications when tasks complete",
5
5
  "type": "module",
6
6
  "keywords": [