cc-pets 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CC_BRIDGE.md +63 -7
- package/CC_BRIDGE.zh-CN.md +43 -5
- package/CHANGELOG.md +106 -0
- package/CHANGELOG.zh-CN.md +106 -0
- package/CONTRIBUTING.md +23 -1
- package/CONTRIBUTING.zh-CN.md +18 -1
- package/PROVIDER_PROTOCOL.md +5 -1
- package/PROVIDER_PROTOCOL.zh-CN.md +4 -1
- package/README.md +177 -33
- package/README.zh-CN.md +137 -32
- package/Resources/AgentIcons/claude.png +0 -0
- package/Resources/AgentIcons/codex.icns +0 -0
- package/Resources/IDEPlugins/cc-pets-terminal.vsix +0 -0
- package/Resources/IDEPlugins/cc-pets-terminal.zip +0 -0
- package/Resources/zh-Hans.lproj/Localizable.strings +187 -35
- package/Sources/CCPets/App/CCPetsAppDelegate+AgentEvents.m +47 -4
- package/Sources/CCPets/App/CCPetsAppDelegate+AgentStatus.m +121 -20
- package/Sources/CCPets/App/CCPetsAppDelegate+Bridge.m +8 -6
- package/Sources/CCPets/App/CCPetsAppDelegate+MenuBar.m +86 -0
- package/Sources/CCPets/App/CCPetsAppDelegate+Private.h +14 -1
- package/Sources/CCPets/App/CCPetsAppDelegate+Quota.m +6 -1
- package/Sources/CCPets/App/CCPetsAppDelegate+Settings.m +3 -6
- package/Sources/CCPets/App/CCPetsAppDelegate+Speech.m +118 -50
- package/Sources/CCPets/App/CCPetsAppDelegate+Update.m +4 -1
- package/Sources/CCPets/App/CCPetsAppDelegate+Workbench.m +4 -0
- package/Sources/CCPets/App/CCPetsAppDelegate.h +12 -2
- package/Sources/CCPets/App/CCPetsAppDelegate.m +4 -2
- package/Sources/CCPets/App/main.m +6 -0
- package/Sources/CCPets/Bridge/CCPetsBridge.m +45 -18
- package/Sources/CCPets/Bridge/CCPetsBridgeCLI.m +175 -68
- package/Sources/CCPets/Bridge/CCPetsBridgeCore.h +14 -6
- package/Sources/CCPets/Bridge/CCPetsBridgeCore.m +356 -110
- package/Sources/CCPets/Bridge/CCPetsBridgeSetup.h +0 -2
- package/Sources/CCPets/Bridge/CCPetsBridgeSetup.m +247 -126
- package/Sources/CCPets/Bridge/CCPetsBridgeStore.h +37 -9
- package/Sources/CCPets/Bridge/CCPetsBridgeStore.m +385 -80
- package/Sources/CCPets/Integrations/CCPetsEvents.h +5 -0
- package/Sources/CCPets/Integrations/CCPetsEvents.m +68 -12
- package/Sources/CCPets/Integrations/CCPetsIDEIntegration.h +21 -0
- package/Sources/CCPets/Integrations/CCPetsIDEIntegration.m +503 -0
- package/Sources/CCPets/Integrations/CCPetsIntegrations.m +1 -1
- package/Sources/CCPets/Integrations/CCPetsLaunchPreflight.h +5 -0
- package/Sources/CCPets/Integrations/CCPetsLaunchPreflight.m +367 -0
- package/Sources/CCPets/Integrations/CCPetsTerminalFocus.h +8 -1
- package/Sources/CCPets/Integrations/CCPetsTerminalFocus.m +156 -25
- package/Sources/CCPets/Integrations/CCPetsTerminalIntegration.h +17 -0
- package/Sources/CCPets/Integrations/CCPetsTerminalIntegration.m +64 -0
- package/Sources/CCPets/Integrations/CCPetsVSCodeIntegration.h +23 -0
- package/Sources/CCPets/Integrations/CCPetsVSCodeIntegration.m +475 -0
- package/Sources/CCPets/Pet/CCPetsPhrasesEditor.m +7 -0
- package/Sources/CCPets/Pet/PetView+Menu.m +11 -3
- package/Sources/CCPets/Pet/PetView.h +7 -0
- package/Sources/CCPets/Pet/PetView.m +12 -1
- package/Sources/CCPets/Support/CCPetsDoctor.m +26 -12
- package/Sources/CCPets/Support/CCPetsPreferences.h +12 -0
- package/Sources/CCPets/Support/CCPetsPreferences.m +52 -2
- package/Sources/CCPets/UI/CCPetsFormBuilder.h +2 -0
- package/Sources/CCPets/UI/CCPetsFormBuilder.m +18 -7
- package/Sources/CCPets/UI/CCPetsGlassView.h +26 -4
- package/Sources/CCPets/UI/CCPetsGlassView.m +40 -9
- package/Sources/CCPets/UI/CCPetsMenuBarIcon.h +16 -0
- package/Sources/CCPets/UI/CCPetsMenuBarIcon.m +70 -0
- package/Sources/CCPets/UI/CCPetsMenuBarPanel.h +18 -0
- package/Sources/CCPets/UI/CCPetsMenuBarPanel.m +528 -0
- package/Sources/CCPets/UI/CCPetsMenuBarSummary.h +51 -0
- package/Sources/CCPets/UI/CCPetsMenuBarSummary.m +95 -0
- package/Sources/CCPets/UI/CCPetsSettingsPage.h +6 -1
- package/Sources/CCPets/UI/CCPetsSettingsPage.m +577 -66
- package/Sources/CCPets/UI/CCPetsStatusItem.h +28 -0
- package/Sources/CCPets/UI/CCPetsStatusItem.m +147 -0
- package/Sources/CCPets/UI/CCPetsUIStyle.h +5 -2
- package/Sources/CCPets/UI/CCPetsUIStyle.m +57 -8
- package/Sources/CCPets/UI/CCPetsUsageChartView.m +4 -0
- package/Sources/CCPets/UI/CCPetsUsagePage.m +23 -28
- package/Sources/CCPets/UI/CCPetsUsageStore.m +2 -2
- package/Sources/CCPets/UI/CCPetsWorkbenchPages.m +5 -3
- package/Sources/CCPets/Usage/CCPetsUsage+CodexBackground.m +193 -0
- package/Sources/CCPets/Usage/CCPetsUsage+Internal.h +1 -0
- package/Sources/CCPets/Usage/CCPetsUsage+Models.m +49 -11
- package/Sources/CCPets/Usage/CCPetsUsage.h +3 -2
- package/Sources/CCPets/Usage/CCPetsUsageMonitor.m +15 -17
- package/Sources/CCPets/Usage/QuotaDashboardView+Rendering.m +11 -29
- package/Sources/CCPets/Usage/QuotaDashboardView.m +128 -2
- package/THIRD_PARTY_NOTICES.md +7 -3
- package/THIRD_PARTY_NOTICES.zh-CN.md +5 -1
- package/bin/claude-with-pet +2 -0
- package/bin/codex-with-pet +2 -0
- package/package.json +5 -1
- package/plugins/jetbrains/README.md +62 -0
- package/plugins/jetbrains/src/main/java/com/ccpets/terminal/TerminalBridge.java +379 -0
- package/plugins/jetbrains/src/main/java/com/ccpets/terminal/TerminalIdentity.java +24 -0
- package/plugins/jetbrains/src/main/java/com/ccpets/terminal/TerminalStartup.java +12 -0
- package/plugins/jetbrains/src/main/resources/META-INF/plugin.xml +23 -0
- package/plugins/jetbrains/src/main/resources/META-INF/pluginIcon.svg +380 -0
- package/plugins/vscode/README.md +63 -0
- package/plugins/vscode/extension.js +210 -0
- package/plugins/vscode/package.json +18 -0
- package/scripts/build-idea-plugin.sh +101 -0
- package/scripts/build-vscode-extension.sh +112 -0
- package/scripts/build.sh +24 -2
- package/scripts/compile-cached.zsh +133 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#import <Cocoa/Cocoa.h>
|
|
2
|
+
#import "CCPetsMainWindow.h"
|
|
3
|
+
#import "CCPetsWorkbench.h"
|
|
4
|
+
|
|
5
|
+
// 菜单栏图标:左键弹出玻璃面板(宠物状态、会话、各账号额度、今日用量,见 CCPetsMenuBarPanel),
|
|
6
|
+
// 右键是和桌宠同一份右键菜单。
|
|
7
|
+
//
|
|
8
|
+
// 数据全部来自现有快照(workbenchSessions / workbenchQuotas / petCardSnapshot),这里不采集、
|
|
9
|
+
// 不起定时器:标题和开着的面板只在宠物名片、额度或设置变了的时候重算。
|
|
10
|
+
// 和主窗口各页一样只认协议,不 import AppDelegate 的私有头。
|
|
11
|
+
@interface CCPetsStatusItemController : NSObject
|
|
12
|
+
- (instancetype)initWithSource:(id<CCPetsWorkbenchSource, CCPetsPetCardSource>)source;
|
|
13
|
+
@property(nonatomic, weak, readonly) id<CCPetsWorkbenchSource, CCPetsPetCardSource> source;
|
|
14
|
+
// 会话状态对应的颜色,和状态卡图标同一套(AppDelegate 的 statusColorForState:)。
|
|
15
|
+
@property(nonatomic, copy) NSColor *(^stateColorProvider)(NSString *state);
|
|
16
|
+
// 右键菜单。由桌宠那边现建;菜单收起后调 contextMenuFinished 收拾预览浮窗和说明。
|
|
17
|
+
@property(nonatomic, copy) NSMenu *(^contextMenuProvider)(void);
|
|
18
|
+
@property(nonatomic, copy) void (^contextMenuFinished)(void);
|
|
19
|
+
// 「显示桌宠」勾选项:读当前状态、切换。
|
|
20
|
+
@property(nonatomic, copy) BOOL (^petVisibleProvider)(void);
|
|
21
|
+
@property(nonatomic, copy) void (^togglePetVisible)(void);
|
|
22
|
+
// 有可安装的新版本时返回版本号;「仅菜单栏」下没有更新气泡和角标,入口只剩面板底部。
|
|
23
|
+
@property(nonatomic, copy) NSString *(^pendingUpdateVersionProvider)(void);
|
|
24
|
+
@property(nonatomic, copy) void (^showPendingUpdate)(void);
|
|
25
|
+
- (void)refresh;
|
|
26
|
+
// 从菜单栏移除并停止监听。之后这个对象不再可用。
|
|
27
|
+
- (void)invalidate;
|
|
28
|
+
@end
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
#import "CCPetsStatusItem.h"
|
|
2
|
+
#import "CCPetsMenuBarSummary.h"
|
|
3
|
+
#import "CCPetsPreferences.h"
|
|
4
|
+
#import "CCPetsL10n.h"
|
|
5
|
+
#import "CCPetsMenuBarPanel.h"
|
|
6
|
+
#import "CCPetsMenuBarIcon.h"
|
|
7
|
+
|
|
8
|
+
static NSColor *LevelColor(CCPetsMenuBarLevel level) {
|
|
9
|
+
switch (level) {
|
|
10
|
+
case CCPetsMenuBarLevelCritical: return NSColor.systemRedColor;
|
|
11
|
+
case CCPetsMenuBarLevelWarning: return NSColor.systemOrangeColor;
|
|
12
|
+
default: return nil;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@interface CCPetsStatusItemController ()
|
|
17
|
+
@property(nonatomic, weak, readwrite) id<CCPetsWorkbenchSource, CCPetsPetCardSource> source;
|
|
18
|
+
@property(nonatomic) NSStatusItem *item;
|
|
19
|
+
@property(nonatomic) CCPetsMenuBarPanel *panel;
|
|
20
|
+
// 各色调的菜单栏图标(见 CCPetsMenuBarIcon),每种只生成一次。
|
|
21
|
+
@property(nonatomic) NSMutableDictionary<NSNumber *, NSImage *> *iconImages;
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
@implementation CCPetsStatusItemController
|
|
25
|
+
|
|
26
|
+
- (instancetype)initWithSource:(id<CCPetsWorkbenchSource, CCPetsPetCardSource>)source {
|
|
27
|
+
if (!(self = [super init])) return nil;
|
|
28
|
+
_source = source;
|
|
29
|
+
_panel = [[CCPetsMenuBarPanel alloc] initWithOwner:self];
|
|
30
|
+
_item = [NSStatusBar.systemStatusBar statusItemWithLength:NSVariableStatusItemLength];
|
|
31
|
+
_iconImages = [NSMutableDictionary dictionary];
|
|
32
|
+
_item.button.image = [self imageForTone:CCPetsMenuBarIconToneNone];
|
|
33
|
+
_item.button.toolTip = @"CC Pets";
|
|
34
|
+
_item.button.target = self;
|
|
35
|
+
_item.button.action = @selector(statusItemClicked:);
|
|
36
|
+
// 左右键松开都要回调,才能在 action 里分流两种菜单。和桌宠拖动无关(tests/test.sh 对拖动
|
|
37
|
+
// 实现的回归检查会拦 NSEventMask 常量的写法,所以这里按事件类型组掩码)。
|
|
38
|
+
[_item.button sendActionOn:NSEventMaskFromType(NSEventTypeLeftMouseUp) |
|
|
39
|
+
NSEventMaskFromType(NSEventTypeRightMouseUp)];
|
|
40
|
+
NSNotificationCenter *center = NSNotificationCenter.defaultCenter;
|
|
41
|
+
for (NSNotificationName name in @[CCPetsPetCardDidChangeNotification,
|
|
42
|
+
CCPetsWorkbenchQuotasDidChangeNotification,
|
|
43
|
+
CCPetsPreferencesDidChangeNotification,
|
|
44
|
+
CCPetsLanguageDidChangeNotification]) {
|
|
45
|
+
[center addObserver:self selector:@selector(sourceDidChange:) name:name object:nil];
|
|
46
|
+
}
|
|
47
|
+
[self refresh];
|
|
48
|
+
return self;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (void)dealloc {
|
|
52
|
+
[NSNotificationCenter.defaultCenter removeObserver:self];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (void)invalidate {
|
|
56
|
+
[NSNotificationCenter.defaultCenter removeObserver:self];
|
|
57
|
+
[self.panel dismiss];
|
|
58
|
+
if (self.item) [NSStatusBar.systemStatusBar removeStatusItem:self.item];
|
|
59
|
+
self.item = nil;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
- (void)sourceDidChange:(NSNotification *)notification {
|
|
63
|
+
[self refresh];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
- (void)refresh {
|
|
67
|
+
NSStatusBarButton *button = self.item.button;
|
|
68
|
+
if (!button) return;
|
|
69
|
+
NSDictionary *snapshot = [self.source petCardSnapshot];
|
|
70
|
+
NSUInteger approvals = [snapshot[@"approvals"] unsignedIntegerValue];
|
|
71
|
+
NSDictionary *parts = CCPetsMenuBarTitleParts([self.source workbenchQuotas], approvals,
|
|
72
|
+
CCPetsPrefBool(CCPetsMenuBarShowsPercentKey));
|
|
73
|
+
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:NSFont.systemFontSize weight:NSFontWeightMedium];
|
|
74
|
+
NSMutableAttributedString *title = [NSMutableAttributedString new];
|
|
75
|
+
if (parts[@"percent"]) {
|
|
76
|
+
NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
|
|
77
|
+
NSColor *color = LevelColor([parts[@"level"] integerValue]);
|
|
78
|
+
if (color) attributes[NSForegroundColorAttributeName] = color;
|
|
79
|
+
[title appendAttributedString:[[NSAttributedString alloc]
|
|
80
|
+
initWithString:[@" " stringByAppendingString:parts[@"percent"]] attributes:attributes]];
|
|
81
|
+
}
|
|
82
|
+
if (parts[@"approvals"]) {
|
|
83
|
+
// U+FE0E 让 ⚠ 按文字字形绘制,颜色才跟得上前景色;否则会是一枚彩色 emoji。
|
|
84
|
+
[title appendAttributedString:[[NSAttributedString alloc]
|
|
85
|
+
initWithString:[NSString stringWithFormat:@" ⚠︎%@", parts[@"approvals"]]
|
|
86
|
+
attributes:@{NSFontAttributeName: font, NSForegroundColorAttributeName: NSColor.systemRedColor}]];
|
|
87
|
+
}
|
|
88
|
+
button.attributedTitle = title;
|
|
89
|
+
button.imagePosition = title.length > 0 ? NSImageLeft : NSImageOnly;
|
|
90
|
+
// 图标跟着状态卡走:同一条快照、同一套归类(工作中蓝、审批橙、完成绿、失败红),
|
|
91
|
+
// 状态卡回落待机时换回待机图。
|
|
92
|
+
NSString *state = [snapshot[@"state"] isKindOfClass:NSString.class] ? snapshot[@"state"] : nil;
|
|
93
|
+
CCPetsMenuBarIconTone tone = CCPetsMenuBarIconToneForState(state);
|
|
94
|
+
BOOL tinted = tone != CCPetsMenuBarIconToneNone;
|
|
95
|
+
button.image = [self imageForTone:tone];
|
|
96
|
+
NSMutableArray<NSString *> *description = [NSMutableArray arrayWithObject:@"CC Pets"];
|
|
97
|
+
if (tinted && [snapshot[@"status"] isKindOfClass:NSString.class]) [description addObject:snapshot[@"status"]];
|
|
98
|
+
if (parts[@"percent"]) [description addObject:parts[@"percent"]];
|
|
99
|
+
if (parts[@"approvals"]) {
|
|
100
|
+
[description addObject:[NSString stringWithFormat:L(@"%@ awaiting approval"), parts[@"approvals"]]];
|
|
101
|
+
}
|
|
102
|
+
[button setAccessibilityLabel:[description componentsJoinedByString:@", "]];
|
|
103
|
+
// 等审批时左键会直接跳转,提示里说清楚,免得用户以为面板打不开。
|
|
104
|
+
button.toolTip = approvals > 0 ? L(@"Click to jump to the session awaiting approval (⌥-click for the panel)") : @"CC Pets";
|
|
105
|
+
[self.panel reload];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
- (NSImage *)imageForTone:(CCPetsMenuBarIconTone)tone {
|
|
109
|
+
NSImage *cached = self.iconImages[@(tone)];
|
|
110
|
+
if (cached) return cached;
|
|
111
|
+
NSImage *image = CCPetsMenuBarIconImage(tone);
|
|
112
|
+
self.iconImages[@(tone)] = image;
|
|
113
|
+
return image;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 左右键共用一个 action。左键开关玻璃面板(有会话等审批时直接跳到那个终端);
|
|
117
|
+
// 右键临时挂上菜单交给按钮弹出,弹完摘掉——
|
|
118
|
+
// 一直挂着 item.menu 的话左键也会直接弹它。
|
|
119
|
+
- (void)statusItemClicked:(NSStatusBarButton *)sender {
|
|
120
|
+
NSEvent *event = NSApp.currentEvent;
|
|
121
|
+
BOOL secondary = event.type == NSEventTypeRightMouseUp ||
|
|
122
|
+
(event.modifierFlags & NSEventModifierFlagControl) != 0;
|
|
123
|
+
if (!secondary) {
|
|
124
|
+
if (self.panel.isShown) {
|
|
125
|
+
[self.panel dismiss];
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
// 有会话在等审批:直接跳到那个终端,这是此刻唯一需要用户动手的事。按住 ⌥ 仍然打开面板。
|
|
129
|
+
BOOL option = (event.modifierFlags & NSEventModifierFlagOption) != 0;
|
|
130
|
+
NSString *approval = option ? nil : CCPetsMenuBarApprovalSessionID([self.source workbenchSessions]);
|
|
131
|
+
if (approval) {
|
|
132
|
+
[self.source focusWorkbenchSessionWithID:approval];
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
[self.panel showBelowButton:sender];
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
[self.panel dismiss];
|
|
139
|
+
NSMenu *menu = self.contextMenuProvider ? self.contextMenuProvider() : nil;
|
|
140
|
+
if (!menu) return;
|
|
141
|
+
self.item.menu = menu;
|
|
142
|
+
[sender performClick:nil];
|
|
143
|
+
self.item.menu = nil;
|
|
144
|
+
if (self.contextMenuFinished) self.contextMenuFinished();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@end
|
|
@@ -42,8 +42,7 @@ NSColor *CCPetsStatusBackgroundColor(CCPetsStatusKind kind);
|
|
|
42
42
|
// Agent 状态(thinking / approval / failed …)归到哪一类。
|
|
43
43
|
CCPetsStatusKind CCPetsStatusKindForAgentState(NSString *state);
|
|
44
44
|
|
|
45
|
-
//
|
|
46
|
-
// 顺序就是色盲安全的保证(相邻两色在三类色盲下都分得开),不要重排。
|
|
45
|
+
// 图表模型色板:前 16 色固定,更多槽位生成颜色;负数表示未知模型的灰色。
|
|
47
46
|
NSColor *CCPetsChartColor(NSInteger slot);
|
|
48
47
|
extern const NSInteger CCPetsChartColorCount;
|
|
49
48
|
|
|
@@ -71,6 +70,10 @@ NSTextField *CCPetsWrappingLabel(NSString *text, CGFloat size, NSFontWeight weig
|
|
|
71
70
|
// 可点的卡片:整张卡片是一个按钮。onClick 为 nil 时不响应。
|
|
72
71
|
@interface CCPetsTileView : CCPetsCardView
|
|
73
72
|
@property(nonatomic, copy) void (^onClick)(void);
|
|
73
|
+
// 这块区域(整行宽)里是控件,不显示手形指针。
|
|
74
|
+
@property(nonatomic, weak) NSView *cursorExclusionView;
|
|
75
|
+
// 只在鼠标停在卡片上时显示的附属控件(比如删除按钮),必须是卡片的子视图。
|
|
76
|
+
@property(nonatomic, weak) NSView *hoverAccessoryView;
|
|
74
77
|
@end
|
|
75
78
|
|
|
76
79
|
// 填色胶囊按钮:悬停面板「订阅 / 用量」那种一点就切换的开关,和右键菜单里的样子一致。
|
|
@@ -79,16 +79,16 @@ CCPetsStatusKind CCPetsStatusKindForAgentState(NSString *state) {
|
|
|
79
79
|
return CCPetsStatusWork;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
const NSInteger CCPetsChartColorCount =
|
|
82
|
+
const NSInteger CCPetsChartColorCount = 16;
|
|
83
83
|
|
|
84
|
-
//
|
|
84
|
+
// 保留原有八色,扩展常用模型色板;更多模型按色相生成颜色。
|
|
85
85
|
NSColor *CCPetsChartColor(NSInteger slot) {
|
|
86
86
|
static NSArray<NSColor *> *colors;
|
|
87
87
|
static NSColor *other;
|
|
88
88
|
static dispatch_once_t once;
|
|
89
89
|
dispatch_once(&once, ^{
|
|
90
|
-
const uint32_t light[] = {0x1597ac, 0xe05c86, 0x6874dc, 0xdd9a1f, 0x9a62d0, 0x3fa577, 0x3a7fc6, 0x8a9a2b};
|
|
91
|
-
const uint32_t dark[] = {0x22a2b8, 0xd65f86, 0x7d87e8, 0xb8841f, 0xa77ad8, 0x3fa577, 0x4c95dc, 0x879733};
|
|
90
|
+
const uint32_t light[] = {0x1597ac, 0xe05c86, 0x6874dc, 0xdd9a1f, 0x9a62d0, 0x3fa577, 0x3a7fc6, 0x8a9a2b, 0xc96b32, 0x258477, 0xb24baf, 0x5266a8, 0xb84c4c, 0x657d34, 0x9b6881, 0x397c99};
|
|
91
|
+
const uint32_t dark[] = {0x22a2b8, 0xd65f86, 0x7d87e8, 0xb8841f, 0xa77ad8, 0x3fa577, 0x4c95dc, 0x879733, 0xec965e, 0x68c5b5, 0xe18bd9, 0xa2b2f0, 0xef8b88, 0xb6c96c, 0xc997b0, 0x80c4df};
|
|
92
92
|
NSMutableArray<NSColor *> *list = [NSMutableArray array];
|
|
93
93
|
for (NSInteger index = 0; index < CCPetsChartColorCount; index++) {
|
|
94
94
|
[list addObject:Dynamic(light[index], 1, dark[index], 1)];
|
|
@@ -96,7 +96,14 @@ NSColor *CCPetsChartColor(NSInteger slot) {
|
|
|
96
96
|
colors = list;
|
|
97
97
|
other = Dynamic(0x9aa3af, 1, 0x66707c, 1);
|
|
98
98
|
});
|
|
99
|
-
|
|
99
|
+
if (slot < 0) return other;
|
|
100
|
+
if (slot < CCPetsChartColorCount) return colors[(NSUInteger)slot];
|
|
101
|
+
CGFloat hue = fmod((slot - CCPetsChartColorCount) * 0.61803398875 + 0.05, 1.0);
|
|
102
|
+
return [NSColor colorWithName:nil dynamicProvider:^NSColor *(NSAppearance *appearance) {
|
|
103
|
+
BOOL dark = AppearanceIsDark(appearance);
|
|
104
|
+
return [NSColor colorWithHue:hue saturation:dark ? 0.48 : 0.65
|
|
105
|
+
brightness:dark ? 0.85 : 0.65 alpha:1];
|
|
106
|
+
}];
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
NSTextField *CCPetsLabel(NSString *text, CGFloat size, NSFontWeight weight, NSColor *color) {
|
|
@@ -145,12 +152,13 @@ NSView *CCPetsMetricRow(NSArray<NSArray<NSString *> *> *items) {
|
|
|
145
152
|
NSFontWeightRegular, CCPetsTertiaryInkColor());
|
|
146
153
|
NSView *heading = title;
|
|
147
154
|
if (item.count > 3 && item[3].length > 0) {
|
|
148
|
-
NSImageView *icon = [NSImageView
|
|
149
|
-
|
|
155
|
+
NSImageView *icon = [NSImageView new];
|
|
156
|
+
icon.image = [NSImage imageWithSystemSymbolName:@"info.circle" accessibilityDescription:item[3]];
|
|
150
157
|
icon.symbolConfiguration = [NSImageSymbolConfiguration configurationWithPointSize:10
|
|
151
158
|
weight:NSFontWeightRegular];
|
|
152
159
|
icon.contentTintColor = CCPetsTertiaryInkColor();
|
|
153
160
|
icon.toolTip = item[3];
|
|
161
|
+
icon.accessibilityHelp = item[3];
|
|
154
162
|
[icon setContentHuggingPriority:NSLayoutPriorityRequired
|
|
155
163
|
forOrientation:NSLayoutConstraintOrientationHorizontal];
|
|
156
164
|
NSStackView *line = [NSStackView stackViewWithViews:@[title, icon]];
|
|
@@ -274,8 +282,37 @@ NSView *CCPetsMetricRow(NSArray<NSArray<NSString *> *> *items) {
|
|
|
274
282
|
|
|
275
283
|
@end
|
|
276
284
|
|
|
285
|
+
@interface CCPetsTileView ()
|
|
286
|
+
@property(nonatomic) NSTrackingArea *hoverTracking;
|
|
287
|
+
@end
|
|
288
|
+
|
|
277
289
|
@implementation CCPetsTileView
|
|
278
290
|
|
|
291
|
+
- (void)setHoverAccessoryView:(NSView *)view {
|
|
292
|
+
_hoverAccessoryView = view;
|
|
293
|
+
view.hidden = YES;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
- (void)updateTrackingAreas {
|
|
297
|
+
[super updateTrackingAreas];
|
|
298
|
+
if (self.hoverTracking) [self removeTrackingArea:self.hoverTracking];
|
|
299
|
+
self.hoverTracking = [[NSTrackingArea alloc] initWithRect:NSZeroRect
|
|
300
|
+
options:NSTrackingMouseEnteredAndExited | NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect
|
|
301
|
+
owner:self userInfo:nil];
|
|
302
|
+
[self addTrackingArea:self.hoverTracking];
|
|
303
|
+
// 卡片重排后鼠标可能已经不在上面,按实际位置校正一次。
|
|
304
|
+
NSPoint mouse = [self convertPoint:self.window.mouseLocationOutsideOfEventStream fromView:nil];
|
|
305
|
+
self.hoverAccessoryView.hidden = !(self.window && NSPointInRect(mouse, self.bounds));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
- (void)mouseEntered:(NSEvent *)event {
|
|
309
|
+
self.hoverAccessoryView.hidden = NO;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
- (void)mouseExited:(NSEvent *)event {
|
|
313
|
+
self.hoverAccessoryView.hidden = YES;
|
|
314
|
+
}
|
|
315
|
+
|
|
279
316
|
- (void)mouseDown:(NSEvent *)event {
|
|
280
317
|
// 按下不立刻触发,松开时还在卡片上才算一次点击,和按钮一个手感。
|
|
281
318
|
}
|
|
@@ -290,7 +327,19 @@ NSView *CCPetsMetricRow(NSArray<NSArray<NSString *> *> *items) {
|
|
|
290
327
|
}
|
|
291
328
|
|
|
292
329
|
- (void)resetCursorRects {
|
|
293
|
-
if (self.onClick)
|
|
330
|
+
if (!self.onClick) return;
|
|
331
|
+
NSView *excluded = self.cursorExclusionView;
|
|
332
|
+
if (!excluded || excluded.superview != self) {
|
|
333
|
+
[self addCursorRect:self.bounds cursor:NSCursor.pointingHandCursor];
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
// 排除区域按整行宽处理:只给它上方和下方的部分加手形指针。
|
|
337
|
+
NSRect frame = excluded.frame;
|
|
338
|
+
NSRect below = NSMakeRect(0, 0, NSWidth(self.bounds), NSMinY(frame));
|
|
339
|
+
NSRect above = NSMakeRect(0, NSMaxY(frame), NSWidth(self.bounds), NSMaxY(self.bounds) - NSMaxY(frame));
|
|
340
|
+
for (NSValue *value in @[[NSValue valueWithRect:below], [NSValue valueWithRect:above]]) {
|
|
341
|
+
if (!NSIsEmptyRect(value.rectValue)) [self addCursorRect:value.rectValue cursor:NSCursor.pointingHandCursor];
|
|
342
|
+
}
|
|
294
343
|
}
|
|
295
344
|
|
|
296
345
|
- (BOOL)isAccessibilityElement {
|
|
@@ -161,6 +161,10 @@ static double NiceStep(double peak) {
|
|
|
161
161
|
[rows addObject:@{@"title": part[0], @"value": CCPetsFormatTokens(Count(counts, part[1])), @"color": color}];
|
|
162
162
|
}
|
|
163
163
|
[rows addObject:@{@"title": L(@"Requests"), @"value": FormatCount(Count(counts, @"requests")), @"color": color}];
|
|
164
|
+
if (Count(counts, @"background") > 0) {
|
|
165
|
+
[rows addObject:@{@"title": L(@"Background (breakdown unavailable)"),
|
|
166
|
+
@"value": CCPetsFormatTokens(Count(counts, @"background")), @"color": color}];
|
|
167
|
+
}
|
|
164
168
|
} else {
|
|
165
169
|
NSMutableArray<NSDictionary *> *layers = [NSMutableArray array];
|
|
166
170
|
for (NSDictionary *layer in self.series) {
|
|
@@ -56,7 +56,7 @@ static NSString *ModelTitle(NSString *model) {
|
|
|
56
56
|
static NSMutableDictionary *SummedCounts(NSArray<NSDictionary *> *list) {
|
|
57
57
|
NSMutableDictionary *sum = [NSMutableDictionary dictionary];
|
|
58
58
|
for (NSDictionary *counts in list) {
|
|
59
|
-
for (NSString *key in @[@"input", @"cacheRead", @"cacheWrite", @"output", @"reasoning", @"requests"]) {
|
|
59
|
+
for (NSString *key in @[@"input", @"cacheRead", @"cacheWrite", @"output", @"reasoning", @"requests", @"background"]) {
|
|
60
60
|
sum[key] = @(Count(sum, key) + Count(counts, key));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -77,11 +77,15 @@ NSArray<NSArray<NSString *> *> *CCPetsUsageMetricItems(NSString *totalTitle, NSD
|
|
|
77
77
|
unsigned long long input = Count(sum, @"input"), write = Count(sum, @"cacheWrite");
|
|
78
78
|
unsigned long long output = Count(sum, @"output"), read = Count(sum, @"cacheRead");
|
|
79
79
|
unsigned long long side = input + write + read;
|
|
80
|
+
unsigned long long background = Count(sum, @"background");
|
|
81
|
+
NSMutableArray<NSString *> *notes = [NSMutableArray array];
|
|
82
|
+
if (write > 0) [notes addObject:[NSString stringWithFormat:L(@"Includes %@ cache write"), CCPetsFormatTokens(write)]];
|
|
83
|
+
if (background > 0) [notes addObject:[NSString stringWithFormat:L(@"Background %@ · breakdown unavailable"), CCPetsFormatTokens(background)]];
|
|
80
84
|
NSString *hit = side > 0 ? [NSString stringWithFormat:L(@"Hit rate %.0f%%"), 100.0 * read / side]
|
|
81
85
|
: L(@"No cache reads yet");
|
|
82
86
|
return @[
|
|
83
|
-
@[totalTitle, CCPetsFormatTokens(CCPetsTotalTokens(sum)),
|
|
84
|
-
? [
|
|
87
|
+
@[totalTitle, CCPetsFormatTokens(CCPetsTotalTokens(sum)), notes.count > 0
|
|
88
|
+
? [notes componentsJoinedByString:@" · "] : L(@"All tokens")],
|
|
85
89
|
@[L(@"Input"), CCPetsFormatTokens(input), L(@"Excluding cache")],
|
|
86
90
|
@[L(@"Output"), CCPetsFormatTokens(output), L(@"Generated by the model")],
|
|
87
91
|
@[L(@"Cached Input"), CCPetsFormatTokens(read), hit],
|
|
@@ -120,7 +124,7 @@ static const NSTimeInterval UsagePageRefreshInterval = 60;
|
|
|
120
124
|
// 当前筛选下的模型条目:key、provider、model、counts(区间合计)、days(每天的 counts)。按总用量从大到小。
|
|
121
125
|
@property(nonatomic) NSArray<NSDictionary *> *entries;
|
|
122
126
|
// 模型 -> 色板位置。按 90 天、全部来源的总用量排序分配,之后切来源、区间、指标都不重新上色:
|
|
123
|
-
//
|
|
127
|
+
// 颜色跟着模型走,不跟着名次走。数据重载时已有模型保留原色,见 computeColorSlots。
|
|
124
128
|
@property(nonatomic) NSDictionary<NSString *, NSNumber *> *colorSlots;
|
|
125
129
|
// 选中的模型 key;nil 是全部模型。
|
|
126
130
|
@property(nonatomic, copy) NSString *selectedKey;
|
|
@@ -316,10 +320,9 @@ static const NSTimeInterval UsagePageRefreshInterval = 60;
|
|
|
316
320
|
NSArray<NSString *> *ranked = [totals keysSortedByValueUsingComparator:^NSComparisonResult(NSNumber *a, NSNumber *b) {
|
|
317
321
|
return [b compare:a];
|
|
318
322
|
}];
|
|
319
|
-
NSUInteger colored = MIN(ranked.count, (NSUInteger)CCPetsChartColorCount);
|
|
320
323
|
NSMutableDictionary<NSString *, NSNumber *> *slots = [NSMutableDictionary dictionary];
|
|
321
324
|
NSMutableIndexSet *taken = [NSMutableIndexSet indexSet];
|
|
322
|
-
for (NSUInteger index = 0; index <
|
|
325
|
+
for (NSUInteger index = 0; index < ranked.count; index++) {
|
|
323
326
|
NSInteger previous = self.colorSlots[ranked[index]] ? self.colorSlots[ranked[index]].integerValue : -1;
|
|
324
327
|
if (previous < 0) continue;
|
|
325
328
|
slots[ranked[index]] = @(previous);
|
|
@@ -328,10 +331,6 @@ static const NSTimeInterval UsagePageRefreshInterval = 60;
|
|
|
328
331
|
NSUInteger next = 0;
|
|
329
332
|
for (NSUInteger index = 0; index < ranked.count; index++) {
|
|
330
333
|
if (slots[ranked[index]]) continue;
|
|
331
|
-
if (index >= colored) {
|
|
332
|
-
slots[ranked[index]] = @(-1);
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
334
|
while ([taken containsIndex:next]) next++;
|
|
336
335
|
slots[ranked[index]] = @((NSInteger)next);
|
|
337
336
|
[taken addIndex:next];
|
|
@@ -385,7 +384,7 @@ static const NSTimeInterval UsagePageRefreshInterval = 60;
|
|
|
385
384
|
|
|
386
385
|
- (void)render {
|
|
387
386
|
NSInteger rangeDays = [self rangeDays];
|
|
388
|
-
self.form.subtitleLabel.stringValue = [NSString stringWithFormat:L(@"Last %ld days · local
|
|
387
|
+
self.form.subtitleLabel.stringValue = [NSString stringWithFormat:L(@"Last %ld days · local usage logs"),
|
|
389
388
|
(long)rangeDays];
|
|
390
389
|
[self.form removeAllContent];
|
|
391
390
|
self.legendItems = [NSMutableDictionary dictionary];
|
|
@@ -401,6 +400,9 @@ static const NSTimeInterval UsagePageRefreshInterval = 60;
|
|
|
401
400
|
|
|
402
401
|
NSMutableDictionary *sum = SummedCounts([self.entries valueForKey:@"counts"]);
|
|
403
402
|
[self.form addView:[self kpiStripWithSum:sum rangeDays:rangeDays]];
|
|
403
|
+
if (Count(sum, @"background") > 0) {
|
|
404
|
+
[self.form addFootnote:L(@"Background usage is included in the total. Its input, output and cache breakdown is unavailable; the corresponding metrics cover recorded details only.")];
|
|
405
|
+
}
|
|
404
406
|
[self.form addView:[self chartCardView]];
|
|
405
407
|
if (self.entries.count > 0) [self.form addView:[self modelTable]];
|
|
406
408
|
[self renderChart];
|
|
@@ -409,11 +411,14 @@ static const NSTimeInterval UsagePageRefreshInterval = 60;
|
|
|
409
411
|
#pragma mark 指标条
|
|
410
412
|
|
|
411
413
|
// 五格和概览一样(同一个部件、同一套口径),只是总用量换成当前来源和区间的合计。
|
|
412
|
-
//
|
|
414
|
+
// 缓存写入和后台用量只在总用量标题后的 ⓘ 悬停展示,不在数字下方重复显示。
|
|
413
415
|
- (NSView *)kpiStripWithSum:(NSDictionary *)sum rangeDays:(NSInteger)rangeDays {
|
|
414
416
|
NSString *title = [NSString stringWithFormat:L(@"Last %ld days · Total"), (long)rangeDays];
|
|
415
417
|
NSMutableArray<NSArray<NSString *> *> *items = [CCPetsUsageMetricItems(title, sum, self.entries.count) mutableCopy];
|
|
416
|
-
|
|
418
|
+
NSString *details = [NSString stringWithFormat:@"%@\n%@",
|
|
419
|
+
[NSString stringWithFormat:L(@"Includes cached input %@"), CCPetsFormatTokens(Count(sum, @"cacheWrite"))],
|
|
420
|
+
[NSString stringWithFormat:L(@"Background usage %@"), CCPetsFormatTokens(Count(sum, @"background"))]];
|
|
421
|
+
items[0] = @[items[0][0], items[0][1], L(@"All tokens"), details];
|
|
417
422
|
NSView *row = CCPetsMetricRow(items);
|
|
418
423
|
CCPetsCardView *card = [CCPetsCardView new];
|
|
419
424
|
row.translatesAutoresizingMaskIntoConstraints = NO;
|
|
@@ -519,7 +524,6 @@ static const NSTimeInterval UsagePageRefreshInterval = 60;
|
|
|
519
524
|
|
|
520
525
|
NSMutableArray<NSDictionary *> *series = [NSMutableArray array];
|
|
521
526
|
NSUInteger dayCount = self.dayStamps.count;
|
|
522
|
-
NSMutableArray<NSNumber *> *otherValues = nil;
|
|
523
527
|
for (NSDictionary *entry in self.entries) {
|
|
524
528
|
if (selected && entry != selected) continue;
|
|
525
529
|
NSString *key = entry[@"key"];
|
|
@@ -533,23 +537,9 @@ static const NSTimeInterval UsagePageRefreshInterval = 60;
|
|
|
533
537
|
[values addObject:@(MetricValue(metric, day))];
|
|
534
538
|
[counts addObject:day];
|
|
535
539
|
}
|
|
536
|
-
// 第 9 名以后合并成一层「其他」,颜色不够分也看不清。单看一个模型时不合并。
|
|
537
|
-
if (!selected && [self.colorSlots[key] integerValue] < 0) {
|
|
538
|
-
if (!otherValues) {
|
|
539
|
-
otherValues = [NSMutableArray arrayWithCapacity:dayCount];
|
|
540
|
-
for (NSUInteger index = 0; index < dayCount; index++) [otherValues addObject:@0];
|
|
541
|
-
}
|
|
542
|
-
for (NSUInteger index = 0; index < dayCount; index++) {
|
|
543
|
-
otherValues[index] = @(otherValues[index].unsignedLongLongValue + values[index].unsignedLongLongValue);
|
|
544
|
-
}
|
|
545
|
-
continue;
|
|
546
|
-
}
|
|
547
540
|
[series addObject:@{@"title": ModelTitle(entry[@"model"]), @"color": [self colorForKey:key],
|
|
548
541
|
@"values": values, @"counts": counts}];
|
|
549
542
|
}
|
|
550
|
-
if (otherValues) {
|
|
551
|
-
[series addObject:@{@"title": L(@"Other"), @"color": CCPetsChartColor(-1), @"values": otherValues, @"counts": @[]}];
|
|
552
|
-
}
|
|
553
543
|
self.chart.days = self.dayStamps;
|
|
554
544
|
self.chart.series = series;
|
|
555
545
|
self.chart.metric = metric;
|
|
@@ -711,6 +701,11 @@ static const CGFloat ModelShareWidth = 130, ModelNumberWidth = 66, ModelRateWidt
|
|
|
711
701
|
row.toolTip = [NSString stringWithFormat:@"%@ %@ · %@ %@ · %@ %@", L(@"Input"),
|
|
712
702
|
CCPetsFormatTokens(Count(counts, @"input")), L(@"Cache Write"), CCPetsFormatTokens(Count(counts, @"cacheWrite")),
|
|
713
703
|
L(@"Output"), CCPetsFormatTokens(Count(counts, @"output"))];
|
|
704
|
+
if (Count(counts, @"background") > 0) {
|
|
705
|
+
row.toolTip = [row.toolTip stringByAppendingFormat:@"\n%@",
|
|
706
|
+
[NSString stringWithFormat:L(@"Background %@ · breakdown unavailable"),
|
|
707
|
+
CCPetsFormatTokens(Count(counts, @"background"))]];
|
|
708
|
+
}
|
|
714
709
|
return row;
|
|
715
710
|
}
|
|
716
711
|
|
|
@@ -42,7 +42,7 @@ static NSDictionary *MergeModelUsageResults(NSArray<NSDictionary *> *values) {
|
|
|
42
42
|
NSMutableDictionary *counts = models[model];
|
|
43
43
|
if (!counts) { counts = [NSMutableDictionary dictionary]; models[model] = counts; }
|
|
44
44
|
NSDictionary *incoming = day[@"models"][model];
|
|
45
|
-
for (NSString *key in @[@"input", @"cacheRead", @"cacheWrite", @"output", @"reasoning", @"requests"]) {
|
|
45
|
+
for (NSString *key in @[@"input", @"cacheRead", @"cacheWrite", @"output", @"reasoning", @"requests", @"background"]) {
|
|
46
46
|
counts[key] = @(Count(counts, key) + Count(incoming, key));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -55,7 +55,7 @@ static NSDictionary *MergeModelUsageResults(NSArray<NSDictionary *> *values) {
|
|
|
55
55
|
for (NSString *model in models) {
|
|
56
56
|
NSMutableDictionary *sum = totals[model];
|
|
57
57
|
if (!sum) { sum = [NSMutableDictionary dictionary]; totals[model] = sum; }
|
|
58
|
-
for (NSString *key in @[@"input", @"cacheRead", @"cacheWrite", @"output", @"reasoning", @"requests"]) {
|
|
58
|
+
for (NSString *key in @[@"input", @"cacheRead", @"cacheWrite", @"output", @"reasoning", @"requests", @"background"]) {
|
|
59
59
|
sum[key] = @(Count(sum, key) + Count(models[model], key));
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import "CCPetsWorkbenchPages.h"
|
|
2
|
+
#import "CCPetsBridgeStore.h"
|
|
2
3
|
#import "CCPetsDiagnosticsPage.h"
|
|
3
4
|
#import "CCPetsFormBuilder.h"
|
|
4
5
|
#import "CCPetsL10n.h"
|
|
@@ -632,7 +633,7 @@ static const CGFloat SessionStateWidth = 92, SessionTimeWidth = 72, SessionActio
|
|
|
632
633
|
kind:CCPetsStatusKindForAgentState(state)];
|
|
633
634
|
[chip.widthAnchor constraintLessThanOrEqualToConstant:SessionStateWidth].active = YES;
|
|
634
635
|
|
|
635
|
-
NSString *title = [session[@"
|
|
636
|
+
NSString *title = [session[@"displayName"] length] > 0 ? session[@"displayName"] : session[@"provider"];
|
|
636
637
|
NSTextField *name = CCPetsLabel(title, 13, NSFontWeightSemibold, CCPetsInkColor());
|
|
637
638
|
NSMutableArray<NSString *> *parts = [NSMutableArray arrayWithObject:session[@"provider"]];
|
|
638
639
|
if ([session[@"terminal"] length] > 0) [parts addObject:session[@"terminal"]];
|
|
@@ -746,7 +747,7 @@ static const CGFloat SessionStateWidth = 92, SessionTimeWidth = 72, SessionActio
|
|
|
746
747
|
NSString *session = entry[@"session"];
|
|
747
748
|
NSUInteger count = [entry[@"count"] unsignedIntegerValue];
|
|
748
749
|
NSTextField *icon = CCPetsLabel(@"", 12, NSFontWeightRegular, CCPetsTertiaryInkColor());
|
|
749
|
-
NSTextField *name = CCPetsLabel(entry[@"name"], 12, NSFontWeightSemibold, CCPetsInkColor());
|
|
750
|
+
NSTextField *name = CCPetsLabel(entry[@"displayName"] ?: entry[@"name"], 12, NSFontWeightSemibold, CCPetsInkColor());
|
|
750
751
|
NSTextField *detail = CCPetsLabel(count == 1 ? L(@"1 message waiting. Say anything in that terminal to deliver it.")
|
|
751
752
|
: [NSString stringWithFormat:L(@"%lu messages waiting. Say anything in that terminal to deliver them."),
|
|
752
753
|
(unsigned long)count], 12, NSFontWeightRegular, CCPetsSecondaryInkColor());
|
|
@@ -762,7 +763,8 @@ static const CGFloat SessionStateWidth = 92, SessionTimeWidth = 72, SessionActio
|
|
|
762
763
|
NSTextField *time = CCPetsNumberLabel([NSDateFormatter localizedStringFromDate:date
|
|
763
764
|
dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle], 12, NSFontWeightRegular,
|
|
764
765
|
CCPetsTertiaryInkColor());
|
|
765
|
-
NSTextField *route = [self routeFrom:delivery[@"
|
|
766
|
+
NSTextField *route = [self routeFrom:CCBridgeSessionDisplayName(delivery[@"fromIdentity"])
|
|
767
|
+
to:CCBridgeSessionDisplayName(delivery[@"toIdentity"])];
|
|
766
768
|
NSTextField *detail = CCPetsLabel(@"", 12, NSFontWeightRegular, CCPetsSecondaryInkColor());
|
|
767
769
|
BOOL unseen = [delivery[@"unseen"] boolValue];
|
|
768
770
|
CCPetsChipView *chip = [[CCPetsChipView alloc] initWithText:unseen ? L(@"Unread") : L(@"Delivered")
|