wowok_agent 2.1.9 → 2.1.18
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/README.md +2 -8
- package/dist/index.d.ts +14321 -3
- package/dist/index.js +76 -37
- package/dist/schema/call/allocation.d.ts +1426 -4
- package/dist/schema/call/arbitration.d.ts +1948 -13
- package/dist/schema/call/base.d.ts +7289 -20
- package/dist/schema/call/contact.d.ts +953 -4
- package/dist/schema/call/demand.d.ts +1248 -5
- package/dist/schema/call/guard.d.ts +943 -7
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/machine.d.ts +3952 -13
- package/dist/schema/call/order.d.ts +1048 -5
- package/dist/schema/call/payment.d.ts +400 -3
- package/dist/schema/call/permission.d.ts +2991 -13
- package/dist/schema/call/personal.d.ts +1458 -13
- package/dist/schema/call/progress.d.ts +907 -6
- package/dist/schema/call/proof.d.ts +316 -3
- package/dist/schema/call/repository.d.ts +2346 -15
- package/dist/schema/call/reward.d.ts +1238 -7
- package/dist/schema/call/service.d.ts +3654 -7
- package/dist/schema/call/treasury.d.ts +2459 -6
- package/dist/schema/common/index.d.ts +754 -33
- package/dist/schema/common/index.js +5 -1
- package/dist/schema/local/index.d.ts +7784 -54
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/local/wip.d.ts +773 -25
- package/dist/schema/messenger/index.d.ts +3655 -31
- package/dist/schema/messenger/index.js +9 -9
- package/dist/schema/query/index.d.ts +47258 -128
- package/dist/schema/query/index.js +3 -61
- package/dist/schema/utils/guard-query-utils.d.ts +2 -2
- package/package.json +10 -10
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
|
-
|
|
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.
|
|
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
|
}
|
|
@@ -700,12 +714,36 @@ async function handleMessengerOperation(args) {
|
|
|
700
714
|
}
|
|
701
715
|
case "send_message": {
|
|
702
716
|
const sendResult = await send_message(validated.from, validated.to, validated.content, validated.options);
|
|
703
|
-
|
|
717
|
+
// Filter out leafHash from merkleData to match schema
|
|
718
|
+
const filteredResult = {
|
|
719
|
+
...sendResult,
|
|
720
|
+
merkleData: sendResult.merkleData ? {
|
|
721
|
+
leafIndex: sendResult.merkleData.leafIndex,
|
|
722
|
+
prevRoot: sendResult.merkleData.prevRoot,
|
|
723
|
+
newRoot: sendResult.merkleData.newRoot,
|
|
724
|
+
serverSignature: sendResult.merkleData.serverSignature,
|
|
725
|
+
serverTimestamp: sendResult.merkleData.serverTimestamp,
|
|
726
|
+
serverPublicKey: sendResult.merkleData.serverPublicKey,
|
|
727
|
+
} : undefined,
|
|
728
|
+
};
|
|
729
|
+
result = { operation: "send_message", result: filteredResult };
|
|
704
730
|
break;
|
|
705
731
|
}
|
|
706
732
|
case "send_file": {
|
|
707
733
|
const sendResult = await send_file(validated.from, validated.to, validated.filePath, validated.options);
|
|
708
|
-
|
|
734
|
+
// Filter out leafHash from merkleData to match schema
|
|
735
|
+
const filteredResult = {
|
|
736
|
+
...sendResult,
|
|
737
|
+
merkleData: sendResult.merkleData ? {
|
|
738
|
+
leafIndex: sendResult.merkleData.leafIndex,
|
|
739
|
+
prevRoot: sendResult.merkleData.prevRoot,
|
|
740
|
+
newRoot: sendResult.merkleData.newRoot,
|
|
741
|
+
serverSignature: sendResult.merkleData.serverSignature,
|
|
742
|
+
serverTimestamp: sendResult.merkleData.serverTimestamp,
|
|
743
|
+
serverPublicKey: sendResult.merkleData.serverPublicKey,
|
|
744
|
+
} : undefined,
|
|
745
|
+
};
|
|
746
|
+
result = { operation: "send_file", result: filteredResult };
|
|
709
747
|
break;
|
|
710
748
|
}
|
|
711
749
|
case "watch_messages": {
|
|
@@ -744,33 +782,27 @@ async function handleMessengerOperation(args) {
|
|
|
744
782
|
break;
|
|
745
783
|
}
|
|
746
784
|
case "blacklist": {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
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.");
|
|
785
|
+
const blacklistResult = await blacklist({
|
|
786
|
+
account: validated.account,
|
|
787
|
+
...validated.blacklist
|
|
788
|
+
});
|
|
789
|
+
result = { operation: "blacklist", op: validated.blacklist.op, result: blacklistResult.result };
|
|
754
790
|
break;
|
|
755
791
|
}
|
|
756
792
|
case "friendslist": {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
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.");
|
|
793
|
+
const friendslistResult = await friendslist({
|
|
794
|
+
account: validated.account,
|
|
795
|
+
...validated.friendslist
|
|
796
|
+
});
|
|
797
|
+
result = { operation: "friendslist", op: validated.friendslist.op, result: friendslistResult.result };
|
|
764
798
|
break;
|
|
765
799
|
}
|
|
766
800
|
case "guardlist": {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
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.");
|
|
801
|
+
const guardlistResult = await guardlist({
|
|
802
|
+
account: validated.account,
|
|
803
|
+
...validated.guardlist
|
|
804
|
+
});
|
|
805
|
+
result = { operation: "guardlist", op: validated.guardlist.op, result: guardlistResult.result };
|
|
774
806
|
break;
|
|
775
807
|
}
|
|
776
808
|
default:
|
|
@@ -778,7 +810,7 @@ async function handleMessengerOperation(args) {
|
|
|
778
810
|
}
|
|
779
811
|
return {
|
|
780
812
|
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
781
|
-
structuredContent: result,
|
|
813
|
+
structuredContent: { result },
|
|
782
814
|
};
|
|
783
815
|
}
|
|
784
816
|
// ================================================
|
|
@@ -978,7 +1010,8 @@ async function main() {
|
|
|
978
1010
|
outputSchema: z.object({
|
|
979
1011
|
documentation_url: z.string().describe("Official WoWok documentation URL on GitHub"),
|
|
980
1012
|
topic: z.string().optional().describe("Requested topic if specified"),
|
|
981
|
-
|
|
1013
|
+
original_topic: z.string().optional().describe("Original topic input by user (before normalization)"),
|
|
1014
|
+
message: z.string().describe("Welcome message with documentation information. Always included in response."),
|
|
982
1015
|
}),
|
|
983
1016
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
984
1017
|
_meta: createToolMeta("documentation", ["docs", "learn", "tutorial", "guide", "help", "reference"]),
|
|
@@ -987,30 +1020,36 @@ async function main() {
|
|
|
987
1020
|
if (!args.topic) {
|
|
988
1021
|
// No topic specified, return base documentation URL
|
|
989
1022
|
const url = GITHUB_BASE_URL;
|
|
1023
|
+
const message = `Welcome to WoWok Documentation! Access comprehensive guides, tutorials, and API references at: ${url}`;
|
|
990
1024
|
return {
|
|
991
1025
|
content: [
|
|
992
1026
|
{
|
|
993
1027
|
type: "text",
|
|
994
|
-
text:
|
|
1028
|
+
text: message,
|
|
995
1029
|
},
|
|
996
1030
|
],
|
|
997
1031
|
structuredContent: {
|
|
998
1032
|
documentation_url: url,
|
|
1033
|
+
message: message,
|
|
999
1034
|
},
|
|
1000
1035
|
};
|
|
1001
1036
|
}
|
|
1002
|
-
// Topic specified,
|
|
1003
|
-
const
|
|
1037
|
+
// Topic specified, normalize to lowercase for case-insensitive matching
|
|
1038
|
+
const normalizedTopic = args.topic.toLowerCase().trim();
|
|
1039
|
+
const url = `${GITHUB_BASE_URL}/${normalizedTopic}.md`;
|
|
1040
|
+
const message = `Documentation for "${normalizedTopic}"\nGitHub URL: ${url}`;
|
|
1004
1041
|
return {
|
|
1005
1042
|
content: [
|
|
1006
1043
|
{
|
|
1007
1044
|
type: "text",
|
|
1008
|
-
text:
|
|
1045
|
+
text: message,
|
|
1009
1046
|
},
|
|
1010
1047
|
],
|
|
1011
1048
|
structuredContent: {
|
|
1012
1049
|
documentation_url: url,
|
|
1013
|
-
topic:
|
|
1050
|
+
topic: normalizedTopic,
|
|
1051
|
+
original_topic: args.topic,
|
|
1052
|
+
message: message,
|
|
1014
1053
|
},
|
|
1015
1054
|
};
|
|
1016
1055
|
});
|