cc-pets 2.4.0 → 2.6.0-beta.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.
Files changed (111) hide show
  1. package/CC_BRIDGE.md +93 -14
  2. package/CC_BRIDGE.zh-CN.md +71 -11
  3. package/CHANGELOG.md +55 -0
  4. package/CHANGELOG.zh-CN.md +56 -1
  5. package/CONTRIBUTING.md +1 -1
  6. package/CONTRIBUTING.zh-CN.md +1 -1
  7. package/PROVIDER_PROTOCOL.md +5 -1
  8. package/PROVIDER_PROTOCOL.zh-CN.md +4 -1
  9. package/README.md +116 -34
  10. package/README.zh-CN.md +99 -35
  11. package/Resources/AgentIcons/antigravity.icns +0 -0
  12. package/Resources/zh-Hans.lproj/Localizable.strings +99 -26
  13. package/Sources/CCPets/App/CCPetsAppDelegate+AgentEvents.m +51 -4
  14. package/Sources/CCPets/App/CCPetsAppDelegate+AgentStatus.m +120 -17
  15. package/Sources/CCPets/App/CCPetsAppDelegate+Bridge.m +24 -11
  16. package/Sources/CCPets/App/CCPetsAppDelegate+MenuBar.m +86 -0
  17. package/Sources/CCPets/App/CCPetsAppDelegate+Private.h +24 -1
  18. package/Sources/CCPets/App/CCPetsAppDelegate+Profiles.m +21 -11
  19. package/Sources/CCPets/App/CCPetsAppDelegate+Quota.m +33 -17
  20. package/Sources/CCPets/App/CCPetsAppDelegate+Settings.m +43 -7
  21. package/Sources/CCPets/App/CCPetsAppDelegate+Speech.m +7 -4
  22. package/Sources/CCPets/App/CCPetsAppDelegate+Update.m +7 -4
  23. package/Sources/CCPets/App/CCPetsAppDelegate+Workbench.m +24 -22
  24. package/Sources/CCPets/App/CCPetsAppDelegate.h +10 -0
  25. package/Sources/CCPets/App/CCPetsAppDelegate.m +18 -8
  26. package/Sources/CCPets/App/CCPetsVersion.h +4 -0
  27. package/Sources/CCPets/App/CCPetsVersion.m +34 -0
  28. package/Sources/CCPets/App/main.m +11 -0
  29. package/Sources/CCPets/Bridge/CCPetsBridge.m +41 -17
  30. package/Sources/CCPets/Bridge/CCPetsBridgeAntigravityApp.h +4 -0
  31. package/Sources/CCPets/Bridge/CCPetsBridgeAntigravityApp.m +119 -0
  32. package/Sources/CCPets/Bridge/CCPetsBridgeCLI.h +3 -1
  33. package/Sources/CCPets/Bridge/CCPetsBridgeCLI.m +272 -50
  34. package/Sources/CCPets/Bridge/CCPetsBridgeCore.h +12 -3
  35. package/Sources/CCPets/Bridge/CCPetsBridgeCore.m +341 -95
  36. package/Sources/CCPets/Bridge/CCPetsBridgeSetup.h +0 -2
  37. package/Sources/CCPets/Bridge/CCPetsBridgeSetup.m +227 -95
  38. package/Sources/CCPets/Bridge/CCPetsBridgeStore.h +35 -5
  39. package/Sources/CCPets/Bridge/CCPetsBridgeStore.m +310 -42
  40. package/Sources/CCPets/Bridge/CCPetsBridgeTerminalTitle.h +12 -0
  41. package/Sources/CCPets/Bridge/CCPetsBridgeTerminalTitle.m +105 -0
  42. package/Sources/CCPets/Integrations/CCPetsAntigravityConfig.h +17 -0
  43. package/Sources/CCPets/Integrations/CCPetsAntigravityConfig.m +462 -0
  44. package/Sources/CCPets/Integrations/CCPetsAntigravityEvents.h +5 -0
  45. package/Sources/CCPets/Integrations/CCPetsAntigravityEvents.m +180 -0
  46. package/Sources/CCPets/Integrations/CCPetsBridgeTitleRelay.h +3 -0
  47. package/Sources/CCPets/Integrations/CCPetsBridgeTitleRelay.m +463 -0
  48. package/Sources/CCPets/Integrations/CCPetsEvents.h +5 -0
  49. package/Sources/CCPets/Integrations/CCPetsEvents.m +68 -12
  50. package/Sources/CCPets/Integrations/CCPetsIntegrations.h +1 -1
  51. package/Sources/CCPets/Integrations/CCPetsIntegrations.m +38 -8
  52. package/Sources/CCPets/Integrations/CCPetsLaunchPreflight.m +15 -5
  53. package/Sources/CCPets/Integrations/CCPetsProfiles.h +2 -1
  54. package/Sources/CCPets/Integrations/CCPetsProfiles.m +112 -81
  55. package/Sources/CCPets/Integrations/CCPetsTerminalFocus.h +11 -1
  56. package/Sources/CCPets/Integrations/CCPetsTerminalFocus.m +217 -45
  57. package/Sources/CCPets/Pet/CCPetsPhrasesEditor.m +7 -0
  58. package/Sources/CCPets/Pet/CCPetsPreviews.m +16 -8
  59. package/Sources/CCPets/Pet/PetView+Menu.m +64 -5
  60. package/Sources/CCPets/Pet/PetView.h +7 -0
  61. package/Sources/CCPets/Pet/PetView.m +12 -1
  62. package/Sources/CCPets/Support/CCPetsDoctor.m +126 -37
  63. package/Sources/CCPets/Support/CCPetsPaths.h +5 -0
  64. package/Sources/CCPets/Support/CCPetsPaths.m +15 -0
  65. package/Sources/CCPets/Support/CCPetsPreferences.h +14 -1
  66. package/Sources/CCPets/Support/CCPetsPreferences.m +36 -0
  67. package/Sources/CCPets/UI/CCPetsMenuBarIcon.h +16 -0
  68. package/Sources/CCPets/UI/CCPetsMenuBarIcon.m +70 -0
  69. package/Sources/CCPets/UI/CCPetsMenuBarPanel.h +18 -0
  70. package/Sources/CCPets/UI/CCPetsMenuBarPanel.m +533 -0
  71. package/Sources/CCPets/UI/CCPetsMenuBarSummary.h +51 -0
  72. package/Sources/CCPets/UI/CCPetsMenuBarSummary.m +98 -0
  73. package/Sources/CCPets/UI/CCPetsSettingsPage.h +7 -1
  74. package/Sources/CCPets/UI/CCPetsSettingsPage.m +205 -8
  75. package/Sources/CCPets/UI/CCPetsStatusItem.h +28 -0
  76. package/Sources/CCPets/UI/CCPetsStatusItem.m +147 -0
  77. package/Sources/CCPets/UI/CCPetsUIStyle.m +3 -1
  78. package/Sources/CCPets/UI/CCPetsUsagePage.h +4 -3
  79. package/Sources/CCPets/UI/CCPetsUsagePage.m +69 -43
  80. package/Sources/CCPets/UI/CCPetsUsageStore.m +11 -1
  81. package/Sources/CCPets/UI/CCPetsWorkbenchPages.m +6 -4
  82. package/Sources/CCPets/Usage/CCPetsAntigravityQuota.m +115 -0
  83. package/Sources/CCPets/Usage/CCPetsNormalizedUsage.h +5 -0
  84. package/Sources/CCPets/Usage/CCPetsNormalizedUsage.m +43 -0
  85. package/Sources/CCPets/Usage/CCPetsProviderRegistry+Testing.h +13 -0
  86. package/Sources/CCPets/Usage/CCPetsProviderRegistry.h +25 -0
  87. package/Sources/CCPets/Usage/CCPetsProviderRegistry.m +94 -0
  88. package/Sources/CCPets/Usage/CCPetsQuotaHistory.h +1 -1
  89. package/Sources/CCPets/Usage/CCPetsQuotaHistory.m +11 -8
  90. package/Sources/CCPets/Usage/CCPetsUsage+Internal.h +2 -0
  91. package/Sources/CCPets/Usage/CCPetsUsage+Models.m +206 -14
  92. package/Sources/CCPets/Usage/CCPetsUsage+TokenTotals.m +4 -4
  93. package/Sources/CCPets/Usage/CCPetsUsage.h +7 -2
  94. package/Sources/CCPets/Usage/CCPetsUsageMode.h +2 -0
  95. package/Sources/CCPets/Usage/CCPetsUsageMode.m +29 -4
  96. package/Sources/CCPets/Usage/CCPetsUsageMonitor.h +4 -4
  97. package/Sources/CCPets/Usage/CCPetsUsageMonitor.m +90 -7
  98. package/Sources/CCPets/Usage/QuotaDashboardView+CompactRow.m +81 -0
  99. package/Sources/CCPets/Usage/QuotaDashboardView+Primitives.m +5 -8
  100. package/Sources/CCPets/Usage/QuotaDashboardView+Private.h +26 -4
  101. package/Sources/CCPets/Usage/QuotaDashboardView+Rendering.m +99 -99
  102. package/Sources/CCPets/Usage/QuotaDashboardView.h +9 -10
  103. package/Sources/CCPets/Usage/QuotaDashboardView.m +232 -79
  104. package/THIRD_PARTY_NOTICES.md +5 -4
  105. package/THIRD_PARTY_NOTICES.zh-CN.md +6 -5
  106. package/bin/agy-with-pet +82 -0
  107. package/bin/cc-pets +1 -1
  108. package/bin/claude-with-pet +15 -0
  109. package/bin/codex-with-pet +17 -2
  110. package/package.json +5 -3
  111. package/scripts/install-shell-integration.sh +5 -0
