@wowok/agent-mcp 2.6.1 → 2.6.4

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 (246) hide show
  1. package/dist/customer/customer-advice.d.ts +31 -0
  2. package/dist/customer/customer-advice.js +129 -0
  3. package/dist/customer/index.d.ts +2 -0
  4. package/dist/customer/index.js +2 -0
  5. package/dist/customer/info-puzzle.d.ts +9 -2
  6. package/dist/customer/info-puzzle.js +34 -7
  7. package/dist/customer/order-monitor.d.ts +2 -0
  8. package/dist/customer/order-monitor.js +3 -2
  9. package/dist/customer/post-purchase.d.ts +2 -0
  10. package/dist/customer/post-purchase.js +6 -5
  11. package/dist/customer/preorder-compare.d.ts +24 -0
  12. package/dist/customer/preorder-compare.js +34 -0
  13. package/dist/customer/reminder-system.d.ts +2 -0
  14. package/dist/customer/reminder-system.js +2 -1
  15. package/dist/customer/risk-assessment.js +30 -7
  16. package/dist/customer/types.d.ts +7 -0
  17. package/dist/examples/arbitration-dispute-create.json +41 -0
  18. package/dist/examples/arbitration-vote-weighted.json +35 -0
  19. package/dist/examples/arbitration-voting-guard-add.json +38 -0
  20. package/dist/examples/demand-present-service.json +33 -0
  21. package/dist/examples/gen-passport-verify-guard.json +48 -0
  22. package/dist/examples/guard-template-balance-check.json +59 -0
  23. package/dist/examples/guard-template-time-lock.json +60 -0
  24. package/dist/examples/insurance-guard-claim-timelock.json +75 -0
  25. package/dist/examples/insurance-guard-withdraw-allocation.json +96 -0
  26. package/dist/examples/insurance-machine-create-publish.json +75 -0
  27. package/dist/examples/insurance-service-allocators-publish.json +56 -0
  28. package/dist/examples/machine-multisig-threshold.json +86 -0
  29. package/dist/examples/machine-template-7node-rental.json +119 -0
  30. package/dist/examples/payment-scenario-bound.json +45 -0
  31. package/dist/examples/rental-ziroom-machine-create.json +149 -0
  32. package/dist/examples/rental-ziroom-permission-create.json +42 -0
  33. package/dist/examples/rental-ziroom-service-create.json +89 -0
  34. package/dist/examples/retail-adv-guard-customer-win-create.json +80 -0
  35. package/dist/examples/retail-adv-guard-messenger-proof-create.json +65 -0
  36. package/dist/examples/retail-adv-guard-reward-timeout-create.json +92 -0
  37. package/dist/examples/retail-adv-reward-guard-add.json +51 -0
  38. package/dist/examples/retail-myshop-allocation-activate.json +55 -0
  39. package/dist/examples/retail-myshop-arbitration-create.json +40 -0
  40. package/dist/examples/retail-myshop-contact-create.json +43 -0
  41. package/dist/examples/retail-myshop-order-create.json +56 -0
  42. package/dist/examples/retail-myshop-progress-operate.json +38 -0
  43. package/dist/examples/retail-myshop-reward-create.json +35 -0
  44. package/dist/examples/retail-myshop-service-create.json +88 -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 +216 -29
  61. package/dist/extensions/constraint-registry.js +21 -19
  62. package/dist/extensions/metric-registry.js +14 -14
  63. package/dist/extensions/mode-evaluator.js +16 -16
  64. package/dist/extensions/modes.js +141 -49
  65. package/dist/extensions/registry.d.ts +16 -9
  66. package/dist/extensions/registry.js +132 -44
  67. package/dist/extensions/types.d.ts +2 -0
  68. package/dist/index.js +50 -0
  69. package/dist/knowledge/deployment-scanner.js +1 -1
  70. package/dist/knowledge/fund-layer.d.ts +138 -0
  71. package/dist/knowledge/fund-layer.js +969 -0
  72. package/dist/knowledge/guard-render.d.ts +57 -0
  73. package/dist/knowledge/guard-render.js +700 -0
  74. package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
  75. package/dist/knowledge/guard-submission-prompt.js +171 -0
  76. package/dist/knowledge/guard-templates.d.ts +10 -0
  77. package/dist/knowledge/guard-templates.js +50 -0
  78. package/dist/knowledge/index.d.ts +2 -2
  79. package/dist/knowledge/index.js +2 -2
  80. package/dist/knowledge/machine-ledger.js +1 -1
  81. package/dist/knowledge/machine-render.d.ts +41 -0
  82. package/dist/knowledge/machine-render.js +565 -0
  83. package/dist/knowledge/machine-risk.js +4 -1
  84. package/dist/knowledge/machine-templates.js +4 -4
  85. package/dist/knowledge/progress-context.js +1 -1
  86. package/dist/knowledge/progress-ledger.js +3 -3
  87. package/dist/knowledge/progress-templates.js +1 -1
  88. package/dist/knowledge/progress-translation.js +1 -1
  89. package/dist/knowledge/reward-confirm.js +2 -2
  90. package/dist/knowledge/reward-puzzle.js +1 -1
  91. package/dist/knowledge/reward-risk.js +9 -9
  92. package/dist/knowledge/reward-templates.js +2 -2
  93. package/dist/knowledge/safety-rules.d.ts +83 -1
  94. package/dist/knowledge/safety-rules.js +166 -2
  95. package/dist/knowledge/scenario-modes.d.ts +1 -1
  96. package/dist/knowledge/scenario-modes.js +13 -11
  97. package/dist/knowledge/service-confirm.d.ts +1 -1
  98. package/dist/knowledge/service-confirm.js +3 -3
  99. package/dist/knowledge/service-context.js +1 -1
  100. package/dist/knowledge/service-ledger.js +1 -1
  101. package/dist/knowledge/service-risk.d.ts +1 -1
  102. package/dist/knowledge/service-risk.js +3 -3
  103. package/dist/knowledge/service-templates.js +2 -2
  104. package/dist/knowledge/service-translation.d.ts +1 -1
  105. package/dist/knowledge/service-translation.js +7 -7
  106. package/dist/knowledge/template-registry.d.ts +48 -0
  107. package/dist/knowledge/template-registry.js +341 -0
  108. package/dist/knowledge/tool-constraints.js +6 -6
  109. package/dist/knowledge/tools-reference.js +11 -8
  110. package/dist/participation/merchant-interest.d.ts +32 -0
  111. package/dist/participation/merchant-interest.js +100 -0
  112. package/dist/participation/radar-core.d.ts +104 -0
  113. package/dist/participation/radar-core.js +269 -0
  114. package/dist/project/context-assembly.js +8 -0
  115. package/dist/project/deployment-bridge.js +6 -5
  116. package/dist/project/deployment-doc.js +5 -5
  117. package/dist/project/edit-planner.d.ts +123 -0
  118. package/dist/project/edit-planner.js +1342 -0
  119. package/dist/project/evaluation.d.ts +36 -0
  120. package/dist/project/evaluation.js +734 -68
  121. package/dist/project/game-theory.d.ts +43 -0
  122. package/dist/project/game-theory.js +177 -0
  123. package/dist/project/graph-builder.js +7 -1
  124. package/dist/project/handlers.d.ts +137 -2
  125. package/dist/project/handlers.js +423 -51
  126. package/dist/project/intent-analyzer.d.ts +71 -0
  127. package/dist/project/intent-analyzer.js +149 -0
  128. package/dist/project/machine-nodes.d.ts +2 -0
  129. package/dist/project/machine-nodes.js +36 -0
  130. package/dist/project/merchant-guide.d.ts +165 -0
  131. package/dist/project/merchant-guide.js +264 -0
  132. package/dist/project/mode-actions.d.ts +199 -0
  133. package/dist/project/mode-actions.js +309 -0
  134. package/dist/project/participation-radar.d.ts +18 -0
  135. package/dist/project/participation-radar.js +428 -0
  136. package/dist/project/pipeline-actions.d.ts +101 -0
  137. package/dist/project/pipeline-actions.js +109 -0
  138. package/dist/project/semantic-graph.d.ts +95 -0
  139. package/dist/project/semantic-graph.js +245 -0
  140. package/dist/project/stage-gate.js +4 -4
  141. package/dist/schema/call/allocation.d.ts +11 -11
  142. package/dist/schema/call/allocation.js +13 -3
  143. package/dist/schema/call/arbitration.d.ts +21 -21
  144. package/dist/schema/call/arbitration.js +30 -9
  145. package/dist/schema/call/base.d.ts +2 -2
  146. package/dist/schema/call/base.js +1 -1
  147. package/dist/schema/call/bridge.d.ts +127 -127
  148. package/dist/schema/call/bridge.js +12 -12
  149. package/dist/schema/call/contact.d.ts +3 -3
  150. package/dist/schema/call/contact.js +2 -2
  151. package/dist/schema/call/demand.d.ts +3 -3
  152. package/dist/schema/call/demand.js +2 -2
  153. package/dist/schema/call/guard.d.ts +11 -11
  154. package/dist/schema/call/guard.js +2 -2
  155. package/dist/schema/call/machine.d.ts +2072 -679
  156. package/dist/schema/call/machine.js +51 -5
  157. package/dist/schema/call/order.d.ts +7 -7
  158. package/dist/schema/call/order.js +3 -6
  159. package/dist/schema/call/payment.d.ts +3 -3
  160. package/dist/schema/call/permission.d.ts +3 -3
  161. package/dist/schema/call/permission.js +2 -2
  162. package/dist/schema/call/personal.d.ts +337 -3
  163. package/dist/schema/call/personal.js +10 -0
  164. package/dist/schema/call/progress.d.ts +177 -9
  165. package/dist/schema/call/progress.js +7 -3
  166. package/dist/schema/call/proof.d.ts +6 -6
  167. package/dist/schema/call/repository.d.ts +3 -3
  168. package/dist/schema/call/repository.js +2 -2
  169. package/dist/schema/call/reward.d.ts +57 -57
  170. package/dist/schema/call/reward.js +3 -3
  171. package/dist/schema/call/semantic.js +48 -2
  172. package/dist/schema/call/service.d.ts +285 -113
  173. package/dist/schema/call/service.js +92 -28
  174. package/dist/schema/call/treasury.d.ts +57 -57
  175. package/dist/schema/call/treasury.js +3 -3
  176. package/dist/schema/common/index.d.ts +2 -0
  177. package/dist/schema/common/index.js +46 -10
  178. package/dist/schema/local/index.js +5 -1
  179. package/dist/schema/messenger/index.js +4 -1
  180. package/dist/schema/operations.d.ts +1318 -317
  181. package/dist/schema/operations.js +76 -7
  182. package/dist/schema/project/index.d.ts +5662 -164
  183. package/dist/schema/project/index.js +1136 -5
  184. package/dist/schema/query/index.d.ts +580 -19
  185. package/dist/schema/query/index.js +88 -36
  186. package/dist/schema/schema-query/index.d.ts +59 -3
  187. package/dist/schema/schema-query/index.js +45 -6
  188. package/dist/schema/trust/index.d.ts +1012 -6
  189. package/dist/schema/trust/index.js +212 -11
  190. package/dist/schema/utils/node-parser.js +13 -0
  191. package/dist/schema/utils/object-type-utils.d.ts +12 -0
  192. package/dist/schema/utils/object-type-utils.js +35 -0
  193. package/dist/schema/utils/permission-machine-check.d.ts +49 -0
  194. package/dist/schema/utils/permission-machine-check.js +121 -0
  195. package/dist/schema/utils/skills-recommendation.d.ts +2 -0
  196. package/dist/schema/utils/skills-recommendation.js +77 -0
  197. package/dist/schema-query/index.d.ts +17 -1
  198. package/dist/schema-query/index.js +359 -3
  199. package/dist/schemas/account_operation.schema.json +1 -1
  200. package/dist/schemas/bridge_operation.schema.json +14 -7
  201. package/dist/schemas/guard2file.schema.json +2 -0
  202. package/dist/schemas/index.json +1 -1
  203. package/dist/schemas/machineNode2file.schema.json +2 -0
  204. package/dist/schemas/messenger_operation.schema.json +1 -1
  205. package/dist/schemas/onchain_events.output.json +1 -1
  206. package/dist/schemas/onchain_operations.output.json +2820 -0
  207. package/dist/schemas/onchain_operations.schema.json +255 -65
  208. package/dist/schemas/onchain_operations_allocation.schema.json +7 -6
  209. package/dist/schemas/onchain_operations_arbitration.schema.json +14 -10
  210. package/dist/schemas/onchain_operations_contact.schema.json +4 -3
  211. package/dist/schemas/onchain_operations_demand.schema.json +4 -3
  212. package/dist/schemas/onchain_operations_gen_passport.schema.json +4 -2
  213. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -0
  214. package/dist/schemas/onchain_operations_guard.schema.json +579 -1
  215. package/dist/schemas/onchain_operations_machine.schema.json +5 -4
  216. package/dist/schemas/onchain_operations_order.schema.json +7 -6
  217. package/dist/schemas/onchain_operations_payment.schema.json +2 -1
  218. package/dist/schemas/onchain_operations_permission.schema.json +3 -2
  219. package/dist/schemas/onchain_operations_personal.schema.json +37 -0
  220. package/dist/schemas/onchain_operations_progress.schema.json +91 -4
  221. package/dist/schemas/onchain_operations_proof.schema.json +2 -1
  222. package/dist/schemas/onchain_operations_repository.schema.json +4 -3
  223. package/dist/schemas/onchain_operations_reward.schema.json +7 -6
  224. package/dist/schemas/onchain_operations_service.schema.json +80 -19
  225. package/dist/schemas/onchain_operations_treasury.schema.json +5 -4
  226. package/dist/schemas/onchain_table_data.output.json +1 -1
  227. package/dist/schemas/onchain_table_data.schema.json +10 -9
  228. package/dist/schemas/project_operation.output.json +3318 -57
  229. package/dist/schemas/project_operation.schema.json +728 -4
  230. package/dist/schemas/query_toolkit.output.json +16 -16
  231. package/dist/schemas/query_toolkit.schema.json +40 -3
  232. package/dist/schemas/schema_query.output.json +65 -2
  233. package/dist/schemas/schema_query.schema.json +31 -5
  234. package/dist/schemas/trust_score.output.json +392 -1
  235. package/dist/schemas/trust_score.schema.json +275 -1
  236. package/dist/schemas/wowok_buildin_info.output.json +81 -8
  237. package/dist/schemas/wowok_buildin_info.schema.json +46 -2
  238. package/dist/tools/handlers/onchain.js +636 -6
  239. package/dist/tools/handlers/project.js +71 -2
  240. package/dist/tools/handlers/query.js +117 -2
  241. package/dist/tools/handlers/schema-query.js +65 -1
  242. package/dist/tools/handlers/trust.js +192 -6
  243. package/dist/tools/index.d.ts +8 -0
  244. package/dist/tools/index.js +229 -15
  245. package/dist/tools/wrap.js +194 -15
  246. package/package.json +2 -2
