CodexBar 是一个 macOS 菜单栏应用,用于查看本机 Codex 账号状态、额度、Token 用量、详细统计信息
Swift appkitcodexcodex-clideveloper-toolsmacosmacos-appmenu-bar-appopenai-codexproductivityswiftswiftuiusage-tracker
feat: 完善进阶模式设置并支持自定义数据更新间隔
Bob513f3055fe24
diff --git a/CodexBar/Controllers/CodexBarAppDelegate.swift b/CodexBar/Controllers/CodexBarAppDelegate.swiftindex 257585a..71fc99a 100644--- a/CodexBar/Controllers/CodexBarAppDelegate.swift+++ b/CodexBar/Controllers/CodexBarAppDelegate.swift@@ -8,18 +8,18 @@ final class CodexBarAppDelegate: NSObject, NSApplicationDelegate {lazy var proxySettings = CodexProxySettings(service: codexStatusService)lazy var viewModel = CodexStatusViewModel(service: codexStatusService)let workflowViewModel = WorkflowViewModel()- lazy var codexHookSettings = CodexHookSettings(codexStatusService: codexStatusService)+ lazy var advancedModeSettings = AdvancedModeSettings(codexStatusService: codexStatusService)lazy var codexCLINotificationSettings = CodexCLINotificationSettings(codexStatusService: codexStatusService)let activityProtectionSettings = ActivityProtectionSettings()lazy var activityMonitor = CodexActivityMonitor(- codexHookSettings: codexHookSettings,+ advancedModeSettings: advancedModeSettings,activityProtectionSettings: activityProtectionSettings)lazy var keepAliveController = KeepAliveController(activityMonitor: activityMonitor,- codexHookSettings: codexHookSettings+ advancedModeSettings: advancedModeSettings)let syncSettings = WorkflowSyncSettings()let globalHotKeySettings = GlobalHotKeySettings()@@ -45,7 +45,7 @@ final class CodexBarAppDelegate: NSObject, NSApplicationDelegate {let controller = StatusItemController(viewModel: viewModel,workflowViewModel: workflowViewModel,- codexHookSettings: codexHookSettings,+ advancedModeSettings: advancedModeSettings,codexCLINotificationSettings: codexCLINotificationSettings,activityMonitor: activityMonitor,syncSettings: syncSettings,@@ -97,7 +97,7 @@ final class CodexBarAppDelegate: NSObject, NSApplicationDelegate {let taskGlowController = TaskGlowController(settings: taskGlowSettings,activityMonitor: activityMonitor,- hookSettings: codexHookSettings+ advancedModeSettings: advancedModeSettings)taskGlowController.start()self.taskGlowController = taskGlowController@@ -149,7 +149,7 @@ final class CodexBarAppDelegate: NSObject, NSApplicationDelegate {let state = LogFields.joined("version=\(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "-")","build=\(Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "-")",- "hook=\(codexHookSettings.isEnabled ? 1 : 0)",+ "advancedMode=\(advancedModeSettings.isEnabled ? 1 : 0)","keepAlive=\(keepAliveController.isEnabled ? 1 : 0)","keepAliveLimit=\(keepAliveController.maximumDuration.loggedHours)","keepAliveBattery=\(keepAliveController.lowBatteryThreshold.rawValue)",diff --git a/CodexBar/Controllers/SettingsWindowController.swift b/CodexBar/Controllers/SettingsWindowController.swiftindex 4c454b7..1bded39 100644--- a/CodexBar/Controllers/SettingsWindowController.swift+++ b/CodexBar/Controllers/SettingsWindowController.swift@@ -8,7 +8,7 @@ final class SettingsWindowController: HostingWindowController {private let viewModel: CodexStatusViewModelprivate let proxySettings: CodexProxySettingsprivate let appUpdater: AppUpdater- private let codexHookSettings: CodexHookSettings+ private let advancedModeSettings: AdvancedModeSettingsprivate let codexCLINotificationSettings: CodexCLINotificationSettingsprivate let syncSettings: WorkflowSyncSettingsprivate let globalHotKeySettings: GlobalHotKeySettings@@ -37,7 +37,7 @@ final class SettingsWindowController: HostingWindowController {viewModel: CodexStatusViewModel,appUpdater: AppUpdater,proxySettings: CodexProxySettings,- codexHookSettings: CodexHookSettings,+ advancedModeSettings: AdvancedModeSettings,codexCLINotificationSettings: CodexCLINotificationSettings,syncSettings: WorkflowSyncSettings,globalHotKeySettings: GlobalHotKeySettings,@@ -55,7 +55,7 @@ final class SettingsWindowController: HostingWindowController {self.viewModel = viewModelself.appUpdater = appUpdaterself.proxySettings = proxySettings- self.codexHookSettings = codexHookSettings+ self.advancedModeSettings = advancedModeSettingsself.codexCLINotificationSettings = codexCLINotificationSettingsself.syncSettings = syncSettingsself.globalHotKeySettings = globalHotKeySettings@@ -85,7 +85,7 @@ final class SettingsWindowController: HostingWindowController {let hostingController = NSHostingController(rootView: AppSettingsView(proxySettings: proxySettings,- codexHookSettings: codexHookSettings,+ advancedModeSettings: advancedModeSettings,syncSettings: syncSettings,globalHotKeySettings: globalHotKeySettings,menuBarQuotaSettings: menuBarQuotaSettings,@@ -157,7 +157,7 @@ final class SettingsWindowController: HostingWindowController {private func refreshSettingsState() {notificationSettings.refreshAuthorizationStatus()- codexHookSettings.reconcileInstalledHooks()+ advancedModeSettings.reconcileConfiguration()codexCLINotificationSettings.refresh()syncSettings.refresh()menuBarQuotaSettings.refresh()@@ -209,10 +209,10 @@ final class SettingsWindowController: HostingWindowController {willShow: { [codexCLINotificationSettings] incodexCLINotificationSettings.refresh()},- contentProvider: { [notificationSettings, codexHookSettings, codexCLINotificationSettings, autoResetSettings, keepAliveController] in+ contentProvider: { [notificationSettings, advancedModeSettings, codexCLINotificationSettings, autoResetSettings, keepAliveController] inNotificationOptionsView(notificationSettings: notificationSettings,- codexHookSettings: codexHookSettings,+ advancedModeSettings: advancedModeSettings,codexCLINotificationSettings: codexCLINotificationSettings,autoResetSettings: autoResetSettings,keepAliveController: keepAliveController@@ -222,7 +222,7 @@ final class SettingsWindowController: HostingWindowController {// 防睡眠只订阅相关派生值, 避免每次任务起停都触发面板高度重算contentChanges: Publishers.MergeMany([notificationSettings.objectWillChange.eraseToAnyPublisher(),- codexHookSettings.objectWillChange.eraseToAnyPublisher(),+ advancedModeSettings.objectWillChange.eraseToAnyPublisher(),autoResetSettings.$isEnabled.map { _ in () }.eraseToAnyPublisher(),@@ -267,10 +267,10 @@ final class SettingsWindowController: HostingWindowController {willShow: { [mainPanelSettings] inmainPanelSettings.refresh()},- contentProvider: { [mainPanelSettings, codexHookSettings, mainPanelUndoManager] in+ contentProvider: { [mainPanelSettings, advancedModeSettings, mainPanelUndoManager] inMainPanelOptionsView(settings: mainPanelSettings,- codexHookSettings: codexHookSettings,+ advancedModeSettings: advancedModeSettings,undoManager: mainPanelUndoManager)}diff --git a/CodexBar/Controllers/StatusItemController.swift b/CodexBar/Controllers/StatusItemController.swiftindex 042ef61..996a4e7 100644--- a/CodexBar/Controllers/StatusItemController.swift+++ b/CodexBar/Controllers/StatusItemController.swift@@ -8,7 +8,7 @@ import SwiftUIfinal class StatusItemController: NSObject, NSMenuDelegate {private let viewModel: CodexStatusViewModelprivate let workflowViewModel: WorkflowViewModel- private let codexHookSettings: CodexHookSettings+ private let advancedModeSettings: AdvancedModeSettingsprivate let codexCLINotificationSettings: CodexCLINotificationSettingsprivate let activityMonitor: CodexActivityMonitorprivate let syncSettings: WorkflowSyncSettings@@ -47,7 +47,7 @@ final class StatusItemController: NSObject, NSMenuDelegate {viewModel: viewModel,appUpdater: appUpdater,proxySettings: proxySettings,- codexHookSettings: codexHookSettings,+ advancedModeSettings: advancedModeSettings,codexCLINotificationSettings: codexCLINotificationSettings,syncSettings: syncSettings,globalHotKeySettings: globalHotKeySettings,@@ -119,7 +119,7 @@ final class StatusItemController: NSObject, NSMenuDelegate {init(viewModel: CodexStatusViewModel,workflowViewModel: WorkflowViewModel,- codexHookSettings: CodexHookSettings,+ advancedModeSettings: AdvancedModeSettings,codexCLINotificationSettings: CodexCLINotificationSettings,activityMonitor: CodexActivityMonitor,syncSettings: WorkflowSyncSettings,@@ -135,7 +135,7 @@ final class StatusItemController: NSObject, NSMenuDelegate {) {self.viewModel = viewModelself.workflowViewModel = workflowViewModel- self.codexHookSettings = codexHookSettings+ self.advancedModeSettings = advancedModeSettingsself.codexCLINotificationSettings = codexCLINotificationSettingsself.activityMonitor = activityMonitorself.syncSettings = syncSettings@@ -271,8 +271,8 @@ final class StatusItemController: NSObject, NSMenuDelegate {// 订阅时 CombineLatest 会同步发出当前值, 初始图标由订阅路径统一渲染observeViewModel()observeWorkflowSyncState()- codexHookSettings.reconcileInstalledHooks()- observeMainPanelHookState()+ advancedModeSettings.reconcileConfiguration()+ observeMainPanelAdvancedModeState()viewModel.startAutoRefresh()}@@ -353,7 +353,7 @@ final class StatusItemController: NSObject, NSMenuDelegate {let rootView = CodexStatusMenuView(viewModel: viewModel,workflowViewModel: workflowViewModel,- codexHookSettings: codexHookSettings,+ advancedModeSettings: advancedModeSettings,mainPanelSettings: mainPanelSettings,activityMonitor: activityMonitor,syncSettings: syncSettings,@@ -400,11 +400,11 @@ final class StatusItemController: NSObject, NSMenuDelegate {.removeDuplicates()let isTaskCenterVisible = Publishers.CombineLatest(- codexHookSettings.$isEnabled,+ advancedModeSettings.$isEnabled,mainPanelSettings.$layout)- .map { isHookEnabled, layout in- isHookEnabled && layout.isVisible(.activity)+ .map { isAdvancedModeEnabled, layout in+ isAdvancedModeEnabled && layout.isVisible(.activity)}.removeDuplicates()@@ -448,7 +448,7 @@ final class StatusItemController: NSObject, NSMenuDelegate {guard let self else {return}- refreshWorkflowIfHookEnabled(performMaintenance: true)+ refreshWorkflowIfAdvancedModeEnabled(performMaintenance: true)}.store(in: &cancellables)@@ -480,7 +480,7 @@ final class StatusItemController: NSObject, NSMenuDelegate {}private func observeWorkflowSyncState() {- codexHookSettings.$isEnabled+ advancedModeSettings.$isEnabled.removeDuplicates().sink { [weak self] isEnabled inguard let self else {@@ -488,10 +488,10 @@ final class StatusItemController: NSObject, NSMenuDelegate {}if isEnabled {- // 回调跑在 willSet, codexHookSettings.isEnabled 此刻还是旧值, 只能用参数+ // 回调跑在 willSet, advancedModeSettings.isEnabled 此刻还是旧值, 只能用参数workflowSyncScheduler.requestSync(- trigger: .hookEnabled,- activation: syncSettings.activation(isHookEnabled: true)+ trigger: .advancedModeEnabled,+ activation: syncSettings.activation(isAdvancedModeEnabled: true))} else {workflowSyncScheduler.clearPendingMaintenance()@@ -508,11 +508,11 @@ final class StatusItemController: NSObject, NSMenuDelegate {.store(in: &cancellables)}- private func observeMainPanelHookState() {- codexHookSettings.$isEnabled+ private func observeMainPanelAdvancedModeState() {+ advancedModeSettings.$isEnabled.removeDuplicates().sink { [weak self] isEnabled in- self?.mainPanelSettings.updateHookEnabled(isEnabled)+ self?.mainPanelSettings.updateAdvancedModeEnabled(isEnabled)}.store(in: &cancellables)}@@ -760,7 +760,7 @@ final class StatusItemController: NSObject, NSMenuDelegate {guard let self, isActiveMenuSurfaceVisible else { return }menuSurfaceState = .shown// 展开完成后再刷新共享状态, 避免主面板与设置窗口在淡入期间一起重算- refreshWorkflowIfHookEnabled(performMaintenance: false)+ refreshWorkflowIfAdvancedModeEnabled(performMaintenance: false)viewModel.refreshIfNeeded(trigger: .panelOpen)}}@@ -997,10 +997,10 @@ final class StatusItemController: NSObject, NSMenuDelegate {// MARK: - 刷新与同步- private func refreshWorkflowIfHookEnabled(performMaintenance: Bool) {- // Hook 与额度使用同一刷新节奏, 配置和信任状态损坏后都能自动收敛- codexHookSettings.reconcileInstalledHooks()- guard codexHookSettings.isEnabled else {+ private func refreshWorkflowIfAdvancedModeEnabled(performMaintenance: Bool) {+ // 进阶模式与额度使用同一刷新节奏, 配置和信任状态损坏后都能自动收敛+ advancedModeSettings.reconcileConfiguration()+ guard advancedModeSettings.isEnabled else {workflowSyncScheduler.clearPendingMaintenance()return}@@ -1023,14 +1023,14 @@ final class StatusItemController: NSObject, NSMenuDelegate {workflowSyncScheduler.requestSync(trigger: .settings,activation: syncSettings.activation(- isHookEnabled: codexHookSettings.isEnabled,+ isAdvancedModeEnabled: advancedModeSettings.isEnabled,isSyncAvailable: isSyncAvailable))}private var workflowSyncActivation: WorkflowSyncActivation {- syncSettings.activation(isHookEnabled: codexHookSettings.isEnabled)+ syncSettings.activation(isAdvancedModeEnabled: advancedModeSettings.isEnabled)}// MARK: - 侧边面板diff --git a/CodexBar/Controllers/TaskGlowController.swift b/CodexBar/Controllers/TaskGlowController.swiftindex 255aed0..c4b592c 100644--- a/CodexBar/Controllers/TaskGlowController.swift+++ b/CodexBar/Controllers/TaskGlowController.swift@@ -7,7 +7,7 @@ import QuartzCorefinal class TaskGlowController {private let settings: TaskGlowSettingsprivate let activityMonitor: CodexActivityMonitor- private let hookSettings: CodexHookSettings+ private let advancedModeSettings: AdvancedModeSettingsprivate var appearance: TaskGlowAppearanceprivate var cancellables = Set<AnyCancellable>()private var panels: [TaskGlowPanel] = []@@ -26,11 +26,11 @@ final class TaskGlowController {init(settings: TaskGlowSettings,activityMonitor: CodexActivityMonitor,- hookSettings: CodexHookSettings+ advancedModeSettings: AdvancedModeSettings) {self.settings = settingsself.activityMonitor = activityMonitor- self.hookSettings = hookSettings+ self.advancedModeSettings = advancedModeSettingsappearance = settings.appearancemotionClock.setAnimationSpeed(appearance.animationSpeed)}@@ -44,15 +44,15 @@ final class TaskGlowController {guard cancellables.isEmpty else { return }Publishers.CombineLatest3(settings.$isEnabled,- hookSettings.$isEnabled,- hookSettings.$isVerified+ advancedModeSettings.$isEnabled,+ advancedModeSettings.$isVerified)- .sink { [weak self] enabled, hookEnabled, hookVerified in+ .sink { [weak self] enabled, advancedModeEnabled, advancedModeVerified inguard let self else { return }- if !enabled || !hookEnabled || !hookVerified {+ if !enabled || !advancedModeEnabled || !advancedModeVerified {cancelPreview()}- isEnabled = enabled && hookEnabled && hookVerified+ isEnabled = enabled && advancedModeEnabled && advancedModeVerifiedconsume(CodexActivityPresentationUpdate(snapshot: activityMonitor.snapshot, terminalEvents: []))}.store(in: &cancellables)@@ -123,7 +123,7 @@ final class TaskGlowController {}return}- guard isEnabled, hookSettings.isOperable,+ guard isEnabled, advancedModeSettings.isOperable,!isSystemSleeping, !isDisplaySleeping, isSessionActive else { return }let role: TaskGlowColorRoleswitch request {diff --git a/CodexBar/Models/CodexStatusError.swift b/CodexBar/Models/CodexStatusError.swiftindex 562feb6..dcb88a9 100644--- a/CodexBar/Models/CodexStatusError.swift+++ b/CodexBar/Models/CodexStatusError.swift@@ -16,23 +16,23 @@ nonisolated enum CodexStatusError: LocalizedError {var errorDescription: String? {switch self {case .executableNotFound:- String(localized: "codex-status.error.executable-not-found")+ String(localized: "codex-status.cli.error.executable-not-found")case let .sourceUnavailable(source):- "\(source.displayName): \(String(localized: "settings.codex-version.unavailable"))"+ "\(source.displayName): \(String(localized: "codex-cli.source.status.unavailable"))"case .serverTimeout:- String(localized: "codex-status.error.server-timeout")+ String(localized: "codex-status.app-server.error.server-timeout")case .serverConnectionClosed:- String(localized: "codex-status.error.connection-closed")+ String(localized: "codex-status.app-server.error.connection-closed")case .invalidServerResponse, .invalidResponsePayload:- String(localized: "codex-status.error.invalid-response")+ String(localized: "codex-status.app-server.error.invalid-response")case let .serverError(message):messagecase .unsupportedMethod:- String(localized: "codex-status.error.unsupported-method")+ String(localized: "codex-status.app-server.error.unsupported-method")case let .unsupportedVersion(minimum):String(localized: "codex-version.requirement", defaultValue: "\(minimum)")case .notLoggedIn:- String(localized: "codex-status.error.not-logged-in")+ String(localized: "codex-status.account.error.not-logged-in")}}diff --git a/CodexBar/Models/UsageHeatmapDay.swift b/CodexBar/Models/UsageHeatmapDay.swiftindex 0c3bf41..b062f1a 100644--- a/CodexBar/Models/UsageHeatmapDay.swift+++ b/CodexBar/Models/UsageHeatmapDay.swift@@ -42,8 +42,8 @@ nonisolated struct UsageHeatmapDay: Equatable, Identifiable {) -> [UsageHeatmapDay?] {let todayTokenCount = usage?.tokenCount(on: today)let hasDailyUsageBuckets = usage?.hasDailyUsageBuckets == true- // Hook 开启时当天工作流统计可见- // Hook 关闭时只在 token bucket 已返回时展示今天+ // 进阶模式开启时当天工作流统计可见+ // 进阶模式关闭时只在 token bucket 已返回时展示今天let endingDaysAgo = showsWorkflow || todayTokenCount != nil ? 0 : 1let workflowByDate = workflow.dailyMetrics.reduce(into: [String: WorkflowDailyMetrics]()) { result, metrics inresult[metrics.startDate] = metricsdiff --git a/CodexBar/Resources/Localizable.xcstrings b/CodexBar/Resources/Localizable.xcstringsindex 6026896..e4c0955 100644--- a/CodexBar/Resources/Localizable.xcstrings+++ b/CodexBar/Resources/Localizable.xcstrings@@ -705,114 +705,274 @@}}},- "activity.tokens.cache-hit-rate" : {+ "advanced-mode.codex.version.unavailable" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Cache-H"+ "value" : "Could not determine the Codex version. Advanced Mode requires Codex %@ or later"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "缓存命中率"+ "value" : "无法确认 Codex 版本, 进阶模式需要 Codex %@ 或更高版本"}}}},- "activity.tokens.cache-write-input" : {+ "advanced-mode.codex.version.unsupported" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Cache-W"+ "value" : "Enabling Advanced Mode requires Codex %@ or later"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "缓存写入"+ "value" : "启用进阶模式需要 Codex %@ 或更高版本"}}}},- "activity.tokens.cached-input" : {+ "advanced-mode.hook.error.config-read-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Cached"+ "value" : "Could not read the Codex Hook configuration"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "缓存命中"+ "value" : "读取 Codex Hook 配置失败"}}}},- "activity.tokens.reasoning-output" : {+ "advanced-mode.hook.error.configuration-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Reasoning"+ "value" : "Could not configure Codex Hook"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "推理输出"+ "value" : "设置 Codex Hook 失败"}}}},- "activity.tokens.input" : {+ "advanced-mode.hook.error.invalid-config-format" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Input"+ "value" : "Invalid hooks.json format"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "输入总计"+ "value" : "hooks.json 格式错误"}}}},- "activity.tokens.output" : {+ "advanced-mode.hook.error.trust-cleanup-unavailable" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Output"+ "value" : "Advanced Mode is off. Could not clear Hook trust"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "输出总计"+ "value" : "进阶模式已关闭, 无法清理 Hook 信任状态"}}}},- "activity.tokens.total" : {+ "advanced-mode.hook.error.verification-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Total"+ "value" : "Could not verify Codex Hook: %@"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "总计"+ "value" : "无法验证 Codex Hook: %@"+ }+ }+ }+ },+ "advanced-mode.hook.result.empty" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Codex returned no Hook validation results"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Codex 未返回 Hook 校验结果"+ }+ }+ }+ },+ "advanced-mode.hook.result.error" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Codex reported Hook validation errors"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Codex 返回 Hook 校验错误"+ }+ }+ }+ },+ "advanced-mode.hook.result.warning" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Codex reported Hook validation warnings"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Codex 返回 Hook 校验警告"+ }+ }+ }+ },+ "advanced-mode.hook.status.disabled" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "CodexBar Hook is disabled"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "CodexBar Hook 已被禁用"+ }+ }+ }+ },+ "advanced-mode.hook.status.disabled-by-codex" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Codex Hook is disabled in Codex settings"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Codex 配置已禁用 Hook"+ }+ }+ }+ },+ "advanced-mode.hook.status.inactive" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "CodexBar Hook is not working"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "CodexBar Hook 未生效"+ }+ }+ }+ },+ "advanced-mode.hook.status.incomplete" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "CodexBar Hook is incomplete"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "CodexBar Hook 配置不完整"+ }+ }+ }+ },+ "advanced-mode.hook.status.unexpected-source" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Unexpected CodexBar Hook source"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "CodexBar Hook 意外来源"+ }+ }+ }+ },+ "advanced-mode.hook.status.untrusted" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "CodexBar Hook is not trusted"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "CodexBar Hook 未被信任"+ }+ }+ }+ },+ "advanced-mode.name" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Advanced Mode"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "进阶模式"}}}@@ -913,6 +1073,22 @@}}},+ "auto-reset.error.wake-schedule-failed" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Could not schedule a wake event for Automatic Reset"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "设置自动重置唤醒计划失败"+ }+ }+ }+ },"auto-reset.lead-time.fifteen-minutes" : {"localizations" : {"en" : {@@ -1089,306 +1265,306 @@}}},- "codex-cli.version.launch-failed" : {+ "codex-cli.source.action.select" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Failed to launch"+ "value" : "Select Source"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "启动失败"+ "value" : "选择来源"}}}},- "codex-cli.version.not-found" : {+ "codex-cli.source.automatic" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "%@ not found"+ "value" : "Automatic"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "未找到 %@"+ "value" : "自动选择"}}}},- "codex-cli.version.parse-failed" : {+ "codex-cli.source.error.not-found" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Version not recognized"+ "value" : "%@ not found"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "版本未知"+ "value" : "未找到 %@"}}}},- "codex-cli.version.read-failed" : {+ "codex-cli.source.status.in-use" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Failed to read version"+ "value" : "In Use"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "读取失败"+ "value" : "当前使用"}}}},- "codex-cli.version.read-timeout" : {+ "codex-cli.source.status.unavailable" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Version check timed out"+ "value" : "Unavailable"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "读取超时"+ "value" : "不可用"}}}},- "codex-cli.version.unknown" : {+ "codex-cli.version.launch-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Unknown version"+ "value" : "Failed to launch"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "未知版本"+ "value" : "启动失败"}}}},- "hook.version.unavailable" : {+ "codex-cli.version.newer-installed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Enabling CodexBar Hook requires Codex %@ or later"+ "value" : "Installed: %@"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "启用 CodexBar Hook 需要 Codex %@ 或更高版本"+ "value" : "已安装 %@"}}}},- "hook.version.unsupported" : {+ "codex-cli.version.parse-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Enabling CodexBar Hook requires Codex %@ or later"+ "value" : "Version not recognized"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "启用 CodexBar Hook 需要 Codex %@ 或更高版本"+ "value" : "版本未知"}}}},- "codex-status.account.not-signed-in" : {+ "codex-cli.version.read-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Not signed in"+ "value" : "Failed to read version"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "未登录"+ "value" : "读取失败"}}}},- "codex-status.account.unavailable" : {+ "codex-cli.version.read-timeout" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Codex account unavailable"+ "value" : "Version check timed out"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex 账号异常"+ "value" : "读取超时"}}}},- "codex-status.error.connection-closed" : {+ "codex-cli.version.unknown" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "The Codex app-server connection closed"+ "value" : "Unknown version"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex app-server 连接已经断开"+ "value" : "未知版本"}}}},- "codex-status.error.executable-not-found" : {+ "codex-status.account.error.not-logged-in" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not find the Codex CLI or app"+ "value" : "Codex is not signed in"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "找不到 Codex CLI 或 Codex APP"+ "value" : "Codex 未登录"}}}},- "codex-status.error.invalid-response" : {+ "codex-status.account.not-signed-in" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not parse the Codex app-server response"+ "value" : "Not signed in"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex app-server 响应无法解析"+ "value" : "未登录"}}}},- "codex-status.error.not-logged-in" : {+ "codex-status.account.unavailable" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Codex is not signed in"+ "value" : "Codex account unavailable"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex 未登录"+ "value" : "Codex 账号异常"}}}},- "codex-status.error.server-timeout" : {+ "codex-status.app-server.error.connection-closed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Timed out waiting for a Codex app-server response"+ "value" : "The Codex app-server connection closed"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex app-server 等待响应超时"+ "value" : "Codex app-server 连接已经断开"}}}},- "codex-status.error.unsupported-method" : {+ "codex-status.app-server.error.invalid-response" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "The Codex app-server does not support this method"+ "value" : "Could not parse the Codex app-server response"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex app-server 不支持该接口"+ "value" : "Codex app-server 响应无法解析"}}}},- "codex-status.result.empty" : {+ "codex-status.app-server.error.server-timeout" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Codex returned no results"+ "value" : "Timed out waiting for a Codex app-server response"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex 没有返回任何结果"+ "value" : "Codex app-server 等待响应超时"}}}},- "codex-status.result.error" : {+ "codex-status.app-server.error.unsupported-method" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Codex returned an error"+ "value" : "The Codex app-server does not support this method"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex 返回错误"+ "value" : "Codex app-server 不支持该接口"}}}},- "codex-status.result.warning" : {+ "codex-status.cli.error.executable-not-found" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Codex returned a warning"+ "value" : "Could not find the Codex CLI or app"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex 返回警告"+ "value" : "找不到 Codex CLI 或 Codex APP"}}}@@ -1873,258 +2049,194 @@}}},- "helper.status.authorization-required" : {+ "helper.error.assets-invalid" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Allow CodexBar to run in the background"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "需要授权允许 CodexBar 后台运行"- }- }- }- },- "helper.status.install-and-authorize" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Install CodexBar Helper and allow background activity"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "需要安装并授权 CodexBar Helper 后台运行"- }- }- }- },- "helper.status.installed-needs-authorization" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "CodexBar Helper installed. Allow background activity"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "已安装 CodexBar Helper 但需要授权允许后台运行"- }- }- }- },- "helper.status.not-registered" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "CodexBarHelper is not registered"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "CodexBarHelper 尚未注册"- }- }- }- },- "hook.error.config-read-failed" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Could not read the Codex Hook configuration"+ "value" : "Helper validation failed. Reinstall CodexBar"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "读取 Codex Hook 配置失败"+ "value" : "CodexBar Helper 组件或配置异常, 请重新安装 CodexBar"}}}},- "hook.error.configuration-failed" : {+ "helper.error.assets-missing" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not configure Codex Hook"+ "value" : "Helper incomplete. Reinstall CodexBar"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "设置 Codex Hook 失败"+ "value" : "CodexBar Helper 组件或配置丢失, 请重新安装 CodexBar"}}}},- "hook.error.invalid-config-format" : {+ "helper.error.connection-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Invalid hooks.json format"+ "value" : "Could not connect to the service"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "hooks.json 文件格式错误"+ "value" : "连接服务失败"}}}},- "hook.error.trust-cleanup-unavailable" : {+ "helper.error.connection-interrupted" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Codex Hook disabled. Cannot clear trust"+ "value" : "The service connection was interrupted"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "已关闭 Codex Hook, 无法清理信任状态"+ "value" : "服务连接中断"}}}},- "hook.error.verification-failed" : {+ "helper.error.invalid-interface" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not verify Codex Hook: %@"+ "value" : "Invalid service interface"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "无法验证 Codex Hook: %@"+ "value" : "服务接口无效"}}}},- "hook.name" : {+ "helper.error.no-response" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook"+ "value" : "The service is not responding"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook"+ "value" : "服务无响应"}}}},- "hook.status.disabled" : {+ "helper.error.registration-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook is disabled"+ "value" : "Could not register the service"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook 已被禁用"+ "value" : "注册服务失败"}}}},- "hook.status.disabled-by-codex" : {+ "helper.error.update-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Codex Hook is disabled in Codex settings"+ "value" : "Could not update the service"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex 配置已禁用 Hook"+ "value" : "更新服务失败"}}}},- "hook.status.inactive" : {+ "helper.status.authorization-required" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook is not working"+ "value" : "Allow CodexBar to run in the background"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook 未生效"+ "value" : "需要授权允许 CodexBar 后台运行"}}}},- "hook.status.incomplete" : {+ "helper.status.install-and-authorize" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook is incomplete"+ "value" : "Install CodexBar Helper and allow background activity"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook 配置不完整"+ "value" : "需要安装并授权 CodexBar Helper 后台运行"}}}},- "hook.status.unexpected-source" : {+ "helper.status.installed-needs-authorization" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Unexpected CodexBar Hook source"+ "value" : "CodexBar Helper installed. Allow background activity"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook 意外来源"+ "value" : "已安装 CodexBar Helper 但需要授权允许后台运行"}}}},- "hook.status.untrusted" : {+ "helper.status.not-registered" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook is not trusted"+ "value" : "CodexBarHelper is not registered"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Hook 未被信任"+ "value" : "CodexBarHelper 尚未注册"}}}@@ -2337,386 +2449,370 @@}}},- "auto-reset.error.wake-schedule-failed" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Could not schedule a wake event for Automatic Reset"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "设置自动重置唤醒计划失败"- }- }- }- },- "keep-alive.error.connection-failed" : {+ "keep-alive.error.prevent-idle-sleep-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not connect to the service"+ "value" : "Could not prevent idle sleep"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "连接服务失败"+ "value" : "防止空闲睡眠失败"}}}},- "keep-alive.error.connection-interrupted" : {+ "keep-alive.error.restore-idle-sleep-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "The service connection was interrupted"+ "value" : "Could not restore the idle sleep policy"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "服务连接中断"+ "value" : "恢复空闲睡眠策略失败"}}}},- "keep-alive.error.helper-assets-invalid" : {+ "keep-alive.error.retry-limit-reached" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Helper validation failed. Reinstall CodexBar"+ "value" : "Keep-awake failed repeatedly; retries stopped"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Helper 组件或配置异常, 请重新安装 CodexBar"+ "value" : "防睡眠多次失败, 已停止重试"}}}},- "keep-alive.error.helper-assets-missing" : {+ "keep-alive.error.toggle-sleep-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Helper incomplete. Reinstall CodexBar"+ "value" : "Could not change the system sleep state"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "CodexBar Helper 组件或配置丢失, 请重新安装 CodexBar"+ "value" : "切换睡眠状态失败"}}}},- "keep-alive.error.invalid-helper-interface" : {+ "keep-alive.low-battery.caption" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Invalid service interface"+ "value" : "Battery only; resumes when charging"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "服务接口无效"+ "value" : "仅在使用电池供电时生效, 充电时自动恢复"}}}},- "keep-alive.error.no-response" : {+ "keep-alive.low-battery.off" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "The service is not responding"+ "value" : "Off"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "服务无响应"+ "value" : "关闭"}}}},- "keep-alive.error.prevent-idle-sleep-failed" : {+ "keep-alive.low-battery.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not prevent idle sleep"+ "value" : "Low Battery Protection"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "防止空闲睡眠失败"+ "value" : "低电量保护"}}}},- "keep-alive.error.registration-failed" : {+ "keep-alive.status.active" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not register the service"+ "value" : "System sleep is currently prevented"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "注册服务失败"+ "value" : "已防止系统睡眠"}}}},- "keep-alive.error.restore-idle-sleep-failed" : {+ "keep-alive.status.disabled-by-other-source" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not restore the idle sleep policy"+ "value" : "System sleep is disabled by another source"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "恢复空闲睡眠策略失败"+ "value" : "系统睡眠已由其他来源关闭"}}}},- "keep-alive.error.retry-limit-reached" : {+ "keep-alive.status.duration-limit-reached" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Keep-awake failed repeatedly; retries stopped"+ "value" : "Keep-awake limit reached (%@)"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "防睡眠多次失败, 已停止重试"+ "value" : "已达到防睡眠时间上限 (%@)"}}}},- "keep-alive.error.toggle-sleep-failed" : {+ "keep-alive.status.low-battery" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not change the system sleep state"+ "value" : "Low battery; system sleep restored"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "切换睡眠状态失败"+ "value" : "电量过低, 已恢复系统睡眠"}}}},- "keep-alive.error.update-failed" : {+ "keep-alive.waiting.caption" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Could not update the service"+ "value" : "Prevent sleep while a task awaits approval"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "更新服务失败"+ "value" : "任务等待批准期间继续防止系统睡眠"}}}},- "keep-alive.low-battery.caption" : {+ "keep-alive.waiting.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Battery only; resumes when charging"+ "value" : "Keep Awake While Waiting"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "仅在使用电池供电时生效, 充电时自动恢复"+ "value" : "等待批准时保持防睡眠"}}}},- "keep-alive.low-battery.off" : {+ "log.action.copy-full" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Off"+ "value" : "Copy Full %@"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "关闭"+ "value" : "复制完整%@"}}}},- "keep-alive.low-battery.title" : {+ "log.action.preview-full" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Low Battery Protection"+ "value" : "Preview Full %@"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "低电量保护"+ "value" : "预览完整%@"}}}},- "keep-alive.status.active" : {+ "log.app-server.error.exit-timeout-killed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "System sleep is currently prevented"+ "value" : "app-server exit timed out; process killed"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "已防止系统睡眠"+ "value" : "app-server 退出超时, 已强制结束"}}}},- "keep-alive.status.disabled-by-other-source" : {+ "log.app-server.error.exit-timeout-running" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "System sleep is disabled by another source"+ "value" : "app-server exit timed out; may still be running"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "系统睡眠已由其他来源关闭"+ "value" : "app-server 退出超时, 可能仍在后台运行"}}}},- "keep-alive.status.duration-limit-reached" : {+ "log.app-server.error.initialization-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Keep-awake limit reached (%@)"+ "value" : "Failed to initialize the app-server session: %@"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "已达到防睡眠时间上限 (%@)"+ "value" : "app-server 会话初始化失败: %@"}}}},- "keep-alive.status.low-battery" : {+ "log.app-server.error.launch-failed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Low battery; system sleep restored"+ "value" : "Failed to launch app-server: %@"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "电量过低, 已恢复系统睡眠"+ "value" : "app-server 启动失败: %@"}}}},- "keep-alive.waiting.caption" : {+ "log.app-server.error.response-connection-closed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Prevent sleep while a task awaits approval"+ "value" : "Connection closed while waiting for a response"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "任务等待批准期间继续防止系统睡眠"+ "value" : "连接已断开, 等待响应失败"}}}},- "keep-alive.waiting.title" : {+ "log.app-server.error.response-timeout" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Keep Awake While Waiting"+ "value" : "Response timed out"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "等待批准时保持防睡眠"+ "value" : "等待响应超时"}}}},- "log.action.copy-full" : {+ "log.app-server.error.write-connection-closed" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Copy Full %@"+ "value" : "Connection closed; the request could not be sent"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "复制完整%@"+ "value" : "连接已断开, 无法发送请求"}}}},- "log.action.preview-full" : {+ "log.app-server.window.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Preview Full %@"+ "value" : "Codex app-server Log"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "预览完整%@"+ "value" : "Codex app-server 日志"}}}@@ -2833,22 +2929,6 @@}}},- "log.window.app-server-title" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Codex app-server Log"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "Codex app-server 日志"- }- }- }- },"log.window.title" : {"localizations" : {"en" : {@@ -3057,7 +3137,7 @@}}},- "notification.credit-expiry.body" : {+ "notification.banked-reset-expiry.body" : {"localizations" : {"en" : {"stringUnit" : {@@ -3073,12 +3153,12 @@}}},- "notification.credit-expiry.title" : {+ "notification.banked-reset-expiry.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Reset Credits Expiring Soon"+ "value" : "Banked Resets Expiring Soon"}},"zh-Hans" : {@@ -3702,13 +3782,13 @@"en" : {"stringUnit" : {"state" : "translated",- "value" : "Proxy"+ "value" : "Network Proxy"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "代理"+ "value" : "网络代理"}}}@@ -3889,118 +3969,6 @@}}},- "request-log.error.exit-timeout-killed" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "app-server exit timed out; process killed"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "app-server 退出超时, 已强制结束"- }- }- }- },- "request-log.error.exit-timeout-running" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "app-server exit timed out; may still be running"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "app-server 退出超时, 可能仍在后台运行"- }- }- }- },- "request-log.error.initialization-failed" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Failed to initialize the app-server session: %@"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "app-server 会话初始化失败: %@"- }- }- }- },- "request-log.error.launch-failed" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Failed to launch app-server: %@"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "app-server 启动失败: %@"- }- }- }- },- "request-log.error.response-connection-closed" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Connection closed while waiting for a response"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "连接已断开, 等待响应失败"- }- }- }- },- "request-log.error.response-timeout" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Response timed out"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "等待响应超时"- }- }- }- },- "request-log.error.write-connection-closed" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Connection closed; the request could not be sent"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "连接已断开, 无法发送请求"- }- }- }- },"settings.about.github-project" : {"localizations" : {"en" : {@@ -4044,215 +4012,151 @@"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "未安装"- }- }- }- },- "settings.about.helper.requires-approval" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Not Authorized"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "未授权"- }- }- }- },- "settings.about.helper.title" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "CodexBar Helper"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "CodexBar Helper"- }- }- }- },- "settings.about.helper.unavailable" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "Unavailable"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "不可用"- }- }- }- },- "settings.about.version" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "CodexBar Version"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "CodexBar 版本"+ "value" : "未安装"}}}},- "settings.auto-reset.title" : {+ "settings.about.helper.requires-approval" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Automatic Reset"+ "value" : "Not Authorized"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "自动重置"+ "value" : "未授权"}}}},- "settings.codex-version.in-use" : {+ "settings.about.helper.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "In Use"+ "value" : "CodexBar Helper"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "当前使用"+ "value" : "CodexBar Helper"}}}},- "settings.codex-version.reconnect" : {+ "settings.about.helper.unavailable" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Reconnect"+ "value" : "Unavailable"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "重新建立连接"+ "value" : "不可用"}}}},- "settings.codex-version.reconnecting" : {+ "settings.about.version" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Reconnecting"+ "value" : "CodexBar Version"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "正在重新连接"+ "value" : "CodexBar 版本"}}}},- "settings.codex-version.source.automatic" : {+ "settings.auto-reset.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Automatic"+ "value" : "Automatic Reset"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "自动选择"+ "value" : "自动重置"}}}},- "settings.codex-version.source.select" : {+ "settings.codex.connection.action.reconnect" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Select Source"+ "value" : "Reconnect"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "选择来源"+ "value" : "重新建立连接"}}}},- "settings.codex-version.title" : {+ "settings.codex.connection.status.reconnecting" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Codex Versions"+ "value" : "Reconnecting"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex 版本"+ "value" : "正在重新连接"}}}},- "settings.codex-version.unavailable" : {+ "settings.codex.version.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Unavailable"+ "value" : "Codex Versions"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "不可用"+ "value" : "Codex 版本"}}}},- "settings.codex-version.updated-to" : {+ "settings.data-update.interval.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Updated to %@"+ "value" : "Data Update Interval"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "已更新至 %@"+ "value" : "数据更新间隔"}}}@@ -4529,50 +4433,50 @@}}},- "settings.notifications.codex-tui.caption" : {+ "settings.notifications.banked-reset-expiry.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Separate from CodexBar notifications"+ "value" : "Reset Expiration"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex TUI 通知, 独立于 CodexBar 通知"+ "value" : "重置临期通知"}}}},- "settings.notifications.codex-tui.title" : {+ "settings.notifications.codex-tui.caption" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Codex TUI Notifications"+ "value" : "Separate from CodexBar notifications"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "Codex TUI 通知"+ "value" : "Codex TUI 通知, 独立于 CodexBar 通知"}}}},- "settings.notifications.credit-expiry.title" : {+ "settings.notifications.codex-tui.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Reset Expiration"+ "value" : "Codex TUI Notifications"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "重置临期通知"+ "value" : "Codex TUI 通知"}}}@@ -4785,82 +4689,82 @@}}},- "settings.task-glow.title" : {+ "settings.sync.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Glow Effect"+ "value" : "Sync Across Devices"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "流光效果"+ "value" : "跨设备同步"}}}},- "settings.sync.title" : {+ "settings.tab.about" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Sync Across Devices"+ "value" : "About"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "跨设备同步"+ "value" : "关于"}}}},- "settings.tab.about" : {+ "settings.tab.advanced" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "About"+ "value" : "Advanced"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "关于"+ "value" : "高级"}}}},- "settings.tab.advanced" : {+ "settings.tab.general" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Advanced"+ "value" : "General"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "高级"+ "value" : "通用"}}}},- "settings.tab.general" : {+ "settings.task-glow.title" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "General"+ "value" : "Glow Effect"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "通用"+ "value" : "流光效果"}}}@@ -4897,55 +4801,55 @@}}},- "sync.error.account-unavailable" : {+ "sync.error.retry-later" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Account unavailable"+ "value" : "Sync failed; try again later"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "账号不可用"+ "value" : "同步失败, 请稍后重试"}}}},- "sync.error.network-unavailable" : {+ "sync.icloud.error.account-unavailable" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Network unavailable"+ "value" : "iCloud account unavailable"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "网络不可用"+ "value" : "iCloud 账户不可用"}}}},- "sync.error.retry-later" : {+ "sync.icloud.error.network-unavailable" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Sync failed; try again later"+ "value" : "Network unavailable"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "同步失败, 请稍后重试"+ "value" : "网络不可用"}}}},- "sync.error.service-unavailable" : {+ "sync.icloud.error.service-unavailable" : {"localizations" : {"en" : {"stringUnit" : {@@ -5361,50 +5265,50 @@}}},- "usage.heatmap.token-metrics" : {+ "usage.heatmap.no-data" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Session data"+ "value" : "No daily usage data"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "会话数据"+ "value" : "暂无日用量数据"}}}},- "usage.heatmap.no-data" : {+ "usage.heatmap.past-weeks" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "No daily usage data"+ "value" : "Past %lld Weeks"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "暂无日用量数据"+ "value" : "近 %lld 周"}}}},- "usage.heatmap.past-weeks" : {+ "usage.heatmap.token-metrics" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Past %lld Weeks"+ "value" : "Session data"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "近 %lld 周"+ "value" : "会话数据"}}}@@ -5478,13 +5382,13 @@"en" : {"stringUnit" : {"state" : "translated",- "value" : "Longest Chat"+ "value" : "Longest Task"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "最长对话"+ "value" : "最长任务"}}}@@ -5521,6 +5425,118 @@}}},+ "usage.tokens.cache-hit-rate" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cache-H"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "缓存命中率"+ }+ }+ }+ },+ "usage.tokens.cache-write-input" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cache-W"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "缓存写入"+ }+ }+ }+ },+ "usage.tokens.cached-input" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cached"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "缓存命中"+ }+ }+ }+ },+ "usage.tokens.input" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Input"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "输入总计"+ }+ }+ }+ },+ "usage.tokens.output" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Output"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "输出总计"+ }+ }+ }+ },+ "usage.tokens.reasoning-output" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Reasoning"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "推理输出"+ }+ }+ }+ },+ "usage.tokens.total" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Total"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "总计"+ }+ }+ }+ },"workflow.metric.approvals" : {"localizations" : {"en" : {@@ -5697,6 +5713,22 @@}}},+ "workflow.rebuild.error.token-history-already-running" : {+ "localizations" : {+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Session data is already being rebuilt"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "会话数据正在重建中"+ }+ }+ }+ },"workflow.rebuild.result.completed" : {"localizations" : {"en" : {@@ -5734,7 +5766,7 @@"en" : {"stringUnit" : {"state" : "translated",- "value" : ", etc."+ "value" : ", etc"}},"zh-Hans" : {@@ -5793,18 +5825,18 @@}}},- "workflow.rebuild.summary.retry-after-hook-enabled" : {+ "workflow.rebuild.summary.retry-after-advanced-mode-enabled" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : ", will retry automatically after CodexBar Hook is enabled"+ "value" : ", will retry automatically after Advanced Mode is enabled"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : ", 开启 CodexBar Hook 后会自动重试"+ "value" : ", 开启进阶模式后会自动重试"}}}@@ -5857,22 +5889,6 @@}}},- "workflow.rebuild.summary.token-record-count" : {- "localizations" : {- "en" : {- "stringUnit" : {- "state" : "translated",- "value" : "; %lld session data records"- }- },- "zh-Hans" : {- "stringUnit" : {- "state" : "translated",- "value" : "; 会话数据 %lld 条"- }- }- }- },"workflow.rebuild.summary.token-history-incomplete" : {"localizations" : {"en" : {@@ -5889,18 +5905,18 @@}}},- "workflow.rebuild.error.token-history-already-running" : {+ "workflow.rebuild.summary.token-record-count" : {"localizations" : {"en" : {"stringUnit" : {"state" : "translated",- "value" : "Session data is already being rebuilt"+ "value" : "; %lld session data records"}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "会话数据正在重建中"+ "value" : "; 会话数据 %lld 条"}}}diff --git a/CodexBar/Services/CodexCLI/CodexCLIResolver.swift b/CodexBar/Services/CodexCLI/CodexCLIResolver.swiftindex 995f8c2..38a21d7 100644--- a/CodexBar/Services/CodexCLI/CodexCLIResolver.swift+++ b/CodexBar/Services/CodexCLI/CodexCLIResolver.swift@@ -33,7 +33,7 @@ nonisolated enum CodexCLISourceSelection: String, CaseIterable, Identifiable {}var title: String {- source?.displayName ?? String(localized: "settings.codex-version.source.automatic")+ source?.displayName ?? String(localized: "codex-cli.source.automatic")}static func load(from defaults: UserDefaults) -> Self {diff --git a/CodexBar/Services/CodexCLI/CodexCLIVersionService.swift b/CodexBar/Services/CodexCLI/CodexCLIVersionService.swiftindex 8a1c509..c78c5ec 100644--- a/CodexBar/Services/CodexCLI/CodexCLIVersionService.swift+++ b/CodexBar/Services/CodexCLI/CodexCLIVersionService.swift@@ -42,7 +42,7 @@ nonisolated struct CodexCLIVersionItem: Equatable, Identifiable {var displayVersion: String {if path == nil {return String(- localized: "codex-cli.version.not-found",+ localized: "codex-cli.source.error.not-found",defaultValue: "\(source.displayName)")}@@ -362,7 +362,7 @@ private final nonisolated class ProcessExitWaiter: Sendable {/// CodexBar 各能力依赖的 app-server 最低版本nonisolated enum CodexCLIMinimumVersion {static let global = "0.145.0"- static let hook = "0.150.0"+ static let advancedMode = "0.153.0"}/// 从 ` codex --version` 的输出中提取用户可读版本号diff --git a/CodexBar/Services/CodexStatus/AppServerSession.swift b/CodexBar/Services/CodexStatus/AppServerSession.swiftindex 0e3cbc1..40a0716 100644--- a/CodexBar/Services/CodexStatus/AppServerSession.swift+++ b/CodexBar/Services/CodexStatus/AppServerSession.swift@@ -9,9 +9,9 @@ final nonisolated class AppServerSession {private typealias EncodedMessage = (data: Data, text: String)private typealias ResponseLine = (text: String, data: Data)- private static let writeFailureMessage = String(localized: "request-log.error.write-connection-closed")- private static let responseConnectionClosedMessage = String(localized: "request-log.error.response-connection-closed")- private static let responseTimeoutMessage = String(localized: "request-log.error.response-timeout")+ private static let writeFailureMessage = String(localized: "log.app-server.error.write-connection-closed")+ private static let responseConnectionClosedMessage = String(localized: "log.app-server.error.response-connection-closed")+ private static let responseTimeoutMessage = String(localized: "log.app-server.error.response-timeout")private static let closeGracefulTimeout: TimeInterval = 1.0private static let closeKillTimeout: TimeInterval = 0.5@@ -161,11 +161,11 @@ final nonisolated class AppServerSession {breakcase .killed:logStorage?.recordFailure(- message: String(localized: "request-log.error.exit-timeout-killed")+ message: String(localized: "log.app-server.error.exit-timeout-killed"))case .stillRunning:logStorage?.recordFailure(- message: String(localized: "request-log.error.exit-timeout-running")+ message: String(localized: "log.app-server.error.exit-timeout-running"))}}diff --git a/CodexBar/Services/CodexStatus/CodexStatusService.swift b/CodexBar/Services/CodexStatus/CodexStatusService.swiftindex 7fee265..7e8efbd 100644--- a/CodexBar/Services/CodexStatus/CodexStatusService.swift+++ b/CodexBar/Services/CodexStatus/CodexStatusService.swift@@ -748,7 +748,7 @@ actor CodexStatusService {} catch {RequestLogStorage.shared.recordFailure(message: String(- localized: "request-log.error.launch-failed",+ localized: "log.app-server.error.launch-failed",defaultValue: "\(error.localizedDescription)"))@@ -795,7 +795,7 @@ actor CodexStatusService {// app-server 链路的细节按既有分工进日志窗口, 不重复写系统日志RequestLogStorage.shared.recordFailure(message: String(- localized: "request-log.error.initialization-failed",+ localized: "log.app-server.error.initialization-failed",defaultValue: "\(error.localizedDescription)"))diff --git a/CodexBar/Services/CodexStatus/CodexStatusViewModel.swift b/CodexBar/Services/CodexStatus/CodexStatusViewModel.swiftindex ad241ac..29270e2 100644--- a/CodexBar/Services/CodexStatus/CodexStatusViewModel.swift+++ b/CodexBar/Services/CodexStatus/CodexStatusViewModel.swift@@ -2,6 +2,30 @@ import Combineimport Foundationimport os+nonisolated enum DataUpdateInterval: Int, CaseIterable, Sendable {+ case oneMinute = 60+ case twoMinutes = 120+ case threeMinutes = 180+ case fiveMinutes = 300+ case tenMinutes = 600++ var duration: TimeInterval {+ TimeInterval(rawValue)+ }++ var title: String {+ String(localized: "duration.minutes", defaultValue: "\(rawValue / 60, specifier: "%lld")")+ }++ func remainingTime(since startedAt: Date?, now: Date) -> TimeInterval {+ guard let startedAt else {+ return 0+ }++ return max(0, duration - now.timeIntervalSince(startedAt))+ }+}+/// UI 级状态; 更细的连接和接口错误由服务层归并到日志nonisolated enum CodexLoadState: Equatable {case loading@@ -30,6 +54,7 @@ final class CodexStatusViewModel: ObservableObject {@Published private(set) var codexSourceSelection = CodexCLISourceSelection.automatic@Published private(set) var pendingCodexSourceSelection: CodexCLISourceSelection?@Published private(set) var autoRefreshCountdownStartedAt: Date?+ @Published private(set) var dataUpdateInterval: DataUpdateInterval/// 统计维护挂在额度刷新完成事件上, 由它继承本次刷新的触发来源private(set) var lastRefreshTrigger: LogTrigger = .launch@@ -39,20 +64,24 @@ final class CodexStatusViewModel: ObservableObject {}var autoRefreshInterval: TimeInterval {- Self.refreshInterval+ dataUpdateInterval.duration}- private static let refreshInterval: TimeInterval = 60+ private static let dataUpdateIntervalKey = "DataUpdate.intervalSeconds"private let service: CodexStatusService+ private let defaults: UserDefaultsprivate var autoRefreshTask: Task<Void, Never>?private var pendingRefreshTask: Task<Void, Never>?private var pendingForcedRefreshTrigger: LogTrigger?private let refreshCoordinator = RefreshTaskCoordinator()private var connectionInfoGeneration: UInt64 = 0- init(service: CodexStatusService = CodexStatusService()) {+ init(service: CodexStatusService = CodexStatusService(), defaults: UserDefaults = .standard) {self.service = service+ self.defaults = defaults+ dataUpdateInterval = (defaults.object(forKey: Self.dataUpdateIntervalKey) as? Int)+ .flatMap(DataUpdateInterval.init(rawValue:)) ?? .oneMinute}deinit {@@ -62,7 +91,7 @@ final class CodexStatusViewModel: ObservableObject {}func refreshIfNeeded(trigger: LogTrigger) {- guard Date().timeIntervalSince(autoRefreshCountdownStartedAt ?? .distantPast) > Self.refreshInterval else {+ guard dataUpdateInterval.remainingTime(since: autoRefreshCountdownStartedAt, now: Date()) == 0 else {return}@@ -74,12 +103,31 @@ final class CodexStatusViewModel: ObservableObject {return}- autoRefreshTask = Task { [weak self] in- self?.refreshIfNeeded(trigger: .launch)+ refreshIfNeeded(trigger: .launch)+ scheduleAutoRefresh()+ }+ func setDataUpdateInterval(_ interval: DataUpdateInterval) {+ guard dataUpdateInterval != interval else {+ return+ }++ defaults.set(interval.rawValue, forKey: Self.dataUpdateIntervalKey)+ dataUpdateInterval = interval+ AppLog.settings.notice("数据更新间隔变更: seconds=\(interval.rawValue)")+ if autoRefreshTask != nil {+ scheduleAutoRefresh()+ }+ }++ private func scheduleAutoRefresh() {+ autoRefreshTask?.cancel()+ autoRefreshTask = Task { [weak self] in// 每轮按剩余时间等待, 手动刷新后倒计时会自然重新对齐while !Task.isCancelled {- let delay = self?.autoRefreshDelay ?? Self.refreshInterval+ guard let delay = self?.autoRefreshDelay else {+ break+ }if await (try? Task.sleep(for: .seconds(delay))) == nil {break}@@ -199,7 +247,7 @@ final class CodexStatusViewModel: ObservableObject {)AppLog.app.notice("额度刷新完成: \(details, privacy: .public)")case .notLoggedIn:- // 未登录是正常状态, 混进失败词根会让每分钟一条噪声盖掉真故障+ // 未登录是正常状态, 使用 notice 级别记录刷新跳过原因let details = LogFields.joined("trigger=\(triggerName)","reason=notLoggedIn",@@ -244,7 +292,7 @@ final class CodexStatusViewModel: ObservableObject {func reconnectCodex(selection: CodexCLISourceSelection? = nil,- requiresHooks: Bool+ requiresAdvancedMode: Bool) async -> Bool {guard !isRefreshing, !isReconnecting else {return false@@ -270,7 +318,7 @@ final class CodexStatusViewModel: ObservableObject {do {codexConnectionInfo = try await service.reconnect(selection: selection,- minimumVersion: requiresHooks ? CodexCLIMinimumVersion.hook : CodexCLIMinimumVersion.global+ minimumVersion: requiresAdvancedMode ? CodexCLIMinimumVersion.advancedMode : CodexCLIMinimumVersion.global)codexSourceSelection = await service.currentSourceSelection()didReconnect = true@@ -295,10 +343,10 @@ final class CodexStatusViewModel: ObservableObject {private var autoRefreshDelay: TimeInterval {guard let autoRefreshCountdownStartedAt else {- return Self.refreshInterval+ return autoRefreshInterval}- let remaining = Self.refreshInterval - Date().timeIntervalSince(autoRefreshCountdownStartedAt)+ let remaining = dataUpdateInterval.remainingTime(since: autoRefreshCountdownStartedAt, now: Date())return max(1, remaining)}}diff --git a/CodexBar/Services/KeepAlive/KeepAliveController.swift b/CodexBar/Services/KeepAlive/KeepAliveController.swiftindex 34ab098..ccab818 100644--- a/CodexBar/Services/KeepAlive/KeepAliveController.swift+++ b/CodexBar/Services/KeepAlive/KeepAliveController.swift@@ -88,7 +88,7 @@ final class KeepAliveController: ObservableObject {}private let activityMonitor: CodexActivityMonitor- private let codexHookSettings: CodexHookSettings+ private let advancedModeSettings: AdvancedModeSettingsprivate let defaults: UserDefaultsprivate let systemSleepService = SystemSleepService()private let powerSourceMonitor = PowerSourceMonitor()@@ -133,22 +133,22 @@ final class KeepAliveController: ObservableObject {private var isStarted = falseprivate var isPreparingForTermination = falseprivate var lastLoggedSleepConditions: SleepConditions?- /// codexHookSettings.isOperable 的最新值, 由订阅维护+ /// advancedModeSettings.isOperable 的最新值, 由订阅维护/// 不直接读那个属性: 订阅回调跑在 willSet, 那时它还是改动前的值- private var isHookEnabled: Bool+ private var isAdvancedModeEnabled: Bool// MARK: - 生命周期init(activityMonitor: CodexActivityMonitor,- codexHookSettings: CodexHookSettings,+ advancedModeSettings: AdvancedModeSettings,defaults: UserDefaults = .standard) {self.activityMonitor = activityMonitor- self.codexHookSettings = codexHookSettings+ self.advancedModeSettings = advancedModeSettingsself.defaults = defaultsdurationLimiter = KeepAliveDurationLimiter(defaults: defaults)- isHookEnabled = codexHookSettings.isOperable+ isAdvancedModeEnabled = advancedModeSettings.isOperableisEnabled = defaults.bool(forKey: Self.enabledKey)// 默认关闭: 老版本升上来的用户不该多出一条中断任务的路径lowBatteryThreshold = (defaults.object(forKey: Self.lowBatteryThresholdKey) as? Int)@@ -172,18 +172,18 @@ final class KeepAliveController: ObservableObject {.sink { [weak self] in self?.objectWillChange.send() }.store(in: &cancellables)- // Hook 是本功能的依赖, 不是用户意图+ // 进阶模式是本功能的依赖, 不是用户意图// 只重新求值当前该不该防止系统睡眠, 绝不改写用户保存的开关// 看 isOperable 那两个输入而不是只看 isEnabled: Codex 那边全局关掉 hooks// 或者不信任我们的 handler 时事件送不过来, 任务恒为空, 防睡眠也就不该显示成可用- // @Published 在 willSet 就发信号, 此刻回读 codexHookSettings.isOperable 会拿到+ // @Published 在 willSet 就发信号, 此刻回读 advancedModeSettings.isOperable 会拿到// 正在变的那一项的旧值; CombineLatest 的两个参数都是各自的新值, 所以只认闭包参数- Publishers.CombineLatest(codexHookSettings.$isEnabled, codexHookSettings.$isVerified)+ Publishers.CombineLatest(advancedModeSettings.$isEnabled, advancedModeSettings.$isVerified).map { $0 && $1 }.removeDuplicates().sink { [weak self] isOperable in- self?.isHookEnabled = isOperable- self?.reconcileSleepState(trigger: .hookChanged)+ self?.isAdvancedModeEnabled = isOperable+ self?.reconcileSleepState(trigger: .advancedModeChanged)}.store(in: &cancellables)@@ -298,8 +298,8 @@ final class KeepAliveController: ObservableObject {// MARK: - 设置入口func setEnabled(_ enabled: Bool) {- // 与 sleepBlockReason 读同一份镜像, 类内只保留一个 Hook 状态的真相来源- guard !enabled || isHookEnabled else {+ // 与 sleepBlockReason 读同一份镜像, 类内只保留一个进阶模式状态的真相来源+ guard !enabled || isAdvancedModeEnabled else {return}guard enabled != isEnabled else {@@ -780,10 +780,10 @@ final class KeepAliveController: ObservableObject {publishNotificationDependencies()}- /// 通知选项是否可用取决于用户开关, Hook, 电量和时长上限+ /// 通知选项是否可用取决于用户开关, 进阶模式, 电量和时长上限/// 各输入的更新路径统一调用此方法, 避免各自维护判定规则private func publishNotificationDependencies() {- let isKeepAliveUsable = isEnabled && isHookEnabled+ let isKeepAliveUsable = isEnabled && isAdvancedModeEnabledassign(isKeepAliveUsable && hasBattery && lowBatteryThreshold != .off,to: \.isLowBatteryProtectionEnabled@@ -798,7 +798,7 @@ final class KeepAliveController: ObservableObject {/// 因任务, 电量或时长暂停防睡眠时, 仍允许修改设置private static func allowsOptions(_ blockReason: SleepBlockReason?) -> Bool {switch blockReason {- case .notStarted, .userOff, .hookDisabled, .helperUnavailable, .terminating:+ case .notStarted, .userOff, .advancedModeDisabled, .helperUnavailable, .terminating:falsecase nil, .noTasks, .helperRefreshing, .lowBattery, .limitReached:true@@ -813,7 +813,7 @@ final class KeepAliveController: ObservableObject {let conditions = SleepConditions(blockReason: blockReason,enabled: isEnabled,- hook: isHookEnabled,+ advancedMode: isAdvancedModeEnabled,tasks: hasKeepAliveTasks,helper: helperStatus,refreshing: isRefreshingHelper,@@ -833,7 +833,7 @@ final class KeepAliveController: ObservableObject {"trigger=\(triggerName)","want=\(blockReason == nil ? 1 : 0)","enabled=\(conditions.enabled ? 1 : 0)",- "hook=\(conditions.hook ? 1 : 0)",+ "advancedMode=\(conditions.advancedMode ? 1 : 0)","tasks=\(conditions.tasks ? 1 : 0)","helper=\(helperName)","refreshing=\(conditions.refreshing ? 1 : 0)",@@ -1444,10 +1444,10 @@ final class KeepAliveController: ObservableObject {if !isEnabled {return .userOff}- if !isHookEnabled {- return .hookDisabled+ if !isAdvancedModeEnabled {+ return .advancedModeDisabled}- // 先检查依赖, 避免 Hook 恢复任务前以 noTasks 提前放出未授权 Helper 的设置入口+ // 先检查依赖, 避免进阶模式恢复任务前以 noTasks 提前放出未授权 Helper 的设置入口if helperStatus != .enabled {return .helperUnavailable}diff --git a/CodexBar/Services/KeepAlive/KeepAliveModels.swift b/CodexBar/Services/KeepAlive/KeepAliveModels.swiftindex 7746cd3..844e52c 100644--- a/CodexBar/Services/KeepAlive/KeepAliveModels.swift+++ b/CodexBar/Services/KeepAlive/KeepAliveModels.swift@@ -116,7 +116,7 @@ extension KeepAliveController {enum SleepBlockReason: String {case notStartedcase userOff- case hookDisabled+ case advancedModeDisabledcase noTaskscase helperUnavailablecase helperRefreshing@@ -131,7 +131,7 @@ extension KeepAliveController {struct SleepConditions: Equatable {let blockReason: SleepBlockReason?let enabled: Bool- let hook: Bool+ let advancedMode: Boollet tasks: Boollet helper: HelperStatuslet refreshing: Bool@@ -155,18 +155,18 @@ nonisolated enum HelperPackageIssue: Equatable, Sendable {}nonisolated enum KeepAliveLocalizedMessage {- static let helperAssetsMissing = String(localized: "keep-alive.error.helper-assets-missing")- static let helperAssetsInvalid = String(localized: "keep-alive.error.helper-assets-invalid")- static let registrationFailed = String(localized: "keep-alive.error.registration-failed")- static let updateFailed = String(localized: "keep-alive.error.update-failed")+ static let helperAssetsMissing = String(localized: "helper.error.assets-missing")+ static let helperAssetsInvalid = String(localized: "helper.error.assets-invalid")+ static let registrationFailed = String(localized: "helper.error.registration-failed")+ static let updateFailed = String(localized: "helper.error.update-failed")static let preventIdleSleepFailed = String(localized: "keep-alive.error.prevent-idle-sleep-failed")static let toggleSleepFailed = String(localized: "keep-alive.error.toggle-sleep-failed")static let restoreIdleSleepFailed = String(localized: "keep-alive.error.restore-idle-sleep-failed")- static let connectionFailed = String(localized: "keep-alive.error.connection-failed")- static let noResponse = String(localized: "keep-alive.error.no-response")+ static let connectionFailed = String(localized: "helper.error.connection-failed")+ static let noResponse = String(localized: "helper.error.no-response")static let retryLimitReached = String(localized: "keep-alive.error.retry-limit-reached")- static let invalidHelperInterface = String(localized: "keep-alive.error.invalid-helper-interface")- static let connectionInterrupted = String(localized: "keep-alive.error.connection-interrupted")+ static let invalidHelperInterface = String(localized: "helper.error.invalid-interface")+ static let connectionInterrupted = String(localized: "helper.error.connection-interrupted")static let autoResetWakeScheduleFailed = String(localized: "auto-reset.error.wake-schedule-failed")}diff --git a/CodexBar/Services/Notifications/CodexNotificationService.swift b/CodexBar/Services/Notifications/CodexNotificationService.swiftindex 3435d2e..bd9b2d0 100644--- a/CodexBar/Services/Notifications/CodexNotificationService.swift+++ b/CodexBar/Services/Notifications/CodexNotificationService.swift@@ -920,9 +920,9 @@ nonisolated struct CodexNotificationContent: Equatable {let expirationText = CodexDateFormat.localDisplayString(from: expirationDate)return CodexNotificationContent(kind: "creditExpiry",- title: String(localized: "notification.credit-expiry.title"),+ title: String(localized: "notification.banked-reset-expiry.title"),body: String(- localized: "notification.credit-expiry.body",+ localized: "notification.banked-reset-expiry.body",defaultValue: "\(count)\(expirationText)"))diff --git a/CodexBar/Services/Settings/CodexHookSettings.swift b/CodexBar/Services/Settings/AdvancedModeSettings.swiftsimilarity index 83%rename from CodexBar/Services/Settings/CodexHookSettings.swiftrename to CodexBar/Services/Settings/AdvancedModeSettings.swiftindex 99203a1..42773d8 100644--- a/CodexBar/Services/Settings/CodexHookSettings.swift+++ b/CodexBar/Services/Settings/AdvancedModeSettings.swift@@ -2,21 +2,21 @@ import Combineimport Foundationimport os-/// 设置页的 Codex Hook 开关状态机, 同时管理 hooks.json 和 Codex 信任状态+/// 进阶模式开关状态机, 同时管理 hooks.json 和 Codex 信任状态@MainActor-final class CodexHookSettings: ObservableObject {- /// 当前进程中的 Hook 开启状态, 首次从现有配置恢复+final class AdvancedModeSettings: ObservableObject {+ /// 当前进程中的进阶模式开启状态, 首次从现有配置恢复/// 开启后配置缺失视为需要自愈, 只有显式关闭或明确的低版本会置为 false@Published private(set) var isEnabled = false@Published private(set) var isUpdating = false/// 最近一次校验的明确结论: Codex 会不会真的执行 CodexBar 的 Hook- /// 乐观默认: 启动对账开始前没有反证, 不能提前把依赖 Hook 的功能关掉+ /// 乐观默认: 启动对账开始前没有反证, 不能提前把依赖进阶模式的功能关掉/// 只由明确结论写入两个方向, RPC 失败或被取消时保留上次的值:/// 连不上 app-server 不说明 Hook 坏了, 那时置灰会把好用的功能关掉@Published private(set) var isVerified = true/// Hook 链路真的通不通: 当前进程中开启, 且最近一次校验没有明确失败- /// 依赖 Hook 的下游 (防睡眠, 任务类通知) 一律看这个+ /// 依赖进阶模式的下游 (防睡眠, 任务类通知) 一律看这个/// Codex 那边全局关掉 hooks 或者不信任我们的 handler 时 isEnabled 照样是 truevar isOperable: Bool {isEnabled && isVerified@@ -41,7 +41,7 @@ final class CodexHookSettings: ObservableObject {private var lastKnownInstalled: Bool?init(- hooksURL: URL = CodexHookSettings.defaultHooksURL(),+ hooksURL: URL = AdvancedModeSettings.defaultHooksURL(),fileManager: FileManager = .default,codexStatusService: CodexStatusService) {@@ -55,14 +55,14 @@ final class CodexHookSettings: ObservableObject {private func refreshInstallationState() {do {let config = try readConfigIfPresent()- let installed = Self.containsAnyCodexBarHook(+ let installed = Self.containsAnyManagedHook(in: config,executablePath: currentExecutablePath)if installed, !isEnabled {isEnabled = true}- let isComplete = Self.containsAllCodexBarHooks(+ let isComplete = Self.containsAllManagedHooks(in: config,executablePath: currentExecutablePath)@@ -82,31 +82,31 @@ final class CodexHookSettings: ObservableObject {} catch {// 只有 I/O 失败和 JSON 格式错误会走到这里, 它们对「Hook 装没装」不提供信息// 文件不存在或配置里没有 CodexBar 都由 readConfigIfPresent 正常返回- // 因此保留上次已知值, 不能把读取失败当成用户关闭了 Hook+ // 因此保留上次已知值, 不能把读取失败当成用户关闭了进阶模式let details = LogFields.joined("detail=\(error.localizedDescription)","action=keepLastKnown")AppLog.hooks.error("Hook 读取失败: \(details, privacy: .public)")- readErrorMessage = String(localized: "hook.error.config-read-failed")+ readErrorMessage = String(localized: "advanced-mode.hook.error.config-read-failed")}}func setEnabled(_ enabled: Bool) {- AppLog.hooks.notice("Hook 开关变更: enabled=\(enabled ? 1 : 0)")+ AppLog.hooks.notice("进阶模式开关变更: enabled=\(enabled ? 1 : 0)")runLatestUpdate(showProgress: true) { settings, generation inawait settings.applyEnabled(enabled, generation: generation)}}- func reconcileInstalledHooks() {+ func reconcileConfiguration() {refreshInstallationState()guard isEnabled, !isUpdating else {return}runLatestUpdate(showProgress: false) { settings, generation in- await settings.reconcileInstalledHooks(generation: generation)+ await settings.reconcileConfiguration(generation: generation)}}@@ -115,16 +115,16 @@ final class CodexHookSettings: ObservableObject {private func applyEnabled(_ enabled: Bool, generation: Int) async {do {if enabled {- try await ensureCodexHookVersionSupported()+ try await ensureAdvancedModeVersionSupported()try ensureCurrentUpdate(generation)try await ensureCodexHooksGloballyEnabled()try ensureCurrentUpdate(generation)- try writeCodexBarHookConfig(enabled: true)+ try writeManagedHookConfig(enabled: true)try ensureCurrentUpdate(generation)isEnabled = trueawait verifyInstalledHooksWithAppServer(generation: generation)} else {- try await disableCodexBarHooks(generation: generation)+ try await disableAdvancedMode(generation: generation)}} catch is CancellationError {return@@ -134,16 +134,16 @@ final class CodexHookSettings: ObservableObject {}/// 与手动关闭共用同一事务, 自动关闭也不会遗留另一套清理语义- private func disableCodexBarHooks(generation: Int, cleanupTrust: Bool = true) async throws {+ private func disableAdvancedMode(generation: Int, cleanupTrust: Bool = true) async throws {// 关闭前先通过 hooks/list 拿到 key// hooks.json 删除后 app-server 就无法再反查这些 key- let cleanupPlan: CodexHookTrustCleanupPlan? = if cleanupTrust {+ let cleanupPlan: ManagedHookTrustCleanupPlan? = if cleanupTrust {try await hookTrustCleanupPlan(generation: generation)} else {nil}try ensureCurrentUpdate(generation)- try writeCodexBarHookConfig(enabled: false)+ try writeManagedHookConfig(enabled: false)try ensureCurrentUpdate(generation)isEnabled = falseoperationErrorMessage = nil@@ -157,27 +157,27 @@ final class CodexHookSettings: ObservableObject {)}- private func reconcileInstalledHooks(generation: Int) async {+ private func reconcileConfiguration(generation: Int) async {do {- try await ensureCodexHookVersionSupported()+ try await ensureAdvancedModeVersionSupported()try ensureCurrentUpdate(generation)} catch is CancellationError {return} catch CodexStatusError.unsupportedVersion(minimum: _) {// 低于全局门槛的连接已关闭, 无法通过 app-server 查询或删除信任项- await disableUnsupportedCodexBarHooks(- error: .unsupportedCodexVersion(minimum: CodexCLIMinimumVersion.hook),+ await disableUnsupportedAdvancedMode(+ error: .unsupportedCodexVersion(minimum: CodexCLIMinimumVersion.advancedMode),generation: generation,cleanupTrust: false)return- } catch let error as HookConfigError {+ } catch let error as AdvancedModeError {guard case .unsupportedCodexVersion = error else {handleVerificationError(error, generation: generation)return}- await disableUnsupportedCodexBarHooks(error: error, generation: generation)+ await disableUnsupportedAdvancedMode(error: error, generation: generation)return} catch {handleVerificationError(error, generation: generation)@@ -190,11 +190,11 @@ final class CodexHookSettings: ObservableObject {try ensureCurrentUpdate(generation)guard !globallyDisabled else {assignVerified(false, reason: .globallyDisabled)- operationErrorMessage = HookConfigError.hooksGloballyDisabled.localizedDescription+ operationErrorMessage = AdvancedModeError.hooksGloballyDisabled.localizedDescriptionreturn}- try reconcileCodexBarHookConfig()+ try reconcileManagedHookConfig()try ensureCurrentUpdate(generation)try await validateInstalledHooksWithAppServer()@@ -210,20 +210,20 @@ final class CodexHookSettings: ObservableObject {}}- private func disableUnsupportedCodexBarHooks(- error: HookConfigError,+ private func disableUnsupportedAdvancedMode(+ error: AdvancedModeError,generation: Int,cleanupTrust: Bool = true) async {do {try ensureCurrentUpdate(generation)assignVerified(false, reason: .unsupportedVersion)- try await disableCodexBarHooks(generation: generation, cleanupTrust: cleanupTrust)+ try await disableAdvancedMode(generation: generation, cleanupTrust: cleanupTrust)try ensureCurrentUpdate(generation)if operationErrorMessage == nil {operationErrorMessage = error.localizedDescription}- AppLog.hooks.notice("Hook 已自动关闭: reason=unsupportedVersion")+ AppLog.hooks.notice("进阶模式已自动关闭: reason=unsupportedVersion")} catch is CancellationError {return} catch {@@ -233,7 +233,7 @@ final class CodexHookSettings: ObservableObject {private func verifyInstalledHooksWithAppServer(generation: Int) async {do {- try await ensureCodexHookVersionSupported()+ try await ensureAdvancedModeVersionSupported()try ensureCurrentUpdate(generation)// 全局开关排在 hooks/list 之前: 它一关, 列表里必然找不到我们的 handler,@@ -242,7 +242,7 @@ final class CodexHookSettings: ObservableObject {try ensureCurrentUpdate(generation)guard !globallyDisabled else {assignVerified(false, reason: .globallyDisabled)- operationErrorMessage = HookConfigError.hooksGloballyDisabled.localizedDescription+ operationErrorMessage = AdvancedModeError.hooksGloballyDisabled.localizedDescriptionreturn}@@ -262,14 +262,14 @@ final class CodexHookSettings: ObservableObject {return}- if let error = error as? HookConfigError {- // HookConfigError 是明确结论: Codex 答复了, 只是答复说这条链路不通+ if let error = error as? AdvancedModeError {+ // AdvancedModeError 是明确结论: Codex 答复了, 只是答复说这条链路不通assignVerified(false, reason: .validationFailed)operationErrorMessage = error.localizedDescription} else {// 这一支是"验不了"而不是"确认不通", isVerified 保留上次的值operationErrorMessage = String(- localized: "hook.error.verification-failed",+ localized: "advanced-mode.hook.error.verification-failed",defaultValue: "\(error.localizedDescription)")}@@ -279,7 +279,7 @@ final class CodexHookSettings: ObservableObject {/// 同值赋值会让设置页与两个子面板反复空转, 所以走这里/// reason 是排查依据: 用户只会说"防睡眠灰了", 那时得能从日志看出是全局禁用还是校验没过/// "验不了"那一支不调这里, 结论保持不变也就不该记一条变化- private func assignVerified(_ verified: Bool, reason: HookVerificationReason) {+ private func assignVerified(_ verified: Bool, reason: AdvancedModeVerificationReason) {guard isVerified != verified else {return}@@ -294,7 +294,7 @@ final class CodexHookSettings: ObservableObject {private func runLatestUpdate(showProgress: Bool,- _ operation: @escaping @MainActor @Sendable (CodexHookSettings, Int) async -> Void+ _ operation: @escaping @MainActor @Sendable (AdvancedModeSettings, Int) async -> Void) {if showProgress {isUpdating = true@@ -328,25 +328,25 @@ final class CodexHookSettings: ObservableObject {return}- if let hookError = error as? HookConfigError,- hookError.isPreflightFailure {+ if let advancedModeError = error as? AdvancedModeError,+ advancedModeError.isPreflightFailure {// 前置检查拦下是预期内的拒绝, 配置一个字没动, 不是故障AppLog.hooks.notice(- "Hook 前置检查未通过: detail=\(hookError.localizedDescription, privacy: .public)"+ "进阶模式前置检查未通过: detail=\(advancedModeError.localizedDescription, privacy: .public)")isEnabled = false- operationErrorMessage = hookError.localizedDescription+ operationErrorMessage = advancedModeError.localizedDescription} else {AppLog.hooks.error("Hook 写入失败: detail=\(error.localizedDescription, privacy: .public)")refreshInstallationState()- operationErrorMessage = String(localized: "hook.error.configuration-failed")+ operationErrorMessage = String(localized: "advanced-mode.hook.error.configuration-failed")}}}-private extension CodexHookSettings {+private extension AdvancedModeSettings {typealias JSONObject = [String: Any]typealias JSONArray = [Any]@@ -360,19 +360,19 @@ private extension CodexHookSettings {static let hookTrustStateKeyPath = "hooks.state"static let trustedHashKey = "trusted_hash"- struct CodexHookTrustEntry {+ struct ManagedHookTrustEntry {let key: Stringlet trustedHash: String}/// discoveryError 会在 Hook 已关闭后展示, 说明仅信任状态清理未完成- struct CodexHookTrustCleanupPlan {+ struct ManagedHookTrustCleanupPlan {let keys: Set<String>let discoveryError: Error?}/// Hook 链路校验结论的变化理由, 只用于日志的 reason= 取值- enum HookVerificationReason: String {+ enum AdvancedModeVerificationReason: String {case configurationDamagedcase globallyDisabledcase unsupportedVersion@@ -380,7 +380,7 @@ private extension CodexHookSettings {case verified}- enum HookConfigError: LocalizedError {+ enum AdvancedModeError: LocalizedError {case invalidFormatcase configurationFailedcase hooksGloballyDisabled@@ -391,19 +391,19 @@ private extension CodexHookSettings {var errorDescription: String? {switch self {case .invalidFormat:- String(localized: "hook.error.invalid-config-format")+ String(localized: "advanced-mode.hook.error.invalid-config-format")case .configurationFailed:- String(localized: "hook.error.configuration-failed")+ String(localized: "advanced-mode.hook.error.configuration-failed")case .hooksGloballyDisabled:- String(localized: "hook.status.disabled-by-codex")+ String(localized: "advanced-mode.hook.status.disabled-by-codex")case let .codexVersionUnavailable(minimum):String(- localized: "hook.version.unavailable",+ localized: "advanced-mode.codex.version.unavailable",defaultValue: "\(minimum)")case let .unsupportedCodexVersion(minimum):String(- localized: "hook.version.unsupported",+ localized: "advanced-mode.codex.version.unsupported",defaultValue: "\(minimum)")case let .hookValidationFailed(message):@@ -444,21 +444,21 @@ private extension CodexHookSettings {func ensureCodexHooksGloballyEnabled() async throws {if try await readGlobalHookDisabled() {- throw HookConfigError.hooksGloballyDisabled+ throw AdvancedModeError.hooksGloballyDisabled}}/// 检查实际用于 hooks/list 的 app-server 握手版本/// 不能只看磁盘版本, 否则升级后尚未重连的旧进程会被误判为可用- func ensureCodexHookVersionSupported() async throws {- let minimumVersion = CodexCLIMinimumVersion.hook+ func ensureAdvancedModeVersionSupported() async throws {+ let minimumVersion = CodexCLIMinimumVersion.advancedModelet connectionInfo = try await codexStatusService.readyConnectionInfo()guard let currentVersion = connectionInfo.version,let isSupported = CodexCLIVersionReader.isVersion(currentVersion,atLeast: minimumVersion) else {- throw HookConfigError.codexVersionUnavailable(minimum: minimumVersion)+ throw AdvancedModeError.codexVersionUnavailable(minimum: minimumVersion)}guard isSupported else {@@ -467,7 +467,7 @@ private extension CodexHookSettings {"minimum=\(minimumVersion)")AppLog.hooks.notice("Hook 版本不支持: \(details, privacy: .public)")- throw HookConfigError.unsupportedCodexVersion(minimum: minimumVersion)+ throw AdvancedModeError.unsupportedCodexVersion(minimum: minimumVersion)}}@@ -481,13 +481,13 @@ private extension CodexHookSettings {)if !entries.isEmpty {do {- try await trustCodexBarHooks(entries)+ try await trustManagedHooks(entries)} catch {AppLog.hooks.error("Hook 信任自愈失败: detail=\(error.localizedDescription, privacy: .public)")- throw HookConfigError.hookValidationFailed(- String(localized: "hook.status.untrusted")+ throw AdvancedModeError.hookValidationFailed(+ String(localized: "advanced-mode.hook.status.untrusted"))}AppLog.hooks.notice("Hook 信任状态已自愈: keys=\(entries.count)")@@ -499,13 +499,13 @@ private extension CodexHookSettings {executablePath: currentExecutablePath,hooksURL: hooksURL) {- throw HookConfigError.hookValidationFailed(message)+ throw AdvancedModeError.hookValidationFailed(message)}}- func hookTrustCleanupPlan(generation: Int) async throws -> CodexHookTrustCleanupPlan {+ func hookTrustCleanupPlan(generation: Int) async throws -> ManagedHookTrustCleanupPlan {do {- let keys = try await codexBarHookTrustKeysFromAppServer()+ let keys = try await managedHookTrustKeysFromAppServer()try ensureCurrentUpdate(generation)return .init(keys: keys, discoveryError: nil)} catch is CancellationError {@@ -517,15 +517,15 @@ private extension CodexHookSettings {// MARK: - hooks.json 读写- func writeCodexBarHookConfig(enabled: Bool) throws {+ func writeManagedHookConfig(enabled: Bool) throws {var config = try readConfigIfPresent()- try Self.removeCodexBarHooks(+ try Self.removeManagedHooks(from: &config,executablePath: currentExecutablePath)if enabled {- _ = try Self.reconcileCodexBarHooks(+ _ = try Self.reconcileManagedHooks(in: &config,executablePath: currentExecutablePath)@@ -536,9 +536,9 @@ private extension CodexHookSettings {AppLog.hooks.notice("Hook 配置已写入: enabled=\(enabled ? 1 : 0)")}- func reconcileCodexBarHookConfig() throws {+ func reconcileManagedHookConfig() throws {var config = try readConfigIfPresent()- let repairedEvents = try Self.reconcileCodexBarHooks(+ let repairedEvents = try Self.reconcileManagedHooks(in: &config,executablePath: currentExecutablePath)@@ -552,7 +552,7 @@ private extension CodexHookSettings {AppLog.hooks.error("Hook 补齐写入失败: detail=\(error.localizedDescription, privacy: .public)")- throw HookConfigError.configurationFailed+ throw AdvancedModeError.configurationFailed}let events = repairedEvents.map(\.rawValue).joined(separator: ",")let details = LogFields.joined(@@ -562,9 +562,9 @@ private extension CodexHookSettings {AppLog.hooks.notice("Hook 配置已自愈: \(details, privacy: .public)")}- func codexBarHookTrustKeysFromAppServer() async throws -> Set<String> {+ func managedHookTrustKeysFromAppServer() async throws -> Set<String> {let response = try await codexStatusService.listCodexHooks(cwds: [hooksListWorkingDirectory])- return Self.codexBarHookTrustKeys(+ return Self.managedHookTrustKeys(from: response,executablePath: currentExecutablePath,hooksURL: hooksURL@@ -581,7 +581,7 @@ private extension CodexHookSettings {do {try ensureCurrentUpdate(generation)if !keys.isEmpty {- try await removeCodexBarHookTrust(keys)+ try await removeManagedHookTrust(keys)try ensureCurrentUpdate(generation)AppLog.hooks.notice("Hook 信任状态已清理: keys=\(keys.count)")}@@ -592,7 +592,7 @@ private extension CodexHookSettings {"detail=\(discoveryError.localizedDescription)")AppLog.hooks.error("无法清理 Hook 信任状态: \(details, privacy: .public)")- operationErrorMessage = String(localized: "hook.error.trust-cleanup-unavailable")+ operationErrorMessage = String(localized: "advanced-mode.hook.error.trust-cleanup-unavailable")} else {operationErrorMessage = nil}@@ -608,11 +608,11 @@ private extension CodexHookSettings {"detail=\(error.localizedDescription)")AppLog.hooks.error("无法清理 Hook 信任状态: \(details, privacy: .public)")- operationErrorMessage = String(localized: "hook.error.trust-cleanup-unavailable")+ operationErrorMessage = String(localized: "advanced-mode.hook.error.trust-cleanup-unavailable")}}- func trustCodexBarHooks(_ entries: [CodexHookTrustEntry]) async throws {+ func trustManagedHooks(_ entries: [ManagedHookTrustEntry]) async throws {guard !entries.isEmpty else {return}@@ -623,7 +623,7 @@ private extension CodexHookSettings {)}- func removeCodexBarHookTrust(_ keys: Set<String>) async throws {+ func removeManagedHookTrust(_ keys: Set<String>) async throws {guard !keys.isEmpty else {return}@@ -674,11 +674,11 @@ private extension CodexHookSettings {do {object = try JSONSerialization.jsonObject(with: data)} catch {- throw HookConfigError.invalidFormat+ throw AdvancedModeError.invalidFormat}guard let config = object as? JSONObject else {- throw HookConfigError.invalidFormat+ throw AdvancedModeError.invalidFormat}return config@@ -697,7 +697,7 @@ private extension CodexHookSettings {try data.write(to: hooksURL, options: .atomic)}- static func containsAnyCodexBarHook(in config: JSONObject, executablePath: String) -> Bool {+ static func containsAnyManagedHook(in config: JSONObject, executablePath: String) -> Bool {guard let hooks = config[hooksKey] as? JSONObject else {return false}@@ -713,7 +713,7 @@ private extension CodexHookSettings {}}- static func containsAllCodexBarHooks(in config: JSONObject, executablePath: String) -> Bool {+ static func containsAllManagedHooks(in config: JSONObject, executablePath: String) -> Bool {guard let hooks = config[hooksKey] as? JSONObject else {return false}@@ -731,7 +731,7 @@ private extension CodexHookSettings {}}- static func reconcileCodexBarHooks(+ static func reconcileManagedHooks(in config: inout JSONObject,executablePath: String) throws -> [CodexHookEvent] {@@ -756,7 +756,7 @@ private extension CodexHookSettings {)}groups.append([- hooksKey: [codexBarHookHandler(for: event, executablePath: executablePath)]+ hooksKey: [managedHookHandler(for: event, executablePath: executablePath)]])hooks[event.configName] = groupsrepairedEvents.append(event)@@ -766,7 +766,7 @@ private extension CodexHookSettings {return repairedEvents}- static func removeCodexBarHooks(+ static func removeManagedHooks(from config: inout JSONObject,executablePath: String) throws {@@ -807,7 +807,7 @@ private extension CodexHookSettings {hooksURL: URL) -> String? {guard !response.data.isEmpty else {- return String(localized: "codex-status.result.empty")+ return String(localized: "advanced-mode.hook.result.empty")}let entries = response.data@@ -837,22 +837,22 @@ private extension CodexHookSettings {}if !errors.isEmpty {- return String(localized: "codex-status.result.error")+ return String(localized: "advanced-mode.hook.result.error")}if hasDisabledHook {- return String(localized: "hook.status.disabled")+ return String(localized: "advanced-mode.hook.status.disabled")}if hasUntrustedHook {- return String(localized: "hook.status.untrusted")+ return String(localized: "advanced-mode.hook.status.untrusted")}if hasMissingEvent {- return String(localized: "hook.status.incomplete")+ return String(localized: "advanced-mode.hook.status.incomplete")}if hasUnexpectedSource {- return String(localized: "hook.status.unexpected-source")+ return String(localized: "advanced-mode.hook.status.unexpected-source")}if !warnings.isEmpty {- return String(localized: "codex-status.result.warning")+ return String(localized: "advanced-mode.hook.result.warning")}return nil@@ -862,10 +862,10 @@ private extension CodexHookSettings {from response: CodexHooksListResponse,executablePath: String,hooksURL: URL- ) -> [CodexHookTrustEntry] {+ ) -> [ManagedHookTrustEntry] {let hooks = response.data.flatMap(\.hooks)let expectedSourcePath = normalizedPath(hooksURL.path)- var entries: [CodexHookTrustEntry] = []+ var entries: [ManagedHookTrustEntry] = []var seenKeys = Set<String>()for event in CodexHookEvent.allCases {@@ -875,7 +875,7 @@ private extension CodexHookSettings {executablePath: executablePath,expectedSourcePath: expectedSourcePath),- isManagedCodexBarHook(+ isManagedHook(hook,executablePath: executablePath,expectedSourcePath: expectedSourcePath@@ -895,7 +895,7 @@ private extension CodexHookSettings {return entries}- static func codexBarHookTrustKeys(+ static func managedHookTrustKeys(from response: CodexHooksListResponse,executablePath: String,hooksURL: URL@@ -905,7 +905,7 @@ private extension CodexHookSettings {response.data.flatMap(\.hooks).compactMap { hook in- guard isManagedCodexBarHook(+ guard isManagedHook(hook,executablePath: executablePath,expectedSourcePath: expectedSourcePath@@ -934,7 +934,7 @@ private extension CodexHookSettings {?? matchingHooks.first}- static func isManagedCodexBarHook(+ static func isManagedHook(_ hook: CodexHookMetadata,executablePath: String,expectedSourcePath: String@@ -961,7 +961,7 @@ private extension CodexHookSettings {state.mapValues { [trustedHashKey: $0] }}- static func hookTrustStateValue(from entries: [CodexHookTrustEntry]) -> [String: [String: String]] {+ static func hookTrustStateValue(from entries: [ManagedHookTrustEntry]) -> [String: [String: String]] {entries.reduce(into: [:]) { value, entry invalue[entry.key] = [trustedHashKey: entry.trustedHash]}@@ -973,7 +973,7 @@ private extension CodexHookSettings {}guard let hooks = value as? JSONObject else {- throw HookConfigError.invalidFormat+ throw AdvancedModeError.invalidFormat}return hooks@@ -985,7 +985,7 @@ private extension CodexHookSettings {}guard let groups = value as? JSONArray else {- throw HookConfigError.invalidFormat+ throw AdvancedModeError.invalidFormat}return groups@@ -1087,7 +1087,7 @@ private extension CodexHookSettings {return isCodexBarCommand(command, executablePath: executablePath)}- static func codexBarHookHandler(+ static func managedHookHandler(for event: CodexHookEvent,executablePath: String) -> JSONObject {diff --git a/CodexBar/Services/Settings/MainPanelSettings.swift b/CodexBar/Services/Settings/MainPanelSettings.swiftindex 5f1418f..941dd11 100644--- a/CodexBar/Services/Settings/MainPanelSettings.swift+++ b/CodexBar/Services/Settings/MainPanelSettings.swift@@ -68,7 +68,7 @@ final class MainPanelSettings: ObservableObject {@Published private(set) var areAnimationsEnabled: Boolprivate let defaults: UserDefaults- private var isHookEnabled: Bool?+ private var isAdvancedModeEnabled: Bool?init(defaults: UserDefaults = .standard) {self.defaults = defaults@@ -83,7 +83,7 @@ final class MainPanelSettings: ObservableObject {}let loadedLayout = Self.loadLayout(from: defaults)- guard isHookEnabled == false else {+ guard isAdvancedModeEnabled == false else {publish(loadedLayout)return}@@ -96,12 +96,12 @@ final class MainPanelSettings: ObservableObject {}}- func updateHookEnabled(_ isEnabled: Bool) {- let wasEnabled = isHookEnabled- isHookEnabled = isEnabled+ func updateAdvancedModeEnabled(_ isEnabled: Bool) {+ let wasEnabled = isAdvancedModeEnabled+ isAdvancedModeEnabled = isEnabledlet updatedLayout: MainPanelLayoutif isEnabled {- // 首次恢复 Hook 状态时保留布局, 只有关闭到开启的转换才自动显示任务+ // 首次恢复进阶模式状态时保留布局, 只有关闭到开启的转换才自动显示任务guard wasEnabled == false else { return }updatedLayout = MainPanelLayout(orderedSections: layout.orderedSections,@@ -114,7 +114,7 @@ final class MainPanelSettings: ObservableObject {return}- AppLog.settings.notice("Hook 开关已同步主面板任务中心")+ AppLog.settings.notice("进阶模式开关已同步主面板任务中心")saveAndPublish(updatedLayout)}@@ -133,7 +133,7 @@ final class MainPanelSettings: ObservableObject {isVisible: Bool,undoManager: UndoManager) {- guard section != .activity || !isVisible || isHookEnabled == true else {+ guard section != .activity || !isVisible || isAdvancedModeEnabled == true else {return}guard layout.isVisible(section) != isVisible else {@@ -184,7 +184,7 @@ final class MainPanelSettings: ObservableObject {_ requestedLayout: MainPanelLayout,undoManager: UndoManager) {- let updatedLayout = isHookEnabled == false+ let updatedLayout = isAdvancedModeEnabled == false? requestedLayout.disablingActivitySection(): requestedLayoutguard updatedLayout != layout else {diff --git a/CodexBar/Services/Settings/WorkflowSyncSettings.swift b/CodexBar/Services/Settings/WorkflowSyncSettings.swiftindex 4f5681c..89be294 100644--- a/CodexBar/Services/Settings/WorkflowSyncSettings.swift+++ b/CodexBar/Services/Settings/WorkflowSyncSettings.swift@@ -60,20 +60,20 @@ final class WorkflowSyncSettings: ObservableObject {syncFailureMessage != nil}- /// "同步是否实际生效"的唯一判定: Hook 已启用且同步开关打开且 iCloud 可用+ /// "同步是否实际生效"的唯一判定: 进阶模式已启用且同步开关打开且 iCloud 可用/// 按顺序返回第一个不满足的项, 日志的 reason= 直接取它的 rawValue- func activation(isHookEnabled: Bool) -> WorkflowSyncActivation {- activation(isHookEnabled: isHookEnabled, isSyncAvailable: isSyncAvailable)+ func activation(isAdvancedModeEnabled: Bool) -> WorkflowSyncActivation {+ activation(isAdvancedModeEnabled: isAdvancedModeEnabled, isSyncAvailable: isSyncAvailable)}/// 两项依赖都可以由调用方指定/// @Published 的订阅回调跑在 willSet, 那时属性还是旧值, 只有回调参数是新值func activation(- isHookEnabled: Bool,+ isAdvancedModeEnabled: Bool,isSyncAvailable: Bool) -> WorkflowSyncActivation {- if !isHookEnabled {- return .hookOff+ if !isAdvancedModeEnabled {+ return .advancedModeOff}if !isEnabled {return .syncOff@@ -84,8 +84,8 @@ final class WorkflowSyncSettings: ObservableObject {return .active}- func isEffectivelyActive(isHookEnabled: Bool) -> Bool {- activation(isHookEnabled: isHookEnabled).isActive+ func isEffectivelyActive(isAdvancedModeEnabled: Bool) -> Bool {+ activation(isAdvancedModeEnabled: isAdvancedModeEnabled).isActive}var unavailableMessage: String? {@@ -204,7 +204,7 @@ final class WorkflowSyncSettings: ObservableObject {/// 同步没生效时缺的是哪一项, 同时充当日志里的 reason= 取值nonisolated enum WorkflowSyncActivation: String {case active- case hookOff+ case advancedModeOffcase syncOffcase unavailable@@ -265,11 +265,11 @@ nonisolated enum WorkflowSyncFailureReason: String {var message: String {switch self {case .networkUnavailable:- String(localized: "sync.error.network-unavailable")+ String(localized: "sync.icloud.error.network-unavailable")case .accountUnavailable:- String(localized: "sync.error.account-unavailable")+ String(localized: "sync.icloud.error.account-unavailable")case .serviceUnavailable:- String(localized: "sync.error.service-unavailable")+ String(localized: "sync.icloud.error.service-unavailable")case .retryLater:String(localized: "sync.error.retry-later")}diff --git a/CodexBar/Services/Support/AppLog.swift b/CodexBar/Services/Support/AppLog.swiftindex d3c5bd2..ad84cc8 100644--- a/CodexBar/Services/Support/AppLog.swift+++ b/CodexBar/Services/Support/AppLog.swift@@ -46,9 +46,9 @@ nonisolated enum LogTrigger: String {case wakecase settingscase retry- /// Hook 开关转为开启后补跑同步- case hookEnabled- case hookChanged+ /// 进阶模式开关转为开启后补跑同步+ case advancedModeEnabled+ case advancedModeChangedcase taskChangedcase helperRegisteredcase terminationdiff --git a/CodexBar/Services/Workflow/CodexActivityMonitor.swift b/CodexBar/Services/Workflow/CodexActivityMonitor.swiftindex 5c8ea06..0a35705 100644--- a/CodexBar/Services/Workflow/CodexActivityMonitor.swift+++ b/CodexBar/Services/Workflow/CodexActivityMonitor.swift@@ -19,7 +19,7 @@ final class CodexActivityMonitor: ObservableObject {var onInactivityProtectionTriggered: ((CodexActivityProtectionNotice) async -> Bool)?var onInactivityProtectionInvalidated: ((UUID, UUID) -> Void)?- private let codexHookSettings: CodexHookSettings+ private let advancedModeSettings: AdvancedModeSettingslet activityProtectionSettings: ActivityProtectionSettingslet activityProtectionStateStore: ActivityProtectionStateStoreprivate let sessionLifecycleReader = CodexSessionLifecycleReader()@@ -71,11 +71,11 @@ final class CodexActivityMonitor: ObservableObject {var sessionTransitionNotBefore: Date?init(- codexHookSettings: CodexHookSettings,+ advancedModeSettings: AdvancedModeSettings,activityProtectionSettings: ActivityProtectionSettings,activityProtectionStateStore: ActivityProtectionStateStore = ActivityProtectionStateStore()) {- self.codexHookSettings = codexHookSettings+ self.advancedModeSettings = advancedModeSettingsself.activityProtectionSettings = activityProtectionSettingsself.activityProtectionStateStore = activityProtectionStateStore}@@ -88,7 +88,7 @@ final class CodexActivityMonitor: ObservableObject {loadActivityProtectionState()- Publishers.CombineLatest(codexHookSettings.$isEnabled, codexHookSettings.$isVerified)+ Publishers.CombineLatest(advancedModeSettings.$isEnabled, advancedModeSettings.$isVerified).map { $0 && $1 }.removeDuplicates().sink { [weak self] isOperable indiff --git a/CodexBar/Services/Workflow/WorkflowHookEventRecorder.swift b/CodexBar/Services/Workflow/WorkflowHookEventRecorder.swiftindex f30dc12..90c324b 100644--- a/CodexBar/Services/Workflow/WorkflowHookEventRecorder.swift+++ b/CodexBar/Services/Workflow/WorkflowHookEventRecorder.swift@@ -6,7 +6,7 @@ nonisolated enum WorkflowHookEventRecorder {static let hookArgument = "--hook-event"/// SessionEnd 和 Interrupt 在 Codex 中最多允许 3 秒, 其他事件沿用 5 秒- /// 超时定义在这里而不是 CodexHookSettings: 写配置与下面的等锁预算必须同源+ /// 超时定义在这里而不是 AdvancedModeSettings: 写配置与下面的等锁预算必须同源private static let defaultHookTimeoutSeconds = 5private static let terminalHookTimeoutSeconds = 3diff --git a/CodexBar/Views/Log/LogView.swift b/CodexBar/Views/Log/LogView.swiftindex 3cc5e6e..965dfa9 100644--- a/CodexBar/Views/Log/LogView.swift+++ b/CodexBar/Views/Log/LogView.swift@@ -26,7 +26,7 @@ struct LogView: View {Image(systemName: "doc.text.magnifyingglass").foregroundStyle(.tint)- Text("log.window.app-server-title")+ Text("log.app-server.window.title").font(.headline)Text(verbatim: "\(entries.count)")diff --git a/CodexBar/Views/Menu/CodexActivityCard.swift b/CodexBar/Views/Menu/CodexActivityCard.swiftindex 2d8445f..413ee2f 100644--- a/CodexBar/Views/Menu/CodexActivityCard.swift+++ b/CodexBar/Views/Menu/CodexActivityCard.swift@@ -1,6 +1,6 @@import SwiftUI-/// Hook 开启时显示的活动摘要, 使用主面板共享的时间+/// 实时任务摘要, 使用主面板共享的时间/// 活动和防睡眠状态由卡片自行观察, 避免刷新整个菜单树struct CodexActivityCard: View {@ObservedObject var activityMonitor: CodexActivityMonitor@@ -162,13 +162,13 @@ struct CodexActivityCard: View {private func tokenUsageMetrics(_ usage: CodexTokenUsage) -> some View {HStack(alignment: .top, spacing: 0) {- tokenMetric("activity.tokens.total", tokens: usage.totalTokens)- tokenMetric("activity.tokens.input", tokens: usage.inputTokens)- tokenMetric("activity.tokens.output", tokens: usage.outputTokens)- tokenMetric("activity.tokens.cached-input", tokens: usage.cachedInputTokens)- tokenMetric("activity.tokens.cache-write-input", tokens: usage.cacheWriteInputTokens)+ tokenMetric("usage.tokens.total", tokens: usage.totalTokens)+ tokenMetric("usage.tokens.input", tokens: usage.inputTokens)+ tokenMetric("usage.tokens.output", tokens: usage.outputTokens)+ tokenMetric("usage.tokens.cached-input", tokens: usage.cachedInputTokens)+ tokenMetric("usage.tokens.cache-write-input", tokens: usage.cacheWriteInputTokens)VStack(spacing: 3) {- Text("activity.tokens.cache-hit-rate")+ Text("usage.tokens.cache-hit-rate").font(.caption2).foregroundStyle(Color.codexSecondaryLabel).minimumScaleFactor(0.65)@@ -178,7 +178,7 @@ struct CodexActivityCard: View {.contentTransition(.numericText(value: usage.cacheHitRate ?? 0))}.frame(minWidth: 0, maxWidth: .infinity)- tokenMetric("activity.tokens.reasoning-output", tokens: usage.reasoningOutputTokens)+ tokenMetric("usage.tokens.reasoning-output", tokens: usage.reasoningOutputTokens)}.lineLimit(1).animation(.codexStatus, value: usage)diff --git a/CodexBar/Views/Menu/CodexStatusMenuSections.swift b/CodexBar/Views/Menu/CodexStatusMenuSections.swiftindex c7d0b10..24e687c 100644--- a/CodexBar/Views/Menu/CodexStatusMenuSections.swift+++ b/CodexBar/Views/Menu/CodexStatusMenuSections.swift@@ -335,8 +335,8 @@ struct WorkflowSyncDisplayState: Equatable {lhs.symbolName == rhs.symbolName && lhs.helpText == rhs.helpText}- init(isHookEnabled: Bool, settings: WorkflowSyncSettings) {- guard settings.isEffectivelyActive(isHookEnabled: isHookEnabled) else {+ init(isAdvancedModeEnabled: Bool, settings: WorkflowSyncSettings) {+ guard settings.isEffectivelyActive(isAdvancedModeEnabled: isAdvancedModeEnabled) else {self = .disabledreturn}diff --git a/CodexBar/Views/Menu/CodexStatusMenuView.swift b/CodexBar/Views/Menu/CodexStatusMenuView.swiftindex 59e329d..4476aae 100644--- a/CodexBar/Views/Menu/CodexStatusMenuView.swift+++ b/CodexBar/Views/Menu/CodexStatusMenuView.swift@@ -35,7 +35,7 @@ struct CodexStatusMenuView: View {@ObservedObject var viewModel: CodexStatusViewModel@ObservedObject var workflowViewModel: WorkflowViewModel- @ObservedObject var codexHookSettings: CodexHookSettings+ @ObservedObject var advancedModeSettings: AdvancedModeSettings@ObservedObject var mainPanelSettings: MainPanelSettings// 活动状态与时间变化由卡片自行观察, 避免刷新整个菜单树let activityMonitor: CodexActivityMonitor@@ -65,7 +65,7 @@ struct CodexStatusMenuView: View {.padding(Metrics.padding).liquidGlassSurface(cornerRadius: Metrics.surfaceCornerRadius, isOuterSurface: true).animation(Metrics.statusAnimation, value: viewModel.loadState)- .animation(Metrics.statusAnimation, value: codexHookSettings.isEnabled)+ .animation(Metrics.statusAnimation, value: advancedModeSettings.isEnabled).animation(Metrics.statusAnimation, value: mainPanelSettings.layout).animation(Metrics.statusAnimation, value: syncSettings.isEnabled).animation(Metrics.statusAnimation, value: syncSettings.isSyncing)@@ -147,7 +147,7 @@ private extension CodexStatusMenuView {@ViewBuildervar activitySection: some View {- if codexHookSettings.isEnabled {+ if advancedModeSettings.isEnabled {CodexActivityCard(activityMonitor: activityMonitor,presentationState: activityCenterPresentationState,@@ -185,11 +185,11 @@ private extension CodexStatusMenuView {@ViewBuilderfunc usageSection(dataPlaceholderSection: MainPanelSection?) -> some View {if let snapshot = viewModel.snapshot,- snapshot.usage != nil || codexHookSettings.isEnabled {+ snapshot.usage != nil || advancedModeSettings.isEnabled {UsageSummaryView(usage: snapshot.usage,workflow: workflowViewModel.snapshot,- showsWorkflow: codexHookSettings.isEnabled,+ showsWorkflow: advancedModeSettings.isEnabled,isStale: snapshot.isUsageStale,onHoverContextChange: onUsageHeatmapHoverChange)@@ -227,7 +227,7 @@ private extension CodexStatusMenuView {viewModel.snapshot?.limits.isEmpty == falsecase .usage:viewModel.snapshot?.usage != nil- || (viewModel.snapshot != nil && codexHookSettings.isEnabled)+ || (viewModel.snapshot != nil && advancedModeSettings.isEnabled)case .account, .activity, .status:false}@@ -242,7 +242,7 @@ private extension CodexStatusMenuView {case .account:truecase .activity:- codexHookSettings.isEnabled+ advancedModeSettings.isEnabledcase .quota, .usage:hasData(for: section) || dataPlaceholderSection == sectioncase .status:@@ -258,7 +258,7 @@ private extension CodexStatusMenuView {countdownInterval: viewModel.autoRefreshInterval,isCountdownActive: menuSurfaceVisibility.isVisible,syncDisplayState: WorkflowSyncDisplayState(- isHookEnabled: codexHookSettings.isEnabled,+ isAdvancedModeEnabled: advancedModeSettings.isEnabled,settings: syncSettings),updateMessage: appUpdater.panelUpdateMessage,diff --git a/CodexBar/Views/Menu/UsageHeatmap.swift b/CodexBar/Views/Menu/UsageHeatmap.swiftindex 4bf5726..e645638 100644--- a/CodexBar/Views/Menu/UsageHeatmap.swift+++ b/CodexBar/Views/Menu/UsageHeatmap.swift@@ -119,7 +119,7 @@ struct UsageSummaryView: View {value: Self.dayText(usage?.summary.longestStreakDays))textMetric(- label: "usage.summary.longest-turn-duration",+ label: "usage.summary.longest-chat",value: Self.durationText(seconds: usage?.summary.longestRunningTurnSec))}@@ -666,14 +666,14 @@ struct UsageHeatmapDayDetailView: View {let usage = context.day.tokenUsagelet cacheHitRate = usage?.cacheHitRate ?? 0return Grid(alignment: .leading, horizontalSpacing: Metrics.metricRowSpacing, verticalSpacing: Metrics.metricSpacing) {- dailyTokenRow("activity.tokens.total", tokens: usage?.totalTokens, tint: .blue)- dailyTokenRow("activity.tokens.input", tokens: usage?.inputTokens, tint: .indigo)- dailyTokenRow("activity.tokens.output", tokens: usage?.outputTokens, tint: .orange)- dailyTokenRow("activity.tokens.cached-input", tokens: usage?.cachedInputTokens, tint: .green)- dailyTokenRow("activity.tokens.cache-write-input", tokens: usage?.cacheWriteInputTokens, tint: .purple)+ dailyTokenRow("usage.tokens.total", tokens: usage?.totalTokens, tint: .blue)+ dailyTokenRow("usage.tokens.input", tokens: usage?.inputTokens, tint: .indigo)+ dailyTokenRow("usage.tokens.output", tokens: usage?.outputTokens, tint: .orange)+ dailyTokenRow("usage.tokens.cached-input", tokens: usage?.cachedInputTokens, tint: .green)+ dailyTokenRow("usage.tokens.cache-write-input", tokens: usage?.cacheWriteInputTokens, tint: .purple)metricRowLayout {metricDot(tint: .teal)- Text("activity.tokens.cache-hit-rate")+ Text("usage.tokens.cache-hit-rate").foregroundStyle(.secondary).fixedSize(horizontal: true, vertical: false).frame(height: Metrics.metricRowHeight)@@ -682,7 +682,7 @@ struct UsageHeatmapDayDetailView: View {comparison: cacheHitRate)}- dailyTokenRow("activity.tokens.reasoning-output", tokens: usage?.reasoningOutputTokens, tint: .cyan)+ dailyTokenRow("usage.tokens.reasoning-output", tokens: usage?.reasoningOutputTokens, tint: .cyan)}}diff --git a/CodexBar/Views/Settings/AppSettingsView.swift b/CodexBar/Views/Settings/AppSettingsView.swiftindex 859fd3c..14c19ff 100644--- a/CodexBar/Views/Settings/AppSettingsView.swift+++ b/CodexBar/Views/Settings/AppSettingsView.swift@@ -9,7 +9,7 @@ struct AppSettingsView: View {@StateObject private var codexVersions = CodexCLIVersionViewModel()@ObservedObject var proxySettings: CodexProxySettings@State private var isShowingProxySettings = false- @ObservedObject var codexHookSettings: CodexHookSettings+ @ObservedObject var advancedModeSettings: AdvancedModeSettings@ObservedObject var syncSettings: WorkflowSyncSettings@ObservedObject var globalHotKeySettings: GlobalHotKeySettings@ObservedObject var menuBarQuotaSettings: MenuBarQuotaSettings@@ -90,7 +90,7 @@ struct AppSettingsView: View {refreshStatusRows()}.onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in- codexHookSettings.reconcileInstalledHooks()+ advancedModeSettings.reconcileConfiguration()syncSettings.refresh()menuBarQuotaSettings.refresh()mainPanelSettings.refresh()@@ -184,6 +184,7 @@ private extension AppSettingsView {static let tabContentSpacing = paddingstatic let windowChromeHeight = padding * 2 + tabBarHeight + tabContentSpacingstatic let menuBarQuotaPickerWidth: CGFloat = 72+ static let dataUpdateIntervalPickerWidth: CGFloat = 90static let syncStatusRowHeight: CGFloat = 16static let syncStatusValueWidth: CGFloat = 160static let tabContentInitialScale = 0.975@@ -271,7 +272,7 @@ private extension AppSettingsView {LiquidGlassDivider()TaskGlowSettingsRow(settings: taskGlowSettings,- codexHookSettings: codexHookSettings,+ advancedModeSettings: advancedModeSettings,onOptionsAction: onOptionsAction)LiquidGlassDivider()@@ -292,12 +293,7 @@ private extension AppSettingsView {var advancedSettingsPage: some View {VStack(alignment: .leading, spacing: Metrics.rowSpacing) {- ProxySettingsRow(settings: proxySettings) {- onOptionsAction(.closeAll)- isShowingProxySettings = true- }- LiquidGlassDivider()- codexHookRow+ advancedModeRowLiquidGlassDivider()notificationRowLiquidGlassDivider()@@ -307,6 +303,13 @@ private extension AppSettingsView {LiquidGlassDivider()syncRowLiquidGlassDivider()+ ProxySettingsRow(settings: proxySettings) {+ onOptionsAction(.closeAll)+ isShowingProxySettings = true+ }+ LiquidGlassDivider()+ dataUpdateIntervalRow+ LiquidGlassDivider()rebuildWorkflowDataRow}.padding(Metrics.panelPadding)@@ -435,19 +438,40 @@ private extension AppSettingsView {// MARK: - 高级页各行- var codexHookRow: some View {+ var dataUpdateIntervalRow: some View {+ HStack(spacing: SettingsRowMetrics.spacing) {+ Image(systemName: "timer")+ .frame(width: SettingsRowMetrics.iconWidth)+ .foregroundStyle(.tint)+ Text("settings.data-update.interval.title")+ Spacer()+ SettingsOptionsPicker(+ title: "settings.data-update.interval.title",+ selection: Binding(+ get: { statusViewModel.dataUpdateInterval },+ set: { statusViewModel.setDataUpdateInterval($0) }+ ),+ options: DataUpdateInterval.allCases,+ label: { $0.title },+ width: Metrics.dataUpdateIntervalPickerWidth+ )+ }+ .frame(minHeight: SettingsRowMetrics.optionsButtonSize)+ }++ var advancedModeRow: some View {VStack(alignment: .leading, spacing: 4) {SettingsToggleRow(- icon: "link",- title: "hook.name",+ icon: "wrench.and.screwdriver",+ title: "advanced-mode.name",isOn: Binding(- get: { codexHookSettings.isEnabled },- set: { codexHookSettings.setEnabled($0) }+ get: { advancedModeSettings.isEnabled },+ set: { advancedModeSettings.setEnabled($0) }),- isEnabled: !codexHookSettings.isUpdating+ isEnabled: !advancedModeSettings.isUpdating)- if let message = codexHookSettings.errorMessage {+ if let message = advancedModeSettings.errorMessage {SettingsCaptionMessageRow(message: message)}}@@ -550,7 +574,7 @@ private extension AppSettingsView {}}),- isEnabled: codexHookSettings.isOperable && !codexHookSettings.isUpdating+ isEnabled: advancedModeSettings.isOperable && !advancedModeSettings.isUpdating) {SettingsOptionsButton(isAvailable: canShowKeepAliveOptions) {onOptionsAction(@@ -618,8 +642,8 @@ private extension AppSettingsView {if let errorMessage = keepAliveController.errorMessage {return SettingsStatusCaption(message: errorMessage, isError: true)}- guard codexHookSettings.isVerified else {- return SettingsStatusCaption(message: String(localized: "hook.status.inactive"))+ guard advancedModeSettings.isVerified else {+ return SettingsStatusCaption(message: String(localized: "advanced-mode.hook.status.inactive"))}if keepAliveController.isActivelyPreventingSleep,@@ -713,9 +737,9 @@ private extension AppSettingsView {var syncRowState: SyncRowState {SyncRowState(- isActive: syncSettings.isEffectivelyActive(isHookEnabled: codexHookSettings.isEnabled),- isHookEnabled: codexHookSettings.isEnabled,- isHookUpdating: codexHookSettings.isUpdating,+ isActive: syncSettings.isEffectivelyActive(isAdvancedModeEnabled: advancedModeSettings.isEnabled),+ isAdvancedModeEnabled: advancedModeSettings.isEnabled,+ isAdvancedModeUpdating: advancedModeSettings.isUpdating,isSyncAvailable: syncSettings.isSyncAvailable,isSyncing: syncSettings.isSyncing)@@ -804,7 +828,7 @@ private extension AppSettingsView {rebuildResult = RebuildResult(message: Self.rebuildSuccessMessage(for: summary,- autoRetryAvailable: codexHookSettings.isEnabled+ autoRetryAvailable: advancedModeSettings.isEnabled),isError: false)@@ -826,7 +850,7 @@ private extension AppSettingsView {static let rebuildFailedDateListLimit = 3/// 未完成的日期只列前几个, 避免长范围重建时结果过长- /// autoRetryAvailable: 常规维护只在 Hook 开启时运行, 关闭时不能承诺自动重试+ /// autoRetryAvailable: 常规维护只在进阶模式开启时运行, 关闭时不能承诺自动重试static func rebuildSuccessMessage(for summary: WorkflowDataRebuildSummary,autoRetryAvailable: Bool@@ -852,7 +876,7 @@ private extension AppSettingsView {message += String(localized: "workflow.rebuild.summary.incomplete-dates", defaultValue: "\(summary.failedDateKeys.count, specifier: "%lld")\(dates)")message += autoRetryAvailable? String(localized: "workflow.rebuild.summary.retry-later")- : String(localized: "workflow.rebuild.summary.retry-after-hook-enabled")+ : String(localized: "workflow.rebuild.summary.retry-after-advanced-mode-enabled")}if summary.didFailSyncReplacementMarking {@@ -962,8 +986,8 @@ private extension AppSettingsView {unavailableSource: statusViewModel.unavailableConnectionSource,onReconnect: { selection inTask { @MainActor in- if await statusViewModel.reconnectCodex(selection: selection, requiresHooks: codexHookSettings.isEnabled) {- codexHookSettings.reconcileInstalledHooks()+ if await statusViewModel.reconnectCodex(selection: selection, requiresAdvancedMode: advancedModeSettings.isEnabled) {+ advancedModeSettings.reconcileConfiguration()}codexVersions.refresh(force: true)}@@ -1397,13 +1421,13 @@ private struct SettingsPageHeightPreferenceKey: PreferenceKey {private struct SyncRowState {/// 由 WorkflowSyncSettings.isEffectivelyActive 统一判定, 视图层不再拼接业务谓词let isActive: Bool- let isHookEnabled: Bool- let isHookUpdating: Bool+ let isAdvancedModeEnabled: Bool+ let isAdvancedModeUpdating: Boollet isSyncAvailable: Boollet isSyncing: Boolvar canToggle: Bool {- isHookEnabled && !isHookUpdating && isSyncAvailable+ isAdvancedModeEnabled && !isAdvancedModeUpdating && isSyncAvailable}func shouldShowSyncStatus(lastSyncText: String?) -> Bool {diff --git a/CodexBar/Views/Settings/AppearanceSettingsRows.swift b/CodexBar/Views/Settings/AppearanceSettingsRows.swiftindex 81b444d..af4887d 100644--- a/CodexBar/Views/Settings/AppearanceSettingsRows.swift+++ b/CodexBar/Views/Settings/AppearanceSettingsRows.swift@@ -17,12 +17,12 @@ struct MainPanelAnimationsSettingsRow: View {struct TaskGlowSettingsRow: View {@ObservedObject var settings: TaskGlowSettings- @ObservedObject var codexHookSettings: CodexHookSettings+ @ObservedObject var advancedModeSettings: AdvancedModeSettingslet onOptionsAction: (SettingsOptionsPanelAction) -> Void@State private var anchorProvider = ScreenFrameProvider()private var canShowOptions: Bool {- settings.isEnabled && codexHookSettings.isOperable && !codexHookSettings.isUpdating+ settings.isEnabled && advancedModeSettings.isOperable && !advancedModeSettings.isUpdating}var body: some View {@@ -30,10 +30,10 @@ struct TaskGlowSettingsRow: View {icon: "light.max",title: "settings.task-glow.title",isOn: Binding(- get: { codexHookSettings.isOperable && settings.isEnabled },+ get: { advancedModeSettings.isOperable && settings.isEnabled },set: { settings.setEnabled($0) }),- isEnabled: codexHookSettings.isOperable && !codexHookSettings.isUpdating+ isEnabled: advancedModeSettings.isOperable && !advancedModeSettings.isUpdating) {SettingsOptionsButton(isAvailable: canShowOptions) {onOptionsAction(.toggle(panel: .taskGlow, anchorProvider: anchorProvider))diff --git a/CodexBar/Views/Settings/CodexSourcePicker.swift b/CodexBar/Views/Settings/CodexSourcePicker.swiftindex 550aa16..87900c6 100644--- a/CodexBar/Views/Settings/CodexSourcePicker.swift+++ b/CodexBar/Views/Settings/CodexSourcePicker.swift@@ -13,7 +13,7 @@ struct CodexSourcePicker: View {selection: selection,options: options,isEnabled: isEnabled,- title: options.contains(selection) ? selection.title : String(localized: "settings.codex-version.source.select"),+ title: options.contains(selection) ? selection.title : String(localized: "codex-cli.source.action.select"),optionTitle: { $0.title },onSelect: onSelect)diff --git a/CodexBar/Views/Settings/CodexVersionSection.swift b/CodexBar/Views/Settings/CodexVersionSection.swiftindex a08fdaa..7f084ba 100644--- a/CodexBar/Views/Settings/CodexVersionSection.swift+++ b/CodexBar/Views/Settings/CodexVersionSection.swift@@ -21,7 +21,7 @@ struct CodexVersionSection: View {.frame(width: Metrics.iconWidth).foregroundStyle(.tint)- Text("settings.codex-version.title")+ Text("settings.codex.version.title")reconnectButton@@ -70,8 +70,8 @@ struct CodexVersionSection: View {let isWorking = isBusy || isReconnectinglet isEnabled = !isWorking && isSourceInstalled(sourceSelection)let label: LocalizedStringKey = isReconnecting- ? "settings.codex-version.reconnecting"- : "settings.codex-version.reconnect"+ ? "settings.codex.connection.status.reconnecting"+ : "settings.codex.connection.action.reconnect"return Button {onReconnect(nil)@@ -142,7 +142,7 @@ struct CodexVersionSection: View {VStack(alignment: .trailing, spacing: 3) {HStack(spacing: 12) {if row.isCurrent || isUnavailable {- Text(isUnavailable ? "settings.codex-version.unavailable" : "settings.codex-version.in-use")+ Text(isUnavailable ? "codex-cli.source.status.unavailable" : "codex-cli.source.status.in-use").font(.caption2.weight(.medium)).foregroundStyle(statusColor).padding(.horizontal, 6)@@ -164,7 +164,7 @@ struct CodexVersionSection: View {.animation(Metrics.statusAnimation, value: isUnavailable)if let newerInstalledVersion = row.newerInstalledVersion {- Text(LocalizedStringResource("settings.codex-version.updated-to", defaultValue: "\(newerInstalledVersion)"))+ Text(LocalizedStringResource("codex-cli.version.newer-installed", defaultValue: "\(newerInstalledVersion)")).font(.caption2.monospacedDigit()).foregroundStyle(.orange).lineLimit(1)diff --git a/CodexBar/Views/Settings/MainPanelOptionsView.swift b/CodexBar/Views/Settings/MainPanelOptionsView.swiftindex 05d0267..e1c143d 100644--- a/CodexBar/Views/Settings/MainPanelOptionsView.swift+++ b/CodexBar/Views/Settings/MainPanelOptionsView.swift@@ -29,7 +29,7 @@ struct MainPanelLayoutSettingsRow: View {/// 主面板布局子选项, 拖放调整区域顺序并控制显隐struct MainPanelOptionsView: View {@ObservedObject var settings: MainPanelSettings- @ObservedObject var codexHookSettings: CodexHookSettings+ @ObservedObject var advancedModeSettings: AdvancedModeSettingslet undoManager: UndoManager@State private var dragState: SectionDragState?@State private var dragTranslation: CGFloat = 0@@ -85,10 +85,10 @@ struct MainPanelOptionsView: View {}private func sectionRow(_ section: MainPanelSection) -> some View {- let isAvailable = section != .activity || codexHookSettings.isEnabled+ let isAvailable = section != .activity || advancedModeSettings.isEnabledlet isVisible = isAvailable && settings.layout.isVisible(section)let visibleSectionCount = settings.layout.visibleSections.filter { visibleSection in- visibleSection != .activity || codexHookSettings.isEnabled+ visibleSection != .activity || advancedModeSettings.isEnabled}.countlet canToggle = isAvailable && (!isVisible || visibleSectionCount > 1)@@ -114,7 +114,7 @@ struct MainPanelOptionsView: View {section.title,isOn: Binding(get: {- (section != .activity || codexHookSettings.isEnabled)+ (section != .activity || advancedModeSettings.isEnabled)&& settings.layout.isVisible(section)},set: {diff --git a/CodexBar/Views/Settings/NotificationOptionsView.swift b/CodexBar/Views/Settings/NotificationOptionsView.swiftindex f2d7011..0a6b18f 100644--- a/CodexBar/Views/Settings/NotificationOptionsView.swift+++ b/CodexBar/Views/Settings/NotificationOptionsView.swift@@ -5,7 +5,7 @@ import SwiftUI/// 通知开启时展开音效子行, 关闭时连同占位一起收起struct NotificationOptionsView: View {@ObservedObject var notificationSettings: NotificationSettings- @ObservedObject var codexHookSettings: CodexHookSettings+ @ObservedObject var advancedModeSettings: AdvancedModeSettings@ObservedObject var codexCLINotificationSettings: CodexCLINotificationSettings@ObservedObject var autoResetSettings: AutoResetSettings@ObservedObject var keepAliveController: KeepAliveController@@ -81,9 +81,9 @@ struct NotificationOptionsView: View {)}- /// Hook 未开启或链路校验不通时显示为关闭并置灰, 不修改持久化的 isTaskCompletionEnabled+ /// 进阶模式未开启或链路校验不通时显示为关闭并置灰, 不修改持久化的 isTaskCompletionEnabledprivate var taskCompletionRow: some View {- let isDisplayedOn = codexHookSettings.isOperable && notificationSettings.isTaskCompletionEnabled+ let isDisplayedOn = advancedModeSettings.isOperable && notificationSettings.isTaskCompletionEnabledreturn notificationOptionRow(title: "settings.notifications.task-completion.title",@@ -91,7 +91,7 @@ struct NotificationOptionsView: View {get: { isDisplayedOn },set: { notificationSettings.setTaskCompletionEnabled($0) }),- isEnabled: codexHookSettings.isOperable,+ isEnabled: advancedModeSettings.isOperable,sound: Binding(get: { notificationSettings.taskCompletionSound },set: { notificationSettings.setTaskCompletionSound($0) }@@ -109,9 +109,9 @@ struct NotificationOptionsView: View {}}- /// Hook 未开启或链路校验不通时显示为关闭并置灰, 不修改持久化的 isTaskWaitingEnabled+ /// 进阶模式未开启或链路校验不通时显示为关闭并置灰, 不修改持久化的 isTaskWaitingEnabledprivate var taskWaitingRow: some View {- let isDisplayedOn = codexHookSettings.isOperable && notificationSettings.isTaskWaitingEnabled+ let isDisplayedOn = advancedModeSettings.isOperable && notificationSettings.isTaskWaitingEnabledreturn notificationOptionRow(title: "settings.notifications.task-waiting.title",@@ -119,7 +119,7 @@ struct NotificationOptionsView: View {get: { isDisplayedOn },set: { notificationSettings.setTaskWaitingEnabled($0) }),- isEnabled: codexHookSettings.isOperable,+ isEnabled: advancedModeSettings.isOperable,sound: Binding(get: { notificationSettings.taskWaitingSound },set: { notificationSettings.setTaskWaitingSound($0) }@@ -127,9 +127,9 @@ struct NotificationOptionsView: View {)}- /// Hook 未开启或链路校验不通时显示为关闭并置灰, 不修改持久化的 isTaskHapticEnabled+ /// 进阶模式未开启或链路校验不通时显示为关闭并置灰, 不修改持久化的 isTaskHapticEnabledprivate var taskHapticRow: some View {- let isDisplayedOn = codexHookSettings.isOperable && notificationSettings.isTaskHapticEnabled+ let isDisplayedOn = advancedModeSettings.isOperable && notificationSettings.isTaskHapticEnabledreturn VStack(spacing: 0) {optionRow(@@ -138,7 +138,7 @@ struct NotificationOptionsView: View {get: { isDisplayedOn },set: { notificationSettings.setTaskHapticEnabled($0) }),- isEnabled: codexHookSettings.isOperable+ isEnabled: advancedModeSettings.isOperable)captionRow("settings.notifications.task-haptics.caption")@@ -147,7 +147,7 @@ struct NotificationOptionsView: View {private var creditExpiryRow: some View {notificationOptionRow(- title: "settings.notifications.credit-expiry.title",+ title: "settings.notifications.banked-reset-expiry.title",isOn: Binding(get: { notificationSettings.isCreditExpiryEnabled },set: { notificationSettings.setCreditExpiryEnabled($0) }diff --git a/CodexBarTests/CodexActivityTaskTests.swift b/CodexBarTests/CodexActivityTaskTests.swiftindex 7108f3e..aa54b80 100644--- a/CodexBarTests/CodexActivityTaskTests.swift+++ b/CodexBarTests/CodexActivityTaskTests.swift@@ -192,7 +192,7 @@ struct CodexActivityTaskTests {private func makeProtectionMonitor(in directory: TestDirectory, preferences: TestPreferences) throws -> CodexActivityMonitor {let monitor = try CodexActivityMonitor(- codexHookSettings: CodexHookSettings(+ advancedModeSettings: AdvancedModeSettings(hooksURL: directory.url.appendingPathComponent("hooks.json"),codexStatusService: makeStatusService(suiteName: preferences.suite)),diff --git a/CodexBarTests/CodexActivityTokenUsageTests.swift b/CodexBarTests/CodexActivityTokenUsageTests.swiftindex 02ff068..e82d72e 100644--- a/CodexBarTests/CodexActivityTokenUsageTests.swift+++ b/CodexBarTests/CodexActivityTokenUsageTests.swift@@ -280,7 +280,7 @@ struct CodexActivityTokenUsageTests {private func makeMonitor(directory: TestDirectory, preferences: TestPreferences) throws -> CodexActivityMonitor {try CodexActivityMonitor(- codexHookSettings: CodexHookSettings(+ advancedModeSettings: AdvancedModeSettings(hooksURL: directory.url.appendingPathComponent("hooks.json"),codexStatusService: makeStatusService(suiteName: preferences.suite)),diff --git a/CodexBarTests/CodexVersionAndProxyTests.swift b/CodexBarTests/CodexVersionAndProxyTests.swiftindex d5a0760..4ac9610 100644--- a/CodexBarTests/CodexVersionAndProxyTests.swift+++ b/CodexBarTests/CodexVersionAndProxyTests.swift@@ -2,6 +2,18 @@ import Foundationimport Testingstruct CodexVersionAndProxyTests {+ @Test(arguments: [+ ("0.150.0", false),+ ("0.152.1", false),+ ("0.153.0-alpha.2", false),+ ("0.153.0", true),+ ("0.153.1", true)+ ])+ func advancedModeRequiresTokenUsageRecordSupport(_ version: String, _ expected: Bool) {+ #expect(CodexCLIVersionReader.isVersion(version, atLeast: CodexCLIMinimumVersion.advancedMode) == expected)+ #expect(CodexCLIVersionReader.isVersion(version, atLeast: CodexCLIMinimumVersion.global) == true)+ }+@Test(arguments: [("0.149.9", "0.150.0", false),("0.150.0", "0.150.0", true),diff --git a/CodexBarTests/SettingsAndMaintenanceTests.swift b/CodexBarTests/SettingsAndMaintenanceTests.swiftindex 3a9f0e0..905e069 100644--- a/CodexBarTests/SettingsAndMaintenanceTests.swift+++ b/CodexBarTests/SettingsAndMaintenanceTests.swift@@ -2,6 +2,49 @@ import Foundationimport Testingstruct SettingsAndMaintenanceTests {+ @Test(arguments: DataUpdateInterval.allCases)+ func dataUpdateIntervalPersistsAndUpdatesCountdown(_ interval: DataUpdateInterval) throws {+ let preferences = try TestPreferences()+ defer { preferences.remove() }+ let service = try makeStatusService(suiteName: preferences.suite)+ let model = CodexStatusViewModel(service: service, defaults: preferences.defaults)+ #expect(model.dataUpdateInterval == .oneMinute)+ model.setDataUpdateInterval(interval)+ #expect(model.autoRefreshInterval == interval.duration)+ let restored = CodexStatusViewModel(service: service, defaults: preferences.defaults)+ #expect(restored.dataUpdateInterval == interval)+ #expect(restored.autoRefreshInterval == interval.duration)+ #expect(!model.isRefreshing)+ #expect(model.autoRefreshCountdownStartedAt == nil)+ }++ @Test(arguments: [0, -60, 90, 1200])+ func invalidDataUpdateIntervalUsesDefault(_ seconds: Int) throws {+ let preferences = try TestPreferences()+ defer { preferences.remove() }+ preferences.defaults.set(seconds, forKey: "DataUpdate.intervalSeconds")+ let model = try CodexStatusViewModel(+ service: makeStatusService(suiteName: preferences.suite),+ defaults: preferences.defaults+ )+ #expect(model.dataUpdateInterval == .oneMinute)+ }++ @Test func dataUpdateIntervalRespectsElapsedTimeAndNewRefreshOrigin() {+ let start = TestFixtures.now+ let now = start.addingTimeInterval(150)+ #expect(DataUpdateInterval.tenMinutes.remainingTime(since: start, now: now) == 450)+ #expect(DataUpdateInterval.threeMinutes.remainingTime(since: start, now: now) == 30)+ #expect(DataUpdateInterval.twoMinutes.remainingTime(since: start, now: now) == 0)+ #expect(DataUpdateInterval.oneMinute.remainingTime(since: nil, now: now) == 0)+ #expect(DataUpdateInterval.oneMinute.remainingTime(since: start, now: start.addingTimeInterval(60)) == 0)+ #expect(DataUpdateInterval.fiveMinutes.remainingTime(since: now, now: now) == 300)+ }++ private nonisolated func makeStatusService(suiteName: String) throws -> CodexStatusService {+ try CodexStatusService(defaults: #require(UserDefaults(suiteName: suiteName)))+ }+@Test func mainPanelAnimationsPreserveStoredPreferenceAndDefault() throws {let preferences = try TestPreferences()defer { preferences.remove() }@@ -95,18 +138,18 @@ struct SettingsAndMaintenanceTests {#expect(activityOnly.disablingActivitySection().visibleSections == [.account])}- @Test func hookDisableHidesActivityAndExplicitReenableRestoresIt() throws {+ @Test func advancedModeDisableHidesTasksAndExplicitReenableRestoresThem() throws {let preferences = try TestPreferences()defer { preferences.remove() }let settings = MainPanelSettings(defaults: preferences.defaults)- settings.updateHookEnabled(false)+ settings.updateAdvancedModeEnabled(false)#expect(!settings.layout.isVisible(.activity))- settings.updateHookEnabled(true)+ settings.updateAdvancedModeEnabled(true)#expect(settings.layout.isVisible(.activity))let undo = UndoManager()settings.setSection(.activity, isVisible: false, undoManager: undo)let restored = MainPanelSettings(defaults: preferences.defaults)- restored.updateHookEnabled(true)+ restored.updateAdvancedModeEnabled(true)#expect(!restored.layout.isVisible(.activity))}diff --git a/Docs/DeveloperGuide/app-server.md b/Docs/DeveloperGuide/app-server.mdindex dc13c30..d3292e9 100644--- a/Docs/DeveloperGuide/app-server.md+++ b/Docs/DeveloperGuide/app-server.md@@ -180,13 +180,9 @@ session 关闭时按以下顺序收口:| `hooks/list` | 校验 Hook 来源和事件能力 || `config/batchWrite` | 修改 Hook 或 TUI 通知相关配置 |-每个 session 会缓存不支持的方法。一旦 app-server 明确返回 method unsupported,当前连接后续不会重复请求该方法。-### Session 能力缓存-method unsupported 通常代表当前 app-server 版本缺少能力。每分钟重复调用只会制造日志和延迟。--但这个结论不能永久保存到 UserDefaults。新连接可能来自升级后的 binary,因此 unsupported 集合只属于 `AppServerSession`,连接重建后重新探测。+`AppServerSession` 缓存 app-server 明确返回 method unsupported 的方法,当前连接后续跳过这些方法。缓存仅存在于内存,连接重建后重新探测能力。## 会话生命周期@@ -241,7 +237,7 @@ ready## 刷新模型-状态 ViewModel 默认每 60 秒刷新。用户也可以在主面板双击账户图标立即触发。+状态 ViewModel 按用户选择的数据更新间隔刷新,支持 1、2、3、5 或 10 分钟,默认 1 分钟。用户也可以在主面板双击账户图标立即触发。一次刷新先解析账户,再读取额度和用量。补充数据缓存严格绑定到账户身份:@@ -412,7 +408,7 @@ Hook 设置也复用 app-server 链路,但采用独立的可用性状态:- `isOperable` 只有在两者都为 `true` 时成立- 短暂 RPC 失败保留上一次明确校验结果-启用或校验 Hook 时必须确认实际 app-server 版本不低于 `0.150.0`+启用或校验 Hook 时必须确认实际 app-server 版本不低于 `0.153.0`详细配置流程见 [Hook 采集与历史聚合](hook-and-aggregation.md)@@ -450,11 +446,11 @@ Reset Credits 明细包含 opaque credit ID。系统日志不能记录 ID 或原- 复用连接的 transport failure 只重建一次- 磁盘 CLI 升级后,当前连接版本与磁盘版本能被区分- app-server 低于 `0.145.0` 时阻断账户主链路并提示升级-- app-server 不低于 `0.145.0` 且低于 `0.150.0` 时账户主链路可用,但 Hook 仍提示需要 `0.150.0`-- app-server 不低于 `0.150.0` 时账户主链路和 Hook 校验均可用+- app-server 不低于 `0.145.0` 且低于 `0.153.0` 时账户主链路可用,但 Hook 仍提示需要 `0.153.0`+- app-server 不低于 `0.153.0` 时账户主链路和 Hook 校验均可用- rate limits 失败但同账户有缓存时展示 stale,通知不误触发- 账户切换后旧额度和用量立即清空-- unsupported method 不会每分钟重复请求+- unsupported method 在同一连接中不会重复请求- Reset Credits `credits == nil` 时保留权威数量并显示未知过期时间- Reset Credits 明细为空或被截断时不从明细长度反推可用数量- 过期、非 available 的 Reset Credits 不进入详情或通知@@ -471,7 +467,8 @@ Reset Credits 明细包含 opaque credit ID。系统日志不能记录 ID 或原- 只有数量或读取失败、没有具体目标时不注册查询重试唤醒事件- 已知目标的单轮连续重试在临期触发 5 分钟后停止,后续普通额度刷新仍可重新开启一轮- 消费成功后的完整额度刷新不会被并发普通刷新丢弃-- 手动刷新后 60 秒倒计时重新对齐+- 手动刷新后按所选数据更新间隔重新对齐倒计时+- 在自动刷新等待期间切换间隔,按上次结果提交时间重新安排等待;正在进行的请求继续完成,重启后恢复所选间隔代理相关验证还包括:停用无效配置、清除损坏记录、测试取消后旧结果隔离、快速连续切换只提交一次、提交失败回滚,以及日志中普通 URL 和 JSON 转义 URL 的用户名、密码替换。diff --git a/Docs/DeveloperGuide/architecture.md b/Docs/DeveloperGuide/architecture.mdindex 58bbedc..082323b 100644--- a/Docs/DeveloperGuide/architecture.md+++ b/Docs/DeveloperGuide/architecture.md@@ -91,7 +91,7 @@ Scripts/ 构建, DMG, appcast 和 CodexBarHelper 清理脚本- `CodexStatusService` 和 `CodexStatusViewModel`- `CodexProxySettings`- `WorkflowService` 和对应 ViewModel-- `CodexHookSettings`+- `AdvancedModeSettings`- `CodexActivityMonitor`- `KeepAliveController`- `AutoResetController`@@ -149,7 +149,7 @@ Hook + rollout --------> CodexActivityMonitor --------> UI### 共享刷新触发-历史维护默认挂在 60 秒额度刷新完成事件上,这是为了减少常驻 timer 和日志噪音。两条链路共享调度时机,但没有共享事实。+历史维护挂在额度刷新完成事件上,间隔由数据更新设置决定,默认 1 分钟,这是为了减少常驻 timer 和日志噪音。两条链路共享调度时机,但没有共享事实。因此修改刷新节奏时需要区分:@@ -240,7 +240,7 @@ Hook + rollout --------> CodexActivityMonitor --------> UI| 主面板账户加载状态 | `CodexStatusViewModel` | 观察发布值 || 自动重置的目标、deadline 和重试 | `AutoResetController` | 设置页只修改开关和提前量 || 自动重置唤醒时间同步 | `AutoResetWakeScheduler` | `AutoResetController` 只提交下一次时间,`KeepAliveController` 只提交 helper 就绪状态 |-| Hook 安装与验证 | `CodexHookSettings` | 读取 `isOperable` |+| Hook 安装与验证 | `AdvancedModeSettings` | 读取 `isOperable` || 历史聚合和维护游标 | `WorkflowService` | 请求快照或重建 || 实时任务 | `CodexActivityMonitor` | 读取快照、通知转场或包含新增终态的展示更新 || 同步游标与远端缓存 | `WorkflowSyncService` | 请求合并快照 |@@ -264,7 +264,7 @@ Hook + rollout --------> CodexActivityMonitor --------> UI| 错误类别 | 典型处理 | 不应采取的处理 || --- | --- | --- |-| 明确业务不支持 | 缓存 method unsupported,显示来源缺失 | 每分钟重复请求或展示 `0` |+| 明确业务不支持 | 缓存 method unsupported,显示来源缺失 | 同一连接中重复请求或展示 `0` || 短暂业务失败 | 同账户范围内使用 stale 缓存 | 清空整个账户快照 || transport 失败 | 丢弃连接,最多重建一次 | 在不可信 pipe 上继续请求 || 数据源身份变化 | 新 generation,从原始来源重建 | 沿用旧 offset 继续追加 |diff --git a/Docs/DeveloperGuide/data-and-privacy.md b/Docs/DeveloperGuide/data-and-privacy.mdindex a98c92b..0101bb6 100644--- a/Docs/DeveloperGuide/data-and-privacy.md+++ b/Docs/DeveloperGuide/data-and-privacy.md@@ -79,7 +79,7 @@ Hook 子进程从 stdin 提取:Hook 子进程从 rollout 首条 `session_meta` 的完整记录或已完成字段前缀中提取来源,按 32 KiB 分块且总计不超过 256 KiB。JSONL 只持久化归一化后的 `main`、`autoReview`、`auxiliary` 或 `unknown`,具体分类与 model 后备规则见 [来源归一化](hook-and-aggregation.md#来源归一化)-不把 prompt, response, tool 参数或 tool 输出写入 CodexBar Hook 文件。+不把 prompt, response, tool 参数或 tool 输出写入 CodexBar 的 Hook 事件文件。工作目录只用于派生 project display name 和实时归属。原始 Hook JSONL 仍可能包含 `cwd`,因此它属于本地敏感上下文,受保留期和文件权限约束。rollout 路径、原始 source 和任意 subagent `other` 值不会持久化。CloudKit 只上传派生后的 project 名计数,并明确依赖用户 opt-in。@@ -156,6 +156,7 @@ Token 账本和同步缓存由 Debug 与 Release 共用。`store.lock` 保护对UserDefaults 保存:- 功能开关和设置选项+- 数据更新间隔(`DataUpdate.intervalSeconds`,单位为秒)- 通知阈值和声音名称- 全局快捷键- 代理启用状态、协议、服务器、端口、认证用户名和密码diff --git a/Docs/DeveloperGuide/design-decisions.md b/Docs/DeveloperGuide/design-decisions.mdindex cdf8f2e..7dfdbca 100644--- a/Docs/DeveloperGuide/design-decisions.md+++ b/Docs/DeveloperGuide/design-decisions.md@@ -18,7 +18,7 @@保存的开关表示用户意图,依赖状态决定是否能执行,结果状态表示已经确认的效果。依赖临时不可用时保留用户开关,恢复后重新协调。-防睡眠的 `isEnabled`、`sleepBlockReason` 和 `isPreventingSleep` 分别对应这三层。Hook 的 `isEnabled` 与 `isVerified` 共同决定 `isOperable`;实时任务依赖可操作状态,历史聚合仍可处理已落盘数据。+防睡眠的 `isEnabled`、`sleepBlockReason` 和 `isPreventingSleep` 分别对应这三层。`AdvancedModeSettings` 的 `isEnabled` 与 `isVerified` 共同决定 `isOperable`;实时任务依赖可操作状态,历史聚合仍可处理已落盘数据。## 缺失、陈旧与不可信数据diff --git a/Docs/DeveloperGuide/development.md b/Docs/DeveloperGuide/development.mdindex 27addb7..70e89a4 100644--- a/Docs/DeveloperGuide/development.md+++ b/Docs/DeveloperGuide/development.md@@ -46,7 +46,7 @@ swiftlint| 功能 | 主要位置 | 实现说明 || --- | --- | --- || app-server、代理、自动重置 | `Services/CodexStatus` 与对应 Settings | [app-server 数据链路](app-server.md) |-| Hook 安装与统计 | `CodexHookSettings`、`WorkflowService`、聚合模型 | [Hook 采集与历史聚合](hook-and-aggregation.md) |+| Hook 安装与统计 | `AdvancedModeSettings`、`WorkflowService`、聚合模型 | [Hook 采集与历史聚合](hook-and-aggregation.md) || 实时任务与异常保护 | `CodexActivityMonitor` 和 readers | [实时任务监控](activity-monitor.md) || 防睡眠与系统唤醒 | `KeepAliveController`、`AutoResetWakeScheduler`、helper | [防睡眠系统](sleep-prevention.md) || 通知与音效 | `CodexNotificationService`、通知 Settings | [通知系统](notifications.md) |diff --git a/Docs/DeveloperGuide/hook-and-aggregation.md b/Docs/DeveloperGuide/hook-and-aggregation.mdindex d0eecf0..439729e 100644--- a/Docs/DeveloperGuide/hook-and-aggregation.md+++ b/Docs/DeveloperGuide/hook-and-aggregation.md@@ -19,12 +19,12 @@ Codex Hook## 安装与校验-[`CodexHookSettings.swift`](../../CodexBar/Services/Settings/CodexHookSettings.swift) 直接读写本地 `hooks.json`,通过 app-server 读取或修改相关配置,并在写入后调用 `hooks/list` 校验安装结果。+[`AdvancedModeSettings.swift`](../../CodexBar/Services/Settings/AdvancedModeSettings.swift) 直接读写本地 `hooks.json`,通过 app-server 读取或修改相关配置,并在写入后调用 `hooks/list` 校验安装结果。启用流程检查以下条件,其中来源、信任和事件完整性在写入后校验:- 当前可执行文件路径可解析-- 实际 app-server 版本不低于 `0.150.0`+- 实际 app-server 版本不低于 `0.153.0`- `features.hooks` 可用- `hooks/list` 返回可信来源- 所需事件集合完整@@ -47,7 +47,7 @@ Codex Hook### 已开启 Hook 的对账-App 启动、设置状态刷新、主面板打开和每轮额度刷新完成时,都会对账已开启的 Hook。自动刷新间隔为上一轮完成后 60 秒:+App 启动、设置状态刷新、主面板打开和每轮额度刷新完成时,都会对账已开启的 Hook。自动刷新按所选数据更新间隔从上一轮完成后计时,默认 1 分钟:- 只有已确认的实际 app-server 版本低于当前 Hook 最低版本时,才移除 CodexBar handler 并尽力清理对应信任项;低于全局最低版本时也执行本地移除- 版本无法确认或 RPC 临时失败时保留用户配置@@ -61,7 +61,7 @@ App 启动、设置状态刷新、主面板打开和每轮额度刷新完成时### 启用事务的顺序```text-确认运行中 app-server >= 0.150.0+确认运行中 app-server >= 0.153.0-> 确认 features.hooks 没有全局关闭-> 读取现有 hooks.json-> 只移除当前 executable 的旧 CodexBar handler@@ -90,7 +90,7 @@ CodexBar 不把命令塞进用户已有 group。独立 group 让卸载时可以### 异步设置操作的代际-用户开关 Hook 或触发校验时,`CodexHookSettings` 通过 `updateCoordinator` 启动操作,由 `RefreshTaskCoordinator` 推进代际并取消旧 Task。+用户开关进阶模式或触发校验时,`AdvancedModeSettings` 通过 `updateCoordinator` 启动操作,由 `RefreshTaskCoordinator` 推进代际并取消旧 Task。每个文件写入或 RPC await 之后都会再次检查 generation。旧操作即使无法真正取消,也不能把新的开关状态或错误信息覆盖回去。@@ -117,7 +117,7 @@ CodexBar 订阅以下 Hook 事件:历史计数需要事件名、日期、project、model 和身份集合。实时状态还需要 turn, reviewer, effort, tool, agent 关联和归一化来源。-把两类需求统一在一条最小原始记录中,可以让 recorder 只写一次,两个下游各自选择所需字段。但新增字段前仍要证明至少有一个消费者需要它,不能因为 Hook payload 中存在就全部持久化。+recorder 将两类链路所需字段写入同一条原始记录,历史聚合与实时监控分别读取各自需要的字段。recorder 为来源分类有界读取 rollout 首行。普通事件使用 `transcript_path`,`SubagentStop` 使用指向子线程自身的 `agent_transcript_path`。rollout 来源无法确定时,只有精确匹配 `codex-auto-review` 的 model 才作为 Auto-review 来源的后备判定。`PermissionRequest` 和 `UserPromptSubmit` 的 reviewer 或 effort 可能不在 Hook payload 中,只有这两个事件还会按 turn 定向读取 rollout 尾部。@@ -430,8 +430,6 @@ schema 变化通常把保留期内所有事件日期标脏。source generation### 维护日志-维护默认跟随 60 秒刷新。空闲机器一天会执行上千次没有变化的检查。-`WorkflowService` 累计连续 idle 轮数,在写入、跳过、失败或清理时输出摘要,并附带累计空转次数。### scheduler 如何合并请求@@ -457,7 +455,7 @@ UI 打开只读取当前本地快照,不自动越过 scheduler 发起无条件- build 期间继续 append 时只提交固定上界,尾部保留 pending- schema 变化后保留期内日期全部用当前算法重建- 旧日期缺失字段在解码及持久化中保留可选值,展示投影按当前回退规则生成计数-- 禁用 CodexBar Hook 不删除用户 handler 和信任项+- 关闭进阶模式不删除用户 handler 和信任项- 快速开关 Hook 时旧 RPC 结果不能覆盖最后一次操作## 故障边界@@ -471,7 +469,7 @@ UI 打开只读取当前本地快照,不自动越过 scheduler 发起无条件## 关键源码-- [`CodexHookSettings.swift`](../../CodexBar/Services/Settings/CodexHookSettings.swift)+- [`AdvancedModeSettings.swift`](../../CodexBar/Services/Settings/AdvancedModeSettings.swift)- [`WorkflowHookEventRecorder.swift`](../../CodexBar/Services/Workflow/WorkflowHookEventRecorder.swift)- [`CodexHookEvent.swift`](../../CodexBar/Models/CodexHookEvent.swift)- [`JSONLines.swift`](../../CodexBar/Services/Workflow/JSONLines.swift)diff --git a/Docs/DeveloperGuide/sleep-prevention.md b/Docs/DeveloperGuide/sleep-prevention.mdindex 8cde972..e4adaed 100644--- a/Docs/DeveloperGuide/sleep-prevention.md+++ b/Docs/DeveloperGuide/sleep-prevention.md@@ -105,7 +105,7 @@ App 和 helper 都使用单调递增 generation:[`KeepAliveController.swift`](../../CodexBar/Services/KeepAlive/KeepAliveController.swift) 只有在以下条件全部成立时才建立防睡眠:- 防睡眠主开关已开启-- Hook 的 `isOperable` 为 `true`+- `AdvancedModeSettings.isOperable` 为 `true`- 至少存在一个符合设置的实时任务- CodexBarHelper 已安装并可连接- 未触发低电量阈值@@ -122,7 +122,7 @@ App 和 helper 都使用单调递增 generation:| --- | --- || `notStarted` | 服务尚未启动 || `userOff` | 用户关闭主开关 |-| `hookDisabled` | Hook 不可工作 |+| `advancedModeDisabled` | Hook 不可工作 || `noTasks` | 没有符合条件的任务 || `helperUnavailable` | CodexBarHelper 未安装或不可连接 || `helperRefreshing` | CodexBarHelper 状态正在恢复或确认 |diff --git a/Docs/DeveloperGuide/sync.md b/Docs/DeveloperGuide/sync.mdindex dc08f86..2d8cd09 100644--- a/Docs/DeveloperGuide/sync.md+++ b/Docs/DeveloperGuide/sync.md@@ -55,7 +55,7 @@ zone 确认和账户 salt 在 actor 内跨轮次缓存;同步失败时使两同步只有在以下条件全部成立时运行:- 用户打开 CloudKit 同步-- `CodexHookSettings.isEnabled` 为 `true`,历史同步可继续消费已落盘聚合+- `AdvancedModeSettings.isEnabled` 为 `true`,历史同步可继续消费已落盘聚合- 当前 iCloud 账户可用- 本地聚合服务可用diff --git a/Docs/DeveloperGuide/ui-and-lifecycle.md b/Docs/DeveloperGuide/ui-and-lifecycle.mdindex cafd123..baf4127 100644--- a/Docs/DeveloperGuide/ui-and-lifecycle.md+++ b/Docs/DeveloperGuide/ui-and-lifecycle.md@@ -47,7 +47,7 @@ UI 使用 SwiftUI 声明内容,由 AppKit Controller 管理窗口。## 任务流光-`TaskGlowController` 在 `TaskGlowSettings.isEnabled` 和 Hook 的 `isOperable` 均为 `true` 时显示任务状态,与主面板动画开关独立。输入来自 `CodexActivityMonitor.presentationPublisher`,包含当前快照与本轮结束事件,见[展示更新](activity-monitor.md#展示更新)+`TaskGlowController` 在 `TaskGlowSettings.isEnabled` 和 `AdvancedModeSettings.isOperable` 均为 `true` 时显示任务状态,与主面板动画开关独立。输入来自 `CodexActivityMonitor.presentationPublisher`,包含当前快照与本轮结束事件,见[展示更新](activity-monitor.md#展示更新)| 场景 | 展示规则 || --- | --- |@@ -57,7 +57,7 @@ UI 使用 SwiftUI 声明内容,由 AppKit Controller 管理窗口。颜色、速度、亮度和结束时长由 `TaskGlowSettings.appearance` 提供。默认运行使用青色,等待批准使用橙色,完成使用绿色,终止使用红色;结束时间相同优先终止。所有计时包含进场动画,到期后按最新快照恢复展示。-设置从关闭切换为开启且 Hook 可用时,`TaskGlowSettings.previewRequests` 请求一次使用当前外观设置的运行预览,完成一个往返周期后恢复实际状态。启动和设置刷新只恢复开关值,不触发预览。+设置从关闭切换为开启且进阶模式可用时,`TaskGlowSettings.previewRequests` 请求一次使用当前外观设置的运行预览,完成一个往返周期后恢复实际状态。启动和设置刷新只恢复开关值,不触发预览。双击设置面板中的颜色块请求对应状态的预览:运行展示往返流光,等待批准展示呼吸效果,完成和终止短暂显示后淡出。颜色预览可以替换正在播放的预览;收起设置子面板只结束颜色预览。开启预览在已有预览或窗口收尾期间忽略重复请求。@@ -209,7 +209,7 @@ fallback panel 展示前使用主面板固定宽度和 SwiftUI fitting height,主面板可见时,数字随数据变化滚动,Token 数字与待查询或不可用占位之间淡入淡出。“动画效果”控制入场动画、太阳徽标旋转和任务状态文字动画,数字更新不受此开关控制。-Hook 开启时,热力图详情按活动统计和会话 Token 分组,并展示用量强度条。各组用 `Grid` 对齐名称和数值。日期切换时,Token 与活动数值使用相同的 `numericText` 过渡,最常用模型使用同一文本视图过渡并按可用宽度缩小字号。+进阶模式开启时,热力图详情按活动统计和会话 Token 分组,并展示用量强度条。各组用 `Grid` 对齐名称和数值。日期切换时,Token 与活动数值使用相同的 `numericText` 过渡,最常用模型使用同一文本视图过渡并按可用宽度缩小字号。共享 `LiquidGlassDivider` 使用银灰和冷白渐变,缓慢循环移动。它通过所在 `NSView` 的窗口可见状态暂停或恢复时间线,不受“动画效果”设置控制。@@ -250,14 +250,14 @@ SwiftUI 可能在窗口创建完成前上报高度。`SettingsWindowController`二级设置入口使用各自的可用性结论:- 主面板布局入口始终可用-- 流光要求 `TaskGlowSettings.isEnabled`、Hook 的 `isOperable` 为 `true`,且 Hook 未在更新+- 流光要求 `TaskGlowSettings.isEnabled`、`AdvancedModeSettings.isOperable` 为 `true`,且进阶模式未在更新- 通知读取 `NotificationSettings.canShowOptions`- 自动重置要求 `AutoResetSettings.isEnabled` 且 `KeepAliveController.helperStatus == .enabled`- 防睡眠读取 `KeepAliveController.canShowOptions`入口条件失效时设置页发送对应的 `close` 动作,避免不可用的子面板继续显示。主开关关闭时,自动重置和防睡眠设置行不显示状态说明。-`MainPanelSettings` 使用稳定区域标识保存账户、任务中心、额度、Token 用量和底部状态的顺序与显隐。布局归一化会去重、忽略无效值、补齐缺失区域,并保证至少保留一个可见区域。`StatusItemController` 在读取到 Hook 关闭状态后调用 `updateHookEnabled(_:)`,持久化关闭任务中心;如果任务中心原本是唯一可见区域,则同时开启账户区域。从关闭切换到开启时自动显示任务中心,首次恢复开启状态和重复开启通知均保留用户布局。设置面板只禁用任务中心开关,拖拽手柄仍保持可用。其他数据链路的临时可用性只影响当次渲染。+`MainPanelSettings` 使用稳定区域标识保存账户、任务中心、额度、Token 用量和底部状态的顺序与显隐。布局归一化会去重、忽略无效值、补齐缺失区域,并保证至少保留一个可见区域。`StatusItemController` 在读取到进阶模式关闭状态后调用 `updateAdvancedModeEnabled(_:)`,持久化关闭任务中心;如果任务中心原本是唯一可见区域,则同时开启账户区域。从关闭切换到开启时自动显示任务中心,首次恢复开启状态和重复开启通知均保留用户布局。设置面板只禁用任务中心开关,拖拽手柄仍保持可用。其他数据链路的临时可用性只影响当次渲染。布局排序使用手柄上的自定义 `DragGesture`。拖动项通过悬浮副本跟随指针,其他行随拖动位置按视图内预览顺序实时让位,松手后才调用 `setSectionOrder(_:)` 一次性持久化最终顺序。@@ -297,13 +297,13 @@ Carbon API 适合无 Dock 菜单栏 App,不需要安装全局键盘事件 tap## 自动刷新与面板打开-app-server 状态默认每 60 秒检查刷新。主面板淡入完成且面板仍可见时,调用 `refreshIfNeeded`;倒计时起点为空或距上次刷新结果提交超过 60 秒时才发起请求。成功和失败的结果提交都会重置倒计时。+app-server 状态按数据更新间隔自动刷新,可选 1、2、3、5 或 10 分钟,默认 1 分钟。主面板淡入完成且面板仍可见时,调用 `refreshIfNeeded`;倒计时起点为空或已达到所选间隔时才发起请求。成功和失败的结果提交都会重置倒计时。修改间隔只重新安排等待任务,不取消正在进行的请求。主面板显示刷新倒计时,双击账户图标可立即手动刷新。普通刷新在刷新或重连进行中被忽略。需要在当前请求后补刷的操作通过 `refreshAfterCurrent` 保存一个待执行触发,当前请求结束后再执行。-淡入完成回调依次触发 Hook 配置对账、Hook 开启时的本地统计刷新检查,以及账户、额度和用量刷新检查。面板在淡入完成前关闭时,取消完成任务及其尚未触发的刷新。+淡入完成回调依次触发 Hook 配置对账、进阶模式开启时的本地统计刷新检查,以及账户、额度和用量刷新检查。面板在淡入完成前关闭时,取消完成任务及其尚未触发的刷新。## 本地化和格式化@@ -345,7 +345,7 @@ app-server 状态默认每 60 秒检查刷新。主面板淡入完成且面板- 主面板布局、流光、通知、自动重置和防睡眠子面板互斥,顶边对齐对应设置行,内容变化后高度正确- 流光子面板展开时颜色输入框不自动聚焦;六位输入限制、粘贴过滤和大写转换正确;无效颜色在回车、失焦及收起时恢复默认,显示与实际颜色一致- 设置子面板展开时从菜单栏打开主面板,主面板保持打开,设置子面板收起且不把焦点抢回设置窗口-- 主面板区域拖动时悬浮行跟随指针,其他行随拖动位置实时让位,松手后平滑落位并只保存最终顺序;拖拽和显隐操作可以通过 `⌘Z` 逐步撤销并通过 `⌘⇧Z` 重做,焦点在设置主窗口或任一设置子面板时均有效;重启后保持配置,最后一个可见区域无法关闭;Hook 关闭时任务中心自动关闭、开关置灰但仍可拖动,任务中心为唯一可见区域时账户自动开启;重新开启 Hook 后任务中心自动显示,手动隐藏后重启仍保持隐藏,自动联动不进入用户撤销历史+- 主面板区域拖动时悬浮行跟随指针,其他行随拖动位置实时让位,松手后平滑落位并只保存最终顺序;拖拽和显隐操作可以通过 `⌘Z` 逐步撤销并通过 `⌘⇧Z` 重做,焦点在设置主窗口或任一设置子面板时均有效;重启后保持配置,最后一个可见区域无法关闭;进阶模式关闭时任务中心自动关闭、开关置灰但仍可拖动,任务中心为唯一可见区域时账户自动开启;重新开启进阶模式后任务中心自动显示,手动隐藏后重启仍保持隐藏,自动联动不进入用户撤销历史- 上下文菜单打开设置或日志时没有焦点丢失- 多显示器和不同菜单栏位置下 fallback panel 位于鼠标屏幕- 快捷键冲突后原快捷键仍可用diff --git a/Docs/README.md b/Docs/README.mdindex 487e363..317b65e 100644--- a/Docs/README.md+++ b/Docs/README.md@@ -6,7 +6,7 @@- [安装与快速开始](UserGuide/getting-started.md)- [主面板与菜单栏](UserGuide/main-panel.md)-- [实时任务与 CodexBar Hook](UserGuide/activity-and-hook.md)+- [实时任务与进阶模式](UserGuide/advanced-mode.md)- [通知与提醒](UserGuide/notifications.md)- [防止系统睡眠](UserGuide/sleep-prevention.md)- [数据、同步与隐私](UserGuide/sync-data-privacy.md)diff --git a/Docs/UserGuide/activity-and-hook.md b/Docs/UserGuide/advanced-mode.mdsimilarity index 75%rename from Docs/UserGuide/activity-and-hook.mdrename to Docs/UserGuide/advanced-mode.mdindex 2a22350..a2049f5 100644--- a/Docs/UserGuide/activity-and-hook.md+++ b/Docs/UserGuide/advanced-mode.md@@ -1,18 +1,18 @@-# 实时任务与 CodexBar Hook+# 实时任务与进阶模式-简体中文 | [English](../en/UserGuide/activity-and-hook.md)+简体中文 | [English](../en/UserGuide/advanced-mode.md)-CodexBar Hook 用于显示实时任务,并支持任务通知、触觉反馈、按任务防睡眠,以及每日会话、轮次和工具调用统计。开启后也可以同步每日活动统计和 rollout Token 历史;重建数据可重新计算本机保留的两类历史。+进阶模式用于显示实时任务,并支持任务通知、触觉反馈、按任务防睡眠,以及每日会话、轮次和工具调用统计。开启后也可以同步每日活动统计和 rollout Token 历史;重建数据可重新计算本机保留的两类历史。## 开启方法1. 打开 `设置 > 高级`-2. 开启 `CodexBar Hook` 并等待校验完成+2. 开启 `进阶模式` 并等待校验完成3. 开始一轮 Codex 任务,在主面板查看状态-Hook 要求当前使用的 Codex 为 `0.150.0` 或更高版本。更新后仍提示版本过低时,在 `设置 > 关于` 点击 `重新建立连接`。其他错误见 [常见问题与排查](troubleshooting.md#hook-无法开启或校验失败)+进阶模式要求当前使用的 Codex 为 `0.153.0` 或更高版本。更新后仍提示版本过低时,在 `设置 > 关于` 点击 `重新建立连接`。其他错误见 [常见问题与排查](troubleshooting.md#进阶模式无法开启或校验失败)-CodexBar 自动检查和修复已开启的 Hook 配置,保留用户和其他 App 的 handler。确认 Codex 低于最低版本时,会关闭 Hook 并移除自己的 handler;更新 Codex 后需要重新开启 Hook。暂时无法连接或确认版本时保留配置,等待下次校验。+CodexBar 自动检查和修复已开启的 Hook 配置,保留用户和其他 App 的 handler。确认 Codex 低于最低版本时,会关闭进阶模式并移除自己的 handler;更新 Codex 后需要重新开启进阶模式。暂时无法连接或确认版本时保留配置,等待下次校验。## 任务状态@@ -41,10 +41,10 @@ CodexBar 自动检查和修复已开启的 Hook 配置,保留用户和其他 A会话和轮次按天去重,跨天继续活动会计入新的一天。当天只有会话结束事件的会话,以及只有完成候选或中断事件的轮次,不计入当天活跃数。工具调用按开始和结束事件数的较大值统计。-## 关闭 Hook+## 关闭进阶模式关闭后,实时任务、任务通知、触觉反馈、防睡眠和 Hook 统计停止更新,活动与 Token 历史的跨设备同步停止。热力图隐藏历史详情,账户、额度和 app-server Token 热力图仍可使用。Hook 记录任务的时间、模型、工具名和项目等信息,不保存提问、回复或工具输入输出正文。保存期限与同步内容见 [数据、同步与隐私](sync-data-privacy.md)-返回 [用户指南](README.md)+返回 [用户指南](../README.md#用户指南)diff --git a/Docs/UserGuide/getting-started.md b/Docs/UserGuide/getting-started.mdindex af0d655..be18e07 100644--- a/Docs/UserGuide/getting-started.md+++ b/Docs/UserGuide/getting-started.md@@ -7,7 +7,7 @@- macOS 15.0 或更高版本- 已安装并登录 [Codex CLI](https://github.com/openai/codex),或安装了内置 Codex 的 ChatGPT App 或 Codex App- 当前使用的 Codex 版本需要为 `0.145.0` 或更高版本-- 使用 Hook 相关功能时,当前使用的 Codex 版本需要为 `0.150.0` 或更高版本+- 启用进阶模式时,当前使用的 Codex 版本需要为 `0.153.0` 或更高版本- 使用跨设备同步时,Mac 需要登录可用的 iCloud 账户CodexBar 默认自动选择来源,优先使用全局安装的 Codex CLI,找不到时再尝试 ChatGPT App 和 Codex App 内置的 Codex。可在“设置 > 关于 > Codex 版本 > 来源”中手动选择。@@ -34,9 +34,9 @@ CodexBar 是菜单栏 App,启动后不会在 Dock 中显示图标:2. 左键点击图标打开主面板3. 等待首次账户和用量刷新完成4. 如果显示未登录,先在当前 Codex 中完成登录-5. 如果需要实时任务、任务类通知、防睡眠或 Hook 统计,在 `设置 > 高级` 中开启 CodexBar Hook+5. 如果需要实时任务、任务类通知、防睡眠或 Hook 统计,在 `设置 > 高级` 中开启进阶模式-CodexBar 每 60 秒自动刷新一次账户、额度和 Token 用量,双击主面板中的账户图标可以立即刷新。+CodexBar 默认每 1 分钟自动刷新账户、额度和 Token 用量,可在 `设置 > 高级 > 数据更新间隔` 选择 1、2、3、5 或 10 分钟。双击主面板中的账户图标可以立即刷新。## 基本操作@@ -58,7 +58,7 @@ CodexBar 每 60 秒自动刷新一次账户、额度和 Token 用量,双击主## 开启更多功能-- [CodexBar Hook](activity-and-hook.md):实时任务、每日活动统计和按任务防睡眠+- [进阶模式](advanced-mode.md):实时任务、每日活动统计和按任务防睡眠- [系统通知](notifications.md):任务和额度提醒,需允许 macOS 通知权限- [自动重置](settings.md#自动重置):提前使用即将过期的留存重置,可能短暂唤醒 Mac- [防止系统睡眠](sleep-prevention.md):长任务期间保持 Mac 唤醒,需批准后台服务diff --git a/Docs/UserGuide/main-panel.md b/Docs/UserGuide/main-panel.mdindex 9492dd9..e67db44 100644--- a/Docs/UserGuide/main-panel.md+++ b/Docs/UserGuide/main-panel.md@@ -79,7 +79,7 @@ CodexBar 会展示 Codex 返回的全部额度分组和窗口。悬停日期方块时会显示日期、Token 数量和用量强度。-CodexBar Hook 开启时,日期详情还会显示以下统计:+进阶模式开启时,日期详情还会显示以下统计:- 最常用模型- 会话数@@ -149,4 +149,4 @@ CodexBar Hook 开启时,日期详情还会显示以下统计:发现新版本时,双击更新提示可以开始更新。-返回 [用户指南](README.md)+返回 [用户指南](../README.md#用户指南)diff --git a/Docs/UserGuide/notifications.md b/Docs/UserGuide/notifications.mdindex 644a4de..8399bce 100644--- a/Docs/UserGuide/notifications.md+++ b/Docs/UserGuide/notifications.md@@ -17,8 +17,8 @@| 通知 | 触发条件 | 默认子开关 | 额外依赖 || --- | --- | --- | --- |-| 任务完成 | 任务完成且运行时长达到所选阈值 | 开启,1 分钟 | CodexBar Hook |-| 任务等待 | 任务进入等待用户批准状态 | 开启 | CodexBar Hook |+| 任务完成 | 任务完成且运行时长达到所选阈值 | 开启,1 分钟 | 进阶模式 |+| 任务等待 | 任务进入等待用户批准状态 | 开启 | 进阶模式 || 额度预警 | 剩余额度达到预警阈值 | 开启,10% | 无 || 额度重置 | 已观察到消耗的额度窗口回到未消耗状态 | 开启 | 无 || 重置临期 | 留存重置进入过期前 7 天窗口 | 开启 | 存在可用留存重置 |@@ -26,7 +26,7 @@| 自动重置失败 | 认证失败导致暂停、协议错误导致停止,或本机明确观察到过期 | 与成功通知共用设置 | 自动重置开关、通知子开关和通知总开关 || 低电量保护 | 低电量保护成功恢复系统睡眠 | 开启 | 防睡眠和低电量保护 || 防睡眠上限 | 达到时长上限并成功恢复系统睡眠 | 开启 | 防睡眠和有限时长上限 |-| 异常会话保护 | 运行中任务持续无进展,达到保护阈值 | 固定行为 | CodexBar Hook 和防睡眠主开关 |+| 异常会话保护 | 运行中任务持续无进展,达到保护阈值 | 固定行为 | 进阶模式和防睡眠主开关 |异常会话保护没有独立通知开关,使用系统默认声音。@@ -70,7 +70,7 @@`任务触觉反馈` 默认关闭。开启后,任务完成或进入等待批准时会触发触摸板震动。-触觉反馈不依赖 macOS 通知授权,但仍然服从 CodexBar 的系统通知总开关和 CodexBar Hook 状态。+触觉反馈不依赖 macOS 通知授权,但仍然服从 CodexBar 的系统通知总开关和进阶模式状态。## Codex TUI 通知@@ -83,4 +83,4 @@- 任务不再等待批准时,对应等待通知会从通知中心撤回- 任务恢复进展或不再符合异常会话保护条件时,对应通知会从通知中心撤回-返回 [用户指南](README.md)+返回 [用户指南](../README.md#用户指南)diff --git a/Docs/UserGuide/settings.md b/Docs/UserGuide/settings.mdindex b9d0c9e..c12d494 100644--- a/Docs/UserGuide/settings.md+++ b/Docs/UserGuide/settings.md@@ -8,7 +8,7 @@| 设置 | 作用 | 默认或初始状态 || --- | --- | --- |-| 主面板布局 | 调整账户、任务、额度、用量和状态的顺序与显隐 | 全部显示;Hook 关闭时任务区域关闭 |+| 主面板布局 | 调整账户、任务、额度、用量和状态的顺序与显隐 | 全部显示;进阶模式关闭时任务区域关闭 || 动画效果 | 控制额度条和热力图入场动画、太阳徽标旋转,以及活动卡片和任务中心的状态文字动画 | 开启 || 流光效果 | 在各显示器顶部用颜色显示任务状态 | 关闭 || 开机自动启动 | 登录 Mac 后启动 CodexBar | 跟随系统登录项状态 |@@ -20,11 +20,11 @@点击右侧选项按钮后,可拖动排序或切换区域开关,至少保留一个区域。使用 `⌘Z` 撤销、`⌘⇧Z` 重做。隐藏区域不会停止相关功能。-Hook 关闭时任务区域自动关闭,从关闭切换到开启时自动显示。开启后仍可手动隐藏任务区域,重启 App 会保留这一选择。如果任务是唯一可见区域,关闭 Hook 时账户区域会自动开启。+进阶模式关闭时任务区域自动关闭,从关闭切换到开启时自动显示。开启后仍可手动隐藏任务区域,重启 App 会保留这一选择。如果任务是唯一可见区域,关闭进阶模式时账户区域会自动开启。### 流光效果-在各显示器顶部显示任务状态,需要 CodexBar Hook 开启且校验通过。此开关默认关闭,与主面板的“动画效果”独立。开启后,点击右侧选项按钮可调整各状态颜色、动画速度、亮度和结束时长。+在各显示器顶部显示任务状态,需要进阶模式开启且校验通过。此开关默认关闭,与主面板的“动画效果”独立。开启后,点击右侧选项按钮可调整各状态颜色、动画速度、亮度和结束时长。开启时按当前运行颜色、速度和亮度播放一次往返预览,随后显示实际任务状态。关闭时光带快速收回到屏幕中心并淡出,收尾完成前再次开启不会重播开启预览。@@ -41,7 +41,7 @@ Hook 关闭时任务区域自动关闭,从关闭切换到开启时自动显示并发任务中有任务结束时,短暂显示完成或终止提示,再恢复当前任务状态。全部任务结束后,从最新记录的结束时间起,按所选“结束时长”显示提示;可选 3、5、10、15、30 或 60 秒,默认 10 秒。预览期间继续接收任务更新,结束提示暂停计时。恢复时按最新任务状态展示,已有结束提示继续剩余时长,预览期间产生的结束提示按完整时长显示。-Hook 不可用时隐藏光带并保留开关选择。系统睡眠、屏幕休眠或用户会话不活跃时也会隐藏;恢复后显示当前状态,已过期的结束提示不会重播。+进阶模式不可用时隐藏光带并保留开关选择。系统睡眠、屏幕休眠或用户会话不活跃时也会隐藏;恢复后显示当前状态,已过期的结束提示不会重播。### 菜单栏额度指示@@ -55,15 +55,20 @@ Hook 不可用时隐藏光带并保留开关选择。系统睡眠、屏幕休眠| 设置 | 作用 | 默认状态 || --- | --- | --- |-| 代理 | 配置 CodexBar 的 Codex 服务连接代理 | 关闭 |-| [CodexBar Hook](activity-and-hook.md) | 启用实时任务和每日活动统计 | 未安装时关闭 |+| [进阶模式](advanced-mode.md) | 启用实时任务和每日活动统计 | 未安装时关闭 || [系统通知](notifications.md) | 配置通知类型、阈值、音效和触觉反馈 | 总开关关闭 || 自动重置 | 提前使用即将过期的留存重置 | 关闭,提前 30 分钟 || [防止系统睡眠](sleep-prevention.md) | 在符合条件的任务运行时保持 Mac 唤醒 | 关闭 || [跨设备同步](sync-data-privacy.md) | 通过 iCloud 合并每日活动统计和会话 Token 用量 | 关闭 |+| 网络代理 | 配置 CodexBar 的 Codex 服务连接代理 | 关闭 |+| 数据更新间隔 | 设置账户、额度及其附带历史维护和同步的自动更新间隔 | 1 分钟 || [重建数据](sync-data-privacy.md#重建数据) | 在后台重新计算所选日期的活动统计和会话 Token 用量 | 手动操作 |-### 代理+### 数据更新间隔++可选 1、2、3、5 或 10 分钟,默认 1 分钟,保存在本机。间隔从上一轮刷新结果提交时开始计算;修改后立即重新计算剩余等待时间,已经到期时尽快刷新。手动刷新会重置倒计时,实时任务监控不受此设置影响。++### 网络代理点击设置行打开配置,填写服务器地址和端口。支持 HTTP、HTTPS、域名、IPv4 和 IPv6;端口范围为 `1~65535`。开启身份验证后用户名必填,密码可留空。@@ -119,4 +124,4 @@ CodexBar Helper 状态始终显示在关于页面,不受自动重置和防睡发现组件异常时,即使之前已授权,也会显示“不可用”。处理方式见 [CodexBarHelper 无法注册](troubleshooting.md#codexbarhelper-无法注册)-返回 [用户指南](README.md)+返回 [用户指南](../README.md#用户指南)diff --git a/Docs/UserGuide/sleep-prevention.md b/Docs/UserGuide/sleep-prevention.mdindex 6523d8f..b95939e 100644--- a/Docs/UserGuide/sleep-prevention.md+++ b/Docs/UserGuide/sleep-prevention.md@@ -6,7 +6,7 @@ CodexBar 可以在任务运行时保持 Mac 唤醒,任务结束或保护条件## 开启与生效条件-1. 在 `设置 > 高级` 开启 CodexBar Hook+1. 在 `设置 > 高级` 开启进阶模式2. 开启 `防止系统睡眠` 并确认3. 如需后台授权,点击 `打开系统设置` 并允许 CodexBar 后台运行@@ -60,4 +60,4 @@ CodexBarHelper 是随 App 安装的后台服务,负责系统睡眠控制。未正常退出前,CodexBar 会恢复自己管理的睡眠状态并取消自动重置唤醒计划。退出未完成时,请查看设置页的后台服务错误。-返回 [用户指南](README.md)+返回 [用户指南](../README.md#用户指南)diff --git a/Docs/UserGuide/sync-data-privacy.md b/Docs/UserGuide/sync-data-privacy.mdindex 6771fb2..273dca2 100644--- a/Docs/UserGuide/sync-data-privacy.md+++ b/Docs/UserGuide/sync-data-privacy.md@@ -4,13 +4,13 @@## 跨设备同步-在 `设置 > 高级` 开启 `跨设备同步`,可以合并同一 iCloud 账户下多台 Mac 的每日 Hook 统计和 rollout Token 用量。需要先开启 CodexBar Hook,并登录可用的 iCloud 账户。+在 `设置 > 高级` 开启 `跨设备同步`,可以合并同一 iCloud 账户下多台 Mac 的每日 Hook 统计和 rollout Token 用量。需要先开启进阶模式,并登录可用的 iCloud 账户。首次开启会上传本机保留期内的统计,之后自动同步变化。关闭同步会保留本机数据。| 状态 | 含义 || --- | --- |-| 同步未开启 | 同步开关或 CodexBar Hook 已关闭 |+| 同步未开启 | 同步开关或进阶模式已关闭 || 正在同步 | 正在传输数据 || 已同步 | 最近一轮同步成功 || 同步失败 | 网络、iCloud 账户或服务暂时不可用,稍后重试 |@@ -76,4 +76,4 @@ App 在历史统计刷新时自动读取本机 Codex 的 rollout,逐步补全交互日志可能包含账户和请求响应内容,退出 App 后清除。分享日志前,请检查其中是否有不希望公开的信息。-返回 [用户指南](README.md)+返回 [用户指南](../README.md#用户指南)diff --git a/Docs/UserGuide/troubleshooting.md b/Docs/UserGuide/troubleshooting.mdindex 349c41b..5bf89cd 100644--- a/Docs/UserGuide/troubleshooting.md+++ b/Docs/UserGuide/troubleshooting.md@@ -24,7 +24,7 @@## 代理配置或连接失败-在 `设置 > 高级 > 代理` 中打开配置,使用 `测试连接` 检查。服务器地址和端口必填,开启身份验证后用户名必填;输入问题会标红并显示简短原因。+在 `设置 > 高级 > 网络代理` 中打开配置,使用 `测试连接` 检查。服务器地址和端口必填,开启身份验证后用户名必填;输入问题会标红并显示简短原因。- 关于页面提示服务器或用户名无效时,修正后保存,或关闭代理开关- 配置无法读取时,在配置窗口右上角 `⋯ > 删除配置` 删除损坏数据@@ -37,15 +37,18 @@双击账户图标重试;持续变淡时,在关于页面查看连接错误或打开日志。-## Hook 无法开启或校验失败+<a id="hook-无法开启或校验失败"></a>++## 进阶模式无法开启或校验失败| 提示 | 处理方法 || --- | --- || 需要更高 Codex 版本 | 更新 Codex 后在关于页面点击 `重新建立连接` |+| 无法确认 Codex 版本 | 在关于页面确认来源可用,点击 `重新建立连接` 后重试 || Codex Hook 已全局关闭 | 在 Codex 配置中重新开启 `features.hooks` |-| CodexBar Hook 已不完整 | 重新打开设置等待自动修复,仍未恢复时关闭后重新开启 Hook |-| CodexBar Hook 未被信任 | 重新开启 Hook,并检查 Codex 的信任提示 |-| CodexBar Hook 意外来源 | 确认当前 Codex 来源和 `CODEX_HOME` 指向预期位置 |+| 进阶模式的 Hook 配置不完整 | 重新打开设置等待自动修复,仍未恢复时关闭后重新开启进阶模式 |+| 进阶模式的 Hook 未被信任 | 重新开启进阶模式,并检查 Codex 的信任提示 |+| 进阶模式的 Hook 来源异常 | 确认当前 Codex 来源和 `CODEX_HOME` 指向预期位置 || `hooks.json` 文件格式错误 | 修复该文件的 JSON 格式后重试 || 无法验证 Codex Hook | 等 Codex 连接恢复后重新打开设置 |@@ -53,7 +56,7 @@## 实时任务没有出现-1. 确认 CodexBar Hook 已开启且没有错误提示+1. 确认进阶模式已开启且没有错误提示2. 确认 `通用 > 主面板布局` 中的 `任务` 区域已开启3. 新建一轮 Codex 任务以产生实时事件4. 打开设置窗口触发一次 Hook 重新校验@@ -67,7 +70,7 @@1. `系统通知` 总开关是否开启2. macOS 是否允许 CodexBar 发送通知3. 对应通知子开关是否开启-4. 任务类通知所需的 CodexBar Hook 是否有效+4. 任务类通知所需的进阶模式是否有效5. 任务完成时长是否达到所选阈值6. 通知音效是否选择了静音@@ -77,7 +80,7 @@按以下顺序检查:-1. CodexBar Hook 是否有效+1. 进阶模式是否有效2. `防止系统睡眠` 是否开启3. 当前是否存在运行中任务4. 只有等待任务时,`等待批准时保持防睡眠` 是否开启@@ -115,7 +118,7 @@- 确认 Mac 已登录 iCloud- 确认 iCloud Drive 和 CloudKit 服务当前可用-- 确认 CodexBar Hook 已开启+- 确认进阶模式已开启- 确认 `跨设备同步` 开关已开启- 将鼠标悬停在主面板底部 iCloud 图标上查看具体状态@@ -142,4 +145,4 @@提交问题时说明复现步骤、CodexBar 与 Codex 版本、可见错误。交互日志可能包含账户和请求内容,分享前请检查隐私信息。-返回 [用户指南](README.md)+返回 [用户指南](../README.md#用户指南)diff --git a/Docs/en/DeveloperGuide/app-server.md b/Docs/en/DeveloperGuide/app-server.mdindex 286af60..8d36f38 100644--- a/Docs/en/DeveloperGuide/app-server.md+++ b/Docs/en/DeveloperGuide/app-server.md@@ -180,13 +180,9 @@ Writing after an early process exit may raise `SIGPIPE`. The service ignores tha| `hooks/list` | Validate Hook source and event capabilities || `config/batchWrite` | Change Hook or TUI notification configuration |-Each session caches unsupported methods. After app-server explicitly returns method unsupported, that connection does not request the method again.-### Session Capability Cache-Method unsupported usually means the running app-server lacks a capability. Calling it again every minute only adds logs and latency.--The conclusion must not persist to UserDefaults, however, because a new connection may come from an upgraded binary. The unsupported set belongs only to `AppServerSession` and is probed again after reconstruction.+`AppServerSession` caches methods for which app-server explicitly returns method unsupported and skips them for the rest of that connection. The cache exists only in memory; capabilities are probed again after the connection is rebuilt.## Session Lifecycle@@ -241,7 +237,7 @@ One refresh reads account, rate limits, and usage; Reset Credits details are inc## Refresh Model-The status view model refreshes every 60 seconds by default. Users can double-click the account icon in the main panel to request an immediate refresh.+The status view model refreshes at the selected data update interval of 1, 2, 3, 5, or 10 minutes, defaulting to 1 minute. Users can double-click the account icon in the main panel to request an immediate refresh.Each refresh resolves the account first, then reads rate limits and usage. Supplemental caches are strictly bound to account identity:@@ -412,7 +408,7 @@ Hook settings reuse the app-server flow but maintain independent availability st- `isOperable` is true only when both are `true`- A transient RPC failure preserves the last explicit validation result-Enabling or validating Hook requires the actual app-server version to be at least `0.150.0`.+Enabling or validating Hook requires the actual app-server version to be at least `0.153.0`.See [Hook Capture and Historical Aggregation](hook-and-aggregation.md) for the full configuration flow.@@ -450,11 +446,11 @@ Reset Credits details include opaque credit IDs. Unified logs must not record ID- A transport failure on a reused connection rebuilds only once- After an on-disk CLI upgrade, the current connection version remains distinct from the disk version- app-server below `0.145.0` blocks the primary account flow and asks for an upgrade-- app-server from `0.145.0` up to but excluding `0.150.0` supports the primary account flow while Hook still requires `0.150.0`-- app-server `0.150.0` or later supports both the account flow and Hook validation+- app-server from `0.145.0` up to but excluding `0.153.0` supports the primary account flow while Hook still requires `0.153.0`+- app-server `0.153.0` or later supports both the account flow and Hook validation- A failed rate-limit read with same-account cache displays stale data without triggering notifications- An account switch clears old rate-limit and usage data immediately-- An unsupported method is not retried every minute+- An unsupported method is not retried within the same connection- Reset Credits with `credits == nil` preserve the authoritative count and show unknown expiration- Empty or truncated Reset Credits details do not redefine the available count from array length- Expired or non-available Reset Credits do not enter details or notifications@@ -471,7 +467,8 @@ Reset Credits details include opaque credit IDs. Unified logs must not record ID- Count-only or failed reads with no specific target do not schedule a query-retry wake event- A known target stops continuous retries 5 minutes after the near-expiration trigger; a later normal refresh may start a new round- A full rate-limit refresh after redemption is not dropped behind a concurrent ordinary refresh-- The 60-second countdown realigns after manual refresh+- The countdown realigns to the selected data update interval after manual refresh+- Changing the interval during an automatic-refresh wait reschedules it from the last committed result; in-flight requests continue, and the selected interval is restored after restartingProxy checks also cover disabling invalid settings, clearing corrupt records, isolating canceled test results, submitting only once during rapid toggles, rolling back failed commits, and replacing usernames and passwords in plain and JSON-escaped URLs with `<redacted>`.diff --git a/Docs/en/DeveloperGuide/architecture.md b/Docs/en/DeveloperGuide/architecture.mdindex 388b13b..46d9fee 100644--- a/Docs/en/DeveloperGuide/architecture.md+++ b/Docs/en/DeveloperGuide/architecture.md@@ -91,7 +91,7 @@ In normal mode, `CodexBarAppDelegate` creates and owns long-lived objects, inclu- `CodexStatusService` and `CodexStatusViewModel`- `CodexProxySettings`- `WorkflowService` and its view model-- `CodexHookSettings`+- `AdvancedModeSettings`- `CodexActivityMonitor`- `KeepAliveController`- `AutoResetController`@@ -149,7 +149,7 @@ Arrows show the direction in which data or read-only state is consumed. A downst### Shared Refresh Triggers-Historical maintenance normally runs after the 60-second rate-limit refresh to reduce resident timers and log noise. The flows share scheduling, not facts.+Historical maintenance runs after rate-limit refreshes at the selected data update interval, defaulting to 1 minute, to reduce resident timers and log noise. The flows share scheduling, not facts.When changing refresh timing, distinguish among these constraints:@@ -240,7 +240,7 @@ Before changing one time window, check for paired invariants. For example, the t| Main-panel account loading state | `CodexStatusViewModel` | Observe published values || Automatic Reset target, deadline, and retries | `AutoResetController` | Settings changes only the switch and lead time || Automatic Reset wake-time synchronization | `AutoResetWakeScheduler` | `AutoResetController` submits only the next time; `KeepAliveController` submits only helper readiness |-| Hook installation and validation | `CodexHookSettings` | Read `isOperable` |+| Hook installation and validation | `AdvancedModeSettings` | Read `isOperable` || Historical aggregation and maintenance cursor | `WorkflowService` | Request snapshots or rebuilds || Live tasks | `CodexActivityMonitor` | Read snapshots, notification transitions, or presentation updates containing new terminal events || Sync cursors and remote cache | `WorkflowSyncService` | Request merged snapshots |@@ -264,7 +264,7 @@ When adding a consumer, subscribe to an existing snapshot first. If it lacks a f| Error class | Typical handling | Incorrect handling || --- | --- | --- |-| Explicitly unsupported capability | Cache method unsupported and show the source as unavailable | Retry every minute or display `0` |+| Explicitly unsupported capability | Cache method unsupported and show the source as unavailable | Retry within the same connection or display `0` || Transient business failure | Use stale cache scoped to the same account | Clear the entire account snapshot || Transport failure | Discard the connection and rebuild it at most once | Continue sending requests over an untrusted pipe || Data-source identity change | Start a new generation and rebuild from the raw source | Continue appending from the old offset |diff --git a/Docs/en/DeveloperGuide/data-and-privacy.md b/Docs/en/DeveloperGuide/data-and-privacy.mdindex 5b3d84f..6072575 100644--- a/Docs/en/DeveloperGuide/data-and-privacy.md+++ b/Docs/en/DeveloperGuide/data-and-privacy.md@@ -79,7 +79,7 @@ The Hook subprocess extracts from stdin:The Hook subprocess extracts origin from the first rollout `session_meta`, using either the complete record or a prefix of completed fields. Reads use 32 KiB chunks with a total limit of 256 KiB. JSONL persists only the normalized `main`, `autoReview`, `auxiliary`, or `unknown` value. See [Origin Normalization](hook-and-aggregation.md#origin-normalization) for classification and model fallback rules.-It does not write prompt text, responses, tool arguments, or tool output to CodexBar Hook files.+It does not write prompt text, responses, tool arguments, or tool output to the Hook event files maintained by CodexBar.The working directory is used only to derive a project display name and live-task ownership. Raw Hook JSONL may still include `cwd`, making it sensitive local context subject to retention and file-permission limits. Rollout paths, raw source values, and arbitrary subagent `other` values are not persisted. CloudKit uploads only derived project-name counts and only after explicit opt-in.@@ -156,6 +156,7 @@ Debug and Release share the token ledger and sync cache. Each `store.lock` proteUserDefaults stores:- Feature switches and options+- Data update interval (`DataUpdate.intervalSeconds`, in seconds)- Notification thresholds and sound names- Global shortcut- Proxy enabled state, protocol, server, port, authentication username, and passworddiff --git a/Docs/en/DeveloperGuide/design-decisions.md b/Docs/en/DeveloperGuide/design-decisions.mdindex 6fa911d..c6b3de5 100644--- a/Docs/en/DeveloperGuide/design-decisions.md+++ b/Docs/en/DeveloperGuide/design-decisions.md@@ -18,7 +18,7 @@ Snapshots can be read repeatedly. Notifications use live transitions; bootstrapA saved switch expresses intent, dependencies determine whether execution is possible, and result state expresses a confirmed effect. Temporary dependency failures preserve the user’s switch and reconcile again on recovery.-Sleep prevention represents these layers with `isEnabled`, `sleepBlockReason`, and `isPreventingSleep`. Hook combines `isEnabled` and `isVerified` into `isOperable`; live tasks require operability, while historical aggregation can still process recorded data.+Sleep prevention represents these layers with `isEnabled`, `sleepBlockReason`, and `isPreventingSleep`. `AdvancedModeSettings` combines `isEnabled` and `isVerified` into `isOperable`; live tasks require operability, while historical aggregation can still process recorded data.## Missing, Stale, and Untrusted Datadiff --git a/Docs/en/DeveloperGuide/development.md b/Docs/en/DeveloperGuide/development.mdindex 801108b..812306a 100644--- a/Docs/en/DeveloperGuide/development.md+++ b/Docs/en/DeveloperGuide/development.md@@ -46,7 +46,7 @@ Unit tests do not cover live CloudKit, app-server, system notifications, window| Feature | Main location | Implementation guide || --- | --- | --- || app-server, proxy, Automatic Reset | `Services/CodexStatus` and corresponding Settings | [app-server Data Flow](app-server.md) |-| Hook installation and statistics | `CodexHookSettings`, `WorkflowService`, aggregate models | [Hook Collection and Aggregation](hook-and-aggregation.md) |+| Hook installation and statistics | `AdvancedModeSettings`, `WorkflowService`, aggregate models | [Hook Collection and Aggregation](hook-and-aggregation.md) || Live tasks and protection | `CodexActivityMonitor` and readers | [Live Task Monitoring](activity-monitor.md) || Sleep prevention and system wakes | `KeepAliveController`, `AutoResetWakeScheduler`, helper | [Sleep Prevention](sleep-prevention.md) || Notifications and sound | `CodexNotificationService`, notification Settings | [Notifications](notifications.md) |diff --git a/Docs/en/DeveloperGuide/hook-and-aggregation.md b/Docs/en/DeveloperGuide/hook-and-aggregation.mdindex d52b7cf..758673e 100644--- a/Docs/en/DeveloperGuide/hook-and-aggregation.md+++ b/Docs/en/DeveloperGuide/hook-and-aggregation.md@@ -19,12 +19,12 @@ Raw events are the fact source; daily aggregation is a rebuildable cache. A chan## Installation and Validation-[`CodexHookSettings.swift`](../../../CodexBar/Services/Settings/CodexHookSettings.swift) reads and writes local `hooks.json` directly, reads or updates related configuration through app-server, and calls `hooks/list` after writing to validate installation.+[`AdvancedModeSettings.swift`](../../../CodexBar/Services/Settings/AdvancedModeSettings.swift) reads and writes local `hooks.json` directly, reads or updates related configuration through app-server, and calls `hooks/list` after writing to validate installation.The enable flow checks the following conditions, validating source, trust, and event completeness after writing:- A resolvable current executable path-- Actual app-server version `0.150.0` or later+- Actual app-server version `0.153.0` or later- Available `features.hooks`- A trusted source returned by `hooks/list`- A complete required event set@@ -47,7 +47,7 @@ A handler in `hooks.json` does not prove Codex will execute it. `isOperable` com### Reconciliation of an Enabled Hook-An enabled Hook is reconciled at app launch, when Settings refreshes, when the main panel opens, and after each quota refresh. Automatic refresh waits 60 seconds after the previous round completes:+An enabled Hook is reconciled at app launch, when Settings refreshes, when the main panel opens, and after each quota refresh. Automatic refresh waits for the selected data update interval after the previous round completes, defaulting to 1 minute:- Only a confirmed running app-server version below the current Hook minimum triggers removal of CodexBar handlers and best-effort cleanup of matching trust entries; versions below the global minimum also trigger local removal- An unknown version or transient RPC failure preserves the user's configuration@@ -61,7 +61,7 @@ Reconciliation compares the required event set with the configuration and restor### Enable Transaction Order```text-Confirm running app-server >= 0.150.0+Confirm running app-server >= 0.153.0-> Confirm features.hooks is not globally disabled-> Read existing hooks.json-> Remove only old CodexBar handlers for this executable@@ -90,7 +90,7 @@ Removal skips malformed sibling entries and processes only precisely identified### Generations for Asynchronous Settings Operations-When the user toggles Hook or validation is triggered, `CodexHookSettings` starts the operation through `updateCoordinator`. Its `RefreshTaskCoordinator` advances the generation and cancels the previous task.+When the user toggles Advanced Mode or validation is triggered, `AdvancedModeSettings` starts the operation through `updateCoordinator`. Its `RefreshTaskCoordinator` advances the generation and cancels the previous task.After every file write or RPC `await`, it checks the generation again. Even if an old operation cannot truly be canceled, it cannot overwrite the latest switch state or error.@@ -117,7 +117,7 @@ CodexBar subscribes to:Historical counts need event name, date, project, model, and identity sets. Live state additionally needs turn, reviewer, effort, tool, agent relationships, and normalized origin.-One minimal raw record lets the recorder write once while both consumers select their fields. A new field still requires a demonstrated consumer; its presence in the Hook payload does not justify persisting everything.+The recorder writes the fields needed by both data flows into one raw record. Historical aggregation and live monitoring each read the fields they use.The recorder performs a bounded read of the rollout's first line to classify origin. Ordinary events use `transcript_path`; `SubagentStop` uses `agent_transcript_path`, which points to the child thread itself. If the rollout origin cannot be determined, only an exact `codex-auto-review` model match serves as the Auto-review fallback. Reviewer or effort for `PermissionRequest` and `UserPromptSubmit` may be absent from the Hook payload, so only those two events also read the rollout tail for that turn.@@ -430,8 +430,6 @@ Maintenance coordinates with the rate-limit refresh cycle but has no data depend### Maintenance Logs-Maintenance normally follows the 60-second refresh. An idle machine would otherwise emit more than a thousand no-change checks per day.-`WorkflowService` accumulates consecutive idle cycles and emits a summary on a write, skip, failure, or cleanup, including the accumulated idle count.### How the Scheduler Coalesces Requests@@ -457,7 +455,7 @@ Opening the UI reads the current local snapshot and does not bypass the schedule- Appends during build commit only to the fixed upper bound and leave the tail pending- A schema change rebuilds every in-retention date with the current algorithm- Missing historical fields remain optional in decoding and persistence; display counts follow the current fallback rules-- Disabling CodexBar Hook preserves user handlers and trust entries+- Disabling Advanced Mode preserves user handlers and trust entries- During rapid Hook toggling, old RPC results cannot overwrite the final operation## Failure Boundaries@@ -471,7 +469,7 @@ Opening the UI reads the current local snapshot and does not bypass the schedule## Key Source Files-- [`CodexHookSettings.swift`](../../../CodexBar/Services/Settings/CodexHookSettings.swift)+- [`AdvancedModeSettings.swift`](../../../CodexBar/Services/Settings/AdvancedModeSettings.swift)- [`WorkflowHookEventRecorder.swift`](../../../CodexBar/Services/Workflow/WorkflowHookEventRecorder.swift)- [`CodexHookEvent.swift`](../../../CodexBar/Models/CodexHookEvent.swift)- [`JSONLines.swift`](../../../CodexBar/Services/Workflow/JSONLines.swift)diff --git a/Docs/en/DeveloperGuide/sleep-prevention.md b/Docs/en/DeveloperGuide/sleep-prevention.mdindex dc7c7dd..1b2febc 100644--- a/Docs/en/DeveloperGuide/sleep-prevention.md+++ b/Docs/en/DeveloperGuide/sleep-prevention.md@@ -105,7 +105,7 @@ Both app and helper use monotonically increasing generations:[`KeepAliveController.swift`](../../../CodexBar/Services/KeepAlive/KeepAliveController.swift) establishes sleep prevention only when all conditions hold:- Prevent System Sleep is enabled-- Hook’s `isOperable` is `true`+- `AdvancedModeSettings.isOperable` is `true`- At least one live task qualifies under settings- CodexBarHelper is installed and connectable- The low-battery threshold is not active@@ -122,7 +122,7 @@ The controller publishes an explicit blocking reason:| --- | --- || `notStarted` | Service has not started || `userOff` | User turned off the master switch |-| `hookDisabled` | Hook is not operational |+| `advancedModeDisabled` | Hook is not operational || `noTasks` | No task qualifies || `helperUnavailable` | CodexBarHelper is not installed or connectable || `helperRefreshing` | CodexBarHelper state is recovering or being confirmed |diff --git a/Docs/en/DeveloperGuide/sync.md b/Docs/en/DeveloperGuide/sync.mdindex 6c845db..196c892 100644--- a/Docs/en/DeveloperGuide/sync.md+++ b/Docs/en/DeveloperGuide/sync.md@@ -55,7 +55,7 @@ Zone confirmation and account salt are cached in the actor across cycles. Sync fSync runs only when all conditions hold:- The user enabled CloudKit sync-- `CodexHookSettings.isEnabled` is `true`; historical sync can consume aggregates already stored locally+- `AdvancedModeSettings.isEnabled` is `true`; historical sync can consume aggregates already stored locally- The current iCloud account is available- The local aggregation service is availablediff --git a/Docs/en/DeveloperGuide/ui-and-lifecycle.md b/Docs/en/DeveloperGuide/ui-and-lifecycle.mdindex 6723539..a237717 100644--- a/Docs/en/DeveloperGuide/ui-and-lifecycle.md+++ b/Docs/en/DeveloperGuide/ui-and-lifecycle.md@@ -47,7 +47,7 @@ Shutdown reverses the order, except for helper-owned system state. AppDelegate f## Task Glow-`TaskGlowController` presents activity while both `TaskGlowSettings.isEnabled` and Hook's `isOperable` are `true`, independently of the main panel's animation setting. It consumes snapshots and terminal events from `CodexActivityMonitor.presentationPublisher`; see [Presentation Updates](activity-monitor.md#presentation-updates).+`TaskGlowController` presents activity while both `TaskGlowSettings.isEnabled` and `AdvancedModeSettings.isOperable` are `true`, independently of the main panel's animation setting. It consumes snapshots and terminal events from `CodexActivityMonitor.presentationPublisher`; see [Presentation Updates](activity-monitor.md#presentation-updates).| Scenario | Presentation rule || --- | --- |@@ -57,7 +57,7 @@ Shutdown reverses the order, except for helper-owned system state. AppDelegate f`TaskGlowSettings.appearance` supplies colors, speed, brightness, and end duration. The default colors are cyan for running, orange for approval waiting, green for completion, and red for termination. Termination takes priority on equal end times. Durations include entrance animations. The latest snapshot determines the state after expiration.-Switching the setting from off to on while Hook is available sends a `TaskGlowSettings.previewRequests` event for one running preview using the current appearance settings. After one round trip, presentation returns to the actual state. Startup and settings refresh restore the switch value without requesting a preview.+Switching the setting from off to on while Advanced Mode is available sends a `TaskGlowSettings.previewRequests` event for one running preview using the current appearance settings. After one round trip, presentation returns to the actual state. Startup and settings refresh restore the switch value without requesting a preview.Double-clicking a color swatch in the settings panel requests a preview of that state: running shows a moving glow, approval waiting pulses, and completion and termination appear briefly before fading. Color previews can replace a playing preview; closing the settings child panel ends only color previews. Requests for the preview triggered by enabling the feature are ignored while a preview or window dismissal is in progress.@@ -209,7 +209,7 @@ The heatmap detail panel uses the complete heatmap area, including its heading,While the main panel is visible, digits roll as values change and Token values fade when switching to or from pending or unavailable placeholders. Animation Effects controls entrance animations, sun-badge rotation, and task status-text animations; it does not control numeric updates.-With Hook enabled, heatmap details group activity statistics and session tokens alongside a usage intensity bar. Each group uses a `Grid` to align labels and values. Date changes use the same `numericText` transition for token and activity values. The most-used model transitions within one text view and scales its font to fit.+With Advanced Mode enabled, heatmap details group activity statistics and session tokens alongside a usage intensity bar. Each group uses a `Grid` to align labels and values. Date changes use the same `numericText` transition for token and activity values. The most-used model transitions within one text view and scales its font to fit.The shared `LiquidGlassDivider` slowly moves a silver-gray and cool-white gradient in a repeating cycle. It pauses or resumes its timeline using its `NSView` window visibility, independently of Animation Effects.@@ -250,14 +250,14 @@ When Automatic Reset or Prevent System Sleep changes from off to on, `AppSettingEach secondary-settings entry uses its own availability decision:- Main Panel Layout is always available-- Task Glow requires `TaskGlowSettings.isEnabled` and Hook's `isOperable` to be `true`, with no Hook update in progress+- Task Glow requires `TaskGlowSettings.isEnabled` and `AdvancedModeSettings.isOperable` to be `true`, with no Advanced Mode update in progress- Notifications reads `NotificationSettings.canShowOptions`- Automatic Reset requires `AutoResetSettings.isEnabled` and `KeepAliveController.helperStatus == .enabled`- Sleep prevention reads `KeepAliveController.canShowOptions`When a condition becomes false, Settings sends the corresponding `close` action so an unavailable child panel does not remain visible. Automatic Reset and sleep-prevention rows show no status explanation while their main switches are off.-`MainPanelSettings` stores the order and visibility of Account, Task Center, Quota, Token Usage, and Footer Status with stable section identifiers. Layout normalization removes duplicates, ignores invalid values, appends missing sections, and keeps at least one section visible. After reading a disabled Hook state, `StatusItemController` calls `updateHookEnabled(_:)` to persist Task Center as hidden. If Task Center was the only visible section, Account is enabled at the same time. Switching Hook from off to on automatically shows Task Center; initial restoration of an enabled Hook and repeated enabled notifications preserve the saved layout. The settings panel disables only the Task Center switch, so its drag handle remains available. Temporary availability of other data sources affects only the current rendering.+`MainPanelSettings` stores the order and visibility of Account, Task Center, Quota, Token Usage, and Footer Status with stable section identifiers. Layout normalization removes duplicates, ignores invalid values, appends missing sections, and keeps at least one section visible. After reading a disabled Hook state, `StatusItemController` calls `updateAdvancedModeEnabled(_:)` to persist Task Center as hidden. If Task Center was the only visible section, Account is enabled at the same time. Switching Hook from off to on automatically shows Task Center; initial restoration of an enabled Hook and repeated enabled notifications preserve the saved layout. The settings panel disables only the Task Center switch, so its drag handle remains available. Temporary availability of other data sources affects only the current rendering.Layout sorting uses a custom `DragGesture` on the handle. A floating copy follows the pointer, other rows move as the drag position changes, and releasing calls `setSectionOrder(_:)` once to persist the final order.@@ -297,13 +297,13 @@ Registration uses try-before-swap:## Automatic Refresh and Panel Opening-App-server state is checked for refresh every 60 seconds by default. Once the main panel's fade-in finishes and the panel is still visible, `refreshIfNeeded` requests data if no countdown origin exists or more than 60 seconds have passed since the last refresh result was committed. Both successful and failed results reset the countdown.+App-server state refreshes at the selected data update interval: 1, 2, 3, 5, or 10 minutes, defaulting to 1 minute. Once the main panel's fade-in finishes and the panel is still visible, `refreshIfNeeded` requests data if no countdown origin exists or the selected interval has elapsed. Both successful and failed results reset the countdown. Changing the interval reschedules the wait without canceling an in-flight request.The main panel shows a refresh countdown. Double-clicking the account icon requests an immediate manual refresh.Ordinary refreshes are ignored while a refresh or reconnect is in progress. Operations requiring a follow-up use `refreshAfterCurrent` to retain one pending trigger and run it after the current request finishes.-The fade-in completion callback triggers Hook configuration reconciliation, a local-statistics refresh check when Hook is enabled, and an account, rate-limit, and usage refresh check in that order. Closing the panel before fade-in finishes cancels the completion task and its pending refresh work.+The fade-in completion callback triggers Hook configuration reconciliation, a local-statistics refresh check when Advanced Mode is enabled, and an account, rate-limit, and usage refresh check in that order. Closing the panel before fade-in finishes cancels the completion task and its pending refresh work.## Localization and Formattingdiff --git a/Docs/en/README.md b/Docs/en/README.mdindex 3ac3de5..755d036 100644--- a/Docs/en/README.md+++ b/Docs/en/README.md@@ -6,7 +6,7 @@- [Installation and Quick Start](UserGuide/getting-started.md)- [Main Panel and Menu Bar](UserGuide/main-panel.md)-- [Live Tasks and CodexBar Hook](UserGuide/activity-and-hook.md)+- [Live Tasks and Advanced Mode](UserGuide/advanced-mode.md)- [Notifications and Alerts](UserGuide/notifications.md)- [Prevent System Sleep](UserGuide/sleep-prevention.md)- [Data, Sync, and Privacy](UserGuide/sync-data-privacy.md)diff --git a/Docs/en/UserGuide/README.md b/Docs/en/UserGuide/README.mdindex b0e9aed..4c0e05c 100644--- a/Docs/en/UserGuide/README.md+++ b/Docs/en/UserGuide/README.md@@ -1,6 +1,6 @@# CodexBar User Guide-[简体中文](../../UserGuide/README.md) | English+[简体中文](../../README.md#用户指南) | English## Contents@@ -8,7 +8,7 @@| --- | --- || [Installation and Quick Start](getting-started.md) | Requirements, installation, basic controls, and feature dependencies || [Main Panel and Menu Bar](main-panel.md) | Menu bar states, account, rate limits, token heatmap, and Task Center |-| [Live Tasks and CodexBar Hook](activity-and-hook.md) | What the Hook does, how to enable it, task states, and historical metrics |+| [Live Tasks and Advanced Mode](advanced-mode.md) | What Advanced Mode does, how to enable it, task states, and historical metrics || [Notifications and Alerts](notifications.md) | Triggers, defaults, sounds, and haptic feedback for each notification type || [Preventing System Sleep](sleep-prevention.md) | Activation conditions, protection options, CodexBarHelper authorization, and coexistence with external sleep settings || [Data, Sync, and Privacy](sync-data-privacy.md) | Local data, iCloud sync, rebuilding data, and network boundaries |@@ -17,7 +17,7 @@## Common Names-- CodexBar Hook: enables live tasks and daily activity statistics+- Advanced Mode: enables live tasks and daily activity statistics- CodexBarHelper: the included background service for sleep prevention and Automatic Reset wakesBack to the [CodexBar README](../../../README.en.md).diff --git a/Docs/en/UserGuide/activity-and-hook.md b/Docs/en/UserGuide/advanced-mode.mdsimilarity index 74%rename from Docs/en/UserGuide/activity-and-hook.mdrename to Docs/en/UserGuide/advanced-mode.mdindex 3ce63a1..5535d9d 100644--- a/Docs/en/UserGuide/activity-and-hook.md+++ b/Docs/en/UserGuide/advanced-mode.md@@ -1,18 +1,18 @@-# Live Tasks and CodexBar Hook+# Live Tasks and Advanced Mode-[简体中文](../../UserGuide/activity-and-hook.md) | English+[简体中文](../../UserGuide/advanced-mode.md) | English-CodexBar Hook provides live task status, task notifications, haptics, task-based sleep prevention, and daily session, turn, and tool-call statistics. It also enables syncing daily activity statistics and rollout token history. Rebuild Data recalculates both types of retained local history.+Advanced Mode provides live task status, task notifications, haptics, task-based sleep prevention, and daily session, turn, and tool-call statistics. It also enables syncing daily activity statistics and rollout token history. Rebuild Data recalculates both types of retained local history.-## Enable Hook+## Enable Advanced Mode1. Open `Settings > Advanced`-2. Enable `CodexBar Hook` and wait for validation+2. Enable `Advanced Mode` and wait for validation3. Start a Codex task and check its status in the main panel-Hook requires the Codex currently in use to be `0.150.0` or later. If the version warning remains after upgrading, click `Reconnect` in `Settings > About`. For other errors, see [Troubleshooting](troubleshooting.md#codexbar-hook-cannot-be-enabled-or-validated).+Advanced Mode requires the Codex currently in use to be `0.153.0` or later. If the version warning remains after upgrading, click `Reconnect` in `Settings > About`. For other errors, see [Troubleshooting](troubleshooting.md#advanced-mode-cannot-be-enabled-or-validated).-CodexBar automatically checks and repairs enabled Hook configuration, preserving handlers belonging to users and other apps. If Codex is confirmed to be below the minimum version, Hook is disabled and CodexBar removes its handlers; enable Hook again after upgrading Codex. Configuration is retained for the next check if the connection or version is temporarily unavailable.+CodexBar automatically checks and repairs enabled Hook configuration, preserving handlers belonging to users and other apps. If Codex is confirmed to be below the minimum version, Advanced Mode is disabled and CodexBar removes its handlers; enable Advanced Mode again after upgrading Codex. Configuration is retained for the next check if the connection or version is temporarily unavailable.## Task States@@ -41,9 +41,9 @@ Hover over a day in the main-panel heatmap to see sessions, turns, tool calls, pSessions and turns are deduplicated within each day; activity continuing into another day counts toward that day. Sessions with only a session-end event and turns with only completion-candidate or interruption events do not count as active that day. Tool calls use the larger of the start and end event counts.-## Disable Hook+## Disable Advanced Mode-Disabling Hook stops updates to live tasks, task notifications, haptics, sleep prevention, and Hook statistics, and stops cross-device sync for activity and token history. The heatmap hides its history details. Account, quota, and the app-server token heatmap remain available.+Disabling Advanced Mode stops updates to live tasks, task notifications, haptics, sleep prevention, and Hook statistics, and stops cross-device sync for activity and token history. The heatmap hides its history details. Account, quota, and the app-server token heatmap remain available.Hook records task information such as time, model, tool name, and project, without saving prompt, reply, or tool input/output content. See [Data, Sync, and Privacy](sync-data-privacy.md) for retention and sync details.diff --git a/Docs/en/UserGuide/getting-started.md b/Docs/en/UserGuide/getting-started.mdindex 13568fa..3bb60ad 100644--- a/Docs/en/UserGuide/getting-started.md+++ b/Docs/en/UserGuide/getting-started.md@@ -7,7 +7,7 @@- macOS 15.0 or later- [Codex CLI](https://github.com/openai/codex) installed and signed in, or ChatGPT App or Codex App with bundled Codex installed- The Codex currently in use must be `0.145.0` or later-- Hook features require the Codex currently in use to be `0.150.0` or later+- Advanced Mode requires the Codex currently in use to be `0.153.0` or later- Cross-device sync requires an available iCloud account on the MacBy default, CodexBar automatically prefers a globally installed Codex CLI. If it cannot find one, it tries the Codex bundled with ChatGPT App and Codex App. You can select a source under Settings > About > Codex Versions > Source.@@ -34,9 +34,9 @@ CodexBar is a menu bar app, so it does not show an icon in the Dock after launch2. Left-click the icon to open the main panel3. Wait for the initial account and usage refresh to finish4. If the panel says you are not signed in, sign in through the active Codex installation first-5. For live tasks, task notifications, sleep prevention, or Hook metrics, enable CodexBar Hook under `Settings > Advanced`+5. For live tasks, task notifications, sleep prevention, or Hook metrics, enable Advanced Mode under `Settings > Advanced`-CodexBar refreshes account, rate-limit, and token usage data every 60 seconds. Double-click the account icon in the main panel to refresh immediately.+CodexBar refreshes account, rate-limit, and token usage data every minute by default. Choose 1, 2, 3, 5, or 10 minutes under `Settings > Advanced > Data Update Interval`. Double-click the account icon in the main panel to refresh immediately.## Basic Controls@@ -58,7 +58,7 @@ The global shortcut opens the main panel on the screen under the pointer when po## Enable More Features-- [CodexBar Hook](activity-and-hook.md): live tasks, daily activity statistics, and task-based sleep prevention+- [Advanced Mode](advanced-mode.md): live tasks, daily activity statistics, and task-based sleep prevention- [System Notifications](notifications.md): task and quota alerts, requiring macOS notification permission- [Automatic Reset](settings.md#automatic-reset): use banked resets shortly before expiration; may briefly wake your Mac- [Prevent System Sleep](sleep-prevention.md): keep your Mac awake during long tasks, requiring background-service approvaldiff --git a/Docs/en/UserGuide/main-panel.md b/Docs/en/UserGuide/main-panel.mdindex 33a3767..969eab7 100644--- a/Docs/en/UserGuide/main-panel.md+++ b/Docs/en/UserGuide/main-panel.md@@ -79,7 +79,7 @@ When `Animation Effects` is enabled, the day squares appear from the top left toHover over a day to see its date, token count, and usage intensity.-When CodexBar Hook is enabled, the details also include:+When Advanced Mode is enabled, the details also include:- Most-used model- Sessionsdiff --git a/Docs/en/UserGuide/notifications.md b/Docs/en/UserGuide/notifications.mdindex 617670c..7685548 100644--- a/Docs/en/UserGuide/notifications.md+++ b/Docs/en/UserGuide/notifications.md@@ -17,8 +17,8 @@ System Notifications is off by default. Turning it off disables all CodexBar sys| Notification | Trigger | Default option | Additional requirement || --- | --- | --- | --- |-| Task completed | A task finishes after running for at least the selected duration | On, 1 minute | CodexBar Hook |-| Waiting for approval | A task starts waiting for user approval | On | CodexBar Hook |+| Task completed | A task finishes after running for at least the selected duration | On, 1 minute | Advanced Mode |+| Waiting for approval | A task starts waiting for user approval | On | Advanced Mode || Low rate limit | Remaining quota reaches the alert threshold | On, 10% | None || Rate limit reset | A rate-limit window previously observed as consumed returns to an unconsumed state | On | None || Banked resets expiring | Banked resets enter the 7-day expiration window | On | Available banked resets |@@ -26,7 +26,7 @@ System Notifications is off by default. Turning it off disables all CodexBar sys| Automatic Reset failed | Authentication failure pauses the task, a protocol error stops it, or this Mac explicitly observes expiration | Shares the success-notification setting | Automatic Reset, its notification option, and System Notifications || Low Battery Protection | Low Battery Protection successfully restores system sleep | On | Sleep prevention and Low Battery Protection || Keep-awake limit | The time limit is reached and system sleep is successfully restored | On | Sleep prevention and a finite time limit |-| Stalled Task Protection | A running task makes no progress for the selected protection interval | Fixed behavior | CodexBar Hook and Prevent System Sleep |+| Stalled Task Protection | A running task makes no progress for the selected protection interval | Fixed behavior | Advanced Mode and Prevent System Sleep |Stalled Task Protection has no separate notification option and uses the default system sound.@@ -70,7 +70,7 @@ If a saved sound is unavailable on the current Mac, CodexBar falls back to the d`Task Haptic Feedback` is off by default. When enabled, the trackpad vibrates when a task finishes or starts waiting for approval.-Haptic feedback does not require macOS notification permission, but it still follows CodexBar's System Notifications switch and CodexBar Hook status.+Haptic feedback does not require macOS notification permission, but it still follows CodexBar's System Notifications switch and Advanced Mode status.## Codex TUI Notificationsdiff --git a/Docs/en/UserGuide/settings.md b/Docs/en/UserGuide/settings.mdindex 8cb7bda..699774d 100644--- a/Docs/en/UserGuide/settings.md+++ b/Docs/en/UserGuide/settings.md@@ -8,9 +8,9 @@ Right-click or Control-click the menu bar icon and choose `Settings`, or press `| Setting | Purpose | Default or initial state || --- | --- | --- |-| Main Panel Layout | Reorder and show or hide Account, Tasks, Quota, Usage, and Status | All visible; Tasks is off when Hook is disabled |+| Main Panel Layout | Reorder and show or hide Account, Tasks, Quota, Usage, and Status | All visible; Tasks is off when Advanced Mode is disabled || Animation Effects | Control quota-bar and heatmap entrance animations, sun-badge rotation, and status-text animations in the activity card and Task Center | On |-| Glow Effect | Show task status with colors along the top of each display; requires Hook to be enabled and verified | Off |+| Glow Effect | Show task status with colors along the top of each display; requires Advanced Mode to be enabled and verified | Off || Launch at Login | Start CodexBar when you sign in to your Mac | Follows the system login-item state || Automatically Check for Updates | Periodically check for CodexBar updates | Follows the current update setting || Menu Bar Quota Indicator | Show the remaining allowance in a selected window | Primary quota |@@ -20,11 +20,11 @@ Right-click or Control-click the menu bar icon and choose `Settings`, or press `Click the options button to drag sections into order or toggle visibility, keeping at least one section visible. Use `⌘Z` to undo and `⌘⇧Z` to redo. Hiding a section does not stop its features.-Disabling Hook hides Tasks; switching Hook from off to on shows Tasks automatically. You can still hide Tasks manually while Hook is enabled, and restarting the app preserves that choice. If Tasks was the only visible section, disabling Hook enables Account automatically.+Disabling Advanced Mode hides Tasks; switching Advanced Mode from off to on shows Tasks automatically. You can still hide Tasks manually while Advanced Mode is enabled, and restarting the app preserves that choice. If Tasks was the only visible section, disabling Advanced Mode enables Account automatically.### Glow Effect-Shows task status along the top of each display. CodexBar Hook must be enabled and verified. The switch is off by default and independent of the main panel's Animation Effects setting. Once enabled, click the options button to adjust status colors, animation speed, brightness, and end duration.+Shows task status along the top of each display. Advanced Mode must be enabled and verified. The switch is off by default and independent of the main panel's Animation Effects setting. Once enabled, click the options button to adjust status colors, animation speed, brightness, and end duration.Turning it on plays one round-trip preview using the current running color, speed, and brightness, then shows actual task status. Turning it off quickly retracts the glow to the screen center and fades it out. Turning it back on before dismissal finishes does not trigger another preview.@@ -41,7 +41,7 @@ Colors use six-digit Display P3 hexadecimal values. Letters are converted to uppWhen a task ends while others remain active, its completion or termination appears briefly before returning to the current task state. Once all tasks end, the latest ending is shown for the selected End Duration, measured from its end time. Choices are 3, 5, 10, 15, 30, or 60 seconds; the default is 10 seconds. Task updates continue during previews while terminal indicator timers pause. Presentation resumes according to the latest task state: existing terminal indicators retain their remaining time, and indicators for tasks that ended during the preview receive their full duration.-The glow is hidden while Hook is unavailable, preserving your switch preference. System sleep, display sleep, or an inactive user session also hides it. On return, it shows the current state without replaying expired terminal indicators.+The glow is hidden while Advanced Mode is unavailable, preserving your switch preference. System sleep, display sleep, or an inactive user session also hides it. On return, it shows the current state without replaying expired terminal indicators.### Menu Bar Quota Indicator@@ -55,15 +55,20 @@ A shortcut needs at least two modifier keys and cannot use `Command-Space` or `C| Setting | Purpose | Default || --- | --- | --- |-| Proxy | Configure the proxy for CodexBar’s Codex service connection | Off |-| [CodexBar Hook](activity-and-hook.md) | Enable live tasks and daily activity statistics | Off if not installed |+| [Advanced Mode](advanced-mode.md) | Enable live tasks and daily activity statistics | Off if not installed || [System Notifications](notifications.md) | Configure notification types, thresholds, sounds, and haptics | Main switch off || Automatic Reset | Use banked resets shortly before expiration | Off, 30-minute lead time || [Prevent System Sleep](sleep-prevention.md) | Keep your Mac awake while eligible tasks run | Off || [Cross-Device Sync](sync-data-privacy.md) | Combine daily activity statistics and session token usage through iCloud | Off |+| Network Proxy | Configure the proxy for CodexBar’s Codex service connection | Off |+| Data Update Interval | Set the automatic update interval for account data, quota, and accompanying historical maintenance and sync | 1 minute || [Rebuild Data](sync-data-privacy.md#rebuild-data) | Recalculate activity statistics and session token usage for selected dates in the background | Manual |-### Proxy+### Data Update Interval++Choose 1, 2, 3, 5, or 10 minutes. The default is 1 minute, saved locally. The interval starts when the previous refresh result is committed. Changing it immediately recalculates the remaining wait; an overdue refresh runs shortly afterward. Manual refresh resets the countdown. Live task monitoring is unaffected.++### Network ProxyClick the setting row and enter a server address and port. HTTP, HTTPS, hostnames, IPv4, and IPv6 are supported; ports must be within `1–65535`. Authentication requires a username; the password may be empty.diff --git a/Docs/en/UserGuide/sleep-prevention.md b/Docs/en/UserGuide/sleep-prevention.mdindex cc6c229..98f3727 100644--- a/Docs/en/UserGuide/sleep-prevention.md+++ b/Docs/en/UserGuide/sleep-prevention.md@@ -6,7 +6,7 @@ CodexBar can keep your Mac awake while tasks run and restore sleep when tasks fi## Enable and Activate-1. Enable CodexBar Hook in `Settings > Advanced`+1. Enable Advanced Mode in `Settings > Advanced`2. Enable `Prevent System Sleep` and confirm3. If background approval is required, click `Open System Settings` and allow CodexBar to run in the backgrounddiff --git a/Docs/en/UserGuide/sync-data-privacy.md b/Docs/en/UserGuide/sync-data-privacy.mdindex 27a5aad..7d1de67 100644--- a/Docs/en/UserGuide/sync-data-privacy.md+++ b/Docs/en/UserGuide/sync-data-privacy.md@@ -4,13 +4,13 @@## Cross-Device Sync-Enable `Cross-Device Sync` in `Settings > Advanced` to combine daily Hook statistics and rollout token usage from Macs using the same iCloud account. CodexBar Hook must be enabled and an available iCloud account signed in.+Enable `Cross-Device Sync` in `Settings > Advanced` to combine daily Hook statistics and rollout token usage from Macs using the same iCloud account. Advanced Mode must be enabled and an available iCloud account signed in.The first sync uploads statistics within local retention; later changes sync automatically. Turning sync off keeps local data.| State | Meaning || --- | --- |-| Sync Off | Sync or CodexBar Hook is disabled |+| Sync Off | Sync or Advanced Mode is disabled || Syncing | Data is being transferred || Synced | The latest sync cycle succeeded || Sync Failed | The network, iCloud account, or service is temporarily unavailable; CodexBar will retry |diff --git a/Docs/en/UserGuide/troubleshooting.md b/Docs/en/UserGuide/troubleshooting.mdindex 023265d..04e6f22 100644--- a/Docs/en/UserGuide/troubleshooting.md+++ b/Docs/en/UserGuide/troubleshooting.md@@ -24,7 +24,7 @@ Check the connection error in `Settings > About`, confirm Codex is installed at## Proxy Configuration or Connection Failures-Open `Settings > Advanced > Proxy` and use `Test Connection` to check the draft. Server and port are required; authentication also requires a username. Invalid fields are outlined in red with a short reason beside the test button.+Open `Settings > Advanced > Network Proxy` and use `Test Connection` to check the draft. Server and port are required; authentication also requires a username. Invalid fields are outlined in red with a short reason beside the test button.- If About reports an invalid server or username, correct and save the settings, or turn the proxy off- If the configuration cannot be read, use `⋯ > Delete Configuration` at the top right of the dialog@@ -37,15 +37,18 @@ A dimmed value means that the current read failed and CodexBar fell back to cachDouble-click the account icon to retry. If data remains faded, check the connection error in About or open Logs.-## CodexBar Hook Cannot Be Enabled or Validated+<a id="codexbar-hook-cannot-be-enabled-or-validated"></a>++## Advanced Mode Cannot Be Enabled or Validated| Message | Action || --- | --- || A newer Codex version is required | Update Codex, then click `Reconnect` in About |+| Could not determine the Codex version | Check that the selected source is available in About, then click `Reconnect` and retry || Codex Hook is globally disabled | Re-enable `features.hooks` in Codex configuration |-| CodexBar Hook is incomplete | Reopen Settings for automatic repair; if needed, turn Hook off and back on |-| CodexBar Hook is untrusted | Re-enable Hook and review Codex’s trust prompts |-| Unexpected CodexBar Hook source | Verify the selected Codex source and the location of `CODEX_HOME` |+| Advanced Mode Hook configuration is incomplete | Reopen Settings for automatic repair; if needed, turn Advanced Mode off and back on |+| Advanced Mode Hook is not trusted | Re-enable Advanced Mode and review Codex’s trust prompts |+| Unexpected Hook source for Advanced Mode | Verify the selected Codex source and the location of `CODEX_HOME` || Invalid `hooks.json` format | Repair the file’s JSON format and retry || Cannot validate Codex Hook | Reopen Settings after the Codex connection recovers |@@ -53,7 +56,7 @@ The default configuration file is `~/.codex/hooks.json`. If `CODEX_HOME` is set,## Live Tasks Do Not Appear-1. Confirm that CodexBar Hook is enabled with no error+1. Confirm that Advanced Mode is enabled with no error2. Confirm that `Tasks` is enabled under `General > Main Panel Layout`3. Start a new Codex task to generate live events4. Open Settings to trigger Hook validation again@@ -67,7 +70,7 @@ Check in this order:1. `System Notifications` is enabled2. macOS allows notifications from CodexBar3. The relevant notification option is enabled-4. CodexBar Hook is valid for task notifications+4. Advanced Mode is valid for task notifications5. The completed task reached the selected duration threshold6. The notification sound is not set to silent@@ -77,7 +80,7 @@ Haptic feedback does not require macOS notification permission, but it does requCheck in this order:-1. CodexBar Hook is valid+1. Advanced Mode is valid2. `Prevent System Sleep` is enabled3. A task is currently running4. If only waiting tasks exist, `Keep Awake While Waiting` is enabled@@ -115,7 +118,7 @@ Temporary failures retry for up to 5 minutes per round; later refreshes may try- Confirm that the Mac is signed in to iCloud- Confirm that iCloud Drive and CloudKit are available-- Confirm that CodexBar Hook is enabled+- Confirm that Advanced Mode is enabled- Confirm that `Sync Across Devices` is enabled- Hover over the iCloud icon at the bottom of the main panel for the detailed statusdiff --git a/README.en.md b/README.en.mdindex 9ab11bf..7181da7 100644--- a/README.en.md+++ b/README.en.md@@ -41,7 +41,7 @@ It can notify you when a task finishes, needs approval, or when your rate limits- Track total tokens, your highest daily usage, and usage streaks- See your longest task duration- Review recent daily token usage in a heatmap-- Enable CodexBar Hook for daily session, turn, tool call, subagent, and other activity metrics+- Enable Advanced Mode for daily session, turn, tool call, subagent, and other activity metrics### Keep track of active tasks@@ -83,7 +83,7 @@ Download the latest version from [GitHub Releases](https://github.com/bob-zebedy- macOS 15.0 or later- [Codex CLI](https://github.com/openai/codex) installed and signed in, or ChatGPT App or Codex App with bundled Codex installed- The running Codex version must be `0.145.0` or later-- Live tasks and other Hook features require the running Codex version to be `0.150.0` or later+- Advanced Mode requires the running Codex version to be `0.153.0` or later- Cross-device sync requires an available iCloud account on the Mac## Quick Start@@ -91,7 +91,7 @@ Download the latest version from [GitHub Releases](https://github.com/bob-zebedy1. Launch CodexBar and find its icon in the menu bar2. Left-click the icon to view your account, rate limits, and token usage3. Right-click or Control-click the icon to open Settings, Logs, or the Quit menu-4. Enable CodexBar Hook under `Settings > Advanced` to unlock live tasks, task notifications, sleep prevention, and Hook metrics+4. Enable Advanced Mode under `Settings > Advanced` to unlock live tasks, task notifications, sleep prevention, and Hook metricsThe default global shortcut is `⌘⇧E`. You can record a different shortcut or disable it in Settings.diff --git a/README.md b/README.mdindex 5e937f6..3d3e69d 100644--- a/README.md+++ b/README.md@@ -41,7 +41,7 @@ CodexBar 是面向 macOS 15 及更高版本的菜单栏 App,用于集中展示- 展示累计 Token、单日峰值和连续使用天数- 展示最长任务时长- 通过热力图回顾近期每日 Token 用量-- 开启 CodexBar Hook 后可查看会话、对话轮次、工具调用和子 Agent 等每日统计+- 开启进阶模式后可查看会话、对话轮次、工具调用和子 Agent 等每日统计### 不错过正在发生的任务@@ -83,7 +83,7 @@ brew install --cask bob-zebedy/tap/codexbar- macOS 15.0 或更高版本- 已安装并登录 [Codex CLI](https://github.com/openai/codex) 或安装了内置 Codex 的 ChatGPT App 或 Codex App- 当前运行的 Codex 版本需要为 `0.145.0` 或更高版本-- 使用实时任务等 Hook 功能时,当前运行的 Codex 版本需要为 `0.150.0` 或更高版本+- 启用进阶模式时,当前运行的 Codex 版本需要为 `0.153.0` 或更高版本- 使用跨设备同步时,Mac 需要登录可用的 iCloud 账户## 快速开始@@ -91,7 +91,7 @@ brew install --cask bob-zebedy/tap/codexbar1. 启动 CodexBar,在菜单栏找到 CodexBar 图标2. 左键点击图标查看账户、额度和 Token 用量3. 右键或按住 Control 点击图标打开设置、日志或退出菜单-4. 在 `设置 > 高级` 中启用 CodexBar Hook,解锁实时任务、任务类通知、防睡眠和 Hook 统计+4. 在 `设置 > 高级` 中启用进阶模式,解锁实时任务、任务类通知、防睡眠和 Hook 统计默认全局快捷键为 `⌘⇧E`,可在设置中重新录制或关闭。@@ -99,7 +99,7 @@ brew install --cask bob-zebedy/tap/codexbar| 文档 | 内容 || --- | --- |-| [用户指南](Docs/UserGuide/README.md) | 安装、主面板、Hook、通知、防睡眠、同步、全部设置和问题排查 |+| [用户指南](Docs/README.md#用户指南) | 安装、主面板、Hook、通知、防睡眠、同步、全部设置和问题排查 || [开发者指南](Docs/DeveloperGuide/README.md) | 架构、数据链路、核心状态机、存储、隐私边界和开发验证 || [文档导航](Docs/README.md) | 全部文档入口 |