ccjk 10.1.0 → 10.3.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 +28 -0
- package/dist/chunks/agent-teams.mjs +1 -1
- package/dist/chunks/agent.mjs +1 -1
- package/dist/chunks/api-providers.mjs +1 -1
- package/dist/chunks/api.mjs +3 -3
- package/dist/chunks/auto-bootstrap.mjs +1 -1
- package/dist/chunks/auto-updater.mjs +1 -1
- package/dist/{shared/ccjk.Br91zBIG.mjs → chunks/banner.mjs} +52 -3
- package/dist/chunks/boost.mjs +2 -2
- package/dist/chunks/ccjk-agents.mjs +1 -1
- package/dist/chunks/ccjk-all.mjs +1 -1
- package/dist/chunks/ccjk-config.mjs +1 -1
- package/dist/chunks/ccjk-hooks.mjs +1 -1
- package/dist/chunks/ccjk-mcp.mjs +2 -2
- package/dist/chunks/ccjk-setup.mjs +1 -1
- package/dist/chunks/ccjk-skills.mjs +1 -1
- package/dist/chunks/ccr.mjs +11 -10
- package/dist/chunks/ccu.mjs +1 -1
- package/dist/chunks/check-updates.mjs +4 -3
- package/dist/chunks/claude-code-config-manager.mjs +8 -7
- package/dist/chunks/claude-code-incremental-manager.mjs +3 -2
- package/dist/chunks/claude-config.mjs +3 -3
- package/dist/chunks/claude-wrapper.mjs +2 -2
- package/dist/chunks/codex-config-switch.mjs +3 -2
- package/dist/chunks/codex-provider-manager.mjs +3 -2
- package/dist/chunks/codex-uninstaller.mjs +2 -2
- package/dist/chunks/codex.mjs +5 -5
- package/dist/chunks/commands.mjs +88 -391
- package/dist/chunks/commands2.mjs +391 -88
- package/dist/chunks/completion.mjs +1 -1
- package/dist/chunks/config-consolidator.mjs +2 -2
- package/dist/chunks/config-switch.mjs +4 -3
- package/dist/chunks/config.mjs +6 -98
- package/dist/chunks/config2.mjs +411 -400
- package/dist/chunks/config3.mjs +401 -410
- package/dist/chunks/constants.mjs +1 -1
- package/dist/chunks/context.mjs +283 -1
- package/dist/chunks/dashboard.mjs +365 -0
- package/dist/chunks/doctor.mjs +4 -4
- package/dist/chunks/features.mjs +12 -11
- package/dist/chunks/fs-operations.mjs +1 -1
- package/dist/chunks/health-alerts.mjs +304 -0
- package/dist/chunks/health-check.mjs +532 -0
- package/dist/chunks/index.mjs +10 -177
- package/dist/chunks/index2.mjs +168 -1162
- package/dist/chunks/index3.mjs +1076 -910
- package/dist/chunks/index4.mjs +947 -137
- package/dist/chunks/index5.mjs +167 -635
- package/dist/chunks/index6.mjs +663 -0
- package/dist/chunks/init.mjs +19 -19
- package/dist/chunks/installer.mjs +649 -147
- package/dist/chunks/installer2.mjs +147 -649
- package/dist/chunks/interview.mjs +2 -2
- package/dist/chunks/marketplace.mjs +1 -1
- package/dist/chunks/mcp.mjs +5 -4
- package/dist/chunks/menu.mjs +22 -9
- package/dist/chunks/metrics-display.mjs +152 -0
- package/dist/chunks/migrator.mjs +1 -1
- package/dist/chunks/monitor.mjs +2 -2
- package/dist/chunks/notification.mjs +1 -1
- package/dist/chunks/onboarding.mjs +2 -2
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/permission-manager.mjs +2 -2
- package/dist/chunks/permissions.mjs +1 -1
- package/dist/chunks/persistence-manager.mjs +781 -0
- package/dist/chunks/persistence.mjs +667 -0
- package/dist/chunks/platform.mjs +1 -1
- package/dist/chunks/plugin.mjs +1 -1
- package/dist/chunks/prompts.mjs +1 -1
- package/dist/chunks/providers.mjs +1 -1
- package/dist/chunks/quick-actions.mjs +321 -0
- package/dist/chunks/quick-provider.mjs +2 -0
- package/dist/chunks/quick-setup.mjs +9 -8
- package/dist/chunks/silent-updater.mjs +1 -1
- package/dist/chunks/simple-config.mjs +3 -8
- package/dist/chunks/skill.mjs +1 -1
- package/dist/chunks/skills-sync.mjs +1 -1
- package/dist/chunks/skills.mjs +1 -1
- package/dist/chunks/slash-commands.mjs +208 -0
- package/dist/chunks/smart-defaults.mjs +1 -1
- package/dist/chunks/startup.mjs +1 -1
- package/dist/chunks/stats.mjs +1 -1
- package/dist/chunks/status.mjs +31 -2
- package/dist/chunks/team.mjs +1 -1
- package/dist/chunks/thinking.mjs +2 -2
- package/dist/chunks/uninstall.mjs +5 -5
- package/dist/chunks/update.mjs +8 -7
- package/dist/chunks/upgrade-manager.mjs +2 -2
- package/dist/chunks/version-checker.mjs +3 -3
- package/dist/chunks/vim.mjs +1 -1
- package/dist/chunks/zero-config.mjs +359 -0
- package/dist/cli.mjs +212 -21
- package/dist/i18n/locales/en/cli.json +14 -1
- package/dist/i18n/locales/en/common.json +27 -0
- package/dist/i18n/locales/en/configuration.json +33 -0
- package/dist/i18n/locales/en/context.json +54 -1
- package/dist/i18n/locales/en/dashboard.json +78 -0
- package/dist/i18n/locales/en/persistence.json +127 -0
- package/dist/i18n/locales/en/quick-actions.json +78 -0
- package/dist/i18n/locales/zh-CN/cli.json +14 -1
- package/dist/i18n/locales/zh-CN/common.json +27 -0
- package/dist/i18n/locales/zh-CN/configuration.json +33 -0
- package/dist/i18n/locales/zh-CN/context.json +54 -1
- package/dist/i18n/locales/zh-CN/dashboard.json +78 -0
- package/dist/i18n/locales/zh-CN/persistence.json +127 -0
- package/dist/i18n/locales/zh-CN/quick-actions.json +78 -0
- package/dist/index.mjs +3 -2
- package/dist/shared/{ccjk.DE91nClQ.mjs → ccjk.BKoi8-Hy.mjs} +1 -1
- package/dist/shared/ccjk.BiCrMV5O.mjs +94 -0
- package/dist/shared/{ccjk.Dpw86UX0.mjs → ccjk.CxtuJxaS.mjs} +1 -1
- package/dist/shared/{ccjk.ClzTOz9n.mjs → ccjk.DB2UYcq0.mjs} +5 -5
- package/dist/shared/{ccjk.CmsW23FN.mjs → ccjk.DVBW2wxp.mjs} +4 -3
- package/dist/shared/{ccjk.Bndhan7G.mjs → ccjk.DfwJOEok.mjs} +1 -1
- package/dist/shared/{ccjk.DvIrK0wz.mjs → ccjk.DrMygfCF.mjs} +1 -1
- package/package.json +19 -19
|
@@ -1,109 +1,412 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { promisify } from 'node:util';
|
|
1
|
+
import process__default from 'node:process';
|
|
3
2
|
import ansis from 'ansis';
|
|
4
|
-
import {
|
|
3
|
+
import { checkAgentBrowserInstalled, getInstallPath } from './installer2.mjs';
|
|
5
4
|
import 'node:fs';
|
|
6
|
-
import 'node:
|
|
7
|
-
import 'node:
|
|
8
|
-
import 'i18next';
|
|
9
|
-
import 'i18next-fs-backend';
|
|
10
|
-
import 'pathe';
|
|
5
|
+
import 'node:os';
|
|
6
|
+
import 'node:path';
|
|
11
7
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
const { cyan: _cyan, yellow: yellow$1, gray: _gray, green: green$1, red: _red, blue: _blue$1, bold: _bold, dim: _dim$1 } = ansis;
|
|
9
|
+
class AgentBrowserSession {
|
|
10
|
+
options;
|
|
11
|
+
isRunning = false;
|
|
12
|
+
sessionId = null;
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
this.options = {
|
|
15
|
+
headless: true,
|
|
16
|
+
verbose: false,
|
|
17
|
+
timeout: 3e4,
|
|
18
|
+
browser: "chromium",
|
|
19
|
+
...options
|
|
20
|
+
};
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
/**
|
|
23
|
+
* 启动浏览器会话
|
|
24
|
+
*/
|
|
25
|
+
async start() {
|
|
26
|
+
if (this.isRunning) {
|
|
27
|
+
if (this.options.verbose) {
|
|
28
|
+
console.log(`${yellow$1("!")} Session already running`);
|
|
29
|
+
}
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const { execSync } = await import('node:child_process');
|
|
34
|
+
this.sessionId = `session-${Date.now()}`;
|
|
35
|
+
const headlessFlag = this.options.headless ? "" : "--headed";
|
|
36
|
+
execSync(`agent-browser start ${headlessFlag} 2>/dev/null || true`, {
|
|
37
|
+
encoding: "utf-8",
|
|
38
|
+
stdio: "pipe"
|
|
39
|
+
});
|
|
40
|
+
this.isRunning = true;
|
|
41
|
+
if (this.options.verbose) {
|
|
42
|
+
console.log(`${green$1("\u2713")} Browser session started: ${this.sessionId}`);
|
|
43
|
+
}
|
|
44
|
+
} catch (error) {
|
|
45
|
+
this.isRunning = false;
|
|
46
|
+
throw new Error(`Failed to start browser session: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 导航到 URL
|
|
51
|
+
*/
|
|
52
|
+
async navigate(url) {
|
|
53
|
+
this.ensureRunning();
|
|
54
|
+
try {
|
|
55
|
+
const { execSync } = await import('node:child_process');
|
|
56
|
+
const fullUrl = url.startsWith("http") ? url : `https://${url}`;
|
|
57
|
+
execSync(`agent-browser open "${fullUrl}"`, {
|
|
58
|
+
encoding: "utf-8",
|
|
59
|
+
stdio: this.options.verbose ? "inherit" : "pipe",
|
|
60
|
+
timeout: this.options.timeout
|
|
61
|
+
});
|
|
62
|
+
if (this.options.verbose) {
|
|
63
|
+
console.log(`${green$1("\u2713")} Navigated to: ${fullUrl}`);
|
|
64
|
+
}
|
|
65
|
+
} catch (error) {
|
|
66
|
+
throw new Error(`Failed to navigate: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 获取页面快照
|
|
71
|
+
*/
|
|
72
|
+
async snapshot(options = {}) {
|
|
73
|
+
this.ensureRunning();
|
|
74
|
+
try {
|
|
75
|
+
const { execSync } = await import('node:child_process');
|
|
76
|
+
const flags = [];
|
|
77
|
+
if (options.interactive)
|
|
78
|
+
flags.push("-i");
|
|
79
|
+
if (options.compact)
|
|
80
|
+
flags.push("-c");
|
|
81
|
+
if (options.depth)
|
|
82
|
+
flags.push(`-d ${options.depth}`);
|
|
83
|
+
if (options.json)
|
|
84
|
+
flags.push("--json");
|
|
85
|
+
const result = execSync(`agent-browser snapshot ${flags.join(" ")}`, {
|
|
86
|
+
encoding: "utf-8",
|
|
87
|
+
timeout: this.options.timeout
|
|
88
|
+
});
|
|
89
|
+
return result.trim();
|
|
90
|
+
} catch (error) {
|
|
91
|
+
throw new Error(`Failed to get snapshot: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 点击元素
|
|
96
|
+
*/
|
|
97
|
+
async click(ref) {
|
|
98
|
+
this.ensureRunning();
|
|
99
|
+
try {
|
|
100
|
+
const { execSync } = await import('node:child_process');
|
|
101
|
+
const refId = ref.startsWith("@") ? ref : `@${ref}`;
|
|
102
|
+
execSync(`agent-browser click ${refId}`, {
|
|
103
|
+
encoding: "utf-8",
|
|
104
|
+
stdio: this.options.verbose ? "inherit" : "pipe",
|
|
105
|
+
timeout: this.options.timeout
|
|
106
|
+
});
|
|
107
|
+
if (this.options.verbose) {
|
|
108
|
+
console.log(`${green$1("\u2713")} Clicked: ${refId}`);
|
|
109
|
+
}
|
|
110
|
+
} catch (error) {
|
|
111
|
+
throw new Error(`Failed to click: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 填充输入框
|
|
116
|
+
*/
|
|
117
|
+
async fill(ref, text) {
|
|
118
|
+
this.ensureRunning();
|
|
119
|
+
try {
|
|
120
|
+
const { execSync } = await import('node:child_process');
|
|
121
|
+
const refId = ref.startsWith("@") ? ref : `@${ref}`;
|
|
122
|
+
execSync(`agent-browser fill ${refId} "${text.replace(/"/g, '\\"')}"`, {
|
|
123
|
+
encoding: "utf-8",
|
|
124
|
+
stdio: this.options.verbose ? "inherit" : "pipe",
|
|
125
|
+
timeout: this.options.timeout
|
|
126
|
+
});
|
|
127
|
+
if (this.options.verbose) {
|
|
128
|
+
console.log(`${green$1("\u2713")} Filled ${refId}: ${text}`);
|
|
129
|
+
}
|
|
130
|
+
} catch (error) {
|
|
131
|
+
throw new Error(`Failed to fill: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* 获取元素文本
|
|
136
|
+
*/
|
|
137
|
+
async getText(ref) {
|
|
138
|
+
this.ensureRunning();
|
|
139
|
+
try {
|
|
140
|
+
const { execSync } = await import('node:child_process');
|
|
141
|
+
const refId = ref.startsWith("@") ? ref : `@${ref}`;
|
|
142
|
+
const result = execSync(`agent-browser get text ${refId}`, {
|
|
143
|
+
encoding: "utf-8",
|
|
144
|
+
timeout: this.options.timeout
|
|
145
|
+
});
|
|
146
|
+
return result.trim();
|
|
147
|
+
} catch (error) {
|
|
148
|
+
throw new Error(`Failed to get text: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 截图
|
|
153
|
+
*/
|
|
154
|
+
async screenshot(path, fullPage = false) {
|
|
155
|
+
this.ensureRunning();
|
|
156
|
+
try {
|
|
157
|
+
const { execSync } = await import('node:child_process');
|
|
158
|
+
const flags = [];
|
|
159
|
+
if (fullPage)
|
|
160
|
+
flags.push("--full");
|
|
161
|
+
if (path)
|
|
162
|
+
flags.push(path);
|
|
163
|
+
const result = execSync(`agent-browser screenshot ${flags.join(" ")}`, {
|
|
164
|
+
encoding: "utf-8",
|
|
165
|
+
timeout: this.options.timeout
|
|
166
|
+
});
|
|
167
|
+
if (this.options.verbose) {
|
|
168
|
+
console.log(`${green$1("\u2713")} Screenshot saved: ${path || "screenshot.png"}`);
|
|
169
|
+
}
|
|
170
|
+
return result.trim();
|
|
171
|
+
} catch (error) {
|
|
172
|
+
throw new Error(`Failed to take screenshot: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 等待
|
|
177
|
+
*/
|
|
178
|
+
async wait(condition) {
|
|
179
|
+
this.ensureRunning();
|
|
180
|
+
try {
|
|
181
|
+
const { execSync } = await import('node:child_process');
|
|
182
|
+
let cmd;
|
|
183
|
+
if (typeof condition === "number") {
|
|
184
|
+
cmd = `agent-browser wait ${condition}`;
|
|
185
|
+
} else if (condition.startsWith("@")) {
|
|
186
|
+
cmd = `agent-browser wait ${condition}`;
|
|
187
|
+
} else {
|
|
188
|
+
cmd = `agent-browser wait --text "${condition}"`;
|
|
189
|
+
}
|
|
190
|
+
execSync(cmd, {
|
|
191
|
+
encoding: "utf-8",
|
|
192
|
+
stdio: this.options.verbose ? "inherit" : "pipe",
|
|
193
|
+
timeout: this.options.timeout
|
|
194
|
+
});
|
|
195
|
+
} catch (error) {
|
|
196
|
+
throw new Error(`Failed to wait: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 关闭会话
|
|
201
|
+
*/
|
|
202
|
+
async close() {
|
|
203
|
+
if (!this.isRunning) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
const { execSync } = await import('node:child_process');
|
|
208
|
+
execSync("agent-browser close 2>/dev/null || true", {
|
|
209
|
+
encoding: "utf-8",
|
|
210
|
+
stdio: "pipe"
|
|
211
|
+
});
|
|
212
|
+
this.isRunning = false;
|
|
213
|
+
this.sessionId = null;
|
|
214
|
+
if (this.options.verbose) {
|
|
215
|
+
console.log(`${green$1("\u2713")} Browser session closed`);
|
|
216
|
+
}
|
|
217
|
+
} catch {
|
|
218
|
+
this.isRunning = false;
|
|
219
|
+
this.sessionId = null;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* 获取会话状态
|
|
224
|
+
*/
|
|
225
|
+
getStatus() {
|
|
226
|
+
return {
|
|
227
|
+
running: this.isRunning,
|
|
228
|
+
sessionId: this.sessionId
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 确保会话正在运行
|
|
233
|
+
*/
|
|
234
|
+
ensureRunning() {
|
|
235
|
+
if (!this.isRunning) {
|
|
236
|
+
throw new Error("Browser session is not running. Call start() first.");
|
|
237
|
+
}
|
|
33
238
|
}
|
|
34
239
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
240
|
+
|
|
241
|
+
const { cyan, yellow, gray, green, red, blue: _blue, bold, dim: _dim } = ansis;
|
|
242
|
+
function agentBrowserHelp(_options) {
|
|
243
|
+
console.log(`
|
|
244
|
+
${bold(cyan("Agent Browser"))} - ${gray("Zero-config browser automation for AI agents")}
|
|
245
|
+
|
|
246
|
+
${yellow("Usage:")}
|
|
247
|
+
ccjk browser <action> [options]
|
|
248
|
+
ccjk ab <action> [options]
|
|
249
|
+
|
|
250
|
+
${yellow("Actions:")}
|
|
251
|
+
${cyan("install")} Install Agent Browser (Rust CLI + Playwright)
|
|
252
|
+
${cyan("uninstall")} Remove Agent Browser
|
|
253
|
+
${cyan("status")} Check installation status
|
|
254
|
+
${cyan("start")} Start a browser session
|
|
255
|
+
${cyan("stop")} Stop current browser session
|
|
256
|
+
${cyan("config")} Configure browser settings
|
|
257
|
+
|
|
258
|
+
${yellow("Examples:")}
|
|
259
|
+
${gray("# Install Agent Browser")}
|
|
260
|
+
ccjk browser install
|
|
261
|
+
|
|
262
|
+
${gray("# Check status")}
|
|
263
|
+
ccjk browser status
|
|
264
|
+
|
|
265
|
+
${gray("# Start a session with URL")}
|
|
266
|
+
ccjk browser start https://example.com
|
|
267
|
+
|
|
268
|
+
${yellow("Quick Start:")}
|
|
269
|
+
${gray("After installation, use these commands directly:")}
|
|
270
|
+
agent-browser open <url> ${gray("# Navigate to URL")}
|
|
271
|
+
agent-browser snapshot -i ${gray("# Get interactive elements")}
|
|
272
|
+
agent-browser click @e1 ${gray("# Click by ref")}
|
|
273
|
+
agent-browser fill @e2 "text" ${gray("# Fill input")}
|
|
274
|
+
agent-browser screenshot ${gray("# Take screenshot")}
|
|
275
|
+
agent-browser close ${gray("# Close browser")}
|
|
276
|
+
|
|
277
|
+
${yellow("Documentation:")}
|
|
278
|
+
Run ${cyan("/browser")} in Claude Code for full skill documentation
|
|
279
|
+
`);
|
|
280
|
+
}
|
|
281
|
+
async function agentBrowserStatus(options) {
|
|
282
|
+
console.log(`
|
|
283
|
+
${bold(cyan("Agent Browser Status"))}
|
|
284
|
+
`);
|
|
285
|
+
const installed = await checkAgentBrowserInstalled();
|
|
286
|
+
const installPath = getInstallPath();
|
|
287
|
+
if (installed) {
|
|
288
|
+
console.log(` ${green("\u2713")} Agent Browser is ${green("installed")}`);
|
|
289
|
+
console.log(` ${gray("Path:")} ${installPath}`);
|
|
290
|
+
try {
|
|
291
|
+
const { execSync } = await import('node:child_process');
|
|
292
|
+
const version = execSync('agent-browser --version 2>/dev/null || echo "unknown"', {
|
|
293
|
+
encoding: "utf-8"
|
|
294
|
+
}).trim();
|
|
295
|
+
console.log(` ${gray("Version:")} ${version}`);
|
|
296
|
+
} catch {
|
|
297
|
+
console.log(` ${gray("Version:")} ${yellow("unknown")}`);
|
|
298
|
+
}
|
|
299
|
+
try {
|
|
300
|
+
const { execSync } = await import('node:child_process');
|
|
301
|
+
execSync("npx playwright --version 2>/dev/null", { encoding: "utf-8" });
|
|
302
|
+
console.log(` ${green("\u2713")} Playwright browsers available`);
|
|
303
|
+
} catch {
|
|
304
|
+
console.log(` ${yellow("!")} Playwright browsers may need installation`);
|
|
305
|
+
console.log(` ${gray("Run:")} npx playwright install chromium`);
|
|
306
|
+
}
|
|
307
|
+
} else {
|
|
308
|
+
console.log(` ${red("\u2717")} Agent Browser is ${red("not installed")}`);
|
|
309
|
+
console.log(`
|
|
310
|
+
${gray("To install, run:")}`);
|
|
311
|
+
console.log(` ${cyan("ccjk browser install")}`);
|
|
312
|
+
}
|
|
313
|
+
if (options.verbose) {
|
|
314
|
+
console.log(`
|
|
315
|
+
${gray("Debug Info:")}`);
|
|
316
|
+
console.log(` ${gray("Install path:")} ${installPath}`);
|
|
317
|
+
console.log(` ${gray("Platform:")} ${process__default.platform}`);
|
|
318
|
+
console.log(` ${gray("Arch:")} ${process__default.arch}`);
|
|
51
319
|
}
|
|
320
|
+
console.log();
|
|
52
321
|
}
|
|
53
|
-
async function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
322
|
+
async function startBrowserSession(url, options = {}) {
|
|
323
|
+
const installed = await checkAgentBrowserInstalled();
|
|
324
|
+
if (!installed) {
|
|
325
|
+
console.log(`
|
|
326
|
+
${red("\u2717")} Agent Browser is not installed`);
|
|
327
|
+
console.log(` ${gray("Run:")} ${cyan("ccjk browser install")} ${gray("first")}
|
|
328
|
+
`);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
console.log(`
|
|
332
|
+
${cyan("Starting browser session...")}
|
|
333
|
+
`);
|
|
57
334
|
try {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
335
|
+
const session = new AgentBrowserSession({
|
|
336
|
+
headless: true,
|
|
337
|
+
verbose: options.verbose
|
|
338
|
+
});
|
|
339
|
+
await session.start();
|
|
340
|
+
if (url) {
|
|
341
|
+
console.log(`${gray("Navigating to:")} ${url}`);
|
|
342
|
+
await session.navigate(url);
|
|
343
|
+
}
|
|
344
|
+
console.log(`
|
|
345
|
+
${green("\u2713")} Browser session started`);
|
|
346
|
+
console.log(`
|
|
347
|
+
${yellow("Available commands:")}`);
|
|
348
|
+
console.log(` agent-browser snapshot -i ${gray("# Get interactive elements")}`);
|
|
349
|
+
console.log(` agent-browser click @e1 ${gray("# Click element")}`);
|
|
350
|
+
console.log(` agent-browser close ${gray("# Close session")}`);
|
|
351
|
+
console.log();
|
|
64
352
|
} catch (error) {
|
|
65
|
-
console.error(
|
|
66
|
-
|
|
353
|
+
console.error(`
|
|
354
|
+
${red("\u2717")} Failed to start browser session`);
|
|
355
|
+
if (options.verbose && error instanceof Error) {
|
|
356
|
+
console.error(` ${gray("Error:")} ${error.message}`);
|
|
357
|
+
}
|
|
358
|
+
console.log(`
|
|
359
|
+
${gray("Try running:")} ${cyan("ccjk browser install")} ${gray("to reinstall")}
|
|
360
|
+
`);
|
|
67
361
|
}
|
|
68
362
|
}
|
|
69
|
-
async function
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
363
|
+
async function stopBrowserSession(options = {}) {
|
|
364
|
+
console.log(`
|
|
365
|
+
${cyan("Stopping browser session...")}
|
|
366
|
+
`);
|
|
73
367
|
try {
|
|
74
|
-
const {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
console.error(ansis.yellow(stderr));
|
|
79
|
-
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrStarted")}`));
|
|
368
|
+
const { execSync } = await import('node:child_process');
|
|
369
|
+
execSync("agent-browser close 2>/dev/null || true", { encoding: "utf-8" });
|
|
370
|
+
console.log(`${green("\u2713")} Browser session stopped
|
|
371
|
+
`);
|
|
80
372
|
} catch (error) {
|
|
81
|
-
if (
|
|
82
|
-
console.log(
|
|
83
|
-
|
|
84
|
-
console.error(ansis.yellow(error.stderr));
|
|
85
|
-
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrStarted")}`));
|
|
373
|
+
if (options.verbose && error instanceof Error) {
|
|
374
|
+
console.log(`${yellow("!")} No active session found or already closed`);
|
|
375
|
+
console.log(` ${gray("Error:")} ${error.message}`);
|
|
86
376
|
} else {
|
|
87
|
-
console.
|
|
88
|
-
|
|
377
|
+
console.log(`${yellow("!")} No active session found
|
|
378
|
+
`);
|
|
89
379
|
}
|
|
90
380
|
}
|
|
91
381
|
}
|
|
92
|
-
async function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
382
|
+
async function configureBrowser(options = {}) {
|
|
383
|
+
console.log(`
|
|
384
|
+
${bold(cyan("Agent Browser Configuration"))}
|
|
385
|
+
`);
|
|
386
|
+
const installed = await checkAgentBrowserInstalled();
|
|
387
|
+
if (!installed) {
|
|
388
|
+
console.log(`${red("\u2717")} Agent Browser is not installed`);
|
|
389
|
+
console.log(` ${gray("Run:")} ${cyan("ccjk browser install")} ${gray("first")}
|
|
390
|
+
`);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
console.log(`${yellow("Current Settings:")}`);
|
|
394
|
+
console.log(` ${gray("Default browser:")} chromium`);
|
|
395
|
+
console.log(` ${gray("Headless mode:")} enabled`);
|
|
396
|
+
console.log(` ${gray("Timeout:")} 30000ms`);
|
|
397
|
+
console.log(`
|
|
398
|
+
${yellow("Configuration Options:")}`);
|
|
399
|
+
console.log(` ${gray("Environment variables:")}`);
|
|
400
|
+
console.log(` AGENT_BROWSER_HEADLESS=false ${gray("# Show browser window")}`);
|
|
401
|
+
console.log(` AGENT_BROWSER_TIMEOUT=60000 ${gray("# Set timeout in ms")}`);
|
|
402
|
+
console.log(` AGENT_BROWSER_BROWSER=firefox ${gray("# Use Firefox")}`);
|
|
403
|
+
if (options.verbose) {
|
|
404
|
+
console.log(`
|
|
405
|
+
${gray("Advanced:")}`);
|
|
406
|
+
console.log(` ${gray("Config file:")} ~/.agent-browser/config.json`);
|
|
407
|
+
console.log(` ${gray("Session dir:")} ~/.agent-browser/sessions/`);
|
|
106
408
|
}
|
|
409
|
+
console.log();
|
|
107
410
|
}
|
|
108
411
|
|
|
109
|
-
export {
|
|
412
|
+
export { agentBrowserHelp, agentBrowserStatus, configureBrowser, startBrowserSession, stopBrowserSession };
|
|
@@ -2,7 +2,7 @@ import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import ansis from 'ansis';
|
|
5
|
-
import { i18n } from './
|
|
5
|
+
import { i18n } from './index2.mjs';
|
|
6
6
|
import 'node:process';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'i18next';
|
|
@@ -5,8 +5,8 @@ import ansis from 'ansis';
|
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import { join } from 'pathe';
|
|
7
7
|
import { SETTINGS_FILE, ClAUDE_CONFIG_FILE, CLAUDE_VSC_CONFIG_FILE } from './constants.mjs';
|
|
8
|
-
import {
|
|
9
|
-
import './
|
|
8
|
+
import { STATUS } from './banner.mjs';
|
|
9
|
+
import './index2.mjs';
|
|
10
10
|
import 'node:url';
|
|
11
11
|
import 'i18next';
|
|
12
12
|
import 'i18next-fs-backend';
|
|
@@ -2,11 +2,11 @@ import process__default from 'node:process';
|
|
|
2
2
|
import ansis from 'ansis';
|
|
3
3
|
import inquirer from 'inquirer';
|
|
4
4
|
import { resolveCodeToolType, isCodeToolType, DEFAULT_CODE_TOOL_TYPE } from './constants.mjs';
|
|
5
|
-
import { ensureI18nInitialized, i18n } from './
|
|
5
|
+
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
6
6
|
import { readZcfConfig } from './ccjk-config.mjs';
|
|
7
7
|
import { ClaudeCodeConfigManager } from './claude-code-config-manager.mjs';
|
|
8
|
-
import {
|
|
9
|
-
import { a as handleGeneralError } from '../shared/ccjk.
|
|
8
|
+
import { s as switchCodexProvider, l as listCodexProviders, a as readCodexConfig, b as switchToOfficialLogin, c as switchToProvider } from './codex.mjs';
|
|
9
|
+
import { a as handleGeneralError } from '../shared/ccjk.DrMygfCF.mjs';
|
|
10
10
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
11
11
|
import 'node:os';
|
|
12
12
|
import 'pathe';
|
|
@@ -24,6 +24,7 @@ import './config.mjs';
|
|
|
24
24
|
import './claude-config.mjs';
|
|
25
25
|
import './platform.mjs';
|
|
26
26
|
import 'tinyexec';
|
|
27
|
+
import '../shared/ccjk.BiCrMV5O.mjs';
|
|
27
28
|
import 'ora';
|
|
28
29
|
import 'semver';
|
|
29
30
|
import './prompts.mjs';
|
package/dist/chunks/config.mjs
CHANGED
|
@@ -3,11 +3,12 @@ import ansis from 'ansis';
|
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import { join, dirname } from 'pathe';
|
|
6
|
-
import { SETTINGS_FILE, CLAUDE_VSC_CONFIG_FILE,
|
|
7
|
-
import { ensureI18nInitialized, i18n } from './
|
|
8
|
-
import { s as setPrimaryApiKey,
|
|
9
|
-
import {
|
|
6
|
+
import { CLAUDE_DIR, SETTINGS_FILE, CLAUDE_VSC_CONFIG_FILE, AI_OUTPUT_LANGUAGES } from './constants.mjs';
|
|
7
|
+
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
8
|
+
import { s as setPrimaryApiKey, c as addCompletedOnboarding, d as deepMerge } from './claude-config.mjs';
|
|
9
|
+
import { exists, ensureDir, copyDir, writeFileAtomic, copyFile } from './fs-operations.mjs';
|
|
10
10
|
import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
|
|
11
|
+
import { m as mergeAndCleanPermissions } from '../shared/ccjk.BiCrMV5O.mjs';
|
|
11
12
|
|
|
12
13
|
const MODEL_ENV_KEYS = [
|
|
13
14
|
"ANTHROPIC_MODEL",
|
|
@@ -23,99 +24,6 @@ function clearModelEnv(env) {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
const INVALID_PERMISSION_NAMES = /* @__PURE__ */ new Set([
|
|
27
|
-
"AllowEdit",
|
|
28
|
-
"AllowWrite",
|
|
29
|
-
"AllowRead",
|
|
30
|
-
"AllowExec",
|
|
31
|
-
"AllowCreateProcess",
|
|
32
|
-
"AllowKillProcess",
|
|
33
|
-
"AllowNetworkAccess",
|
|
34
|
-
"AllowFileSystemAccess",
|
|
35
|
-
"AllowShellAccess",
|
|
36
|
-
"AllowHttpAccess"
|
|
37
|
-
]);
|
|
38
|
-
const DANGEROUS_BASH_PATTERNS = /* @__PURE__ */ new Set([
|
|
39
|
-
"Bash(passwd *)",
|
|
40
|
-
"Bash(reboot *)",
|
|
41
|
-
"Bash(shutdown *)",
|
|
42
|
-
"Bash(halt *)",
|
|
43
|
-
"Bash(poweroff *)",
|
|
44
|
-
"Bash(init *)",
|
|
45
|
-
"Bash(telinit *)",
|
|
46
|
-
"Bash(rm *)",
|
|
47
|
-
"Bash(kill *)",
|
|
48
|
-
"Bash(pkill *)",
|
|
49
|
-
"Bash(killall *)",
|
|
50
|
-
"Bash(su *)",
|
|
51
|
-
"Bash(sudo *)",
|
|
52
|
-
"Bash(visudo *)",
|
|
53
|
-
"Bash(useradd *)",
|
|
54
|
-
"Bash(userdel *)",
|
|
55
|
-
"Bash(usermod *)",
|
|
56
|
-
"Bash(groupadd *)",
|
|
57
|
-
"Bash(groupdel *)",
|
|
58
|
-
"Bash(groupmod *)",
|
|
59
|
-
"Bash(modprobe *)",
|
|
60
|
-
"Bash(insmod *)",
|
|
61
|
-
"Bash(rmmod *)"
|
|
62
|
-
]);
|
|
63
|
-
function isValidPermission(perm) {
|
|
64
|
-
if (INVALID_PERMISSION_NAMES.has(perm)) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
if (["mcp__.*", "mcp__*", "mcp__(*)"].includes(perm)) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
if (/^[a-z]/.test(perm) && !perm.startsWith("mcp__")) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
function isCoveredByWildcard(perm, wildcardPerm) {
|
|
76
|
-
const wildcardMatch = wildcardPerm.match(/^(\w+)\((.+)\)$/);
|
|
77
|
-
if (!wildcardMatch) return false;
|
|
78
|
-
const [, tool, wildcardArg] = wildcardMatch;
|
|
79
|
-
if (!wildcardArg.includes("*")) return false;
|
|
80
|
-
const permMatch = perm.match(/^(\w+)\((.+)\)$/);
|
|
81
|
-
if (!permMatch) return false;
|
|
82
|
-
const [, permTool, permArg] = permMatch;
|
|
83
|
-
if (tool !== permTool) return false;
|
|
84
|
-
const regexStr = wildcardArg.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".+");
|
|
85
|
-
return new RegExp(`^${regexStr}$`).test(permArg);
|
|
86
|
-
}
|
|
87
|
-
function mergeAndCleanPermissions(templatePermissions, userPermissions) {
|
|
88
|
-
const template = templatePermissions || [];
|
|
89
|
-
const user = userPermissions || [];
|
|
90
|
-
const result = [...template];
|
|
91
|
-
for (const perm of user) {
|
|
92
|
-
if (result.includes(perm)) {
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (!isValidPermission(perm)) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
if (DANGEROUS_BASH_PATTERNS.has(perm)) {
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
let isRedundant = false;
|
|
102
|
-
for (const templatePerm of template) {
|
|
103
|
-
if (perm.startsWith(`${templatePerm}(`)) {
|
|
104
|
-
isRedundant = true;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
if (isCoveredByWildcard(perm, templatePerm)) {
|
|
108
|
-
isRedundant = true;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (!isRedundant) {
|
|
113
|
-
result.push(perm);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
27
|
function ensureClaudeDir() {
|
|
120
28
|
ensureDir(CLAUDE_DIR);
|
|
121
29
|
}
|
|
@@ -468,4 +376,4 @@ const config = {
|
|
|
468
376
|
updateDefaultModel: updateDefaultModel
|
|
469
377
|
};
|
|
470
378
|
|
|
471
|
-
export {
|
|
379
|
+
export { applyAiLanguageDirective as a, backupExistingConfig as b, copyConfigFiles as c, updateDefaultModel as d, getExistingApiConfig as e, configureApi as f, getExistingModelConfig as g, clearModelEnv as h, ensureClaudeDir as i, config as j, promptApiConfigurationAction as p, switchToOfficialLogin as s, updateCustomModel as u };
|