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
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { getSessionId } from '../bootstrap/state.js'
|
|
import { checkStatsigFeatureGate_CACHED_MAY_BE_STALE } from '../services/analytics/growthbook.js'
|
|
import type { SessionId } from '../types/ids.js'
|
|
import { isEnvTruthy } from '../utils/envUtils.js'
|
|
|
|
// -- config
|
|
|
|
// Immutable values snapshotted once at query() entry. Separating these from
|
|
// the per-iteration State struct and the mutable ToolUseContext makes future
|
|
// step() extraction tractable — a pure reducer can take (state, event, config)
|
|
// where config is plain data.
|
|
//
|
|
// Intentionally excludes feature() gates — those are tree-shaking boundaries
|
|
// and must stay inline at the guarded blocks for dead-code elimination.
|
|
export type QueryConfig = {
|
|
sessionId: SessionId
|
|
|
|
// Runtime gates (env/statsig). NOT feature() gates — see above.
|
|
gates: {
|
|
// Statsig — CACHED_MAY_BE_STALE already admits staleness, so snapshotting
|
|
// once per query() call stays within the existing contract.
|
|
streamingToolExecution: boolean
|
|
emitToolUseSummaries: boolean
|
|
isAnt: boolean
|
|
fastModeEnabled: boolean
|
|
}
|
|
}
|
|
|
|
export function buildQueryConfig(): QueryConfig {
|
|
return {
|
|
sessionId: getSessionId(),
|
|
gates: {
|
|
streamingToolExecution: checkStatsigFeatureGate_CACHED_MAY_BE_STALE(
|
|
'tengu_streaming_tool_execution2',
|
|
),
|
|
emitToolUseSummaries: isEnvTruthy(
|
|
process.env.CLAUDE_CODE_EMIT_TOOL_USE_SUMMARIES,
|
|
),
|
|
isAnt: false,
|
|
// Inlined from fastMode.ts to avoid pulling its heavy module graph
|
|
// (axios, settings, auth, model, oauth, config) into test shards that
|
|
// didn't previously load it — changes init order and breaks unrelated tests.
|
|
fastModeEnabled: !isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_FAST_MODE),
|
|
},
|
|
}
|
|
}
|