wtagent 0.2.0 → 0.2.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/README.md CHANGED
@@ -8,7 +8,9 @@ WTAgent connects ChatGPT, Claude, DeepSeek, Gemini, Kimi, or GLM Web to your loc
8
8
 
9
9
  ## Quick start
10
10
 
11
- Requires Node.js 20.17+ and Chrome/Chromium. WTAgent supports macOS, Linux, and native Windows. WSL is not currently supported.
11
+ Requires Node.js 20.17+ and Chrome/Chromium. WTAgent supports macOS, Linux, native Windows, and preview support for WSL2 with WSLg. WSL1 and external X11 configurations are best effort.
12
+
13
+ On WSL, install the Linux Chrome/Chromium package inside the distribution and launch WTAgent from WSL. WTAgent keeps file and command execution in the WSL environment and connects to that Linux browser over local CDP. Display environment variables are only configuration hints; actual GUI availability is confirmed when Chrome starts. Windows-host Chrome is not supported from WSL yet.
12
14
 
13
15
  ```bash
14
16
  npm install -g wtagent
@@ -59,7 +61,9 @@ WTAgent 将 ChatGPT、Claude、DeepSeek、Gemini、Kimi 或 GLM 网页聊天连
59
61
 
60
62
  ### 快速开始
61
63
 
62
- 需要 Node.js 20.17+ 和 Chrome/Chromium。支持 macOS、Linux 和原生 Windows,暂不支持 WSL。
64
+ 需要 Node.js 20.17+ 和 Chrome/Chromium。支持 macOS、Linux、原生 Windows,以及预览支持带 WSLg 的 WSL2。WSL1 和外部 X11 配置仅按尽力支持处理。
65
+
66
+ 在 WSL 中使用时,需要在 WSL 发行版内部安装 Linux 版 Chrome/Chromium,并从 WSL 启动 WTAgent。文件读写和命令执行仍然发生在 WSL 环境中,WTAgent 通过本地 CDP 连接这个 Linux 浏览器。图形环境变量仅表示已配置,实际可用性会在 Chrome 启动时确认。当前还不支持从 WSL 直接控制 Windows 主机上的 Chrome。
63
67
 
64
68
  ```bash
65
69
  npm install -g wtagent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wtagent",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Turn your own web AI session into a local tool-using agent.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/cli/main.js CHANGED
@@ -208,7 +208,14 @@ async function runDoctor(options) {
208
208
  }
209
209
  console.log(`Data: ${paths.appDataDir}`);
210
210
  console.log(`Profile: ${paths.profileDir}`);
211
- console.log(report.exitCode === 0 ? "Doctor: OK" : "Doctor: FAILED");
211
+ const hasWarnings = report.items.some((item) => item.status === "degraded");
212
+ console.log(
213
+ report.exitCode !== 0
214
+ ? "Doctor: FAILED"
215
+ : hasWarnings
216
+ ? "Doctor: OK (with warnings)"
217
+ : "Doctor: OK",
218
+ );
212
219
  process.exitCode = report.exitCode;
213
220
  }
214
221
 
@@ -55,6 +55,35 @@ export function detectWsl({
55
55
  );
56
56
  }
57
57
 
58
+ export function getWslSupport({
59
+ platform = process.platform,
60
+ env = process.env,
61
+ osRelease = os.release(),
62
+ } = {}) {
63
+ if (!detectWsl({ platform, env, osRelease })) {
64
+ return { supported: true, preview: false, reason: null };
65
+ }
66
+
67
+ const display = env.WAYLAND_DISPLAY || env.DISPLAY;
68
+ if (!display) {
69
+ return {
70
+ supported: false,
71
+ preview: false,
72
+ reason:
73
+ "WSL is detected, but no Linux graphical display is configured. Enable WSLg (or an X server), install Chrome/Chromium inside the WSL distribution, and retry.",
74
+ };
75
+ }
76
+
77
+ return {
78
+ supported: true,
79
+ preview: true,
80
+ reason:
81
+ `WSL is detected with a ${env.WAYLAND_DISPLAY ? "Wayland" : "X11"} display environment configured. `
82
+ + "This preview check does not verify that the display is reachable; WTAgent confirms that only when Linux Chrome starts. "
83
+ + "Windows-host Chrome is not used.",
84
+ };
85
+ }
86
+
58
87
  export function getNativeWindowsSupport({
59
88
  platform = process.platform,
60
89
  arch = process.arch,
@@ -100,11 +129,12 @@ export function assertNativeRuntimeSupported(context = {}) {
100
129
  `WTAgent requires Node.js 20.17.0 or newer; current runtime is ${version}.`,
101
130
  );
102
131
  }
103
- if (detectWsl(context)) {
104
- throw new Error(
105
- "WTAgent does not support running inside WSL in v1. Launch it from native Windows PowerShell or CMD against a Windows project path.",
106
- );
132
+
133
+ const wsl = getWslSupport(context);
134
+ if (!wsl.supported) {
135
+ throw new Error(wsl.reason);
107
136
  }
137
+
108
138
  const windows = getNativeWindowsSupport(context);
109
139
  if (!windows.supported) {
110
140
  throw new Error(windows.reason);
@@ -356,11 +386,12 @@ export async function collectDoctorReport({
356
386
 
357
387
  const isWsl = detectWsl({ platform, env, osRelease });
358
388
  if (isWsl) {
389
+ const wsl = getWslSupport({ platform, env, osRelease });
359
390
  add(
360
391
  "host",
361
392
  "Runtime host",
362
- "fail",
363
- "WSL is detected. WTAgent v1 must run from native Windows PowerShell or CMD, not from WSL.",
393
+ wsl.supported ? (wsl.preview ? "degraded" : "pass") : "fail",
394
+ wsl.reason,
364
395
  { required: true },
365
396
  );
366
397
  } else {