@morlay/dsh-desktop-host 0.0.1-alpha.2 → 0.0.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -12
- package/config/desktop.cordis.patch.yml +23 -0
- package/lib/index.js +414 -925
- package/lib/webserver.js +264 -0
- package/lib/wire.js +245 -0
- package/package.json +25 -11
package/README.md
CHANGED
|
@@ -1,31 +1,53 @@
|
|
|
1
1
|
# @morlay/dsh-desktop-host
|
|
2
2
|
|
|
3
|
-
桌面部署里那个 **host
|
|
4
|
-
|
|
3
|
+
桌面部署里那个 **host 进程**:按 `desktop` profile 把 Web 应用启起来,然后**在进程内接管 `webServer`**——
|
|
4
|
+
不监听任何端口,Electron 壳把 `dsh-app://app/*` 的请求经字节管道(FD 3/4)喂进来。
|
|
5
5
|
|
|
6
6
|
上游 `apps/desktop-host`(`@deepseek-ai/dsh-desktop-host`)是 `private: true` 的应用,外部装不到,所以这里
|
|
7
|
-
是它的**变体包**:argv / IPC 契约、`lib/index.js`
|
|
8
|
-
`@deepseek-ai/dsh-skill-office`(见 [`src/office.ts`](./src/office.ts)
|
|
7
|
+
是它的**变体包**:argv / IPC 契约、`lib/index.js` 入口路径照旧,两处本地差别——Office 组合不再挂
|
|
8
|
+
`@deepseek-ai/dsh-skill-office`(见 [`src/office.ts`](./src/office.ts)),载波从「监听端口 + 壳认证反向代理」
|
|
9
|
+
换成「宿主内 webServer 替身 + 管道」(见 [`src/webserver.ts`](./src/webserver.ts) 与桌面层的
|
|
10
|
+
[设计 桌面无端口传输与窗口对齐](../dsh-desktopify/.agents/designs/20260920-桌面无端口传输与窗口对齐.md))。
|
|
9
11
|
|
|
10
12
|
## 用法
|
|
11
13
|
|
|
12
14
|
被 [`@morlay/dsh-desktopify`](../dsh-desktopify/README.md) 使用,不单独跑:
|
|
13
15
|
|
|
14
|
-
- `dev` / `bundle`
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`
|
|
16
|
+
- `dev` / `bundle` 把本包落位到部署的 `<runtime>/node_modules/@morlay/dsh-desktop-host`:`dev` 整份复制源码树,
|
|
17
|
+
`bundle` 按 manifest `files` 复制。两条路都要带上这四样——`lib/index.js`(启动入口)、
|
|
18
|
+
`lib/webserver.js`(桌面 patch 行按 `../lib/webserver.js` 加载)、`lib/wire.js`、
|
|
19
|
+
`config/desktop.cordis.patch.yml`(入口按 `../config/desktop.cordis.patch.yml` 作为 `patchFiles` 读),
|
|
20
|
+
缺任一样 host 都起不来;
|
|
21
|
+
- 壳按 `<runtime>/node_modules/@morlay/dsh-desktop-host/lib/index.js` 启动它(stdio 五元组:
|
|
22
|
+
FD 3/4 是管道,FD 5 是 Node IPC),argv 为
|
|
23
|
+
`[runtimeDir, projectDir, primaryRuntime, profileResolution, pnpmEntry, nodeBin]`;
|
|
24
|
+
- IPC:`ready { protocolVersion }` / `fatal { message }`,另外收 `shutdown`。
|
|
25
|
+
|
|
26
|
+
出口:`.`(启动入口)、`./webserver`(无端口 `webServer` 服务,供 patch 行加载)、`./wire`
|
|
27
|
+
(管道分帧,壳构建时内联,部署里不需要单独解析它)。
|
|
28
|
+
|
|
29
|
+
## 运行时做的事
|
|
30
|
+
|
|
31
|
+
1. `runProfile` 装配 `desktop` profile(保住 profileContext / proxy / fail-loud / appReady / shutdown 语义);
|
|
32
|
+
2. 桌面 patch 禁用上游 `webserver` 行,插入本包的 `webServer` 替身——同一份路由面
|
|
33
|
+
(`register` / `registerFallback` / `registerUpgrade` / `tapIndex` / `renderIndex` / `collectIndexInjections` /
|
|
34
|
+
`port` / `host`),请求由 `dispatch(Request)` 从管道喂进来;
|
|
35
|
+
3. 接管浏览器认证:页面由壳独占、没有网络入口,`connection` 的 `requestRejection` 与 `authorizeIndex`
|
|
36
|
+
被改写为放行(理由与代价见[债务 桌面宿主覆写 connection 认证方法](../dsh-desktopify/.agents/debts/20260920-桌面宿主覆写connection认证方法.md));
|
|
37
|
+
4. 注入客户端 transport(`__DSH_TRANSPORT__ = { ownsHost, openStream }`)并注册 `/.dsh/remote-stream`
|
|
38
|
+
(POST NDJSON → `typertGateway.wireStream.open`)。
|
|
18
39
|
|
|
19
40
|
## 依赖边界
|
|
20
41
|
|
|
21
42
|
`@deepseek-ai/*` 全部由**部署自己的** `node_modules` 提供(与上游同边界):
|
|
22
43
|
|
|
23
|
-
- `dependencies
|
|
24
|
-
`@deepseek-ai/dsh-app-boot`、`@deepseek-ai/dsh-home-paths
|
|
44
|
+
- `dependencies`:本包入口与替身真正 import 的 `@deepseek-ai/dsh`(含 `./profile-boot` 子路径)、
|
|
45
|
+
`@deepseek-ai/dsh-app-boot`、`@deepseek-ai/dsh-home-paths`、`@deepseek-ai/dsh-host-webserver`
|
|
46
|
+
(`renderIndexInjections`)、`@deepseek-ai/schemastery`(替身的 Config schema);
|
|
25
47
|
- `peerDependencies`:`@deepseek-ai/cordis`;
|
|
26
|
-
- 类型面 `@deepseek-ai/dsh-client-connection` / `@deepseek-ai/dsh-
|
|
48
|
+
- 类型面 `@deepseek-ai/dsh-client-connection` / `@deepseek-ai/dsh-api-gateway` 只在 devDependencies
|
|
27
49
|
(空 import 带 Context merge,构建后即被擦除);
|
|
28
|
-
- vendor 里的 `
|
|
50
|
+
- vendor 里的 `workspace-dependencies` 模块在构建期内联,运行期不依赖 vendor 路径。
|
|
29
51
|
|
|
30
52
|
清单只声明**这份代码真正用到**的包:上游那份 app manifest 里的组合依赖
|
|
31
53
|
(`@deepseek-ai/dsh-skill-office`、`dsh-agent`、`dsh-jobs`、`dsh-tools` …)属于部署的官方闭包,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 桌面形态的传输接管:上游 `webserver` 行在激活时 listen,桌面没有网络入口,
|
|
2
|
+
# 这里禁用它并插入宿主内的无端口替身(同服务名 `webServer`、同一份路由面,
|
|
3
|
+
# 请求由字节管道经 dispatch 喂进来)。其余行沿用 web-app bundle。
|
|
4
|
+
#
|
|
5
|
+
# `web-runtime` 的四项一并写全:patch 整块替换 config,没有端口可打印、也没有
|
|
6
|
+
# 浏览器可交接;`surfaceContext` 关掉,免得提示段带一个并不存在的 URL。
|
|
7
|
+
|
|
8
|
+
- id: webserver
|
|
9
|
+
disabled: true
|
|
10
|
+
|
|
11
|
+
- insert:
|
|
12
|
+
- id: portless-webserver
|
|
13
|
+
name: '../lib/webserver.js'
|
|
14
|
+
config:
|
|
15
|
+
host: '127.0.0.1'
|
|
16
|
+
port: 0
|
|
17
|
+
|
|
18
|
+
- id: web-runtime
|
|
19
|
+
config:
|
|
20
|
+
openBrowser: false
|
|
21
|
+
printUrl: false
|
|
22
|
+
surfaceContext: false
|
|
23
|
+
trustedHosts: []
|