specific-ai-cli 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.en.md +177 -0
- package/README.ja.md +177 -0
- package/README.ko.md +177 -0
- package/README.md +174 -2
- package/README.zh-TW.md +177 -0
- package/assets/banner.txt +3 -0
- package/dist/cli/argv.js +98 -0
- package/dist/cli/commands/auth.js +11 -0
- package/dist/cli/commands/config.js +23 -0
- package/dist/cli/commands/doctor.js +134 -0
- package/dist/cli/commands/platforms.js +24 -0
- package/dist/cli/commands/version.js +4 -0
- package/dist/cli/confirm.js +22 -0
- package/dist/cli/dispatch.js +440 -0
- package/dist/cli/help.js +223 -0
- package/dist/cli/hints.js +60 -0
- package/dist/cli/main.js +18 -0
- package/dist/cli/output.js +66 -0
- package/dist/core/auth-handlers.js +41 -0
- package/dist/core/auth-store.js +119 -0
- package/dist/core/capabilities.js +163 -0
- package/dist/core/config.js +121 -0
- package/dist/core/cookies.js +164 -0
- package/dist/core/errors.js +37 -0
- package/dist/core/files.js +89 -0
- package/dist/core/fsutil.js +52 -0
- package/dist/core/hash.js +4 -0
- package/dist/core/http.js +331 -0
- package/dist/core/image.js +280 -0
- package/dist/core/log.js +40 -0
- package/dist/core/login.js +191 -0
- package/dist/core/mp4.js +130 -0
- package/dist/core/normalize.js +207 -0
- package/dist/core/options.js +110 -0
- package/dist/core/paths.js +38 -0
- package/dist/core/pb.js +59 -0
- package/dist/core/py.js +181 -0
- package/dist/core/rand.js +131 -0
- package/dist/core/registry.js +129 -0
- package/dist/core/schemas.js +41 -0
- package/dist/core/stream.js +104 -0
- package/dist/core/toolkit.js +35 -0
- package/dist/core/vm.js +73 -0
- package/dist/core/vocab.js +157 -0
- package/dist/platforms/_shared/impaas.js +410 -0
- package/dist/platforms/bilibili/index.js +216 -0
- package/dist/platforms/bilibili/web/api.js +806 -0
- package/dist/platforms/bilibili/web/client.js +311 -0
- package/dist/platforms/bilibili/web/commands.js +783 -0
- package/dist/platforms/bilibili/web/ddddocr.js +342 -0
- package/dist/platforms/bilibili/web/gaia.js +130 -0
- package/dist/platforms/bilibili/web/geetest-manual.js +154 -0
- package/dist/platforms/bilibili/web/geetest-vision.js +232 -0
- package/dist/platforms/bilibili/web/geetest.js +450 -0
- package/dist/platforms/bilibili/web/normalize.js +234 -0
- package/dist/platforms/bilibili/web/profile.js +135 -0
- package/dist/platforms/bilibili/web/resolve.js +112 -0
- package/dist/platforms/bilibili/web/sign.js +223 -0
- package/dist/platforms/bilibili/web/upos.js +102 -0
- package/dist/platforms/douyin/index.js +142 -0
- package/dist/platforms/douyin/web/api.js +863 -0
- package/dist/platforms/douyin/web/client.js +413 -0
- package/dist/platforms/douyin/web/commands.js +712 -0
- package/dist/platforms/douyin/web/creator.js +601 -0
- package/dist/platforms/douyin/web/crypto.js +247 -0
- package/dist/platforms/douyin/web/dtrait.js +190 -0
- package/dist/platforms/douyin/web/im.js +502 -0
- package/dist/platforms/douyin/web/image.js +5 -0
- package/dist/platforms/douyin/web/live.js +225 -0
- package/dist/platforms/douyin/web/mssdk.js +148 -0
- package/dist/platforms/douyin/web/normalize.js +326 -0
- package/dist/platforms/douyin/web/passport.js +1247 -0
- package/dist/platforms/douyin/web/profile.js +221 -0
- package/dist/platforms/douyin/web/proto.js +26 -0
- package/dist/platforms/douyin/web/resolve.js +88 -0
- package/dist/platforms/douyin/web/sign.js +436 -0
- package/dist/platforms/douyin/web/tos.js +78 -0
- package/dist/platforms/index.js +17 -0
- package/dist/platforms/jd/index.js +67 -0
- package/dist/platforms/jd/web/aks.js +115 -0
- package/dist/platforms/jd/web/api.js +549 -0
- package/dist/platforms/jd/web/chat.js +132 -0
- package/dist/platforms/jd/web/client.js +470 -0
- package/dist/platforms/jd/web/commands.js +557 -0
- package/dist/platforms/jd/web/jcap/helper.js +90 -0
- package/dist/platforms/jd/web/jcap/host.js +107 -0
- package/dist/platforms/jd/web/jcap/lsd.js +300 -0
- package/dist/platforms/jd/web/jcap/solver.js +995 -0
- package/dist/platforms/jd/web/jcap.js +150 -0
- package/dist/platforms/jd/web/js.js +420 -0
- package/dist/platforms/jd/web/login.js +775 -0
- package/dist/platforms/jd/web/normalize.js +297 -0
- package/dist/platforms/jd/web/profile.js +256 -0
- package/dist/platforms/jd/web/util.js +175 -0
- package/dist/platforms/jd/web/webm.js +133 -0
- package/dist/platforms/kuaishou/index.js +98 -0
- package/dist/platforms/kuaishou/web/api.js +694 -0
- package/dist/platforms/kuaishou/web/captcha-crypto.js +134 -0
- package/dist/platforms/kuaishou/web/captcha-fp.js +180 -0
- package/dist/platforms/kuaishou/web/captcha.js +273 -0
- package/dist/platforms/kuaishou/web/client.js +487 -0
- package/dist/platforms/kuaishou/web/commands.js +863 -0
- package/dist/platforms/kuaishou/web/gap.js +144 -0
- package/dist/platforms/kuaishou/web/gdfp.js +376 -0
- package/dist/platforms/kuaishou/web/gql.js +11 -0
- package/dist/platforms/kuaishou/web/live.js +125 -0
- package/dist/platforms/kuaishou/web/normalize.js +241 -0
- package/dist/platforms/kuaishou/web/oracle.js +329 -0
- package/dist/platforms/kuaishou/web/profile.js +259 -0
- package/dist/platforms/kuaishou/web/resolve.js +84 -0
- package/dist/platforms/kuaishou/web/session.js +592 -0
- package/dist/platforms/kuaishou/web/sign.js +568 -0
- package/dist/platforms/taobao/index.js +56 -0
- package/dist/platforms/taobao/web/api.js +96 -0
- package/dist/platforms/taobao/web/client.js +102 -0
- package/dist/platforms/taobao/web/commands.js +172 -0
- package/dist/platforms/taobao/web/im.js +68 -0
- package/dist/platforms/taobao/web/normalize.js +103 -0
- package/dist/platforms/taobao/web/profile.js +85 -0
- package/dist/platforms/taobao/web/resolve.js +51 -0
- package/dist/platforms/taobao/web/sign.js +35 -0
- package/dist/platforms/tiktok/index.js +120 -0
- package/dist/platforms/tiktok/web/api.js +1234 -0
- package/dist/platforms/tiktok/web/client.js +362 -0
- package/dist/platforms/tiktok/web/commands.js +821 -0
- package/dist/platforms/tiktok/web/im.js +133 -0
- package/dist/platforms/tiktok/web/jsrun.js +126 -0
- package/dist/platforms/tiktok/web/normalize.js +286 -0
- package/dist/platforms/tiktok/web/profile.js +169 -0
- package/dist/platforms/tiktok/web/resolve.js +156 -0
- package/dist/platforms/tiktok/web/sign.js +585 -0
- package/dist/platforms/tiktok/web/upload.js +805 -0
- package/dist/platforms/tiktok/web/wire.js +490 -0
- package/dist/platforms/weibo/index.js +91 -0
- package/dist/platforms/weibo/web/api.js +206 -0
- package/dist/platforms/weibo/web/client.js +155 -0
- package/dist/platforms/weibo/web/commands.js +202 -0
- package/dist/platforms/weibo/web/normalize.js +137 -0
- package/dist/platforms/weibo/web/profile.js +246 -0
- package/dist/platforms/weibo/web/resolve.js +60 -0
- package/dist/platforms/weibo/web/sign.js +85 -0
- package/dist/platforms/x/index.js +107 -0
- package/dist/platforms/x/web/api.js +443 -0
- package/dist/platforms/x/web/article.js +212 -0
- package/dist/platforms/x/web/client.js +202 -0
- package/dist/platforms/x/web/commands.js +363 -0
- package/dist/platforms/x/web/graphql.js +108 -0
- package/dist/platforms/x/web/normalize.js +235 -0
- package/dist/platforms/x/web/profile.js +99 -0
- package/dist/platforms/x/web/resolve.js +44 -0
- package/dist/platforms/x/web/transaction.js +171 -0
- package/dist/platforms/xhs/index.js +101 -0
- package/dist/platforms/xhs/web/api.js +278 -0
- package/dist/platforms/xhs/web/client.js +540 -0
- package/dist/platforms/xhs/web/commands.js +1046 -0
- package/dist/platforms/xhs/web/creator-api.js +609 -0
- package/dist/platforms/xhs/web/creator.js +203 -0
- package/dist/platforms/xhs/web/js.js +194 -0
- package/dist/platforms/xhs/web/login.js +230 -0
- package/dist/platforms/xhs/web/normalize.js +166 -0
- package/dist/platforms/xhs/web/profile.js +127 -0
- package/dist/platforms/xhs/web/push.js +361 -0
- package/dist/platforms/xhs/web/resolve.js +69 -0
- package/dist/platforms/xhs/web/state.js +368 -0
- package/dist/platforms/xianyu/index.js +59 -0
- package/dist/platforms/xianyu/web/api.js +312 -0
- package/dist/platforms/xianyu/web/client.js +134 -0
- package/dist/platforms/xianyu/web/commands.js +305 -0
- package/dist/platforms/xianyu/web/im.js +73 -0
- package/dist/platforms/xianyu/web/normalize.js +123 -0
- package/dist/platforms/xianyu/web/profile.js +146 -0
- package/dist/platforms/xianyu/web/resolve.js +48 -0
- package/dist/platforms/xianyu/web/sign.js +79 -0
- package/package.json +77 -4
- package/static/douyin/Live.proto +194 -0
- package/static/douyin/Request.proto +89 -0
- package/static/douyin/Response.proto +46 -0
- package/static/douyin/acrawler_runtime/ac_vm.js +2 -0
- package/static/douyin/acrawler_runtime/browser_window_shape.json +1 -0
- package/static/douyin/acrawler_runtime/canvas_actual_exact.json +1 -0
- package/static/douyin/acrawler_runtime/run_ac_node.js +1005 -0
- package/static/douyin/acrawler_runtime/runner_window_keys_baseline.txt +240 -0
- package/static/douyin/challenge_profile.json +801 -0
- package/static/douyin/challenge_template_runner.js +217 -0
- package/static/douyin/dtrait_profile.json +66 -0
- package/static/douyin/mstoken_common_profile.json +1 -0
- package/static/douyin/mstoken_profile.json +214 -0
- package/static/jd/h5st5_env.js +750 -0
- package/static/jd/h5st5_lib.js +5 -0
- package/static/jd/h5st5_server.js +49 -0
- package/static/jd/jcap/env/env_core.js +512 -0
- package/static/jd/jcap/env/run.js +1307 -0
- package/static/jd/jcap/run/jcap_ujb96b.js +39 -0
- package/static/jd/package.json +4 -0
- package/static/jd/pc_tk_lib.js +1 -0
- package/static/jd/pc_tk_server.js +63 -0
- package/static/jd/summer_cryptico_runner.js +50 -0
- package/static/jd/webm/env/run.js +453 -0
- package/static/jd/webm/run/jdwebm-riskhandle.js +49 -0
- package/static/kuaishou/bundles/weapon/kwf-0.0.2.2cee19b4b7dec496.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-0-0.0.1-obfuscated.4b7f3de1ab0ddcc2.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-1-0.0.1-obfuscated.346ebdb1c78df316.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-10-0.0.1-obfuscated.a33db41897b983af.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-11-0.0.1-obfuscated.5e0a90af726d8a7e.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-12-0.0.1-obfuscated.20ea29345706ec8c.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-13-0.0.1-obfuscated.6b74e9640ff18648.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-14-0.0.1-obfuscated.551e4429d156bf66.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-15-0.0.1-obfuscated.8625b087aaba4a60.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-16-0.0.1-obfuscated.d5ffa4020f3be99a.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-17-0.0.1-obfuscated.6d13e19b22f50a80.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-18-0.0.1-obfuscated.6d31405044166289.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-19-0.0.1-obfuscated.a9a8d925942f19e4.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-2-0.0.1-obfuscated.b849a136ae4a6b3e.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-3-0.0.1-obfuscated.f9e77ebf6186e2ac.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-4-0.0.1-obfuscated.2c3c155aa52ceb0e.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-5-0.0.1-obfuscated.4e553d17691b3c5a.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-6-0.0.1-obfuscated.f73ddd3ff13e1217.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-7-0.0.1-obfuscated.1628b8729beaab7e.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-8-0.0.1-obfuscated.6da6baef7aa81fff.js +1 -0
- package/static/kuaishou/bundles/weapon/kws-9-0.0.1-obfuscated.8645d55e5323b743.js +1 -0
- package/static/kuaishou/fixtures/current_follow_script_813.network-response +2 -0
- package/static/kuaishou/fixtures/live_ws_maps.json +61 -0
- package/static/kuaishou/fixtures/live_ws_proto.json +1342 -0
- package/static/kuaishou/js/cp-kwf.js +1 -0
- package/static/kuaishou/tools/kwf_oracle.js +799 -0
- package/static/kuaishou/tools/kws_oracle.js +885 -0
- package/static/kuaishou/tools/like_token_oracle.js +70 -0
- package/static/taobao/taobao_js_20260407.js +570 -0
- package/static/tiktok/Tiktok_Request.json +597 -0
- package/static/tiktok/package.json +3 -0
- package/static/tiktok/shop_bsid/core.js +1 -0
- package/static/tiktok/shop_bsid/env_core.js +512 -0
- package/static/tiktok/shop_bsid/loader.js +1 -0
- package/static/tiktok/shop_bsid/run.js +753 -0
- package/static/tiktok/shop_bsid/sign.js +100 -0
- package/static/tiktok/shop_bsid/webmssdk.js +1 -0
- package/static/tiktok/shop_bsid/webmssdk_ex.js +1 -0
- package/static/tiktok/signing/env/env_core.js +512 -0
- package/static/tiktok/signing/env/sign.js +455 -0
- package/static/tiktok/signing/sdk_config.json +230 -0
- package/static/tiktok/signing/source/webmssdk.js +1 -0
- package/static/tiktok/signing/source/webmssdk_ex.js +1 -0
- package/static/tiktok/signing/source/webmssdk_legacy.js +1 -0
- package/static/x/graphql.json +7777 -0
- package/static/x/transaction_l1.json +12 -0
- package/static/xhs/package.json +3 -0
- package/static/xhs/xhs_core/js/b1.js +210 -0
- package/static/xhs/xhs_core/js/mns.js +340 -0
- package/static/xhs/xhs_core/js/mns_0101_keystream.json +5 -0
- package/static/xhs/xhs_core/js/mns_keystreams.json +1 -0
- package/static/xhs/xhs_core/js/sign.js +225 -0
- package/static/xhs/xhs_core/js/websectiga_cli.js +220 -0
- package/static/xhs/xhs_core/js/websectiga_env.js +512 -0
- package/static/xhs/xhs_core/js/xs_common.js +79 -0
- package/static/xhs/xhs_creator/js/profile.js +115 -0
- package/static/xhs/xhs_creator/js/rap_fingerprint_creator.json +6 -0
- package/static/xhs/xhs_creator/js/reference_profile.json +282 -0
- package/static/xhs/xhs_creator/js/xhs_creator_sign.js +29 -0
- package/static/xhs/xhs_creator/js/xhs_creator_signature.js +23 -0
- package/static/xhs/xhs_pc/js/aes_decrypt.js +22 -0
- package/static/xhs/xhs_pc/js/aes_encrypt.js +30 -0
- package/static/xhs/xhs_pc/js/b1.js +9 -0
- package/static/xhs/xhs_pc/js/deflate.js +320 -0
- package/static/xhs/xhs_pc/js/mns.js +4 -0
- package/static/xhs/xhs_pc/js/profile.js +141 -0
- package/static/xhs/xhs_pc/js/rap.js +173 -0
- package/static/xhs/xhs_pc/js/rap_cli.js +30 -0
- package/static/xhs/xhs_pc/js/rap_crypto.js +73 -0
- package/static/xhs/xhs_pc/js/rap_fingerprint_template.json +8 -0
- package/static/xhs/xhs_pc/js/reference_profile.json +262 -0
- package/static/xhs/xhs_pc/js/sign.js +6 -0
- package/static/xhs/xhs_pc/js/web_ssk.js +82 -0
- package/static/xhs/xhs_pc/js/xs_common.js +4 -0
- package/static/xianyu/et_f.js +2 -0
- package/static/xianyu/gen_tfstk.js +410 -0
- package/static/xianyu/goofish_js_version_2.js +568 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { SpecificAIError } from '../../../core/errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* 参数归一化(AGENTS 4.8):笔记 / 用户 / 直播间的 ID、URL、分享短链(xhslink.com)、`me`。
|
|
4
|
+
* 小红书取详情需要 xsec_token,只能从 URL 里带进来(上游 get_note_info(url) 同样从 URL 解析)。
|
|
5
|
+
*/
|
|
6
|
+
const SHORT_RE = /^https?:\/\/(xhslink\.com|xhs\.link)\//i;
|
|
7
|
+
const ID_RE = /^[0-9a-f]{24}$/i;
|
|
8
|
+
/** 分享短链跟一次跳转,取 Location。 */
|
|
9
|
+
async function expand(p, input) {
|
|
10
|
+
const s = input.trim();
|
|
11
|
+
if (!SHORT_RE.test(s))
|
|
12
|
+
return s;
|
|
13
|
+
const res = await p.http.request({ url: s, redirect: 'manual', cookies: false });
|
|
14
|
+
return res.headers.get('location') ?? s;
|
|
15
|
+
}
|
|
16
|
+
function query(u) {
|
|
17
|
+
const out = {};
|
|
18
|
+
for (const [k, v] of u.searchParams)
|
|
19
|
+
out[k] = v;
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
/** 笔记:24 位 ID,或 /explore/<id>、/discovery/item/<id>、/user/profile/<uid>/<id> 的链接(带 xsec_token)。 */
|
|
23
|
+
export async function resolveNote(p, input) {
|
|
24
|
+
const s = await expand(p, input);
|
|
25
|
+
if (ID_RE.test(s))
|
|
26
|
+
return { id: s, token: '', source: 'pc_feed' };
|
|
27
|
+
try {
|
|
28
|
+
const u = new URL(s);
|
|
29
|
+
const id = u.pathname.split('/').filter(Boolean).at(-1) ?? '';
|
|
30
|
+
if (ID_RE.test(id)) {
|
|
31
|
+
const q = query(u);
|
|
32
|
+
return { id, token: q.xsec_token ?? '', source: q.xsec_source || 'pc_search' };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch { }
|
|
36
|
+
throw new SpecificAIError('USAGE', `无法识别的笔记:${input}`, { hint: '传带 xsec_token 的笔记链接,例如 https://www.xiaohongshu.com/explore/<id>?xsec_token=...' });
|
|
37
|
+
}
|
|
38
|
+
/** 用户:24 位 ID、主页链接 /user/profile/<id>?xsec_token=...,或 `me`。 */
|
|
39
|
+
export async function resolveUser(p, input) {
|
|
40
|
+
const s = await expand(p, input);
|
|
41
|
+
if (s === 'me') {
|
|
42
|
+
const id = p.credential.user?.id;
|
|
43
|
+
if (!id)
|
|
44
|
+
throw new SpecificAIError('AUTH_REQUIRED', 'me 表示当前账号,需要先登录', { hint: 'specific-ai xhs auth login' });
|
|
45
|
+
return { id, token: '', source: '' };
|
|
46
|
+
}
|
|
47
|
+
if (ID_RE.test(s))
|
|
48
|
+
return { id: s, token: '', source: '' };
|
|
49
|
+
try {
|
|
50
|
+
const u = new URL(s);
|
|
51
|
+
const m = /\/user\/profile\/([0-9a-f]{24})/i.exec(u.pathname);
|
|
52
|
+
if (m) {
|
|
53
|
+
const q = query(u);
|
|
54
|
+
return { id: m[1], token: q.xsec_token ?? '', source: q.xsec_source ?? '' };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch { }
|
|
58
|
+
throw new SpecificAIError('USAGE', `无法识别的用户:${input}`, { hint: '传用户 ID(24 位十六进制)或主页链接 https://www.xiaohongshu.com/user/profile/<id>' });
|
|
59
|
+
}
|
|
60
|
+
/** 直播间:房间号(数字)或直播间链接 /livestream/<room_id>。 */
|
|
61
|
+
export async function resolveRoom(p, input) {
|
|
62
|
+
const s = await expand(p, input);
|
|
63
|
+
if (/^\d+$/.test(s))
|
|
64
|
+
return s;
|
|
65
|
+
const m = /\/livestream\/(?:[^/?]+\/)?(\d+)/.exec(s) ?? /[?&]room_id=(\d+)/.exec(s);
|
|
66
|
+
if (m)
|
|
67
|
+
return m[1];
|
|
68
|
+
throw new SpecificAIError('USAGE', `无法识别的直播间:${input}`, { hint: '传房间号或直播间链接' });
|
|
69
|
+
}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import * as rand from '../../../core/rand.js';
|
|
2
|
+
import { generateB1 } from './js.js';
|
|
3
|
+
import { CREATOR_REFERENCE, PC_REFERENCE } from './profile.js';
|
|
4
|
+
/**
|
|
5
|
+
* 签名要用的设备 / 会话状态(上游 xhs_pc/state.py 的 PcDeviceProfile、xhs_creator/state.py 的 CreatorDeviceProfile)。
|
|
6
|
+
*
|
|
7
|
+
* 会话状态(loadts、dsllt、MNS seq、tiga 时间、webSsk、tab 设备 ID……)对应浏览器的 localStorage / sessionStorage,
|
|
8
|
+
* 持久部分存在凭证的 `device.pc` / `device.creator`;和上游 from_cookie 一样,MNS seq 每条命令从 0 开始。
|
|
9
|
+
*/
|
|
10
|
+
export const DS_REFRESH_MS = 15 * 60 * 1000;
|
|
11
|
+
const tail = (hex) => [...Buffer.from(hex, 'hex')];
|
|
12
|
+
const material = (v) => ({ tier: String(v.tier), envConst: Number(v.envConst), envFpTail: tail(v.envFpTailHex), deviceTag: v.deviceTag });
|
|
13
|
+
/** 浏览器写 ets 时避开末位是 1 的毫秒数。 */
|
|
14
|
+
export const normalizeEts = (t) => (t % 10 === 1 ? t + 1 : t);
|
|
15
|
+
/** 32 位随机数:上游 `secrets.randbits(32)`。 */
|
|
16
|
+
export const randbits32 = () => Math.floor(rand.random() * 2 ** 32);
|
|
17
|
+
/** JS 的数字转字符串(与 Python `str(float)` 在这些值上一致:整数不带 .0)。 */
|
|
18
|
+
const num = (v) => String(v);
|
|
19
|
+
// ================================================================ PC
|
|
20
|
+
const PC_STAGE_BY_TIER = { '0201': 'security', '0101': 'coldContent', '0301': 'steadyContent' };
|
|
21
|
+
/** b1 的 19 字段采集器状态(上游 B1RuntimeState)。 */
|
|
22
|
+
function pcB1State(startedAt, profileName = '') {
|
|
23
|
+
const v = { ...PC_REFERENCE.b1Reference, ...(profileName ? PC_REFERENCE.b1Profiles[profileName] : {}) };
|
|
24
|
+
const overrides = { ...(v.overrides ?? {}) };
|
|
25
|
+
for (const k of ['x37', 'x38', 'x82'])
|
|
26
|
+
if (k in v)
|
|
27
|
+
overrides[k] = String(v[k]);
|
|
28
|
+
return {
|
|
29
|
+
frameCount: Number(v.frameCount),
|
|
30
|
+
x39: Number(v.x39),
|
|
31
|
+
x50: String(v.x50),
|
|
32
|
+
secCanvas: String(v.secCanvas),
|
|
33
|
+
generatedAtOffsetMs: v.generatedAtOffsetMs != null ? Number(v.generatedAtOffsetMs) : null,
|
|
34
|
+
selectedGlobalNames: [...v.selectedGlobalNames],
|
|
35
|
+
timeOrigin: startedAt + Number(v.timeOriginOffsetMs ?? 0),
|
|
36
|
+
telemetryProfile: String(v.telemetryProfile ?? 'active'),
|
|
37
|
+
telemetryTemplate: String(v.telemetryTemplate ?? ''),
|
|
38
|
+
mouse: { ...(v.mouse ?? {}) },
|
|
39
|
+
keyboard: { ...(v.keyboard ?? {}) },
|
|
40
|
+
page: { ...(v.page ?? {}) },
|
|
41
|
+
state: { ...(v.state ?? {}) },
|
|
42
|
+
features: { ...(v.features ?? {}) },
|
|
43
|
+
overrides,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function pcB1Options(s, now) {
|
|
47
|
+
const overrides = { ...s.overrides, x36: String(s.frameCount) };
|
|
48
|
+
if (s.telemetryTemplate)
|
|
49
|
+
overrides.x84 = s.telemetryTemplate.replace('__TIME_ORIGIN__', num(s.timeOrigin));
|
|
50
|
+
return {
|
|
51
|
+
now,
|
|
52
|
+
x39: s.x39,
|
|
53
|
+
x50: s.x50,
|
|
54
|
+
secCanvas: s.secCanvas,
|
|
55
|
+
windowKeys: s.selectedGlobalNames,
|
|
56
|
+
telemetry: { profile: s.telemetryProfile, timeOrigin: s.timeOrigin, mouse: s.mouse, keyboard: s.keyboard, page: s.page, state: s.state, features: s.features },
|
|
57
|
+
overrides,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export class PcState {
|
|
61
|
+
cookies = {};
|
|
62
|
+
loadts = 0;
|
|
63
|
+
dsllt = 0;
|
|
64
|
+
ets = 0;
|
|
65
|
+
seq = 0;
|
|
66
|
+
fingerprintReady = false;
|
|
67
|
+
lastTiga = 0;
|
|
68
|
+
p1 = 0;
|
|
69
|
+
sc = 0;
|
|
70
|
+
tabDeviceId = '';
|
|
71
|
+
rwpFingerprint = '';
|
|
72
|
+
rwpToken = null;
|
|
73
|
+
webSsk = '';
|
|
74
|
+
webBuild;
|
|
75
|
+
release;
|
|
76
|
+
stages;
|
|
77
|
+
b1;
|
|
78
|
+
named = new Map();
|
|
79
|
+
/** cookies 是上游 cookie_map(不含 host-only 的 acw_tc),local / session 是持久化的 storage。 */
|
|
80
|
+
constructor(cookies, local = {}, session = {}) {
|
|
81
|
+
this.cookies = { ...cookies };
|
|
82
|
+
const started = Number(cookies.loadts || rand.now());
|
|
83
|
+
this.loadts = started;
|
|
84
|
+
this.dsllt = Number(local.dsllt || started);
|
|
85
|
+
this.ets = Number(cookies.ets || normalizeEts(started));
|
|
86
|
+
this.fingerprintReady = Boolean(cookies.gid);
|
|
87
|
+
this.lastTiga = Number(local.last_tiga_update_time || 0);
|
|
88
|
+
this.p1 = Number(local.p1 || 0);
|
|
89
|
+
this.sc = Number(local.sc || 0);
|
|
90
|
+
this.tabDeviceId = session.XHS_TAB_DEVICE_ID || '';
|
|
91
|
+
this.rwpFingerprint = session.XHS_RWP_FINGERPRINT || '';
|
|
92
|
+
try {
|
|
93
|
+
this.rwpToken = local.RWP_LOGIN_TOKEN ? JSON.parse(local.RWP_LOGIN_TOKEN) : null;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
this.rwpToken = null;
|
|
97
|
+
}
|
|
98
|
+
this.webSsk = local.webSsk || '';
|
|
99
|
+
// 上游 ensure_tab_device_id:没有时消耗一次 uuid4
|
|
100
|
+
this.tabDeviceId ||= rand.uuid4();
|
|
101
|
+
this.rwpFingerprint ||= String(started);
|
|
102
|
+
this.b1 = pcB1State(started);
|
|
103
|
+
this.release = { ...PC_REFERENCE.release };
|
|
104
|
+
this.webBuild = cookies.webBuild || this.release.webBuild;
|
|
105
|
+
this.stages = Object.fromEntries(Object.entries(PC_REFERENCE.mnsStages).map(([k, v]) => [k, material(v)]));
|
|
106
|
+
}
|
|
107
|
+
/** 上游 update_cookies:跟进 loadts / ets / websectiga / gid 带来的状态变化。 */
|
|
108
|
+
updateCookies(updates) {
|
|
109
|
+
const oldTiga = this.cookies.websectiga;
|
|
110
|
+
Object.assign(this.cookies, updates);
|
|
111
|
+
if (updates.webBuild)
|
|
112
|
+
this.webBuild = updates.webBuild;
|
|
113
|
+
if (updates.loadts)
|
|
114
|
+
this.loadts = Number(updates.loadts);
|
|
115
|
+
if (updates.ets)
|
|
116
|
+
this.ets = Number(updates.ets);
|
|
117
|
+
if (updates.websectiga && updates.websectiga !== oldTiga)
|
|
118
|
+
this.lastTiga = rand.now();
|
|
119
|
+
if (updates.gid)
|
|
120
|
+
this.fingerprintReady = true;
|
|
121
|
+
}
|
|
122
|
+
/** 签名 JS 能看到的 document.cookie:去掉 HttpOnly 的登录态。 */
|
|
123
|
+
get documentCookie() {
|
|
124
|
+
const hidden = new Set(['acw_tc', 'web_session', 'secure_session', 'id_token', 'customer-sso-sid', 'access-token-creator.xiaohongshu.com', 'galaxy_creator_session_id']);
|
|
125
|
+
return Object.entries(this.cookies)
|
|
126
|
+
.filter(([k]) => !hidden.has(k))
|
|
127
|
+
.map(([k, v]) => `${k}=${v}`)
|
|
128
|
+
.join('; ');
|
|
129
|
+
}
|
|
130
|
+
resolveTier(api, explicit) {
|
|
131
|
+
if (explicit)
|
|
132
|
+
return explicit;
|
|
133
|
+
if (this.fingerprintReady)
|
|
134
|
+
return '0301';
|
|
135
|
+
if (api.includes('/api/sec/v1/') || api.includes('/api/redcaptcha/') || api.includes('sem_sdk'))
|
|
136
|
+
return '0201';
|
|
137
|
+
return '0101';
|
|
138
|
+
}
|
|
139
|
+
/** 上游 next_sign_context:MNS 档位、环境常量、seq 自增、随机 version。 */
|
|
140
|
+
nextSignContext(api, options = {}) {
|
|
141
|
+
const tier = this.resolveTier(api, options.tier);
|
|
142
|
+
const m = options.mnsProfile ? material(PC_REFERENCE.loginMnsProfiles[options.mnsProfile]) : this.stages[PC_STAGE_BY_TIER[tier]];
|
|
143
|
+
const now = rand.now();
|
|
144
|
+
const context = {
|
|
145
|
+
tier,
|
|
146
|
+
now,
|
|
147
|
+
version: randbits32(),
|
|
148
|
+
loadts: this.loadts,
|
|
149
|
+
seq: ++this.seq,
|
|
150
|
+
envConst: m.envConst,
|
|
151
|
+
envFpTail: m.envFpTail,
|
|
152
|
+
webBuild: this.webBuild,
|
|
153
|
+
signVersion: this.release.signVersion,
|
|
154
|
+
appId: this.release.appId,
|
|
155
|
+
platform: this.release.platform,
|
|
156
|
+
userAgent: this.release.userAgent,
|
|
157
|
+
secChUa: this.release.secChUa,
|
|
158
|
+
};
|
|
159
|
+
if (this.webSsk)
|
|
160
|
+
context.webSsk = this.webSsk;
|
|
161
|
+
return context;
|
|
162
|
+
}
|
|
163
|
+
currentB1(now, profileName) {
|
|
164
|
+
if (!profileName)
|
|
165
|
+
return generateB1(pcB1Options(this.b1, now));
|
|
166
|
+
const cached = this.named.get(profileName);
|
|
167
|
+
if (cached)
|
|
168
|
+
return cached;
|
|
169
|
+
const s = pcB1State(this.loadts, profileName);
|
|
170
|
+
const at = s.generatedAtOffsetMs != null ? this.loadts + s.generatedAtOffsetMs : now;
|
|
171
|
+
const value = generateB1(pcB1Options(s, at));
|
|
172
|
+
this.named.set(profileName, value);
|
|
173
|
+
return value;
|
|
174
|
+
}
|
|
175
|
+
dslPair(dsl, now) {
|
|
176
|
+
if (now - this.dsllt >= DS_REFRESH_MS)
|
|
177
|
+
this.dsllt = now;
|
|
178
|
+
return `${this.dsllt};${dsl}`;
|
|
179
|
+
}
|
|
180
|
+
profileDataOptions(now) {
|
|
181
|
+
return {
|
|
182
|
+
fields: {},
|
|
183
|
+
timestampMs: now,
|
|
184
|
+
ets: this.ets,
|
|
185
|
+
documentCookie: this.documentCookie,
|
|
186
|
+
timeOrigin: this.loadts + Number(PC_REFERENCE.webProfile.timeOriginOffsetMs ?? 0),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/** 持久化的 localStorage / sessionStorage。 */
|
|
190
|
+
storage() {
|
|
191
|
+
const local = { dsllt: String(this.dsllt), last_tiga_update_time: String(this.lastTiga), p1: String(this.p1), sc: String(this.sc) };
|
|
192
|
+
if (this.webSsk)
|
|
193
|
+
local.webSsk = this.webSsk;
|
|
194
|
+
if (this.rwpToken)
|
|
195
|
+
local.RWP_LOGIN_TOKEN = JSON.stringify(this.rwpToken);
|
|
196
|
+
return { local, session: { XHS_TAB_DEVICE_ID: this.tabDeviceId, XHS_RWP_FINGERPRINT: this.rwpFingerprint } };
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// ================================================================ Creator
|
|
200
|
+
/** Creator 页面的 b1 采集器(上游 CreatorB1RuntimeState;传了 started_at 的都不抖动)。 */
|
|
201
|
+
function creatorB1State(startedAt, profileName = 'login') {
|
|
202
|
+
const v = { ...CREATOR_REFERENCE.b1Reference, ...(['', 'login', 'default'].includes(profileName) ? {} : CREATOR_REFERENCE.b1Profiles[profileName]) };
|
|
203
|
+
return {
|
|
204
|
+
frameCount: Number(v.frameCount),
|
|
205
|
+
x39: Number(v.x39),
|
|
206
|
+
x50: String(v.x50),
|
|
207
|
+
x51: String(v.x51 ?? ''),
|
|
208
|
+
generatedAtOffsetMs: v.generatedAtOffsetMs != null ? Number(v.generatedAtOffsetMs) : null,
|
|
209
|
+
secCanvas: String(v.secCanvas),
|
|
210
|
+
x37: String(v.x37),
|
|
211
|
+
x38: String(v.x38),
|
|
212
|
+
selectedGlobalNames: [...v.selectedGlobalNames],
|
|
213
|
+
timeOrigin: startedAt + Number(v.timeOriginOffsetMs ?? 0),
|
|
214
|
+
mouse: { ...(v.mouse ?? {}) },
|
|
215
|
+
keyboard: { ...(v.keyboard ?? {}) },
|
|
216
|
+
page: { ...(v.page ?? {}) },
|
|
217
|
+
state: { ...(v.state ?? {}) },
|
|
218
|
+
features: { ...(v.features ?? {}) },
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const atom = (v) => (v == null ? 'null' : v === true ? 'true' : v === false ? 'false' : String(v));
|
|
222
|
+
const mapText = (v) => Object.entries(v).map(([k, x]) => `${k}:${atom(x)}`).join(',');
|
|
223
|
+
function creatorTelemetry(s) {
|
|
224
|
+
const f = { ae: null, ak: null, cdr: null, bf: null, fi: null, ...s.features };
|
|
225
|
+
const bf = f.bf == null ? 'null' : `{ar:${atom(f.bf.ar)},fr:${atom(f.bf.fr)}}`;
|
|
226
|
+
return (`{mt:{to:${num(s.timeOrigin)}},m:{${mapText(s.mouse)}},k:{${mapText(s.keyboard)}},p:{${mapText(s.page)}},st:{${mapText(s.state)}},` +
|
|
227
|
+
`ft:{ae:${atom(f.ae)},ak:${atom(f.ak)},cdr:${atom(f.cdr)},bf:${bf},fi:${atom(f.fi)}}}`);
|
|
228
|
+
}
|
|
229
|
+
function creatorB1Options(s, now) {
|
|
230
|
+
return {
|
|
231
|
+
now,
|
|
232
|
+
x39: s.x39,
|
|
233
|
+
x50: s.x50,
|
|
234
|
+
x51: s.x51,
|
|
235
|
+
secCanvas: s.secCanvas,
|
|
236
|
+
overrides: { x36: String(s.frameCount), x37: s.x37, x38: s.x38, x82: s.selectedGlobalNames.join('|').slice(0, 300), x84: creatorTelemetry(s) },
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const DOCUMENT_COOKIE_ORDER = ['ets', 'a1', 'webId', 'gid', 'abRequestId', 'webBuild', 'xsecappid', 'websectiga', 'sec_poison_id', 'loadts'];
|
|
240
|
+
export class CreatorState {
|
|
241
|
+
cookies;
|
|
242
|
+
loadts;
|
|
243
|
+
dsllt;
|
|
244
|
+
ets;
|
|
245
|
+
seq;
|
|
246
|
+
securityReady;
|
|
247
|
+
p1;
|
|
248
|
+
sc;
|
|
249
|
+
b1b1;
|
|
250
|
+
dsl = '';
|
|
251
|
+
dsProgram = '';
|
|
252
|
+
release;
|
|
253
|
+
/** 构造时的页面加载时刻:默认 b1 采集器的 timeOrigin 以它为基准(上游 b1_state 在构造时创建)。 */
|
|
254
|
+
started;
|
|
255
|
+
named = new Map();
|
|
256
|
+
constructor(cookies, local = {}, dsl = '') {
|
|
257
|
+
this.cookies = { ...cookies };
|
|
258
|
+
const started = Number(cookies.loadts || rand.now());
|
|
259
|
+
this.started = started;
|
|
260
|
+
this.loadts = started;
|
|
261
|
+
this.dsllt = Number(local.dsllt || started);
|
|
262
|
+
this.ets = Number(cookies.ets || started);
|
|
263
|
+
this.seq = Number(local.mns_seq || 0);
|
|
264
|
+
this.dsl = dsl;
|
|
265
|
+
this.securityReady = Boolean(cookies.websectiga || cookies.gid || dsl);
|
|
266
|
+
this.p1 = Number(local.p1 || 0);
|
|
267
|
+
this.sc = Number(local.sc || 0);
|
|
268
|
+
this.b1b1 = local.b1b1 || '1';
|
|
269
|
+
this.release = { ...CREATOR_REFERENCE.release };
|
|
270
|
+
}
|
|
271
|
+
updateCookies(updates) {
|
|
272
|
+
Object.assign(this.cookies, updates);
|
|
273
|
+
if (updates.loadts)
|
|
274
|
+
this.loadts = Number(updates.loadts);
|
|
275
|
+
if (updates.ets)
|
|
276
|
+
this.ets = Number(updates.ets);
|
|
277
|
+
if (updates.websectiga || updates.gid)
|
|
278
|
+
this.securityReady = true;
|
|
279
|
+
}
|
|
280
|
+
get documentCookie() {
|
|
281
|
+
return DOCUMENT_COOKIE_ORDER.filter((k) => k in this.cookies).map((k) => `${k}=${this.cookies[k]}`).join('; ');
|
|
282
|
+
}
|
|
283
|
+
activateSecurity(dsl, program, at = rand.now()) {
|
|
284
|
+
this.dsl = dsl;
|
|
285
|
+
if (program)
|
|
286
|
+
this.dsProgram = program;
|
|
287
|
+
this.dsllt = at;
|
|
288
|
+
this.securityReady = true;
|
|
289
|
+
}
|
|
290
|
+
/** 上游 resolve_mns_material:档位与按路由区分的环境常量,不推进 seq。 */
|
|
291
|
+
resolveMaterial(tier, mnsProfile) {
|
|
292
|
+
const resolved = tier ?? (this.securityReady ? '0101' : '0201');
|
|
293
|
+
const stage = resolved === '0201' ? 'bootstrap' : 'ready';
|
|
294
|
+
let m = material(CREATOR_REFERENCE.mnsStages[stage]);
|
|
295
|
+
if (mnsProfile)
|
|
296
|
+
m = material(CREATOR_REFERENCE.mnsProfiles[mnsProfile]);
|
|
297
|
+
if (resolved === '0101' && !['login_early', 'login_callback'].includes(mnsProfile ?? '')) {
|
|
298
|
+
const key = mnsProfile ?? '';
|
|
299
|
+
let env;
|
|
300
|
+
if (key === 'publish_user_info')
|
|
301
|
+
env = 1337;
|
|
302
|
+
else if (key === 'publish_mountable')
|
|
303
|
+
env = 1341;
|
|
304
|
+
else if (['publish_permit', 'publish_permit_image', 'publish_permit_video'].includes(key))
|
|
305
|
+
env = 1349;
|
|
306
|
+
else if (['note_manager', 'note_manager_steady'].includes(key))
|
|
307
|
+
env = m.envConst;
|
|
308
|
+
else if (key === 'login_ready')
|
|
309
|
+
env = 1350;
|
|
310
|
+
else
|
|
311
|
+
env = 1351;
|
|
312
|
+
m = { ...m, envConst: env };
|
|
313
|
+
}
|
|
314
|
+
return { tier: resolved, material: m };
|
|
315
|
+
}
|
|
316
|
+
nextSignContext(tier, mnsProfile) {
|
|
317
|
+
const r = this.resolveMaterial(tier, mnsProfile);
|
|
318
|
+
return {
|
|
319
|
+
tier: r.tier,
|
|
320
|
+
now: rand.now(),
|
|
321
|
+
version: randbits32(),
|
|
322
|
+
loadts: this.loadts,
|
|
323
|
+
seq: ++this.seq,
|
|
324
|
+
envConst: r.material.envConst,
|
|
325
|
+
envFpTail: r.material.envFpTail,
|
|
326
|
+
deviceTag: r.material.deviceTag,
|
|
327
|
+
b1b1: this.b1b1,
|
|
328
|
+
signCount: this.sc,
|
|
329
|
+
webBuild: this.release.webBuild,
|
|
330
|
+
signVersion: this.release.signVersion,
|
|
331
|
+
appId: this.release.appId,
|
|
332
|
+
platform: this.release.platform,
|
|
333
|
+
userAgent: this.release.userAgent,
|
|
334
|
+
secChUa: this.release.secChUa,
|
|
335
|
+
dsProgram: this.dsProgram,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
currentB1(now, profileName) {
|
|
339
|
+
if (!profileName)
|
|
340
|
+
return generateB1(creatorB1Options(creatorB1State(this.started), now));
|
|
341
|
+
const cached = this.named.get(profileName);
|
|
342
|
+
if (cached)
|
|
343
|
+
return cached;
|
|
344
|
+
const s = creatorB1State(this.loadts, profileName);
|
|
345
|
+
const at = s.generatedAtOffsetMs != null ? this.loadts + s.generatedAtOffsetMs : now;
|
|
346
|
+
const value = generateB1(creatorB1Options(s, at));
|
|
347
|
+
this.named.set(profileName, value);
|
|
348
|
+
return value;
|
|
349
|
+
}
|
|
350
|
+
dslPair(now) {
|
|
351
|
+
if (now - this.dsllt >= DS_REFRESH_MS)
|
|
352
|
+
this.dsllt = now;
|
|
353
|
+
return `${this.dsllt};${this.dsl || 'undefined'}`;
|
|
354
|
+
}
|
|
355
|
+
profileDataOptions(location, referer) {
|
|
356
|
+
return {
|
|
357
|
+
timestampMs: rand.now(),
|
|
358
|
+
timeOrigin: creatorB1State(this.started).timeOrigin,
|
|
359
|
+
documentCookie: this.documentCookie,
|
|
360
|
+
location,
|
|
361
|
+
referer,
|
|
362
|
+
fields: {},
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
storage() {
|
|
366
|
+
return { dsllt: String(this.dsllt), p1: String(this.p1), sc: String(this.sc), b1b1: this.b1b1 };
|
|
367
|
+
}
|
|
368
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { filter, visibility } from '../../core/options.js';
|
|
3
|
+
import { definePlatform, handlers } from '../../core/registry.js';
|
|
4
|
+
/** 懒加载 web 端的 handler:只有执行到这条命令时才加载实现。 */
|
|
5
|
+
const { h, impl } = handlers(() => import('./web/commands.js'));
|
|
6
|
+
export default definePlatform({
|
|
7
|
+
id: 'xianyu',
|
|
8
|
+
name: '闲鱼',
|
|
9
|
+
aliases: ['goofish', 'xy'],
|
|
10
|
+
item: '闲置商品',
|
|
11
|
+
endpoints: {
|
|
12
|
+
web: {
|
|
13
|
+
login: { methods: ['qrcode', 'cookie'], default: 'qrcode' },
|
|
14
|
+
commands: {
|
|
15
|
+
'auth login': impl('full', 'authLogin'),
|
|
16
|
+
'auth status': impl('full', 'authStatus'),
|
|
17
|
+
'user get': impl('partial', 'userGet', { note: '只支持 me;查询他人规划中' }),
|
|
18
|
+
'user items': 'none',
|
|
19
|
+
'user collects': 'none',
|
|
20
|
+
'user follow': 'none',
|
|
21
|
+
'user unfollow': 'none',
|
|
22
|
+
'item get': impl('full', 'itemGet'),
|
|
23
|
+
'item search': 'none',
|
|
24
|
+
'item related': 'none',
|
|
25
|
+
'item list': 'none',
|
|
26
|
+
'item collect': 'none',
|
|
27
|
+
'item uncollect': 'none',
|
|
28
|
+
'item publish': impl('full', 'itemPublish', {
|
|
29
|
+
supports: ['title', 'text', 'image', 'visibility', 'price'],
|
|
30
|
+
options: {
|
|
31
|
+
// 商品发布即上架,没有「仅自己可见」
|
|
32
|
+
visibility: visibility('public'),
|
|
33
|
+
shipping: z.enum(['free', 'distance', 'fixed', 'none']).default('free').describe('运费:free 包邮、distance 按距离计费、fixed 一口价、none 无需邮寄'),
|
|
34
|
+
postage: z.number().nonnegative().optional().describe('一口价运费(元),配合 --shipping fixed'),
|
|
35
|
+
pickup: z.boolean().optional().describe('支持自提'),
|
|
36
|
+
originalPrice: z.number().positive().optional().describe('原价(元),配合 --price'),
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
'item delete': 'none',
|
|
40
|
+
'item categories': 'none',
|
|
41
|
+
'feed list': { upstream: 'none', options: { kind: filter.kind('recommend') } },
|
|
42
|
+
'keyword suggest': 'none',
|
|
43
|
+
'msg list': 'none',
|
|
44
|
+
'msg history': impl('full', 'msgHistory'),
|
|
45
|
+
'msg send': impl('full', 'msgSend', {
|
|
46
|
+
note: '--to 不带 --item 时按上游的默认商品建会话;--to 加 --item 就这件商品联系对方(卖家可以联系买家)',
|
|
47
|
+
}),
|
|
48
|
+
'msg listen': impl('full', 'msgListen'),
|
|
49
|
+
'msg read': 'none',
|
|
50
|
+
'msg revoke': 'none',
|
|
51
|
+
'msg delete': 'none',
|
|
52
|
+
'media upload': impl('full', 'mediaUpload'),
|
|
53
|
+
'history list': 'none',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
app: 'planned',
|
|
57
|
+
pc: 'planned',
|
|
58
|
+
},
|
|
59
|
+
});
|