wowok_agent 1.6.6 → 2.1.8

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.

Potentially problematic release.


This version of wowok_agent might be problematic. Click here for more details.

Files changed (181) hide show
  1. package/README.md +20 -40
  2. package/dist/index.d.ts +13528 -27
  3. package/dist/index.js +1026 -27
  4. package/dist/schema/call/allocation.d.ts +1370 -0
  5. package/dist/schema/call/allocation.js +27 -0
  6. package/dist/schema/call/arbitration.d.ts +1902 -0
  7. package/dist/schema/call/arbitration.js +106 -0
  8. package/dist/schema/call/base.d.ts +6381 -0
  9. package/dist/schema/call/base.js +152 -0
  10. package/dist/schema/call/contact.d.ts +898 -0
  11. package/dist/schema/call/contact.js +41 -0
  12. package/dist/schema/call/demand.d.ts +1193 -0
  13. package/dist/schema/call/demand.js +51 -0
  14. package/dist/schema/call/guard.d.ts +819 -0
  15. package/dist/schema/call/guard.js +67 -0
  16. package/dist/schema/call/handler.d.ts +80 -0
  17. package/dist/schema/call/handler.js +177 -0
  18. package/dist/schema/call/index.d.ts +18 -0
  19. package/dist/schema/call/index.js +19 -0
  20. package/dist/schema/call/machine.d.ts +3906 -0
  21. package/dist/schema/call/machine.js +164 -0
  22. package/dist/schema/call/order.d.ts +994 -0
  23. package/dist/schema/call/order.js +39 -0
  24. package/dist/schema/call/payment.d.ts +408 -0
  25. package/dist/schema/call/payment.js +20 -0
  26. package/dist/schema/call/permission.d.ts +2945 -0
  27. package/dist/schema/call/permission.js +118 -0
  28. package/dist/schema/call/personal.d.ts +1498 -0
  29. package/dist/schema/call/personal.js +81 -0
  30. package/dist/schema/call/progress.d.ts +847 -0
  31. package/dist/schema/call/progress.js +37 -0
  32. package/dist/schema/call/proof.d.ts +328 -0
  33. package/dist/schema/call/proof.js +27 -0
  34. package/dist/schema/call/repository.d.ts +2220 -0
  35. package/dist/schema/call/repository.js +85 -0
  36. package/dist/schema/call/reward.d.ts +1178 -0
  37. package/dist/schema/call/reward.js +46 -0
  38. package/dist/schema/call/service.d.ts +3534 -0
  39. package/dist/schema/call/service.js +87 -0
  40. package/dist/schema/call/treasury.d.ts +2399 -0
  41. package/dist/schema/call/treasury.js +76 -0
  42. package/dist/schema/common/index.d.ts +623 -0
  43. package/dist/schema/common/index.js +331 -0
  44. package/dist/schema/index.d.ts +7 -0
  45. package/dist/schema/index.js +8 -0
  46. package/dist/schema/local/index.d.ts +7824 -0
  47. package/dist/schema/local/index.js +913 -0
  48. package/dist/schema/local/wip.d.ts +781 -0
  49. package/dist/schema/local/wip.js +229 -0
  50. package/dist/schema/messenger/index.d.ts +3624 -0
  51. package/dist/schema/messenger/index.js +407 -0
  52. package/dist/schema/query/index.d.ts +27176 -0
  53. package/dist/schema/query/index.js +1313 -0
  54. package/dist/schema/utils/guard-parser.d.ts +20 -0
  55. package/dist/schema/utils/guard-parser.js +410 -0
  56. package/dist/schema/utils/guard-query-utils.d.ts +5 -0
  57. package/dist/schema/utils/guard-query-utils.js +22 -0
  58. package/dist/schema/utils/node-parser.d.ts +59 -0
  59. package/dist/schema/utils/node-parser.js +382 -0
  60. package/dist/schema/utils/permission-index-utils.d.ts +2 -0
  61. package/dist/schema/utils/permission-index-utils.js +10 -0
  62. package/package.json +31 -49
  63. package/LICENSE +0 -201
  64. package/dist/call/arbitration.d.ts +0 -57
  65. package/dist/call/arbitration.d.ts.map +0 -1
  66. package/dist/call/arbitration.js +0 -245
  67. package/dist/call/arbitration.js.map +0 -1
  68. package/dist/call/base.d.ts +0 -85
  69. package/dist/call/base.d.ts.map +0 -1
  70. package/dist/call/base.js +0 -231
  71. package/dist/call/base.js.map +0 -1
  72. package/dist/call/call.d.ts +0 -95
  73. package/dist/call/call.d.ts.map +0 -1
  74. package/dist/call/call.js +0 -149
  75. package/dist/call/call.js.map +0 -1
  76. package/dist/call/demand.d.ts +0 -46
  77. package/dist/call/demand.d.ts.map +0 -1
  78. package/dist/call/demand.js +0 -201
  79. package/dist/call/demand.js.map +0 -1
  80. package/dist/call/guard.d.ts +0 -53
  81. package/dist/call/guard.d.ts.map +0 -1
  82. package/dist/call/guard.js +0 -386
  83. package/dist/call/guard.js.map +0 -1
  84. package/dist/call/machine.d.ts +0 -97
  85. package/dist/call/machine.d.ts.map +0 -1
  86. package/dist/call/machine.js +0 -342
  87. package/dist/call/machine.js.map +0 -1
  88. package/dist/call/object_permission.d.ts +0 -14
  89. package/dist/call/object_permission.d.ts.map +0 -1
  90. package/dist/call/object_permission.js +0 -59
  91. package/dist/call/object_permission.js.map +0 -1
  92. package/dist/call/permission.d.ts +0 -63
  93. package/dist/call/permission.d.ts.map +0 -1
  94. package/dist/call/permission.js +0 -137
  95. package/dist/call/permission.js.map +0 -1
  96. package/dist/call/personal.d.ts +0 -47
  97. package/dist/call/personal.d.ts.map +0 -1
  98. package/dist/call/personal.js +0 -119
  99. package/dist/call/personal.js.map +0 -1
  100. package/dist/call/repository.d.ts +0 -117
  101. package/dist/call/repository.d.ts.map +0 -1
  102. package/dist/call/repository.js +0 -408
  103. package/dist/call/repository.js.map +0 -1
  104. package/dist/call/service.d.ts +0 -115
  105. package/dist/call/service.d.ts.map +0 -1
  106. package/dist/call/service.js +0 -550
  107. package/dist/call/service.js.map +0 -1
  108. package/dist/call/treasury.d.ts +0 -46
  109. package/dist/call/treasury.d.ts.map +0 -1
  110. package/dist/call/treasury.js +0 -222
  111. package/dist/call/treasury.js.map +0 -1
  112. package/dist/common.d.ts +0 -12
  113. package/dist/common.d.ts.map +0 -1
  114. package/dist/common.js +0 -71
  115. package/dist/common.js.map +0 -1
  116. package/dist/index.d.ts.map +0 -1
  117. package/dist/index.js.map +0 -1
  118. package/dist/local/.d.ts +0 -20
  119. package/dist/local/.d.ts.map +0 -1
  120. package/dist/local/.js +0 -76
  121. package/dist/local/.js.map +0 -1
  122. package/dist/local/account.d.ts +0 -42
  123. package/dist/local/account.d.ts.map +0 -1
  124. package/dist/local/account.js +0 -335
  125. package/dist/local/account.js.map +0 -1
  126. package/dist/local/cache.d.ts +0 -32
  127. package/dist/local/cache.d.ts.map +0 -1
  128. package/dist/local/cache.js +0 -77
  129. package/dist/local/cache.js.map +0 -1
  130. package/dist/local/coin.d.ts +0 -22
  131. package/dist/local/coin.d.ts.map +0 -1
  132. package/dist/local/coin.js +0 -123
  133. package/dist/local/coin.js.map +0 -1
  134. package/dist/local/config.d.ts +0 -20
  135. package/dist/local/config.d.ts.map +0 -1
  136. package/dist/local/config.js +0 -75
  137. package/dist/local/config.js.map +0 -1
  138. package/dist/local/index.d.ts +0 -110
  139. package/dist/local/index.d.ts.map +0 -1
  140. package/dist/local/index.js +0 -122
  141. package/dist/local/index.js.map +0 -1
  142. package/dist/local/local.d.ts +0 -55
  143. package/dist/local/local.d.ts.map +0 -1
  144. package/dist/local/local.js +0 -248
  145. package/dist/local/local.js.map +0 -1
  146. package/dist/query/events.d.ts +0 -65
  147. package/dist/query/events.d.ts.map +0 -1
  148. package/dist/query/events.js +0 -75
  149. package/dist/query/events.js.map +0 -1
  150. package/dist/query/objects.d.ts +0 -346
  151. package/dist/query/objects.d.ts.map +0 -1
  152. package/dist/query/objects.js +0 -472
  153. package/dist/query/objects.js.map +0 -1
  154. package/dist/query/permission.d.ts +0 -15
  155. package/dist/query/permission.d.ts.map +0 -1
  156. package/dist/query/permission.js +0 -45
  157. package/dist/query/permission.js.map +0 -1
  158. package/dist/query/received.d.ts +0 -16
  159. package/dist/query/received.d.ts.map +0 -1
  160. package/dist/query/received.js +0 -16
  161. package/dist/query/received.js.map +0 -1
  162. package/dist/schema/call.d.ts +0 -13005
  163. package/dist/schema/call.d.ts.map +0 -1
  164. package/dist/schema/call.js +0 -997
  165. package/dist/schema/call.js.map +0 -1
  166. package/dist/schema/const.d.ts +0 -254
  167. package/dist/schema/const.d.ts.map +0 -1
  168. package/dist/schema/const.js +0 -305
  169. package/dist/schema/const.js.map +0 -1
  170. package/dist/schema/local.d.ts +0 -702
  171. package/dist/schema/local.d.ts.map +0 -1
  172. package/dist/schema/local.js +0 -150
  173. package/dist/schema/local.js.map +0 -1
  174. package/dist/schema/query.d.ts +0 -1465
  175. package/dist/schema/query.d.ts.map +0 -1
  176. package/dist/schema/query.js +0 -224
  177. package/dist/schema/query.js.map +0 -1
  178. package/dist/schema/util.d.ts +0 -71
  179. package/dist/schema/util.d.ts.map +0 -1
  180. package/dist/schema/util.js +0 -139
  181. package/dist/schema/util.js.map +0 -1
