@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.
Files changed (93) hide show
  1. package/dist/harness/checkpoint.d.ts +8 -0
  2. package/dist/harness/checkpoint.js +129 -0
  3. package/dist/harness/index.d.ts +33 -0
  4. package/dist/harness/index.js +75 -0
  5. package/dist/harness/plan.d.ts +18 -0
  6. package/dist/harness/plan.js +252 -0
  7. package/dist/harness/recover.d.ts +17 -0
  8. package/dist/harness/recover.js +139 -0
  9. package/dist/harness/types.d.ts +137 -0
  10. package/dist/harness/types.js +1 -0
  11. package/dist/harness/verify.d.ts +42 -0
  12. package/dist/harness/verify.js +237 -0
  13. package/dist/index.js +134 -52
  14. package/dist/loop-engineering/aggregate.d.ts +50 -0
  15. package/dist/loop-engineering/aggregate.js +132 -0
  16. package/dist/loop-engineering/diagnose.d.ts +21 -0
  17. package/dist/loop-engineering/diagnose.js +179 -0
  18. package/dist/loop-engineering/improve.d.ts +26 -0
  19. package/dist/loop-engineering/improve.js +178 -0
  20. package/dist/loop-engineering/index.d.ts +4 -0
  21. package/dist/loop-engineering/index.js +4 -0
  22. package/dist/loop-engineering/pipeline.d.ts +17 -0
  23. package/dist/loop-engineering/pipeline.js +56 -0
  24. package/dist/mode-market/index.d.ts +3 -0
  25. package/dist/mode-market/index.js +3 -0
  26. package/dist/mode-market/registry.d.ts +53 -0
  27. package/dist/mode-market/registry.js +124 -0
  28. package/dist/mode-market/review.d.ts +27 -0
  29. package/dist/mode-market/review.js +214 -0
  30. package/dist/mode-market/submission.d.ts +25 -0
  31. package/dist/mode-market/submission.js +85 -0
  32. package/dist/schema/call/allocation.d.ts +40 -40
  33. package/dist/schema/call/arbitration.d.ts +90 -90
  34. package/dist/schema/call/base.d.ts +1054 -0
  35. package/dist/schema/call/base.js +100 -22
  36. package/dist/schema/call/bridge-handler.js +36 -18
  37. package/dist/schema/call/bridge.d.ts +115 -115
  38. package/dist/schema/call/handler.d.ts +2 -1
  39. package/dist/schema/call/handler.js +94 -3
  40. package/dist/schema/call/index.d.ts +1 -0
  41. package/dist/schema/call/index.js +1 -0
  42. package/dist/schema/call/machine.d.ts +144 -144
  43. package/dist/schema/call/order.d.ts +12 -12
  44. package/dist/schema/call/progress.d.ts +6 -6
  45. package/dist/schema/call/proof.js +7 -6
  46. package/dist/schema/call/reward.d.ts +6 -6
  47. package/dist/schema/call/semantic.d.ts +23 -0
  48. package/dist/schema/call/semantic.js +764 -0
  49. package/dist/schema/call/service.d.ts +142 -142
  50. package/dist/schema/call/treasury.d.ts +204 -204
  51. package/dist/schema/local/index.d.ts +113 -2
  52. package/dist/schema/local/index.js +11 -1
  53. package/dist/schema/messenger/index.d.ts +435 -95
  54. package/dist/schema/messenger/index.js +20 -8
  55. package/dist/schema/operations.d.ts +988 -495
  56. package/dist/schema/operations.js +14 -3
  57. package/dist/schema/query/index.d.ts +346 -342
  58. package/dist/schema/query/index.js +4 -1
  59. package/dist/schemas/account_operation.output.json +3 -0
  60. package/dist/schemas/account_operation.schema.json +1 -1
  61. package/dist/schemas/index.json +1 -1
  62. package/dist/schemas/local_info_operation.output.json +3 -0
  63. package/dist/schemas/local_mark_operation.output.json +3 -0
  64. package/dist/schemas/messenger_operation.output.json +21 -0
  65. package/dist/schemas/messenger_operation.schema.json +43 -8
  66. package/dist/schemas/onchain_events.output.json +3 -0
  67. package/dist/schemas/onchain_operations.output.json +464 -21
  68. package/dist/schemas/onchain_operations.schema.json +21 -17
  69. package/dist/schemas/onchain_operations_allocation.schema.json +11 -9
  70. package/dist/schemas/onchain_operations_arbitration.schema.json +11 -9
  71. package/dist/schemas/onchain_operations_contact.schema.json +11 -9
  72. package/dist/schemas/onchain_operations_demand.schema.json +11 -9
  73. package/dist/schemas/onchain_operations_gen_passport.schema.json +21 -17
  74. package/dist/schemas/onchain_operations_guard.schema.json +11 -9
  75. package/dist/schemas/onchain_operations_machine.schema.json +11 -9
  76. package/dist/schemas/onchain_operations_order.schema.json +11 -9
  77. package/dist/schemas/onchain_operations_payment.schema.json +11 -9
  78. package/dist/schemas/onchain_operations_permission.schema.json +11 -9
  79. package/dist/schemas/onchain_operations_personal.schema.json +11 -9
  80. package/dist/schemas/onchain_operations_progress.schema.json +11 -9
  81. package/dist/schemas/onchain_operations_repository.schema.json +11 -9
  82. package/dist/schemas/onchain_operations_reward.schema.json +11 -9
  83. package/dist/schemas/onchain_operations_service.schema.json +11 -9
  84. package/dist/schemas/onchain_operations_treasury.schema.json +11 -9
  85. package/dist/schemas/onchain_table_data.output.json +3 -0
  86. package/dist/schemas/query_toolkit.schema.json +5 -1
  87. package/dist/telemetry/index.d.ts +19 -0
  88. package/dist/telemetry/index.js +112 -0
  89. package/dist/telemetry/redact.d.ts +2 -0
  90. package/dist/telemetry/redact.js +23 -0
  91. package/dist/telemetry/storage.d.ts +8 -0
  92. package/dist/telemetry/storage.js +80 -0
  93. 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
- export declare function handleCallResult(result: any): {
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
- export function handleCallResult(result) {
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: { type: "error", error: enrichedError },
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: { type: "error", error: enrichedError },
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,
@@ -1,5 +1,6 @@
1
1
  export * from './base.js';
2
2
  export * from './handler.js';
3
+ export * from './semantic.js';
3
4
  export * from './contact.js';
4
5
  export * from './demand.js';
5
6
  export * from './guard.js';
@@ -1,5 +1,6 @@
1
1
  export * from './base.js';
2
2
  export * from './handler.js';
3
+ export * from './semantic.js';
3
4
  export * from './contact.js';
4
5
  export * from './demand.js';
5
6
  export * from './guard.js';