clauderipple 0.7.0 → 0.8.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/CHANGELOG.md +51 -0
- package/README.ko.md +15 -1
- package/README.md +23 -3
- package/dist/app/package.json +1 -1
- package/dist/cli/src/claude-auth.js +35 -1
- package/dist/cli/src/codex.js +23 -0
- package/dist/cli/src/hooks/agent-title.js +58 -29
- package/dist/cli/src/index.js +46 -1
- package/dist/cli/src/runtime.js +3 -0
- package/dist/cli/src/settings.js +49 -0
- package/dist/mod/.claude-plugin/plugin.json +1 -0
- package/dist/mod/hooks/hooks.json +1 -0
- package/dist/mod/hooks/register.tsx +309 -0
- package/dist/mod/hooks/worker.ts +49 -0
- package/dist/mod/tsconfig.json +3 -0
- package/dist/mod/types/index.d.ts +30 -0
- package/dist/router/src/admin.js +411 -32
- package/dist/router/src/agents.js +24 -8
- package/dist/router/src/catalog.js +80 -0
- package/dist/router/src/compat.js +27 -1
- package/dist/router/src/config.js +31 -0
- package/dist/router/src/index.js +12 -1
- package/dist/router/src/ingress/server.js +3 -2
- package/dist/router/src/picker.js +33 -2
- package/dist/router/src/presets.js +2 -1
- package/dist/router/src/providers/chatgpt/index.js +42 -15
- package/dist/router/src/providers/chatgpt/translate.js +34 -6
- package/dist/router/src/providers/google/accounts.js +345 -0
- package/dist/router/src/providers/google/antigravity.js +392 -0
- package/dist/router/src/providers/google/index.js +617 -0
- package/dist/router/src/providers/google/login.js +249 -0
- package/dist/router/src/providers/google/thoughtSignatures.js +47 -0
- package/dist/router/src/providers/google/translate.js +539 -0
- package/dist/router/src/providers/google/transport.js +118 -0
- package/dist/router/src/providers/openai/translate.js +3 -3
- package/dist/router/src/proxy.js +85 -1
- package/dist/router/src/requestlog.js +2 -0
- package/dist/router/src/routing.js +22 -0
- package/dist/router/src/version.js +1 -1
- package/dist/ui/app.js +420 -45
- package/dist/ui/i18n.js +76 -4
- package/dist/ui/index.html +5 -0
- package/dist/ui/style.css +4 -0
- package/docs/ARCHITECTURE.md +287 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0 — 2026-10-05
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **The route, where you type** (Claude Code mods; a switch on the Clients screen, or
|
|
8
|
+
`clauderipple mod on`). A line above the Claude Code prompt says where your last request
|
|
9
|
+
went: model, provider, effort, cache hit and time, colored by provider and result. `Log` or
|
|
10
|
+
`/ripple-log` opens the request log in a side pane, all sessions or just this one; `×` or
|
|
11
|
+
`/ripple-bar` puts the line away. The router now records which Claude Code session sent each
|
|
12
|
+
request (`X-Claude-Code-Session-Id`), and `/api/requests?session=` filters by it.
|
|
13
|
+
- **Workers stay on their own model.** The same mod catches a `model` argument on an Agent call
|
|
14
|
+
that would have put a ClaudeRipple worker on a Claude alias (its output cut to 64 tokens) and
|
|
15
|
+
runs it on its own model, and reads a `[[ripple: name@level]]` marker wherever it sits in the
|
|
16
|
+
prompt, not only on the first line.
|
|
17
|
+
- **Google Gemini**, on its own wire: an AI Studio key, or a Google account through the
|
|
18
|
+
Antigravity backend with several accounts in rotation. Google's terms name the account route
|
|
19
|
+
as a breach and accounts were suspended for it; the sign-in says so before it starts.
|
|
20
|
+
- **Each routed model gets its own effort menu in the Claude app.** DeepSeek and GLM show
|
|
21
|
+
low/high/max instead of Claude's whole ladder; a model that takes no effort shows none.
|
|
22
|
+
- **Fast mode on GPT.** `/fast` in Claude Code asks the ChatGPT backend for the Codex fast tier.
|
|
23
|
+
- **Updates from the dashboard**: the version row checks and starts an update.
|
|
24
|
+
- **A typed model ID** for a provider that lists no models (#42).
|
|
25
|
+
- **An explicit Auto mode classifier target** (`autoModeClassifier`, JSON only; #43 by
|
|
26
|
+
@Sociopacific). The README says what pointing it at a weaker model gives up.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- **Measuring an OpenCode provider takes one request per model**, its effort ladder read from
|
|
31
|
+
models.dev, four models at a time, instead of about ten sequential requests each (three
|
|
32
|
+
OpenCode Go models had taken 2m33s). The ladders are the catalogue's: glm-5.3-flash is
|
|
33
|
+
low/high/max, where requests had accepted seven levels.
|
|
34
|
+
- **Generated workers run at `@high`** unless a marker says otherwise.
|
|
35
|
+
- **A clamping tie goes up**: medium on a low/high/max model is high, not low.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **A settings save no longer undoes what the router wrote.** The dashboard saved the whole
|
|
40
|
+
config from the copy it loaded when it opened, so measured ladders and hand edits came back
|
|
41
|
+
with the next unrelated save. Every save now starts from the router's current config.
|
|
42
|
+
- **Routed workers are no longer told to call `advisor`** after the tool was dropped (#47, #48
|
|
43
|
+
by @115dkk).
|
|
44
|
+
- **`claude-login` finds the Desktop-cached CLI** in its new `<version>/<hash>/` folder (#45,
|
|
45
|
+
#46 by @115dkk). macOS had the same layout.
|
|
46
|
+
- **Codex context overflow** is answered as "prompt is too long", so Claude Code compacts
|
|
47
|
+
instead of retrying the same request (#44 by @Sociopacific); a stream held for that opens
|
|
48
|
+
after five seconds regardless.
|
|
49
|
+
- The Codex app sees a GPT model released after the router started; subagent titles keep the
|
|
50
|
+
model and effort under Desktop's new task panel; a provider's connection test reads a
|
|
51
|
+
model-not-found 404 as an accepted key; a Gemini provider waiting on Google's verification
|
|
52
|
+
is not shown as connected, and the page to open is passed on.
|
|
53
|
+
|
|
3
54
|
## 0.7.0 — 2026-09-29
|
|
4
55
|
|
|
5
56
|
### Added
|
package/README.ko.md
CHANGED
|
@@ -132,6 +132,15 @@ ClaudeRipple이 Claude에 하는 일은 작고 확인할 수 있습니다. Claud
|
|
|
132
132
|
돌려 쓰는 것도 같은 약관 아래 각자 판단할 일입니다. 계정을 어떻게 다룰지는 Anthropic만 정할 수 있으니, 여기 적은
|
|
133
133
|
내용은 보장이 아닙니다.
|
|
134
134
|
|
|
135
|
+
### Gemini를 Google 계정으로 쓰면요?
|
|
136
|
+
|
|
137
|
+
AI Studio API 키는 Google이 공식 지원하는 방식이고 안전합니다. Google 계정 로그인(Antigravity)은 다릅니다.
|
|
138
|
+
Google [Antigravity 약관](https://antigravity.google/terms) 6조와 [Gemini CLI FAQ](https://geminicli.com/docs/resources/faq/)는
|
|
139
|
+
그 로그인 정보를 다른 프로그램에서 쓰는 것을 위반으로 명시합니다. Google은 2026년 2월 이렇게 쓰인 계정을 정지했고(정지되면
|
|
140
|
+
Gemini CLI와 Code Assist도 막혔습니다), [2차 위반은 영구 정지](https://github.com/google-gemini/gemini-cli/discussions/20632)라고
|
|
141
|
+
밝혔습니다. ClaudeRipple은 다른 도구들도 제공하고 요청이 있어 이 로그인을 넣었으며, 시작 전에 이 경고를 보여 주고 트래픽을
|
|
142
|
+
숨기는 일은 하지 않습니다. 쓰신다면 주 계정이 아닌 계정을 쓰세요.
|
|
143
|
+
|
|
135
144
|
### ChatGPT 계정을 여러 개 쓸 수 있나요?
|
|
136
145
|
|
|
137
146
|
됩니다. `clauderipple login`을 할 때마다(또는 대시보드의 **+ ChatGPT 계정 추가**) 계정이 하나씩 늘어납니다.
|
|
@@ -226,6 +235,10 @@ ClaudeRipple은 Claude Code 프로세스만 신뢰하는 작은 HTTPS 프록시
|
|
|
226
235
|
서버 측 스레드 처리, 도구 호출과 이미지 왕복, 모델이 받는 범위로 추론 강도 클램프, 호환 벤더에는 Anthropic 전용 필드 제거.
|
|
227
236
|
- **제대로 된 요청 로그.** 누가 물었고 어떤 모델이 답했는지, 입력·캐시·출력 토큰, 지연, 상태를 요청마다. 한 시간 요약 포함.
|
|
228
237
|
- **서브에이전트 이름표.** 백그라운드 작업 패널에 "Agent" 대신 `Terra·high · Review`가 보입니다.
|
|
238
|
+
- **입력창에서 보이는 경로.** Claude Code mod가 입력창 위에 한 줄을 띄웁니다. 마지막 요청이 어디로 갔는지, 추론 강도·캐시
|
|
239
|
+
적중률·시간까지. `Log`(또는 `/ripple-log`)로 요청 로그를 옆 패널에 프로바이더·결과별 색으로 띄우고, `×`(또는
|
|
240
|
+
`/ripple-bar`)로 줄을 숨깁니다. 같은 mod가 Agent 호출에 다른 모델이 붙어도 워커를 제 모델로 돌리고,
|
|
241
|
+
`[[ripple: 이름@강도]]` 표식을 프롬프트 어디에 두든 읽습니다. 클라이언트 화면의 스위치 하나, 또는 `clauderipple mod on`.
|
|
229
242
|
- **ChatGPT 구독으로 이미지 생성.** `clauderipple image "<프롬프트>"`. 참고 이미지와 투명 배경도 됩니다. 서브에이전트에도
|
|
230
243
|
방법이 적혀 있어, GPT나 DeepSeek 워커가 이미지 도구 없이 이미지를 만들고 직접 확인합니다.
|
|
231
244
|
- **원하면 가벼운 워커.** 스위치 하나로, 생성된 서브에이전트에 세션의 MCP·플러그인 도구 전부 대신 워커가 쓰는 도구만
|
|
@@ -320,7 +333,7 @@ node packages/cli/src/index.ts ui # 브라우저에서 로컬 GUI 열기
|
|
|
320
333
|
```
|
|
321
334
|
|
|
322
335
|
`uninstall`은 전부 되돌리고 `~/.claude/settings.json`을 백업에서 복원합니다. 그 밖의 명령: `status`, `start`, `stop`,
|
|
323
|
-
`restart`, `logs -f`, `login`, `logout`, `claude-login`, `claude-logout`, `picker on|off`, `agent-title on|off`,
|
|
336
|
+
`restart`, `logs -f`, `login`, `logout`, `claude-login`, `claude-logout`, `picker on|off`, `agent-title on|off`, `mod on|off`,
|
|
324
337
|
`codex on|off`, `update`, `image "<프롬프트>"`.
|
|
325
338
|
</details>
|
|
326
339
|
|
|
@@ -419,6 +432,7 @@ Anthropic API 키로 갑니다. 구독 로그인 재사용은 Anthropic 약관
|
|
|
419
432
|
| 프로바이더 | 종류 | 인증 | 모델 목록 | 비고 |
|
|
420
433
|
|---|---|---|---|---|
|
|
421
434
|
| ChatGPT 구독 | Codex 백엔드 | 로그인 여러 개, 한도 차면 자동 전환(Codex 로그인도 재사용) | 구독에서 자동으로 읽음(GPT-6 Sol·Luna·Astra, GPT-5.6 …) | 추론 강도 low…max(Luna는 ultra), 프롬프트 캐시 94~99 % |
|
|
435
|
+
| Google Gemini | Gemini API | AI Studio API 키, 또는 Google 계정 로그인(Antigravity, 위 FAQ 참고) | 자동 검색 | 번역(Messages ⇄ generateContent), 턴 사이 thought signature 유지 |
|
|
422
436
|
| OpenRouter | Anthropic 호환 | API 키 | 400+, 자동 검색 | 모델별 추론 강도 지원을 API에서 읽음 |
|
|
423
437
|
| DeepSeek, Kimi, Z.ai GLM, MiniMax, Qwen(국제/중국) | Anthropic 호환 | API 키 | 프리셋 | 벤더 공식 문서로 확인 |
|
|
424
438
|
| xAI Grok, Mistral, Groq, Together, Fireworks | OpenAI 호환 | API 키 | 자동 검색 | 번역(Chat Completions / Responses) |
|
package/README.md
CHANGED
|
@@ -151,6 +151,18 @@ subscription login. That use is subject to Anthropic's terms; an Anthropic API k
|
|
|
151
151
|
the question. Rotating several Claude subscriptions is likewise your call under those
|
|
152
152
|
terms. Only Anthropic can say how an account is treated, so nothing here is a promise.
|
|
153
153
|
|
|
154
|
+
### What about Gemini through a Google account?
|
|
155
|
+
|
|
156
|
+
An AI Studio API key is the way Google supports, and the safe one. The Google account
|
|
157
|
+
sign-in (Antigravity) is different: Google's [Antigravity terms](https://antigravity.google/terms)
|
|
158
|
+
(section 6) and the [Gemini CLI FAQ](https://geminicli.com/docs/resources/faq/) name using
|
|
159
|
+
those credentials from another program as a breach. In February 2026 Google suspended
|
|
160
|
+
accounts used this way — the suspension also cut off Gemini CLI and Code Assist — and
|
|
161
|
+
[said](https://github.com/google-gemini/gemini-cli/discussions/20632) a second violation
|
|
162
|
+
is permanent. ClaudeRipple offers the sign-in because others do and people asked, shows
|
|
163
|
+
this warning before it starts, and does nothing to hide the traffic. Use a secondary
|
|
164
|
+
account if you use it at all.
|
|
165
|
+
|
|
154
166
|
### Can I use several ChatGPT accounts?
|
|
155
167
|
|
|
156
168
|
Yes. Each `clauderipple login` (or **+ Add ChatGPT account** in the dashboard) adds one.
|
|
@@ -243,7 +255,7 @@ you map go to your provider, everything else goes to Anthropic byte for byte.
|
|
|
243
255
|
|
|
244
256
|
- **Any model in Claude Desktop and Claude Code.** GPT-6 Sol / Luna / Astra and
|
|
245
257
|
GPT-5.6 Terra / Sol / Luna through your ChatGPT Plus/Pro subscription (new models
|
|
246
|
-
appear the day OpenAI serves them), or DeepSeek, Kimi, GLM,
|
|
258
|
+
appear the day OpenAI serves them), Google Gemini, or DeepSeek, Kimi, GLM,
|
|
247
259
|
MiniMax, Qwen, Grok, Mistral, Groq, Together, Fireworks, OpenRouter (400+ models)
|
|
248
260
|
and local Ollama / LM Studio. Under their real names in the picker, or mapped onto
|
|
249
261
|
a Claude name.
|
|
@@ -272,6 +284,12 @@ you map go to your provider, everything else goes to Anthropic byte for byte.
|
|
|
272
284
|
latency, status, per request, with a one-hour summary.
|
|
273
285
|
- **Subagent name tags.** The background-task panel shows `Terra·high · Review`
|
|
274
286
|
instead of a generic "Agent".
|
|
287
|
+
- **The route, where you type.** A Claude Code mod puts one line above the prompt:
|
|
288
|
+
where your last request went, its effort, cache hit and time. `Log` (or `/ripple-log`)
|
|
289
|
+
opens the request log in a side pane, color-coded by provider and result; `×` (or
|
|
290
|
+
`/ripple-bar`) hides the line. The same mod keeps a worker on its own model when the
|
|
291
|
+
Agent call names another, and reads its `[[ripple: name@level]]` marker wherever it sits
|
|
292
|
+
in the prompt. One switch on the Clients screen, or `clauderipple mod on`.
|
|
275
293
|
- **Images from your ChatGPT subscription.** `clauderipple image "<prompt>"`, with
|
|
276
294
|
reference images and transparent backgrounds. Subagents are told how, so a GPT or
|
|
277
295
|
DeepSeek worker can make an image and look at it without an image tool.
|
|
@@ -374,7 +392,7 @@ node packages/cli/src/index.ts ui # open the local GUI in your browser
|
|
|
374
392
|
|
|
375
393
|
`uninstall` reverses everything and restores `~/.claude/settings.json` from a backup.
|
|
376
394
|
Other commands: `status`, `start`, `stop`, `restart`, `logs -f`, `login`, `logout`,
|
|
377
|
-
`claude-login`, `claude-logout`, `picker on|off`, `agent-title on|off`,
|
|
395
|
+
`claude-login`, `claude-logout`, `picker on|off`, `agent-title on|off`, `mod on|off`,
|
|
378
396
|
`codex on|off`, `update`, `image "<prompt>"`.
|
|
379
397
|
</details>
|
|
380
398
|
|
|
@@ -491,6 +509,7 @@ provider you configured is available the same way.
|
|
|
491
509
|
| Provider | Kind | Auth | Model list | Notes |
|
|
492
510
|
|---|---|---|---|---|
|
|
493
511
|
| ChatGPT subscription | Codex backend | several sign-ins, switching when one runs out (Codex login reused too) | read from your subscription (GPT-6 Sol, Luna, Astra, GPT-5.6 …) | effort low…max (Luna: ultra), prompt cache 94–99 % |
|
|
512
|
+
| Google Gemini | Gemini API | AI Studio API key, or Google account sign-in (Antigravity, see below) | discovered | translated (Messages ⇄ generateContent), thought signatures kept across turns |
|
|
494
513
|
| OpenRouter | Anthropic-compatible | API key | 400+, discovered | per-model effort support read from the API |
|
|
495
514
|
| DeepSeek, Kimi, Z.ai GLM, MiniMax, Qwen (intl / cn) | Anthropic-compatible | API key | preset | verified against vendor docs |
|
|
496
515
|
| xAI Grok, Mistral, Groq, Together, Fireworks | OpenAI-compatible | API key | discovered | translated (Chat Completions / Responses) |
|
|
@@ -509,7 +528,8 @@ Claude Desktop / claude CLI ──HTTPS_PROXY──▶ ClaudeRipple ──▶ ap
|
|
|
509
528
|
│
|
|
510
529
|
mapped model ──────────┼──▶ chatgpt.com/backend-api (Responses ⇄ Messages)
|
|
511
530
|
├──▶ Anthropic-compatible vendors (+ compat layer)
|
|
512
|
-
|
|
531
|
+
├──▶ OpenAI-compatible vendors (Messages ⇄ Chat/Responses)
|
|
532
|
+
└──▶ Google Gemini (Messages ⇄ generateContent)
|
|
513
533
|
Codex app / CLI ──/v1/responses──▶ ClaudeRipple ingress ──▶ Claude (your login or API key) / vendors
|
|
514
534
|
```
|
|
515
535
|
|
package/dist/app/package.json
CHANGED
|
@@ -39,6 +39,40 @@ function versionBinaries(versionDir) {
|
|
|
39
39
|
? BINARY_NAMES.map((name) => path.join(versionDir, name))
|
|
40
40
|
: [path.join(versionDir, "claude.app", "Contents", "MacOS", "claude")];
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* The launcher of one cached version: in the version directory itself, else one directory below it,
|
|
44
|
+
* newest first. Claude Desktop 2.19675 on Windows caches CLI 2.1.286 as <version>\<12 hex>\claude.exe
|
|
45
|
+
* beside .payload and .verified files, and moved the 2.1.284 it already had into the same shape, so
|
|
46
|
+
* no version directory held a launcher directly any more (2026-10-02).
|
|
47
|
+
*/
|
|
48
|
+
function cachedBinary(versionDir) {
|
|
49
|
+
const flat = versionBinaries(versionDir).find((candidate) => fs.existsSync(candidate));
|
|
50
|
+
if (flat)
|
|
51
|
+
return flat;
|
|
52
|
+
try {
|
|
53
|
+
const subdirectories = fs.readdirSync(versionDir)
|
|
54
|
+
.flatMap((entry) => {
|
|
55
|
+
const directory = path.join(versionDir, entry);
|
|
56
|
+
try {
|
|
57
|
+
const stat = fs.statSync(directory);
|
|
58
|
+
return stat.isDirectory() ? [{ directory, mtimeMs: stat.mtimeMs }] : [];
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
.sort((left, right) => right.mtimeMs - left.mtimeMs);
|
|
65
|
+
for (const { directory } of subdirectories) {
|
|
66
|
+
const binary = versionBinaries(directory).find((candidate) => fs.existsSync(candidate));
|
|
67
|
+
if (binary)
|
|
68
|
+
return binary;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// A missing or unreadable version directory has no usable binary.
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
42
76
|
export function latestDesktopClaude() {
|
|
43
77
|
for (const directory of desktopClaudeCodeDirs()) {
|
|
44
78
|
try {
|
|
@@ -46,7 +80,7 @@ export function latestDesktopClaude() {
|
|
|
46
80
|
.filter((entry) => /^\d+\.\d+\.\d+$/.test(entry))
|
|
47
81
|
.sort((left, right) => left.localeCompare(right, undefined, { numeric: true }));
|
|
48
82
|
for (const version of versions.reverse()) {
|
|
49
|
-
const binary =
|
|
83
|
+
const binary = cachedBinary(path.join(directory, version));
|
|
50
84
|
if (binary)
|
|
51
85
|
return binary;
|
|
52
86
|
}
|
package/dist/cli/src/codex.js
CHANGED
|
@@ -104,6 +104,29 @@ export function writeCodexCatalog(models, home = codexHome()) {
|
|
|
104
104
|
fs.writeFileSync(file, JSON.stringify({ models: [...theirs, ...ours] }, null, 1), { mode: 0o600 });
|
|
105
105
|
return file;
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Our catalog is a copy of Codex's cache, so it goes stale when Codex refreshes that cache: a model
|
|
109
|
+
* OpenAI released after the router started stayed missing from the app (gpt-6.1-sol, 2026-09-30 —
|
|
110
|
+
* the copy was written at router start, Codex's cache gained the model half an hour later). Rewrite
|
|
111
|
+
* the copy whenever the cache changes, while `codex on` is in effect. Polls, as Codex replaces the
|
|
112
|
+
* file rather than editing it; once a minute is plenty, since the app reads the catalog only when it
|
|
113
|
+
* starts. Returns a stop function.
|
|
114
|
+
*/
|
|
115
|
+
export function followCodexCache(models, home = codexHome(), intervalMs = 60_000, onError = () => { }) {
|
|
116
|
+
const cache = path.join(home, "models_cache.json");
|
|
117
|
+
const listener = (now, before) => {
|
|
118
|
+
if (now.mtimeMs === before.mtimeMs || !codexEnabled(home))
|
|
119
|
+
return;
|
|
120
|
+
try {
|
|
121
|
+
writeCodexCatalog(models(), home);
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
onError(e);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
fs.watchFile(cache, { interval: intervalMs, persistent: false }, listener);
|
|
128
|
+
return () => fs.unwatchFile(cache, listener);
|
|
129
|
+
}
|
|
107
130
|
function catalogBlock(file) {
|
|
108
131
|
return `${CATALOG_START}
|
|
109
132
|
model_catalog_json = ${JSON.stringify(file)}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
// Claude Code PreToolUse hook (matcher: Agent|Task): put the real model and thinking depth into the
|
|
2
2
|
// subagent's title, e.g. "Terra·high · Provider presets", so the Claude Desktop background-task
|
|
3
|
-
// panel shows which model a subagent runs on. The app's
|
|
4
|
-
//
|
|
3
|
+
// panel shows which model a subagent runs on. The app's model line names Claude models only (its
|
|
4
|
+
// display table is a fixed list of Claude families, app web bundle 2026-09-30), so for a routed
|
|
5
|
+
// model the title is the only text we can influence.
|
|
5
6
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
7
|
+
// The panel shows this title only while it follows the session live: rebuilt from the transcript
|
|
8
|
+
// (another session opened and back, app restart) it takes the description the parent model wrote,
|
|
9
|
+
// which a hook cannot change. So the generated agent files also ask the parent to write the same
|
|
10
|
+
// prefix itself (packages/router/src/agents.ts); here it is corrected to what the router will do.
|
|
11
|
+
//
|
|
12
|
+
// Model resolution mirrors the router (packages/router/src/routing.ts): a `[[ripple: sol@xhigh]]`
|
|
13
|
+
// marker at the very top of the prompt, else the agent definition's frontmatter `model:`, else the
|
|
14
|
+
// explicit `model` argument, else the parent session's model from the transcript tail. Depth = the
|
|
15
|
+
// marker's level, else the agent file's `@level`, else the hook input's effort.level, after the
|
|
16
|
+
// router's `effortClamp`. Runs in <50ms, never fails the tool call (empty output = no-op).
|
|
10
17
|
//
|
|
11
18
|
// Installed by `clauderipple agent-title on` into ~/.claude/settings.json; the router ships no
|
|
12
19
|
// Python, so this is TypeScript run by the Node recorded in <home>/paths.json.
|
|
@@ -14,36 +21,42 @@ import fs from "node:fs";
|
|
|
14
21
|
import os from "node:os";
|
|
15
22
|
import path from "node:path";
|
|
16
23
|
import { fileURLToPath } from "node:url";
|
|
17
|
-
|
|
24
|
+
// The router's marker (routing.ts MARKER): honoured only at the very top of the prompt.
|
|
25
|
+
const MARKER = /^\s*\[\[\s*(?:ripple|gpt)\s*:\s*([A-Za-z0-9.\-]+)\s*(?:@\s*([A-Za-z]+))?\s*\]\]/;
|
|
26
|
+
const REMINDER = /<system-reminder>[\s\S]*?<\/system-reminder>/g;
|
|
18
27
|
const OUR_PREFIX = /^[^\s·]+(?:·[a-z]+)? · /;
|
|
19
28
|
const CLAUDE_ID = /^claude-(opus|sonnet|haiku|fable)-(\d+(?:-\d+)*?)(?:-\d{8})?$/;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
/** The router's default `effortClamp` (config.ts), for when config.json cannot be read. */
|
|
30
|
+
const DEFAULT_CLAMP = { ultra: "max" };
|
|
31
|
+
/** A model's name in a title: the last word of its display name ("GPT-6.1 Sol" → "Sol"). */
|
|
32
|
+
export function shortName(name) {
|
|
33
|
+
const words = name.trim().split(/\s+/);
|
|
34
|
+
return words[words.length - 1];
|
|
35
|
+
}
|
|
36
|
+
function titleConfig() {
|
|
37
|
+
const names = { "gpt-5.6-terra": "Terra", "gpt-5.6-sol": "Sol", "gpt-5.6-luna": "Luna", "gpt-6-astra": "Astra", "gpt-6-sol": "Sol", "gpt-6-luna": "Luna" };
|
|
23
38
|
const home = process.env.CLAUDERIPPLE_HOME ?? path.join(os.homedir(), ".clauderipple");
|
|
24
39
|
try {
|
|
25
40
|
const cfg = JSON.parse(fs.readFileSync(path.join(home, "config.json"), "utf8"));
|
|
26
41
|
const add = (id, name) => {
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
const words = name.trim().split(/\s+/);
|
|
30
|
-
out[id.toLowerCase()] = words.length > 1 ? words[words.length - 1] : name.trim();
|
|
42
|
+
if (id && name)
|
|
43
|
+
names[id.toLowerCase()] = shortName(name);
|
|
31
44
|
};
|
|
32
45
|
for (const m of cfg.cli?.extraModels ?? [])
|
|
33
46
|
add(m.model, m.name);
|
|
34
47
|
for (const p of Object.values(cfg.providers ?? {}))
|
|
35
48
|
for (const m of p.models ?? [])
|
|
36
49
|
add(m.id, m.name);
|
|
50
|
+
return { names, aliases: cfg.aliases ?? {}, effortClamp: { ...DEFAULT_CLAMP, ...(cfg.effortClamp ?? {}) } };
|
|
37
51
|
}
|
|
38
52
|
catch {
|
|
39
|
-
|
|
53
|
+
return { names, aliases: {}, effortClamp: DEFAULT_CLAMP };
|
|
40
54
|
}
|
|
41
|
-
return out;
|
|
42
55
|
}
|
|
56
|
+
/** The `[[ripple: <name>@<effort>]]` a prompt starts with, name lowercased. Not resolved. */
|
|
43
57
|
export function fromMarker(prompt) {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
return m ? { model: m[1].toLowerCase(), effort: (m[2] ?? "").toLowerCase() } : null;
|
|
58
|
+
const m = MARKER.exec(prompt.replace(REMINDER, ""));
|
|
59
|
+
return m ? { name: m[1].toLowerCase(), effort: (m[2] ?? "").toLowerCase() } : null;
|
|
47
60
|
}
|
|
48
61
|
export function fromAgentFile(subagentType, dirs) {
|
|
49
62
|
if (!subagentType || subagentType.includes("/") || subagentType.startsWith("."))
|
|
@@ -106,28 +119,44 @@ function parentModel(transcriptPath) {
|
|
|
106
119
|
}
|
|
107
120
|
return null;
|
|
108
121
|
}
|
|
109
|
-
|
|
122
|
+
/**
|
|
123
|
+
* The model and effort the router will use for this call. The marker's name resolves as the router's
|
|
124
|
+
* aliases do (agents.ts withAgentAliases): an explicit alias, else an agent file's model, else the
|
|
125
|
+
* name itself; its effort, when absent, is the one the subagent's own `model:` asks for.
|
|
126
|
+
*/
|
|
127
|
+
function routed(inp, agentDirs, aliases) {
|
|
128
|
+
const own = fromAgentFile(typeof inp.subagent_type === "string" ? inp.subagent_type : "", agentDirs);
|
|
129
|
+
const marker = fromMarker(typeof inp.prompt === "string" ? inp.prompt : "");
|
|
130
|
+
if (!marker)
|
|
131
|
+
return own;
|
|
132
|
+
const model = aliases[marker.name]?.toLowerCase() ?? fromAgentFile(marker.name, agentDirs)?.model ?? marker.name;
|
|
133
|
+
return { model, effort: marker.effort || (own?.effort ?? "") };
|
|
134
|
+
}
|
|
135
|
+
export function retitle(input, agentDirs, cfg) {
|
|
110
136
|
if (input.tool_name !== "Agent" && input.tool_name !== "Task")
|
|
111
137
|
return null;
|
|
112
138
|
const inp = input.tool_input ?? {};
|
|
113
139
|
const desc = inp.description;
|
|
114
140
|
if (typeof desc !== "string" || desc.trim() === "")
|
|
115
141
|
return null;
|
|
116
|
-
const
|
|
117
|
-
const
|
|
142
|
+
const clamp = cfg.effortClamp ?? DEFAULT_CLAMP;
|
|
143
|
+
const level = (e) => clamp[e] ?? e;
|
|
144
|
+
const effort = level((typeof input.effort === "object" && input.effort ? input.effort.level : typeof input.effort === "string" ? input.effort : "") ?? "");
|
|
145
|
+
const got = routed(inp, agentDirs, cfg.aliases ?? {});
|
|
146
|
+
const names = cfg.names;
|
|
118
147
|
let tag = null;
|
|
119
|
-
if (got) {
|
|
120
|
-
//
|
|
148
|
+
if (got && !claudePretty(got.model)) {
|
|
149
|
+
// Legacy short forms ("sol") resolve against full ids ("gpt-5.6-sol").
|
|
121
150
|
const key = names[got.model] !== undefined ? got.model : Object.keys(names).find((k) => k.endsWith(`-${got.model}`));
|
|
122
|
-
const name = (key ? names[key] : undefined) ??
|
|
123
|
-
|
|
124
|
-
tag = got.effort ? `${name}·${got.effort}` : name;
|
|
151
|
+
const name = (key ? names[key] : undefined) ?? got.model;
|
|
152
|
+
tag = got.effort ? `${name}·${level(got.effort)}` : name;
|
|
125
153
|
}
|
|
126
154
|
if (tag === null) {
|
|
127
155
|
const name = claudePretty(typeof inp.model === "string" ? inp.model : undefined) ?? (got ? claudePretty(got.model) : null) ?? claudePretty(parentModel(input.transcript_path) ?? undefined);
|
|
128
156
|
if (!name)
|
|
129
157
|
return null;
|
|
130
|
-
|
|
158
|
+
const e = got?.effort ? level(got.effort) : effort;
|
|
159
|
+
tag = e ? `${name}·${e}` : name;
|
|
131
160
|
}
|
|
132
161
|
const prefix = `${tag} · `;
|
|
133
162
|
if (desc.startsWith(prefix))
|
|
@@ -150,7 +179,7 @@ if (process.argv[1] && path.resolve(process.argv[1]) === path.resolve(fileURLToP
|
|
|
150
179
|
try {
|
|
151
180
|
const raw = fs.readFileSync(0, "utf8");
|
|
152
181
|
const data = JSON.parse(raw || "{}");
|
|
153
|
-
const updated = retitle(data, defaultAgentDirs(),
|
|
182
|
+
const updated = retitle(data, defaultAgentDirs(), titleConfig());
|
|
154
183
|
if (updated)
|
|
155
184
|
process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: "PreToolUse", updatedInput: updated } }) + "\n");
|
|
156
185
|
}
|
package/dist/cli/src/index.js
CHANGED
|
@@ -315,7 +315,7 @@ async function status() {
|
|
|
315
315
|
const p = await probe({ host: cfg.listen.host, port: cfg.listen.port, caPem: caPath, upstream: cfg.upstream });
|
|
316
316
|
rows.push(["probe", `${p.ok ? "ok" : "FAIL"}: ${p.detail} (${p.ms}ms)`]);
|
|
317
317
|
for (const [name, p2] of Object.entries(cfg.providers)) {
|
|
318
|
-
const providerUrl = p2.type === "chatgpt" ? (p2.url ?? "https://chatgpt.com") : p2.type === "anthropic" ? "https://api.anthropic.com" : p2.url;
|
|
318
|
+
const providerUrl = p2.type === "chatgpt" ? (p2.url ?? "https://chatgpt.com") : p2.type === "anthropic" ? "https://api.anthropic.com" : p2.type === "google" ? (p2.url ?? "https://generativelanguage.googleapis.com") : p2.url;
|
|
319
319
|
const u = new URL(providerUrl);
|
|
320
320
|
rows.push([`provider ${name}`, await tcpCheck(u.hostname, Number(u.port) || (u.protocol === "https:" ? 443 : 80))]);
|
|
321
321
|
}
|
|
@@ -458,12 +458,15 @@ function help() {
|
|
|
458
458
|
logout forget every ChatGPT account added with "login" (the Codex CLI's own login is left alone)
|
|
459
459
|
claude-login connect a Claude subscription in the browser (--setup-token: via \`claude setup-token\`; --manual: paste the code)
|
|
460
460
|
claude-logout remove every Claude subscription added to ClaudeRipple
|
|
461
|
+
google-login add a Google account for the Antigravity (Cloud Code Assist) backend (prints Google's terms warning first)
|
|
462
|
+
google-logout remove every Google account added to ClaudeRipple
|
|
461
463
|
image "<prompt>" [-o FILE] [--aspect square|landscape|portrait] [--transparent] [--ref FILE ...]
|
|
462
464
|
generate an image with your ChatGPT subscription and print the file's path
|
|
463
465
|
picker on|off show your mapped models by name in the Claude Desktop picker (trusts the CA in your login keychain, routes the app through ClaudeRipple)
|
|
464
466
|
codex on|off add/remove ClaudeRipple's local OpenAI provider and selection profile for Codex CLI
|
|
465
467
|
agent-title on|off|status
|
|
466
468
|
prefix subagent titles with the real model and thinking depth ("Terra·high · …") via a Claude Code hook
|
|
469
|
+
mod on|off|status show where each request went above the Claude Code prompt, and the request log in a pane (/ripple-log), via a Claude Code mod
|
|
467
470
|
|
|
468
471
|
Home directory: ${homeDir()} (override with CLAUDERIPPLE_HOME)`);
|
|
469
472
|
}
|
|
@@ -540,6 +543,23 @@ try {
|
|
|
540
543
|
console.log(agentTitleHookEnabled() ? "on" : "off");
|
|
541
544
|
break;
|
|
542
545
|
}
|
|
546
|
+
case "mod": {
|
|
547
|
+
const sub = args[1];
|
|
548
|
+
const { setStatusMod, statusModEnabled } = await import("./settings.js");
|
|
549
|
+
if (sub === "on" || sub === "off") {
|
|
550
|
+
const r = setStatusMod(sub === "on", installedRuntime.modDir);
|
|
551
|
+
for (const n of r.notes)
|
|
552
|
+
console.log(`✓ ${n}`);
|
|
553
|
+
if (!r.changed)
|
|
554
|
+
console.log(`✓ already ${sub}`);
|
|
555
|
+
if (r.backup)
|
|
556
|
+
console.log(` backup: ${r.backup}`);
|
|
557
|
+
console.log("Applies to Claude Code sessions started from now on.");
|
|
558
|
+
}
|
|
559
|
+
else
|
|
560
|
+
console.log(statusModEnabled() ? "on" : "off");
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
543
563
|
case "login": {
|
|
544
564
|
const { login } = await import("../../router/src/providers/chatgpt/auth.js");
|
|
545
565
|
const { saveChatGptAccount, readChatGptAccounts, chatgptAccountsPath } = await import("../../router/src/providers/chatgpt/accounts.js");
|
|
@@ -592,6 +612,31 @@ try {
|
|
|
592
612
|
case "claude-logout":
|
|
593
613
|
console.log(claudeLogout(homeDir()) ? "✓ ClaudeRipple Claude accounts removed" : "no ClaudeRipple Claude accounts stored");
|
|
594
614
|
break;
|
|
615
|
+
case "google-login": {
|
|
616
|
+
const { GoogleOAuthSession } = await import("../../router/src/providers/google/login.js");
|
|
617
|
+
const { ANTIGRAVITY_WARNING } = await import("../../router/src/providers/google/antigravity.js");
|
|
618
|
+
const { readGoogleAccounts, googleAccountsPath } = await import("../../router/src/providers/google/accounts.js");
|
|
619
|
+
// The terms warning is printed once, before anything else, so a sign-in is never accidental.
|
|
620
|
+
console.log(`⚠ ${ANTIGRAVITY_WARNING}\n`);
|
|
621
|
+
const before = readGoogleAccounts(homeDir()).length;
|
|
622
|
+
const session = new GoogleOAuthSession({ home: homeDir() }, ANTIGRAVITY_WARNING);
|
|
623
|
+
const { url } = await session.start();
|
|
624
|
+
console.log(before > 0
|
|
625
|
+
? `Opening your browser to add a Google account (${before} signed in already). Sign in with the account to add; this window waits up to 5 minutes.`
|
|
626
|
+
: "Opening your browser to sign in with Google. Sign in there; this window waits up to 5 minutes.");
|
|
627
|
+
if (!openBrowser(url))
|
|
628
|
+
console.log(`Open this URL manually:\n${url}`);
|
|
629
|
+
await session.result;
|
|
630
|
+
const total = readGoogleAccounts(homeDir()).length;
|
|
631
|
+
console.log(`✓ Google account added. ${total} account${total === 1 ? "" : "s"} in ${googleAccountsPath(homeDir())}; refreshed automatically.`);
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
case "google-logout": {
|
|
635
|
+
const { removeAllGoogleAccounts } = await import("../../router/src/providers/google/accounts.js");
|
|
636
|
+
const removed = removeAllGoogleAccounts(homeDir());
|
|
637
|
+
console.log(removed > 0 ? `✓ removed ${removed} Google account${removed === 1 ? "" : "s"}` : "no Google account stored");
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
595
640
|
case "image":
|
|
596
641
|
await image();
|
|
597
642
|
break;
|
package/dist/cli/src/runtime.js
CHANGED
|
@@ -21,6 +21,7 @@ export function runtime() {
|
|
|
21
21
|
cli: path.join(resources, "packages", "cli", "src", "index.ts"),
|
|
22
22
|
router: path.join(resources, "packages", "router", "src", "index.ts"),
|
|
23
23
|
hookScript: path.join(resources, "packages", "cli", "src", "hooks", "agent-title.ts"),
|
|
24
|
+
modDir: path.join(resources, "packages", "mod"),
|
|
24
25
|
repo: resources,
|
|
25
26
|
trayMain: "",
|
|
26
27
|
packaged: true,
|
|
@@ -37,6 +38,7 @@ export function runtime() {
|
|
|
37
38
|
cli: path.join(resources, "packages", "cli", "src", "index.ts"),
|
|
38
39
|
router: path.join(resources, "packages", "router", "src", "index.ts"),
|
|
39
40
|
hookScript: path.join(resources, "packages", "cli", "src", "hooks", "agent-title.ts"),
|
|
41
|
+
modDir: path.join(resources, "packages", "mod"),
|
|
40
42
|
repo: resources,
|
|
41
43
|
trayMain: "",
|
|
42
44
|
packaged: true,
|
|
@@ -55,6 +57,7 @@ export function runtime() {
|
|
|
55
57
|
cli,
|
|
56
58
|
router: path.resolve(here, `../../router/src/index${ext}`),
|
|
57
59
|
hookScript: path.resolve(here, `hooks/agent-title${ext}`),
|
|
60
|
+
modDir: path.resolve(here, "../../..", ext === ".ts" ? "packages/mod" : "dist/mod"),
|
|
58
61
|
repo: path.resolve(here, "../../.."),
|
|
59
62
|
trayMain: path.resolve(here, "../../..", ext === ".ts" ? "packages/app/dist/main.js" : "dist/app/dist/main.js"),
|
|
60
63
|
packaged: false,
|
package/dist/cli/src/settings.js
CHANGED
|
@@ -214,3 +214,52 @@ export function agentTitleHookEnabled() {
|
|
|
214
214
|
return false;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
+
// ---- Status mod (packages/mod) ------------------------------------------------------------
|
|
218
|
+
/** The `name` in packages/mod/.claude-plugin/plugin.json: how our entry is told from anyone else's. */
|
|
219
|
+
export const STATUS_MOD_NAME = "clauderipple-status";
|
|
220
|
+
const PLUGIN_DIRS = "CLAUDE_CODE_PLUGIN_DIRS";
|
|
221
|
+
function isStatusMod(dir) {
|
|
222
|
+
try {
|
|
223
|
+
return JSON.parse(fs.readFileSync(path.join(dir, ".claude-plugin", "plugin.json"), "utf8")).name === STATUS_MOD_NAME;
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function pluginDirs(env) {
|
|
230
|
+
return (env[PLUGIN_DIRS] ?? "").split(path.delimiter).filter(Boolean);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Registers or removes the status mod in settings.json's `env.CLAUDE_CODE_PLUGIN_DIRS`, the one
|
|
234
|
+
* place a session the desktop app starts reads plugin folders from (Claude Code docs, plugin
|
|
235
|
+
* authoring reference, CLI 2.1.286). The variable is a path list other plugins may share: only
|
|
236
|
+
* entries that are this mod are touched — by its manifest's name, so an install that moved
|
|
237
|
+
* (a checkout, then the app) leaves no stale entry behind — and the variable goes only when we
|
|
238
|
+
* were its last entry.
|
|
239
|
+
*/
|
|
240
|
+
export function setStatusMod(enabled, dir) {
|
|
241
|
+
const file = settingsPath();
|
|
242
|
+
const s = readSettings(file);
|
|
243
|
+
const env = { ...(s.env ?? {}) };
|
|
244
|
+
const before = pluginDirs(env);
|
|
245
|
+
const kept = before.filter((entry) => path.resolve(entry) !== path.resolve(dir) && !isStatusMod(entry));
|
|
246
|
+
const after = enabled ? [...kept, dir] : kept;
|
|
247
|
+
if (after.join(path.delimiter) === before.join(path.delimiter))
|
|
248
|
+
return { changed: false, backup: null, notes: [], wroteSlots: [] };
|
|
249
|
+
if (after.length > 0)
|
|
250
|
+
env[PLUGIN_DIRS] = after.join(path.delimiter);
|
|
251
|
+
else
|
|
252
|
+
delete env[PLUGIN_DIRS];
|
|
253
|
+
const b = backup(file);
|
|
254
|
+
s.env = env;
|
|
255
|
+
write(file, s);
|
|
256
|
+
return { changed: true, backup: b, notes: [`env.${PLUGIN_DIRS}: ClaudeRipple status mod ${enabled ? "added" : "removed"}`], wroteSlots: [] };
|
|
257
|
+
}
|
|
258
|
+
export function statusModEnabled() {
|
|
259
|
+
try {
|
|
260
|
+
return pluginDirs(readSettings(settingsPath()).env ?? {}).some(isStatusMod);
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "name": "clauderipple-status", "version": "0.1.0", "description": "Shows where ClaudeRipple sent each request and its request log, and keeps ClaudeRipple workers on their own model and effort.", "types": "./types/index.d.ts" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "modules": ["./register.tsx"] }
|