🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🔧 chore: type-check with bun check and fix IPC type errors (#20498)
Innei58ca54300f70
diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.ymlindex c07f4b2a109..8e2544f12ec 100644--- a/.github/actions/setup-env/action.yml+++ b/.github/actions/setup-env/action.yml@@ -13,7 +13,7 @@ inputs:bun-version:description: Bun versionrequired: false- default: '1.3.2'+ default: 'canary'runs:using: compositediff --git a/.github/workflows/release-sdk.yml b/.github/workflows/release-sdk.ymlindex 9e8f778889b..441143ba0f5 100644--- a/.github/workflows/release-sdk.yml+++ b/.github/workflows/release-sdk.yml@@ -37,7 +37,7 @@ jobs:- name: Install bunuses: oven-sh/setup-bun@v2with:- bun-version: '1.3.2'+ bun-version: 'canary'- name: Install dependenciesrun: pnpm installdiff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex f3d593f341f..3d20d216621 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -240,7 +240,7 @@ jobs:- name: Install bunuses: oven-sh/setup-bun@v2with:- bun-version: '1.3.2'+ bun-version: 'canary'- name: Verify Windows shell strategyrun: bun run packages/local-file-shell/scripts/verify-windows-shell.tsdiff --git a/AGENTS.md b/AGENTS.mdindex a577d54a08b..33b3a176181 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -78,7 +78,8 @@ Use `bun run check [changed-files...]`.- Every bug fix needs a regression test that fails before the fix and passes after it. Skip pure style/CSS fixes when the only practical assertion would match stylesheet source strings.- Run once with the selectors needed: no selector means lint + related tests; `--lint`, `--test`, and `--type` compose. Default scope is all staged, unstaged and untracked changes; explicit paths override it.-- Lint autofixes files: review the emitted diff. Tests use the nearest owning Vitest config. `--type` checks the full repo. Never run `bun run test`, which runs the full suite.+- Lint autofixes files: review the emitted diff. Tests use the nearest owning Vitest config. `--type` checks the full repo (`bun run type-check`). Never run `bun run test`, which runs the full suite.+- `bun run type-check` runs Bun's builtin checker (`bun --check --tsconfig-override tsconfig.type-check.json`). That needs Bun ≥ 1.4.3. The package.json `check` script is the agent CLI (`bun run check`).- `--alint` is opt-in: model-backed rules in `packages/alint/` for judgement calls eslint cannot express. It needs a provider (`bun run alint:setup`); findings are warnings to fix or justify in the PR.- For a manual package test, run from the owning package: `cd packages/database && bunx vitest run --silent='passed-only' '[file-path]'`.diff --git a/apps/desktop/src/main/controllers/McpInstallCtr.ts b/apps/desktop/src/main/controllers/McpInstallCtr.tsindex 94ce1fa5ad3..bb12a82d57e 100644--- a/apps/desktop/src/main/controllers/McpInstallCtr.ts+++ b/apps/desktop/src/main/controllers/McpInstallCtr.ts@@ -58,6 +58,8 @@ interface McpInstallParams {* Responsible for handling MCP plugin installation process*/export default class McpInstallController extends ControllerModule {+ static override readonly groupName = 'mcpInstall';+/*** Handle MCP plugin installation request* @param parsedData Parsed protocol datadiff --git a/apps/desktop/src/main/controllers/__tests__/controllerDefaultExport.test.ts b/apps/desktop/src/main/controllers/__tests__/controllerDefaultExport.test.tsindex f4cc86faafb..8d6e8031c1d 100644--- a/apps/desktop/src/main/controllers/__tests__/controllerDefaultExport.test.ts+++ b/apps/desktop/src/main/controllers/__tests__/controllerDefaultExport.test.ts@@ -1,5 +1,9 @@import { describe, expect, it } from 'vitest';+import HeteroSessionCtr from '../HeteroSessionCtr';+import McpInstallCtr from '../McpInstallCtr';+import { controllerIpcConstructors } from '../registry';+const controllerModules = import.meta.glob('../*Ctr.ts', { eager: true }) as Record<string,{ default?: unknown }@@ -14,3 +18,15 @@ describe('controller default exports', () => {}});});++describe('controllerIpcConstructors', () => {+ it('registers HeteroSessionCtr with unique non-empty group names', () => {+ expect(controllerIpcConstructors).toContain(HeteroSessionCtr);+ expect(HeteroSessionCtr.groupName).toBe('heteroSession');+ expect(McpInstallCtr.groupName).toBe('mcpInstall');++ const names = controllerIpcConstructors.map((Ctor) => Ctor.groupName);+ expect(names.every((name) => typeof name === 'string' && name.length > 0)).toBe(true);+ expect(new Set(names).size).toBe(names.length);+ });+});diff --git a/apps/desktop/src/main/controllers/registry.ts b/apps/desktop/src/main/controllers/registry.tsindex 3ddeb7dca97..2f58dbfb360 100644--- a/apps/desktop/src/main/controllers/registry.ts+++ b/apps/desktop/src/main/controllers/registry.ts@@ -13,6 +13,7 @@ import DevtoolsCtr from './DevtoolsCtr';import GatewayConnectionCtr from './GatewayConnectionCtr';import GitCtr from './GitCtr';import HeterogeneousAgentCtr from './HeterogeneousAgentCtr';+import HeteroSessionCtr from './HeteroSessionCtr';import ImessageBridgeCtr from './ImessageBridgeCtr';import LocalDatabaseCtr from './LocalDatabaseCtr';import LocalFileCtr from './LocalFileCtr';@@ -37,6 +38,7 @@ import WorkspaceCtr from './WorkspaceCtr';export const controllerIpcConstructors = [HeterogeneousAgentCtr,+ HeteroSessionCtr,AuthCtr,AuvCtr,BrowserControlCtr,diff --git a/package.json b/package.jsonindex 36b02aeb9a4..e89c515d6ac 100644--- a/package.json+++ b/package.json@@ -131,7 +131,7 @@"test-app:coverage": "vitest --coverage --silent='passed-only'","tunnel:cloudflare": "cloudflared tunnel --url http://localhost:3010 --protocol http2","tunnel:ngrok": "ngrok http http://localhost:3010",- "type-check": "tsgo -p tsconfig.type-check.json --noEmit --checkers 2",+ "type-check": "bun --check --tsconfig-override tsconfig.type-check.json","type-check:tsc": "tsc --noEmit","widget:tick": "tsx ./scripts/widgetTick/index.mts","workflow:cdn": "tsx ./scripts/cdnWorkflow/index.ts",diff --git a/packages/electron-client-ipc/src/types/binary.ts b/packages/electron-client-ipc/src/types/binary.tsindex 11a533d9173..8d7a40bfdce 100644--- a/packages/electron-client-ipc/src/types/binary.ts+++ b/packages/electron-client-ipc/src/types/binary.ts@@ -17,7 +17,15 @@ export interface BinaryStatus {/*** Binary categories*/-export type BinaryCategory = 'content-search' | 'custom' | 'file-search' | 'system';+export type BinaryCategory =+ | 'ast-search'+ | 'browser-automation'+ | 'cli-agents'+ | 'content-search'+ | 'custom'+ | 'file-search'+ | 'runtime-environment'+ | 'system';/*** Binary info for displaydiff --git a/src/services/electron/binary.test.ts b/src/services/electron/binary.test.tsnew file mode 100644index 00000000000..1eca681b73f--- /dev/null+++ b/src/services/electron/binary.test.ts@@ -0,0 +1,41 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';++const binary = vi.hoisted(() => ({+ clearCache: vi.fn(),+ getAllStatus: vi.fn(),+ getCategories: vi.fn(),+ getInCategory: vi.fn(),+ getRegistered: vi.fn(),+ getStatus: vi.fn(),+}));++vi.mock('@/utils/electron/ipc', () => ({+ ensureElectronIpc: () => ({ binary }),+}));++describe('binaryService cached IPC wrappers', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ });++ it('awaits sync main-process getters over IPC', async () => {+ const { binaryService } = await import('./binary');++ binary.getStatus.mockResolvedValue({ available: true });+ binary.getAllStatus.mockResolvedValue({ claude: { available: true } });+ binary.getRegistered.mockResolvedValue(['claude']);+ binary.getCategories.mockResolvedValue(['system']);+ binary.getInCategory.mockResolvedValue([{ name: 'claude' }]);+ binary.clearCache.mockResolvedValue(undefined);++ await expect(binaryService.getStatus('claude')).resolves.toEqual({ available: true });+ await expect(binaryService.getAllStatus()).resolves.toEqual({ claude: { available: true } });+ await expect(binaryService.getRegistered()).resolves.toEqual(['claude']);+ await expect(binaryService.getCategories()).resolves.toEqual(['system']);+ await expect(binaryService.getInCategory('system')).resolves.toEqual([{ name: 'claude' }]);+ await expect(binaryService.clearCache('claude')).resolves.toBeUndefined();++ expect(binary.getStatus).toHaveBeenCalledWith('claude');+ expect(binary.clearCache).toHaveBeenCalledWith('claude');+ });+});diff --git a/src/services/electron/binary.ts b/src/services/electron/binary.tsindex cbe2c78c52a..bfbfefb91d6 100644--- a/src/services/electron/binary.ts+++ b/src/services/electron/binary.ts@@ -49,42 +49,42 @@ class BinaryService {/*** Get cached status for a binary (no detection)*/- getStatus = (name: string): BinaryStatus | null => {+ getStatus = async (name: string): Promise<BinaryStatus | null> => {return ensureElectronIpc().binary.getStatus(name);};/*** Get all cached statuses (no detection)*/- getAllStatus = (): Record<string, BinaryStatus> => {+ getAllStatus = async (): Promise<Record<string, BinaryStatus>> => {return ensureElectronIpc().binary.getAllStatus();};/*** Clear binary status cache*/- clearCache = (name?: string): void => {- ensureElectronIpc().binary.clearCache(name);+ clearCache = async (name?: string): Promise<void> => {+ await ensureElectronIpc().binary.clearCache(name);};/*** Get list of registered binary names*/- getRegistered = (): string[] => {+ getRegistered = async (): Promise<string[]> => {return ensureElectronIpc().binary.getRegistered();};/*** Get all categories*/- getCategories = (): BinaryCategory[] => {+ getCategories = async (): Promise<BinaryCategory[]> => {return ensureElectronIpc().binary.getCategories();};/*** Get binaries in a category with their info*/- getInCategory = (category: BinaryCategory): BinaryInfo[] => {+ getInCategory = async (category: BinaryCategory): Promise<BinaryInfo[]> => {return ensureElectronIpc().binary.getInCategory(category);};diff --git a/src/services/electron/heteroSession.test.ts b/src/services/electron/heteroSession.test.tsnew file mode 100644index 00000000000..0957ab1c9f6--- /dev/null+++ b/src/services/electron/heteroSession.test.ts@@ -0,0 +1,49 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';++const heteroSession = vi.hoisted(() => ({+ getDirPrefs: vi.fn(),+ listLocalSessions: vi.fn(),+ readLocalSession: vi.fn(),+ setDirPref: vi.fn(),+}));++vi.mock('@/utils/electron/ipc', () => ({+ ensureElectronIpc: () => ({ heteroSession }),+}));++describe('electronHeteroSessionService', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ });++ it('forwards scan and pref calls over the heteroSession IPC group', async () => {+ const { electronHeteroSessionService } = await import('./heteroSession');+ const scan = { errors: [], groups: [] };+ heteroSession.listLocalSessions.mockResolvedValue(scan);+ heteroSession.readLocalSession.mockResolvedValue(null);+ heteroSession.getDirPrefs.mockResolvedValue({});+ heteroSession.setDirPref.mockResolvedValue(undefined);++ await expect(electronHeteroSessionService.listLocalSessions()).resolves.toEqual(scan);+ await expect(+ electronHeteroSessionService.readLocalSession({+ filePath: '/tmp/session.jsonl',+ source: 'claude-code',+ }),+ ).resolves.toBeNull();+ await expect(electronHeteroSessionService.getDirPrefs()).resolves.toEqual({});+ await expect(+ electronHeteroSessionService.setDirPref({ key: 'claude-code::/repo', pref: null }),+ ).resolves.toBeUndefined();++ expect(heteroSession.listLocalSessions).toHaveBeenCalledOnce();+ expect(heteroSession.readLocalSession).toHaveBeenCalledWith({+ filePath: '/tmp/session.jsonl',+ source: 'claude-code',+ });+ expect(heteroSession.setDirPref).toHaveBeenCalledWith({+ key: 'claude-code::/repo',+ pref: null,+ });+ });+});diff --git a/src/services/electron/heterogeneousAgent.ts b/src/services/electron/heterogeneousAgent.tsindex cf2f232b638..2e0693b2b41 100644--- a/src/services/electron/heterogeneousAgent.ts+++ b/src/services/electron/heterogeneousAgent.ts@@ -4,7 +4,10 @@ import type {CodexRateLimitResetResult,KimiCodeQuotaSnapshot,} from '@lobechat/electron-client-ipc';-import type { HeterogeneousProviderBindingReference } from '@lobechat/heterogeneous-agents';+import type {+ HeterogeneousProviderBindingReference,+ LocalHeterogeneousAgentType,+} from '@lobechat/heterogeneous-agents';import type {HeterogeneousAgentModelCatalog,HeteroSessionImportMessage,@@ -22,7 +25,7 @@ class HeterogeneousAgentService {}async startSession(params: {- agentType?: string;+ agentType?: LocalHeterogeneousAgentType;args?: string[];command: string;cwd?: string;diff --git a/src/services/electron/system.ts b/src/services/electron/system.tsindex f5c1118e290..595911ecf72 100644--- a/src/services/electron/system.ts+++ b/src/services/electron/system.ts@@ -105,7 +105,7 @@ class ElectronSystemService {return this.ipc.menu.popupContextMenu(params);};- closePopupContextMenu = async (): Promise<void> => {+ closePopupContextMenu = async (): Promise<{ success: boolean }> => {return this.ipc.menu.closePopupContextMenu();};diff --git a/src/store/chat/slices/agentRun/actions/transports/hetero/heterogeneousAgentExecutor.ts b/src/store/chat/slices/agentRun/actions/transports/hetero/heterogeneousAgentExecutor.tsindex 83bf0a20efc..ee484a91a3f 100644--- a/src/store/chat/slices/agentRun/actions/transports/hetero/heterogeneousAgentExecutor.ts+++ b/src/store/chat/slices/agentRun/actions/transports/hetero/heterogeneousAgentExecutor.ts@@ -2025,7 +2025,7 @@ export const executeHeterogeneousAgent = async (// Start session (pass resumeSessionId for multi-turn --resume)const result = await heterogeneousAgentService.startSession({- agentType: adapterType,+ agentType: isLocalHeterogeneousType(adapterType) ? adapterType : undefined,args: spawnArgs,command: resolveHeterogeneousAgentCommand(adapterType, heterogeneousProvider.command),cwd: workingDirectory,