wtagent 0.1.0-alpha.6 → 0.2.0
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 +57 -93
- package/docs/technical-design.md +1 -0
- package/package.json +3 -2
- package/src/browser/base-web-adapter.js +1178 -0
- package/src/browser/cdp-browser.js +94 -4
- package/src/browser/cdp-state.js +52 -4
- package/src/browser/chatgpt-web-adapter.js +290 -730
- package/src/browser/claude-web-adapter.js +205 -0
- package/src/browser/deepseek-web-adapter.js +337 -0
- package/src/browser/fake-web-model-adapter.js +5 -1
- package/src/browser/gemini-web-adapter.js +465 -0
- package/src/browser/glm-web-adapter.js +246 -0
- package/src/browser/kimi-web-adapter.js +285 -0
- package/src/browser/provider-registry.js +199 -0
- package/src/cli/main.js +440 -56
- package/src/cli/notice-store.js +125 -0
- package/src/cli/prompt-input.js +505 -145
- package/src/cli/render-events.js +31 -3
- package/src/cli/self-update.js +145 -0
- package/src/cli/startup-notices.js +161 -0
- package/src/platform/paths.js +7 -0
- package/src/policy/approval-store.js +67 -0
- package/src/policy/policy-engine.js +16 -0
- package/src/protocol/markers.js +3 -2
- package/src/protocol/prompt-builder.js +14 -7
- package/src/protocol/xml-protocol.js +193 -11
- package/src/runtime/agent-runtime.js +313 -29
- package/src/session/agent-session.js +4 -1
- package/src/session/canonical-transcript.js +2 -2
- package/src/session/session-export.js +2 -2
- package/src/shared/fetch-json.js +24 -0
- package/src/shared/limits.js +17 -0
- package/src/shared/package-info.js +23 -0
- package/src/shared/usage-limit.js +21 -0
- package/src/tools/default-tools.js +23 -3
- package/src/tools/search-fallback.js +27 -3
package/README.md
CHANGED
|
@@ -1,144 +1,108 @@
|
|
|
1
1
|
# WTAgent
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use your web AI account as a local CLI agent.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
WTAgent connects ChatGPT, Claude, DeepSeek, Gemini, Kimi, or GLM Web to your local project: the model reasons in the browser while WTAgent reads and writes local files and runs commands on your machine.
|
|
6
6
|
|
|
7
|
-
[中文](#中文)
|
|
7
|
+
[中文](#中文)
|
|
8
8
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
WTAgent 把 GPT 网页聊天连接到本地工具,提供类似 Codex 的 CLI Agent 体验。当前首个适配器支持 ChatGPT Web。
|
|
12
|
-
|
|
13
|
-
网页 GPT 负责思考,WTAgent 在本机:
|
|
14
|
-
|
|
15
|
-
- 读取和修改本地文件
|
|
16
|
-
- 调用结构化本地命令,运行构建、测试和开发服务
|
|
17
|
-
|
|
18
|
-
不需要 OpenAI API Key,也不要求 ChatGPT Pro。WTAgent 使用独立的 Chrome Profile 保存你的网页登录状态,并使用该账号在网页上实际可用的模型和额度;如果账号拥有 Pro,它会成为额外优势。
|
|
19
|
-
|
|
20
|
-
支持矩阵:
|
|
21
|
-
|
|
22
|
-
- macOS
|
|
23
|
-
- Linux
|
|
24
|
-
- Windows 10 1809+ / Windows 11 x64
|
|
25
|
-
- Windows ARM64 目前为预览支持
|
|
26
|
-
|
|
27
|
-
边界:
|
|
9
|
+
## Quick start
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
- Git 和 `rg` 是可选项,不是运行前提
|
|
31
|
-
- WSL 不在首版支持范围内;请直接在原生 PowerShell / CMD / Windows Terminal 中运行
|
|
32
|
-
|
|
33
|
-
### 快速开始
|
|
34
|
-
|
|
35
|
-
需要 Node.js 20.17+ 和 Chrome/Chromium。
|
|
11
|
+
Requires Node.js 20.17+ and Chrome/Chromium. WTAgent supports macOS, Linux, and native Windows. WSL is not currently supported.
|
|
36
12
|
|
|
37
13
|
```bash
|
|
38
|
-
npm install -g wtagent
|
|
39
|
-
wtagent login
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Windows PowerShell:
|
|
43
|
-
|
|
44
|
-
```powershell
|
|
45
|
-
npm install -g wtagent --registry=https://registry.npmjs.org/
|
|
46
|
-
wtagent doctor
|
|
47
|
-
wtagent login
|
|
14
|
+
npm install -g wtagent
|
|
48
15
|
```
|
|
49
16
|
|
|
50
|
-
|
|
17
|
+
Open a working directory and start WTAgent:
|
|
51
18
|
|
|
52
19
|
```bash
|
|
53
|
-
|
|
20
|
+
mkdir wtagent-demo
|
|
21
|
+
cd wtagent-demo
|
|
54
22
|
wtagent
|
|
55
23
|
```
|
|
56
24
|
|
|
57
|
-
|
|
25
|
+
ChatGPT asks you to choose `Pro` or `Current`; other providers keep or silently select their configured default. Then type a task:
|
|
58
26
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
wtagent "检查这个项目并修复测试"
|
|
63
|
-
wtagent -C ./my-project "创建一个网站"
|
|
27
|
+
```text
|
|
28
|
+
$ wtagent
|
|
29
|
+
you › Create hello.js that writes "Hello from WTAgent" to hello.txt. Run it with Node.js and verify the result.
|
|
64
30
|
```
|
|
65
31
|
|
|
66
|
-
|
|
32
|
+
WTAgent creates the files in the current directory, runs the script locally, and checks its output. You can continue chatting in the same terminal after the task finishes.
|
|
67
33
|
|
|
68
|
-
|
|
34
|
+
Choose a provider with `--model` (ChatGPT is the default). Supported values are `chatgpt`, `claude`, `deepseek`, `gemini`, `kimi`, and `glm`:
|
|
69
35
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- 如果系统没有 Git 或 `rg`,WTAgent 仍应保留核心文件读写与搜索能力
|
|
75
|
-
|
|
76
|
-
## English
|
|
36
|
+
```bash
|
|
37
|
+
wtagent --model claude "inspect this project and summarize its architecture"
|
|
38
|
+
wtagent --model gemini "inspect this project and summarize its architecture"
|
|
39
|
+
```
|
|
77
40
|
|
|
78
|
-
|
|
41
|
+
Claude keeps the model selected by claude.ai in its browser profile; WTAgent does not override it.
|
|
42
|
+
Gemini likewise keeps the model selected in its browser profile.
|
|
79
43
|
|
|
80
|
-
|
|
44
|
+
If the provider is not signed in, WTAgent opens its dedicated Chrome profile and asks you to sign in. Each provider has an independent profile, and your task continues automatically after login.
|
|
81
45
|
|
|
82
|
-
|
|
83
|
-
- Run structured local commands, builds, tests, and development servers
|
|
46
|
+
WTAgent itself does not require an API key. It uses your own web account, available models, and quota.
|
|
84
47
|
|
|
85
|
-
|
|
48
|
+
You can also provide the first task directly:
|
|
86
49
|
|
|
87
|
-
|
|
50
|
+
```bash
|
|
51
|
+
wtagent "create hello.js, run it, and verify the output"
|
|
52
|
+
```
|
|
88
53
|
|
|
89
|
-
|
|
90
|
-
- Linux
|
|
91
|
-
- Windows 10 1809+ / Windows 11 x64
|
|
92
|
-
- Windows ARM64 is currently preview only
|
|
54
|
+
Multiline paste and `↑` / `↓` input history are supported. Press `Ctrl+C` or `Ctrl+D` to exit.
|
|
93
55
|
|
|
94
|
-
|
|
56
|
+
## 中文
|
|
95
57
|
|
|
96
|
-
|
|
97
|
-
- Git and `rg` are optional accelerators, not runtime requirements
|
|
98
|
-
- WSL is not supported in v1; run WTAgent from native PowerShell, CMD, or Windows Terminal
|
|
58
|
+
WTAgent 将 ChatGPT、Claude、DeepSeek、Gemini、Kimi 或 GLM 网页聊天连接到本地项目:模型在浏览器中思考,WTAgent 在你的电脑上读写本地文件并运行命令。
|
|
99
59
|
|
|
100
|
-
###
|
|
60
|
+
### 快速开始
|
|
101
61
|
|
|
102
|
-
|
|
62
|
+
需要 Node.js 20.17+ 和 Chrome/Chromium。支持 macOS、Linux 和原生 Windows,暂不支持 WSL。
|
|
103
63
|
|
|
104
64
|
```bash
|
|
105
|
-
npm install -g wtagent
|
|
106
|
-
wtagent login
|
|
65
|
+
npm install -g wtagent
|
|
107
66
|
```
|
|
108
67
|
|
|
109
|
-
|
|
68
|
+
进入工作目录并启动:
|
|
110
69
|
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
wtagent
|
|
114
|
-
wtagent
|
|
70
|
+
```bash
|
|
71
|
+
mkdir wtagent-demo
|
|
72
|
+
cd wtagent-demo
|
|
73
|
+
wtagent
|
|
115
74
|
```
|
|
116
75
|
|
|
117
|
-
|
|
76
|
+
ChatGPT 会让你选择 `Pro` 或 `Current`;其他 provider 会保持或自动选择配置的默认模式。然后直接输入任务:
|
|
118
77
|
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
|
|
78
|
+
```text
|
|
79
|
+
$ wtagent
|
|
80
|
+
you › 创建 hello.js,将“Hello from WTAgent”写入 hello.txt。用 Node.js 运行并验证结果。
|
|
122
81
|
```
|
|
123
82
|
|
|
124
|
-
|
|
83
|
+
WTAgent 会在当前目录创建文件、运行本地脚本并检查输出。任务完成后,可以继续在同一个终端中对话。
|
|
125
84
|
|
|
126
|
-
|
|
85
|
+
通过 `--model` 选择 provider(默认是 ChatGPT)。可选值包括 `chatgpt`、`claude`、`deepseek`、`gemini`、`kimi` 和 `glm`:
|
|
127
86
|
|
|
128
87
|
```bash
|
|
129
|
-
wtagent
|
|
130
|
-
wtagent
|
|
88
|
+
wtagent --model claude "分析这个项目并总结架构"
|
|
89
|
+
wtagent --model gemini "分析这个项目并总结架构"
|
|
131
90
|
```
|
|
132
91
|
|
|
133
|
-
|
|
92
|
+
Claude 会沿用 claude.ai 在该浏览器 Profile 中选择的模型,WTAgent 不会自动切换模型。
|
|
93
|
+
Gemini 同样沿用其浏览器 Profile 当前选择的模型。
|
|
134
94
|
|
|
135
|
-
|
|
95
|
+
如果尚未登录对应 provider,WTAgent 会打开它的独立专用 Chrome Profile 并提示登录;登录成功后任务会自动继续。
|
|
136
96
|
|
|
137
|
-
|
|
97
|
+
WTAgent 本身无需 API Key,而是使用你自己的网页账号、可用模型和额度。
|
|
98
|
+
|
|
99
|
+
也可以在启动时直接附带第一个任务:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
wtagent "创建 hello.js,运行并验证输出"
|
|
103
|
+
```
|
|
138
104
|
|
|
139
|
-
|
|
140
|
-
- WTAgent always uses its own Chrome profile and does not reuse your daily browsing profile
|
|
141
|
-
- Core file and search capabilities must continue to work even when Git or `rg` is missing
|
|
105
|
+
支持多行粘贴和 `↑` / `↓` 输入历史。使用 `Ctrl+C` 或 `Ctrl+D` 退出。
|
|
142
106
|
|
|
143
107
|
## License
|
|
144
108
|
|
package/docs/technical-design.md
CHANGED
|
@@ -652,6 +652,7 @@ sessionId + assistantMessageIdentity + normalizedToolCall
|
|
|
652
652
|
- Chrome 崩溃:用相同 Profile 重启并打开会话 URL。
|
|
653
653
|
- 同一 CLI 进程中的 follow-up 保持在当前会话 Page,不重复导航;跨进程恢复需要等待本地记录的最近 assistant message ID 出现在 DOM 后才能发送。
|
|
654
654
|
- 每次发送记录已有消息 ID 和新 user turn,只接受位于该 user turn 之后的新 assistant turn;无法建立可靠消息身份时超时并保存诊断,禁止退化为基于数量或文本变化猜测。
|
|
655
|
+
- 新 assistant 节点在停止生成后持续 10 秒仍为空时,Runtime 只发送“继续上一轮”的短提示,不重发原任务、附件或工具结果;自动恢复最多 3 次。仍为空时保留 Chrome、Session 和待确认工具结果并回到 CLI,允许用户输入 `/retry` 或新的指令。
|
|
655
656
|
- 同一 Profile 同时只允许一个 WTAgent CLI Session;启动和接管过程使用 Profile 级互斥锁。
|
|
656
657
|
- 登录失效或出现验证:进入 `AUTH_REQUIRED`/`PAUSED`,让用户接管。
|
|
657
658
|
- 会话页面丢失:从本地记录打开原会话;无法恢复时创建新的本地 Session 和新的网页对话,不向旧 rollout 继续追加。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wtagent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Turn your own web AI session into a local tool-using agent.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"test": "node --test",
|
|
33
|
-
"test:unit": "node --test test/protocol.test.js test/policy.test.js test/tools.test.js test/prompt-builder.test.js test/session-export.test.js test/platform.test.js test/cli.test.js test/at-files.test.js",
|
|
33
|
+
"test:unit": "node --test test/protocol.test.js test/policy.test.js test/tools.test.js test/prompt-builder.test.js test/session-export.test.js test/platform.test.js test/cli.test.js test/at-files.test.js test/self-update.test.js test/startup-notices.test.js test/provider-registry.test.js test/claude-adapter.test.js test/deepseek-adapter.test.js test/gemini-adapter.test.js test/kimi-adapter.test.js test/glm-adapter.test.js",
|
|
34
34
|
"test:integration": "node --test test/runtime.test.js",
|
|
35
35
|
"test:windows": "node --test test/windows-command-launcher.test.js test/windows-diagnostics.test.js test/windows-search-path.test.js test/atomic-write.test.js test/process-utils.test.js test/cdp-state.test.js test/windows-fixtures.test.js test/windows-package-smoke.test.js",
|
|
36
36
|
"check": "node scripts/check-syntax.js",
|
|
37
37
|
"doctor": "node src/cli/main.js doctor",
|
|
38
38
|
"login": "node src/cli/main.js login",
|
|
39
39
|
"prepack": "npm run check && npm test",
|
|
40
|
+
"release": "npm publish --tag latest",
|
|
40
41
|
"release:alpha": "npm publish --tag alpha"
|
|
41
42
|
},
|
|
42
43
|
"engines": {
|