@wowok/agent-mcp 2.4.1 → 2.5.0

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 (348) hide show
  1. package/dist/config/runtime.d.ts +4 -0
  2. package/dist/config/runtime.js +29 -5
  3. package/dist/harness/auto-escalation.d.ts +27 -0
  4. package/dist/harness/auto-escalation.js +68 -0
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +29 -1621
  7. package/dist/knowledge/allocation-confirm.d.ts +115 -0
  8. package/dist/knowledge/allocation-confirm.js +534 -0
  9. package/dist/knowledge/allocation-context.d.ts +58 -0
  10. package/dist/knowledge/allocation-context.js +249 -0
  11. package/dist/knowledge/allocation-ledger.d.ts +67 -0
  12. package/dist/knowledge/allocation-ledger.js +463 -0
  13. package/dist/knowledge/allocation-puzzle.d.ts +135 -0
  14. package/dist/knowledge/allocation-puzzle.js +298 -0
  15. package/dist/knowledge/allocation-risk.d.ts +78 -0
  16. package/dist/knowledge/allocation-risk.js +568 -0
  17. package/dist/knowledge/allocation-templates.d.ts +38 -0
  18. package/dist/knowledge/allocation-templates.js +970 -0
  19. package/dist/knowledge/allocation-translation.d.ts +72 -0
  20. package/dist/knowledge/allocation-translation.js +585 -0
  21. package/dist/knowledge/arb-risk.d.ts +37 -0
  22. package/dist/knowledge/arb-risk.js +210 -0
  23. package/dist/knowledge/arbitration-confirm.d.ts +135 -0
  24. package/dist/knowledge/arbitration-confirm.js +559 -0
  25. package/dist/knowledge/arbitration-context.d.ts +81 -0
  26. package/dist/knowledge/arbitration-context.js +505 -0
  27. package/dist/knowledge/arbitration-ledger.d.ts +62 -0
  28. package/dist/knowledge/arbitration-ledger.js +521 -0
  29. package/dist/knowledge/arbitration-puzzle.d.ts +84 -0
  30. package/dist/knowledge/arbitration-puzzle.js +304 -0
  31. package/dist/knowledge/arbitration-risk.d.ts +112 -0
  32. package/dist/knowledge/arbitration-risk.js +433 -0
  33. package/dist/knowledge/arbitration-templates.d.ts +38 -0
  34. package/dist/knowledge/arbitration-templates.js +276 -0
  35. package/dist/knowledge/arbitration-translation.d.ts +91 -0
  36. package/dist/knowledge/arbitration-translation.js +487 -0
  37. package/dist/knowledge/bridge-risk.d.ts +36 -0
  38. package/dist/knowledge/bridge-risk.js +263 -0
  39. package/dist/knowledge/contact-risk.d.ts +32 -0
  40. package/dist/knowledge/contact-risk.js +200 -0
  41. package/dist/knowledge/demand-confirm.d.ts +32 -0
  42. package/dist/knowledge/demand-confirm.js +206 -0
  43. package/dist/knowledge/demand-risk.d.ts +30 -0
  44. package/dist/knowledge/demand-risk.js +240 -0
  45. package/dist/knowledge/demand-translation.d.ts +55 -0
  46. package/dist/knowledge/demand-translation.js +354 -0
  47. package/dist/knowledge/deployment-scanner.d.ts +63 -0
  48. package/dist/knowledge/deployment-scanner.js +762 -0
  49. package/dist/knowledge/examples-scanner-cli.d.ts +1 -0
  50. package/dist/knowledge/examples-scanner-cli.js +26 -0
  51. package/dist/knowledge/examples-scanner.d.ts +121 -0
  52. package/dist/knowledge/examples-scanner.js +825 -0
  53. package/dist/knowledge/flywheel-loop.d.ts +3 -0
  54. package/dist/knowledge/flywheel-loop.js +32 -3
  55. package/dist/knowledge/glossary.js +3 -1
  56. package/dist/knowledge/guard-confirm.d.ts +86 -0
  57. package/dist/knowledge/guard-confirm.js +406 -0
  58. package/dist/knowledge/guard-context.d.ts +56 -0
  59. package/dist/knowledge/guard-context.js +287 -0
  60. package/dist/knowledge/guard-design-patterns.d.ts +37 -0
  61. package/dist/knowledge/guard-design-patterns.js +257 -0
  62. package/dist/knowledge/guard-ledger.js +14 -0
  63. package/dist/knowledge/guard-lint.d.ts +1 -0
  64. package/dist/knowledge/guard-lint.js +83 -3
  65. package/dist/knowledge/guard-migration.d.ts +48 -0
  66. package/dist/knowledge/guard-migration.js +228 -0
  67. package/dist/knowledge/guard-puzzle.js +3 -2
  68. package/dist/knowledge/guard-risk.d.ts +3 -1
  69. package/dist/knowledge/guard-risk.js +832 -64
  70. package/dist/knowledge/guard-templates.d.ts +1 -0
  71. package/dist/knowledge/guard-templates.js +278 -2
  72. package/dist/knowledge/guard-translation.js +6 -5
  73. package/dist/knowledge/index.d.ts +342 -0
  74. package/dist/knowledge/index.js +344 -0
  75. package/dist/knowledge/machine-confirm.d.ts +102 -0
  76. package/dist/knowledge/machine-confirm.js +559 -0
  77. package/dist/knowledge/machine-context.d.ts +160 -0
  78. package/dist/knowledge/machine-context.js +812 -0
  79. package/dist/knowledge/machine-ledger.d.ts +41 -0
  80. package/dist/knowledge/machine-ledger.js +315 -0
  81. package/dist/knowledge/machine-puzzle.d.ts +206 -0
  82. package/dist/knowledge/machine-puzzle.js +494 -0
  83. package/dist/knowledge/machine-risk.d.ts +75 -0
  84. package/dist/knowledge/machine-risk.js +644 -0
  85. package/dist/knowledge/machine-templates.d.ts +92 -0
  86. package/dist/knowledge/machine-templates.js +1592 -0
  87. package/dist/knowledge/machine-topology.d.ts +57 -0
  88. package/dist/knowledge/machine-topology.js +234 -0
  89. package/dist/knowledge/machine-translation.d.ts +96 -0
  90. package/dist/knowledge/machine-translation.js +513 -0
  91. package/dist/knowledge/mcp-schema-audit-cli.d.ts +1 -0
  92. package/dist/knowledge/mcp-schema-audit-cli.js +45 -0
  93. package/dist/knowledge/mcp-schema-audit.d.ts +90 -0
  94. package/dist/knowledge/mcp-schema-audit.js +772 -0
  95. package/dist/knowledge/onchain-constants.d.ts +4 -0
  96. package/dist/knowledge/onchain-constants.js +35 -0
  97. package/dist/knowledge/order-confirm.d.ts +115 -0
  98. package/dist/knowledge/order-confirm.js +573 -0
  99. package/dist/knowledge/order-context.d.ts +66 -0
  100. package/dist/knowledge/order-context.js +390 -0
  101. package/dist/knowledge/order-ledger.d.ts +69 -0
  102. package/dist/knowledge/order-ledger.js +341 -0
  103. package/dist/knowledge/order-puzzle.d.ts +159 -0
  104. package/dist/knowledge/order-puzzle.js +255 -0
  105. package/dist/knowledge/order-risk.d.ts +66 -0
  106. package/dist/knowledge/order-risk.js +653 -0
  107. package/dist/knowledge/order-templates.d.ts +50 -0
  108. package/dist/knowledge/order-templates.js +368 -0
  109. package/dist/knowledge/order-translation.d.ts +78 -0
  110. package/dist/knowledge/order-translation.js +550 -0
  111. package/dist/knowledge/passport-confirm.d.ts +130 -0
  112. package/dist/knowledge/passport-confirm.js +531 -0
  113. package/dist/knowledge/passport-context.d.ts +59 -0
  114. package/dist/knowledge/passport-context.js +306 -0
  115. package/dist/knowledge/passport-ledger.d.ts +48 -0
  116. package/dist/knowledge/passport-ledger.js +282 -0
  117. package/dist/knowledge/passport-puzzle.d.ts +108 -0
  118. package/dist/knowledge/passport-puzzle.js +333 -0
  119. package/dist/knowledge/passport-risk.d.ts +70 -0
  120. package/dist/knowledge/passport-risk.js +450 -0
  121. package/dist/knowledge/passport-templates.d.ts +40 -0
  122. package/dist/knowledge/passport-templates.js +568 -0
  123. package/dist/knowledge/passport-translation.d.ts +68 -0
  124. package/dist/knowledge/passport-translation.js +516 -0
  125. package/dist/knowledge/payment-risk.d.ts +33 -0
  126. package/dist/knowledge/payment-risk.js +182 -0
  127. package/dist/knowledge/permission-confirm.d.ts +110 -0
  128. package/dist/knowledge/permission-confirm.js +426 -0
  129. package/dist/knowledge/permission-context.d.ts +58 -0
  130. package/dist/knowledge/permission-context.js +224 -0
  131. package/dist/knowledge/permission-ledger.d.ts +38 -0
  132. package/dist/knowledge/permission-ledger.js +403 -0
  133. package/dist/knowledge/permission-puzzle.d.ts +122 -0
  134. package/dist/knowledge/permission-puzzle.js +173 -0
  135. package/dist/knowledge/permission-risk.d.ts +76 -0
  136. package/dist/knowledge/permission-risk.js +411 -0
  137. package/dist/knowledge/permission-templates.d.ts +38 -0
  138. package/dist/knowledge/permission-templates.js +234 -0
  139. package/dist/knowledge/permission-translation.d.ts +57 -0
  140. package/dist/knowledge/permission-translation.js +350 -0
  141. package/dist/knowledge/personal-risk.d.ts +36 -0
  142. package/dist/knowledge/personal-risk.js +212 -0
  143. package/dist/knowledge/progress-confirm.d.ts +108 -0
  144. package/dist/knowledge/progress-confirm.js +456 -0
  145. package/dist/knowledge/progress-context.d.ts +123 -0
  146. package/dist/knowledge/progress-context.js +452 -0
  147. package/dist/knowledge/progress-ledger.d.ts +63 -0
  148. package/dist/knowledge/progress-ledger.js +327 -0
  149. package/dist/knowledge/progress-puzzle.d.ts +82 -0
  150. package/dist/knowledge/progress-puzzle.js +219 -0
  151. package/dist/knowledge/progress-risk.d.ts +74 -0
  152. package/dist/knowledge/progress-risk.js +461 -0
  153. package/dist/knowledge/progress-templates.d.ts +38 -0
  154. package/dist/knowledge/progress-templates.js +228 -0
  155. package/dist/knowledge/progress-translation.d.ts +52 -0
  156. package/dist/knowledge/progress-translation.js +401 -0
  157. package/dist/knowledge/proof-confirm.d.ts +31 -0
  158. package/dist/knowledge/proof-confirm.js +187 -0
  159. package/dist/knowledge/proof-risk.d.ts +33 -0
  160. package/dist/knowledge/proof-risk.js +207 -0
  161. package/dist/knowledge/proof-translation.d.ts +52 -0
  162. package/dist/knowledge/proof-translation.js +283 -0
  163. package/dist/knowledge/registrar-risk.d.ts +34 -0
  164. package/dist/knowledge/registrar-risk.js +217 -0
  165. package/dist/knowledge/repository-confirm.d.ts +36 -0
  166. package/dist/knowledge/repository-confirm.js +242 -0
  167. package/dist/knowledge/repository-risk.d.ts +40 -0
  168. package/dist/knowledge/repository-risk.js +312 -0
  169. package/dist/knowledge/repository-translation.d.ts +58 -0
  170. package/dist/knowledge/repository-translation.js +422 -0
  171. package/dist/knowledge/resource-risk.d.ts +32 -0
  172. package/dist/knowledge/resource-risk.js +157 -0
  173. package/dist/knowledge/reward-confirm.d.ts +113 -0
  174. package/dist/knowledge/reward-confirm.js +496 -0
  175. package/dist/knowledge/reward-context.d.ts +127 -0
  176. package/dist/knowledge/reward-context.js +504 -0
  177. package/dist/knowledge/reward-ledger.d.ts +96 -0
  178. package/dist/knowledge/reward-ledger.js +502 -0
  179. package/dist/knowledge/reward-puzzle.d.ts +97 -0
  180. package/dist/knowledge/reward-puzzle.js +288 -0
  181. package/dist/knowledge/reward-risk.d.ts +84 -0
  182. package/dist/knowledge/reward-risk.js +545 -0
  183. package/dist/knowledge/reward-translation.d.ts +58 -0
  184. package/dist/knowledge/reward-translation.js +501 -0
  185. package/dist/knowledge/safety-rules.js +11 -3
  186. package/dist/knowledge/scenario-modes.d.ts +53 -0
  187. package/dist/knowledge/scenario-modes.js +302 -0
  188. package/dist/knowledge/service-confirm.d.ts +152 -0
  189. package/dist/knowledge/service-confirm.js +699 -0
  190. package/dist/knowledge/service-context.d.ts +66 -0
  191. package/dist/knowledge/service-context.js +403 -0
  192. package/dist/knowledge/service-ledger.d.ts +71 -0
  193. package/dist/knowledge/service-ledger.js +609 -0
  194. package/dist/knowledge/service-puzzle.d.ts +158 -0
  195. package/dist/knowledge/service-puzzle.js +236 -0
  196. package/dist/knowledge/service-risk.d.ts +108 -0
  197. package/dist/knowledge/service-risk.js +615 -0
  198. package/dist/knowledge/service-templates.d.ts +39 -0
  199. package/dist/knowledge/service-templates.js +418 -0
  200. package/dist/knowledge/service-translation.d.ts +103 -0
  201. package/dist/knowledge/service-translation.js +622 -0
  202. package/dist/knowledge/tools-reference.d.ts +17 -0
  203. package/dist/knowledge/tools-reference.js +151 -0
  204. package/dist/knowledge/treasury-confirm.d.ts +133 -0
  205. package/dist/knowledge/treasury-confirm.js +512 -0
  206. package/dist/knowledge/treasury-context.d.ts +64 -0
  207. package/dist/knowledge/treasury-context.js +363 -0
  208. package/dist/knowledge/treasury-ledger.d.ts +42 -0
  209. package/dist/knowledge/treasury-ledger.js +300 -0
  210. package/dist/knowledge/treasury-puzzle.d.ts +163 -0
  211. package/dist/knowledge/treasury-puzzle.js +216 -0
  212. package/dist/knowledge/treasury-risk.d.ts +86 -0
  213. package/dist/knowledge/treasury-risk.js +440 -0
  214. package/dist/knowledge/treasury-templates.d.ts +38 -0
  215. package/dist/knowledge/treasury-templates.js +316 -0
  216. package/dist/knowledge/treasury-translation.d.ts +78 -0
  217. package/dist/knowledge/treasury-translation.js +498 -0
  218. package/dist/knowledge/util-risk.d.ts +30 -0
  219. package/dist/knowledge/util-risk.js +135 -0
  220. package/dist/project/business-puzzle.d.ts +47 -0
  221. package/dist/project/business-puzzle.js +372 -0
  222. package/dist/project/deployment-doc.d.ts +61 -0
  223. package/dist/project/deployment-doc.js +432 -0
  224. package/dist/project/graph.d.ts +1 -0
  225. package/dist/project/graph.js +27 -1
  226. package/dist/project/index.d.ts +1 -0
  227. package/dist/project/index.js +39 -2
  228. package/dist/project/namespace.d.ts +11 -1
  229. package/dist/project/namespace.js +27 -2
  230. package/dist/project/query.d.ts +2 -0
  231. package/dist/project/query.js +56 -15
  232. package/dist/project/risk-aggregator.d.ts +50 -0
  233. package/dist/project/risk-aggregator.js +280 -0
  234. package/dist/project/substep-trace.d.ts +130 -0
  235. package/dist/project/substep-trace.js +332 -0
  236. package/dist/rules.d.ts +12 -0
  237. package/dist/rules.js +9 -0
  238. package/dist/schema/call/allocation.d.ts +44 -44
  239. package/dist/schema/call/arbitration.d.ts +141 -141
  240. package/dist/schema/call/base.d.ts +386 -386
  241. package/dist/schema/call/base.js +6 -6
  242. package/dist/schema/call/bridge-handler.d.ts +5 -2
  243. package/dist/schema/call/bridge.d.ts +159 -159
  244. package/dist/schema/call/contact.d.ts +110 -110
  245. package/dist/schema/call/demand.d.ts +76 -76
  246. package/dist/schema/call/handler.d.ts +2 -3
  247. package/dist/schema/call/handler.js +1 -1
  248. package/dist/schema/call/machine.d.ts +96 -96
  249. package/dist/schema/call/order.d.ts +98 -110
  250. package/dist/schema/call/permission-handler.d.ts +5 -0
  251. package/dist/schema/call/permission-handler.js +54 -0
  252. package/dist/schema/call/permission.d.ts +108 -108
  253. package/dist/schema/call/personal.d.ts +14 -14
  254. package/dist/schema/call/progress.d.ts +57 -72
  255. package/dist/schema/call/progress.js +7 -4
  256. package/dist/schema/call/proof.d.ts +18 -18
  257. package/dist/schema/call/proof.js +12 -7
  258. package/dist/schema/call/repository.d.ts +154 -154
  259. package/dist/schema/call/reward.d.ts +55 -55
  260. package/dist/schema/call/semantic.js +1 -1
  261. package/dist/schema/call/service.d.ts +238 -238
  262. package/dist/schema/call/treasury.d.ts +93 -93
  263. package/dist/schema/config/index.d.ts +178 -5
  264. package/dist/schema/config/index.js +52 -1
  265. package/dist/schema/local/index.d.ts +3554 -836
  266. package/dist/schema/local/index.js +2 -1
  267. package/dist/schema/messenger/index.d.ts +162 -162
  268. package/dist/schema/operations.d.ts +1102 -1118
  269. package/dist/schema/operations.js +7 -1
  270. package/dist/schema/project/index.d.ts +1392 -6
  271. package/dist/schema/project/index.js +426 -2
  272. package/dist/schema/query/index.d.ts +818 -818
  273. package/dist/schema/query/index.js +15 -9
  274. package/dist/schema/schema-query/index.d.ts +23 -3
  275. package/dist/schema/schema-query/index.js +13 -2
  276. package/dist/schema/sync-layer4.d.ts +21 -0
  277. package/dist/schema/sync-layer4.js +261 -0
  278. package/dist/schema/trust/index.d.ts +26 -26
  279. package/dist/schema/utils/guard-query-utils.d.ts +7 -0
  280. package/dist/schema/utils/guard-query-utils.js +14 -1
  281. package/dist/schemas/account_operation.output.json +718 -0
  282. package/dist/schemas/bridge_operation.output.json +1 -1
  283. package/dist/schemas/config_operation.output.json +173 -0
  284. package/dist/schemas/index.json +9 -1
  285. package/dist/schemas/local_info_operation.output.json +718 -0
  286. package/dist/schemas/local_mark_operation.output.json +718 -0
  287. package/dist/schemas/messenger_operation.output.json +1 -1
  288. package/dist/schemas/onchain_events.output.json +1 -1
  289. package/dist/schemas/onchain_operations.output.json +5 -4
  290. package/dist/schemas/onchain_operations.schema.json +1813 -333
  291. package/dist/schemas/onchain_operations_allocation.schema.json +9 -11
  292. package/dist/schemas/onchain_operations_arbitration.schema.json +2 -1
  293. package/dist/schemas/onchain_operations_contact.schema.json +2 -1
  294. package/dist/schemas/onchain_operations_demand.schema.json +2 -1
  295. package/dist/schemas/onchain_operations_gen_passport.schema.json +878 -872
  296. package/dist/schemas/onchain_operations_gen_proof.schema.json +273 -0
  297. package/dist/schemas/onchain_operations_guard.schema.json +584 -70
  298. package/dist/schemas/onchain_operations_machine.schema.json +4 -6
  299. package/dist/schemas/onchain_operations_order.schema.json +13 -9
  300. package/dist/schemas/onchain_operations_payment.schema.json +2 -1
  301. package/dist/schemas/onchain_operations_permission.schema.json +2 -1
  302. package/dist/schemas/onchain_operations_personal.schema.json +2 -1
  303. package/dist/schemas/onchain_operations_progress.schema.json +14 -10
  304. package/dist/schemas/onchain_operations_proof.schema.json +699 -0
  305. package/dist/schemas/onchain_operations_repository.schema.json +2 -1
  306. package/dist/schemas/onchain_operations_reward.schema.json +2 -1
  307. package/dist/schemas/onchain_operations_service.schema.json +4 -6
  308. package/dist/schemas/onchain_operations_treasury.schema.json +2 -1
  309. package/dist/schemas/onchain_table_data.output.json +6 -12
  310. package/dist/schemas/onchain_table_data.schema.json +32 -1
  311. package/dist/schemas/project_operation.output.json +879 -0
  312. package/dist/schemas/project_operation.schema.json +473 -2
  313. package/dist/schemas/query_toolkit.output.json +14906 -6
  314. package/dist/schemas/schema_query.output.json +38 -1
  315. package/dist/telemetry/index.d.ts +1 -1
  316. package/dist/tools/handlers/bridge.d.ts +1 -0
  317. package/dist/tools/handlers/bridge.js +1 -0
  318. package/dist/tools/handlers/config.d.ts +2 -0
  319. package/dist/tools/handlers/config.js +74 -0
  320. package/dist/tools/handlers/file-export.d.ts +3 -0
  321. package/dist/tools/handlers/file-export.js +90 -0
  322. package/dist/tools/handlers/local.d.ts +3 -0
  323. package/dist/tools/handlers/local.js +38 -0
  324. package/dist/tools/handlers/messenger.d.ts +16 -0
  325. package/dist/tools/handlers/messenger.js +188 -0
  326. package/dist/tools/handlers/onchain.d.ts +2 -0
  327. package/dist/tools/handlers/onchain.js +248 -0
  328. package/dist/tools/handlers/project.d.ts +2 -0
  329. package/dist/tools/handlers/project.js +293 -0
  330. package/dist/tools/handlers/query.d.ts +5 -0
  331. package/dist/tools/handlers/query.js +256 -0
  332. package/dist/tools/handlers/schema-query.d.ts +2 -0
  333. package/dist/tools/handlers/schema-query.js +93 -0
  334. package/dist/tools/handlers/trust.d.ts +2 -0
  335. package/dist/tools/handlers/trust.js +194 -0
  336. package/dist/tools/handlers/wip.d.ts +2 -0
  337. package/dist/tools/handlers/wip.js +44 -0
  338. package/dist/tools/index.d.ts +13 -0
  339. package/dist/tools/index.js +526 -0
  340. package/dist/tools/rules-hook.d.ts +2 -0
  341. package/dist/tools/rules-hook.js +23 -0
  342. package/dist/tools/shared.d.ts +20 -0
  343. package/dist/tools/shared.js +130 -0
  344. package/dist/tools/types.d.ts +35 -0
  345. package/dist/tools/types.js +1 -0
  346. package/dist/tools/wrap.d.ts +14 -0
  347. package/dist/tools/wrap.js +267 -0
  348. package/package.json +20 -6
