refactor: use typed window.metonaDesktop instead of (window as any)

Replaced all '(window as any).metonaDesktop' with the properly typed
'window.metonaDesktop' across mcp-client.ts, skill-manager.ts,
agent-engine.ts, and log-service.ts. The MetonaDesktopAPI type is
already declared in types.d.ts, so the 'as any' cast was unnecessary
and bypassed type checking.
This commit is contained in:
thzxx
2026-04-24 14:03:34 +08:00
parent 0065ded925
commit 9cb6c243a7
4 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -170,7 +170,7 @@ function parseToolCallsFromText(content: string): ToolCall[] {
/** v4.2: 从对话中自动推断用户画像 */
async function inferUserProfile(userMsg: string, assistantMsg: string): Promise<void> {
const bridge = (window as any).metonaDesktop;
const bridge = window.metonaDesktop;
if (!bridge?.db?.getSetting) return;
const profile: Record<string, unknown> = await bridge.db.getSetting('user_profile', {}) || {};
@@ -365,7 +365,7 @@ export interface AgentCallbacks {
/** 保存执行轨迹到 SQLite */
async function saveTrace(trace: Omit<TraceEntry, 'id' | 'createdAt'>): Promise<void> {
try {
const bridge = (window as any).metonaDesktop;
const bridge = window.metonaDesktop;
if (!bridge?.db) return;
const entry = {
id: `trace_${generateId()}`,