@wowok/agent-mcp 2.6.3 → 2.6.6

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 (193) hide show
  1. package/README.md +13 -9
  2. package/dist/customer/customer-advice.d.ts +31 -0
  3. package/dist/customer/customer-advice.js +129 -0
  4. package/dist/customer/index.d.ts +2 -0
  5. package/dist/customer/index.js +2 -0
  6. package/dist/customer/info-puzzle.d.ts +8 -1
  7. package/dist/customer/info-puzzle.js +30 -5
  8. package/dist/customer/order-monitor.d.ts +2 -0
  9. package/dist/customer/order-monitor.js +3 -2
  10. package/dist/customer/post-purchase.d.ts +2 -0
  11. package/dist/customer/post-purchase.js +6 -5
  12. package/dist/customer/preorder-compare.d.ts +24 -0
  13. package/dist/customer/preorder-compare.js +34 -0
  14. package/dist/customer/reminder-system.d.ts +2 -0
  15. package/dist/customer/reminder-system.js +2 -1
  16. package/dist/customer/risk-assessment.js +4 -3
  17. package/dist/customer/types.d.ts +5 -0
  18. package/dist/examples/arbitration-dispute-create.json +41 -0
  19. package/dist/examples/arbitration-vote-weighted.json +35 -0
  20. package/dist/examples/arbitration-voting-guard-add.json +38 -0
  21. package/dist/examples/demand-present-service.json +33 -0
  22. package/dist/examples/gen-passport-verify-guard.json +48 -0
  23. package/dist/examples/guard-template-balance-check.json +36 -15
  24. package/dist/examples/guard-template-time-lock.json +33 -12
  25. package/dist/examples/insurance-guard-claim-timelock.json +75 -0
  26. package/dist/examples/insurance-guard-withdraw-allocation.json +96 -0
  27. package/dist/examples/insurance-machine-create-publish.json +75 -0
  28. package/dist/examples/insurance-service-allocators-publish.json +56 -0
  29. package/dist/examples/machine-multisig-threshold.json +86 -0
  30. package/dist/examples/machine-template-7node-rental.json +99 -94
  31. package/dist/examples/payment-scenario-bound.json +45 -0
  32. package/dist/examples/rental-ziroom-machine-create.json +126 -114
  33. package/dist/examples/rental-ziroom-permission-create.json +10 -3
  34. package/dist/examples/rental-ziroom-service-create.json +27 -18
  35. package/dist/examples/retail-adv-guard-customer-win-create.json +80 -0
  36. package/dist/examples/retail-adv-guard-messenger-proof-create.json +65 -0
  37. package/dist/examples/retail-adv-guard-reward-timeout-create.json +92 -0
  38. package/dist/examples/retail-adv-reward-guard-add.json +51 -0
  39. package/dist/examples/retail-myshop-allocation-activate.json +55 -0
  40. package/dist/examples/retail-myshop-arbitration-create.json +40 -0
  41. package/dist/examples/retail-myshop-contact-create.json +43 -0
  42. package/dist/examples/retail-myshop-order-create.json +56 -0
  43. package/dist/examples/retail-myshop-progress-operate.json +38 -0
  44. package/dist/examples/retail-myshop-reward-create.json +35 -0
  45. package/dist/examples/service-discount-issue.json +46 -0
  46. package/dist/examples/threebody-guard-create.json +56 -0
  47. package/dist/examples/threebody-machine-create.json +72 -0
  48. package/dist/examples/threebody-permission-create.json +38 -0
  49. package/dist/examples/threebody-service-allocators.json +49 -0
  50. package/dist/examples/travel-guard-time-lock.json +69 -0
  51. package/dist/examples/travel-guard-weather-oracle.json +70 -0
  52. package/dist/examples/travel-machine-create.json +136 -0
  53. package/dist/examples/travel-repository-create.json +47 -0
  54. package/dist/examples/travel-service-create.json +102 -0
  55. package/dist/examples/travel-treasury-create.json +34 -0
  56. package/dist/examples/treasury-deposit.json +37 -0
  57. package/dist/examples/treasury-withdraw.json +38 -0
  58. package/dist/extensions/business-modules.d.ts +49 -0
  59. package/dist/extensions/business-modules.js +287 -0
  60. package/dist/extensions/capability-manifest.js +192 -5
  61. package/dist/extensions/constraint-registry.js +3 -1
  62. package/dist/extensions/modes.js +10 -4
  63. package/dist/extensions/registry.d.ts +14 -9
  64. package/dist/extensions/registry.js +69 -14
  65. package/dist/extensions/types.d.ts +1 -0
  66. package/dist/knowledge/fund-layer.d.ts +67 -1
  67. package/dist/knowledge/fund-layer.js +561 -12
  68. package/dist/knowledge/guard-templates.d.ts +10 -0
  69. package/dist/knowledge/guard-templates.js +50 -0
  70. package/dist/knowledge/index.d.ts +2 -2
  71. package/dist/knowledge/index.js +2 -2
  72. package/dist/knowledge/machine-risk.js +4 -1
  73. package/dist/knowledge/progress-context.js +1 -1
  74. package/dist/knowledge/progress-ledger.js +3 -3
  75. package/dist/knowledge/progress-templates.js +1 -1
  76. package/dist/knowledge/progress-translation.js +1 -1
  77. package/dist/knowledge/safety-rules.d.ts +83 -1
  78. package/dist/knowledge/safety-rules.js +166 -2
  79. package/dist/knowledge/scenario-modes.d.ts +1 -1
  80. package/dist/knowledge/scenario-modes.js +13 -11
  81. package/dist/knowledge/template-registry.d.ts +48 -0
  82. package/dist/knowledge/template-registry.js +341 -0
  83. package/dist/knowledge/tool-constraints.js +6 -6
  84. package/dist/knowledge/tools-reference.js +11 -8
  85. package/dist/participation/merchant-interest.d.ts +32 -0
  86. package/dist/participation/merchant-interest.js +100 -0
  87. package/dist/participation/radar-core.d.ts +104 -0
  88. package/dist/participation/radar-core.js +269 -0
  89. package/dist/project/context-assembly.js +8 -0
  90. package/dist/project/edit-planner.js +27 -56
  91. package/dist/project/evaluation.d.ts +36 -0
  92. package/dist/project/evaluation.js +422 -56
  93. package/dist/project/game-theory.d.ts +43 -0
  94. package/dist/project/game-theory.js +177 -0
  95. package/dist/project/graph-builder.js +1 -0
  96. package/dist/project/handlers.d.ts +38 -0
  97. package/dist/project/handlers.js +65 -35
  98. package/dist/project/intent-analyzer.d.ts +71 -0
  99. package/dist/project/intent-analyzer.js +149 -0
  100. package/dist/project/machine-nodes.d.ts +2 -0
  101. package/dist/project/machine-nodes.js +36 -0
  102. package/dist/project/merchant-guide.d.ts +165 -0
  103. package/dist/project/merchant-guide.js +264 -0
  104. package/dist/project/mode-actions.d.ts +199 -0
  105. package/dist/project/mode-actions.js +309 -0
  106. package/dist/project/participation-radar.d.ts +18 -0
  107. package/dist/project/participation-radar.js +428 -0
  108. package/dist/project/pipeline-actions.d.ts +101 -0
  109. package/dist/project/pipeline-actions.js +109 -0
  110. package/dist/project/semantic-graph.d.ts +95 -0
  111. package/dist/project/semantic-graph.js +245 -0
  112. package/dist/schema/call/allocation.d.ts +11 -11
  113. package/dist/schema/call/allocation.js +11 -1
  114. package/dist/schema/call/arbitration.d.ts +21 -21
  115. package/dist/schema/call/arbitration.js +17 -9
  116. package/dist/schema/call/base.d.ts +2 -2
  117. package/dist/schema/call/base.js +1 -1
  118. package/dist/schema/call/bridge.d.ts +127 -127
  119. package/dist/schema/call/bridge.js +12 -12
  120. package/dist/schema/call/contact.d.ts +3 -3
  121. package/dist/schema/call/demand.d.ts +3 -3
  122. package/dist/schema/call/guard.d.ts +11 -11
  123. package/dist/schema/call/guard.js +1 -1
  124. package/dist/schema/call/machine.d.ts +216 -21
  125. package/dist/schema/call/machine.js +1 -1
  126. package/dist/schema/call/order.d.ts +7 -7
  127. package/dist/schema/call/payment.d.ts +3 -3
  128. package/dist/schema/call/permission.d.ts +3 -3
  129. package/dist/schema/call/personal.d.ts +337 -3
  130. package/dist/schema/call/personal.js +10 -0
  131. package/dist/schema/call/progress.d.ts +177 -9
  132. package/dist/schema/call/progress.js +7 -3
  133. package/dist/schema/call/proof.d.ts +6 -6
  134. package/dist/schema/call/repository.d.ts +3 -3
  135. package/dist/schema/call/reward.d.ts +57 -57
  136. package/dist/schema/call/semantic.js +41 -1
  137. package/dist/schema/call/service.d.ts +114 -114
  138. package/dist/schema/call/service.js +11 -2
  139. package/dist/schema/call/treasury.d.ts +57 -57
  140. package/dist/schema/messenger/index.js +4 -1
  141. package/dist/schema/operations.d.ts +713 -291
  142. package/dist/schema/operations.js +33 -0
  143. package/dist/schema/project/index.d.ts +4635 -100
  144. package/dist/schema/project/index.js +868 -1
  145. package/dist/schema/query/index.d.ts +363 -19
  146. package/dist/schema/query/index.js +25 -3
  147. package/dist/schema/schema-query/index.d.ts +13 -7
  148. package/dist/schema/schema-query/index.js +29 -5
  149. package/dist/schema/trust/index.d.ts +1012 -6
  150. package/dist/schema/trust/index.js +212 -11
  151. package/dist/schema/utils/skills-recommendation.js +1 -0
  152. package/dist/schema-query/index.d.ts +4 -1
  153. package/dist/schema-query/index.js +255 -1
  154. package/dist/schemas/bridge_operation.schema.json +14 -7
  155. package/dist/schemas/guard2file.schema.json +2 -0
  156. package/dist/schemas/index.json +1 -1
  157. package/dist/schemas/machineNode2file.schema.json +2 -0
  158. package/dist/schemas/messenger_operation.schema.json +1 -1
  159. package/dist/schemas/onchain_operations.schema.json +143 -15
  160. package/dist/schemas/onchain_operations_allocation.schema.json +2 -1
  161. package/dist/schemas/onchain_operations_arbitration.schema.json +7 -5
  162. package/dist/schemas/onchain_operations_contact.schema.json +1 -0
  163. package/dist/schemas/onchain_operations_demand.schema.json +1 -0
  164. package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -0
  165. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -0
  166. package/dist/schemas/onchain_operations_guard.schema.json +578 -0
  167. package/dist/schemas/onchain_operations_machine.schema.json +1 -0
  168. package/dist/schemas/onchain_operations_order.schema.json +4 -3
  169. package/dist/schemas/onchain_operations_payment.schema.json +1 -0
  170. package/dist/schemas/onchain_operations_permission.schema.json +1 -0
  171. package/dist/schemas/onchain_operations_personal.schema.json +37 -0
  172. package/dist/schemas/onchain_operations_progress.schema.json +90 -3
  173. package/dist/schemas/onchain_operations_proof.schema.json +1 -0
  174. package/dist/schemas/onchain_operations_repository.schema.json +1 -0
  175. package/dist/schemas/onchain_operations_reward.schema.json +1 -0
  176. package/dist/schemas/onchain_operations_service.schema.json +4 -3
  177. package/dist/schemas/onchain_operations_treasury.schema.json +1 -0
  178. package/dist/schemas/project_operation.output.json +2243 -1
  179. package/dist/schemas/project_operation.schema.json +683 -1
  180. package/dist/schemas/query_toolkit.output.json +1 -1
  181. package/dist/schemas/query_toolkit.schema.json +37 -0
  182. package/dist/schemas/schema_query.output.json +1 -1
  183. package/dist/schemas/schema_query.schema.json +30 -5
  184. package/dist/schemas/trust_score.output.json +392 -1
  185. package/dist/schemas/trust_score.schema.json +275 -1
  186. package/dist/tools/handlers/onchain.js +73 -8
  187. package/dist/tools/handlers/project.js +46 -0
  188. package/dist/tools/handlers/query.js +117 -2
  189. package/dist/tools/handlers/schema-query.js +41 -0
  190. package/dist/tools/handlers/trust.js +192 -6
  191. package/dist/tools/index.js +52 -9
  192. package/dist/tools/wrap.js +194 -15
  193. package/package.json +2 -2
