mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-09-24 23:10:56 +08:00
feat: refresh latest v0.97.0 release payload
This commit is contained in:
@@ -57,6 +57,13 @@ const mockPriorityCommands = new Set<string>([
|
||||
"get_webview_panels",
|
||||
"focus_webview_panel",
|
||||
"navigate_webview_panel",
|
||||
"get_browser_connector_settings_cmd",
|
||||
"set_browser_connector_install_root_cmd",
|
||||
"set_browser_connector_enabled_cmd",
|
||||
"set_system_connector_enabled_cmd",
|
||||
"get_browser_connector_install_status_cmd",
|
||||
"install_browser_connector_extension_cmd",
|
||||
"open_browser_extensions_page_cmd",
|
||||
"launch_browser_session",
|
||||
"launch_browser_profile_runtime_assist_cmd",
|
||||
"get_browser_action_audit_logs",
|
||||
|
||||
@@ -133,6 +133,45 @@
|
||||
"targets": ["src/lib/api/contextMemory.ts"],
|
||||
"allowedPaths": []
|
||||
},
|
||||
{
|
||||
"id": "agent-chat-timeline-flow-demo",
|
||||
"classification": "dead-candidate",
|
||||
"description": "已删除的聊天时间线演示组件",
|
||||
"targets": [
|
||||
"src/components/agent/chat/components/TimelineFlowDemo.tsx"
|
||||
],
|
||||
"allowedPaths": []
|
||||
},
|
||||
{
|
||||
"id": "agent-chat-legacy-project-selector",
|
||||
"classification": "dead-candidate",
|
||||
"description": "已删除的聊天目录旧项目选择器",
|
||||
"targets": [
|
||||
"src/components/agent/chat/components/ProjectSelector.tsx"
|
||||
],
|
||||
"allowedPaths": []
|
||||
},
|
||||
{
|
||||
"id": "agent-chat-timeline-inline-item",
|
||||
"classification": "dead-candidate",
|
||||
"description": "已删除的聊天时间线内联原型项组件",
|
||||
"targets": [
|
||||
"src/components/agent/chat/components/TimelineInlineItem.tsx"
|
||||
],
|
||||
"allowedPaths": []
|
||||
},
|
||||
{
|
||||
"id": "agent-chat-task-files-directory-impl",
|
||||
"classification": "dead-candidate",
|
||||
"description": "已删除的聊天任务文件旧目录实现",
|
||||
"targets": [
|
||||
"src/components/agent/chat/components/TaskFiles/index.ts",
|
||||
"src/components/agent/chat/components/TaskFiles/types.ts",
|
||||
"src/components/agent/chat/components/TaskFiles/TaskFileList.tsx",
|
||||
"src/components/agent/chat/components/TaskFiles/TaskFileItem.tsx"
|
||||
],
|
||||
"allowedPaths": []
|
||||
},
|
||||
{
|
||||
"id": "team-subagent-scheduler-hook",
|
||||
"classification": "compat",
|
||||
|
||||
+162
-4
@@ -15,6 +15,14 @@ import { shouldPreferMockInBrowser } from "../dev-bridge/mockPriorityCommands";
|
||||
|
||||
// 模拟的命令处理器
|
||||
const mockCommands = new Map<string, (...args: any[]) => any>();
|
||||
const shouldLogMockInfo = import.meta.env.MODE !== "test";
|
||||
|
||||
function logMockInfo(...args: Parameters<typeof console.log>) {
|
||||
if (!shouldLogMockInfo) {
|
||||
return;
|
||||
}
|
||||
console.log(...args);
|
||||
}
|
||||
|
||||
const createDeprecatedCommandMock =
|
||||
(command: string, replacement: string) => () => {
|
||||
@@ -73,6 +81,30 @@ type MockBrowserEnvironmentPresetRecord = {
|
||||
archived_at: string | null;
|
||||
};
|
||||
|
||||
type MockBrowserConnectorSettings = {
|
||||
enabled: boolean;
|
||||
install_root_dir: string | null;
|
||||
install_dir: string | null;
|
||||
system_connectors: Array<{
|
||||
id: string;
|
||||
label: string;
|
||||
description: string;
|
||||
enabled: boolean;
|
||||
available: boolean;
|
||||
}>;
|
||||
};
|
||||
|
||||
type MockBrowserConnectorInstallStatus = {
|
||||
status: string;
|
||||
install_root_dir: string | null;
|
||||
install_dir: string | null;
|
||||
bundled_name: string;
|
||||
bundled_version: string;
|
||||
installed_name: string | null;
|
||||
installed_version: string | null;
|
||||
message: string | null;
|
||||
};
|
||||
|
||||
const mockBrowserProfiles: MockBrowserProfileRecord[] = [
|
||||
{
|
||||
id: "browser-profile-general",
|
||||
@@ -115,6 +147,60 @@ const mockBrowserEnvironmentPresets: MockBrowserEnvironmentPresetRecord[] = [
|
||||
},
|
||||
];
|
||||
|
||||
let mockBrowserConnectorSettings: MockBrowserConnectorSettings = {
|
||||
enabled: true,
|
||||
install_root_dir: "/mock/path/to/connectors",
|
||||
install_dir: "/mock/path/to/connectors/Lime Browser Connector",
|
||||
system_connectors: [
|
||||
{
|
||||
id: "reminders",
|
||||
label: "提醒事项",
|
||||
description: "读取和管理你的提醒事项和任务列表。",
|
||||
enabled: false,
|
||||
available: true,
|
||||
},
|
||||
{
|
||||
id: "calendar",
|
||||
label: "日历",
|
||||
description: "读取和管理你的日历事件。",
|
||||
enabled: false,
|
||||
available: true,
|
||||
},
|
||||
{
|
||||
id: "notes",
|
||||
label: "备忘录",
|
||||
description: "读取和创建你的备忘录。",
|
||||
enabled: false,
|
||||
available: true,
|
||||
},
|
||||
{
|
||||
id: "mail",
|
||||
label: "邮件",
|
||||
description: "读取邮件和创建草稿。",
|
||||
enabled: false,
|
||||
available: true,
|
||||
},
|
||||
{
|
||||
id: "contacts",
|
||||
label: "通讯录",
|
||||
description: "搜索、读取和创建联系人。",
|
||||
enabled: false,
|
||||
available: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
let mockBrowserConnectorInstallStatus: MockBrowserConnectorInstallStatus = {
|
||||
status: "not_installed",
|
||||
install_root_dir: "/mock/path/to/connectors",
|
||||
install_dir: "/mock/path/to/connectors/Lime Browser Connector",
|
||||
bundled_name: "Lime Browser Connector",
|
||||
bundled_version: "0.1.0",
|
||||
installed_name: null,
|
||||
installed_version: null,
|
||||
message: "尚未导出浏览器连接器",
|
||||
};
|
||||
|
||||
const now = () => new Date().toISOString();
|
||||
const mockBrowserSessionStates = new Map<string, any>();
|
||||
let mockExistingSessionTabs = [
|
||||
@@ -875,7 +961,7 @@ const defaultMocks: Record<string, any> = {
|
||||
}),
|
||||
|
||||
save_config: (config: any) => {
|
||||
console.log("[Mock] Config saved:", config);
|
||||
logMockInfo("[Mock] Config saved:", config);
|
||||
return { success: true };
|
||||
},
|
||||
|
||||
@@ -885,7 +971,7 @@ const defaultMocks: Record<string, any> = {
|
||||
get_default_provider: () => "kiro",
|
||||
set_default_provider: (args: any) => {
|
||||
const provider = args?.provider ?? args;
|
||||
console.log("[Mock] Default provider set to:", provider);
|
||||
logMockInfo("[Mock] Default provider set to:", provider);
|
||||
return provider;
|
||||
},
|
||||
get_available_models: () => [],
|
||||
@@ -1650,6 +1736,78 @@ const defaultMocks: Record<string, any> = {
|
||||
controls: [],
|
||||
pending_commands: [],
|
||||
}),
|
||||
get_browser_connector_settings_cmd: () => mockBrowserConnectorSettings,
|
||||
set_browser_connector_install_root_cmd: (args: any) => {
|
||||
const installRootDir =
|
||||
typeof args?.request?.install_root_dir === "string" &&
|
||||
args.request.install_root_dir.trim()
|
||||
? args.request.install_root_dir.trim()
|
||||
: "/mock/path/to/connectors";
|
||||
mockBrowserConnectorSettings = {
|
||||
...mockBrowserConnectorSettings,
|
||||
install_root_dir: installRootDir,
|
||||
install_dir: `${installRootDir}/Lime Browser Connector`,
|
||||
};
|
||||
mockBrowserConnectorInstallStatus = {
|
||||
...mockBrowserConnectorInstallStatus,
|
||||
install_root_dir: installRootDir,
|
||||
install_dir: `${installRootDir}/Lime Browser Connector`,
|
||||
};
|
||||
return mockBrowserConnectorSettings;
|
||||
},
|
||||
set_browser_connector_enabled_cmd: (args: any) => {
|
||||
mockBrowserConnectorSettings = {
|
||||
...mockBrowserConnectorSettings,
|
||||
enabled: args?.enabled !== false,
|
||||
};
|
||||
return mockBrowserConnectorSettings;
|
||||
},
|
||||
set_system_connector_enabled_cmd: (args: any) => {
|
||||
const request = args?.request ?? {};
|
||||
mockBrowserConnectorSettings = {
|
||||
...mockBrowserConnectorSettings,
|
||||
system_connectors: mockBrowserConnectorSettings.system_connectors.map(
|
||||
(connector) =>
|
||||
connector.id === request.id
|
||||
? { ...connector, enabled: request.enabled === true }
|
||||
: connector,
|
||||
),
|
||||
};
|
||||
return mockBrowserConnectorSettings;
|
||||
},
|
||||
get_browser_connector_install_status_cmd: () => mockBrowserConnectorInstallStatus,
|
||||
install_browser_connector_extension_cmd: (args: any) => {
|
||||
const installRootDir =
|
||||
typeof args?.request?.install_root_dir === "string" &&
|
||||
args.request.install_root_dir.trim()
|
||||
? args.request.install_root_dir.trim()
|
||||
: mockBrowserConnectorSettings.install_root_dir ??
|
||||
"/mock/path/to/connectors";
|
||||
const installDir = `${installRootDir}/Lime Browser Connector`;
|
||||
mockBrowserConnectorSettings = {
|
||||
...mockBrowserConnectorSettings,
|
||||
install_root_dir: installRootDir,
|
||||
install_dir: installDir,
|
||||
};
|
||||
mockBrowserConnectorInstallStatus = {
|
||||
...mockBrowserConnectorInstallStatus,
|
||||
status: "installed",
|
||||
install_root_dir: installRootDir,
|
||||
install_dir: installDir,
|
||||
installed_name: "Lime Browser Connector",
|
||||
installed_version: mockBrowserConnectorInstallStatus.bundled_version,
|
||||
message: "已安装最新版本浏览器连接器",
|
||||
};
|
||||
return {
|
||||
install_root_dir: installRootDir,
|
||||
install_dir: installDir,
|
||||
bundled_name: "Lime Browser Connector",
|
||||
bundled_version: mockBrowserConnectorInstallStatus.bundled_version,
|
||||
installed_version: mockBrowserConnectorInstallStatus.bundled_version,
|
||||
auto_config_path: `${installDir}/auto_config.json`,
|
||||
};
|
||||
},
|
||||
open_browser_extensions_page_cmd: () => true,
|
||||
chrome_bridge_execute_command: (args: any) => ({
|
||||
success: true,
|
||||
request_id: `mock-${Date.now()}`,
|
||||
@@ -3369,7 +3527,7 @@ export async function invoke<T = any>(
|
||||
cmd: string,
|
||||
args?: Record<string, unknown>,
|
||||
): Promise<T> {
|
||||
console.log(`[Mock] invoke: ${cmd}`, args);
|
||||
logMockInfo(`[Mock] invoke: ${cmd}`, args);
|
||||
|
||||
// 检查是否有自定义 mock
|
||||
if (mockCommands.has(cmd)) {
|
||||
@@ -3422,7 +3580,7 @@ export function clearMocks() {
|
||||
export function convertFileSrc(filePath: string, _protocol?: string): string {
|
||||
// 在 mock 环境中,返回一个占位符或原始路径
|
||||
// 实际图片无法在 web 环境中显示,但不会导致构建错误
|
||||
console.log(`[Mock] convertFileSrc: ${filePath}`);
|
||||
logMockInfo(`[Mock] convertFileSrc: ${filePath}`);
|
||||
return filePath;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,14 @@ type UnlistenFn = () => void;
|
||||
|
||||
// 存储事件监听器
|
||||
const listeners = new Map<string, Set<EventCallback<any>>>();
|
||||
const shouldLogMockEventInfo = import.meta.env.MODE !== "test";
|
||||
|
||||
function logMockEventInfo(...args: Parameters<typeof console.log>) {
|
||||
if (!shouldLogMockEventInfo) {
|
||||
return;
|
||||
}
|
||||
console.log(...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock listen function
|
||||
@@ -15,7 +23,7 @@ export async function listen<T = any>(
|
||||
event: string,
|
||||
handler: EventCallback<T>,
|
||||
): Promise<UnlistenFn> {
|
||||
console.log(`[Mock] listen: ${event}`);
|
||||
logMockEventInfo(`[Mock] listen: ${event}`);
|
||||
|
||||
if (!listeners.has(event)) {
|
||||
listeners.set(event, new Set());
|
||||
@@ -32,7 +40,7 @@ export async function listen<T = any>(
|
||||
listeners.delete(event);
|
||||
}
|
||||
}
|
||||
console.log(`[Mock] unlisten: ${event}`);
|
||||
logMockEventInfo(`[Mock] unlisten: ${event}`);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -43,7 +51,7 @@ export async function once<T = any>(
|
||||
event: string,
|
||||
handler: EventCallback<T>,
|
||||
): Promise<UnlistenFn> {
|
||||
console.log(`[Mock] once: ${event}`);
|
||||
logMockEventInfo(`[Mock] once: ${event}`);
|
||||
|
||||
const wrappedHandler = (data: T) => {
|
||||
handler(data);
|
||||
@@ -61,7 +69,7 @@ export async function once<T = any>(
|
||||
* Mock emit function - 用于触发事件
|
||||
*/
|
||||
export async function emit(event: string, payload?: any): Promise<void> {
|
||||
console.log(`[Mock] emit: ${event}`, payload);
|
||||
logMockEventInfo(`[Mock] emit: ${event}`, payload);
|
||||
|
||||
const set = listeners.get(event);
|
||||
if (set) {
|
||||
|
||||
@@ -276,6 +276,46 @@ export interface ChromeBridgeCommandResult {
|
||||
data?: unknown;
|
||||
}
|
||||
|
||||
export interface SystemConnectorSnapshot {
|
||||
id: string;
|
||||
label: string;
|
||||
description: string;
|
||||
enabled: boolean;
|
||||
available: boolean;
|
||||
}
|
||||
|
||||
export interface BrowserConnectorSettingsSnapshot {
|
||||
enabled: boolean;
|
||||
install_root_dir?: string | null;
|
||||
install_dir?: string | null;
|
||||
system_connectors: SystemConnectorSnapshot[];
|
||||
}
|
||||
|
||||
export interface BrowserConnectorInstallStatus {
|
||||
status: "not_installed" | "installed" | "update_available" | "broken";
|
||||
install_root_dir?: string | null;
|
||||
install_dir?: string | null;
|
||||
bundled_name: string;
|
||||
bundled_version: string;
|
||||
installed_name?: string | null;
|
||||
installed_version?: string | null;
|
||||
message?: string | null;
|
||||
}
|
||||
|
||||
export interface BrowserConnectorInstallRequest {
|
||||
install_root_dir?: string;
|
||||
profile_key?: string;
|
||||
}
|
||||
|
||||
export interface BrowserConnectorInstallResult {
|
||||
install_root_dir: string;
|
||||
install_dir: string;
|
||||
bundled_name: string;
|
||||
bundled_version: string;
|
||||
installed_version: string;
|
||||
auto_config_path: string;
|
||||
}
|
||||
|
||||
export type BrowserBackendType =
|
||||
| "aster_compat"
|
||||
| "lime_extension_bridge"
|
||||
@@ -798,6 +838,69 @@ export async function getChromeBridgeStatus(): Promise<ChromeBridgeStatusSnapsho
|
||||
return safeInvoke<ChromeBridgeStatusSnapshot>("get_chrome_bridge_status");
|
||||
}
|
||||
|
||||
export async function getBrowserConnectorSettings(): Promise<BrowserConnectorSettingsSnapshot> {
|
||||
return safeInvoke<BrowserConnectorSettingsSnapshot>(
|
||||
"get_browser_connector_settings_cmd",
|
||||
);
|
||||
}
|
||||
|
||||
export async function setBrowserConnectorInstallRoot(
|
||||
installRootDir: string,
|
||||
): Promise<BrowserConnectorSettingsSnapshot> {
|
||||
return safeInvoke<BrowserConnectorSettingsSnapshot>(
|
||||
"set_browser_connector_install_root_cmd",
|
||||
{
|
||||
request: {
|
||||
install_root_dir: installRootDir,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export async function setBrowserConnectorEnabled(
|
||||
enabled: boolean,
|
||||
): Promise<BrowserConnectorSettingsSnapshot> {
|
||||
return safeInvoke<BrowserConnectorSettingsSnapshot>(
|
||||
"set_browser_connector_enabled_cmd",
|
||||
{
|
||||
enabled,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export async function setSystemConnectorEnabled(request: {
|
||||
id: string;
|
||||
enabled: boolean;
|
||||
}): Promise<BrowserConnectorSettingsSnapshot> {
|
||||
return safeInvoke<BrowserConnectorSettingsSnapshot>(
|
||||
"set_system_connector_enabled_cmd",
|
||||
{
|
||||
request,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export async function getBrowserConnectorInstallStatus(): Promise<BrowserConnectorInstallStatus> {
|
||||
return safeInvoke<BrowserConnectorInstallStatus>(
|
||||
"get_browser_connector_install_status_cmd",
|
||||
);
|
||||
}
|
||||
|
||||
export async function installBrowserConnectorExtension(
|
||||
request: BrowserConnectorInstallRequest,
|
||||
): Promise<BrowserConnectorInstallResult> {
|
||||
return safeInvoke<BrowserConnectorInstallResult>(
|
||||
"install_browser_connector_extension_cmd",
|
||||
{
|
||||
request,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export async function openBrowserExtensionsPage(): Promise<boolean> {
|
||||
return safeInvoke<boolean>("open_browser_extensions_page_cmd");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 ChromeBridge 发送测试命令
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user