cc-pets 1.0.1 → 1.0.4
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/CHANGELOG.md +5 -0
- package/README.md +12 -2
- package/Sources/CCPets/CCPetsAppDelegate.h +54 -0
- package/Sources/CCPets/CCPetsAppDelegate.m +1158 -0
- package/Sources/CCPets/CCPetsCleanup.h +7 -0
- package/Sources/CCPets/CCPetsCleanup.m +126 -0
- package/Sources/CCPets/CCPetsEvents.h +10 -0
- package/Sources/CCPets/CCPetsEvents.m +232 -0
- package/Sources/CCPets/CCPetsImageLoader.h +4 -0
- package/Sources/CCPets/CCPetsImageLoader.m +36 -0
- package/Sources/CCPets/CCPetsPaths.h +23 -0
- package/Sources/CCPets/CCPetsPaths.m +48 -0
- package/Sources/CCPets/CCPetsPreviews.h +6 -0
- package/Sources/CCPets/CCPetsPreviews.m +159 -0
- package/Sources/CCPets/CCPetsQuotaHistory.h +7 -0
- package/Sources/CCPets/CCPetsQuotaHistory.m +83 -0
- package/Sources/CCPets/CCPetsUsage.h +19 -0
- package/Sources/CCPets/CCPetsUsage.m +289 -0
- package/Sources/CCPets/CCPetsUsageMonitor.h +10 -0
- package/Sources/CCPets/CCPetsUsageMonitor.m +163 -0
- package/Sources/CCPets/CCPetsVersion.h +10 -0
- package/Sources/CCPets/CCPetsVersion.m +62 -0
- package/Sources/CCPets/MenuToggleSwitch.h +5 -0
- package/Sources/CCPets/MenuToggleSwitch.m +47 -0
- package/Sources/CCPets/PetView.h +35 -0
- package/Sources/CCPets/PetView.m +511 -0
- package/Sources/CCPets/QuotaDashboardView.h +23 -0
- package/Sources/CCPets/QuotaDashboardView.m +318 -0
- package/Sources/CCPets/main.m +11 -2528
- package/bin/cc-pets +5 -0
- package/bin/claude-with-pet +2 -1
- package/bin/codex-with-pet +3 -1
- package/package.json +2 -3
- package/scripts/build.sh +20 -1
- package/scripts/install-git-hooks.sh +47 -0
- package/scripts/uninstall-app.sh +9 -0
- package/scripts/uninstall-shell-integration.sh +50 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
- 新增 `cc-pets clean` 和带确认的 `cc-pets uninstall --purge`,并自动清理测试临时目录与过期运行状态。
|
|
8
|
+
- 更新日志每次更新前截断,并限制为最近 1 MB,避免长期残留增长。
|
|
9
|
+
- Codex/Claude 额度读取改为 FSEvents/VNODE 事件监听,并保留 120 秒容错刷新,降低空闲文件扫描与 JSON 解析。
|
|
10
|
+
- 精灵图按显示尺寸降采样,菜单预览改用有限缓存;待审批记录增加 TTL 与容量上限。
|
|
11
|
+
- 低电量模式和系统“减少动态效果”开启时自动降低动画刷新频率。
|
|
7
12
|
- 新增可展开折叠的玻璃 Agent 状态卡片、活跃 CLI 会话数徽标和可选的完成、失败、审批系统通知。
|
|
8
13
|
- 历史记录与系统通知设置改用右侧高对比度迷你开关,支持在菜单保持展开时连续调整。
|
|
9
14
|
- 折叠圆钮固定锚定在桌宠头部右上区域,展开和折叠时不再跳动。
|
package/README.md
CHANGED
|
@@ -134,13 +134,17 @@ cc-pets install
|
|
|
134
134
|
```bash
|
|
135
135
|
git clone https://gitee.com/wangxinyusqn/cc-pets.git
|
|
136
136
|
cd cc-pets
|
|
137
|
-
npm install -g . --
|
|
137
|
+
npm install -g . --ignore-scripts
|
|
138
|
+
cc-pets install
|
|
138
139
|
# 首次安装后新开一个终端
|
|
139
140
|
codex
|
|
140
141
|
# 或
|
|
141
142
|
claude
|
|
142
143
|
```
|
|
143
144
|
|
|
145
|
+
npm 12 会把本地目录安装识别为项目范围安装,不接受命令行传入的 `--allow-scripts`。
|
|
146
|
+
因此本地源码安装显式跳过生命周期脚本,再通过 `cc-pets install` 执行可重复的初始化流程。
|
|
147
|
+
|
|
144
148
|
两种方式都会安装 `cc-pets`、`codex-with-pet` 和 `claude-with-pet`。
|
|
145
149
|
npm 的安装后脚本会自动构建原生应用、安装两套 Agent Hooks,并向 `~/.zshrc` 追加带明确标记的
|
|
146
150
|
`codex` 与 `claude` alias,不会覆盖真实的 CLI 二进制。首次安装需要新开终端让 alias 生效;以后升级只需执行 npm 命令。
|
|
@@ -202,6 +206,9 @@ cc-pets --status
|
|
|
202
206
|
# 查看本机额度历史 JSON
|
|
203
207
|
cc-pets --history
|
|
204
208
|
|
|
209
|
+
# 清理可重建的临时状态、更新日志和构建缓存,保留历史、配置与偏好
|
|
210
|
+
cc-pets clean
|
|
211
|
+
|
|
205
212
|
# 从标准输入发送第三方 Provider 状态事件
|
|
206
213
|
printf '%s' '{"schemaVersion":1,"provider":"MyAgent","state":"thinking"}' \
|
|
207
214
|
| cc-pets provider-event
|
|
@@ -212,6 +219,9 @@ cc-pets install
|
|
|
212
219
|
# 安全移除 Hooks、恢复 Claude status line,并清理 shell alias
|
|
213
220
|
cc-pets uninstall
|
|
214
221
|
|
|
222
|
+
# 完整移除集成、应用和全部本地数据;执行前会再次确认
|
|
223
|
+
cc-pets uninstall --purge
|
|
224
|
+
|
|
215
225
|
# 仅删除 ~/Applications 中的 macOS 应用(不会删除 npm 包或 Hooks)
|
|
216
226
|
cc-pets uninstall-app
|
|
217
227
|
|
|
@@ -242,7 +252,7 @@ Claude.ai Pro/Max 订阅账号,并在会话完成首次 API 响应后出现;
|
|
|
242
252
|
额度详情面板使用青色区分 Codex、紫色区分 Claude。5 小时剩余额度使用进度条,周剩余
|
|
243
253
|
额度使用环形进度,右侧展示对应的周重置时间。服务端的 Unix 时间戳会使用 Mac 当前系统时区格式化为
|
|
244
254
|
`M/d HH:mm:ss`;因此它与 CLI 中标注其他时区的同一时刻可能日期和小时不同,但代表同一个真实时间。
|
|
245
|
-
|
|
255
|
+
应用通过文件事件实时读取额度,并保留 120 秒容错刷新;右上角刷新按钮也可立即读取本地数据。Codex 数据随本地 session 更新,Claude 数据则要等 Claude Code
|
|
246
256
|
下一次把 `rate_limits` 传给 status line 后才会变化,按钮不会主动请求 Claude 服务端。
|
|
247
257
|
面板使用原生 AppKit 毛玻璃材质,以紧凑悬浮卡片形式显示在桌宠左上方,并优先使用本机官方 Codex、Claude 应用
|
|
248
258
|
图标。鼠标从口袋移动到面板后可继续停留查看,移出两者后面板会延迟收起;拖动桌宠时
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#import <Cocoa/Cocoa.h>
|
|
2
|
+
#import "PetView.h"
|
|
3
|
+
#import "QuotaDashboardView.h"
|
|
4
|
+
#import "CCPetsUsageMonitor.h"
|
|
5
|
+
|
|
6
|
+
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
|
7
|
+
@property NSPanel *panel;
|
|
8
|
+
@property NSPanel *quotaPanel;
|
|
9
|
+
@property NSPanel *statusPanel;
|
|
10
|
+
@property NSVisualEffectView *statusGlass;
|
|
11
|
+
@property NSTextField *statusTitleLabel;
|
|
12
|
+
@property NSTextField *statusDetailLabel;
|
|
13
|
+
@property NSButton *statusIconButton;
|
|
14
|
+
@property NSPanel *statusTogglePanel;
|
|
15
|
+
@property NSVisualEffectView *statusToggleGlass;
|
|
16
|
+
@property NSButton *statusToggleButton;
|
|
17
|
+
@property BOOL statusBubbleExpanded;
|
|
18
|
+
@property BOOL statusBubbleAbove;
|
|
19
|
+
@property BOOL hasAgentStatus;
|
|
20
|
+
@property NSInteger liveClientCount;
|
|
21
|
+
@property NSString *lastStatusState;
|
|
22
|
+
@property NSString *lastStatusProvider;
|
|
23
|
+
@property NSTimeInterval lastStatusTimestamp;
|
|
24
|
+
@property NSSet<NSString *> *liveClientProviders;
|
|
25
|
+
@property BOOL hasUnlabeledClient;
|
|
26
|
+
@property NSMutableDictionary<NSString *, NSDictionary *> *pendingApprovalRecords;
|
|
27
|
+
@property QuotaDashboardView *quotaView;
|
|
28
|
+
@property BOOL managedByCLI;
|
|
29
|
+
@property BOOL pocketHovering;
|
|
30
|
+
@property BOOL dashboardHovering;
|
|
31
|
+
@property BOOL petDragging;
|
|
32
|
+
@property NSString *binaryDirectory;
|
|
33
|
+
@property PetView *petView;
|
|
34
|
+
@property CCPetsUsageMonitor *usageMonitor;
|
|
35
|
+
@property unsigned long long agentEventOffset;
|
|
36
|
+
@property NSMutableData *agentEventPartialLine;
|
|
37
|
+
@property dispatch_source_t agentEventSource;
|
|
38
|
+
@property BOOL agentEventReaderInitialized;
|
|
39
|
+
@property BOOL checkingForUpdate;
|
|
40
|
+
@property BOOL updating;
|
|
41
|
+
@property NSTask *updateTask;
|
|
42
|
+
@property NSTimer *usageTimer;
|
|
43
|
+
- (void)showQuotaDashboard;
|
|
44
|
+
- (void)positionQuotaDashboard;
|
|
45
|
+
- (void)scheduleQuotaDashboardHide;
|
|
46
|
+
- (void)hideQuotaDashboardIfNeeded;
|
|
47
|
+
- (void)positionAgentStatus;
|
|
48
|
+
- (void)showAgentStatusForRecord:(NSDictionary *)record;
|
|
49
|
+
- (void)prunePendingApprovalRecords;
|
|
50
|
+
- (void)toggleAgentStatusBubble:(id)sender;
|
|
51
|
+
- (void)refreshUsage:(id)sender;
|
|
52
|
+
- (void)applyCodexUsage:(NSDictionary *)codexUsage claudeUsage:(NSDictionary *)claudeUsage;
|
|
53
|
+
- (void)switchPetToID:(NSString *)petID;
|
|
54
|
+
@end
|