@@ -34,6 +34,7 @@ export interface GuardJsonInput {
34
34
  host_object?: string;
35
35
  binding_field?: string;
36
36
  action?: string;
37
+ sharing_recipients?: ("Signer" | "Entity" | "GuardIdentifier")[];
37
38
  };
38
39
  }
39
40
  export interface AutoFixAction {
@@ -81,10 +81,15 @@ async function checkSdkSyntax(json) {
81
81
  function checkSemanticErrors(json) {
82
82
  const diagnostics = [];
83
83
  const { table, root, binding_hint } = json;
84
+ const scene = binding_hint ? findScene(binding_hint.host_object ?? "", binding_hint.binding_field ?? "") : undefined;
84
85
  const submissionEntries = getSubmissionEntries(table);
85
86
  if (submissionEntries.length > 0 && root && !hasSignerContext(root)) {
86
87
  const hasAddressSubmission = submissionEntries.some((e) => e.value_type === "Address");
87
- if (hasAddressSubmission) {
88
+ const isAllocatorsEntitySharing = scene?.id === "service_order_allocators_guard" &&
89
+ binding_hint?.sharing_recipients !== undefined &&
90
+ binding_hint.sharing_recipients.length > 0 &&
91
+ !binding_hint.sharing_recipients.includes("Signer");
92
+ if (hasAddressSubmission && !isAllocatorsEntitySharing) {
88
93
  const indices = submissionEntries
89
94
  .filter((e) => e.value_type === "Address")
90
95
  .map((e) => table.indexOf(e));
@@ -101,7 +106,6 @@ function checkSemanticErrors(json) {
101
106
  });
102
107
  }
103
108
  }
104
- const scene = binding_hint ? findScene(binding_hint.host_object ?? "", binding_hint.binding_field ?? "") : undefined;
105
109
  if (scene?.id === "arbitration_voting_guard") {
106
110
  const hasWeightSubmission = submissionEntries.some((e) => ["U8", "U16", "U32", "U64", "U128", "U256"].includes(e.value_type ?? ""));
107
111
  if (hasWeightSubmission) {
@@ -238,6 +242,22 @@ function checkSyntaxHints(json) {
238
242
  });
239
243
  }
240
244
  }
245
+ for (let i = 0; i < table.length; i++) {
246
+ const entry = table[i];
247
+ if (entry.b_submission === true && entry.value !== undefined && entry.value !== null) {
248
+ diagnostics.push({
249
+ code: "SH-11",
250
+ message: `table[${i}] has a redundant value field on b_submission=true entry (the verifier supplies the value at runtime; this value is ignored by BCS encoding and wastes gas)`,
251
+ severity: "warning",
252
+ source: "lint",
253
+ location: { path: `/table/${i}/value` },
254
+ fix: {
255
+ description: "Remove the value field — it is ignored for b_submission=true entries",
256
+ auto_fixable: true,
257
+ },
258
+ });
259
+ }
260
+ }
241
261
  return diagnostics;
242
262
  }
243
263
  function checkSuggestions(json) {
@@ -324,6 +344,46 @@ function checkSuggestions(json) {
324
344
  });
325
345
  }
