@zhin.js/plugin-music 7.0.8 → 7.0.10
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/commands/cookie/delete/[source].js +23 -0
- package/commands/cookie/delete/[source].ts +27 -0
- package/commands/cookie/get/[source].js +29 -0
- package/commands/cookie/get/[source].ts +33 -0
- package/commands/cookie/set/[source].js +23 -0
- package/commands/cookie/set/[source].ts +27 -0
- package/commands/cookie/status.js +25 -0
- package/commands/cookie/status.ts +25 -0
- package/commands/login/[platform].js +64 -0
- package/commands/login/[platform].ts +76 -0
- package/commands//347/202/271/346/255/214/[keyword].js +62 -0
- package/commands//347/202/271/346/255/214/[keyword].ts +74 -0
- package/components/share-music.js +6 -6
- package/components/share-music.ts +6 -6
- package/lib/config.d.ts +3 -3
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +36 -7
- package/lib/config.js.map +1 -1
- package/lib/credential-store.d.ts +34 -0
- package/lib/credential-store.d.ts.map +1 -0
- package/lib/credential-store.js +111 -0
- package/lib/credential-store.js.map +1 -0
- package/lib/index.d.ts +5 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/login/index.d.ts +20 -0
- package/lib/login/index.d.ts.map +1 -0
- package/lib/login/index.js +100 -0
- package/lib/login/index.js.map +1 -0
- package/lib/login/netease.d.ts +6 -0
- package/lib/login/netease.d.ts.map +1 -0
- package/lib/login/netease.js +58 -0
- package/lib/login/netease.js.map +1 -0
- package/lib/login/qq.d.ts +7 -0
- package/lib/login/qq.d.ts.map +1 -0
- package/lib/login/qq.js +139 -0
- package/lib/login/qq.js.map +1 -0
- package/lib/login/types.d.ts +19 -0
- package/lib/login/types.d.ts.map +1 -0
- package/lib/login/types.js +11 -0
- package/lib/login/types.js.map +1 -0
- package/lib/music-lib.d.ts +13 -12
- package/lib/music-lib.d.ts.map +1 -1
- package/lib/music-lib.js +36 -22
- package/lib/music-lib.js.map +1 -1
- package/lib/session.d.ts +29 -0
- package/lib/session.d.ts.map +1 -0
- package/lib/session.js +39 -0
- package/lib/session.js.map +1 -0
- package/lib/sources/index.d.ts +2 -1
- package/lib/sources/index.d.ts.map +1 -1
- package/lib/sources/index.js +6 -2
- package/lib/sources/index.js.map +1 -1
- package/lib/sources/kugou.d.ts +6 -0
- package/lib/sources/kugou.d.ts.map +1 -0
- package/lib/sources/kugou.js +54 -0
- package/lib/sources/kugou.js.map +1 -0
- package/lib/sources/kuwo.d.ts +7 -0
- package/lib/sources/kuwo.d.ts.map +1 -0
- package/lib/sources/kuwo.js +69 -0
- package/lib/sources/kuwo.js.map +1 -0
- package/lib/sources/netease.d.ts +1 -1
- package/lib/sources/netease.d.ts.map +1 -1
- package/lib/sources/netease.js +19 -5
- package/lib/sources/netease.js.map +1 -1
- package/lib/sources/qq.d.ts +1 -14
- package/lib/sources/qq.d.ts.map +1 -1
- package/lib/sources/qq.js +114 -81
- package/lib/sources/qq.js.map +1 -1
- package/lib/types.d.ts +4 -24
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +0 -1
- package/lib/types.js.map +1 -1
- package/middlewares/music-selection.js +46 -0
- package/middlewares/music-selection.ts +56 -0
- package/package.json +10 -5
- package/plugin.js +24 -1
- package/src/config.ts +54 -30
- package/src/credential-store.ts +169 -0
- package/src/index.ts +43 -2
- package/src/login/index.ts +135 -0
- package/src/login/netease.ts +69 -0
- package/src/login/qq.ts +154 -0
- package/src/login/types.ts +27 -0
- package/src/music-lib.ts +39 -26
- package/src/session.ts +60 -0
- package/src/sources/index.ts +12 -8
- package/src/sources/kugou.ts +78 -0
- package/src/sources/kuwo.ts +94 -0
- package/src/sources/netease.ts +29 -12
- package/src/sources/qq.ts +158 -125
- package/src/types.ts +6 -28
- package/tools/music-search.js +6 -2
- package/tools/music-search.ts +6 -2
- package/tools/music-share.js +6 -2
- package/tools/music-share.ts +6 -2
package/src/types.ts
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
export type MusicSource = 'qq' | 'netease' | 'kuwo' | 'kugou';
|
|
2
2
|
|
|
3
|
-
/** 音乐源类型 */
|
|
4
|
-
export type MusicSource = "qq" | "netease";
|
|
5
|
-
|
|
6
|
-
/** 音乐分享内容 */
|
|
7
3
|
export interface MusicInfo {
|
|
8
4
|
id: string;
|
|
9
5
|
source: MusicSource;
|
|
10
|
-
/** 跳转链接 */
|
|
11
6
|
url: string;
|
|
12
|
-
/** 音乐标题 */
|
|
13
7
|
title: string;
|
|
8
|
+
artist?: string;
|
|
9
|
+
album?: string;
|
|
10
|
+
duration?: number;
|
|
14
11
|
}
|
|
12
|
+
|
|
15
13
|
export interface MusicDetail extends MusicInfo {
|
|
16
14
|
image: string;
|
|
17
|
-
audio:string;
|
|
18
|
-
duration?: number;
|
|
15
|
+
audio: string;
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
/** 音乐源配置 */
|
|
22
18
|
export interface MusicSourceConfig {
|
|
23
19
|
appid: number;
|
|
24
20
|
package: string;
|
|
@@ -27,21 +23,6 @@ export interface MusicSourceConfig {
|
|
|
27
23
|
version: string;
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
/** QQ 音乐 API 响应 */
|
|
31
|
-
export interface MusicQQ {
|
|
32
|
-
id: string;
|
|
33
|
-
mid: string;
|
|
34
|
-
name: string;
|
|
35
|
-
docid: string;
|
|
36
|
-
singer: string;
|
|
37
|
-
album?: {
|
|
38
|
-
mid: string;
|
|
39
|
-
name: string;
|
|
40
|
-
};
|
|
41
|
-
interval?: number;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** 网易云音乐 API 响应 */
|
|
45
26
|
export interface Music163 {
|
|
46
27
|
id: string;
|
|
47
28
|
name: string;
|
|
@@ -58,10 +39,7 @@ export interface Music163 {
|
|
|
58
39
|
};
|
|
59
40
|
}
|
|
60
41
|
|
|
61
|
-
/** 音乐搜索服务接口 */
|
|
62
42
|
export interface MusicSearchService {
|
|
63
|
-
/** 搜索音乐 */
|
|
64
43
|
search(keyword: string, limit?: number): Promise<MusicInfo[]>;
|
|
65
|
-
/** 获取音乐详情 */
|
|
66
44
|
getDetail(id: string): Promise<MusicDetail>;
|
|
67
45
|
}
|
package/tools/music-search.js
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
3
|
import { searchMusic } from "../lib/music-lib.js";
|
|
4
4
|
export default defineAgentTool({
|
|
5
|
-
description: '
|
|
5
|
+
description: '搜索音乐并返回结果列表(支持QQ/网易云/酷我/酷狗)',
|
|
6
6
|
inputSchema: {
|
|
7
7
|
type: 'object',
|
|
8
8
|
properties: {
|
|
9
9
|
keyword: { type: 'string', description: '搜索关键词' },
|
|
10
|
-
source: {
|
|
10
|
+
source: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
enum: ['qq', 'netease', 'kuwo', 'kugou'],
|
|
13
|
+
description: '音乐源(默认 qq)',
|
|
14
|
+
},
|
|
11
15
|
limit: { type: 'number', description: '返回结果数量(默认 5)' },
|
|
12
16
|
},
|
|
13
17
|
required: ['keyword'],
|
package/tools/music-search.ts
CHANGED
|
@@ -7,12 +7,16 @@ export default defineAgentTool<{
|
|
|
7
7
|
source?: MusicSource;
|
|
8
8
|
limit?: number;
|
|
9
9
|
}>({
|
|
10
|
-
description: '
|
|
10
|
+
description: '搜索音乐并返回结果列表(支持QQ/网易云/酷我/酷狗)',
|
|
11
11
|
inputSchema: {
|
|
12
12
|
type: 'object',
|
|
13
13
|
properties: {
|
|
14
14
|
keyword: { type: 'string', description: '搜索关键词' },
|
|
15
|
-
source: {
|
|
15
|
+
source: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
enum: ['qq', 'netease', 'kuwo', 'kugou'],
|
|
18
|
+
description: '音乐源(默认 qq)',
|
|
19
|
+
},
|
|
16
20
|
limit: { type: 'number', description: '返回结果数量(默认 5)' },
|
|
17
21
|
},
|
|
18
22
|
required: ['keyword'],
|
package/tools/music-share.js
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
3
|
import { shareMusicDetail } from "../lib/music-lib.js";
|
|
4
4
|
export default defineAgentTool({
|
|
5
|
-
description: '
|
|
5
|
+
description: '分享指定的音乐(支持QQ/网易云/酷我/酷狗)',
|
|
6
6
|
inputSchema: {
|
|
7
7
|
type: 'object',
|
|
8
8
|
properties: {
|
|
9
9
|
id: { type: 'string', description: '音乐 ID' },
|
|
10
|
-
source: {
|
|
10
|
+
source: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
enum: ['qq', 'netease', 'kuwo', 'kugou'],
|
|
13
|
+
description: '音乐源',
|
|
14
|
+
},
|
|
11
15
|
},
|
|
12
16
|
required: ['id', 'source'],
|
|
13
17
|
},
|
package/tools/music-share.ts
CHANGED
|
@@ -6,12 +6,16 @@ export default defineAgentTool<{
|
|
|
6
6
|
id: string;
|
|
7
7
|
source: MusicSource;
|
|
8
8
|
}>({
|
|
9
|
-
description: '
|
|
9
|
+
description: '分享指定的音乐(支持QQ/网易云/酷我/酷狗)',
|
|
10
10
|
inputSchema: {
|
|
11
11
|
type: 'object',
|
|
12
12
|
properties: {
|
|
13
13
|
id: { type: 'string', description: '音乐 ID' },
|
|
14
|
-
source: {
|
|
14
|
+
source: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
enum: ['qq', 'netease', 'kuwo', 'kugou'],
|
|
17
|
+
description: '音乐源',
|
|
18
|
+
},
|
|
15
19
|
},
|
|
16
20
|
required: ['id', 'source'],
|
|
17
21
|
},
|