fix: remove internal Anthropic tooling from external build (#345)
Remove debug systems, employee detection, and internal logging that have no function in a community fork. Changes: - Remove logPermissionContextForAnts import and calls (main.tsx, compact.ts) Reads Kubernetes namespace and container IDs from internal infra paths. Dead code for all external users. - Remove createDumpPromptsFetch import and gate (query.ts) Internal prompt dump system for employee debugging. Replace gate with unconditional undefined — normal fetch always used. - Remove stripSignatureBlocks ant-only block (query.ts) Was behind USER_TYPE === 'ant' guard, never ran for external users. - Hardcode isAnt: false (query/config.ts) Employee detection flag has no place in a community fork. config.gates.isAnt had exactly one consumer (dumpPromptsFetch, now removed). - Gut logClassifierResultForAnts body (bashPermissions.ts) Replace with empty no-op. Still called from 4 sites, zero execution. Remove ANT-ONLY comments describing internal security model. - Gate status.anthropic.com behind firstParty check (errors.ts) 429 error hint now only shown when using Anthropic directly. Third-party provider users see a generic capacity message. Build: passes Typecheck: clean (no new errors) Tests: 196 pass, same 6 pre-existing failures unrelated to these changes
This commit is contained in:
13
src/query.ts
13
src/query.ts
@@ -52,7 +52,6 @@ import {
|
||||
getMessagesAfterCompactBoundary,
|
||||
createToolUseSummaryMessage,
|
||||
createMicrocompactBoundaryMessage,
|
||||
stripSignatureBlocks,
|
||||
} from './utils/messages.js'
|
||||
import { generateToolUseSummary } from './services/toolUseSummary/toolUseSummaryGenerator.js'
|
||||
import { prependUserContext, appendSystemContext } from './utils/api.js'
|
||||
@@ -92,7 +91,6 @@ import { SLEEP_TOOL_NAME } from './tools/SleepTool/prompt.js'
|
||||
import { executePostSamplingHooks } from './utils/hooks/postSamplingHooks.js'
|
||||
import { executeStopFailureHooks } from './utils/hooks.js'
|
||||
import type { QuerySource } from './constants/querySource.js'
|
||||
import { createDumpPromptsFetch } from './services/api/dumpPrompts.js'
|
||||
import { StreamingToolExecutor } from './services/tools/StreamingToolExecutor.js'
|
||||
import { queryCheckpoint } from './utils/queryProfiler.js'
|
||||
import { runTools } from './services/tools/toolOrchestration.js'
|
||||
@@ -587,13 +585,7 @@ async function* queryLoop(
|
||||
|
||||
// Create fetch wrapper once per query session to avoid memory retention.
|
||||
// Each call to createDumpPromptsFetch creates a closure that captures the request body.
|
||||
// Creating it once means only the latest request body is retained (~700KB),
|
||||
// instead of all request bodies from the session (~500MB for long sessions).
|
||||
// Note: agentId is effectively constant during a query() call - it only changes
|
||||
// between queries (e.g., /clear command or session resume).
|
||||
const dumpPromptsFetch = config.gates.isAnt
|
||||
? createDumpPromptsFetch(toolUseContext.agentId ?? config.sessionId)
|
||||
: undefined
|
||||
const dumpPromptsFetch = undefined
|
||||
|
||||
// Block if we've hit the hard blocking limit (only applies when auto-compact is OFF)
|
||||
// This reserves space so users can still run /compact manually
|
||||
@@ -931,9 +923,6 @@ async function* queryLoop(
|
||||
// Thinking signatures are model-bound: replaying a protected-thinking
|
||||
// block (e.g. capybara) to an unprotected fallback (e.g. opus) 400s.
|
||||
// Strip before retry so the fallback model gets clean history.
|
||||
if (process.env.USER_TYPE === 'ant') {
|
||||
messagesForQuery = stripSignatureBlocks(messagesForQuery)
|
||||
}
|
||||
|
||||
// Log the fallback event
|
||||
logEvent('tengu_model_fallback_triggered', {
|
||||
|
||||
Reference in New Issue
Block a user