From e45280d6c320126a78f89daeb83cab5cfd950328 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 18 Nov 2026 20:19:23 +0000 Subject: [PATCH 1/3] fix: point official site, market, and tunnel defaults at dimo-ai.com New installs and docs use https://dimo-ai.com. Official model-gateway writes use https://model.dimo-ai.com with the site's protocol paths. Saved providers, relay assignments, and the previous host stay valid. Co-authored-by: XieXing --- .env.example | 4 +- README.md | 18 ++--- README.zh-CN.md | 18 ++--- crates/plugins/src/catalog.rs | 8 +- crates/plugins/src/official_catalog.rs | 2 +- crates/utils/src/lib.rs | 35 ++++++++- crates/utils/src/tunnel.rs | 46 +++++++++-- dimo-plugin.json | 2 +- docs/plugins/official-plugins.md | 2 +- .../src/components/layout/HostSelector.tsx | 4 +- .../onboarding/OnboardingAppearance.test.tsx | 2 +- .../panels/DockviewWelcomePanel.test.tsx | 2 +- .../panels/DockviewWelcomePanel.tsx | 4 +- .../src/features/model-router/preset.test.ts | 77 +++++++++++++++++++ frontend/src/features/model-router/preset.ts | 65 ++++++++++++++-- frontend/src/lib/branding.ts | 4 +- .../src/pages/plugins/OfficialPluginIcon.tsx | 8 +- .../plugins/PluginInstallTrustDialog.tsx | 9 ++- .../plugins/PluginMarketplaceLogo.test.tsx | 8 +- .../src/pages/plugins/officialPlugins.test.ts | 6 ++ .../pages/settings/RemoteClientSettings.tsx | 4 +- npx-cli/README.md | 6 +- npx-cli/bin/plugin.js | 2 +- npx-cli/bin/plugin.test.js | 3 +- .../skills/dimo-plugin-development/SKILL.md | 2 +- .../references/link.md | 2 +- scripts/host-tunnel/test_public_ip.sh | 18 +++++ scripts/host-tunnel/tunnel.sh | 4 +- scripts/package-host-family.test.js | 2 +- 29 files changed, 304 insertions(+), 63 deletions(-) diff --git a/.env.example b/.env.example index ae7a029aa..dcea16918 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ # Optional site origin override. Leave commented out during local dev so `pnpm run dev` -# defaults to http://localhost:3100 while release builds default to https://vibex.xforever.xin. -# DIMO_SITE_URL=https://vibex.xforever.xin +# defaults to http://localhost:3100 while release builds default to https://dimo-ai.com. +# DIMO_SITE_URL=https://dimo-ai.com # Local Apple signing for `pnpm run dev` and `pnpm run tauri:build`. # Copy to `.env.local` (gitignored) and fill in your Developer ID details. diff --git a/README.md b/README.md index 552a2c002..ab8dd7732 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,10 @@

- Website - Download - Docs - Marketplace + Website + Download + Docs + Marketplace npm version

@@ -126,7 +126,7 @@ Built on a lightweight native Rust core where **everything is a plugin**. Equip ### 1. Native Desktop App (Recommended) -Download the native installer (with built-in auto-updates) from the [Official Download Page](https://vibex.xforever.xin/#download): +Download the native installer (with built-in auto-updates) from the [Official Download Page](https://dimo-ai.com/#download): - **macOS**: Apple Silicon (`aarch64` `.dmg`) · Intel (`x64` `.dmg`) - **Windows**: Windows 10 / 11 (`x64` / `arm64` `.exe`) @@ -173,10 +173,10 @@ pnpm run check # Run frontend & Rust type/compile checks ## Official Links & Community -- **Website**: [https://vibex.xforever.xin](https://vibex.xforever.xin) -- **Downloads**: [https://vibex.xforever.xin/#download](https://vibex.xforever.xin/#download) -- **Online Docs**: [https://vibex.xforever.xin/docs](https://vibex.xforever.xin/docs) -- **Plugin Marketplace**: [https://vibex.xforever.xin/marketplace](https://vibex.xforever.xin/marketplace) +- **Website**: [https://dimo-ai.com](https://dimo-ai.com) +- **Downloads**: [https://dimo-ai.com/#download](https://dimo-ai.com/#download) +- **Online Docs**: [https://dimo-ai.com/docs](https://dimo-ai.com/docs) +- **Plugin Marketplace**: [https://dimo-ai.com/marketplace](https://dimo-ai.com/marketplace) - **CLI Package**: [https://www.npmjs.com/package/dimoai](https://www.npmjs.com/package/dimoai)
diff --git a/README.zh-CN.md b/README.zh-CN.md index d54a53f54..bcc2fcc0f 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -15,10 +15,10 @@

- 官网 - 下载客户端 - 文档中心 - 插件市场 + 官网 + 下载客户端 + 文档中心 + 插件市场 npm version

