diff --git a/docs/subsystems/claude-subscription-bridge.md b/docs/subsystems/claude-subscription-bridge.md index 2c7971560..58e234990 100644 --- a/docs/subsystems/claude-subscription-bridge.md +++ b/docs/subsystems/claude-subscription-bridge.md @@ -258,7 +258,7 @@ the setting (`claudeTUIErr`, `claudeNotTUIWhy`). That is when - it is Claude Code in WSL whose home the probe didn't find, or, in the distro user's own folder, one Windows can't read (`wslread`); -- the request has safeguards, client cache marks, a JSON schema, an image +- the request has a JSON schema, an image known only by its URL (`urlImages`: the helper pastes files, and has no bytes of it), or words over 400KB (`tuiPromptMost`, images not counted), which a paste can't carry; @@ -266,6 +266,18 @@ the setting (`claudeTUIErr`, `claudeNotTUIWhy`). That is when [Tool results another request answers first](#tool-results-another-request-answers-first)); a branch of an interactive run's session is interactive too. +Safeguards are taken: interactive Claude Code reads +`CLAUDE_CODE_EXTRA_BODY` only as it starts (2.1.316: a later +`apply_flag_settings` or a rewritten `--settings` file changes nothing it +sends), so `startRun` puts them in its environment, and a turn whose +safeguards changed starts a new run told the whole conversation +(`setSafeguards`). Client cache marks are taken too, but not kept: the +helper pastes the words without their marks, so the run keeps Claude +Code's own prompt caching (no `DISABLE_PROMPT_CACHING`, no client tail) +and the reply reports every client mark as dropped +(`clientCache.pasted`; see +[Client-placed cache marks](#client-placed-cache-marks-1717)). + The gateway's log says which (`claude: not the interactive mode: …`). A refused request never ran, so it isn't the editor's last request (`noteClaudeRun`). The model test's and warm-up's "hi" (`askClaude`) goes @@ -346,8 +358,11 @@ ignore the header. The mode is part of the run's identity, including rewritten conversations and tool-result handoffs: opted-in and ordinary requests never share a run. -An opted-in run sets `DISABLE_PROMPT_CACHING=1`. Its four cache slots belong -to the client. `claude_cache.go` validates the marks before run selection; +An opted-in `-p` run sets `DISABLE_PROMPT_CACHING=1`. Its four cache slots +belong to the client. An interactive run is pasted the words without their +marks, so it keeps Claude Code's own caching and reports the system, message +and tail marks dropped beside the tools' (`clientCache.pasted`); the table +below is the `-p` run's. `claude_cache.go` validates the marks before run selection; `renderClaudePrompt` places them in a new run's first user message. | Client mark | Bridge behavior | diff --git a/internal/gateway/claude_cache.go b/internal/gateway/claude_cache.go index 1452dc943..85fcfe378 100644 --- a/internal/gateway/claude_cache.go +++ b/internal/gateway/claude_cache.go @@ -23,8 +23,14 @@ type clientCache struct { messages int droppedSystem int droppedMessages int + systemMarks int // the system's marks, as the request has them fresh bool - report func() + // pasted: the run is Claude Code's interactive mode, which is pasted + // the words with none of their marks (claudetui's userPieces), and + // keeps its own prompt caching (startRun): every mark but the tools' + // is dropped + pasted bool + report func() } func wantsClientCache(r *http.Request, from provider.Protocol) bool { @@ -51,6 +57,7 @@ func (c *clientCache) selected(fresh bool) { return } c.fresh = fresh + c.pasted = claudeTUIOn() if c.report != nil { c.report() } @@ -175,6 +182,7 @@ func readClientCache(a aRequest) (*clientCache, error) { return nil, err } if ttl != "" { + c.systemMarks++ prefix, _ := json.Marshal(system[:i+1]) end := len(stringOrText(prefix)) if end <= lastEnd { @@ -247,13 +255,19 @@ func cacheDropped(w http.ResponseWriter, req *Request) { if c.tools > 0 { fields = append(fields, fmt.Sprintf("tools:%d", c.tools)) } - if c.droppedSystem > 0 { - fields = append(fields, fmt.Sprintf("system:%d", c.droppedSystem)) - } - messages := c.messages + system, messages := c.droppedSystem, c.messages if c.fresh { messages = c.droppedMessages } + if c.pasted { + system, messages = c.systemMarks, c.messages + if c.tail != "" { + messages++ + } + } + if system > 0 { + fields = append(fields, fmt.Sprintf("system:%d", system)) + } if messages > 0 { fields = append(fields, fmt.Sprintf("messages:%d", messages)) } diff --git a/internal/gateway/claude_mode_last_test.go b/internal/gateway/claude_mode_last_test.go index 5c41c3b51..fe7c2418c 100644 --- a/internal/gateway/claude_mode_last_test.go +++ b/internal/gateway/claude_mode_last_test.go @@ -36,9 +36,9 @@ func TestClaudeTUICodes(t *testing.T) { was := claudeTUIRuns claudeTUIRuns = true t.Cleanup(func() { claudeTUIRuns = was }) - req := &Request{Messages: []Message{{Role: "user", Parts: []Part{{Kind: Text, Text: "hi"}}}}, Safeguards: []byte(`{"a":1}`)} - if tui, code := claudeTUI(req, claudeCLI{path: "/usr/local/bin/claude"}, []map[string]any{{"type": "text", "text": "hi"}}); tui || code != "safeguards" { - t.Fatalf("with safeguards: %v %q", tui, code) + req := &Request{Messages: []Message{{Role: "user", Parts: []Part{{Kind: Text, Text: "hi"}}}}, Format: &Format{Type: "json_schema", Schema: []byte(`{"type":"object"}`)}} + if tui, code := claudeTUI(req, claudeCLI{path: "/usr/local/bin/claude"}, []map[string]any{{"type": "text", "text": "hi"}}); tui || code != "schema" { + t.Fatalf("with a schema: %v %q", tui, code) } if tui, code := claudeTUI(req, claudeCLI{}, nil); tui || code != "missing" { t.Fatalf("no Claude Code: %v %q", tui, code) diff --git a/internal/gateway/claude_subscription.go b/internal/gateway/claude_subscription.go index 63b7888e5..1750f432e 100644 --- a/internal/gateway/claude_subscription.go +++ b/internal/gateway/claude_subscription.go @@ -639,7 +639,8 @@ func (c claudeCLI) asRoot(env []string) []string { // claudeEnvVars are the variables magpie sets for a Claude Code run, which // one in WSL is handed (wslrun's Env). var claudeEnvVars = []string{"ENABLE_CLAUDEAI_MCP_SERVERS", "DISABLE_AUTO_COMPACT", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC", - "DISABLE_TELEMETRY", "DISABLE_ERROR_REPORTING", "DISABLE_AUTOUPDATER", "ANTHROPIC_BETAS"} + "DISABLE_TELEMETRY", "DISABLE_ERROR_REPORTING", "DISABLE_AUTOUPDATER", "ANTHROPIC_BETAS", + "CLAUDE_CODE_EXTRA_BODY", "DISABLE_PROMPT_CACHING"} // env is env for a run in config directory configDir ("" for the account // Claude Code is signed in to): for one in WSL, what of it goes in. @@ -952,12 +953,26 @@ func (b *subscriptionBridge) startRun(ctx context.Context, req *Request, model, cleanup() return nil, nil, err } - if req.clientCache != nil { + if req.clientCache != nil && !tui { + // the client's marks take the place of Claude Code's own; the + // interactive mode is pasted the words without them, and keeps + // its own (clientCache.pasted) env = append(env, "DISABLE_PROMPT_CACHING=1") } if len(req.Safeguards) > 0 { env = append(env, "ANTHROPIC_BETAS="+req.SafeguardBeta) } + // The interactive mode's Claude Code reads CLAUDE_CODE_EXTRA_BODY once, + // as it starts: one handed over later (apply_flag_settings, or a + // --settings file rewritten) changes nothing it sends, so the run is + // given the safeguards here, and one whose turn changes them is + // started again (setSafeguards). A client's cache tail isn't added to + // Claude Code's own marks, which it keeps (clientCache.pasted). + tuiBody := "" + if tui && len(req.Safeguards) > 0 { + tuiBody = claudeExtraBody(req.Safeguards, "") + env = append(env, "CLAUDE_CODE_EXTRA_BODY="+tuiBody) + } if tui && (!client || configDir != "") { // a folder of magpie's, or an account folder of magpie's whose // Claude Code no one else runs: asked whether to trust it, the @@ -999,6 +1014,9 @@ func (b *subscriptionBridge) startRun(ctx context.Context, req *Request, model, run.lean = req.leanPrompt run.tui = tui run.cachePrefix = prefix + if tuiBody != "" { + run.safeguards = bytes.Clone(req.Safeguards) + } run.allowed = allowedTools(req) if user, _ := ownerAccount(owner); user != "" { run.loginVersion = provider.ClaudeLoginVersion(user) @@ -1160,8 +1178,6 @@ func claudePrint(req *Request, binary claudeCLI, prompt []map[string]any) (code, is bool code, why string }{ - {len(req.Safeguards) > 0, "safeguards", "safeguards"}, - {req.clientCache != nil, "cache", "the client's cache marks"}, {len(req.Format.schema()) > 0, "schema", "a JSON schema"}, {urlImages(req.Messages) > 0, "image", "an image known by its URL"}, {len(b) > tuiPromptMost, "big", "a first message over 400KB"}, @@ -1201,8 +1217,7 @@ func claudeMachineWhy(binary claudeCLI) (code, why string) { // machine, for the Claude Code provider page: TUI when Claude Code's // interactive mode, else -p (turned off) or none (it can't run here), Why // the code of claudeMachineWhy. With it on, a request only -p takes -// (safeguards, a client's cache marks, a JSON schema, an image known by -// its URL, a first message over 400KB) is refused. +// (claudePrint) is refused. type ClaudeMode struct { TUI bool `json:"tui"` Why string `json:"why,omitempty"` @@ -1277,6 +1292,9 @@ func (r *subscriptionRun) setSafeguards(req *Request) error { r.settingsMu.Lock() defer r.settingsMu.Unlock() tail := req.cacheTail() + if r.tui { + tail = "" // its own marks, not the client's (startRun) + } if r.clientMarks != (req.clientCache != nil) || !r.cachePrefix.accepts(tail) { return errors.New("client cache marks changed; restart Claude Code") } @@ -1286,6 +1304,10 @@ func (r *subscriptionRun) setSafeguards(req *Request) error { if len(req.Safeguards) > 0 && r.safeguardBeta != req.SafeguardBeta { return errors.New("safety beta changed; restart Claude Code") } + if r.tui { + // it read them as it started (startRun), and reads them no more + return errors.New("safeguards changed; restart Claude Code's interactive mode") + } err := r.cliControl(map[string]any{"subtype": "apply_flag_settings", "settings": map[string]any{ "env": map[string]string{"CLAUDE_CODE_EXTRA_BODY": claudeExtraBody(req.Safeguards, tail)}}}) if err == nil { diff --git a/internal/gateway/claude_tui_extra_body_test.go b/internal/gateway/claude_tui_extra_body_test.go new file mode 100644 index 000000000..668554043 --- /dev/null +++ b/internal/gateway/claude_tui_extra_body_test.go @@ -0,0 +1,104 @@ +package gateway + +import ( + "path/filepath" + "strings" + "testing" + + "github.com/yetone/magpie/internal/claudetui" + "github.com/yetone/magpie/internal/testenv" +) + +// tuiScriptHarness is a script harness whose runs are the interactive +// mode's, through a stand-in helper that runs the Claude Code it is handed. +func tuiScriptHarness(t *testing.T, script string) *resumeHarness { + t.Helper() + h := newScriptHarness(t, "ok", script) + claudeTUIRuns = true + t.Cleanup(func() { claudeTUIRuns = false }) + helper := filepath.Join(t.TempDir(), "magpie") + testenv.Program(t, helper, `#!/bin/sh +[ "$1" = "`+claudetui.Command+`" ] || exit 9 +shift; claude=$1; shift +exec "$claude" "$@" +`) + claudeTUIHelper = helper + t.Cleanup(func() { claudeTUIHelper = "" }) + return h +} + +// The interactive mode's Claude Code reads CLAUDE_CODE_EXTRA_BODY only as +// it starts (a real 2.1.316: an apply_flag_settings or a --settings file +// rewritten later changed nothing it sent), so a run whose turn carries +// safeguards is given them in its environment, and a turn whose +// safeguards differ starts a new run told the whole conversation; one +// with the same goes on in the run. They were refused with the +// interactive mode on (e5f66f8a6). +func TestClaudeTUISafeguardsInEnv(t *testing.T) { + h := tuiScriptHarness(t, `echo "extra ${CLAUDE_CODE_EXTRA_BODY-unset} betas ${ANTHROPIC_BETAS-unset}" >> $log`) + + h.extra = safeguards + h.ask("rules", "a1") + h.ask("rules", "a1", "a2") + runs := h.runs() + if len(runs) != 1 { + t.Fatalf("the same safeguards started %d runs, want 1", len(runs)) + } + for _, log := range runs { + if !strings.Contains(log, `extra {"safeguards":[{"type":"dangerous_tool_use","classifier_context":"The user allows file edits in the project."}]} betas dangerous-tool-use-`) { + t.Fatalf("the run's environment: %s", log) + } + if strings.Contains(log, "apply_flag_settings") { + t.Fatalf("an interactive run was told settings it doesn't read: %s", log) + } + } + h.extra = strings.Replace(safeguards, "file edits", "nothing", 1) + h.ask("rules", "a1", "a2", "a3") + runs = h.runs() + if len(runs) != 2 { + t.Fatalf("changed safeguards went on in %d runs, want a second", len(runs)) + } + seen := false + for _, log := range runs { + if strings.Contains(log, `"classifier_context":"The user allows nothing in the project."`) { + seen = true + if !strings.Contains(log, "a1") || !strings.Contains(log, "a3") { + t.Fatalf("the new run wasn't told the whole conversation: %s", log) + } + } + } + if !seen { + t.Fatalf("no run has the changed safeguards: %v", runs) + } +} + +// A client's own cache marks are taken with the interactive mode on: its +// words are pasted without them (claudetui's userPieces), so Claude Code +// keeps its own prompt caching, not turned off for marks it never sends, +// and the reply says the client's marks were dropped. With caching off and +// the marks lost, every turn was written to the cache again at full price. +func TestClaudeTUIClientCacheKeepsItsOwn(t *testing.T) { + h := tuiScriptHarness(t, `echo "cache-disabled ${DISABLE_PROMPT_CACHING-unset} extra ${CLAUDE_CODE_EXTRA_BODY-unset}" >> $log`) + h.from = "127.0.0.1:51000" + system := `"system":[{"type":"text","text":"shared","cache_control":{"type":"ephemeral","ttl":"1h"}},{"type":"text","text":"more"}],` + tool := `"tools":[{"name":"read","input_schema":{"type":"object"},"cache_control":{"type":"ephemeral","ttl":"1h"}}],` + tail := `"cache_control":{"type":"ephemeral","ttl":"1h"},` + first := `{"role":"user","content":[{"type":"text","text":"hello","cache_control":{"type":"ephemeral","ttl":"1h"}},{"type":"text","text":"there"}]}` + w := cacheAsk(t, h, system+tool+tail, `[`+first+`]`, "client") + if got := w.Header().Get("X-Magpie-Cache-Marks-Dropped"); got != "tools:1,system:1,messages:2" { + t.Fatalf("dropped %q", got) + } + for _, log := range h.runs() { + if !strings.Contains(log, "cache-disabled unset extra unset") { + t.Fatalf("an interactive run's caching: %s", log) + } + } + // the next turn goes on in the run + w = cacheAsk(t, h, system+tool+tail, `[`+first+`,{"role":"assistant","content":"ok"},{"role":"user","content":"again"}]`, "client") + if got := w.Header().Get("X-Magpie-Cache-Marks-Dropped"); got != "tools:1,system:1,messages:2" { + t.Fatalf("next turn dropped %q", got) + } + if n := len(h.runs()); n != 1 { + t.Fatalf("the next turn started %d runs", n) + } +} diff --git a/internal/gateway/claude_tui_test.go b/internal/gateway/claude_tui_test.go index 2f61f89a9..4d13d1935 100644 --- a/internal/gateway/claude_tui_test.go +++ b/internal/gateway/claude_tui_test.go @@ -42,8 +42,8 @@ func TestClaudeTUIChosen(t *testing.T) { {"turned off", &Request{Messages: text("hi")}, here, prompt, true, false, "the interactive mode is turned off"}, {"in WSL", &Request{Messages: text("hi")}, claudeCLI{path: "claude", wsl: &wslrun.Tool{Distro: "Ubuntu", Home: "/home/me"}}, prompt, false, on, ""}, {"in WSL, its home unknown", &Request{Messages: text("hi")}, claudeCLI{path: "claude", wsl: &wslrun.Tool{Distro: "Ubuntu"}}, prompt, false, false, "Claude Code in WSL, its home unknown"}, - {"safeguards", &Request{Messages: text("hi"), Safeguards: json.RawMessage(`{"a":1}`)}, here, prompt, false, false, "safeguards"}, - {"client cache marks", &Request{Messages: text("hi"), clientCache: &clientCache{}}, here, prompt, false, false, "the client's cache marks"}, + {"safeguards", &Request{Messages: text("hi"), Safeguards: json.RawMessage(`{"a":1}`)}, here, prompt, false, on, ""}, + {"client cache marks", &Request{Messages: text("hi"), clientCache: &clientCache{}}, here, prompt, false, on, ""}, {"a schema", &Request{Messages: text("hi"), Format: &Format{Type: "json_schema", Schema: json.RawMessage(`{"type":"object"}`)}}, here, prompt, false, false, "a JSON schema"}, {"an image", &Request{Messages: []Message{{Role: "user", Parts: []Part{{Kind: Image, MediaType: "image/png", Data: "AA=="}}}}}, here, prompt, false, on, ""}, {"an image by its URL", &Request{Messages: []Message{{Role: "user", Parts: []Part{{Kind: Image, URL: "https://example.com/a.png"}}}}}, here, prompt, false, false, "an image known by its URL"}, diff --git a/internal/gui/assets/claudemode.js b/internal/gui/assets/claudemode.js index 952348f95..1fb367c28 100644 --- a/internal/gui/assets/claudemode.js +++ b/internal/gui/assets/claudemode.js @@ -38,7 +38,7 @@ function ccTip(anchor, tui) { t("Your plan counts these requests as Claude Code's own use, at about half of the 5-hour allowance that -p uses for the same work.")), mode(!tui, "claude -p", t("Claude Code's print mode, the one scripts and the Agent SDK use: a request in, its reply out."), - t("It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, safeguards, a client's own cache points, a first message over 400KB."), + t("It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, a first message over 400KB."), t("The plan counts a -p request at about twice the interactive mode's.")), el("div", "foot", t("Switched here or in Settings › Models › Replies. With the interactive mode on, nothing ever runs as -p: a request it can't take, or one it fails to start for, fails saying why."))); document.body.append(tip); diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index f894e7500..fe0c3c132 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -12,7 +12,7 @@ const I18N = { "magpie opens Claude Code as a person does, in a terminal of its own that you don't see, types each request in and reads the reply from its transcript.": "magpie 像人一样打开 Claude Code:在一个你看不到的终端里输入每个请求,再从它的会话记录里读出回复。", "Your plan counts these requests as Claude Code's own use, at about half of the 5-hour allowance that -p uses for the same work.": "套餐把这些请求算作 Claude Code 自身的使用,同样的工作只消耗 -p 约一半的 5 小时额度。", "Claude Code's print mode, the one scripts and the Agent SDK use: a request in, its reply out.": "Claude Code 的打印模式,脚本和 Agent SDK 用的就是它:一个请求进去,一个回复出来。", - "It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, safeguards, a client's own cache points, a first message over 400KB.": "启动即用,并且支持交互模式做不到的:JSON schema、按 URL 给的图片、安全护栏、客户端自己的缓存点、超过 400KB 的第一条消息。", + "It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, a first message over 400KB.": "启动即用,并且支持交互模式做不到的:JSON schema、按 URL 给的图片、超过 400KB 的第一条消息。", "The plan counts a -p request at about twice the interactive mode's.": "套餐对 -p 请求的计量约为交互模式的两倍。", "Switched here or in Settings › Models › Replies. With the interactive mode on, nothing ever runs as -p: a request it can't take, or one it fails to start for, fails saying why.": "可在这里或 设置 › 模型 › 回复 里切换。开着交互模式时,任何请求都不会走 -p:交互模式接不了或启动失败的请求会报错并说明原因。", "Every request runs as claude -p": "每个请求都以 claude -p 运行", @@ -4365,7 +4365,7 @@ const I18N = { "magpie opens Claude Code as a person does, in a terminal of its own that you don't see, types each request in and reads the reply from its transcript.": "magpie 像人一樣開啟 Claude Code:在一個你看不到的終端機裡輸入每個請求,再從它的對話記錄讀出回覆。", "Your plan counts these requests as Claude Code's own use, at about half of the 5-hour allowance that -p uses for the same work.": "方案把這些請求算作 Claude Code 本身的使用,同樣的工作只消耗 -p 約一半的 5 小時額度。", "Claude Code's print mode, the one scripts and the Agent SDK use: a request in, its reply out.": "Claude Code 的列印模式,腳本和 Agent SDK 用的就是它:一個請求進去,一個回覆出來。", - "It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, safeguards, a client's own cache points, a first message over 400KB.": "啟動即用,並且支援互動模式做不到的:JSON schema、以 URL 提供的圖片、安全護欄、用戶端自己的快取點、超過 400KB 的第一則訊息。", + "It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, a first message over 400KB.": "啟動即用,並且支援互動模式做不到的:JSON schema、以 URL 提供的圖片、超過 400KB 的第一則訊息。", "The plan counts a -p request at about twice the interactive mode's.": "方案對 -p 請求的計量約為互動模式的兩倍。", "Switched here or in Settings › Models › Replies. With the interactive mode on, nothing ever runs as -p: a request it can't take, or one it fails to start for, fails saying why.": "可在這裡或 設定 › 模型 › 回覆 裡切換。開著互動模式時,任何請求都不會走 -p:互動模式接不了或啟動失敗的請求會報錯並說明原因。", "Every request runs as claude -p": "每個請求都以 claude -p 執行", @@ -8703,7 +8703,7 @@ const I18N = { "magpie opens Claude Code as a person does, in a terminal of its own that you don't see, types each request in and reads the reply from its transcript.": "magpie は人と同じように Claude Code を開きます。見えない専用のターミナルで各リクエストを入力し、トランスクリプトから応答を読み取ります。", "Your plan counts these requests as Claude Code's own use, at about half of the 5-hour allowance that -p uses for the same work.": "プランはこれらのリクエストを Claude Code 自身の利用として数え、同じ作業で -p の約半分の 5 時間枠しか使いません。", "Claude Code's print mode, the one scripts and the Agent SDK use: a request in, its reply out.": "Claude Code の print モードで、スクリプトや Agent SDK が使うものです。リクエストを渡し、応答を受け取ります。", - "It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, safeguards, a client's own cache points, a first message over 400KB.": "すぐに起動し、対話モードにできないものも扱えます:JSON schema、URL で指定された画像、セーフガード、クライアント独自のキャッシュ位置、400KB を超える最初のメッセージ。", + "It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, a first message over 400KB.": "すぐに起動し、対話モードにできないものも扱えます:JSON schema、URL で指定された画像、400KB を超える最初のメッセージ。", "The plan counts a -p request at about twice the interactive mode's.": "プランは -p のリクエストを対話モードの約 2 倍として数えます。", "Switched here or in Settings › Models › Replies. With the interactive mode on, nothing ever runs as -p: a request it can't take, or one it fails to start for, fails saying why.": "ここか 設定 › モデル › 応答 で切り替えられます。対話モードがオンのときは、何も -p では実行しません。対話モードで扱えないリクエストや起動に失敗したリクエストは理由を添えてエラーになります。", "Every request runs as claude -p": "すべてのリクエストを claude -p で実行します", @@ -13043,7 +13043,7 @@ const I18N = { "magpie opens Claude Code as a person does, in a terminal of its own that you don't see, types each request in and reads the reply from its transcript.": "magpie öffnet Claude Code wie ein Mensch, in einem eigenen Terminal, das du nicht siehst, tippt jede Anfrage ein und liest die Antwort aus dem Transkript.", "Your plan counts these requests as Claude Code's own use, at about half of the 5-hour allowance that -p uses for the same work.": "Dein Plan zählt diese Anfragen als Claude Codes eigene Nutzung, mit etwa der Hälfte des 5-Stunden-Kontingents, das -p für dieselbe Arbeit braucht.", "Claude Code's print mode, the one scripts and the Agent SDK use: a request in, its reply out.": "Der Print-Modus von Claude Code, den Skripte und das Agent SDK nutzen: eine Anfrage hinein, ihre Antwort heraus.", - "It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, safeguards, a client's own cache points, a first message over 400KB.": "Er startet sofort und kann, was der interaktive Modus nicht kann: ein JSON-Schema, ein Bild per URL, Safeguards, eigene Cache-Punkte des Clients, eine erste Nachricht über 400 KB.", + "It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, a first message over 400KB.": "Er startet sofort und kann, was der interaktive Modus nicht kann: ein JSON-Schema, ein Bild per URL, eine erste Nachricht über 400 KB.", "The plan counts a -p request at about twice the interactive mode's.": "Der Plan zählt eine -p-Anfrage etwa doppelt so hoch wie eine im interaktiven Modus.", "Switched here or in Settings › Models › Replies. With the interactive mode on, nothing ever runs as -p: a request it can't take, or one it fails to start for, fails saying why.": "Hier oder unter Einstellungen › Modelle › Antworten umschaltbar. Mit eingeschaltetem interaktivem Modus läuft nie etwas als -p: Eine Anfrage, die er nicht annehmen kann oder für die er nicht startet, schlägt mit dem Grund fehl.", "Every request runs as claude -p": "Jede Anfrage läuft als claude -p", diff --git a/internal/gui/tests/claude-mode.test.cjs b/internal/gui/tests/claude-mode.test.cjs index 093edcc07..048d97120 100644 --- a/internal/gui/tests/claude-mode.test.cjs +++ b/internal/gui/tests/claude-mode.test.cjs @@ -124,7 +124,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", ]); // nothing in the card says a request falls back to -p (the owner, 11-01) assert.equal((await tip.locator(".foot").textContent()).trim(), await tr("Switched here or in Settings › Models › Replies. With the interactive mode on, nothing ever runs as -p: a request it can't take, or one it fails to start for, fails saying why.")); - assert.equal((await tip.locator(".cc-m").nth(1).locator("p.good").textContent()).trim(), await tr("It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, safeguards, a client's own cache points, a first message over 400KB.")); + assert.equal((await tip.locator(".cc-m").nth(1).locator("p.good").textContent()).trim(), await tr("It starts at once, and takes what the interactive mode can't: a JSON schema, an image by its URL, a first message over 400KB.")); const box = await tip.boundingBox(); assert(box.x >= 0 && box.y >= 0 && box.x + box.width <= width && box.y + box.height <= 760, `the card is inside the window: ${JSON.stringify(box)}`); if (lang !== "en") {