From 1897eb9f6d92b478b8dbefcbb259bafad709e691 Mon Sep 17 00:00:00 2001 From: AstroHan Date: Sat, 29 Aug 2026 17:38:50 +0800 Subject: [PATCH] refactor(desktop): remove internal compatibility facades Import shared thread search and the Computer Use PIP feed from their owning modules. Remove the Desktop-only forwarding file and the completed PIP migration re-exports while leaving the PIP controller and lifecycle unchanged. Generated-by: Codex --- .../src/main/__tests__/thread-search.test.ts | 2 +- .../src/main/computer-use/pip-window.ts | 9 ----- .../desktop-native-capability-assembly.ts | 6 ++-- .../src/main/runtime-host-search-ipc-main.ts | 2 +- apps/desktop/src/main/search/thread-search.ts | 33 ------------------- 5 files changed, 4 insertions(+), 48 deletions(-) delete mode 100644 apps/desktop/src/main/search/thread-search.ts diff --git a/apps/desktop/src/main/__tests__/thread-search.test.ts b/apps/desktop/src/main/__tests__/thread-search.test.ts index 612eb53676..cac84c1e77 100644 --- a/apps/desktop/src/main/__tests__/thread-search.test.ts +++ b/apps/desktop/src/main/__tests__/thread-search.test.ts @@ -28,7 +28,7 @@ import { findMatch, foldForMatch, runThreadSearch, -} from '../search/thread-search.js'; +} from '@maka/core/thread-search'; type Entry = { session: SessionSummary; messages: StoredMessage[] }; type SearchOutcome = Awaited>; diff --git a/apps/desktop/src/main/computer-use/pip-window.ts b/apps/desktop/src/main/computer-use/pip-window.ts index 0f5bbf9b8a..f148acf3d3 100644 --- a/apps/desktop/src/main/computer-use/pip-window.ts +++ b/apps/desktop/src/main/computer-use/pip-window.ts @@ -761,12 +761,3 @@ export function createComputerUsePipController( }, }; } - - - -// Re-exported so callers keep their type import path while the code moves. -export type { ParentWindowLike, PipWindowLike } from './pip-electron.js'; - -// Re-exported so callers and tests keep their import path while the code -// moves. Comes out in a later cut. -export { withComputerUsePip } from './pip-feed.js'; diff --git a/apps/desktop/src/main/desktop-native-capability-assembly.ts b/apps/desktop/src/main/desktop-native-capability-assembly.ts index 0fcef1e123..4182384793 100644 --- a/apps/desktop/src/main/desktop-native-capability-assembly.ts +++ b/apps/desktop/src/main/desktop-native-capability-assembly.ts @@ -25,10 +25,8 @@ import { createDesktopPhysicalInputGuard, } from './computer-use-host.js'; import { createCursorOverlayController } from './computer-use/cursor-overlay-window.js'; -import { - createComputerUsePipController, - withComputerUsePip, -} from './computer-use/pip-window.js'; +import { withComputerUsePip } from './computer-use/pip-feed.js'; +import { createComputerUsePipController } from './computer-use/pip-window.js'; import { createComputerUseStatusItem, withComputerUseStatusItem, diff --git a/apps/desktop/src/main/runtime-host-search-ipc-main.ts b/apps/desktop/src/main/runtime-host-search-ipc-main.ts index 6fe5e4b07f..194188998a 100644 --- a/apps/desktop/src/main/runtime-host-search-ipc-main.ts +++ b/apps/desktop/src/main/runtime-host-search-ipc-main.ts @@ -18,6 +18,7 @@ */ import type { SearchResult } from '@maka/core/search'; +import { runThreadSearch } from '@maka/core/thread-search'; import type { DesktopRuntimeHostClient } from './runtime-host-client.js'; import { toDesktopHostSessionSummary } from './runtime-host-session-catalog-ipc-main.js'; import { @@ -25,7 +26,6 @@ import { readWithFallback, type ReconnectableReadIpcMain, } from './ipc-reconnect-policy.js'; -import { runThreadSearch } from './search/thread-search.js'; interface RuntimeHostSearchIpcDeps { readonly ipcMain: ReconnectableReadIpcMain; diff --git a/apps/desktop/src/main/search/thread-search.ts b/apps/desktop/src/main/search/thread-search.ts deleted file mode 100644 index 55fee8142f..0000000000 --- a/apps/desktop/src/main/search/thread-search.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Desktop compatibility facade for the shared local transcript search. - * Runtime Host Agent tools and the Desktop search modal intentionally use the - * same bounded, redacted implementation. - */ -export { - SNIPPET_MAX_CODE_POINTS, - TOOL_RESULT_SCAN_CAP_BYTES, - capCodePoints, - collectSearchableText, - findMatch, - foldForMatch, - runThreadSearch, -} from '@maka/core/thread-search';