@wowok/agent-mcp 2.3.6 → 2.3.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.
Files changed (38) hide show
  1. package/dist/index.d.ts +1 -15838
  2. package/dist/index.js +40 -394
  3. package/dist/schema/call/bridge-handler.d.ts +5 -0
  4. package/dist/schema/call/bridge-handler.js +234 -0
  5. package/dist/schema/call/bridge.d.ts +2212 -0
  6. package/dist/schema/call/bridge.js +408 -0
  7. package/dist/schema/call/handler.js +29 -15
  8. package/dist/schema/call/index.d.ts +1 -0
  9. package/dist/schema/call/index.js +1 -0
  10. package/dist/schema/index.d.ts +1 -0
  11. package/dist/schema/index.js +1 -0
  12. package/dist/schema/messenger/index.d.ts +74 -74
  13. package/dist/schema/operations.d.ts +24302 -0
  14. package/dist/schema/operations.js +393 -0
  15. package/dist/schema-query/index.d.ts +3 -1
  16. package/dist/schema-query/index.js +63 -3
  17. package/dist/schemas/account_operation.output.json +1395 -0
  18. package/dist/schemas/bridge_operation.output.json +64 -0
  19. package/dist/schemas/bridge_operation.schema.json +547 -0
  20. package/dist/schemas/guard2file.output.json +84 -0
  21. package/dist/schemas/index.json +33 -14
  22. package/dist/schemas/local_info_operation.output.json +70 -0
  23. package/dist/schemas/local_mark_operation.output.json +114 -0
  24. package/dist/schemas/machineNode2file.output.json +89 -0
  25. package/dist/schemas/messenger_operation.output.json +1068 -0
  26. package/dist/schemas/onchain_events.output.json +513 -0
  27. package/dist/schemas/onchain_operations.output.json +1764 -0
  28. package/dist/schemas/onchain_operations.schema.json +8324 -49
  29. package/dist/schemas/onchain_table_data.output.json +1938 -0
  30. package/dist/schemas/onchain_table_data.schema.json +483 -22
  31. package/dist/schemas/query_toolkit.output.json +18 -0
  32. package/dist/schemas/query_toolkit.schema.json +454 -19
  33. package/dist/schemas/schema_query.output.json +42 -0
  34. package/dist/schemas/schema_query.schema.json +1 -0
  35. package/dist/schemas/wip_file.output.json +116 -0
  36. package/dist/schemas/wip_file.schema.json +163 -15
  37. package/dist/schemas/wowok_buildin_info.output.json +577 -0
  38. package/package.json +2 -3
