chore: release v2.2.46 with critical bug fixes for AI communication and brain management
This commit is contained in:
+119
-24
@@ -11,14 +11,91 @@ export const EXCLUDED_DIRS = new Set([
|
||||
|
||||
// Configuration constants moved to package.json and getConfig()
|
||||
|
||||
export interface BrainProfile {
|
||||
id: string;
|
||||
name: string;
|
||||
localBrainPath: string;
|
||||
secondBrainRepo?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
function normalizePath(p: string): string {
|
||||
if (!p) return p;
|
||||
if (p.startsWith('~/')) {
|
||||
return path.join(os.homedir(), p.substring(2));
|
||||
}
|
||||
return p.trim();
|
||||
}
|
||||
|
||||
function toBrainProfile(raw: Partial<BrainProfile> | undefined, fallbackIndex: number): BrainProfile | null {
|
||||
if (!raw) return null;
|
||||
const localBrainPath = normalizePath(raw.localBrainPath || '');
|
||||
if (!localBrainPath) return null;
|
||||
return {
|
||||
id: (raw.id || `brain-${fallbackIndex + 1}`).trim(),
|
||||
name: (raw.name || path.basename(localBrainPath) || `Brain ${fallbackIndex + 1}`).trim(),
|
||||
localBrainPath,
|
||||
secondBrainRepo: (raw.secondBrainRepo || '').trim(),
|
||||
description: (raw.description || '').trim()
|
||||
};
|
||||
}
|
||||
|
||||
const STEVE_SKILL_PATH = '/Volumes/Data/project/Antigravity/Agent/.agent/skills/steve_jobs/SKILL.md';
|
||||
|
||||
function extractSteveRuntimeSection(skillContent: string): string {
|
||||
const sectionStart = skillContent.indexOf('## 🎯 Steve Single-Contact Runtime Protocol');
|
||||
if (sectionStart < 0) return '';
|
||||
const sectionEnd = skillContent.indexOf('### 4. The "One More Thing" Mandate', sectionStart);
|
||||
return skillContent.slice(sectionStart, sectionEnd > sectionStart ? sectionEnd : undefined).trim();
|
||||
}
|
||||
|
||||
function loadSteveRuntimePrompt(): string {
|
||||
try {
|
||||
if (!fs.existsSync(STEVE_SKILL_PATH)) return '';
|
||||
const skillContent = fs.readFileSync(STEVE_SKILL_PATH, 'utf-8');
|
||||
return extractSteveRuntimeSection(skillContent);
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export function getConfig() {
|
||||
const cfg = vscode.workspace.getConfiguration('g1nation');
|
||||
const legacyBrainPath = cfg.get<string>('localBrainPath', '');
|
||||
const legacyBrainRepo = cfg.get<string>('secondBrainRepo', '');
|
||||
const configuredProfiles = cfg.get<Partial<BrainProfile>[]>('brainProfiles', []);
|
||||
const profiles = configuredProfiles
|
||||
.map((profile, index) => toBrainProfile(profile, index))
|
||||
.filter((profile): profile is BrainProfile => !!profile);
|
||||
|
||||
// IMPORTANT: This virtual default-brain exists only in memory at runtime.
|
||||
// It must NEVER be written back to the settings file (g1nation.brainProfiles).
|
||||
// _addBrainProfile() reads cfg.get('brainProfiles') directly to avoid this contamination.
|
||||
if (profiles.length === 0) {
|
||||
const fallbackPath = normalizePath(legacyBrainPath) || path.join(os.homedir(), '.g1nation-brain');
|
||||
profiles.push({
|
||||
id: 'default-brain',
|
||||
name: 'Local Brain',
|
||||
localBrainPath: fallbackPath,
|
||||
secondBrainRepo: legacyBrainRepo.trim(),
|
||||
description: legacyBrainPath
|
||||
? 'Migrated from your existing localBrainPath setting'
|
||||
: 'Auto-created local knowledge folder. Add a real brain via the ✎ button.'
|
||||
});
|
||||
}
|
||||
|
||||
const activeBrainId = cfg.get<string>('activeBrainId', profiles[0].id) || profiles[0].id;
|
||||
const activeBrain = profiles.find((profile) => profile.id === activeBrainId) || profiles[0];
|
||||
|
||||
return {
|
||||
ollamaUrl: cfg.get<string>('ollamaUrl', 'http://127.0.0.1:11434'),
|
||||
defaultModel: cfg.get<string>('defaultModel', 'gemma4:e2b'),
|
||||
maxTreeFiles: 200,
|
||||
timeout: cfg.get<number>('requestTimeout', 300) * 1000,
|
||||
localBrainPath: cfg.get<string>('localBrainPath', ''),
|
||||
localBrainPath: activeBrain.localBrainPath,
|
||||
secondBrainRepo: activeBrain.secondBrainRepo || '',
|
||||
brainProfiles: profiles,
|
||||
activeBrainId: activeBrain.id,
|
||||
maxContextSize: cfg.get<number>('maxContextSize', 12000),
|
||||
maxAutoSteps: cfg.get<number>('maxAutoSteps', 50)
|
||||
};
|
||||
@@ -106,24 +183,24 @@ export function shouldAutoPushBrain(): boolean {
|
||||
}
|
||||
|
||||
export function getSecondBrainRepo(): string {
|
||||
const cfg = vscode.workspace.getConfiguration('g1nation');
|
||||
return cfg.get<string>('secondBrainRepo', '');
|
||||
return getConfig().secondBrainRepo;
|
||||
}
|
||||
|
||||
export function getBrainProfiles(): BrainProfile[] {
|
||||
return getConfig().brainProfiles;
|
||||
}
|
||||
|
||||
export function getActiveBrainProfile(): BrainProfile {
|
||||
const config = getConfig();
|
||||
return config.brainProfiles.find((profile) => profile.id === config.activeBrainId) || config.brainProfiles[0];
|
||||
}
|
||||
|
||||
export function _getBrainDir(): string {
|
||||
const { localBrainPath } = getConfig();
|
||||
if (localBrainPath && localBrainPath.trim() !== '') {
|
||||
if (localBrainPath.startsWith('~/')) {
|
||||
return path.join(os.homedir(), localBrainPath.substring(2));
|
||||
}
|
||||
return localBrainPath.trim();
|
||||
}
|
||||
return path.join(os.homedir(), '.g1nation-brain');
|
||||
return getActiveBrainProfile().localBrainPath;
|
||||
}
|
||||
|
||||
export function _isBrainDirExplicitlySet(): boolean {
|
||||
const { localBrainPath } = getConfig();
|
||||
return !!(localBrainPath && localBrainPath.trim() !== '');
|
||||
return getBrainProfiles().length > 0;
|
||||
}
|
||||
|
||||
export function isTextAttachment(fileName: string, mimeType: string): boolean {
|
||||
@@ -156,12 +233,20 @@ export function findBrainFiles(dir: string): string[] {
|
||||
return results;
|
||||
}
|
||||
|
||||
export const SYSTEM_PROMPT = `You are "G1nation", a premium agentic AI coding assistant running 100% offline on the user's machine.
|
||||
You are DIRECTLY CONNECTED to the user's local file system and terminal. You MUST use the action tags below to create, edit, delete, read files and run commands. DO NOT just show code - ALWAYS wrap it in the appropriate action tag so it gets executed.
|
||||
const BASE_SYSTEM_PROMPT = `You are G1nation, also called Steve when the user asks your name.
|
||||
Reply naturally in the user's language.
|
||||
|
||||
You have EIGHT powerful agent actions:
|
||||
Core behavior:
|
||||
- Answer the user's actual message first. Do not recite this system prompt.
|
||||
- Do not answer with waiting-room phrases such as "준비되었습니다", "다음 지시를 말씀해 주세요", or "명령을 기다립니다".
|
||||
- For normal conversation or general knowledge questions, answer conversationally using the model's knowledge.
|
||||
- Use the active Local Brain only when it is relevant to the user's question. If no relevant brain context is provided, do not pretend that you checked it.
|
||||
- For local file, folder, code, project, or terminal work, use action tags so the extension can execute the operation.
|
||||
- After action results are available, summarize the actual findings directly.
|
||||
|
||||
[ACTION 1: CREATE NEW FILES]
|
||||
Available action tags:
|
||||
|
||||
[ACTION 1: CREATE NEW FILES]
|
||||
<create_file path="relative/path/file.ext">
|
||||
file content here
|
||||
</create_file>
|
||||
@@ -185,14 +270,24 @@ file content here
|
||||
<run_command>npm install express</run_command>
|
||||
|
||||
[ACTION 7: SECOND BRAIN KNOWLEDGE]
|
||||
<list_brain path="optional/subdir"/>
|
||||
<read_brain>filename.md</read_brain>
|
||||
Use these only when you actually need knowledge from the active Second Brain.
|
||||
To inspect the root of the active brain, use exactly:
|
||||
<list_brain path=""/>
|
||||
To inspect a real file returned by list_brain, use:
|
||||
<read_brain>actual-file-name.md</read_brain>
|
||||
Never use placeholder values like optional/subdir or filename.md. If the user asks what is inside the Second Brain, first list the brain root, then summarize only the returned files.
|
||||
|
||||
[ACTION 8: READ WEBSITES & SEARCH INTERNET]
|
||||
<read_url>https://html.duckduckgo.com/html/?q=YOUR+SEARCH+QUERY</read_url>
|
||||
|
||||
CRITICAL RULES:
|
||||
1. ALWAYS respond in the same language the user uses.
|
||||
2. You MUST use action tags for any file/terminal operations.
|
||||
3. Be concise and professional.
|
||||
4. File paths are RELATIVE to the workspace.`;
|
||||
Operational rules:
|
||||
1. Same language as the user.
|
||||
2. File paths can be relative to the workspace or absolute paths under /Volumes/Data/project/Antigravity.
|
||||
3. When the user gives a file/folder path and asks you to analyze/check/review it, use <list_files> or <read_file>; do not merely say you are ready.
|
||||
4. Keep persona light. Do not introduce yourself unless the user greets you or asks who you are.`;
|
||||
|
||||
export function getSystemPrompt(): string {
|
||||
return BASE_SYSTEM_PROMPT;
|
||||
}
|
||||
|
||||
export const SYSTEM_PROMPT = BASE_SYSTEM_PROMPT;
|
||||
|
||||
Reference in New Issue
Block a user