@wowok/agent-mcp 2.3.12 → 2.3.14
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/harness/checkpoint.d.ts +8 -0
- package/dist/harness/checkpoint.js +129 -0
- package/dist/harness/index.d.ts +33 -0
- package/dist/harness/index.js +75 -0
- package/dist/harness/plan.d.ts +18 -0
- package/dist/harness/plan.js +252 -0
- package/dist/harness/recover.d.ts +17 -0
- package/dist/harness/recover.js +139 -0
- package/dist/harness/types.d.ts +137 -0
- package/dist/harness/types.js +1 -0
- package/dist/harness/verify.d.ts +42 -0
- package/dist/harness/verify.js +237 -0
- package/dist/index.js +134 -52
- package/dist/loop-engineering/aggregate.d.ts +50 -0
- package/dist/loop-engineering/aggregate.js +132 -0
- package/dist/loop-engineering/diagnose.d.ts +21 -0
- package/dist/loop-engineering/diagnose.js +179 -0
- package/dist/loop-engineering/improve.d.ts +26 -0
- package/dist/loop-engineering/improve.js +178 -0
- package/dist/loop-engineering/index.d.ts +4 -0
- package/dist/loop-engineering/index.js +4 -0
- package/dist/loop-engineering/pipeline.d.ts +17 -0
- package/dist/loop-engineering/pipeline.js +56 -0
- package/dist/mode-market/index.d.ts +3 -0
- package/dist/mode-market/index.js +3 -0
- package/dist/mode-market/registry.d.ts +53 -0
- package/dist/mode-market/registry.js +124 -0
- package/dist/mode-market/review.d.ts +27 -0
- package/dist/mode-market/review.js +214 -0
- package/dist/mode-market/submission.d.ts +25 -0
- package/dist/mode-market/submission.js +85 -0
- package/dist/schema/call/allocation.d.ts +40 -40
- package/dist/schema/call/arbitration.d.ts +90 -90
- package/dist/schema/call/base.d.ts +1054 -0
- package/dist/schema/call/base.js +100 -22
- package/dist/schema/call/bridge-handler.js +36 -18
- package/dist/schema/call/bridge.d.ts +115 -115
- package/dist/schema/call/handler.d.ts +2 -1
- package/dist/schema/call/handler.js +94 -3
- package/dist/schema/call/index.d.ts +1 -0
- package/dist/schema/call/index.js +1 -0
- package/dist/schema/call/machine.d.ts +144 -144
- package/dist/schema/call/order.d.ts +12 -12
- package/dist/schema/call/progress.d.ts +6 -6
- package/dist/schema/call/proof.js +7 -6
- package/dist/schema/call/reward.d.ts +6 -6
- package/dist/schema/call/semantic.d.ts +23 -0
- package/dist/schema/call/semantic.js +764 -0
- package/dist/schema/call/service.d.ts +142 -142
- package/dist/schema/call/treasury.d.ts +204 -204
- package/dist/schema/local/index.d.ts +113 -2
- package/dist/schema/local/index.js +11 -1
- package/dist/schema/messenger/index.d.ts +435 -95
- package/dist/schema/messenger/index.js +20 -8
- package/dist/schema/operations.d.ts +988 -495
- package/dist/schema/operations.js +14 -3
- package/dist/schema/query/index.d.ts +346 -342
- package/dist/schema/query/index.js +4 -1
- package/dist/schemas/account_operation.output.json +3 -0
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/local_info_operation.output.json +3 -0
- package/dist/schemas/local_mark_operation.output.json +3 -0
- package/dist/schemas/messenger_operation.output.json +21 -0
- package/dist/schemas/messenger_operation.schema.json +43 -8
- package/dist/schemas/onchain_events.output.json +3 -0
- package/dist/schemas/onchain_operations.output.json +464 -21
- package/dist/schemas/onchain_operations.schema.json +21 -17
- package/dist/schemas/onchain_operations_allocation.schema.json +11 -9
- package/dist/schemas/onchain_operations_arbitration.schema.json +11 -9
- package/dist/schemas/onchain_operations_contact.schema.json +11 -9
- package/dist/schemas/onchain_operations_demand.schema.json +11 -9
- package/dist/schemas/onchain_operations_gen_passport.schema.json +21 -17
- package/dist/schemas/onchain_operations_guard.schema.json +11 -9
- package/dist/schemas/onchain_operations_machine.schema.json +11 -9
- package/dist/schemas/onchain_operations_order.schema.json +11 -9
- package/dist/schemas/onchain_operations_payment.schema.json +11 -9
- package/dist/schemas/onchain_operations_permission.schema.json +11 -9
- package/dist/schemas/onchain_operations_personal.schema.json +11 -9
- package/dist/schemas/onchain_operations_progress.schema.json +11 -9
- package/dist/schemas/onchain_operations_repository.schema.json +11 -9
- package/dist/schemas/onchain_operations_reward.schema.json +11 -9
- package/dist/schemas/onchain_operations_service.schema.json +11 -9
- package/dist/schemas/onchain_operations_treasury.schema.json +11 -9
- package/dist/schemas/onchain_table_data.output.json +3 -0
- package/dist/schemas/query_toolkit.schema.json +5 -1
- package/dist/telemetry/index.d.ts +19 -0
- package/dist/telemetry/index.js +112 -0
- package/dist/telemetry/redact.d.ts +2 -0
- package/dist/telemetry/redact.js +23 -0
- package/dist/telemetry/storage.d.ts +8 -0
- package/dist/telemetry/storage.js +80 -0
- package/package.json +6 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CallEnv } from "@wowok/wowok";
|
|
2
2
|
import type { CallOutput } from "./base.js";
|
|
3
|
-
|
|
3
|
+
import { type SemanticContext } from "./semantic.js";
|
|
4
|
+
export declare function handleCallResult(result: any, context?: SemanticContext): {
|
|
4
5
|
content: any[];
|
|
5
6
|
structuredContent: CallOutput;
|
|
6
7
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResponseData, LocalMark, enrichMoveError } from "@wowok/wowok";
|
|
2
|
+
import { classifyError, buildSemantic } from "./semantic.js";
|
|
2
3
|
function convertBigInts(obj) {
|
|
3
4
|
if (typeof obj === "bigint")
|
|
4
5
|
return obj.toString();
|
|
@@ -12,14 +13,67 @@ function convertBigInts(obj) {
|
|
|
12
13
|
}
|
|
13
14
|
return obj;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
function runHarnessLoops(context, output, errorCode) {
|
|
17
|
+
if (!context?.harness || !context?.expected)
|
|
18
|
+
return undefined;
|
|
19
|
+
const harness = context.harness;
|
|
20
|
+
const expected = context.expected;
|
|
21
|
+
const actualSemantic = output.semantic;
|
|
22
|
+
const verifyReport = harness.verify({
|
|
23
|
+
expected,
|
|
24
|
+
actual: {
|
|
25
|
+
result_type: output.result.type,
|
|
26
|
+
semantic: actualSemantic,
|
|
27
|
+
error_code: output.result.type === "error" ? output.result.error_code : undefined,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
let recovery;
|
|
31
|
+
const needRecovery = verifyReport.status !== "pass" || output.result.type === "error" || errorCode;
|
|
32
|
+
if (needRecovery) {
|
|
33
|
+
const ec = errorCode
|
|
34
|
+
|| (output.result.type === "error" ? output.result.error_code : undefined)
|
|
35
|
+
|| "unknown";
|
|
36
|
+
recovery = harness.recover(ec, context.operation_id || expected.operation, {
|
|
37
|
+
operation_type: context.operation_type,
|
|
38
|
+
data: context.data,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
verify: {
|
|
43
|
+
status: verifyReport.status,
|
|
44
|
+
mismatches: verifyReport.mismatches.map(m => convertBigInts(m)),
|
|
45
|
+
summary: verifyReport.summary,
|
|
46
|
+
timestamp: verifyReport.timestamp,
|
|
47
|
+
},
|
|
48
|
+
recovery: recovery ? {
|
|
49
|
+
strategy: recovery.strategy,
|
|
50
|
+
should_retry: recovery.should_retry,
|
|
51
|
+
adjusted_params: recovery.adjusted_params,
|
|
52
|
+
user_prompt: recovery.user_prompt,
|
|
53
|
+
max_attempts: recovery.max_attempts,
|
|
54
|
+
current_attempt: recovery.current_attempt,
|
|
55
|
+
detail: recovery.detail,
|
|
56
|
+
} : undefined,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function handleCallResult(result, context) {
|
|
16
60
|
const safeResult = convertBigInts(result);
|
|
17
61
|
if (safeResult && "error" in safeResult) {
|
|
18
62
|
const enrichedError = enrichMoveError(safeResult.error);
|
|
63
|
+
const classified = classifyError(enrichedError);
|
|
19
64
|
const output = {
|
|
20
65
|
message: `Error: ${enrichedError}`,
|
|
21
|
-
result: {
|
|
66
|
+
result: {
|
|
67
|
+
type: "error",
|
|
68
|
+
error: enrichedError,
|
|
69
|
+
error_code: classified.error_code,
|
|
70
|
+
retryable: classified.retryable,
|
|
71
|
+
recovery_hint: classified.recovery_hint,
|
|
72
|
+
},
|
|
22
73
|
};
|
|
74
|
+
const harnessReport = runHarnessLoops(context, output, classified.error_code);
|
|
75
|
+
if (harnessReport)
|
|
76
|
+
output.harness_report = harnessReport;
|
|
23
77
|
return {
|
|
24
78
|
content: [{ type: "text", text: output.message }],
|
|
25
79
|
structuredContent: output,
|
|
@@ -32,10 +86,20 @@ export function handleCallResult(result) {
|
|
|
32
86
|
const isSuccess = txStatus === "success";
|
|
33
87
|
if (!isSuccess) {
|
|
34
88
|
const enrichedError = enrichMoveError(txError || txStatus || "unknown error");
|
|
89
|
+
const classified = classifyError(enrichedError);
|
|
35
90
|
const output = {
|
|
36
91
|
message: `Transaction failed: ${enrichedError}`,
|
|
37
|
-
result: {
|
|
92
|
+
result: {
|
|
93
|
+
type: "error",
|
|
94
|
+
error: enrichedError,
|
|
95
|
+
error_code: classified.error_code,
|
|
96
|
+
retryable: classified.retryable,
|
|
97
|
+
recovery_hint: classified.recovery_hint,
|
|
98
|
+
},
|
|
38
99
|
};
|
|
100
|
+
const harnessReport = runHarnessLoops(context, output, classified.error_code);
|
|
101
|
+
if (harnessReport)
|
|
102
|
+
output.harness_report = harnessReport;
|
|
39
103
|
return {
|
|
40
104
|
content: [
|
|
41
105
|
{ type: "text", text: output.message },
|
|
@@ -47,7 +111,11 @@ export function handleCallResult(result) {
|
|
|
47
111
|
const output = {
|
|
48
112
|
message: "Transaction completed successfully",
|
|
49
113
|
result: { type: "transaction", ...safeResult },
|
|
114
|
+
semantic: buildSemantic(safeResult, context),
|
|
50
115
|
};
|
|
116
|
+
const harnessReport = runHarnessLoops(context, output);
|
|
117
|
+
if (harnessReport)
|
|
118
|
+
output.harness_report = harnessReport;
|
|
51
119
|
return {
|
|
52
120
|
content: [
|
|
53
121
|
{ type: "text", text: output.message },
|
|
@@ -60,7 +128,21 @@ export function handleCallResult(result) {
|
|
|
60
128
|
const output = {
|
|
61
129
|
message: "Submission required for Guard verification",
|
|
62
130
|
result: { type: "submission", ...safeResult },
|
|
131
|
+
semantic: context ? {
|
|
132
|
+
intent: "guard_submission_required",
|
|
133
|
+
status: "pending_input",
|
|
134
|
+
summary: "Guard verification required — fill the submission data and resubmit",
|
|
135
|
+
next_actions: [{
|
|
136
|
+
action: "fill guard submission data and resubmit via call_with_submission",
|
|
137
|
+
reason: "Guard rejected the call; submission must satisfy the Guard table requirements",
|
|
138
|
+
tool: "onchain_operations (with submission field)",
|
|
139
|
+
priority: "required",
|
|
140
|
+
}],
|
|
141
|
+
} : undefined,
|
|
63
142
|
};
|
|
143
|
+
const harnessReport = runHarnessLoops(context, output);
|
|
144
|
+
if (harnessReport)
|
|
145
|
+
output.harness_report = harnessReport;
|
|
64
146
|
return {
|
|
65
147
|
content: [
|
|
66
148
|
{ type: "text", text: output.message },
|
|
@@ -74,6 +156,9 @@ export function handleCallResult(result) {
|
|
|
74
156
|
message: "Operation completed",
|
|
75
157
|
result: { type: "data", data: safeResult },
|
|
76
158
|
};
|
|
159
|
+
const harnessReport = runHarnessLoops(context, output);
|
|
160
|
+
if (harnessReport)
|
|
161
|
+
output.harness_report = harnessReport;
|
|
77
162
|
return {
|
|
78
163
|
content: [
|
|
79
164
|
{ type: "text", text: output.message },
|
|
@@ -87,6 +172,9 @@ export function handleCallResult(result) {
|
|
|
87
172
|
message: "Operation completed",
|
|
88
173
|
result: { type: "null" },
|
|
89
174
|
};
|
|
175
|
+
const harnessReport = runHarnessLoops(context, output);
|
|
176
|
+
if (harnessReport)
|
|
177
|
+
output.harness_report = harnessReport;
|
|
90
178
|
return {
|
|
91
179
|
content: [{ type: "text", text: output.message }],
|
|
92
180
|
structuredContent: output,
|
|
@@ -96,6 +184,9 @@ export function handleCallResult(result) {
|
|
|
96
184
|
message: "Operation completed",
|
|
97
185
|
result: { type: "transaction", ...safeResult },
|
|
98
186
|
};
|
|
187
|
+
const harnessReport = runHarnessLoops(context, output);
|
|
188
|
+
if (harnessReport)
|
|
189
|
+
output.harness_report = harnessReport;
|
|
99
190
|
return {
|
|
100
191
|
content: [{ type: "text", text: output.message }],
|
|
101
192
|
structuredContent: output,
|