@@ -235,7 +235,7 @@ final class SettingsStore: ObservableObject {
235235 let systemPrompt : String
236236 }
237237
238- /// User-defined dictation prompt profiles (named system prompts for dictation cleanup ).
238+ /// User-defined dictation prompt profiles (named system prompts for dictation enhancement ).
239239 /// The built-in default prompt is not stored here.
240240 var dictationPromptProfiles : [ DictationPromptProfile ] {
241241 get {
@@ -886,6 +886,15 @@ final class SettingsStore: ObservableObject {
886886 )
887887 }
888888
889+ if self . promptRoutingScope ( for: normalizedMode) == . selectedAppsOnly {
890+ return self . defaultPromptResolution (
891+ for: normalizedMode,
892+ source: . builtInDefault,
893+ appBinding: nil ,
894+ allowDefaultOverride: false
895+ )
896+ }
897+
889898 if let profile = self . selectedPromptProfile ( for: normalizedMode) {
890899 let body = Self . stripBasePrompt ( for: normalizedMode, from: profile. prompt)
891900 if !body. isEmpty {
@@ -907,6 +916,11 @@ final class SettingsStore: ObservableObject {
907916 }
908917
909918 func effectiveDictationPromptBody( for slot: DictationShortcutSlot , appBundleID: String ? = nil ) -> String {
919+ if self . promptRoutingScope ( for: . dictate) == . selectedAppsOnly {
920+ guard self . dictationPromptSelection ( for: slot) != . off else { return " " }
921+ return self . effectivePromptBody ( for: . dictate, appBundleID: appBundleID)
922+ }
923+
910924 switch self . dictationPromptSelection ( for: slot) {
911925 case . off:
912926 return " "
@@ -925,6 +939,11 @@ final class SettingsStore: ObservableObject {
925939 }
926940
927941 func effectiveDictationSystemPrompt( for slot: DictationShortcutSlot , appBundleID: String ? = nil ) -> String {
942+ if self . promptRoutingScope ( for: . dictate) == . selectedAppsOnly {
943+ guard self . dictationPromptSelection ( for: slot) != . off else { return " " }
944+ return self . effectiveSystemPrompt ( for: . dictate, appBundleID: appBundleID)
945+ }
946+
928947 switch self . dictationPromptSelection ( for: slot) {
929948 case . off, . default:
930949 return self . effectiveSystemPrompt ( for: . dictate, appBundleID: appBundleID)
@@ -953,10 +972,10 @@ final class SettingsStore: ObservableObject {
953972 }
954973
955974 /// Literal placeholder that gets substituted with the raw transcription
956- /// when composing the user message for a dictation cleanup call.
975+ /// when composing the user message for a dictation enhancement call.
957976 static let transcriptPlaceholder = " ${transcript} "
958977
959- /// Compose the user-turn string for a dictation cleanup call by folding
978+ /// Compose the user-turn string for a dictation enhancement call by folding
960979 /// the transcript into the prompt template. If the template contains the
961980 /// `${transcript}` placeholder, the placeholder is replaced; otherwise
962981 /// the transcript is appended after a blank line, matching the pre-PR
@@ -973,9 +992,10 @@ final class SettingsStore: ObservableObject {
973992 private func defaultPromptResolution(
974993 for mode: PromptMode ,
975994 source: PromptResolutionSource ,
976- appBinding: AppPromptBinding ?
995+ appBinding: AppPromptBinding ? ,
996+ allowDefaultOverride: Bool = true
977997 ) -> PromptResolution {
978- if let override = self . defaultPromptOverride ( for: mode) {
998+ if allowDefaultOverride , let override = self . defaultPromptOverride ( for: mode) {
979999 let trimmedOverride = override. trimmingCharacters ( in: . whitespacesAndNewlines)
9801000 if trimmedOverride. isEmpty {
9811001 return PromptResolution (
@@ -2265,7 +2285,9 @@ final class SettingsStore: ObservableObject {
22652285 customDictionaryEntries: self . customDictionaryEntries,
22662286 selectedDictationPromptID: self . selectedDictationPromptID,
22672287 dictationPromptOff: self . isDictationPromptOff,
2288+ dictationPromptRoutingScope: self . dictationPromptRoutingScope,
22682289 selectedEditPromptID: self . selectedEditPromptID,
2290+ editPromptRoutingScope: self . editPromptRoutingScope,
22692291 defaultDictationPromptOverride: self . defaultDictationPromptOverride,
22702292 defaultEditPromptOverride: self . defaultEditPromptOverride
22712293 )
@@ -2340,6 +2362,8 @@ final class SettingsStore: ObservableObject {
23402362 self . appPromptBindings = appPromptBindings
23412363 self . selectedDictationPromptID = payload. selectedDictationPromptID
23422364 self . isDictationPromptOff = payload. dictationPromptOff ?? self . isDictationPromptOff
2365+ self . dictationPromptRoutingScope = payload. dictationPromptRoutingScope ?? . allApps
2366+ self . editPromptRoutingScope = payload. editPromptRoutingScope ?? . allApps
23432367 self . selectedEditPromptID = payload. selectedEditPromptID
23442368 self . defaultDictationPromptOverride = payload. defaultDictationPromptOverride
23452369 self . defaultEditPromptOverride = payload. defaultEditPromptOverride
0 commit comments