@dhfpub/clawpool 0.2.1 → 0.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/package.json
CHANGED
|
@@ -17,7 +17,7 @@ Use the bundled scripts and local OpenClaw CLI to bootstrap ClawPool channel acc
|
|
|
17
17
|
6. `configure-openclaw`
|
|
18
18
|
7. `bootstrap-openclaw`
|
|
19
19
|
|
|
20
|
-
`fetch-captcha` is only a helper step
|
|
20
|
+
`fetch-captcha` is only a helper step for `reset` and `change_password` email-code sends.
|
|
21
21
|
|
|
22
22
|
## Explain ClawPool
|
|
23
23
|
|
|
@@ -49,11 +49,16 @@ If the user wants the main OpenClaw agent to gain ClawPool channel ability quick
|
|
|
49
49
|
|
|
50
50
|
### A. Send registration email code
|
|
51
51
|
|
|
52
|
+
1. Ask for `email`.
|
|
53
|
+
2. Run `scripts/clawpool_auth.py send-email-code --email ... --scene register`.
|
|
54
|
+
|
|
55
|
+
### A2. Send reset or change-password email code
|
|
56
|
+
|
|
52
57
|
1. Ask for `email`.
|
|
53
58
|
2. Run `scripts/clawpool_auth.py fetch-captcha`.
|
|
54
59
|
3. Show `captcha_image_path` to the user if present.
|
|
55
60
|
4. Ask the user to read the captcha text.
|
|
56
|
-
5. Run `scripts/clawpool_auth.py send-email-code --email ... --scene
|
|
61
|
+
5. Run `scripts/clawpool_auth.py send-email-code --email ... --scene reset --captcha-id ... --captcha-value ...`.
|
|
57
62
|
|
|
58
63
|
### B. Register
|
|
59
64
|
|
|
@@ -160,7 +165,7 @@ This action can:
|
|
|
160
165
|
## Guardrails
|
|
161
166
|
|
|
162
167
|
1. Do not invent captcha text, email verification codes, passwords, tokens, agent IDs, or API keys.
|
|
163
|
-
2. Do not call `send-email-code` before obtaining a fresh `captcha_id`.
|
|
168
|
+
2. Do not call `send-email-code` for `reset` or `change_password` before obtaining a fresh `captcha_id`.
|
|
164
169
|
3. Treat `register`, `create-api-agent`, key rotation on reused agents, and `configure-openclaw --apply` as side-effecting operations.
|
|
165
170
|
4. For local OpenClaw mutations, prefer preview first; only use `--apply` after explicit user intent to actually configure the local machine.
|
|
166
171
|
5. Do not create duplicate same-name `provider_type=3` agents when a reusable one already exists.
|
|
@@ -176,7 +181,7 @@ This action can:
|
|
|
176
181
|
## Error Handling
|
|
177
182
|
|
|
178
183
|
1. `图形验证码错误或已过期`:
|
|
179
|
-
fetch a new captcha and retry send-email-code.
|
|
184
|
+
for `reset` or `change_password`, fetch a new captcha and retry send-email-code.
|
|
180
185
|
2. `该邮箱已被注册`:
|
|
181
186
|
stop registration and switch to login if the user wants.
|
|
182
187
|
3. `邮箱验证码错误或已过期`:
|
|
@@ -19,7 +19,7 @@ Helper prerequisite:
|
|
|
19
19
|
|
|
20
20
|
| Helper Action | Method | Route | Purpose |
|
|
21
21
|
|---|---|---|---|
|
|
22
|
-
| `fetch-captcha` | `GET` | `/auth/captcha` | Fetch a fresh captcha before `send-email-code` |
|
|
22
|
+
| `fetch-captcha` | `GET` | `/auth/captcha` | Fetch a fresh captcha before `send-email-code` for `reset` or `change_password` |
|
|
23
23
|
|
|
24
24
|
### Agent bootstrap action
|
|
25
25
|
|
|
@@ -36,7 +36,16 @@ Helper prerequisite:
|
|
|
36
36
|
```json
|
|
37
37
|
{
|
|
38
38
|
"email": "user@example.com",
|
|
39
|
-
"scene": "register"
|
|
39
|
+
"scene": "register"
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For `reset` and `change_password`, `captcha_id` and `captcha_value` are still required:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"email": "user@example.com",
|
|
48
|
+
"scene": "reset",
|
|
40
49
|
"captcha_id": "captcha-id",
|
|
41
50
|
"captcha_value": "ab12"
|
|
42
51
|
}
|
|
@@ -94,7 +103,7 @@ When the same-name `provider_type=3` agent already exists, the skill should:
|
|
|
94
103
|
|
|
95
104
|
### Captcha helper
|
|
96
105
|
|
|
97
|
-
`fetch-captcha` returns `captcha_id` and `b64s`. The bundled script also returns `captcha_image_path` when image decoding succeeds.
|
|
106
|
+
`fetch-captcha` returns `captcha_id` and `b64s`. The bundled script also returns `captcha_image_path` when image decoding succeeds. This helper is only needed for `reset` and `change_password` email-code sends.
|
|
98
107
|
|
|
99
108
|
### `register` / `login`
|
|
100
109
|
|
|
@@ -119,7 +128,7 @@ The bundled script lifts these fields to the top level:
|
|
|
119
128
|
|
|
120
129
|
## Common Errors
|
|
121
130
|
|
|
122
|
-
1. `图形验证码错误或已过期`
|
|
131
|
+
1. `图形验证码错误或已过期` for `reset` or `change_password`
|
|
123
132
|
2. `邮箱验证码错误或已过期`
|
|
124
133
|
3. `该邮箱已被注册`
|
|
125
134
|
4. `用户不存在或密码错误`
|
|
@@ -1231,16 +1231,28 @@ def handle_fetch_captcha(args):
|
|
|
1231
1231
|
|
|
1232
1232
|
|
|
1233
1233
|
def handle_send_email_code(args):
|
|
1234
|
+
scene = args.scene.strip()
|
|
1235
|
+
payload = {
|
|
1236
|
+
"email": args.email.strip(),
|
|
1237
|
+
"scene": scene,
|
|
1238
|
+
}
|
|
1239
|
+
captcha_id = (args.captcha_id or "").strip()
|
|
1240
|
+
captcha_value = (args.captcha_value or "").strip()
|
|
1241
|
+
if scene in {"reset", "change_password"}:
|
|
1242
|
+
if not captcha_id or not captcha_value:
|
|
1243
|
+
raise ClawpoolAuthError(
|
|
1244
|
+
"captcha_id and captcha_value are required for reset/change_password"
|
|
1245
|
+
)
|
|
1246
|
+
if captcha_id:
|
|
1247
|
+
payload["captcha_id"] = captcha_id
|
|
1248
|
+
if captcha_value:
|
|
1249
|
+
payload["captcha_value"] = captcha_value
|
|
1250
|
+
|
|
1234
1251
|
result = request_json(
|
|
1235
1252
|
"POST",
|
|
1236
1253
|
"/auth/send-code",
|
|
1237
1254
|
args.base_url,
|
|
1238
|
-
body=
|
|
1239
|
-
"email": args.email.strip(),
|
|
1240
|
-
"scene": args.scene.strip(),
|
|
1241
|
-
"captcha_id": args.captcha_id.strip(),
|
|
1242
|
-
"captcha_value": args.captcha_value.strip(),
|
|
1243
|
-
},
|
|
1255
|
+
body=payload,
|
|
1244
1256
|
)
|
|
1245
1257
|
print_json(
|
|
1246
1258
|
{
|
|
@@ -1409,8 +1421,8 @@ def build_parser():
|
|
|
1409
1421
|
send_email_code = subparsers.add_parser("send-email-code", help="Send email verification code")
|
|
1410
1422
|
send_email_code.add_argument("--email", required=True)
|
|
1411
1423
|
send_email_code.add_argument("--scene", required=True, choices=["register", "reset", "change_password"])
|
|
1412
|
-
send_email_code.add_argument("--captcha-id",
|
|
1413
|
-
send_email_code.add_argument("--captcha-value",
|
|
1424
|
+
send_email_code.add_argument("--captcha-id", default="")
|
|
1425
|
+
send_email_code.add_argument("--captcha-value", default="")
|
|
1414
1426
|
send_email_code.set_defaults(handler=handle_send_email_code)
|
|
1415
1427
|
|
|
1416
1428
|
register = subparsers.add_parser("register", help="Register by email verification code")
|