wowok_agent 2.1.27 → 2.1.29

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 CHANGED
@@ -8,10 +8,156 @@ import packageJson from "../package.json" with { type: "json" };
8
8
  // Import schema
9
9
  import { CallService_DataSchema, CallMachine_DataSchema, MachineNode2File_InputSchema, MachineNode2File_OutputWrappedSchema, CallProgress_DataSchema, CallPermission_DataSchema, CallGuard_DataSchema, Guard2File_InputSchema, Guard2File_OutputWrappedSchema, CallArbitration_DataSchema, CallRepository_DataSchema, CallContact_DataSchema, CallTreasury_DataSchema, CallReward_DataSchema, CallAllocation_DataSchema, CallPersonal_DataSchema, CallPayment_DataSchema, CallDemand_DataSchema, CallOrder_DataSchema, CallEnvSchema, SubmissionCallSchema, strictParse, CallOutputSchema, handleCallResult, createServerConfig, createCapabilitiesConfig, createToolMeta, transformSubmission, getEnvConfig, WipGenerationOptionsSchema, WipToHtmlOptionsSchema, TokenDataFilterSchema, LocalInfoFilterSchema, LocalMarkFilterSchema, AccountFilterSchema, TokenTypeSchema, OnchainEventsInputSchema, OnchainEventsResultSchema, ProtocolInfoQuerySchema, ProtocolInfoResultSchema, WatchQueryOperationsResultSchema, NameOrAddressSchema, AccountOrMark_AddressSchema, ObjectTypeSchema, AccountOperationOutputWrappedSchema, LocalMarkOperationOutputWrappedSchema, LocalInfoOperationOutputWrappedSchema, WipOperationOutputSchema, MessengerOperationOutputSchema, AccountOperationSchema, LocalMarkOperationSchema, LocalInfoOperationSchema, parseMachineNodesFromText, formatNodeErrors as formatMachineNodeErrors, MessengerOperationInputSchema, } from "./schema/index.js";
10
10
  // Import wowok SDK
