chat-heimerdinger 0.1.5 → 0.1.7

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/README.md CHANGED
@@ -273,12 +273,12 @@ pnpm link --global
273
273
  ## 开发
274
274
 
275
275
  ```bash
276
- # 开发模式(使用 tsx)
277
- pnpm dev
278
-
279
276
  # 构建
280
277
  pnpm build
281
278
 
279
+ # link
280
+ pnpm link
281
+
282
282
  # 格式化
283
283
  pnpm format
284
284
  ```
package/dist/cli.js CHANGED
@@ -118539,7 +118539,7 @@ import { spawnSync } from "node:child_process";
118539
118539
  import { dirname as dirname3, join as join5 } from "node:path";
118540
118540
 
118541
118541
  // src/services/service-manager.ts
118542
- import { execSync as execSync2, spawn as spawn4 } from "node:child_process";
118542
+ import { execSync as execSync3, spawn as spawn4 } from "node:child_process";
118543
118543
  import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync5, unlinkSync as unlinkSync3, writeFileSync as writeFileSync5 } from "node:fs";
118544
118544
  import { dirname as dirname2, join as join4 } from "node:path";
118545
118545
 
@@ -119635,25 +119635,59 @@ class SlackAdapter {
119635
119635
  import { existsSync as existsSync6, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
119636
119636
 
119637
119637
  // src/services/whisper.ts
119638
- import { spawn as spawn3 } from "node:child_process";
119638
+ import { execSync as execSync2, spawn as spawn3 } from "node:child_process";
119639
119639
  import { existsSync as existsSync5, mkdirSync as mkdirSync2, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
119640
119640
  import { tmpdir } from "node:os";
119641
119641
  import { join as join3 } from "node:path";
119642
119642
  var WHISPER_MODEL_PATH = join3(process.env.HOME || "/home/dev", ".local/share/whisper/ggml-small.bin");
119643
- var WHISPER_CLI = "whisper-cli";
119644
119643
 
119645
119644
  class WhisperService {
119646
119645
  modelPath;
119646
+ whisperBinaryPath;
119647
+ ffmpegBinaryPath;
119647
119648
  constructor(modelPath = WHISPER_MODEL_PATH) {
119648
119649
  this.modelPath = modelPath;
119650
+ consola.debug(`WhisperService init: HOME=${process.env.HOME}, modelPath=${this.modelPath}`);
119651
+ this.whisperBinaryPath = this.findBinary("whisper-cli", [
119652
+ "/usr/local/bin/whisper-cli",
119653
+ "/usr/bin/whisper-cli",
119654
+ `${process.env.HOME}/.local/bin/whisper-cli`
119655
+ ]);
119656
+ this.ffmpegBinaryPath = this.findBinary("ffmpeg", [
119657
+ "/usr/bin/ffmpeg",
119658
+ "/usr/local/bin/ffmpeg"
119659
+ ]);
119660
+ }
119661
+ findBinary(name, commonPaths) {
119662
+ try {
119663
+ const path = execSync2(`which ${name}`, { encoding: "utf-8" }).trim();
119664
+ if (path && existsSync5(path)) {
119665
+ consola.debug(`Found ${name} at:`, path);
119666
+ return path;
119667
+ }
119668
+ } catch {}
119669
+ for (const p2 of commonPaths) {
119670
+ if (existsSync5(p2)) {
119671
+ consola.debug(`Found ${name} at:`, p2);
119672
+ return p2;
119673
+ }
119674
+ }
119675
+ consola.warn(`Could not find ${name} binary`);
119676
+ return name;
119649
119677
  }
119650
119678
  async isAvailable() {
119679
+ consola.debug(`Checking whisper availability: model=${this.modelPath}, binary=${this.whisperBinaryPath}`);
119651
119680
  if (!existsSync5(this.modelPath)) {
119652
119681
  consola.warn(`Whisper model not found at ${this.modelPath}`);
119653
119682
  return false;
119654
119683
  }
119684
+ if (this.whisperBinaryPath.startsWith("/")) {
119685
+ const exists = existsSync5(this.whisperBinaryPath);
119686
+ consola.debug(`Whisper binary exists: ${exists}`);
119687
+ return exists;
119688
+ }
119655
119689
  return new Promise((resolve) => {
119656
- const proc = spawn3(WHISPER_CLI, ["-h"], { stdio: "ignore" });
119690
+ const proc = spawn3(this.whisperBinaryPath, ["-h"], { stdio: "ignore" });
119657
119691
  proc.on("close", (code) => resolve(code === 0));
119658
119692
  proc.on("error", () => resolve(false));
119659
119693
  });
@@ -119693,7 +119727,7 @@ class WhisperService {
119693
119727
  "-y",
119694
119728
  outputFile
119695
119729
  ];
119696
- const proc = spawn3("ffmpeg", args, { stdio: ["ignore", "pipe", "pipe"] });
119730
+ const proc = spawn3(this.ffmpegBinaryPath, args, { stdio: ["ignore", "pipe", "pipe"] });
119697
119731
  let stderr = "";
119698
119732
  proc.stderr.on("data", (data) => {
119699
119733
  stderr += data.toString();
@@ -119722,8 +119756,8 @@ class WhisperService {
119722
119756
  "-f",
119723
119757
  wavFile
119724
119758
  ];
119725
- consola.debug(`Running whisper: ${WHISPER_CLI} ${args.join(" ")}`);
119726
- const proc = spawn3(WHISPER_CLI, args, { stdio: ["ignore", "pipe", "pipe"] });
119759
+ consola.debug(`Running whisper: ${this.whisperBinaryPath} ${args.join(" ")}`);
119760
+ const proc = spawn3(this.whisperBinaryPath, args, { stdio: ["ignore", "pipe", "pipe"] });
119727
119761
  let stdout2 = "";
119728
119762
  let stderr = "";
119729
119763
  proc.stdout.on("data", (data) => {
@@ -120899,6 +120933,7 @@ Shutting down...`);
120899
120933
  await server.start();
120900
120934
  }
120901
120935
  async startDaemon() {
120936
+ await this.killOrphanedProcesses();
120902
120937
  if (!existsSync8(LOG_DIR)) {
120903
120938
  mkdirSync3(LOG_DIR, { recursive: true });
120904
120939
  }
@@ -120957,7 +120992,8 @@ Shutting down...`);
120957
120992
  }
120958
120993
  async killOrphanedProcesses() {
120959
120994
  try {
120960
- execSync2('pkill -f "node.*daemon-entry" 2>/dev/null || true', { encoding: "utf-8" });
120995
+ execSync3('pkill -f "node.*daemon-entry\\.js" 2>/dev/null || true', { encoding: "utf-8" });
120996
+ execSync3('pkill -f "tsx.*daemon-entry" 2>/dev/null || true', { encoding: "utf-8" });
120961
120997
  } catch {}
120962
120998
  }
120963
120999
  async writePidFile(pid) {
@@ -116373,25 +116373,59 @@ class ClaudeCodeService {
116373
116373
  }
116374
116374
 
116375
116375
  // src/services/whisper.ts
116376
- import { spawn as spawn2 } from "node:child_process";
116376
+ import { execSync as execSync2, spawn as spawn2 } from "node:child_process";
116377
116377
  import { existsSync as existsSync3, mkdirSync as mkdirSync2, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
116378
116378
  import { tmpdir } from "node:os";
116379
116379
  import { join as join3 } from "node:path";
116380
116380
  var WHISPER_MODEL_PATH = join3(process.env.HOME || "/home/dev", ".local/share/whisper/ggml-small.bin");
116381
- var WHISPER_CLI = "whisper-cli";
116382
116381
 
116383
116382
  class WhisperService {
116384
116383
  modelPath;
116384
+ whisperBinaryPath;
116385
+ ffmpegBinaryPath;
116385
116386
  constructor(modelPath = WHISPER_MODEL_PATH) {
116386
116387
  this.modelPath = modelPath;
116388
+ consola.debug(`WhisperService init: HOME=${process.env.HOME}, modelPath=${this.modelPath}`);
116389
+ this.whisperBinaryPath = this.findBinary("whisper-cli", [
116390
+ "/usr/local/bin/whisper-cli",
116391
+ "/usr/bin/whisper-cli",
116392
+ `${process.env.HOME}/.local/bin/whisper-cli`
116393
+ ]);
116394
+ this.ffmpegBinaryPath = this.findBinary("ffmpeg", [
116395
+ "/usr/bin/ffmpeg",
116396
+ "/usr/local/bin/ffmpeg"
116397
+ ]);
116398
+ }
116399
+ findBinary(name, commonPaths) {
116400
+ try {
116401
+ const path = execSync2(`which ${name}`, { encoding: "utf-8" }).trim();
116402
+ if (path && existsSync3(path)) {
116403
+ consola.debug(`Found ${name} at:`, path);
116404
+ return path;
116405
+ }
116406
+ } catch {}
116407
+ for (const p of commonPaths) {
116408
+ if (existsSync3(p)) {
116409
+ consola.debug(`Found ${name} at:`, p);
116410
+ return p;
116411
+ }
116412
+ }
116413
+ consola.warn(`Could not find ${name} binary`);
116414
+ return name;
116387
116415
  }
116388
116416
  async isAvailable() {
116417
+ consola.debug(`Checking whisper availability: model=${this.modelPath}, binary=${this.whisperBinaryPath}`);
116389
116418
  if (!existsSync3(this.modelPath)) {
116390
116419
  consola.warn(`Whisper model not found at ${this.modelPath}`);
116391
116420
  return false;
116392
116421
  }
116422
+ if (this.whisperBinaryPath.startsWith("/")) {
116423
+ const exists = existsSync3(this.whisperBinaryPath);
116424
+ consola.debug(`Whisper binary exists: ${exists}`);
116425
+ return exists;
116426
+ }
116393
116427
  return new Promise((resolve) => {
116394
- const proc = spawn2(WHISPER_CLI, ["-h"], { stdio: "ignore" });
116428
+ const proc = spawn2(this.whisperBinaryPath, ["-h"], { stdio: "ignore" });
116395
116429
  proc.on("close", (code) => resolve(code === 0));
116396
116430
  proc.on("error", () => resolve(false));
116397
116431
  });
@@ -116431,7 +116465,7 @@ class WhisperService {
116431
116465
  "-y",
116432
116466
  outputFile
116433
116467
  ];
116434
- const proc = spawn2("ffmpeg", args, { stdio: ["ignore", "pipe", "pipe"] });
116468
+ const proc = spawn2(this.ffmpegBinaryPath, args, { stdio: ["ignore", "pipe", "pipe"] });
116435
116469
  let stderr = "";
116436
116470
  proc.stderr.on("data", (data) => {
116437
116471
  stderr += data.toString();
@@ -116460,8 +116494,8 @@ class WhisperService {
116460
116494
  "-f",
116461
116495
  wavFile
116462
116496
  ];
116463
- consola.debug(`Running whisper: ${WHISPER_CLI} ${args.join(" ")}`);
116464
- const proc = spawn2(WHISPER_CLI, args, { stdio: ["ignore", "pipe", "pipe"] });
116497
+ consola.debug(`Running whisper: ${this.whisperBinaryPath} ${args.join(" ")}`);
116498
+ const proc = spawn2(this.whisperBinaryPath, args, { stdio: ["ignore", "pipe", "pipe"] });
116465
116499
  let stdout2 = "";
116466
116500
  let stderr = "";
116467
116501
  proc.stdout.on("data", (data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chat-heimerdinger",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Bridge IM tools (Slack/Lark) with Claude Code for vibe coding",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,6 @@
13
13
  "LICENSE"
14
14
  ],
15
15
  "scripts": {
16
- "dev": "tsx src/cli.ts",
17
16
  "build": "bun build ./src/cli.ts --outdir ./dist --target node && bun build ./src/services/daemon-entry.ts --outdir ./dist --target node && sed -i '1s|#!/usr/bin/env bun|#!/usr/bin/env node|' ./dist/cli.js ./dist/daemon-entry.js && chmod +x ./dist/cli.js",
18
17
  "test": "bun test",
19
18
  "lint": "biome check .",