pi-voice-input 0.2.15 → 0.2.16

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.
@@ -23,6 +23,10 @@ import WebSocket from "ws";
23
23
 
24
24
  const CONFIG_PATH = path.join(homedir(), ".pi", "agent", "voice-input.config.json");
25
25
  const VOLC_API_KEY_URL = "https://console.volcengine.com/speech/new/setting/apikeys?projectName=default";
26
+ // pi-bridge redirects child_process calls whose cwd is inside the bridged fake
27
+ // project directory. Audio capture and system volume control must always use
28
+ // the local machine, so force those subprocesses to a known-local cwd.
29
+ const LOCAL_AUDIO_PROCESS_CWD = homedir();
26
30
  const DEFAULT_SHORTCUT = Key.ctrlShift("r");
27
31
  const DEFAULT_POSTPROCESS_MODEL = "";
28
32
  const DEFAULT_POSTPROCESS_CONTEXT_TOKENS = 20000;
@@ -267,17 +271,17 @@ function timestampForFilename(): string {
267
271
  }
268
272
 
269
273
  function commandExists(command: string): boolean {
270
- return spawnSync("sh", ["-lc", `command -v ${command}`], { stdio: "ignore" }).status === 0;
274
+ return spawnSync("sh", ["-lc", `command -v ${command}`], { cwd: LOCAL_AUDIO_PROCESS_CWD, stdio: "ignore" }).status === 0;
271
275
  }
272
276
 
273
277
  function commandOutput(command: string, args: string[], timeoutMs = 1500): string {
274
- const result = spawnSync(command, args, { encoding: "utf8", timeout: timeoutMs });
278
+ const result = spawnSync(command, args, { cwd: LOCAL_AUDIO_PROCESS_CWD, encoding: "utf8", timeout: timeoutMs });
275
279
  if (result.status !== 0) return "";
276
280
  return (result.stdout || "").trim();
277
281
  }
278
282
 
279
283
  function runCommand(command: string, args: string[], timeoutMs = 1500): boolean {
280
- return spawnSync(command, args, { stdio: "ignore", timeout: timeoutMs }).status === 0;
284
+ return spawnSync(command, args, { cwd: LOCAL_AUDIO_PROCESS_CWD, stdio: "ignore", timeout: timeoutMs }).status === 0;
281
285
  }
282
286
 
283
287
  function formatPercent(value: number): string {
@@ -1527,6 +1531,7 @@ async function startRecording(ctx: ExtensionContext) {
1527
1531
  let child: ReturnType<typeof spawn>;
1528
1532
  try {
1529
1533
  child = spawn(cmd[0], cmd.slice(1), {
1534
+ cwd: LOCAL_AUDIO_PROCESS_CWD,
1530
1535
  detached: true,
1531
1536
  stdio: ["ignore", "ignore", "ignore"],
1532
1537
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-voice-input",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "Press Ctrl+Shift+R to dictate prompts into Pi using VolcEngine ASR",
5
5
  "type": "module",
6
6
  "keywords": [