chore: version up to 2.80.38 and package with refined recovery
This commit is contained in:
+24
-15
@@ -1789,22 +1789,31 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
this._currentSessionBrainId = selectedBrainId;
|
||||
|
||||
let agentSkillContext = undefined;
|
||||
if (agentFile && fs.existsSync(agentFile)) {
|
||||
agentSkillContext = fs.readFileSync(agentFile, 'utf8');
|
||||
|
||||
// Merge in any external skill .md files the user has mapped to this
|
||||
// agent. We concatenate into the same agentSkillContext blob so the
|
||||
// rest of the pipeline (agent.ts, agent-mode override) treats them
|
||||
// identically to the agent's own .md — no further changes needed.
|
||||
try {
|
||||
const entry = getOrCreateAgentEntry(agentFile);
|
||||
const bundle = loadExternalSkills(entry.skillFolders);
|
||||
const block = formatSkillsAsPromptBlock(bundle);
|
||||
if (block) {
|
||||
agentSkillContext = `${agentSkillContext.trim()}\n\n${block}`;
|
||||
if (agentFile && agentFile !== 'none' && fs.existsSync(agentFile)) {
|
||||
const fileContent = fs.readFileSync(agentFile, 'utf8');
|
||||
// Guard: a freshly-created agent still has only the placeholder template
|
||||
// ("# Agent Persona: …\n\nAdd your instructions here…"). Treating that as a real
|
||||
// agent prompt just confuses the model — fall back to normal mode and tell the user.
|
||||
const body = fileContent.replace(/^?#\s*Agent\s*Persona\s*:.*$/im, '').trim();
|
||||
const isPlaceholder = !body || /^add your instructions here/i.test(body);
|
||||
if (isPlaceholder) {
|
||||
logInfo('Selected agent has no real instructions — running without agent mode.', { agentFile });
|
||||
this._view?.webview.postMessage({ type: 'lmStudioError', value: '선택한 에이전트에 내용이 없습니다 — 에이전트 프롬프트를 작성한 뒤 다시 시도하세요. (이번 응답은 에이전트 없이 처리합니다)' });
|
||||
} else {
|
||||
agentSkillContext = fileContent;
|
||||
// Merge in any external skill .md files the user has mapped to this agent. We concatenate
|
||||
// into the same agentSkillContext blob so the rest of the pipeline (agent.ts, agent-mode
|
||||
// override) treats them identically to the agent's own .md — no further changes needed.
|
||||
try {
|
||||
const entry = getOrCreateAgentEntry(agentFile);
|
||||
const bundle = loadExternalSkills(entry.skillFolders);
|
||||
const block = formatSkillsAsPromptBlock(bundle);
|
||||
if (block) {
|
||||
agentSkillContext = `${agentSkillContext.trim()}\n\n${block}`;
|
||||
}
|
||||
} catch (e: any) {
|
||||
logError('External skill load failed.', { error: e?.message || String(e) });
|
||||
}
|
||||
} catch (e: any) {
|
||||
logError('External skill load failed.', { error: e?.message || String(e) });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user