知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
feat: after each meeting, notes and transcript can be saved as Markdown into a folder you pick, such as an Obsidian vault
wquguru3b488088d893
diff --git a/Resources/Info.plist b/Resources/Info.plistindex 35a5f82..11617d8 100644--- a/Resources/Info.plist+++ b/Resources/Info.plist@@ -56,6 +56,16 @@<false/><key>NSAudioCaptureUsageDescription</key><string>Cicada reads the sound your Mac is playing to make live subtitles.</string>+ <key>NSDocumentsFolderUsageDescription</key>+ <string>To save each meeting's notes and transcript into the folder you chose.</string>+ <key>NSDesktopFolderUsageDescription</key>+ <string>To save each meeting's notes and transcript into the folder you chose.</string>+ <key>NSDownloadsFolderUsageDescription</key>+ <string>To save each meeting's notes and transcript into the folder you chose.</string>+ <key>NSRemovableVolumesUsageDescription</key>+ <string>To save each meeting's notes and transcript into the folder you chose.</string>+ <key>NSNetworkVolumesUsageDescription</key>+ <string>To save each meeting's notes and transcript into the folder you chose.</string><key>NSHighResolutionCapable</key><true/><key>NSHumanReadableCopyright</key>diff --git a/Resources/en.lproj/InfoPlist.strings b/Resources/en.lproj/InfoPlist.stringsindex c41589b..0b8b8e4 100644--- a/Resources/en.lproj/InfoPlist.strings+++ b/Resources/en.lproj/InfoPlist.strings@@ -4,3 +4,8 @@ NSAudioCaptureUsageDescription = "Cicada reads the sound your Mac is playing toNSMicrophoneUsageDescription = "While you hold the talk key, Cicada uses the microphone to translate what you say into the other side's language. When it listens to a meeting in the room, the microphone hears the people there.";NSSpeechRecognitionUsageDescription = "Cicada uses speech recognition to turn audio into text.";NSLocalNetworkUsageDescription = "Only to reach the AI server you set up on your local network. Cicada doesn't look for or connect to other devices.";+NSDocumentsFolderUsageDescription = "To save each meeting's notes and transcript into the folder you chose.";+NSDesktopFolderUsageDescription = "To save each meeting's notes and transcript into the folder you chose.";+NSDownloadsFolderUsageDescription = "To save each meeting's notes and transcript into the folder you chose.";+NSRemovableVolumesUsageDescription = "To save each meeting's notes and transcript into the folder you chose.";+NSNetworkVolumesUsageDescription = "To save each meeting's notes and transcript into the folder you chose.";diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.stringsindex 8f7131b..36e7a13 100644--- a/Resources/en.lproj/Localizable.strings+++ b/Resources/en.lproj/Localizable.strings@@ -1434,3 +1434,36 @@"正在听外放…" = "Listening to the speaker…";"知了 · 正在听" = "Cicada · Listening";"没听到声音,请拔掉耳机或调大音量" = "No sound; unplug headphones or turn it up";++/* FolderExport */+"会后存一份" = "After the meeting";+"纪要没存到文件夹" = "Notes weren't saved to the folder";+"知了没有权限写入 %@。点按去设置" = "Cicada isn't allowed to write to %@. Click to open Settings";+"上次存于 %@ · %@" = "Last saved %@ · %@";+"存到文件夹" = "Save to folder";+"纪要和文字记录存成 Markdown;文件夹同步到哪,内容就到哪" = "Notes and transcript as Markdown; wherever the folder syncs, they go too";+"位置" = "Location";+"以前的会议" = "Earlier meetings";+"还有 %lld 场没存" = "%lld not saved yet";+"正在确认能写入 %@…" = "Checking Cicada can write to %@…";+"Obsidian 库" = "Obsidian vault";+"更改…" = "Change…";+"也存一份" = "Save them too";+"其他文件夹…" = "Another folder…";+"去系统设置" = "Open System Settings";+"没有权限写入 %@" = "Not allowed to write to %@";+"找不到 %@" = "Can't find %@";+"接上或换个文件夹后自动补存" = "Saves once it's back, or pick another folder";+"没存上" = "Not saved";+"%lld 场会议没存上,允许后自动补存" = "%lld meetings not saved; they save once allowed";+"在系统设置里允许知了,或换个文件夹" = "Allow Cicada in System Settings, or pick another folder";+"Obsidian 库「%@」" = "Obsidian vault “%@”";+"在库里新建 Cicada 文件夹" = "A new Cicada folder inside it";+"存到哪里" = "Save where";+"macOS 可能会问一次能不能访问这个位置" = "macOS may ask once whether Cicada can use this location";+"存到这里" = "Save here";+"会后把纪要和文字记录存成 Markdown 到这里" = "After each meeting, notes and transcript are saved here as Markdown";+"已存到 %@ ·" = "Saved to %@ ·";+"没存到文件夹 ·" = "Not saved to the folder ·";+"整理好后存到 %@" = "Saves to %@ once the notes are ready";+"在访达中显示" = "Show in Finder";diff --git a/Resources/en.lproj/Localizable.stringsdict b/Resources/en.lproj/Localizable.stringsdictindex 2df465c..14348ad 100644--- a/Resources/en.lproj/Localizable.stringsdict+++ b/Resources/en.lproj/Localizable.stringsdict@@ -258,5 +258,37 @@<string>And %lld more</string></dict></dict>+ <key>还有 %lld 场没存</key>+ <dict>+ <key>NSStringLocalizedFormatKey</key>+ <string>%#@n@</string>+ <key>n</key>+ <dict>+ <key>NSStringFormatSpecTypeKey</key>+ <string>NSStringPluralRuleType</string>+ <key>NSStringFormatValueTypeKey</key>+ <string>lld</string>+ <key>one</key>+ <string>%lld not saved yet</string>+ <key>other</key>+ <string>%lld not saved yet</string>+ </dict>+ </dict>+ <key>%lld 场会议没存上,允许后自动补存</key>+ <dict>+ <key>NSStringLocalizedFormatKey</key>+ <string>%#@n@</string>+ <key>n</key>+ <dict>+ <key>NSStringFormatSpecTypeKey</key>+ <string>NSStringPluralRuleType</string>+ <key>NSStringFormatValueTypeKey</key>+ <string>lld</string>+ <key>one</key>+ <string>%lld meeting not saved; it saves once allowed</string>+ <key>other</key>+ <string>%lld meetings not saved; they save once allowed</string>+ </dict>+ </dict></dict></plist>diff --git a/Resources/ja.lproj/InfoPlist.strings b/Resources/ja.lproj/InfoPlist.stringsindex 7744961..cf53740 100644--- a/Resources/ja.lproj/InfoPlist.strings+++ b/Resources/ja.lproj/InfoPlist.strings@@ -4,3 +4,8 @@ NSAudioCaptureUsageDescription = "ライブ字幕を作るため、Cicada は MaNSMicrophoneUsageDescription = "話すキーを押している間、Cicada はマイクを使ってあなたの言葉を相手の言語に翻訳します。会議室を聞くときは、マイクでその場の人の声を聞きます。";NSSpeechRecognitionUsageDescription = "Cicada は音声をテキストにするために音声認識を使います。";NSLocalNetworkUsageDescription = "AI サービスに設定したローカルネットワーク上のサーバーに接続するためだけに使います。Cicada がほかのデバイスを探したり接続したりすることはありません。";+NSDocumentsFolderUsageDescription = "会議のあと、議事録と文字起こしを選んだフォルダに保存するため。";+NSDesktopFolderUsageDescription = "会議のあと、議事録と文字起こしを選んだフォルダに保存するため。";+NSDownloadsFolderUsageDescription = "会議のあと、議事録と文字起こしを選んだフォルダに保存するため。";+NSRemovableVolumesUsageDescription = "会議のあと、議事録と文字起こしを選んだフォルダに保存するため。";+NSNetworkVolumesUsageDescription = "会議のあと、議事録と文字起こしを選んだフォルダに保存するため。";diff --git a/Resources/ja.lproj/Localizable.strings b/Resources/ja.lproj/Localizable.stringsindex 420c871..45d0da7 100644--- a/Resources/ja.lproj/Localizable.strings+++ b/Resources/ja.lproj/Localizable.strings@@ -1434,3 +1434,36 @@"正在听外放…" = "スピーカーを聞いています…";"知了 · 正在听" = "Cicada · 聞いています";"没听到声音,请拔掉耳机或调大音量" = "音が聞こえません。イヤホンを外すか音量を上げてください";++/* FolderExport */+"会后存一份" = "会議のあとに保存";+"纪要没存到文件夹" = "議事録をフォルダに保存できませんでした";+"知了没有权限写入 %@。点按去设置" = "Cicada には %@ への書き込み権限がありません。クリックして設定へ";+"上次存于 %@ · %@" = "前回の保存 %@ · %@";+"存到文件夹" = "フォルダに保存";+"纪要和文字记录存成 Markdown;文件夹同步到哪,内容就到哪" = "議事録と文字起こしを Markdown で保存。フォルダの同期先にも届きます";+"位置" = "場所";+"以前的会议" = "以前の会議";+"还有 %lld 场没存" = "未保存が %lld 件";+"正在确认能写入 %@…" = "%@ に書き込めるか確認中…";+"Obsidian 库" = "Obsidian 保管庫";+"更改…" = "変更…";+"也存一份" = "これも保存";+"其他文件夹…" = "別のフォルダ…";+"去系统设置" = "システム設定を開く";+"没有权限写入 %@" = "%@ への書き込み権限がありません";+"找不到 %@" = "%@ が見つかりません";+"接上或换个文件夹后自动补存" = "接続し直すか別のフォルダを選ぶと自動で保存します";+"没存上" = "保存できませんでした";+"%lld 场会议没存上,允许后自动补存" = "%lld 件の会議が未保存。許可すると自動で保存します";+"在系统设置里允许知了,或换个文件夹" = "システム設定で Cicada を許可するか、別のフォルダを選んでください";+"Obsidian 库「%@」" = "Obsidian 保管庫「%@」";+"在库里新建 Cicada 文件夹" = "保管庫に Cicada フォルダを作成";+"存到哪里" = "保存先";+"macOS 可能会问一次能不能访问这个位置" = "macOS がこの場所へのアクセスを一度確認することがあります";+"存到这里" = "ここに保存";+"会后把纪要和文字记录存成 Markdown 到这里" = "会議のあと、議事録と文字起こしを Markdown でここに保存します";+"已存到 %@ ·" = "%@ に保存済み ·";+"没存到文件夹 ·" = "フォルダに未保存 ·";+"整理好后存到 %@" = "議事録ができたら %@ に保存";+"在访达中显示" = "Finder で表示";diff --git a/Resources/ko.lproj/InfoPlist.strings b/Resources/ko.lproj/InfoPlist.stringsindex 5799cbb..263121d 100644--- a/Resources/ko.lproj/InfoPlist.strings+++ b/Resources/ko.lproj/InfoPlist.strings@@ -4,3 +4,8 @@ NSAudioCaptureUsageDescription = "실시간 자막을 만들기 위해 Cicada가NSMicrophoneUsageDescription = "말하기 키를 누르고 있는 동안 Cicada가 마이크로 내 말을 상대의 언어로 번역합니다. 회의실을 들을 때는 마이크로 그 자리에 있는 사람들의 말을 듣습니다.";NSSpeechRecognitionUsageDescription = "Cicada는 음성을 텍스트로 바꾸기 위해 음성 인식을 사용합니다.";NSLocalNetworkUsageDescription = "AI 서비스에 설정한 로컬 네트워크 서버에 연결할 때만 사용합니다. Cicada는 다른 기기를 찾거나 연결하지 않습니다.";+NSDocumentsFolderUsageDescription = "회의 후 회의록과 기록을 선택한 폴더에 저장하기 위해서입니다.";+NSDesktopFolderUsageDescription = "회의 후 회의록과 기록을 선택한 폴더에 저장하기 위해서입니다.";+NSDownloadsFolderUsageDescription = "회의 후 회의록과 기록을 선택한 폴더에 저장하기 위해서입니다.";+NSRemovableVolumesUsageDescription = "회의 후 회의록과 기록을 선택한 폴더에 저장하기 위해서입니다.";+NSNetworkVolumesUsageDescription = "회의 후 회의록과 기록을 선택한 폴더에 저장하기 위해서입니다.";diff --git a/Resources/ko.lproj/Localizable.strings b/Resources/ko.lproj/Localizable.stringsindex 0b5a8a5..d1c278e 100644--- a/Resources/ko.lproj/Localizable.strings+++ b/Resources/ko.lproj/Localizable.strings@@ -1434,3 +1434,36 @@"正在听外放…" = "스피커를 듣는 중…";"知了 · 正在听" = "Cicada · 듣는 중";"没听到声音,请拔掉耳机或调大音量" = "소리가 안 들려요. 이어폰을 빼거나 볼륨을 높이세요";++/* FolderExport */+"会后存一份" = "회의 후 저장";+"纪要没存到文件夹" = "회의록을 폴더에 저장하지 못했습니다";+"知了没有权限写入 %@。点按去设置" = "Cicada에 %@ 쓰기 권한이 없습니다. 클릭해서 설정 열기";+"上次存于 %@ · %@" = "마지막 저장 %@ · %@";+"存到文件夹" = "폴더에 저장";+"纪要和文字记录存成 Markdown;文件夹同步到哪,内容就到哪" = "회의록과 기록을 Markdown으로 저장합니다. 폴더가 동기화되는 곳에도 갑니다";+"位置" = "위치";+"以前的会议" = "이전 회의";+"还有 %lld 场没存" = "%lld개 아직 저장 안 됨";+"正在确认能写入 %@…" = "%@에 쓸 수 있는지 확인 중…";+"Obsidian 库" = "Obsidian 보관함";+"更改…" = "변경…";+"也存一份" = "함께 저장";+"其他文件夹…" = "다른 폴더…";+"去系统设置" = "시스템 설정 열기";+"没有权限写入 %@" = "%@에 쓸 권한이 없음";+"找不到 %@" = "%@을(를) 찾을 수 없음";+"接上或换个文件夹后自动补存" = "다시 연결하거나 다른 폴더를 고르면 자동 저장";+"没存上" = "저장 못 함";+"%lld 场会议没存上,允许后自动补存" = "회의 %lld개 저장 안 됨. 허용하면 자동 저장";+"在系统设置里允许知了,或换个文件夹" = "시스템 설정에서 Cicada를 허용하거나 다른 폴더를 고르세요";+"Obsidian 库「%@」" = "Obsidian 보관함 “%@”";+"在库里新建 Cicada 文件夹" = "보관함 안에 Cicada 폴더 생성";+"存到哪里" = "저장 위치";+"macOS 可能会问一次能不能访问这个位置" = "macOS가 이 위치 접근을 한 번 물을 수 있습니다";+"存到这里" = "여기에 저장";+"会后把纪要和文字记录存成 Markdown 到这里" = "회의 후 회의록과 기록을 Markdown으로 여기에 저장합니다";+"已存到 %@ ·" = "%@에 저장됨 ·";+"没存到文件夹 ·" = "폴더에 저장 안 됨 ·";+"整理好后存到 %@" = "회의록이 준비되면 %@에 저장";+"在访达中显示" = "Finder에서 보기";diff --git a/Resources/zh-Hans.lproj/InfoPlist.strings b/Resources/zh-Hans.lproj/InfoPlist.stringsindex b1bbc1b..f63cab5 100644--- a/Resources/zh-Hans.lproj/InfoPlist.strings+++ b/Resources/zh-Hans.lproj/InfoPlist.strings@@ -4,3 +4,8 @@ NSAudioCaptureUsageDescription = "知了需要读取系统正在播放的声音NSMicrophoneUsageDescription = "按住快捷键说话时,知了需要麦克风把你的话翻译成对方的语言;听会议室时,麦克风用来听屋里的人说话。";NSSpeechRecognitionUsageDescription = "知了需要语音识别权限,把音频转成文字。";NSLocalNetworkUsageDescription = "只用来连接你在 AI 服务里填的局域网服务器。知了不会查找或连接别的设备。";+NSDocumentsFolderUsageDescription = "会后把纪要和文字记录存到你选的文件夹。";+NSDesktopFolderUsageDescription = "会后把纪要和文字记录存到你选的文件夹。";+NSDownloadsFolderUsageDescription = "会后把纪要和文字记录存到你选的文件夹。";+NSRemovableVolumesUsageDescription = "会后把纪要和文字记录存到你选的文件夹。";+NSNetworkVolumesUsageDescription = "会后把纪要和文字记录存到你选的文件夹。";diff --git a/Resources/zh-Hans.lproj/Localizable.strings b/Resources/zh-Hans.lproj/Localizable.stringsindex 78d5eeb..e699782 100644--- a/Resources/zh-Hans.lproj/Localizable.strings+++ b/Resources/zh-Hans.lproj/Localizable.strings@@ -1342,3 +1342,36 @@"正在听外放…" = "正在听外放…";"知了 · 正在听" = "知了 · 正在听";"没听到声音,请拔掉耳机或调大音量" = "没听到声音,请拔掉耳机或调大音量";++/* FolderExport */+"会后存一份" = "会后存一份";+"纪要没存到文件夹" = "纪要没存到文件夹";+"知了没有权限写入 %@。点按去设置" = "知了没有权限写入 %@。点按去设置";+"上次存于 %@ · %@" = "上次存于 %@ · %@";+"存到文件夹" = "存到文件夹";+"纪要和文字记录存成 Markdown;文件夹同步到哪,内容就到哪" = "纪要和文字记录存成 Markdown;文件夹同步到哪,内容就到哪";+"位置" = "位置";+"以前的会议" = "以前的会议";+"还有 %lld 场没存" = "还有 %lld 场没存";+"正在确认能写入 %@…" = "正在确认能写入 %@…";+"Obsidian 库" = "Obsidian 库";+"更改…" = "更改…";+"也存一份" = "也存一份";+"其他文件夹…" = "其他文件夹…";+"去系统设置" = "去系统设置";+"没有权限写入 %@" = "没有权限写入 %@";+"找不到 %@" = "找不到 %@";+"接上或换个文件夹后自动补存" = "接上或换个文件夹后自动补存";+"没存上" = "没存上";+"%lld 场会议没存上,允许后自动补存" = "%lld 场会议没存上,允许后自动补存";+"在系统设置里允许知了,或换个文件夹" = "在系统设置里允许知了,或换个文件夹";+"Obsidian 库「%@」" = "Obsidian 库「%@」";+"在库里新建 Cicada 文件夹" = "在库里新建 Cicada 文件夹";+"存到哪里" = "存到哪里";+"macOS 可能会问一次能不能访问这个位置" = "macOS 可能会问一次能不能访问这个位置";+"存到这里" = "存到这里";+"会后把纪要和文字记录存成 Markdown 到这里" = "会后把纪要和文字记录存成 Markdown 到这里";+"已存到 %@ ·" = "已存到 %@ ·";+"没存到文件夹 ·" = "没存到文件夹 ·";+"整理好后存到 %@" = "整理好后存到 %@";+"在访达中显示" = "在访达中显示";diff --git a/Sources/Cicada/AppModel.swift b/Sources/Cicada/AppModel.swiftindex 48a49cf..8ca9932 100644--- a/Sources/Cicada/AppModel.swift+++ b/Sources/Cicada/AppModel.swift@@ -162,6 +162,8 @@ final class AppModel: ObservableObject {let updates = Updates()let loginItem = LoginItem()lazy var notes = NotesEngine(ling: ling, store: store)+ /// 存到文件夹 (settings › 通用).+ lazy var folderExport = FolderExporter(store: store, settings: settings)lazy var notesWindow = NotesWindowController(model: self)lazy var importer = FileImporter(store: store, settings: settings, translator: translator)let vocabulary = Vocabulary(url: Vocabulary.defaultURL)@@ -316,6 +318,11 @@ final class AppModel: ObservableObject {}}importer.onFinished = { [weak self] id in self?.importFinished(id) }+ // 存到文件夹: written once a record is settled, rewritten when it changes.+ folderExport.settling = { [weak self] id in self?.notes.settling(id) ?? false }+ store.onSave = { [weak self] id in self?.folderExport.saved(id) }+ notes.finalDone = { [weak self] id in self?.folderExport.settled(id) }+ folderExport.retry()notes.language = { [weak self] id inTranslationService.englishName(self?.notesLanguageCode(id) ?? "zh-CN")}@@ -760,6 +767,7 @@ final class AppModel: ObservableObject {store.end(at: endedAt, heardSpeech: listen.heardSpeech)if settings.speakerVoices, let ended { speakerNamer.guess(ended, force: true) }notes.finish()+ if let ended { folderExport.ended(ended) }overlay.hide()refresh()updates.notifyIfDue() // held while the meeting was on@@ -1164,7 +1172,10 @@ final class AppModel: ObservableObject {networkMonitor.start(queue: DispatchQueue(label: "cicada.ai-network"))// Turning the local network permission on doesn't change the path: look again on coming back.NotificationCenter.default.addObserver(forName: NSApplication.didBecomeActiveNotification, object: nil, queue: .main) { [weak self] _ in- MainActor.assumeIsolated { self?.ling.recheckLocalNetwork() }+ MainActor.assumeIsolated {+ self?.ling.recheckLocalNetwork()+ self?.folderExport.retry() // a folder permission fixed in System Settings+ }}}@@ -1687,6 +1698,7 @@ final class AppModel: ObservableObject {func deleteSession(_ id: String) {importer.cancel(id)store.delete(id)+ folderExport.deleted(id)}private func importFinished(_ id: String) {@@ -1695,6 +1707,7 @@ final class AppModel: ObservableObject {if settings.speakerVoices { speakerNamer.guess(id, force: true) }let notesToo = settings.importNotes && ling.hasKey && !s.lines.isEmptyif notesToo { notes.generate(for: id) }+ folderExport.ended(id)let content = UNMutableNotificationContent()content.title = L("\(s.displayTitle) 转好了")content.body = L("\(RecordList.length(s)) · \(s.lines.count) 句") + (notesToo ? L(",正在整理纪要") : "")@@ -2317,6 +2330,22 @@ final class AppModel: ObservableObject {case "frame":debugLog("overlay frame=\(overlay.barFrame) font=\(overlay.currentFontSize)")case "import": importFiles(arg.split(separator: ",").map { URL(fileURLWithPath: String($0)) })+ // 存到文件夹: exportFolder:<path> picks a folder (as 存到这里 does), exportFolder:off turns it+ // off; exportAll is 也存一份; exportState replies with the index and the problem.+ case "exportFolder":+ if arg == "off" { folderExport.turnOff() } else { folderExport.choose(URL(fileURLWithPath: arg, isDirectory: true)) }+ case "exportAll": folderExport.writeAll()+ case "rename":+ // rename:<id>=<title> as if typed into the record's title (empty: the automatic one).+ let p = arg.split(separator: "=", maxSplits: 1).map(String.init)+ store.rename(p[0], to: p.count > 1 ? p[1] : "")+ case "exportState":+ let x = folderExport+ DebugRun.reply?.data = [+ "on": x.on, "folder": settings.exportFolder, "checking": x.checking,+ "problem": x.problem.map { "\($0)" } as Any, "files": x.index.files, "pending": x.index.pending,+ "unwritten": x.unwritten.count, "lastFile": x.index.lastFile as Any,+ ] as [String: Any]case "importCancel": importer.cancelAll()case "importRetry":// `<id>=<locale>`: as if that language was picked in 这场会议只留下了录音.@@ -2423,6 +2452,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, UNUsmodel.openMicrophoneSettings()return}+ // "纪要没存到文件夹": settings › 通用, where the row says what to do.+ if problem == "folder" {+ model.openSettings(.records)+ return+ }// "有新版本": the panel shows the download, and install asks first if a meeting is on.if update != nil {if !popover.isShown { togglePopover() }diff --git a/Sources/Cicada/FolderExport.swift b/Sources/Cicada/FolderExport.swiftnew file mode 100644index 0000000..5d830e4--- /dev/null+++ b/Sources/Cicada/FolderExport.swift@@ -0,0 +1,430 @@+import AppKit+import Foundation+import UserNotifications++/// 存到文件夹: the file a settled meeting becomes (docs/folder-export.md). The name and frontmatter+/// are a contract with the ports (Tests/fixtures/folder-export); the body is 导出 Markdown's.+enum FolderExportFormat {+ /// The record's own name: what the user called it, else the notes' title, else the imported+ /// file's name. Never `displayTitle`, which is localized and carries a date.+ static func name(_ s: Session) -> String {+ if s.renamed ?? !s.title.hasPrefix("会议 ") { return s.title }+ if let t = s.notes?.title, !t.isEmpty { return t }+ if let file = s.sourceFile { return (file as NSString).deletingPathExtension }+ return ""+ }++ /// A name every system accepts and a vault can link to: no path, wildcard or link characters,+ /// at most 120 UTF-8 bytes (vaults sync between systems, so the union of their rules).+ static func safeName(_ name: String) -> String {+ let banned = Set("/\\:*?\"<>|#^[]".unicodeScalars)+ let spaced = String(String.UnicodeScalarView(name.unicodeScalars.map { banned.contains($0) || $0.value < 0x20 ? " " : $0 }))+ var out = trim(spaced.split(whereSeparator: \.isWhitespace).joined(separator: " "))+ if out.utf8.count > 120 {+ var cut = String.UnicodeScalarView()+ var bytes = 0+ for u in out.unicodeScalars {+ bytes += String(u).utf8.count+ if bytes > 120 { break }+ cut.append(u)+ }+ out = trim(String(cut))+ }+ return out+ }++ private static func trim(_ s: String) -> String {+ var scalars = Array(s.unicodeScalars)+ while let f = scalars.first, f == " " || f == "." { scalars.removeFirst() }+ while let l = scalars.last, l == " " || l == "." { scalars.removeLast() }+ return String(String.UnicodeScalarView(scalars))+ }++ static func stem(_ s: Session, timeZone: TimeZone = .current) -> String {+ let date = format(s.startedAt, "yyyy-MM-dd HHmm", timeZone)+ let safe = safeName(name(s))+ return safe.isEmpty ? date : "\(date) \(safe)"+ }++ /// `stem.md`, or `stem 2.md`, `stem 3.md`… when a name is taken.+ static func fileName(_ stem: String, taken: (String) -> Bool) -> String {+ var n = 1+ while true {+ let name = n == 1 ? "\(stem).md" : "\(stem) \(n).md"+ if !taken(name) { return name }+ n += 1+ }+ }++ /// A JSON-style double-quoted string, which YAML reads as is.+ static func quote(_ s: String) -> String {+ var out = "\""+ for u in s.unicodeScalars {+ switch u {+ case "\\": out += "\\\\"+ case "\"": out += "\\\""+ case "\n": out += "\\n"+ case "\r": out += "\\r"+ case "\t": out += "\\t"+ case _ where u.value < 0x20: out += String(format: "\\u%04x", u.value)+ default: out.unicodeScalars.append(u)+ }+ }+ return out + "\""+ }++ static func frontmatter(_ s: Session, timeZone: TimeZone = .current) -> String {+ let ended = s.endedAt ?? s.startedAt+ let languages = Set(s.lines.map(\.srcLang)).sorted { Array($0.unicodeScalars.map(\.value)).lexicographicallyPrecedes($1.unicodeScalars.map(\.value)) }+ let notes = s.notes.map { $0.isEmpty ? "none" : $0.final ? "final" : "draft" } ?? "none"+ return """+ ---+ cicada: 1+ id: \(quote(s.id))+ title: \(quote(name(s)))+ started: \(quote(format(s.startedAt, "yyyy-MM-dd'T'HH:mm:ssxxx", timeZone)))+ ended: \(quote(format(ended, "yyyy-MM-dd'T'HH:mm:ssxxx", timeZone)))+ minutes: \(max(0, Int(ended.timeIntervalSince(s.startedAt) / 60)))+ languages: [\(languages.map(quote).joined(separator: ", "))]+ source: \(quote(s.sourceFile == nil ? "meeting" : "file"))+ notes: \(quote(notes))+ tags: ["cicada"]+ ---++ """+ }++ static func document(_ s: Session) -> String { frontmatter(s) + TranscriptExport.markdown(s) }++ private static func format(_ date: Date, _ pattern: String, _ tz: TimeZone) -> String {+ let f = DateFormatter()+ f.locale = Locale(identifier: "en_US_POSIX")+ f.calendar = Calendar(identifier: .gregorian)+ f.timeZone = tz+ f.dateFormat = pattern+ return f.string(from: date)+ }++ /// Obsidian's vaults (its `obsidian.json`), the most recently opened first; only ones that exist.+ static func obsidianVaults(_ json: Data, exists: (String) -> Bool = { FileManager.default.fileExists(atPath: $0) }) -> [URL] {+ guard let root = try? JSONSerialization.jsonObject(with: json) as? [String: Any],+ let vaults = root["vaults"] as? [String: [String: Any]] else { return [] }+ return vaults.values+ .compactMap { v -> (String, Double)? in+ guard let path = v["path"] as? String, exists(path) else { return nil }+ return (path, (v["ts"] as? NSNumber)?.doubleValue ?? 0)+ }+ .sorted { $0.1 > $1.1 }+ .map { URL(fileURLWithPath: $0.0, isDirectory: true) }+ }++ static var obsidianVaults: [URL] {+ let file = FileManager.default.homeDirectoryForCurrentUser+ .appendingPathComponent("Library/Application Support/obsidian/obsidian.json")+ return (try? Data(contentsOf: file)).map { obsidianVaults($0) } ?? []+ }+}++/// Writes settled meetings into the chosen folder and keeps the index of what it wrote. UI state on+/// the main actor; the files are written one at a time on its own queue, since a macOS privacy+/// prompt blocks the thread that touches the folder.+@MainActor final class FolderExporter: ObservableObject {+ enum Problem: Equatable {+ /// macOS didn't let Cicada write there (privacy settings).+ case denied+ /// The folder, or the drive it was on, is gone.+ case missing+ case failed(String)+ }++ struct Index: Codable, Equatable {+ var folder: String = ""+ /// Record id → the file name Cicada wrote.+ var files: [String: String] = [:]+ /// Records waiting to be written.+ var pending: [String] = []+ var lastFile: String? = nil+ var lastAt: Date? = nil+ }++ @Published private(set) var index = Index()+ @Published private(set) var problem: Problem?+ /// Checking a newly chosen folder.+ @Published private(set) var checking = false++ let store: SessionStore+ let settings: AppSettings+ /// The meeting's final notes pass is running or waiting.+ var settling: (String) -> Bool = { _ in false }+ private let indexURL: URL+ private let queue = DispatchQueue(label: "cicada.folder-export")+ private var scheduled: DispatchWorkItem?+ /// Told about this problem already (cleared once a write works).+ private var notified = false++ init(store: SessionStore, settings: AppSettings, indexURL: URL? = nil) {+ self.store = store+ self.settings = settings+ self.indexURL = indexURL ?? store.root.deletingLastPathComponent().appendingPathComponent("FolderExport.json")+ let d = JSONDecoder()+ d.dateDecodingStrategy = .iso8601+ if let data = try? Data(contentsOf: self.indexURL), let i = try? d.decode(Index.self, from: data) { index = i }+ }++ var on: Bool { settings.exportOn && !settings.exportFolder.isEmpty }+ var folder: URL? { settings.exportFolder.isEmpty ? nil : URL(fileURLWithPath: settings.exportFolder, isDirectory: true) }++ func file(for id: String) -> URL? {+ guard on, let folder, index.folder == settings.exportFolder, let name = index.files[id] else { return nil }+ return folder.appendingPathComponent(name)+ }++ func isPending(_ id: String) -> Bool { on && index.pending.contains(id) }++ /// Ended, not being imported, with something said.+ func ready(_ s: Session) -> Bool { s.endedAt != nil && s.importing != true && !s.lines.isEmpty && s.id != store.liveID }++ /// Settled records not written to this folder yet.+ var unwritten: [Session] {+ store.sessions.filter { ready($0) && index.files[$0.id] == nil && !index.pending.contains($0.id) }+ }++ /// "工作笔记 › Cicada": the folder and the one it is in, as Finder names them.+ static func shortPath(_ url: URL) -> String {+ let fm = FileManager.default+ return [url.deletingLastPathComponent().path, url.path].map { fm.displayName(atPath: $0) }.joined(separator: " › ")+ }++ static func vault(of url: URL) -> URL? {+ FolderExportFormat.obsidianVaults.first { url.path == $0.path || url.path.hasPrefix($0.path + "/") }+ }++ // MARK: Triggers++ /// A meeting ended or an import finished: write it once it is settled.+ func ended(_ id: String) {+ guard on else { return }+ if !index.pending.contains(id) { index.pending.append(id) }+ saveIndex()+ schedule()+ }++ /// A record was saved: rewrite it if it was written, or write it if it is waiting.+ func saved(_ id: String) {+ guard on, index.files[id] != nil || index.pending.contains(id) else { return }+ if !index.pending.contains(id) { index.pending.append(id) }+ schedule()+ }++ /// The final notes pass for a meeting is over (done or failed).+ func settled(_ id: String) { if on, index.pending.contains(id) { schedule() } }++ /// 也存一份: every settled record not written yet.+ func writeAll() {+ guard on else { return }+ index.pending += unwritten.map(\.id)+ saveIndex()+ flush(fromMeeting: false)+ }++ /// At launch and when the app comes forward: try what is still waiting.+ func retry() {+ guard on, !index.pending.isEmpty else { return }+ schedule(after: 0.5, fromMeeting: false)+ }++ func deleted(_ id: String) {+ index.files[id] = nil+ index.pending.removeAll { $0 == id }+ saveIndex()+ }++ // MARK: Choosing the folder++ /// A new folder (or the same one again after a fix): start its index, check it can be written now+ /// so that a privacy prompt comes while settings is open, not when a meeting ends.+ func choose(_ url: URL) {+ settings.exportFolder = url.path+ settings.exportOn = true+ if index.folder != url.path { index = Index(folder: url.path) }+ saveIndex()+ checking = true+ problem = nil+ queue.async {+ let result = Self.probe(url)+ DispatchQueue.main.async { MainActor.assumeIsolated {+ self.checking = false+ self.problem = result+ if result == nil { self.notified = false; self.retry() }+ debugLog("folder export: \(url.path) → \(result.map { "\($0)" } ?? "ok")")+ } }+ }+ }++ func turnOff() {+ settings.exportOn = false+ problem = nil+ }++ // MARK: Writing++ private func schedule(after delay: Double = 2, fromMeeting: Bool = true) {+ scheduled?.cancel()+ let work = DispatchWorkItem { [weak self] in+ MainActor.assumeIsolated { self?.flush(fromMeeting: fromMeeting) }+ }+ scheduled = work+ DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: work)+ }++ struct Job: Sendable {+ let id: String+ let stem: String+ let old: String?+ let text: String+ }++ enum Outcome: Sendable, Equatable {+ case wrote(id: String, name: String)+ case unchanged(id: String)+ case stopped(Problem)+ }++ /// Renders what is settled here (records live on the main actor), writes it on the queue.+ private func flush(fromMeeting: Bool) {+ guard on, let folder else { return }+ if index.folder != folder.path { index = Index(folder: folder.path, pending: index.pending) }+ var jobs: [Job] = []+ for id in index.pending {+ guard let s = store.session(id) else { index.pending.removeAll { $0 == id }; continue }+ guard ready(s), !settling(id) else { continue }+ jobs.append(Job(id: id, stem: FolderExportFormat.stem(s), old: index.files[id], text: FolderExportFormat.document(s)))+ }+ saveIndex()+ guard !jobs.isEmpty else { return }+ let ours = index.files+ queue.async {+ let outcomes = Self.write(jobs, to: folder, ours: ours)+ DispatchQueue.main.async { MainActor.assumeIsolated { self.apply(outcomes, folder: folder.path, fromMeeting: fromMeeting) } }+ }+ }++ private func apply(_ outcomes: [Outcome], folder: String, fromMeeting: Bool) {+ guard index.folder == folder else { return }+ var stopped: Problem?+ for o in outcomes {+ switch o {+ case .wrote(let id, let name):+ index.files[id] = name+ index.pending.removeAll { $0 == id }+ index.lastFile = name+ index.lastAt = Date()+ case .unchanged(let id):+ index.pending.removeAll { $0 == id }+ case .stopped(let p):+ stopped = p+ }+ }+ saveIndex()+ problem = stopped+ if stopped == nil { notified = false }+ if stopped == .denied, fromMeeting, !notified {+ notified = true+ notifyDenied()+ }+ }++ /// Off the main thread. Stops at the first problem: the rest would fail the same way.+ nonisolated static func write(_ jobs: [Job], to folder: URL, ours: [String: String]) -> [Outcome] {+ if let p = ensure(folder) { return [.stopped(p)] }+ let fm = FileManager.default+ var ours = ours+ var out: [Outcome] = []+ for job in jobs {+ let mine = Set(ours.filter { $0.key != job.id }.values)+ let name = FolderExportFormat.fileName(job.stem) { candidate in+ if candidate == job.old { return false }+ return mine.contains(candidate) || fm.fileExists(atPath: folder.appendingPathComponent(candidate).path)+ }+ let url = folder.appendingPathComponent(name)+ if name == job.old, let now = try? String(contentsOf: url, encoding: .utf8), now == job.text {+ out.append(.unchanged(id: job.id))+ continue+ }+ do {+ try Data(job.text.utf8).write(to: url, options: .atomic)+ } catch {+ out.append(.stopped(classify(error, folder)))+ return out+ }+ // Renamed: the old file goes, only if it is the one Cicada wrote.+ if let old = job.old, old != name { try? fm.removeItem(at: folder.appendingPathComponent(old)) }+ ours[job.id] = name+ out.append(.wrote(id: job.id, name: name))+ }+ return out+ }++ /// The folder exists, or is made when only it is missing (never a drive that isn't mounted).+ /// By errno, not `fileExists`: macOS privacy settings make a folder look absent (EPERM), and+ /// that must read as "no permission", not as an unplugged drive.+ nonisolated private static func ensure(_ folder: URL) -> Problem? {+ var st = stat()+ if stat(folder.path, &st) == 0 { return (st.st_mode & S_IFMT) == S_IFDIR ? nil : .missing }+ if errno == EPERM || errno == EACCES { return .denied }+ if stat(folder.deletingLastPathComponent().path, &st) != 0 { return errno == EPERM || errno == EACCES ? .denied : .missing }+ do { try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: false) } catch { return classify(error, folder) }+ return nil+ }++ /// Writes and removes a hidden file: the check after choosing a folder.+ nonisolated static func probe(_ folder: URL) -> Problem? {+ if let p = ensure(folder) { return p }+ let file = folder.appendingPathComponent(".cicada-check")+ do {+ try Data().write(to: file)+ try? FileManager.default.removeItem(at: file)+ return nil+ } catch {+ return classify(error, folder)+ }+ }++ nonisolated private static func classify(_ error: Error, _ folder: URL) -> Problem {+ let ns = error as NSError+ let posix = (ns.userInfo[NSUnderlyingErrorKey] as? NSError).flatMap { $0.domain == NSPOSIXErrorDomain ? $0.code : nil }+ if ns.code == NSFileWriteNoPermissionError || ns.code == NSFileReadNoPermissionError+ || posix == Int(EPERM) || posix == Int(EACCES) { return .denied }+ var st = stat()+ if stat(folder.path, &st) != 0 { return errno == EPERM || errno == EACCES ? .denied : .missing }+ return .failed(ns.localizedDescription)+ }++ private func saveIndex() {+ let e = JSONEncoder()+ e.dateEncodingStrategy = .iso8601+ e.outputFormatting = [.prettyPrinted, .sortedKeys]+ guard let data = try? e.encode(index) else { return }+ try? data.write(to: indexURL, options: .atomic)+ }++ private func notifyDenied() {+ guard let folder else { return }+ let title = L("纪要没存到文件夹"), body = L("知了没有权限写入 \(Self.shortPath(folder))。点按去设置")+ UNUserNotificationCenter.current().requestAuthorization(options: [.alert]) { granted, _ in+ guard granted else { return }+ let content = UNMutableNotificationContent()+ content.title = title+ content.body = body+ content.userInfo = ["problem": "folder"]+ UNUserNotificationCenter.current().add(UNNotificationRequest(identifier: "problem-folder", content: content, trigger: nil)) { error in+ debugLog(error.map { "folder export: notification not shown: \($0)" } ?? "folder export: notified denied")+ }+ }+ }++ /// System Settings › 隐私与安全性 › 文件和文件夹.+ static func openPrivacySettings() {+ NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders")!)+ }+}diff --git a/Sources/Cicada/FolderExportViews.swift b/Sources/Cicada/FolderExportViews.swiftnew file mode 100644index 0000000..021d6a8--- /dev/null+++ b/Sources/Cicada/FolderExportViews.swift@@ -0,0 +1,186 @@+import AppKit+import SwiftUI++/// 设置 › 通用 › 会后存一份.+struct FolderExportSettings: View {+ @ObservedObject var model: AppModel+ @ObservedObject var settings: AppSettings+ @ObservedObject var exporter: FolderExporter+ @State private var choosing = false++ var body: some View {+ VStack(alignment: .leading, spacing: 8) {+ SettingsCard {+ SettingsRow(title: L("存到文件夹"), detail: L("纪要和文字记录存成 Markdown;文件夹同步到哪,内容就到哪"),+ divider: exporter.on) {+ Toggle("存到文件夹", isOn: Binding(get: { exporter.on }, set: { on in+ if !on { exporter.turnOff() }+ else if let folder = exporter.folder { exporter.choose(folder) }+ else { choosing = true }+ }))+ .toggleStyle(.switch).labelsHidden().controlSize(.small).tint(Palette.ink)+ }+ if exporter.on, let folder = exporter.folder {+ if exporter.checking {+ HStack(spacing: 8) {+ ProgressView().controlSize(.small)+ Text("正在确认能写入 \(FolderExporter.shortPath(folder))…").font(.system(size: 12)).foregroundStyle(Palette.secondary)+ }+ .padding(.horizontal, 16).frame(minHeight: 40)+ Divider().padding(.leading, 16)+ } else if let problem = exporter.problem {+ problemRow(problem, folder).padding(.horizontal, 10).padding(.vertical, 8)+ Divider().padding(.leading, 16)+ }+ SettingsRow(title: L("位置"), detail: FolderExporter.shortPath(folder),+ divider: !exporter.unwritten.isEmpty,+ mark: nil) {+ HStack(spacing: 8) {+ if FolderExporter.vault(of: folder) != nil { Tag(L("Obsidian 库")) }+ SoftButton(L("打开")) { NSWorkspace.shared.open(folder) }+ SoftButton(L("更改…")) { choosing = true }+ }+ }+ let left = exporter.unwritten.count+ if left > 0 {+ SettingsRow(title: L("以前的会议"), detail: L("还有 \(left) 场没存"), divider: false) {+ SoftButton(L("也存一份")) { exporter.writeAll() }+ }+ }+ }+ }+ if exporter.on, let name = exporter.index.lastFile, let at = exporter.index.lastAt {+ Text("上次存于 \(dateText(at, "MMMdHHmm")) · \(name)")+ .font(.system(size: 12)).foregroundStyle(Palette.tertiary).lineLimit(1).truncationMode(.middle)+ .padding(.leading, 4)+ }+ }+ .sheet(isPresented: $choosing) {+ FolderChoice(current: exporter.folder) { url in+ choosing = false+ if let url { exporter.choose(url) }+ }+ }+ }++ @ViewBuilder private func problemRow(_ problem: FolderExporter.Problem, _ folder: URL) -> some View {+ let waiting = exporter.index.pending.count+ HStack(spacing: 12) {+ VStack(alignment: .leading, spacing: 2) {+ switch problem {+ case .denied:+ Text("没有权限写入 \(FolderExporter.shortPath(folder))").font(.system(size: 13, weight: .semibold))+ Text(waiting > 0 ? L("\(waiting) 场会议没存上,允许后自动补存") : L("在系统设置里允许知了,或换个文件夹"))+ .font(.system(size: 12)).foregroundStyle(Palette.secondary)+ case .missing:+ Text("找不到 \(FolderExporter.shortPath(folder))").font(.system(size: 13, weight: .semibold))+ Text("接上或换个文件夹后自动补存").font(.system(size: 12)).foregroundStyle(Palette.secondary)+ case .failed(let message):+ Text("没存上").font(.system(size: 13, weight: .semibold))+ Text(message).font(.system(size: 12)).foregroundStyle(Palette.secondary).lineLimit(2)+ }+ }+ .foregroundStyle(Palette.ink)+ Spacer(minLength: 8)+ if problem == .denied { SoftButton(L("去系统设置"), dark: true) { FolderExporter.openPrivacySettings() } }+ }+ .padding(.horizontal, 12).padding(.vertical, 10)+ .background(RoundedRectangle(cornerRadius: 9).fill(problem == .denied ? Palette.accentPale : Palette.ground))+ }+}++/// 存到哪里: an Obsidian vault first (a new Cicada folder in it), then 文稿 › Cicada, or any folder.+struct FolderChoice: View {+ let current: URL?+ let done: (URL?) -> Void+ @State private var pick = 0+ private let options: [(title: String, detail: String?, url: URL?)]++ init(current: URL?, done: @escaping (URL?) -> Void) {+ self.current = current+ self.done = done+ var options: [(String, String?, URL?)] = FolderExportFormat.obsidianVaults.prefix(3).map {+ (L("Obsidian 库「\($0.lastPathComponent)」"), L("在库里新建 Cicada 文件夹"), $0.appendingPathComponent("Cicada", isDirectory: true))+ }+ let documents = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]+ options.append((FileManager.default.displayName(atPath: documents.path) + " › Cicada", nil, documents.appendingPathComponent("Cicada", isDirectory: true)))+ options.append((L("其他文件夹…"), nil, nil))+ self.options = options+ }++ var body: some View {+ VStack(alignment: .leading, spacing: 14) {+ Text("存到哪里").font(.system(size: 15, weight: .bold)).foregroundStyle(Palette.ink)+ VStack(spacing: 8) {+ ForEach(Array(options.enumerated()), id: \.offset) { i, o in+ Button { pick = i } label: {+ HStack(alignment: .top, spacing: 10) {+ Image(systemName: pick == i ? "largecircle.fill.circle" : "circle")+ .font(.system(size: 13)).foregroundStyle(pick == i ? Palette.ink : Palette.tertiary)+ VStack(alignment: .leading, spacing: 2) {+ Text(o.title).font(.system(size: 13, weight: pick == i ? .semibold : .regular)).foregroundStyle(Palette.ink)+ if let d = o.detail { Text(d).font(.system(size: 12)).foregroundStyle(Palette.secondary) }+ }+ Spacer(minLength: 0)+ }+ .padding(.horizontal, 12).padding(.vertical, 10)+ .background(RoundedRectangle(cornerRadius: 9).stroke(pick == i ? Palette.ink : Palette.line, lineWidth: pick == i ? 1.5 : 1))+ .contentShape(Rectangle())+ }+ .buttonStyle(.plain)+ }+ }+ Text("macOS 可能会问一次能不能访问这个位置").font(.system(size: 12)).foregroundStyle(Palette.tertiary)+ HStack(spacing: 8) {+ Spacer()+ SoftButton(L("取消")) { done(nil) }.keyboardShortcut(.cancelAction)+ SoftButton(L("存到这里"), dark: true) { confirm() }.keyboardShortcut(.defaultAction)+ }+ }+ .padding(20)+ .frame(width: 380)+ .background(Color.white)+ }++ private func confirm() {+ if let url = options[pick].url { done(url); return }+ let panel = NSOpenPanel()+ panel.canChooseDirectories = true+ panel.canChooseFiles = false+ panel.canCreateDirectories = true+ panel.allowsMultipleSelection = false+ panel.prompt = L("存到这里")+ panel.message = L("会后把纪要和文字记录存成 Markdown 到这里")+ panel.directoryURL = current ?? FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]+ done(panel.runModal() == .OK ? panel.url : nil)+ }+}++/// The record's line under its title: where its file is, or why it isn't there yet.+struct FolderExportLine: View {+ @ObservedObject var exporter: FolderExporter+ @ObservedObject var model: AppModel+ let session: Session++ var body: some View {+ if exporter.on, let folder = exporter.folder, exporter.ready(session) {+ let short = FolderExporter.shortPath(folder)+ HStack(spacing: 4) {+ if let file = exporter.file(for: session.id), !exporter.isPending(session.id) {+ Image(systemName: "folder").font(.system(size: 11))+ Text("已存到 \(short) ·")+ Button(L("在访达中显示")) { NSWorkspace.shared.activateFileViewerSelecting([file]) }+ .buttonStyle(.plain).foregroundStyle(Palette.link)+ } else if exporter.isPending(session.id), exporter.problem != nil {+ Text("没存到文件夹 ·")+ Button(L("去设置")) { model.openSettings(.records) }+ .buttonStyle(.plain).foregroundStyle(Palette.link)+ } else if exporter.isPending(session.id) {+ Image(systemName: "folder").font(.system(size: 11))+ Text("整理好后存到 \(short)")+ }+ }+ .font(.system(size: 12)).foregroundStyle(Palette.tertiary).lineLimit(1)+ }+ }+}diff --git a/Sources/Cicada/Notes.swift b/Sources/Cicada/Notes.swiftindex 656a0f6..022a4b6 100644--- a/Sources/Cicada/Notes.swift+++ b/Sources/Cicada/Notes.swift@@ -146,6 +146,10 @@ final class NotesEngine: ObservableObject {/// Final passes asked for while another call was running, in order; each runs after it./// Several can wait: an imported file can finish while the meeting's own pass is queued.private var pendingFinals: [String] = []+ /// A final pass is over, whether it wrote notes or not (存到文件夹 waits for it).+ var finalDone: ((String) -> Void)?+ /// The final pass for this meeting is running or waiting its turn.+ func settling(_ id: String) -> Bool { generatingID == id || pendingFinals.contains(id) }/// A language change that arrived while another update was running: rewrite after it.private var pendingRewrite: String?private var lastAttempt = Date.distantPast@@ -264,8 +268,8 @@ final class NotesEngine: ObservableObject {if fresh { pendingRewrite = id }return}- guard let session = store.session(id), !session.lines.isEmpty else { return }- guard ling.hasKey else { state = .noKey; return }+ guard let session = store.session(id), !session.lines.isEmpty else { if final { finalDone?(id) }; return }+ guard ling.hasKey else { state = .noKey; if final { finalDone?(id) }; return }inFlight = truelastAttempt = Date()state = .updating@@ -273,6 +277,7 @@ final class NotesEngine: ObservableObject {defer {inFlight = falseif final, generatingID == id { generatingID = nil }+ if final { finalDone?(id) }if !pendingFinals.isEmpty {let next = pendingFinals.removeFirst()if pendingRewrite == next { pendingRewrite = nil } // the final pass starts from nothing anywaydiff --git a/Sources/Cicada/SessionStore.swift b/Sources/Cicada/SessionStore.swiftindex f6f7db4..6496c4e 100644--- a/Sources/Cicada/SessionStore.swift+++ b/Sources/Cicada/SessionStore.swift@@ -90,6 +90,8 @@ final class SessionStore: ObservableObject {let root: URL/// Per meeting: a file being imported saves alongside the live meeting without delaying it.private var saveWork: [String: DispatchWorkItem] = [:]+ /// A record was written to disk (存到文件夹 follows its changes).+ var onSave: ((String) -> Void)?/// `root`: tests keep their meetings in a folder of their own.init(root: URL? = nil) {@@ -446,6 +448,7 @@ final class SessionStore: ObservableObject {guard let data = try? encoder.encode(s) else { return }try? FileManager.default.createDirectory(at: folder(id), withIntermediateDirectories: true)try? data.write(to: folder(id).appendingPathComponent("session.json"), options: .atomic)+ onSave?(id)}}diff --git a/Sources/Cicada/Settings.swift b/Sources/Cicada/Settings.swiftindex 018123a..232bd88 100644--- a/Sources/Cicada/Settings.swift+++ b/Sources/Cicada/Settings.swift@@ -67,6 +67,14 @@ final class AppSettings: ObservableObject {@Published var recordAudio: Bool {didSet { save() }}+ /// 存到文件夹: settled meetings are also written as Markdown into `exportFolder` (a path; empty+ /// until one is chosen). Not a secret: it may sit in UserDefaults.+ @Published var exportOn: Bool {+ didSet { save() }+ }+ @Published var exportFolder: String {+ didSet { save() }+ }/// Imported files: the language they are in ("auto" or a locale), and whether notes are written/// once one is transcribed.@Published var importLanguage: String {@@ -276,6 +284,8 @@ final class AppSettings: ObservableObject {speakMic = defaults.string(forKey: "speakMic") ?? ""savedSystemInput = defaults.string(forKey: "savedSystemInput") ?? ""recordAudio = defaults.object(forKey: "recordAudio") as? Bool ?? true+ exportOn = defaults.bool(forKey: "exportOn")+ exportFolder = defaults.string(forKey: "exportFolder") ?? ""importLanguage = defaults.string(forKey: "importLanguage") ?? "auto"importNotes = defaults.object(forKey: "importNotes") as? Bool ?? trueoverlayAuto = defaults.object(forKey: "overlayAuto") as? Bool ?? true@@ -336,6 +346,8 @@ final class AppSettings: ObservableObject {defaults.set(speakMic, forKey: "speakMic")defaults.set(savedSystemInput, forKey: "savedSystemInput")defaults.set(recordAudio, forKey: "recordAudio")+ defaults.set(exportOn, forKey: "exportOn")+ defaults.set(exportFolder, forKey: "exportFolder")defaults.set(importLanguage, forKey: "importLanguage")defaults.set(importNotes, forKey: "importNotes")defaults.set(overlayAuto, forKey: "overlayAuto")diff --git a/Sources/Cicada/SettingsWindow.swift b/Sources/Cicada/SettingsWindow.swiftindex abd33f2..35c7f52 100644--- a/Sources/Cicada/SettingsWindow.swift+++ b/Sources/Cicada/SettingsWindow.swift@@ -739,6 +739,8 @@ struct SettingsView: View {SoftButton(L("打开")) { NSWorkspace.shared.open(model.store.root) }}}+ Text("会后存一份").font(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.secondary).padding(.top, 4)+ FolderExportSettings(model: model, settings: settings, exporter: model.folderExport)Text("导入的文件").font(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.secondary).padding(.top, 4)SettingsCard {SettingsRow(title: L("文件里说的"), detail: L("译成“翻译成”里的语言")) {diff --git a/Sources/Cicada/Views.swift b/Sources/Cicada/Views.swiftindex 68f402e..993d771 100644--- a/Sources/Cicada/Views.swift+++ b/Sources/Cicada/Views.swift@@ -1270,6 +1270,7 @@ struct MainWindowView: View {.help(([dateLine(s, live: live)] + more.compactMap { $0 }).joined(separator: " · "))}RecordTitleField(session: s, store: store).id(s.id).padding(.top, 8)+ if !live { FolderExportLine(exporter: model.folderExport, model: model, session: s).padding(.top, 8) }if s.sourcePath != nil {VStack(alignment: .leading, spacing: 12) {if s.fromRecording, s.lines.isEmpty || s.importing == true, !working(s) {diff --git a/Tests/CicadaTests/FolderExportTests.swift b/Tests/CicadaTests/FolderExportTests.swiftnew file mode 100644index 0000000..b4ecc57--- /dev/null+++ b/Tests/CicadaTests/FolderExportTests.swift@@ -0,0 +1,125 @@+import Foundation+import Testing+@testable import Cicada++/// 存到文件夹's file name and frontmatter are a contract with the ports (Tests/fixtures/folder-export).+struct FolderExportTests {+ static let fixtures = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent()+ .appendingPathComponent("fixtures/folder-export")++ struct Collision: Decodable { let stem: String; let taken: [String]; let want: String }+ struct Cases: Decodable {+ let timeZone: String+ let fileName: String+ let names: [[String]]+ let stems: [[String]]+ let escapes: [[String]]+ let collisions: [Collision]+ }++ static func cases() throws -> Cases {+ try JSONDecoder().decode(Cases.self, from: Data(contentsOf: fixtures.appendingPathComponent("cases.json")))+ }++ static func session() throws -> Session {+ let d = JSONDecoder()+ d.dateDecodingStrategy = .iso8601+ return try d.decode(Session.self, from: Data(contentsOf: fixtures.appendingPathComponent("session.json")))+ }++ @Test func frontmatterBytes() throws {+ let tz = TimeZone(identifier: try Self.cases().timeZone)!+ let want = try String(contentsOf: Self.fixtures.appendingPathComponent("frontmatter.md"), encoding: .utf8)+ #expect(FolderExportFormat.frontmatter(try Self.session(), timeZone: tz) == want)+ }++ @Test func fileName() throws {+ let c = try Self.cases()+ let stem = FolderExportFormat.stem(try Self.session(), timeZone: TimeZone(identifier: c.timeZone)!)+ #expect(FolderExportFormat.fileName(stem) { _ in false } == c.fileName)+ }++ @Test func names() throws {+ for pair in try Self.cases().names { #expect(FolderExportFormat.safeName(pair[0]) == pair[1], "\(pair[0])") }+ }++ @Test func stems() throws {+ let c = try Self.cases()+ var s = try Self.session()+ for pair in c.stems {+ s.title = pair[0]+ #expect(FolderExportFormat.stem(s, timeZone: TimeZone(identifier: c.timeZone)!) == pair[1])+ }+ }++ @Test func escapes() throws {+ for pair in try Self.cases().escapes { #expect(FolderExportFormat.quote(pair[0]) == pair[1], "\(pair[0])") }+ }++ @Test func collisions() throws {+ for c in try Self.cases().collisions {+ #expect(FolderExportFormat.fileName(c.stem) { c.taken.contains($0) } == c.want)+ }+ }++ /// The name: the user's title, else the notes', else the imported file's, never the display title.+ @Test func namePrecedence() throws {+ var s = try Self.session()+ s.renamed = false+ s.title = Session.defaultTitle(s.startedAt)+ #expect(FolderExportFormat.name(s) == "产品路线评审")+ s.notes = nil+ #expect(FolderExportFormat.name(s) == "")+ s.sourceFile = "Weekly sync.m4a"+ #expect(FolderExportFormat.name(s) == "Weekly sync")+ #expect(FolderExportFormat.frontmatter(s).contains("source: \"file\"\nnotes: \"none\""))+ }++ @Test func obsidianVaults() {+ let json = #"{"vaults":{"a":{"path":"/v/old","ts":1},"b":{"path":"/v/new","ts":5,"open":true},"c":{"path":"/gone","ts":9}}}"#+ let vaults = FolderExportFormat.obsidianVaults(Data(json.utf8)) { $0 != "/gone" }+ #expect(vaults.map(\.path) == ["/v/new", "/v/old"])+ #expect(FolderExportFormat.obsidianVaults(Data("not json".utf8)).isEmpty)+ }+}++/// Real writes into a temporary folder: the cases the ports test too.+struct FolderExportWriteTests {+ let root = FileManager.default.temporaryDirectory.appendingPathComponent("folder-export-\(UUID().uuidString)")+ var folder: URL { root.appendingPathComponent("Cicada") }++ init() throws { try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true) }++ func job(_ stem: String, old: String? = nil, text: String = "x") -> FolderExporter.Job {+ FolderExporter.Job(id: "a", stem: stem, old: old, text: text)+ }++ @Test func foreignFileIsKept() throws {+ try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true)+ try "mine".write(to: folder.appendingPathComponent("n.md"), atomically: true, encoding: .utf8)+ #expect(FolderExporter.write([job("n")], to: folder, ours: [:]) == [.wrote(id: "a", name: "n 2.md")])+ #expect(try String(contentsOf: folder.appendingPathComponent("n.md"), encoding: .utf8) == "mine")+ }++ @Test func renameMovesAndUnchangedSkips() throws {+ _ = FolderExporter.write([job("old")], to: folder, ours: [:])+ #expect(FolderExporter.write([job("old", old: "old.md")], to: folder, ours: ["a": "old.md"]) == [.unchanged(id: "a")])+ #expect(FolderExporter.write([job("new", old: "old.md")], to: folder, ours: ["a": "old.md"]) == [.wrote(id: "a", name: "new.md")])+ #expect(try FileManager.default.contentsOfDirectory(atPath: folder.path) == ["new.md"])+ }++ @Test func missingParentIsNotCreated() {+ let gone = root.appendingPathComponent("unplugged/Cicada")+ #expect(FolderExporter.write([job("n")], to: gone, ours: [:]) == [.stopped(.missing)])+ #expect(!FileManager.default.fileExists(atPath: gone.deletingLastPathComponent().path))+ }++ /// A folder that can't be looked into reads as "no permission", not as a missing drive.+ @Test func unreadableParentIsDenied() throws {+ let locked = root.appendingPathComponent("locked")+ try FileManager.default.createDirectory(at: locked, withIntermediateDirectories: true)+ try FileManager.default.setAttributes([.posixPermissions: 0], ofItemAtPath: locked.path)+ defer { try? FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: locked.path) }+ #expect(FolderExporter.write([job("n")], to: locked.appendingPathComponent("Cicada"), ours: [:]) == [.stopped(.denied)])+ }+}diff --git a/Tests/fixtures/folder-export/cases.json b/Tests/fixtures/folder-export/cases.jsonnew file mode 100644index 0000000..a17ff1d--- /dev/null+++ b/Tests/fixtures/folder-export/cases.json@@ -0,0 +1,32 @@+{+ "timeZone": "Asia/Shanghai",+ "fileName": "2026-11-06 1400 产品路线评审.md",+ "names": [+ ["产品路线评审", "产品路线评审"],+ ["Q3 / Q4: plan?", "Q3 Q4 plan"],+ [" a\\b*c\"d<e>f|g#h^i[j]k ", "a b c d e f g h i j k"],+ ["line\nbreak\ttab", "line break tab"],+ ["...trailing dots. ", "trailing dots"],+ ["", ""],+ ["///", ""],+ ["一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十", "一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十"],+ ["Café 👋🏽 meeting", "Café 👋🏽 meeting"]+ ],+ "stems": [+ ["产品路线评审", "2026-11-06 1400 产品路线评审"],+ ["", "2026-11-06 1400"]+ ],+ "escapes": [+ ["plain", "\"plain\""],+ ["say \"hi\"", "\"say \\\"hi\\\"\""],+ ["back\\slash", "\"back\\\\slash\""],+ ["a\nb\tc\rd", "\"a\\nb\\tc\\rd\""],+ ["bell\u0007", "\"bell\\u0007\""],+ ["a/b ü 中", "\"a/b ü 中\""]+ ],+ "collisions": [+ {"stem": "2026-11-06 1400 周会", "taken": [], "want": "2026-11-06 1400 周会.md"},+ {"stem": "2026-11-06 1400 周会", "taken": ["2026-11-06 1400 周会.md"], "want": "2026-11-06 1400 周会 2.md"},+ {"stem": "2026-11-06 1400 周会", "taken": ["2026-11-06 1400 周会.md", "2026-11-06 1400 周会 2.md"], "want": "2026-11-06 1400 周会 3.md"}+ ]+}diff --git a/Tests/fixtures/folder-export/frontmatter.md b/Tests/fixtures/folder-export/frontmatter.mdnew file mode 100644index 0000000..ded22c3--- /dev/null+++ b/Tests/fixtures/folder-export/frontmatter.md@@ -0,0 +1,12 @@+---+cicada: 1+id: "20261106-140000"+title: "产品路线评审"+started: "2026-11-06T14:00:00+08:00"+ended: "2026-11-06T14:48:12+08:00"+minutes: 48+languages: ["en", "zh"]+source: "meeting"+notes: "final"+tags: ["cicada"]+---diff --git a/Tests/fixtures/folder-export/session.json b/Tests/fixtures/folder-export/session.jsonnew file mode 100644index 0000000..3239f4b--- /dev/null+++ b/Tests/fixtures/folder-export/session.json@@ -0,0 +1,100 @@+{+ "endedAt" : "2026-11-06T06:48:12Z",+ "hasAudio" : true,+ "id" : "20261106-140000",+ "lines" : [+ {+ "dst" : "我们把发布挪到 20 号。",+ "dstLang" : "zh",+ "id" : "l1",+ "speaker" : "them",+ "src" : "Let's move the launch to the 20th.",+ "srcLang" : "en",+ "t" : 521.34,+ "voice" : 3+ },+ {+ "dst" : "离线模式重连时还是会丢最后一句。",+ "dstLang" : "zh",+ "id" : "l2",+ "speaker" : "them",+ "src" : "Offline mode still drops the last sentence on reconnect.",+ "srcLang" : "en",+ "t" : 605,+ "voice" : 7+ },+ {+ "dst" : "OK, I'll look into it.",+ "dstLang" : "en",+ "id" : "l3",+ "speaker" : "me",+ "src" : "好,我来看一下。",+ "srcLang" : "zh",+ "t" : 612.5+ },+ {+ "dst" : "staging 的 key 先别用了。",+ "dstLang" : "zh",+ "id" : "l4",+ "speaker" : "them",+ "src" : "Stop using the staging key for now.",+ "srcLang" : "en",+ "t" : 640.2,+ "voice" : 3+ }+ ],+ "notes" : {+ "conclusions" : [+ {+ "support" : 2,+ "t" : 521.34,+ "text" : "发布挪到 11 月 20 日"+ }+ ],+ "covered" : 4,+ "final" : true,+ "summary" : "发布推迟到 20 日,先修完离线模式。",+ "terms" : [+ {+ "heard" : [+ "Emmer"+ ],+ "name" : "Emma",+ "note" : "测试负责人"+ }+ ],+ "title" : "产品路线评审",+ "todos" : [+ {+ "owner" : "Emma",+ "support" : 1,+ "t" : 605,+ "text" : "周五前给出离线模式测试结果"+ }+ ],+ "topics" : [+ {+ "points" : [+ "重连时丢最后一句"+ ],+ "start" : 600,+ "summary" : "离线模式还有一个问题。",+ "title" : "离线模式"+ }+ ]+ },+ "renamed" : true,+ "room" : true,+ "sourcePath" : "/Users/someone/Movies/review.mp4",+ "startedAt" : "2026-11-06T06:00:00Z",+ "title" : "产品路线评审",+ "voiceGuesses" : {+ "3" : {+ "evidence" : "08:41 “Sure, Emma…”",+ "name" : "Emma"+ }+ },+ "voiceNames" : {+ "7" : "Kenji"+ }+}diff --git a/docs/folder-export.md b/docs/folder-export.mdnew file mode 100644index 0000000..7315cf8--- /dev/null+++ b/docs/folder-export.md@@ -0,0 +1,82 @@+# 存到文件夹 (folder export)++After a meeting is settled, Cicada writes it as one Markdown file into a folder the user picked, so a+notes vault (Obsidian, Logseq), a synced folder or an agent watching the folder picks it up. The Mac+app is the reference (`Sources/Cicada/FolderExport.swift`); every port writes the same file name and+the same frontmatter. The fixtures in `Tests/fixtures/folder-export` are the contract: each+platform's unit tests check them.++## The file++`<frontmatter><Markdown body>`: the frontmatter below, then the body exactly as the platform's+existing 导出 Markdown gives it (the body is not part of the contract).++```+---+cicada: 1+id: "<record id>"+title: "<name>"+started: "<yyyy-MM-ddTHH:mm:ss±hh:mm>"+ended: "<yyyy-MM-ddTHH:mm:ss±hh:mm>"+minutes: <int>+languages: ["<code>", …]+source: "meeting" | "file"+notes: "final" | "draft" | "none"+tags: ["cicada"]+---+```++- Keys in this order, `\n` line ends, no trailing spaces. `cicada` is the format version.+- Every string is written as a JSON-style double-quoted string: `\` → `\\`, `"` → `\"`, `\n` `\r`+ `\t` as such, other characters below U+0020 as `\u00XX` (lowercase hex), everything else+ (including `/` and non-ASCII) as is. Lists are `[` items joined by `, ` `]`; empty: `[]`.+- Times are the device's local time with its offset (`+08:00`, `+00:00` for UTC, never `Z`), no+ fractional seconds.+- `minutes`: whole minutes of `ended − started`, rounded down.+- `languages`: the distinct `srcLang` of the lines, sorted by code point.+- `source`: `"file"` when the record has a `sourceFile` (an imported file), else `"meeting"`.+- `notes`: `"none"` without notes or with empty notes, `"final"` when `notes.final`, else `"draft"`.+- `name` (also used in the file name): the record's own title when the user renamed it (`renamed`,+ or for older records a title not starting with `会议 `), else the notes' title, else the imported+ file's name without its extension, else empty. Never the localized display title.++## The file name++`<yyyy-MM-dd HHmm>[ <safe name>].md`, the start in local time. The safe name:++1. Each of `/ \ : * ? " < > | # ^ [ ]` and each character below U+0020 becomes a space.+2. Runs of whitespace become one space; leading and trailing spaces and dots are removed.+3. Cut to at most 120 UTF-8 bytes at a code-point boundary, then trim trailing spaces and dots again.++An empty safe name leaves just the date: `2026-11-06 1400.md`.++Taken names (another record's file in the index, or a file on disk Cicada didn't write) get ` 2`,+` 3`… before `.md`. Cicada never overwrites a file it didn't write.++## When it writes++- A meeting is written once it is settled: it has ended, isn't being imported, has lines, and its+ final notes pass is not running or queued. Without a key or when the final pass fails, the+ transcript alone is written (`notes: "none"`), and rewritten if notes come later.+- A written record is rewritten after any later change (rename, names for voices, 重新整理…);+ unchanged content isn't written again. A new name moves the file.+- Deleting a record in Cicada leaves its file alone.+- Pending records are kept in the index and tried again at launch, when the app comes forward and on+ the next change. Writes are in order, one at a time, off the UI thread, and atomic (temporary file+ then rename) where the platform allows.+- 以前的会议 › 也存一份 queues every settled record not written yet; the first permission error+ stops the rest.++## The index++Next to the records (`FolderExport.json` on the Mac): the folder, each record's file name, and the+records still to write. A new folder starts a new index; files in the old one stay.++## Problems++- No permission (macOS privacy, Windows controlled folder access, a lost Android grant): one row in+ settings and one line in the record, plus one system notification after a meeting (never during+ one, never for 也存一份), once until it works again.+- The folder can't be found (drive unplugged): Cicada recreates only the last folder, and only when+ its parent exists; otherwise one grey line in settings and the record, no notification. It saves+ when the folder is back.diff --git a/tools/README.md b/tools/README.mdindex 6c8ab56..2f3bcfc 100644--- a/tools/README.md+++ b/tools/README.md@@ -24,6 +24,7 @@- 多开:两边都设 `CICADA_DEBUG_CHANNEL=x`(`open -n --env CICADA_DEBUG_CHANNEL=x build/Cicada.app`),命令只发给这一份,日志在 `/tmp/livesubs-dev-debug-x.log`- 导出:`export:<目录>`- 导入录音或视频:`import:<路径>[,<路径>…]`(等于拖进会议记录窗口),`importState` 把进度写进日志,`importCancel` 停止转写,`importRetry:<会议 id>[=<locale>]` 重新转写(带 locale 等于在“这场会议只留下了录音”里选了这种语言),`importNotify` 把通知权限写进日志+ - 存到文件夹:`exportFolder:<路径>` 选文件夹(等于“存到这里”,会马上试写一次),`exportFolder:off` 关掉,`exportAll` 即“也存一份”,`rename:<会议 id>=<标题>` 像在记录里改标题(不给标题恢复自动标题),`exportState` 回复索引(`files`、`pending`、`unwritten`、`lastFile`)和问题(`denied` `missing` `failed`)- 新手引导与窗口:`onboarding:<步骤>[,skip|ask|setup]`(1–5,5 是收尾页;skip 是第 3 步点了“先不接”,ask / setup 是第 4 步的二选一 / 清单)、`samplePlay`、`speakers:<on|off>`(“说话人识别”)、`speakerGuess:<会议 id>`(马上让 Ling 认一遍名字)、`speakersRender:<会议 id>=<png>`、`voiceprintFile:<音频>=<json>`(用 app 里的声纹模型算整个文件的声纹,和参考模型对比)、`closeWindow:<main|settings|onboarding>`、`settings:<overlay|language|speak|records|ai|diagnostics>`、`about`- 显示与字幕:`display:<notes|bar|none>`、`subtitles:<both|translation|original>`、`meetingSubtitles:<…>`、`overlayState`、`overlayToggle`、`pillClick`(等于点主窗口顶部的“正在听”)、`overlayAuto[:off]`、`hideAfter:<秒>`- 纪要:`notesLang:<mine|source>`、`meetingNotesLang:<…>`、`notesRegenerate:<id>=<mine|source>`、`notesWindow[:x,y,w,h]`、`notesClose`、`notesMinimize`、`notesFrame`、`notesNow`、`notesState`、`notesShow:<id>`、`notesReplay:<id>[,<每次几句>]`(按会议时的节奏重写一遍纪要,默认每次 4 句;回复被 max_tokens 截断时日志写 `cut at max_tokens`)、`notesCapturable[:off]`(只改窗口能否被截屏)、`notesShare:<on|off>`(改“共享屏幕时让对方看到”这个设置,等于点图标或开关)