11
- import { CallService, CallMachine, CallProgress, CallPermission, CallGuard, CallArbitration, CallRepository, CallContact, CallTreasury, CallReward, CallAllocation, CallPersonal, CallPayment, CallDemand, CallOrder, gen_passport, guard2file, parseGuardFile, formatGuardParseErrors, machineNode2file, generateNodeComments, generate_wip, verify_wip, sign_wip, wip2html, account_operation, local_mark_operation, local_info_operation, watch_conversations, send_message, send_file, watch_messages, extract_zip_messages, generate_wts, verify_wts, sign_wts, wts2html, proof_message, query_local_mark_list, query_account_list, query_local_info_list, query_local_token_list, query_account, query_personal, query_objects, query_table, queryProtocolInfo, query_received, queryTableItem_RepositoryData, queryTableItem_PermissionPerm, queryTableItem_RewardRecord, queryTableItem_DemandPresenter, queryTableItem_TreasuryHistory, queryTableItem_MachineNode, queryTableItem_ProgressHistory, queryTableItem_AddressMark, queryTableItem_EntityRegistrar, queryTableItem_EntityLinker, query_events, blacklist, friendslist, guardlist, settings, } from "wowok";
11
+ import { CallService, CallMachine, CallProgress, CallPermission, CallGuard, CallArbitration, CallRepository, CallContact, CallTreasury, CallReward, CallAllocation, CallPersonal, CallPayment, CallDemand, CallOrder, gen_passport, guard2file, parseGuardFile, formatGuardParseErrors, machineNode2file, generateNodeComments, generate_wip, verify_wip, sign_wip, wip2html, account_operation, local_mark_operation, local_info_operation, watch_conversations, send_message, send_file, watch_messages, extract_zip_messages, generate_wts, verify_wts, sign_wts, wts2html, proof_message, query_local_mark_list, query_account_list, query_local_info_list, query_local_token_list, query_account, query_personal, query_objects, query_table, queryProtocolInfo, query_received, queryTableItem_RepositoryData, queryTableItem_PermissionPerm, queryTableItem_RewardRecord, queryTableItem_DemandPresenter, queryTableItem_TreasuryHistory, queryTableItem_MachineNode, queryTableItem_ProgressHistory, queryTableItem_AddressMark, queryTableItem_EntityRegistrar, queryTableItem_EntityLinker, query_events, blacklist, friendslist, guardlist, settings, AmountType, } from "wowok";
12
+ const SERVER_DESCRIPTION = `WoWok MCP Server - Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.
13
+
14
+ ## Token System Overview
15
+
16
+ ### Default Platform Token: WOW
17
+ - Token Type: 0x2::wow::WOW
18
+ - Precision: 1_000_000_000 (9 decimal places)
19
+ - This is the default token for all operations unless specified otherwise
20
+
21
+ ### Multi-Token Support
22
+ The platform supports ANY token (e.g., USDT, USDC, custom tokens). To use non-WOW tokens:
23
+ 1. Use query_toolkit with query_type='token_list' to query available tokens and their precision info
24
+ 2. Use the token's full type string (e.g., '0x2::usdt::USDT') in token_type parameter
25
+ 3. Each token has its own precision - always verify before operations
26
+
27
+ ### Token Precision Handling
28
+ Different tokens have different precisions. ALWAYS query to verify:
29
+ - WOW (default): 1_000_000_000 (9 decimals)
30
+ - Other tokens: Use query_toolkit with query_type='token_list' to get actual precision
31
+ - Never assume a token's decimal places - always query first
32
+
33
+ ## CRITICAL: Token Amount Handling
34
+
35
+ ### Amount Input Rules
36
+ 1. WITH currency unit (e.g., '2WOW', '10.5WOW', '100USDT'):
37
+ - Auto-converted using token's precision: 2WOW -> 2_000_000_000
38
+ - Use for: All on-chain token operations
39
+ - MUST match the token_type parameter
40
+
41
+ 2. WITHOUT currency unit (e.g., '2', '100'):
42
+ - Used as-is: 2 -> 2
43
+ - Use for: Regular numeric parameters (counts, indices, etc.)
44
+
45
+ ### Multi-Token Operation Examples
46
+ - Create USDT-priced Service: token_type='0x2::usdt::USDT', amount='100USDT'
47
+ - Allocate USDC rewards: token_type='0x2::usdc::USDC', amount='500USDC'
48
+ - WOW remains default: omit token_type or use '0x2::wow::WOW'
49
+
50
+ ### Security Warning
51
+ Token amounts are HIGHLY SENSITIVE. Always:
52
+ - Confirm user's intent before executing transfers
53
+ - Verify token type and amount format (with/without unit)
54
+ - Query token precision if unsure
55
+ - Double-check large amount transactions
56
+ - Never assume decimal places - use explicit token unit
57
+
58
+ ## Tool Selection Guide
59
+
60
+ | User Intent | Correct Tool | Wrong Tool (Avoid) |
61
+ |------------|--------------|-------------------|
62
+ | Create service listing | onchain_operations (service) | query_toolkit |
63
+ | Send coins to address | onchain_operations (payment) | account_operation |
64
+ | Check my balance | query_toolkit (account_balance) | onchain_operations |
65
+ | Manage local wallet | account_operation | onchain_operations |
66
+ | Export Guard for edit | guard2file | query_toolkit |
67
+ | Send/Watch encrypted message | messenger_operation | onchain_operations |
68
+ | Create workflow template | onchain_operations (machine) | wip_file |
69
+ | Store my phone number | local_info_operation | onchain_operations |
70
+ | Buy service (create order) | onchain_operations (order) | onchain_operations (service) |
71
+ | Manage my orders | onchain_operations (order) | query_toolkit |
72
+ | Apply for arbitration | onchain_operations (order) | onchain_operations (arbitration) |
73
+ | Create reward pool for marketing | onchain_operations (reward) | onchain_operations (treasury) |
74
+ | Claim rewards from pool | onchain_operations (reward) | query_toolkit |
75
+ | Create fund allocation plan | onchain_operations (allocation) | onchain_operations (treasury) |
76
+ | Execute fund distribution | onchain_operations (allocation) | onchain_operations (payment) |
77
+ | Post service demand with reward | onchain_operations (demand) | onchain_operations (service) |
78
+ | Submit solution for demand | onchain_operations (demand) | onchain_operations (order) |
79
+ | Create team treasury | onchain_operations (treasury) | onchain_operations (allocation) |
80
+ | Deposit/Withdraw from treasury | onchain_operations (treasury) | onchain_operations (payment) |
81
+ | Create access control rules | onchain_operations (permission) | onchain_operations (guard) |
82
+ | Create validation rules (Guard) | onchain_operations (guard) | onchain_operations (permission) |
83
+ | Export Guard for editing | guard2file | query_toolkit |
84
+ | Export Machine nodes for editing | machineNode2file | query_toolkit |
85
+ | Query token list and precision | query_toolkit (token_list) | wowok_buildin_info |
86
+ | Watch on-chain events | onchain_events | query_toolkit |
87
+ | Generate WIP promise file | wip_file (generate) | messenger_operation |
88
+ | Sign WIP file | wip_file (sign) | account_operation (signData) |
89
+ | Verify WIP file integrity | wip_file (verify) | query_toolkit |
90
+ | Send encrypted file via messenger | messenger_operation (send_file) | wip_file |
91
+ | Generate witness timestamp (WTS) | messenger_operation (generate_wts) | wip_file |
92
+ | Query protocol constants | wowok_buildin_info | query_toolkit |
93
+ | Get documentation URL | documents_and_learn | wowok_buildin_info |
94
+
95
+ ## Local vs On-chain Operations
96
+
97
+ ### LOCAL ONLY (Never touch blockchain):
98
+ - account_operation
99
+ - local_mark_operation
100
+ - local_info_operation
101
+
102
+ ### ON-CHAIN (Blockchain transactions):
103
+ - onchain_operations
104
+ - messenger_operation (some operations)
105
+ - wip_file (sign operation)
106
+
107
+ ### QUERY (Read-only):
108
+ - query_toolkit
109
+ - onchain_events
110
+ - wowok_buildin_info
111
+ - documents_and_learn
112
+ - guard2file
113
+ - machineNode2file
114
+ `;
12
115
  // Create server instance