@@ -130,7 +130,7 @@ ### 1. 下载桌面客户端(推荐) -前往 [Dimo 官方下载页](https://vibex.xforever.xin/#download) 获取原生安装包(支持自动更新): +前往 [Dimo 官方下载页](https://dimo-ai.com/#download) 获取原生安装包(支持自动更新): - **macOS**:Apple Silicon (`aarch64` `.dmg`) · Intel (`x64` `.dmg`) - **Windows**:Windows 10 / 11 (`x64` / `arm64` `.exe`) @@ -177,10 +177,10 @@ pnpm run check # 运行前后端类型与编译检查 ## 官方链接与社区交流 -- **官方网站**:[https://vibex.xforever.xin](https://vibex.xforever.xin) -- **客户端下载**:[https://vibex.xforever.xin/#download](https://vibex.xforever.xin/#download) -- **在线文档**:[https://vibex.xforever.xin/docs](https://vibex.xforever.xin/docs) -- **插件市场**:[https://vibex.xforever.xin/marketplace](https://vibex.xforever.xin/marketplace) +- **官方网站**:[https://dimo-ai.com](https://dimo-ai.com) +- **客户端下载**:[https://dimo-ai.com/#download](https://dimo-ai.com/#download) +- **在线文档**:[https://dimo-ai.com/docs](https://dimo-ai.com/docs) +- **插件市场**:[https://dimo-ai.com/marketplace](https://dimo-ai.com/marketplace) - **CLI 工具包**:[https://www.npmjs.com/package/dimoai](https://www.npmjs.com/package/dimoai)
diff --git a/crates/plugins/src/catalog.rs b/crates/plugins/src/catalog.rs index 08c7a360e..79d4292c4 100644 --- a/crates/plugins/src/catalog.rs +++ b/crates/plugins/src/catalog.rs @@ -696,6 +696,7 @@ pub fn origin_kind(origin: Option<&str>) -> Option<&'static str> { } else if origin.contains("marketplace") || matches_origin_host(origin, &marketplace_origin()) || matches_origin_host(origin, &utils::site_origin()) + || matches_origin_host(origin, utils::LEGACY_SITE_ORIGIN) || matches_origin_host( origin, crate::official_catalog::official_marketplace_origin(), @@ -1070,9 +1071,14 @@ mod tests { Some("github") ); assert_eq!( - origin_kind(Some("https://vibex.xforever.xin/marketplace/dimo/office")), + origin_kind(Some("https://dimo-ai.com/marketplace/dimo/office")), Some("marketplace") ); + assert_eq!( + origin_kind(Some("https://vibex.xforever.xin/files/a.vxp")), + Some("marketplace") + ); + assert_eq!(origin_kind(Some("https://evil.example/plugin.vxp")), None); assert!(source_allows_remote_update( PluginSourceKind::Snapshot, Some("https://github.com/acme/notes") diff --git a/crates/plugins/src/official_catalog.rs b/crates/plugins/src/official_catalog.rs index 3b50b0ac3..641b93734 100644 --- a/crates/plugins/src/official_catalog.rs +++ b/crates/plugins/src/official_catalog.rs @@ -277,7 +277,7 @@ mod tests { #[test] fn catalog_lists_official_plugins_with_repositories() { let catalog = official_plugin_catalog(); - assert_eq!(catalog.marketplace.origin, "https://vibex.xforever.xin"); + assert_eq!(catalog.marketplace.origin, "https://dimo-ai.com"); assert!( catalog .official diff --git a/crates/utils/src/lib.rs b/crates/utils/src/lib.rs index 984ea2f3c..e24dfc5d5 100644 --- a/crates/utils/src/lib.rs +++ b/crates/utils/src/lib.rs @@ -21,7 +21,10 @@ pub mod tokio; pub mod tunnel; pub mod version; -pub const DEFAULT_SITE_ORIGIN: &str = "https://vibex.xforever.xin"; +pub const DEFAULT_SITE_ORIGIN: &str = "https://dimo-ai.com"; +/// Previous public site. Installed marketplace sources and saved tunnel +/// origins on this host stay valid; new defaults use `DEFAULT_SITE_ORIGIN`. +pub const LEGACY_SITE_ORIGIN: &str = "https://vibex.xforever.xin"; pub const DEFAULT_DEV_SITE_ORIGIN: &str = "http://localhost:3100"; fn default_site_origin() -> &'static str { @@ -73,9 +76,15 @@ pub fn cache_dir() -> std::path::PathBuf { .to_path_buf() } +#[cfg(test)] +pub(crate) fn lock_site_env() -> std::sync::MutexGuard<'static, ()> { + static LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); + LOCK.lock().expect("site env lock") +} + #[cfg(test)] mod tests { - use super::cache_dir; + use super::{DEFAULT_SITE_ORIGIN, cache_dir, lock_site_env, site_origin}; #[test] fn cache_dir_uses_the_dimo_project_identity() { @@ -90,4 +99,26 @@ mod tests { "cache directory still uses the leftover bloop identity: {rendered}" ); } + + #[test] + fn site_origin_defaults_to_the_public_site_and_keeps_an_env_override() { + let _lock = lock_site_env(); + let previous = std::env::var("DIMO_SITE_URL").ok(); + unsafe { + std::env::remove_var("DIMO_SITE_URL"); + } + let default_origin = site_origin(); + unsafe { + std::env::set_var("DIMO_SITE_URL", "https://site.example.test/"); + } + let overridden = site_origin(); + unsafe { + match previous { + Some(value) => std::env::set_var("DIMO_SITE_URL", value), + None => std::env::remove_var("DIMO_SITE_URL"), + } + } + assert_eq!(default_origin, DEFAULT_SITE_ORIGIN); + assert_eq!(overridden, "https://site.example.test"); + } } diff --git a/crates/utils/src/tunnel.rs b/crates/utils/src/tunnel.rs index 0bc975dd8..1b16a8e59 100644 --- a/crates/utils/src/tunnel.rs +++ b/crates/utils/src/tunnel.rs @@ -3,7 +3,7 @@ use std::net::IpAddr; pub const DEFAULT_TUNNEL_PORT: u16 = 17891; -pub const DEFAULT_OFFICIAL_RELAY_HOST: &str = "vibex.xforever.xin"; +pub const DEFAULT_OFFICIAL_RELAY_HOST: &str = "dimo-ai.com"; pub const DEFAULT_OFFICIAL_RELAY_PORT: u16 = 443; pub const RELAY_HEARTBEAT_INTERVAL_MS: u64 = 15_000; pub const RELAY_CONTROL_TIMEOUT_MS: u64 = 45_000; @@ -184,8 +184,9 @@ pub fn scheme_hint_from_input(input: &str) -> Option<&'static str> { #[cfg(test)] mod tests { use super::{ - DEFAULT_TUNNEL_PORT, TunnelEndpoint, extract_relay_token, format_origin, install_command, - parse_tunnel_endpoint, probe_origins, scheme_hint_from_input, + DEFAULT_OFFICIAL_RELAY_HOST, DEFAULT_TUNNEL_PORT, TunnelEndpoint, extract_relay_token, + format_origin, install_command, official_relay_endpoint, parse_tunnel_endpoint, + probe_origins, scheme_hint_from_input, }; #[test] @@ -283,11 +284,9 @@ mod tests { assert_eq!(extract_relay_token("203.0.113.10:13630"), None); } - static ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); - #[test] fn install_command_includes_the_public_host() { - let _lock = ENV_LOCK.lock().expect("env lock"); + let _lock = crate::lock_site_env(); unsafe { std::env::set_var("DIMO_SITE_URL", "https://site.example.com"); } @@ -303,7 +302,7 @@ mod tests { #[test] fn install_command_uses_sudo_for_privileged_ports() { - let _lock = ENV_LOCK.lock().expect("env lock"); + let _lock = crate::lock_site_env(); unsafe { std::env::set_var("DIMO_SITE_URL", "https://site.example.com"); } @@ -324,7 +323,7 @@ mod tests { #[test] fn install_command_respects_dimo_site_url_env() { - let _lock = ENV_LOCK.lock().expect("env lock"); + let _lock = crate::lock_site_env(); unsafe { std::env::set_var("DIMO_SITE_URL", "https://site.example.com/"); } @@ -337,4 +336,35 @@ mod tests { "curl -fsSL https://site.example.com/tunnel.sh | sh -s -- -t tok_abc -p 17891 -h relay.example.com" ); } + + #[test] + fn official_relay_uses_the_public_site_unless_overridden() { + let _lock = crate::lock_site_env(); + let previous_url = std::env::var("DIMO_RELAY_URL").ok(); + let previous_host = std::env::var("DIMO_RELAY_HOST").ok(); + unsafe { + std::env::remove_var("DIMO_RELAY_URL"); + std::env::remove_var("DIMO_RELAY_HOST"); + } + let endpoint = official_relay_endpoint(None).expect("default relay"); + let assigned = official_relay_endpoint(Some("assigned.example.test")).expect("assigned"); + unsafe { + std::env::set_var("DIMO_RELAY_HOST", "relay.example.test"); + } + let overridden = official_relay_endpoint(None).expect("env relay"); + unsafe { + match previous_url { + Some(value) => std::env::set_var("DIMO_RELAY_URL", value), + None => std::env::remove_var("DIMO_RELAY_URL"), + } + match previous_host { + Some(value) => std::env::set_var("DIMO_RELAY_HOST", value), + None => std::env::remove_var("DIMO_RELAY_HOST"), + } + } + assert_eq!(endpoint.host, DEFAULT_OFFICIAL_RELAY_HOST); + assert_eq!(endpoint.port, 443); + assert_eq!(assigned.host, "assigned.example.test"); + assert_eq!(overridden.host, "relay.example.test"); + } } diff --git a/dimo-plugin.json b/dimo-plugin.json index 83f48761e..98ea5ee5c 100644 --- a/dimo-plugin.json +++ b/dimo-plugin.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "marketplace": { - "origin": "https://vibex.xforever.xin", + "origin": "https://dimo-ai.com", "path": "/marketplace" }, "official": [ diff --git a/docs/plugins/official-plugins.md b/docs/plugins/official-plugins.md index 7a64ef087..e84ff0fc2 100644 --- a/docs/plugins/official-plugins.md +++ b/docs/plugins/official-plugins.md @@ -4,7 +4,7 @@ ### 分发与生效规则 -- **市场官方分类与源码登记**:仓库根 [`dimo-plugin.json`](../../dimo-plugin.json) 登记了通过 [官方插件市场](https://vibex.xforever.xin/marketplace/) 与独立 GitHub Release 分发的核心官方包;Host 优先从市场拉取,离线或市场无制品时回退至快照/仓库地址,也支持直接导入 `.vxp` 或 `dimo plugin add --dev` 链接本地源码目录。 +- **市场官方分类与源码登记**:仓库根 [`dimo-plugin.json`](../../dimo-plugin.json) 登记了通过 [官方插件市场](https://dimo-ai.com/marketplace/) 与独立 GitHub Release 分发的核心官方包;Host 优先从市场拉取,离线或市场无制品时回退至快照/仓库地址,也支持直接导入 `.vxp` 或 `dimo plugin add --dev` 链接本地源码目录。 - **能力等价插件(Capability-Parity)**:从原内置功能迁出的等价官方插件(如浏览器、代码补全、提示词增强、看板视图、笔记等)按 Host 版本白名单自动就绪,用户仍可随时禁用或卸载。 - **生效双轨(Dual Activation)**:UI 面板、主题、右键菜单与 Provider 接缝**启用即刻生效、禁用原子撤下**;向 Agent 注入的 **Skill、MCP 与 Hook 仅对启用后新建或重新绑定的会话生效**(不热拆已在运行中的 STDIO 会话)。 - **单层独立**:各插件彼此完全独立,不存在插件依赖插件;关闭任一插件只会按反序回收其当前激活代(Activation Generation)。 diff --git a/frontend/src/components/layout/HostSelector.tsx b/frontend/src/components/layout/HostSelector.tsx index 52a3deb6e..509170e3e 100644 --- a/frontend/src/components/layout/HostSelector.tsx +++ b/frontend/src/components/layout/HostSelector.tsx @@ -56,6 +56,7 @@ import { createBackendAppSurfaceTransport } from '@/lib/api/appSurfaceTransport' import { createPluginControlApi } from '@/lib/api/plugins'; import { backendListen } from '@/lib/backendTransport'; import { DesktopCapabilityError, isTauriClient } from '@/lib/desktopShell'; +import { getSiteUrl } from '@/lib/branding'; import { getErrorMessage } from '@/lib/modals'; import { tauriBackendTransport, useBackendTransport } from '@/lib/transport'; import { cn } from '@/lib/utils'; @@ -173,8 +174,7 @@ function ConnectHostDialog({ const isSshProfile = savedHostSource(matchedProfile?.provision_kind) === 'ssh'; const relayPublicOrigin = - overview?.assignedRelayServer?.publicOrigin?.trim() || - 'https://vibex.xforever.xin'; + overview?.assignedRelayServer?.publicOrigin?.trim() || getSiteUrl(); const canUseCloudRelay = Boolean( isSignedIn && overview?.relayPermission !== false && !isSshProfile ); diff --git a/frontend/src/components/onboarding/OnboardingAppearance.test.tsx b/frontend/src/components/onboarding/OnboardingAppearance.test.tsx index 0c052cabb..dc60c83e6 100644 --- a/frontend/src/components/onboarding/OnboardingAppearance.test.tsx +++ b/frontend/src/components/onboarding/OnboardingAppearance.test.tsx @@ -177,7 +177,7 @@ describe('onboarding appearance', () => { }) ).toEqual([ 'https://cdn.example.com/onboarding/free-tabs.mp4', - 'https://vibex.xforever.xin/videos/onboarding/free-tabs.mp4', + 'https://dimo-ai.com/videos/onboarding/free-tabs.mp4', ]); expect(resolveOnboardingVideoSources('canvas', { devLocal: true })[0]).toBe( '/__dev/onboarding-videos/infinite-canvas.mp4' diff --git a/frontend/src/components/panels/DockviewWelcomePanel.test.tsx b/frontend/src/components/panels/DockviewWelcomePanel.test.tsx index 0faa4b90f..888dfeff3 100644 --- a/frontend/src/components/panels/DockviewWelcomePanel.test.tsx +++ b/frontend/src/components/panels/DockviewWelcomePanel.test.tsx @@ -369,7 +369,7 @@ describe('DockviewWelcomePanel', () => { ).toBeInTheDocument(); expect(screen.getByRole('link', { name: '去官网查看' })).toHaveAttribute( 'href', - 'https://vibex.com/docs' + 'https://dimo-ai.com/docs' ); expect( diff --git a/frontend/src/components/panels/DockviewWelcomePanel.tsx b/frontend/src/components/panels/DockviewWelcomePanel.tsx index c277f0d68..6da2ff147 100644 --- a/frontend/src/components/panels/DockviewWelcomePanel.tsx +++ b/frontend/src/components/panels/DockviewWelcomePanel.tsx @@ -47,6 +47,7 @@ import { useKanbanProjectSessions, } from '@/hooks/useKanbanProjectSessions'; import { fileTreeApi, openSettingsSurface, projectsApi } from '@/lib/api'; +import { getSiteUrl } from '@/lib/branding'; import { openLocalAppWindow } from '@/lib/api/appWindow'; import { useTauriClient } from '@/lib/desktopShell'; import { @@ -77,7 +78,6 @@ import { const WELCOME_RECENT_SESSION_LIMIT = 4; const WELCOME_RECENT_PROJECT_LIMIT = 5; -const DOCS_URL = 'https://vibex.com/docs'; const TIP_KEYS = [ 'promptEnhance', 'pageLayout', @@ -237,7 +237,7 @@ function WelcomeTips() {
diff --git a/frontend/src/features/model-router/preset.test.ts b/frontend/src/features/model-router/preset.test.ts index cfd28f3c1..c40996cf2 100644 --- a/frontend/src/features/model-router/preset.test.ts +++ b/frontend/src/features/model-router/preset.test.ts @@ -2,9 +2,11 @@ import { describe, expect, it } from 'vitest'; import type { RouterProvision } from './account'; import { + MODEL_GATEWAY_ORIGIN, ROUTER_OPENCODE_PROVIDER_ID, ROUTER_PROVIDER_NAME, dshProviderSaveRequest, + officialModelBaseUrl, openCodeConnectRequest, providerSaveRequest, supportsModelRouter, @@ -92,6 +94,17 @@ describe('openCodeConnectRequest', () => { expect(request.models.map((model) => model.id)).toEqual(['sonnet', 'opus']); }); + it('does not append a second /v1 when the official gateway is already versioned', () => { + const request = openCodeConnectRequest( + provision({ + agentId: 'opencode', + protocol: 'anthropic', + baseUrl: 'https://model.xforever.xin', + }) + ); + expect(request.base_url).toBe(`${MODEL_GATEWAY_ORIGIN}/v1`); + }); + it('keeps the OpenAI-compatible base as issued', () => { const request = openCodeConnectRequest( provision({ @@ -141,6 +154,70 @@ describe('dshProviderSaveRequest', () => { }); }); +describe('officialModelBaseUrl', () => { + it('keeps a user gateway and only rewrites the official model host', () => { + expect(officialModelBaseUrl('codex', 'https://gateway.example/v1')).toBe( + 'https://gateway.example/v1' + ); + expect( + officialModelBaseUrl('claude_code', 'https://api.anthropic.com') + ).toBe('https://api.anthropic.com'); + expect(officialModelBaseUrl('codex', 'not a url')).toBe('not a url'); + }); + + it('uses the model host root for Claude and Gemini and /v1 for OpenAI clients', () => { + expect( + officialModelBaseUrl('claude_code', 'https://model.xforever.xin') + ).toBe(MODEL_GATEWAY_ORIGIN); + expect(officialModelBaseUrl('gemini', 'https://model.dimo-ai.com/v1')).toBe( + MODEL_GATEWAY_ORIGIN + ); + expect( + officialModelBaseUrl('antigravity', 'https://model.xforever.xin/v1') + ).toBe(MODEL_GATEWAY_ORIGIN); + expect(officialModelBaseUrl('codex', 'https://model.xforever.xin')).toBe( + `${MODEL_GATEWAY_ORIGIN}/v1` + ); + expect( + officialModelBaseUrl('opencode', 'https://model.dimo-ai.com/v1') + ).toBe(`${MODEL_GATEWAY_ORIGIN}/v1`); + expect( + officialModelBaseUrl( + 'deepseek_harness', + 'https://vibex.xforever.xin/api/router' + ) + ).toBe(`${MODEL_GATEWAY_ORIGIN}/v1`); + expect( + officialModelBaseUrl('claude_code', 'https://dimo-ai.com/api/router/v1') + ).toBe(MODEL_GATEWAY_ORIGIN); + }); + + it('writes the normalized official URL onto the ModelRouter preset only', () => { + const saved = providerSaveRequest( + provision({ + agentId: 'codex', + protocol: 'openai', + baseUrl: 'https://model.xforever.xin', + }), + 'preset-1' + ); + expect(saved.id).toBe('preset-1'); + expect(saved.name).toBe(ROUTER_PROVIDER_NAME); + expect(saved.api_url).toBe(`${MODEL_GATEWAY_ORIGIN}/v1`); + + const custom = providerSaveRequest( + provision({ + agentId: 'codex', + protocol: 'openai', + baseUrl: 'https://gateway.example/v1', + }), + 'user-preset' + ); + expect(custom.id).toBe('user-preset'); + expect(custom.api_url).toBe('https://gateway.example/v1'); + }); +}); + describe('supportsModelRouter', () => { it('offers the entry for all agents that support custom model gateways', () => { expect(supportsModelRouter('codex')).toBe(true); diff --git a/frontend/src/features/model-router/preset.ts b/frontend/src/features/model-router/preset.ts index d021b9dcc..b149b40d2 100644 --- a/frontend/src/features/model-router/preset.ts +++ b/frontend/src/features/model-router/preset.ts @@ -43,6 +43,60 @@ export function supportsModelRouter(agentId: string) { export const ROUTER_PROVIDER_NAME = 'Dimo ModelRouter'; export const ROUTER_OPENCODE_PROVIDER_ID = 'dimo-modelrouter'; +/** + * Public model gateway. Matches the site `baseUrlForAgentImport` contract: + * Claude Code, Gemini CLI, and Antigravity use the root because those clients + * append their own version path. OpenAI-compatible clients need `/v1`. + */ +export const MODEL_GATEWAY_ORIGIN = 'https://model.dimo-ai.com'; +const LEGACY_MODEL_HOST = 'model.xforever.xin'; +const MODEL_GATEWAY_HOST = 'model.dimo-ai.com'; +const MODEL_GATEWAY_ROOT_AGENTS = new Set([ + 'claude_code', + 'gemini', + 'antigravity', +]); + +function isOfficialModelGateway(url: URL): boolean { + if (url.username || url.password) return false; + if (url.protocol !== 'https:' && url.protocol !== 'http:') return false; + if (url.port && url.port !== '443') return false; + const host = url.hostname.toLowerCase(); + if (host === LEGACY_MODEL_HOST || host === MODEL_GATEWAY_HOST) return true; + const path = url.pathname.replace(/\/+$/, '') || '/'; + const siteRouter = path === '/api/router' || path.startsWith('/api/router/'); + return ( + siteRouter && + (host === 'vibex.xforever.xin' || + host === 'dimo-ai.com' || + host === 'www.dimo-ai.com') + ); +} + +/** + * Rewrites only the official model gateway onto the current host and the path + * that agent's client expects. Any other URL, including a provider the user + * typed, is returned unchanged. + */ +export function officialModelBaseUrl(agentId: string, issued: string): string { + const trimmed = issued.trim(); + let url: URL; + try { + url = new URL(trimmed); + } catch { + return trimmed; + } + if (!isOfficialModelGateway(url)) return trimmed; + return MODEL_GATEWAY_ROOT_AGENTS.has(agentId) + ? MODEL_GATEWAY_ORIGIN + : `${MODEL_GATEWAY_ORIGIN}/v1`; +} + +function withOpenAiVersion(base: string): string { + const trimmed = base.replace(/\/+$/, ''); + return trimmed.endsWith('/v1') ? trimmed : `${trimmed}/v1`; +} + /** The chosen model first, then the rest the key can reach. */ function orderedModels(provision: RouterProvision) { return [ @@ -93,7 +147,7 @@ export function providerSaveRequest( id: existingId, name: ROUTER_PROVIDER_NAME, agent_id: provision.agentId, - api_url: provision.baseUrl, + api_url: officialModelBaseUrl(provision.agentId, provision.baseUrl), api_key: provision.apiKey, model: modelField(provision), }; @@ -104,14 +158,15 @@ export function openCodeConnectRequest( enabled = true ): OpenCodeProviderConnectRequest { const anthropic = provision.protocol === 'anthropic'; + const issued = officialModelBaseUrl(provision.agentId, provision.baseUrl); return { provider_id: ROUTER_OPENCODE_PROVIDER_ID, name: ROUTER_PROVIDER_NAME, npm: anthropic ? '@ai-sdk/anthropic' : '@ai-sdk/openai-compatible', api: null, - // The Anthropic SDK package expects the versioned root; the gateway's - // Anthropic base is unversioned because Claude Code appends /v1 itself. - base_url: anthropic ? `${provision.baseUrl}/v1` : provision.baseUrl, + // The Anthropic SDK package expects the versioned root. Claude Code keeps + // the unversioned gateway root and appends /v1 itself. + base_url: anthropic ? withOpenAiVersion(issued) : issued, api_key: provision.apiKey, models: orderedModels(provision).map((model) => ({ id: model.id, @@ -130,7 +185,7 @@ export function dshProviderSaveRequest( display_name: ROUTER_PROVIDER_NAME, notes: null, api: 'openai-completions', - base_url: provision.baseUrl, + base_url: officialModelBaseUrl(provision.agentId, provision.baseUrl), api_key: provision.apiKey, models: orderedModels(provision).map((model) => ({ id: model.id, diff --git a/frontend/src/lib/branding.ts b/frontend/src/lib/branding.ts index e8c4d2729..8a6d10385 100644 --- a/frontend/src/lib/branding.ts +++ b/frontend/src/lib/branding.ts @@ -1,6 +1,8 @@ export const APP_NAME = 'Dimo'; -export const DEFAULT_SITE_URL = 'https://vibex.xforever.xin'; +export const DEFAULT_SITE_URL = 'https://dimo-ai.com'; +/** Previous public site. Marketplace icons and saved origins on this host stay valid. */ +export const LEGACY_SITE_HOST = 'vibex.xforever.xin'; export const DEFAULT_DEV_SITE_URL = 'http://localhost:3100'; function resolveDefaultSiteUrl(): string { diff --git a/frontend/src/pages/plugins/OfficialPluginIcon.tsx b/frontend/src/pages/plugins/OfficialPluginIcon.tsx index 00767c4df..47f2e71a1 100644 --- a/frontend/src/pages/plugins/OfficialPluginIcon.tsx +++ b/frontend/src/pages/plugins/OfficialPluginIcon.tsx @@ -4,7 +4,11 @@ import { type ComponentType, type SVGProps, useId, useState } from 'react'; import { CONTRIBUTION_ICONS } from '@/components/plugins/contributionIcon'; import type { CoreFoundationArtworkKey } from '@/features/plugins/coreFoundationPlugins'; import type { CatalogListing } from '@/lib/api/plugins'; -import { getMarketplaceHost, getMarketplaceOrigin } from '@/lib/branding'; +import { + LEGACY_SITE_HOST, + getMarketplaceHost, + getMarketplaceOrigin, +} from '@/lib/branding'; import { listingPackageIds, @@ -659,7 +663,7 @@ export function allowedMarketplaceIconUrl(value: string): string | null { if (!isLoopbackHttp) { if (url.protocol !== 'https:') return null; if (url.port !== '' && url.port !== '443') return null; - if (host !== getMarketplaceHost()) return null; + if (host !== getMarketplaceHost() && host !== LEGACY_SITE_HOST) return null; } return url.href; } diff --git a/frontend/src/pages/plugins/PluginInstallTrustDialog.tsx b/frontend/src/pages/plugins/PluginInstallTrustDialog.tsx index 782af82e7..421beaee9 100644 --- a/frontend/src/pages/plugins/PluginInstallTrustDialog.tsx +++ b/frontend/src/pages/plugins/PluginInstallTrustDialog.tsx @@ -12,7 +12,11 @@ import { DialogTitle, } from '@/components/ui/dialog'; import type { CatalogListing } from '@/lib/api/plugins'; -import { getMarketplaceHost, getSiteHost } from '@/lib/branding'; +import { + LEGACY_SITE_HOST, + getMarketplaceHost, + getSiteHost, +} from '@/lib/branding'; import { officialListingName } from './officialPlugins'; export function listingSourceLabel( @@ -40,7 +44,8 @@ export function listingSourceLabel( if ( rawLower.includes('marketplace') || (marketplaceHost && rawLower.includes(marketplaceHost)) || - (siteHost && rawLower.includes(siteHost)) + (siteHost && rawLower.includes(siteHost)) || + rawLower.includes(LEGACY_SITE_HOST) ) { return t('plugins.installPreviewSourceOfficial'); } diff --git a/frontend/src/pages/plugins/PluginMarketplaceLogo.test.tsx b/frontend/src/pages/plugins/PluginMarketplaceLogo.test.tsx index e3cbdaeba..59ee8c4fe 100644 --- a/frontend/src/pages/plugins/PluginMarketplaceLogo.test.tsx +++ b/frontend/src/pages/plugins/PluginMarketplaceLogo.test.tsx @@ -145,13 +145,19 @@ describe('PluginMarketplaceLogo', () => { vi.unstubAllEnvs(); }); - it('respects DIMO_SITE_URL for allowlisted marketplace icon host', () => { + it('respects DIMO_SITE_URL and still allows the legacy marketplace host', () => { + expect(allowedMarketplaceIconUrl('https://dimo-ai.com/foo.png')).toBe( + 'https://dimo-ai.com/foo.png' + ); vi.stubEnv('DIMO_SITE_URL', 'https://site.example.com/'); expect(allowedMarketplaceIconUrl('https://site.example.com/foo.png')).toBe( 'https://site.example.com/foo.png' ); expect( allowedMarketplaceIconUrl('https://vibex.xforever.xin/foo.png') + ).toBe('https://vibex.xforever.xin/foo.png'); + expect( + allowedMarketplaceIconUrl('https://evil.example/foo.png') ).toBeNull(); }); }); diff --git a/frontend/src/pages/plugins/officialPlugins.test.ts b/frontend/src/pages/plugins/officialPlugins.test.ts index 4a475be5d..85dc2789a 100644 --- a/frontend/src/pages/plugins/officialPlugins.test.ts +++ b/frontend/src/pages/plugins/officialPlugins.test.ts @@ -133,6 +133,12 @@ describe('official plugin presentation', () => { sourceOrigin: 'https://vibex.xforever.xin/marketplace/dimo/office', }) ).toBe(false); + expect( + isOpenSourcePluginOrigin({ + sourceKind: 'marketplace', + sourceOrigin: 'https://dimo-ai.com/marketplace/dimo/office', + }) + ).toBe(false); }); it('allows uninstall only for non-builtin packages that support it', () => { diff --git a/frontend/src/pages/settings/RemoteClientSettings.tsx b/frontend/src/pages/settings/RemoteClientSettings.tsx index 215642a0a..b4b441d21 100644 --- a/frontend/src/pages/settings/RemoteClientSettings.tsx +++ b/frontend/src/pages/settings/RemoteClientSettings.tsx @@ -40,6 +40,7 @@ import { type HostClientProfile, type SavedHostUpdateView, } from '@/lib/api'; +import { getSiteUrl } from '@/lib/branding'; import { getErrorMessage } from '@/lib/modals'; import { cn } from '@/lib/utils'; @@ -219,8 +220,7 @@ export function RemoteClientSettings() { isSignedIn && overview?.relayPermission !== false ); const relayPublicOrigin = - overview?.assignedRelayServer?.publicOrigin?.trim() || - 'https://vibex.xforever.xin'; + overview?.assignedRelayServer?.publicOrigin?.trim() || getSiteUrl(); const locationContext = useContext(UNSAFE_LocationContext); const rawSearch = locationContext?.location.search ?? diff --git a/npx-cli/README.md b/npx-cli/README.md index 22e47093a..29adb1121 100644 --- a/npx-cli/README.md +++ b/npx-cli/README.md @@ -2,9 +2,9 @@ Official CLI and Host-family launcher for **Dimo** — the **Integrated Agent Development Environment (IADE)** unifying **20 built-in Coding Agents** (Claude Code, Codex, DeepSeek Harness, Google Antigravity, Cursor, OpenCode, Pi, Grok, Cline, OpenClaw, Hermes, CodeBuddy, Kimi Code, Qoder, Kiro CLI, Auggie, TRAE CLI, Command Code, ZCode, OMP) and the **Official ACP Registry** on a single local-first Rust Host. -- **Website**: [https://vibex.xforever.xin](https://vibex.xforever.xin) -- **Documentation**: [https://vibex.xforever.xin/docs](https://vibex.xforever.xin/docs) -- **Plugin Marketplace**: [https://vibex.xforever.xin/marketplace](https://vibex.xforever.xin/marketplace) +- **Website**: [https://dimo-ai.com](https://dimo-ai.com) +- **Documentation**: [https://dimo-ai.com/docs](https://dimo-ai.com/docs) +- **Plugin Marketplace**: [https://dimo-ai.com/marketplace](https://dimo-ai.com/marketplace) - **GitHub**: [https://github.com/DimoADE/Dimo](https://github.com/DimoADE/Dimo) --- diff --git a/npx-cli/bin/plugin.js b/npx-cli/bin/plugin.js index 681a8391f..dc974d4fe 100644 --- a/npx-cli/bin/plugin.js +++ b/npx-cli/bin/plugin.js @@ -438,7 +438,7 @@ async function addDevPlugin(source, flags) { } } -const DEFAULT_SITE_URL = "https://vibex.xforever.xin"; +const DEFAULT_SITE_URL = "https://dimo-ai.com"; function marketplaceOrigin(flag) { return String( diff --git a/npx-cli/bin/plugin.test.js b/npx-cli/bin/plugin.test.js index 60c2c91b5..ea8f00638 100644 --- a/npx-cli/bin/plugin.test.js +++ b/npx-cli/bin/plugin.test.js @@ -281,7 +281,6 @@ test("plugin publish parses credentials and marketplace origin", () => { assert.equal(packed.flags.showTree, true); const repo = parseArgs(["--web", "ada/notes#v1.2.0", "--owner", "ada"]); assert.equal(repo.flags.web, "ada/notes#v1.2.0"); - assert.equal(marketplaceOrigin(), "https://vibex.xforever.xin"); assert.equal( marketplaceOrigin("https://example.test/"), "https://example.test", @@ -291,6 +290,8 @@ test("plugin publish parses credentials and marketplace origin", () => { const prevMarketUrl = process.env.DIMO_MARKETPLACE_URL; try { delete process.env.DIMO_MARKETPLACE_URL; + delete process.env.DIMO_SITE_URL; + assert.equal(marketplaceOrigin(), "https://dimo-ai.com"); process.env.DIMO_SITE_URL = "https://site.example.com/"; assert.equal(marketplaceOrigin(), "https://site.example.com"); diff --git a/plugins/plugin-development/contents/skills/dimo-plugin-development/SKILL.md b/plugins/plugin-development/contents/skills/dimo-plugin-development/SKILL.md index 418728ef0..03db71184 100644 --- a/plugins/plugin-development/contents/skills/dimo-plugin-development/SKILL.md +++ b/plugins/plugin-development/contents/skills/dimo-plugin-development/SKILL.md @@ -165,7 +165,7 @@ dimo-plugin pack [--output file.vxp] dimo plugin add --profile file.vxp -y ``` -Git 源:`dimo plugin add --web #tag -y`。市场页:`dimo plugin add --web https://vibex.xforever.xin/marketplace// -y`。 +Git 源:`dimo plugin add --web #tag -y`。市场页:`dimo plugin add --web https://dimo-ai.com/marketplace// -y`。 用户明确要求上架时: diff --git a/plugins/plugin-development/contents/skills/dimo-plugin-development/references/link.md b/plugins/plugin-development/contents/skills/dimo-plugin-development/references/link.md index 8d02832f0..7dfa78d34 100644 --- a/plugins/plugin-development/contents/skills/dimo-plugin-development/references/link.md +++ b/plugins/plugin-development/contents/skills/dimo-plugin-development/references/link.md @@ -36,7 +36,7 @@ Host 未运行时,路径写入 `~/.dimo/imports/links.jsonl`,下次启动再 dimo plugin pack [dir] [--output file.vxp] dimo plugin add --profile file.vxp -y dimo plugin add --web #tag -y -dimo plugin add --web https://vibex.xforever.xin/marketplace// -y +dimo plugin add --web https://dimo-ai.com/marketplace// -y dimo plugin list dimo plugin update dimo plugin remove diff --git a/scripts/host-tunnel/test_public_ip.sh b/scripts/host-tunnel/test_public_ip.sh index 09db22de1..7d79b3a4a 100755 --- a/scripts/host-tunnel/test_public_ip.sh +++ b/scripts/host-tunnel/test_public_ip.sh @@ -53,4 +53,22 @@ ipaddr="$(PATH="${stubdir}:${PATH}" public_ip)" help_text="$(sh "${ROOT}/tunnel.sh" --help 2>&1 || true)" printf '%s\n' "${help_text}" | grep -q '\[-h \]' || fail "usage should mention -h public-host" +default_site="$( + unset DIMO_SITE_URL + TUNNEL_SH_LIB=1 + # shellcheck disable=SC1091 + . "${ROOT}/tunnel.sh" + printf '%s' "${SITE_URL}" +)" +[ "${default_site}" = "https://dimo-ai.com" ] || fail "default site should be https://dimo-ai.com, got ${default_site}" + +override_site="$( + DIMO_SITE_URL="https://override.example/" + TUNNEL_SH_LIB=1 + # shellcheck disable=SC1091 + . "${ROOT}/tunnel.sh" + printf '%s' "${SITE_URL}" +)" +[ "${override_site}" = "https://override.example" ] || fail "DIMO_SITE_URL should override the site, got ${override_site}" + echo "ok" diff --git a/scripts/host-tunnel/tunnel.sh b/scripts/host-tunnel/tunnel.sh index e2707cf00..ef564bc98 100755 --- a/scripts/host-tunnel/tunnel.sh +++ b/scripts/host-tunnel/tunnel.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Dimo public tunnel installer. POSIX sh. Safe to pipe: curl -fsSL https://vibex.xforever.xin/tunnel.sh | sh +# Dimo public tunnel installer. POSIX sh. Safe to pipe: curl -fsSL https://dimo-ai.com/tunnel.sh | sh set -eu TOKEN="" @@ -7,7 +7,7 @@ PORT="" HOST="" BIND="0.0.0.0" BIND_SET=0 -SITE_URL="${DIMO_SITE_URL:-https://vibex.xforever.xin}" +SITE_URL="${DIMO_SITE_URL:-https://dimo-ai.com}" SITE_URL="${SITE_URL%/}" PY_URL="${SITE_URL}/tunnel.py" MODE="install" diff --git a/scripts/package-host-family.test.js b/scripts/package-host-family.test.js index 0f3095e6e..cb491157a 100644 --- a/scripts/package-host-family.test.js +++ b/scripts/package-host-family.test.js @@ -20,7 +20,7 @@ test("packages server, companion, web UI, and official catalog without plugin pa path.join(root, "dimo-plugin.json"), JSON.stringify({ schemaVersion: 1, - marketplace: { origin: "https://vibex.xforever.xin", path: "/marketplace" }, + marketplace: { origin: "https://dimo-ai.com", path: "/marketplace" }, official: [ { id: "dimo.session-enhance", From 7ae9a032f4c5d96ed8f2d152ef4bd1de21040bdc Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 18 Nov 2026 20:51:43 +0000 Subject: [PATCH 2/3] style: clear fmt and clippy failures inherited from master Master already failed rustfmt, Prettier, and the Linux desktop clippy check after the developer-mode merge. Format those files and compile the Windows inspector shortcut only on Windows and in tests. Co-authored-by: XieXing --- crates/agents/src/manager.rs | 14 +-- crates/agents/src/manager/protocol/vendor.rs | 17 +-- crates/agents/src/runtime.rs | 100 +++++++++--------- crates/agents/src/runtime_temp.rs | 5 +- crates/browser-host/src/service.rs | 5 +- crates/browser-host/src/userdata.rs | 5 +- crates/git/src/cli.rs | 34 +++--- crates/git/src/validation.rs | 4 +- crates/server/src/chat_inbound.rs | 3 +- crates/server/src/chat_inbound_commands.rs | 35 +++++- crates/server/src/composition.rs | 4 +- .../server/src/domains/plugins_marketplace.rs | 4 +- crates/server/src/e2ee.rs | 8 +- crates/server/src/host/product.rs | 6 +- crates/server/src/host/streams.rs | 5 +- crates/server/src/ws.rs | 23 ++-- .../tests/webrtc_security_and_session.rs | 9 +- .../services/src/services/events/streams.rs | 49 ++++----- .../kanban/canvas/canvasModifierZoom.test.ts | 6 +- .../kanban/canvas/canvasModifierZoom.ts | 6 +- .../layout/HistoryImportStatusButton.test.tsx | 6 +- .../onboarding/OnboardingHistoryImport.tsx | 7 +- .../onboarding/onboardingHistory.ts | 4 +- .../host-browser/HostBrowserPanel.tsx | 6 +- .../host-browser/browserSurfaceBounds.ts | 18 +++- frontend/src/hooks/useProjects.test.tsx | 4 +- frontend/src/hooks/useProjects.ts | 3 +- frontend/src/lib/frontendPreferences.ts | 5 +- src-tauri/src/developer_mode.rs | 5 + 29 files changed, 212 insertions(+), 188 deletions(-) diff --git a/crates/agents/src/manager.rs b/crates/agents/src/manager.rs index adebeb5cf..d111a628a 100644 --- a/crates/agents/src/manager.rs +++ b/crates/agents/src/manager.rs @@ -1167,7 +1167,9 @@ impl AgentConnectionManager { /// Collect `(connection_id, session_id)` pairs whose Anthropic Prompt Cache /// is ready for `/compact` warm-preservation while the connection is idle. - pub async fn collect_idle_compaction_targets(&self) -> Vec<(AgentConnectionId, AgentSessionId)> { + pub async fn collect_idle_compaction_targets( + &self, + ) -> Vec<(AgentConnectionId, AgentSessionId)> { let candidates = { let connections = self.connections.lock().await; connections @@ -1187,14 +1189,8 @@ impl AgentConnectionManager { let now = Utc::now(); let mut targets = Vec::new(); - for ( - id, - status, - active_prompt, - pending_permissions, - pending_elicitations, - session_map, - ) in candidates + for (id, status, active_prompt, pending_permissions, pending_elicitations, session_map) in + candidates { if *status.lock().await != AgentConnectionStatus::Ready { continue; diff --git a/crates/agents/src/manager/protocol/vendor.rs b/crates/agents/src/manager/protocol/vendor.rs index ab17ba78e..d2d59adf9 100644 --- a/crates/agents/src/manager/protocol/vendor.rs +++ b/crates/agents/src/manager/protocol/vendor.rs @@ -172,7 +172,10 @@ pub(in crate::manager) fn qualify_omp_model_labels(options: &mut [AcpSessionConf } SessionConfigSelectOptions::Grouped(groups) => { for group in groups { - group.options.iter_mut().for_each(qualify_model_choice_label); + group + .options + .iter_mut() + .for_each(qualify_model_choice_label); } } #[allow(unreachable_patterns)] @@ -536,11 +539,8 @@ mod tests { let mut options = vec![model_option(vec![ SessionConfigSelectOption::new("mint/gpt-5.6-terra", "GPT-5.6 Terra") .description("mint/gpt-5.6-terra".to_string()), - SessionConfigSelectOption::new( - "cc-switch-open-router/stealth/ox-alpha", - "Ox Alpha", - ) - .description("cc-switch-open-router/stealth/ox-alpha".to_string()), + SessionConfigSelectOption::new("cc-switch-open-router/stealth/ox-alpha", "Ox Alpha") + .description("cc-switch-open-router/stealth/ox-alpha".to_string()), ])]; qualify_omp_model_labels(&mut options); @@ -555,7 +555,10 @@ mod tests { .iter() .map(|choice| choice.name.as_str()) .collect::>(); - assert_eq!(names, ["mint/GPT-5.6 Terra", "cc-switch-open-router/Ox Alpha"]); + assert_eq!( + names, + ["mint/GPT-5.6 Terra", "cc-switch-open-router/Ox Alpha"] + ); } #[test] diff --git a/crates/agents/src/runtime.rs b/crates/agents/src/runtime.rs index 4bb26ab48..8c955d260 100644 --- a/crates/agents/src/runtime.rs +++ b/crates/agents/src/runtime.rs @@ -462,14 +462,13 @@ impl AgentRuntime { if driver_enabled && let Some(idle_timeout) = crate::idle_sweep::idle_timeout_from_env() { let compact_state = Arc::clone(&state); let compact_manager = Arc::clone(&connection_manager); - let compact_trigger: crate::idle_sweep::IdleCompactionTrigger = - Arc::new(move || { - let state = Arc::clone(&compact_state); - let manager = Arc::clone(&compact_manager); - Box::pin(async move { - Self::dispatch_idle_compactions(&state, &manager).await; - }) - }); + let compact_trigger: crate::idle_sweep::IdleCompactionTrigger = Arc::new(move || { + let state = Arc::clone(&compact_state); + let manager = Arc::clone(&compact_manager); + Box::pin(async move { + Self::dispatch_idle_compactions(&state, &manager).await; + }) + }); tokio::spawn(crate::idle_sweep::idle_sweep_task( Arc::clone(&connection_manager), idle_timeout, @@ -525,7 +524,10 @@ impl AgentRuntime { } let now = Utc::now(); let prompt_id = AgentPromptId::new(); - if !matches!(session.queue.submit(prompt_id), QueueTransition::Started { .. }) { + if !matches!( + session.queue.submit(prompt_id), + QueueTransition::Started { .. } + ) { continue; } session.snapshot.active_prompt_id = session.queue.active(); @@ -545,7 +547,9 @@ impl AgentRuntime { prompt_id }; - connection_manager.touch_connection_activity(connection_id).await; + connection_manager + .touch_connection_activity(connection_id) + .await; if let Err(error) = connection_manager .send_prompt_with_display_blocks( connection_id, @@ -628,8 +632,8 @@ impl AgentRuntime { { continue; } - let is_background_compaction = active_before - .is_some_and(|id| state.background_compactions.contains(&id)); + let is_background_compaction = + active_before.is_some_and(|id| state.background_compactions.contains(&id)); let activity = crate::request_status::activity_for_event(&manager_event.event); if matches!(manager_event.event, AgentEvent::RequestActivity { .. }) && manager_event.prompt_id != active_before @@ -699,43 +703,42 @@ impl AgentRuntime { manager_event.session_id, manager_event.event, ); - let activity_envelope = if let (Some(prompt_id), Some(activity)) = - (active_before, activity) - { - let now = Utc::now(); - let previous = state.request_activity.get(&prompt_id); - let cancelling = previous.is_some_and(|(held, _)| { - held.phase == crate::request_status::RequestPhase::Cancelling - }); - let changed = previous.is_none_or(|(held, at)| { - held != &activity - || now.signed_duration_since(*at).num_seconds() >= 5 - }); - if changed - && (!cancelling - || activity.phase - == crate::request_status::RequestPhase::Cancelling) - { - state - .request_activity - .insert(prompt_id, (activity.clone(), now)); - (!explicit_activity).then(|| { - Self::queue_envelope_locked( - &mut state, - manager_event.connection_id, - manager_event.session_id, - AgentEvent::RequestActivity { - prompt_id, - activity, - }, - ) - }) + let activity_envelope = + if let (Some(prompt_id), Some(activity)) = (active_before, activity) { + let now = Utc::now(); + let previous = state.request_activity.get(&prompt_id); + let cancelling = previous.is_some_and(|(held, _)| { + held.phase == crate::request_status::RequestPhase::Cancelling + }); + let changed = previous.is_none_or(|(held, at)| { + held != &activity + || now.signed_duration_since(*at).num_seconds() >= 5 + }); + if changed + && (!cancelling + || activity.phase + == crate::request_status::RequestPhase::Cancelling) + { + state + .request_activity + .insert(prompt_id, (activity.clone(), now)); + (!explicit_activity).then(|| { + Self::queue_envelope_locked( + &mut state, + manager_event.connection_id, + manager_event.session_id, + AgentEvent::RequestActivity { + prompt_id, + activity, + }, + ) + }) + } else { + None + } } else { None - } - } else { - None - }; + }; if let Some(prompt_id) = active_before && state.prompts.get(&prompt_id).is_some_and(|p| { matches!( @@ -6167,7 +6170,8 @@ mod tests { }, }, }; - let active_before = AgentRuntime::active_prompt_for_manager_event_locked(&state, &event); + let active_before = + AgentRuntime::active_prompt_for_manager_event_locked(&state, &event); assert_eq!(active_before, Some(compact_prompt_id)); AgentRuntime::apply_manager_event_locked(&mut state, &event); let next = AgentRuntime::prompt_to_dispatch_after_manager_event_locked( diff --git a/crates/agents/src/runtime_temp.rs b/crates/agents/src/runtime_temp.rs index 0c712a509..7b543b0f6 100644 --- a/crates/agents/src/runtime_temp.rs +++ b/crates/agents/src/runtime_temp.rs @@ -191,10 +191,7 @@ pub fn sweep_stale_agent_runtime_temps() { removed += sweep_runtime_temp_bases_in(&base); } if removed > 0 { - tracing::info!( - removed, - "removed stale ACP temporary directories" - ); + tracing::info!(removed, "removed stale ACP temporary directories"); } } diff --git a/crates/browser-host/src/service.rs b/crates/browser-host/src/service.rs index 3a7b59f70..34517b749 100644 --- a/crates/browser-host/src/service.rs +++ b/crates/browser-host/src/service.rs @@ -387,7 +387,10 @@ impl BrowserService { let _ = self.native.close(&tab_id).await; } let _ = self.native.reset_all().await; - self.occupant.lock().unwrap_or_else(|p| p.into_inner()).take(); + self.occupant + .lock() + .unwrap_or_else(|p| p.into_inner()) + .take(); self.policy.set_user_rules(Vec::new()); *self.settings.lock().unwrap_or_else(|p| p.into_inner()) = BrowserSettings::default(); self.userdata.clear_all(); diff --git a/crates/browser-host/src/userdata.rs b/crates/browser-host/src/userdata.rs index 49eafbca8..610506c5d 100644 --- a/crates/browser-host/src/userdata.rs +++ b/crates/browser-host/src/userdata.rs @@ -474,7 +474,10 @@ impl UserDataManager { } let _ = fs::remove_dir_all(root); } - self.memory.lock().unwrap_or_else(|p| p.into_inner()).clear(); + self.memory + .lock() + .unwrap_or_else(|p| p.into_inner()) + .clear(); } fn profile_dir(&self, profile_id: &str) -> Option { diff --git a/crates/git/src/cli.rs b/crates/git/src/cli.rs index c91cb3824..c882088ed 100644 --- a/crates/git/src/cli.rs +++ b/crates/git/src/cli.rs @@ -1396,7 +1396,14 @@ impl GitCli { // --diff-filter to get status, --numstat for additions/deletions let name_status = self.git( worktree_path, - ["diff-tree", "--no-commit-id", "-r", "--name-status", sha, "--"], + [ + "diff-tree", + "--no-commit-id", + "-r", + "--name-status", + sha, + "--", + ], )?; let numstat = self.git( worktree_path, @@ -1978,8 +1985,12 @@ mod tests { let git = GitCli::new(); assert!( - git.add_remote(repo.path(), "--upload-pack=evil", "https://example.com/r.git") - .is_err() + git.add_remote( + repo.path(), + "--upload-pack=evil", + "https://example.com/r.git" + ) + .is_err() ); assert!( git.add_remote(repo.path(), "origin", "ext::sh -c evil") @@ -1989,19 +2000,10 @@ mod tests { git.add_remote(repo.path(), "origin", "--upload-pack=evil") .is_err() ); - assert!( - git.checkout_branch(repo.path(), "--orphan=evil") - .is_err() - ); - assert!( - git.delete_branch(repo.path(), "--force").is_err() - ); - assert!( - git.reset_to(repo.path(), "HEAD", "hard --merge").is_err() - ); - assert!( - git.cherry_pick(repo.path(), "--strategy=evil").is_err() - ); + assert!(git.checkout_branch(repo.path(), "--orphan=evil").is_err()); + assert!(git.delete_branch(repo.path(), "--force").is_err()); + assert!(git.reset_to(repo.path(), "HEAD", "hard --merge").is_err()); + assert!(git.cherry_pick(repo.path(), "--strategy=evil").is_err()); git.add_remote(repo.path(), "origin", "https://example.com/repo.git") .expect("valid remote should be added"); diff --git a/crates/git/src/validation.rs b/crates/git/src/validation.rs index 648044924..8a80b2840 100644 --- a/crates/git/src/validation.rs +++ b/crates/git/src/validation.rs @@ -63,9 +63,7 @@ pub(crate) fn validate_remote_name(remote: &str) -> Result<&str, GitCliError> { pub(crate) fn validate_remote_url(url: &str) -> Result<&str, GitCliError> { let trimmed = validate_cli_arg(url, "remote URL")?; let lower = trimmed.to_ascii_lowercase(); - if lower.starts_with("ext::") - || lower.starts_with("fd::") - || lower.starts_with("remote-ext::") + if lower.starts_with("ext::") || lower.starts_with("fd::") || lower.starts_with("remote-ext::") { return Err(GitCliError::CommandFailed(format!( "unsafe git remote transport is not allowed: {trimmed}" diff --git a/crates/server/src/chat_inbound.rs b/crates/server/src/chat_inbound.rs index 4a558312e..d83757f13 100644 --- a/crates/server/src/chat_inbound.rs +++ b/crates/server/src/chat_inbound.rs @@ -393,8 +393,7 @@ fn is_sender_authorized(kind: &str, config: &Value, sender_id: &str, chat_id: &s let explicit_senders = explicit_authorized_senders(config); if !explicit_senders.is_empty() { - return explicit_senders.contains(trimmed_sender) - || explicit_senders.contains(sender_base); + return explicit_senders.contains(trimmed_sender) || explicit_senders.contains(sender_base); } let trimmed_chat = chat_id.trim(); diff --git a/crates/server/src/chat_inbound_commands.rs b/crates/server/src/chat_inbound_commands.rs index c509d1ea5..7e37184d2 100644 --- a/crates/server/src/chat_inbound_commands.rs +++ b/crates/server/src/chat_inbound_commands.rs @@ -1195,15 +1195,30 @@ mod tests { "chat_id": "-100123", "authorized_senders": ["42"] }); - assert!(is_sender_authorized("telegram", &telegram_cfg, "42", "-100123")); - assert!(!is_sender_authorized("telegram", &telegram_cfg, "99", "-100123")); + assert!(is_sender_authorized( + "telegram", + &telegram_cfg, + "42", + "-100123" + )); + assert!(!is_sender_authorized( + "telegram", + &telegram_cfg, + "99", + "-100123" + )); let qq_cfg = json!({ "target_id": "group-42", "authorized_senders": ["admin-1"] }); assert!(is_sender_authorized("qq", &qq_cfg, "admin-1", "group-42")); - assert!(!is_sender_authorized("qq", &qq_cfg, "intruder-2", "group-42")); + assert!(!is_sender_authorized( + "qq", + &qq_cfg, + "intruder-2", + "group-42" + )); } #[test] @@ -1225,8 +1240,18 @@ mod tests { #[test] fn telegram_topic_scoped_sender_matches_base_allowlist_and_rejects_empty_sender() { let cfg = json!({ "chat_id": "-100123", "authorized_senders": ["42"] }); - assert!(is_sender_authorized("telegram", &cfg, "42:topic:777", "-100123")); - assert!(!is_sender_authorized("telegram", &cfg, ":topic:777", "-100123")); + assert!(is_sender_authorized( + "telegram", + &cfg, + "42:topic:777", + "-100123" + )); + assert!(!is_sender_authorized( + "telegram", + &cfg, + ":topic:777", + "-100123" + )); assert!(!is_sender_authorized( "telegram", &json!({ "chat_id": "-100123" }), diff --git a/crates/server/src/composition.rs b/crates/server/src/composition.rs index ea871bdeb..36db90d0b 100644 --- a/crates/server/src/composition.rs +++ b/crates/server/src/composition.rs @@ -491,9 +491,7 @@ impl HeadlessServer { app_surfaces, preview_proxy: preview_proxy.clone(), automation: automation_runtime.clone(), - automation_ownership: crate::AutomationOwnership::fixed( - automation_owner.is_some(), - ), + automation_ownership: crate::AutomationOwnership::fixed(automation_owner.is_some()), deployment: deployment.clone(), runtime_root: config.data_dir.join("plugins/runtimes"), worker_runtime, diff --git a/crates/server/src/domains/plugins_marketplace.rs b/crates/server/src/domains/plugins_marketplace.rs index 52b28a515..22d5329d2 100644 --- a/crates/server/src/domains/plugins_marketplace.rs +++ b/crates/server/src/domains/plugins_marketplace.rs @@ -1104,8 +1104,8 @@ pub(super) fn remove_managed_plugin_snapshot( fn is_remote_safe_plugin_host_call(capability: &str, operation: &str) -> bool { match capability { - "storage" | "storage.kv" | "browser" | "artifact.preview" | "artifact" - | "conversation" | "collaboration" | "workspace" | "blob" | "log" | "app" => true, + "storage" | "storage.kv" | "browser" | "artifact.preview" | "artifact" | "conversation" + | "collaboration" | "workspace" | "blob" | "log" | "app" => true, "provider.presets" => operation == "list", "plugin.self" => matches!(operation, "status" | "doctor"), _ => false, diff --git a/crates/server/src/e2ee.rs b/crates/server/src/e2ee.rs index bb3197d73..2740183cd 100644 --- a/crates/server/src/e2ee.rs +++ b/crates/server/src/e2ee.rs @@ -435,8 +435,7 @@ pub async fn e2ee_middleware(mut request: Request, next: Next) -> Response { .into_response(); }; if !resp_bytes.is_empty() { - let Ok(encrypted_b64) = - encrypt_payload(&active_session.key, AAD_RESP, &resp_bytes) + let Ok(encrypted_b64) = encrypt_payload(&active_session.key, AAD_RESP, &resp_bytes) else { return ( StatusCode::INTERNAL_SERVER_ERROR, @@ -626,7 +625,10 @@ mod tests { use tower::ServiceExt; let app = Router::new() - .route("/health", get(|| async { Json(serde_json::json!({"ok": true})) })) + .route( + "/health", + get(|| async { Json(serde_json::json!({"ok": true})) }), + ) .route( "/api/v1/echo", post(|body: String| async move { Json(serde_json::json!({ "body": body })) }), diff --git a/crates/server/src/host/product.rs b/crates/server/src/host/product.rs index 3268b9601..66c33f056 100644 --- a/crates/server/src/host/product.rs +++ b/crates/server/src/host/product.rs @@ -1660,9 +1660,9 @@ impl ServerApplicationDomains { } else { resolved_path }; - let parent = path - .parent() - .ok_or_else(|| ApplicationError::bad_request("Workflow source has no parent directory"))?; + let parent = path.parent().ok_or_else(|| { + ApplicationError::bad_request("Workflow source has no parent directory") + })?; if !parent.is_dir() { return Err(ApplicationError::not_found(format!( "Parent directory does not exist: {}", diff --git a/crates/server/src/host/streams.rs b/crates/server/src/host/streams.rs index 43ba2edde..ee3e271fd 100644 --- a/crates/server/src/host/streams.rs +++ b/crates/server/src/host/streams.rs @@ -146,7 +146,10 @@ impl ServerApplicationDomains { .await .map_err(internal_error)? .ok_or_else(|| { - ApplicationError::not_found(format!("Workspace {} not found", args.workspace_id)) + ApplicationError::not_found(format!( + "Workspace {} not found", + args.workspace_id + )) })?; let stats = args.stats_only.unwrap_or(false); let channel = if stats { diff --git a/crates/server/src/ws.rs b/crates/server/src/ws.rs index c2472490b..c0aedcad5 100644 --- a/crates/server/src/ws.rs +++ b/crates/server/src/ws.rs @@ -708,9 +708,8 @@ where { let text = serde_json::to_string(&message).map_err(|_| ())?; let wire_text = if let Some(key) = e2ee_key { - let encrypted = - crate::e2ee::encrypt_payload(key, crate::e2ee::AAD_WS, text.as_bytes()) - .map_err(|_| ())?; + let encrypted = crate::e2ee::encrypt_payload(key, crate::e2ee::AAD_WS, text.as_bytes()) + .map_err(|_| ())?; serde_json::json!({ "type": "e2ee", "d": encrypted, @@ -759,12 +758,9 @@ mod tests { let plaintext = r#"{"type":"ping"}"#; assert!(decode_ws_text(plaintext, Some(&session), &mut active_key).is_err()); - let encrypted = crate::e2ee::encrypt_payload( - &session.key, - crate::e2ee::AAD_WS, - plaintext.as_bytes(), - ) - .expect("encrypt ws payload"); + let encrypted = + crate::e2ee::encrypt_payload(&session.key, crate::e2ee::AAD_WS, plaintext.as_bytes()) + .expect("encrypt ws payload"); let wrapped = serde_json::json!({ "type": "e2ee", "d": encrypted }).to_string(); assert_eq!( decode_ws_text(&wrapped, Some(&session), &mut active_key).expect("decrypt ws frame"), @@ -789,12 +785,9 @@ mod tests { plaintext ); - let encrypted = crate::e2ee::encrypt_payload( - &session.key, - crate::e2ee::AAD_WS, - plaintext.as_bytes(), - ) - .expect("encrypt ws payload"); + let encrypted = + crate::e2ee::encrypt_payload(&session.key, crate::e2ee::AAD_WS, plaintext.as_bytes()) + .expect("encrypt ws payload"); let wrapped = serde_json::json!({ "type": "e2ee", "d": encrypted }).to_string(); assert!(decode_ws_text(&wrapped, Some(&session), &mut active_key).is_ok()); assert!(active_key.is_some()); diff --git a/crates/server/tests/webrtc_security_and_session.rs b/crates/server/tests/webrtc_security_and_session.rs index 9e8c02e6d..62f60903a 100644 --- a/crates/server/tests/webrtc_security_and_session.rs +++ b/crates/server/tests/webrtc_security_and_session.rs @@ -736,12 +736,9 @@ async fn unauthenticated_connect_request_cannot_revoke_mobile_or_probe_device_na .await .expect("response"); assert_eq!(resp.status(), StatusCode::CREATED); - let created: PollDeviceConnectResponse = serde_json::from_slice( - &to_bytes(resp.into_body(), 16 * 1024) - .await - .expect("body"), - ) - .expect("json"); + let created: PollDeviceConnectResponse = + serde_json::from_slice(&to_bytes(resp.into_body(), 16 * 1024).await.expect("body")) + .expect("json"); assert_eq!(created.status, DeviceConnectRequestStatus::Pending); // Victim's active mobile credential MUST remain valid before host approval. diff --git a/crates/services/src/services/events/streams.rs b/crates/services/src/services/events/streams.rs index 24ac64416..c6a569d56 100644 --- a/crates/services/src/services/events/streams.rs +++ b/crates/services/src/services/events/streams.rs @@ -143,17 +143,11 @@ impl EventService { let writer_pool = self.db.pool.clone(); let mut ensure_task = tokio::spawn(async move { crate::services::project::ProjectService::new() - .ensure_home_project( - &writer_pool, - &crate::services::repo::RepoService::new(), - ) + .ensure_home_project(&writer_pool, &crate::services::repo::RepoService::new()) .await }); - match tokio::time::timeout( - std::time::Duration::from_millis(500), - &mut ensure_task, - ) - .await + match tokio::time::timeout(std::time::Duration::from_millis(500), &mut ensure_task) + .await { Ok(Ok(Ok(_))) => { projects = Project::find_all(&read_pool).await?; @@ -355,27 +349,22 @@ impl EventService { let receiver = self.msg_store.get_receiver(); // Propagate transient database lock/pool errors so subscribers retry, while // treating corrupted/malformed scratch payloads the same as "scratch not found". - let scratch = match Scratch::find_by_id( - self.db.reader().as_pool(), - scratch_id, - scratch_type, - ) - .await - { - Ok(scratch) => scratch, - Err(db::models::scratch::ScratchError::Database(sqlx_err)) => { - return Err(EventError::Sqlx(sqlx_err)); - } - Err(e) => { - tracing::warn!( - scratch_id = %scratch_id, - scratch_type = %scratch_type, - error = %e, - "Failed to load scratch, treating as empty" - ); - None - } - }; + let scratch = + match Scratch::find_by_id(self.db.reader().as_pool(), scratch_id, scratch_type).await { + Ok(scratch) => scratch, + Err(db::models::scratch::ScratchError::Database(sqlx_err)) => { + return Err(EventError::Sqlx(sqlx_err)); + } + Err(e) => { + tracing::warn!( + scratch_id = %scratch_id, + scratch_type = %scratch_type, + error = %e, + "Failed to load scratch, treating as empty" + ); + None + } + }; let initial_patch = json!([{ "op": "replace", diff --git a/frontend/src/components/kanban/canvas/canvasModifierZoom.test.ts b/frontend/src/components/kanban/canvas/canvasModifierZoom.test.ts index fad3e3d5b..931804930 100644 --- a/frontend/src/components/kanban/canvas/canvasModifierZoom.test.ts +++ b/frontend/src/components/kanban/canvas/canvasModifierZoom.test.ts @@ -14,9 +14,9 @@ describe('canvas modifier zoom', () => { expect(isCanvasModifierZoomWheel({ ctrlKey: false, metaKey: true })).toBe( true ); - expect( - isCanvasModifierZoomWheel({ ctrlKey: false, metaKey: false }) - ).toBe(false); + expect(isCanvasModifierZoomWheel({ ctrlKey: false, metaKey: false })).toBe( + false + ); }); it('zooms toward the pointer and keeps that canvas point under the cursor', () => { diff --git a/frontend/src/components/kanban/canvas/canvasModifierZoom.ts b/frontend/src/components/kanban/canvas/canvasModifierZoom.ts index 223d74a49..e283641ec 100644 --- a/frontend/src/components/kanban/canvas/canvasModifierZoom.ts +++ b/frontend/src/components/kanban/canvas/canvasModifierZoom.ts @@ -25,10 +25,8 @@ export function nextCanvasModifierZoom(input: { minZoom: number; maxZoom: number; }): CanvasZoomViewport { - const modeScale = - input.deltaMode === 1 ? 0.05 : input.deltaMode ? 1 : 0.002; - const wheelDelta = - -input.deltaY * modeScale * (input.pinchBoost ? 10 : 1); + const modeScale = input.deltaMode === 1 ? 0.05 : input.deltaMode ? 1 : 0.002; + const wheelDelta = -input.deltaY * modeScale * (input.pinchBoost ? 10 : 1); const zoom = clamp( input.viewport.zoom * Math.pow(2, wheelDelta), input.minZoom, diff --git a/frontend/src/components/layout/HistoryImportStatusButton.test.tsx b/frontend/src/components/layout/HistoryImportStatusButton.test.tsx index 5b91b3e40..fd7b88d4d 100644 --- a/frontend/src/components/layout/HistoryImportStatusButton.test.tsx +++ b/frontend/src/components/layout/HistoryImportStatusButton.test.tsx @@ -63,9 +63,9 @@ describe('history import status button', () => { armQuietHistoryImport(); render(); fireEvent.click(screen.getByRole('button', { name: label('open') })); - expect(screen.getByRole('region', { name: label('title') })).toHaveTextContent( - 'Build the importer' - ); + expect( + screen.getByRole('region', { name: label('title') }) + ).toHaveTextContent('Build the importer'); expect( screen.getByText(label('running', { current: 1, total: 4 })) ).toBeInTheDocument(); diff --git a/frontend/src/components/onboarding/OnboardingHistoryImport.tsx b/frontend/src/components/onboarding/OnboardingHistoryImport.tsx index 7ae891f12..33164ceda 100644 --- a/frontend/src/components/onboarding/OnboardingHistoryImport.tsx +++ b/frontend/src/components/onboarding/OnboardingHistoryImport.tsx @@ -132,8 +132,7 @@ export function OnboardingHistoryImport({ const leaveEarly = useRef(false); const onFinishRef = useRef(onFinish); onFinishRef.current = onFinish; - const running = - busy || importPhase !== null || job?.status === 'running'; + const running = busy || importPhase !== null || job?.status === 'running'; const continueOnboarding = useCallback(async () => { if (continued.current) return; continued.current = true; @@ -842,9 +841,7 @@ export function OnboardingHistoryImport({ {job.progress ? (

{t('onboarding.importResult', job.progress)} - {job.progress.title - ? ` · ${job.progress.title}` - : ''} + {job.progress.title ? ` · ${job.progress.title}` : ''}

) : null} {job.result?.errors.map((message, index) => ( diff --git a/frontend/src/components/onboarding/onboardingHistory.ts b/frontend/src/components/onboarding/onboardingHistory.ts index b78e23f2a..974816e60 100644 --- a/frontend/src/components/onboarding/onboardingHistory.ts +++ b/frontend/src/components/onboarding/onboardingHistory.ts @@ -136,9 +136,7 @@ export async function prepareOnboardingHistoryImport( ); } const scannedWorkspace = - !override && folder.project_id === projectId - ? folder.workspace_id - : null; + !override && folder.project_id === projectId ? folder.workspace_id : null; const workspaceId = scannedWorkspace || (await resolveWorkspace(projectId)); for (const session of folder.sessions) { const sessionKey = localHistorySessionKey(session); diff --git a/frontend/src/features/host-browser/HostBrowserPanel.tsx b/frontend/src/features/host-browser/HostBrowserPanel.tsx index f56bd56f4..c810378e1 100644 --- a/frontend/src/features/host-browser/HostBrowserPanel.tsx +++ b/frontend/src/features/host-browser/HostBrowserPanel.tsx @@ -1132,8 +1132,10 @@ export function HostBrowserPanel({ } }; const hide = - overlayCoversBrowser(hostRef.current, latestOverlayOcclusionRef.current) || - canvasLayerCoversBrowser(hostRef.current); + overlayCoversBrowser( + hostRef.current, + latestOverlayOcclusionRef.current + ) || canvasLayerCoversBrowser(hostRef.current); if ( occludedRef.current === hide && hideTargetRef.current == null && diff --git a/frontend/src/features/host-browser/browserSurfaceBounds.ts b/frontend/src/features/host-browser/browserSurfaceBounds.ts index 411c8b65a..0a67e151c 100644 --- a/frontend/src/features/host-browser/browserSurfaceBounds.ts +++ b/frontend/src/features/host-browser/browserSurfaceBounds.ts @@ -33,7 +33,10 @@ export function browserSurfaceRectsOverlap( ): boolean { const right = Math.min(a.right, b.right); const bottom = Math.min(a.bottom, b.bottom); - return right - Math.max(a.left, b.left) >= 1 && bottom - Math.max(a.top, b.top) >= 1; + return ( + right - Math.max(a.left, b.left) >= 1 && + bottom - Math.max(a.top, b.top) >= 1 + ); } /** @@ -48,7 +51,11 @@ export function clipBrowserSurfaceRect( if (!host) return rect; let clipped = rect; let parent = host.parentElement; - while (parent && parent !== document.body && parent !== document.documentElement) { + while ( + parent && + parent !== document.body && + parent !== document.documentElement + ) { if (parent.matches(CANVAS_STAGE_CLIP_SELECTOR)) { const bounds = parent.getBoundingClientRect(); if (bounds.width > 0 && bounds.height > 0) { @@ -86,7 +93,8 @@ export function canvasLayerCoversBrowser(host: HTMLElement | null): boolean { const ownNode = host.closest('.react-flow__node') as HTMLElement | null; if (ownNode) { const ownZ = parseFlowNodeZIndex(ownNode); - const allNodes = flowRoot.querySelectorAll('.react-flow__node'); + const allNodes = + flowRoot.querySelectorAll('.react-flow__node'); for (const otherNode of allNodes) { if ( otherNode === ownNode || @@ -110,7 +118,9 @@ export function canvasLayerCoversBrowser(host: HTMLElement | null): boolean { Node.DOCUMENT_POSITION_FOLLOWING )); if (!stacksAbove) continue; - if (browserSurfaceRectsOverlap(clipped, otherNode.getBoundingClientRect())) { + if ( + browserSurfaceRectsOverlap(clipped, otherNode.getBoundingClientRect()) + ) { return true; } } diff --git a/frontend/src/hooks/useProjects.test.tsx b/frontend/src/hooks/useProjects.test.tsx index 5ccaf2bc0..f038717e3 100644 --- a/frontend/src/hooks/useProjects.test.tsx +++ b/frontend/src/hooks/useProjects.test.tsx @@ -134,9 +134,7 @@ describe('useProjects and useProjectMutations in WebUI/remote mode', () => { vi.useFakeTimers(); const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {}); let attempt = 0; - let resolveTail: - | ((value: IteratorResult) => void) - | undefined; + let resolveTail: ((value: IteratorResult) => void) | undefined; const savedProject = makeProject({ id: 'proj-050', name: 'Migrated 0.5.0 Project', diff --git a/frontend/src/hooks/useProjects.ts b/frontend/src/hooks/useProjects.ts index adf21fc0e..4209d0d72 100644 --- a/frontend/src/hooks/useProjects.ts +++ b/frontend/src/hooks/useProjects.ts @@ -63,7 +63,8 @@ export function useProjects(): UseProjectsResult { (remote && remoteProjects.data !== undefined) || (!remote && data) ? projects : undefined; - const waitingForInitialRetry = !isInitialized && isRetrying && retryCount <= 2; + const waitingForInitialRetry = + !isInitialized && isRetrying && retryCount <= 2; const errorObj = useMemo( () => remote diff --git a/frontend/src/lib/frontendPreferences.ts b/frontend/src/lib/frontendPreferences.ts index 9ee76621b..e4dffaeb1 100644 --- a/frontend/src/lib/frontendPreferences.ts +++ b/frontend/src/lib/frontendPreferences.ts @@ -97,7 +97,10 @@ let lastLocalPreferenceWriteAt = 0; let localResetEpochAt = 0; function isWithinLocalResetWindow(now = Date.now()): boolean { - return localResetEpochAt > 0 && now - localResetEpochAt < LOCAL_RESET_SUPPRESSION_MS; + return ( + localResetEpochAt > 0 && + now - localResetEpochAt < LOCAL_RESET_SUPPRESSION_MS + ); } export function clearLocalFrontendStorage(): void { diff --git a/src-tauri/src/developer_mode.rs b/src-tauri/src/developer_mode.rs index b50a0e891..34503cbec 100644 --- a/src-tauri/src/developer_mode.rs +++ b/src-tauri/src/developer_mode.rs @@ -34,9 +34,12 @@ const HOTKEY_INSTALL: &str = r#" })(); "#; +#[cfg(any(windows, test))] const VK_F12: u32 = 0x7B; +#[cfg(any(windows, test))] const VK_I: u32 = 0x49; +#[cfg(any(windows, test))] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum InspectShortcut { Ignore, @@ -48,6 +51,8 @@ pub enum InspectShortcut { /// Release WebView2 keeps its own F12 shortcut after `AreDevToolsEnabled` was /// turned on. Closing developer mode must swallow that key, not only skip our /// open call. +#[cfg(any(windows, test))] +#[allow(clippy::too_many_arguments)] pub fn inspect_shortcut_action( enabled: bool, key: u32, From 98ca17558096075506a6af00a1bab4dc91c0be26 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 18 Nov 2026 21:24:38 +0000 Subject: [PATCH 3/3] test: report workflow isolation evidence when the CI e2e misses it The GitHub workflow e2e passed on master and on the previous commit, then failed once with a null isolation flag after the worktree was created. Include the stored evidence and step failure in that assertion. Co-authored-by: XieXing --- crates/server/tests/workflow_pulse_e2e.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/server/tests/workflow_pulse_e2e.rs b/crates/server/tests/workflow_pulse_e2e.rs index 7cdb041a0..63537fb07 100644 --- a/crates/server/tests/workflow_pulse_e2e.rs +++ b/crates/server/tests/workflow_pulse_e2e.rs @@ -838,7 +838,6 @@ async fn github_ci_webhook_triggers_isolated_session_workflow_and_posts_pr_and_c assert_eq!(step1_err.0, "failed"); let evidence1: Value = serde_json::from_str(step1_err.1.as_deref().unwrap_or("{}")) .expect("parse run 1 evidence json"); - assert_eq!(evidence1["workspace"]["isolated"], true); let step_failed_events: Vec = sqlx::query_scalar( "SELECT payload_json FROM workflow_events WHERE run_id = ? AND event_kind = 'step_failed'", ) @@ -846,6 +845,10 @@ async fn github_ci_webhook_triggers_isolated_session_workflow_and_posts_pr_and_c .fetch_all(pool) .await .expect("query step_failed events"); + assert_eq!( + evidence1["workspace"]["isolated"], true, + "run 1 evidence missing isolation: {evidence1}; step_failed: {step_failed_events:?}" + ); assert!( step_failed_events .iter()