@wowok/agent-mcp 2.6.1 → 2.6.3
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/customer/info-puzzle.d.ts +1 -1
- package/dist/customer/info-puzzle.js +4 -2
- package/dist/customer/risk-assessment.js +26 -4
- package/dist/customer/types.d.ts +2 -0
- package/dist/examples/guard-template-balance-check.json +38 -0
- package/dist/examples/guard-template-time-lock.json +39 -0
- package/dist/examples/machine-template-7node-rental.json +114 -0
- package/dist/examples/rental-ziroom-machine-create.json +137 -0
- package/dist/examples/rental-ziroom-permission-create.json +35 -0
- package/dist/examples/rental-ziroom-service-create.json +80 -0
- package/dist/examples/retail-myshop-service-create.json +88 -0
- package/dist/extensions/capability-manifest.js +24 -24
- package/dist/extensions/constraint-registry.js +18 -18
- package/dist/extensions/metric-registry.js +14 -14
- package/dist/extensions/mode-evaluator.js +16 -16
- package/dist/extensions/modes.js +131 -45
- package/dist/extensions/registry.d.ts +2 -0
- package/dist/extensions/registry.js +63 -30
- package/dist/extensions/types.d.ts +1 -0
- package/dist/index.js +50 -0
- package/dist/knowledge/deployment-scanner.js +1 -1
- package/dist/knowledge/fund-layer.d.ts +72 -0
- package/dist/knowledge/fund-layer.js +420 -0
- package/dist/knowledge/guard-render.d.ts +57 -0
- package/dist/knowledge/guard-render.js +700 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
- package/dist/knowledge/guard-submission-prompt.js +171 -0
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-render.d.ts +41 -0
- package/dist/knowledge/machine-render.js +565 -0
- package/dist/knowledge/machine-templates.js +4 -4
- package/dist/knowledge/reward-confirm.js +2 -2
- package/dist/knowledge/reward-puzzle.js +1 -1
- package/dist/knowledge/reward-risk.js +9 -9
- package/dist/knowledge/reward-templates.js +2 -2
- package/dist/knowledge/service-confirm.d.ts +1 -1
- package/dist/knowledge/service-confirm.js +3 -3
- package/dist/knowledge/service-context.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +3 -3
- package/dist/knowledge/service-templates.js +2 -2
- package/dist/knowledge/service-translation.d.ts +1 -1
- package/dist/knowledge/service-translation.js +7 -7
- package/dist/project/deployment-bridge.js +6 -5
- package/dist/project/deployment-doc.js +5 -5
- package/dist/project/edit-planner.d.ts +123 -0
- package/dist/project/edit-planner.js +1371 -0
- package/dist/project/evaluation.js +314 -14
- package/dist/project/graph-builder.js +6 -1
- package/dist/project/handlers.d.ts +99 -2
- package/dist/project/handlers.js +358 -16
- package/dist/project/stage-gate.js +4 -4
- package/dist/schema/call/allocation.js +2 -2
- package/dist/schema/call/arbitration.js +19 -6
- package/dist/schema/call/contact.js +2 -2
- package/dist/schema/call/demand.js +2 -2
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/machine.d.ts +1975 -777
- package/dist/schema/call/machine.js +50 -4
- package/dist/schema/call/order.js +3 -6
- package/dist/schema/call/permission.js +2 -2
- package/dist/schema/call/repository.js +2 -2
- package/dist/schema/call/reward.js +3 -3
- package/dist/schema/call/semantic.js +7 -1
- package/dist/schema/call/service.d.ts +180 -8
- package/dist/schema/call/service.js +82 -27
- package/dist/schema/call/treasury.js +3 -3
- package/dist/schema/common/index.d.ts +2 -0
- package/dist/schema/common/index.js +46 -10
- package/dist/schema/local/index.js +5 -1
- package/dist/schema/operations.d.ts +755 -176
- package/dist/schema/operations.js +43 -7
- package/dist/schema/project/index.d.ts +969 -6
- package/dist/schema/project/index.js +268 -4
- package/dist/schema/query/index.d.ts +217 -0
- package/dist/schema/query/index.js +63 -33
- package/dist/schema/schema-query/index.d.ts +53 -3
- package/dist/schema/schema-query/index.js +17 -2
- package/dist/schema/utils/node-parser.js +13 -0
- package/dist/schema/utils/object-type-utils.d.ts +12 -0
- package/dist/schema/utils/object-type-utils.js +35 -0
- package/dist/schema/utils/permission-machine-check.d.ts +49 -0
- package/dist/schema/utils/permission-machine-check.js +121 -0
- package/dist/schema/utils/skills-recommendation.d.ts +2 -0
- package/dist/schema/utils/skills-recommendation.js +76 -0
- package/dist/schema-query/index.d.ts +14 -1
- package/dist/schema-query/index.js +104 -2
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.output.json +2820 -0
- package/dist/schemas/onchain_operations.schema.json +115 -53
- package/dist/schemas/onchain_operations_allocation.schema.json +5 -5
- package/dist/schemas/onchain_operations_arbitration.schema.json +9 -7
- package/dist/schemas/onchain_operations_contact.schema.json +3 -3
- package/dist/schemas/onchain_operations_demand.schema.json +3 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +4 -4
- package/dist/schemas/onchain_operations_order.schema.json +3 -3
- package/dist/schemas/onchain_operations_payment.schema.json +1 -1
- package/dist/schemas/onchain_operations_permission.schema.json +2 -2
- package/dist/schemas/onchain_operations_progress.schema.json +1 -1
- package/dist/schemas/onchain_operations_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_repository.schema.json +3 -3
- package/dist/schemas/onchain_operations_reward.schema.json +6 -6
- package/dist/schemas/onchain_operations_service.schema.json +77 -17
- package/dist/schemas/onchain_operations_treasury.schema.json +4 -4
- package/dist/schemas/onchain_table_data.output.json +1 -1
- package/dist/schemas/onchain_table_data.schema.json +10 -9
- package/dist/schemas/project_operation.output.json +1026 -7
- package/dist/schemas/project_operation.schema.json +46 -4
- package/dist/schemas/query_toolkit.output.json +15 -15
- package/dist/schemas/query_toolkit.schema.json +3 -3
- package/dist/schemas/schema_query.output.json +64 -1
- package/dist/schemas/schema_query.schema.json +3 -2
- package/dist/schemas/wowok_buildin_info.output.json +81 -8
- package/dist/schemas/wowok_buildin_info.schema.json +46 -2
- package/dist/tools/handlers/onchain.js +571 -6
- package/dist/tools/handlers/project.js +25 -2
- package/dist/tools/handlers/schema-query.js +24 -1
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +177 -6
- package/package.json +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface SubmissionFieldPrompt {
|
|
2
|
+
identifier: number;
|
|
3
|
+
name: string;
|
|
4
|
+
value_type: string;
|
|
5
|
+
required: boolean;
|
|
6
|
+
suggested_value?: string;
|
|
7
|
+
suggestion_reason?: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
10
|
+
export interface GuardSubmissionPrompt {
|
|
11
|
+
guard_address: string;
|
|
12
|
+
guard_name?: string;
|
|
13
|
+
operation: string;
|
|
14
|
+
required_fields: SubmissionFieldPrompt[];
|
|
15
|
+
context: string;
|
|
16
|
+
fill_example: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SubmissionContext {
|
|
19
|
+
operation: string;
|
|
20
|
+
network?: string;
|
|
21
|
+
signer?: string;
|
|
22
|
+
progress_address?: string;
|
|
23
|
+
progress_current?: string;
|
|
24
|
+
order_address?: string;
|
|
25
|
+
service_address?: string;
|
|
26
|
+
machine_address?: string;
|
|
27
|
+
allocation_address?: string;
|
|
28
|
+
extra?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
export declare function generateGuardSubmissionPrompt(guardRef: string, ctx: SubmissionContext): Promise<GuardSubmissionPrompt | undefined>;
|
|
31
|
+
export declare function formatSubmissionPrompt(prompt: GuardSubmissionPrompt): string;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { query_objects, LocalMark } from "@wowok/wowok";
|
|
2
|
+
function inferValue(fieldName, valueType, ctx) {
|
|
3
|
+
const name = fieldName.toLowerCase();
|
|
4
|
+
if (name.includes("order") || name.includes("task")) {
|
|
5
|
+
if (ctx.order_address) {
|
|
6
|
+
return { value: ctx.order_address, reason: "Inferred from operation's order_address context" };
|
|
7
|
+
}
|
|
8
|
+
if (ctx.progress_address) {
|
|
9
|
+
return { value: ctx.progress_address, reason: "Progress.task is typically the order — query Progress to get the actual task address" };
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (name.includes("signer") || name.includes("sender") || name.includes("caller")) {
|
|
13
|
+
if (ctx.signer) {
|
|
14
|
+
return { value: ctx.signer, reason: "Inferred from env.account (the signing account)" };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (name.includes("service")) {
|
|
18
|
+
if (ctx.service_address) {
|
|
19
|
+
return { value: ctx.service_address, reason: "Inferred from operation's service_address context" };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (name.includes("machine")) {
|
|
23
|
+
if (ctx.machine_address) {
|
|
24
|
+
return { value: ctx.machine_address, reason: "Inferred from operation's machine_address context" };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (name.includes("progress") || name.includes("node") || name.includes("current")) {
|
|
28
|
+
if (ctx.progress_current) {
|
|
29
|
+
return { value: ctx.progress_current, reason: "Inferred from Progress.current node name" };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (name.includes("allocation") || name.includes("allocator")) {
|
|
33
|
+
if (ctx.allocation_address) {
|
|
34
|
+
return { value: ctx.allocation_address, reason: "Inferred from operation's allocation_address context" };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (ctx.extra) {
|
|
38
|
+
for (const [key, val] of Object.entries(ctx.extra)) {
|
|
39
|
+
if (name.includes(key.toLowerCase())) {
|
|
40
|
+
return { value: val, reason: `Inferred from extra context: ${key}` };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
function describeField(name, valueType) {
|
|
47
|
+
const n = name.toLowerCase();
|
|
48
|
+
if (n.includes("order"))
|
|
49
|
+
return `Order object address (type: ${valueType})`;
|
|
50
|
+
if (n.includes("signer") || n.includes("sender"))
|
|
51
|
+
return `Transaction signer address (type: ${valueType})`;
|
|
52
|
+
if (n.includes("service"))
|
|
53
|
+
return `Service object address (type: ${valueType})`;
|
|
54
|
+
if (n.includes("machine"))
|
|
55
|
+
return `Machine object address (type: ${valueType})`;
|
|
56
|
+
if (n.includes("progress"))
|
|
57
|
+
return `Progress object address (type: ${valueType})`;
|
|
58
|
+
if (n.includes("node") || n.includes("current"))
|
|
59
|
+
return `Current node name (type: ${valueType})`;
|
|
60
|
+
if (n.includes("amount") || n.includes("price") || n.includes("balance"))
|
|
61
|
+
return `Amount in smallest unit (type: ${valueType})`;
|
|
62
|
+
if (n.includes("allocation"))
|
|
63
|
+
return `Allocation object address (type: ${valueType})`;
|
|
64
|
+
return `Field "${name}" (type: ${valueType})`;
|
|
65
|
+
}
|
|
66
|
+
export async function generateGuardSubmissionPrompt(guardRef, ctx) {
|
|
67
|
+
let guardAddress = guardRef;
|
|
68
|
+
let guardName;
|
|
69
|
+
if (!guardRef.startsWith("0x")) {
|
|
70
|
+
try {
|
|
71
|
+
const mark = await LocalMark.Instance().get(guardRef);
|
|
72
|
+
if (mark?.address) {
|
|
73
|
+
guardAddress = mark.address;
|
|
74
|
+
guardName = guardRef;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let guardObj;
|
|
85
|
+
try {
|
|
86
|
+
const result = await query_objects({
|
|
87
|
+
objects: [guardAddress],
|
|
88
|
+
network: ctx.network,
|
|
89
|
+
});
|
|
90
|
+
guardObj = result?.objects?.[0];
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
if (!guardObj)
|
|
96
|
+
return undefined;
|
|
97
|
+
const table = guardObj.table ?? guardObj.b_table ?? [];
|
|
98
|
+
if (!Array.isArray(table) || table.length === 0)
|
|
99
|
+
return undefined;
|
|
100
|
+
const submissionItems = table.filter((item) => item.b_submission === true);
|
|
101
|
+
if (submissionItems.length === 0)
|
|
102
|
+
return undefined;
|
|
103
|
+
const requiredFields = submissionItems.map((item) => {
|
|
104
|
+
const fieldName = item.name ?? `identifier_${item.identifier}`;
|
|
105
|
+
const valueType = typeof item.value_type === "number"
|
|
106
|
+
? ValueTypeNames[item.value_type] ?? String(item.value_type)
|
|
107
|
+
: String(item.value_type);
|
|
108
|
+
const inferred = inferValue(fieldName, valueType, ctx);
|
|
109
|
+
return {
|
|
110
|
+
identifier: item.identifier,
|
|
111
|
+
name: fieldName,
|
|
112
|
+
value_type: valueType,
|
|
113
|
+
required: true,
|
|
114
|
+
suggested_value: inferred?.value,
|
|
115
|
+
suggestion_reason: inferred?.reason,
|
|
116
|
+
description: describeField(fieldName, valueType),
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
const fillLines = requiredFields.map((f) => {
|
|
120
|
+
const val = f.suggested_value ?? `<${f.value_type}_value>`;
|
|
121
|
+
return ` { identifier: ${f.identifier}, name: "${f.name}", value_type: "${f.value_type}", value: ${val} }`;
|
|
122
|
+
});
|
|
123
|
+
const fillExample = `submission: {
|
|
124
|
+
guard: "${guardName ?? guardAddress}",
|
|
125
|
+
submission: [
|
|
126
|
+
${fillLines.join(",\n")}
|
|
127
|
+
]
|
|
128
|
+
}`;
|
|
129
|
+
return {
|
|
130
|
+
guard_address: guardAddress,
|
|
131
|
+
guard_name: guardName,
|
|
132
|
+
operation: ctx.operation,
|
|
133
|
+
required_fields: requiredFields,
|
|
134
|
+
context: `Operation "${ctx.operation}" requires Guard "${guardName ?? guardAddress}" verification. ` +
|
|
135
|
+
`The Guard has ${requiredFields.length} field(s) that need submission data (b_submission=true). ` +
|
|
136
|
+
`Fill the submission with the required values and retry the operation using call_with_submission. ` +
|
|
137
|
+
`Each field has an identifier (number), name, and expected value_type. ` +
|
|
138
|
+
`The suggested_value (if provided) is inferred from the operation context — verify before using.`,
|
|
139
|
+
fill_example: fillExample,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export function formatSubmissionPrompt(prompt) {
|
|
143
|
+
const lines = [];
|
|
144
|
+
lines.push("GUARD SUBMISSION REQUIRED — operation cannot proceed without submission data.");
|
|
145
|
+
lines.push(`Guard: ${prompt.guard_name ?? prompt.guard_address} (${prompt.guard_address})`);
|
|
146
|
+
lines.push(`Operation: ${prompt.operation}`);
|
|
147
|
+
lines.push("");
|
|
148
|
+
lines.push("Required fields (fill these in the submission):");
|
|
149
|
+
for (const f of prompt.required_fields) {
|
|
150
|
+
lines.push(` [${f.identifier}] ${f.name} (${f.value_type}) — ${f.description}`);
|
|
151
|
+
if (f.suggested_value) {
|
|
152
|
+
lines.push(` Suggested: ${f.suggested_value} (${f.suggestion_reason})`);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
lines.push(` No suggestion — derive value from context or ask user.`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
lines.push("");
|
|
159
|
+
lines.push("Fill example (use in the next call with submission):");
|
|
160
|
+
lines.push(prompt.fill_example);
|
|
161
|
+
return lines.join("\n");
|
|
162
|
+
}
|
|
163
|
+
const ValueTypeNames = {
|
|
164
|
+
0: "Bool",
|
|
165
|
+
1: "Address",
|
|
166
|
+
2: "U64",
|
|
167
|
+
3: "String",
|
|
168
|
+
4: "Vec",
|
|
169
|
+
5: "U256",
|
|
170
|
+
6: "Object",
|
|
171
|
+
};
|
|
@@ -284,7 +284,7 @@ export function inferSceneFromFlow(description) {
|
|
|
284
284
|
if (lower.includes("wonder") || lower.includes("praise") || lower.includes("complain")
|
|
285
285
|
|| lower.includes("thumbs_up") || lower.includes("thumbs_down")
|
|
286
286
|
|| lower.includes("rating") || lower.includes("feedback")
|
|
287
|
-
|| lower.includes("
|
|
287
|
+
|| lower.includes("praise") || lower.includes("complaint")) {
|
|
288
288
|
return findScene("wonder_feedback");
|
|
289
289
|
}
|
|
290
290
|
if (lower.includes("reward") || lower.includes("incentive")) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface MachineNodeForRender {
|
|
2
|
+
name: string;
|
|
3
|
+
description?: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface MachineForwardForRender {
|
|
6
|
+
name: string;
|
|
7
|
+
weight: number;
|
|
8
|
+
named_operator?: string | null;
|
|
9
|
+
permission_index?: number | null;
|
|
10
|
+
guard?: string | null;
|
|
11
|
+
retained_submission?: number[] | string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface MachineEdgeForRender {
|
|
14
|
+
from: string;
|
|
15
|
+
to: string;
|
|
16
|
+
threshold: number;
|
|
17
|
+
forwards: MachineForwardForRender[];
|
|
18
|
+
}
|
|
19
|
+
export interface MachineRenderInput {
|
|
20
|
+
nodes: MachineNodeForRender[];
|
|
21
|
+
edges: MachineEdgeForRender[];
|
|
22
|
+
machineName?: string | null;
|
|
23
|
+
machineAddress?: string | null;
|
|
24
|
+
published?: boolean | null;
|
|
25
|
+
paused?: boolean | null;
|
|
26
|
+
}
|
|
27
|
+
export declare function sanitizeMermaidNodeId(name: string): string;
|
|
28
|
+
export declare function renderMachineMermaid(nodes: MachineNodeForRender[], edges: MachineEdgeForRender[], options?: {
|
|
29
|
+
colored?: boolean;
|
|
30
|
+
}): string;
|
|
31
|
+
export declare function renderMachineTreeIndented(input: MachineRenderInput): string;
|
|
32
|
+
export declare function parseMachineTreeIndented(text: string): {
|
|
33
|
+
success: boolean;
|
|
34
|
+
data?: {
|
|
35
|
+
nodes: MachineNodeForRender[];
|
|
36
|
+
edges: MachineEdgeForRender[];
|
|
37
|
+
};
|
|
38
|
+
errors: string[];
|
|
39
|
+
};
|
|
40
|
+
export declare function renderMachineAscii(input: MachineRenderInput): string;
|
|
41
|
+
export declare function renderMachineMarkmap(input: MachineRenderInput): string;
|