wowok_agent 2.1.40 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1237 -1
- package/dist/schema/call/allocation.js +24 -1
- package/dist/schema/call/arbitration.js +92 -1
- package/dist/schema/call/base.js +134 -1
- package/dist/schema/call/contact.js +37 -1
- package/dist/schema/call/demand.js +47 -1
- package/dist/schema/call/guard.js +58 -1
- package/dist/schema/call/handler.js +171 -1
- package/dist/schema/call/index.js +18 -1
- package/dist/schema/call/machine.js +152 -1
- package/dist/schema/call/order.js +34 -1
- package/dist/schema/call/payment.js +17 -1
- package/dist/schema/call/permission.js +105 -1
- package/dist/schema/call/personal.js +68 -1
- package/dist/schema/call/progress.js +26 -1
- package/dist/schema/call/proof.js +27 -1
- package/dist/schema/call/repository.js +76 -1
- package/dist/schema/call/reward.js +42 -1
- package/dist/schema/call/service.js +82 -1
- package/dist/schema/call/treasury.js +71 -1
- package/dist/schema/common/index.js +345 -1
- package/dist/schema/index.js +7 -1
- package/dist/schema/local/index.js +855 -1
- package/dist/schema/local/wip.js +187 -1
- package/dist/schema/messenger/index.js +446 -1
- package/dist/schema/query/index.js +1265 -1
- package/dist/schema/utils/guard-parser.js +401 -1
- package/dist/schema/utils/guard-query-utils.js +22 -1
- package/dist/schema/utils/node-parser.js +353 -1
- package/dist/schema/utils/permission-index-utils.js +7 -1
- package/package.json +3 -6
|
@@ -1 +1,446 @@
|
|
|
1
|
-
import{z}from'zod';import{NameOrAddressSchema,EntrypointSchema,AccountOrMark_AddressAISchema,ManyAccountOrMark_AddressAISchema}from'../common/index.js';export const MessageStatusSchema=z['enum'](['pending','confirmed','read','failed','rejected','decrypted','decrypt_failed']);export const MessageDirectionSchema=z['enum'](['sent','received']);export const MessageTypeSchema=z['union']([z['literal'](0x1),z['literal'](0x3)]);export const MessageContentTypeSchema=z['enum'](['text','zip','wts','wip']);export const MessageTimeFieldSchema=z['enum'](['createdAt','receivedAt','serverTimestamp']);export const RangeTypeSchema=z['enum'](['time','messageId','seqIndex']);export const ZipMetadataSchema=z['object']({'fileName':z['string']()['describe']('ZIP\x20filename'),'fileSize':z['number']()['describe']('File\x20size\x20in\x20bytes'),'fileHash':z['string']()['describe']('File\x20SHA256\x20hash'),'contentType':MessageContentTypeSchema['describe']('Content\x20type'),'localCachePath':z['string']()['optional']()['describe']('Local\x20cache\x20path'),'downloadedAt':z['number']()['optional']()['describe']('Download\x20timestamp')})['describe']('ZIP\x20file\x20metadata');export const MessageSchema=z['object']({'messageId':z['string']()['describe']('Message\x20ID'),'fromAddress':z['string']()['describe']('Sender\x20address'),'toAddress':z['string']()['describe']('Recipient\x20address'),'plaintextHash':z['string']()['describe']('Plaintext\x20hash'),'plaintext':z['string']()['optional']()['describe']('Decrypted\x20plaintext\x20(optional)'),'guardAddress':z['string']()['optional']()['describe']('Guard\x20address'),'passportAddress':z['string']()['optional']()['describe']('Passport\x20address'),'lastReceivedLeafIndex':z['number']()['optional']()['describe']('Last\x20received\x20leaf\x20index'),'direction':MessageDirectionSchema['describe']('Message\x20direction'),'status':MessageStatusSchema['describe']('Message\x20status'),'msgType':MessageTypeSchema['describe']('Message\x20type'),'leafIndex':z['number']()['optional']()['describe']('Leaf\x20index'),'prevRoot':z['string']()['optional']()['describe']('Previous\x20Merkle\x20Root'),'newRoot':z['string']()['optional']()['describe']('Current\x20Merkle\x20Root'),'serverSignature':z['string']()['optional']()['describe']('Server\x20signature'),'serverTimestamp':z['number']()['optional']()['describe']('Server\x20confirmation\x20timestamp'),'serverPublicKey':z['string']()['optional']()['describe']('Server\x20public\x20key'),'arkConfirmed':z['object']({'recipient':z['string']()['describe']('Recipient\x20address'),'recipientPublicKey':z['string']()['describe']('Recipient\x20public\x20key'),'signature':z['string']()['describe']('Recipient\x20signature'),'timestamp':z['number']()['describe']('ARK\x20confirmation\x20time')})['optional']()['describe']('ARK\x20confirmation'),'createdAt':z['number']()['describe']('Message\x20creation\x20time\x20(client)'),'receivedAt':z['number']()['optional']()['describe']('Local\x20reception\x20time'),'zipMetadata':ZipMetadataSchema['optional']()['describe']('ZIP\x20file\x20metadata'),'proof':z['string']()['optional']()['describe']('On-chain\x20proof\x20object\x20address'),'decryptError':z['string']()['optional']()['describe']('Decryption\x20failure\x20reason'),'decryptAttempts':z['number']()['optional']()['describe']('Number\x20of\x20decryption\x20attempts'),'lastDecryptAttemptAt':z['number']()['optional']()['describe']('Last\x20decryption\x20attempt\x20timestamp'),'viewedAt':z['number']()['optional']()['describe']('Timestamp\x20when\x20the\x20current\x20user\x20viewed\x20this\x20message\x20(local\x20storage).\x20If\x20present,\x20indicates\x20the\x20message\x20has\x20been\x20viewed\x20by\x20the\x20user.\x20Only\x20applicable\x20to\x20received\x20messages\x20(direction\x20===\x20\x27received\x27)')})['describe']('Message\x20object');export const ConversationInfoSchema=z['object']({'peerAddress':z['string']()['describe']('Peer\x20address'),'lastMessageAt':z['number']()['describe']('Last\x20message\x20time'),'messageCount':z['number']()['describe']('Total\x20message\x20count'),'unreadCount':z['number']()['describe']('Unread\x20message\x20count\x20-\x20count\x20of\x20received\x20messages\x20that\x20have\x20not\x20been\x20viewed\x20(viewedAt\x20is\x20undefined)'),'lastMessagePreview':z['string']()['optional']()['describe']('Last\x20message\x20preview\x20text'),'previewMessages':z['array'](MessageSchema)['optional']()['describe']('Preview\x20messages\x20for\x20this\x20conversation\x20(default\x202\x20messages,\x20sorted\x20by\x20time\x20descending)')})['describe']('Conversation\x20info\x20with\x20unread\x20count\x20and\x20preview\x20messages');export const ConversationsFilterSchema=z['object']({'account':z['string']()['optional']()['describe']('Account\x20name\x20or\x20address\x20to\x20query\x20conversations\x20for.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'unreadOnly':z['boolean']()['optional']()['describe']('If\x20true,\x20only\x20return\x20conversations\x20with\x20unread\x20messages\x20(unreadCount\x20>\x200).\x20Useful\x20for\x20quickly\x20finding\x20conversations\x20needing\x20attention'),'startTime':z['number']()['optional']()['describe']('Start\x20timestamp\x20(ms)\x20for\x20filtering\x20conversations\x20by\x20lastMessageAt.\x20Only\x20returns\x20conversations\x20where\x20lastMessageAt\x20>=\x20this\x20value'),'endTime':z['number']()['optional']()['describe']('End\x20timestamp\x20(ms)\x20for\x20filtering\x20conversations\x20by\x20lastMessageAt.\x20Only\x20returns\x20conversations\x20where\x20lastMessageAt\x20<=\x20this\x20value'),'previewMessageCount':z['number']()['optional']()['describe']('Number\x20of\x20preview\x20messages\x20to\x20include\x20for\x20each\x20conversation\x20(default:\x202).\x20Set\x20to\x200\x20to\x20disable\x20preview\x20messages.\x20If\x20>\x200,\x20preview\x20messages\x20are\x20automatically\x20included'),'sortBy':z['enum'](['lastMessageAt','unreadCount','messageCount'])['optional']()['describe']('Sort\x20conversations\x20by:\x20\x27lastMessageAt\x27\x20=\x20most\x20recent\x20activity\x20first,\x20\x27unreadCount\x27\x20=\x20most\x20unread\x20messages\x20first,\x20\x27messageCount\x27\x20=\x20most\x20total\x20messages\x20first'),'sortOrder':z['enum'](['asc','desc'])['optional']()['describe']('Sort\x20order:\x20\x27asc\x27\x20=\x20ascending\x20(oldest/smallest\x20first),\x20\x27desc\x27\x20=\x20descending\x20(newest/largest\x20first).\x20Default\x20is\x20\x27desc\x27\x20for\x20time-based\x20sorting'),'skipAutoMarkViewed':z['boolean']()['optional']()['describe']('If\x20true,\x20preview\x20messages\x20will\x20NOT\x20be\x20automatically\x20marked\x20as\x20viewed\x20when\x20retrieved.\x20Default\x20is\x20false,\x20meaning\x20preview\x20messages\x20are\x20auto-marked\x20as\x20viewed')})['describe']('Conversations\x20filter\x20options\x20-\x20use\x20unreadOnly\x20to\x20quickly\x20find\x20active\x20conversations,\x20and\x20previewMessageCount\x20to\x20control\x20how\x20many\x20recent\x20messages\x20are\x20included');export const MessageFilterSchema=z['object']({'account':z['string']()['optional']()['describe']('Account\x20to\x20filter\x20messages\x20for'),'direction':MessageDirectionSchema['optional']()['describe']('Filter\x20by\x20message\x20direction'),'status':MessageStatusSchema['optional']()['describe']('Filter\x20by\x20message\x20status'),'peerAddress':AccountOrMark_AddressAISchema['optional']()['describe']('Filter\x20by\x20peer\x20address\x20-\x20can\x20be\x20a\x20string\x20(name/address)\x20or\x20full\x20object'),'msgType':MessageTypeSchema['optional']()['describe']('Filter\x20by\x20message\x20type'),'contentType':MessageContentTypeSchema['optional']()['describe']('Filter\x20by\x20content\x20type'),'decryptedOnly':z['boolean']()['optional']()['describe']('Only\x20return\x20decrypted\x20messages'),'confirmedOnly':z['boolean']()['optional']()['describe']('Only\x20return\x20confirmed\x20messages'),'keyword':z['string']()['optional']()['describe']('Search\x20keyword\x20in\x20plaintext'),'sortOrder':z['enum'](['asc','desc'])['optional']()['describe']('Sort\x20order:\x20asc\x20or\x20desc'),'limit':z['number']()['optional']()['describe']('Return\x20limit'),'offset':z['number']()['optional']()['describe']('Pagination\x20offset'),'timeField':MessageTimeFieldSchema['optional']()['describe']('Time\x20field\x20for\x20time\x20filtering'),'startTime':z['number']()['optional']()['describe']('Start\x20timestamp\x20(ms)'),'endTime':z['number']()['optional']()['describe']('End\x20timestamp\x20(ms)'),'createdAtStart':z['number']()['optional']()['describe']('Created\x20at\x20start\x20time'),'createdAtEnd':z['number']()['optional']()['describe']('Created\x20at\x20end\x20time'),'receivedAtStart':z['number']()['optional']()['describe']('Received\x20at\x20start\x20time'),'receivedAtEnd':z['number']()['optional']()['describe']('Received\x20at\x20end\x20time'),'serverTimestampStart':z['number']()['optional']()['describe']('Server\x20timestamp\x20start\x20time'),'serverTimestampEnd':z['number']()['optional']()['describe']('Server\x20timestamp\x20end\x20time'),'arkConfirmedOnly':z['boolean']()['optional']()['describe']('Only\x20return\x20ARK\x20confirmed\x20messages'),'arkTimestampStart':z['number']()['optional']()['describe']('ARK\x20timestamp\x20start'),'arkTimestampEnd':z['number']()['optional']()['describe']('ARK\x20timestamp\x20end'),'proofedOnly':z['boolean']()['optional']()['describe']('Only\x20return\x20messages\x20with\x20proof'),'hasLastReceivedIndexOnly':z['boolean']()['optional']()['describe']('Only\x20return\x20messages\x20with\x20lastReceivedLeafIndex'),'lastReceivedIndexMin':z['number']()['optional']()['describe']('Min\x20lastReceivedLeafIndex'),'lastReceivedIndexMax':z['number']()['optional']()['describe']('Max\x20lastReceivedLeafIndex'),'listFilterMode':z['enum'](['friends','guard','stranger','any'])['optional']()['describe']('List\x20filter\x20mode:\x20\x27friends\x27\x20=\x20only\x20messages\x20from\x20friends\x20list,\x20\x27guard\x27\x20=\x20only\x20messages\x20from\x20Guard\x20list,\x20\x27stranger\x27\x20=\x20only\x20messages\x20from\x20strangers\x20(not\x20in\x20friends/guard\x20lists),\x20\x27any\x27\x20=\x20no\x20filtering\x20(default)'),'customListFilter':z['object']({'includeAddresses':z['array'](z['string']())['optional']()['describe']('Include\x20addresses\x20-\x20only\x20return\x20messages\x20from\x20these\x20addresses\x20(highest\x20priority)'),'excludeAddresses':z['array'](z['string']())['optional']()['describe']('Exclude\x20addresses\x20-\x20exclude\x20messages\x20from\x20these\x20addresses'),'relation':z['enum'](['union','intersection'])['optional']()['describe']('Address\x20list\x20relation:\x20\x27union\x27\x20=\x20combine\x20lists\x20as\x20union,\x20\x27intersection\x27\x20=\x20combine\x20lists\x20as\x20intersection')})['optional']()['describe']('Custom\x20list\x20filter\x20for\x20advanced\x20address-based\x20filtering,\x20works\x20in\x20combination\x20with\x20listFilterMode'),'viewed':z['boolean']()['optional']()['describe']('Filter\x20by\x20viewed\x20status:\x20true\x20=\x20only\x20viewed\x20messages,\x20false\x20=\x20only\x20unviewed\x20messages.\x20A\x20message\x20is\x20considered\x20\x27viewed\x27\x20if\x20viewedAt\x20field\x20exists.\x20Only\x20applicable\x20to\x20received\x20messages'),'viewedAtStart':z['number']()['optional']()['describe']('Filter\x20by\x20viewed\x20timestamp\x20start\x20(inclusive).\x20Only\x20returns\x20messages\x20where\x20viewedAt\x20>=\x20this\x20value.\x20Useful\x20for\x20finding\x20recently\x20viewed\x20messages'),'viewedAtEnd':z['number']()['optional']()['describe']('Filter\x20by\x20viewed\x20timestamp\x20end\x20(inclusive).\x20Only\x20returns\x20messages\x20where\x20viewedAt\x20<=\x20this\x20value.\x20Useful\x20for\x20finding\x20messages\x20viewed\x20before\x20a\x20certain\x20time'),'skipAutoMarkViewed':z['boolean']()['optional']()['describe']('If\x20true,\x20messages\x20returned\x20by\x20this\x20query\x20will\x20NOT\x20be\x20automatically\x20marked\x20as\x20viewed.\x20Default\x20is\x20false,\x20meaning\x20messages\x20are\x20auto-marked\x20as\x20viewed\x20when\x20retrieved\x20through\x20watch_messages')})['describe']('Message\x20filter\x20options\x20-\x20all\x20conditions\x20are\x20optional\x20and\x20combined\x20with\x20AND\x20logic.\x20Use\x20viewed\x20field\x20to\x20filter\x20by\x20read/unread\x20status,\x20and\x20viewedAtStart/viewedAtEnd\x20to\x20filter\x20by\x20when\x20messages\x20were\x20viewed');export const SendMessageOptionsSchema=z['object']({'guardAddress':NameOrAddressSchema['optional']()['describe']('Guard\x20address'),'passportAddress':NameOrAddressSchema['optional']()['describe']('Passport\x20address'),'force':z['boolean']()['optional']()['describe']('Force\x20send\x20even\x20if\x20there\x20are\x20pending\x20Guard\x20messages'),'new_messenger_name':z['string']()['optional']()['describe']('New\x20messenger\x20name\x20for\x20recipient')})['describe']('Send\x20message\x20options');export const SendFileOptionsSchema=z['object']({'fileName':z['string']()['optional']()['describe']('Custom\x20file\x20name'),'contentType':z['enum'](['wts','wip','zip'])['optional']()['describe']('Content\x20type\x20hint'),'guardAddress':NameOrAddressSchema['optional']()['describe']('Guard\x20address'),'passportAddress':NameOrAddressSchema['optional']()['describe']('Passport\x20address'),'force':z['boolean']()['optional']()['describe']('Force\x20send\x20even\x20if\x20there\x20are\x20pending\x20Guard\x20messages'),'new_messenger_name':z['string']()['optional']()['describe']('New\x20messenger\x20name\x20for\x20recipient')})['describe']('Send\x20file\x20options');export const SendMessageResultSchema=z['object']({'messageId':z['string']()['describe']('Message\x20ID'),'status':MessageStatusSchema['describe']('Message\x20status'),'merkleData':z['object']({'leafIndex':z['number']()['describe']('Leaf\x20index'),'prevRoot':z['string']()['describe']('Previous\x20Merkle\x20Root'),'newRoot':z['string']()['describe']('Current\x20Merkle\x20Root'),'serverSignature':z['string']()['describe']('Server\x20signature'),'serverTimestamp':z['number']()['describe']('Server\x20confirmation\x20timestamp'),'serverPublicKey':z['string']()['describe']('Server\x20public\x20key')})['optional']()['describe']('Merkle\x20Tree\x20proof\x20data'),'guardList':z['array'](z['string']())['optional']()['describe']('Guard\x20list\x20(only\x20returned\x20on\x20error)'),'lastReceivedLeafIndex':z['number']()['optional']()['describe']('Last\x20received\x20leaf\x20index\x20(for\x20message\x20confirmation)')})['describe']('Send\x20message\x20result');const BaseRangeSchema=z['object']({'type':RangeTypeSchema['describe']('Range\x20type'),'start':z['union']([z['number'](),z['string']()])['describe']('Start\x20value'),'end':z['union']([z['number'](),z['string']()])['describe']('End\x20value')});export const TimeRangeSchema=BaseRangeSchema['extend']({'type':z['literal']('time'),'start':z['number'](),'end':z['number']()});export const MessageIdRangeSchema=BaseRangeSchema['extend']({'type':z['literal']('messageId'),'start':z['string'](),'end':z['string']()});export const SeqIndexRangeSchema=BaseRangeSchema['extend']({'type':z['literal']('seqIndex'),'start':z['number'](),'end':z['number']()});export const WtsRangeSchema=z['discriminatedUnion']('type',[TimeRangeSchema,MessageIdRangeSchema,SeqIndexRangeSchema])['describe']('WTS\x20range\x20filter\x20parameters');export const WtsGenerationParamsSchema=z['object']({'myAccount':NameOrAddressSchema['describe']('My\x20account\x20name\x20or\x20address\x20(string)'),'peerAccount':AccountOrMark_AddressAISchema['describe']('Peer\x20account\x20name\x20or\x20address\x20-\x20can\x20be\x20a\x20string\x20(name/address)\x20or\x20full\x20object'),'range':WtsRangeSchema['optional']()['describe']('Range\x20filter\x20parameters'),'excludePlaintext':z['boolean']()['optional']()['describe']('Whether\x20to\x20exclude\x20plaintext'),'outputDir':z['string']()['describe']('Output\x20directory\x20path')})['describe']('WTS\x20generation\x20parameters');export const WtsFileResultSchema=z['object']({'files':z['array'](z['string']())['describe']('Generated\x20WTS\x20file\x20paths'),'totalMessageCount':z['number']()['describe']('Total\x20message\x20count'),'timeRange':z['object']({'start':z['number']()['describe']('Start\x20time'),'end':z['number']()['describe']('End\x20time')})['describe']('Time\x20range')})['describe']('WTS\x20file\x20result');export const WtsSignatureVerificationSchema=z['object']({'publicKey':z['string']()['describe']('Signer\x20public\x20key'),'address':z['string']()['optional']()['describe']('Signer\x20address'),'valid':z['boolean']()['describe']('Whether\x20signature\x20is\x20valid')})['describe']('WTS\x20signature\x20verification\x20details');export const WtsVerificationResultSchema=z['object']({'valid':z['boolean']()['describe']('Whether\x20verification\x20succeeded'),'error':z['string']()['optional']()['describe']('Error\x20message\x20if\x20verification\x20failed'),'hashValid':z['boolean']()['optional']()['describe']('Whether\x20hash\x20validation\x20passed'),'hasSignature':z['boolean']()['optional']()['describe']('Whether\x20WTS\x20has\x20signatures'),'signatureValid':z['boolean']()['optional']()['describe']('Whether\x20signature\x20validation\x20passed'),'signatures':z['array'](WtsSignatureVerificationSchema)['optional']()['describe']('Signature\x20verification\x20details')})['describe']('WTS\x20verification\x20result');export const WtsToHtmlOptionsSchema=z['object']({'title':z['string']()['optional']()['describe']('HTML\x20document\x20title'),'theme':z['enum'](['light','dark'])['optional']()['describe']('HTML\x20theme'),'outputPath':z['string']()['optional']()['describe']('Output\x20file\x20path')})['describe']('WTS\x20to\x20HTML\x20conversion\x20options');export const AddressExistenceSchema=z['object']({'address':z['string']()['describe']('Address'),'exists':z['boolean']()['describe']('Whether\x20address\x20exists\x20in\x20list')})['describe']('Address\x20existence\x20check\x20result');export const GuardListItemSchema=z['object']({'guardAddress':z['string']()['describe']('Guard\x20address'),'passportValiditySeconds':z['number']()['describe']('Passport\x20validity\x20in\x20seconds')})['describe']('Guard\x20list\x20item');export const ListOperationResponseSchema=z['object']({'success':z['boolean']()['describe']('Whether\x20operation\x20succeeded'),'operation':z['string']()['describe']('Operation\x20performed'),'modifiedCount':z['number']()['describe']('Number\x20of\x20items\x20modified'),'currentCount':z['number']()['describe']('Current\x20list\x20size'),'maxCount':z['number']()['describe']('Maximum\x20list\x20size'),'invalidAddresses':z['array'](z['string']())['optional']()['nullable']()['describe']('Invalid\x20addresses'),'existResults':z['array'](AddressExistenceSchema)['optional']()['nullable']()['describe']('Existence\x20check\x20results'),'message':z['string']()['optional']()['nullable']()['describe']('Operation\x20message'),'currentList':z['array'](z['string']())['optional']()['nullable']()['describe']('Current\x20list\x20content'),'currentGuardList':z['array'](GuardListItemSchema)['optional']()['nullable']()['describe']('Current\x20guard\x20list\x20content')})['describe']('List\x20operation\x20response');export const BlacklistOperationSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add'),'users':ManyAccountOrMark_AddressAISchema['describe']('Users\x20to\x20add\x20to\x20blacklist\x20-\x20can\x20be\x20array\x20of\x20strings\x20(names/addresses)\x20or\x20full\x20object')}),z['object']({'op':z['literal']('remove'),'users':ManyAccountOrMark_AddressAISchema['describe']('Users\x20to\x20remove\x20from\x20blacklist\x20-\x20can\x20be\x20array\x20of\x20strings\x20(names/addresses)\x20or\x20full\x20object')}),z['object']({'op':z['literal']('clear')}),z['object']({'op':z['literal']('get')}),z['object']({'op':z['literal']('exist'),'users':ManyAccountOrMark_AddressAISchema['describe']('Users\x20to\x20check\x20existence\x20-\x20can\x20be\x20array\x20of\x20strings\x20(names/addresses)\x20or\x20full\x20object')})])['describe']('Blacklist\x20management\x20operation');export const FriendslistOperationSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add'),'users':ManyAccountOrMark_AddressAISchema['describe']('Users\x20to\x20add\x20to\x20friends\x20list\x20-\x20can\x20be\x20array\x20of\x20strings\x20(names/addresses)\x20or\x20full\x20object')}),z['object']({'op':z['literal']('remove'),'users':ManyAccountOrMark_AddressAISchema['describe']('Users\x20to\x20remove\x20from\x20friends\x20list\x20-\x20can\x20be\x20array\x20of\x20strings\x20(names/addresses)\x20or\x20full\x20object')}),z['object']({'op':z['literal']('clear')}),z['object']({'op':z['literal']('get')}),z['object']({'op':z['literal']('exist'),'users':ManyAccountOrMark_AddressAISchema['describe']('Users\x20to\x20check\x20existence\x20-\x20can\x20be\x20array\x20of\x20strings\x20(names/addresses)\x20or\x20full\x20object')})])['describe']('Friends\x20list\x20management\x20operation');export const GuardParamSchema=z['object']({'guard':NameOrAddressSchema['describe']('Guard\x20address\x20or\x20name'),'passportValiditySeconds':z['number']()['min'](0xa)['max'](0x12cc0300)['describe']('Passport\x20validity\x20in\x20seconds\x20(10s\x20to\x2010\x20years)')})['describe']('Guard\x20parameter');export const GuardlistOperationSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add'),'guards':z['array'](GuardParamSchema)['min'](0x1)['max'](0xa)['describe']('Guards\x20to\x20add\x20to\x20guard\x20list')}),z['object']({'op':z['literal']('remove'),'guards':z['array'](NameOrAddressSchema)['min'](0x1)['max'](0xa)['describe']('Guard\x20addresses\x20to\x20remove\x20from\x20guard\x20list')}),z['object']({'op':z['literal']('get')})])['describe']('Guard\x20list\x20management\x20operation');export const SettingsOperationSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('get')}),z['object']({'op':z['literal']('set'),'allowStrangerMessages':z['boolean']()['optional']()['describe']('Allow\x20messages\x20from\x20strangers'),'maxInboxSize':z['number']()['min'](0x1)['optional']()['describe']('Maximum\x20inbox\x20size')})])['describe']('Settings\x20management\x20operation');export const GetSettingsResponseSchema=z['object']({'allowStrangerMessages':z['boolean']()['optional']()['describe']('Whether\x20messages\x20from\x20strangers\x20are\x20allowed'),'maxInboxSize':z['number']()['optional']()['describe']('Current\x20maximum\x20inbox\x20size'),'minUserInboxSize':z['number']()['describe']('Server\x20minimum\x20allowed\x20inbox\x20size\x20limit'),'maxUserInboxSize':z['number']()['describe']('Server\x20maximum\x20allowed\x20inbox\x20size\x20limit'),'defaultAllowStrangerMessages':z['boolean']()['describe']('Server\x20default\x20setting\x20for\x20allowing\x20stranger\x20messages')})['describe']('Get\x20settings\x20response');export const MessengerOperationInputSchema=z['discriminatedUnion']('operation',[z['object']({'operation':z['literal']('watch_conversations'),'filter':ConversationsFilterSchema['optional']()['describe']('Conversations\x20filter\x20options\x20-\x20use\x20unreadOnly\x20to\x20find\x20conversations\x20with\x20unread\x20messages,\x20previewMessageCount\x20to\x20control\x20message\x20previews\x20(default\x202),\x20and\x20sortBy/sortOrder\x20to\x20customize\x20sorting')}),z['object']({'operation':z['literal']('send_message'),'from':NameOrAddressSchema['optional']()['describe']('Sender\x20account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'to':AccountOrMark_AddressAISchema['describe']('Recipient\x20address\x20or\x20account\x20name\x20-\x20can\x20be\x20a\x20string\x20(name/address)\x20or\x20full\x20object'),'content':z['string']()['max'](0x2710)['describe']('Message\x20content\x20text'),'options':SendMessageOptionsSchema['optional']()['describe']('Optional\x20message\x20settings')}),z['object']({'operation':z['literal']('send_file'),'from':NameOrAddressSchema['optional']()['describe']('Sender\x20account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'to':AccountOrMark_AddressAISchema['describe']('Recipient\x20address\x20or\x20account\x20name\x20-\x20can\x20be\x20a\x20string\x20(name/address)\x20or\x20full\x20object'),'filePath':z['string']()['describe']('Local\x20file\x20path\x20to\x20send.\x20File\x20will\x20be\x20compressed\x20as\x20ZIP\x20before\x20sending'),'options':SendFileOptionsSchema['optional']()['describe']('Optional\x20file\x20sending\x20settings')}),z['object']({'operation':z['literal']('watch_messages'),'filter':MessageFilterSchema['optional']()['describe']('Message\x20filter\x20options')}),z['object']({'operation':z['literal']('extract_zip_messages'),'account':NameOrAddressSchema['optional']()['describe']('Account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'messages':z['array'](z['union']([z['string'](),MessageSchema]))['describe']('Array\x20of\x20message\x20objects\x20or\x20message\x20IDs\x20to\x20extract'),'outputDir':z['string']()['describe']('Output\x20directory\x20path\x20for\x20extracted\x20files')}),z['object']({'operation':z['literal']('generate_wts'),'params':WtsGenerationParamsSchema['describe']('WTS\x20generation\x20parameters')}),z['object']({'operation':z['literal']('verify_wts'),'wtsFilePath':z['string']()['describe']('WTS\x20file\x20path\x20to\x20verify')}),z['object']({'operation':z['literal']('sign_wts'),'wtsFilePath':z['string']()['describe']('WTS\x20file\x20path\x20to\x20sign'),'account':NameOrAddressSchema['optional']()['describe']('Account\x20name\x20or\x20address\x20to\x20sign\x20with.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'outputPath':z['string']()['optional']()['describe']('Output\x20file\x20path.\x20If\x20not\x20specified,\x20saves\x20to\x20signed_*.wts')}),z['object']({'operation':z['literal']('wts2html'),'wtsPath':z['string']()['describe']('WTS\x20file\x20path\x20or\x20directory\x20to\x20convert'),'options':WtsToHtmlOptionsSchema['optional']()['describe']('Conversion\x20options')}),z['object']({'operation':z['literal']('proof_message'),'account':NameOrAddressSchema['optional']()['describe']('Account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'messageId':z['string']()['describe']('Message\x20ID\x20to\x20proof\x20on-chain'),'network':EntrypointSchema['optional']()['describe']('Network\x20to\x20use\x20for\x20on-chain\x20proof')}),z['object']({'operation':z['literal']('blacklist'),'account':NameOrAddressSchema['optional']()['describe']('Account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'blacklist':BlacklistOperationSchema['describe']('Blacklist\x20management\x20operation')}),z['object']({'operation':z['literal']('friendslist'),'account':NameOrAddressSchema['optional']()['describe']('Account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'friendslist':FriendslistOperationSchema['describe']('Friends\x20list\x20management\x20operation')}),z['object']({'operation':z['literal']('guardlist'),'account':NameOrAddressSchema['optional']()['describe']('Account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'guardlist':GuardlistOperationSchema['describe']('Guard\x20list\x20management\x20operation')}),z['object']({'operation':z['literal']('settings'),'account':NameOrAddressSchema['optional']()['describe']('Account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'settings':SettingsOperationSchema['describe']('Settings\x20management\x20operation')}),z['object']({'operation':z['literal']('mark_messages_as_viewed'),'account':NameOrAddressSchema['optional']()['describe']('Account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'messageIds':z['array'](z['string']())['min'](0x1)['max'](0x3e8)['describe']('Array\x20of\x20message\x20IDs\x20to\x20mark\x20as\x20viewed\x20(1-1000\x20messages).\x20Only\x20messages\x20belonging\x20to\x20this\x20account\x20will\x20be\x20marked')}),z['object']({'operation':z['literal']('mark_conversation_as_viewed'),'account':NameOrAddressSchema['optional']()['describe']('Account\x20name\x20or\x20address.\x20If\x20not\x20specified,\x20uses\x20default\x20account'),'peerAddress':AccountOrMark_AddressAISchema['describe']('Peer\x20address\x20or\x20account\x20name\x20-\x20can\x20be\x20a\x20string\x20(name/address)\x20or\x20full\x20object.\x20All\x20unviewed\x20received\x20messages\x20from\x20this\x20peer\x20will\x20be\x20marked\x20as\x20viewed')})])['describe']('Messenger\x20operation\x20input\x20schema');export const MessengerOperationOutputSchema=z['object']({'result':z['discriminatedUnion']('operation',[z['object']({'operation':z['literal']('watch_conversations'),'result':z['array'](ConversationInfoSchema)['describe']('List\x20of\x20conversations')}),z['object']({'operation':z['literal']('send_message'),'result':SendMessageResultSchema['describe']('Send\x20message\x20result')}),z['object']({'operation':z['literal']('send_file'),'result':SendMessageResultSchema['describe']('Send\x20file\x20result')}),z['object']({'operation':z['literal']('watch_messages'),'result':z['array'](MessageSchema)['describe']('List\x20of\x20messages')}),z['object']({'operation':z['literal']('extract_zip_messages'),'result':z['array'](z['string']())['describe']('Extracted\x20file\x20paths')}),z['object']({'operation':z['literal']('generate_wts'),'result':WtsFileResultSchema['describe']('Generate\x20WTS\x20result')}),z['object']({'operation':z['literal']('verify_wts'),'result':WtsVerificationResultSchema['describe']('WTS\x20verification\x20result')}),z['object']({'operation':z['literal']('sign_wts'),'result':z['string']()['describe']('Signed\x20WTS\x20file\x20path')}),z['object']({'operation':z['literal']('wts2html'),'result':z['union']([z['string'](),z['array'](z['string']())])['describe']('HTML\x20string\x20or\x20file\x20path(s)')}),z['object']({'operation':z['literal']('proof_message'),'result':z['object']({'proofAddress':z['string']()['describe']('Proof\x20object\x20address\x20on\x20blockchain')})['describe']('Proof\x20message\x20result')}),z['object']({'operation':z['literal']('blacklist'),'op':z['enum'](['add','remove','clear','get','exist'])['describe']('Operation\x20type'),'result':z['union']([ListOperationResponseSchema,z['array'](z['string']())])['describe']('Blacklist\x20operation\x20result')}),z['object']({'operation':z['literal']('friendslist'),'op':z['enum'](['add','remove','clear','get','exist'])['describe']('Operation\x20type'),'result':z['union']([ListOperationResponseSchema,z['array'](z['string']())])['describe']('Friends\x20list\x20operation\x20result')}),z['object']({'operation':z['literal']('guardlist'),'op':z['enum'](['add','remove','get'])['describe']('Operation\x20type'),'result':ListOperationResponseSchema['describe']('Guard\x20list\x20operation\x20result')}),z['object']({'operation':z['literal']('settings'),'op':z['enum'](['get','set'])['describe']('Operation\x20type'),'result':z['union']([GetSettingsResponseSchema,z['boolean']()])['describe']('Settings\x20operation\x20result\x20-\x20GetSettingsResponse\x20for\x20\x27get\x27\x20operation,\x20boolean\x20for\x20\x27set\x27\x20operation')}),z['object']({'operation':z['literal']('mark_messages_as_viewed'),'result':z['number']()['describe']('Number\x20of\x20messages\x20successfully\x20marked\x20as\x20viewed.\x20Only\x20messages\x20that\x20were\x20previously\x20unviewed\x20are\x20counted')}),z['object']({'operation':z['literal']('mark_conversation_as_viewed'),'result':z['number']()['describe']('Number\x20of\x20messages\x20successfully\x20marked\x20as\x20viewed\x20in\x20the\x20conversation.\x20Only\x20received\x20messages\x20that\x20were\x20previously\x20unviewed\x20are\x20counted')})])['describe']('Messenger\x20operation\x20result\x20discriminated\x20union')})['describe']('Messenger\x20operation\x20output\x20schema');
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { NameOrAddressSchema, EntrypointSchema, AccountOrMark_AddressAISchema, ManyAccountOrMark_AddressAISchema } from "../common/index.js";
|
|
3
|
+
export const MessageStatusSchema = z.enum(["pending", "confirmed", "read", "failed", "rejected", "decrypted", "decrypt_failed"]);
|
|
4
|
+
export const MessageDirectionSchema = z.enum(["sent", "received"]);
|
|
5
|
+
export const MessageTypeSchema = z.union([z.literal(1), z.literal(3)]);
|
|
6
|
+
export const MessageContentTypeSchema = z.enum(["text", "zip", "wts", "wip"]);
|
|
7
|
+
export const MessageTimeFieldSchema = z.enum(["createdAt", "receivedAt", "serverTimestamp"]);
|
|
8
|
+
export const RangeTypeSchema = z.enum(["time", "messageId", "seqIndex"]);
|
|
9
|
+
export const ZipMetadataSchema = z.object({
|
|
10
|
+
fileName: z.string().describe("ZIP filename"),
|
|
11
|
+
fileSize: z.number().describe("File size in bytes"),
|
|
12
|
+
fileHash: z.string().describe("File SHA256 hash"),
|
|
13
|
+
contentType: MessageContentTypeSchema.describe("Content type"),
|
|
14
|
+
localCachePath: z.string().optional().describe("Local cache path"),
|
|
15
|
+
downloadedAt: z.number().optional().describe("Download timestamp"),
|
|
16
|
+
}).describe("ZIP file metadata");
|
|
17
|
+
export const MessageSchema = z.object({
|
|
18
|
+
messageId: z.string().describe("Message ID"),
|
|
19
|
+
fromAddress: z.string().describe("Sender address"),
|
|
20
|
+
toAddress: z.string().describe("Recipient address"),
|
|
21
|
+
plaintextHash: z.string().describe("Plaintext hash"),
|
|
22
|
+
plaintext: z.string().optional().describe("Decrypted plaintext (optional)"),
|
|
23
|
+
guardAddress: z.string().optional().describe("Guard address"),
|
|
24
|
+
passportAddress: z.string().optional().describe("Passport address"),
|
|
25
|
+
lastReceivedLeafIndex: z.number().optional().describe("Last received leaf index"),
|
|
26
|
+
direction: MessageDirectionSchema.describe("Message direction"),
|
|
27
|
+
status: MessageStatusSchema.describe("Message status"),
|
|
28
|
+
msgType: MessageTypeSchema.describe("Message type"),
|
|
29
|
+
leafIndex: z.number().optional().describe("Leaf index"),
|
|
30
|
+
prevRoot: z.string().optional().describe("Previous Merkle Root"),
|
|
31
|
+
newRoot: z.string().optional().describe("Current Merkle Root"),
|
|
32
|
+
serverSignature: z.string().optional().describe("Server signature"),
|
|
33
|
+
serverTimestamp: z.number().optional().describe("Server confirmation timestamp"),
|
|
34
|
+
serverPublicKey: z.string().optional().describe("Server public key"),
|
|
35
|
+
arkConfirmed: z.object({
|
|
36
|
+
recipient: z.string().describe("Recipient address"),
|
|
37
|
+
recipientPublicKey: z.string().describe("Recipient public key"),
|
|
38
|
+
signature: z.string().describe("Recipient signature"),
|
|
39
|
+
timestamp: z.number().describe("ARK confirmation time"),
|
|
40
|
+
}).optional().describe("ARK confirmation"),
|
|
41
|
+
createdAt: z.number().describe("Message creation time (client)"),
|
|
42
|
+
receivedAt: z.number().optional().describe("Local reception time"),
|
|
43
|
+
zipMetadata: ZipMetadataSchema.optional().describe("ZIP file metadata"),
|
|
44
|
+
proof: z.string().optional().describe("On-chain proof object address"),
|
|
45
|
+
decryptError: z.string().optional().describe("Decryption failure reason"),
|
|
46
|
+
decryptAttempts: z.number().optional().describe("Number of decryption attempts"),
|
|
47
|
+
lastDecryptAttemptAt: z.number().optional().describe("Last decryption attempt timestamp"),
|
|
48
|
+
viewedAt: z.number().optional().describe("Timestamp when the current user viewed this message (local storage). If present, indicates the message has been viewed by the user. Only applicable to received messages (direction === 'received')"),
|
|
49
|
+
}).describe("Message object");
|
|
50
|
+
export const ConversationInfoSchema = z.object({
|
|
51
|
+
peerAddress: z.string().describe("Peer address"),
|
|
52
|
+
lastMessageAt: z.number().describe("Last message time"),
|
|
53
|
+
messageCount: z.number().describe("Total message count"),
|
|
54
|
+
unreadCount: z.number().describe("Unread message count - count of received messages that have not been viewed (viewedAt is undefined)"),
|
|
55
|
+
lastMessagePreview: z.string().optional().describe("Last message preview text"),
|
|
56
|
+
previewMessages: z.array(MessageSchema).optional().describe("Preview messages for this conversation (default 2 messages, sorted by time descending)"),
|
|
57
|
+
}).describe("Conversation info with unread count and preview messages");
|
|
58
|
+
export const ConversationsFilterSchema = z.object({
|
|
59
|
+
account: z.string().optional().describe("Account name or address to query conversations for. If not specified, uses default account"),
|
|
60
|
+
unreadOnly: z.boolean().optional().describe("If true, only return conversations with unread messages (unreadCount > 0). Useful for quickly finding conversations needing attention"),
|
|
61
|
+
startTime: z.number().optional().describe("Start timestamp (ms) for filtering conversations by lastMessageAt. Only returns conversations where lastMessageAt >= this value"),
|
|
62
|
+
endTime: z.number().optional().describe("End timestamp (ms) for filtering conversations by lastMessageAt. Only returns conversations where lastMessageAt <= this value"),
|
|
63
|
+
previewMessageCount: z.number().optional().describe("Number of preview messages to include for each conversation (default: 2). Set to 0 to disable preview messages. If > 0, preview messages are automatically included"),
|
|
64
|
+
sortBy: z.enum(["lastMessageAt", "unreadCount", "messageCount"]).optional().describe("Sort conversations by: 'lastMessageAt' = most recent activity first, 'unreadCount' = most unread messages first, 'messageCount' = most total messages first"),
|
|
65
|
+
sortOrder: z.enum(["asc", "desc"]).optional().describe("Sort order: 'asc' = ascending (oldest/smallest first), 'desc' = descending (newest/largest first). Default is 'desc' for time-based sorting"),
|
|
66
|
+
skipAutoMarkViewed: z.boolean().optional().describe("If true, preview messages will NOT be automatically marked as viewed when retrieved. Default is false, meaning preview messages are auto-marked as viewed"),
|
|
67
|
+
}).describe("Conversations filter options - use unreadOnly to quickly find active conversations, and previewMessageCount to control how many recent messages are included");
|
|
68
|
+
export const MessageFilterSchema = z.object({
|
|
69
|
+
account: z.string().optional().describe("Account to filter messages for"),
|
|
70
|
+
direction: MessageDirectionSchema.optional().describe("Filter by message direction"),
|
|
71
|
+
status: MessageStatusSchema.optional().describe("Filter by message status"),
|
|
72
|
+
peerAddress: AccountOrMark_AddressAISchema.optional().describe("Filter by peer address - can be a string (name/address) or full object"),
|
|
73
|
+
msgType: MessageTypeSchema.optional().describe("Filter by message type"),
|
|
74
|
+
contentType: MessageContentTypeSchema.optional().describe("Filter by content type"),
|
|
75
|
+
decryptedOnly: z.boolean().optional().describe("Only return decrypted messages"),
|
|
76
|
+
confirmedOnly: z.boolean().optional().describe("Only return confirmed messages"),
|
|
77
|
+
keyword: z.string().optional().describe("Search keyword in plaintext"),
|
|
78
|
+
sortOrder: z.enum(["asc", "desc"]).optional().describe("Sort order: asc or desc"),
|
|
79
|
+
limit: z.number().optional().describe("Return limit"),
|
|
80
|
+
offset: z.number().optional().describe("Pagination offset"),
|
|
81
|
+
timeField: MessageTimeFieldSchema.optional().describe("Time field for time filtering"),
|
|
82
|
+
startTime: z.number().optional().describe("Start timestamp (ms)"),
|
|
83
|
+
endTime: z.number().optional().describe("End timestamp (ms)"),
|
|
84
|
+
createdAtStart: z.number().optional().describe("Created at start time"),
|
|
85
|
+
createdAtEnd: z.number().optional().describe("Created at end time"),
|
|
86
|
+
receivedAtStart: z.number().optional().describe("Received at start time"),
|
|
87
|
+
receivedAtEnd: z.number().optional().describe("Received at end time"),
|
|
88
|
+
serverTimestampStart: z.number().optional().describe("Server timestamp start time"),
|
|
89
|
+
serverTimestampEnd: z.number().optional().describe("Server timestamp end time"),
|
|
90
|
+
arkConfirmedOnly: z.boolean().optional().describe("Only return ARK confirmed messages"),
|
|
91
|
+
arkTimestampStart: z.number().optional().describe("ARK timestamp start"),
|
|
92
|
+
arkTimestampEnd: z.number().optional().describe("ARK timestamp end"),
|
|
93
|
+
proofedOnly: z.boolean().optional().describe("Only return messages with proof"),
|
|
94
|
+
hasLastReceivedIndexOnly: z.boolean().optional().describe("Only return messages with lastReceivedLeafIndex"),
|
|
95
|
+
lastReceivedIndexMin: z.number().optional().describe("Min lastReceivedLeafIndex"),
|
|
96
|
+
lastReceivedIndexMax: z.number().optional().describe("Max lastReceivedLeafIndex"),
|
|
97
|
+
listFilterMode: z.enum(["friends", "guard", "stranger", "any"]).optional().describe("List filter mode: 'friends' = only messages from friends list, 'guard' = only messages from Guard list, 'stranger' = only messages from strangers (not in friends/guard lists), 'any' = no filtering (default)"),
|
|
98
|
+
customListFilter: z.object({
|
|
99
|
+
includeAddresses: z.array(z.string()).optional().describe("Include addresses - only return messages from these addresses (highest priority)"),
|
|
100
|
+
excludeAddresses: z.array(z.string()).optional().describe("Exclude addresses - exclude messages from these addresses"),
|
|
101
|
+
relation: z.enum(["union", "intersection"]).optional().describe("Address list relation: 'union' = combine lists as union, 'intersection' = combine lists as intersection"),
|
|
102
|
+
}).optional().describe("Custom list filter for advanced address-based filtering, works in combination with listFilterMode"),
|
|
103
|
+
viewed: z.boolean().optional().describe("Filter by viewed status: true = only viewed messages, false = only unviewed messages. A message is considered 'viewed' if viewedAt field exists. Only applicable to received messages"),
|
|
104
|
+
viewedAtStart: z.number().optional().describe("Filter by viewed timestamp start (inclusive). Only returns messages where viewedAt >= this value. Useful for finding recently viewed messages"),
|
|
105
|
+
viewedAtEnd: z.number().optional().describe("Filter by viewed timestamp end (inclusive). Only returns messages where viewedAt <= this value. Useful for finding messages viewed before a certain time"),
|
|
106
|
+
skipAutoMarkViewed: z.boolean().optional().describe("If true, messages returned by this query will NOT be automatically marked as viewed. Default is false, meaning messages are auto-marked as viewed when retrieved through watch_messages"),
|
|
107
|
+
}).describe("Message filter options - all conditions are optional and combined with AND logic. Use viewed field to filter by read/unread status, and viewedAtStart/viewedAtEnd to filter by when messages were viewed");
|
|
108
|
+
export const SendMessageOptionsSchema = z.object({
|
|
109
|
+
guardAddress: NameOrAddressSchema.optional().describe("Guard address"),
|
|
110
|
+
passportAddress: NameOrAddressSchema.optional().describe("Passport address"),
|
|
111
|
+
force: z.boolean().optional().describe("Force send even if there are pending Guard messages"),
|
|
112
|
+
new_messenger_name: z.string().optional().describe("New messenger name for recipient"),
|
|
113
|
+
}).describe("Send message options");
|
|
114
|
+
export const SendFileOptionsSchema = z.object({
|
|
115
|
+
fileName: z.string().optional().describe("Custom file name"),
|
|
116
|
+
contentType: z.enum(["wts", "wip", "zip"]).optional().describe("Content type hint"),
|
|
117
|
+
guardAddress: NameOrAddressSchema.optional().describe("Guard address"),
|
|
118
|
+
passportAddress: NameOrAddressSchema.optional().describe("Passport address"),
|
|
119
|
+
force: z.boolean().optional().describe("Force send even if there are pending Guard messages"),
|
|
120
|
+
new_messenger_name: z.string().optional().describe("New messenger name for recipient"),
|
|
121
|
+
}).describe("Send file options");
|
|
122
|
+
export const SendMessageResultSchema = z.object({
|
|
123
|
+
messageId: z.string().describe("Message ID"),
|
|
124
|
+
status: MessageStatusSchema.describe("Message status"),
|
|
125
|
+
merkleData: z.object({
|
|
126
|
+
leafIndex: z.number().describe("Leaf index"),
|
|
127
|
+
prevRoot: z.string().describe("Previous Merkle Root"),
|
|
128
|
+
newRoot: z.string().describe("Current Merkle Root"),
|
|
129
|
+
serverSignature: z.string().describe("Server signature"),
|
|
130
|
+
serverTimestamp: z.number().describe("Server confirmation timestamp"),
|
|
131
|
+
serverPublicKey: z.string().describe("Server public key"),
|
|
132
|
+
}).optional().describe("Merkle Tree proof data"),
|
|
133
|
+
guardList: z.array(z.string()).optional().describe("Guard list (only returned on error)"),
|
|
134
|
+
lastReceivedLeafIndex: z.number().optional().describe("Last received leaf index (for message confirmation)"),
|
|
135
|
+
}).describe("Send message result");
|
|
136
|
+
const BaseRangeSchema = z.object({
|
|
137
|
+
type: RangeTypeSchema.describe("Range type"),
|
|
138
|
+
start: z.union([z.number(), z.string()]).describe("Start value"),
|
|
139
|
+
end: z.union([z.number(), z.string()]).describe("End value"),
|
|
140
|
+
});
|
|
141
|
+
export const TimeRangeSchema = BaseRangeSchema.extend({
|
|
142
|
+
type: z.literal("time"),
|
|
143
|
+
start: z.number(),
|
|
144
|
+
end: z.number(),
|
|
145
|
+
});
|
|
146
|
+
export const MessageIdRangeSchema = BaseRangeSchema.extend({
|
|
147
|
+
type: z.literal("messageId"),
|
|
148
|
+
start: z.string(),
|
|
149
|
+
end: z.string(),
|
|
150
|
+
});
|
|
151
|
+
export const SeqIndexRangeSchema = BaseRangeSchema.extend({
|
|
152
|
+
type: z.literal("seqIndex"),
|
|
153
|
+
start: z.number(),
|
|
154
|
+
end: z.number(),
|
|
155
|
+
});
|
|
156
|
+
export const WtsRangeSchema = z.discriminatedUnion("type", [
|
|
157
|
+
TimeRangeSchema,
|
|
158
|
+
MessageIdRangeSchema,
|
|
159
|
+
SeqIndexRangeSchema,
|
|
160
|
+
]).describe("WTS range filter parameters");
|
|
161
|
+
export const WtsGenerationParamsSchema = z.object({
|
|
162
|
+
myAccount: NameOrAddressSchema.describe("My account name or address (string)"),
|
|
163
|
+
peerAccount: AccountOrMark_AddressAISchema.describe("Peer account name or address - can be a string (name/address) or full object"),
|
|
164
|
+
range: WtsRangeSchema.optional().describe("Range filter parameters"),
|
|
165
|
+
excludePlaintext: z.boolean().optional().describe("Whether to exclude plaintext"),
|
|
166
|
+
outputDir: z.string().describe("Output directory path"),
|
|
167
|
+
}).describe("WTS generation parameters");
|
|
168
|
+
export const WtsFileResultSchema = z.object({
|
|
169
|
+
files: z.array(z.string()).describe("Generated WTS file paths"),
|
|
170
|
+
totalMessageCount: z.number().describe("Total message count"),
|
|
171
|
+
timeRange: z.object({
|
|
172
|
+
start: z.number().describe("Start time"),
|
|
173
|
+
end: z.number().describe("End time"),
|
|
174
|
+
}).describe("Time range"),
|
|
175
|
+
}).describe("WTS file result");
|
|
176
|
+
export const WtsSignatureVerificationSchema = z.object({
|
|
177
|
+
publicKey: z.string().describe("Signer public key"),
|
|
178
|
+
address: z.string().optional().describe("Signer address"),
|
|
179
|
+
valid: z.boolean().describe("Whether signature is valid"),
|
|
180
|
+
}).describe("WTS signature verification details");
|
|
181
|
+
export const WtsVerificationResultSchema = z.object({
|
|
182
|
+
valid: z.boolean().describe("Whether verification succeeded"),
|
|
183
|
+
error: z.string().optional().describe("Error message if verification failed"),
|
|
184
|
+
hashValid: z.boolean().optional().describe("Whether hash validation passed"),
|
|
185
|
+
hasSignature: z.boolean().optional().describe("Whether WTS has signatures"),
|
|
186
|
+
signatureValid: z.boolean().optional().describe("Whether signature validation passed"),
|
|
187
|
+
signatures: z.array(WtsSignatureVerificationSchema).optional().describe("Signature verification details"),
|
|
188
|
+
}).describe("WTS verification result");
|
|
189
|
+
export const WtsToHtmlOptionsSchema = z.object({
|
|
190
|
+
title: z.string().optional().describe("HTML document title"),
|
|
191
|
+
theme: z.enum(["light", "dark"]).optional().describe("HTML theme"),
|
|
192
|
+
outputPath: z.string().optional().describe("Output file path"),
|
|
193
|
+
}).describe("WTS to HTML conversion options");
|
|
194
|
+
export const AddressExistenceSchema = z.object({
|
|
195
|
+
address: z.string().describe("Address"),
|
|
196
|
+
exists: z.boolean().describe("Whether address exists in list"),
|
|
197
|
+
}).describe("Address existence check result");
|
|
198
|
+
export const GuardListItemSchema = z.object({
|
|
199
|
+
guardAddress: z.string().describe("Guard address"),
|
|
200
|
+
passportValiditySeconds: z.number().describe("Passport validity in seconds"),
|
|
201
|
+
}).describe("Guard list item");
|
|
202
|
+
export const ListOperationResponseSchema = z.object({
|
|
203
|
+
success: z.boolean().describe("Whether operation succeeded"),
|
|
204
|
+
operation: z.string().describe("Operation performed"),
|
|
205
|
+
modifiedCount: z.number().describe("Number of items modified"),
|
|
206
|
+
currentCount: z.number().describe("Current list size"),
|
|
207
|
+
maxCount: z.number().describe("Maximum list size"),
|
|
208
|
+
invalidAddresses: z.array(z.string()).optional().nullable().describe("Invalid addresses"),
|
|
209
|
+
existResults: z.array(AddressExistenceSchema).optional().nullable().describe("Existence check results"),
|
|
210
|
+
message: z.string().optional().nullable().describe("Operation message"),
|
|
211
|
+
currentList: z.array(z.string()).optional().nullable().describe("Current list content"),
|
|
212
|
+
currentGuardList: z.array(GuardListItemSchema).optional().nullable().describe("Current guard list content"),
|
|
213
|
+
}).describe("List operation response");
|
|
214
|
+
export const BlacklistOperationSchema = z.discriminatedUnion("op", [
|
|
215
|
+
z.object({
|
|
216
|
+
op: z.literal("add"),
|
|
217
|
+
users: ManyAccountOrMark_AddressAISchema.describe("Users to add to blacklist - can be array of strings (names/addresses) or full object"),
|
|
218
|
+
}),
|
|
219
|
+
z.object({
|
|
220
|
+
op: z.literal("remove"),
|
|
221
|
+
users: ManyAccountOrMark_AddressAISchema.describe("Users to remove from blacklist - can be array of strings (names/addresses) or full object"),
|
|
222
|
+
}),
|
|
223
|
+
z.object({
|
|
224
|
+
op: z.literal("clear"),
|
|
225
|
+
}),
|
|
226
|
+
z.object({
|
|
227
|
+
op: z.literal("get"),
|
|
228
|
+
}),
|
|
229
|
+
z.object({
|
|
230
|
+
op: z.literal("exist"),
|
|
231
|
+
users: ManyAccountOrMark_AddressAISchema.describe("Users to check existence - can be array of strings (names/addresses) or full object"),
|
|
232
|
+
}),
|
|
233
|
+
]).describe("Blacklist management operation");
|
|
234
|
+
export const FriendslistOperationSchema = z.discriminatedUnion("op", [
|
|
235
|
+
z.object({
|
|
236
|
+
op: z.literal("add"),
|
|
237
|
+
users: ManyAccountOrMark_AddressAISchema.describe("Users to add to friends list - can be array of strings (names/addresses) or full object"),
|
|
238
|
+
}),
|
|
239
|
+
z.object({
|
|
240
|
+
op: z.literal("remove"),
|
|
241
|
+
users: ManyAccountOrMark_AddressAISchema.describe("Users to remove from friends list - can be array of strings (names/addresses) or full object"),
|
|
242
|
+
}),
|
|
243
|
+
z.object({
|
|
244
|
+
op: z.literal("clear"),
|
|
245
|
+
}),
|
|
246
|
+
z.object({
|
|
247
|
+
op: z.literal("get"),
|
|
248
|
+
}),
|
|
249
|
+
z.object({
|
|
250
|
+
op: z.literal("exist"),
|
|
251
|
+
users: ManyAccountOrMark_AddressAISchema.describe("Users to check existence - can be array of strings (names/addresses) or full object"),
|
|
252
|
+
}),
|
|
253
|
+
]).describe("Friends list management operation");
|
|
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
|
+
export const SettingsOperationSchema = z.discriminatedUnion("op", [
|
|
272
|
+
z.object({
|
|
273
|
+
op: z.literal("get"),
|
|
274
|
+
}),
|
|
275
|
+
z.object({
|
|
276
|
+
op: z.literal("set"),
|
|
277
|
+
allowStrangerMessages: z.boolean().optional().describe("Allow messages from strangers"),
|
|
278
|
+
maxInboxSize: z.number().min(1).optional().describe("Maximum inbox size"),
|
|
279
|
+
}),
|
|
280
|
+
]).describe("Settings management operation");
|
|
281
|
+
export const GetSettingsResponseSchema = z.object({
|
|
282
|
+
allowStrangerMessages: z.boolean().optional().describe("Whether messages from strangers are allowed"),
|
|
283
|
+
maxInboxSize: z.number().optional().describe("Current maximum inbox size"),
|
|
284
|
+
minUserInboxSize: z.number().describe("Server minimum allowed inbox size limit"),
|
|
285
|
+
maxUserInboxSize: z.number().describe("Server maximum allowed inbox size limit"),
|
|
286
|
+
defaultAllowStrangerMessages: z.boolean().describe("Server default setting for allowing stranger messages"),
|
|
287
|
+
}).describe("Get settings response");
|
|
288
|
+
export const MessengerOperationInputSchema = z.discriminatedUnion("operation", [
|
|
289
|
+
z.object({
|
|
290
|
+
operation: z.literal("watch_conversations"),
|
|
291
|
+
filter: ConversationsFilterSchema.optional().describe("Conversations filter options - use unreadOnly to find conversations with unread messages, previewMessageCount to control message previews (default 2), and sortBy/sortOrder to customize sorting"),
|
|
292
|
+
}),
|
|
293
|
+
z.object({
|
|
294
|
+
operation: z.literal("send_message"),
|
|
295
|
+
from: NameOrAddressSchema.optional().describe("Sender account name or address. If not specified, uses default account"),
|
|
296
|
+
to: AccountOrMark_AddressAISchema.describe("Recipient address or account name - can be a string (name/address) or full object"),
|
|
297
|
+
content: z.string().max(10000).describe("Message content text"),
|
|
298
|
+
options: SendMessageOptionsSchema.optional().describe("Optional message settings"),
|
|
299
|
+
}),
|
|
300
|
+
z.object({
|
|
301
|
+
operation: z.literal("send_file"),
|
|
302
|
+
from: NameOrAddressSchema.optional().describe("Sender account name or address. If not specified, uses default account"),
|
|
303
|
+
to: AccountOrMark_AddressAISchema.describe("Recipient address or account name - can be a string (name/address) or full object"),
|
|
304
|
+
filePath: z.string().describe("Local file path to send. File will be compressed as ZIP before sending"),
|
|
305
|
+
options: SendFileOptionsSchema.optional().describe("Optional file sending settings"),
|
|
306
|
+
}),
|
|
307
|
+
z.object({
|
|
308
|
+
operation: z.literal("watch_messages"),
|
|
309
|
+
filter: MessageFilterSchema.optional().describe("Message filter options"),
|
|
310
|
+
}),
|
|
311
|
+
z.object({
|
|
312
|
+
operation: z.literal("extract_zip_messages"),
|
|
313
|
+
account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
|
|
314
|
+
messages: z.array(z.union([z.string(), MessageSchema])).describe("Array of message objects or message IDs to extract"),
|
|
315
|
+
outputDir: z.string().describe("Output directory path for extracted files"),
|
|
316
|
+
}),
|
|
317
|
+
z.object({
|
|
318
|
+
operation: z.literal("generate_wts"),
|
|
319
|
+
params: WtsGenerationParamsSchema.describe("WTS generation parameters"),
|
|
320
|
+
}),
|
|
321
|
+
z.object({
|
|
322
|
+
operation: z.literal("verify_wts"),
|
|
323
|
+
wtsFilePath: z.string().describe("WTS file path to verify"),
|
|
324
|
+
}),
|
|
325
|
+
z.object({
|
|
326
|
+
operation: z.literal("sign_wts"),
|
|
327
|
+
wtsFilePath: z.string().describe("WTS file path to sign"),
|
|
328
|
+
account: NameOrAddressSchema.optional().describe("Account name or address to sign with. If not specified, uses default account"),
|
|
329
|
+
outputPath: z.string().optional().describe("Output file path. If not specified, saves to signed_*.wts"),
|
|
330
|
+
}),
|
|
331
|
+
z.object({
|
|
332
|
+
operation: z.literal("wts2html"),
|
|
333
|
+
wtsPath: z.string().describe("WTS file path or directory to convert"),
|
|
334
|
+
options: WtsToHtmlOptionsSchema.optional().describe("Conversion options"),
|
|
335
|
+
}),
|
|
336
|
+
z.object({
|
|
337
|
+
operation: z.literal("proof_message"),
|
|
338
|
+
account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
|
|
339
|
+
messageId: z.string().describe("Message ID to proof on-chain"),
|
|
340
|
+
network: EntrypointSchema.optional().describe("Network to use for on-chain proof"),
|
|
341
|
+
}),
|
|
342
|
+
z.object({
|
|
343
|
+
operation: z.literal("blacklist"),
|
|
344
|
+
account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
|
|
345
|
+
blacklist: BlacklistOperationSchema.describe("Blacklist management operation"),
|
|
346
|
+
}),
|
|
347
|
+
z.object({
|
|
348
|
+
operation: z.literal("friendslist"),
|
|
349
|
+
account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
|
|
350
|
+
friendslist: FriendslistOperationSchema.describe("Friends list management operation"),
|
|
351
|
+
}),
|
|
352
|
+
z.object({
|
|
353
|
+
operation: z.literal("guardlist"),
|
|
354
|
+
account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
|
|
355
|
+
guardlist: GuardlistOperationSchema.describe("Guard list management operation"),
|
|
356
|
+
}),
|
|
357
|
+
z.object({
|
|
358
|
+
operation: z.literal("settings"),
|
|
359
|
+
account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
|
|
360
|
+
settings: SettingsOperationSchema.describe("Settings management operation"),
|
|
361
|
+
}),
|
|
362
|
+
z.object({
|
|
363
|
+
operation: z.literal("mark_messages_as_viewed"),
|
|
364
|
+
account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
|
|
365
|
+
messageIds: z.array(z.string()).min(1).max(1000).describe("Array of message IDs to mark as viewed (1-1000 messages). Only messages belonging to this account will be marked"),
|
|
366
|
+
}),
|
|
367
|
+
z.object({
|
|
368
|
+
operation: z.literal("mark_conversation_as_viewed"),
|
|
369
|
+
account: NameOrAddressSchema.optional().describe("Account name or address. If not specified, uses default account"),
|
|
370
|
+
peerAddress: AccountOrMark_AddressAISchema.describe("Peer address or account name - can be a string (name/address) or full object. All unviewed received messages from this peer will be marked as viewed"),
|
|
371
|
+
}),
|
|
372
|
+
]).describe("Messenger operation input schema");
|
|
373
|
+
export const MessengerOperationOutputSchema = z.object({
|
|
374
|
+
result: z.discriminatedUnion("operation", [
|
|
375
|
+
z.object({
|
|
376
|
+
operation: z.literal("watch_conversations"),
|
|
377
|
+
result: z.array(ConversationInfoSchema).describe("List of conversations"),
|
|
378
|
+
}),
|
|
379
|
+
z.object({
|
|
380
|
+
operation: z.literal("send_message"),
|
|
381
|
+
result: SendMessageResultSchema.describe("Send message result"),
|
|
382
|
+
}),
|
|
383
|
+
z.object({
|
|
384
|
+
operation: z.literal("send_file"),
|
|
385
|
+
result: SendMessageResultSchema.describe("Send file result"),
|
|
386
|
+
}),
|
|
387
|
+
z.object({
|
|
388
|
+
operation: z.literal("watch_messages"),
|
|
389
|
+
result: z.array(MessageSchema).describe("List of messages"),
|
|
390
|
+
}),
|
|
391
|
+
z.object({
|
|
392
|
+
operation: z.literal("extract_zip_messages"),
|
|
393
|
+
result: z.array(z.string()).describe("Extracted file paths"),
|
|
394
|
+
}),
|
|
395
|
+
z.object({
|
|
396
|
+
operation: z.literal("generate_wts"),
|
|
397
|
+
result: WtsFileResultSchema.describe("Generate WTS result"),
|
|
398
|
+
}),
|
|
399
|
+
z.object({
|
|
400
|
+
operation: z.literal("verify_wts"),
|
|
401
|
+
result: WtsVerificationResultSchema.describe("WTS verification result"),
|
|
402
|
+
}),
|
|
403
|
+
z.object({
|
|
404
|
+
operation: z.literal("sign_wts"),
|
|
405
|
+
result: z.string().describe("Signed WTS file path"),
|
|
406
|
+
}),
|
|
407
|
+
z.object({
|
|
408
|
+
operation: z.literal("wts2html"),
|
|
409
|
+
result: z.union([z.string(), z.array(z.string())]).describe("HTML string or file path(s)"),
|
|
410
|
+
}),
|
|
411
|
+
z.object({
|
|
412
|
+
operation: z.literal("proof_message"),
|
|
413
|
+
result: z.object({
|
|
414
|
+
proofAddress: z.string().describe("Proof object address on blockchain"),
|
|
415
|
+
}).describe("Proof message result"),
|
|
416
|
+
}),
|
|
417
|
+
z.object({
|
|
418
|
+
operation: z.literal("blacklist"),
|
|
419
|
+
op: z.enum(["add", "remove", "clear", "get", "exist"]).describe("Operation type"),
|
|
420
|
+
result: z.union([ListOperationResponseSchema, z.array(z.string())]).describe("Blacklist operation result"),
|
|
421
|
+
}),
|
|
422
|
+
z.object({
|
|
423
|
+
operation: z.literal("friendslist"),
|
|
424
|
+
op: z.enum(["add", "remove", "clear", "get", "exist"]).describe("Operation type"),
|
|
425
|
+
result: z.union([ListOperationResponseSchema, z.array(z.string())]).describe("Friends list operation result"),
|
|
426
|
+
}),
|
|
427
|
+
z.object({
|
|
428
|
+
operation: z.literal("guardlist"),
|
|
429
|
+
op: z.enum(["add", "remove", "get"]).describe("Operation type"),
|
|
430
|
+
result: ListOperationResponseSchema.describe("Guard list operation result"),
|
|
431
|
+
}),
|
|
432
|
+
z.object({
|
|
433
|
+
operation: z.literal("settings"),
|
|
434
|
+
op: z.enum(["get", "set"]).describe("Operation type"),
|
|
435
|
+
result: z.union([GetSettingsResponseSchema, z.boolean()]).describe("Settings operation result - GetSettingsResponse for 'get' operation, boolean for 'set' operation"),
|
|
436
|
+
}),
|
|
437
|
+
z.object({
|
|
438
|
+
operation: z.literal("mark_messages_as_viewed"),
|
|
439
|
+
result: z.number().describe("Number of messages successfully marked as viewed. Only messages that were previously unviewed are counted"),
|
|
440
|
+
}),
|
|
441
|
+
z.object({
|
|
442
|
+
operation: z.literal("mark_conversation_as_viewed"),
|
|
443
|
+
result: z.number().describe("Number of messages successfully marked as viewed in the conversation. Only received messages that were previously unviewed are counted"),
|
|
444
|
+
}),
|
|
445
|
+
]).describe("Messenger operation result discriminated union"),
|
|
446
|
+
}).describe("Messenger operation output schema");
|