fix: hide macOS usage errors
This commit is contained in:
@@ -17,6 +17,7 @@ Docs: https://docs.clawd.bot
|
|||||||
- Plugins: route command detection/text chunking helpers through the plugin runtime and drop runtime exports from the SDK.
|
- Plugins: route command detection/text chunking helpers through the plugin runtime and drop runtime exports from the SDK.
|
||||||
- Plugins: auto-enable bundled channel/provider plugins when configuration is present.
|
- Plugins: auto-enable bundled channel/provider plugins when configuration is present.
|
||||||
- Config: stamp last-touched metadata on write and warn if the config is newer than the running build.
|
- Config: stamp last-touched metadata on write and warn if the config is newer than the running build.
|
||||||
|
- macOS: hide usage section when usage is unavailable instead of showing provider errors.
|
||||||
- Memory: add native Gemini embeddings provider for memory search. (#1151)
|
- Memory: add native Gemini embeddings provider for memory search. (#1151)
|
||||||
- Agents: add local docs path resolution and include docs/mirror/source/community pointers in the system prompt.
|
- Agents: add local docs path resolution and include docs/mirror/source/community pointers in the system prompt.
|
||||||
- Slack: add HTTP webhook mode via Bolt HTTP receiver for Events API deployments. (#1143) — thanks @jdrhyne.
|
- Slack: add HTTP webhook mode via Bolt HTTP receiver for Events API deployments. (#1143) — thanks @jdrhyne.
|
||||||
|
|||||||
@@ -280,9 +280,7 @@ extension MenuSessionsInjector {
|
|||||||
|
|
||||||
private func insertUsageSection(into menu: NSMenu, at cursor: Int, width: CGFloat) -> Int {
|
private func insertUsageSection(into menu: NSMenu, at cursor: Int, width: CGFloat) -> Int {
|
||||||
let rows = self.usageRows
|
let rows = self.usageRows
|
||||||
let errorText = self.cachedUsageErrorText
|
if rows.isEmpty {
|
||||||
|
|
||||||
if rows.isEmpty, errorText == nil {
|
|
||||||
return cursor
|
return cursor
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,25 +304,6 @@ extension MenuSessionsInjector {
|
|||||||
menu.insertItem(headerItem, at: cursor)
|
menu.insertItem(headerItem, at: cursor)
|
||||||
cursor += 1
|
cursor += 1
|
||||||
|
|
||||||
if let errorText = errorText?.nonEmpty, !rows.isEmpty {
|
|
||||||
menu.insertItem(
|
|
||||||
self.makeMessageItem(
|
|
||||||
text: errorText,
|
|
||||||
symbolName: "exclamationmark.triangle",
|
|
||||||
width: width,
|
|
||||||
maxLines: 2),
|
|
||||||
at: cursor)
|
|
||||||
cursor += 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if rows.isEmpty {
|
|
||||||
menu.insertItem(
|
|
||||||
self.makeMessageItem(text: errorText ?? "No usage available", symbolName: "minus", width: width),
|
|
||||||
at: cursor)
|
|
||||||
cursor += 1
|
|
||||||
return cursor
|
|
||||||
}
|
|
||||||
|
|
||||||
if let selectedProvider = self.selectedUsageProviderId,
|
if let selectedProvider = self.selectedUsageProviderId,
|
||||||
let primary = rows.first(where: { $0.providerId.lowercased() == selectedProvider }),
|
let primary = rows.first(where: { $0.providerId.lowercased() == selectedProvider }),
|
||||||
rows.count > 1
|
rows.count > 1
|
||||||
@@ -561,14 +540,11 @@ extension MenuSessionsInjector {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
self.cachedUsageSummary = try await UsageLoader.loadSummary()
|
self.cachedUsageSummary = try await UsageLoader.loadSummary()
|
||||||
self.cachedUsageErrorText = nil
|
|
||||||
self.usageCacheUpdatedAt = Date()
|
|
||||||
} catch {
|
} catch {
|
||||||
if self.cachedUsageSummary == nil {
|
self.cachedUsageSummary = nil
|
||||||
self.cachedUsageErrorText = self.compactUsageError(error)
|
self.cachedUsageErrorText = nil
|
||||||
}
|
|
||||||
self.usageCacheUpdatedAt = Date()
|
|
||||||
}
|
}
|
||||||
|
self.usageCacheUpdatedAt = Date()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func compactUsageError(_ error: Error) -> String {
|
private func compactUsageError(_ error: Error) -> String {
|
||||||
|
|||||||
Reference in New Issue
Block a user