@wowok/agent-mcp 2.2.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.
- package/README.md +56 -0
- package/dist/index.d.ts +15800 -0
- package/dist/index.js +1479 -0
- package/dist/schema/call/allocation.d.ts +1430 -0
- package/dist/schema/call/allocation.js +24 -0
- package/dist/schema/call/arbitration.d.ts +1974 -0
- package/dist/schema/call/arbitration.js +92 -0
- package/dist/schema/call/base.d.ts +7325 -0
- package/dist/schema/call/base.js +138 -0
- package/dist/schema/call/contact.d.ts +970 -0
- package/dist/schema/call/contact.js +37 -0
- package/dist/schema/call/demand.d.ts +1265 -0
- package/dist/schema/call/demand.js +47 -0
- package/dist/schema/call/guard.d.ts +951 -0
- package/dist/schema/call/guard.js +58 -0
- package/dist/schema/call/handler.d.ts +38 -0
- package/dist/schema/call/handler.js +171 -0
- package/dist/schema/call/index.d.ts +18 -0
- package/dist/schema/call/index.js +18 -0
- package/dist/schema/call/machine.d.ts +3974 -0
- package/dist/schema/call/machine.js +152 -0
- package/dist/schema/call/order.d.ts +974 -0
- package/dist/schema/call/order.js +34 -0
- package/dist/schema/call/payment.d.ts +404 -0
- package/dist/schema/call/payment.js +17 -0
- package/dist/schema/call/permission.d.ts +3017 -0
- package/dist/schema/call/permission.js +105 -0
- package/dist/schema/call/personal.d.ts +1472 -0
- package/dist/schema/call/personal.js +68 -0
- package/dist/schema/call/progress.d.ts +725 -0
- package/dist/schema/call/progress.js +26 -0
- package/dist/schema/call/proof.d.ts +320 -0
- package/dist/schema/call/proof.js +27 -0
- package/dist/schema/call/repository.d.ts +2358 -0
- package/dist/schema/call/repository.js +76 -0
- package/dist/schema/call/reward.d.ts +1232 -0
- package/dist/schema/call/reward.js +30 -0
- package/dist/schema/call/service.d.ts +3494 -0
- package/dist/schema/call/service.js +82 -0
- package/dist/schema/call/treasury.d.ts +2345 -0
- package/dist/schema/call/treasury.js +71 -0
- package/dist/schema/common/index.d.ts +843 -0
- package/dist/schema/common/index.js +347 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.js +7 -0
- package/dist/schema/local/index.d.ts +17522 -0
- package/dist/schema/local/index.js +855 -0
- package/dist/schema/local/wip.d.ts +784 -0
- package/dist/schema/local/wip.js +187 -0
- package/dist/schema/messenger/index.d.ts +4655 -0
- package/dist/schema/messenger/index.js +446 -0
- package/dist/schema/query/index.d.ts +73445 -0
- package/dist/schema/query/index.js +1324 -0
- package/dist/schema/utils/guard-parser.d.ts +20 -0
- package/dist/schema/utils/guard-parser.js +401 -0
- package/dist/schema/utils/guard-query-utils.d.ts +5 -0
- package/dist/schema/utils/guard-query-utils.js +22 -0
- package/dist/schema/utils/node-parser.d.ts +45 -0
- package/dist/schema/utils/node-parser.js +353 -0
- package/dist/schema/utils/permission-index-utils.d.ts +2 -0
- package/dist/schema/utils/permission-index-utils.js +7 -0
- package/package.json +48 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CallEnvSchema, NamedObjectSchema, SubmissionCallSchema } from './base.js';
|
|
3
|
+
import { GuardNodeSchema } from '../query/index.js';
|
|
4
|
+
import { DescriptionSchema, GuardTableItemBaseSchema, NameOrAddressSchema } from '../common/index.js';
|
|
5
|
+
export const CallGuard_RootSchema = z.discriminatedUnion("type", [
|
|
6
|
+
z.object({
|
|
7
|
+
type: z.literal("node"),
|
|
8
|
+
node: GuardNodeSchema.describe("Guard computational tree root node. MUST return a Bool value (pass/fail)."),
|
|
9
|
+
}).strict(),
|
|
10
|
+
z.object({
|
|
11
|
+
type: z.literal("file"),
|
|
12
|
+
file_path: z.string().describe("Path to JSON or Markdown file containing Guard definition. File can define: namedNew, description, table, root, rely."),
|
|
13
|
+
format: z.enum(["json", "markdown"]).optional().default("json")
|
|
14
|
+
.describe("File format: 'json' or 'markdown'. Default is 'json'."),
|
|
15
|
+
}).strict(),
|
|
16
|
+
]).describe("Guard root definition. Either provide a direct node tree or reference a file to load. When using file type, fields defined in the schema (namedNew, description, table, rely) will OVERRIDE the corresponding fields in the file.");
|
|
17
|
+
export const CallGuard_DataSchema = z.object({
|
|
18
|
+
namedNew: NamedObjectSchema.optional().describe("Name and optional tags for the new Guard object. Set 'onChain: true' to create a public on-chain identity. When using root.type='file', this field OVERRIDES namedNew in the file."),
|
|
19
|
+
description: DescriptionSchema.optional().describe("Guard description. When using root.type='file', this field OVERRIDES description in the file."),
|
|
20
|
+
table: z.array(GuardTableItemBaseSchema).optional().describe("Data table of the Guard object. When using root.type='file', this field OVERRIDES table in the file."),
|
|
21
|
+
root: CallGuard_RootSchema.describe("Root definition: either a direct node tree (type='node') or a file reference (type='file'). When type='file', the file can define all Guard fields (namedNew, description, table, root, rely), and schema fields override file content."),
|
|
22
|
+
rely: z.object({
|
|
23
|
+
guards: z.array(NameOrAddressSchema).describe("List of dependent Guard object IDs or names."),
|
|
24
|
+
logic_or: z.boolean().optional().describe("Whether to use logical OR operator."),
|
|
25
|
+
}).optional().describe("All Guard objects that the new Guard object depends on. If logic_or is true, the execution result of the new Guard object is the logical OR of the execution results of all dependent Guard objects; otherwise, it is logical AND. When using root.type='file', this field OVERRIDES rely in the file."),
|
|
26
|
+
}).strict().describe("On-chain Guard creation. IMPORTANT: All defined data (include all submitted data) must be defined in the 'table' field. USAGE: Set 'namedNew' field with {name, tags?, onChain?} to name the new Guard. The Guard is immutable once created. Define the validation logic in 'root' field. When root.type='file', the file can contain all Guard fields, and any fields defined in the schema will OVERRIDE the file content.");
|
|
27
|
+
export const CallGuard_InputSchema = z.object({
|
|
28
|
+
data: CallGuard_DataSchema.describe("Guard data definition."),
|
|
29
|
+
env: CallEnvSchema.optional(),
|
|
30
|
+
}).strict().describe("On-chain Guard creation input wrapper. Contains the Guard data definition and optional environment settings.");
|
|
31
|
+
export const CallGenPassport_InputSchema = z.object({
|
|
32
|
+
guard: z.union([NameOrAddressSchema, z.array(NameOrAddressSchema)]).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."),
|
|
33
|
+
info: SubmissionCallSchema.optional().describe("Optional submission data. If not provided, will attempt to get existing submissions from the guard."),
|
|
34
|
+
env: CallEnvSchema.optional(),
|
|
35
|
+
}).strict().describe("Generate a new Passport object after Guard verification succeeds. The Passport is an immutable on-chain object that can be used for offline friend verification, transaction condition verification, etc. Supports verifying multiple guards at once.");
|
|
36
|
+
export const Guard2File_InputSchema = z.object({
|
|
37
|
+
guard: NameOrAddressSchema.describe("Guard object ID or name to export"),
|
|
38
|
+
file_path: z.string().describe("Output file path (absolute or relative)"),
|
|
39
|
+
format: z.enum(["json", "markdown"]).optional().describe("Output format: 'json' (default) or 'markdown'"),
|
|
40
|
+
env: CallEnvSchema.optional(),
|
|
41
|
+
}).strict().describe("Query a Guard object from the blockchain and export its definition to a JSON or Markdown file. The exported file can be edited and used to create new Guard objects.");
|
|
42
|
+
export const Guard2File_OutputSchema = z.discriminatedUnion("status", [
|
|
43
|
+
z.object({
|
|
44
|
+
status: z.literal("success"),
|
|
45
|
+
data: z.object({
|
|
46
|
+
file_path: z.string().describe("Absolute path of the exported file"),
|
|
47
|
+
format: z.enum(["json", "markdown"]).describe("Export format"),
|
|
48
|
+
guard_object: z.string().describe("Guard object ID"),
|
|
49
|
+
}).strict().describe("Success result data"),
|
|
50
|
+
}).strict(),
|
|
51
|
+
z.object({
|
|
52
|
+
status: z.literal("error"),
|
|
53
|
+
error: z.string().describe("Error message"),
|
|
54
|
+
}).strict(),
|
|
55
|
+
]).describe("Guard2File operation output schema with discriminator");
|
|
56
|
+
export const Guard2File_OutputWrappedSchema = z.object({
|
|
57
|
+
result: Guard2File_OutputSchema,
|
|
58
|
+
}).strict().describe("Guard2File operation output wrapped schema");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CallEnv } from "wowok";
|
|
2
|
+
import type { CallOutput } from "./base.js";
|
|
3
|
+
export declare function handleCallResult(result: any): {
|
|
4
|
+
content: any[];
|
|
5
|
+
structuredContent: CallOutput;
|
|
6
|
+
};
|
|
7
|
+
export declare function createServerConfig(packageJson: any, description?: string): {
|
|
8
|
+
name: any;
|
|
9
|
+
version: any;
|
|
10
|
+
description: any;
|
|
11
|
+
};
|
|
12
|
+
export declare function createCapabilitiesConfig(): {
|
|
13
|
+
capabilities: {
|
|
14
|
+
prompts: {};
|
|
15
|
+
resources: {};
|
|
16
|
+
tools: {
|
|
17
|
+
listChanged: boolean;
|
|
18
|
+
};
|
|
19
|
+
logging: {};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare function createToolMeta(category: string, tags: string[]): {
|
|
23
|
+
author: string;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
lastUpdated: string;
|
|
26
|
+
category: string;
|
|
27
|
+
tags: string[];
|
|
28
|
+
requiresAuth: boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare function createToolAnnotations(readOnlyHint?: boolean, destructiveHint?: boolean): {
|
|
31
|
+
readOnlyHint: boolean;
|
|
32
|
+
destructiveHint: boolean;
|
|
33
|
+
idempotentHint: boolean;
|
|
34
|
+
openWorldHint: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare function transformSubmission(submission: any): Promise<any>;
|
|
37
|
+
export declare function validateInput<T>(data: any, schema: any): T;
|
|
38
|
+
export declare function getEnvConfig(env?: any): CallEnv;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { ResponseData, LocalMark, enrichMoveError } from "wowok";
|
|
2
|
+
export function handleCallResult(result) {
|
|
3
|
+
if (result && "error" in result) {
|
|
4
|
+
const enrichedError = enrichMoveError(result.error);
|
|
5
|
+
const output = {
|
|
6
|
+
message: `Error: ${enrichedError}`,
|
|
7
|
+
result: { type: "error", error: enrichedError },
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
content: [{ type: "text", text: output.message }],
|
|
11
|
+
structuredContent: output,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
if (result && "digest" in result) {
|
|
15
|
+
const r = ResponseData(result);
|
|
16
|
+
const txStatus = result?.effects?.status?.status;
|
|
17
|
+
const txError = result?.effects?.status?.error;
|
|
18
|
+
const isSuccess = txStatus === "success";
|
|
19
|
+
if (!isSuccess) {
|
|
20
|
+
const enrichedError = enrichMoveError(txError || txStatus || "unknown error");
|
|
21
|
+
const output = {
|
|
22
|
+
message: `Transaction failed: ${enrichedError}`,
|
|
23
|
+
result: { type: "error", error: enrichedError },
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{ type: "text", text: output.message },
|
|
28
|
+
{ type: "text", text: JSON.stringify(r) },
|
|
29
|
+
],
|
|
30
|
+
structuredContent: output,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const output = {
|
|
34
|
+
message: "Transaction completed successfully",
|
|
35
|
+
result: { type: "transaction", ...result },
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
content: [
|
|
39
|
+
{ type: "text", text: output.message },
|
|
40
|
+
{ type: "text", text: JSON.stringify(r) },
|
|
41
|
+
],
|
|
42
|
+
structuredContent: output,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (result && "guard" in result && "submission" in result) {
|
|
46
|
+
const output = {
|
|
47
|
+
message: "Submission required for Guard verification",
|
|
48
|
+
result: { type: "submission", ...result },
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{ type: "text", text: output.message },
|
|
53
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
54
|
+
],
|
|
55
|
+
structuredContent: output,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(result)) {
|
|
59
|
+
const output = {
|
|
60
|
+
message: "Operation completed",
|
|
61
|
+
result: { type: "data", data: result },
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{ type: "text", text: output.message },
|
|
66
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
67
|
+
],
|
|
68
|
+
structuredContent: output,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (result === undefined || result === null) {
|
|
72
|
+
const output = {
|
|
73
|
+
message: "Operation completed",
|
|
74
|
+
result: { type: "null" },
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
content: [{ type: "text", text: output.message }],
|
|
78
|
+
structuredContent: output,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const output = {
|
|
82
|
+
message: "Operation completed",
|
|
83
|
+
result: { type: "transaction", ...result },
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: output.message }],
|
|
87
|
+
structuredContent: output,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export function createServerConfig(packageJson, description) {
|
|
91
|
+
return {
|
|
92
|
+
name: packageJson.name,
|
|
93
|
+
version: packageJson.version,
|
|
94
|
+
description: description || packageJson.description,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export function createCapabilitiesConfig() {
|
|
98
|
+
return {
|
|
99
|
+
capabilities: {
|
|
100
|
+
prompts: {},
|
|
101
|
+
resources: {},
|
|
102
|
+
tools: { listChanged: true },
|
|
103
|
+
logging: {},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export function createToolMeta(category, tags) {
|
|
108
|
+
return {
|
|
109
|
+
author: "WOWOK Team",
|
|
110
|
+
createdAt: "2026-02-01",
|
|
111
|
+
lastUpdated: "2026-02-01",
|
|
112
|
+
category,
|
|
113
|
+
tags,
|
|
114
|
+
requiresAuth: false,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export function createToolAnnotations(readOnlyHint = false, destructiveHint = false) {
|
|
118
|
+
return {
|
|
119
|
+
readOnlyHint,
|
|
120
|
+
destructiveHint,
|
|
121
|
+
idempotentHint: true,
|
|
122
|
+
openWorldHint: false,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export async function transformSubmission(submission) {
|
|
126
|
+
if (!submission)
|
|
127
|
+
return undefined;
|
|
128
|
+
const guardNames = (submission.guard || []).map((g) => g.object).filter(Boolean);
|
|
129
|
+
const submissionGuardNames = (submission.submission || []).map((s) => s.guard).filter(Boolean);
|
|
130
|
+
const allNames = [...new Set([...guardNames, ...submissionGuardNames])];
|
|
131
|
+
const resolvedAddresses = allNames.length > 0
|
|
132
|
+
? await LocalMark.Instance().get_many_address(allNames)
|
|
133
|
+
: [];
|
|
134
|
+
const nameToAddress = new Map();
|
|
135
|
+
allNames.forEach((name, index) => {
|
|
136
|
+
const addr = resolvedAddresses[index];
|
|
137
|
+
if (addr) {
|
|
138
|
+
nameToAddress.set(name, addr);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const getAddress = (name) => {
|
|
142
|
+
if (nameToAddress.has(name)) {
|
|
143
|
+
return nameToAddress.get(name);
|
|
144
|
+
}
|
|
145
|
+
for (const [n, addr] of nameToAddress.entries()) {
|
|
146
|
+
if (n === name)
|
|
147
|
+
return addr;
|
|
148
|
+
}
|
|
149
|
+
if (name.startsWith("0x") && name.length === 66) {
|
|
150
|
+
return name;
|
|
151
|
+
}
|
|
152
|
+
throw new Error(`Guard name or address not found: ${name}`);
|
|
153
|
+
};
|
|
154
|
+
return {
|
|
155
|
+
type: "submission",
|
|
156
|
+
guard: (submission.guard || []).map((g) => ({
|
|
157
|
+
object: getAddress(g.object),
|
|
158
|
+
impack: g.impack || false,
|
|
159
|
+
})),
|
|
160
|
+
submission: (submission.submission || []).map((s) => ({
|
|
161
|
+
guard: getAddress(s.guard),
|
|
162
|
+
submission: s.submission || [],
|
|
163
|
+
})),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export function validateInput(data, schema) {
|
|
167
|
+
return schema.parse(data);
|
|
168
|
+
}
|
|
169
|
+
export function getEnvConfig(env) {
|
|
170
|
+
return env || {};
|
|
171
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './base.js';
|
|
2
|
+
export * from './handler.js';
|
|
3
|
+
export * from './contact.js';
|
|
4
|
+
export * from './demand.js';
|
|
5
|
+
export * from './guard.js';
|
|
6
|
+
export * from './machine.js';
|
|
7
|
+
export * from './arbitration.js';
|
|
8
|
+
export * from './allocation.js';
|
|
9
|
+
export * from './order.js';
|
|
10
|
+
export * from './payment.js';
|
|
11
|
+
export * from './permission.js';
|
|
12
|
+
export * from './personal.js';
|
|
13
|
+
export * from './proof.js';
|
|
14
|
+
export * from './progress.js';
|
|
15
|
+
export * from './repository.js';
|
|
16
|
+
export * from './reward.js';
|
|
17
|
+
export * from './service.js';
|
|
18
|
+
export * from './treasury.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './base.js';
|
|
2
|
+
export * from './handler.js';
|
|
3
|
+
export * from './contact.js';
|
|
4
|
+
export * from './demand.js';
|
|
5
|
+
export * from './guard.js';
|
|
6
|
+
export * from './machine.js';
|
|
7
|
+
export * from './arbitration.js';
|
|
8
|
+
export * from './allocation.js';
|
|
9
|
+
export * from './order.js';
|
|
10
|
+
export * from './payment.js';
|
|
11
|
+
export * from './permission.js';
|
|
12
|
+
export * from './personal.js';
|
|
13
|
+
export * from './proof.js';
|
|
14
|
+
export * from './progress.js';
|
|
15
|
+
export * from './repository.js';
|
|
16
|
+
export * from './reward.js';
|
|
17
|
+
export * from './service.js';
|
|
18
|
+
export * from './treasury.js';
|