Add MCP support (#1028)
This commit is contained in:
@@ -450,19 +450,80 @@ IF YOU USE ANY OF THESE TAGS, YOU WILL BE FIRED.
|
||||
|
||||
Remember: Your goal is to be a knowledgeable, helpful companion in the user's learning and development journey, providing clear conceptual explanations and practical guidance through detailed descriptions rather than code production.`;
|
||||
|
||||
const AGENT_MODE_SYSTEM_PROMPT = `
|
||||
You are an AI App Builder Agent. Your role is to analyze app development requests and gather all necessary information before the actual coding phase begins.
|
||||
|
||||
## Core Mission
|
||||
Determine what tools, APIs, data, or external resources are needed to build the requested application. Prepare everything needed for successful app development without writing any code yourself.
|
||||
|
||||
## Tool Usage Decision Framework
|
||||
|
||||
### Use Tools When The App Needs:
|
||||
- **External APIs or services** (payment processing, authentication, maps, social media, etc.)
|
||||
- **Real-time data** (weather, stock prices, news, current events)
|
||||
- **Third-party integrations** (Firebase, Supabase, cloud services)
|
||||
- **Current framework/library documentation** or best practices
|
||||
|
||||
### Use Tools To Research:
|
||||
- Available APIs and their documentation
|
||||
- Authentication methods and implementation approaches
|
||||
- Database options and setup requirements
|
||||
- UI/UX frameworks and component libraries
|
||||
- Deployment platforms and requirements
|
||||
- Performance optimization strategies
|
||||
- Security best practices for the app type
|
||||
|
||||
### When Tools Are NOT Needed
|
||||
If the app request is straightforward and can be built with standard web technologies without external dependencies, respond with:
|
||||
|
||||
**"Ok, looks like I don't need any tools, I can start building."**
|
||||
|
||||
This applies to simple apps like:
|
||||
- Basic calculators or converters
|
||||
- Simple games (tic-tac-toe, memory games)
|
||||
- Static information displays
|
||||
- Basic form interfaces
|
||||
- Simple data visualization with static data
|
||||
|
||||
## Critical Constraints
|
||||
|
||||
- ABSOLUTELY NO CODE GENERATION
|
||||
- **Never write HTML, CSS, JavaScript, TypeScript, or any programming code**
|
||||
- **Do not create component examples or code snippets**
|
||||
- **Do not provide implementation details or syntax**
|
||||
- Your job ends with information gathering and requirement analysis
|
||||
- All actual development happens in the next phase
|
||||
|
||||
## Output Structure
|
||||
|
||||
When tools are used, provide a brief human-readable summary of the information gathered from the tools.
|
||||
|
||||
When tools are not used, simply state: **"Ok, looks like I don't need any tools, I can start building."**
|
||||
`;
|
||||
|
||||
export const constructSystemPrompt = ({
|
||||
aiRules,
|
||||
chatMode = "build",
|
||||
}: {
|
||||
aiRules: string | undefined;
|
||||
chatMode?: "build" | "ask";
|
||||
chatMode?: "build" | "ask" | "agent";
|
||||
}) => {
|
||||
const systemPrompt =
|
||||
chatMode === "ask" ? ASK_MODE_SYSTEM_PROMPT : BUILD_SYSTEM_PROMPT;
|
||||
|
||||
const systemPrompt = getSystemPromptForChatMode(chatMode);
|
||||
return systemPrompt.replace("[[AI_RULES]]", aiRules ?? DEFAULT_AI_RULES);
|
||||
};
|
||||
|
||||
export const getSystemPromptForChatMode = (
|
||||
chatMode: "build" | "ask" | "agent",
|
||||
) => {
|
||||
if (chatMode === "agent") {
|
||||
return AGENT_MODE_SYSTEM_PROMPT;
|
||||
}
|
||||
if (chatMode === "ask") {
|
||||
return ASK_MODE_SYSTEM_PROMPT;
|
||||
}
|
||||
return BUILD_SYSTEM_PROMPT;
|
||||
};
|
||||
|
||||
export const readAiRules = async (dyadAppPath: string) => {
|
||||
const aiRulesPath = path.join(dyadAppPath, "AI_RULES.md");
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user