@senad-d/micme 0.1.2 → 0.2.1

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/src/settings.ts CHANGED
@@ -12,35 +12,32 @@ import {
12
12
  truncateToWidth,
13
13
  visibleWidth,
14
14
  } from "@earendil-works/pi-tui";
15
- import { homedir } from "node:os";
16
15
  import { basename } from "node:path";
17
16
  import {
18
17
  DEFAULT_MACOS_PRINTABLE_SHORTCUT,
19
18
  DEFAULT_RECORD_SAMPLE_RATE,
20
19
  DEFAULT_SHORTCUT,
21
20
  DEFAULT_STREAM_VAD_THRESHOLD,
21
+ DEFAULT_STREAM_FLUSH_MS,
22
22
  DEFAULT_TRANSCRIBE_SAMPLE_RATE,
23
- DEFAULT_WHISPER_CPP_MODEL_NAME,
24
- PYTHON_WHISPER_MODEL_NAMES,
25
- WHISPER_CPP_MODEL_NAMES,
26
23
  } from "./constants.ts";
27
24
  import {
28
25
  env,
29
26
  expandConfigPath,
30
- getMicmeConfigPath,
31
27
  getTranscriptionMode,
32
28
  getTranscriptionModeProfile,
33
29
  reloadMicmeConfig,
34
30
  writeMicmeConfigValues,
35
31
  } from "./config.ts";
36
32
  import { discoverAudioDevices } from "./audio.ts";
37
- import { discoverWhisperCppModels, ensureWhisperCppModel, getDefaultWhisperCppModelPath } from "./models.ts";
33
+ import { formatBackendLabel, resolveTranscriptionPlan } from "./backends.ts";
34
+ import { discoverPythonWhisperModels, discoverWhisperCppModels, ensureWhisperCppModel, resolveWhisperCppModel } from "./models.ts";
38
35
  import { findExecutable } from "./processes.ts";
39
- import type { AudioDeviceCandidate, ModelCandidate } from "./types.ts";
36
+ import type { AudioDeviceCandidate, ModelCandidate, ResolvedTranscriptionPlan } from "./types.ts";
40
37
 
41
38
  type MicmeTheme = ExtensionContext["ui"]["theme"];
42
39
 
43
- type ConfigurationCategoryId = "general" | "transcription" | "streaming" | "audio" | "shortcuts" | "diagnostics";
40
+ type ConfigurationCategoryId = "general" | "transcription" | "streaming" | "audio";
44
41
  type FocusedPane = "categories" | "settings";
45
42
  type DisplayKind = "boolean" | "number" | "path" | "slider" | "text" | "model";
46
43
 
@@ -56,6 +53,7 @@ interface ConfigurationItem extends SettingItem {
56
53
  displayKind?: DisplayKind;
57
54
  emptyLabel?: string;
58
55
  valueLabels?: Record<string, string>;
56
+ visibleWhen?: (plan: ResolvedTranscriptionPlan) => boolean;
59
57
  }
60
58
 
