@meet-im/lxcli 0.1.1 → 0.1.2
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/dist/commands/generate-skills.js +2 -4
- package/dist/commands/index.js +0 -2
- package/dist/commands/services/meet/api.d.ts +2 -13
- package/dist/commands/services/meet/api.js +5 -31
- package/dist/commands/services/meet/config.d.ts +0 -2
- package/dist/commands/services/meet/config.js +24 -11
- package/dist/commands/services/meet/descriptions.d.ts +4 -3
- package/dist/commands/services/meet/descriptions.js +5 -6
- package/dist/commands/services/meet/handler.d.ts +2 -22
- package/dist/commands/services/meet/handler.js +6 -42
- package/dist/commands/services/meet/index.js +6 -25
- package/dist/commands/services/meet/params.d.ts +8 -0
- package/dist/commands/services/meet/params.js +3 -0
- package/dist/commands/services/meet/skill-metadata.d.ts +9 -0
- package/dist/commands/services/meet/skill-metadata.js +2 -0
- package/dist/commands/services/meet/types.d.ts +4 -62
- package/dist/commands/services/meet/types.js +0 -1
- package/dist/commands/services/meet/utils.d.ts +1 -0
- package/dist/commands/services/meet/utils.js +4 -0
- package/package.json +1 -1
|
@@ -13,8 +13,7 @@ const PACKAGE_JSON_PATH = path.resolve('package.json');
|
|
|
13
13
|
const CATEGORY_CONFIG = {
|
|
14
14
|
'lxcli-builtin': { title: 'Builtin', description: 'lxcli 内置命令。' },
|
|
15
15
|
'lxcli-kb-': { title: 'Kb', description: 'Kanboard 服务命令。' },
|
|
16
|
-
'lxcli-meet-': { title: 'Meet', description: '
|
|
17
|
-
'lxcli-meetbot-': { title: 'Meetbot', description: 'MeetBot 服务命令。' },
|
|
16
|
+
'lxcli-meet-': { title: 'Meet', description: 'MeetIM 服务命令。' },
|
|
18
17
|
};
|
|
19
18
|
function getCategory(skillName) {
|
|
20
19
|
// 精确匹配 lxcli-builtin
|
|
@@ -76,7 +75,7 @@ async function scanSkills(skillsDir) {
|
|
|
76
75
|
throw new Error(`Failed to read skills directory: ${skillsDir}`);
|
|
77
76
|
}
|
|
78
77
|
// 按分类排序,同类按名称排序
|
|
79
|
-
const categoryOrder = ['builtin', 'kb', 'meet', '
|
|
78
|
+
const categoryOrder = ['builtin', 'kb', 'meet', 'other'];
|
|
80
79
|
entries.sort((a, b) => {
|
|
81
80
|
const catA = categoryOrder.indexOf(a.category);
|
|
82
81
|
const catB = categoryOrder.indexOf(b.category);
|
|
@@ -106,7 +105,6 @@ function renderIndex(entries) {
|
|
|
106
105
|
builtin: CATEGORY_CONFIG['lxcli-builtin'],
|
|
107
106
|
kb: CATEGORY_CONFIG['lxcli-kb-'],
|
|
108
107
|
meet: CATEGORY_CONFIG['lxcli-meet-'],
|
|
109
|
-
meetbot: CATEGORY_CONFIG['lxcli-meetbot-'],
|
|
110
108
|
other: { title: 'Other', description: '其他命令。' },
|
|
111
109
|
};
|
|
112
110
|
for (const [cat, items] of Object.entries(grouped)) {
|
package/dist/commands/index.js
CHANGED
|
@@ -9,7 +9,6 @@ import { registerUpgradeCommand } from './upgrade.js';
|
|
|
9
9
|
import { registerGenerateSkillsCommand } from './generate-skills.js';
|
|
10
10
|
import { registerSchemaCommand } from './schema.js';
|
|
11
11
|
import kbService from './services/kb/index.js';
|
|
12
|
-
import meetbotService from './services/meetbot/index.js';
|
|
13
12
|
import meetService from './services/meet/index.js';
|
|
14
13
|
export const builtInCommands = [
|
|
15
14
|
{ name: 'auth', register: registerAuthCommand },
|
|
@@ -23,7 +22,6 @@ export const builtInCommands = [
|
|
|
23
22
|
];
|
|
24
23
|
export const externalServices = [
|
|
25
24
|
kbService,
|
|
26
|
-
meetbotService,
|
|
27
25
|
meetService,
|
|
28
26
|
];
|
|
29
27
|
export function registerAllCommands(program) {
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
* 同步消息
|
|
4
|
-
*/
|
|
5
|
-
export declare function syncMsg(gateway: string, params: SyncMsgParams, token: string): Promise<SyncMsgResult>;
|
|
6
|
-
/**
|
|
7
|
-
* 获取会话信息(含成员列表)
|
|
8
|
-
*/
|
|
9
|
-
export declare function getConvInfo2(gateway: string, params: GetConvInfo2Params, token: string): Promise<GetConvInfo2Result>;
|
|
10
|
-
/**
|
|
11
|
-
* 获取当前用户信息
|
|
12
|
-
*/
|
|
13
|
-
export declare function getMyInfo(gateway: string, token: string): Promise<GetMyInfoResult>;
|
|
1
|
+
import type { GetMySimpleInfoResult } from './types.js';
|
|
2
|
+
export declare function getMySimpleInfo(gateway: string, pat: string): Promise<GetMySimpleInfoResult>;
|
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
// src/commands/services/meet/api.ts
|
|
2
1
|
import { request } from '../../../core/http.js';
|
|
3
|
-
|
|
4
|
-
* 同步消息
|
|
5
|
-
*/
|
|
6
|
-
export async function syncMsg(gateway, params, token) {
|
|
2
|
+
export async function getMySimpleInfo(gateway, pat) {
|
|
7
3
|
return request({
|
|
8
4
|
gateway,
|
|
9
|
-
path: '/
|
|
10
|
-
method: 'POST',
|
|
11
|
-
body: params,
|
|
12
|
-
headers: { Token: token },
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* 获取会话信息(含成员列表)
|
|
17
|
-
*/
|
|
18
|
-
export async function getConvInfo2(gateway, params, token) {
|
|
19
|
-
return request({
|
|
20
|
-
gateway,
|
|
21
|
-
path: '/general/GetConvInfo2',
|
|
22
|
-
method: 'POST',
|
|
23
|
-
body: params,
|
|
24
|
-
headers: { Token: token },
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* 获取当前用户信息
|
|
29
|
-
*/
|
|
30
|
-
export async function getMyInfo(gateway, token) {
|
|
31
|
-
return request({
|
|
32
|
-
gateway,
|
|
33
|
-
path: '/general/GetMyInfo',
|
|
5
|
+
path: '/general/GetMySimpleInfo',
|
|
34
6
|
method: 'POST',
|
|
35
7
|
body: {},
|
|
36
|
-
headers: {
|
|
8
|
+
headers: {
|
|
9
|
+
Authorization: `meet ${pat}`,
|
|
10
|
+
},
|
|
37
11
|
});
|
|
38
12
|
}
|
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
const meetGateways = {
|
|
2
|
+
test: 'https://staging-meet-api.miyachat.com',
|
|
3
|
+
pre: 'https://pre-meet-api.miyachat.com',
|
|
4
|
+
staging: 'https://staging-meet-api.miyachat.com',
|
|
5
|
+
beta: 'https://staging-meet-api.miyachat.com',
|
|
6
|
+
prod: 'https://meet-api.miyachat.com',
|
|
7
|
+
};
|
|
8
|
+
const coGateways = {
|
|
9
|
+
test: 'https://ng.meet-api.mecord668.com',
|
|
10
|
+
pre: 'https://ng.meet-api.mecord668.com',
|
|
11
|
+
staging: 'https://ng.meet-api.mecord668.com',
|
|
12
|
+
beta: 'https://ng.meet-api.mecord668.com',
|
|
13
|
+
prod: 'https://ng.meet-api.mecord668.com',
|
|
14
|
+
};
|
|
15
|
+
const skyGateways = {
|
|
16
|
+
test: 'https://meet-api.yuanqiyun668.com',
|
|
17
|
+
pre: 'https://meet-api.yuanqiyun668.com',
|
|
18
|
+
staging: 'https://meet-api.yuanqiyun668.com',
|
|
19
|
+
beta: 'https://meet-api.yuanqiyun668.com',
|
|
20
|
+
prod: 'https://meet-api.yuanqiyun668.com',
|
|
21
|
+
};
|
|
2
22
|
export const meetConfig = {
|
|
3
23
|
name: 'meet',
|
|
4
24
|
gateways: {
|
|
5
|
-
meet:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
staging: 'https://staging-meet-api.miyachat.com',
|
|
9
|
-
beta: 'https://staging-meet-api.miyachat.com',
|
|
10
|
-
prod: 'https://meet-api.miyachat.com',
|
|
11
|
-
},
|
|
25
|
+
meet: meetGateways,
|
|
26
|
+
co: coGateways,
|
|
27
|
+
sky: skyGateways,
|
|
12
28
|
},
|
|
13
29
|
};
|
|
14
|
-
export function getMeetGateway(tenant, env) {
|
|
15
|
-
return meetConfig.gateways[tenant]?.[env];
|
|
16
|
-
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export type
|
|
3
|
-
export declare const
|
|
1
|
+
export declare const METHODS: readonly string[];
|
|
2
|
+
export type Method = typeof METHODS[number];
|
|
3
|
+
export declare const METHOD_DESCRIPTIONS: Record<Method, string>;
|
|
4
|
+
export { PARAM_DEFS, type ParamDef, type ParamType } from './params.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export const
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
getConvInfo2: 'Get conversation info with members',
|
|
6
|
-
getMyInfo: 'Get current user info',
|
|
1
|
+
import { PARAM_DEFS } from './params.js';
|
|
2
|
+
export const METHODS = Object.keys(PARAM_DEFS);
|
|
3
|
+
export const METHOD_DESCRIPTIONS = {
|
|
4
|
+
getMe: '获取当前开发者基础信息',
|
|
7
5
|
};
|
|
6
|
+
export { PARAM_DEFS } from './params.js';
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* 获取 meet 认证信息
|
|
4
|
-
*/
|
|
5
|
-
export declare function getMeetAuth(userName?: string): {
|
|
6
|
-
user: NonNullable<ReturnType<typeof getCurrentUser>>;
|
|
7
|
-
token: string;
|
|
8
|
-
};
|
|
9
|
-
export interface SyncMsgOptions {
|
|
1
|
+
export interface GetMeOptions {
|
|
10
2
|
user?: string;
|
|
11
3
|
gateway?: string;
|
|
12
|
-
params?: string;
|
|
13
4
|
}
|
|
14
|
-
export declare function
|
|
15
|
-
export interface GetConvInfo2Options {
|
|
16
|
-
user?: string;
|
|
17
|
-
gateway?: string;
|
|
18
|
-
params?: string;
|
|
19
|
-
}
|
|
20
|
-
export declare function handleGetConvInfo2(options: GetConvInfo2Options): Promise<void>;
|
|
21
|
-
export interface GetMyInfoOptions {
|
|
22
|
-
user?: string;
|
|
23
|
-
gateway?: string;
|
|
24
|
-
}
|
|
25
|
-
export declare function handleGetMyInfo(options: GetMyInfoOptions): Promise<void>;
|
|
5
|
+
export declare function handleGetMe(options: GetMeOptions): Promise<void>;
|
|
@@ -1,50 +1,14 @@
|
|
|
1
|
-
// src/commands/services/meet/handler.ts
|
|
2
1
|
import { getCurrentUser, getGatewayForUser } from '../../../core/auth.js';
|
|
3
2
|
import { outputCliError } from '../../../core/error.js';
|
|
4
|
-
import { outputJson
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export function getMeetAuth(userName) {
|
|
10
|
-
const user = getCurrentUser(userName);
|
|
3
|
+
import { outputJson } from '../../../utils/index.js';
|
|
4
|
+
import { getMySimpleInfo } from './api.js';
|
|
5
|
+
export async function handleGetMe(options) {
|
|
6
|
+
const user = getCurrentUser(options.user);
|
|
11
7
|
if (!user) {
|
|
12
8
|
outputCliError('USER_NOT_FOUND', 'No user configured. Run "lxcli auth" first.');
|
|
9
|
+
return;
|
|
13
10
|
}
|
|
14
|
-
return {
|
|
15
|
-
user: user,
|
|
16
|
-
token: user.token,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export async function handleSyncMsg(options) {
|
|
20
|
-
if (!options.params) {
|
|
21
|
-
outputCliError('PARAM_INVALID', 'Missing required option: --params.');
|
|
22
|
-
}
|
|
23
|
-
const { user, token } = getMeetAuth(options.user);
|
|
24
|
-
const gateway = options.gateway || getGatewayForUser(user, 'meet');
|
|
25
|
-
const params = parseCliParams(options.params);
|
|
26
|
-
if (!params.sessionInfo) {
|
|
27
|
-
outputCliError('PARAM_INVALID', 'Missing required field: sessionInfo.');
|
|
28
|
-
}
|
|
29
|
-
const result = await syncMsg(gateway, params, token);
|
|
30
|
-
outputJson(result);
|
|
31
|
-
}
|
|
32
|
-
export async function handleGetConvInfo2(options) {
|
|
33
|
-
if (!options.params) {
|
|
34
|
-
outputCliError('PARAM_INVALID', 'Missing required option: --params.');
|
|
35
|
-
}
|
|
36
|
-
const { user, token } = getMeetAuth(options.user);
|
|
37
|
-
const gateway = options.gateway || getGatewayForUser(user, 'meet');
|
|
38
|
-
const params = parseCliParams(options.params);
|
|
39
|
-
if (!params.sessionInfo) {
|
|
40
|
-
outputCliError('PARAM_INVALID', 'Missing required field: sessionInfo.');
|
|
41
|
-
}
|
|
42
|
-
const result = await getConvInfo2(gateway, params, token);
|
|
43
|
-
outputJson(result);
|
|
44
|
-
}
|
|
45
|
-
export async function handleGetMyInfo(options) {
|
|
46
|
-
const { user, token } = getMeetAuth(options.user);
|
|
47
11
|
const gateway = options.gateway || getGatewayForUser(user, 'meet');
|
|
48
|
-
const result = await
|
|
12
|
+
const result = await getMySimpleInfo(gateway, user.token);
|
|
49
13
|
outputJson(result);
|
|
50
14
|
}
|
|
@@ -1,43 +1,24 @@
|
|
|
1
|
-
// src/commands/services/meet/index.ts
|
|
2
1
|
import { registerService } from '../../../core/tenants.js';
|
|
3
2
|
import { meetConfig } from './config.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { METHOD_DESCRIPTIONS } from './descriptions.js';
|
|
4
|
+
import { handleGetMe } from './handler.js';
|
|
6
5
|
const meetService = {
|
|
7
6
|
name: 'meet',
|
|
8
7
|
description: 'MeetIM Core API',
|
|
9
|
-
enabled:
|
|
8
|
+
enabled: true,
|
|
10
9
|
register(cmd) {
|
|
11
10
|
registerService(meetConfig);
|
|
12
11
|
cmd.description(this.description).allowUnknownOption(false);
|
|
13
|
-
// 无子命令时显示帮助
|
|
14
12
|
cmd.action(() => {
|
|
15
13
|
console.log(cmd.helpInformation());
|
|
16
14
|
process.exitCode = 0;
|
|
17
15
|
});
|
|
18
|
-
// syncMsg
|
|
19
16
|
cmd
|
|
20
|
-
.command('
|
|
21
|
-
.description(
|
|
22
|
-
.requiredOption('--params <json>', 'JSON params: {sessionInfo, beginSeqId?, endSeqId?, limit?}')
|
|
17
|
+
.command('getMe')
|
|
18
|
+
.description(METHOD_DESCRIPTIONS.getMe)
|
|
23
19
|
.option('--user <user>', 'Specify user')
|
|
24
20
|
.option('--gateway <url>', 'Override meet gateway')
|
|
25
|
-
.action(
|
|
26
|
-
// getConvInfo2
|
|
27
|
-
cmd
|
|
28
|
-
.command('getConvInfo2')
|
|
29
|
-
.description(COMMAND_DESCRIPTIONS.getConvInfo2)
|
|
30
|
-
.requiredOption('--params <json>', 'JSON params: {sessionInfo}')
|
|
31
|
-
.option('--user <user>', 'Specify user')
|
|
32
|
-
.option('--gateway <url>', 'Override meet gateway')
|
|
33
|
-
.action(handleGetConvInfo2);
|
|
34
|
-
// getMyInfo
|
|
35
|
-
cmd
|
|
36
|
-
.command('getMyInfo')
|
|
37
|
-
.description(COMMAND_DESCRIPTIONS.getMyInfo)
|
|
38
|
-
.option('--user <user>', 'Specify user')
|
|
39
|
-
.option('--gateway <url>', 'Override meet gateway')
|
|
40
|
-
.action(handleGetMyInfo);
|
|
21
|
+
.action(handleGetMe);
|
|
41
22
|
},
|
|
42
23
|
};
|
|
43
24
|
export default meetService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ParamType = 'integer' | 'number' | 'string' | 'array<integer>' | 'array<string>' | 'object' | 'file';
|
|
2
|
+
export interface ParamDef {
|
|
3
|
+
name: string;
|
|
4
|
+
type: ParamType;
|
|
5
|
+
required: boolean;
|
|
6
|
+
description: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const PARAM_DEFS: Record<string, ParamDef[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Method } from './descriptions.js';
|
|
2
|
+
import type { ParamDef } from './params.js';
|
|
3
|
+
export interface MethodSkillMetadata {
|
|
4
|
+
notes?: string[];
|
|
5
|
+
skillParams?: ParamDef[];
|
|
6
|
+
paramsExample?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export declare const METHOD_SHORTCUT_PARAMS: Partial<Record<Method, string[]>>;
|
|
9
|
+
export declare const METHOD_SKILL_METADATA: Partial<Record<Method, MethodSkillMetadata>>;
|
|
@@ -1,65 +1,7 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
firstID: number;
|
|
3
|
-
secondID: number;
|
|
4
|
-
/** 1=私聊, 3=群聊 */
|
|
5
|
-
sessionType: 1 | 3;
|
|
6
|
-
companyID?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface SyncMsgParams {
|
|
9
|
-
sessionInfo: SessionInfo;
|
|
10
|
-
beginSeqId?: number;
|
|
11
|
-
endSeqId?: number;
|
|
12
|
-
limit?: number;
|
|
13
|
-
isForward?: boolean;
|
|
14
|
-
notReaded?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface MsgContent {
|
|
17
|
-
seqID: number;
|
|
18
|
-
content: string;
|
|
19
|
-
fromUID: number;
|
|
20
|
-
timestamp: number;
|
|
21
|
-
[key: string]: unknown;
|
|
22
|
-
}
|
|
23
|
-
export interface SyncMsgResult {
|
|
24
|
-
msgs: MsgContent[];
|
|
25
|
-
lastSeqId: number;
|
|
26
|
-
isMin: boolean;
|
|
27
|
-
[key: string]: unknown;
|
|
28
|
-
}
|
|
29
|
-
export interface GetConvInfo2Params {
|
|
30
|
-
sessionInfo: SessionInfo;
|
|
31
|
-
}
|
|
32
|
-
export interface ConvInfo {
|
|
33
|
-
groupID: number;
|
|
34
|
-
name: string;
|
|
35
|
-
avatar: string;
|
|
36
|
-
memberCount: number;
|
|
37
|
-
[key: string]: unknown;
|
|
38
|
-
}
|
|
39
|
-
export interface ConvMember {
|
|
1
|
+
export interface GetMySimpleInfoResult {
|
|
40
2
|
userID: number;
|
|
41
3
|
nickName: string;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export interface GetConvInfo2Result {
|
|
46
|
-
convInfo: ConvInfo;
|
|
47
|
-
isInGroup: boolean;
|
|
48
|
-
isDiscarded: boolean;
|
|
49
|
-
members?: ConvMember[];
|
|
50
|
-
total?: number;
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
}
|
|
53
|
-
export interface UserInfo {
|
|
54
|
-
userID: number;
|
|
55
|
-
nickName: string;
|
|
56
|
-
avatar: string;
|
|
57
|
-
mobile?: string;
|
|
58
|
-
email?: string;
|
|
59
|
-
[key: string]: unknown;
|
|
60
|
-
}
|
|
61
|
-
export interface GetMyInfoResult {
|
|
62
|
-
uInfo: UserInfo;
|
|
63
|
-
currentCompanyID: number;
|
|
64
|
-
[key: string]: unknown;
|
|
4
|
+
mobileStr: string;
|
|
5
|
+
jobNumber: string;
|
|
6
|
+
email: string;
|
|
65
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getNextRequestId(): string;
|