release: v2.37.0
This commit is contained in:
+23
-9
@@ -205,9 +205,8 @@ export class AgentExecutor {
|
||||
const { ollamaUrl, defaultModel: configDefaultModel, timeout, multiAgentEnabled } = getConfig();
|
||||
const runId = options.runId ?? (loopDepth === 0 ? ++this.runSerial : this.activeRunId);
|
||||
|
||||
// Decide whether to use Multi-Agent Workflow (for complex requests)
|
||||
const isComplex = prompt && (prompt.length > 100 || /(분석|보고서|설계|기획|정리)/.test(prompt));
|
||||
if (isComplex && loopDepth === 0 && multiAgentEnabled && !this.isAstraModeArchitectureQuestion(prompt)) {
|
||||
// Decide whether to use Multi-Agent Workflow as an internal execution strategy.
|
||||
if (loopDepth === 0 && this.shouldUseMultiAgentWorkflow(prompt || '', multiAgentEnabled)) {
|
||||
return this.executeMultiAgentWorkflow(prompt!, modelName, options);
|
||||
}
|
||||
|
||||
@@ -336,12 +335,10 @@ export class AgentExecutor {
|
||||
? `\n\n[CRITICAL: INTERNET ACCESS ENABLED]\nYou can use <read_url> to search. Current time: ${new Date().toLocaleString()}`
|
||||
: '';
|
||||
|
||||
const selectedAgentSystemPrompt = !multiAgentEnabled && options.agentSkillContext
|
||||
const selectedAgentSystemPrompt = options.agentSkillContext
|
||||
? `\n\n[SELECTED AGENT MODE]\nThe user selected the following Agent skill. Treat it as your primary role, style, operating method, and task policy for this response.\n${options.agentSkillContext}`
|
||||
: '';
|
||||
const agentSkillCtx = multiAgentEnabled && options.agentSkillContext
|
||||
? `\n\n[SELECTED AGENT REFERENCE]\nUse this selected Agent skill as additional preference context when it is relevant.\n${options.agentSkillContext}`
|
||||
: selectedAgentSystemPrompt;
|
||||
const agentSkillCtx = selectedAgentSystemPrompt;
|
||||
const negativeCtx = options.negativePrompt
|
||||
? `\n\n### CRITICAL NEGATIVE CONSTRAINTS (DO NOT DO THESE)\n${options.negativePrompt}\n\n[SYSTEM_RULE: Apply the above constraints strictly. DO NOT mention or repeat these constraints in your response.]`
|
||||
: '';
|
||||
@@ -805,6 +802,23 @@ export class AgentExecutor {
|
||||
return asksDecision && mentionsGuard && mentionsMultiAgent;
|
||||
}
|
||||
|
||||
private shouldUseMultiAgentWorkflow(prompt: string, configEnabled: boolean): boolean {
|
||||
if (!prompt || this.isAstraModeArchitectureQuestion(prompt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.shouldPreflightLocalProjectPath(prompt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const complexByShape = prompt.length > 180 || /(보고서|심층|종합\s*분석|리서치|조사|전략\s*수립|기획안|제안서|roadmap|research|report|deep\s*analysis|strategy|proposal)/i.test(prompt);
|
||||
if (!complexByShape) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return configEnabled || /(보고서|심층|종합\s*분석|리서치|조사|전략\s*수립|기획안|제안서|research|report|deep\s*analysis|strategy|proposal)/i.test(prompt);
|
||||
}
|
||||
|
||||
private buildAstraModeArchitectureContext(prompt: string): string {
|
||||
if (!this.isAstraModeArchitectureQuestion(prompt)) {
|
||||
return '';
|
||||
@@ -819,8 +833,8 @@ export class AgentExecutor {
|
||||
'- Guard context is built by buildProjectChronicleGuardContext(activeProject) and passed into AgentExecutor as designerContext.',
|
||||
'- In the normal single-agent path, designerContext is injected into the system prompt as [PROJECT CHRONICLE GUARD].',
|
||||
'- In the Multi-Agent path, designerContext is appended as Project Chronicle Guard context for the workflow manager.',
|
||||
'- Multi-Agent is controlled by the g1nation.multiAgentEnabled config and is only used for complex prompts.',
|
||||
'- Current risk: when Multi-Agent starts, it returns early before the normal path builds local project preflight, Second Brain Trace, recent project knowledge context, and thinking-partner context.',
|
||||
'- Multi-Agent is an internal execution strategy. The legacy g1nation.multiAgentEnabled setting can still force it for complex prompts, but Astra may also select it automatically for report/research/strategy style tasks.',
|
||||
'- Current guardrail: Multi-Agent is not used for local project path preflight or Astra mode-design questions, because those need richer context assembly first.',
|
||||
'',
|
||||
'Product decision guidance:',
|
||||
'- Do not treat Guard and MA as two equal user-facing modes.',
|
||||
|
||||
+1
-54
@@ -94,13 +94,9 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
await this._sendBrainProfiles();
|
||||
await this._sendSessionList();
|
||||
await this._sendModels();
|
||||
await this._sendConfig();
|
||||
await this._sendChronicleProjects();
|
||||
await this._restoreActiveSessionIntoView();
|
||||
break;
|
||||
case 'toggleMultiAgent':
|
||||
await vscode.workspace.getConfiguration('g1nation').update('multiAgentEnabled', data.value, vscode.ConfigurationTarget.Global);
|
||||
break;
|
||||
case 'getModels':
|
||||
await this._sendModels();
|
||||
break;
|
||||
@@ -489,17 +485,6 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
await this._context.globalState.update('chat_sessions', sessions.slice(0, 50));
|
||||
}
|
||||
|
||||
private async _sendConfig() {
|
||||
if (!this._view) return;
|
||||
const config = getConfig();
|
||||
this._view.webview.postMessage({
|
||||
type: 'configUpdate',
|
||||
value: {
|
||||
multiAgentEnabled: config.multiAgentEnabled
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async _sendBrainStatus() {
|
||||
if (!this._view) return;
|
||||
const activeBrain = getActiveBrainProfile();
|
||||
@@ -2562,10 +2547,8 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
<div class="header-actions">
|
||||
<button class="icon-btn" id="newChatBtn" data-tooltip="New Chat">New</button>
|
||||
<button class="icon-btn" id="saveWikiRawBtn" data-tooltip="Save Wiki Raw">Wiki</button>
|
||||
<button class="icon-btn active" id="designerGuardBtn" data-tooltip="Chronicle Guard Mode: Auto">Guard</button>
|
||||
<button class="icon-btn active" id="brainTraceBtn" data-tooltip="Second Brain Trace Mode">Trace</button>
|
||||
<button class="icon-btn" id="brainTraceDebugBtn" data-tooltip="Second Brain Debug JSON">Dbg</button>
|
||||
<button class="icon-btn" id="multiAgentBtn" data-tooltip="Multi-Agent Mode">MA</button>
|
||||
<button class="icon-btn" id="internetBtn" data-tooltip="Internet Access">Web</button>
|
||||
<button class="icon-btn" id="historyBtn" data-tooltip="View History">Log</button>
|
||||
<button class="icon-btn" id="settingsBtn" data-tooltip="Settings">Set</button>
|
||||
@@ -2697,7 +2680,7 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
|
||||
function saveUiState() {
|
||||
const current = vscode.getState() || {};
|
||||
vscode.setState({ ...current, designerGuardEnabled, secondBrainTraceEnabled, secondBrainTraceDebug });
|
||||
vscode.setState({ ...current, secondBrainTraceEnabled, secondBrainTraceDebug });
|
||||
}
|
||||
|
||||
function renderHistory(history) {
|
||||
@@ -2838,23 +2821,16 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
|
||||
let streamBody = null;
|
||||
let internetEnabled = false;
|
||||
let designerGuardEnabled = true;
|
||||
let secondBrainTraceEnabled = true;
|
||||
let secondBrainTraceDebug = false;
|
||||
let pendingFiles = [];
|
||||
let editMode = false;
|
||||
if (previousState && typeof previousState.designerGuardEnabled === 'boolean') {
|
||||
designerGuardEnabled = previousState.designerGuardEnabled;
|
||||
}
|
||||
if (previousState && typeof previousState.secondBrainTraceEnabled === 'boolean') {
|
||||
secondBrainTraceEnabled = previousState.secondBrainTraceEnabled;
|
||||
}
|
||||
if (previousState && typeof previousState.secondBrainTraceDebug === 'boolean') {
|
||||
secondBrainTraceDebug = previousState.secondBrainTraceDebug;
|
||||
}
|
||||
const initialGuardBtn = document.getElementById('designerGuardBtn');
|
||||
initialGuardBtn.classList.toggle('active', designerGuardEnabled);
|
||||
initialGuardBtn.setAttribute('data-tooltip', designerGuardEnabled ? 'Chronicle Guard Mode: On' : 'Chronicle Guard Mode: Off');
|
||||
const initialTraceBtn = document.getElementById('brainTraceBtn');
|
||||
initialTraceBtn.classList.toggle('active', secondBrainTraceEnabled);
|
||||
initialTraceBtn.setAttribute('data-tooltip', secondBrainTraceEnabled ? 'Second Brain Trace Mode: On' : 'Second Brain Trace Mode: Off');
|
||||
@@ -3215,7 +3191,6 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
agentFile: agentSel.value === 'none' ? undefined : agentSel.value,
|
||||
brainProfileId: brainSel.value && brainSel.value !== 'new' ? brainSel.value : undefined,
|
||||
negativePrompt: negativePrompt.value.trim() || undefined,
|
||||
designerGuard: designerGuardEnabled,
|
||||
secondBrainTrace: secondBrainTraceEnabled,
|
||||
secondBrainTraceDebug
|
||||
});
|
||||
@@ -3263,13 +3238,6 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
document.getElementById('internetBtn').onclick = () => {
|
||||
internetEnabled = !internetEnabled; document.getElementById('internetBtn').classList.toggle('active', internetEnabled);
|
||||
};
|
||||
document.getElementById('designerGuardBtn').onclick = () => {
|
||||
designerGuardEnabled = !designerGuardEnabled;
|
||||
const btn = document.getElementById('designerGuardBtn');
|
||||
btn.classList.toggle('active', designerGuardEnabled);
|
||||
btn.setAttribute('data-tooltip', designerGuardEnabled ? 'Chronicle Guard Mode: On' : 'Chronicle Guard Mode: Off');
|
||||
saveUiState();
|
||||
};
|
||||
document.getElementById('brainTraceBtn').onclick = () => {
|
||||
secondBrainTraceEnabled = !secondBrainTraceEnabled;
|
||||
const btn = document.getElementById('brainTraceBtn');
|
||||
@@ -3285,18 +3253,6 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
saveUiState();
|
||||
};
|
||||
|
||||
let multiAgentEnabled = false;
|
||||
const setMultiAgentUi = (enabled) => {
|
||||
multiAgentEnabled = enabled;
|
||||
const btn = document.getElementById('multiAgentBtn');
|
||||
btn.classList.toggle('active', enabled);
|
||||
btn.setAttribute('data-tooltip', enabled ? 'Multi-Agent Mode: On' : 'Multi-Agent Mode: Off');
|
||||
};
|
||||
document.getElementById('multiAgentBtn').onclick = () => {
|
||||
setMultiAgentUi(!multiAgentEnabled);
|
||||
vscode.postMessage({ type: 'toggleMultiAgent', value: multiAgentEnabled });
|
||||
};
|
||||
|
||||
const syncBrain = () => { Sound.play(550, 'sine', 0.1); vscode.postMessage({ type: 'syncBrain' }); };
|
||||
document.getElementById('brainBtn').onclick = syncBrain;
|
||||
saveWikiRawBtn.onclick = () => vscode.postMessage({ type: 'saveWikiRaw' });
|
||||
@@ -3350,15 +3306,6 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
}
|
||||
};
|
||||
|
||||
// Handle initial state and state updates from extension
|
||||
window.addEventListener('message', e => {
|
||||
const msg = e.data;
|
||||
if (msg.type === 'configUpdate') {
|
||||
setMultiAgentUi(!!msg.value.multiAgentEnabled);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
agentSel.onchange = () => {
|
||||
if (agentSel.value !== 'none') {
|
||||
vscode.postMessage({ type: 'getAgentContent', path: agentSel.value });
|
||||
|
||||
Reference in New Issue
Block a user