61
59
  const CONFIGURATION_CATEGORIES: ConfigurationCategory[] = [
@@ -63,8 +61,6 @@ const CONFIGURATION_CATEGORIES: ConfigurationCategory[] = [
63
61
  { id: "transcription", label: "Transcription", description: "Backend model, mode, and transcription fallback settings." },
64
62
  { id: "streaming", label: "Streaming", description: "Low-latency live transcription behavior." },
65
63
  { id: "audio", label: "Audio", description: "Recording, preprocessing, and metering settings." },
66
- { id: "shortcuts", label: "Shortcuts", description: "Terminal and printable-character shortcut bindings." },
67
- { id: "diagnostics", label: "Diagnostics", description: "Debug and timing output." },
68
64
  ];
69
65
 
70
66
  const TWO_PANE_MIN_WIDTH = 72;
@@ -82,9 +78,10 @@ export async function showConfiguration(ctx: ExtensionContext) {
82
78
  }
83
79
  const audioDevices = await discoverAudioDevices();
84
80
  const modelCandidates = discoverWhisperCppModels(ctx.cwd);
81
+ const pythonModelCandidates = await discoverPythonWhisperModels();
85
82
 
86
83
  await ctx.ui.custom<void>((tui, theme, _keybindings, done) => {
87
- const items = buildConfigurationItems(modelCandidates, audioDevices, theme);
84
+ const items = buildConfigurationItems(modelCandidates, pythonModelCandidates, audioDevices, theme);
88
85
  return new ConfigurationScreen({
89
86
  configPath: configState.path,
90
87
  items,
@@ -135,6 +132,7 @@ class ConfigurationScreen implements Component {
135
132
  }
136
133
 
137
134
  render(width: number): string[] {
135
+ this.refreshDerivedItems();
138
136
  if (this.submenuComponent) return this.submenuComponent.render(width);
139
137
  if (width < TWO_PANE_MIN_WIDTH) return this.renderNarrow(width);
140
138
  return this.renderTwoPane(width);
@@ -351,9 +349,9 @@ class ConfigurationScreen implements Component {
351
349
  const category = this.currentCategory();
352
350
  const selection = this.getSelectionText();
353
351
  const search = this.searchActive ? `Search: ${this.searchQuery || "type to filter all settings"}` : "";
354
- const lead = this.statusText || search || "↑↓ move • Tab pane • Enter edit • / search • Esc back • q quit";
352
+ const lead = this.statusText || search;
355
353
  const description = selected?.description ?? category.description;
356
- return `${lead} • ${selection} • ${description}`;
354
+ return lead ? `${lead} • ${selection} • ${description}` : `${selection} • ${description}`;
357
355
  }
358
356
 
359
357
  private formatValue(item: ConfigurationItem, width: number) {
@@ -410,12 +408,22 @@ class ConfigurationScreen implements Component {
410
408
  }
411
409
 
412
410
  private getCategoryItems(categoryId = this.currentCategory().id) {
413
- return this.items.filter((item) => item.categoryId === categoryId);
411
+ const plan = this.getCurrentPlan();
412
+ return this.items.filter((item) => item.categoryId === categoryId && this.isItemVisible(item, plan));
413
+ }
414
+
415
+ private getVisibleItems() {
416
+ const plan = this.getCurrentPlan();
417
+ return this.items.filter((item) => this.isItemVisible(item, plan));
418
+ }
419
+
420
+ private isItemVisible(item: ConfigurationItem, plan: ResolvedTranscriptionPlan) {
421
+ return item.visibleWhen ? item.visibleWhen(plan) : true;
414
422
  }
415
423
 
416
424
  private getDisplaySettings() {
417
425
  if (!this.hasSearchQuery()) return this.getCategoryItems();
418
- return fuzzyFilter(this.items, this.searchQuery, (item) => `${item.label} ${item.id} ${item.description ?? ""} ${this.getCategory(item.categoryId).label}`);
426
+ return fuzzyFilter(this.getVisibleItems(), this.searchQuery, (item) => `${item.label} ${item.id} ${item.description ?? ""} ${this.getCategory(item.categoryId).label}`);
419
427
  }
420
428
 
421
429
  private getSelectedSetting() {
@@ -480,7 +488,8 @@ class ConfigurationScreen implements Component {
480
488
  void this.onSave(item.id, nextValue)
481
489
  .then((updatedValues) => {
482
490
  this.updateValues(updatedValues);
483
- this.refreshDerivedDefaults();
491
+ this.refreshDerivedItems();
492
+ this.clampSelections();
484
493
  this.statusText = formatSaveStatus(item.id, nextValue);
485
494
  })
486
495
  .catch((error) => {
@@ -502,14 +511,41 @@ class ConfigurationScreen implements Component {
502
511
  }
503
512
  }
504
513
 
505
- private refreshDerivedDefaults() {
506
- if (env("MICME_WHISPER_CPP_MODEL") !== undefined) return;
507
- const item = this.items.find((candidate) => candidate.id === "MICME_WHISPER_CPP_MODEL");
508
- if (!item) return;
509
- item.rawValue = getDefaultWhisperCppModelPath();
510
- item.currentValue = displayConfigurationValue(item.id, item.rawValue);
514
+ private refreshDerivedItems() {
515
+ const plan = this.getCurrentPlan();
516
+ const backend = this.items.find((candidate) => candidate.id === "MICME_TRANSCRIBE_BACKEND");
517
+ if (backend && !["whisper.cpp", "python"].includes(backend.rawValue)) {
518
+ backend.rawValue = getUiBackendValue(plan);
519
+ backend.currentValue = displayConfigurationValue(backend.id, backend.rawValue);
520
+ }
521
+
522
+ const model = this.items.find((candidate) => candidate.id === "MICME_WHISPER_CPP_MODEL");
523
+ if (model) {
524
+ model.rawValue = getCurrentWhisperCppModelValue();
525
+ model.currentValue = displayConfigurationValue(model.id, model.rawValue);
526
+ }
527
+
528
+ const mode = this.items.find((candidate) => candidate.id === "MICME_TRANSCRIPTION_MODE");
529
+ if (mode) {
530
+ const base = "Changing this applies the matching profile: stable clip defaults or low-latency stream settings.";
531
+ mode.description = plan.requestedBackend === "python" || plan.requestedBackend === "custom"
532
+ ? `${base} Streaming mode requires whisper.cpp. Switch to clip mode or choose auto/whisper.cpp.`
533
+ : base;
534
+ }
535
+ }
536
+
537
+ private getCurrentPlan() {
538
+ return resolveTranscriptionPlan({ transcriptionMode: getTranscriptionMode() });
511
539
  }
512
540
 
541
+ private clampSelections() {
542
+ for (const category of CONFIGURATION_CATEGORIES) {
543
+ const count = this.getCategoryItems(category.id).length;
544
+ this.selectedByCategory.set(category.id, clamp(this.selectedByCategory.get(category.id) ?? 0, 0, Math.max(0, count - 1)));
545
+ }
546
+ }
547
+
548
+
513
549
  private handleSearchInput(data: string) {
514
550
  if (matchesKey(data, Key.slash)) {
515
551
  this.searchActive = true;
@@ -550,8 +586,16 @@ class ConfigurationScreen implements Component {
550
586
  }
551
587
  }
552
588
 
553
- export function buildConfigurationItems(modelCandidates: ModelCandidate[], audioDevices: AudioDeviceCandidate[], theme: MicmeTheme): ConfigurationItem[] {
554
- const currentModel = env("MICME_WHISPER_CPP_MODEL") ?? getDefaultWhisperCppModelPath();
589
+ export function buildConfigurationItems(
590
+ modelCandidates: ModelCandidate[],
591
+ pythonModelCandidatesOrAudioDevices: ModelCandidate[] | AudioDeviceCandidate[],
592
+ audioDevicesOrTheme: AudioDeviceCandidate[] | MicmeTheme,
593
+ maybeTheme?: MicmeTheme,
594
+ ): ConfigurationItem[] {
595
+ const pythonModelCandidates = maybeTheme ? (pythonModelCandidatesOrAudioDevices as ModelCandidate[]) : [];
596
+ const audioDevices = maybeTheme ? (audioDevicesOrTheme as AudioDeviceCandidate[]) : (pythonModelCandidatesOrAudioDevices as AudioDeviceCandidate[]);
597
+ const theme = maybeTheme ?? (audioDevicesOrTheme as MicmeTheme);
598
+ const currentModelPath = getCurrentWhisperCppModelValue();
555
599
  const currentDevice = env("MICME_AUDIO_DEVICE") ?? "0";
556
600
  const audioValues = audioDevices.length > 0 ? audioDevices.map((device) => device.value) : [currentDevice];
557
601
  if (!audioValues.includes(currentDevice)) audioValues.unshift(currentDevice);
@@ -560,6 +604,15 @@ export function buildConfigurationItems(modelCandidates: ModelCandidate[], audio
560
604
  const whisperStreamBinValues = uniqueStrings([env("MICME_WHISPER_STREAM_BIN") ?? "", findExecutable(["whisper-stream"]) ?? "", "whisper-stream"]);
561
605
  const audioFilter = env("MICME_AUDIO_FILTER") ?? "highpass=f=80,lowpass=f=7600";
562
606
  const macosPrintableShortcut = env("MICME_PRINTABLE_SHORTCUTS") ?? (process.platform === "darwin" ? DEFAULT_MACOS_PRINTABLE_SHORTCUT : "");
607
+ const plan = resolveTranscriptionPlan({ transcriptionMode: getTranscriptionMode() });
608
+ const backendValues = ["whisper.cpp", "python"] as const;
609
+ const backendLabels = Object.fromEntries(backendValues.map((value) => [value, formatBackendLabel(value)]));
610
+ const uiBackendValue = getUiBackendValue(plan);
611
+ const whisperCppVisible = (candidate: ResolvedTranscriptionPlan) => getUiBackendValue(candidate) === "whisper.cpp";
612
+ const pythonVisible = (candidate: ResolvedTranscriptionPlan) => getUiBackendValue(candidate) === "python";
613
+ const pythonModelValues = uniqueStrings([env("MICME_WHISPER_MODEL") ?? "base.en", ...pythonModelCandidates.map((candidate) => candidate.value)]);
614
+ const pythonModelLabels = Object.fromEntries(pythonModelCandidates.map((candidate) => [candidate.value, candidate.label]));
615
+ const modelPathCandidates = [{ label: "Use default model", value: "", description: "Clear explicit path override and use Micme's default whisper.cpp model path.", installed: true, kind: "path" as const }, ...modelCandidates];
563
616
 
564
617
  return [
565
618
  {
@@ -572,16 +625,6 @@ export function buildConfigurationItems(modelCandidates: ModelCandidate[], audio
572
625
  values: ["1", "0"],
573
626
  displayKind: "boolean",
574
627
  },
575
- {
576
- id: "MICME_DEFAULT_WHISPER_CPP_MODEL",
577
- categoryId: "general",
578
- label: "Default model name",
579
- description: "Used when no explicit whisper.cpp model path is configured.",
580
- rawValue: env("MICME_DEFAULT_WHISPER_CPP_MODEL") ?? DEFAULT_WHISPER_CPP_MODEL_NAME,
581
- currentValue: env("MICME_DEFAULT_WHISPER_CPP_MODEL") ?? DEFAULT_WHISPER_CPP_MODEL_NAME,
582
- values: [...WHISPER_CPP_MODEL_NAMES],
583
- displayKind: "text",
584
- },
585
628
  {
586
629
  id: "MICME_LANGUAGE",
587
630
  categoryId: "general",
@@ -602,38 +645,54 @@ export function buildConfigurationItems(modelCandidates: ModelCandidate[], audio
602
645
  values: ["clip", "stream"],
603
646
  displayKind: "text",
604
647
  },
648
+ {
649
+ id: "MICME_TRANSCRIBE_BACKEND",
650
+ categoryId: "transcription",
651
+ label: "Backend",
652
+ description: "Choose the transcription backend.",
653
+ rawValue: uiBackendValue,
654
+ currentValue: uiBackendValue,
655
+ values: [...backendValues],
656
+ valueLabels: backendLabels,
657
+ displayKind: "text",
658
+ },
605
659
  {
606
660
  id: "MICME_WHISPER_CPP_MODEL",
607
661
  categoryId: "transcription",
608
- label: "Whisper.cpp model",
609
- description: "Local ggml/gguf Whisper model. Use small.en/medium.en if base.en is too weak.",
610
- rawValue: currentModel,
611
- currentValue: displayConfigurationValue("MICME_WHISPER_CPP_MODEL", currentModel),
662
+ label: "Model",
663
+ description: "Whisper.cpp ggml/gguf model file.",
664
+ rawValue: currentModelPath,
665
+ currentValue: displayConfigurationValue("MICME_WHISPER_CPP_MODEL", currentModelPath),
612
666
  displayKind: "model",
613
667
  emptyLabel: "not set",
614
- submenu: (_currentValue, done) => createModelSelector(modelCandidates, theme, done),
668
+ submenu: (_currentValue, done) => createModelSelector(modelPathCandidates, theme, done),
669
+ visibleWhen: whisperCppVisible,
615
670
  },
616
671
  {
617
672
  id: "MICME_WHISPER_CPP_BIN",
618
673
  categoryId: "transcription",
619
- label: "Whisper.cpp binary",
674
+ label: "Binary",
620
675
  description: "Command/path for whisper.cpp transcription. Leave unset to use whisper-cli/whisper-cpp from PATH.",
621
676
  rawValue: env("MICME_WHISPER_CPP_BIN") ?? "",
622
677
  currentValue: displayConfigurationValue("MICME_WHISPER_CPP_BIN", env("MICME_WHISPER_CPP_BIN") ?? ""),
623
678
  values: whisperCppBinValues,
624
679
  displayKind: "path",
625
680
  emptyLabel: "not set",
681
+ visibleWhen: whisperCppVisible,
626
682
  },
627
683
  {
628
684
  id: "MICME_WHISPER_MODEL",
629
685
  categoryId: "transcription",
630
- label: "Python fallback model",
631
- description: "Used only when whisper.cpp model is not configured.",
686
+ label: "Model",
687
+ description: "Model name passed to the OpenAI Whisper Python CLI.",
632
688
  rawValue: env("MICME_WHISPER_MODEL") ?? "base.en",
633
689
  currentValue: env("MICME_WHISPER_MODEL") ?? "base.en",
634
- values: [...PYTHON_WHISPER_MODEL_NAMES],
690
+ values: pythonModelValues,
691
+ valueLabels: pythonModelLabels,
635
692
  displayKind: "text",
693
+ visibleWhen: pythonVisible,
636
694
  },
695
+
637
696
  {
638
697
  id: "MICME_WHISPER_STREAM_BIN",
639
698
  categoryId: "streaming",
@@ -659,20 +718,30 @@ export function buildConfigurationItems(modelCandidates: ModelCandidate[], audio
659
718
  id: "MICME_STREAM_KEEP_CONTEXT",
660
719
  categoryId: "streaming",
661
720
  label: "Stream context",
662
- description: "Keep Whisper prompt context between chunks for better fast/accented speech continuity.",
663
- rawValue: env("MICME_STREAM_KEEP_CONTEXT") ?? "1",
664
- currentValue: env("MICME_STREAM_KEEP_CONTEXT") ?? "1",
665
- values: ["1", "0"],
721
+ description: "Keep Whisper prompt context between chunks. Off by default for append-only dictation; turn on for more contextual correction.",
722
+ rawValue: env("MICME_STREAM_KEEP_CONTEXT") ?? "0",
723
+ currentValue: env("MICME_STREAM_KEEP_CONTEXT") ?? "0",
724
+ values: ["0", "1"],
666
725
  displayKind: "boolean",
667
726
  },
727
+ {
728
+ id: "MICME_STREAM_FLUSH_MS",
729
+ categoryId: "streaming",
730
+ label: "Stream flush delay",
731
+ description: "Quiet interval before tentative stream words are committed append-only into the editor.",
732
+ rawValue: env("MICME_STREAM_FLUSH_MS") ?? String(DEFAULT_STREAM_FLUSH_MS),
733
+ currentValue: env("MICME_STREAM_FLUSH_MS") ?? String(DEFAULT_STREAM_FLUSH_MS),
734
+ values: ["400", "650", "700", "1000"],
735
+ displayKind: "number",
736
+ },
668
737
  {
669
738
  id: "MICME_STREAM_FINALIZE_WITH_CLIP",
670
739
  categoryId: "streaming",
671
740
  label: "Stream final pass",
672
- description: "On stop, replace the live preview with the stable clip-mode transcript.",
673
- rawValue: env("MICME_STREAM_FINALIZE_WITH_CLIP") ?? "1",
674
- currentValue: env("MICME_STREAM_FINALIZE_WITH_CLIP") ?? "1",
675
- values: ["1", "0"],
741
+ description: "Opt in to replace the append-only live stream with a final clip-mode transcript on stop.",
742
+ rawValue: env("MICME_STREAM_FINALIZE_WITH_CLIP") ?? "0",
743
+ currentValue: env("MICME_STREAM_FINALIZE_WITH_CLIP") ?? "0",
744
+ values: ["0", "1"],
676
745
  displayKind: "boolean",
677
746
  },
678
747
  {
@@ -779,7 +848,7 @@ export function buildConfigurationItems(modelCandidates: ModelCandidate[], audio
779
848
  },
780
849
  {
781
850
  id: "MICME_SHORTCUT",
782
- categoryId: "shortcuts",
851
+ categoryId: "general",
783
852
  label: "Terminal shortcut",
784
853
  description: "Shortcut when your terminal sends real Alt/Ctrl keys. Requires /reload or restart after changing.",
785
854
  rawValue: env("MICME_SHORTCUT") ?? DEFAULT_SHORTCUT,
@@ -789,7 +858,7 @@ export function buildConfigurationItems(modelCandidates: ModelCandidate[], audio
789
858
  },
790
859
  {
791
860
  id: "MICME_PRINTABLE_SHORTCUTS",
792
- categoryId: "shortcuts",
861
+ categoryId: "general",
793
862
  label: "macOS printable shortcut",
794
863
  description: "Toggle-only fallback for terminals where Option+M inserts a character instead of sending Alt+M. Use /reload after changing.",
795
864
  rawValue: macosPrintableShortcut,
@@ -800,9 +869,9 @@ export function buildConfigurationItems(modelCandidates: ModelCandidate[], audio
800
869
  },
801
870
  {
802
871
  id: "MICME_STREAM_DIAGNOSTICS",
803
- categoryId: "diagnostics",
872
+ categoryId: "general",
804
873
  label: "Stream diagnostics",
805
- description: "Show timing notifications for first whisper-stream output and first editor preview.",
874
+ description: "Show opt-in whisper-stream frame/state diagnostics and first-output timing notifications.",
806
875
  rawValue: env("MICME_STREAM_DIAGNOSTICS") ?? "0",
807
876
  currentValue: env("MICME_STREAM_DIAGNOSTICS") ?? "0",
808
877
  values: ["0", "1"],
@@ -860,19 +929,6 @@ export async function saveConfigurationValue(ctx: ExtensionContext, id: string,
860
929
  await writeMicmeConfigValues(valuesToWrite);
861
930
  reloadMicmeConfig();
862
931
 
863
- const configLabel = formatConfigPathForMessage(getMicmeConfigPath());
864
- const overriddenKeys = Object.keys(valuesToWrite).filter((key) => process.env[key] !== undefined);
865
- if (id === "MICME_TRANSCRIPTION_MODE") {
866
- const mode = valuesToWrite.MICME_TRANSCRIPTION_MODE === "stream" ? "stream" : "clip";
867
- const detail = mode === "stream" ? "low-latency stream profile" : "stable clip profile";
868
- const sourceSuffix = overriddenKeys.length ? `; shell env still overrides ${overriddenKeys.join(", ")}` : ` (${configLabel})`;
869
- ctx.ui.notify(`Saved ${mode} mode and applied ${detail}${sourceSuffix}.`, overriddenKeys.length ? "warning" : "info");
870
- } else {
871
- const overrideSuffix = overriddenKeys.includes(id) ? `, but shell env still overrides ${id}` : ` (${configLabel})`;
872
- const reloadSuffix = id === "MICME_SHORTCUT" ? " • /reload required" : id === "MICME_PRINTABLE_SHORTCUTS" ? " • /reload recommended" : "";
873
- ctx.ui.notify(`Saved ${id}=${displayConfigurationValue(id, value)}${overrideSuffix}${reloadSuffix}`, overriddenKeys.includes(id) ? "warning" : "info");
874
- }
875
-
876
932
  const effectiveValues: Record<string, string> = {};
877
933
  for (const key of Object.keys(valuesToWrite)) effectiveValues[key] = env(key) ?? "";
878
934
  return effectiveValues;
@@ -880,10 +936,21 @@ export async function saveConfigurationValue(ctx: ExtensionContext, id: string,
880
936
 
881
937
  export function displayConfigurationValue(id: string, value: string) {
882
938
  if (id === "MICME_WHISPER_CPP_MODEL") return value ? basename(value) : "not set";
939
+ if (id === "MICME_TRANSCRIBE_COMMAND") return value ? "configured" : "not set";
883
940
  if (id === "MICME_AUDIO_FILTER") return value || "<empty>";
884
941
  return value || "not set";
885
942
  }
886
943
 
944
+ function getUiBackendValue(plan: ResolvedTranscriptionPlan): "whisper.cpp" | "python" {
945
+ if (plan.requestedBackend === "python" || plan.requestedBackend === "whisper.cpp") return plan.requestedBackend;
946
+ return plan.effectiveBackend === "python" ? "python" : "whisper.cpp";
947
+ }
948
+
949
+ function getCurrentWhisperCppModelValue() {
950
+ const explicit = env("MICME_WHISPER_CPP_MODEL")?.trim();
951
+ return explicit ? expandConfigPath(explicit) : resolveWhisperCppModel().path;
952
+ }
953
+
887
954
  export function uniqueStrings(values: string[]) {
888
955
  const seen = new Set<string>();
889
956
  const output: string[] = [];
@@ -899,24 +966,11 @@ export function uniqueStrings(values: string[]) {
899
966
  function formatSaveStatus(id: string, value: string) {
900
967
  const writtenKeys = id === "MICME_TRANSCRIPTION_MODE" ? Object.keys(getTranscriptionModeProfile(value === "stream" ? "stream" : "clip")) : [id];
901
968
  const overriddenKeys = writtenKeys.filter((key) => process.env[key] !== undefined);
902
- const configLabel = formatConfigPathForMessage(getMicmeConfigPath());
903
- if (id === "MICME_TRANSCRIPTION_MODE") {
904
- const mode = value === "stream" ? "stream" : "clip";
905
- const detail = mode === "stream" ? "low-latency stream profile" : "stable clip profile";
906
- const sourceSuffix = overriddenKeys.length ? ` • shell env still overrides ${overriddenKeys.join(", ")}` : ` • ${configLabel}`;
907
- return `Saved MICME_TRANSCRIPTION_MODE=${mode} and applied ${detail}${sourceSuffix}`;
908
- }
909
-
910
- const sourceSuffix = overriddenKeys.includes(id) ? `, but shell env still overrides ${id}` : ` (${configLabel})`;
911
- const reloadSuffix = id === "MICME_SHORTCUT" ? " • /reload required" : id === "MICME_PRINTABLE_SHORTCUTS" ? " • /reload recommended" : "";
912
- return `Saved ${id}=${displayConfigurationValue(id, value)}${sourceSuffix}${reloadSuffix}`;
913
- }
969
+ const reloadHint = id === "MICME_SHORTCUT" ? "/reload required for shortcut changes" : id === "MICME_PRINTABLE_SHORTCUTS" ? "/reload recommended for printable shortcuts" : "";
914
970
 
915
- function formatConfigPathForMessage(path: string) {
916
- const home = homedir();
917
- if (home && path === home) return "~";
918
- if (home && path.startsWith(`${home}/`)) return `~/${path.slice(home.length + 1)}`;
919
- return path;
971
+ if (id === "MICME_TRANSCRIPTION_MODE" && overriddenKeys.length) return `Shell env still overrides ${overriddenKeys.join(", ")}`;
972
+ if (overriddenKeys.includes(id)) return reloadHint ? `Shell env still overrides ${id} • ${reloadHint}` : `Shell env still overrides ${id}`;
973
+ return reloadHint;
920
974
  }
921
975
 
922
976
  function fitAnsi(text: string, width: number, ellipsis = "…") {