@wirecat/whatsapp-cli 0.0.0-stage → 0.1.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.
Files changed (110) hide show
  1. package/LICENSE +204 -0
  2. package/README.md +282 -2
  3. package/dist/adapter/adapter.d.ts +9 -0
  4. package/dist/adapter/adapter.d.ts.map +1 -0
  5. package/dist/adapter/adapter.js +326 -0
  6. package/dist/adapter/adapter.js.map +1 -0
  7. package/dist/adapter/checks.d.ts +7 -0
  8. package/dist/adapter/checks.d.ts.map +1 -0
  9. package/dist/adapter/checks.js +3 -0
  10. package/dist/adapter/checks.js.map +1 -0
  11. package/dist/adapter/errors.d.ts +18 -0
  12. package/dist/adapter/errors.d.ts.map +1 -0
  13. package/dist/adapter/errors.js +40 -0
  14. package/dist/adapter/errors.js.map +1 -0
  15. package/dist/adapter/format-markdown.d.ts +8 -0
  16. package/dist/adapter/format-markdown.d.ts.map +1 -0
  17. package/dist/adapter/format-markdown.js +80 -0
  18. package/dist/adapter/format-markdown.js.map +1 -0
  19. package/dist/adapter/groups.d.ts +21 -0
  20. package/dist/adapter/groups.d.ts.map +1 -0
  21. package/dist/adapter/groups.js +210 -0
  22. package/dist/adapter/groups.js.map +1 -0
  23. package/dist/adapter/map.d.ts +9 -0
  24. package/dist/adapter/map.d.ts.map +1 -0
  25. package/dist/adapter/map.js +72 -0
  26. package/dist/adapter/map.js.map +1 -0
  27. package/dist/adapter/polls.d.ts +21 -0
  28. package/dist/adapter/polls.d.ts.map +1 -0
  29. package/dist/adapter/polls.js +103 -0
  30. package/dist/adapter/polls.js.map +1 -0
  31. package/dist/app.d.ts +6 -0
  32. package/dist/app.d.ts.map +1 -0
  33. package/dist/app.js +16 -0
  34. package/dist/app.js.map +1 -0
  35. package/dist/bin/wa.d.ts +3 -0
  36. package/dist/bin/wa.d.ts.map +1 -0
  37. package/dist/bin/wa.js +27 -0
  38. package/dist/bin/wa.js.map +1 -0
  39. package/dist/commands/answer.d.ts +7 -0
  40. package/dist/commands/answer.d.ts.map +1 -0
  41. package/dist/commands/answer.js +11 -0
  42. package/dist/commands/answer.js.map +1 -0
  43. package/dist/commands/session.d.ts +37 -0
  44. package/dist/commands/session.d.ts.map +1 -0
  45. package/dist/commands/session.js +202 -0
  46. package/dist/commands/session.js.map +1 -0
  47. package/dist/commands/setup.d.ts +3 -0
  48. package/dist/commands/setup.d.ts.map +1 -0
  49. package/dist/commands/setup.js +192 -0
  50. package/dist/commands/setup.js.map +1 -0
  51. package/dist/commands/update.d.ts +2 -0
  52. package/dist/commands/update.d.ts.map +1 -0
  53. package/dist/commands/update.js +36 -0
  54. package/dist/commands/update.js.map +1 -0
  55. package/dist/diagnose.d.ts +77 -0
  56. package/dist/diagnose.d.ts.map +1 -0
  57. package/dist/diagnose.js +84 -0
  58. package/dist/diagnose.js.map +1 -0
  59. package/dist/engine/contract.d.ts +617 -0
  60. package/dist/engine/contract.d.ts.map +1 -0
  61. package/dist/engine/contract.js +186 -0
  62. package/dist/engine/contract.js.map +1 -0
  63. package/dist/engine/events.d.ts +9 -0
  64. package/dist/engine/events.d.ts.map +1 -0
  65. package/dist/engine/events.js +23 -0
  66. package/dist/engine/events.js.map +1 -0
  67. package/dist/engine/go-engine.d.ts +23 -0
  68. package/dist/engine/go-engine.d.ts.map +1 -0
  69. package/dist/engine/go-engine.js +238 -0
  70. package/dist/engine/go-engine.js.map +1 -0
  71. package/dist/engine/groups.d.ts +159 -0
  72. package/dist/engine/groups.d.ts.map +1 -0
  73. package/dist/engine/groups.js +64 -0
  74. package/dist/engine/groups.js.map +1 -0
  75. package/dist/engine-binary.d.ts +5 -0
  76. package/dist/engine-binary.d.ts.map +1 -0
  77. package/dist/engine-binary.js +18 -0
  78. package/dist/engine-binary.js.map +1 -0
  79. package/dist/install/postinstall.d.ts +8 -0
  80. package/dist/install/postinstall.d.ts.map +1 -0
  81. package/dist/install/postinstall.js +62 -0
  82. package/dist/install/postinstall.js.map +1 -0
  83. package/dist/messenger.d.ts +64 -0
  84. package/dist/messenger.d.ts.map +1 -0
  85. package/dist/messenger.js +171 -0
  86. package/dist/messenger.js.map +1 -0
  87. package/dist/paths.d.ts +5 -0
  88. package/dist/paths.d.ts.map +1 -0
  89. package/dist/paths.js +7 -0
  90. package/dist/paths.js.map +1 -0
  91. package/dist/program.d.ts +8 -0
  92. package/dist/program.d.ts.map +1 -0
  93. package/dist/program.js +114 -0
  94. package/dist/program.js.map +1 -0
  95. package/dist/reasons.d.ts +4 -0
  96. package/dist/reasons.d.ts.map +1 -0
  97. package/dist/reasons.js +13 -0
  98. package/dist/reasons.js.map +1 -0
  99. package/dist/update.d.ts +8 -0
  100. package/dist/update.d.ts.map +1 -0
  101. package/dist/update.js +26 -0
  102. package/dist/update.js.map +1 -0
  103. package/dist/version.d.ts +2 -0
  104. package/dist/version.d.ts.map +1 -0
  105. package/dist/version.js +2 -0
  106. package/dist/version.js.map +1 -0
  107. package/install/postinstall.mjs +3 -0
  108. package/install/windows.ps1 +161 -0
  109. package/package.json +89 -4
  110. package/skills/whatsapp-cli/SKILL.md +290 -0
