pi-wechat-session-hub 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-wechat-session-hub",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "通过微信管理本机多个 Pi 会话的 Pi 扩展。",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -36,8 +36,9 @@
36
36
  ],
37
37
  "scripts": {
38
38
  "typecheck": "tsc --noEmit",
39
- "test": "node --experimental-transform-types --test tests/config-store.test.ts tests/project-service.test.ts tests/project-command-parser.test.ts tests/registry.test.ts tests/pi-rpc-client.test.ts tests/background-worker.test.ts tests/background-worker-resume.test.ts tests/pi-cli.test.ts tests/durable-message-queue.test.ts tests/gateway-command-parser.test.ts tests/gateway-command-router.test.ts tests/durable-message-queue-context.test.ts tests/wechat-ilink.test.ts tests/credential-store.test.ts tests/ilink-qr-login.test.ts tests/gateway-runtime.test.ts tests/wechat-manager-command-parser.test.ts tests/ui-worker-manager.test.ts tests/windows-terminal-launcher.test.ts tests/gateway-service-controller.test.ts tests/windows-logon-task-manager.test.ts tests/ui-session-owner-handoff.test.ts tests/ui-resume-owner-liveness.test.ts tests/wechat-session-hub-command.test.ts",
40
- "test:pi-runtime": "node scripts/pi-rpc-smoke.mjs"
39
+ "test": "node --experimental-transform-types --test --test-timeout=30000 --test-force-exit tests/config-store.test.ts tests/project-service.test.ts tests/project-command-parser.test.ts tests/registry.test.ts tests/pi-rpc-client.test.ts tests/background-worker.test.ts tests/background-worker-resume.test.ts tests/pi-cli.test.ts tests/durable-message-queue.test.ts tests/gateway-command-parser.test.ts tests/gateway-command-router.test.ts tests/durable-message-queue-context.test.ts tests/wechat-ilink.test.ts tests/credential-store.test.ts tests/ilink-qr-login.test.ts tests/gateway-runtime.test.ts tests/wechat-manager-command-parser.test.ts tests/ui-worker-manager.test.ts tests/windows-terminal-launcher.test.ts tests/gateway-service-controller.test.ts tests/windows-logon-task-manager.test.ts tests/ui-session-owner-handoff.test.ts tests/ui-resume-owner-liveness.test.ts tests/wechat-session-hub-command.test.ts",
40
+ "test:pi-runtime": "node scripts/pi-rpc-smoke.mjs",
41
+ "test:wt-capability": "node --experimental-transform-types scripts/probe-wt-capability.mjs"
41
42
  },
42
43
  "peerDependencies": {
43
44
  "@earendil-works/pi-coding-agent": "*"
@@ -1,19 +1,40 @@
1
1
  import { isAbsolute, basename } from "node:path";
2
- import { resolveWindowsTerminalExecutable } from "../src/gateway/windows-terminal-launcher.ts";
2
+ import {
3
+ resolveWindowsTerminalExecutable,
4
+ WindowsTerminalLaunchError,
5
+ } from "../src/gateway/windows-terminal-launcher.ts";
3
6
 
4
7
  /**
5
8
  * 校验可见 UI 模式的真实平台探测自洽。
6
9
  *
10
+ * 语义上这是 CI 的可用性探针, 不是功能断言:
11
+ *
12
+ * - 非 Windows 平台: 按设计不支持, 视为通过。
13
+ * - Windows 但未安装 Windows Terminal: 按设计阻塞, 视为通过。
14
+ * - Windows 且解析出 wt.exe: 断言结果是绝对路径且文件名为 `wt.exe`。
15
+ *
7
16
  * 注意 Windows Terminal 常以 App Execution Alias 形式存在(位于
8
17
  * `%LOCALAPPDATA%\Microsoft\WindowsApps`)。该目录权限受限, 对别名执行
9
- * `existsSync` / `Test-Path` 会返回 false, 因此这里不复检文件存在性,
10
- * 而是断言解析结果自洽: 绝对路径且文件名为 `wt.exe`。
18
+ * `existsSync` / `Test-Path` 会返回 false, 因此不复检文件存在性。
11
19
  *
12
20
  * @returns 探测结果自洽时正常结束。
13
- * @throws {Error} 解析结果不是绝对 wt.exe 路径时抛出。
21
+ * @throws {Error} 报告可用但返回的不是绝对 wt.exe 路径时抛出。
14
22
  */
15
23
  async function main() {
16
- const executable = await resolveWindowsTerminalExecutable();
24
+ if (process.platform !== "win32") {
25
+ console.log(`当前平台为 ${process.platform}, 可见 UI 模式按设计不支持, 探测通过。`);
26
+ return;
27
+ }
28
+ let executable;
29
+ try {
30
+ executable = await resolveWindowsTerminalExecutable();
31
+ } catch (error) {
32
+ if (error instanceof WindowsTerminalLaunchError && error.code === "wt_not_found") {
33
+ console.log("当前环境未提供 Windows Terminal, 可见 UI 模式按设计阻塞, 探测通过。");
34
+ return;
35
+ }
36
+ throw error;
37
+ }
17
38
  console.log(`已解析 wt.exe: ${executable}`);
18
39
  if (!isAbsolute(executable) || basename(executable).toLowerCase() !== "wt.exe") {
19
40
  throw new Error(`解析结果不是绝对 wt.exe 路径: ${executable}`);