feat: 移除反蒸馏代码
This commit is contained in:
parent
5ee49fd106
commit
c252294dd7
12
DEV-LOG.md
12
DEV-LOG.md
@ -1,5 +1,17 @@
|
||||
# DEV-LOG
|
||||
|
||||
## 移除反蒸馏机制 (2026-04-02)
|
||||
|
||||
项目中发现三处 anti-distillation 相关代码,全部移除。
|
||||
|
||||
**移除内容:**
|
||||
- `src/services/api/claude.ts` — 删除 fake_tools 注入逻辑(原第 302-314 行),该代码通过 `ANTI_DISTILLATION_CC` feature flag 在 API 请求中注入 `anti_distillation: ['fake_tools']`,使服务端在响应中混入虚假工具调用以污染蒸馏数据
|
||||
- `src/utils/betas.ts` — 删除 connector-text summarization beta 注入块及 `SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER` 导入,该机制让服务端缓冲工具调用间的 assistant 文本并摘要化返回
|
||||
- `src/constants/betas.ts` — 删除 `SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER` 常量定义(原第 23-25 行)
|
||||
- `src/utils/streamlinedTransform.ts` — 注释从 "distillation-resistant" 改为 "compact",streamlined 模式本身是有效的输出压缩功能,仅修正描述
|
||||
|
||||
---
|
||||
|
||||
## Buddy 命令合入 + Feature Flag 规范修正 (2026-04-02)
|
||||
|
||||
合入 `pr/smallflyingpig/36` 分支(支持 buddy 命令 + 修复 rehatch),并修正 feature flag 使用方式。
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
- [x] Buddy 小宠物回来啦
|
||||
- [x] Auto Mode 回归
|
||||
- [x] 所有 Feature 现在可以通过环境变量配置, 而不是垃圾的 bun --feature
|
||||
- [x] 移除牢 A 的反蒸馏代码!!!
|
||||
- [ ] V5 大规模重构石山代码, 全面模块分包
|
||||
- [ ] V5 将会为全新分支, 届时 main 分支将会封存为历史版本
|
||||
|
||||
|
||||
@ -20,9 +20,6 @@ export const FAST_MODE_BETA_HEADER = 'fast-mode-2026-02-01'
|
||||
export const REDACT_THINKING_BETA_HEADER = 'redact-thinking-2026-02-12'
|
||||
export const TOKEN_EFFICIENT_TOOLS_BETA_HEADER =
|
||||
'token-efficient-tools-2026-03-28'
|
||||
export const SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER = feature('CONNECTOR_TEXT')
|
||||
? 'summarize-connector-text-2026-03-13'
|
||||
: ''
|
||||
export const AFK_MODE_BETA_HEADER = feature('TRANSCRIPT_CLASSIFIER')
|
||||
? 'afk-mode-2026-01-31'
|
||||
: ''
|
||||
|
||||
@ -299,20 +299,6 @@ export function getExtraBodyParams(betaHeaders?: string[]): JsonObject {
|
||||
}
|
||||
}
|
||||
|
||||
// Anti-distillation: send fake_tools opt-in for 1P CLI only
|
||||
if (
|
||||
feature('ANTI_DISTILLATION_CC')
|
||||
? process.env.CLAUDE_CODE_ENTRYPOINT === 'cli' &&
|
||||
shouldIncludeFirstPartyOnlyBetas() &&
|
||||
getFeatureValue_CACHED_MAY_BE_STALE(
|
||||
'tengu_anti_distill_fake_tool_injection',
|
||||
false,
|
||||
)
|
||||
: false
|
||||
) {
|
||||
result.anti_distillation = ['fake_tools']
|
||||
}
|
||||
|
||||
// Handle beta headers if provided
|
||||
if (betaHeaders && betaHeaders.length > 0) {
|
||||
if (result.anthropic_beta && Array.isArray(result.anthropic_beta)) {
|
||||
|
||||
@ -15,7 +15,6 @@ import {
|
||||
PROMPT_CACHING_SCOPE_BETA_HEADER,
|
||||
REDACT_THINKING_BETA_HEADER,
|
||||
STRUCTURED_OUTPUTS_BETA_HEADER,
|
||||
SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER,
|
||||
TOKEN_EFFICIENT_TOOLS_BETA_HEADER,
|
||||
TOOL_SEARCH_BETA_HEADER_1P,
|
||||
TOOL_SEARCH_BETA_HEADER_3P,
|
||||
@ -276,27 +275,6 @@ export const getAllModelBetas = memoize((model: string): string[] => {
|
||||
betaHeaders.push(REDACT_THINKING_BETA_HEADER)
|
||||
}
|
||||
|
||||
// POC: server-side connector-text summarization (anti-distillation). The
|
||||
// API buffers assistant text between tool calls, summarizes it, and returns
|
||||
// the summary with a signature so the original can be restored on subsequent
|
||||
// turns — same mechanism as thinking blocks. Ant-only while we measure
|
||||
// TTFT/TTLT/capacity; betas already flow to tengu_api_success for splitting.
|
||||
// Backend independently requires Capability.ANTHROPIC_INTERNAL_RESEARCH.
|
||||
//
|
||||
// USE_CONNECTOR_TEXT_SUMMARIZATION is tri-state: =1 forces on (opt-in even
|
||||
// if GB is off), =0 forces off (opt-out of a GB rollout you were bucketed
|
||||
// into), unset defers to GB.
|
||||
if (
|
||||
SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER &&
|
||||
process.env.USER_TYPE === 'ant' &&
|
||||
includeFirstPartyOnlyBetas &&
|
||||
!isEnvDefinedFalsy(process.env.USE_CONNECTOR_TEXT_SUMMARIZATION) &&
|
||||
(isEnvTruthy(process.env.USE_CONNECTOR_TEXT_SUMMARIZATION) ||
|
||||
getFeatureValue_CACHED_MAY_BE_STALE('tengu_slate_prism', false))
|
||||
) {
|
||||
betaHeaders.push(SUMMARIZE_CONNECTOR_TEXT_BETA_HEADER)
|
||||
}
|
||||
|
||||
// Add context management beta for tool clearing (ant opt-in) or thinking preservation
|
||||
const antOptedIntoToolClearing =
|
||||
isEnvTruthy(process.env.USE_API_CONTEXT_MANAGEMENT) &&
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Transforms SDK messages for streamlined output mode.
|
||||
*
|
||||
* Streamlined mode is a "distillation-resistant" output format that:
|
||||
* Streamlined mode is a compact output format that:
|
||||
* - Keeps text messages intact
|
||||
* - Summarizes tool calls with cumulative counts (resets when text appears)
|
||||
* - Omits thinking content
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user