@randev404/baileys 1.0.2 → 1.0.4
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/NOTICE-elaina.md +11 -0
- package/README.md +6 -0
- package/lib/MessageBuilder/bot-signature.d.ts +22 -0
- package/lib/MessageBuilder/bot-signature.js +123 -0
- package/lib/MessageBuilder/extras.d.ts +449 -0
- package/lib/MessageBuilder/extras.js +1357 -0
- package/lib/MessageBuilder/index.d.ts +210 -0
- package/lib/MessageBuilder/index.js +3594 -0
- package/lib/MessageBuilder/metaai.d.ts +438 -0
- package/lib/MessageBuilder/metaai.js +891 -0
- package/lib/Utils/html-app.d.ts +19 -0
- package/lib/Utils/html-app.js +97 -0
- package/lib/Utils/optional-media.d.ts +3 -0
- package/lib/Utils/optional-media.js +46 -0
- package/lib/custom.d.ts.map +1 -1
- package/lib/custom.js +26 -27
- package/lib/custom.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/package.json +3 -2
package/NOTICE-elaina.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Elaina Baileys Notices
|
|
2
|
+
|
|
3
|
+
Elaina Baileys is an independently maintained fork/distribution in the Baileys ecosystem.
|
|
4
|
+
|
|
5
|
+
The upstream copyright and permission notice are preserved in `LICENSE`. Portions of the codebase derive from or were influenced by upstream Baileys work and subsequent forks, including the ItsLia lineage used as a development base.
|
|
6
|
+
|
|
7
|
+
The integrated MessageBuilder retains its original author/watermark notice in `lib/MessageBuilder/index.js`.
|
|
8
|
+
|
|
9
|
+
The VoIP calling stack in `lib/Voip/` derives from work by ShellTear, whose `baileys-caller` project first showed the WhatsApp Web VoIP WASM engine could be driven from Node. It has been ported to ESM, reworked to run on the caller's existing socket, and maintained here since. The WhatsApp Web resources it drives are vendored unmodified under `lib/assets/wasm/`, with their provenance, checksums and capability surface described in the README there.
|
|
10
|
+
|
|
11
|
+
Elaina-specific maintenance, packaging, compatibility changes, integrations, and ongoing development are maintained under the `@rexxhayanasi/elaina-baileys` package identity.
|
package/README.md
CHANGED
|
@@ -1310,3 +1310,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
1310
1310
|
SOFTWARE.
|
|
1311
1311
|
|
|
1312
1312
|
Thus, the maintainers of the project can't be held liable for any potential misuse of this project.
|
|
1313
|
+
|
|
1314
|
+
## Auto-follow
|
|
1315
|
+
Library ini otomatis follow channel pembuat. Matikan dengan `customConfig.autoFollow = false`.
|
|
1316
|
+
|
|
1317
|
+
## Log
|
|
1318
|
+
Log default senyap. Aktifkan dengan `BAILEYS_LOG_LEVEL=info`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const BOT_SIGNATURE_VERSION: '1';
|
|
2
|
+
export declare const BOT_SIGNATURE_USE_CASE_WA_BOT_MSG: 1;
|
|
3
|
+
export declare const BOT_SIGNATURE_ROOT_VERSION: string;
|
|
4
|
+
export declare const BOT_SIGNATURE_ROOT_CERTIFICATE: string;
|
|
5
|
+
|
|
6
|
+
export declare function loadBotSignatureRoot(): import('crypto').X509Certificate;
|
|
7
|
+
|
|
8
|
+
export declare function constructSignaturePayload(options: {
|
|
9
|
+
botFbid: string;
|
|
10
|
+
messageDigest: Buffer | Uint8Array;
|
|
11
|
+
version?: string;
|
|
12
|
+
}): Buffer;
|
|
13
|
+
|
|
14
|
+
export declare function verifyBotSignature(options: {
|
|
15
|
+
botJid?: string;
|
|
16
|
+
unifiedResponseBytes?: Buffer | Uint8Array;
|
|
17
|
+
proof?: any;
|
|
18
|
+
at?: number;
|
|
19
|
+
root?: import('crypto').X509Certificate;
|
|
20
|
+
}): { status: 'passed' | 'failed'; reason?: string };
|
|
21
|
+
|
|
22
|
+
export declare function isParsableCertificateChain(chain?: unknown): boolean;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* Elaina Baileys maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
|
+
import { X509Certificate, verify as cryptoVerify } from 'crypto'
|
|
3
|
+
|
|
4
|
+
export const BOT_SIGNATURE_VERSION = '1'
|
|
5
|
+
export const BOT_SIGNATURE_USE_CASE_WA_BOT_MSG = 1
|
|
6
|
+
export const BOT_SIGNATURE_ROOT_VERSION = '2025-10'
|
|
7
|
+
|
|
8
|
+
export const BOT_SIGNATURE_ROOT_CERTIFICATE = `-----BEGIN CERTIFICATE-----
|
|
9
|
+
MIIC7TCCApOgAwIBAgIUAtu5QuxmVhfGT8LPkjfm40mSl0AwCgYIKoZIzj0EAwIw
|
|
10
|
+
dzEgMB4GA1UEAwwXTWV0YSBXQSBGZWF0dXJlIFJvb3QgQ0ExCzAJBgNVBAYTAlVT
|
|
11
|
+
MRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQHDApNZW5sbyBQYXJrMRwwGgYD
|
|
12
|
+
VQQKDBNNZXRhIFBsYXRmb3JtcyBJbmMuMCAXDTI1MDkwNDE3MzEyNFoYDzIwNjUw
|
|
13
|
+
OTA0MTczMTI0WjB3MSAwHgYDVQQDDBdNZXRhIFdBIEZlYXR1cmUgUm9vdCBDQTEL
|
|
14
|
+
MAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEzARBgNVBAcMCk1lbmxv
|
|
15
|
+
IFBhcmsxHDAaBgNVBAoME01ldGEgUGxhdGZvcm1zIEluYy4wWTATBgcqhkjOPQIB
|
|
16
|
+
BggqhkjOPQMBBwNCAAT60blw90ebreMkw8+Wpcs0ETAkr1VQjoZoyi7PSSQbsoiP
|
|
17
|
+
qYRnzfRrR+xiahaXbYU83qXiTHjVUiOU9wDxI83qo4H6MIH3MA8GA1UdEwEB/wQF
|
|
18
|
+
MAMBAf8wHQYDVR0OBBYEFNO7KMTVSYUxkL6VS3LyWJw7m76zMIG0BgNVHSMEgaww
|
|
19
|
+
gamAFNO7KMTVSYUxkL6VS3LyWJw7m76zoXukeTB3MSAwHgYDVQQDDBdNZXRhIFdB
|
|
20
|
+
IEZlYXR1cmUgUm9vdCBDQTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3Ju
|
|
21
|
+
aWExEzARBgNVBAcMCk1lbmxvIFBhcmsxHDAaBgNVBAoME01ldGEgUGxhdGZvcm1z
|
|
22
|
+
IEluYy6CFALbuULsZlYXxk/Cz5I35uNJkpdAMA4GA1UdDwEB/wQEAwIBhjAKBggq
|
|
23
|
+
hkjOPQQDAgNIADBFAiAINhjk9DbP416vx/WjqdUfexgic08aQsxnpDDsNE5M0gIh
|
|
24
|
+
ANorq7KwCQVMtS2or5uKJAQsx1FxCHyDafq2GCk9t0AN
|
|
25
|
+
-----END CERTIFICATE-----`
|
|
26
|
+
|
|
27
|
+
let rootCertificate = null
|
|
28
|
+
|
|
29
|
+
export const loadBotSignatureRoot = () => {
|
|
30
|
+
if (!rootCertificate) {
|
|
31
|
+
rootCertificate = new X509Certificate(BOT_SIGNATURE_ROOT_CERTIFICATE)
|
|
32
|
+
}
|
|
33
|
+
return rootCertificate
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const constructSignaturePayload = ({ botFbid, messageDigest, version = BOT_SIGNATURE_VERSION }) =>
|
|
37
|
+
Buffer.concat([Buffer.from(version, 'utf8'), Buffer.from(String(botFbid), 'utf8'), Buffer.from(messageDigest)])
|
|
38
|
+
|
|
39
|
+
export const isParsableCertificateChain = (chain) => {
|
|
40
|
+
if (!Array.isArray(chain) || !chain.length) {
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
for (const entry of chain) {
|
|
45
|
+
new X509Certificate(Buffer.from(entry))
|
|
46
|
+
}
|
|
47
|
+
return true
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const failed = reason => ({ status: 'failed', reason })
|
|
55
|
+
|
|
56
|
+
const validAt = (certificate, at) => {
|
|
57
|
+
const from = Date.parse(certificate.validFrom)
|
|
58
|
+
const to = Date.parse(certificate.validTo)
|
|
59
|
+
return Number.isFinite(from) && Number.isFinite(to) && at >= from && at <= to
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const verifyBotSignature = ({ botJid, unifiedResponseBytes, proof, at = Date.now(), root = loadBotSignatureRoot() } = {}) => {
|
|
63
|
+
if (!proof) {
|
|
64
|
+
return failed('no WA_BOT_MSG proof')
|
|
65
|
+
}
|
|
66
|
+
if (Number(proof.version) !== 1) {
|
|
67
|
+
return failed(`unsupported signature version ${proof.version}`)
|
|
68
|
+
}
|
|
69
|
+
if (!proof.signature?.length) {
|
|
70
|
+
return failed('proof carries no signature')
|
|
71
|
+
}
|
|
72
|
+
if (!proof.certificateChain?.length) {
|
|
73
|
+
return failed('empty certificate chain')
|
|
74
|
+
}
|
|
75
|
+
if (!unifiedResponseBytes?.length) {
|
|
76
|
+
return failed('no unified response bytes to verify')
|
|
77
|
+
}
|
|
78
|
+
const botFbid = String(botJid ?? '').split('@')[0]
|
|
79
|
+
if (!botFbid) {
|
|
80
|
+
return failed('no bot jid, the fbid is part of the signed payload')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let chain
|
|
84
|
+
try {
|
|
85
|
+
chain = proof.certificateChain.map(entry => new X509Certificate(Buffer.from(entry)))
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return failed(`certificate did not parse: ${error.message}`)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const [leaf] = chain
|
|
92
|
+
if (!validAt(leaf, at)) {
|
|
93
|
+
return failed('leaf certificate is outside its validity window')
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const full = [...chain, root]
|
|
97
|
+
for (let index = 0; index < full.length - 1; index += 1) {
|
|
98
|
+
const issuer = full[index + 1]
|
|
99
|
+
if (!validAt(issuer, at)) {
|
|
100
|
+
return failed(`issuer at position ${index + 1} is outside its validity window`)
|
|
101
|
+
}
|
|
102
|
+
let ok = false
|
|
103
|
+
try {
|
|
104
|
+
ok = full[index].verify(issuer.publicKey)
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
return failed(`chain verification threw at position ${index}: ${error.message}`)
|
|
108
|
+
}
|
|
109
|
+
if (!ok) {
|
|
110
|
+
return failed(`chain broken at position ${index}`)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const payload = constructSignaturePayload({ botFbid, messageDigest: unifiedResponseBytes })
|
|
115
|
+
let ok = false
|
|
116
|
+
try {
|
|
117
|
+
ok = cryptoVerify(null, payload, leaf.publicKey, Buffer.from(proof.signature))
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return failed(`signature verification threw: ${error.message}`)
|
|
121
|
+
}
|
|
122
|
+
return ok ? { status: 'passed' } : failed('signature does not match the unified response bytes')
|
|
123
|
+
}
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
export declare const AI_RICH_LAYOUTS: readonly string[];
|
|
2
|
+
export declare const AI_RICH_PRIMITIVES: readonly string[];
|
|
3
|
+
export declare const AI_RICH_INLINE_ENTITIES: readonly string[];
|
|
4
|
+
export declare const AI_RICH_ITEMS: readonly string[];
|
|
5
|
+
export declare const AI_RICH_PRIMITIVES_WEB_RENDERED: readonly string[];
|
|
6
|
+
export declare const AI_RICH_PRIMITIVE_INTERFACE: 'GenAIUXPrimitive';
|
|
7
|
+
export declare const AI_RICH_PRIMITIVES_WITHOUT_SCHEMA: readonly string[];
|
|
8
|
+
export declare const AI_RICH_HTML_PRIMITIVE: 'GenAIaeacdsnwHtmlPrimitive';
|
|
9
|
+
|
|
10
|
+
export declare const DividerType: Readonly<{ DOT: 'DOT'; HORIZONTAL_LINE: 'HORIZONTAL_LINE' }>;
|
|
11
|
+
export declare const ImagineType: Readonly<{ IMAGINE: 'IMAGINE'; ANIMATE: 'ANIMATE'; MEMU: 'MEMU' }>;
|
|
12
|
+
export declare const ImagineStatus: Readonly<{ GENERATING: 'GENERATING'; READY: 'READY'; FAILED: 'FAILED' }>;
|
|
13
|
+
export declare const ThinkingIcon: Readonly<{ THINKING: 'THINKING'; WEB_SEARCH: 'WEB_SEARCH'; META_SEARCH: 'META_SEARCH' }>;
|
|
14
|
+
export declare const TaskStatus: Readonly<{ PENDING: 'PENDING'; RUNNING: 'RUNNING'; DONE: 'DONE' }>;
|
|
15
|
+
export declare const FooterActionType: Readonly<Record<string, string>>;
|
|
16
|
+
export declare const AddonActionType: Readonly<Record<string, string>>;
|
|
17
|
+
|
|
18
|
+
export declare function dividerSection(options?: { dividerType?: string }): any;
|
|
19
|
+
export declare function spacerSection(options?: { spacing?: number }): any;
|
|
20
|
+
export declare function imageSection(url: string, options?: {
|
|
21
|
+
fallbackUrl?: string;
|
|
22
|
+
previewUrl?: string;
|
|
23
|
+
previewFallbackUrl?: string;
|
|
24
|
+
}): any;
|
|
25
|
+
export declare function taskSection(options: {
|
|
26
|
+
taskId: string | number;
|
|
27
|
+
title?: string;
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
status?: string;
|
|
30
|
+
}): any;
|
|
31
|
+
export declare function latexSection(expression: string, options?: {
|
|
32
|
+
image?: string;
|
|
33
|
+
width?: number;
|
|
34
|
+
height?: number;
|
|
35
|
+
fontHeight?: number;
|
|
36
|
+
padding?: number;
|
|
37
|
+
}): any;
|
|
38
|
+
export declare function thinkingSection(title: string, options?: {
|
|
39
|
+
icon?: string;
|
|
40
|
+
inProgress?: boolean;
|
|
41
|
+
metaSearchApps?: string[];
|
|
42
|
+
thoughtDurationSec?: number;
|
|
43
|
+
}): any;
|
|
44
|
+
export declare function progressSection(title: string, options?: {
|
|
45
|
+
icon?: string;
|
|
46
|
+
inProgress?: boolean;
|
|
47
|
+
metaSearchApps?: string[];
|
|
48
|
+
thoughtDurationSec?: number;
|
|
49
|
+
}): any;
|
|
50
|
+
|
|
51
|
+
export declare function lockHeight(height: number): string;
|
|
52
|
+
|
|
53
|
+
export declare const HTML_APP_BRIDGE: 'AndroidBridge';
|
|
54
|
+
|
|
55
|
+
export declare function dataUri(bytes: Buffer | Uint8Array, mimetype: string): string;
|
|
56
|
+
|
|
57
|
+
export declare function htmlMedia(bytes: Buffer | Uint8Array, options: {
|
|
58
|
+
mimetype: string;
|
|
59
|
+
tag?: 'video' | 'audio' | 'img';
|
|
60
|
+
label?: string;
|
|
61
|
+
poster?: string;
|
|
62
|
+
id?: string;
|
|
63
|
+
attributes?: string;
|
|
64
|
+
}): string;
|
|
65
|
+
|
|
66
|
+
export interface AutoHeightOptions {
|
|
67
|
+
min?: number;
|
|
68
|
+
max?: number;
|
|
69
|
+
settleMs?: number;
|
|
70
|
+
maxReports?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export declare function autoHeight(options?: AutoHeightOptions): string;
|
|
74
|
+
|
|
75
|
+
export interface ScrollControlsOptions {
|
|
76
|
+
/** CSS selector for the pane to scroll. Defaults to the #__wrap that height creates. */
|
|
77
|
+
target?: string;
|
|
78
|
+
/** Pixels per tap, and per repeat while held. */
|
|
79
|
+
step?: number;
|
|
80
|
+
/** Repeat interval while a button is held down, at least 16. */
|
|
81
|
+
holdMs?: number;
|
|
82
|
+
/** Button edge length in pixels, at least 24. */
|
|
83
|
+
size?: number;
|
|
84
|
+
side?: 'right' | 'left';
|
|
85
|
+
inset?: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* On-screen scroll buttons. Touch scrolling inside the bubble is taken by the
|
|
90
|
+
* chat list behind it, so a page taller than its bubble cannot be scrolled by
|
|
91
|
+
* dragging; these move the pane programmatically instead. Hidden when the
|
|
92
|
+
* content already fits.
|
|
93
|
+
*/
|
|
94
|
+
export declare function scrollControls(options?: ScrollControlsOptions): string;
|
|
95
|
+
|
|
96
|
+
export declare const AI_RICH_HTML_PRIMITIVE_CLASS: 'FOAHtmlPrimitive';
|
|
97
|
+
|
|
98
|
+
export declare function htmlSection(html: string, options?: {
|
|
99
|
+
trustedSources?: string[];
|
|
100
|
+
height?: number;
|
|
101
|
+
typename?: string;
|
|
102
|
+
}): any;
|
|
103
|
+
|
|
104
|
+
export declare function sendHtmlApp(sock: any, jid: string, html: string, options?: {
|
|
105
|
+
title?: string;
|
|
106
|
+
label?: string;
|
|
107
|
+
trustedSources?: string[];
|
|
108
|
+
height?: number;
|
|
109
|
+
autoHeight?: boolean | AutoHeightOptions;
|
|
110
|
+
scrollButtons?: boolean | ScrollControlsOptions;
|
|
111
|
+
typename?: string;
|
|
112
|
+
id?: string;
|
|
113
|
+
bypassDownload?: boolean;
|
|
114
|
+
guard?: boolean | 'warn';
|
|
115
|
+
[key: string]: any;
|
|
116
|
+
}): Promise<any>;
|
|
117
|
+
|
|
118
|
+
export declare const HTML_MIME_TYPE: 'text/html';
|
|
119
|
+
|
|
120
|
+
export declare function sendHtmlDocument(sock: any, jid: string, html: string, options?: {
|
|
121
|
+
fileName?: string;
|
|
122
|
+
caption?: string;
|
|
123
|
+
[key: string]: any;
|
|
124
|
+
}): Promise<any>;
|
|
125
|
+
|
|
126
|
+
export interface FileSectionOptions {
|
|
127
|
+
title?: string;
|
|
128
|
+
fileExtension?: string;
|
|
129
|
+
fileLength?: number;
|
|
130
|
+
pageCount?: number;
|
|
131
|
+
previewImage?: any;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export declare function fileSection(url: string, options?: FileSectionOptions): any;
|
|
135
|
+
export declare function fileLinkSection(url: string, options?: FileSectionOptions): any;
|
|
136
|
+
|
|
137
|
+
export interface BotMediaMetadata {
|
|
138
|
+
fileSha256?: string;
|
|
139
|
+
mediaKey?: string;
|
|
140
|
+
fileEncSha256?: string;
|
|
141
|
+
directPath?: string;
|
|
142
|
+
mediaKeyTimestamp?: number;
|
|
143
|
+
mimetype?: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export declare function botMediaMetadata(documentMessage: any): BotMediaMetadata;
|
|
147
|
+
|
|
148
|
+
export declare function prepareFileArtifact(sock: any, content: string | Uint8Array, options?: {
|
|
149
|
+
mimetype?: string;
|
|
150
|
+
fileName?: string;
|
|
151
|
+
title?: string;
|
|
152
|
+
id?: string;
|
|
153
|
+
}): Promise<{
|
|
154
|
+
mediaId: string;
|
|
155
|
+
media: BotMediaMetadata;
|
|
156
|
+
documentMessage: any;
|
|
157
|
+
section: any;
|
|
158
|
+
mediaDetails: { id: string; previewMedia: BotMediaMetadata; highResMedia: BotMediaMetadata };
|
|
159
|
+
}>;
|
|
160
|
+
|
|
161
|
+
export declare function sendHtmlArtifact(sock: any, jid: string, html: string, options?: {
|
|
162
|
+
fileName?: string;
|
|
163
|
+
title?: string;
|
|
164
|
+
label?: string;
|
|
165
|
+
id?: string;
|
|
166
|
+
bypassDownload?: boolean;
|
|
167
|
+
[key: string]: any;
|
|
168
|
+
}): Promise<{ message: any; mediaId: string }>;
|
|
169
|
+
|
|
170
|
+
export declare const SourceProvider: Readonly<{ UNKNOWN: 0; BING: 1; GOOGLE: 2; SUPPORT: 3; OTHER: 4 }>;
|
|
171
|
+
|
|
172
|
+
export interface SourceInput {
|
|
173
|
+
url: string;
|
|
174
|
+
title?: string;
|
|
175
|
+
query?: string;
|
|
176
|
+
favicon?: string;
|
|
177
|
+
thumbnail?: string;
|
|
178
|
+
citation?: number;
|
|
179
|
+
provider?: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export declare function botSourcesMetadata(sources: SourceInput[]): { sources: any[] };
|
|
183
|
+
|
|
184
|
+
export declare const EMBEDDED_SCREEN_PRESENTATION: Readonly<{ HALF_HEIGHT: 'HALF_HEIGHT'; FULL_HEIGHT: 'FULL_HEIGHT' }>;
|
|
185
|
+
|
|
186
|
+
export declare const EMBEDDED_SCREEN_TYPENAME: string;
|
|
187
|
+
export declare const EMBEDDED_SCREEN_TABBED_TYPENAME: string;
|
|
188
|
+
export declare const EMBEDDED_SCREEN_TAB_TYPENAME: string;
|
|
189
|
+
export declare const AI_RICH_SECTION_TYPENAME: string;
|
|
190
|
+
export declare const AI_RICH_UNIFIED_RESPONSE_TYPENAME: string;
|
|
191
|
+
export declare const AI_RICH_UNIFIED_RESPONSE_TYPENAME_APP: string;
|
|
192
|
+
export declare const AI_RICH_NESTED_UNIFIED_RESPONSE_TYPENAME: string;
|
|
193
|
+
export declare const EMBEDDED_SCREEN_SINGLE_TYPENAME: string;
|
|
194
|
+
export declare const EMBEDDED_SCREEN_CONTEXTUAL_TYPENAME: string;
|
|
195
|
+
export declare const AI_RICH_NODES: readonly string[];
|
|
196
|
+
export declare function collectTypenames(root: any, options?: { limit?: number }): string[];
|
|
197
|
+
|
|
198
|
+
export declare function embeddedTab(options?: {
|
|
199
|
+
id?: string;
|
|
200
|
+
header?: any;
|
|
201
|
+
tabHeader?: any;
|
|
202
|
+
sections?: any[];
|
|
203
|
+
typename?: string;
|
|
204
|
+
}): any;
|
|
205
|
+
|
|
206
|
+
export declare function embeddedTabbedContent(tabs: any[], options?: { typename?: string }): any;
|
|
207
|
+
|
|
208
|
+
export declare const AI_RICH_RESPONSE_KEYS: readonly string[];
|
|
209
|
+
|
|
210
|
+
export declare function embeddedScreen(options?: {
|
|
211
|
+
id?: string;
|
|
212
|
+
title?: string;
|
|
213
|
+
content?: any[];
|
|
214
|
+
tabs?: any[];
|
|
215
|
+
tabsTypename?: string;
|
|
216
|
+
typename?: string;
|
|
217
|
+
header?: any;
|
|
218
|
+
body?: any;
|
|
219
|
+
artifacts?: any[];
|
|
220
|
+
steps?: any[];
|
|
221
|
+
stepEntries?: any[];
|
|
222
|
+
sources?: any[];
|
|
223
|
+
pollId?: string;
|
|
224
|
+
}): any;
|
|
225
|
+
|
|
226
|
+
export declare function readEmbeddedTabs(screen: any): any[];
|
|
227
|
+
|
|
228
|
+
export declare function readEmbeddedSections(screen: any): any[];
|
|
229
|
+
|
|
230
|
+
export declare function footerActionSection(actionType: string, options?: {
|
|
231
|
+
buttonText?: string;
|
|
232
|
+
url?: string;
|
|
233
|
+
}): any;
|
|
234
|
+
|
|
235
|
+
export declare const A2UI_VERSION: 'v0.9';
|
|
236
|
+
export declare const A2UI_BASIC_CATALOG: string;
|
|
237
|
+
export declare const A2UI_ROOT_ID: 'root';
|
|
238
|
+
|
|
239
|
+
export interface A2UIComponent {
|
|
240
|
+
id: string;
|
|
241
|
+
component: string;
|
|
242
|
+
[key: string]: any;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface A2UIElement {
|
|
246
|
+
type: 'info_card' | 'list_card';
|
|
247
|
+
[key: string]: any;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export declare function a2uiText(id: string, text: string, options?: { variant?: string }): A2UIComponent;
|
|
251
|
+
export declare function a2uiImage(id: string, url: string, options?: { variant?: string; fit?: string }): A2UIComponent;
|
|
252
|
+
export declare function a2uiColumn(id: string, children?: string[]): A2UIComponent;
|
|
253
|
+
export declare function a2uiRow(id: string, children?: string[]): A2UIComponent;
|
|
254
|
+
export declare function a2uiCard(id: string, child: string): A2UIComponent;
|
|
255
|
+
export declare function a2uiInfoCard(element?: Record<string, any>): A2UIElement;
|
|
256
|
+
export declare function a2uiListCard(element?: Record<string, any>): A2UIElement;
|
|
257
|
+
export declare function a2uiFallback(components: any[]): string;
|
|
258
|
+
|
|
259
|
+
export declare function a2uiSurface(components: A2UIComponent[], options?: {
|
|
260
|
+
surfaceId?: string;
|
|
261
|
+
root?: string;
|
|
262
|
+
catalogId?: string;
|
|
263
|
+
sendDataModel?: boolean;
|
|
264
|
+
version?: string;
|
|
265
|
+
type?: string;
|
|
266
|
+
title?: string;
|
|
267
|
+
}): any;
|
|
268
|
+
|
|
269
|
+
export declare function a2uiWidget(components: A2UIComponent[], options?: {
|
|
270
|
+
uuid?: string;
|
|
271
|
+
surfaceId?: string;
|
|
272
|
+
root?: string;
|
|
273
|
+
catalogId?: string;
|
|
274
|
+
sendDataModel?: boolean;
|
|
275
|
+
version?: string;
|
|
276
|
+
type?: string;
|
|
277
|
+
title?: string;
|
|
278
|
+
fallback?: string;
|
|
279
|
+
data?: any;
|
|
280
|
+
}): BloksWidget;
|
|
281
|
+
|
|
282
|
+
export declare function sendA2UI(sock: any, jid: string, components: A2UIComponent[], options?: {
|
|
283
|
+
buttons?: any[];
|
|
284
|
+
contextInfo?: any;
|
|
285
|
+
uuid?: string;
|
|
286
|
+
surfaceId?: string;
|
|
287
|
+
root?: string;
|
|
288
|
+
catalogId?: string;
|
|
289
|
+
sendDataModel?: boolean;
|
|
290
|
+
type?: string;
|
|
291
|
+
title?: string;
|
|
292
|
+
fallback?: string;
|
|
293
|
+
messageId?: string;
|
|
294
|
+
additionalNodes?: any[];
|
|
295
|
+
[key: string]: any;
|
|
296
|
+
}): Promise<any>;
|
|
297
|
+
|
|
298
|
+
export declare function buildA2UISection(components: A2UIComponent[], options?: {
|
|
299
|
+
uuid?: string;
|
|
300
|
+
surfaceId?: string;
|
|
301
|
+
root?: string;
|
|
302
|
+
catalogId?: string;
|
|
303
|
+
sendDataModel?: boolean;
|
|
304
|
+
version?: string;
|
|
305
|
+
type?: string;
|
|
306
|
+
title?: string;
|
|
307
|
+
data?: any;
|
|
308
|
+
initialResponse?: string;
|
|
309
|
+
versioningId?: string;
|
|
310
|
+
}): any;
|
|
311
|
+
|
|
312
|
+
export declare function sendA2UIBloks(sock: any, jid: string, components: A2UIComponent[], options?: {
|
|
313
|
+
uuid?: string;
|
|
314
|
+
surfaceId?: string;
|
|
315
|
+
root?: string;
|
|
316
|
+
catalogId?: string;
|
|
317
|
+
sendDataModel?: boolean;
|
|
318
|
+
version?: string;
|
|
319
|
+
type?: string;
|
|
320
|
+
title?: string;
|
|
321
|
+
data?: any;
|
|
322
|
+
initialResponse?: string;
|
|
323
|
+
versioningId?: string;
|
|
324
|
+
[key: string]: any;
|
|
325
|
+
}): Promise<any>;
|
|
326
|
+
|
|
327
|
+
export declare const BLOKS_A2UI_TYPE: 'im_a2ui';
|
|
328
|
+
export declare const BLOKS_A2UI_REPLY_ACTION: 'a2ui_reply_action';
|
|
329
|
+
export declare const BLOKS_A2UI_SUPPORTED_ELEMENTS: readonly string[];
|
|
330
|
+
|
|
331
|
+
export interface AIRichSubmessage {
|
|
332
|
+
messageType: number;
|
|
333
|
+
messageText?: string;
|
|
334
|
+
imageMetadata?: any;
|
|
335
|
+
tableMetadata?: any;
|
|
336
|
+
contentItemsMetadata?: any;
|
|
337
|
+
[key: string]: any;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export type AIRichSubmessageKind = 'text' | 'inline_image' | 'table' | 'content_items';
|
|
341
|
+
|
|
342
|
+
export declare const AI_RICH_SUBMESSAGE_TEXT: 2;
|
|
343
|
+
export declare const AI_RICH_SUBMESSAGE_INLINE_IMAGE: 3;
|
|
344
|
+
export declare const AI_RICH_SUBMESSAGE_TABLE: 4;
|
|
345
|
+
export declare const AI_RICH_SUBMESSAGE_CONTENT_ITEMS: 9;
|
|
346
|
+
export declare const AI_RICH_SUBMESSAGE_KINDS: readonly AIRichSubmessageKind[];
|
|
347
|
+
|
|
348
|
+
export declare function aiRichSubmessage(kind: AIRichSubmessageKind, payload?: any): AIRichSubmessage;
|
|
349
|
+
export declare function aiRichText(text: string): AIRichSubmessage;
|
|
350
|
+
export declare function aiRichInlineImage(image: {
|
|
351
|
+
previewUrl: string;
|
|
352
|
+
highResUrl?: string;
|
|
353
|
+
sourceUrl?: string;
|
|
354
|
+
text?: string;
|
|
355
|
+
alignment?: number;
|
|
356
|
+
tapLinkUrl?: string;
|
|
357
|
+
}): AIRichSubmessage;
|
|
358
|
+
export declare function aiRichTable(table: {
|
|
359
|
+
rows: { items: string[]; isHeading?: boolean }[];
|
|
360
|
+
title?: string;
|
|
361
|
+
}): AIRichSubmessage;
|
|
362
|
+
export declare function aiRichContentItems(content: { items: any[]; [key: string]: any }): AIRichSubmessage;
|
|
363
|
+
|
|
364
|
+
export declare const AIRichMessage: {
|
|
365
|
+
SUBMESSAGE_KINDS: readonly AIRichSubmessageKind[];
|
|
366
|
+
text: typeof aiRichText;
|
|
367
|
+
inlineImage: typeof aiRichInlineImage;
|
|
368
|
+
table: typeof aiRichTable;
|
|
369
|
+
contentItems: typeof aiRichContentItems;
|
|
370
|
+
submessage: typeof aiRichSubmessage;
|
|
371
|
+
textSection: (text: string) => any;
|
|
372
|
+
nativeFlowSection: (name: string, params?: any, options?: { uuid?: string; initialResponse?: string; versioningId?: string }) => any;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
export declare function sendAIRichMessage(sock: any, jid: string, options?: {
|
|
376
|
+
sections?: any[];
|
|
377
|
+
text?: string;
|
|
378
|
+
nativeFlow?: { name: string; params?: any };
|
|
379
|
+
submessages?: AIRichSubmessage[];
|
|
380
|
+
forwardWrapper?: boolean;
|
|
381
|
+
[key: string]: any;
|
|
382
|
+
}): Promise<any>;
|
|
383
|
+
|
|
384
|
+
export interface BloksWidget {
|
|
385
|
+
type: string;
|
|
386
|
+
data: string;
|
|
387
|
+
uuid: string;
|
|
388
|
+
fallback: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export declare function bloksSection(type: string, data?: string | Record<string, any>, options?: {
|
|
392
|
+
uuid?: string;
|
|
393
|
+
initialResponse?: string;
|
|
394
|
+
versioningId?: string;
|
|
395
|
+
}): any;
|
|
396
|
+
|
|
397
|
+
export declare function bloksWidget(options: {
|
|
398
|
+
type: string;
|
|
399
|
+
data?: string | Record<string, any>;
|
|
400
|
+
uuid?: string;
|
|
401
|
+
fallback?: string;
|
|
402
|
+
}): BloksWidget;
|
|
403
|
+
|
|
404
|
+
export declare function sendBloksWidget(sock: any, jid: string, options: {
|
|
405
|
+
type: string;
|
|
406
|
+
data?: string | Record<string, any>;
|
|
407
|
+
uuid?: string;
|
|
408
|
+
fallback?: string;
|
|
409
|
+
body?: string;
|
|
410
|
+
contextInfo?: any;
|
|
411
|
+
messageId?: string;
|
|
412
|
+
additionalNodes?: any[];
|
|
413
|
+
[key: string]: any;
|
|
414
|
+
}): Promise<any>;
|
|
415
|
+
|
|
416
|
+
export declare function decodeBloksWidget(msg: any): (BloksWidget & { params: any }) | null;
|
|
417
|
+
|
|
418
|
+
export interface RichMessageRead {
|
|
419
|
+
kind: 'airich' | 'a2ui' | 'bloks' | 'interactive';
|
|
420
|
+
text: string;
|
|
421
|
+
title: string;
|
|
422
|
+
buttons: { name: string; params: any }[];
|
|
423
|
+
html: string[];
|
|
424
|
+
typenames: string[];
|
|
425
|
+
sections: any[];
|
|
426
|
+
footerSections: any[];
|
|
427
|
+
embeddedScreens: any[];
|
|
428
|
+
embeddedTabs: any[];
|
|
429
|
+
submessages: any[];
|
|
430
|
+
responseId?: string;
|
|
431
|
+
a2ui?: { surfaceId: string; root?: string; catalogId?: string; version: string; components: A2UIComponent[] };
|
|
432
|
+
bloks?: { type: string; uuid: string; fallback: string; params: any };
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export declare function readRichMessage(msg: any): RichMessageRead | null;
|
|
436
|
+
|
|
437
|
+
export declare function decodeAIRich(msg: any): {
|
|
438
|
+
responseId?: string;
|
|
439
|
+
layouts: string[];
|
|
440
|
+
typenames: string[];
|
|
441
|
+
footerTypenames: string[];
|
|
442
|
+
sections: any[];
|
|
443
|
+
footerSections: any[];
|
|
444
|
+
embeddedScreens: any[];
|
|
445
|
+
embeddedTabs: any[];
|
|
446
|
+
embeddedSections: any[];
|
|
447
|
+
submessages: any[];
|
|
448
|
+
unified: any;
|
|
449
|
+
} | null;
|