fix: 批量修正 external 字面量

This commit is contained in:
claude-code-best
2026-04-02 17:01:39 +08:00
parent 799dacc407
commit ac1f02958c
31 changed files with 97 additions and 100 deletions

View File

@@ -96,7 +96,7 @@ const fullInputSchema = lazySchema(() => {
mode: permissionModeSchema().optional().describe('Permission mode for spawned teammate (e.g., "plan" to require plan approval).')
});
return baseInputSchema().merge(multiAgentInputSchema).extend({
isolation: (("external" as string) === 'ant' ? z.enum(['worktree', 'remote']) : z.enum(['worktree'])).optional().describe(("external" as string) === 'ant' ? 'Isolation mode. "worktree" creates a temporary git worktree so the agent works on an isolated copy of the repo. "remote" launches the agent in a remote CCR environment (always runs in background).' : 'Isolation mode. "worktree" creates a temporary git worktree so the agent works on an isolated copy of the repo.'),
isolation: ((process.env.USER_TYPE) === 'ant' ? z.enum(['worktree', 'remote']) : z.enum(['worktree'])).optional().describe((process.env.USER_TYPE) === 'ant' ? 'Isolation mode. "worktree" creates a temporary git worktree so the agent works on an isolated copy of the repo. "remote" launches the agent in a remote CCR environment (always runs in background).' : 'Isolation mode. "worktree" creates a temporary git worktree so the agent works on an isolated copy of the repo.'),
cwd: z.string().optional().describe('Absolute path to run the agent in. Overrides the working directory for all filesystem and shell operations within this agent. Mutually exclusive with isolation: "worktree".')
});
});
@@ -432,7 +432,7 @@ export const AgentTool = buildTool({
// Remote isolation: delegate to CCR. Gated ant-only — the guard enables
// dead code elimination of the entire block for external builds.
if (("external" as string) === 'ant' && effectiveIsolation === 'remote') {
if ((process.env.USER_TYPE) === 'ant' && effectiveIsolation === 'remote') {
const eligibility = await checkRemoteAgentEligibility();
if (!eligibility.eligible) {
const reasons = (eligibility as { eligible: false; errors: Parameters<typeof formatPreconditionError>[0][] }).errors.map(formatPreconditionError).join('\n');
@@ -522,7 +522,7 @@ export const AgentTool = buildTool({
// Log agent memory loaded event for subagents
if (selectedAgent.memory) {
logEvent('tengu_agent_memory_loaded', {
...(("external" as string) === 'ant' && {
...((process.env.USER_TYPE) === 'ant' && {
agent_type: selectedAgent.agentType as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
}),
scope: selectedAgent.memory as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
@@ -1284,7 +1284,7 @@ export const AgentTool = buildTool({
// Only route through auto mode classifier when in auto mode
// In all other modes, auto-approve sub-agent generation
// Note: "external" === 'ant' guard enables dead code elimination for external builds
if (("external" as string) === 'ant' && appState.toolPermissionContext.mode === 'auto') {
if ((process.env.USER_TYPE) === 'ant' && appState.toolPermissionContext.mode === 'auto') {
return {
behavior: 'passthrough',
message: 'Agent tool requires permission to spawn sub-agents.'