termux-stt 1.2.7 → 1.2.9

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/bin/termux-stt.js CHANGED
@@ -1,35 +1,51 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  /**
4
- * termux-stt CLI for Node.js / npx
3
+ * AMEVA Standard Node.js CLI Runner for termux_stt.
4
+ * Automatically resolves Python 3 environment and dispatches to python -m termux_stt.
5
5
  */
6
+ const fs = require('fs');
7
+ const { spawn, execSync } = require('child_process');
6
8
 
7
- const { spawn, spawnSync } = require('child_process');
8
-
9
- const args = process.argv.slice(2);
10
-
11
- function getPythonExecutable() {
12
- if (process.env.PYTHON) return process.env.PYTHON;
13
- const candidates = process.platform === 'win32'
14
- ? ['py', 'python3', 'python']
15
- : ['python3', 'python'];
9
+ function findPython() {
10
+ if (process.env.PYTHON && fs.existsSync(process.env.PYTHON)) {
11
+ return process.env.PYTHON;
12
+ }
13
+ const termuxBin = '/data/data/com.termux/files/usr/bin/python3';
14
+ if (fs.existsSync(termuxBin)) {
15
+ return termuxBin;
16
+ }
17
+ const termuxBinAlt = '/data/data/com.termux/files/usr/bin/python';
18
+ if (fs.existsSync(termuxBinAlt)) {
19
+ return termuxBinAlt;
20
+ }
21
+ const candidates = ['python3', 'python'];
16
22
  for (const cmd of candidates) {
17
23
  try {
18
- const res = spawnSync(cmd, ['-c', 'import sys; sys.exit(0)'], { stdio: 'ignore' });
19
- if (res.status === 0) return cmd;
24
+ const checkCmd = process.platform === 'win32' ? `where ${cmd}` : `command -v ${cmd}`;
25
+ const res = execSync(checkCmd, { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
26
+ if (res) return cmd;
20
27
  } catch (_) {}
21
28
  }
22
29
  return 'python3';
23
30
  }
24
31
 
25
- const pythonExe = getPythonExecutable();
26
- const pythonArgs = ['-m', 'termux_stt.cli.main', ...args];
32
+ const pythonBin = findPython();
33
+ const args = ['-m', 'termux_stt.platform.installer', ...process.argv.slice(2)];
27
34
 
28
- const proc = spawn(pythonExe, pythonArgs, {
35
+ const child = spawn(pythonBin, args, {
29
36
  stdio: 'inherit',
30
37
  env: process.env
31
38
  });
32
39
 
33
- proc.on('close', (code) => {
34
- process.exit(code || 0);
40
+ child.on('error', (err) => {
41
+ console.error(`[${'termux_stt'}] Failed to spawn python process (${pythonBin}):`, err.message);
42
+ process.exit(1);
43
+ });
44
+
45
+ child.on('exit', (code, signal) => {
46
+ if (signal) {
47
+ process.kill(process.pid, signal);
48
+ } else {
49
+ process.exit(code || 0);
50
+ }
35
51
  });
package/index.d.ts CHANGED
@@ -60,4 +60,4 @@ export function createEngine(
60
60
  options?: EngineOptions
61
61
  ): Engine;
62
62
 
63
- export function formatTime(seconds: number, separator?: string): string;
63
+ export function formatTime(seconds: number, separator?: string): string;
package/package.json CHANGED
@@ -1,87 +1,87 @@
1
- {
2
- "name": "termux-stt",
3
- "version": "1.2.7",
4
- "description": "On-device Speech-to-Text & speaker diarization framework utilizing device resources for Android Termux",
5
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "bin": {
8
- "termux-stt": "bin/termux-stt.js",
9
- "termux-stt-install": "bin/termux-stt.js"
10
- },
11
- "files": [
12
- "index.js",
13
- "index.d.ts",
14
- "lib",
15
- "bin",
16
- "README.md",
17
- "LICENSE"
18
- ],
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/uno-km/termux-stt.git"
22
- },
23
- "keywords": [
24
- "termux",
25
- "stt",
26
- "speech-to-text",
27
- "whisper",
28
- "whisper-cpp",
29
- "vosk",
30
- "sherpa-onnx",
31
- "diarization",
32
- "speaker-diarization",
33
- "voice-recognition",
34
- "audio-transcription",
35
- "on-device-ai",
36
- "edge-ai",
37
- "mobile-ai",
38
- "vulkan",
39
- "vulkan-compute",
40
- "gpu-acceleration",
41
- "real-time-factor",
42
- "low-latency",
43
- "arm64",
44
- "android",
45
- "snapdragon",
46
- "adreno",
47
- "exynos",
48
- "arm-mali",
49
- "zero-compilation",
50
- "vad",
51
- "voice-activity-detection",
52
- "silero-vad",
53
- "x-vector",
54
- "k-means",
55
- "clustering",
56
- "srt-export",
57
- "vtt-export",
58
- "rttm",
59
- "microphone-streaming",
60
- "headless-audio",
61
- "pulseaudio",
62
- "offline-speech",
63
- "privacy-first",
64
- "termux-aichain",
65
- "termux-tts",
66
- "termux-llamacpp",
67
- "termux-diffusion",
68
- "ameva-runtime",
69
- "ggml",
70
- "quantization",
71
- "bionic-libc",
72
- "autonomous-agents",
73
- "voice-assistant"
74
- ],
75
- "author": "uno-km (AMEVA Foundation) <dev@ameva.org>",
76
- "license": "MIT",
77
- "bugs": {
78
- "url": "https://github.com/uno-km/termux-stt/issues"
79
- },
80
- "homepage": "https://uno-km.github.io/termux-stt/",
81
- "dependencies": {
82
- "@ameva/runtime": ">=2.0.0"
83
- },
84
- "engines": {
85
- "node": ">=16.0.0"
86
- }
87
- }
1
+ {
2
+ "name": "termux-stt",
3
+ "version": "1.2.9",
4
+ "description": "On-device Speech-to-Text & speaker diarization framework utilizing device resources for Android Termux",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "bin": {
8
+ "termux-stt": "bin/cli.js",
9
+ "termux-stt-install": "bin/termux-stt.js"
10
+ },
11
+ "files": [
12
+ "index.js",
13
+ "index.d.ts",
14
+ "lib",
15
+ "bin",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/uno-km/termux-stt.git"
22
+ },
23
+ "keywords": [
24
+ "termux",
25
+ "stt",
26
+ "speech-to-text",
27
+ "whisper",
28
+ "whisper-cpp",
29
+ "vosk",
30
+ "sherpa-onnx",
31
+ "diarization",
32
+ "speaker-diarization",
33
+ "voice-recognition",
34
+ "audio-transcription",
35
+ "on-device-ai",
36
+ "edge-ai",
37
+ "mobile-ai",
38
+ "vulkan",
39
+ "vulkan-compute",
40
+ "gpu-acceleration",
41
+ "real-time-factor",
42
+ "low-latency",
43
+ "arm64",
44
+ "android",
45
+ "snapdragon",
46
+ "adreno",
47
+ "exynos",
48
+ "arm-mali",
49
+ "zero-compilation",
50
+ "vad",
51
+ "voice-activity-detection",
52
+ "silero-vad",
53
+ "x-vector",
54
+ "k-means",
55
+ "clustering",
56
+ "srt-export",
57
+ "vtt-export",
58
+ "rttm",
59
+ "microphone-streaming",
60
+ "headless-audio",
61
+ "pulseaudio",
62
+ "offline-speech",
63
+ "privacy-first",
64
+ "termux-aichain",
65
+ "termux-tts",
66
+ "termux-llamacpp",
67
+ "termux-diffusion",
68
+ "ameva-runtime",
69
+ "ggml",
70
+ "quantization",
71
+ "bionic-libc",
72
+ "autonomous-agents",
73
+ "voice-assistant"
74
+ ],
75
+ "author": "uno-km (AMEVA Foundation) <dev@ameva.org>",
76
+ "license": "MIT",
77
+ "bugs": {
78
+ "url": "https://github.com/uno-km/termux-stt/issues"
79
+ },
80
+ "homepage": "https://uno-km.github.io/termux-stt/",
81
+ "dependencies": {
82
+ "@ameva/runtime": ">=2.0.0"
83
+ },
84
+ "engines": {
85
+ "node": ">=16.0.0"
86
+ }
87
+ }