claude: a turn Anthropic refuses in the interactive mode as a third-party app's is asked again as claude -p, and the agent's prompt is remembered

Raven (Discord #general): Cindy with Pi as its engine, routed through
group/auto to a Claude subscription, failed every turn with "Anthropic
refused an interactive-mode turn on claude-opus-5-5 as a third-party
app's", and the message told them to turn the interactive mode off in
Settings, which makes every request of every agent run as -p (about twice
the plan count).

Now, with the interactive mode on:
- a refusal carrying "Third-party apps now draw from your extra usage",
  met before a byte of the reply reached the client (stream head, or a
  whole reply with no parts), is asked again once as claude -p
  (redoAsPrint); the client sees only the -p answer;
- the agent's system prompt (sha256 of its first 2KB, billing header
  dropped, so Pi's trailing <cwd> doesn't change it) is remembered for
  12h, and its next turns go straight to -p (wantTUI, req.tuiRefused,
  clientCache.print) while every other agent stays interactive;
- a refusal after the reply had begun (keepalive sent, or text said) is
  not redone, so nothing is spent twice; the prompt is still remembered
  and the message now says magpie runs its next turns as -p: ask again;
- a -p run that is refused too fails as before ("run as claude -p"),
  once, no loop;
- the setting is untouched; with it off (claudePrintMode) everything is
  -p as before. The run is the real claude binary, nothing else changed
  in what is sent.

This reverses the #4503 call (fbbdf6e05, v0.1.2754: no automatic -p redo)
and the 10-31/11-01 "nothing ever runs as -p with the interactive mode
on", for this refusal only. The switch's foot, the Settings text (en, zh,
zh-TW, ja, de) and docs/subsystems/claude-subscription-bridge.md say so.

Run (mote, at this head rebased on 1100ed649):
- go test -run 'ThirdParty|TUIRefusal|ClaudeTUI|ClaudeSubscription|ClaudePrint'
  ./internal/gateway/ ok; Budget/i18n tests in ./internal/gui ok
- gofmt -l clean; go vet ./internal/gateway (darwin, GOOS=linux,
  GOOS=windows) ok; GOOS=windows go vet ./internal/gui ok. GOOS=linux go
  vet ./internal/gui fails in wails' cgo-only linux files on mote, the same
  on main, untouched here.
- GUI, chromium and webkit: claude-mode, claude-tui-setting,
  claude-quota-onboarding, mobile-web, i18n-keys, gui-zh-tw, gui-ja,
  gui-de: 57 pass, 6 fail in each engine; the fails are i18n-keys "a
  plugin's words are its own" (#5327, #5332) and mobile-web (#3952,
  #5013), the same 6 at origin/main 1100ed649 alone.
- Red on the old code: the new tests run against 1d704f819 all fail (400,
  the old "turn the interactive mode off" message).

Broken by hand: dropping len(col.res.Parts)==0 from the whole-reply redo
turns TestClaudeTUIThirdPartyRefusalAfterWordsNotRedone/whole red;
dropping the refusedTUI call turns ...PromptRemembered, ...AfterStart and
...AfterWords/stream red.

Tests use the real Pi 1.1.0 system prompt (testdata/workdir/pi-1.1.0.json)
with its cwd changed per conversation.

