wtagent 0.1.0 → 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 +50 -36
- package/package.json +2 -2
- package/src/browser/base-web-adapter.js +1178 -0
- package/src/browser/cdp-browser.js +62 -0
- package/src/browser/cdp-state.js +52 -4
- package/src/browser/chatgpt-web-adapter.js +301 -992
- package/src/browser/claude-web-adapter.js +205 -0
- package/src/browser/deepseek-web-adapter.js +337 -0
- 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 +276 -59
- package/src/cli/notice-store.js +125 -0
- package/src/cli/prompt-input.js +504 -170
- package/src/cli/render-events.js +14 -8
- 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/protocol/markers.js +3 -2
- package/src/protocol/prompt-builder.js +9 -5
- package/src/protocol/xml-protocol.js +193 -11
- package/src/runtime/agent-runtime.js +131 -18
- 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 +11 -1
- package/src/shared/package-info.js +23 -0
- package/src/shared/usage-limit.js +2 -2
package/README.md
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
# WTAgent
|
|
2
2
|
|
|
3
|
-
Use
|
|
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 Web 连接到你的本地项目,提供类似 Codex 的命令行体验:GPT 在网页中思考,WTAgent 在本机读写文件、编译代码并运行测试。
|
|
12
|
-
|
|
13
|
-
当前支持 ChatGPT Web。无需 OpenAI API Key,也不要求 ChatGPT Pro;使用的是你自己的网页账号、可用模型和额度。
|
|
14
|
-
|
|
15
|
-
### 开始使用
|
|
9
|
+
## Quick start
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
Requires Node.js 20.17+ and Chrome/Chromium. WTAgent supports macOS, Linux, and native Windows. WSL is not currently supported.
|
|
18
12
|
|
|
19
13
|
```bash
|
|
20
14
|
npm install -g wtagent
|
|
21
15
|
```
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
Open a working directory and start WTAgent:
|
|
24
18
|
|
|
25
19
|
```bash
|
|
26
20
|
mkdir wtagent-demo
|
|
@@ -28,41 +22,50 @@ cd wtagent-demo
|
|
|
28
22
|
wtagent
|
|
29
23
|
```
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
例如,启动后直接在终端输入:
|
|
25
|
+
ChatGPT asks you to choose `Pro` or `Current`; other providers keep or silently select their configured default. Then type a task:
|
|
34
26
|
|
|
35
27
|
```text
|
|
36
28
|
$ wtagent
|
|
37
|
-
you ›
|
|
38
|
-
you › 再增加一组包含负数的测试
|
|
29
|
+
you › Create hello.js that writes "Hello from WTAgent" to hello.txt. Run it with Node.js and verify the result.
|
|
39
30
|
```
|
|
40
31
|
|
|
41
|
-
WTAgent
|
|
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.
|
|
42
33
|
|
|
43
|
-
|
|
34
|
+
Choose a provider with `--model` (ChatGPT is the default). Supported values are `chatgpt`, `claude`, `deepseek`, `gemini`, `kimi`, and `glm`:
|
|
44
35
|
|
|
45
36
|
```bash
|
|
46
|
-
wtagent "
|
|
37
|
+
wtagent --model claude "inspect this project and summarize its architecture"
|
|
38
|
+
wtagent --model gemini "inspect this project and summarize its architecture"
|
|
47
39
|
```
|
|
48
40
|
|
|
49
|
-
|
|
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.
|
|
43
|
+
|
|
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.
|
|
45
|
+
|
|
46
|
+
WTAgent itself does not require an API key. It uses your own web account, available models, and quota.
|
|
47
|
+
|
|
48
|
+
You can also provide the first task directly:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
wtagent "create hello.js, run it, and verify the output"
|
|
52
|
+
```
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
Multiline paste and `↑` / `↓` input history are supported. Press `Ctrl+C` or `Ctrl+D` to exit.
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
## 中文
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
WTAgent 将 ChatGPT、Claude、DeepSeek、Gemini、Kimi 或 GLM 网页聊天连接到本地项目:模型在浏览器中思考,WTAgent 在你的电脑上读写本地文件并运行命令。
|
|
56
59
|
|
|
57
|
-
###
|
|
60
|
+
### 快速开始
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
需要 Node.js 20.17+ 和 Chrome/Chromium。支持 macOS、Linux 和原生 Windows,暂不支持 WSL。
|
|
60
63
|
|
|
61
64
|
```bash
|
|
62
65
|
npm install -g wtagent
|
|
63
66
|
```
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
进入工作目录并启动:
|
|
66
69
|
|
|
67
70
|
```bash
|
|
68
71
|
mkdir wtagent-demo
|
|
@@ -70,25 +73,36 @@ cd wtagent-demo
|
|
|
70
73
|
wtagent
|
|
71
74
|
```
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
For example, start it and type directly in the terminal:
|
|
76
|
+
ChatGPT 会让你选择 `Pro` 或 `Current`;其他 provider 会保持或自动选择配置的默认模式。然后直接输入任务:
|
|
76
77
|
|
|
77
78
|
```text
|
|
78
79
|
$ wtagent
|
|
79
|
-
you ›
|
|
80
|
-
you › Add another test containing negative numbers.
|
|
80
|
+
you › 创建 hello.js,将“Hello from WTAgent”写入 hello.txt。用 Node.js 运行并验证结果。
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
WTAgent
|
|
83
|
+
WTAgent 会在当前目录创建文件、运行本地脚本并检查输出。任务完成后,可以继续在同一个终端中对话。
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
通过 `--model` 选择 provider(默认是 ChatGPT)。可选值包括 `chatgpt`、`claude`、`deepseek`、`gemini`、`kimi` 和 `glm`:
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
wtagent
|
|
88
|
+
wtagent --model claude "分析这个项目并总结架构"
|
|
89
|
+
wtagent --model gemini "分析这个项目并总结架构"
|
|
89
90
|
```
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
Claude 会沿用 claude.ai 在该浏览器 Profile 中选择的模型,WTAgent 不会自动切换模型。
|
|
93
|
+
Gemini 同样沿用其浏览器 Profile 当前选择的模型。
|
|
94
|
+
|
|
95
|
+
如果尚未登录对应 provider,WTAgent 会打开它的独立专用 Chrome Profile 并提示登录;登录成功后任务会自动继续。
|
|
96
|
+
|
|
97
|
+
WTAgent 本身无需 API Key,而是使用你自己的网页账号、可用模型和额度。
|
|
98
|
+
|
|
99
|
+
也可以在启动时直接附带第一个任务:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
wtagent "创建 hello.js,运行并验证输出"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
支持多行粘贴和 `↑` / `↓` 输入历史。使用 `Ctrl+C` 或 `Ctrl+D` 退出。
|
|
92
106
|
|
|
93
107
|
## License
|
|
94
108
|
|
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,7 +30,7 @@
|
|
|
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",
|