326
346
  }
347
+ if (root) {
348
+ const rootStr = rootToString(root);
349
+ const hasProofSigner = rootStr.includes("proof.signer");
350
+ const hasProofTime = rootStr.includes("proof.time");
351
+ const hasStringLength = rootStr.includes("calc_string_length");
352
+ const hasStringSubmission = submissionEntries.some((e) => e.value_type === "String");
353
+ if (hasProofSigner && hasProofTime) {
354
+ diagnostics.push({
355
+ code: "SG-04",
356
+ message: "Strict-mode privacy-delivery guard detected (proof.signer + proof.time). " +
357
+ "Recommended three conditions: Signer==proof.signer (submitter accountability), " +
358
+ "proof.time>order.time (freshness), order.service==service (project binding). " +
359
+ "No content verification — only submission responsibility ('whoever benefits bears the burden of proof').",
360
+ severity: "info",
361
+ source: "lint",
362
+ location: { path: "/root" },
363
+ fix: {
364
+ description: "Ensure all three conditions are present (logic_and). Refer to template tpl_forward_privacy_delivery_proof. " +
365
+ "Query IDs: proof.signer=1958, proof.time=1960, order.time=1574, order.service=1563.",
366
+ auto_fixable: false,
367
+ },
368
+ });
369
+ }
370
+ else if (hasStringLength && hasStringSubmission) {
371
+ diagnostics.push({
372
+ code: "SG-04",
373
+ message: "Broad-mode privacy-delivery guard detected (String submission + length check, e.g. Merkle Root length == 66). " +
374
+ "This trusts the submitter's honesty; the counterparty can dispute by checking their own Messenger conversation. " +
375
+ "Suitable as an arbitration basis, not a fund-flow gate.",
376
+ severity: "info",
377
+ source: "lint",
378
+ location: { path: "/root" },
379
+ fix: {
380
+ description: "For stronger assurance, consider strict mode: submit a Proof object address (from messenger.submitChainProof) + " +
381
+ "Order address, then verify proof.signer/proof.time/order.service. See template tpl_forward_privacy_delivery_proof.",
382
+ auto_fixable: false,
383
+ },
384
+ });
385
+ }
386
+ }
327
387
  return diagnostics;
