diff --git a/docs/configuration.ja.md b/docs/configuration.ja.md index e4c4ab55e0..ab29328578 100644 --- a/docs/configuration.ja.md +++ b/docs/configuration.ja.md @@ -368,6 +368,7 @@ | `compat` | { roles?, dropFields? } | {} | — | ルート単位のワイヤー互換性上書き;provider エントリはキーごとに global ブロックを優先します;dropFields は加算的に union されます。 | | `direct` | boolean | false | — | クライアント側の除外:このアップストリームへのトラフィックは決して bili に指向されません。 | | `passthrough` | boolean | false | — | セッション状態なしのルートスコープのバイト単位リレー — 不正防止アップストリーム向け。 | +| `renderNone` | boolean | unset (follows diagnostics.renderNone) | — | ルートスコープのレンダータグ:true でこのルートの履歴に ACP タグを描画せず、false で強制的に有効化(#2483)。 | | `imageBilling` | "auto" \| "pixels" \| "bytes" | auto (→ pixels) | — | このルートのイメージトークンカウント基準;bytes はバイトリレーに対する明示的なオプトインです。 | | `imageTokenCap` | number | unset (uncapped) | — | このルートのイメージごとのトークンコスト上限。 | | `resign` | scheme → { enabled?, passthrough?, credentialRef? } | {} (global map applies) | — | グローバル resign マップのルート単位のオーバーライド(レベル 2、最も深いものが優先)。 | diff --git a/docs/configuration.md b/docs/configuration.md index 0ce26ea7e3..2e20727657 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -369,6 +369,7 @@ This index is generated from `website/config-reference/*.yaml` — edit the seed | `compat` | { roles?, dropFields? } | {} | — | Per-route wire-compat overrides; provider entries beat the global block per key; dropFields union additively. | | `direct` | boolean | false | — | Client-side exemption: traffic for this upstream is never pointed at bili at all. | | `passthrough` | boolean | false | — | Route-scoped byte-for-byte relay with no session state — for anti-fraud upstreams. | +| `renderNone` | boolean | unset (follows diagnostics.renderNone) | — | Route-scoped render tags: true renders no ACP tags into this route's history, false forces them on (#2483). | | `imageBilling` | "auto" \| "pixels" \| "bytes" | auto (→ pixels) | — | Image-token counting basis for this route; bytes is an explicit opt-in for byte relays. | | `imageTokenCap` | number | unset (uncapped) | — | Per-image token cost cap for this route. | | `resign` | scheme → { enabled?, passthrough?, credentialRef? } | {} (global map applies) | — | Per-route overrides of the global resign map (level 2, deepest wins). | diff --git a/docs/configuration.zh-CN.md b/docs/configuration.zh-CN.md index 20982b7278..d67b38c904 100644 --- a/docs/configuration.zh-CN.md +++ b/docs/configuration.zh-CN.md @@ -369,6 +369,7 @@ | `compat` | { roles?, dropFields? } | {} | — | 逐路由线上兼容覆盖;provider 条目按键级覆盖全局;dropFields 加法并集。 | | `direct` | boolean | false | — | 客户端侧豁免:该上游流量完全不指向 bili。 | | `passthrough` | boolean | false | — | 路由级逐字节透传、无会话状态——面向反作弊上游。 | +| `renderNone` | boolean | unset (follows diagnostics.renderNone) | — | 路由级渲染标记:true 时本路由历史不渲染 ACP 标签,false 强制开启(#2483)。 | | `imageBilling` | "auto" \| "pixels" \| "bytes" | auto (→ pixels) | — | 本路由图片 token 计费口径;bytes 为字节中继的显式指定。 | | `imageTokenCap` | number | unset (uncapped) | — | 本路由单张图片 token 成本上限。 | | `resign` | scheme → { enabled?, passthrough?, credentialRef? } | {} (global map applies) | — | 按路由覆盖全局 resign 映射(第 2 级,最深层胜出)。 | diff --git a/src/cache-ledger.ts b/src/cache-ledger.ts index 3393e4ae5e..4796f74bda 100644 --- a/src/cache-ledger.ts +++ b/src/cache-ledger.ts @@ -2522,7 +2522,7 @@ function formatSeam(r: BiliCacheReport): string { if (r.seam.providerSide.count > 0) { out.push("▲ PROVIDER-SIDE MISS (previous request's message list fully preserved)"); out.push(` ${r.seam.providerSide.count} sample(s) · ${fmtTok(r.seam.providerSide.missed)} tok — the previous request's message list is preserved in this one (byte-for-byte under the 512 KiB forensics cap; above it, proven by the stable recorded head plus exact message-count growth — any difference is only the appended tail), and the sample arrived within ${Math.round(PROVIDER_TTL_GAP_MS / 60_000)} min of the previous one, so this is an ABNORMAL provider miss (eviction / relay node rotation), not TTL ageing. Not a bili rebuild seam.`); - out.push(` stateful-upstream check (#2483): if your upstream keeps a live session per conversation and validates the echoed history against its own transcript (claude-code-based relays such as magpie), bili's render tags on assistant text trip that check even though bili's own list is unchanged — set diagnostics.renderNone=true until per-route render-tags control ships; expect exactly ONE replay when flipping the flag mid-session`); + out.push(` stateful-upstream check (#2483): if your upstream keeps a live session per conversation and validates the echoed history against its own transcript (claude-code-based relays such as magpie), bili's render tags on assistant text trip that check even though bili's own list is unchanged — set providers[""].renderNone=true (or diagnostics.renderNone=true for every lane); expect exactly ONE replay when flipping the flag mid-session`); } if (r.seam.client.count > 0) { out.push("✎ CLIENT MID-HISTORY REWRITE (host-side insert — NOT a bili seam)"); diff --git a/src/config.ts b/src/config.ts index e8c42325c5..0c8347c077 100644 --- a/src/config.ts +++ b/src/config.ts @@ -86,6 +86,14 @@ export type ProviderRoute = { * verbatim, no session state. For upstreams whose anti-cheat fingerprints * the request body (e.g. ZCode 405/3012). */ passthrough?: boolean; + /** Route-scoped render-tags switch (#2483): `true` renders no ACP tags + * into history for requests matching this route, `false` forces them on, + * unset follows `diagnostics.renderNone`. For upstreams that keep a live + * session per conversation and validate the echoed history against their + * own transcript (claude-code-based relays such as magpie), where render + * tags on assistant text break session reuse every turn. ACP_RENDER_NONE + * still wins over both. */ + renderNone?: boolean; /** Client-side routing exemption (#1622): this upstream never gets pointed * through bili at all. Store-rewriting native lanes (zcode today) skip * matching entries instead of wrapping them, so traffic flows @@ -1173,7 +1181,7 @@ interface DshFileSettings { * {@link parseRouteEntry} consumes per route. When they sit on a non-URL key * WITHOUT `bind` they are inert (longest-prefix matching never hits a name), * so loadRoutes warns loudly instead of letting them sit dead (#1469). */ -const NAMED_PROVIDER_ROUTING_FIELDS = ["compress", "models", "proxy", "passthrough", "compressProtocol", "protocol", "compat", "imageBilling", "imageTokenCap"] as const; +const NAMED_PROVIDER_ROUTING_FIELDS = ["compress", "models", "proxy", "passthrough", "compressProtocol", "protocol", "compat", "imageBilling", "imageTokenCap", "renderNone"] as const; // Once-per-signature dedup so hot-reload / repeated launcher loads don't spam // the same named-provider warning (same pattern as the absorb warnings below). @@ -3067,7 +3075,7 @@ export function parseRouteEntry(v: unknown): ProviderRoute | undefined { // is the KEY in the providers map (identical to the /bili/ string), // so it is NOT repeated inside the value. if (v && typeof v === "object" && !Array.isArray(v)) { - const obj = v as { models?: Record; proxy?: string; compressProtocol?: string; protocol?: unknown; compress?: CompressSettings; cacheKeepalive?: unknown; compat?: { roles?: unknown; dropFields?: unknown }; passthrough?: boolean; direct?: boolean; imageBilling?: unknown; imageTokenCap?: unknown; calibration?: unknown; baseUrl?: unknown; api?: unknown; apiKeyEnv?: unknown; credentialRef?: unknown }; + const obj = v as { models?: Record; proxy?: string; compressProtocol?: string; protocol?: unknown; compress?: CompressSettings; cacheKeepalive?: unknown; compat?: { roles?: unknown; dropFields?: unknown }; passthrough?: boolean; renderNone?: unknown; direct?: boolean; imageBilling?: unknown; imageTokenCap?: unknown; calibration?: unknown; baseUrl?: unknown; api?: unknown; apiKeyEnv?: unknown; credentialRef?: unknown }; const route: ProviderRoute = { models: obj.models }; if (typeof obj.proxy === "string") route.proxy = obj.proxy; if (obj.compressProtocol === "marker" || obj.compressProtocol === "tools") route.compressProtocol = obj.compressProtocol; @@ -3090,6 +3098,7 @@ export function parseRouteEntry(v: unknown): ProviderRoute | undefined { if (compatDrops) compat.dropFields = compatDrops; if (Object.keys(compat).length > 0) route.compat = compat; if (typeof obj.passthrough === "boolean") route.passthrough = obj.passthrough; + if (typeof obj.renderNone === "boolean") route.renderNone = obj.renderNone; if (typeof obj.direct === "boolean") route.direct = obj.direct; const imageBilling = parseImageBilling(obj.imageBilling); if (imageBilling) route.imageBilling = imageBilling; diff --git a/src/knobs.ts b/src/knobs.ts index 29ed9b9e8c..25e687b085 100644 --- a/src/knobs.ts +++ b/src/knobs.ts @@ -1,3 +1,4 @@ +import { AsyncLocalStorage } from "node:async_hooks"; // #2030: canonical home for runtime knobs. Every knob resolves // env var > config file > default: // - the ENV tier is byte-exact with the historical parsing (deployments and @@ -863,10 +864,26 @@ export function dumpGcMaxAgeMs(): number | null { return null; } -/** ACP_RENDER_NONE > diagnostics.renderNone > false (any non-empty env value enables). */ +/** #2483: request-scoped render override from the matched provider route + * (`providers[].renderNone`). Set by the request handler around the + * prepare pipeline so every render-strategy reader (prepare-*, inject, + * count_tokens, the compress-loop rebuild) agrees for that request. */ +const routeRender = new AsyncLocalStorage<{ renderNone: boolean }>(); + +/** Run `fn` with the route's renderNone in scope; undefined = no route override. */ +export function withRouteRenderNone(value: boolean | undefined, fn: () => T): T { + return value === undefined ? fn() : routeRender.run({ renderNone: value }, fn); +} + +/** ACP_RENDER_NONE > providers[].renderNone > diagnostics.renderNone > false + * (any non-empty env value enables). The route value wins over the global + * file flag in either direction, so one lane can opt in (a stateful + * claude-code relay such as magpie) or out while the rest keep the default. */ export function renderNone(): boolean { const envRaw = process.env.ACP_RENDER_NONE; if (envRaw !== undefined) return envRaw.length > 0; + const route = routeRender.getStore(); + if (route !== undefined) return route.renderNone; return fileDiag().renderNone === true; } diff --git a/src/server/handle.ts b/src/server/handle.ts index 0166ebde6b..973a106e7e 100644 --- a/src/server/handle.ts +++ b/src/server/handle.ts @@ -65,7 +65,7 @@ import { resolveCompatDropFields } from "../compat-drop.js"; import { unwrapCommandcodeBody, type CommandcodeEnvelopeMeta } from "../commandcode-wire.js"; import { DecompressedTooLargeError, decodeRequestBody, IngestBodyTooLargeError } from "../content-encoding.js"; import { matchModelEndpoint } from "../model-endpoints.js"; -import { autoModeForgeEnabled, dshAuthoredCompactionEnabled, imageRescaleEnabled, limitsDecodedBytes as knobLimitsDecodedBytes, limitsIngestBytes as knobLimitsIngestBytes, noInjectTool as knobNoInjectTool, pluginBypassOverride, rawDumpDir as knobRawDumpDir } from "../knobs.js"; +import { autoModeForgeEnabled, dshAuthoredCompactionEnabled, imageRescaleEnabled, limitsDecodedBytes as knobLimitsDecodedBytes, limitsIngestBytes as knobLimitsIngestBytes, noInjectTool as knobNoInjectTool, pluginBypassOverride, withRouteRenderNone, rawDumpDir as knobRawDumpDir } from "../knobs.js"; import { buildForgeResponse, classifierForgeVariant, estimateCjkTokens, isAutoModeClassifier, requestText, summarizeAction } from "../auto-mode-forge.js"; import { extractConversationId, isV1BackgroundSideRequest, isV1InternalRequest, unwrapV1Internal } from "../v1internal.js"; import { anthropicBetaContextWindow, BILI_HOP_HEADER, capRegistryWindowByStandard, expandedContextSuffixWindow, launcherContextWindow, launcherMaxOutput, noteUnresolvedModelSession, UNRESOLVED_MODEL_SESSION_THRESHOLD, windowSourceLogged } from "./context-window.js"; @@ -1065,6 +1065,9 @@ async function handleRequest( // requests whose upstream URL matches a provider route with // `passthrough: true` (upstreams that fingerprint the request body). const routePassthrough = !opts.passthrough && findRoute(opts.routes, providerDestUrl)?.passthrough === true; + // #2483: route-scoped render tags (`providers[].renderNone`), applied + // around every prepare of this request (incl. compress-loop rebuilds). + const routeRenderNone = findRoute(opts.routes, providerDestUrl)?.renderNone; if (routePassthrough && hopMarker === undefined && protocol && parsed) { log("info", `[route-passthrough] ${maskUrlsInText(providerDestUrl)} matches a passthrough route — forwarding verbatim, kernel bypassed`); } @@ -3054,7 +3057,7 @@ async function handleRequest( // #1295: stamp the envelope meta onto every Prepared for this // request (initial AND preflight re-prepares both flow through). const runPrepare = async (): Promise => { - const p = await runPrepareInner(); + const p = await withRouteRenderNone(routeRenderNone, runPrepareInner); if (ccMeta !== undefined) p.commandcode = { meta: ccMeta }; return p; }; diff --git a/tests/issue2483-route-render-none.test.ts b/tests/issue2483-route-render-none.test.ts new file mode 100644 index 0000000000..2d8e893c07 --- /dev/null +++ b/tests/issue2483-route-render-none.test.ts @@ -0,0 +1,199 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import http from "node:http"; +import { once } from "node:events"; +import { mkdirSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import { defaultConfig } from "acp-kernel"; +import { startServer } from "../src/server.ts"; +import { loadRoutes, type ProxyOptions } from "../src/config.ts"; +import { SessionStore, _setStoreForTest } from "../src/persist.ts"; +import { _setForTest as setRegistryForTest } from "../src/registry.ts"; + +// #2483 follow-up: route-scoped render tags (`providers[].renderNone`). +// A stateful claude-code relay (magpie) keyed to one upstream URL needs tags off +// while every other lane keeps them. These tests pin the forwarded bytes: +// the matching route decides, a non-matching route falls back to the global +// diagnostics flag, and ACP_RENDER_NONE still wins over both. +// (Harness copied from issue2483-render-strategy.test.ts.) +// +// Original header — #2483: the effective render strategy had two consistency holes: +// (a) the processTurn diag line hardcoded renderTags=text-only even when +// renderNone was active (misleading log); +// (b) the Google lane ignored renderNone entirely — hardcoded "text-only" in +// processTurn / Prepared / countTokens and no knob check on the #1881 +// tagsOnly gate, so ACP_RENDER_NONE was dead config on /v1beta. +// These e2e tests pin the WIRE bytes on both lanes: the default still tags +// assistant/model text (no behavior drift), and under ACP_RENDER_NONE=1 the +// forwarded assistant/model text is byte-identical to the client's and the +// NEVER-echo prompt section disappears (the tagsOnly gate follows the strategy). + +function close(server: http.Server): Promise { + return new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve())); +} + +async function freePort(): Promise { + const server = http.createServer(); + server.listen(0, "127.0.0.1"); + await once(server, "listening"); + const port = (server.address() as { port: number }).port; + await close(server); + return port; +} + +function upstreamServer(onBody: (path: string, body: unknown) => void): Promise { + const server = http.createServer((req, res) => { + const chunks: Buffer[] = []; + req.on("data", (c: Buffer) => chunks.push(c)); + req.on("end", () => { + let parsed: unknown = null; + try { parsed = JSON.parse(Buffer.concat(chunks).toString("utf8")); } catch { /* ignore */ } + const url = req.url ?? ""; + onBody(url, parsed); + res.writeHead(200, { "content-type": "application/json" }); + if (url.includes(":generateContent")) { + res.end(JSON.stringify({ + candidates: [{ content: { role: "model", parts: [{ text: "ok" }] }, finishReason: "STOP" }], + usageMetadata: { promptTokenCount: 10, candidatesTokenCount: 5, totalTokenCount: 15 }, + })); + return; + } + res.end(JSON.stringify({ + id: "chatcmpl-test", object: "chat.completion", created: 0, model: "test", + choices: [{ index: 0, message: { role: "assistant", content: "ok" }, finish_reason: "stop" }], + usage: { prompt_tokens: 10, completion_tokens: 5, total_tokens: 15 }, + })); + }); + }); + return new Promise((resolve) => server.listen(0, "127.0.0.1", () => resolve(server))); +} + +interface Harness { port: number; stop: () => Promise; cleanup: () => void } + +async function startProxy(upstream: http.Server, fileConfig: (upstreamUrl: string) => unknown): Promise { + _setStoreForTest(new SessionStore({ enabled: false })); + setRegistryForTest({}); + const root = path.join(tmpdir(), `bili-2483-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`); + const biliConfig = path.join(root, "billion-context.json"); + mkdirSync(root, { recursive: true }); + const previous = process.env.BILI_CONFIG_FILE; + process.env.BILI_CONFIG_FILE = biliConfig; + delete process.env.ACP_RENDER_NONE; + delete process.env.ACP_NO_COMPRESS_PROMPT; + const upstreamPort = (upstream.address() as { port: number }).port; + writeFileSync(biliConfig, JSON.stringify(fileConfig(`http://127.0.0.1:${upstreamPort}`)), "utf8"); + const port = await freePort(); + const opts: ProxyOptions = { + port, + host: "127.0.0.1", + upstream: `http://127.0.0.1:${upstreamPort}`, + routes: loadRoutes(), + proxy: "", + proxyMode: "direct", + proxySource: "direct", + modelContextLimit: 400_000, + kernelConfig: defaultConfig(400_000), + compress: { injectTool: false, injectNudge: false }, + promptCache: { routing: "auto" }, + sessionHeader: "x-acp-session", + log: false, + debug: false, + passthrough: false, + chainContentDetection: false, + passthroughSource: null, + compat: { roles: {} }, + streamErrorShape: "protocol", + autoRestartOnUpdate: false, + updateTag: "latest", + advisoryCheck: false, + releaseNotesCheck: false, + autoUpdate: false, + mitm: { enabled: false, domains: [] }, + }; + const proxy = await startServer(opts); + if (!proxy.listening) await once(proxy, "listening"); + return { + port, + stop: async () => { await close(proxy); }, + cleanup: () => { + delete process.env.ACP_RENDER_NONE; + if (previous === undefined) delete process.env.BILI_CONFIG_FILE; else process.env.BILI_CONFIG_FILE = previous; + rmSync(root, { recursive: true, force: true }); + }, + }; +} + +const CHAT_BODY = JSON.stringify({ + model: "test", + max_tokens: 1000, + messages: [ + { role: "system", content: "You are helpful." }, + { role: "user", content: "hello" }, + { role: "assistant", content: "hi there" }, + { role: "user", content: "what did we say?" }, + ], +}); + + +type Msg = { role?: string; content?: unknown }; + +function chatAssistantText(fwd: Record): string { + const msgs = fwd.messages as Msg[] | undefined; + assert.ok(Array.isArray(msgs), "forwarded body carries messages"); + const a = msgs.find((m) => m.role === "assistant"); + assert.ok(a, "the assistant message reaches the upstream"); + return typeof a.content === "string" ? a.content : JSON.stringify(a.content); +} + +function chatSystemText(fwd: Record): string { + const msgs = fwd.messages as Msg[] | undefined; + assert.ok(Array.isArray(msgs), "forwarded body carries messages"); + const sys = msgs.find((m) => m.role === "system"); + assert.ok(sys, "a system message reaches the upstream"); + return typeof sys.content === "string" ? sys.content : JSON.stringify(sys.content); +} + +async function sendChat(upstreamOf: (p: string, b: unknown) => void, cfg: (u: string) => unknown, sid: string, env?: string): Promise> { + const seen: Array> = []; + const upstream = await upstreamServer((p, body) => { upstreamOf(p, body); seen.push(body as Record); }); + const harness = await startProxy(upstream, cfg); + if (env !== undefined) process.env.ACP_RENDER_NONE = env; + try { + const res = await fetch(`http://127.0.0.1:${harness.port}/v1/chat/completions`, { + method: "POST", + headers: { "content-type": "application/json", "x-session-id": sid }, + body: CHAT_BODY, + }); + assert.equal(res.status, 200); + assert.equal(seen.length, 1); + return seen[0]!; + } finally { + await harness.stop(); + harness.cleanup(); + await close(upstream); + } +} + +const noop = () => {}; + +test("#2483 route renderNone=true: matching route forwards assistant text untagged", async () => { + const fwd = await sendChat(noop, (u) => ({ providers: { [u]: { renderNone: true } } }), "route-render-none-on"); + assert.equal(chatAssistantText(fwd), "hi there", "assistant text is byte-identical to the client's"); + assert.ok(!chatSystemText(fwd).includes("NEVER echo"), "tags-only prohibition follows the route strategy"); +}); + +test("#2483 route renderNone=false overrides a global diagnostics.renderNone=true", async () => { + const fwd = await sendChat(noop, (u) => ({ diagnostics: { renderNone: true }, providers: { [u]: { renderNone: false } } }), "route-render-none-off"); + assert.ok(chatAssistantText(fwd).startsWith(" { + const fwd = await sendChat(noop, (u) => ({ providers: { [`${u}/other-lane`]: { renderNone: true } } }), "route-render-none-other"); + assert.ok(chatAssistantText(fwd).startsWith(" { + const fwd = await sendChat(noop, (u) => ({ providers: { [u]: { renderNone: false } } }), "route-render-none-env", "1"); + assert.equal(chatAssistantText(fwd), "hi there", "env switch outranks the route"); +}); diff --git a/website/config-reference/providers.yaml b/website/config-reference/providers.yaml index d88e1b83d2..8527024049 100644 --- a/website/config-reference/providers.yaml +++ b/website/config-reference/providers.yaml @@ -118,6 +118,17 @@ entries: desc_ja: "セッション状態なしのルートスコープのバイト単位リレー — 不正防止アップストリーム向け。" site_en: "Route-scoped byte-for-byte relay with no session state — for anti-fraud upstreams." site_zh: "路由级逐字节透传、无会话状态——面向反作弊上游。" + - key: renderNone + type: boolean + default: "unset (follows diagnostics.renderNone)" + group: providers + id: cr.rn + render: route-row + desc_en: "Route-scoped render tags: true renders no ACP tags into this route's history, false forces them on (#2483)." + desc_zh: "路由级渲染标记:true 时本路由历史不渲染 ACP 标签,false 强制开启(#2483)。" + desc_ja: "ルートスコープのレンダータグ:true でこのルートの履歴に ACP タグを描画せず、false で強制的に有効化(#2483)。" + site_en: "Route-scoped render tags (#2483): true renders no ACP tags into this route's history — for stateful claude-code relays such as magpie, which validate the echoed history against their own transcript — false forces them on; unset follows diagnostics.renderNone. ACP_RENDER_NONE still wins." + site_zh: "路由级渲染标记(#2483):true 时本路由历史不渲染 ACP 标签——面向 magpie 这类会把回传历史与自身 transcript 比对的有状态 claude-code 中继;false 强制开启;不设则跟随 diagnostics.renderNone。ACP_RENDER_NONE 仍然优先。" - key: imageBilling type: "\"auto\" | \"pixels\" | \"bytes\"" default: "auto (→ pixels)" diff --git a/website/docs/index.html b/website/docs/index.html index 4b1172324e..f55f9c8e54 100644 --- a/website/docs/index.html +++ b/website/docs/index.html @@ -245,6 +245,7 @@

providers — route table fields

compat{ roles?, dropFields? }{ roles?, dropFields? } — remap roles the upstream rejects (e.g. developer→system); provider entries beat the global block per key; dropFields strips fields strict schemas reject (additive union). directbooleanClient-side exemption: traffic for this upstream is never pointed at bili at all — unlike passthrough, it does not even terminate there. passthroughbooleanRoute-scoped byte-for-byte relay with no session state — for anti-fraud upstreams. + renderNonebooleanRoute-scoped render tags (#2483): true renders no ACP tags into this route's history — for stateful claude-code relays such as magpie, which validate the echoed history against their own transcript — false forces them on; unset follows diagnostics.renderNone. ACP_RENDER_NONE still wins. imageBilling"auto" | "pixels" | "bytes"Image-token counting basis for this route: auto (→ pixels), pixels, or bytes (explicit opt-in for byte relays). imageTokenCapnumberPer-image token cost cap for this route; unset = uncapped. resignscheme → { enabled?, passthrough?, credentialRef? }Per-route overrides of the global resign map (level 2, deepest wins). diff --git a/website/main.js b/website/main.js index 19461eee64..ce841299c4 100644 --- a/website/main.js +++ b/website/main.js @@ -112,6 +112,7 @@ "cr.compat": "{ roles?, dropFields? } — remap roles the upstream rejects (e.g. developer→system); provider entries beat the global block per key; dropFields strips fields strict schemas reject (additive union).", "cr.direct": "Client-side exemption: traffic for this upstream is never pointed at bili at all — unlike passthrough, it does not even terminate there.", "cr.pt": "Route-scoped byte-for-byte relay with no session state — for anti-fraud upstreams.", + "cr.rn": "Route-scoped render tags (#2483): true renders no ACP tags into this route's history — for stateful claude-code relays such as magpie, which validate the echoed history against their own transcript — false forces them on; unset follows diagnostics.renderNone. ACP_RENDER_NONE still wins.", "cr.ib": "Image-token counting basis for this route: auto (→ pixels), pixels, or bytes (explicit opt-in for byte relays).", "cr.itc": "Per-image token cost cap for this route; unset = uncapped.", "cr.resign": "Per-route overrides of the global resign map (level 2, deepest wins).", @@ -370,6 +371,7 @@ "cr.compat": "{ roles?, dropFields? } —— 重写上游拒收的角色(如 developer→system);provider 条目按键级覆盖全局;dropFields 剔除严格 schema 拒收的字段(加法并集)。", "cr.direct": "客户端侧豁免:该上游流量完全不指向 bili——与 passthrough 不同,连终结都不经过它。", "cr.pt": "路由级逐字节透传、无会话状态——面向反作弊上游。", + "cr.rn": "路由级渲染标记(#2483):true 时本路由历史不渲染 ACP 标签——面向 magpie 这类会把回传历史与自身 transcript 比对的有状态 claude-code 中继;false 强制开启;不设则跟随 diagnostics.renderNone。ACP_RENDER_NONE 仍然优先。", "cr.ib": "本路由图片 token 计费口径:auto(默认→pixels)、pixels 或 bytes(字节中继需显式指定)。", "cr.itc": "本路由单张图片 token 成本上限;未设置 = 不限制。", "cr.resign": "按路由覆盖全局 resign 映射(第 2 级,最深层胜出)。",