@@ -0,0 +1,617 @@
1
+ import * as v from "valibot";
2
+ import type { GroupEngine } from "./groups.js";
3
+ /**
4
+ * What the engine and the adapter say to each other, in WhatsApp's own terms. The Go engine speaks it as JSON
5
+ * lines; `FakeEngine` speaks it in memory. Bump `PROTOCOL` on any change an older peer would misread — the
6
+ * adapter refuses an engine whose hello names another version.
7
+ *
8
+ * Ids are JIDs as strings. A one-to-one chat is always in its LID form (`…@lid`) when WhatsApp has one for the
9
+ * user, never in phone form: cli-core cannot merge two stored chats, so the engine picks the one id before it
10
+ * emits a chat (cli-private plans/2026-10-16-whatsapp-foundation.md, decision 3). Names are what the address book or the
11
+ * person set; a phone number is never a name.
12
+ */
13
+ export declare const PROTOCOL = 10;
14
+ export declare const waChat: v.StrictObjectSchema<{
15
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
16
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
17
+ readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
18
+ readonly unread: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
19
+ readonly lastMessageAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
20
+ readonly participants: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
21
+ readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
22
+ readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
23
+ }, undefined>;
24
+ export declare const waContact: v.StrictObjectSchema<{
25
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
26
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
27
+ }, undefined>;
28
+ /**
29
+ * What whatsmeow needs to fetch and decrypt a file again, base64 where it is bytes. Stored as the attachment's opaque
30
+ * `providerRef`, so a download or a forward needs only the store. A channel's files are not encrypted and have no keys.
31
+ */
32
+ export declare const waMediaRef: v.StrictObjectSchema<{
33
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
34
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
35
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
36
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
37
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
38
+ }, undefined>;
39
+ /**
40
+ * cli-core's Attachment in WhatsApp's terms: `photo`, `video`, `voice`, `audio`, `document`, `sticker`, `location`
41
+ * (`url` is a `geo:` link), `contact` (its name only — the card holds a phone number). `ref` only for a file.
42
+ */
43
+ export declare const waAttachment: v.StrictObjectSchema<{
44
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
45
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
46
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
47
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
48
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
49
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
50
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
51
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
52
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
53
+ readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
54
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
55
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
56
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
57
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
58
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
59
+ }, undefined>, undefined>;
60
+ }, undefined>;
61
+ /**
62
+ * A poll as its message carries it. An answer's `id` is the start of the SHA-256 of its text, which is what a vote
63
+ * names on the wire. Votes arrive later, live as `vote` events or in a history push's `votes`; cli-core's store
64
+ * counts them.
65
+ */
66
+ export declare const waPoll: v.StrictObjectSchema<{
67
+ readonly question: v.StringSchema<undefined>;
68
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
69
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
70
+ readonly text: v.StringSchema<undefined>;
71
+ }, undefined>, undefined>;
72
+ readonly multiple: v.BooleanSchema<undefined>;
73
+ }, undefined>;
74
+ export declare const waMessage: v.StrictObjectSchema<{
75
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
76
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
77
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
78
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
79
+ readonly fromMe: v.BooleanSchema<undefined>;
80
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
81
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
82
+ readonly text: v.StringSchema<undefined>;
83
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
84
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
85
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
86
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
87
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
88
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
89
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
90
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
91
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
92
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
93
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
94
+ readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
95
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
96
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
97
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
98
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
99
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
100
+ }, undefined>, undefined>;
101
+ }, undefined>, undefined>, undefined>;
102
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
103
+ readonly question: v.StringSchema<undefined>;
104
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
105
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
106
+ readonly text: v.StringSchema<undefined>;
107
+ }, undefined>, undefined>;
108
+ readonly multiple: v.BooleanSchema<undefined>;
109
+ }, undefined>, undefined>;
110
+ }, undefined>;
111
+ /**
112
+ * One person's newest choice in a poll: `selected` is the full SHA-256 of each chosen answer's text, and none takes
113
+ * the vote back. `voter` is in LID form like a sender, and the account's own vote is under `self()`. A vote in a
114
+ * history push carries its `poll`, since the push may not hold that poll; a live `vote` event has none. `votedAt` is
115
+ * when the voter cast it, by WhatsApp's clock: the store keeps a voter's newest vote by it.
116
+ */
117
+ export declare const waVote: v.StrictObjectSchema<{
118
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
119
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
120
+ readonly voter: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
121
+ readonly voterName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
122
+ readonly selected: v.ArraySchema<v.StringSchema<undefined>, undefined>;
123
+ readonly votedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
124
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
125
+ readonly question: v.StringSchema<undefined>;
126
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
127
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
128
+ readonly text: v.StringSchema<undefined>;
129
+ }, undefined>, undefined>;
130
+ readonly multiple: v.BooleanSchema<undefined>;
131
+ }, undefined>, undefined>;
132
+ }, undefined>;
133
+ /**
134
+ * One push from the phone. `kind` follows whatsmeow's sync types; the adapter treats them all alike. `votes` are the
135
+ * votes in the pushed polls, which the store saves with the push, not as `vote` events.
136
+ */
137
+ export declare const waHistory: v.StrictObjectSchema<{
138
+ readonly kind: v.PicklistSchema<["bootstrap", "recent", "full", "on_demand", "push_name", "other"], undefined>;
139
+ readonly chats: v.ArraySchema<v.StrictObjectSchema<{
140
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
141
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
142
+ readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
143
+ readonly unread: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
144
+ readonly lastMessageAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
145
+ readonly participants: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
146
+ readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
147
+ readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
148
+ }, undefined>, undefined>;
149
+ readonly contacts: v.ArraySchema<v.StrictObjectSchema<{
150
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
151
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
152
+ }, undefined>, undefined>;
153
+ readonly messages: v.ArraySchema<v.StrictObjectSchema<{
154
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
155
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
156
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
157
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
158
+ readonly fromMe: v.BooleanSchema<undefined>;
159
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
160
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
161
+ readonly text: v.StringSchema<undefined>;
162
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
163
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
164
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
165
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
166
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
167
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
168
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
169
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
170
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
171
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
172
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
173
+ readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
174
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
175
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
176
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
177
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
178
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
179
+ }, undefined>, undefined>;
180
+ }, undefined>, undefined>, undefined>;
181
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
182
+ readonly question: v.StringSchema<undefined>;
183
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
184
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
185
+ readonly text: v.StringSchema<undefined>;
186
+ }, undefined>, undefined>;
187
+ readonly multiple: v.BooleanSchema<undefined>;
188
+ }, undefined>, undefined>;
189
+ }, undefined>, undefined>;
190
+ readonly votes: v.ArraySchema<v.StrictObjectSchema<{
191
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
192
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
193
+ readonly voter: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
194
+ readonly voterName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
195
+ readonly selected: v.ArraySchema<v.StringSchema<undefined>, undefined>;
196
+ readonly votedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
197
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
198
+ readonly question: v.StringSchema<undefined>;
199
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
200
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
201
+ readonly text: v.StringSchema<undefined>;
202
+ }, undefined>, undefined>;
203
+ readonly multiple: v.BooleanSchema<undefined>;
204
+ }, undefined>, undefined>;
205
+ }, undefined>, undefined>;
206
+ }, undefined>;
207
+ /**
208
+ * The phone's answer to `older`: the chat's messages sent before the anchor, as many as were asked or fewer. No
209
+ * messages and `more: false` is the chat's start. The engine never answers no messages with `more: true`: a batch of
210
+ * only messages the contract skips is asked past, since cli-core reads any empty page as the start.
211
+ */
212
+ export declare const waOlder: v.StrictObjectSchema<{
213
+ readonly messages: v.ArraySchema<v.StrictObjectSchema<{
214
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
215
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
216
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
217
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
218
+ readonly fromMe: v.BooleanSchema<undefined>;
219
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
220
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
221
+ readonly text: v.StringSchema<undefined>;
222
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
223
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
224
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
225
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
226
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
227
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
228
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
229
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
230
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
231
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
232
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
233
+ readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
234
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
235
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
236
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
237
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
238
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
239
+ }, undefined>, undefined>;
240
+ }, undefined>, undefined>, undefined>;
241
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
242
+ readonly question: v.StringSchema<undefined>;
243
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
244
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
245
+ readonly text: v.StringSchema<undefined>;
246
+ }, undefined>, undefined>;
247
+ readonly multiple: v.BooleanSchema<undefined>;
248
+ }, undefined>, undefined>;
249
+ }, undefined>, undefined>;
250
+ readonly more: v.BooleanSchema<undefined>;
251
+ }, undefined>;
252
+ /** `outdated`: WhatsApp refuses this engine's version. `stopped`: the engine process ended without being asked. */
253
+ export declare const connectionState: v.PicklistSchema<["connected", "disconnected", "logged_out", "replaced", "banned", "outdated", "stopped"], undefined>;
254
+ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema<{
255
+ readonly event: v.LiteralSchema<"history", undefined>;
256
+ readonly history: v.StrictObjectSchema<{
257
+ readonly kind: v.PicklistSchema<["bootstrap", "recent", "full", "on_demand", "push_name", "other"], undefined>;
258
+ readonly chats: v.ArraySchema<v.StrictObjectSchema<{
259
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
260
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
261
+ readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
262
+ readonly unread: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
263
+ readonly lastMessageAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
264
+ readonly participants: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
265
+ readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
266
+ readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
267
+ }, undefined>, undefined>;
268
+ readonly contacts: v.ArraySchema<v.StrictObjectSchema<{
269
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
270
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
271
+ }, undefined>, undefined>;
272
+ readonly messages: v.ArraySchema<v.StrictObjectSchema<{
273
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
274
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
275
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
276
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
277
+ readonly fromMe: v.BooleanSchema<undefined>;
278
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
279
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
280
+ readonly text: v.StringSchema<undefined>;
281
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
282
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
283
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
284
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
285
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
286
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
287
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
288
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
289
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
290
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
291
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
292
+ readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
293
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
294
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
295
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
296
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
297
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
298
+ }, undefined>, undefined>;
299
+ }, undefined>, undefined>, undefined>;
300
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
301
+ readonly question: v.StringSchema<undefined>;
302
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
303
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
304
+ readonly text: v.StringSchema<undefined>;
305
+ }, undefined>, undefined>;
306
+ readonly multiple: v.BooleanSchema<undefined>;
307
+ }, undefined>, undefined>;
308
+ }, undefined>, undefined>;
309
+ readonly votes: v.ArraySchema<v.StrictObjectSchema<{
310
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
311
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
312
+ readonly voter: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
313
+ readonly voterName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
314
+ readonly selected: v.ArraySchema<v.StringSchema<undefined>, undefined>;
315
+ readonly votedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
316
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
317
+ readonly question: v.StringSchema<undefined>;
318
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
319
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
320
+ readonly text: v.StringSchema<undefined>;
321
+ }, undefined>, undefined>;
322
+ readonly multiple: v.BooleanSchema<undefined>;
323
+ }, undefined>, undefined>;
324
+ }, undefined>, undefined>;
325
+ }, undefined>;
326
+ }, undefined>, v.StrictObjectSchema<{
327
+ readonly event: v.LiteralSchema<"message", undefined>;
328
+ readonly message: v.StrictObjectSchema<{
329
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
330
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
331
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
332
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
333
+ readonly fromMe: v.BooleanSchema<undefined>;
334
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
335
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
336
+ readonly text: v.StringSchema<undefined>;
337
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
338
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
339
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
340
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
341
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
342
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
343
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
344
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
345
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
346
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
347
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
348
+ readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
349
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
350
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
351
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
352
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
353
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
354
+ }, undefined>, undefined>;
355
+ }, undefined>, undefined>, undefined>;
356
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
357
+ readonly question: v.StringSchema<undefined>;
358
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
359
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
360
+ readonly text: v.StringSchema<undefined>;
361
+ }, undefined>, undefined>;
362
+ readonly multiple: v.BooleanSchema<undefined>;
363
+ }, undefined>, undefined>;
364
+ }, undefined>;
365
+ }, undefined>, v.StrictObjectSchema<{
366
+ readonly event: v.LiteralSchema<"edit", undefined>;
367
+ readonly message: v.StrictObjectSchema<{
368
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
369
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
370
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
371
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
372
+ readonly fromMe: v.BooleanSchema<undefined>;
373
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
374
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
375
+ readonly text: v.StringSchema<undefined>;
376
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
377
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
378
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
379
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
380
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
381
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
382
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
383
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
384
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
385
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
386
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
387
+ readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
388
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
389
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
390
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
391
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
392
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
393
+ }, undefined>, undefined>;
394
+ }, undefined>, undefined>, undefined>;
395
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
396
+ readonly question: v.StringSchema<undefined>;
397
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
398
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
399
+ readonly text: v.StringSchema<undefined>;
400
+ }, undefined>, undefined>;
401
+ readonly multiple: v.BooleanSchema<undefined>;
402
+ }, undefined>, undefined>;
403
+ }, undefined>;
404
+ }, undefined>, v.StrictObjectSchema<{
405
+ readonly event: v.LiteralSchema<"delete", undefined>;
406
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
407
+ readonly id: v.StringSchema<undefined>;
408
+ }, undefined>, v.StrictObjectSchema<{
409
+ readonly event: v.LiteralSchema<"vote", undefined>;
410
+ readonly vote: v.StrictObjectSchema<{
411
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
412
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
413
+ readonly voter: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
414
+ readonly voterName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
415
+ readonly selected: v.ArraySchema<v.StringSchema<undefined>, undefined>;
416
+ readonly votedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
417
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
418
+ readonly question: v.StringSchema<undefined>;
419
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
420
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
421
+ readonly text: v.StringSchema<undefined>;
422
+ }, undefined>, undefined>;
423
+ readonly multiple: v.BooleanSchema<undefined>;
424
+ }, undefined>, undefined>;
425
+ }, undefined>;
426
+ }, undefined>, v.StrictObjectSchema<{
427
+ readonly event: v.LiteralSchema<"connection", undefined>;
428
+ readonly state: v.PicklistSchema<["connected", "disconnected", "logged_out", "replaced", "banned", "outdated", "stopped"], undefined>;
429
+ }, undefined>], undefined>;
430
+ export declare const engineErrorCode: v.PicklistSchema<["validation_error", "authentication_error", "permission_error", "not_found", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "outcome_unknown"], undefined>;
431
+ /**
432
+ * Why, for the refusals an agent recovers from differently than their code says: another process holds the device
433
+ * (`device.in-use`), WhatsApp handed the login to another connection (`device.replaced`), logged the device out, refuses
434
+ * this version (`client.outdated`), banned the account, or asked it to slow down (`account.rate-limited`, never the
435
+ * engine's own lookup pace). The CLI registers each one (`src/reasons.ts`).
436
+ */
437
+ export declare const engineReason: v.PicklistSchema<["device.in-use", "device.replaced", "device.logged-out", "client.outdated", "account.banned", "account.rate-limited"], undefined>;
438
+ export declare const engineError: v.StrictObjectSchema<{
439
+ readonly code: v.PicklistSchema<["validation_error", "authentication_error", "permission_error", "not_found", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "outcome_unknown"], undefined>;
440
+ readonly message: v.StringSchema<undefined>;
441
+ readonly reason: v.OptionalSchema<v.PicklistSchema<["device.in-use", "device.replaced", "device.logged-out", "client.outdated", "account.banned", "account.rate-limited"], undefined>, undefined>;
442
+ }, undefined>;
443
+ /** The engine's first line: its protocol and the linked account (`self()`), or `null` before a login. */
444
+ export declare const hello: v.StrictObjectSchema<{
445
+ readonly protocol: v.NumberSchema<undefined>;
446
+ readonly engine: v.StringSchema<undefined>;
447
+ readonly version: v.StringSchema<undefined>;
448
+ readonly self: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
449
+ }, undefined>;
450
+ export declare const waAccount: v.StrictObjectSchema<{
451
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
452
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
453
+ }, undefined>;
454
+ export declare const waChatCard: v.StrictObjectSchema<{
455
+ readonly chat: v.StrictObjectSchema<{
456
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
457
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
458
+ readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
459
+ readonly unread: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
460
+ readonly lastMessageAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
461
+ readonly participants: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
462
+ readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
463
+ readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
464
+ }, undefined>;
465
+ readonly members: v.NullableSchema<v.ArraySchema<v.StrictObjectSchema<{
466
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
467
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
468
+ }, undefined>, undefined>, undefined>;
469
+ }, undefined>;
470
+ /**
471
+ * A code to show while linking: `qr` is the text of a QR code to draw, `pair` the eight characters to type on the
472
+ * phone. Either one links the account for as long as it is valid, so it is shown and never stored or logged.
473
+ */
474
+ export declare const loginCode: v.StrictObjectSchema<{
475
+ readonly login: v.PicklistSchema<["qr", "pair"], undefined>;
476
+ readonly code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
477
+ }, undefined>;
478
+ export type WaChat = v.InferOutput<typeof waChat>;
479
+ export type WaContact = v.InferOutput<typeof waContact>;
480
+ export type WaMessage = v.InferOutput<typeof waMessage>;
481
+ export type WaPoll = v.InferOutput<typeof waPoll>;
482
+ export type WaVote = v.InferOutput<typeof waVote>;
483
+ export type WaMediaRef = v.InferOutput<typeof waMediaRef>;
484
+ export type WaAttachment = v.InferOutput<typeof waAttachment>;
485
+ export type WaHistory = v.InferOutput<typeof waHistory>;
486
+ export type EngineEvent = v.InferOutput<typeof engineEvent>;
487
+ export type ConnectionState = v.InferOutput<typeof connectionState>;
488
+ export type EngineErrorCode = v.InferOutput<typeof engineErrorCode>;
489
+ export type EngineReason = v.InferOutput<typeof engineReason>;
490
+ /** The engine's reasons, and the client's own for an engine that ended, before a request or during a write. */
491
+ export type WaReason = EngineReason | "engine.stopped" | "engine.stopped-mid-write";
492
+ export type Hello = v.InferOutput<typeof hello>;
493
+ export type WaAccount = v.InferOutput<typeof waAccount>;
494
+ export type WaChatCard = v.InferOutput<typeof waChatCard>;
495
+ export type LoginCode = v.InferOutput<typeof loginCode>;
496
+ export type WaOlder = v.InferOutput<typeof waOlder>;
497
+ export interface WaLink {
498
+ method: "qr" | "phone";
499
+ /** International format; the phone method only. Sent to the engine on stdin, never as an argument. */
500
+ phone?: string;
501
+ }
502
+ export interface WaSend {
503
+ chat: string;
504
+ text: string;
505
+ /** The message id WhatsApp will carry; a resend with the same id is the same message. */
506
+ id: string;
507
+ replyTo?: string;
508
+ /** The replied-to message as the store holds it; without it, phones show the quote as unavailable. */
509
+ quoted?: WaQuote;
510
+ }
511
+ export interface WaQuote {
512
+ fromMe: boolean;
513
+ sender: string | null;
514
+ text: string;
515
+ }
516
+ /** One file from this machine, sent with `text` as its caption. `kind` is decided as tg decides it. */
517
+ export interface WaSendMedia extends WaSend {
518
+ file: {
519
+ kind: "photo" | "video" | "voice" | "document";
520
+ path: string;
521
+ name: string;
522
+ };
523
+ }
524
+ /** A poll to send; `multiple` lets a voter pick any number of answers, else one. */
525
+ export interface WaNewPoll {
526
+ chat: string;
527
+ id: string;
528
+ question: string;
529
+ answers: string[];
530
+ multiple: boolean;
531
+ }
532
+ /** A stored message sent again, marked forwarded: its text and its one file, by the keys the store holds. */
533
+ export interface WaForward {
534
+ chat: string;
535
+ id: string;
536
+ text: string;
537
+ attachment: WaAttachment | null;
538
+ }
539
+ /**
540
+ * A message the account already has, as WhatsApp addresses one: whatsmeow keeps no messages, so whether it is the
541
+ * account's own and who sent it come from cli-core's store. A wrong key is not refused — WhatsApp drops the reaction
542
+ * or the deletion silently — so the adapter sends one only for a message the store holds.
543
+ */
544
+ export interface WaKey {
545
+ chat: string;
546
+ id: string;
547
+ fromMe: boolean;
548
+ /** Who sent it; in a group, required for someone else's message. */
549
+ sender: string | null;
550
+ }
551
+ /** The most messages one `older` request asks the phone for, as WhatsApp's own clients ask. */
552
+ export declare const OLDER_MAX = 50;
553
+ /** A stored message the phone counts back from: WhatsApp needs its id, whether it is the account's own, and its time. */
554
+ export interface WaAnchor extends WaKey {
555
+ timestamp: string;
556
+ }
557
+ /**
558
+ * A refusal from the engine, already in the closed list of codes. Its message is fixed wording: it never repeats a
559
+ * chat name, a JID or anything typed, since errors reach logs and run records.
560
+ */
561
+ export declare class EngineError extends Error {
562
+ readonly code: EngineErrorCode;
563
+ readonly reason?: WaReason | undefined;
564
+ constructor(code: EngineErrorCode, message: string, reason?: WaReason | undefined);
565
+ }
566
+ /**
567
+ * The engine as the adapter sees it. `GoEngine` runs whatsmeow in a child process; `FakeEngine` serves tests.
568
+ * An event nobody listens for yet is kept and handed to the first listener of its kind, so a history push that
569
+ * comes right after connecting is not lost to a `feed` that started a moment after `watch`.
570
+ */
571
+ export interface WhatsAppEngine extends GroupEngine {
572
+ /**
573
+ * The linked account, from the engine's own store: no request. `null` before a login. Always the user JID in LID
574
+ * form with no device part (`…@lid`, not `…:12@s.whatsapp.net`): the store keys the account by it, so a change of
575
+ * form later would split the account, and the phone form would put a phone number in a stored key.
576
+ */
577
+ self(): string | null;
578
+ /** Resolves once the engine is connected and receiving. */
579
+ ready(signal: AbortSignal): Promise<void>;
580
+ me(): Promise<WaAccount>;
581
+ /** Every chat the engine knows, for resolving a name. */
582
+ directory(): Promise<WaChat[]>;
583
+ chat(jid: string): Promise<WaChatCard>;
584
+ send(request: WaSend): Promise<WaMessage>;
585
+ /** New text for one of the account's own messages; the answer carries the new text and when it changed. */
586
+ edit(key: WaKey, text: string): Promise<WaMessage>;
587
+ /** Deletes a message for everyone: the account's own, or another's in a group the account administers. */
588
+ revoke(key: WaKey): Promise<void>;
589
+ /** The account's reaction on a message; `null` takes it off. */
590
+ react(key: WaKey, emoji: string | null): Promise<void>;
591
+ /** A read receipt for someone else's message; the sender sees it. Only a command that asked for it calls this. */
592
+ markRead(key: WaKey): Promise<void>;
593
+ /** Uploads the file, then sends it; a failed upload sent nothing. */
594
+ sendMedia(request: WaSendMedia): Promise<WaMessage>;
595
+ /** Writes a stored file to `path`, which must not exist yet; the engine creates it readable by this user alone. */
596
+ download(attachment: WaAttachment, path: string): Promise<void>;
597
+ forward(request: WaForward): Promise<WaMessage>;
598
+ createPoll(request: WaNewPoll): Promise<WaMessage>;
599
+ /** The account's vote in a poll, by the answers' texts; none takes it back. Everyone in the chat sees it. */
600
+ vote(key: WaKey, answers: string[]): Promise<void>;
601
+ /**
602
+ * Asks the phone for up to `count` of the chat's messages sent before `anchor`, and waits for its answer. WhatsApp
603
+ * keeps no history on its servers: the phone answers only while it is online, and a phone that does not answer in
604
+ * time is a `timeout`.
605
+ */
606
+ older(anchor: WaAnchor, count: number): Promise<WaOlder>;
607
+ /**
608
+ * Links this device to the account, showing each code through `onCode` until the phone confirms. Answers the
609
+ * account at once when the device is already linked.
610
+ */
611
+ link(request: WaLink, onCode: (code: LoginCode) => void): Promise<WaAccount>;
612
+ logout(): Promise<void>;
613
+ /** Events of the given kinds until the returned function is called. */
614
+ listen(kinds: readonly EngineEvent["event"][], onEvent: (event: EngineEvent) => void): () => void;
615
+ close(): Promise<void>;
616
+ }
617
+ //# sourceMappingURL=contract.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