@@ -0,0 +1,393 @@
1
+ import { z } from 'zod';
2
+ import { CallService_DataSchema, CallMachine_DataSchema, CallProgress_DataSchema, CallRepository_DataSchema, CallArbitration_DataSchema, CallContact_DataSchema, CallTreasury_DataSchema, CallReward_DataSchema, CallAllocation_DataSchema, CallPermission_DataSchema, CallGuard_DataSchema, CallPersonal_DataSchema, CallPayment_DataSchema, CallDemand_DataSchema, CallOrder_DataSchema, CallEnvSchema, SubmissionCallSchema, } from './call/index.js';
3
+ import { WipGenerationOptionsSchema, WipToHtmlOptionsSchema, LocalMarkFilterSchema, AccountFilterSchema, LocalInfoFilterSchema, TokenDataFilterSchema, } from './local/index.js';
4
+ import { NameOrAddressSchema, AccountOrMark_AddressSchema, AccountOrMark_AddressAISchema, EntrypointSchema, TokenTypeSchema, ObjectBaseSchema, } from './common/index.js';
5
+ import { TableAnswerSchema, TableItem_RepositoryDataSchema, TableItem_PermissionPermSchema, TableItem_EntityRegistrarSchema, TableItem_EntityLinkerSchema, TableItem_RewardRecordSchema, TableItem_DemandPresenterSchema, TableItem_TreasuryHistorySchema, TableItem_MachineNodeSchema, TableItem_ProgressHistorySchema, TableItem_AddressMarkSchema, } from './query/index.js';
6
+ export const OnchainOperationsSchema = z.preprocess((input) => {
7
+ if (typeof input === 'object' && input !== null) {
8
+ const obj = { ...input };
9
+ if (typeof obj.description === 'string' && !obj.operation_type) {
10
+ try {
11
+ const parsed = JSON.parse(obj.description);
12
+ if (parsed && typeof parsed === 'object' && parsed.operation_type) {
13
+ return parsed;
14
+ }
15
+ }
16
+ catch { }
17
+ }
18
+ if (typeof obj.data === 'string') {
19
+ try {
20
+ obj.data = JSON.parse(obj.data);
21
+ }
22
+ catch { }
23
+ }
24
+ if (typeof obj.env === 'string') {
25
+ try {
26
+ obj.env = JSON.parse(obj.env);
27
+ }
28
+ catch { }
29
+ }
30
+ if (typeof obj.submission === 'string') {
31
+ try {
32
+ obj.submission = JSON.parse(obj.submission);
33
+ }
34
+ catch { }
35
+ }
36
+ if (typeof obj.info === 'string') {
37
+ try {
38
+ obj.info = JSON.parse(obj.info);
39
+ }
40
+ catch { }
41
+ }
42
+ return obj;
43
+ }
44
+ return input;
45
+ }, z.discriminatedUnion("operation_type", [
46
+ z.object({
47
+ operation_type: z.literal("service"),
48
+ data: CallService_DataSchema,
49
+ env: CallEnvSchema.optional(),
50
+ submission: SubmissionCallSchema.optional(),
51
+ }).describe("🏪 Service Object: Create and manage product/service listings with transparent promises, bind workflow templates to order processing, set pricing, issue discount coupons to customers, and establish quality standards, etc.."),
52
+ z.object({
53
+ operation_type: z.literal("machine"),
54
+ data: CallMachine_DataSchema,
55
+ env: CallEnvSchema.optional(),
56
+ submission: SubmissionCallSchema.optional(),
57
+ }).describe("⚙️ Machine Object: Design and deploy automated workflow templates (Machines) that define how services are delivered, etc.."),
58
+ z.object({
59
+ operation_type: z.literal("progress"),
60
+ data: CallProgress_DataSchema,
61
+ env: CallEnvSchema.optional(),
62
+ submission: SubmissionCallSchema.optional(),
63
+ }).describe("📊 Progress Object: Track and manage active workflows in real-time."),
64
+ z.object({
65
+ operation_type: z.literal("repository"),
66
+ data: CallRepository_DataSchema,
67
+ env: CallEnvSchema.optional(),
68
+ submission: SubmissionCallSchema.optional(),
69
+ }).describe("📦 Repository Object: Read/write database with consensus field + address as key, strongly-typed data as value."),
70
+ z.object({
71
+ operation_type: z.literal("arbitration"),
72
+ data: CallArbitration_DataSchema,
73
+ env: CallEnvSchema.optional(),
74
+ submission: SubmissionCallSchema.optional(),
75
+ }).describe("⚖️ Arbitration Object: Access a transparent on-chain arbitration system for resolving order conflicts."),
76
+ z.object({
77
+ operation_type: z.literal("contact"),
78
+ data: CallContact_DataSchema,
79
+ env: CallEnvSchema.optional(),
80
+ submission: SubmissionCallSchema.optional(),
81
+ }).describe("💬 Contact Object: Manage on-chain instant messaging contact profiles."),
82
+ z.object({
83
+ operation_type: z.literal("treasury"),
84
+ data: CallTreasury_DataSchema,
85
+ env: CallEnvSchema.optional(),
86
+ submission: SubmissionCallSchema.optional(),
87
+ }).describe("💰 Treasury Object: Create and manage treasury for team funds with deposit/withdrawal rules, etc.."),
88
+ z.object({
89
+ operation_type: z.literal("reward"),
90
+ data: CallReward_DataSchema,
91
+ env: CallEnvSchema.optional(),
92
+ submission: SubmissionCallSchema.optional(),
93
+ }).describe("🎁 Reward Object: Create reward pools and set claim conditions by Guard verification."),
94
+ z.object({
95
+ operation_type: z.literal("allocation"),
96
+ data: CallAllocation_DataSchema,
97
+ env: CallEnvSchema.optional(),
98
+ submission: SubmissionCallSchema.optional(),
99
+ }).describe("📤 Allocation Object: Create distribution plans to auto-distribute funds to multiple recipients."),
100
+ z.object({
101
+ operation_type: z.literal("permission"),
102
+ data: CallPermission_DataSchema,
103
+ env: CallEnvSchema.optional(),
104
+ }).describe("🔐 Permission Object: Define who can perform which operations on WoWok objects. Important Note: If needed, you should first query 'guard instructions' through the 'wowok_buildin_info' tool."),
105
+ z.object({
106
+ operation_type: z.literal("guard"),
107
+ data: CallGuard_DataSchema,
108
+ env: CallEnvSchema.optional(),
109
+ }).describe("🛡️ Guard Object: Create immutable programmable validation rules that return boolean results. Set 'namedNew' to name the new Guard. Use root.type='node' for direct node tree or root.type='file' to load from file. Use 'wowok_buildin_info' tool with query='guard instructions' for all available operations. NOTE for EntityLinker/EntityRegistrar queries: Add system addresses to the Guard table - ENTITY_LINKER_ADDRESS (0xaaa) for EntityLinker, ENTITY_REGISTRAR_ADDRESS (0xaab) for EntityRegistrar."),
110
+ z.object({
111
+ operation_type: z.literal("personal"),
112
+ data: CallPersonal_DataSchema,
113
+ env: CallEnvSchema.optional(),
114
+ }).describe("🆔 Public Identity Profile: Establish and manage your on-chain public identity. ⚠️ CRITICAL: Everything here is PERMANENTLY PUBLIC on the blockchain!"),
115
+ z.object({
116
+ operation_type: z.literal("payment"),
117
+ data: CallPayment_DataSchema,
118
+ env: CallEnvSchema.optional(),
119
+ }).describe("💰 Payment Object: Send instant, irreversible coin transfers to any wallet address."),
120
+ z.object({
121
+ operation_type: z.literal("demand"),
122
+ data: CallDemand_DataSchema,
123
+ env: CallEnvSchema.optional(),
124
+ submission: SubmissionCallSchema.optional(),
125
+ }).describe("🎯 Demand Object: Post service requests with reward pools on-chain."),
126
+ z.object({
127
+ operation_type: z.literal("order"),
128
+ data: CallOrder_DataSchema,
129
+ env: CallEnvSchema.optional(),
130
+ submission: SubmissionCallSchema.optional(),
131
+ }).describe("📦 Order Object: Manage the order lifecycle, Including operating order arbitration (Arb Object associated with the order), advancing progress (Progress Object associated with the order), extracting order refunds/payments, setting agents, etc."),
132
+ z.object({
133
+ operation_type: z.literal("gen_passport"),
134
+ guard: z.union([z.string(), z.array(z.string())]).describe("Guard object ID(s) to verify and generate passport from. Can be a single guard (string) or multiple guards (array of strings). Supports guard names or addresses."),
135
+ info: SubmissionCallSchema.optional().describe("Optional submission data. If not provided, will attempt to get existing submissions from the guard."),
136
+ env: CallEnvSchema.optional(),
137
+ }).describe("🛂 Generate Verified Passport Object: Create immutable verified credentials after Guard validation passes. Supports verifying multiple guards at once."),
138
+ ]));
139
+ export const WipOperationsSchema = z.preprocess((input) => {
140
+ if (typeof input === 'object' && input !== null) {
141
+ const obj = { ...input };
142
+ if (typeof obj.description === 'string' && !obj.type) {
143
+ try {
144
+ const parsed = JSON.parse(obj.description);
145
+ if (parsed && typeof parsed === 'object' && parsed.type) {
146
+ return parsed;
147
+ }
148
+ }
149
+ catch { }
150
+ }
151
+ if (typeof obj.options === 'string') {
152
+ try {
153
+ obj.options = JSON.parse(obj.options);
154
+ }
155
+ catch { }
156
+ }
157
+ return obj;
158
+ }
159
+ return input;
160
+ }, z.discriminatedUnion("type", [
161
+ z.object({
162
+ type: z.literal("generate"),
163
+ options: WipGenerationOptionsSchema.describe("WIP generation options"),
164
+ outputPath: z.string().describe("Output file path (.wip file). If file exists, it will be overwritten"),
165
+ }).describe("Generate WIP file from markdown text and optional images"),
166
+ z.object({
167
+ type: z.literal("verify"),
168
+ wipFilePath: z.string().describe("WIP file path to verify. Supports: 1) Local file path (e.g., '/path/to/file.wip', 'C:\\Users\\name\\doc.wip'), 2) Network URL (e.g., 'https://example.com/doc.wip', 'http://site.com/file.wip'), 3) Data URL (e.g., 'data:application/json;base64,eyJ3aXAiOi...')"),
169
+ hash_equal: z.string().optional().describe("Optional expected hash value. If provided, the function will first verify if the file's hash matches this value. If not matched, returns hash mismatch error."),
170
+ requireSignature: z.boolean().optional().describe("Optional flag to require digital signature. If true, verification will fail if WIP file has no signature"),
171
+ }).describe("Verify WIP file integrity and signatures"),
172
+ z.object({
173
+ type: z.literal("sign"),
174
+ wipFilePath: z.string().describe("WIP file path to sign. Supports: 1) Local file path (e.g., '/path/to/file.wip'), 2) Network URL (e.g., 'https://example.com/doc.wip'). The file will be loaded, validated, and signed"),
175
+ account: z.string().optional().describe("Signing account (account name or address). If not specified, uses default account"),
176
+ outputPath: z.string().optional().describe("Output file path. If not specified, adds 'signed_' prefix to original file name (e.g., 'doc.wip' becomes 'signed_doc.wip')"),
177
+ }).describe("Sign WIP file with account"),
178
+ z.object({
179
+ type: z.literal("wip2html"),
180
+ wipPath: z.string().describe("WIP file path or directory path. Supports: 1) Single WIP file (e.g., '/path/to/file.wip'), 2) Directory containing .wip files (e.g., '/path/to/wips/'), 3) Network URL (e.g., 'https://example.com/doc.wip'). When directory is provided, all .wip files in the directory will be converted to HTML"),
181
+ options: WipToHtmlOptionsSchema.optional().describe("Conversion options"),
182
+ }).describe("Convert WIP file to HTML format"),
183
+ ]));
184
+ export const OnchainTableDataSchema = z.preprocess((input) => {
185
+ if (typeof input === 'object' && input !== null && !Array.isArray(input)) {
186
+ const obj = { ...input };
187
+ if (typeof obj.description === 'string' && !obj.query_type) {
188
+ try {
189
+ const parsed = JSON.parse(obj.description);
190
+ if (parsed && typeof parsed === 'object' && parsed.query_type) {
191
+ return parsed;
192
+ }
193
+ }
194
+ catch { }
195
+ }
196
+ if (obj.cursor === '')
197
+ obj.cursor = null;
198
+ if (obj.limit === '')
199
+ obj.limit = null;
200
+ return obj;
201
+ }
202
+ return input;
203
+ }, z.union([
204
+ z.discriminatedUnion("query_type", [
205
+ z.object({
206
+ query_type: z.literal("onchain_table"),
207
+ parent: NameOrAddressSchema.describe("Parent object ID whose dynamic fields table to query"),
208
+ cursor: z.union([z.string(), z.null()]).optional().describe("Pagination cursor from previous page's nextCursor"),
209
+ limit: z.union([z.number(), z.null()]).optional().describe("Max items per page"),
210
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
211
+ network: EntrypointSchema.optional(),
212
+ }).describe("Paginated query of an on-chain object's dynamic fields table — returns items with keys, types, and object IDs. Use to explore all entries (e.g., all orders in a Service, all records in a Repository). Returns: TableAnswer | undefined (items[], nextCursor, hasNextPage)"),
213
+ z.object({
214
+ query_type: z.literal("onchain_table_item_repository_data"),
215
+ parent: NameOrAddressSchema.describe("Parent Repository object ID"),
216
+ name: z.string().describe("Name/key of the record to retrieve from the repository"),
217
+ entity: z.union([AccountOrMark_AddressSchema, z.number()]).describe("Entity ID or address that owns/identifies the record"),
218
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
219
+ network: EntrypointSchema.optional(),
220
+ }).describe("Query a specific record from a Repository's on-chain key-value database by name and entity. Use to read stored data records. Returns: TableItem_RepositoryData | undefined"),
221
+ z.object({
222
+ query_type: z.literal("onchain_table_item_permission_perm"),
223
+ parent: NameOrAddressSchema.describe("Parent Permission object ID"),
224
+ address: z.union([AccountOrMark_AddressSchema, z.string()]).describe("User address or Guard ID whose permissions to check"),
225
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
226
+ network: EntrypointSchema.optional(),
227
+ }).describe("Query a permission entry from a Permission object's perm table — checks what operations a user/guard is allowed to perform. Use to verify access rights. Returns: TableItem_PermissionPerm | undefined"),
228
+ z.object({
229
+ query_type: z.literal("onchain_table_item_entity_registrar"),
230
+ address: z.union([AccountOrMark_AddressSchema, z.string()]).describe("User address to look up in the global EntityRegistrar"),
231
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
232
+ network: EntrypointSchema.optional(),
233
+ }).describe("Query an entity's registration record from the global EntityRegistrar — verifies if an address is registered on the blockchain. Use to check registration status and details. Returns: TableItem_EntityRegistrar | undefined"),
234
+ z.object({
235
+ query_type: z.literal("onchain_table_item_entity_linker"),
236
+ address: z.union([AccountOrMark_AddressSchema, z.string()]).describe("Entity address whose community votes/endorsements to query"),
237
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
238
+ network: EntrypointSchema.optional(),
239
+ }).describe("Query community votes/endorsements for an entity from the global EntityLinker — shows how others have voted on this entity. Use to check reputation and community trust. Returns: TableItem_EntityLinker | undefined"),
240
+ z.object({
241
+ query_type: z.literal("onchain_table_item_reward_record"),
242
+ parent: NameOrAddressSchema.describe("Parent Reward object ID"),
243
+ address: AccountOrMark_AddressSchema.describe("User address that claimed the reward"),
244
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
245
+ network: EntrypointSchema.optional(),
246
+ }).describe("Query a reward claim record from a Reward object's table — checks if a user has claimed a specific incentive. Use to verify reward distribution status. Returns: TableItem_RewardRecord | undefined"),
247
+ ]),
248
+ z.discriminatedUnion("query_type", [
249
+ z.object({
250
+ query_type: z.literal("onchain_table_item_demand_presenter"),
251
+ parent: NameOrAddressSchema.describe("Parent Demand object ID"),
252
+ address: AccountOrMark_AddressSchema.describe("Presenter address that submitted the demand"),
253
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
254
+ network: EntrypointSchema.optional(),
255
+ }).describe("Query a demand submission from a Demand object's table — Demands are service requests submitted by users. Use to check a specific demand's details. Returns: TableItem_DemandPresenter | undefined"),
256
+ z.object({
257
+ query_type: z.literal("onchain_table_item_treasury_history"),
258
+ parent: NameOrAddressSchema.describe("Parent Treasury object ID"),
259
+ address: AccountOrMark_AddressSchema.describe("Payment ID whose treasury record to look up"),
260
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
261
+ network: EntrypointSchema.optional(),
262
+ }).describe("Query a payment record from a Treasury's history table by payment ID — Treasury manages funds and payment tracking. Use to look up payment details and status. Returns: TableItem_TreasuryHistory | undefined"),
263
+ z.object({
264
+ query_type: z.literal("onchain_table_item_machine_node"),
265
+ parent: NameOrAddressSchema.describe("Parent Machine object ID"),
266
+ key: z.string().describe("Node name (string key) to query in the Machine's workflow definition"),
267
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
268
+ network: EntrypointSchema.optional(),
269
+ }).describe("Query a workflow node definition from a Machine object's table by node name — Machines define workflow templates. Use to inspect a specific node's configuration and logic. Returns: TableItem_MachineNode | undefined"),
270
+ z.object({
271
+ query_type: z.literal("onchain_table_item_progress_history"),
272
+ parent: NameOrAddressSchema.describe("Parent Progress object ID"),
273
+ u64: z.union([z.number(), z.string()]).describe("Sequence number (u64) of the progress step to query"),
274
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
275
+ network: EntrypointSchema.optional(),
276
+ }).describe("Query a progress step record from a Progress object's table by sequence number — Progress tracks order/workflow execution. Use to check the status of a specific execution step. Returns: TableItem_ProgressHistory | undefined"),
277
+ z.object({
278
+ query_type: z.literal("onchain_table_item_address_mark"),
279
+ parent: NameOrAddressSchema.describe("Parent AddressMark object ID"),
280
+ address: AccountOrMark_AddressSchema.describe("Address whose PUBLIC on-chain name/tags to look up"),
281
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
282
+ network: EntrypointSchema.optional(),
283
+ }).describe("Query a PUBLIC on-chain name/tag mark for an address — unlike local marks, these are published on-chain. Use to look up public labels attached to any address. Returns: TableItem_AddressMark | undefined"),
284
+ z.object({
285
+ query_type: z.literal("onchain_table_item_generic"),
286
+ parent: NameOrAddressSchema.describe("Parent object ID whose dynamic field to query"),
287
+ key_type: z.string().describe("Type of the key (e.g., 'address', 'u64', 'string', '0x2::object::ID')"),
288
+ key_value: z.any().describe("Value of the key. Must match the key_type format"),
289
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
290
+ network: EntrypointSchema.optional(),
291
+ }).describe("Query a generic table item from ANY object's dynamic fields — supports arbitrary key types and values for non-WoWok objects. Use for custom objects and general-purpose table lookups. Returns: ObjectBase | undefined"),
292
+ ]),
293
+ ]));
294
+ export const WatchQueryOperationsSchema = z.preprocess((input) => {
295
+ if (typeof input === 'object' && input !== null) {
296
+ const obj = { ...input };
297
+ if (typeof obj.description === 'string' && !obj.query_type) {
298
+ try {
299
+ const parsed = JSON.parse(obj.description);
300
+ if (parsed && typeof parsed === 'object' && parsed.query_type) {
301
+ return parsed;
302
+ }
303
+ }
304
+ catch { }
305
+ }
306
+ for (const key of ['filter', 'objects', 'env', 'token_type']) {
307
+ if (typeof obj[key] === 'string') {
308
+ try {
309
+ obj[key] = JSON.parse(obj[key]);
310
+ }
311
+ catch { }
312
+ }
313
+ }
314
+ return obj;
315
+ }
316
+ return input;
317
+ }, z.union([
318
+ z.discriminatedUnion("query_type", [
319
+ z.object({
320
+ query_type: z.literal("local_mark_list"),
321
+ filter: LocalMarkFilterSchema.optional().describe("Local mark filter"),
322
+ }).describe("Query your LOCAL address book — maps human-readable names to blockchain addresses with optional tags. Use to resolve names→addresses or find addresses by tag. Returns: MarkData[] (name, address, tags, timestamps)"),
323
+ z.object({
324
+ query_type: z.literal("account_list"),
325
+ filter: AccountFilterSchema.optional().describe("Account filter"),
326
+ }).describe("Query your LOCAL accounts — view all accounts stored on this device (addresses, public keys, messenger status, suspension state). Use to discover available accounts before operations. Returns: AccountData[] (name, address, pubkey, suspended, messenger, timestamps)"),
327
+ z.object({
328
+ query_type: z.literal("local_info_list"),
329
+ filter: LocalInfoFilterSchema.optional().describe("Local info filter"),
330
+ }).describe("Query your LOCAL private info — sensitive data like delivery addresses, phone numbers, contacts stored ONLY on this device. Use to retrieve saved contact/delivery details. Returns: InfoData[] (name, default value, contents, timestamps)"),
331
+ z.object({
332
+ query_type: z.literal("token_list"),
333
+ filter: TokenDataFilterSchema.optional(),
334
+ }).describe("Query cached token metadata — symbol, decimals, icon URL, description for tokens previously fetched from chain. Use to look up token info without an on-chain query. Returns: TokenTypeInfo[] (type, alias, name, symbol, decimals, iconUrl)"),
335
+ z.object({
336
+ query_type: z.literal("account_balance"),
337
+ name_or_address: NameOrAddressSchema.optional().describe("Account name or address. Use empty string '' for the default account. Defaults to '' if omitted."),
338
+ balance: z.boolean().optional().describe("Set to true to query total balance amount for the token type"),
339
+ coin: z.object({
340
+ cursor: z.union([z.string(), z.null()]).optional().describe("Pagination cursor for listing coin objects"),
341
+ limit: z.union([z.number(), z.null()]).optional().describe("Max coin objects per page"),
342
+ }).optional().describe("Set to query paginated coin objects instead of balance. Use cursor/limit for pagination."),
343
+ token_type: TokenTypeSchema.optional().describe("Token type to query; defaults to 0x2::wow::WOW (platform token)"),
344
+ network: EntrypointSchema.optional(),
345
+ }).describe("Query an account's coin balance OR paginated coin objects. Use balance=true for total amount, or coin={cursor,limit} to list individual coin objects. Returns: { address, balance? | coin? }"),
346
+ z.object({
347
+ query_type: z.literal("local_names"),
348
+ addresses: z.array(z.string()).describe("Array of addresses to look up local names for"),
349
+ }).describe("Query local names (account name and local mark name) for a list of addresses. Returns array of: { account?: string, local_mark?: string, address: string }"),
350
+ ]),
351
+ z.discriminatedUnion("query_type", [
352
+ z.object({
353
+ query_type: z.literal("onchain_personal_profile"),
354
+ account: NameOrAddressSchema.optional().describe("Account name or ID to query. Use empty string '' for the default account."),
355
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
356
+ network: EntrypointSchema.optional(),
357
+ }).describe("Query any user's PUBLIC on-chain profile — social links, reputation (likes/dislikes), personal info records, voting history, referrer. Use to look up a user's public identity and reputation. Returns: ObjectPersonal | undefined"),
358
+ z.object({
359
+ query_type: z.literal("onchain_objects"),
360
+ objects: z.array(NameOrAddressSchema).describe("List of object IDs (names or addresses) to query in batch"),
361
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
362
+ network: EntrypointSchema.optional(),
363
+ }).describe("Batch query on-chain WOWOK objects by ID or name — supports Service, Machine, Order, Treasury, Reward, Arb, Personal, Contact, and more. Use to inspect one or more objects in a single call. Returns: { objects: ObjectBase[] }"),
364
+ z.object({
365
+ query_type: z.literal("onchain_received"),
366
+ name_or_address: AccountOrMark_AddressAISchema.describe("Name or address of the object that received payments/items - can be a string (name/address) or full object"),
367
+ type: z.union([z.string(), z.literal("CoinWrapper"), z.null()]).optional().describe("Type filter for querying received objects. " +
368
+ "- If undefined or null: query all types (equivalent to the old all_type=true). " +
369
+ "- If 'CoinWrapper': query CoinWrapper type for the object's token (equivalent to the old all_type=false). " +
370
+ "- If string: query specific StructType (e.g., '0x2::payment::CoinWrapper<0x2::wow::WOW>')."),
371
+ cursor: z.union([z.string(), z.null()]).optional().describe("Pagination cursor from previous page"),
372
+ limit: z.union([z.number(), z.null()]).optional().describe("Max records per page"),
373
+ no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
374
+ network: EntrypointSchema.optional(),
375
+ }).describe("Query objects (Payments, Tokens, NFTs) received by a specific object. Use to track incoming payments or items sent to an on-chain object. Supports pagination and type filter. Returns: ReceivedBalance | ReceivedNormal[]"),
376
+ ]),
377
+ ]));
378
+ export const OnchainTableDataResultSchema = z.object({
379
+ result: z.union([
380
+ z.object({ query_type: z.literal("onchain_table"), result: z.union([TableAnswerSchema, z.undefined()]) }),
381
+ z.object({ query_type: z.literal("onchain_table_item_repository_data"), result: z.union([TableItem_RepositoryDataSchema, z.undefined()]) }),
382
+ z.object({ query_type: z.literal("onchain_table_item_permission_perm"), result: z.union([TableItem_PermissionPermSchema, z.undefined()]) }),
383
+ z.object({ query_type: z.literal("onchain_table_item_entity_registrar"), result: z.union([TableItem_EntityRegistrarSchema, z.undefined()]) }),
384
+ z.object({ query_type: z.literal("onchain_table_item_entity_linker"), result: z.union([TableItem_EntityLinkerSchema, z.undefined()]) }),
385
+ z.object({ query_type: z.literal("onchain_table_item_reward_record"), result: z.union([TableItem_RewardRecordSchema, z.undefined()]) }),
386
+ z.object({ query_type: z.literal("onchain_table_item_demand_presenter"), result: z.union([TableItem_DemandPresenterSchema, z.undefined()]) }),
387
+ z.object({ query_type: z.literal("onchain_table_item_treasury_history"), result: z.union([TableItem_TreasuryHistorySchema, z.undefined()]) }),
388
+ z.object({ query_type: z.literal("onchain_table_item_machine_node"), result: z.union([TableItem_MachineNodeSchema, z.undefined()]) }),
389
+ z.object({ query_type: z.literal("onchain_table_item_progress_history"), result: z.union([TableItem_ProgressHistorySchema, z.undefined()]) }),
390
+ z.object({ query_type: z.literal("onchain_table_item_address_mark"), result: z.union([TableItem_AddressMarkSchema, z.undefined()]) }),
391
+ z.object({ query_type: z.literal("onchain_table_item_generic"), result: z.union([ObjectBaseSchema, z.undefined()]) }),
392
+ ])
393
+ });
@@ -3,9 +3,10 @@ export interface SchemaInfo {
3
3
  title: string;
4
4
  description?: string;
5
5
  path: string;
6
+ outputPath?: string;
6
7
  }
