@inetafrica/open-claudia 1.13.2 → 1.13.4

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.
Files changed (3) hide show
  1. package/bot.js +1 -1
  2. package/package.json +1 -1
  3. package/setup.js +112 -3
package/bot.js CHANGED
@@ -1209,7 +1209,7 @@ bot.onText(/\/model$/, (msg) => {
1209
1209
  [{ text: "GPT-5.4", callback_data: "m:gpt-5.4-medium" }, { text: "GPT-5.4 High", callback_data: "m:gpt-5.4-high" }],
1210
1210
  [{ text: "Auto", callback_data: "m:auto" }, { text: "Default", callback_data: "m:default" }],
1211
1211
  ] : [
1212
- [{ text: "Opus", callback_data: "m:opus" }, { text: "Sonnet", callback_data: "m:sonnet" }, { text: "Haiku", callback_data: "m:haiku" }],
1212
+ [{ text: "Opus 4.7", callback_data: "m:claude-opus-4-7" }, { text: "Opus 4.6", callback_data: "m:claude-opus-4-6" }, { text: "Sonnet 4.6", callback_data: "m:claude-sonnet-4-6" }, { text: "Haiku", callback_data: "m:claude-haiku-4-5-20251001" }],
1213
1213
  [{ text: "Default", callback_data: "m:default" }],
1214
1214
  ];
1215
1215
  const label = settings.backend === "cursor" ? "Cursor Agent" : "Claude Code";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inetafrica/open-claudia",
3
- "version": "1.13.2",
3
+ "version": "1.13.4",
4
4
  "description": "Your always-on AI coding assistant — Claude Code via Telegram",
5
5
  "main": "bot.js",
6
6
  "bin": {
package/setup.js CHANGED
@@ -152,7 +152,9 @@ function findFfmpeg() { return findBinary("ffmpeg"); }
152
152
 
153
153
  function findWhisperModel() {
154
154
  const candidates = [
155
+ "/opt/homebrew/share/whisper-cpp/models/ggml-base.en.bin",
155
156
  "/opt/homebrew/share/whisper-cpp/ggml-base.en.bin",
157
+ "/usr/local/share/whisper-cpp/models/ggml-base.en.bin",
156
158
  "/usr/local/share/whisper-cpp/ggml-base.en.bin",
157
159
  path.join(__dirname, "models", "ggml-base.en.bin"),
158
160
  ];
@@ -162,6 +164,79 @@ function findWhisperModel() {
162
164
  return null;
163
165
  }
164
166
 
167
+ async function installWhisper(platform) {
168
+ if (platform === "macos") {
169
+ console.log("\n Installing whisper-cpp via Homebrew...");
170
+ try {
171
+ execSync("brew install whisper-cpp", { stdio: "inherit", timeout: 300000 });
172
+ } catch (e) {
173
+ console.log(" Failed to install whisper-cpp. Install manually: brew install whisper-cpp");
174
+ return { cli: null, model: null };
175
+ }
176
+
177
+ const cli = findWhisper();
178
+ if (!cli) {
179
+ console.log(" whisper-cli not found after install.");
180
+ return { cli: null, model: null };
181
+ }
182
+
183
+ // Download model
184
+ const modelDir = "/usr/local/share/whisper-cpp/models";
185
+ const modelPath = path.join(modelDir, "ggml-base.en.bin");
186
+ if (!fs.existsSync(modelPath)) {
187
+ console.log(" Downloading whisper base.en model (~142MB)...");
188
+ try {
189
+ fs.mkdirSync(modelDir, { recursive: true });
190
+ execSync(`curl -L -o "${modelPath}" "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin"`, {
191
+ stdio: "inherit", timeout: 300000,
192
+ });
193
+ } catch (e) {
194
+ console.log(" Failed to download model. Voice notes will be disabled.");
195
+ return { cli, model: null };
196
+ }
197
+ }
198
+
199
+ console.log(" Whisper installed successfully!\n");
200
+ return { cli, model: modelPath };
201
+ }
202
+
203
+ if (platform === "linux") {
204
+ console.log("\n On Linux, install whisper.cpp manually:");
205
+ console.log(" https://github.com/ggerganov/whisper.cpp#quick-start");
206
+ return { cli: null, model: null };
207
+ }
208
+
209
+ console.log(" Whisper auto-install not supported on this platform.");
210
+ return { cli: null, model: null };
211
+ }
212
+
213
+ async function installFfmpeg(platform) {
214
+ if (platform === "macos") {
215
+ console.log("\n Installing FFmpeg via Homebrew...");
216
+ try {
217
+ execSync("brew install ffmpeg", { stdio: "inherit", timeout: 300000 });
218
+ } catch (e) {
219
+ console.log(" Failed to install FFmpeg. Install manually: brew install ffmpeg");
220
+ return null;
221
+ }
222
+ return findFfmpeg();
223
+ }
224
+
225
+ if (platform === "linux") {
226
+ console.log("\n Installing FFmpeg via apt...");
227
+ try {
228
+ execSync("sudo apt-get install -y ffmpeg", { stdio: "inherit", timeout: 300000 });
229
+ } catch (e) {
230
+ console.log(" Failed to install FFmpeg. Install manually: sudo apt-get install ffmpeg");
231
+ return null;
232
+ }
233
+ return findFfmpeg();
234
+ }
235
+
236
+ console.log(" FFmpeg auto-install not supported on this platform.");
237
+ return null;
238
+ }
239
+
165
240
  // ── Daemon setup ───────────────────────────────────────────────────
166
241
 
167
242
  async function setupDaemon(platform) {
@@ -470,13 +545,47 @@ async function main() {
470
545
  const platform = detectPlatform();
471
546
  console.log(` Platform: ${platform}`);
472
547
 
473
- const ffmpegPath = findFfmpeg();
474
- const whisperPath = findWhisper();
475
- const whisperModel = findWhisperModel();
548
+ let ffmpegPath = findFfmpeg();
549
+ let whisperPath = findWhisper();
550
+ let whisperModel = findWhisperModel();
476
551
  console.log(` FFmpeg: ${ffmpegPath || "not found (voice notes disabled)"}`);
477
552
  console.log(` Whisper: ${whisperPath || "not found (voice notes disabled)"}`);
478
553
  console.log("");
479
554
 
555
+ // Offer to install missing voice note dependencies
556
+ if (!ffmpegPath || !whisperPath) {
557
+ const installVoice = await ask(" Enable voice notes? This will install FFmpeg + Whisper (y/n) [y]: ");
558
+ if (installVoice.toLowerCase() !== "n") {
559
+ if (!ffmpegPath) {
560
+ ffmpegPath = await installFfmpeg(platform);
561
+ if (ffmpegPath) console.log(` FFmpeg: ${ffmpegPath}`);
562
+ }
563
+ if (!whisperPath) {
564
+ const result = await installWhisper(platform);
565
+ whisperPath = result.cli || "";
566
+ whisperModel = result.model || "";
567
+ if (whisperPath) console.log(` Whisper: ${whisperPath}`);
568
+ } else if (!whisperModel) {
569
+ // Whisper CLI exists but no model — download it
570
+ const modelDir = platform === "macos"
571
+ ? (fs.existsSync("/opt/homebrew/bin") ? "/opt/homebrew/share/whisper-cpp/models" : "/usr/local/share/whisper-cpp/models")
572
+ : "/usr/local/share/whisper-cpp/models";
573
+ const modelPath = path.join(modelDir, "ggml-base.en.bin");
574
+ console.log(" Downloading whisper base.en model (~142MB)...");
575
+ try {
576
+ fs.mkdirSync(modelDir, { recursive: true });
577
+ execSync(`curl -L -o "${modelPath}" "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin"`, {
578
+ stdio: "inherit", timeout: 300000,
579
+ });
580
+ whisperModel = modelPath;
581
+ } catch (e) {
582
+ console.log(" Failed to download model.");
583
+ }
584
+ }
585
+ console.log("");
586
+ }
587
+ }
588
+
480
589
  state.data.claudePath = claudePath;
481
590
  state.data.platform = platform;
482
591
  state.data.ffmpegPath = ffmpegPath || "";