package/CC_BRIDGE.md CHANGED
@@ -5,15 +5,16 @@ English | [简体中文](./CC_BRIDGE.zh-CN.md)
5
5
  CC Bridge lets Claude Code and Codex terminal sessions running on the same Mac discover
6
6
  each other, exchange messages, and wake each other up. It mirrors Claude Code's native
7
7
  cross-session messaging (`ListAgents` / `SendMessage`) and extends it to
8
- Claude ↔ Codex and Codex ↔ Codex.
8
+ Claude ↔ Codex and Codex ↔ Codex. Antigravity CLI can also exchange messages with
9
+ local sessions. Antigravity App conversations support automatic wake-up when the Sidecar is enabled.
9
10
 
10
- It uses only documented extension points of both CLIs: hooks, MCP, and `codex queue`.
11
+ It uses documented extension points including hooks, MCP, `codex queue`, and Antigravity App Sidecars.
11
12
  It does not use internal protocols, inject keystrokes into terminals, or edit transcripts.
12
13
 
13
14
  ## Enable and disable
14
15
 
15
16
  ```bash
16
- cc-pets bridge enable # Write hooks, register the MCP server, and turn CC Bridge on
17
+ cc-pets bridge enable # Configure registered CLI profiles and turn CC Bridge on
17
18
  cc-pets bridge status # Show the switch, options, online sessions, and recent messages
18
19
  cc-pets bridge disable # Remove every CC Bridge integration and turn it off
19
20
  ```
@@ -27,6 +28,7 @@ After enabling:
27
28
  `cc-pets bridge send <name> '<text>'` (delivered messages include this hint).
28
29
  - Running Codex sessions need a **restart**. Then run `/hooks` to trust the cc-pets bridge hooks;
29
30
  Codex skips untrusted hooks, so that session will not appear in the list.
31
+ - Restart Antigravity CLI to load the hooks and Bridge MCP server. Start sessions with `agy`.
30
32
  - Codex asks for approval on every MCP tool call by default (calls fail outright when the approval
31
33
  policy is `never`), and Claude Code asks according to your permission settings. Opt in as needed;