7
8
  export interface SchemaQueryRequest {
8
- action: "list" | "get" | "search" | "list_operations";
9
+ action: "list" | "get" | "search" | "list_operations" | "get_output";
9
10
  name?: string;
10
11
  query?: string;
11
12
  }
@@ -24,6 +25,7 @@ export declare function getSchemaIndex(): {
24
25
  } | null;
25
26
  export declare function listSchemas(): SchemaInfo[];
26
27
  export declare function getSchema(name: string): any | null;
28
+ export declare function getOutputSchema(name: string): any | null;
27
29
  export declare function searchSchemas(query: string): SchemaInfo[];
28
30
  export declare function listOperations(): SchemaInfo[];
29
31
  export declare function processSchemaQuery(request: SchemaQueryRequest): SchemaQueryResponse;
@@ -45,6 +45,20 @@ export function getSchema(name) {
45
45
  return null;
46
46
  }
47
47
  }
48
+ export function getOutputSchema(name) {
49
+ try {
50
+ const schemaPath = join(SCHEMAS_DIR, `${name}.output.json`);
51
+ if (!existsSync(schemaPath)) {
52
+ return null;
53
+ }
54
+ const content = readFileSync(schemaPath, "utf-8");
55
+ const schema = JSON.parse(content);
56
+ return resolveSchemaRefs(schema);
57
+ }
58
+ catch {
59
+ return null;
60
+ }
61
+ }
48
62
  function resolveSchemaRefs(schema, visited = new Set()) {
49
63
  if (!schema || typeof schema !== "object") {
50
64
  return schema;
@@ -55,9 +69,14 @@ function resolveSchemaRefs(schema, visited = new Set()) {
55
69
  const result = {};
56
70
  for (const [key, value] of Object.entries(schema)) {
57
71
  if (key === "$ref" && typeof value === "string") {
58
- const refSchema = loadRefSchema(value, visited);
59
- if (refSchema) {
60
- Object.assign(result, resolveSchemaRefs(refSchema, visited));
72
+ if (value.startsWith("#")) {
73
+ result[key] = value;
74
+ }
75
+ else {
76
+ const refSchema = loadRefSchema(value, visited);
77
+ if (refSchema) {
78
+ Object.assign(result, resolveSchemaRefs(refSchema, visited));
79
+ }
61
80
  }
62
81
  }
63
82
  else if (typeof value === "object") {
@@ -182,6 +201,47 @@ export function processSchemaQuery(request) {
182
201
  message: `Found ${operations.length} on-chain operations`,
183
202
  };
184
203
  }
204
+ case "get_output": {
205
+ if (!name) {
206
+ return {
207
+ success: false,
208
+ action,
209
+ data: null,
210
+ message: "Tool name is required for 'get_output' action",
211
+ suggestions: ["Provide a tool name", "Use 'list' action to see available tools and their outputPath"],
212
+ };
213
+ }
214
+ const schema = getOutputSchema(name);
215
+ if (!schema) {
216
+ const allSchemas = listSchemas();
217
+ const toolExists = allSchemas.find(s => s.name === name);
218
+ if (toolExists) {
219
+ return {
220
+ success: false,
221
+ action,
222
+ data: null,
223
+ message: `Tool '${name}' exists but has no output schema file. The tool may not declare an outputSchema, or the schema file was not generated.`,
224
+ suggestions: [`Use 'get' action with name='${name}' to retrieve its input schema`],
225
+ };
226
+ }
227
+ const suggestions = searchSchemas(name).slice(0, 5);
228
+ return {
229
+ success: false,
230
+ action,
231
+ data: null,
232
+ message: `Tool '${name}' not found`,
233
+ suggestions: suggestions.length > 0
234
+ ? suggestions.map(s => `Did you mean: ${s.name}?`)
235
+ : ["Use 'list' action to see available tools"],
236
+ };
237
+ }
238
+ return {
239
+ success: true,
240
+ action,
241
+ data: schema,
242
+ message: `Retrieved output schema: ${name}`,
243
+ };
244
+ }
185
245
  default:
186
246
  return {
187
247
  success: false,