cc-pets 1.0.0 → 1.0.3

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.
@@ -0,0 +1,276 @@
1
+ #import "CCPetsUsage.h"
2
+ #import "CCPetsPaths.h"
3
+ #import <sys/stat.h>
4
+ #import <unistd.h>
5
+
6
+ int RecordClaudeUsage(void) {
7
+ NSData *input = [NSFileHandle.fileHandleWithStandardInput readDataToEndOfFile];
8
+ NSDictionary *payload = input.length > 0 ? [NSJSONSerialization JSONObjectWithData:input options:0 error:nil] : nil;
9
+ NSDictionary *limits = [payload[@"rate_limits"] isKindOfClass:NSDictionary.class] ? payload[@"rate_limits"] : nil;
10
+ if (!limits) return EXIT_SUCCESS;
11
+ NSData *json = [NSJSONSerialization dataWithJSONObject:limits options:0 error:nil];
12
+ if (!json) return EXIT_SUCCESS;
13
+ if (![json writeToFile:ClaudeUsagePath() options:NSDataWritingAtomic error:nil]) return EXIT_SUCCESS;
14
+ chmod(ClaudeUsagePath().fileSystemRepresentation, S_IRUSR | S_IWUSR);
15
+ return EXIT_SUCCESS;
16
+ }
17
+
18
+ NSDictionary *LatestClaudeUsage(void) {
19
+ NSData *data = [NSData dataWithContentsOfFile:ClaudeUsagePath()];
20
+ NSDictionary *limits = data ? [NSJSONSerialization JSONObjectWithData:data options:0 error:nil] : nil;
21
+ if (![limits isKindOfClass:NSDictionary.class]) return nil;
22
+ id fiveHour = [limits[@"five_hour"] isKindOfClass:NSDictionary.class] ? limits[@"five_hour"] : NSNull.null;
23
+ id week = [limits[@"seven_day"] isKindOfClass:NSDictionary.class] ? limits[@"seven_day"] : NSNull.null;
24
+ return @{@"fiveHour": fiveHour, @"week": week};
25
+ }
26
+
27
+ static BOOL AllDigits(NSString *text) {
28
+ if (text.length == 0) return NO;
29
+ static NSCharacterSet *nonDigits;
30
+ static dispatch_once_t once;
31
+ dispatch_once(&once, ^{
32
+ nonDigits = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"].invertedSet;
33
+ });
34
+ return [text rangeOfCharacterFromSet:nonDigits].location == NSNotFound;
35
+ }
36
+
37
+ // 会话目录是零填充的 YYYY/MM/DD,字典序等于时间序,因此倒序取名字即可,不必 stat。
38
+ static NSArray<NSURL *> *DescendingNumericSubdirectories(NSURL *directory) {
39
+ NSArray<NSURL *> *contents = [NSFileManager.defaultManager contentsOfDirectoryAtURL:directory
40
+ includingPropertiesForKeys:@[NSURLIsDirectoryKey]
41
+ options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
42
+ NSMutableArray<NSURL *> *result = [NSMutableArray arrayWithCapacity:contents.count];
43
+ for (NSURL *url in contents) {
44
+ NSNumber *isDirectory = nil;
45
+ if (![url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil]) continue;
46
+ if (!isDirectory.boolValue || !AllDigits(url.lastPathComponent)) continue;
47
+ [result addObject:url];
48
+ }
49
+ [result sortUsingComparator:^NSComparisonResult(NSURL *left, NSURL *right) {
50
+ return [right.lastPathComponent compare:left.lastPathComponent];
51
+ }];
52
+ return result;
53
+ }
54
+
55
+ // 单个目录内 mtime 最新的 .jsonl。文件名格式不是契约,因此文件一律按 mtime 选,
56
+ // 只有日期目录名吃字典序。
57
+ static NSURL *NewestSessionFileInDirectory(NSURL *directory, NSDate **outDate) {
58
+ NSArray<NSURLResourceKey> *keys = @[NSURLContentModificationDateKey, NSURLIsRegularFileKey];
59
+ NSArray<NSURL *> *contents = [NSFileManager.defaultManager contentsOfDirectoryAtURL:directory
60
+ includingPropertiesForKeys:keys options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
61
+ NSURL *newest = nil;
62
+ NSDate *newestDate = NSDate.distantPast;
63
+ for (NSURL *url in contents) {
64
+ if (![url.pathExtension isEqualToString:@"jsonl"]) continue;
65
+ NSDictionary *values = [url resourceValuesForKeys:keys error:nil];
66
+ if (![values[NSURLIsRegularFileKey] boolValue]) continue;
67
+ NSDate *date = values[NSURLContentModificationDateKey] ?: NSDate.distantPast;
68
+ if ([date compare:newestDate] == NSOrderedDescending) {
69
+ newest = url;
70
+ newestDate = date;
71
+ }
72
+ }
73
+ if (outDate) *outDate = newest ? newestDate : nil;
74
+ return newest;
75
+ }
76
+
77
+ static const NSUInteger MinimumExaminedSessionDays = 3;
78
+ static const NSUInteger MaximumExaminedSessionDays = 40;
79
+
80
+ // 按 YYYY/MM/DD 倒序下钻,成本与历史会话总量无关,只与近期活跃度有关。
81
+ // 收手条件必须同时满足“看够 MinimumExaminedSessionDays 个日期目录”和“已经找到过文件”:
82
+ // 只写前者的话,用户闲置数天后冷启动会一无所获,比全量扫描更差。
83
+ static NSURL *NewestCodexSessionURL(NSURL *sessionsURL) {
84
+ NSURL *newest = nil;
85
+ NSDate *newestDate = NSDate.distantPast;
86
+ NSUInteger examinedDays = 0;
87
+ for (NSURL *year in DescendingNumericSubdirectories(sessionsURL)) {
88
+ for (NSURL *month in DescendingNumericSubdirectories(year)) {
89
+ for (NSURL *day in DescendingNumericSubdirectories(month)) {
90
+ NSDate *date = nil;
91
+ NSURL *candidate = NewestSessionFileInDirectory(day, &date);
92
+ if (candidate && [date compare:newestDate] == NSOrderedDescending) {
93
+ newest = candidate;
94
+ newestDate = date;
95
+ }
96
+ examinedDays += 1;
97
+ if (examinedDays >= MinimumExaminedSessionDays && newest) return newest;
98
+ if (examinedDays >= MaximumExaminedSessionDays) return newest;
99
+ }
100
+ }
101
+ }
102
+ // 兜底:非 YYYY/MM/DD 布局(例如直接摊在 sessions/ 下)仍然能被发现。
103
+ return newest ?: NewestSessionFileInDirectory(sessionsURL, NULL);
104
+ }
105
+
106
+ static NSDictionary *UsageFromCodexLine(NSData *lineData) {
107
+ if (lineData.length == 0) return nil;
108
+ // 快速拒绝直接在字节上做,不再为每行分配 NSString。
109
+ static NSData *marker;
110
+ static dispatch_once_t once;
111
+ dispatch_once(&once, ^{
112
+ marker = [@"\"type\":\"token_count\"" dataUsingEncoding:NSUTF8StringEncoding];
113
+ });
114
+ if ([lineData rangeOfData:marker options:0
115
+ range:NSMakeRange(0, lineData.length)].location == NSNotFound) return nil;
116
+ // 逐层校验类型:顶层若是数组、payload 若是字符串,下面的下标访问会抛
117
+ // unrecognized selector 直接崩掉桌宠。
118
+ id rootValue = [NSJSONSerialization JSONObjectWithData:lineData options:0 error:nil];
119
+ if (![rootValue isKindOfClass:NSDictionary.class]) return nil;
120
+ id payloadValue = ((NSDictionary *)rootValue)[@"payload"];
121
+ if (![payloadValue isKindOfClass:NSDictionary.class]) return nil;
122
+ NSDictionary *payload = payloadValue;
123
+ id typeValue = payload[@"type"];
124
+ if (![typeValue isKindOfClass:NSString.class] ||
125
+ ![(NSString *)typeValue isEqualToString:@"token_count"]) return nil;
126
+ id limitsValue = payload[@"rate_limits"];
127
+ if (![limitsValue isKindOfClass:NSDictionary.class]) return nil;
128
+ NSDictionary *limits = limitsValue;
129
+ id primaryValue = limits[@"primary"];
130
+ id secondaryValue = limits[@"secondary"];
131
+ NSDictionary *primary = [primaryValue isKindOfClass:NSDictionary.class] ? primaryValue : nil;
132
+ NSDictionary *secondary = [secondaryValue isKindOfClass:NSDictionary.class] ? secondaryValue : nil;
133
+ NSDictionary *fiveHour = nil;
134
+ NSDictionary *week = nil;
135
+ for (NSDictionary *quota in @[primary ?: @{}, secondary ?: @{}]) {
136
+ NSInteger minutes = [quota[@"window_minutes"] integerValue];
137
+ if (minutes == 300) fiveHour = quota;
138
+ if (minutes == 10080) week = quota;
139
+ }
140
+ return @{
141
+ @"fiveHour": fiveHour ?: NSNull.null,
142
+ @"week": week ?: NSNull.null
143
+ };
144
+ }
145
+
146
+ // token_count 行几乎总在文件末尾,因此从尾部反向按 \n 切片逐行试,命中即停。
147
+ // 原实现会把整段(最多 2MB)解码成 NSString、再切成全部行、再把每行编码回 NSData、
148
+ // 又解码回 NSString 查子串,等于来回往返两遍。
149
+ static NSDictionary *LatestUsageInData(NSData *data) {
150
+ const uint8_t *bytes = data.bytes;
151
+ NSUInteger end = data.length;
152
+ while (end > 0) {
153
+ NSUInteger start = end;
154
+ while (start > 0 && bytes[start - 1] != '\n') start -= 1;
155
+ if (end > start) {
156
+ NSDictionary *usage = UsageFromCodexLine(
157
+ [data subdataWithRange:NSMakeRange(start, end - start)]);
158
+ if (usage) return usage;
159
+ }
160
+ end = start > 0 ? start - 1 : 0;
161
+ }
162
+ return nil;
163
+ }
164
+
165
+ NSDictionary *LatestUsage(void) {
166
+ NSString *home = NSProcessInfo.processInfo.environment[@"CODEX_HOME"];
167
+ if (home.length == 0) home = [NSHomeDirectory() stringByAppendingPathComponent:@".codex"];
168
+ NSURL *sessions = [NSURL fileURLWithPath:[home stringByAppendingPathComponent:@"sessions"]];
169
+ NSURL *newest = NewestCodexSessionURL(sessions);
170
+ if (!newest) return nil;
171
+
172
+ NSFileHandle *handle = [NSFileHandle fileHandleForReadingFromURL:newest error:nil];
173
+ if (!handle) return nil;
174
+ unsigned long long size = [handle seekToEndOfFile];
175
+ [handle seekToFileOffset:size > 2 * 1024 * 1024 ? size - 2 * 1024 * 1024 : 0];
176
+ NSData *tail = [handle readDataToEndOfFile];
177
+ [handle closeFile];
178
+ return LatestUsageInData(tail);
179
+ }
180
+
181
+ @implementation CodexUsageReader
182
+ - (instancetype)init {
183
+ if ((self = [super init])) {
184
+ NSString *home = NSProcessInfo.processInfo.environment[@"CODEX_HOME"];
185
+ if (home.length == 0) home = [NSHomeDirectory() stringByAppendingPathComponent:@".codex"];
186
+ _sessionsURL = [NSURL fileURLWithPath:[home stringByAppendingPathComponent:@"sessions"]];
187
+ _partialLine = [NSMutableData data];
188
+ }
189
+ return self;
190
+ }
191
+ - (void)selectSessionURL:(NSURL *)url {
192
+ self.sessionURL = url;
193
+ self.offset = 0;
194
+ [self.partialLine setLength:0];
195
+ if (!url) {
196
+ self.usage = nil;
197
+ return;
198
+ }
199
+ NSFileHandle *handle = [NSFileHandle fileHandleForReadingFromURL:url error:nil];
200
+ if (!handle) return;
201
+ unsigned long long size = [handle seekToEndOfFile];
202
+ unsigned long long start = size > 2 * 1024 * 1024 ? size - 2 * 1024 * 1024 : 0;
203
+ [handle seekToFileOffset:start];
204
+ NSData *tail = [handle readDataToEndOfFile];
205
+ [handle closeFile];
206
+ self.offset = start + tail.length;
207
+ self.usage = LatestUsageInData(tail);
208
+
209
+ const uint8_t *bytes = tail.bytes;
210
+ NSUInteger lastNewline = NSNotFound;
211
+ for (NSUInteger index = tail.length; index > 0; index--) {
212
+ if (bytes[index - 1] == '\n') {
213
+ lastNewline = index - 1;
214
+ break;
215
+ }
216
+ }
217
+ if (lastNewline == NSNotFound) [self.partialLine appendData:tail];
218
+ else if (lastNewline + 1 < tail.length) {
219
+ [self.partialLine appendData:[tail subdataWithRange:NSMakeRange(lastNewline + 1, tail.length - lastNewline - 1)]];
220
+ }
221
+ }
222
+ - (void)consumeIncrementalData:(NSData *)data {
223
+ if (data.length == 0) return;
224
+ [self.partialLine appendData:data];
225
+ const uint8_t *bytes = self.partialLine.bytes;
226
+ NSUInteger lineStart = 0;
227
+ for (NSUInteger index = 0; index < self.partialLine.length; index++) {
228
+ if (bytes[index] != '\n') continue;
229
+ NSData *line = [self.partialLine subdataWithRange:NSMakeRange(lineStart, index - lineStart)];
230
+ NSDictionary *newUsage = UsageFromCodexLine(line);
231
+ if (newUsage) self.usage = newUsage;
232
+ lineStart = index + 1;
233
+ }
234
+ if (lineStart > 0) {
235
+ NSData *remainder = [self.partialLine subdataWithRange:
236
+ NSMakeRange(lineStart, self.partialLine.length - lineStart)];
237
+ self.partialLine = [remainder mutableCopy];
238
+ }
239
+ if (self.partialLine.length > 2 * 1024 * 1024) [self.partialLine setLength:0];
240
+ }
241
+ - (NSDictionary *)refresh {
242
+ NSTimeInterval now = NSDate.date.timeIntervalSince1970;
243
+ BOOL needsFullDiscovery = !self.sessionURL || now - self.lastFullDiscovery >= 60;
244
+ NSURL *candidate = nil;
245
+ if (needsFullDiscovery) {
246
+ candidate = NewestCodexSessionURL(self.sessionsURL);
247
+ self.lastFullDiscovery = now;
248
+ } else {
249
+ candidate = NewestSessionFileInDirectory(
250
+ self.sessionURL.URLByDeletingLastPathComponent, NULL);
251
+ }
252
+ if (candidate && ![candidate.path isEqualToString:self.sessionURL.path]) [self selectSessionURL:candidate];
253
+ if (!self.sessionURL) return self.usage;
254
+
255
+ NSFileHandle *handle = [NSFileHandle fileHandleForReadingFromURL:self.sessionURL error:nil];
256
+ if (!handle) {
257
+ self.lastFullDiscovery = 0;
258
+ return self.usage;
259
+ }
260
+ unsigned long long size = [handle seekToEndOfFile];
261
+ if (size < self.offset) {
262
+ [handle closeFile];
263
+ [self selectSessionURL:self.sessionURL];
264
+ return self.usage;
265
+ }
266
+ if (size > self.offset) {
267
+ unsigned long long start = self.offset;
268
+ [handle seekToFileOffset:start];
269
+ NSData *newData = [handle readDataToEndOfFile];
270
+ self.offset = start + newData.length;
271
+ [self consumeIncrementalData:newData];
272
+ }
273
+ [handle closeFile];
274
+ return self.usage;
275
+ }
276
+ @end
@@ -0,0 +1,10 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ #ifndef CC_PETS_VERSION
4
+ #define CC_PETS_VERSION "unknown"
5
+ #endif
6
+
7
+ // 只接受严格的三段纯数字版本号;valid 为 NO 时返回值无意义。
8
+ // 自动更新会把比较结果作为是否升级的唯一依据,所以这里刻意不接受预发布号。
9
+ NSComparisonResult CompareStableVersions(NSString *left, NSString *right, BOOL *valid);
10
+ int RestartAfterPID(pid_t pid, NSString *appPath, BOOL managed);
@@ -0,0 +1,62 @@
1
+ #import "CCPetsVersion.h"
2
+ #import <signal.h>
3
+ #import <unistd.h>
4
+ #import <errno.h>
5
+
6
+ static NSArray<NSNumber *> *StableVersionComponents(NSString *version) {
7
+ if (![version isKindOfClass:NSString.class]) return nil;
8
+ NSArray<NSString *> *parts = [version componentsSeparatedByString:@"."];
9
+ if (parts.count != 3) return nil;
10
+ NSCharacterSet *nonDigits = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"].invertedSet;
11
+ NSMutableArray<NSNumber *> *components = [NSMutableArray arrayWithCapacity:3];
12
+ for (NSString *part in parts) {
13
+ if (part.length == 0 || part.length > 9 ||
14
+ (part.length > 1 && [part hasPrefix:@"0"]) ||
15
+ [part rangeOfCharacterFromSet:nonDigits].location != NSNotFound) return nil;
16
+ [components addObject:@(part.longLongValue)];
17
+ }
18
+ return components;
19
+ }
20
+
21
+ NSComparisonResult CompareStableVersions(NSString *left, NSString *right, BOOL *valid) {
22
+ NSArray<NSNumber *> *leftParts = StableVersionComponents(left);
23
+ NSArray<NSNumber *> *rightParts = StableVersionComponents(right);
24
+ if (!leftParts || !rightParts) {
25
+ if (valid) *valid = NO;
26
+ return NSOrderedSame;
27
+ }
28
+ if (valid) *valid = YES;
29
+ for (NSUInteger index = 0; index < 3; index++) {
30
+ long long leftValue = leftParts[index].longLongValue;
31
+ long long rightValue = rightParts[index].longLongValue;
32
+ if (leftValue < rightValue) return NSOrderedAscending;
33
+ if (leftValue > rightValue) return NSOrderedDescending;
34
+ }
35
+ return NSOrderedSame;
36
+ }
37
+
38
+ int RestartAfterPID(pid_t pid, NSString *appPath, BOOL managed) {
39
+ for (NSUInteger attempt = 0; attempt < 300; attempt++) {
40
+ if (pid <= 1 || (kill(pid, 0) != 0 && errno == ESRCH)) break;
41
+ usleep(100000);
42
+ }
43
+ if (pid > 1 && (kill(pid, 0) == 0 || errno == EPERM)) {
44
+ fprintf(stderr, "等待旧版 CC Pets 退出超时。\n");
45
+ return EXIT_FAILURE;
46
+ }
47
+
48
+ NSString *openPath = NSProcessInfo.processInfo.environment[@"CC_PETS_OPEN_PATH"];
49
+ if (openPath.length == 0) openPath = @"/usr/bin/open";
50
+ NSTask *task = [NSTask new];
51
+ task.executableURL = [NSURL fileURLWithPath:openPath];
52
+ NSMutableArray<NSString *> *arguments = [NSMutableArray arrayWithObjects:@"-g", appPath, nil];
53
+ if (managed) [arguments addObjectsFromArray:@[@"--args", @"--managed"]];
54
+ task.arguments = arguments;
55
+ NSError *error = nil;
56
+ if (![task launchAndReturnError:&error]) {
57
+ fprintf(stderr, "无法重新启动 CC Pets: %s\n", error.localizedDescription.UTF8String);
58
+ return EXIT_FAILURE;
59
+ }
60
+ [task waitUntilExit];
61
+ return task.terminationStatus == EXIT_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE;
62
+ }
@@ -0,0 +1,5 @@
1
+ #import <Cocoa/Cocoa.h>
2
+
3
+ // 菜单里用的自绘开关。系统 NSSwitch 在 NSMenuItem 的自定义视图里对比度不足。
4
+ @interface MenuToggleSwitch : NSButton
5
+ @end
@@ -0,0 +1,47 @@
1
+ #import "MenuToggleSwitch.h"
2
+
3
+ @implementation MenuToggleSwitch
4
+ - (instancetype)initWithFrame:(NSRect)frameRect {
5
+ if ((self = [super initWithFrame:frameRect])) {
6
+ self.bordered = NO;
7
+ self.title = @"";
8
+ self.buttonType = NSButtonTypeToggle;
9
+ self.focusRingType = NSFocusRingTypeNone;
10
+ [self setAccessibilityRole:NSAccessibilityCheckBoxRole];
11
+ }
12
+ return self;
13
+ }
14
+ - (void)setState:(NSControlStateValue)value {
15
+ [super setState:value];
16
+ self.needsDisplay = YES;
17
+ }
18
+ - (void)drawRect:(NSRect)dirtyRect {
19
+ NSRect track = NSInsetRect(self.bounds, 1, 2);
20
+ BOOL enabled = self.state == NSControlStateValueOn;
21
+ NSColor *trackColor = enabled
22
+ ? [NSColor.controlAccentColor colorWithAlphaComponent:self.highlighted ? 0.72 : 0.96]
23
+ : [NSColor colorWithWhite:self.highlighted ? 0.38 : 0.46 alpha:0.82];
24
+ [trackColor setFill];
25
+ NSBezierPath *trackPath = [NSBezierPath bezierPathWithRoundedRect:track
26
+ xRadius:NSHeight(track) / 2.0 yRadius:NSHeight(track) / 2.0];
27
+ [trackPath fill];
28
+ [[NSColor colorWithWhite:0 alpha:enabled ? 0.08 : 0.16] setStroke];
29
+ trackPath.lineWidth = 0.8;
30
+ [trackPath stroke];
31
+
32
+ CGFloat diameter = NSHeight(track) - 4;
33
+ CGFloat knobX = enabled
34
+ ? NSMaxX(track) - diameter - 2
35
+ : NSMinX(track) + 2;
36
+ NSRect knob = NSMakeRect(knobX, NSMidY(track) - diameter / 2.0, diameter, diameter);
37
+ [NSGraphicsContext saveGraphicsState];
38
+ NSShadow *shadow = [NSShadow new];
39
+ shadow.shadowColor = [NSColor colorWithWhite:0 alpha:0.24];
40
+ shadow.shadowBlurRadius = 1.5;
41
+ shadow.shadowOffset = NSMakeSize(0, -0.5);
42
+ [shadow set];
43
+ [NSColor.whiteColor setFill];
44
+ [[NSBezierPath bezierPathWithOvalInRect:knob] fill];
45
+ [NSGraphicsContext restoreGraphicsState];
46
+ }
47
+ @end
@@ -0,0 +1,33 @@
1
+ #import <Cocoa/Cocoa.h>
2
+
3
+ @interface PetView : NSView <NSMenuDelegate>
4
+ @property NSImage *sheet;
5
+ @property NSInteger spriteRowCount;
6
+ @property(nonatomic) NSInteger lookDirection;
7
+ @property NSInteger frameIndex;
8
+ @property NSInteger rowIndex;
9
+ @property NSArray<NSNumber *> *frames;
10
+ @property NSUInteger sequenceIndex;
11
+ @property BOOL oneShot;
12
+ @property BOOL draggingPet;
13
+ @property BOOL agentActive;
14
+ @property NSPoint dragStartMouse;
15
+ @property NSPoint dragStartWindowOrigin;
16
+ @property NSString *currentPetID;
17
+ @property id globalMouseMonitor;
18
+ @property id localMouseMonitor;
19
+ @property(copy) void (^pocketHoverChanged)(BOOL hovering);
20
+ @property(copy) void (^positionChanged)(void);
21
+ @property(copy) void (^dragStateChanged)(BOOL dragging);
22
+ @property(copy) NSArray<NSDictionary *> *(^petOptionsRequested)(void);
23
+ @property(copy) void (^switchPetRequested)(NSString *petID);
24
+ @property NSMutableDictionary<NSString *, NSImage *> *petMenuPreviewCache;
25
+ @property NSPanel *petMenuPreviewPanel;
26
+ @property NSImageView *petMenuPreviewImageView;
27
+ @property NSTimer *frameTimer;
28
+ @property(nonatomic) BOOL animationSuspended;
29
+ - (instancetype)initWithFrame:(NSRect)frame sheet:(NSImage *)sheet rowCount:(NSInteger)rowCount;
30
+ - (void)applySheet:(NSImage *)sheet petID:(NSString *)petID rowCount:(NSInteger)rowCount;
31
+ - (void)handleAgentEvent:(NSString *)event tool:(NSString *)tool failed:(BOOL)failed;
32
+ - (void)playRow:(NSInteger)row throughFrame:(NSInteger)last oneShot:(BOOL)oneShot;
33
+ @end