chore: v2.2.73 — ASTRA-DEBUG 로그 레벨 + webview CSP font-src 보강
- ASTRA-DEBUG 정상 흐름 로그를 console.error → logInfo/console.log 로 강등 (chatHandlers, extension, slashRouter): DevTools에 ERR로 찍히던 오탐 제거 - sidebar webview에 명시적 CSP meta 추가 + font-src에 data: 허용 (sidebar.html, sidebarProvider._getHtml): VS Code outer iframe이 codicon.ttf를 data:font/ttf 로 inject하면서 기본 CSP에 막혀 매 prompt 마다 violation 경고가 찍히던 문제 해소 - 누적된 LM Studio / agent / 컨텍스트 매니저 / 테스트 갱신 동반 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -886,6 +886,12 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
|
||||
void this._restoreActiveSessionIntoView();
|
||||
void this._sendReadyStatus();
|
||||
// v2.2.66 — initial-load 단계에서도 brain/models/agents 를 한 번 더 푸시한다.
|
||||
// 기존엔 webview 의 'ready' 핸드셰이크에만 의존했는데, 그 체인 도중 하나가 throw 하면
|
||||
// 나머지 populate 가 통째로 안 돌아 dropdown 이 비는 회귀가 발생할 수 있다. 이중 보장.
|
||||
void this._sendBrainProfiles();
|
||||
void this._sendAgentsList();
|
||||
void this._sendModels();
|
||||
|
||||
viewDisposables.push(webviewView.webview.onDidReceiveMessage(async (data) => {
|
||||
// dispatch root 진입 trace — "/benchmark 입력했는데 아무 응답 없음" 같은
|
||||
@@ -1263,6 +1269,8 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
description: profile.description || '',
|
||||
repo: profile.secondBrainRepo || ''
|
||||
}));
|
||||
// v2.2.66 — dropdown 이 갑자기 비는 회귀가 보고됨. 무엇이 실제로 전송되는지 추적.
|
||||
logInfo(`[_sendBrainProfiles] profiles=${profiles.length} activeBrainId=${activeBrain.id} active=${activeBrain.name}`);
|
||||
this._view.webview.postMessage({
|
||||
type: 'brainProfiles',
|
||||
value: {
|
||||
@@ -3368,7 +3376,37 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* v2.2.70 — 도구 드롭다운의 "자동 기록" 토글에서 호출. config 를 즉시 갱신하고 webview 에
|
||||
* 새 상태를 푸시. globalState 갱신이 아닌 vscode 설정 갱신이므로 다음 세션까지 영구 유지.
|
||||
*/
|
||||
async _setChronicleAutoRecord(enabled: boolean): Promise<void> {
|
||||
try {
|
||||
await vscode.workspace.getConfiguration('g1nation').update(
|
||||
'chronicleAutoRecord', !!enabled, vscode.ConfigurationTarget.Global
|
||||
);
|
||||
logInfo(`[chronicleAutoRecord] toggled → ${enabled ? 'ON' : 'OFF'}`);
|
||||
} catch (e: any) {
|
||||
logError('[chronicleAutoRecord] update failed', { error: e?.message || String(e) });
|
||||
}
|
||||
await this._sendChronicleAutoRecordStatus();
|
||||
}
|
||||
|
||||
/** Send current 자동 기록 enabled flag to the webview so the Tools menu can render the toggle state. */
|
||||
async _sendChronicleAutoRecordStatus(): Promise<void> {
|
||||
if (!this._view) return;
|
||||
this._view.webview.postMessage({
|
||||
type: 'chronicleAutoRecordStatus',
|
||||
value: { enabled: getConfig().chronicleAutoRecord !== false }
|
||||
});
|
||||
}
|
||||
|
||||
async _autoWriteChronicleAfterPrompt() {
|
||||
// v2.2.70 — 자동 기록 OFF (g1nation.chronicleAutoRecord=false) 면 즉시 종료.
|
||||
// 수동 기록 (도구 메뉴, /wiki 명령 등) 은 영향받지 않는다.
|
||||
if (getConfig().chronicleAutoRecord === false) {
|
||||
return;
|
||||
}
|
||||
const history = this._agent.getHistory();
|
||||
const latestUser = [...history].reverse().find(message => message.role === 'user')?.content || '';
|
||||
const latestAssistant = [...history].reverse().find(message => message.role === 'assistant')?.content || '';
|
||||
@@ -4056,7 +4094,20 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
|
||||
const mediaRoot = vscode.Uri.joinPath(this._extensionUri, 'media');
|
||||
const stylesUri = webview.asWebviewUri(vscode.Uri.joinPath(mediaRoot, 'sidebar.css')).toString();
|
||||
const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(mediaRoot, 'sidebar.js')).toString();
|
||||
// VS Code의 outer webview iframe이 codicon.ttf를 data:font/ttf 로 inject한다.
|
||||
// 기본 CSP는 font-src 'self' https://*.vscode-cdn.net 라 data: 가 빠져 있어
|
||||
// DevTools에 violation 경고가 매번 찍힘. 우리가 명시적 CSP를 박아 data: 를
|
||||
// 허용해 주면 호스트 iframe도 같은 CSP를 상속하면서 경고가 사라진다.
|
||||
const csp = [
|
||||
`default-src 'none'`,
|
||||
`img-src ${webview.cspSource} https: data:`,
|
||||
`style-src ${webview.cspSource} 'unsafe-inline'`,
|
||||
`script-src ${webview.cspSource} https://cdn.jsdelivr.net 'unsafe-inline'`,
|
||||
`font-src ${webview.cspSource} https: data:`,
|
||||
`connect-src ${webview.cspSource} https:`,
|
||||
].join('; ');
|
||||
return SidebarChatProvider._htmlTemplateCache
|
||||
.replace('__CSP__', csp)
|
||||
.replace('__STYLES_URI__', stylesUri)
|
||||
.replace('__SCRIPT_URI__', scriptUri);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user