@@ -0,0 +1,43 @@
1
+ import type { SemanticObjectGraph } from "./semantic-graph.js";
2
+ import type { BusinessIntent } from "./intent-analyzer.js";
3
+ import type { BusinessModuleId } from "../extensions/business-modules.js";
4
+ export type GameScenario = "merchant_may_deliver_late" | "merchant_may_abandon" | "customer_may_deny_acceptance" | "customer_may_false_claim" | "supplier_may_not_deliver";
5
+ export interface GameTheoryConstraint {
6
+ scenario: GameScenario;
7
+ conflict: string;
8
+ userProtection: {
9
+ mechanism: string;
10
+ object: string;
11
+ guard?: string;
12
+ };
13
+ merchantConstraint: {
14
+ requiredDeposit?: boolean;
15
+ requiredArbitration?: boolean;
16
+ requiredProof?: string;
17
+ timeoutPenalty?: string;
18
+ };
19
+ evaluationMetric: string;
20
+ mitigationSignals: string[][];
21
+ mitigatingModules: BusinessModuleId[];
22
+ recommendation: string;
23
+ }
24
+ export interface GameTheoryCheckResult {
25
+ scenario: GameScenario;
26
+ conflict: string;
27
+ covered: boolean;
28
+ matchedSignals: string[];
29
+ partialSignals: string[];
30
+ userProtection: string;
31
+ evaluationMetric: string;
32
+ recommendation?: string;
33
+ }
34
+ export interface GameTheoryReport {
35
+ results: GameTheoryCheckResult[];
36
+ coveredCount: number;
37
+ totalCount: number;
38
+ exposedScenarios: GameScenario[];
39
+ wowAlignments: string[];
40
+ summary: string;
41
+ }
42
+ export declare const GAME_THEORY_CONSTRAINTS: GameTheoryConstraint[];
43
+ export declare function checkGameTheoryConstraints(graph: SemanticObjectGraph, intent: BusinessIntent): GameTheoryReport;
@@ -0,0 +1,177 @@
1
+ export const GAME_THEORY_CONSTRAINTS = [
2
+ {
3
+ scenario: "merchant_may_deliver_late",
4
+ conflict: "Merchant incentive: collect payment fast, deliver at own pace (or never). User bears schedule risk with no leverage once funds leave their wallet.",
5
+ userProtection: {
6
+ mechanism: "Milestone escrow — funds locked in Order, released per verified milestone",
7
+ object: "Order + Allocation",
8
+ guard: "milestone forward guard verifies deliverable before release",
9
+ },
10
+ merchantConstraint: {
11
+ requiredDeposit: true,
12
+ timeoutPenalty: "compensation_fund covers refund for unstarted milestones",
13
+ },
14
+ evaluationMetric: "timeout_protection",
15
+ mitigationSignals: [
16
+ ["edge:has_order_allocators", "node:main_machine"],
17
+ ["module:milestone_escrow"],
18
+ ],
19
+ mitigatingModules: ["milestone_escrow", "refund_guarantee"],
20
+ recommendation: "Adopt milestone_escrow module: bind order_allocators + Machine so funds release only per verified milestone. Add compensation_fund for late-delivery refunds.",
21
+ },
22
+ {
23
+ scenario: "merchant_may_abandon",
24
+ conflict: "Merchant incentive: maximize intake then abandon the service (exit scam). User has no recourse without locked funds or deposit.",
25
+ userProtection: {
26
+ mechanism: "Escrow + compensation fund — user refunds from on-chain fund even if merchant vanishes",
27
+ object: "Service.compensation_fund + Order",
28
+ guard: "refund_guard validates claim conditions",
29
+ },
30
+ merchantConstraint: {
31
+ requiredDeposit: true,
32
+ requiredArbitration: true,
33
+ },
34
+ evaluationMetric: "escrow_quality",
35
+ mitigationSignals: [
36
+ ["edge:has_order_allocators", "module:refund_guarantee"],
37
+ ["module:refund_guarantee", "node:main_arbitration"],
38
+ ],
39
+ mitigatingModules: ["refund_guarantee", "milestone_escrow", "reputation_on_chain"],
40
+ recommendation: "Adopt refund_guarantee module: compensation_fund_add > 0 with refund_guard. Escrow via order_allocators prevents merchant from touching funds before delivery.",
41
+ },
42
+ {
43
+ scenario: "customer_may_deny_acceptance",
44
+ conflict: "Customer incentive: withhold acceptance confirmation to delay payment indefinitely while using the deliverable. Merchant's funds stay locked.",
45
+ userProtection: {
46
+ mechanism: "Accept timeout — after N days without response, order auto-advances (adminUnhold) and merchant gets paid",
47
+ object: "Machine forward + Progress",
48
+ guard: "time_guard on accept forward",
49
+ },
50
+ merchantConstraint: {
51
+ timeoutPenalty: "user silence past timeout = implicit acceptance",
52
+ },
53
+ evaluationMetric: "timeout_protection",
54
+ mitigationSignals: [
55
+ ["module:accept_timeout_protection"],
56
+ ["node:guard_accept_timeout_protection"],
57
+ ],
58
+ mitigatingModules: ["accept_timeout_protection"],
59
+ recommendation: "Adopt accept_timeout_protection module: time_guard on the accept forward (e.g. 7 days) + PROGRESS_UNHOLD permission so the workflow auto-advances on customer silence.",
60
+ },
61
+ {
62
+ scenario: "customer_may_false_claim",
63
+ conflict: "Customer incentive: claim non-delivery or defect to obtain refund while keeping the goods/service. Merchant loses both deliverable and payment.",
64
+ userProtection: {
65
+ mechanism: "WIP provenance — delivery hash committed on-chain before/at delivery; independent arbitration verifies evidence",
66
+ object: "Repository + Arbitration",
67
+ guard: "Guard compares proof.signer/proof.time against committed WIP hash",
68
+ },
69
+ merchantConstraint: {
70
+ requiredProof: "wip_hash committed to Repository before fund release",
71
+ requiredArbitration: true,
72
+ },
73
+ evaluationMetric: "proof_integrity",
74
+ mitigationSignals: [
75
+ ["node:main_repository", "node:main_arbitration"],
76
+ ["module:wip_provenance", "node:main_arbitration"],
77
+ ],
78
+ mitigatingModules: ["wip_provenance", "independent_arbitration", "damage_attestation"],
79
+ recommendation: "Adopt wip_provenance + independent_arbitration modules: Repository stores WIP hashes as tamper-proof delivery evidence; Arbitration (independent Permission) resolves false claims against on-chain proof.",
80
+ },
81
+ {
82
+ scenario: "supplier_may_not_deliver",
83
+ conflict: "Supplier incentive: accept sub-order payment terms then under-deliver, leaving the merchant liable to the end customer. Multi-party opacity hides the failure point.",
84
+ userProtection: {
85
+ mechanism: "Supplier visibility — Demand + sub-order flow with multi-tier Allocation; each tier paid only on its own verified delivery",
86
+ object: "Demand + Allocation (multi-tier)",
87
+ guard: "per-tier release guard",
88
+ },
89
+ merchantConstraint: {
90
+ requiredProof: "sub-delivery proof per Allocation tier",
91
+ },
92
+ evaluationMetric: "supplier_visibility",
93
+ mitigationSignals: [
94
+ ["module:supplier_collaboration"],
95
+ ["module:multi_tier_allocation"],
96
+ ],
97
+ mitigatingModules: ["supplier_collaboration", "multi_tier_allocation"],
98
+ recommendation: "Adopt supplier_collaboration module: publish Demand referencing the main Service, split Allocation across tiers so each supplier is paid only for verified sub-delivery.",
99
+ },
100
+ ];
101
+ function evalSignal(token, graph, intent) {
102
+ const [kind, value] = token.split(":", 2);
103
+ switch (kind) {
104
+ case "node":
105
+ return graph.nodes.some((n) => n.id === value);
106
+ case "edge":
107
+ return graph.edges.some((e) => e.relation === value);
108
+ case "module":
109
+ return graph.adoptedModules.includes(value);
110
+ case "type":
111
+ return graph.nodes.some((n) => n.type === value);
112
+ case "trust": {
113
+ const v = intent.trust;
114
+ return v[value] === true || (typeof v[value] === "string" && v[value] !== "none");
115
+ }
116
+ default:
117
+ return false;
118
+ }
119
+ }
120
+ export function checkGameTheoryConstraints(graph, intent) {
121
+ const results = [];
122
+ for (const c of GAME_THEORY_CONSTRAINTS) {
123
+ let matched = null;
124
+ let bestPartial = [];
125
+ let bestPartialScore = -1;
126
+ for (const group of c.mitigationSignals) {
127
+ const hits = group.filter((s) => evalSignal(s, graph, intent));
128
+ if (hits.length === group.length) {
129
+ matched = group;
130
+ break;
131
+ }
132
+ const score = hits.length / group.length;
133
+ if (hits.length > 0 && score > bestPartialScore) {
134
+ bestPartialScore = score;
135
+ bestPartial = hits;
136
+ }
137
+ }
138
+ results.push({
139
+ scenario: c.scenario,
140
+ conflict: c.conflict,
141
+ covered: matched !== null,
142
+ matchedSignals: matched ?? [],
143
+ partialSignals: matched ? [] : bestPartial,
144
+ userProtection: `${c.userProtection.mechanism} (${c.userProtection.object}${c.userProtection.guard ? `, guard: ${c.userProtection.guard}` : ""})`,
145
+ evaluationMetric: c.evaluationMetric,
146
+ recommendation: matched ? undefined : c.recommendation,
147
+ });
148
+ }
149
+ const covered = results.filter((r) => r.covered);
150
+ const exposed = results.filter((r) => !r.covered);
151
+ const wowAlignments = [];
152
+ if (graph.edges.some((e) => e.relation === "has_order_allocators")) {
153
+ wowAlignments.push("Milestone escrow: funds locked in Order, released per verified milestone — merchant paid for delivery, user pays for value");
154
+ }
155
+ if (graph.adoptedModules.includes("accept_timeout_protection")) {
156
+ wowAlignments.push("Accept timeout: customer silence past N days = implicit acceptance — merchant protected from payment stalling");
157
+ }
158
+ if (graph.nodes.some((n) => n.id === "main_repository")) {
159
+ wowAlignments.push("WIP provenance: delivery hash on-chain — false claims verifiable against tamper-proof evidence");
160
+ }
161
+ if (graph.nodes.some((n) => n.id === "main_arbitration")) {
162
+ wowAlignments.push("Micro-arbitration: Guard-weighted voting with independent Permission — low-cost dispute resolution without platform fees");
163
+ }
164
+ if (graph.adoptedModules.includes("reputation_on_chain")) {
165
+ wowAlignments.push("On-chain reputation: both sides' behavior permanently recorded — future transactions price the risk");
166
+ }
167
+ return {
168
+ results,
169
+ coveredCount: covered.length,
170
+ totalCount: results.length,
171
+ exposedScenarios: exposed.map((r) => r.scenario),
172
+ wowAlignments,
173
+ summary: exposed.length === 0
174
+ ? `All ${results.length} adversarial scenarios have on-chain mitigations.`
175
+ : `${exposed.length}/${results.length} adversarial scenarios EXPOSED: ${exposed.map((r) => r.scenario).join(", ")}. Apply the recommendations to align incentives.`,
176
+ };
177
+ }
@@ -9,7 +9,12 @@ function shortTypeName(objectType) {
9
9
  }
