@morlay/dsh-desktop-host 0.0.1-alpha.6 → 0.0.1-alpha.8

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 CHANGED
@@ -21,7 +21,8 @@
21
21
  - 壳按 `<runtime>/node_modules/@morlay/dsh-desktop-host/lib/index.js` 启动它(stdio 五元组:
22
22
  FD 3/4 是管道,FD 5 是 Node IPC),argv 为
23
23
  `[runtimeDir, projectDir, primaryRuntime, pnpmEntry, nodeBin]`(上游 0.1.7 删掉 `runProfile` 的 `resolutionMode` 后少一格);
24
- - IPC:`ready { protocolVersion }` / `fatal { message }`,另外收 `shutdown`。
24
+ - IPC:`ready { protocolVersion }` / `fatal { message, diagnostic }`(`diagnostic` 是完整 `util.inspect` 的错误,
25
+ 与上游 0.1.7-alpha.2 同形;壳的 dialog 用 `message`,完整诊断走 stderr),另外收 `shutdown`。
25
26
 
26
27
  出口:`.`(启动入口)、`./webserver`(无端口 `webServer` 服务,供 patch 行加载)、`./wire`
27
28
  (管道分帧,壳构建时内联,部署里不需要单独解析它)。
package/lib/index.js CHANGED
@@ -3,6 +3,7 @@ import { once } from "node:events";
3
3
  import { createReadStream, createWriteStream } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
+ import { inspect } from "node:util";
6
7
  import { loadLayeredEnv, loadProfileDirectory } from "@deepseek-ai/dsh-app-boot";
7
8
  import { runProfile } from "@deepseek-ai/dsh/profile-boot";
8
9
  import { resolveDshHome } from "@deepseek-ai/dsh-home-paths";
@@ -225,6 +226,23 @@ const DESKTOP_PATCH = fileURLToPath(new URL("../config/desktop.cordis.patch.yml"
225
226
  function errorMessage(error) {
226
227
  return error instanceof Error ? error.message : String(error);
227
228
  }
229
+ /** 诊断上限:壳把它写进日志,再长也没有额外价值。 */
230
+ const MAX_FATAL_DIAGNOSTIC_CHARS = 65536;
231
+ /**
232
+ * fatal 事件:`message` 给壳的 dialog 用,`diagnostic` 是完整 `inspect`(`code` / `syscall` /
233
+ * `path` / `cause` 链,stack 行里没有)——stderr 字节与这条 IPC 谁先到不确定,壳报告的是它
234
+ * 先看到的那一条,所以诊断得跟 IPC 一起走。
235
+ */
236
+ function fatalEvent(error) {
237
+ return {
238
+ type: "fatal",
239
+ message: errorMessage(error),
240
+ diagnostic: inspect(error, {
241
+ depth: 4,
242
+ maxArrayLength: 50
243
+ }).slice(0, MAX_FATAL_DIAGNOSTIC_CHARS)
244
+ };
245
+ }
228
246
  async function main() {
229
247
  const runtimeDir = process.argv[2];
230
248
  const projectDir = process.argv[3];
@@ -389,28 +407,19 @@ async function main() {
389
407
  frames = decoder.push(chunk);
390
408
  for (const frame of frames) handleFrame(frame);
391
409
  } catch (error) {
392
- send({
393
- type: "fatal",
394
- message: errorMessage(error)
395
- });
410
+ send(fatalEvent(error));
396
411
  stop(1);
397
412
  }
398
413
  });
399
414
  requestPipe.once("error", (error) => {
400
- send({
401
- type: "fatal",
402
- message: errorMessage(error)
403
- });
415
+ send(fatalEvent(error));
404
416
  stop(1);
405
417
  });
406
418
  requestPipe.once("end", () => {
407
419
  try {
408
420
  decoder.finish();
409
421
  } catch (error) {
410
- send({
411
- type: "fatal",
412
- message: errorMessage(error)
413
- });
422
+ send(fatalEvent(error));
414
423
  stop(1);
415
424
  }
416
425
  });
@@ -428,11 +437,7 @@ async function main() {
428
437
  });
429
438
  }
