cc-pets 2.0.0 → 2.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.
- package/CHANGELOG.md +73 -30
- package/CHANGELOG.zh-CN.md +90 -0
- package/CONTRIBUTING.md +18 -15
- package/CONTRIBUTING.zh-CN.md +22 -0
- package/LICENSE +1 -1
- package/PROVIDER_PROTOCOL.md +50 -41
- package/PROVIDER_PROTOCOL.zh-CN.md +58 -0
- package/README.md +240 -502
- package/README.zh-CN.md +617 -0
- package/Resources/Info.plist +2 -0
- package/Resources/phrases.default.txt +48 -49
- package/SECURITY.md +13 -10
- package/SECURITY.zh-CN.md +18 -0
- package/Sources/CCPets/CCPetsAppDelegate.h +12 -0
- package/Sources/CCPets/CCPetsAppDelegate.m +400 -37
- package/Sources/CCPets/CCPetsCodexRateLimits.h +13 -0
- package/Sources/CCPets/CCPetsCodexRateLimits.m +383 -0
- package/Sources/CCPets/CCPetsEvents.m +7 -2
- package/Sources/CCPets/CCPetsPaths.h +4 -0
- package/Sources/CCPets/CCPetsPaths.m +6 -0
- package/Sources/CCPets/CCPetsPhrases.h +1 -24
- package/Sources/CCPets/CCPetsPhrases.m +1 -82
- package/Sources/CCPets/CCPetsPhrasesEditor.m +0 -28
- package/Sources/CCPets/CCPetsQuotaHistory.m +12 -5
- package/Sources/CCPets/CCPetsTerminalFocus.h +11 -0
- package/Sources/CCPets/CCPetsTerminalFocus.m +150 -0
- package/Sources/CCPets/CCPetsUsage.m +135 -14
- package/Sources/CCPets/CCPetsUsageMonitor.m +41 -3
- package/Sources/CCPets/PetView.m +19 -11
- package/Sources/CCPets/QuotaDashboardView.m +38 -16
- package/Sources/CCPets/main.m +5 -0
- package/THIRD_PARTY_NOTICES.md +13 -7
- package/THIRD_PARTY_NOTICES.zh-CN.md +12 -0
- package/bin/claude-with-pet +8 -2
- package/bin/codex-with-pet +8 -3
- package/package.json +14 -5
- package/scripts/pet-store.mjs +1 -1
package/Sources/CCPets/main.m
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
#import "CCPetsUsage.h"
|
|
8
8
|
#import "CCPetsVersion.h"
|
|
9
9
|
#import "CCPetsCleanup.h"
|
|
10
|
+
#import "CCPetsTerminalFocus.h"
|
|
10
11
|
#import <sys/file.h>
|
|
11
12
|
#import <sys/stat.h>
|
|
12
13
|
#import <fcntl.h>
|
|
@@ -37,6 +38,10 @@ int main(int argc, const char *argv[]) {
|
|
|
37
38
|
return RestartAfterPID(pid, appPath, managed);
|
|
38
39
|
}
|
|
39
40
|
if (argc > 1 && strcmp(argv[1], "--hook") == 0) return RecordHookEvent();
|
|
41
|
+
if (argc > 1 && strcmp(argv[1], "--frontmost-bundle-id") == 0) {
|
|
42
|
+
puts(FrontmostApplicationBundleIdentifier().UTF8String);
|
|
43
|
+
return EXIT_SUCCESS;
|
|
44
|
+
}
|
|
40
45
|
if (argc > 1 && (strcmp(argv[1], "--provider-event") == 0 ||
|
|
41
46
|
strcmp(argv[1], "provider-event") == 0)) return RecordProviderEvent();
|
|
42
47
|
if (argc > 1 && strcmp(argv[1], "--claude-usage") == 0) return RecordClaudeUsage();
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Third-Party Notices
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
原创默认素材,与任何现有动漫、游戏或商业吉祥物无关,并与项目代码一同按 MIT License 分发。
|
|
3
|
+
English | [简体中文](./THIRD_PARTY_NOTICES.zh-CN.md)
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
The CC Pets distribution does not bundle character assets downloaded from PetDex.
|
|
6
|
+
The built-in `默认.webp` is an original default asset created for this project. It
|
|
7
|
+
is unrelated to any existing anime, game, or commercial mascot and is distributed
|
|
8
|
+
with the project code under the MIT License.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
At runtime, the app may read locally installed Codex/ChatGPT and Claude application
|
|
11
|
+
icons for interface identification. Those icons are not copied into this repository
|
|
12
|
+
or the npm package. Their trademarks and copyrights belong to their respective
|
|
13
|
+
owners.
|
|
11
14
|
|
|
15
|
+
Assets installed by users from PetDex or other sources are managed by those users
|
|
16
|
+
and are not part of this project distribution. Follow the applicable author,
|
|
17
|
+
platform, and rights-holder licenses and terms when using or redistributing them.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 第三方声明
|
|
2
|
+
|
|
3
|
+
[English](./THIRD_PARTY_NOTICES.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
CC Pets 发布包不捆绑 PetDex 下载的角色素材。内置的 `默认.webp` 是专为本项目创建的
|
|
6
|
+
原创默认素材,与任何现有动漫、游戏或商业吉祥物无关,并与项目代码一同按 MIT License 分发。
|
|
7
|
+
|
|
8
|
+
程序会在运行时尝试读取用户本机已安装的 Codex/ChatGPT 和 Claude 应用图标,仅用于界面识别;
|
|
9
|
+
这些图标不会复制进仓库或 npm 发布包,其商标和版权归各自权利人所有。
|
|
10
|
+
|
|
11
|
+
用户通过 PetDex 或其他来源安装的素材由用户自行管理,不属于本项目发布内容。使用和再分发
|
|
12
|
+
此类素材时,请遵守对应作者、平台和权利人的许可证及使用条款。
|
package/bin/claude-with-pet
CHANGED
|
@@ -41,9 +41,15 @@ if [[ -d "${INSTALLED_APP}" ]]; then
|
|
|
41
41
|
PET_APP="${INSTALLED_APP}"
|
|
42
42
|
fi
|
|
43
43
|
|
|
44
|
+
# 固定 Agent 所在终端;后续所有 Hook 都会继承,用户中途切换应用也不会改错目标。
|
|
45
|
+
export CC_PETS_TERMINAL_TTY="${TTY:-}"
|
|
46
|
+
export CC_PETS_TERMINAL_PROGRAM="${TERM_PROGRAM:-}"
|
|
47
|
+
export CC_PETS_TERMINAL_SESSION="${TERM_SESSION_ID:-${ITERM_SESSION_ID:-}}"
|
|
48
|
+
export CC_PETS_TERMINAL_BUNDLE_ID="$("${PET_BIN}" --frontmost-bundle-id 2>/dev/null || true)"
|
|
49
|
+
|
|
44
50
|
mkdir -p "${CLIENT_DIR}"
|
|
45
|
-
#
|
|
46
|
-
|
|
51
|
+
# 第一行记录 provider,第二行记录 TTY;桌宠据此判断具体 Agent 会话是否仍在线。
|
|
52
|
+
printf '%s\n%s\n' 'Claude' "${CC_PETS_TERMINAL_TTY:t}" > "${CLIENT_FILE}"
|
|
47
53
|
|
|
48
54
|
print -rn -- '{"schemaVersion":1,"provider":"Claude","state":"starting"}' | \
|
|
49
55
|
"${PET_BIN}" --provider-event >/dev/null 2>&1 || true
|
package/bin/codex-with-pet
CHANGED
|
@@ -39,10 +39,15 @@ if [[ -d "${INSTALLED_APP}" ]]; then
|
|
|
39
39
|
PET_APP="${INSTALLED_APP}"
|
|
40
40
|
fi
|
|
41
41
|
|
|
42
|
+
# Hook 的 stdin 是 JSON 管道,完成时再调用 tty 已经拿不到原始终端;必须在 exec 前固定。
|
|
43
|
+
export CC_PETS_TERMINAL_TTY="${TTY:-}"
|
|
44
|
+
export CC_PETS_TERMINAL_PROGRAM="${TERM_PROGRAM:-}"
|
|
45
|
+
export CC_PETS_TERMINAL_SESSION="${TERM_SESSION_ID:-${ITERM_SESSION_ID:-}}"
|
|
46
|
+
export CC_PETS_TERMINAL_BUNDLE_ID="$("${PET_BIN}" --frontmost-bundle-id 2>/dev/null || true)"
|
|
47
|
+
|
|
42
48
|
mkdir -p "${CLIENT_DIR}"
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
-
print -r -- 'Codex' > "${CLIENT_FILE}"
|
|
49
|
+
# 第一行记录 provider,第二行记录 TTY;桌宠据此判断具体 Agent 会话是否仍在线。
|
|
50
|
+
printf '%s\n%s\n' 'Codex' "${CC_PETS_TERMINAL_TTY:t}" > "${CLIENT_FILE}"
|
|
46
51
|
|
|
47
52
|
print -rn -- '{"schemaVersion":1,"provider":"Codex","state":"starting"}' | \
|
|
48
53
|
"${PET_BIN}" --provider-event >/dev/null 2>&1 || true
|
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-pets",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "A native macOS desktop pet for Codex CLI and Claude Code",
|
|
5
|
-
"author":
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Sunnyshiny",
|
|
7
|
+
"url": "https://github.com/Sunnyshinnny776"
|
|
8
|
+
},
|
|
6
9
|
"license": "MIT",
|
|
7
10
|
"repository": {
|
|
8
11
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
12
|
+
"url": "git+https://github.com/Sunnyshinnny776/cc-pets.git"
|
|
10
13
|
},
|
|
11
|
-
"homepage": "https://github.com/
|
|
14
|
+
"homepage": "https://github.com/Sunnyshinnny776/cc-pets",
|
|
12
15
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/
|
|
16
|
+
"url": "https://github.com/Sunnyshinnny776/cc-pets/issues"
|
|
14
17
|
},
|
|
15
18
|
"keywords": [
|
|
16
19
|
"codex",
|
|
@@ -34,11 +37,17 @@
|
|
|
34
37
|
"Resources/phrases.default.txt",
|
|
35
38
|
"Sources/CCPets",
|
|
36
39
|
"README.md",
|
|
40
|
+
"README.zh-CN.md",
|
|
37
41
|
"PROVIDER_PROTOCOL.md",
|
|
42
|
+
"PROVIDER_PROTOCOL.zh-CN.md",
|
|
38
43
|
"CHANGELOG.md",
|
|
44
|
+
"CHANGELOG.zh-CN.md",
|
|
39
45
|
"CONTRIBUTING.md",
|
|
46
|
+
"CONTRIBUTING.zh-CN.md",
|
|
40
47
|
"SECURITY.md",
|
|
48
|
+
"SECURITY.zh-CN.md",
|
|
41
49
|
"THIRD_PARTY_NOTICES.md",
|
|
50
|
+
"THIRD_PARTY_NOTICES.zh-CN.md",
|
|
42
51
|
"LICENSE"
|
|
43
52
|
],
|
|
44
53
|
"bin": {
|
package/scripts/pet-store.mjs
CHANGED
|
@@ -36,7 +36,7 @@ const USER_AGENT = (() => {
|
|
|
36
36
|
} catch {
|
|
37
37
|
// 版本读不到不该让下载失败,退回占位版本号即可。
|
|
38
38
|
}
|
|
39
|
-
return `cc-pets/${version} (+https://github.com/
|
|
39
|
+
return `cc-pets/${version} (+https://github.com/Sunnyshinnny776/cc-pets)`;
|
|
40
40
|
})();
|
|
41
41
|
|
|
42
42
|
// 不能 add、只会出现在已装素材里的来源。桌宠的"导入 Codex 素材"开关会写 source: "codex"。
|