Skip to content

Commit c252294

Browse files
feat: 移除反蒸馏代码
1 parent 5ee49fd commit c252294

6 files changed

Lines changed: 14 additions & 40 deletions

File tree

DEV-LOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# DEV-LOG
22

3+
## 移除反蒸馏机制 (2026-04-02)
4+
5+
项目中发现三处 anti-distillation 相关代码,全部移除。
6+
7+
**移除内容:**
8+
- `src/services/api/claude.ts` — 删除 fake_tools 注入逻辑(原第 302-314 行),该代码通过 `ANTI_DISTILLATION_CC` feature flag 在 API 请求中注入 `anti_distillation: ['fake_tools']`,使服务端在响应中混入虚假工具调用以污染蒸馏数据
9+
- `src/utils/betas.ts` — 删除 connector-text summarization beta 注入块及 `SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER` 导入,该机制让服务端缓冲工具调用间的 assistant 文本并摘要化返回
10+
- `src/constants/betas.ts` — 删除 `SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER` 常量定义(原第 23-25 行)
11+
- `src/utils/streamlinedTransform.ts` — 注释从 "distillation-resistant" 改为 "compact",streamlined 模式本身是有效的输出压缩功能,仅修正描述
12+
13+
---
14+
315
## Buddy 命令合入 + Feature Flag 规范修正 (2026-04-02)
416

517
合入 `pr/smallflyingpig/36` 分支(支持 buddy 命令 + 修复 rehatch),并修正 feature flag 使用方式。

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- [x] Buddy 小宠物回来啦
1616
- [x] Auto Mode 回归
1717
- [x] 所有 Feature 现在可以通过环境变量配置, 而不是垃圾的 bun --feature
18+
- [x] 移除牢 A 的反蒸馏代码!!!
1819
- [ ] V5 大规模重构石山代码, 全面模块分包
1920
- [ ] V5 将会为全新分支, 届时 main 分支将会封存为历史版本
2021

src/constants/betas.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ export const FAST_MODE_BETA_HEADER = 'fast-mode-2026-02-01'
2020
export const REDACT_THINKING_BETA_HEADER = 'redact-thinking-2026-02-12'
2121
export const TOKEN_EFFICIENT_TOOLS_BETA_HEADER =
2222
'token-efficient-tools-2026-03-28'
23-
export const SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER = feature('CONNECTOR_TEXT')
24-
? 'summarize-connector-text-2026-03-13'
25-
: ''
2623
export const AFK_MODE_BETA_HEADER = feature('TRANSCRIPT_CLASSIFIER')
2724
? 'afk-mode-2026-01-31'
2825
: ''

src/services/api/claude.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,6 @@ export function getExtraBodyParams(betaHeaders?: string[]): JsonObject {
299299
}
300300
}
301301

302-
// Anti-distillation: send fake_tools opt-in for 1P CLI only
303-
if (
304-
feature('ANTI_DISTILLATION_CC')
305-
? process.env.CLAUDE_CODE_ENTRYPOINT === 'cli' &&
306-
shouldIncludeFirstPartyOnlyBetas() &&
307-
getFeatureValue_CACHED_MAY_BE_STALE(
308-
'tengu_anti_distill_fake_tool_injection',
309-
false,
310-
)
311-
: false
312-
) {
313-
result.anti_distillation = ['fake_tools']
314-
}
315-
316302
// Handle beta headers if provided
317303
if (betaHeaders && betaHeaders.length > 0) {
318304
if (result.anthropic_beta && Array.isArray(result.anthropic_beta)) {

src/utils/betas.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
PROMPT_CACHING_SCOPE_BETA_HEADER,
1616
REDACT_THINKING_BETA_HEADER,
1717
STRUCTURED_OUTPUTS_BETA_HEADER,
18-
SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER,
1918
TOKEN_EFFICIENT_TOOLS_BETA_HEADER,
2019
TOOL_SEARCH_BETA_HEADER_1P,
2120
TOOL_SEARCH_BETA_HEADER_3P,
@@ -276,27 +275,6 @@ export const getAllModelBetas = memoize((model: string): string[] => {
276275
betaHeaders.push(REDACT_THINKING_BETA_HEADER)
277276
}
278277

279-
// POC: server-side connector-text summarization (anti-distillation). The
280-
// API buffers assistant text between tool calls, summarizes it, and returns
281-
// the summary with a signature so the original can be restored on subsequent
282-
// turns — same mechanism as thinking blocks. Ant-only while we measure
283-
// TTFT/TTLT/capacity; betas already flow to tengu_api_success for splitting.
284-
// Backend independently requires Capability.ANTHROPIC_INTERNAL_RESEARCH.
285-
//
286-
// USE_CONNECTOR_TEXT_SUMMARIZATION is tri-state: =1 forces on (opt-in even
287-
// if GB is off), =0 forces off (opt-out of a GB rollout you were bucketed
288-
// into), unset defers to GB.
289-
if (
290-
SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER &&
291-
process.env.USER_TYPE === 'ant' &&
292-
includeFirstPartyOnlyBetas &&
293-
!isEnvDefinedFalsy(process.env.USE_CONNECTOR_TEXT_SUMMARIZATION) &&
294-
(isEnvTruthy(process.env.USE_CONNECTOR_TEXT_SUMMARIZATION) ||
295-
getFeatureValue_CACHED_MAY_BE_STALE('tengu_slate_prism', false))
296-
) {
297-
betaHeaders.push(SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER)
298-
}
299-
300278
// Add context management beta for tool clearing (ant opt-in) or thinking preservation
301279
const antOptedIntoToolClearing =
302280
isEnvTruthy(process.env.USE_API_CONTEXT_MANAGEMENT) &&

src/utils/streamlinedTransform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Transforms SDK messages for streamlined output mode.
33
*
4-
* Streamlined mode is a "distillation-resistant" output format that:
4+
* Streamlined mode is a compact output format that:
55
* - Keeps text messages intact
66
* - Summarizes tool calls with cumulative counts (resets when text appears)
77
* - Omits thinking content

0 commit comments

Comments
 (0)