430
439
  if (import.meta.main) main().catch((error) => {
431
- const message = errorMessage(error);
432
- if (process.send !== void 0 && process.connected) process.send({
433
- type: "fatal",
434
- message
435
- }, (sendError) => {
440
+ if (process.send !== void 0 && process.connected) process.send(fatalEvent(error), (sendError) => {
436
441
  if (sendError !== null) console.error(sendError);
437
442
  });
438
443
  console.error(error);
package/lib/wire.js CHANGED
@@ -290,7 +290,7 @@ var DesktopHostResponseDecoder = class {
290
290
  function isDesktopHostEvent(value) {
291
291
  if (!isRecord(value)) return false;
292
292
  if (value.type === "ready") return value.protocolVersion === 1;
293
- if (value.type === "fatal") return typeof value.message === "string";
293
+ if (value.type === "fatal") return typeof value.message === "string" && (value.diagnostic === void 0 || typeof value.diagnostic === "string");
294
294
  return false;
295
295
  }
296
296
  /** IPC 命令校验(host 侧)。 */
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Desktop Host",
4
+ "description": "Desktop host process: boots the desktop profile and serves it through an in-process, portless webServer over byte pipes."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "桌面宿主进程",
4
+ "description": "桌面部署的 host 进程:按 desktop profile 装配,经字节管道交给宿主内无端口的 webServer。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morlay/dsh-desktop-host",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.8",
4
4
  "description": "Desktop host process for dsh-desktopify: boots the desktop profile and serves it through an in-process, portless webServer over byte pipes — upstream apps/desktop-host with the web carrier taken over and the Office skill mount removed.",
5
5
  "keywords": [
6
6
  "desktop",
@@ -16,42 +16,31 @@
16
16
  "url": "https://github.com/morlay/dsh-plugin.git"
17
17
  },
18
18
  "files": [
19
+ "locale/*.json",
19
20
  "lib",
20
21
  "config/desktop.cordis.patch.yml"
21
22
  ],
22
23
  "type": "module",
23
24
  "main": "./lib/index.js",
24
25
  "exports": {
25
- ".": {
26
- "types": "./src/index.ts",
27
- "default": "./lib/index.js"
28
- },
29
- "./webserver": {
30
- "types": "./src/webserver.ts",
31
- "default": "./lib/webserver.js"
32
- },
33
- "./wire": {
34
- "types": "./src/wire.ts",
35
- "default": "./lib/wire.js"
36
- },
37
- "./package.json": "./package.json"
26
+ "./locale/*.json": "./locale/*.json"
38
27
  },
39
28
  "dependencies": {
40
- "@deepseek-ai/dsh": "0.1.7-alpha.1",
41
- "@deepseek-ai/dsh-app-boot": "0.1.7-alpha.1",
42
- "@deepseek-ai/dsh-home-paths": "0.1.7-alpha.1",
43
- "@deepseek-ai/dsh-host-webserver": "0.1.7-alpha.1",
44
- "@deepseek-ai/dsh-tool-workspace-dependencies": "0.1.7-alpha.1",
45
- "@deepseek-ai/schemastery": "3.18.3"
29
+ "@deepseek-ai/dsh": "0.1.7-rc.1",
30
+ "@deepseek-ai/dsh-app-boot": "0.1.7-rc.1",
31
+ "@deepseek-ai/dsh-home-paths": "0.1.7-rc.1",
32
+ "@deepseek-ai/dsh-host-webserver": "0.1.7-rc.1",
33
+ "@deepseek-ai/dsh-tool-workspace-dependencies": "0.1.7-rc.1",
34
+ "@deepseek-ai/schemastery": "3.18.4"
46
35
  },
47
36
  "devDependencies": {
48
- "@deepseek-ai/cordis": "4.0.3",
49
- "@deepseek-ai/dsh-api-gateway": "0.1.7-alpha.1",
50
- "@deepseek-ai/dsh-client-connection": "0.1.7-alpha.1",
37
+ "@deepseek-ai/cordis": "4.0.4",
38
+ "@deepseek-ai/dsh-api-gateway": "0.1.7-rc.1",
39
+ "@deepseek-ai/dsh-client-connection": "0.1.7-rc.1",
51
40
  "@types/node": "^26.5.0"
52
41
  },
53
42
  "peerDependencies": {
54
- "@deepseek-ai/cordis": "4.0.3"
43
+ "@deepseek-ai/cordis": "4.0.4"
55
44
  },
56
45
  "engines": {
57
46
  "node": ">=24.11.0"