Not tried: a real Claude account (no refused turn reproduced against
Anthropic; the refusal text is the one the reporter's log and #4503
carry). A -p run continuing with tool results under a remembered prompt
(the wantTUI resume path) has no test of its own.
This commit is contained in:
yetone
2026-11-06 01:20:14 +08:00
parent 1100ed6494
commit 498b6419ff
9 changed files with 400 additions and 72 deletions
@@ -303,6 +303,25 @@ path or isn't macOS, Linux or Windows. Nothing a request asks is refused
any more (`claudePrint` keeps an image known by its URL, which
`serveClaudeSubscription` has downloaded before any run, below).
The one exception to "nothing runs as `-p`" with it On is a turn Anthropic
refuses in the interactive mode as a third-party app's: a 400 "Third-party
apps now draw from your extra usage" (#4503). Anthropic judges the agent's
own system prompt, as a whole, there and serves the same prompt to `-p`
(isjiajia01's controlled tests; Raven on Discord: Pi in Cindy through
`group/auto`, every turn refused). When the refusal comes with nothing of
the reply said or sent (`relay` hands it back as `redoAsPrint`,
`redoable`), the turn is asked again once as `-p` (`serveSubscriptionAs`,
`Request.tuiRefused`, `claudePrint` code `third-party`). Anthropic answered
the refused turn nothing, so the `-p` run is its only answer; a turn that
would draw from extra usage would have been served, not refused. The
prompt's fingerprint (`thirdPartyKey`: its first 2KB, the agent's own part
before Pi's working directory) is kept on the bridge for 12 hours
(`thirdPartyFor`), and its next turns start as `-p`, their runs going on
with tool results as a `-p` run does (`wantTUI`). A `-p` run's refusal, a
turn whose reply had begun, and Off are never asked again
(`thirdPartyRefused` says why). Settings' own value is not changed.
`claude_tui_refusal_test.go` holds each case.
A JSON schema is answered through an answer tool of magpie's
(`claude_tui_schema.go`): interactive Claude Code takes `--json-schema`
and does nothing with it (2.1.316, a real run: its result's
+4 -1
View File
@@ -30,6 +30,9 @@ type clientCache struct {
// keeps its own prompt caching (startRun): every mark but the tools'
// is dropped
pasted bool
// print: the run is claude -p though the interactive mode is on
// (Request.tuiRefused)
print bool
report func()
}
@@ -57,7 +60,7 @@ func (c *clientCache) selected(fresh bool) {
return
}
c.fresh = fresh
c.pasted = claudeTUIOn()
c.pasted = claudeTUIOn() && !c.print
if c.report != nil {
c.report()
}
+151 -20
View File
@@ -91,6 +91,10 @@ type subscriptionBridge struct {
// run for one goes in magpie's own folder until untrustedFor has
// passed (start)
untrusted sync.Map
// thirdParty are agents' system prompts (thirdPartyKey) Anthropic
// refused in the interactive mode as a third-party app's, and when:
// their turns run as claude -p until thirdPartyFor has passed (#4503)
thirdParty sync.Map
}
// untrustedFor is how long a caller's folder Claude Code asked to trust
@@ -1043,7 +1047,7 @@ func (b *subscriptionBridge) startRun(ctx context.Context, req *Request, model,
from = nil
}
}
if from != nil && from == req.branch && !from.tui && claudeTUIOn() {
if from != nil && from == req.branch && !from.tui && wantTUI(req) {
// a branch of a -p run's session, made before the interactive
// mode was turned on: -p's prompt isn't the interactive mode's,
// so the cache has nothing of it; a new interactive Claude Code
@@ -1134,7 +1138,7 @@ func (b *subscriptionBridge) startRun(ctx context.Context, req *Request, model,
// runs them interactively. A run it can't take is refused, never made
// -p: a refused request never ran, and isn't the last run
tui, code := claudeTUI(req, binary)
if !tui && code != "off" && code != "no-shim" {
if !tui && code != "off" && code != "no-shim" && code != thirdPartyCode {
cleanup()
return nil, nil, &tuiRefusal{claudeTUIErr(claudeNotTUIWhy(req, binary))}
}
@@ -1387,6 +1391,7 @@ func claudePrint(req *Request, binary claudeCLI) (code, why string) {
code, why string
}{
{urlImages(req.Messages) > 0, "image", "an image known by its URL"},
{req.tuiRefused, thirdPartyCode, "Anthropic refused this agent's system prompt in the interactive mode as a third-party app's"},
} {
if c.is {
return c.code, c.why
@@ -1665,6 +1670,14 @@ func claudeTUIOn() bool {
return claudeTUIRuns && !settings.Load().ClaudePrintMode
}
// wantTUI is whether req's run is to be the interactive mode: it is on,
// and Anthropic hasn't refused req's agent's prompt there (tuiRefused).
// A -p run made for such a prompt goes on with its turns, as a -p run
// from before the interactive mode was turned on doesn't.
func wantTUI(req *Request) bool {
return claudeTUIOn() && !req.tuiRefused
}
// claudeNotTUIWhy is why a run isn't the interactive mode.
func claudeNotTUIWhy(req *Request, binary claudeCLI) string {
if why := claudePrintWhy(req, binary); why != "" {
@@ -1806,7 +1819,7 @@ func (b *subscriptionBridge) resume(req *Request, owner string) (*subscriptionRu
if run == nil {
return nil, nil
}
if !run.tui && claudeTUIOn() {
if !run.tui && wantTUI(req) {
// a -p run from before the interactive mode was turned on goes
// on with no turn more
run.abortFor("Claude Code's interactive mode is on, and this run is -p")
@@ -2585,7 +2598,7 @@ func (b *subscriptionBridge) branch(req *Request, owner string) *savedSession {
}
}
sid, sessions := run.sessionID, slices.Clone(run.sessions)
usable := !run.closed && !run.rewound && run.lean == req.leanPrompt && !run.clientMarks && (run.tui || !claudeTUIOn())
usable := !run.closed && !run.rewound && run.lean == req.leanPrompt && !run.clientMarks && (run.tui || !wantTUI(req))
run.mu.Unlock()
if at == "" {
continue
@@ -6158,6 +6171,14 @@ var ratelimitWindows = map[string]string{
// on them.
func (s *Server) serveSubscription(w http.ResponseWriter, r *http.Request, from provider.Protocol, name, model, owner string, body []byte, usage *Usage,
start func(ctx context.Context, req *Request) (*subscriptionRun, <-chan Event, error)) (int, string) {
return s.serveSubscriptionAs(w, r, from, name, model, owner, body, usage, start, false)
}
// serveSubscriptionAs is serveSubscription, asPrint for the turn asked
// again as claude -p after the interactive mode's run was refused as a
// third-party app's with nothing of the reply said (redoAsPrint).
func (s *Server) serveSubscriptionAs(w http.ResponseWriter, r *http.Request, from provider.Protocol, name, model, owner string, body []byte, usage *Usage,
start func(ctx context.Context, req *Request) (*subscriptionRun, <-chan Event, error), asPrint bool) (int, string) {
var req *Request
var err error
if name == "Claude Code" && wantsClientCache(r, from) {
@@ -6212,7 +6233,17 @@ func (s *Server) serveSubscription(w http.ResponseWriter, r *http.Request, from
}
}
}
if name == "Claude Code" && claudeTUIOn() && urlImages(req.Messages) > 0 {
// a turn whose agent's system prompt Anthropic refused in the
// interactive mode as a third-party app's runs as claude -p, which is
// served it: asked again after the refusal, or of a prompt refused
// within thirdPartyFor (#4503)
if name == "Claude Code" && claudeTUIOn() && (asPrint || s.subscription.tuiRefused(req)) {
req.tuiRefused = true
if req.clientCache != nil {
req.clientCache.print = true
}
}
if name == "Claude Code" && wantTUI(req) && urlImages(req.Messages) > 0 {
// the interactive mode is pasted files: an image known by its URL
// is downloaded first, as -p's Claude Code had Anthropic fetch it
if err := fetchURLImages(r.Context(), req.Messages); err != nil {
@@ -6222,7 +6253,7 @@ func (s *Server) serveSubscription(w http.ResponseWriter, r *http.Request, from
// the interactive mode answers a schema through magpie's answer tool
var answer Tool
var answerSchema *jsonschema.Schema
if name == "Claude Code" && claudeTUIOn() && len(req.Format.schema()) > 0 {
if name == "Claude Code" && wantTUI(req) && len(req.Format.schema()) > 0 {
if answerSchema, err = compileAnswerSchema(cliSchema(req.Format.schema())); err != nil {
return writeError(w, from, 400, "Claude Code: "+err.Error()), err.Error()
}
@@ -6413,12 +6444,21 @@ func (s *Server) serveSubscription(w http.ResponseWriter, r *http.Request, from
defer close(quit)
events = keepBridgeHeard(events, quit)
}
return relay(w, r, from, name, req, events, usage, abort, begin, func(said, stop string, ok bool) {
code, msg := relay(w, r, from, name, req, events, usage, abort, begin, func(said, stop string, ok bool) {
if !gone() {
return // the client went first: letGo has the run
}
run.ended(req, said, stop, ok)
})
if req.interactive && strings.Contains(msg, thirdPartyWords) {
s.subscription.refusedTUI(req)
}
if code == redoAsPrint {
gone()
log.Printf("claude: Anthropic refused an interactive-mode turn on %s as a third-party app's, with nothing of the reply said: asked again as claude -p (#4503)", req.Model)
return s.serveSubscriptionAs(w, r, from, name, model, owner, body, usage, start, true)
}
return code, msg
}
// bridgeFailed is the status and words a client is answered with when an
@@ -6461,15 +6501,16 @@ const thirdPartyWords = "Third-party apps now draw from your extra usage"
// answered with, with what happened and what to do said after it when
// Anthropic refused the turn as a third-party app's (#4503). The bare
// 400 said "keep going" and nothing of why a client's turn was refused
// while plain ones were served. magpie never asks again on its own, as
// claude -p or otherwise: a second try may draw from the account's extra
// usage, which is the user's to spend (the owner's call on #4503). The
// refusal is about the request, the same on every account, so it stays a
// 400 that no account rests for and the next isn't asked
// while plain ones were served. An interactive-mode turn refused with
// nothing of its reply said is asked again as claude -p before it gets
// here (redoAsPrint); one that gets here had begun its reply, and the
// next turns of its agent's prompt run as -p (tuiRefused). The refusal
// is about the request, the same on every account, so it stays a 400
// that no account rests for and the next isn't asked
// (TestClaudeTUIRefusalIsNoAccountsFault). The words avoid quotaWords',
// which would read it as an account out of quota.
func thirdPartyRefused(name string, req *Request, code int, msg string) string {
if name != "Claude Code" || code != http.StatusBadRequest || !strings.Contains(msg, thirdPartyWords) {
if !thirdPartySaid(name, code, msg) {
return msg
}
if !req.interactive {
@@ -6477,12 +6518,95 @@ func thirdPartyRefused(name string, req *Request, code int, msg string) string {
return msg + " (magpie: Anthropic counted this turn, run as claude -p, as a third-party app's and answered nothing. " +
"Asking again may draw from the Claude account's extra usage, so magpie doesn't ask again on its own.)"
}
log.Printf("claude: Anthropic refused an interactive-mode turn on %s as a third-party app's (#4503)", req.Model)
return msg + " (magpie: Anthropic counted this turn as a third-party app's and answered nothing. " +
log.Printf("claude: Anthropic refused an interactive-mode turn on %s as a third-party app's, its reply begun (#4503)", req.Model)
return msg + " (magpie: Anthropic counted this turn as a third-party app's once its reply had begun. " +
"It ran in Claude Code's interactive mode with your agent's own system prompt, which Anthropic can refuse there. " +
"Asking again the same way may draw from the Claude account's extra usage, so magpie doesn't ask again on its own. " +
"Claude Code as claude -p is served such prompts: turn off Claude Code's interactive mode in Settings › Models › Replies " +
"or in this provider's editor; the plan counts a -p request at about twice the interactive mode's.)"
"magpie runs this agent's next turns as claude -p, which is served such prompts: ask again.)"
}
// thirdPartySaid is whether a Claude Code run's failure is Anthropic's
// refusal of its turn as a third-party app's.
func thirdPartySaid(name string, code int, msg string) bool {
return name == "Claude Code" && code == http.StatusBadRequest && strings.Contains(msg, thirdPartyWords)
}
// thirdPartyCode is claudePrint's code for a run that is claude -p
// because Anthropic refused its agent's prompt in the interactive mode.
const thirdPartyCode = "third-party"
// redoAsPrint is relay's status for an interactive-mode turn Anthropic
// refused as a third-party app's (#4503, Raven on Discord: Pi in Cindy
// through group/auto) before any of its reply was said, or reached the
// client: nothing was written, and serveSubscriptionAs asks it again, once,
// as claude -p, which isjiajia01's controlled tests had served the same
// prompt. Anthropic answered the refused turn nothing, so the -p run is
// its only answer, and one that would draw from extra usage would have
// been served, not refused. A -p turn is never asked again (req.interactive
// is false), and neither is one whose reply had begun: that client has its
// start already, and the turn may have said or done something.
const redoAsPrint = -4503
// redoable is whether relay hands an interactive-mode turn's refusal,
// code and msg, back as redoAsPrint: Anthropic's third-party refusal, the
// user's interactive mode still on (Off, every run is -p already), and the
// client still waiting.
func redoable(r *http.Request, name string, req *Request, code int, msg string) bool {
return req.interactive && !req.tuiRefused && thirdPartySaid(name, code, msg) && claudeTUIOn() && r.Context().Err() == nil
}
// thirdPartyFor is how long an agent's system prompt Anthropic refused in
// the interactive mode runs as claude -p before the interactive mode is
// tried for it again. A try refused costs a Claude Code's start and no
// usage; a -p turn the plan counts at about twice.
const thirdPartyFor = 12 * time.Hour
// thirdPartyKeyLen is how much of a system prompt its fingerprint reads:
// an agent's own part, which comes first, and not what it adds after of
// the day, its folder or its files (Pi's date and working directory), so
// that each conversation of the agent isn't refused once first.
const thirdPartyKeyLen = 2048
// thirdPartyKey is req's agent's system prompt's fingerprint, "" when it
// has none: what the interactive mode was refused for is the prompt,
// judged as a whole (#4503), not the account or the conversation.
func thirdPartyKey(req *Request) string {
sys := strings.TrimSpace(withoutBillingHeader(req.System))
if sys == "" {
return ""
}
if len(sys) > thirdPartyKeyLen {
sys = sys[:thirdPartyKeyLen]
}
sum := sha256.Sum256([]byte(sys))
return hex.EncodeToString(sum[:])
}
// refusedTUI keeps that Anthropic refused req's agent's prompt in the
// interactive mode, for its next turns to run as claude -p (tuiRefused).
func (b *subscriptionBridge) refusedTUI(req *Request) {
key := thirdPartyKey(req)
if key == "" {
return
}
now := time.Now()
b.thirdParty.Range(func(k, v any) bool {
if now.Sub(v.(time.Time)) >= thirdPartyFor {
b.thirdParty.Delete(k)
}
return true
})
b.thirdParty.Store(key, now)
}
// tuiRefused is whether Anthropic refused req's agent's prompt in the
// interactive mode within thirdPartyFor.
func (b *subscriptionBridge) tuiRefused(req *Request) bool {
key := thirdPartyKey(req)
if key == "" {
return false
}
at, ok := b.thirdParty.Load(key)
return ok && time.Since(at.(time.Time)) < thirdPartyFor
}
// bridgeHeardAfter is how long a Claude Code run may work on its turn
@@ -6610,8 +6734,12 @@ func relay(w http.ResponseWriter, r *http.Request, from provider.Protocol, name
}
code := 502
if n > 0 {
usage.add(Usage{ErrType: head[n-1].Code, RequestID: head[n-1].RequestID})
code, msg = bridgeFailed(name, msg, head[n-1].Status)
// nothing of the reply was said, nor has reached the client
if redoable(r, name, req, code, msg) {
return redoAsPrint, msg
}
usage.add(Usage{ErrType: head[n-1].Code, RequestID: head[n-1].RequestID})
msg = thirdPartyRefused(name, req, code, msg)
}
return writeError(w, from, code, name+": "+msg), msg
@@ -6682,8 +6810,11 @@ func relay(w http.ResponseWriter, r *http.Request, from provider.Protocol, name
// client yet, so it is told the failure, as a translated reply
// cut short is (errEndedShort)
usage.add(col.res.Usage)
usage.add(Usage{ErrType: col.errCode})
code, msg := bridgeFailed(name, col.err, col.errStatus)
if len(col.res.Parts) == 0 && redoable(r, name, req, code, msg) {
return redoAsPrint, msg
}
usage.add(Usage{ErrType: col.errCode})
msg = thirdPartyRefused(name, req, code, msg)
return writeError(w, from, code, name+": "+msg), msg
}
+202 -34
View File
@@ -1,13 +1,17 @@
package gateway
import (
"encoding/json"
"net/http/httptest"
"os"
"path/filepath"
"strings"
"testing"
"time"
"github.com/yetone/magpie/internal/claudetui"
"github.com/yetone/magpie/internal/provider"
"github.com/yetone/magpie/internal/settings"
"github.com/yetone/magpie/internal/testenv"
)
@@ -34,9 +38,10 @@ func TestClaudeTUIRefusalIsNoAccountsFault(t *testing.T) {
const tuiThirdPartyRefusal = `{"type":"result","subtype":"error_during_execution","is_error":true,"result":"API Error: 400 Third-party apps now draw from your extra usage, not your plan limits. Add more at claude.ai/settings/usage and keep going.","api_error_status":400}`
// tuiThirdPartyHarness is tuiHelperHarness whose interactive Claude Code
// answers every turn with that refusal; as claude -p it answers "ok".
// answers every turn with that refusal, after hold (a shell command);
// as claude -p it answers "ok", or runs print first when it is given.
// (ggbdpq's harness, #4503.)
func tuiThirdPartyHarness(t *testing.T) (*resumeHarness, string) {
func tuiThirdPartyHarness(t *testing.T, hold, print string) (*resumeHarness, string) {
t.Helper()
start := `if [ -n "$MG_TEST_TUI" ]; then
echo '{"type":"system","subtype":"init","session_id":"'$sid'"}'
@@ -46,12 +51,13 @@ func tuiThirdPartyHarness(t *testing.T) (*resumeHarness, string) {
echo '{"type":"control_response","response":{"subtype":"success","request_id":"'$id'"}}'
continue ;;
esac
` + hold + `
echo '` + tuiThirdPartyRefusal + `'
exit 1
done
exit 0
fi
`
` + print
h := newScriptHarness(t, "ok", start)
claudeTUIRuns = true
t.Cleanup(func() { claudeTUIRuns = false })
@@ -70,51 +76,209 @@ exec "$claude" "$@"
return h, started
}
// A turn Anthropic refuses in the interactive mode as a third-party app's
// (#4503) reaches the client as a 400 that says what happened, that asking
// again may draw from extra usage, and where to turn the interactive mode
// off. magpie asks nothing again on its own: no claude -p run starts, which
// the plan counts at about twice and which may draw from extra usage (the
// owner's call), and no account rests for it or is asked next.
func TestClaudeTUIThirdPartyRefusalSaysWhy(t *testing.T) {
// piSystem is Pi 1.1.0's own system prompt, as the reporter's Pi in Cindy
// sends it, its working directory dir.
func piSystem(t *testing.T, dir string) string {
t.Helper()
b, err := os.ReadFile(filepath.Join("testdata", "workdir", "pi-1.1.0.json"))
if err != nil {
t.Fatal(err)
}
var req struct {
Messages []json.RawMessage `json:"messages"`
}
var first struct {
Content string `json:"content"`
}
if err := json.Unmarshal(b, &req); err != nil || len(req.Messages) == 0 {
t.Fatal(err)
}
if err := json.Unmarshal(req.Messages[0], &first); err != nil {
t.Fatal(err)
}
sys := first.Content
if !strings.Contains(sys, "operating inside pi") || !strings.Contains(sys, "/Users/me/work/proj/My Proj") {
t.Fatalf("not Pi's prompt: %.200s", sys)
}
return strings.ReplaceAll(sys, "/Users/me/work/proj/My Proj", dir)
}
// askThirdParty asks h's Claude subscription a first turn under system,
// on claude-opus-5-5 as the reporter's group/auto did.
func askThirdParty(t *testing.T, h *resumeHarness, system string, stream bool) (int, string, string, Usage) {
t.Helper()
sys, _ := json.Marshal(system)
s := ""
if stream {
s = `"stream":true,`
}
body := `{"model":"claude-opus-5-5","max_tokens":100,` + s + `"system":` + string(sys) + `,"tools":[{"name":"read","input_schema":{"type":"object"}}],"messages":[{"role":"user","content":"hi"}]}`
rec := httptest.NewRecorder()
var u Usage
code, msg := h.s.serveClaudeSubscription(rec, httptest.NewRequest("POST", "/v1/messages", strings.NewReader(body)), provider.Anthropic, h.p, "claude-opus-5-5", []byte(body), &u)
return code, msg, rec.Body.String(), u
}
// A turn Anthropic refuses in the interactive mode as a third-party app's,
// with nothing of its reply said (#4503; Raven on Discord: Pi in Cindy,
// group/auto to a Claude subscription, every turn refused), is asked again
// once as claude -p, which is served such prompts, and the client has its
// answer: no error, and nothing to turn off in Settings. Before, the
// client had the 400 and was told to turn the interactive mode off for
// every request.
func TestClaudeTUIThirdPartyRefusalRedoneAsPrint(t *testing.T) {
for _, stream := range []bool{false, true} {
t.Run(map[bool]string{false: "whole", true: "stream"}[stream], func(t *testing.T) {
h, started := tuiThirdPartyHarness(t)
s := ""
if stream {
s = `"stream":true,`
h, started := tuiThirdPartyHarness(t, "", "")
code, msg, body, u := askThirdParty(t, h, piSystem(t, "/Users/raven/cindy"), stream)
if code != 200 || !strings.Contains(body, "ok") {
t.Fatalf("%d %.300s %.400s", code, msg, body)
}
body := `{"model":"claude-sonnet-5","max_tokens":100,` + s + `"system":"You are pi, a coding agent harness.","tools":[{"name":"read","input_schema":{"type":"object"}}],"messages":[{"role":"user","content":"hi"}]}`
rec := httptest.NewRecorder()
var u Usage
code, msg := h.s.serveClaudeSubscription(rec, httptest.NewRequest("POST", "/v1/messages", strings.NewReader(body)), provider.Anthropic, h.p, "claude-sonnet-5", []byte(body), &u)
if code != 400 {
t.Fatalf("%d %.400s", code, msg)
}
for _, w := range []string{thirdPartyWords, "interactive mode with your agent's own system prompt", "may draw from the Claude account's extra usage", "doesn't ask again on its own", "Settings › Models › Replies"} {
if !strings.Contains(msg, w) || !strings.Contains(rec.Body.String(), w) {
t.Fatalf("the client isn't told %q: %s", w, rec.Body.String())
}
if strings.Contains(body, thirdPartyWords) || u.ErrType != "" {
t.Fatalf("the client, or its usage row, has the refusal: %q %s", u.ErrType, body)
}
if n := helperStarts(started); n != 1 {
t.Fatalf("the interactive mode started %d times, want once", n)
}
if runs := h.runs(); len(runs) != 1 {
t.Fatalf("%d runs, want the interactive one alone: nothing is asked again as claude -p", len(runs))
if runs := h.runs(); len(runs) != 2 {
t.Fatalf("%d runs, want two: the interactive mode's, then claude -p", len(runs))
}
if retryable(code, rec.Body.Bytes()) {
t.Fatalf("the refusal is asked of the next account: %s", rec.Body.String())
}
switch f := failure(code, rec.Body.Bytes()); f {
case failCredit, failQuota, failRate, failAuth:
t.Fatalf("the refusal reads as the account's (%s): %s", f, rec.Body.String())
if claudeTUIOn() == false || settings.Load().ClaudePrintMode {
t.Fatal("the user's setting changed")
}
})
}
}
// The next turns of the same agent's prompt run as claude -p from the
// start, in another conversation of it too (Pi's working directory comes
// after its own part); another agent's prompt is still tried in the
// interactive mode first.
func TestClaudeTUIThirdPartyPromptRemembered(t *testing.T) {
h, started := tuiThirdPartyHarness(t, "", "")
if code, msg, body, _ := askThirdParty(t, h, piSystem(t, "/Users/raven/cindy"), false); code != 200 {
t.Fatalf("%d %.300s %.300s", code, msg, body)
}
if code, msg, body, _ := askThirdParty(t, h, piSystem(t, "/Users/raven/other"), true); code != 200 || !strings.Contains(body, "ok") {
t.Fatalf("%d %.300s %.300s", code, msg, body)
}
if n := helperStarts(started); n != 1 {
t.Fatalf("the interactive mode started %d times, want once: the prompt it refused runs as -p", n)
}
if runs := len(h.runs()); runs != 3 {
t.Fatalf("%d runs, want 3", runs)
}
if code, msg, _, _ := askThirdParty(t, h, "You are a careful reviewer.", false); code != 200 {
t.Fatalf("%d %.300s", code, msg)
}
if n := helperStarts(started); n != 2 {
t.Fatalf("the interactive mode started %d times, want twice: another prompt is tried there first", n)
}
}
// The redo is once: claude -p too refusing the turn the same way, the
// client has that refusal, saying it ran as -p, and no third run starts.
func TestClaudeTUIThirdPartyRefusalRedoneOnce(t *testing.T) {
print := `if [ -z "$MG_TEST_TUI" ]; then
echo '{"type":"system","subtype":"init","session_id":"'$sid'"}'
while read -r line; do
case $line in *'"type":"control_request"'*)
id=$(printf '%s' "$line" | sed 's/.*"request_id":"\([^"]*\)".*/\1/')
echo '{"type":"control_response","response":{"subtype":"success","request_id":"'$id'"}}'
continue ;;
esac
echo '` + tuiThirdPartyRefusal + `'
exit 1
done
exit 0
fi
`
h, started := tuiThirdPartyHarness(t, "", print)
code, msg, body, _ := askThirdParty(t, h, piSystem(t, "/w"), false)
if code != 400 || !strings.Contains(msg, thirdPartyWords) || !strings.Contains(body, "run as claude -p") {
t.Fatalf("%d %.300s %.300s", code, msg, body)
}
if n := helperStarts(started); n != 1 {
t.Fatalf("the interactive mode started %d times, want once", n)
}
if runs := len(h.runs()); runs != 2 {
t.Fatalf("%d runs, want two: the interactive mode's, then claude -p", runs)
}
if retryable(code, []byte(body)) {
t.Fatalf("the refusal is asked of the next account: %s", body)
}
switch f := failure(code, []byte(body)); f {
case failCredit, failQuota, failRate, failAuth:
t.Fatalf("the refusal reads as the account's (%s): %s", f, body)
}
}
// A turn whose reply had begun reaching the client before the refusal is
// not asked again: the client has the reply's start already. Its agent's
// next turn runs as claude -p.
func TestClaudeTUIThirdPartyRefusalAfterStartNotRedone(t *testing.T) {
heard, every := bridgeHeardAfter, keepaliveEvery
bridgeHeardAfter, keepaliveEvery = 0, 20*time.Millisecond
t.Cleanup(func() { bridgeHeardAfter, keepaliveEvery = heard, every })
h, started := tuiThirdPartyHarness(t, "sleep 1", "")
code, _, body, _ := askThirdParty(t, h, piSystem(t, "/w"), true)
if code != 200 || !strings.Contains(body, "message_start") || !strings.Contains(body, thirdPartyWords) {
t.Fatalf("%d %.400s", code, body)
}
if runs := len(h.runs()); runs != 1 {
t.Fatalf("%d runs, want the interactive one alone", runs)
}
if code, msg, body, _ := askThirdParty(t, h, piSystem(t, "/w"), false); code != 200 || !strings.Contains(body, "ok") {
t.Fatalf("%d %.300s %.300s", code, msg, body)
}
if n := helperStarts(started); n != 1 {
t.Fatalf("the interactive mode started %d times, want once", n)
}
}
// A turn that said some of its reply before the refusal is not asked
// again either, whole or streamed: what it said may have been acted on,
// and asked again it would be said and counted twice.
func TestClaudeTUIThirdPartyRefusalAfterWordsNotRedone(t *testing.T) {
said := `echo '{"type":"stream_event","event":{"type":"message_start","message":{"id":"m","model":"claude-opus-5-5","usage":{"input_tokens":1}}}}'
echo '{"type":"stream_event","event":{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"half"}}}'`
for _, stream := range []bool{false, true} {
t.Run(map[bool]string{false: "whole", true: "stream"}[stream], func(t *testing.T) {
h, started := tuiThirdPartyHarness(t, said, "")
code, _, body, _ := askThirdParty(t, h, piSystem(t, "/w"), stream)
if !strings.Contains(body, thirdPartyWords) || !stream && code != 400 {
t.Fatalf("%d %.400s", code, body)
}
if runs := len(h.runs()); runs != 1 {
t.Fatalf("%d runs, want the interactive one alone", runs)
}
if code, msg, body, _ := askThirdParty(t, h, piSystem(t, "/w2"), false); code != 200 || !strings.Contains(body, "ok") {
t.Fatalf("%d %.300s %.300s", code, msg, body)
}
if n := helperStarts(started); n != 1 {
t.Fatalf("the interactive mode started %d times, want once", n)
}
})
}
}
// With the interactive mode turned off, every run is claude -p as before:
// nothing is remembered or asked again.
func TestClaudeThirdPartyRefusalPrintModeAlone(t *testing.T) {
h, started := tuiThirdPartyHarness(t, "", "")
printMode(t, true)
code, msg, body, _ := askThirdParty(t, h, piSystem(t, "/w"), false)
if code != 200 || !strings.Contains(body, "ok") {
t.Fatalf("%d %.300s %.300s", code, msg, body)
}
if n := helperStarts(started); n != 0 {
t.Fatalf("the interactive mode started %d times with it turned off", n)
}
}
// The same refusal of a claude -p run says so without telling the user to
// turn the interactive mode off, which it already is.
// turn the interactive mode off, which it already is; one of the
// interactive mode whose reply had begun says the next turns run as -p.
func TestClaudeThirdPartyRefusalOfPrint(t *testing.T) {
msg := thirdPartyRefused("Claude Code", &Request{Model: "m"}, 400, "API Error: 400 Third-party apps now draw from your extra usage, not your plan limits.")
if !strings.Contains(msg, "run as claude -p") || strings.Contains(msg, "turn off") {
@@ -123,4 +287,8 @@ func TestClaudeThirdPartyRefusalOfPrint(t *testing.T) {
if got := thirdPartyRefused("Claude Code", &Request{interactive: true}, 502, "other"); got != "other" {
t.Fatal(got)
}
msg = thirdPartyRefused("Claude Code", &Request{Model: "m", interactive: true}, 400, "API Error: 400 Third-party apps now draw from your extra usage, not your plan limits.")
if !strings.Contains(msg, "next turns as claude -p") || strings.Contains(msg, "Settings") {
t.Fatal(msg)
}
}
+6
View File
@@ -223,6 +223,12 @@ type Request struct {
// request is Claude Code's interactive mode, not claude -p: what a
// refusal it ends in is told with (thirdPartyRefused, #4503)
interactive bool
// tuiRefused, for the Claude bridge, is a request whose agent's
// system prompt Anthropic refused in the interactive mode as a
// third-party app's (#4503): its run is claude -p, which is served
// such prompts, with the interactive mode on all the same
// (thirdPartyPrint)
tuiRefused bool
// hourMarks has the cache marks magpie adds on Anthropic's Messages
// (anthropicBody) last an hour: a Responses client's (Codex's), whose
// turns are often more than five minutes apart and whose own vendor
+3 -3
View File
@@ -21679,10 +21679,10 @@ function renderReplies(s, keep) {
const c = segRow("claudeLeanRow", t("Short Claude system prompt"),
t("A Claude subscription answers with the agent's own instructions as its system prompt, in place of Claude Code's, about 1K fewer tokens each request. Still the real Claude Code, but its requests look less like Claude Code's own, which can put the account more at risk"),
onOff, s.claudeLeanPrompt ? "on" : "off", (v) => savePrefs({ ...keep, claudeLeanPrompt: v === "on" }));
// a Claude run as Claude Code's interactive mode, -p when off (the plan
// counts a -p request at about twice); on, nothing is ever -p
// Claude Code's interactive mode, -p when off (2x the plan's count);
// on, -p only for a prompt Anthropic refused there (#4503)
const u = segRow("claudeTuiRow", t("Claude Code's interactive mode"),
t("A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, no request ever runs as -p. Off runs every request as claude -p"),
t("A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, a request runs as -p only when Anthropic refuses its agent's prompt there. Off runs every request as claude -p"),
onOff, s.claudePrintMode ? "off" : "on", (v) => { claudeMode = null; savePrefs({ ...keep, claudePrintMode: v === "off" }); });
box.append(r, l, f, k, c, u);
}
+4 -3
View File
@@ -2,8 +2,9 @@
// Claude subscription's runs are Claude Code's interactive mode (TUI) or
// claude -p, switched right there, how the last request went, and on hover
// what each is and what it is good for (the owner, 10-31, 11-01). With the
// interactive mode on nothing runs as -p: a request it can't take fails,
// saying why (the owner, 11-01). app.js imports this with the row's first
// interactive mode on a request it can't take fails, saying why (the owner,
// 11-01); a turn Anthropic refuses there as a third-party app's runs as -p
// (#4503). app.js imports this with the row's first
// read of /api/claude/mode (claudeModeRow), so it weighs nothing on the
// core.
@@ -39,7 +40,7 @@ function ccTip(anchor, tui) {
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, with no terminal of its own to open first."),
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.")));
el("div", "foot", t("Switched here or in Settings › Models › Replies. With the interactive mode on, a request it can't take, or one it fails to start for, fails saying why. A turn Anthropic refuses there as a third-party app's runs as -p.")));
document.body.append(tip);
const a = anchor.getBoundingClientRect(), b = tip.getBoundingClientRect();
tip.style.left = Math.max(8, Math.min(a.left, innerWidth - b.width - 8)) + "px";
+8 -8
View File
@@ -49,7 +49,7 @@ const I18N = {
"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, with no terminal of its own to open first.": "启动即用,不用先打开它自己的终端。",
"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:交互模式接不了或启动失败的请求会报错并说明原因。",
"Switched here or in Settings › Models › Replies. With the interactive mode on, a request it can't take, or one it fails to start for, fails saying why. A turn Anthropic refuses there as a third-party app's runs as -p.": "可在这里或 设置 › 模型 › 回复 里切换。开着交互模式时,交互模式接不了或启动失败的请求会报错并说明原因。Anthropic 在交互模式里当作第三方应用拒绝的轮次会改走 -p。",
"Every request runs as claude -p": "每个请求都以 claude -p 运行",
"MCP router": "MCP 路由",
"in {agents}": "用于 {agents}",
@@ -403,7 +403,7 @@ const I18N = {
"Short Claude system prompt": "精简 Claude 系统提示词",
"Claude Code's interactive mode": "Claude Code 交互模式",
"Claude Code isn't installed on this computer": "这台电脑上没有安装 Claude Code",
"A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, no request ever runs as -p. Off runs every request as claude -p": "Claude 订阅像人一样以交互模式运行 Claude Code,套餐对每次请求的计量约为 -p 的一半。开启时,任何请求都不会走 -p。关闭则每个请求都以 claude -p 运行",
"A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, a request runs as -p only when Anthropic refuses its agent's prompt there. Off runs every request as claude -p": "Claude 订阅像人一样以交互模式运行 Claude Code,套餐对每次请求的计量约为 -p 的一半。开启时,只有 Anthropic 在交互模式里拒绝了 Agent 的提示词,请求才走 -p。关闭则每个请求都以 claude -p 运行",
"Claude requests fail: {why}": "Claude 请求会报错:{why}",
"A Claude subscription answers with the agent's own instructions as its system prompt, in place of Claude Code's, about 1K fewer tokens each request. Still the real Claude Code, but its requests look less like Claude Code's own, which can put the account more at risk": "Claude 订阅以智能体自己的指令作为系统提示词,代替 Claude Code 的,每次请求约少 1K token。仍是真正的 Claude Code,但请求不再那么像 Claude Code 自己发出的,账号风险可能更高",
"Ask again after a refusal": "被拒答后再问",
@@ -4679,7 +4679,7 @@ const I18N = {
"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, with no terminal of its own to open first.": "啟動即用,不用先開啟它自己的終端機。",
"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:互動模式接不了或啟動失敗的請求會報錯並說明原因。",
"Switched here or in Settings › Models › Replies. With the interactive mode on, a request it can't take, or one it fails to start for, fails saying why. A turn Anthropic refuses there as a third-party app's runs as -p.": "可在這裡或 設定 › 模型 › 回覆 裡切換。開著互動模式時,互動模式接不了或啟動失敗的請求會報錯並說明原因。Anthropic 在互動模式裡當作第三方應用拒絕的輪次會改走 -p。",
"Every request runs as claude -p": "每個請求都以 claude -p 執行",
"MCP router": "MCP 路由",
"in {agents}": "用於 {agents}",
@@ -5041,7 +5041,7 @@ const I18N = {
"Short Claude system prompt": "精簡 Claude 系統提示詞",
"Claude Code's interactive mode": "Claude Code 互動模式",
"Claude Code isn't installed on this computer": "這台電腦上沒有安裝 Claude Code",
"A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, no request ever runs as -p. Off runs every request as claude -p": "Claude 訂閱像人一樣以互動模式執行 Claude Code,方案對每次請求的計量約為 -p 的一半。開啟時,任何請求都不會走 -p。關閉則每個請求都以 claude -p 執行",
"A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, a request runs as -p only when Anthropic refuses its agent's prompt there. Off runs every request as claude -p": "Claude 訂閱像人一樣以互動模式執行 Claude Code,方案對每次請求的計量約為 -p 的一半。開啟時,只有 Anthropic 在互動模式裡拒絕了 Agent 的提示詞,請求才走 -p。關閉則每個請求都以 claude -p 執行",
"Claude requests fail: {why}": "Claude 請求會報錯:{why}",
"A Claude subscription answers with the agent's own instructions as its system prompt, in place of Claude Code's, about 1K fewer tokens each request. Still the real Claude Code, but its requests look less like Claude Code's own, which can put the account more at risk": "Claude 訂閱以代理自己的指令作為系統提示詞,取代 Claude Code 的,每次請求約少 1K token。仍是真正的 Claude Code,但請求不再那麼像 Claude Code 自己發出的,帳號風險可能更高",
"Ask again after a refusal": "被拒答後再問",
@@ -9294,7 +9294,7 @@ const I18N = {
"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, with no terminal of its own to open first.": "専用の端末を先に開くことなく、すぐに起動します。",
"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 では実行しません。対話モードで扱えないリクエストや起動に失敗したリクエストは理由を添えてエラーになります。",
"Switched here or in Settings › Models › Replies. With the interactive mode on, a request it can't take, or one it fails to start for, fails saying why. A turn Anthropic refuses there as a third-party app's runs as -p.": "ここか 設定 › モデル › 応答 で切り替えられます。対話モードがオンのときは、対話モードで扱えないリクエストや起動に失敗したリクエストは理由を添えてエラーになります。Anthropic が対話モードでサードパーティアプリのものとして拒否したターンは -p で実行します。",
"Every request runs as claude -p": "すべてのリクエストを claude -p で実行します",
"MCP router": "MCP ルーター",
"in {agents}": "{agents} で使用",
@@ -9648,7 +9648,7 @@ const I18N = {
"Short Claude system prompt": "Claude のシステムプロンプトを短く",
"Claude Code's interactive mode": "Claude Code の対話モード",
"Claude Code isn't installed on this computer": "このコンピュータには Claude Code がインストールされていません",
"A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, no request ever runs as -p. Off runs every request as claude -p": "Claude サブスクリプションは人と同じように Claude Code を対話モードで実行し、プランはリクエストを -p の約半分として数えます。オンのときは、どのリクエストも -p では実行しません。オフにするとすべてのリクエストを claude -p で実行します",
"A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, a request runs as -p only when Anthropic refuses its agent's prompt there. Off runs every request as claude -p": "Claude サブスクリプションは人と同じように Claude Code を対話モードで実行し、プランはリクエストを -p の約半分として数えます。オンのときは、Anthropic が対話モードでエージェントのプロンプトを拒否したときだけ -p で実行します。オフにするとすべてのリクエストを claude -p で実行します",
"Claude requests fail: {why}": "Claude へのリクエストはエラーになります:{why}",
"A Claude subscription answers with the agent's own instructions as its system prompt, in place of Claude Code's, about 1K fewer tokens each request. Still the real Claude Code, but its requests look less like Claude Code's own, which can put the account more at risk": "Claude サブスクリプションは Claude Code のものの代わりにエージェント自身の指示をシステムプロンプトとして応答し、リクエストごとに約 1K トークン少なくなります。本物の Claude Code のままですが、リクエストが Claude Code 自身のものらしくなくなるため、アカウントのリスクが高まる可能性があります",
"Ask again after a refusal": "拒否のあと聞き直す",
@@ -13911,7 +13911,7 @@ const I18N = {
"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, with no terminal of its own to open first.": "Er startet sofort, ohne zuerst ein eigenes Terminal zu öffnen.",
"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.",
"Switched here or in Settings › Models › Replies. With the interactive mode on, a request it can't take, or one it fails to start for, fails saying why. A turn Anthropic refuses there as a third-party app's runs as -p.": "Hier oder unter Einstellungen › Modelle › Antworten umschaltbar. Mit eingeschaltetem interaktivem Modus schlägt eine Anfrage, die er nicht annehmen kann oder für die er nicht startet, mit dem Grund fehl. Ein Zug, den Anthropic dort als den einer Drittanbieter-App ablehnt, läuft als -p.",
"Every request runs as claude -p": "Jede Anfrage läuft als claude -p",
"MCP router": "MCP-Router",
"in {agents}": "in {agents}",
@@ -14265,7 +14265,7 @@ const I18N = {
"Short Claude system prompt": "Kurzer Claude-Systemprompt",
"Claude Code's interactive mode": "Interaktiver Modus von Claude Code",
"Claude Code isn't installed on this computer": "Claude Code ist auf diesem Computer nicht installiert",
"A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, no request ever runs as -p. Off runs every request as claude -p": "Ein Claude-Abo führt Claude Code wie ein Mensch im interaktiven Modus aus, wo der Plan eine Anfrage mit etwa der Hälfte von -p anrechnet. Ein: Keine Anfrage läuft je als -p. Aus führt jede Anfrage als claude -p aus",
"A Claude subscription runs Claude Code as a person does, in its interactive mode, where the plan counts a request at about half of what -p uses. On, a request runs as -p only when Anthropic refuses its agent's prompt there. Off runs every request as claude -p": "Ein Claude-Abo führt Claude Code wie ein Mensch im interaktiven Modus aus, wo der Plan eine Anfrage mit etwa der Hälfte von -p anrechnet. Ein: Eine Anfrage läuft nur dann als -p, wenn Anthropic dort den Prompt ihres Agenten ablehnt. Aus führt jede Anfrage als claude -p aus",
"Claude requests fail: {why}": "Claude-Anfragen schlagen fehl: {why}",
"A Claude subscription answers with the agent's own instructions as its system prompt, in place of Claude Code's, about 1K fewer tokens each request. Still the real Claude Code, but its requests look less like Claude Code's own, which can put the account more at risk": "Ein Claude-Abo antwortet mit den eigenen Anweisungen des Agenten als Systemprompt statt mit dem von Claude Code, etwa 1K Token weniger pro Anfrage. Weiterhin das echte Claude Code, aber seine Anfragen sehen Claude Codes eigenen weniger ähnlich, was das Konto stärker gefährden kann",
"Ask again after a refusal": "Nach einer Ablehnung erneut fragen",
+3 -3
View File
@@ -5,8 +5,8 @@
// each is good for (the owner, 10-31). Here:
// - on, its last request interactive: TUI pressed, the last request said;
// - hovering or focusing the switch shows both modes, the one chosen
// marked, each with its advantage, inside the window, and says nothing
// ever runs as -p with the interactive mode on; moving away hides it;
// marked, each with its advantage, inside the window, and says a turn
// Anthropic refuses as a third-party app's runs as -p; moving away hides it;
// - turned off: claude -p pressed, every request said to run as it;
// pressing TUI saves claudePrintMode false with the rest kept, reads the
// mode again and draws TUI pressed; pressing claude -p turns it back;
@@ -127,7 +127,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
{ on: false, name: "claude -p", now: "", good: 1, bad: 1 },
]);
// 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(".foot").textContent()).trim(), await tr("Switched here or in Settings › Models › Replies. With the interactive mode on, a request it can't take, or one it fails to start for, fails saying why. A turn Anthropic refuses there as a third-party app's runs as -p."));
assert.equal((await tip.locator(".cc-m").nth(1).locator("p.good").textContent()).trim(), await tr("It starts at once, with no terminal of its own to open first."));
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)}`);