13
116
  const server = new McpServer(createServerConfig(packageJson), createCapabilitiesConfig());
14
117
  // ================================================
118
+ // Helper Functions
119
+ // ================================================
120
+ /**
121
+ * Convert string amount type to AmountType enum
122
+ * Handles case-insensitive matching
123
+ */
124
+ function convertAmountType(type) {
125
+ if (typeof type === "number")
126
+ return type;
127
+ const upperType = type.toUpperCase();
128
+ if (upperType === "GUARDU64IDENTIFIER" || upperType === "GUARD_U64_IDENTIFIER") {
129
+ return AmountType.GuardU64Identifier;
130
+ }
131
+ if (upperType === "FIXED") {
132
+ return AmountType.Fixed;
133
+ }
134
+ return AmountType.Fixed; // default
135
+ }
136
+ /**
137
+ * Transform reward data to convert string amount types to enum values
138
+ */
139
+ function transformRewardData(data) {
140
+ if (!data)
141
+ return data;
142
+ const transformed = { ...data };
143
+ // Transform guard_add array
144
+ if (transformed.guard_add && Array.isArray(transformed.guard_add)) {
145
+ transformed.guard_add = transformed.guard_add.map((guard) => {
146
+ if (guard.amount && typeof guard.amount.type === "string") {
147
+ return {
148
+ ...guard,
149
+ amount: {
150
+ ...guard.amount,
151
+ type: convertAmountType(guard.amount.type)
152
+ }
153
+ };
154
+ }
155
+ return guard;
156
+ });
157
+ }
158
+ return transformed;
159
+ }
160
+ // ================================================
15
161
  // Schema Definitions
16
162
  // ================================================
17
163
  // On-chain Operations Schema (Merged from Merchant and Personal Operations)
@@ -314,7 +460,9 @@ async function handleOnchainOperations(args) {
314
460
  return handleCallResult(result);
315
461
  }
316
462
  case "reward": {
317
- const callReward = new CallReward(validated.data);
463
+ // Transform reward data to convert string amount types to enum values
464
+ const transformedData = transformRewardData(validated.data);
465
+ const callReward = new CallReward(transformedData);
318
466
  const result = validated.submission
319
467
  ? await callReward.call_with_submission(env, transformSubmission(validated.submission))
320
468
  : await callReward.call(env);
@@ -60,7 +60,7 @@ export declare const CallOrder_DataSchema: z.ZodObject<{
60
60
  check_all_founded?: boolean | undefined;
61
61
  }>>;
62
62
  required_info: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNull]>>;
