wtagent 0.2.2 → 0.4.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.
@@ -2,6 +2,7 @@ import { ChatGPTWebAdapter } from "./chatgpt-web-adapter.js";
2
2
  import { ClaudeWebAdapter } from "./claude-web-adapter.js";
3
3
  import { DeepSeekWebAdapter } from "./deepseek-web-adapter.js";
4
4
  import { GeminiWebAdapter } from "./gemini-web-adapter.js";
5
+ import { GrokWebAdapter } from "./grok-web-adapter.js";
5
6
  import { KimiWebAdapter } from "./kimi-web-adapter.js";
6
7
  import { GLMWebAdapter } from "./glm-web-adapter.js";
7
8
  import { getProfileDir } from "../platform/paths.js";
@@ -18,15 +19,13 @@ import { getProfileDir } from "../platform/paths.js";
18
19
  // data dir; each provider logs in once, independently
19
20
  // status - "active" (has a working adapter) | "planned" (named
20
21
  // but not implemented yet)
21
- // promptsForMode - whether the CLI shows an interactive mode picker at
22
- // conversation start (ChatGPT has Pro/Current; most
23
- // providers do not prompt)
24
- // defaultMode - mode applied silently at conversation start when the
25
- // provider does not prompt (null = keep the site's
26
- // current setting). The adapter's selectMode()
27
- // interprets this value.
28
22
  // adapter - the adapter class, or null until implemented
29
23
  //
24
+ // WTAgent deliberately does not encode provider-specific model names or choose
25
+ // a model automatically. After login, interactive runs give the user a chance
26
+ // to choose directly on the provider website; pressing Enter keeps whatever
27
+ // the website currently has selected.
28
+ //
30
29
  // ChatGPT keeps the historical "chrome-profile" basename so existing logins,
31
30
  // the logout guard, and cli.test.js keep working unchanged.
32
31
  export const PROVIDERS = Object.freeze({
@@ -36,8 +35,6 @@ export const PROVIDERS = Object.freeze({
36
35
  baseUrl: "https://chatgpt.com/",
37
36
  profileBasename: "chrome-profile",
38
37
  status: "active",
39
- promptsForMode: true,
40
- defaultMode: null,
41
38
  adapter: ChatGPTWebAdapter,
42
39
  }),
43
40
  deepseek: Object.freeze({
@@ -46,10 +43,6 @@ export const PROVIDERS = Object.freeze({
46
43
  baseUrl: "https://chat.deepseek.com/",
47
44
  profileBasename: "deepseek-profile",
48
45
  status: "active",
49
- // DeepSeek does not prompt; every new conversation silently switches to
50
- // 专家模式 (Expert) + 深度思考 (Deep Thinking) — see DeepSeekWebAdapter.selectMode.
51
- promptsForMode: false,
52
- defaultMode: "expert-thinking",
53
46
  adapter: DeepSeekWebAdapter,
54
47
  }),
55
48
  claude: Object.freeze({
@@ -58,10 +51,6 @@ export const PROVIDERS = Object.freeze({
58
51
  baseUrl: "https://claude.ai/",
59
52
  profileBasename: "claude-profile",
60
53
  status: "active",
61
- promptsForMode: false,
62
- // Keep whatever model claude.ai selects in this browser profile. WTAgent
63
- // does not open the model menu or override the account/site default.
64
- defaultMode: null,
65
54
  adapter: ClaudeWebAdapter,
66
55
  }),
67
56
  grok: Object.freeze({
@@ -69,10 +58,8 @@ export const PROVIDERS = Object.freeze({
69
58
  label: "Grok",
70
59
  baseUrl: "https://grok.com/",
71
60
  profileBasename: "grok-profile",
72
- status: "planned",
73
- promptsForMode: false,
74
- defaultMode: null,
75
- adapter: null,
61
+ status: "active",
62
+ adapter: GrokWebAdapter,
76
63
  }),
77
64
  kimi: Object.freeze({
78
65
  id: "kimi",
@@ -80,10 +67,6 @@ export const PROVIDERS = Object.freeze({
80
67
  baseUrl: "https://www.kimi.com/",
81
68
  profileBasename: "kimi-profile",
82
69
  status: "active",
83
- // Kimi does not prompt; every new conversation silently switches to the K3
84
- // flagship model — see KimiWebAdapter.selectMode.
85
- promptsForMode: false,
86
- defaultMode: "k3",
87
70
  adapter: KimiWebAdapter,
88
71
  }),
89
72
  glm: Object.freeze({
@@ -92,10 +75,6 @@ export const PROVIDERS = Object.freeze({
92
75
  baseUrl: "https://chat.z.ai/",
93
76
  profileBasename: "glm-profile",
94
77
  status: "active",
95
- // GLM does not prompt; every new conversation silently selects the newest
96
- // available model (GLM-5.3, else GLM-5.2) — see GLMWebAdapter.selectMode.
97
- promptsForMode: false,
98
- defaultMode: "latest",
99
78
  adapter: GLMWebAdapter,
100
79
  }),
101
80
  gemini: Object.freeze({
@@ -104,9 +83,6 @@ export const PROVIDERS = Object.freeze({
104
83
  baseUrl: "https://gemini.google.com/app",
105
84
  profileBasename: "gemini-profile",
106
85
  status: "active",
107
- promptsForMode: false,
108
- // Preserve the model currently selected by Gemini in this profile.
109
- defaultMode: null,
110
86
  adapter: GeminiWebAdapter,
111
87
  }),
112
88
  });
@@ -138,24 +114,6 @@ export function getProvider(providerId) {
138
114
  return provider;
139
115
  }
140
116
 
141
- // `--mode` is ChatGPT's Pro/Current switch, but people often type
142
- // `--mode kimi` meaning the Kimi provider. If the value is a known provider
143
- // id, treat it as `--model` and clear `--mode` so ChatGPT mode parsing is not
144
- // applied. Conflicting `--model` + `--mode <provider>` is rejected.
145
- export function resolveCliProviderSelection({ model, mode } = {}) {
146
- const modeAsProvider = findProvider(mode);
147
- if (!modeAsProvider) {
148
- return { model, mode };
149
- }
150
- if (model != null && getProvider(model).id !== modeAsProvider.id) {
151
- throw new Error(
152
- `--mode ${mode} selects ${modeAsProvider.label}, but --model ${model} is already set. `
153
- + `Use --model ${modeAsProvider.id}.`,
154
- );
155
- }
156
- return { model: modeAsProvider.id, mode: undefined };
157
- }
158
-
159
117
  // Resolves the dedicated Chrome profile directory for a provider under the
160
118
  // given app data dir. ChatGPT resolves to the historical "chrome-profile".
161
119
  export function getProviderProfileDir(appDataDir, providerId) {