@meet-im/meet 2.0.6 → 3.0.0-beta.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/dist/account-inspect-api.d.ts +2 -0
- package/dist/account-inspect-api.js +4 -0
- package/dist/channel-plugin-api.d.ts +1 -0
- package/dist/channel-plugin-api.js +3 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +43 -0
- package/dist/monitor-api.d.ts +1 -0
- package/dist/monitor-api.js +1 -0
- package/dist/probe-api.d.ts +1 -0
- package/dist/probe-api.js +1 -0
- package/dist/runtime-setter-api.d.ts +1 -0
- package/dist/runtime-setter-api.js +2 -0
- package/dist/send-api.d.ts +1 -0
- package/dist/send-api.js +1 -0
- package/dist/src/account-inspect.d.ts +5 -0
- package/dist/src/account-inspect.js +9 -0
- package/dist/src/accounts.d.ts +12 -0
- package/dist/src/accounts.js +134 -0
- package/dist/src/bot.d.ts +15 -0
- package/dist/src/bot.js +355 -0
- package/dist/src/channel.d.ts +3 -0
- package/dist/src/channel.js +402 -0
- package/dist/src/client.d.ts +8 -0
- package/dist/src/client.js +49 -0
- package/dist/src/config-schema.d.ts +82 -0
- package/dist/src/config-schema.js +46 -0
- package/dist/src/media.d.ts +57 -0
- package/dist/src/media.js +140 -0
- package/dist/src/monitor.d.ts +9 -0
- package/dist/src/monitor.js +153 -0
- package/dist/src/outbound.d.ts +2 -0
- package/dist/src/outbound.js +34 -0
- package/dist/src/policy.d.ts +30 -0
- package/dist/src/policy.js +78 -0
- package/dist/src/probe.d.ts +10 -0
- package/dist/src/probe.js +56 -0
- package/dist/src/reply-dispatcher.d.ts +29 -0
- package/dist/src/reply-dispatcher.js +173 -0
- package/dist/src/runtime.d.ts +11 -0
- package/dist/src/runtime.js +6 -0
- package/dist/src/sdk-bridge.d.ts +21 -0
- package/dist/src/sdk-bridge.js +214 -0
- package/dist/src/send.d.ts +60 -0
- package/dist/src/send.js +317 -0
- package/dist/src/targets.d.ts +15 -0
- package/dist/src/targets.js +63 -0
- package/dist/src/types.d.ts +76 -0
- package/dist/src/types.js +1 -0
- package/dist/vitest.config.d.ts +8 -0
- package/dist/vitest.config.js +7 -0
- package/openclaw.plugin.json +116 -0
- package/package.json +18 -17
- package/index.ts +0 -26
- package/src/accounts.ts +0 -182
- package/src/bot.ts +0 -418
- package/src/channel.ts +0 -396
- package/src/client.ts +0 -63
- package/src/config-schema.ts +0 -50
- package/src/media.ts +0 -198
- package/src/monitor.ts +0 -195
- package/src/outbound.ts +0 -43
- package/src/policy.ts +0 -131
- package/src/probe.ts +0 -75
- package/src/reply-dispatcher.ts +0 -207
- package/src/runtime.ts +0 -14
- package/src/sdk-bridge.ts +0 -268
- package/src/send.ts +0 -383
- package/src/targets.ts +0 -101
- package/src/types.ts +0 -96
package/src/targets.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
export type MeetTargetKind = "user" | "channel"
|
|
2
|
-
|
|
3
|
-
export type MeetTarget = {
|
|
4
|
-
kind: MeetTargetKind
|
|
5
|
-
id: string
|
|
6
|
-
raw: string
|
|
7
|
-
normalized: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type MeetTargetParseOptions = {
|
|
11
|
-
defaultKind?: MeetTargetKind
|
|
12
|
-
ambiguousMessage?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function buildMessagingTarget(kind: MeetTargetKind, id: string, raw: string): MeetTarget {
|
|
16
|
-
return { kind, id, raw, normalized: `${kind}:${id}` }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function parseMentionPrefixOrAtUserTarget(params: {
|
|
20
|
-
raw: string
|
|
21
|
-
mentionPattern: RegExp
|
|
22
|
-
prefixes: Array<{ prefix: string; kind: MeetTargetKind }>
|
|
23
|
-
atUserPattern: RegExp
|
|
24
|
-
atUserErrorMessage: string
|
|
25
|
-
}): MeetTarget | undefined {
|
|
26
|
-
const { raw, mentionPattern, prefixes, atUserPattern } = params
|
|
27
|
-
|
|
28
|
-
const mentionMatch = raw.match(mentionPattern)
|
|
29
|
-
if (mentionMatch) {
|
|
30
|
-
return buildMessagingTarget("user", mentionMatch[2], raw)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for (const { prefix, kind } of prefixes) {
|
|
34
|
-
if (raw.startsWith(prefix)) {
|
|
35
|
-
const id = raw.slice(prefix.length)
|
|
36
|
-
if (id) {
|
|
37
|
-
return buildMessagingTarget(kind, id, raw)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (atUserPattern.test(raw)) {
|
|
43
|
-
return buildMessagingTarget("user", raw, raw)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return undefined
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function parseMeetTarget(
|
|
50
|
-
raw: string,
|
|
51
|
-
options: MeetTargetParseOptions = {},
|
|
52
|
-
): MeetTarget | undefined {
|
|
53
|
-
const trimmed = raw.trim()
|
|
54
|
-
if (!trimmed) {
|
|
55
|
-
return undefined
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const userTarget = parseMentionPrefixOrAtUserTarget({
|
|
59
|
-
raw: trimmed,
|
|
60
|
-
mentionPattern: /^@\[([^\]]+)\]\((\d+)\)$/,
|
|
61
|
-
prefixes: [
|
|
62
|
-
{ prefix: "user:", kind: "user" },
|
|
63
|
-
{ prefix: "channel:", kind: "channel" },
|
|
64
|
-
{ prefix: "meet:", kind: "user" },
|
|
65
|
-
],
|
|
66
|
-
atUserPattern: /^\d+$/,
|
|
67
|
-
atUserErrorMessage: "Meet DMs require a user id (use user:<id>)",
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
if (userTarget) {
|
|
71
|
-
return userTarget
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (/^\d+$/.test(trimmed)) {
|
|
75
|
-
if (options.defaultKind) {
|
|
76
|
-
return buildMessagingTarget(options.defaultKind, trimmed, trimmed)
|
|
77
|
-
}
|
|
78
|
-
throw new Error(
|
|
79
|
-
options.ambiguousMessage ??
|
|
80
|
-
`Ambiguous Meet recipient "${trimmed}". Use "user:${trimmed}" for DMs or "channel:${trimmed}" for channel messages.`,
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return buildMessagingTarget("channel", trimmed, trimmed)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function resolveMeetChannelId(raw: string): string {
|
|
88
|
-
const target = parseMeetTarget(raw, { defaultKind: "channel" })
|
|
89
|
-
if (!target) {
|
|
90
|
-
throw new Error(`Invalid Meet channel: ${raw}`)
|
|
91
|
-
}
|
|
92
|
-
return target.id
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export function formatMeetTarget(target: MeetTarget): string {
|
|
96
|
-
return `${target.kind}:${target.id}`
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function looksLikeMeetId(input: string): boolean {
|
|
100
|
-
return /^\d+$/.test(input) || /^(user:|channel:|meet:)/.test(input)
|
|
101
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
SessionInfo,
|
|
3
|
-
AttachmentInfo,
|
|
4
|
-
UploadProgress,
|
|
5
|
-
} from "@meet-im/meet-bot-jssdk"
|
|
6
|
-
import type { z } from "zod"
|
|
7
|
-
import {
|
|
8
|
-
MeetConfigSchema,
|
|
9
|
-
MeetAccountConfigSchema,
|
|
10
|
-
MeetChannelConfigSchema,
|
|
11
|
-
MeetGroupConfigSchema,
|
|
12
|
-
} from "./config-schema.js"
|
|
13
|
-
|
|
14
|
-
export type MeetConfig = z.infer<typeof MeetConfigSchema>
|
|
15
|
-
export type MeetAccountConfig = z.infer<typeof MeetAccountConfigSchema>
|
|
16
|
-
export type MeetChannelConfig = z.infer<typeof MeetChannelConfigSchema>
|
|
17
|
-
export type MeetGroupConfig = z.infer<typeof MeetGroupConfigSchema>
|
|
18
|
-
|
|
19
|
-
// 重新导出 SDK 类型
|
|
20
|
-
export type { AttachmentInfo, UploadProgress }
|
|
21
|
-
|
|
22
|
-
export type ResolvedMeetAccount = {
|
|
23
|
-
accountId: string
|
|
24
|
-
enabled: boolean
|
|
25
|
-
configured: boolean
|
|
26
|
-
name?: string
|
|
27
|
-
apiEndpoint?: string
|
|
28
|
-
apiToken?: string
|
|
29
|
-
config: MeetConfig
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export type MeetReplyContext = {
|
|
33
|
-
messageId: string
|
|
34
|
-
senderId?: string
|
|
35
|
-
senderName?: string
|
|
36
|
-
content?: string
|
|
37
|
-
timestamp?: number
|
|
38
|
-
mediaPaths?: string[]
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type MeetMessageContext = {
|
|
42
|
-
chatId: string
|
|
43
|
-
messageId: string
|
|
44
|
-
senderId: string
|
|
45
|
-
senderOpenId: string
|
|
46
|
-
senderName?: string
|
|
47
|
-
chatType: "direct" | "channel"
|
|
48
|
-
mentionedBot: boolean
|
|
49
|
-
hasAnyMention?: boolean
|
|
50
|
-
content: string
|
|
51
|
-
contentType: string
|
|
52
|
-
placeholder?: string
|
|
53
|
-
rawPayload?: string
|
|
54
|
-
sessionInfo: SessionInfo
|
|
55
|
-
timestamp?: number
|
|
56
|
-
atIds?: number[]
|
|
57
|
-
replyContext?: MeetReplyContext
|
|
58
|
-
media?: MeetMediaAttachment[]
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export type MeetSendResult = {
|
|
62
|
-
messageId: string
|
|
63
|
-
chatId: string
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export type MeetProbeResult = {
|
|
67
|
-
ok: boolean
|
|
68
|
-
error?: string
|
|
69
|
-
botId?: string
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export type MeetMediaInfo = {
|
|
73
|
-
path: string
|
|
74
|
-
contentType?: string
|
|
75
|
-
placeholder: string
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* 入站消息中的媒体附件信息
|
|
80
|
-
*/
|
|
81
|
-
export type MeetMediaAttachment = {
|
|
82
|
-
fileId: string | number
|
|
83
|
-
fileName?: string
|
|
84
|
-
fileSize?: number
|
|
85
|
-
mimeType?: string
|
|
86
|
-
fileUrl?: string
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* 文件上传结果
|
|
91
|
-
*/
|
|
92
|
-
export type MeetUploadResult = {
|
|
93
|
-
fileID: number
|
|
94
|
-
path: string
|
|
95
|
-
size: number
|
|
96
|
-
}
|