@lingjingai/lj-awb-cli-pre 0.4.6 → 0.4.7
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 +1 -1
- package/packages/awb-cli/package.json +2 -2
- package/packages/awb-core/package.json +1 -1
- package/packages/awb-core/src/api.js +4 -3
- package/packages/awb-core/src/services.js +35 -3
- package/skills/lj-awb/SKILL.md +2 -2
- package/skills/lj-awb/VERSION +1 -1
- package/skills/lj-awb/compat.json +3 -3
- package/skills/lj-awb/modules/account.md +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingjingai/lj-awb-cli-pre",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Lingjing AWB CLI monorepo with shared core, standalone CLI, and agent skills (pre-release build pointing to https://animeworkbench-pre.lingjingai.cn)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingjingai/awb-cli-bin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Standalone CLI for Lingjing AWB",
|
|
5
5
|
"private": true,
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@lingjingai/awb-core": "0.4.
|
|
16
|
+
"@lingjingai/awb-core": "0.4.7"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -148,9 +148,10 @@ export async function selectProjectGroup(projectGroupNo) {
|
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export async function
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
export async function fetchGroupAccessKey({ userId, groupId }) {
|
|
152
|
+
// 切换团队:用当前用户的 userId + 目标 groupId 换取该团队的 accessKey,再刷新本地认证文件。
|
|
153
|
+
return await apiFetch('/api/anime/user/account/groupAccessKey', {
|
|
154
|
+
body: { userId, groupId },
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
|
|
@@ -704,9 +704,41 @@ export async function selectTeam(kwargs = {}) {
|
|
|
704
704
|
action: 'account switch-team',
|
|
705
705
|
groupId,
|
|
706
706
|
});
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
707
|
+
// userId 取当前登录用户(与 account info 同源:fetchUserInfo)
|
|
708
|
+
const userId = normalizeUserInfo(await awbApi.fetchUserInfo()).userId;
|
|
709
|
+
if (!userId) {
|
|
710
|
+
throw new LingjingAwbCliError('无法获取当前用户 userId,切换团队失败', {
|
|
711
|
+
type: 'api_error',
|
|
712
|
+
exitCode: 1,
|
|
713
|
+
hint: '请先确认已登录(lj-awb auth status),再重试。',
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
// 用 userId + 目标 groupId 换取该团队的 accessKey
|
|
717
|
+
const accessKey = trimSecret(await awbApi.fetchGroupAccessKey({ userId, groupId }));
|
|
718
|
+
if (!accessKey) {
|
|
719
|
+
throw new LingjingAwbCliError('切换团队失败:未返回该团队的 accessKey', {
|
|
720
|
+
type: 'api_error',
|
|
721
|
+
exitCode: 1,
|
|
722
|
+
hint: '请确认该 groupId 属于当前用户可访问的团队;若持续失败请联系平台。',
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
// 刷新本地认证文件(等同登录写入),并用新 key 校验,拿到切换后的用户 / 团队上下文
|
|
726
|
+
const saved = await saveVerifiedAccessKey(accessKey, { loginMethod: 'switch-team' });
|
|
727
|
+
const switchedGroupId = saved.user?.groupId ?? groupId;
|
|
728
|
+
await saveState({
|
|
729
|
+
currentGroupId: switchedGroupId,
|
|
730
|
+
currentGroupName: saved.user?.groupName ?? null,
|
|
731
|
+
currentUserId: saved.user?.userId ?? userId,
|
|
732
|
+
}).catch(() => {});
|
|
733
|
+
return {
|
|
734
|
+
selected: true,
|
|
735
|
+
action: 'account switch-team',
|
|
736
|
+
groupId: switchedGroupId,
|
|
737
|
+
groupName: saved.user?.groupName ?? null,
|
|
738
|
+
userId: saved.user?.userId ?? userId,
|
|
739
|
+
userName: saved.user?.userName ?? null,
|
|
740
|
+
accessKey: saved.accessKey,
|
|
741
|
+
};
|
|
710
742
|
}
|
|
711
743
|
|
|
712
744
|
export async function selectProjectGroupCommand(kwargs = {}) {
|
package/skills/lj-awb/SKILL.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lj-awb
|
|
3
|
-
version: 0.4.
|
|
3
|
+
version: 0.4.7
|
|
4
4
|
description: "灵境 AWB CLI skill。使用 `lj-awb` 命令调用动漫平台 / AWB 云端能力,覆盖认证、项目组、积分(含充值购买与兑换码兑换)、模型发现、上传、统一 create 创建域、任务查询、视频超分、最终产物 artifact CRUD 与本地 JSON 导入。用户说生图、生视频、视频超分、主体、音色、素材加白、去字幕、充值、购买积分、兑换码、artifact 写入或查询时使用。正式生成、切换项目组、清空认证、兑换码、artifact 写入等写入或扣费动作前必须确认。"
|
|
5
5
|
metadata:
|
|
6
6
|
bootstrap:
|
|
7
7
|
package: "@lingjingai/lj-awb-cli"
|
|
8
|
-
version: "0.4.
|
|
8
|
+
version: "0.4.7"
|
|
9
9
|
bin: "lj-awb"
|
|
10
10
|
cliHelp: "lj-awb --help"
|
|
11
11
|
---
|
package/skills/lj-awb/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.7
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
| `lj-awb account info` | 当前用户、团队、项目组、积分摘要(启动后第一条信息) |
|
|
10
10
|
| `lj-awb account teams` | 列出当前账号可访问的团队 |
|
|
11
11
|
| `lj-awb account switch-team --group-id <id> --dry-run` | 预览切换团队 |
|
|
12
|
-
| `lj-awb account switch-team --group-id <id> --yes` |
|
|
12
|
+
| `lj-awb account switch-team --group-id <id> --yes` | 切换团队(换取该团队 accessKey 并刷新本地登录态) |
|
|
13
13
|
|
|
14
14
|
## 什么时候切团队
|
|
15
15
|
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
## 规则
|
|
26
26
|
|
|
27
27
|
- `account switch-team` 改变团队上下文,**必须确认**后追加 `--yes`。
|
|
28
|
+
- 切换原理:用当前用户 `userId` + 目标 `groupId` 调 `groupAccessKey` 换到该团队的 accessKey,再**写回本地认证文件**(等同重新登录到该团队)。
|
|
29
|
+
- 若用户是通过 `LINGJING_AWB_ACCESS_KEY` 环境变量登录的,写回文件**不生效**(env key 优先级高于文件);这种情况下要么 `unset LINGJING_AWB_ACCESS_KEY` 后再切,要么直接换该团队的 access key。
|
|
28
30
|
- 切换团队会**重置项目组上下文**:之后跑 `project current` 必然为空,需要让用户重新 `project use --project-group-no <no>` 选一个。
|
|
29
31
|
- 不要把 `account info.groupName`(团队名)当作项目组名报告给用户。
|
|
30
32
|
- 输出字段速查见 [`../references/output-fields.md`](../references/output-fields.md) 的"账号与项目组"小节。
|