@livx.cc/native-kit 0.26.0 → 0.27.0

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@livx.cc/native-kit",
3
- "version": "0.26.0",
4
- "description": "Isomorphic native-capabilities kit for PWAs — same API in browser and in an appwrap native shell. Zero dependencies.",
3
+ "version": "0.27.0",
4
+ "description": "Isomorphic native-capabilities kit for PWAs \u2014 same API in browser and in an appwrap native shell. Zero dependencies.",
5
5
  "license": "MIT",
6
6
  "author": "Elya Livshitz",
7
7
  "homepage": "https://github.com/Livshitz/appwrap#readme",
@@ -37,7 +37,8 @@
37
37
  "src"
38
38
  ],
39
39
  "scripts": {
40
- "build": "bun build src/index.ts --outdir=dist --format=esm && bun build src/index.ts --outfile=dist/native-kit.iife.js --format=iife --global-name=NativeKitLib"
40
+ "typecheck": "tsc --noEmit",
41
+ "build": "tsc --noEmit && bun build src/index.ts --outdir=dist --format=esm && bun build src/index.ts --outfile=dist/native-kit.iife.js --format=iife --global-name=NativeKitLib"
41
42
  },
42
43
  "devDependencies": {
43
44
  "typescript": "^5.4.0"
@@ -53,7 +53,9 @@ export class ScannerModule {
53
53
 
54
54
  /** Open the scanner; resolve the first code, or `{ cancelled: true }` if dismissed. */
55
55
  scan(opts: ScanOptions = {}): Promise<ScanResult | ScanCancelled> {
56
- return this.kit.invoke('scanner.scan', opts);
56
+ // Open-ended: the camera stays up until a code is found or the user cancels — lining up a QR
57
+ // routinely takes longer than the 10s invoke default, which would abandon the scan mid-aim.
58
+ return this.kit.invoke('scanner.scan', opts, { timeoutMs: 300_000 });
57
59
  }
58
60
 
59
61
  /** Dismiss an in-progress {@link scan} (its promise then resolves `{ cancelled: true }`). */
@@ -68,7 +68,9 @@ export class SpeechModule {
68
68
 
69
69
  /** Speak `text` aloud; resolves when the utterance finishes (or is stopped). */
70
70
  speak(text: string, opts: SpeakOptions = {}): Promise<void> {
71
- return this.kit.invoke('speech.speak', { text, ...opts });
71
+ // Resolves only when the utterance (or its queue) finishes — easily exceeds the 10s invoke
72
+ // default for longer text or back-to-back speak() calls, dropping the result. Give it room.
73
+ return this.kit.invoke('speech.speak', { text, ...opts }, { timeoutMs: 120_000 });
72
74
  }
73
75
 
74
76
  /** Cancel the current/queued utterance immediately. */
@@ -84,7 +86,9 @@ export class SpeechModule {
84
86
  /** Start capturing the mic; resolves the FINAL transcript. With `{ partial:true }`, interim
85
87
  * results stream via {@link onPartial}. Throws `KitError('UNSUPPORTED')` where STT is absent. */
86
88
  listen(opts: ListenOptions = {}): Promise<string> {
87
- return this.kit.invoke('speech.listen', opts);
89
+ // Open-ended: resolves on the final result or when stopListening() is called — a person may take
90
+ // a while to speak, so it must not be cut off by the 10s invoke default.
91
+ return this.kit.invoke('speech.listen', opts, { timeoutMs: 600_000 });
88
92
  }
89
93
 
90
94
  /** Stop capture early; the pending {@link listen} resolves with the best transcript so far. */