@@ -0,0 +1,407 @@
1
+ import { z } from "zod";
2
+ import { NameOrAddressSchema, EntrypointSchema, ManyAccountOrMark_AddressSchema, AccountOrMark_AddressSchema } from "../common/index.js";
3
+ // ============================================================
4
+ // Messenger Schema Definitions (strictly based on messenger-api.ts and types.ts)
5
+ // ============================================================
6
+ // Enums from types.ts
7
+ export const MessageStatusSchema = z.enum(["pending", "confirmed", "read", "failed", "rejected"]);
8
+ export const MessageDirectionSchema = z.enum(["sent", "received"]);
9
+ export const MessageTypeSchema = z.union([z.literal(1), z.literal(3)]);
10
+ export const MessageContentTypeSchema = z.enum(["text", "zip", "wts", "wip"]);
11
+ export const MessageTimeFieldSchema = z.enum(["createdAt", "receivedAt", "serverTimestamp"]);
12
+ export const RangeTypeSchema = z.enum(["time", "messageId", "seqIndex"]);
13
+ // ZipMetadata
14
+ export const ZipMetadataSchema = z.object({
15
+ fileName: z.string().describe("ZIP filename"),
16
+ fileSize: z.number().describe("File size in bytes"),
17
+ fileHash: z.string().describe("File SHA256 hash"),
18
+ contentType: MessageContentTypeSchema.describe("Content type"),
19
+ localCachePath: z.string().optional().describe("Local cache path"),
20
+ downloadedAt: z.number().optional().describe("Download timestamp"),
21
+ }).describe("ZIP file metadata");
22
+ // Message
23
+ export const MessageSchema = z.object({
24
+ messageId: z.string().describe("Message ID"),
25
+ fromAddress: z.string().describe("Sender address"),
26
+ toAddress: z.string().describe("Recipient address"),
27
+ plaintextHash: z.string().describe("Plaintext hash"),
28
+ plaintext: z.string().optional().describe("Decrypted plaintext (optional)"),
29
+ guardAddress: z.string().optional().describe("Guard address"),
30
+ passportAddress: z.string().optional().describe("Passport address"),
31
+ lastReceivedLeafIndex: z.number().optional().describe("Last received leaf index"),
32
+ direction: MessageDirectionSchema.describe("Message direction"),
33
+ status: MessageStatusSchema.describe("Message status"),
34
+ msgType: MessageTypeSchema.describe("Message type"),
35
+ leafIndex: z.number().optional().describe("Leaf index"),
36
+ prevRoot: z.string().optional().describe("Previous Merkle Root"),
37
+ newRoot: z.string().optional().describe("Current Merkle Root"),
38
+ serverSignature: z.string().optional().describe("Server signature"),
39
+ serverTimestamp: z.number().optional().describe("Server confirmation timestamp"),
40
+ serverPublicKey: z.string().optional().describe("Server public key"),
41
+ arkConfirmed: z.object({
42
+ recipient: z.string().describe("Recipient address"),
43
+ recipientPublicKey: z.string().describe("Recipient public key"),
44
+ signature: z.string().describe("Recipient signature"),
45
+ timestamp: z.number().describe("ARK confirmation time"),
46
+ }).optional().describe("ARK confirmation"),
47
+ createdAt: z.number().describe("Message creation time (client)"),
48
+ receivedAt: z.number().optional().describe("Local reception time"),
49
+ zipMetadata: ZipMetadataSchema.optional().describe("ZIP file metadata"),
50
+ proof: z.string().optional().describe("On-chain proof object address"),
51
+ }).describe("Message object");
52
+ // ConversationInfo
53
+ export const ConversationInfoSchema = z.object({
54
+ peerAddress: z.string().describe("Peer address"),
55
+ lastMessageAt: z.number().describe("Last message time"),
56
+ messageCount: z.number().describe("Total message count"),
57
+ unreadCount: z.number().describe("Unread message count"),
58
+ lastMessagePreview: z.string().optional().describe("Last message preview"),
59
+ }).describe("Conversation info");
60
+ // MessageFilter
61
+ export const MessageFilterSchema = z.object({
62
+ direction: MessageDirectionSchema.optional().describe("Filter by message direction"),
63
+ status: MessageStatusSchema.optional().describe("Filter by message status"),
64
+ peerAddress: AccountOrMark_AddressSchema.optional().describe("Filter by peer address"),
65
+ msgType: MessageTypeSchema.optional().describe("Filter by message type"),
66
+ contentType: MessageContentTypeSchema.optional().describe("Filter by content type"),
67
+ decryptedOnly: z.boolean().optional().describe("Only return decrypted messages"),
68
+ confirmedOnly: z.boolean().optional().describe("Only return confirmed messages"),
69
+ keyword: z.string().optional().describe("Search keyword in plaintext"),
70
+ sortOrder: z.enum(["asc", "desc"]).optional().describe("Sort order: asc or desc"),
71
+ limit: z.number().optional().describe("Return limit"),
72
+ offset: z.number().optional().describe("Pagination offset"),
73
+ timeField: MessageTimeFieldSchema.optional().describe("Time field for time filtering"),
74
+ startTime: z.number().optional().describe("Start timestamp (ms)"),
75
+ endTime: z.number().optional().describe("End timestamp (ms)"),
76
+ createdAtStart: z.number().optional().describe("Created at start time"),
77
+ createdAtEnd: z.number().optional().describe("Created at end time"),
78
+ receivedAtStart: z.number().optional().describe("Received at start time"),
79
+ receivedAtEnd: z.number().optional().describe("Received at end time"),
80
+ serverTimestampStart: z.number().optional().describe("Server timestamp start time"),
81
+ serverTimestampEnd: z.number().optional().describe("Server timestamp end time"),
82
+ arkConfirmedOnly: z.boolean().optional().describe("Only return ARK confirmed messages"),
83
+ arkTimestampStart: z.number().optional().describe("ARK timestamp start"),
84
+ arkTimestampEnd: z.number().optional().describe("ARK timestamp end"),
85
+ proofedOnly: z.boolean().optional().describe("Only return messages with proof"),
86
+ hasLastReceivedIndexOnly: z.boolean().optional().describe("Only return messages with lastReceivedLeafIndex"),
87
+ lastReceivedIndexMin: z.number().optional().describe("Min lastReceivedLeafIndex"),
88
+ lastReceivedIndexMax: z.number().optional().describe("Max lastReceivedLeafIndex"),
89
+ listFilterMode: z.enum(["friends", "guard", "stranger", "any"]).optional().describe("List filter mode"),
90
+ customListFilter: z.object({
91
+ includeAddresses: z.array(z.string()).optional().describe("Include addresses"),
92
+ excludeAddresses: z.array(z.string()).optional().describe("Exclude addresses"),
93
+ relation: z.enum(["union", "intersection"]).optional().describe("Address list relation"),
94
+ }).optional().describe("Custom list filter"),
95
+ account: NameOrAddressSchema.optional().describe("Account to filter messages for"),
96
+ }).describe("Message filter options");
97
+ // SendMessageOptions
98
+ export const SendMessageOptionsSchema = z.object({
99
+ guardAddress: NameOrAddressSchema.optional().describe("Guard address"),
100
+ passportAddress: NameOrAddressSchema.optional().describe("Passport address"),
101
+ force: z.boolean().optional().describe("Force send even if there are pending Guard messages"),
102
+ new_messenger_name: z.string().optional().describe("New messenger name for recipient"),
103
+ }).describe("Send message options");
104
+ // SendFileOptions
105
+ export const SendFileOptionsSchema = z.object({
106
+ fileName: z.string().optional().describe("Custom file name"),
107
+ contentType: z.enum(["wts", "wip", "zip"]).optional().describe("Content type hint"),
108
+ guardAddress: NameOrAddressSchema.optional().describe("Guard address"),
109
+ passportAddress: NameOrAddressSchema.optional().describe("Passport address"),
110
+ force: z.boolean().optional().describe("Force send even if there are pending Guard messages"),
111
+ new_messenger_name: z.string().optional().describe("New messenger name for recipient"),
112
+ }).describe("Send file options");
113
+ // SendMessageResult
114
+ export const SendMessageResultSchema = z.object({
115
+ messageId: z.string().describe("Message ID"),
116
+ status: MessageStatusSchema.describe("Message status"),
117
+ merkleData: z.object({
118
+ leafIndex: z.number().describe("Leaf index"),
119
+ prevRoot: z.string().describe("Previous Merkle Root"),
120
+ newRoot: z.string().describe("Current Merkle Root"),
121
+ serverSignature: z.string().describe("Server signature"),
122
+ serverTimestamp: z.number().describe("Server confirmation timestamp"),
123
+ serverPublicKey: z.string().describe("Server public key"),
124
+ }).optional().describe("Merkle Tree proof data"),
125
+ guardList: z.array(z.string()).optional().describe("Guard list (only returned on error)"),
126
+ }).describe("Send message result");
127
+ // WTS Range Types
128
+ const BaseRangeSchema = z.object({
129
+ type: RangeTypeSchema.describe("Range type"),
130
+ start: z.union([z.number(), z.string()]).describe("Start value"),
131
+ end: z.union([z.number(), z.string()]).describe("End value"),
132
+ });
133
+ export const TimeRangeSchema = BaseRangeSchema.extend({
134
+ type: z.literal("time"),
135
+ start: z.number(),
136
+ end: z.number(),
137
+ });
138
+ export const MessageIdRangeSchema = BaseRangeSchema.extend({
139
+ type: z.literal("messageId"),
140
+ start: z.string(),
141
+ end: z.string(),
142
+ });
143
+ export const SeqIndexRangeSchema = BaseRangeSchema.extend({
144
+ type: z.literal("seqIndex"),
145
+ start: z.number(),
146
+ end: z.number(),
147
+ });
148
+ export const WtsRangeSchema = z.discriminatedUnion("type", [
149
+ TimeRangeSchema,
150
+ MessageIdRangeSchema,
151
+ SeqIndexRangeSchema,
152
+ ]).describe("WTS range filter parameters");
153
+ // WtsGenerationParams
154
+ export const WtsGenerationParamsSchema = z.object({
155
+ myAccount: NameOrAddressSchema.describe("My account name or address"),
156
+ peerAccount: NameOrAddressSchema.describe("Peer account or address"),
157
+ range: WtsRangeSchema.optional().describe("Range filter parameters"),
158
+ excludePlaintext: z.boolean().optional().describe("Whether to exclude plaintext"),
159
+ outputDir: z.string().describe("Output directory path"),
160
+ }).describe("WTS generation parameters");
161
+ // WtsFileResult
162
+ export const WtsFileResultSchema = z.object({
163
+ files: z.array(z.string()).describe("Generated WTS file paths"),
164
+ totalMessageCount: z.number().describe("Total message count"),
165
+ timeRange: z.object({
166
+ start: z.number().describe("Start time"),
167
+ end: z.number().describe("End time"),
168
+ }).describe("Time range"),
169
+ }).describe("WTS file result");
170
+ // WtsVerificationResult
171
+ export const WtsSignatureVerificationSchema = z.object({
172
+ publicKey: z.string().describe("Signer public key"),
173
+ address: z.string().optional().describe("Signer address"),
174
+ valid: z.boolean().describe("Whether signature is valid"),
175
+ }).describe("WTS signature verification details");
176
+ export const WtsVerificationResultSchema = z.object({
177
+ valid: z.boolean().describe("Whether verification succeeded"),
178
+ error: z.string().optional().describe("Error message if verification failed"),
179
+ hashValid: z.boolean().optional().describe("Whether hash validation passed"),
180
+ hasSignature: z.boolean().optional().describe("Whether WTS has signatures"),
181
+ signatureValid: z.boolean().optional().describe("Whether signature validation passed"),
182
+ signatures: z.array(WtsSignatureVerificationSchema).optional().describe("Signature verification details"),
183
+ }).describe("WTS verification result");
184
+ // WtsToHtmlOptions
185
+ export const WtsToHtmlOptionsSchema = z.object({
186
+ title: z.string().optional().describe("HTML document title"),
187
+ theme: z.enum(["light", "dark"]).optional().describe("HTML theme"),
188
+ outputPath: z.string().optional().describe("Output file path"),
189
+ }).describe("WTS to HTML conversion options");
190
+ // List Operation Response
191
+ export const AddressExistenceSchema = z.object({
192
+ address: z.string().describe("Address"),
193
+ exists: z.boolean().describe("Whether address exists in list"),
194
+ }).describe("Address existence check result");
195
+ export const GuardListItemSchema = z.object({
196
+ guardAddress: z.string().describe("Guard address"),
197
+ passportValiditySeconds: z.number().describe("Passport validity in seconds"),
198
+ }).describe("Guard list item");
199
+ export const ListOperationResponseSchema = z.object({
200
+ success: z.boolean().describe("Whether operation succeeded"),
201
+ operation: z.string().describe("Operation performed"),
202
+ modifiedCount: z.number().describe("Number of items modified"),
203
+ currentCount: z.number().describe("Current list size"),
204
+ maxCount: z.number().describe("Maximum list size"),
205
+ invalidAddresses: z.array(z.string()).optional().describe("Invalid addresses"),
206
+ existResults: z.array(AddressExistenceSchema).optional().describe("Existence check results"),
207
+ message: z.string().optional().describe("Operation message"),
208
+ currentList: z.array(z.string()).optional().describe("Current list content"),
209
+ currentGuardList: z.array(GuardListItemSchema).optional().describe("Current guard list content"),
210
+ }).describe("List operation response");
211
+ // Blacklist Operations
212
+ export const BlacklistOperationSchema = z.discriminatedUnion("op", [
213
+ z.object({
214
+ op: z.literal("add"),
215
+ users: ManyAccountOrMark_AddressSchema.describe("Users to add to blacklist"),
216
+ }),
217
+ z.object({
218
+ op: z.literal("remove"),
219
+ users: ManyAccountOrMark_AddressSchema.describe("Users to remove from blacklist"),
220
+ }),
221
+ z.object({
222
+ op: z.literal("clear"),
223
+ }),
224
+ z.object({
225
+ op: z.literal("get"),
226
+ }),
227
+ z.object({
228
+ op: z.literal("exist"),
229
+ users: ManyAccountOrMark_AddressSchema.describe("Users to check existence"),
230
+ }),
231
+ ]).describe("Blacklist management operation");
232
+ // Friendslist Operations
233
+ export const FriendslistOperationSchema = z.discriminatedUnion("op", [
234
+ z.object({
235
+ op: z.literal("add"),
236
+ users: ManyAccountOrMark_AddressSchema.describe("Users to add to friends list"),
237
+ }),
238
+ z.object({
239
+ op: z.literal("remove"),
240
+ users: ManyAccountOrMark_AddressSchema.describe("Users to remove from friends list"),
241
+ }),
242
+ z.object({
243
+ op: z.literal("clear"),
244
+ }),
245
+ z.object({
246
+ op: z.literal("get"),
247
+ }),
248
+ z.object({
249
+ op: z.literal("exist"),
250
+ users: ManyAccountOrMark_AddressSchema.describe("Users to check existence"),
251
+ }),
252
+ ]).describe("Friends list management operation");
253
+ // Guardlist Operations
254
+ export const GuardParamSchema = z.object({
255
+ guard: NameOrAddressSchema.describe("Guard address or name"),
256
+ passportValiditySeconds: z.number().min(10).max(315360000).describe("Passport validity in seconds (10s to 10 years)"),
257
+ }).describe("Guard parameter");
258
+ export const GuardlistOperationSchema = z.discriminatedUnion("op", [
259
+ z.object({
260
+ op: z.literal("add"),
261
+ guards: z.array(GuardParamSchema).min(1).max(10).describe("Guards to add to guard list"),
262
+ }),
263
+ z.object({
264
+ op: z.literal("remove"),
265
+ guards: z.array(NameOrAddressSchema).min(1).max(10).describe("Guard addresses to remove from guard list"),
266
+ }),
267
+ z.object({
268
+ op: z.literal("get"),
269
+ }),
270
+ ]).describe("Guard list management operation");
271
+ // ============================================================
272
+ // Input Schema (Discriminated Union by "operation")
273
+ // ============================================================
274
+ export const MessengerOperationInputSchema = z.discriminatedUnion("operation", [
275
+ z.object({
276
+ operation: z.literal("watch_conversations"),
277
+ account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
278
+ }),
279
+ z.object({
280
+ operation: z.literal("send_message"),
281
+ from: NameOrAddressSchema.optional().describe("Sender account name or address. If not specified, uses default account"),
282
+ to: AccountOrMark_AddressSchema.describe("Recipient address or account name"),
283
+ content: z.string().max(10000).describe("Message content text"),
284
+ options: SendMessageOptionsSchema.optional().describe("Optional message settings"),
285
+ }),
286
+ z.object({
287
+ operation: z.literal("send_file"),
288
+ from: NameOrAddressSchema.optional().describe("Sender account name or address. If not specified, uses default account"),
289
+ to: AccountOrMark_AddressSchema.describe("Recipient address or account name"),
290
+ filePath: z.string().describe("Local file path to send. File will be compressed as ZIP before sending"),
291
+ options: SendFileOptionsSchema.optional().describe("Optional file sending settings"),
292
+ }),
293
+ z.object({
294
+ operation: z.literal("watch_messages"),
295
+ filter: MessageFilterSchema.optional().describe("Message filter options"),
296
+ }),
297
+ z.object({
298
+ operation: z.literal("extract_zip_messages"),
299
+ account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
300
+ messages: z.array(z.union([z.string(), MessageSchema])).describe("Array of message objects or message IDs to extract"),
301
+ outputDir: z.string().describe("Output directory path for extracted files"),
302
+ }),
303
+ z.object({
304
+ operation: z.literal("generate_wts"),
305
+ params: WtsGenerationParamsSchema.describe("WTS generation parameters"),
306
+ }),
307
+ z.object({
308
+ operation: z.literal("verify_wts"),
309
+ wtsFilePath: z.string().describe("WTS file path to verify"),
310
+ }),
311
+ z.object({
312
+ operation: z.literal("sign_wts"),
313
+ wtsFilePath: z.string().describe("WTS file path to sign"),
314
+ account: NameOrAddressSchema.optional().describe("Account name or address to sign with. If not specified, uses default account"),
315
+ outputPath: z.string().optional().describe("Output file path. If not specified, saves to signed_*.wts"),
316
+ }),
317
+ z.object({
318
+ operation: z.literal("wts2html"),
319
+ wtsPath: z.string().describe("WTS file path or directory to convert"),
320
+ options: WtsToHtmlOptionsSchema.optional().describe("Conversion options"),
321
+ }),
322
+ z.object({
323
+ operation: z.literal("proof_message"),
324
+ account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
325
+ messageId: z.string().describe("Message ID to proof on-chain"),
326
+ network: EntrypointSchema.optional().describe("Network to use for on-chain proof"),
327
+ }),
328
+ z.object({
329
+ operation: z.literal("blacklist"),
330
+ account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
331
+ blacklist: BlacklistOperationSchema.describe("Blacklist management operation"),
332
+ }),
333
+ z.object({
334
+ operation: z.literal("friendslist"),
335
+ account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
336
+ friendslist: FriendslistOperationSchema.describe("Friends list management operation"),
337
+ }),
338
+ z.object({
339
+ operation: z.literal("guardlist"),
340
+ account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
341
+ guardlist: GuardlistOperationSchema.describe("Guard list management operation"),
342
+ }),
343
+ ]).describe("Messenger operation input schema");
344
+ // ============================================================
345
+ // Output Schema (Discriminated Union by "operation")
346
+ // ============================================================
347
+ export const MessengerOperationOutputSchema = z.object({
348
+ result: z.discriminatedUnion("operation", [
349
+ z.object({
350
+ operation: z.literal("watch_conversations"),
351
+ result: z.array(ConversationInfoSchema).describe("List of conversations"),
352
+ }),
353
+ z.object({
354
+ operation: z.literal("send_message"),
355
+ result: SendMessageResultSchema.describe("Send message result"),
356
+ }),
357
+ z.object({
358
+ operation: z.literal("send_file"),
359
+ result: SendMessageResultSchema.describe("Send file result"),
360
+ }),
361
+ z.object({
362
+ operation: z.literal("watch_messages"),
363
+ result: z.array(MessageSchema).describe("List of messages"),
364
+ }),
365
+ z.object({
366
+ operation: z.literal("extract_zip_messages"),
367
+ result: z.array(z.string()).describe("Extracted file paths"),
368
+ }),
369
+ z.object({
370
+ operation: z.literal("generate_wts"),
371
+ result: WtsFileResultSchema.describe("Generate WTS result"),
372
+ }),
373
+ z.object({
374
+ operation: z.literal("verify_wts"),
375
+ result: WtsVerificationResultSchema.describe("WTS verification result"),
376
+ }),
377
+ z.object({
378
+ operation: z.literal("sign_wts"),
379
+ result: z.string().describe("Signed WTS file path"),
380
+ }),
381
+ z.object({
382
+ operation: z.literal("wts2html"),
383
+ result: z.union([z.string(), z.array(z.string())]).describe("HTML string or file path(s)"),
384
+ }),
385
+ z.object({
386
+ operation: z.literal("proof_message"),
387
+ result: z.object({
388
+ proofAddress: z.string().describe("Proof object address on blockchain"),
389
+ }).describe("Proof message result"),
390
+ }),
391
+ z.object({
392
+ operation: z.literal("blacklist"),
393
+ op: z.enum(["add", "remove", "clear", "get", "exist"]).describe("Operation type"),
394
+ result: z.union([ListOperationResponseSchema, z.array(z.string())]).describe("Blacklist operation result"),
395
+ }),
396
+ z.object({
397
+ operation: z.literal("friendslist"),
398
+ op: z.enum(["add", "remove", "clear", "get", "exist"]).describe("Operation type"),
399
+ result: z.union([ListOperationResponseSchema, z.array(z.string())]).describe("Friends list operation result"),
400
+ }),
401
+ z.object({
402
+ operation: z.literal("guardlist"),
403
+ op: z.enum(["add", "remove", "get"]).describe("Operation type"),
404
+ result: ListOperationResponseSchema.describe("Guard list operation result"),
405
+ }),
406
+ ]).describe("Messenger operation output schema")
407
+ });