32
34
  see [Options](#options).
@@ -43,6 +45,7 @@ with the saved options when CC Bridge is enabled.
43
45
  cc-pets bridge configure --approve=view,send # No approval prompts in Codex and Claude
44
46
  cc-pets bridge configure --codex-approve=view # Codex only
45
47
  cc-pets bridge configure --claude-allow= # Clear Claude's allow list
48
+ cc-pets bridge configure --agy-allow=view # Antigravity CLI only
46
49
  cc-pets bridge configure --wake=off # Turn off auto-wake
47
50
  cc-pets bridge configure --edit-guard=off # Turn off the reservation edit guard
48
51
  ```
@@ -50,11 +53,18 @@ cc-pets bridge configure --edit-guard=off # Turn off the reservation edit
50
53
  | Option | Description |
51
54
  | --- | --- |
52
55
  | `--approve` / `--codex-approve` / `--claude-allow` | Tools that skip approval. Use groups `view` (list sessions, list reservations, read inbox), `send`, `reserve` (reserve / release), `name`, or tool names. Codex gets a marked block at the end of `~/.codex/config.toml`; Claude gets entries in `~/.claude/settings.json` `permissions.allow` (only `mcp__cc-bridge__*` entries are touched). `disable` removes both |
53
- | `--wake=on\|off` | Wake idle sessions automatically (default on). When off, messages wait in the inbox until the recipient's next prompt, which saves tokens |
56
+ | `--agy-allow` | Opt in to skipping approval for Antigravity CLI. Use the same groups or tool names. `--agy-allow=` clears the list. `--approve` applies to Codex and Claude |
57
+ | `--agy-app=on\|off` | Enable the Antigravity App Sidecar in the default Gemini root. Defaults to off |
58
+ | `--tab-title=on\|off` | Append the Bridge nickname to CLI terminal tab titles. Defaults to off |
59
+ | `--wake=on\|off` | Wake idle Claude Code, supported Codex, and Sidecar-enabled Antigravity App sessions automatically (default on). When off, messages wait in the inbox until the recipient's next prompt, which saves tokens |
54
60
  | `--edit-guard=on\|off` | Pause the first edit to a file another session reserved (default on) |
55
61
 
56
62
  Claude picks up changes immediately; Codex needs a session restart (and re-trusting in `/hooks` when hooks change).
57
63
 
64
+ To enable tab nicknames, right-click the pet and turn on **CC Bridge → Tab nicknames**. Restart the
65
+ CLI session through the CC Pets shell integration to apply the setting. For example, a tab can show
66
+ `Fix quota polling | cc-pets · robin`.
67
+
58
68
  ## Usage
59
69
 
60
70
  Ask in plain language in any session:
@@ -66,13 +76,63 @@ The agent uses these MCP tools:
66
76
  | Tool | Description |
67
77
  | --- | --- |
68
78
  | `list_agents` | Lists online sessions: name [ref], CLI, busy/idle, terminal (tty), start time, directory. The name is the address; add ` [ref]` only when names collide. |
69
- | `send_message` | Sends a message. With `notify_when_idle: true`, you get a one-shot notice when the recipient next finishes a turn. |
79
+ | `send_message` | Sends a message. With `notify_when_idle: true`, you get a one-shot notice when the recipient next finishes a turn. That doesn't mean it has handled this message. |
70
80
  | `set_name` | Renames the current session. |
71
81
  | `reserve_files` | Reserves files or directories you are about to edit (globs supported); returns conflicts when they overlap with other reservations. |
72
82
  | `release_files` | Releases this session's reservations. |
73
83
  | `list_reservations` | Lists reservations in the current repository, or who reserved a given file. |
74
84
  | `check_inbox` | Reads the inbox manually. Messages are normally delivered automatically. |
75
85
 
86
+ ### Antigravity CLI
87
+
88
+ Enable CC Bridge and make sure `agy` is on your `PATH`. Run `agy` in the project directory.
89
+ Incoming messages wait in the inbox until the next model invocation. Use `list_agents` in another
90
+ session or run `cc-pets bridge status` to find the session's Bridge name.
91
+
92
+ Antigravity CLI's default Gemini root is `~/.gemini`. For a registered custom root, set
93
+ `CC_PETS_ANTIGRAVITY_HOME` when launching. CC Pets uses `config/hooks.json` for CLI hooks,
94
+ `config/mcp_config.json` for the Bridge MCP server, and `antigravity-cli/settings.json` for
95
+ the tool allow list. `cc-pets doctor` checks the hooks, MCP registration and shell launcher.
96
+
97
+ See [Antigravity CLI authentication](https://antigravity.google/docs/cli/install/) for sign-in options.
98
+
99
+ ### Antigravity App
100
+
101
+ Opt in to App conversations by enabling the Sidecar.
102
+
103
+ ```bash
104
+ cc-pets bridge enable --agy-app=on
105
+ ```
106
+
107
+ Restart the App to load the Sidecar and Bridge MCP server. Start a turn in each conversation you
108
+ want to receive messages in, then use `cc-pets bridge status` or `list_agents` from another session
109
+ to find its Bridge name. Keep the App running so the Sidecar can wake the conversation. When
110
+ auto-wake is on, the Sidecar sends a fixed wake-up prompt to the existing conversation with
111
+ `agentapi`. The hook delivers the peer's message separately as a user message with a Bridge source header.
112
+
113
+ The Sidecar uses the App's default `~/.gemini` root. `cc-pets bridge configure --agy-app=off` removes
114
+ the managed Sidecar and its App setting. [Google Sidecars documentation](https://antigravity.google/docs/sidecars#agentapi)
115
+
116
+ ### Current session identity
117
+
118
+ Every MCP tool accepts an optional `session_id` identifying the caller. Bridge supplies the current ID
119
+ in `SessionStart` and `UserPromptSubmit` hook context; agents should pass that exact value on each call.
120
+ For an existing session without this context, read `CODEX_THREAD_ID` (Codex) or
121
+ `CLAUDE_CODE_SESSION_ID` (Claude) from that session's own shell. Do not use a recipient's ID, guess
122
+ from the online list, or hard-code one session's ID in shared MCP configuration.
123
+
124
+ Multiple Codex sessions can share an app-server PID. When MCP does not inherit a session ID, the
125
+ argument distinguishes the caller. Each call independently validates the registration, live status,
126
+ provider and host PID; the MCP process never caches the selected identity. An invalid explicit ID,
127
+ one belonging to another host, or one that can't be checked because the MCP host process can't be
128
+ identified is rejected with the reason and without falling back to another identity. Calls without
129
+ the argument retain environment-based identification and unique PID matching for existing single-session
130
+ clients. Anonymous session listing remains available when identity cannot be resolved, but `list_reservations`
131
+ returns an error because the repository to check is unknown.
132
+
133
+ After updating, reconnect the CC Bridge MCP server (or restart its client) to load the new binary
134
+ and tool definitions with `session_id`.
135
+
76
136
  ### Session names
77
137
 
78
138
  Default names look like `<account>.<project-directory>.<animal>`, for example `claude.my-app.otter` or
@@ -119,12 +179,14 @@ Claude / Codex sessions for wording changes to take effect (MCP instructions loa
119
179
  | Notify a session | Use cc-bridge to tell api the login endpoint is now POST /api/login and returns a token; update the frontend call |
120
180
  | Hand off a task | Ask web to write unit tests for src/api/login.ts and report back |
121
181
  | Get an answer back | Ask api how far the database migration has gone, and have it reply through cc-bridge |
122
- | Wait until it's done | Tell api to run the test suite, and notify you when it goes idle |
182
+ | Wait for a result | Tell api to run the test suite and send you the result through cc-bridge |
183
+ | See when it's idle | Message api and have it notify you when it goes idle |
123
184
  | Target by terminal | Send this to the Claude session in ttys003: … |
124
185
 
125
186
  Replies arrive as new messages in your session. "Notify you when it goes idle" sends a one-shot
126
- notice once the recipient finishes its turn (`notify_when_idle`), which is handy for "continue after
127
- it's done".
187
+ notice once the recipient finishes its turn (`notify_when_idle`). If the recipient is busy, that may be
188
+ a turn that started before your message arrived, so the notice only means a turn ended, not that your
189
+ task is done. To wait for a result, ask the recipient to reply when it finishes.
128
190
 
129
191
  ### Several sessions in one repository
130
192
 
@@ -185,9 +247,11 @@ Just ask: "Reserve src/api before you start the refactor, and release it when yo
185
247
  | --- | --- | --- | --- |
186
248
  | Codex | Woken immediately through `codex queue` | Queued after the current turn | Not delivered; receipt is undeliverable |
187
249
  | Claude Code | Woken by a background `asyncRewake` watcher | Injected into the current turn | Not delivered; receipt is undeliverable |
250
+ | Antigravity CLI (`agy`) | Waits for the next model invocation | Picked up on a subsequent model invocation | Not delivered; receipt is undeliverable |
251
+ | Antigravity App with Sidecar enabled | Starts a new turn in the existing conversation | Waits for the conversation or its next model invocation | Not delivered once the App is offline |
188
252
 
189
- The Claude Code watcher arms at session start and at the end of every turn, and waits up to about
190
- 55 minutes before exiting. If a Claude session stays idle through that gap, messages stay in its
253
+ The Claude Code watcher arms at session start and at the end of every turn. A new watcher replaces the
254
+ previous one and restarts the wait, which lasts up to about 55 minutes before it exits. If a Claude session stays idle through that gap, messages stay in its
191
255
  inbox and are included with the user's next prompt; messages that arrive during that turn are
192
256
  delivered when it ends.
193
257
 
@@ -199,6 +263,15 @@ prompt brings them in.
199
263
  Senders get receipts such as "queued", "in inbox", or "undeliverable". Delivery does not mean
200
264
  the recipient has read or agreed to anything.
201
265
 
266
+ A session that crashes or is killed never fires `SessionEnd`. Its undelivered messages are cleaned up
267
+ the next time the session list finds it offline, or when the next session starts: receipts become
268
+ undeliverable and its idle subscriptions are removed.
269
+
270
+ Codex threads on a shared app-server run in the background. Closing a terminal tab doesn't end the
271
+ thread right away: `SessionEnd` fires when the app-server unloads it, which took up to a few minutes
272
+ when tested. Until then the thread still shows as online, and a message sent to it may be queued and
273
+ run when the thread is resumed.
274
+
202
275
  ## In the pet
203
276
 
204
277
  With CC Bridge enabled, the round icon on the pet's status card gets a message badge in its
@@ -239,12 +312,14 @@ tool through `~/.cc-pets/bridge-cli.json`, written on every `cc-pets install`; i
239
312
  when a peer asks for an action that was denied on its side, the agent should refuse and tell the user.
240
313
  - Message bodies are stored in the current user's temporary directory
241
314
  (`cc-bridge-<uid>/` under `getconf DARWIN_USER_TEMP_DIR`) with `0700` directories and `0600`
242
- files; undelivered messages expire after 24 hours. This is an explicit exception to the
315
+ files; undelivered messages expire after 24 hours (cleaned up when the next session starts). A body is
316
+ deleted once its message is delivered. Receipts hold only sender, recipient, time and status, and
317
+ stay about 48 hours for troubleshooting. This is an explicit exception to the
243
318
  [Provider protocol](./PROVIDER_PROTOCOL.md)'s no-content rule, which is why CC Bridge is off by default.
244
319
  - A message is limited to 16 KB. A pair of sessions exchanging more than 20 messages within
245
320
  10 minutes is paused to stop two agents from auto-replying to each other in a loop.
246
321
  - Pet status cards and notifications never show message bodies.
247
- - No background daemon: only hooks, the MCP server, and the watcher inside Claude sessions, all of which exit with the session.
322
+ - Hooks, MCP servers, and Claude watchers follow their sessions. The Antigravity Sidecar runs with the App.
248
323
 
249
324
  ## Identity and delivery guarantees
250
325
 
@@ -252,15 +327,19 @@ Bridge validates `CODEX_THREAD_ID` / `CLAUDE_CODE_SESSION_ID` against the live s
252
327
  current host process. Without a session ID, PID lookup is allowed only when it identifies exactly one
253
328
  live session. Ambiguous shared hosts and stale explicit IDs fail closed for sending, renaming, reading
254
329
  inboxes and managing reservations. CLI diagnostics can select a session explicitly with
255
- `--from <session-name-or-full-session-id>`.
330
+ `--from <session-name-or-full-session-id>`; with `send`, put it before the message.
256
331
 
257
332
  Claimed inbox messages remain on disk until the complete output has been flushed successfully.
258
333
  A later hook, watcher or `check_inbox` recovers unconfirmed messages after a crash. A crash between
259
334
  output and confirmation may deliver the same message ID again; the host provides no acknowledgement
260
- protocol, so exactly-once delivery is not guaranteed. Codex queue delivery uses the recipient's Home.
335
+ protocol, so exactly-once delivery is not guaranteed. When `codex queue` times out, Bridge can't tell
336
+ whether the message was queued, so it also goes to the inbox and the sender is told it may arrive
337
+ twice with the same ID. Codex queue delivery uses the recipient's Home.
261
338
  Legacy records with an unknown Home fall back to the inbox until registration is refreshed by input
262
339
  in that session.
263
340
 
264
341
  Existing watchers recheck the enabled and auto-wake switches while polling. Disabling Bridge also
265
342
  blocks CLI send, rename and inbox operations. Integration removal failures return a nonzero exit code;
266
343
  the runtime remains disabled, and `disable` can be retried after resolving the reported errors.
344
+ `disable` deletes all undelivered messages and marks their receipts undeliverable. Delivered receipts
345
+ contain no message body and stay for their normal retention period.
@@ -4,15 +4,15 @@
4
4
 
5
5
  CC Bridge 让本机同时运行的 Claude Code 与 Codex 终端会话互相发现、发消息、唤醒对方,
6
6
  体验对齐 Claude Code 原生的跨会话消息(`ListAgents` / `SendMessage`),并且支持
7
- Claude ↔ Codex、Codex ↔ Codex。
7
+ Claude ↔ Codex、Codex ↔ Codex。Antigravity CLI 也能与本机会话互发消息,启用 Sidecar 的 Antigravity App 支持自动唤醒。
8
8
 
9
- 它只使用两边官方公开的扩展点:hooks、MCP、`codex queue`。不接入任何内部协议,
9
+ 它使用官方公开的扩展点,包括 hooks、MCP、`codex queue` 和 Antigravity App Sidecar。不接入任何内部协议,
10
10
  不向终端注入按键,不修改会话记录。
11
11
 
12
12
  ## 开启与关闭
13
13
 
14
14
  ```bash
15
- cc-pets bridge enable # 写入 hooks、注册 MCP,并打开开关
15
+ cc-pets bridge enable # 配置已登记的 CLI 账号,并打开开关
16
16
  cc-pets bridge status # 查看开关、选项、在线会话与最近消息
17
17
  cc-pets bridge disable # 移除全部 CC Bridge 集成并关闭
18
18
  ```
@@ -25,6 +25,7 @@ cc-pets bridge disable # 移除全部 CC Bridge 集成并关闭
25
25
  在此之前可以在 Bash 里用 `cc-pets bridge send <名字> '<内容>'` 回复(收到的消息里会附带这条提示)。
26
26
  - 已经在运行的 Codex 会话需要**重启**。启动后执行 `/hooks`,信任 cc-pets bridge 的 hooks;
27
27
  未信任的 hooks 会被 Codex 跳过,对应会话不会出现在列表里。
28
+ - 用 `agy` 重启 Antigravity CLI 会话,以加载 Hooks 与 Bridge MCP。
28
29
  - Codex 默认每次调用 MCP 工具都要审批(审批策略为 `never` 时调用会直接失败);Claude Code 首次调用时也会按你的
29
30
  权限设置询问。可以按需放开,见下方[选项](#选项)。
30
31
 
@@ -38,6 +39,7 @@ cc-pets bridge disable # 移除全部 CC Bridge 集成并关闭
38
39
  cc-pets bridge configure --approve=view,send # Codex 与 Claude 同时免审批
39
40
  cc-pets bridge configure --codex-approve=view # 只设 Codex
40
41
  cc-pets bridge configure --claude-allow= # 清空 Claude 免确认
42
+ cc-pets bridge configure --agy-allow=view # 只设 Antigravity CLI 免确认
41
43
  cc-pets bridge configure --wake=off # 关闭自动唤醒
42
44
  cc-pets bridge configure --edit-guard=off # 关闭编辑前预留拦截
43
45
  ```
@@ -45,14 +47,21 @@ cc-pets bridge configure --edit-guard=off # 关闭编辑前预留拦截
45
47
  | 选项 | 说明 |
46
48
  | --- | --- |
47
49
  | `--approve` / `--codex-approve` / `--claude-allow` | 免审批的工具。可写分组 `view`(列会话、查预留、读信箱)、`send`(发消息)、`reserve`(预留 / 释放)、`name`(改名),或具体工具名。Codex 写入 `~/.codex/config.toml` 末尾的带标记块,Claude 写入 `~/.claude/settings.json` 的 `permissions.allow`(只增删 `mcp__cc-bridge__*` 条目);`disable` 时一并移除 |
48
- | `--wake=on\|off` | 自动唤醒空闲会话,默认开。关闭后消息只进信箱,等对方下次收到你的输入时带入,可省 token |
50
+ | `--agy-allow` | 单独设置 Antigravity CLI 的免审批工具,接受同一组分组或工具名。`--agy-allow=` 清空列表。`--approve` 作用于 Codex 和 Claude |
51
+ | `--agy-app=on\|off` | 在默认 Gemini 根目录启用 Antigravity App Sidecar,默认关闭 |
52
+ | `--tab-title=on\|off` | 在 CLI 终端标签标题末尾追加 Bridge 昵称,默认关闭 |
53
+ | `--wake=on\|off` | 自动唤醒空闲的 Claude Code、支持唤醒的 Codex 和启用了 Sidecar 的 Antigravity App 会话,默认开。关闭后消息只进信箱,等对方下次收到你的输入时带入,可省 token |
49
54
  | `--edit-guard=on\|off` | 编辑他人预留的文件时暂停一次,默认开 |
50
55
 
51
56
  运行中的 watcher 会在轮询时检查关闭状态;关闭自动唤醒后不再主动取信,关闭 Bridge 后 CLI 也拒绝发送、改名和收件。
52
57
  卸载集成失败会返回非零退出码,运行时开关仍保持关闭,可排除错误后再次执行 `disable`。
58
+ `disable` 会删除所有未投递的消息,回执标记为 undeliverable;已送达的回执不含正文,按保留期留作记录。
53
59
 
54
60
  Claude 侧的改动会被热加载;Codex 侧(审批、hooks)需要重启 Codex 会话,hooks 变化后还要在 `/hooks` 中重新信任。
55
61
 
62
+ 在桌宠右键菜单中打开 **CC Bridge → 标签昵称**,再通过 CC Pets 的终端集成重启 CLI 会话。
63
+ 标签标题可显示为 `修复额度轮询 | cc-pets · 知更鸟`。
64
+
56
65
  ## 使用
57
66
 
58
67
  在任意一个会话里直接用自然语言:
@@ -64,13 +73,54 @@ Agent 会调用这些 MCP 工具:
64
73
  | 工具 | 说明 |
65
74
  | --- | --- |
66
75
  | `list_agents` | 列出在线会话:名字 [ref]、CLI、忙闲、所在终端(tty)、启动时间、目录。名字就是地址;只有重名时才需要写成 `名字 [ref]`。 |
67
- | `send_message` | 发消息;`notify_when_idle: true` 时,对方下次完成回合后你会收到一条一次性空闲通知。 |
76
+ | `send_message` | 发消息;`notify_when_idle: true` 时,对方下次完成回合后你会收到一条一次性空闲通知。这不代表对方已处理这条消息。 |
68
77
  | `set_name` | 修改当前会话的名字。 |
69
78
  | `reserve_files` | 预留即将修改的文件或目录(支持 glob),与他人预留重叠时返回冲突列表。 |
70
79
  | `release_files` | 释放本会话的预留。 |
71
80
  | `list_reservations` | 查看当前仓库的所有预留,或某个文件被谁预留。 |
72
81
  | `check_inbox` | 手动读取信箱。正常情况下消息会自动送达,一般不需要调用。 |
73
82
 
83
+ ### Antigravity CLI
84
+
85
+ 开启 CC Bridge 并确保 `agy` 在 `PATH` 中,然后在项目目录运行 `agy`。收到的消息会先留在信箱,
86
+ 等下一次模型调用时带入。在另一个会话中调用 `list_agents`,或运行 `cc-pets bridge status`,
87
+ 即可查到该会话的 Bridge 名字。
88
+
89
+ Antigravity CLI 默认使用 `~/.gemini` 作为 Gemini 根目录。启动时可通过 `CC_PETS_ANTIGRAVITY_HOME` 选择已登记的自定义根目录。
90
+ CC Pets 在根目录下使用 `config/hooks.json` 配置 CLI Hooks,在 `config/mcp_config.json` 注册 Bridge MCP,
91
+ 在 `antigravity-cli/settings.json` 设置工具免审批列表。`cc-pets doctor` 检查 Hooks、MCP 注册和 shell 启动入口。
92
+
93
+ 登录方式见 [Antigravity CLI 认证文档](https://antigravity.google/docs/cli/install/)。
94
+
95
+ ### Antigravity App
96
+
97
+ 运行下面的命令以启用 App 的 Sidecar。
98
+
99
+ ```bash
100
+ cc-pets bridge enable --agy-app=on
101
+ ```
102
+
103
+ 重启 App 加载 Sidecar 和 Bridge MCP。在每个希望收信的对话中启动一轮,然后用 `cc-pets bridge status`
104
+ 或在另一个会话中调用 `list_agents` 找到它的 Bridge 名称。保持 App 运行,Sidecar 才能唤醒对话。
105
+ 开启自动唤醒后,Sidecar 通过 `agentapi` 向原对话提交固定的唤醒提示。Hook 会将队友的正文另行作为用户消息送入,并附上 Bridge 来源标头。
106
+
107
+ Sidecar 使用 App 默认的 `~/.gemini` 根目录。`cc-pets bridge configure --agy-app=off` 会移除 CC Pets 管理的
108
+ Sidecar 和对应的 App 设置。[Google Sidecars 文档](https://antigravity.google/docs/sidecars#agentapi)
109
+
110
+ ### 当前会话身份
111
+
112
+ 所有 MCP 工具都支持可选的 `session_id` 参数,用来标识调用者。Bridge 在 `SessionStart` 和
113
+ `UserPromptSubmit` hook 的上下文中提供当前 ID,Agent 应在每次调用中原样传入;旧会话缺少该上下文时,
114
+ 可从当前会话 shell 的 `CODEX_THREAD_ID`(Codex)或 `CLAUDE_CODE_SESSION_ID`(Claude)读取。
115
+ 不要使用收件人的 ID、从在线列表猜测,或把某个会话的 ID 固定写进共享 MCP 配置。
116
+
117
+ Codex 的多个会话可以共用一个 app-server PID;MCP 未继承会话 ID 时,必须通过参数区分调用者。
118
+ 每次调用独立校验注册记录、在线状态、provider 和宿主 PID,不在 MCP 进程中缓存会话身份。
119
+ 显式 ID 无效或不属于当前宿主时直接报错,错误信息会说明原因;识别不出 MCP 的宿主进程时同样拒绝。这些情况都不回退到其他身份。未传参数时保留环境变量及 PID 唯一匹配,
120
+ 兼容原来的单会话模式;无法识别时仍允许匿名查看会话列表,但 `list_reservations` 会报错,因为无从确定该查哪个仓库。
121
+
122
+ 更新后需要重新连接 CC Bridge MCP(或重启使用它的客户端),才能加载新程序和带 `session_id` 的工具定义。
123
+
74
124
  ### 会话名
75
125
 
76
126
  默认名字是 `<账号名>.<项目目录名>.<动物>`,例如 `claude.my-app.otter`、`claude-x.my-app.panda`。账号名取多账号页里的名称
@@ -113,11 +163,13 @@ CC_BRIDGE_NAME=api codex
113
163
  | 通知对方 | 用 cc-bridge 告诉 api:登录接口改成了 POST /api/login,返回字段加了 token,你那边同步改一下前端调用 |
114
164
  | 分派任务 | 让 web 帮忙写 src/api/login.ts 的单元测试,写完告诉我结果 |
115
165
  | 要对方回复 | 问一下 api 数据库迁移做到哪一步了,让它用 cc-bridge 回复你 |
116
- | 等对方做完 | 给 api 发消息让它跑一遍测试,并在它空闲时通知你 |
166
+ | 等对方回复 | 给 api 发消息让它跑一遍测试,跑完用 cc-bridge 把结果发给你 |
167
+ | 看对方何时空闲 | 给 api 发消息,并在它空闲时通知你 |
117
168
  | 按终端指定 | 发给 ttys003 那个 Claude 会话:…… |
118
169
 
119
170
  对方的回复会作为一条新消息出现在当前会话里。"在它空闲时通知你"会让对方这一轮做完后,
120
- 当前会话收到一条一次性的空闲通知(`notify_when_idle`),适合"等它做完我再继续"。
171
+ 当前会话收到一条一次性的空闲通知(`notify_when_idle`)。对方忙碌时,这一轮可能是收到消息前就在进行的回合,
172
+ 所以通知只表示对方结束了一个回合,不代表你的任务已完成。要等结果,请让对方做完后回复你。
121
173
 
122
174
  ### 多个会话改同一个仓库
123
175
 
@@ -151,7 +203,7 @@ CC_BRIDGE_NAME=api codex
151
203
  Bridge 优先验证当前进程提供的 `CODEX_THREAD_ID` / `CLAUDE_CODE_SESSION_ID`,包括注册记录、
152
204
  在线状态和宿主是否一致。没有会话 ID 时,仅允许宿主 PID 唯一匹配一个在线会话。
153
205
  多个会话共享 PID 且缺少可靠 ID,或显式 ID 已失效时,会明确拒绝发送、改名、收件和文件预留等操作,
154
- 不会按最近活跃时间猜测。CLI 排查时可用 `--from <会话名或完整会话 ID>` 显式指定身份。
206
+ 不会按最近活跃时间猜测。CLI 排查时可用 `--from <会话名或完整会话 ID>` 显式指定身份;`send` 的 `--from` 要写在正文之前。
155
207
 
156
208
  ## 文件预留
157
209
 
@@ -174,8 +226,10 @@ Bridge 优先验证当前进程提供的 `CODEX_THREAD_ID` / `CLAUDE_CODE_SESSIO
174
226
  | --- | --- | --- | --- |
175
227
  | Codex | 通过 `codex queue` 立即唤醒 | 排在当前回合之后处理 | 不投递,回执为 undeliverable |
176
228
  | Claude Code | 后台 watcher 通过 `asyncRewake` 唤醒 | 注入当前回合 | 不投递,回执为 undeliverable |
229
+ | Antigravity CLI(`agy`) | 等下一次模型调用 | 后续模型调用时带入 | 不投递,回执为 undeliverable |
230
+ | 已启用 Sidecar 的 Antigravity App | 在原对话中开始新一轮 | 等待对话空闲或后续模型调用 | App 离线后无法投递 |
177
231
 
178
- Claude Code 的 watcher 在会话启动和每轮结束时挂上,每次最多等待约 55 分钟后自动退出。
232
+ Claude Code 的 watcher 在会话启动和每轮结束时挂上,新挂上的会取代旧的并重新计时,最多等待约 55 分钟后自动退出。
179
233
  如果 Claude 会话在这段空窗期里一直空闲,消息会留在信箱,等用户下次输入时一并带入;
180
234
  那一轮进行中新到的消息,在该轮结束时投递。
181
235
 
@@ -188,6 +242,11 @@ Claude Code 的 watcher 在会话启动和每轮结束时挂上,每次最多
188
242
  信箱消息认领后保留在 `claimed`,完整输出并刷新输出流成功后才确认。进程异常退出时,下一次
189
243
  hook、watcher 或 `check_inbox` 会恢复未确认消息。在输出已到达宿主、确认尚未落盘的瞬间崩溃,
190
244
  恢复后可能重复投递同一个消息 ID;目前没有宿主确认协议,无法保证恰好一次送达。
245
+ `codex queue` 超时时无法确定消息是否已入队,消息会同时放进信箱,发送方会收到可能重复的提示,两份消息的 ID 相同。
246
+ 会话崩溃或被杀时不会触发 `SessionEnd`:下一次查询在线列表时发现它已离线,或下一个会话启动时,
247
+ 它未投递的消息会被清理,回执标记为 undeliverable,空闲订阅也一并移除。
248
+ 共享 app-server 的 Codex 线程在后台运行:关闭终端标签后,线程不会立刻结束,要等 app-server 卸载它才触发 `SessionEnd`,
249
+ 实测有几分钟以内的延迟。在此之前它仍显示在线,发给它的消息可能进入队列,并在恢复该线程时执行。
191
250
  跨账号投递 Codex 使用接收方注册的 Home;旧记录无法确定 Home 时保留到信箱,等待该会话输入后刷新注册。
192
251
 
193
252
  ## 桌宠里的显示
@@ -223,9 +282,10 @@ hook、watcher 或 `check_inbox` 会恢复未确认消息。在输出已到达
223
282
  这条消息不能提升权限:不能用来修改权限或配置,不能当作对待确认操作的批准;如果对方说某个操作
224
283
  在它那边被拒绝、请你代为执行,Agent 应拒绝并告知用户。
225
284
  - 消息正文保存在当前用户的临时目录(`getconf DARWIN_USER_TEMP_DIR` 下的 `cc-bridge-<uid>/`),
226
- 目录权限为 `0700`、文件权限为 `0600`,未投递的消息 24 小时后过期。
285
+ 目录权限为 `0700`、文件权限为 `0600`,未投递的消息 24 小时后过期(在下一个会话启动时清理)。
286
+ 消息送达后正文随之删除。回执只保存发送方、接收方、时间和状态,不含正文,保留约 48 小时用于排查。
227
287
  这是对 [Provider 协议](./PROVIDER_PROTOCOL.zh-CN.md)"不接收正文"原则的一个显式例外,
228
288
  所以默认关闭,需要你主动开启。
229
289
  - 单条消息最多 16KB。同一对会话 10 分钟内往来超过 20 条会被暂停,防止两个 Agent 互相自动回复形成循环。
230
290
  - 桌宠的状态卡片与系统通知不会显示消息正文。
231
- - 不引入常驻守护进程:只有 hooks、MCP server,以及 Claude 会话内的 watcher,都随会话结束而退出。
291
+ - Hooks、MCP server 和 Claude watcher 都随各自的会话结束而退出。Antigravity Sidecar 随 App 运行。
package/CHANGELOG.md CHANGED
@@ -7,6 +7,61 @@ truth for the version.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.5.0] - 2026-11-15
11
+
12
+ ### Menu bar
13
+
14
+ - Add a menu bar icon, chosen under Settings → Show In: Desktop Pet (default), Pet + Menu Bar, or Menu Bar Only.
15
+ - Left-click opens a compact glass panel: the pet's current status, up to five online sessions (click to jump to the terminal), a 5-hour quota ring per account, today's tokens, and Show Pet / Main menu. Right-click opens the pet's context menu.
16
+ - The menu bar icon is an outlined terminal window whose color follows the status card (blue working, green completed, red failed); awaiting approval switches the `>_` prompt to orange `•••` and returns to the normal menu bar color when the card goes back to idle. Plan accounts are listed before API accounts in the panel.
17
+ - While a session awaits approval, left-clicking the icon jumps straight to its terminal; ⌥-click opens the panel.
18
+ - The icon shows the number of sessions awaiting approval and, optionally, the lowest 5-hour quota left (orange at 20% or below, red at 10%). The number follows the switch only.
19
+ - Menu Bar Only hides the pet and its status card, bubbles and hover panel. Chatter is skipped without using its budget; tracking and notifications continue.
20
+ - The phrases editor's Try a Line explains that the pet is hidden in Menu Bar Only.
21
+
22
+ ### Status card
23
+
24
+ - Show the session instead of the agent in the title ("session · status"), so concurrent sessions can be told apart at a glance. With CC Bridge enabled the label is `directory.animal` (for example `cc-pets.crab`); otherwise it is the working directory name, falling back to the agent name when neither is known. Long labels are truncated in the middle and keep the trailing animal suffix.
25
+ - Hovering the status card shows the full session name and working directory.
26
+ - Accept optional working-directory metadata in provider events for session labels and tooltips, falling back to the event command's current directory.
27
+
28
+ ### CC Bridge
29
+
30
+ - Show Chinese animal aliases alongside automatically generated session names in Chinese UI, CLI output, messages and notifications. Keep original names and refs as message addresses; custom names remain unchanged.
31
+ - Exclude transient Codex tasks without persisted transcripts from message-recipient registration while retaining their pre-edit file reservation checks.
32
+ - Accept a per-call `session_id` in MCP tools, supplied through session-start and user-prompt hook context, so Codex sessions sharing an app-server PID can identify themselves when MCP does not inherit a session ID. Explicit identities must pass live-registration and host checks; retain single-session auto-detection, reject invalid IDs and never cache caller identity.
33
+ - Keep `config.toml` byte-for-byte outside CC Bridge's own managed block, including blank lines inside multi-line strings and marker-like text.
34
+ - Recognize CLI hosts from structured argv so paths containing spaces work. Rejected `session_id` values now report why, and an unverifiable host is still rejected.
35
+ - Serialize reservation creation, renewal, acknowledgement, release and expiry so concurrent sessions can't miss conflicts or lose updates.
36
+ - Detect overlaps between directories and globs, such as `src/api` and `src/**/*.ts`, by checking whether a common path exists.
37
+ - Clean up after sessions that exit without `SessionEnd`: mark undelivered messages undeliverable, expire old messages and receipts, and remove idle subscriptions.
38
+ - Reject invalid `paths` in `release_files` without changing any reservation.
39
+ - Make send limits atomic so concurrent sessions can't exceed them.
40
+ - Resolve symlinks in repository roots and reserved paths, including new files and globs, so reservations match however a session reached the directory.
41
+ - Keep the newest deliveries in the pet's badge and notifications when receipts exceed the scan limit.
42
+ - Use the same online check in the pet as in the CLI.
43
+ - Report the right count in the "and N more" delivery notification.
44
+ - Recognize only real `mcp_servers` declarations when uninstalling, so matching text in project paths no longer causes false removal errors.
45
+ - Treat `--from` after the first two `send` arguments as message text, and reject unknown options and flags missing a value.
46
+ - Stop treating patch-like text in written content as edited files, and skip `git` when no reservations exist.
47
+ - Answer MCP requests with invalid UTF-8 with a parse error instead of no response.
48
+ - Return an error from `list_reservations` when the caller is unknown instead of checking the MCP process directory.
49
+ - Stop storing message bodies in receipts, so a body is deleted once its message is delivered.
50
+ - Delete undelivered messages on `disable` and mark their receipts undeliverable.
51
+ - When `codex queue` times out, keep the inbox fallback and warn the sender that the message may arrive twice.
52
+ - `release_files` with an empty `paths` array now releases nothing; omit `paths` to release everything.
53
+ - Skip inbox locking while the watcher's inbox is empty, and clarify what `notify_when_idle` guarantees.
54
+ - Let each new watcher replace the previous one and restart the wait, so active sessions stay wakeable for about 55 minutes after every turn.
55
+ - Enqueue under the inbox lock and recheck that Bridge is on and the recipient is online, so a slow send can't leave a body behind after `disable` or a session exit.
56
+ - Follow symlinks before resolving `..` in reserved paths, and recognize quoted `mcp_servers` keys at every level when uninstalling.
57
+
58
+ ### Session lifecycle
59
+
60
+ - Match shared-host Codex terminal launches against unique TUI readiness records within one second before or after session creation, covering initial frames logged just after creation without guessing between concurrent clients.
61
+ - Track persistent Codex desktop chats against the current app instance, include them in online counts, and keep the pet running while Codex desktop is open after the last managed CLI exits. Ignore transient background tasks and restore recent desktop records without replaying animations or notifications.
62
+ - Record Codex session-end hooks, remove ended sessions and pending approvals, and switch the displayed session or return to idle without a completion animation. Ignore trailing events after a turn completes.
63
+ - Preserve profile-ID separators and normalize legacy IDs so account matching stays consistent. Track managed CLI exits per session instead of excluding other sessions from the same provider.
64
+
10
65
  ## [2.4.0] - 2026-11-03
11
66
 
12
67
  ### Diagnostics
@@ -6,6 +6,61 @@
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.5.0] - 2026-11-15
10
+
11
+ ### 菜单栏
12
+
13
+ - 新增菜单栏图标,在「设置 → 显示位置」选择:仅桌宠(默认)、桌宠 + 菜单栏、仅菜单栏。
14
+ - 左键打开精简的玻璃面板:宠物当前状态、最多 5 个在线会话(点击跳到终端)、每个账号一个 5 小时额度环、今日用量,以及显示桌宠、主菜单。右键打开与桌宠相同的右键菜单。
15
+ - 菜单栏图标是带 `>_` 的描边终端窗口,颜色与状态卡同步(工作中蓝、完成绿、失败红),等待审批时 `>_` 换成橙色 `•••`,状态卡回落待机时恢复原色。面板中订阅账号排在 API 账号之前。
16
+ - 有会话等待审批时,左键点图标直接跳到该会话的终端;按住 ⌥ 点击打开面板。
17
+ - 图标旁显示等待审批的会话数,可选显示最低的 5 小时剩余额度(20% 及以下橙色,10% 及以下红色),是否显示只看开关。
18
+ - 仅菜单栏时隐藏桌宠及其状态卡、气泡和悬停面板。碎碎念直接跳过、不占预算;状态跟踪和系统通知照常。
19
+ - 仅菜单栏时,台词编辑器的「试说一句」会提示桌宠已隐藏。
20
+
21
+ ### 状态卡
22
+
23
+ - 标题由「智能体 · 状态」改为「会话 · 状态」,多个会话同时运行时能直接看出是哪一个。开启 CC Bridge 时显示「目录名.动物」(如 `cc-pets.crab`),否则显示工作目录名;取不到时仍显示智能体名称。过长的标签截掉中间、保留末尾的动物后缀。
24
+ - 悬停状态卡显示完整会话名和工作目录。
25
+ - Provider 事件支持可选的工作目录信息,用于会话标签与悬停提示;未提供或无效时回退到事件命令的当前目录。
26
+
27
+ ### CC Bridge
28
+
29
+ - 中文界面、CLI 输出、消息与通知为自动生成的会话名附加中文动物别名;消息寻址仍使用原始名称和 ref,自定义名称保持不变。
30
+ - 没有持久化转录的 Codex 临时任务不再注册为消息收件人,但仍执行编辑前的文件预留检查。
31
+ - MCP 工具支持逐次传入 `session_id`,由会话启动及用户输入 hook 提供当前身份,修复多个 Codex 会话共用 app-server PID 且 MCP 未继承会话 ID 时无法识别调用者的问题。显式身份须通过在线注册及宿主校验;保留单会话自动识别,拒绝无效 ID 且不缓存调用者身份。
32
+ - `config.toml` 只改 CC Bridge 自身的管理块,其余内容逐字保留,包括多行字符串里的空行和形似标记的文本。
33
+ - 通过结构化 argv 识别 CLI 宿主,修复路径含空格时识别失败的问题。`session_id` 被拒绝时会说明原因,无法验证宿主时仍然拒绝。
34
+ - 文件预留的创建、续期、确认、释放和过期删除改为串行执行,避免并发会话漏检冲突或丢失更新。
35
+ - 通过判断是否存在共同路径来检测目录与 glob 的重叠,例如 `src/api` 与 `src/**/*.ts`。
36
+ - 补全未触发 `SessionEnd` 就退出的会话的清理:未投递消息标记为 undeliverable,过期消息和回执收尾,并移除空闲订阅。
37
+ - `release_files` 收到非法 `paths` 时报错,且不改动任何预留。
38
+ - 发送限额改为原子操作,并发会话不会越过上限。
39
+ - 解析仓库根和预留路径中的软链,包括新文件和 glob,无论会话从哪条路径进入目录,预留都能对上。
40
+ - 回执数超过扫描上限时,桌宠的角标和通知仍保留最新送达的消息。
41
+ - 桌宠与 CLI 使用同一套在线判断规则。
42
+ - 修正送达通知里“另外 N 条”的数量。
43
+ - 卸载时只识别真正的 `mcp_servers` 声明,项目路径中的相同文字不再导致误报移除失败。
44
+ - `send` 前两个参数之后的 `--from` 视为消息正文;未知选项和缺值的参数会报错。
45
+ - 写入内容里形似补丁的文本不再算作被编辑的文件;没有预留时跳过 `git` 调用。
46
+ - 含非法 UTF-8 的 MCP 请求返回解析错误,不再没有响应。
47
+ - 调用者身份未知时,`list_reservations` 返回错误,不再查询 MCP 进程所在目录。
48
+ - 回执不再保存消息正文,消息送达后正文即被删除。
49
+ - `disable` 时删除未投递的消息,回执标记为 undeliverable。
50
+ - `codex queue` 超时时仍回退到信箱,并提示发送方消息可能到达两次。
51
+ - `release_files` 传空数组时不再释放任何预留;不传 `paths` 才会全部释放。
52
+ - watcher 在信箱为空时不再加锁,并明确 `notify_when_idle` 的保证范围。
53
+ - 新 watcher 取代旧的并重新计时,活跃会话在每轮结束后约 55 分钟内都能被唤醒。
54
+ - 入信箱时持有信箱锁,并复查 Bridge 开关和收件方在线状态,发送缓慢时不会在 `disable` 或会话退出后留下正文。
55
+ - 预留路径先解析软链再处理 `..`;卸载时识别每一级都带引号的 `mcp_servers` 键。
56
+
57
+ ### 会话生命周期
58
+
59
+ - 共享宿主下的 Codex 终端匹配改为查询会话创建前后一秒内唯一的 TUI 就绪记录,兼容首帧稍晚于会话创建才记录的情况,多个客户端并发时仍不猜测归属。
60
+ - 按当前应用实例跟踪 Codex 桌面端的持久化聊天,将其计入在线数量;最后一个托管 CLI 退出后,Codex 桌面端仍运行时保留桌宠。过滤后台临时任务,恢复近期桌面会话记录时不重播动画或通知。
61
+ - 记录 Codex 会话结束 Hook,清理已结束会话和待审批记录,并切换展示会话或直接恢复待机,不误播完成动画;回合完成后的尾随事件不再覆盖终态。
62
+ - 保留账号 ID 的分隔符并兼容旧格式,修复账号匹配;按具体会话跟踪托管 CLI 退出,避免误排除同一 Provider 的其他会话。
63
+
9
64
  ## [2.4.0] - 2026-11-03
10
65
 
11
66
  ### 诊断
@@ -46,7 +101,7 @@
46
101
 
47
102
  ### 启动保护
48
103
 
49
- - 新增可选的小火箭(Shadowrocket)启动检查,位于「主菜单 → 设置 → 启动保护」,默认关闭。包装器在登记会话、发送 starting 事件之前检查 VPN 连接状态,并分别请求服务的 `/cdn-cgi/trace`。中国大陆(CN)、香港(HK)、未知出口及请求失败均阻止启动;成功显示出口 IP 和地区。
104
+ - 新增可选的 Shadowrocket 启动检查,位于「主菜单 → 设置 → 启动保护」,默认关闭。包装器在登记会话、发送 starting 事件之前检查 VPN 连接状态,并分别请求服务的 `/cdn-cgi/trace`。中国大陆(CN)、香港(HK)、未知出口及请求失败均阻止启动;成功显示出口 IP 和地区。
50
105
  - Claude 默认检查 `api.anthropic.com`;Codex 按 `auth.json` 的登录模式检查 `chatgpt.com` 或 `api.openai.com`,模式未知时检查两者。支持用户级常见端点配置;自定义地址必须返回有效 trace,不回退到无关域名。移除独立 DNS / 首页 HEAD 探测,不携带账号凭据、校验 TLS 证书、忽略 `~/.curlrc`、不跟随重定向。复杂配置、项目网络覆盖及云服务商的支持边界见 README;绕过包装器的启动不受保护。
51
106
  - 出口检测调整为连接时限 8 秒、单次请求时限 15 秒、进程保护时限 16 秒;临时传输故障和 HTTP 502 / 503 / 504 间隔 1 秒重试一次。失败时显示超时阶段、尝试次数及连接累计耗时。包装器测试每轮使用独立偏好域,避免读取真实 VPN 设置并发起网络探测,保留编译缓存和阶段计时。
52
107
 
package/CONTRIBUTING.md CHANGED
@@ -43,7 +43,7 @@ Install preview builds explicitly; the automatic updater accepts stable versions
43
43
  `main` is reserved for stable releases, including the stable GitHub Release and tag.
44
44
  Complete implementation, documentation, screenshots, and validation on `publish`
45
45
  before submitting to `main`; repeat integration checks there before a stable release.
46
- The latest stable GitHub release is **v2.3.0**, covering the Main menu, multiple accounts, token usage by model, and the native runtime.
46
+ The latest stable GitHub release is **v2.5.0**, covering menu bar mode, clearer session status and lifecycle tracking, and CC Bridge identity, file reservation, and message delivery fixes.
47
47
  See [release status](docs/release-status.md) for validation and handoff details.
48
48
 
49
49
  ## Localization
@@ -36,7 +36,7 @@ prerelease,并使用如 `2.2.1-rc.1` 的预发布版本号。`main` 仅负责
36
36
  GitHub Release 和 tag。提交到 `main` 前,代码、文档、截图与验证必须全部完成;
37
37
  在 `main` 完成集成验证后才能发布正式版本。
38
38
  测试版本需显式安装,自动更新器只接受正式版本号。
39
- 当前 GitHub 正式版本为 **v2.3.0**,包含主菜单、多账号、按模型统计 Token 用量与原生运行时。
39
+ 当前 GitHub 正式版本为 **v2.5.0**,包含菜单栏模式、更清楚的会话状态与生命周期跟踪,以及 CC Bridge 身份、文件预留和消息投递修复。
40
40
  验证和交接状态见[发布状态](docs/release-status.md)。
41
41
 
42
42
  ## 多语言
@@ -4,7 +4,7 @@ English | [简体中文](./PROVIDER_PROTOCOL.zh-CN.md)
4
4
 
5
5
  Third-party CLI agents can write normalized status events to CC Pets through
6
6
  standard input and reuse its status card, animations, and optional system
7
- notifications. The protocol accepts status and tool categories only. It does not
7
+ notifications. The protocol accepts status, tool categories, and working-directory metadata. It does not
8
8
  accept prompts, command text, file contents, or model output.
9
9
 
10
10
  ## Sending an event
@@ -22,6 +22,10 @@ printf '%s' '{
22
22
  letters, digits, spaces, `.`, `_`, and `-`. `tool` is optional, has a maximum length
23
23
  of 64 characters, and is used only to select redacted status text and animation.
24
24
 
25
+ `cwd` is optional and supplies the working directory for the session label and tooltip.
26
+ It must be an absolute path of at most 1,024 UTF-16 code units without control characters.
27
+ If omitted or invalid, CC Pets uses the event command's current working directory.
28
+
25
29
  `state` must be one of these values:
26
30
 
27
31
  | State | Meaning |
@@ -3,7 +3,7 @@
3
3
  [English](./PROVIDER_PROTOCOL.md) | 简体中文
4
4
 
5
5
  第三方 CLI Agent 可以通过标准输入向 CC Pets 写入统一状态事件,从而复用状态气泡、
6
- 桌宠动画和可选的系统通知。协议只接收状态类别和工具类别,不接收提示词、命令正文、
6
+ 桌宠动画和可选的系统通知。协议接收状态类别、工具类别和工作目录信息,不接收提示词、命令正文、
7
7
  文件内容或模型输出。
8
8
 
9
9
  ## 发送事件
@@ -20,6 +20,9 @@ printf '%s' '{
20
20
  `provider` 必填,最长 32 个字符,仅保留字母、数字、空格、`.`、`_` 和 `-`。
21
21
  `tool` 可选,最长 64 个字符,仅用于选择脱敏后的状态文案和动画。
22
22
 
23
+ `cwd` 可选,用于会话标签和悬停提示。必须是绝对路径,最长 1,024 个 UTF-16 码元,
24
+ 且不能含控制字符。未提供或无效时,使用事件命令的当前工作目录。
25
+
23
26
  `state` 必须是下列值之一:
24
27
 
25
28
  | state | 含义 |