mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
fix: 批量修正 external 字面量
This commit is contained in:
@@ -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.'
|
||||
|
||||
@@ -99,7 +99,7 @@ type ProcessedMessage = {
|
||||
*/
|
||||
function processProgressMessages(messages: ProgressMessage<Progress>[], tools: Tools, isAgentRunning: boolean): ProcessedMessage[] {
|
||||
// Only process for ants
|
||||
if (("external" as string) !== 'ant') {
|
||||
if ((process.env.USER_TYPE) !== 'ant') {
|
||||
return messages.filter((m): m is ProgressMessage<AgentToolProgress> => hasProgressMessage(m.data) && m.data.message.type !== 'user').map(m => ({
|
||||
type: 'original',
|
||||
message: m
|
||||
@@ -385,7 +385,7 @@ export function renderToolResultMessage(data: Output, progressMessagesForMessage
|
||||
} as import('@anthropic-ai/sdk/resources/beta/messages/messages.mjs').BetaUsage
|
||||
});
|
||||
return <Box flexDirection="column">
|
||||
{("external" as string) === 'ant' && <MessageResponse>
|
||||
{(process.env.USER_TYPE) === 'ant' && <MessageResponse>
|
||||
<Text color="warning">
|
||||
[ANT-ONLY] API calls: {getDisplayPath(getDumpPromptsPath(agentId))}
|
||||
</Text>
|
||||
@@ -591,7 +591,7 @@ export function renderToolUseRejectedMessage(_input: {
|
||||
const firstData = progressMessagesForMessage[0]?.data;
|
||||
const agentId = firstData && hasProgressMessage(firstData) ? firstData.agentId : undefined;
|
||||
return <>
|
||||
{("external" as string) === 'ant' && agentId && <MessageResponse>
|
||||
{(process.env.USER_TYPE) === 'ant' && agentId && <MessageResponse>
|
||||
<Text color="warning">
|
||||
[ANT-ONLY] API calls: {getDisplayPath(getDumpPromptsPath(agentId))}
|
||||
</Text>
|
||||
|
||||
@@ -161,7 +161,7 @@ export const TaskOutputTool: Tool<InputSchema, TaskOutputToolOutput> = buildTool
|
||||
return this.isReadOnly?.(_input) ?? false;
|
||||
},
|
||||
isEnabled() {
|
||||
return ("external" as string) !== 'ant';
|
||||
return (process.env.USER_TYPE) !== 'ant';
|
||||
},
|
||||
isReadOnly(_input) {
|
||||
return true;
|
||||
|
||||
@@ -25,7 +25,7 @@ export function renderToolResultMessage(output: Output, _progressMessagesForMess
|
||||
}: {
|
||||
verbose: boolean;
|
||||
}): React.ReactNode {
|
||||
if (("external" as string) === 'ant') {
|
||||
if ((process.env.USER_TYPE) === 'ant') {
|
||||
return null;
|
||||
}
|
||||
const rawCommand = output.command ?? '';
|
||||
|
||||
Reference in New Issue
Block a user