328
388
  }
329
389
  export function autoFixGuard(json) {
@@ -433,6 +493,20 @@ export function autoFixGuard(json) {
433
493
  fixed.rely.guards = unique;
434
494
  }
435
495
  }
496
+ for (let i = 0; i < fixed.table.length; i++) {
497
+ const entry = fixed.table[i];
498
+ if (entry.b_submission === true && entry.value !== undefined && entry.value !== null) {
499
+ const before = JSON.stringify(entry.value);
500
+ delete entry.value;
501
+ actions.push({
502
+ diagnostic_code: "SH-11",
503
+ description: `table[${i}] remove redundant value on b_submission=true entry`,
504
+ before,
505
+ after: "(removed)",
506
+ path: `/table/${i}/value`,
507
+ });
508
+ }
509
+ }
436
510
  return { fixed, actions };
437
511
  }
438
512
  export async function lintGuard(json, options) {
@@ -467,7 +541,13 @@ export async function lintGuard(json, options) {
467
541
  name: e.name,
468
542
  object_type: e.object_type,
469
543
  }));
470
- risk_assessment = assessGuardRisks({ table: mappedTable, root, rely, scene });
544
+ risk_assessment = assessGuardRisks({
545
+ table: mappedTable,
546
+ root,
547
+ rely,
548
+ scene,
549
+ sharing_recipients: binding_hint?.sharing_recipients,
550
+ });
471
551
  for (const r of risk_assessment.risks) {
472
552
  const severity = r.level === "critical" || r.level === "high" ? "error" :
473
553
  r.level === "medium" ? "warning" :
@@ -0,0 +1,48 @@
1
+ export type GuardNodeType = 'logic_or' | 'logic_and' | 'logic_not' | 'logic_equal' | 'logic_string_nocase_equal' | 'logic_as_u256_equal' | 'logic_string_contains' | 'logic_string_nocase_contains' | 'logic_as_u256_greater' | 'logic_as_u256_lesser' | 'logic_as_u256_greater_or_equal' | 'logic_as_u256_lesser_or_equal' | 'vec_contains_string' | 'vec_contains_string_nocase' | 'vec_contains_address' | 'vec_contains_number' | 'vec_contains_bool' | 'identifier' | 'query' | 'context' | 'calc_number_add' | 'calc_number_subtract' | 'calc_number_multiply' | 'calc_number_divide' | 'calc_number_mod' | string;
2
+ export interface GuardNode {
3
+ type: GuardNodeType;
4
+ nodes?: GuardNode[];
5
+ node?: GuardNode;
6
+ identifier?: number;
7
+ query?: string | number;
8
+ context?: string;
9
+ object?: {
10
+ identifier?: number;
11
+ convert_witness?: string | number;
12
+ };
13
+ parameters?: unknown[];
14
+ }
15
+ export interface GuardTableEntry {
16
+ identifier: number;
17
+ b_submission?: boolean;
18
+ value_type?: string | number;
19
+ value?: unknown;
20
+ name?: string;
21
+ }
22
+ export type VecContainsTarget = 'vec_contains_string' | 'vec_contains_string_nocase' | 'vec_contains_address' | 'vec_contains_number' | 'vec_contains_bool';
23
+ export type VecValueType = 'VecString' | 'VecAddress' | 'VecU64' | 'VecU128' | 'VecU256' | 'VecU8' | 'VecU16' | 'VecU32' | 'VecBool';
24
+ export interface ConversionResult {
25
+ convertible: boolean;
26
+ targetOperator?: VecContainsTarget;
27
+ vectorValueType?: VecValueType;
28
+ sharedNode?: GuardNode;
29
+ constants?: Array<{
30
+ identifier: number;
31
+ value: unknown;
32
+ value_type: string;
33
+ }>;
34
+ reasons?: string[];
35
+ }
36
+ export declare function analyzeLogicOrConversion(orNode: GuardNode, table: GuardTableEntry[]): ConversionResult;
37
+ export interface ShorthandResult {
38
+ newRoot: GuardNode;
39
+ removeIdentifiers: number[];
40
+ addEntry: {
41
+ identifier: number;
42
+ b_submission: false;
43
+ value_type: VecValueType;
44
+ value: unknown[];
45
+ name: string;
46
+ };
47
+ }
48
+ export declare function buildShorthand(orNode: GuardNode, result: ConversionResult, newIdentifier: number): ShorthandResult | null;
@@ -0,0 +1,228 @@
1
+ const EQUAL_OPERATORS = new Set([
2
+ 'logic_equal',
3
+ 'logic_string_nocase_equal',
4
+ 'logic_as_u256_equal',
5
+ ]);
6
+ function mapOperatorToTarget(operator, valueType) {
7
+ if (valueType === 'String' || valueType === 2) {
8
+ if (operator === 'logic_string_nocase_equal') {
9
+ return { target: 'vec_contains_string_nocase', vecType: 'VecString' };
10
+ }
11
+ if (operator === 'logic_equal') {
12
+ return { target: 'vec_contains_string', vecType: 'VecString' };
13
+ }
14
+ return null;
15
+ }
16
+ if (valueType === 'Address' || valueType === 1) {
17
+ if (operator === 'logic_equal') {
18
+ return { target: 'vec_contains_address', vecType: 'VecAddress' };
19
+ }
20
+ return null;
21
+ }
22
+ if (valueType === 'Bool' || valueType === 0) {
23
+ if (operator === 'logic_equal') {
24
+ return { target: 'vec_contains_bool', vecType: 'VecBool' };
25
+ }
26
+ return null;
27
+ }
28
+ const numericTypes = new Set([
29
+ 'U8', 'U16', 'U32', 'U64', 'U128', 'U256',
30
+ 3, 4, 5, 6, 7, 8,
31
+ ]);
32
+ if (numericTypes.has(valueType)) {
33
+ if (operator === 'logic_equal' || operator === 'logic_as_u256_equal') {
34
+ return { target: 'vec_contains_number', vecType: 'VecU256' };
35
+ }
36
+ return null;
37
+ }
38
+ return null;
39
+ }
40
+ export function analyzeLogicOrConversion(orNode, table) {
41
+ const reasons = [];
42
+ if (orNode.type !== 'logic_or') {
43
+ return {
44
+ convertible: false,
45
+ reasons: [`Node type is '${orNode.type}', not 'logic_or'. Only logic_or nodes are candidates.`],
46
+ };
47
+ }
48
+ const children = orNode.nodes ?? [];
49
+ if (children.length < 2) {
50
+ return {
51
+ convertible: false,
52
+ reasons: [`logic_or has ${children.length} children; need at least 2 to convert.`],
53
+ };
54
+ }
55
+ if (children.length > 7) {
56
+ return {
57
+ convertible: false,
58
+ reasons: [
59
+ `logic_or has ${children.length} children; vec_contains_* supports at most 7 needles (1 haystack + 7 needles = 8 node limit). Keep the logic_or.`,
60
+ ],
61
+ };
62
+ }
63
+ const childOperators = new Set();
64
+ for (const child of children) {
65
+ if (!EQUAL_OPERATORS.has(child.type)) {
66
+ if (child.type === 'logic_string_contains' || child.type === 'logic_string_nocase_contains') {
67
+ reasons.push(`Child uses '${child.type}' (substring match). vec_contains_* is whole-element membership, NOT substring. Cannot convert.`);
68
+ }
69
+ else if (child.type?.startsWith('logic_as_u256_greater') || child.type?.startsWith('logic_as_u256_lesser')) {
70
+ reasons.push(`Child uses '${child.type}' (ordering comparison). vec_contains_* is membership, not ordering. Cannot convert.`);
71
+ }
72
+ else if (child.type === 'logic_and' || child.type === 'logic_or' || child.type === 'logic_not') {
73
+ reasons.push(`Child is a nested logic node ('${child.type}'). Only leaf equal-style comparisons are convertible.`);
74
+ }
75
+ else {
76
+ reasons.push(`Child uses '${child.type}' which is not an equal-style operator (logic_equal / logic_string_nocase_equal / logic_as_u256_equal).`);
77
+ }
78
+ return { convertible: false, reasons };
79
+ }
80
+ childOperators.add(child.type);
81
+ }
82
+ if (childOperators.size > 1) {
83
+ const opList = Array.from(childOperators).join(', ');
84
+ return {
85
+ convertible: false,
86
+ reasons: [
87
+ `Children use mixed operators: [${opList}]. Mixing case-sensitive (logic_equal) and case-insensitive (logic_string_nocase_equal) comparisons would change semantics. Keep the logic_or.`,
88
+ ],
89
+ };
90
+ }
91
+ const sharedOperator = children[0].type;
92
+ for (let i = 0; i < children.length; i++) {
93
+ const childNodes = children[i].nodes ?? [];
94
+ if (childNodes.length !== 2) {
95
+ return {
96
+ convertible: false,
97
+ reasons: [
98
+ `Child ${i} ('${sharedOperator}') has ${childNodes.length} sub-nodes; expected exactly 2 (one constant side + one shared query side).`,
99
+ ],
100
+ };
101
+ }
102
+ }
103
+ const constants = [];
104
+ let sharedNode = null;
105
+ let sharedNodeSerial = null;
106
+ for (let i = 0; i < children.length; i++) {
107
+ const childNodes = children[i].nodes;
108
+ const left = childNodes[0];
109
+ const right = childNodes[1];
110
+ const leftIsConstId = left.type === 'identifier' && typeof left.identifier === 'number';
111
+ const rightIsConstId = right.type === 'identifier' && typeof right.identifier === 'number';
112
+ if (!leftIsConstId && !rightIsConstId) {
113
+ return {
114
+ convertible: false,
115
+ reasons: [
116
+ `Child ${i} has no constant identifier side (both sub-nodes are non-identifier). Conversion requires one side to be a constant table entry.`,
117
+ ],
118
+ };
119
+ }
120
+ if (leftIsConstId && rightIsConstId) {
121
+ return {
122
+ convertible: false,
123
+ reasons: [
124
+ `Child ${i} has two identifier sides. Conversion requires one side to be a non-constant (query/context/calc) node shared across all children.`,
125
+ ],
126
+ };
127
+ }
128
+ const constIdNode = leftIsConstId ? left : right;
129
+ const nonConstNode = leftIsConstId ? right : left;
130
+ const tableEntry = table.find((e) => e.identifier === constIdNode.identifier);
131
+ if (!tableEntry) {
132
+ return {
133
+ convertible: false,
134
+ reasons: [
135
+ `Child ${i} references identifier[${constIdNode.identifier}] which is not in the table.`,
136
+ ],
137
+ };
138
+ }
139
+ if (tableEntry.b_submission !== false) {
140
+ return {
141
+ convertible: false,
142
+ reasons: [
143
+ `Child ${i} references identifier[${constIdNode.identifier}] with b_submission=${tableEntry.b_submission}. Conversion requires compile-time constants (b_submission=false).`,
144
+ ],
145
+ };
146
+ }
147
+ if (tableEntry.value === undefined || tableEntry.value === null) {
148
+ return {
149
+ convertible: false,
150
+ reasons: [
151
+ `Child ${i} references identifier[${constIdNode.identifier}] which has no 'value' field. Conversion requires explicit constant values.`,
152
+ ],
153
+ };
154
+ }
155
+ const nonConstSerial = JSON.stringify(nonConstNode);
156
+ if (sharedNodeSerial === null) {
157
+ sharedNodeSerial = nonConstSerial;
158
+ sharedNode = nonConstNode;
159
+ }
160
+ else if (sharedNodeSerial !== nonConstSerial) {
161
+ return {
162
+ convertible: false,
163
+ reasons: [
164
+ `Child ${i}'s non-constant side differs from child 0's. All children must share the SAME non-constant node (same query, same convert_witness, same parameters). Keep the logic_or.`,
165
+ ],
166
+ };
167
+ }
168
+ constants.push({
169
+ identifier: constIdNode.identifier,
170
+ value: tableEntry.value,
171
+ value_type: String(tableEntry.value_type ?? ''),
172
+ });
173
+ }
174
+ const valueTypes = new Set(constants.map((c) => c.value_type));
175
+ if (valueTypes.size > 1) {
176
+ return {
177
+ convertible: false,
178
+ reasons: [
179
+ `Constants have mixed value_types: [${Array.from(valueTypes).join(', ')}]. All constants must share the same type to form a single VecXxx.`,
180
+ ],
181
+ };
182
+ }
183
+ const sharedValueType = constants[0].value_type;
184
+ const mapping = mapOperatorToTarget(sharedOperator, sharedValueType);
185
+ if (!mapping) {
186
+ return {
187
+ convertible: false,
188
+ reasons: [
189
+ `No vec_contains_* variant maps to operator='${sharedOperator}' with value_type='${sharedValueType}'. ` +
190
+ `Mappable combinations: (logic_string_nocase_equal, String)→vec_contains_string_nocase; ` +
191
+ `(logic_equal, String)→vec_contains_string; (logic_equal, Address)→vec_contains_address; ` +
192
+ `(logic_equal, Bool)→vec_contains_bool; (logic_equal|logic_as_u256_equal, numeric)→vec_contains_number.`,
193
+ ],
194
+ };
195
+ }
196
+ return {
197
+ convertible: true,
198
+ targetOperator: mapping.target,
199
+ vectorValueType: mapping.vecType,
200
+ sharedNode: sharedNode ?? undefined,
201
+ constants,
202
+ };
203
+ }
204
+ export function buildShorthand(orNode, result, newIdentifier) {
205
+ if (!result.convertible || !result.targetOperator || !result.vectorValueType || !result.sharedNode || !result.constants) {
206
+ return null;
207
+ }
208
+ const values = result.constants.map((c) => c.value);
209
+ const removeIdentifiers = result.constants.map((c) => c.identifier);
210
+ const newRoot = {
211
+ type: result.targetOperator,
212
+ nodes: [
213
+ { type: 'identifier', identifier: newIdentifier },
214
+ result.sharedNode,
215
+ ],
216
+ };
217
+ return {
218
+ newRoot,
219
+ removeIdentifiers,
220
+ addEntry: {
221
+ identifier: newIdentifier,
222
+ b_submission: false,
223
+ value_type: result.vectorValueType,
224
+ value: values,
225
+ name: 'converted_constants',
226
+ },
227
+ };
228
+ }
@@ -1,3 +1,4 @@
1
+ import { MAX_SUBMISSION_SIZE_PASSPORT } from "@wowok/wowok";
1
2
  export function checkPuzzleCompleteness(puzzle) {
2
3
  const dimensions = {
3
4
  intent: isIntentComplete(puzzle.intent),
@@ -214,7 +215,7 @@ export function generateConfirmationText(puzzle) {
214
215
  ["R1", "Guard immutable=true to verify", puzzle.constraints.runtime_01_guard_immutable],
215
216
  ["R2", "submission type bytes match table declaration", puzzle.constraints.runtime_02_submission_type_match],
216
217
  ["R3", "b_submission=true entry found in submission", puzzle.constraints.runtime_03_submission_complete],
217
- ["R4", "submission total bytes ≤ 256", puzzle.constraints.runtime_04_submission_size],
218
+ ["R4", `submission total bytes ≤ ${MAX_SUBMISSION_SIZE_PASSPORT}`, puzzle.constraints.runtime_04_submission_size],
218
219
  ["R5", "witness derivation source object has related field", puzzle.constraints.runtime_05_witness_source_valid],
219
220
  ["R6", "query target object exists and types match", puzzle.constraints.runtime_06_query_object_valid],
220
221
  ];
@@ -604,7 +605,7 @@ function deriveConstraints(table, root, rely, collectors) {
604
605
  const runtime02 = true;
605
606
  const runtime03 = true;
606
607
  const submissionEntries = table.filter((t) => t.b_submission);
607
- const runtime04 = submissionEntries.length <= 256;
608
+ const runtime04 = submissionEntries.length <= MAX_SUBMISSION_SIZE_PASSPORT;
608
609
  const runtime05 = true;
609
610
  const runtime06 = true;
610
611
  return {
@@ -1,6 +1,6 @@
1
1
  import type { GuardScene } from "./guard-ledger.js";
2
2
  export type GuardStakeholder = "customer" | "provider" | "arbitrator" | "claimant" | "system";
3
- export type RiskLevel = "critical" | "high" | "medium" | "low" | "info";
3
+ export type RiskLevel = "critical" | "high" | "medium" | "low";
4
4
  export type DataSourceClass = "type1_onchain_constant" | "type2_witness_derived" | "type3_submitted_object" | "type4_system_context" | "cross_type";
5
5
  export type RiskCategory = "data_source_trust" | "submission_forgery" | "system_context_risk" | "game_theory" | "logic_gap" | "binding_risk" | "dependency_risk" | "impack_risk" | "rep_risk";
6
6
  export interface GuardRisk {
@@ -46,6 +46,7 @@ export interface RiskCheckContext {
46
46
  };
47
47
  scene?: GuardScene;
48
48
  operation_type?: string;
49
+ sharing_recipients?: ("Signer" | "Entity" | "GuardIdentifier")[];
49
50
  }
50
51
  export declare function assessGuardRisks(params: {
51
52
  table: RiskCheckContext["table"];
@@ -53,6 +54,7 @@ export declare function assessGuardRisks(params: {
53
54
  rely?: RiskCheckContext["rely"];
54
55
  scene?: GuardScene;
55
56
  operation_type?: string;
57
+ sharing_recipients?: RiskCheckContext["sharing_recipients"];
56
58
  }): GuardRiskAssessment;
57
59
  export declare function assessGuardRisksForOperation(operation_type: string, data: any): GuardRiskAssessment | null;
58
60
  export declare function getRiskSummary(assessment: GuardRiskAssessment): {