@kolisachint/hoocode-agent 0.4.105 → 0.4.106

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.
@@ -85,10 +85,16 @@ function isDeadTerminalError(error) {
85
85
  const code = error.code;
86
86
  return code !== undefined && DEAD_TERMINAL_ERROR_CODES.has(code);
87
87
  }
88
- // Mirrors voicetools' own default trailing-silence window (see `--silence-ms` /
89
- // VOICE_SILENCE_MS upstream). Only used to drive the cosmetic countdown in the
90
- // panel; the actual cutoff decision is made by the binary, not this timer.
91
- const VOICE_SILENCE_MS = 600;
88
+ // Trailing-silence window: how long a pause while speaking lasts before the
89
+ // capture auto-stops. Passed to `voicetools serve` via `--silence-ms` (see
90
+ // VoiceDaemon.spawn) so the binary's real cutoff matches the on-screen
91
+ // countdown this same value drives. Kept generous so a thinking pause mid-
92
+ // sentence doesn't cut the user off (the binary's own default is 600ms).
93
+ const VOICE_SILENCE_MS = 3000;
94
+ /** How long to keep the warm voice model in memory after the last capture
95
+ * completes. The daemon auto-shuts down after this window, releasing the
96
+ * ~900 MB resident model; the next ctrl+r pays a cold-start respawn cost. */
97
+ const VOICE_IDLE_TIMEOUT_MS = 60_000;
92
98
  const VOICE_UNAVAILABLE_MESSAGE = "Voice input failed: voicetools binary unavailable and could not be downloaded. " +
93
99
  "Install it, set VOICETOOLS_BIN, or ensure a published release exists for this platform.";
94
100
  const ANTHROPIC_SUBSCRIPTION_AUTH_WARNING = "Anthropic subscription auth: billed per token as extra usage, not plan limits.";
@@ -2852,7 +2858,10 @@ export class InteractiveMode {
2852
2858
  this.showError(VOICE_UNAVAILABLE_MESSAGE);
2853
2859
  return;
2854
2860
  }
2855
- const result = await VoiceDaemon.spawn(bin, this.buildVoiceDaemonHandlers());
2861
+ const result = await VoiceDaemon.spawn(bin, this.buildVoiceDaemonHandlers(), {
2862
+ silenceMs: VOICE_SILENCE_MS,
2863
+ idleTimeoutMs: VOICE_IDLE_TIMEOUT_MS,
2864
+ });
2856
2865
  if (!result.ok) {
2857
2866
  if (result.reason === "unsupported") {
2858
2867
  this.voiceDaemonUnsupported = true;
@@ -2956,6 +2965,12 @@ export class InteractiveMode {
2956
2965
  this.resetVoiceUI();
2957
2966
  this.showError(`Voice input daemon crashed: ${message}. It will restart on next use.`);
2958
2967
  },
2968
+ onIdle: () => {
2969
+ // Daemon auto-shut down after idle timeout: drop the reference so the
2970
+ // next ctrl+r respawns (cold start). No user-facing message — this is
2971
+ // an expected memory-reclamation event, not an error.
2972
+ this.voiceDaemon = undefined;
2973
+ },
2959
2974
  };
2960
2975
  }
2961
2976
  /** Inject decoded text into the editor via bracketed paste (with a trailing space). */