wowok_agent 2.1.9 → 2.1.17

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,11 +8,7 @@ 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, 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, } from "wowok";
12
- // TODO: Uncomment these once agent/mcp can import these properly
13
- // import {
14
- // blacklist, friendslist, guardlist,
15
- // } 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, } from "wowok";
16
12
  // Create server instance
17
13
  const server = new McpServer(createServerConfig(packageJson), createCapabilitiesConfig());
18
14
  // ================================================
@@ -160,7 +156,7 @@ const WatchQueryOperationsSchema = z.discriminatedUnion("query_type", [
160
156
  }).describe("Query token list with optional filter"),
161
157
  z.object({
162
158
  query_type: z.literal("account_balance"),
163
- account: NameOrAddressSchema.optional().describe("Account name or address. Use empty string '' for the default account. Defaults to '' if omitted."),
159
+ name_or_address: NameOrAddressSchema.optional().describe("Account name or address. Use empty string '' for the default account. Defaults to '' if omitted."),
164
160
  token_type: TokenTypeSchema.optional().describe("Token type; default token type is 0x2::wow::WOW"),
165
161
  }).describe("Query account balance or coin objects by the token type"),
166
162
  z.object({
@@ -584,7 +580,7 @@ async function handleWatchQueryOperations(args) {
584
580
  break;
585
581
  }
586
582
  case "account_balance": {
587
- const queryResult = await query_account({ name_or_address: validated.account, token_type: validated.token_type, balance: true });
583
+ const queryResult = await query_account({ name_or_address: validated.name_or_address, token_type: validated.token_type, balance: true });
588
584
  result = { query_type: "account_balance", result: queryResult };
589
585
  break;
590
586
  }
@@ -595,6 +591,24 @@ async function handleWatchQueryOperations(args) {
595
591
  }
596
592
  case "onchain_objects": {
597
593
  const queryResult = await query_objects({ objects: validated.objects });
594
+ // 为 Guard 对象添加指令树说明
595
+ if (queryResult && queryResult.objects && Array.isArray(queryResult.objects)) {
596
+ queryResult.objects = queryResult.objects.map((obj) => {
597
+ if (obj && obj.data && obj.data.type === "Guard" && obj.data.root) {
598
+ try {
599
+ const nodeComments = generateNodeComments(obj.data.root);
600
+ return {
601
+ ...obj,
602
+ _guard_node_comments: nodeComments
603
+ };
604
+ }
605
+ catch (e) {
606
+ return obj;
607
+ }
608
+ }
609
+ return obj;
610
+ });
611
+ }
598
612
  result = { query_type: "onchain_objects", result: queryResult };
599
613
  break;
600
614
  }
@@ -744,33 +758,27 @@ async function handleMessengerOperation(args) {
744
758
  break;
745
759
  }
746
760
  case "blacklist": {
747
- // TODO: Uncomment once blacklist is properly imported
748
- // const blacklistResult = await blacklist({
749
- // account: validated.account,
750
- // ...validated.blacklist
751
- // } as any);
752
- // result = { operation: "blacklist", op: validated.blacklist.op, result: blacklistResult.result };
753
- throw new Error("Blacklist operation is temporarily unavailable. Please re-install agent/mcp dependencies.");
761
+ const blacklistResult = await blacklist({
762
+ account: validated.account,
763
+ ...validated.blacklist
764
+ });
765
+ result = { operation: "blacklist", op: validated.blacklist.op, result: blacklistResult.result };
754
766
  break;
755
767
  }
756
768
  case "friendslist": {
757
- // TODO: Uncomment once friendslist is properly imported
758
- // const friendslistResult = await friendslist({
759
- // account: validated.account,
760
- // ...validated.friendslist
761
- // } as any);
762
- // result = { operation: "friendslist", op: validated.friendslist.op, result: friendslistResult.result };
763
- throw new Error("Friendslist operation is temporarily unavailable. Please re-install agent/mcp dependencies.");
769
+ const friendslistResult = await friendslist({
770
+ account: validated.account,
771
+ ...validated.friendslist
772
+ });
773
+ result = { operation: "friendslist", op: validated.friendslist.op, result: friendslistResult.result };
764
774
  break;
765
775
  }
766
776
  case "guardlist": {
767
- // TODO: Uncomment once guardlist is properly imported
768
- // const guardlistResult = await guardlist({
769
- // account: validated.account,
770
- // ...validated.guardlist
771
- // } as any);
772
- // result = { operation: "guardlist", op: validated.guardlist.op, result: guardlistResult.result };
773
- throw new Error("Guardlist operation is temporarily unavailable. Please re-install agent/mcp dependencies.");
777
+ const guardlistResult = await guardlist({
778
+ account: validated.account,
779
+ ...validated.guardlist
780
+ });
781
+ result = { operation: "guardlist", op: validated.guardlist.op, result: guardlistResult.result };
774
782
  break;
775
783
  }
776
784
  default:
@@ -778,7 +786,7 @@ async function handleMessengerOperation(args) {
778
786
  }
779
787
  return {
780
788
  content: [{ type: "text", text: JSON.stringify(result) }],
781
- structuredContent: result,
789
+ structuredContent: { result },
782
790
  };
783
791
  }
784
792
  // ================================================
@@ -978,7 +986,8 @@ async function main() {
978
986
  outputSchema: z.object({
979
987
  documentation_url: z.string().describe("Official WoWok documentation URL on GitHub"),
980
988
  topic: z.string().optional().describe("Requested topic if specified"),
981
- message: z.string().describe("Welcome message with documentation information"),
989
+ original_topic: z.string().optional().describe("Original topic input by user (before normalization)"),
990
+ message: z.string().describe("Welcome message with documentation information. Always included in response."),
982
991
  }),
983
992
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
984
993
  _meta: createToolMeta("documentation", ["docs", "learn", "tutorial", "guide", "help", "reference"]),
@@ -987,30 +996,36 @@ async function main() {
987
996
  if (!args.topic) {
988
997
  // No topic specified, return base documentation URL
989
998
  const url = GITHUB_BASE_URL;
999
+ const message = `Welcome to WoWok Documentation! Access comprehensive guides, tutorials, and API references at: ${url}`;
990
1000
  return {
991
1001
  content: [
992
1002
  {
993
1003
  type: "text",
994
- text: `Welcome to WoWok Documentation! Access comprehensive guides, tutorials, and API references at: ${url}`,
1004
+ text: message,
995
1005
  },
996
1006
  ],
997
1007
  structuredContent: {
998
1008
  documentation_url: url,
1009
+ message: message,
999
1010
  },
1000
1011
  };
1001
1012
  }
1002
- // Topic specified, construct URL
1003
- const url = `${GITHUB_BASE_URL}/${args.topic}.md`;
1013
+ // Topic specified, normalize to lowercase for case-insensitive matching
1014
+ const normalizedTopic = args.topic.toLowerCase().trim();
1015
+ const url = `${GITHUB_BASE_URL}/${normalizedTopic}.md`;
1016
+ const message = `Documentation for "${normalizedTopic}"\nGitHub URL: ${url}`;
1004
1017
  return {
1005
1018
  content: [
1006
1019
  {
1007
1020
  type: "text",
1008
- text: `Documentation for "${args.topic}"\nGitHub URL: ${url}`,
1021
+ text: message,
1009
1022
  },
1010
1023
  ],
1011
1024
  structuredContent: {
1012
1025
  documentation_url: url,
1013
- topic: args.topic,
1026
+ topic: normalizedTopic,
1027
+ original_topic: args.topic,
1028
+ message: message,
1014
1029
  },
1015
1030
  };
1016
1031
  });