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/README.md +2 -8
- package/dist/index.d.ts +14321 -3
- package/dist/index.js +50 -35
- 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/wip.d.ts +773 -25
- package/dist/schema/messenger/index.d.ts +3655 -31
- package/dist/schema/messenger/index.js +4 -4
- 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
|
}
|
|
@@ -744,33 +758,27 @@ async function handleMessengerOperation(args) {
|
|
|
744
758
|
break;
|
|
745
759
|
}
|
|
746
760
|
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.");
|
|
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
|
-
|
|
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.");
|
|
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
|
-
|
|
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.");
|
|
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
|
-
|
|
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:
|
|
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,
|
|
1003
|
-
const
|
|
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:
|
|
1021
|
+
text: message,
|
|
1009
1022
|
},
|
|
1010
1023
|
],
|
|
1011
1024
|
structuredContent: {
|
|
1012
1025
|
documentation_url: url,
|
|
1013
|
-
topic:
|
|
1026
|
+
topic: normalizedTopic,
|
|
1027
|
+
original_topic: args.topic,
|
|
1028
|
+
message: message,
|
|
1014
1029
|
},
|
|
1015
1030
|
};
|
|
1016
1031
|
});
|