2025-07-22 19:59:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @license
|
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
import { Box, Text } from 'ink';
|
|
|
|
|
|
import { Colors } from '../colors.js';
|
2025-07-23 00:27:14 +08:00
|
|
|
|
import {
|
|
|
|
|
|
shortenPath,
|
|
|
|
|
|
tildeifyPath,
|
|
|
|
|
|
tokenLimit,
|
|
|
|
|
|
} from '@qwen-code/qwen-code-core';
|
2025-07-22 19:59:07 +08:00
|
|
|
|
import { ConsoleSummaryDisplay } from './ConsoleSummaryDisplay.js';
|
|
|
|
|
|
import process from 'node:process';
|
|
|
|
|
|
import Gradient from 'ink-gradient';
|
|
|
|
|
|
import { MemoryUsageDisplay } from './MemoryUsageDisplay.js';
|
|
|
|
|
|
|
2025-07-30 17:43:11 -07:00
|
|
|
|
import { DebugProfiler } from './DebugProfiler.js';
|
|
|
|
|
|
|
2025-07-22 19:59:07 +08:00
|
|
|
|
interface FooterProps {
|
|
|
|
|
|
model: string;
|
|
|
|
|
|
targetDir: string;
|
|
|
|
|
|
branchName?: string;
|
|
|
|
|
|
debugMode: boolean;
|
|
|
|
|
|
debugMessage: string;
|
|
|
|
|
|
corgiMode: boolean;
|
|
|
|
|
|
errorCount: number;
|
|
|
|
|
|
showErrorDetails: boolean;
|
|
|
|
|
|
showMemoryUsage?: boolean;
|
|
|
|
|
|
promptTokenCount: number;
|
|
|
|
|
|
nightly: boolean;
|
2025-07-25 15:36:42 -07:00
|
|
|
|
vimMode?: string;
|
2025-07-22 19:59:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const Footer: React.FC<FooterProps> = ({
|
|
|
|
|
|
model,
|
|
|
|
|
|
targetDir,
|
|
|
|
|
|
branchName,
|
|
|
|
|
|
debugMode,
|
|
|
|
|
|
debugMessage,
|
|
|
|
|
|
corgiMode,
|
|
|
|
|
|
errorCount,
|
|
|
|
|
|
showErrorDetails,
|
|
|
|
|
|
showMemoryUsage,
|
|
|
|
|
|
promptTokenCount,
|
|
|
|
|
|
nightly,
|
2025-07-25 15:36:42 -07:00
|
|
|
|
vimMode,
|
2025-07-22 19:59:07 +08:00
|
|
|
|
}) => {
|
|
|
|
|
|
const limit = tokenLimit(model);
|
|
|
|
|
|
const percentage = promptTokenCount / limit;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
2025-07-25 17:36:19 -07:00
|
|
|
|
<Box justifyContent="space-between" width="100%">
|
2025-07-22 19:59:07 +08:00
|
|
|
|
<Box>
|
2025-07-30 17:43:11 -07:00
|
|
|
|
{debugMode && <DebugProfiler />}
|
2025-07-25 15:36:42 -07:00
|
|
|
|
{vimMode && <Text color={Colors.Gray}>[{vimMode}] </Text>}
|
2025-07-22 19:59:07 +08:00
|
|
|
|
{nightly ? (
|
|
|
|
|
|
<Gradient colors={Colors.GradientColors}>
|
|
|
|
|
|
<Text>
|
|
|
|
|
|
{shortenPath(tildeifyPath(targetDir), 70)}
|
|
|
|
|
|
{branchName && <Text> ({branchName}*)</Text>}
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
</Gradient>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<Text color={Colors.LightBlue}>
|
|
|
|
|
|
{shortenPath(tildeifyPath(targetDir), 70)}
|
|
|
|
|
|
{branchName && <Text color={Colors.Gray}> ({branchName}*)</Text>}
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{debugMode && (
|
|
|
|
|
|
<Text color={Colors.AccentRed}>
|
|
|
|
|
|
{' ' + (debugMessage || '--debug')}
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Middle Section: Centered Sandbox Info */}
|
|
|
|
|
|
<Box
|
|
|
|
|
|
flexGrow={1}
|
|
|
|
|
|
alignItems="center"
|
|
|
|
|
|
justifyContent="center"
|
|
|
|
|
|
display="flex"
|
|
|
|
|
|
>
|
|
|
|
|
|
{process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec' ? (
|
|
|
|
|
|
<Text color="green">
|
|
|
|
|
|
{process.env.SANDBOX.replace(/^gemini-(?:cli-)?/, '')}
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
) : process.env.SANDBOX === 'sandbox-exec' ? (
|
|
|
|
|
|
<Text color={Colors.AccentYellow}>
|
2025-07-21 17:54:44 -04:00
|
|
|
|
macOS Seatbelt{' '}
|
2025-07-22 19:59:07 +08:00
|
|
|
|
<Text color={Colors.Gray}>({process.env.SEATBELT_PROFILE})</Text>
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<Text color={Colors.AccentRed}>
|
|
|
|
|
|
no sandbox <Text color={Colors.Gray}>(see /docs)</Text>
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
|
|
{/* Right Section: Gemini Label and Console Summary */}
|
|
|
|
|
|
<Box alignItems="center">
|
|
|
|
|
|
<Text color={Colors.AccentBlue}>
|
|
|
|
|
|
{' '}
|
|
|
|
|
|
{model}{' '}
|
|
|
|
|
|
<Text color={Colors.Gray}>
|
|
|
|
|
|
({((1 - percentage) * 100).toFixed(0)}% context left)
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
{corgiMode && (
|
|
|
|
|
|
<Text>
|
|
|
|
|
|
<Text color={Colors.Gray}>| </Text>
|
|
|
|
|
|
<Text color={Colors.AccentRed}>▼</Text>
|
|
|
|
|
|
<Text color={Colors.Foreground}>(´</Text>
|
|
|
|
|
|
<Text color={Colors.AccentRed}>ᴥ</Text>
|
|
|
|
|
|
<Text color={Colors.Foreground}>`)</Text>
|
|
|
|
|
|
<Text color={Colors.AccentRed}>▼ </Text>
|
|
|
|
|
|
</Text>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{!showErrorDetails && errorCount > 0 && (
|
|
|
|
|
|
<Box>
|
|
|
|
|
|
<Text color={Colors.Gray}>| </Text>
|
|
|
|
|
|
<ConsoleSummaryDisplay errorCount={errorCount} />
|
|
|
|
|
|
</Box>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{showMemoryUsage && <MemoryUsageDisplay />}
|
|
|
|
|
|
</Box>
|
|
|
|
|
|
</Box>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|