@@ -1,10 +1,12 @@
1
1
  import { classifyError, buildDataSemantic, } from "../schema/call/semantic.js";
2
2
  import { buildClassifiedErrorResult } from "./shared.js";
3
- import { shouldRunLightHooks, shouldRunHeavyHooks, recordOperationFailure, } from "../harness/auto-escalation.js";
3
+ import { shouldRunLightHooks, shouldRunHeavyHooks, recordOperationFailure, recordCriticalRisk, recordCriticalOperation, recordSubstepFailure, } from "../harness/auto-escalation.js";
4
+ import { getHarnessTier, setHarnessTier } from "../config/runtime.js";
4
5
  import { getHarness } from "../harness/index.js";
5
6
  import { recordOperationOutcome } from "../experience/index.js";
6
7
  import { recordIndustrySignal } from "../knowledge/flywheel-loop.js";
7
8
  import { getStageCache } from "../project/index.js";
9
+ import { extractAmount, getAmountThreshold, formatAmount } from "../knowledge/safety-rules.js";
8
10
  export function withTimeout(promise, timeoutMs = 30000, operationName = "operation") {
9
11
  let timer;
10
12
  return Promise.race([
@@ -59,13 +61,6 @@ export const strictStatusErrorShape = (error, _classified, _ctx) => ({
59
61
  result: { status: "error", error },
60
62
  });
61
63
  function checkProjectStage(action, project, version) {
62
- const entry = getStageCache(project, version);
63
- if (!entry) {
64
- if (action === "analyze_intent" || action === "get_project_status") {
65
- return null;
66
- }
67
- return `project_stage: calling '${action}' before 'analyze_intent' — recommend calling analyze_intent first for project '${project}:${version}'`;
68
- }
69
64
  const stageOrder = {
70
65
  analyze_intent: 2,
71
66
  aggregate_risks: 3,
@@ -75,6 +70,13 @@ function checkProjectStage(action, project, version) {
75
70
  const requiredStage = stageOrder[action];
76
71
  if (!requiredStage)
77
72
  return null;
73
+ const entry = getStageCache(project, version);
74
+ if (!entry) {
75
+ if (action === "analyze_intent") {
76
+ return null;
77
+ }
78
+ return `project_stage: calling '${action}' before 'analyze_intent' — recommend calling analyze_intent first for project '${project}:${version}'`;
79
+ }
78
80
  if (entry.stage < requiredStage - 1) {
79
81
  return `project_stage: calling '${action}' (stage ${requiredStage}) but project is at stage ${entry.stage} — recommend completing prior stages first for '${project}:${version}'`;
80
82
  }
@@ -92,8 +94,9 @@ export function dispatchWithHarness(handler, toolName) {
92
94
  const harness = getHarness();
93
95
  const runLight = shouldRunLightHooks();
94
96
  const runHeavy = shouldRunHeavyHooks();
95
- const isPublishOp = runHeavy && isPublishOperation(toolName, args);
96
- const isSignOp = runHeavy && isSignOperation(toolName, args);
97
+ const publishIntent = isPublishOperation(toolName, args);
98
+ const signIntent = isSignOperation(toolName, args);
99
+ const tierNow = getHarnessTier();
97
100
  let expectedResult;
98
101
  if (runLight) {
99
102
  try {
@@ -123,17 +126,45 @@ export function dispatchWithHarness(handler, toolName) {
123
126
  catch {
124
127
  }
125
128
  }
126
- if (isPublishOp) {
129
+ if (publishIntent && tierNow === "lightweight") {
130
+ setHarnessTier("full");
131
+ harnessWarnings.push("pre_publish: tier forced to full for publish-class operation (GLM5-21 §3.3)");
132
+ }
133
+ if (publishIntent && tierNow !== "off") {
127
134
  try {
128
- harnessWarnings.push("pre_publish: full-tier check engaged");
135
+ const check = runPrePublishChecks(toolName, args);
136
+ harnessWarnings.push(...check.warnings);
137
+ if (check.critical.length > 0) {
138
+ for (const c of check.critical) {
139
+ const esc = recordCriticalRisk(c);
140
+ if (esc)
141
+ harnessWarnings.push(`Harness escalated to full tier: ${esc.reason}`);
142
+ }
143
+ return buildHarnessBlockResult("pre_publish", `Publish BLOCKED by Harness pre-publish gate (GLM5-21 V6): ` +
144
+ `${check.critical.length} CRITICAL risk(s) must be resolved before publish.`, check.critical, check.warnings, "immutable_violation", "Fix the CRITICAL risks listed in the message (e.g. rename dispute/refund nodes per R-M1-11, add the entry pair prev_node=\"\"), then retry publish. Nodes/pairs/forwards are immutable after publish — verify via machineNode2file first.");
145
+ }
129
146
  }
130
147
  catch (e) {
131
148
  harnessWarnings.push(`pre_publish hook failed: ${e instanceof Error ? e.message : String(e)}`);
132
149
  }
133
150
  }
134
- if (isSignOp) {
151
+ if (signIntent && runHeavy) {
135
152
  try {
136
- harnessWarnings.push("pre_sign: full-tier check engaged");
153
+ const data = extractData(args);
154
+ const amt = data ? extractAmount(data) : null;
155
+ if (amt !== null) {
156
+ const threshold = getAmountThreshold();
157
+ let value = null;
158
+ try {
159
+ value = BigInt(amt);
160
+ }
161
+ catch {
162
+ value = null;
163
+ }
164
+ if (value !== null && value > threshold) {
165
+ return buildHarnessBlockResult("pre_sign", `Sign BLOCKED by Harness pre-sign gate (GLM5-21 V7): amount ${formatAmount(value)} WOW exceeds the full-tier threshold ${formatAmount(threshold)} WOW.`, [`amount ${amt} (smallest unit) > threshold ${threshold.toString()} (smallest unit)`], [], "invalid_parameter", "Raise WOWOK_AMOUNT_THRESHOLD to match the intended amount, split the transaction, or reset the harness tier to lightweight (config_operation) after explicit user confirmation.");
166
+ }
167
+ }
137
168
  }
138
169
  catch (e) {
139
170
  harnessWarnings.push(`pre_sign hook failed: ${e instanceof Error ? e.message : String(e)}`);
@@ -149,6 +180,17 @@ export function dispatchWithHarness(handler, toolName) {
149
180
  if (escalation) {
150
181
  harnessWarnings.push(`Harness escalated to full tier: ${escalation.reason}`);
151
182
  }
183
+ if (toolName === "onchain_operations") {
184
+ try {
185
+ const classified = classifyError(errorCode, e);
186
+ if (!classified.retryable && classified.error_code !== "unknown") {
187
+ const esc2 = recordCriticalOperation(toolName, classified.error_code);
188
+ if (esc2)
189
+ harnessWarnings.push(`Harness escalated to full tier: ${esc2.reason}`);
190
+ }
191
+ }
192
+ catch { }
193
+ }
152
194
  throw e;
153
195
  }
154
196
  if (runLight && expectedResult) {
@@ -168,6 +210,34 @@ export function dispatchWithHarness(handler, toolName) {
168
210
  harnessWarnings.push(`post_call hook failed: ${e instanceof Error ? e.message : String(e)}`);
169
211
  }
170
212
  }
213
+ if (toolName === "onchain_operations") {
214
+ try {
215
+ if (classifyOutcome(result) === "failed") {
216
+ const errText = extractErrorCode(result) ?? "";
217
+ const classified = classifyError(errText);
218
+ if (!classified.retryable && classified.error_code !== "unknown") {
219
+ const esc = recordCriticalOperation(toolName, classified.error_code);
220
+ if (esc)
221
+ harnessWarnings.push(`Harness escalated to full tier: ${esc.reason}`);
222
+ }
223
+ }
224
+ }
225
+ catch { }
226
+ }
227
+ if (toolName === "project_operation") {
228
+ try {
229
+ const action = args?.action;
230
+ if (action === "generate_deployment_doc" || action === "trace_substeps") {
231
+ const crit = extractCriticalFindingCount(result);
232
+ if (crit > 0) {
233
+ const esc = recordSubstepFailure(`${String(action)}: ${crit} critical finding(s)`);
234
+ if (esc)
235
+ harnessWarnings.push(`Harness escalated to full tier: ${esc.reason}`);
236
+ }
237
+ }
238
+ }
239
+ catch { }
240
+ }
171
241
  if (isWriteClassTool(toolName)) {
172
242
  try {
173
243
  const operationType = extractOperationType(toolName, args) ?? toolName;
@@ -213,7 +283,10 @@ function isPublishOperation(toolName, args) {
213
283
  if (toolName !== "onchain_operations")
214
284
  return false;
215
285
  const opType = extractOperationType(toolName, args);
216
- return opType === "service" || opType === "machine";
286
+ if (opType !== "service" && opType !== "machine")
287
+ return false;
288
+ const data = extractData(args);
289
+ return data?.publish === true || data?.bPublished === true;
217
290
  }
218
291
  function isSignOperation(toolName, args) {
219
292
  if (toolName === "wip_file") {
@@ -319,3 +392,109 @@ function extractIndustry(args) {
319
392
  }
320
393
  return undefined;
321
394
  }
395
+ const ANTI_PATTERN_NODE_REGEX = /(^|_)(disputed?|refund(?:ed)?|arbitration|arb)(_|$)/i;
396
+ function runPrePublishChecks(toolName, args) {
397
+ const critical = [];
398
+ const warnings = [];
399
+ const opType = extractOperationType(toolName, args);
400
+ const data = extractData(args) ?? {};
401
+ if (opType === "machine") {
402
+ const nodeOp = data.node;
403
+ const nodes = Array.isArray(nodeOp)
404
+ ? nodeOp
405
+ : Array.isArray(nodeOp?.nodes)
406
+ ? nodeOp.nodes
407
+ : [];
408
+ if (nodes.length > 0) {
409
+ for (const n of nodes) {
410
+ const name = typeof n?.name === "string" ? n.name : "";
411
+ if (name && ANTI_PATTERN_NODE_REGEX.test(name)) {
412
+ critical.push(`R-M1-11: machine node "${name}" models dispute/refund flow — ` +
413
+ `refunds must route via an Allocator triggered by business states, ` +
414
+ `disputes via the separate Arbitration object (off-Machine)`);
415
+ }
416
+ }
417
+ const seen = new Set();
418
+ for (const n of nodes) {
419
+ const name = typeof n?.name === "string" ? n.name : "";
420
+ if (!name)
421
+ continue;
422
+ if (seen.has(name)) {
423
+ critical.push(`MC-C-04: duplicate machine node name "${name}" — on-chain will reject the publish transaction`);
424
+ }
425
+ seen.add(name);
426
+ }
427
+ const hasEntry = nodes.some((n) => Array.isArray(n?.pairs) && n.pairs.some((p) => p?.prev_node === ""));
428
+ if (!hasEntry) {
429
+ critical.push(`Machine has no entry pair (prev_node="") — Progress can never advance ` +
430
+ `from the initial state; orders are permanently stuck`);
431
+ }
432
+ for (const n of nodes) {
433
+ const nodeName = typeof n?.name === "string" ? n.name : "?";
434
+ for (const p of n?.pairs ?? []) {
435
+ for (const f of (p?.forwards ?? [])) {
436
+ const hasOp = f?.namedOperator !== undefined && f?.namedOperator !== null;
437
+ const hasIdx = f?.permissionIndex !== undefined && f?.permissionIndex !== null;
438
+ if (!hasOp && !hasIdx) {
439
+ warnings.push(`pre_publish: node "${nodeName}" forward "${String(f?.name ?? "?")}" has neither namedOperator nor permissionIndex — no one can advance it`);
440
+ }
441
+ }
442
+ }
443
+ }
444
+ }
445
+ else {
446
+ warnings.push("pre_publish: publishing machine without inline node data — topology not verifiable in this call; " +
447
+ "verify nodes/pairs/forwards via machineNode2file BEFORE publish (immutable after publish, IMMUT-001)");
448
+ }
449
+ warnings.push("pre_publish: machine nodes/pairs/forwards become immutable after publish (IMMUT-001)");
450
+ }
451
+ if (opType === "service") {
452
+ warnings.push("pre_publish: service machine/order_allocators/arbitrations become immutable after publish (IMMUT-002); sales remains modifiable");
453
+ if (data.machine === undefined) {
454
+ warnings.push("pre_publish: 'machine' not set in this call — if the service was never bound to a published machine, " +
455
+ "it cannot process orders and CANNOT be fixed after publish");
456
+ }
457
+ if (data.order_allocators === undefined) {
458
+ warnings.push("pre_publish: 'order_allocators' not set in this call — immutable after publish; " +
459
+ "orders will have no fund distribution if never configured");
460
+ }
461
+ }
462
+ return { critical, warnings };
463
+ }
464
+ function buildHarnessBlockResult(gate, reason, critical, warnings, errorCode, recoveryHint) {
465
+ const detail = [
466
+ ...critical.map((c) => `CRITICAL: ${c}`),
467
+ ...warnings.map((w) => `WARN: ${w}`),
468
+ ].join("\n");
469
+ const text = `Error: ${reason}${detail ? `\n${detail}` : ""}\nRecovery: ${recoveryHint}`;
470
+ return {
471
+ content: [{ type: "text", text }],
472
+ structuredContent: {
473
+ result: {
474
+ type: "error",
475
+ error: `${reason} [gate=${gate}]`,
476
+ error_code: errorCode,
477
+ retryable: false,
478
+ recovery_hint: recoveryHint,
479
+ },
480
+ message: text,
481
+ },
482
+ };
483
+ }
484
+ function extractCriticalFindingCount(result) {
485
+ const sc = result?.structuredContent;
486
+ if (!sc)
487
+ return 0;
488
+ const semantic = sc.semantic;
489
+ const summary = semantic?.summary;
490
+ if (typeof summary?.critical_count === "number" && summary.critical_count > 0) {
491
+ return summary.critical_count;
492
+ }
493
+ const findings = (sc.findings ?? semantic?.findings);
494
+ if (Array.isArray(findings)) {
495
+ return findings.filter((f) => f?.severity === "error").length;
496
+ }
497
+ const text = result?.content?.map((c) => ("text" in c ? c.text : "")).join("\n") ?? "";
498
+ const matches = text.match(/\[AUDIT ERROR\]/g);
499
+ return matches ? matches.length : 0;
500
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wowok/agent-mcp",
3
- "version": "2.6.3",
3
+ "version": "2.6.6",
4
4
  "description": "Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "license": "Apache-2.0",
51
51
  "dependencies": {
52
52
  "@modelcontextprotocol/sdk": "^1.29.0",
53
- "@wowok/wowok": "2.6.3",
53
+ "@wowok/wowok": "2.6.6",
54
54
  "lodash": "^4.18.1",
55
55
  "zod": "^3.25.76",
56
56
  "zod-to-json-schema": "^3.25.2"