@shulex/cxclawctl 0.1.6 → 0.1.8
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 +3 -4
- package/capabilities.lock.json +2 -2
- package/dist/cli.js +19 -9
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,13 +33,13 @@ codex plugin marketplace add SolveaCX/cx_claw_codex --ref marketplace/stable
|
|
|
33
33
|
codex plugin add cxclaw@cxclaw
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
然后完成钉钉登录:
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
npx --yes @shulex/cxclawctl@latest auth login
|
|
39
|
+
npx --yes @shulex/cxclawctl@latest auth login
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
CLI
|
|
42
|
+
CLI 固定连接生产授权服务 `https://ai.solvea.cx/api_v2/ticket`,不接受用户指定服务地址或登录环境。CLI 会打开钉钉授权页;一次登录即可访问获准的测试和生产租户。授权完成后,检查登录状态和本地版本:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
npx --yes @shulex/cxclawctl@latest auth status
|
|
@@ -50,7 +50,6 @@ npx --yes @shulex/cxclawctl@latest doctor
|
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
npx --yes @shulex/cxclawctl@latest setup \
|
|
53
|
-
--server <shulex-cloud 授权地址> \
|
|
54
53
|
--channel stable
|
|
55
54
|
```
|
|
56
55
|
|
package/capabilities.lock.json
CHANGED
package/dist/cli.js
CHANGED
|
@@ -6,10 +6,13 @@ import { readFile as readFile6 } from "fs/promises";
|
|
|
6
6
|
// src/auth.ts
|
|
7
7
|
import open from "open";
|
|
8
8
|
|
|
9
|
+
// src/config.ts
|
|
10
|
+
var AUTH_SERVER_URL = "https://ai.solvea.cx/api_v2/ticket";
|
|
11
|
+
|
|
9
12
|
// package.json
|
|
10
13
|
var package_default = {
|
|
11
14
|
name: "@shulex/cxclawctl",
|
|
12
|
-
version: "0.1.
|
|
15
|
+
version: "0.1.8",
|
|
13
16
|
description: "Solvea CXClaw CLI and Codex plugin runtime",
|
|
14
17
|
type: "module",
|
|
15
18
|
bin: {
|
|
@@ -80,7 +83,7 @@ async function request(session, path, init = {}, tenant = false) {
|
|
|
80
83
|
let last;
|
|
81
84
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
82
85
|
try {
|
|
83
|
-
const response = await fetch(`${
|
|
86
|
+
const response = await fetch(`${AUTH_SERVER_URL}${path}`, { ...init, headers, signal: AbortSignal.timeout(3e4) });
|
|
84
87
|
const text = await response.text();
|
|
85
88
|
const value = text ? JSON.parse(text) : void 0;
|
|
86
89
|
if (!response.ok) throw new Error(`server returned ${response.status}: ${text}`);
|
|
@@ -113,8 +116,11 @@ async function deleteSession() {
|
|
|
113
116
|
|
|
114
117
|
// src/auth.ts
|
|
115
118
|
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
function publicAuthStatus(session) {
|
|
120
|
+
return { ok: true, loggedIn: true, email: session.email, channel: session.channel, accessExpiresAt: session.accessExpiry };
|
|
121
|
+
}
|
|
122
|
+
async function login(channel) {
|
|
123
|
+
const session = { channel, accessToken: "", refreshToken: "", accessExpiry: 0, employeeId: "", email: "" };
|
|
118
124
|
const start = await post(session, "/auth/device/start", { clientVersion: VERSION });
|
|
119
125
|
console.error(`\u8BF7\u5728\u6D4F\u89C8\u5668\u6253\u5F00\u4EE5\u4E0B\u5730\u5740\u5B8C\u6210\u9489\u9489\u6388\u6743\uFF1A
|
|
120
126
|
${start.verificationUriComplete}
|
|
@@ -2824,7 +2830,11 @@ var usage = () => [
|
|
|
2824
2830
|
"Example: cxclawctl intent create --data-file intent.json"
|
|
2825
2831
|
].join("\n\n");
|
|
2826
2832
|
async function runAuth(action2, args) {
|
|
2827
|
-
if (action2 === "login")
|
|
2833
|
+
if (action2 === "login") {
|
|
2834
|
+
if (flag(args, "--server") || flag(args, "--env")) throw new Error("auth login \u56FA\u5B9A\u4F7F\u7528\u751F\u4EA7\u6388\u6743\u670D\u52A1\uFF0C\u4E0D\u652F\u6301 --server \u6216 --env");
|
|
2835
|
+
const session = await login(option(args, "--channel") ?? "stable");
|
|
2836
|
+
return print(publicAuthStatus(session));
|
|
2837
|
+
}
|
|
2828
2838
|
if (action2 === "logout") {
|
|
2829
2839
|
await logout();
|
|
2830
2840
|
return print({ ok: true, loggedOut: true });
|
|
@@ -2832,14 +2842,13 @@ async function runAuth(action2, args) {
|
|
|
2832
2842
|
if (action2 === "status") {
|
|
2833
2843
|
try {
|
|
2834
2844
|
const session = await loadSession();
|
|
2835
|
-
return print(
|
|
2845
|
+
return print(publicAuthStatus(session));
|
|
2836
2846
|
} catch {
|
|
2837
2847
|
return print({ ok: true, loggedIn: false });
|
|
2838
2848
|
}
|
|
2839
2849
|
}
|
|
2840
2850
|
if (action2 === "refresh") {
|
|
2841
|
-
|
|
2842
|
-
return print({ ok: true, accessExpiresAt: session.accessExpiry });
|
|
2851
|
+
return print(publicAuthStatus(await authenticated()));
|
|
2843
2852
|
}
|
|
2844
2853
|
throw new Error("auth action must be login, logout, status, or refresh");
|
|
2845
2854
|
}
|
|
@@ -2871,9 +2880,10 @@ async function main(args = process.argv.slice(2)) {
|
|
|
2871
2880
|
return;
|
|
2872
2881
|
}
|
|
2873
2882
|
if (command === "setup") {
|
|
2883
|
+
if (flag(args, "--server") || flag(args, "--env")) throw new Error("setup \u56FA\u5B9A\u4F7F\u7528\u751F\u4EA7\u6388\u6743\u670D\u52A1\uFF0C\u4E0D\u652F\u6301 --server \u6216 --env");
|
|
2874
2884
|
const channel = option(args, "--channel") ?? "stable";
|
|
2875
2885
|
await installMarketplace(channel);
|
|
2876
|
-
await login(
|
|
2886
|
+
await login(channel);
|
|
2877
2887
|
await installScheduler();
|
|
2878
2888
|
return;
|
|
2879
2889
|
}
|