feat: v2.12.0 - UI/UX Refinement (Model Sync & Premium Tooltips)
This commit is contained in:
+7
-97
@@ -3,103 +3,7 @@ import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export const EXCLUDED_DIRS = new Set([
|
||||
'node_modules', '.git', '.vscode', 'out', 'dist', 'build',
|
||||
'.next', '.cache', '__pycache__', '.DS_Store', 'coverage',
|
||||
'.turbo', '.nuxt', '.output', 'vendor', 'target'
|
||||
]);
|
||||
|
||||
// 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: activeBrain.localBrainPath,
|
||||
secondBrainRepo: activeBrain.secondBrainRepo || '',
|
||||
brainProfiles: profiles,
|
||||
activeBrainId: activeBrain.id,
|
||||
maxContextSize: cfg.get<number>('maxContextSize', 12000),
|
||||
maxAutoSteps: cfg.get<number>('maxAutoSteps', 50)
|
||||
};
|
||||
}
|
||||
import { getConfig, BrainProfile, EXCLUDED_DIRS } from './config';
|
||||
|
||||
export type EngineKind = 'lmstudio' | 'ollama';
|
||||
|
||||
@@ -243,6 +147,12 @@ Core behavior:
|
||||
- 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.
|
||||
- ALWAYS explain your thought process using the <rationale> tag BEFORE performing any actions. Use the following structure:
|
||||
<rationale>
|
||||
[PROBLEM] Description of the issue or need found in the context.
|
||||
[GOAL] What you intend to achieve with your proposed changes.
|
||||
[REASONING] Detailed logical basis for choosing specific actions or architecture.
|
||||
</rationale>
|
||||
|
||||
Available action tags:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user