10
10
  function extractAddressFields(obj) {
11
11
  const refs = [];
12
- const objType = obj.type;
12
+ const rawType = obj.type;
13
+ let objType = rawType;
14
+ if (rawType && rawType.includes("::")) {
15
+ const parts = rawType.split("::");
16
+ objType = parts[parts.length - 1];
17
+ }
13
18
  const isAddress = (v) => typeof v === "string" && v.startsWith("0x") && v.length >= 10;
14
19
  const addRef = (addr, field, refType) => {
15
20
  if (isAddress(addr) && addr !== "0x0" && addr !== obj.object) {
@@ -254,6 +259,7 @@ const EXPECTED_RELATIONSHIPS = new Map([
254
259
  ["Demand", [
255
260
  { targetType: "Guard", fieldName: "guard", relationshipType: "validate" },
256
261
  { targetType: "Reward", fieldName: "rewards", relationshipType: "trigger" },
262
+ { targetType: "Permission", fieldName: "permission", relationshipType: "validate", single: true },
257
263
  { targetType: "Contact", fieldName: "um", relationshipType: "bind", single: true },
258
264
  ]],
259
265
  ["Treasury", [
@@ -1,5 +1,5 @@
1
1
  import type { z } from "zod";
2
- import { type ProjectObject, type EvaluationType } from "@wowok/wowok";
2
+ import { type ProjectObject, type ObjectRole, type EvaluationType } from "@wowok/wowok";
3
3
  import type { ProjectOperationInputSchema } from "../schema/project/index.js";
4
4
  type ProjectInput = z.infer<typeof ProjectOperationInputSchema>;
5
5
  export declare function handleListProjects(v: ProjectInput): Promise<{
@@ -30,6 +30,7 @@ export declare function handleCreateProject(v: ProjectInput): Promise<{
30
30
  action: "create_project";
31
31
  project: import("@wowok/wowok").Project;
32
32
  blueprint: {
33
+ industry_mismatch_hint?: string | undefined;
33
34
  objects_count: number;
34
35
  edges_count: number;
35
36
  industry_source: string;
@@ -37,6 +38,15 @@ export declare function handleCreateProject(v: ProjectInput): Promise<{
37
38
  steps_count: number;
38
39
  scenarios_count: number;
39
40
  key_risk: string | undefined;
41
+ intent_inference: {
42
+ traits: import("../knowledge/industry-registry.js").IndustryTraits;
43
+ confidence: number;
44
+ matched_keywords: string[];
45
+ top_matches: {
46
+ industry: string;
47
+ similarity: number;
48
+ }[];
49
+ };
40
50
  };
41
51
  recommended_creation_order: {
42
52
  step: number;
@@ -47,6 +57,7 @@ export declare function handleCreateProject(v: ProjectInput): Promise<{
47
57
  blueprint_warning?: undefined;
48
58
  blueprint_skipped?: undefined;
49
59
  hint?: undefined;
60
+ recommended_industries?: undefined;
50
61
  } | {
51
62
  action: "create_project";
52
63
  project: import("@wowok/wowok").Project;
@@ -60,6 +71,7 @@ export declare function handleCreateProject(v: ProjectInput): Promise<{
60
71
  blueprint?: undefined;
61
72
  blueprint_skipped?: undefined;
62
73
  hint?: undefined;
74
+ recommended_industries?: undefined;
63
75
  } | {
64
76
  action: "create_project";
65
77
  project: import("@wowok/wowok").Project;
@@ -73,6 +85,31 @@ export declare function handleCreateProject(v: ProjectInput): Promise<{
73
85
  }[];
74
86
  blueprint?: undefined;
75
87
  blueprint_warning?: undefined;
88
+ recommended_industries?: undefined;
89
+ } | {
90
+ action: "create_project";
91
+ project: import("@wowok/wowok").Project;
92
+ recommended_creation_order: {
93
+ step: number;
94
+ object: string;
95
+ reason: string;
96
+ required: boolean;
97
+ }[];
98
+ recommended_industries: {
99
+ industry: string;
100
+ similarity: number;
101
+ matched_traits: string[];
102
+ reference_examples: {
103
+ file: string;
104
+ title: string;
105
+ operation_type: string;
106
+ verified: boolean;
107
+ }[];
108
+ }[];
109
+ hint: string;
110
+ blueprint?: undefined;
111
+ blueprint_warning?: undefined;
112
+ blueprint_skipped?: undefined;
76
113
  } | {
77
114
  action: "create_project";
78
115
  project: import("@wowok/wowok").Project;
@@ -86,6 +123,7 @@ export declare function handleCreateProject(v: ProjectInput): Promise<{
86
123
  blueprint_warning?: undefined;
87
124
  blueprint_skipped?: undefined;
88
125
  hint?: undefined;
126
+ recommended_industries?: undefined;
89
127
  }>;
90
128
  export declare function handleCreateProjectFromOnchain(v: ProjectInput): Promise<{
91
129
  action: "create_project_from_onchain";
@@ -100,14 +138,31 @@ export declare function handleUpdateProject(v: ProjectInput): Promise<{
100
138
  export declare function handleGetProjectDetail(v: ProjectInput): Promise<{
101
139
  action: "get_project_detail";
102
140
  project: import("@wowok/wowok").Project;
103
- objects: ProjectObject[];
141
+ objects: {
142
+ isDraft: boolean;
143
+ id: string;
144
+ projectId: string;
145
+ objectAddress: string;
146
+ objectType: string | null;
147
+ objectName: string | null;
148
+ role: ObjectRole;
149
+ tags: string[] | null;
150
+ addedAt: number;
151
+ metadata: Record<string, unknown> | null;
152
+ }[];
153
+ objectCount: number;
154
+ onchainCount: number;
155
+ draftCount: number;
104
156
  objectGroups: {
105
157
  core: ProjectObject[];
106
158
  dependency: ProjectObject[];
107
159
  reference: ProjectObject[];
108
160
  other: ProjectObject[];
161
+ draft: ProjectObject[];
109
162
  stats: {
110
163
  total: number;
164
+ onchain_count: number;
165
+ draft_count: number;
111
166
  core_count: number;
112
167
  dependency_count: number;
113
168
  reference_count: number;
@@ -212,6 +267,8 @@ export declare function handleEvaluateProject(v: ProjectInput): Promise<{
212
267
  needsLlm: boolean;
213
268
  llmPrompt: string | undefined;
214
269
  evaluationId: string;
270
+ refreshWarning: string | undefined;
271
+ graphFallbackWarning: string | undefined;
215
272
  }>;
216
273
  export declare function handleSaveEvaluation(v: ProjectInput): Promise<{
217
274
  action: "save_evaluation";
@@ -248,6 +305,67 @@ export declare function handleCloneProjectToNetwork(v: ProjectInput): Promise<{
248
305
  message: string;
249
306
  next_steps: string;
250
307
  }>;
308
+ export declare function handleMigrateToMainnet(v: ProjectInput): Promise<{
309
+ action: "migrate_to_mainnet";
310
+ migration_status: string;
311
+ source_project: {
312
+ prefix: string;
313
+ network: string;
314
+ preserved: boolean;
315
+ };
316
+ target_project: {
317
+ prefix: string;
318
+ project_id: string;
319
+ network: string;
320
+ cloned_objects_count: number;
321
+ };
322
+ key_principle: string;
323
+ migration_plan: ({
324
+ step: number;
325
+ status: string;
326
+ action: string;
327
+ description: string;
328
+ result: string;
329
+ deployment_plan?: undefined;
330
+ critical_note?: undefined;
331
+ names_to_register?: undefined;
332
+ } | {
333
+ step: number;
334
+ status: string;
335
+ action: string;
336
+ description: string;
337
+ deployment_plan: {
338
+ order: number;
339
+ object_type: string;
340
+ object_name: string;
341
+ operation_type: string;
342
+ localmark_name: string;
343
+ note: string;
344
+ }[];
345
+ critical_note: string;
346
+ result?: undefined;
347
+ names_to_register?: undefined;
348
+ } | {
349
+ step: number;
350
+ status: string;
351
+ action: string;
352
+ description: string;
353
+ names_to_register: string[];
354
+ result?: undefined;
355
+ deployment_plan?: undefined;
356
+ critical_note?: undefined;
357
+ } | {
358
+ step: number;
359
+ status: string;
360
+ action: string;
361
+ description: string;
362
+ result?: undefined;
363
+ deployment_plan?: undefined;
364
+ critical_note?: undefined;
365
+ names_to_register?: undefined;
366
+ })[];
367
+ summary: string;
368
+ }>;
251
369
  export declare function handleGetObjectDiff(v: ProjectInput): Promise<{
252
370
  action: "get_object_diff";
253
371
  address: string;
@@ -284,6 +402,23 @@ export declare function handleGetMachineGraph(v: ProjectInput): Promise<{
284
402
  }[];
285
403
  published: boolean | null;
286
404
  paused: boolean | null;
405
+ mermaid: string;
406
+ tree_outline: string;
407
+ ascii_art: string;
408
+ markmap: string;
409
+ }>;
410
+ export declare function handleGetGuardGraph(v: ProjectInput): Promise<{
411
+ action: "get_guard_graph";
412
+ guardAddress: string;
413
+ guardName: string | null;
414
+ root: any;
415
+ table: any[];
416
+ rely: any;
417
+ immutable: any;
418
+ mermaid: string;
419
+ tree_outline: string;
420
+ ascii_art: string;
421
+ markmap: string;
287
422
  }>;
288
423
  export declare function handlePreEvaluateCheck(v: ProjectInput): Promise<{
289
424
  action: "pre_evaluate_check";