@n1creator/openacp-cli 2026.712.3 → 2026.712.5

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.
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Keep the former wrapper cache as the fallback so existing model downloads and
5
+ # virtual environments are reused after migration to the native provider.
6
+ CACHE_ROOT="${OPENACP_LOCAL_WHISPER_CACHE:-${CODEX_TRANSCRIBE_VOICE_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/codex/transcribe-voice}}"
7
+ VENV_DIR="$CACHE_ROOT/venv"
8
+ PYTHON="$VENV_DIR/bin/python"
9
+ PACKAGE_MARKER="$CACHE_ROOT/.faster-whisper-1.2"
10
+
11
+ usage() {
12
+ cat >&2 <<'EOF'
13
+ Usage: transcribe_audio.sh [options] <audio-file>
14
+
15
+ Options:
16
+ --model NAME faster-whisper model name (default: base)
17
+ --language CODE Whisper language code, for example ru or en (default: ru)
18
+ --beam-size N Beam size for decoding (default: 5)
19
+ --vad-filter Enable VAD filtering
20
+ --no-vad-filter Disable VAD filtering (default)
21
+ --segments Print timestamped segments instead of one plain transcript
22
+ --device NAME Device for faster-whisper (default: cpu)
23
+ --compute-type NAME Compute type (default: int8)
24
+ --quiet Suppress metadata on stderr
25
+ EOF
26
+ }
27
+
28
+ ensure_env() {
29
+ mkdir -p "$CACHE_ROOT"
30
+ if [[ ! -x "$PYTHON" ]]; then
31
+ if command -v uv >/dev/null 2>&1; then
32
+ uv venv "$VENV_DIR" >&2
33
+ else
34
+ local python_bin="${PYTHON_BIN:-python3}"
35
+ "$python_bin" -m venv "$VENV_DIR" >&2 || {
36
+ echo "Could not create a Python virtual environment. Install uv or python3-venv." >&2
37
+ exit 2
38
+ }
39
+ fi
40
+ rm -f "$PACKAGE_MARKER"
41
+ fi
42
+
43
+ if [[ ! -f "$PACKAGE_MARKER" ]]; then
44
+ if command -v uv >/dev/null 2>&1; then
45
+ uv pip install --python "$PYTHON" 'faster-whisper>=1.2,<2' >&2
46
+ else
47
+ "$PYTHON" -m pip install 'faster-whisper>=1.2,<2' >&2 || {
48
+ echo "Could not install faster-whisper. Install uv or ensure pip is available in the venv." >&2
49
+ exit 2
50
+ }
51
+ fi
52
+ touch "$PACKAGE_MARKER"
53
+ fi
54
+ }
55
+
56
+ if [[ $# -eq 0 ]]; then
57
+ usage
58
+ exit 2
59
+ fi
60
+
61
+ ensure_env
62
+
63
+ "$PYTHON" - "$@" <<'PY'
64
+ import argparse
65
+ import os
66
+ import sys
67
+ from pathlib import Path
68
+
69
+ from faster_whisper import WhisperModel
70
+
71
+
72
+ def main() -> int:
73
+ parser = argparse.ArgumentParser(description="Transcribe an audio file with faster-whisper.")
74
+ parser.add_argument("audio_file", help="Path to the audio file to transcribe")
75
+ parser.add_argument("--model", default=os.environ.get("OPENACP_LOCAL_WHISPER_MODEL", "base"))
76
+ parser.add_argument("--language", default=os.environ.get("OPENACP_LOCAL_WHISPER_LANGUAGE", "ru"))
77
+ parser.add_argument("--beam-size", type=int, default=int(os.environ.get("OPENACP_LOCAL_WHISPER_BEAM_SIZE", "5")))
78
+ parser.add_argument("--vad-filter", dest="vad_filter", action="store_true", default=False)
79
+ parser.add_argument("--no-vad-filter", dest="vad_filter", action="store_false")
80
+ parser.add_argument("--segments", action="store_true", help="Print timestamped segments")
81
+ parser.add_argument("--device", default=os.environ.get("OPENACP_LOCAL_WHISPER_DEVICE", "cpu"))
82
+ parser.add_argument("--compute-type", default=os.environ.get("OPENACP_LOCAL_WHISPER_COMPUTE_TYPE", "int8"))
83
+ parser.add_argument("--quiet", action="store_true", help="Suppress metadata on stderr")
84
+ args = parser.parse_args()
85
+
86
+ audio_path = Path(args.audio_file).expanduser()
87
+ if not audio_path.exists():
88
+ print(f"Audio file not found: {audio_path}", file=sys.stderr)
89
+ return 2
90
+
91
+ model = WhisperModel(args.model, device=args.device, compute_type=args.compute_type)
92
+ segments_iter, info = model.transcribe(
93
+ str(audio_path),
94
+ language=args.language,
95
+ beam_size=args.beam_size,
96
+ vad_filter=args.vad_filter,
97
+ )
98
+ segments = list(segments_iter)
99
+
100
+ if not args.quiet:
101
+ probability = getattr(info, "language_probability", None)
102
+ probability_text = f"{probability:.3f}" if probability is not None else "unknown"
103
+ print(
104
+ f"model={args.model} language={info.language} "
105
+ f"language_probability={probability_text} duration={info.duration:.3f}s",
106
+ file=sys.stderr,
107
+ )
108
+
109
+ if args.segments:
110
+ for segment in segments:
111
+ print(f"[{segment.start:.2f}-{segment.end:.2f}] {segment.text.strip()}")
112
+ else:
113
+ print(" ".join(segment.text.strip() for segment in segments).strip())
114
+ return 0
115
+
116
+
117
+ raise SystemExit(main())
118
+ PY
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n1creator/openacp-cli",
3
- "version": "2026.712.3",
3
+ "version": "2026.712.5",
4
4
  "description": "Self-hosted bridge for AI coding agents via ACP protocol",
5
5
  "type": "module",
6
6
  "bin": {