63
- progress: z.ZodOptional<z.ZodDiscriminatedUnion<"hold", [z.ZodObject<{
63
+ progress: z.ZodOptional<z.ZodObject<{
64
64
  operation: z.ZodObject<{
65
65
  next_node_name: z.ZodEffects<z.ZodString, string, string>;
66
66
  forward: z.ZodEffects<z.ZodString, string, string>;
@@ -71,53 +71,26 @@ export declare const CallOrder_DataSchema: z.ZodObject<{
71
71
  forward: string;
72
72
  next_node_name: string;
73
73
  }>;
74
- hold: z.ZodLiteral<true>;
74
+ hold: z.ZodOptional<z.ZodBoolean>;
75
75
  adminUnhold: z.ZodOptional<z.ZodBoolean>;
76
76
  message: z.ZodOptional<z.ZodString>;
77
77
  }, "strict", z.ZodTypeAny, {
78
- hold: true;
79
78
  operation: {
80
79
  forward: string;
81
80
  next_node_name: string;
82
81
  };
83
82
  message?: string | undefined;
83
+ hold?: boolean | undefined;
84
84
  adminUnhold?: boolean | undefined;
85
85
  }, {
86
- hold: true;
87
86
  operation: {
88
87
  forward: string;
89
88
  next_node_name: string;
90
89
  };
91
90
  message?: string | undefined;
91
+ hold?: boolean | undefined;
92
92
  adminUnhold?: boolean | undefined;
93
- }>, z.ZodObject<{
94
- operation: z.ZodObject<{
95
- next_node_name: z.ZodEffects<z.ZodString, string, string>;
96
- forward: z.ZodEffects<z.ZodString, string, string>;
97
- }, "strict", z.ZodTypeAny, {
98
- forward: string;
99
- next_node_name: string;
100
- }, {
101
- forward: string;
102
- next_node_name: string;
103
- }>;
104
- hold: z.ZodLiteral<false>;
105
- message: z.ZodOptional<z.ZodString>;
106
- }, "strict", z.ZodTypeAny, {
107
- hold: false;
108
- operation: {
109
- forward: string;
110
- next_node_name: string;
111
- };
112
- message?: string | undefined;
113
- }, {
114
- hold: false;
115
- operation: {
116
- forward: string;
117
- next_node_name: string;
118
- };
119
- message?: string | undefined;
120
- }>]>>;
93
+ }>>;
121
94
  arb_confirm: z.ZodOptional<z.ZodObject<{
122
95
  arb: z.ZodEffects<z.ZodString, string, string>;
123
96
  confirm: z.ZodBoolean;
@@ -234,20 +207,13 @@ export declare const CallOrder_DataSchema: z.ZodObject<{
234
207
  }, "strict", z.ZodTypeAny, {
235
208
  object: string;
236
209
  progress?: {
237
- hold: true;
238
210
  operation: {
239
211
  forward: string;
240
212
  next_node_name: string;
241
213
  };
242
214
  message?: string | undefined;
215
+ hold?: boolean | undefined;
243
216
  adminUnhold?: boolean | undefined;
244
- } | {
245
- hold: false;
246
- operation: {
247
- forward: string;
248
- next_node_name: string;
249
- };
250
- message?: string | undefined;
251
217
  } | undefined;
252
218
  required_info?: string | null | undefined;
253
219
  agents?: {
@@ -291,20 +257,13 @@ export declare const CallOrder_DataSchema: z.ZodObject<{
291
257
  }, {
292
258
  object: string;
293
259
  progress?: {
294
- hold: true;
295
260
  operation: {
296
261
  forward: string;
297
262
  next_node_name: string;
298
263
  };
299
264
  message?: string | undefined;
265
+ hold?: boolean | undefined;
300
266
  adminUnhold?: boolean | undefined;
301
- } | {
302
- hold: false;
303
- operation: {
304
- forward: string;
305
- next_node_name: string;
306
- };
307
- message?: string | undefined;
308
267
  } | undefined;
309
268
  required_info?: string | null | undefined;
310
269
  agents?: {
@@ -375,7 +334,7 @@ export declare const CallOrder_InputSchema: z.ZodObject<{
375
334
  check_all_founded?: boolean | undefined;
376
335
  }>>;
377
336
  required_info: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNull]>>;
378
- progress: z.ZodOptional<z.ZodDiscriminatedUnion<"hold", [z.ZodObject<{
337
+ progress: z.ZodOptional<z.ZodObject<{
379
338
  operation: z.ZodObject<{
380
339
  next_node_name: z.ZodEffects<z.ZodString, string, string>;
381
340
  forward: z.ZodEffects<z.ZodString, string, string>;
@@ -386,53 +345,26 @@ export declare const CallOrder_InputSchema: z.ZodObject<{
386
345
  forward: string;
387
346
  next_node_name: string;
388
347
  }>;
389
- hold: z.ZodLiteral<true>;
348
+ hold: z.ZodOptional<z.ZodBoolean>;
390
349
  adminUnhold: z.ZodOptional<z.ZodBoolean>;
391
350
  message: z.ZodOptional<z.ZodString>;
392
351
  }, "strict", z.ZodTypeAny, {
393
- hold: true;
394
352
  operation: {
395
353
  forward: string;
396
354
  next_node_name: string;
397
355
  };
398
356
  message?: string | undefined;
357
+ hold?: boolean | undefined;
399
358
  adminUnhold?: boolean | undefined;
400
359
  }, {
401
- hold: true;
402
360
  operation: {
403
361
  forward: string;
404
362
  next_node_name: string;
405
363
  };
406
364
  message?: string | undefined;
365
+ hold?: boolean | undefined;
407
366
  adminUnhold?: boolean | undefined;
408
- }>, z.ZodObject<{
409
- operation: z.ZodObject<{
410
- next_node_name: z.ZodEffects<z.ZodString, string, string>;
411
- forward: z.ZodEffects<z.ZodString, string, string>;
412
- }, "strict", z.ZodTypeAny, {
413
- forward: string;
414
- next_node_name: string;
415
- }, {
416
- forward: string;
417
- next_node_name: string;
418
- }>;
419
- hold: z.ZodLiteral<false>;
420
- message: z.ZodOptional<z.ZodString>;
421
- }, "strict", z.ZodTypeAny, {
422
- hold: false;
423
- operation: {
424
- forward: string;
425
- next_node_name: string;
426
- };
427
- message?: string | undefined;
428
- }, {
429
- hold: false;
430
- operation: {
431
- forward: string;
432
- next_node_name: string;
433
- };
434
- message?: string | undefined;
435
- }>]>>;
367
+ }>>;
436
368
  arb_confirm: z.ZodOptional<z.ZodObject<{
437
369
  arb: z.ZodEffects<z.ZodString, string, string>;
438
370
  confirm: z.ZodBoolean;
@@ -549,20 +481,13 @@ export declare const CallOrder_InputSchema: z.ZodObject<{
549
481
  }, "strict", z.ZodTypeAny, {
550
482
  object: string;
551
483
  progress?: {
552
- hold: true;
553
484
  operation: {
554
485
  forward: string;
555
486
  next_node_name: string;
556
487
  };
557
488
  message?: string | undefined;
489
+ hold?: boolean | undefined;
558
490
  adminUnhold?: boolean | undefined;
559
- } | {
560
- hold: false;
561
- operation: {
562
- forward: string;
563
- next_node_name: string;
564
- };
565
- message?: string | undefined;
566
491
  } | undefined;
567
492
  required_info?: string | null | undefined;
568
493
  agents?: {
@@ -606,20 +531,13 @@ export declare const CallOrder_InputSchema: z.ZodObject<{
606
531
  }, {
607
532
  object: string;
608
533
  progress?: {
609
- hold: true;
610
534
  operation: {
611
535
  forward: string;
612
536
  next_node_name: string;
613
537
  };
614
538
  message?: string | undefined;
539
+ hold?: boolean | undefined;
615
540
  adminUnhold?: boolean | undefined;
616
- } | {
617
- hold: false;
618
- operation: {
619
- forward: string;
620
- next_node_name: string;
621
- };
622
- message?: string | undefined;
623
541
  } | undefined;
624
542
  required_info?: string | null | undefined;
625
543
  agents?: {
@@ -864,20 +782,13 @@ export declare const CallOrder_InputSchema: z.ZodObject<{
864
782
  data: {
865
783
  object: string;
866
784
  progress?: {
867
- hold: true;
868
785
  operation: {
869
786
  forward: string;
870
787
  next_node_name: string;
871
788
  };
872
789
  message?: string | undefined;
790
+ hold?: boolean | undefined;
873
791
  adminUnhold?: boolean | undefined;
874
- } | {
875
- hold: false;
876
- operation: {
877
- forward: string;
878
- next_node_name: string;
879
- };
880
- message?: string | undefined;
881
792
  } | undefined;
882
793
  required_info?: string | null | undefined;
883
794
  agents?: {
@@ -957,20 +868,13 @@ export declare const CallOrder_InputSchema: z.ZodObject<{
957
868
  data: {
958
869
  object: string;
959
870
  progress?: {
960
- hold: true;
961
871
  operation: {
962
872
  forward: string;
963
873
  next_node_name: string;
964
874
  };
965
875
  message?: string | undefined;
876
+ hold?: boolean | undefined;
966
877
  adminUnhold?: boolean | undefined;
967
- } | {
968
- hold: false;
969
- operation: {
970
- forward: string;
971
- next_node_name: string;
972
- };
973
- message?: string | undefined;
974
878
  } | undefined;
975
879
  required_info?: string | null | undefined;
976
880
  agents?: {