fix(client): intercept the alpha chat file-open funnel (remote.session.openWorkspacePath)

0.1.2-alpha 宿主删除了 ctx.workspaces.openPath,聊天文件点击全部改走
remote 命名空间,旧拦截成为死代码(点击穿透到 xdg-open)。改为在
ctx.inject(['remote.session']) 内以 defineProperty 遮蔽该方法(accessor
属性,赋值无效),接管时返回 RemoteResult 成功包络。语义不变,

设计:docs/plans/2026-08-31-openpath-intercept-alpha-design.md
This commit is contained in:
Cyancat
2026-09-02 23:13:57 +08:00
committed by Menghuan1918
parent dde0923980
commit 26d37c1a8f
9 changed files with 425 additions and 126 deletions
+20 -9
View File
@@ -407,14 +407,27 @@ export interface SidebarConversation {
}
/**
* The client workspaces service face (mirror of the runtime IWorkspaces). Only
* the chat's file-open funnel is touched: `openPath` hands an absolute path
* to the Host OS's default application, and every chat-side file open
* (tool rows, produced-files, prose mentions) funnels through it.
* The client `remote.session` namespace face (mirror of the gateway client's
* RemoteNamespaceService for the session-controller contribution on alpha
* hosts). The chat's file-open funnel is `openWorkspacePath`: the caller
* resolves the path against the session cwd, and the host hands it to the
* OS's default application. Namespace methods are accessor properties (see
* `client/openpath-intercept.ts` for how the interception shadows them).
*/
export interface SidebarWorkspacesService {
/** Open a filesystem path with the Host operating system's default application. */
openPath(path: string): Promise<void>
export interface SidebarRemoteSessionService {
/**
* Open an absolute path with the Host operating system's default
* application. Resolves with the typert `RemoteResult` envelope
* (`{ ok: true, value: { opened } }` / `{ ok: false, error }`), like every
* remote method — callers branch on `result.ok`.
*/
openWorkspacePath(
request: { path: string },
signal?: AbortSignal,
): Promise<
| { readonly ok: true; readonly value: { opened: boolean } }
| { readonly ok: false; readonly error: { readonly code: string; readonly message: string; readonly details: object } }
>
}
/**
@@ -499,8 +512,6 @@ export interface SidebarContextShape {
webRuntime: SidebarWebRuntime
/** The client slot registry (register/inject). */
slots: SidebarSlotsService
/** The client workspaces service face (file-open funnel). */
workspaces: SidebarWorkspacesService
/** The settings service face (prefs persistence + namespace reads). */
settings: SidebarSettingsService
/** The invariant registry face. */