@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
@@ -6,8 +6,8 @@ const LEVEL_WEIGHT = {
6
6
  const BUILTIN_RISK_METRICS = [
7
7
  {
8
8
  metric_id: "funds_risk",
9
- display_name: "资金风险",
10
- description: "直接操作资金 / 影响资金流向 / 无资金风险",
9
+ display_name: "Funds Risk",
10
+ description: "Directly operates funds / affects fund flow / no fund risk",
11
11
  type: "risk",
12
12
  scale: "level",
13
13
  weight: 1.0,
@@ -15,8 +15,8 @@ const BUILTIN_RISK_METRICS = [
15
15
  },
16
16
  {
17
17
  metric_id: "trust_risk",
18
- display_name: "信任风险",
19
- description: "影响信任机制的程度",
18
+ display_name: "Trust Risk",
19
+ description: "Degree of impact on trust mechanism",
20
20
  type: "risk",
21
21
  scale: "level",
22
22
  weight: 1.0,
@@ -24,8 +24,8 @@ const BUILTIN_RISK_METRICS = [
24
24
  },
25
25
  {
26
26
  metric_id: "delivery_risk",
27
- display_name: "履约风险",
28
- description: "影响订单履约的程度",
27
+ display_name: "Delivery Risk",
28
+ description: "Degree of impact on order fulfillment",
29
29
  type: "risk",
30
30
  scale: "level",
31
31
  weight: 1.0,
@@ -33,8 +33,8 @@ const BUILTIN_RISK_METRICS = [
33
33
  },
34
34
  {
35
35
  metric_id: "compliance_risk",
36
- display_name: "合规风险",
37
- description: "涉及监管的程度",
36
+ display_name: "Compliance Risk",
37
+ description: "Degree of regulatory involvement",
38
38
  type: "risk",
39
39
  scale: "level",
40
40
  weight: 1.0,
@@ -44,8 +44,8 @@ const BUILTIN_RISK_METRICS = [
44
44
  const BUILTIN_BENEFIT_METRICS = [
45
45
  {
46
46
  metric_id: "automation_level",
47
- display_name: "自动化等级",
48
- description: "全自动 / 半自动 / 手动",
47
+ display_name: "Automation Level",
48
+ description: "Fully automated / semi-automated / manual",
49
49
  type: "benefit",
50
50
  scale: "level",
51
51
  weight: 1.0,
@@ -53,8 +53,8 @@ const BUILTIN_BENEFIT_METRICS = [
53
53
  },
54
54
  {
55
55
  metric_id: "trust_boost",
56
- display_name: "信任提升",
57
- description: "对信任机制的增强程度",
56
+ display_name: "Trust Boost",
57
+ description: "Degree of enhancement to trust mechanism",
58
58
  type: "benefit",
59
59
  scale: "level",
60
60
  weight: 1.0,
@@ -62,8 +62,8 @@ const BUILTIN_BENEFIT_METRICS = [
62
62
  },
63
63
  {
64
64
  metric_id: "efficiency_gain",
65
- display_name: "效率提升",
66
- description: "对效率的提升程度",
65
+ display_name: "Efficiency Gain",
66
+ description: "Degree of efficiency improvement",
67
67
  type: "benefit",
68
68
  scale: "level",
69
69
  weight: 1.0,
@@ -70,34 +70,34 @@ export class ModeEvaluator {
70
70
  feasibility_score = Math.max(0, Math.min(100, Math.round(feasibility_score)));
71
71
  const recommendations = [];
72
72
  if (benefit_delta > 0) {
73
- recommendations.push(`收益提升 ${benefit_delta.toFixed(1)} 分,迁移有正向价值`);
73
+ recommendations.push(`Benefit increased by ${benefit_delta.toFixed(1)} points, migration has positive value`);
74
74
  }
75
75
  else if (benefit_delta < 0) {
76
- recommendations.push(`收益下降 ${Math.abs(benefit_delta).toFixed(1)} 分,需评估迁移必要性`);
76
+ recommendations.push(`Benefit decreased by ${Math.abs(benefit_delta).toFixed(1)} points, need to evaluate migration necessity`);
77
77
  }
78
78
  if (risk_delta > 10) {
79
- recommendations.push(`风险增加 ${risk_delta.toFixed(1)} 分,建议加强风险控制措施`);
79
+ recommendations.push(`Risk increased by ${risk_delta.toFixed(1)} points, recommend strengthening risk control measures`);
80
80
  }
81
81
  else if (risk_delta < -10) {
82
- recommendations.push(`风险降低 ${Math.abs(risk_delta).toFixed(1)} 分,迁移有助于风险管控`);
82
+ recommendations.push(`Risk decreased by ${Math.abs(risk_delta).toFixed(1)} points, migration helps risk management`);
83
83
  }
84
84
  if (added_capabilities.length > 0) {
85
- recommendations.push(`新增 ${added_capabilities.length} 个能力,需要额外配置:${added_capabilities.slice(0, 3).join(", ")}`);
85
+ recommendations.push(`Added ${added_capabilities.length} capabilities, need extra configuration: ${added_capabilities.slice(0, 3).join(", ")}`);
86
86
  }
87
87
  if (removed_capabilities.length > 0) {
88
- recommendations.push(`移除 ${removed_capabilities.length} 个能力,相关功能将不可用`);
88
+ recommendations.push(`Removed ${removed_capabilities.length} capabilities, related features will be unavailable`);
89
89
  }
90
90
  if (conflicting_capabilities.length > 0) {
91
- recommendations.push(`检测到 ${conflicting_capabilities.length} 个能力冲突,必须解决后才能迁移`);
91
+ recommendations.push(`Detected ${conflicting_capabilities.length} capability conflicts, must be resolved before migration`);
92
92
  }
93
93
  if (feasibility_score >= 70) {
94
- recommendations.push("迁移可行性高,建议执行");
94
+ recommendations.push("Migration feasibility is high, recommend executing");
95
95
  }
96
96
  else if (feasibility_score >= 40) {
97
- recommendations.push("迁移可行性中等,需谨慎评估");
97
+ recommendations.push("Migration feasibility is medium, need careful evaluation");
98
98
  }
99
99
  else {
100
- recommendations.push("迁移可行性低,建议保持当前模式或寻找替代方案");
100
+ recommendations.push("Migration feasibility is low, recommend keeping the current mode or finding an alternative");
101
101
  }
102
102
  return {
103
103
  feasibility_score,
@@ -142,13 +142,13 @@ export class ModeEvaluator {
142
142
  generateRecommendations(mode, risk_score, benefit_score, capability_conflicts, violated_constraints, unmet_conditions) {
143
143
  const recs = [];
144
144
  if (capability_conflicts.length > 0) {
145
- recs.push(`检测到 ${capability_conflicts.length} 个能力冲突,必须解决后才能应用模式`);
145
+ recs.push(`Detected ${capability_conflicts.length} capability conflicts, must be resolved before applying the mode`);
146
146
  }
147
147
  if (violated_constraints.length > 0) {
148
- recs.push(`检测到 ${violated_constraints.length} 个硬约束违规,需要补充缺失的能力或调整模式配置`);
148
+ recs.push(`Detected ${violated_constraints.length} hard constraint violations, need to supplement missing capabilities or adjust mode configuration`);
149
149
  }
150
150
  if (unmet_conditions.length > 0) {
151
- recs.push(`检测到 ${unmet_conditions.length} 个软约束未满足,建议调整以提升模式质量`);
151
+ recs.push(`Detected ${unmet_conditions.length} soft constraints not met, recommend adjusting to improve mode quality`);
152
152
  }
153
153
  const appetiteThresholds = {
154
154
  conservative: { max_risk: 30, min_benefit: 50 },
@@ -157,13 +157,13 @@ export class ModeEvaluator {
157
157
  };
158
158
  const threshold = appetiteThresholds[mode.risk_appetite];
159
159
  if (risk_score > threshold.max_risk) {
160
- recs.push(`风险评分 ${risk_score} 超过 ${mode.risk_appetite} 模式阈值 ${threshold.max_risk},建议降低风险或调整风险偏好`);
160
+ recs.push(`Risk score ${risk_score} exceeds ${mode.risk_appetite} mode threshold ${threshold.max_risk}, recommend reducing risk or adjusting risk appetite`);
161
161
  }
162
162
  if (benefit_score < threshold.min_benefit) {
163
- recs.push(`收益评分 ${benefit_score} 低于 ${mode.risk_appetite} 模式阈值 ${threshold.min_benefit},建议增加收益能力或调整风险偏好`);
163
+ recs.push(`Benefit score ${benefit_score} below ${mode.risk_appetite} mode threshold ${threshold.min_benefit}, recommend adding benefit capabilities or adjusting risk appetite`);
164
164
  }
165
165
  if (recs.length === 0) {
166
- recs.push(`模式评估通过:风险 ${risk_score} / 收益 ${benefit_score} / 风险-收益比 ${(benefit_score / Math.max(risk_score, 1)).toFixed(2)}`);
166
+ recs.push(`Mode evaluation passed: risk ${risk_score} / benefit ${benefit_score} / risk-benefit ratio ${(benefit_score / Math.max(risk_score, 1)).toFixed(2)}`);
167
167
  }
168
168
  return recs;
169
169
  }
@@ -25,9 +25,9 @@ const GENERAL_FLYWHEEL = {
25
25
  const GENERAL_MACHINE_SHAPE = [
26
26
  { name: "paid", role: "Entry: order created and paid" },
27
27
  { name: "delivering", role: "Service delivery in progress" },
28
+ { name: "delivered", role: "Deliverable available for review" },
28
29
  { name: "completed", role: "Service completed, funds released" },
29
- { name: "refunded", role: "Customer refund path" },
30
- { name: "cancelled", role: "Pre-delivery cancellation" },
30
+ { name: "cancelled", role: "Pre-delivery cancellation — triggers refund Allocator" },
31
31
  ];
32
32
  const GENERAL_ALLOCATOR = {
33
33
  recipient: "signer",
@@ -41,8 +41,8 @@ const RETAIL_MACHINE_SHAPE = [
41
41
  { name: "delivered", role: "Goods delivered to buyer" },
42
42
  { name: "confirmed", role: "Buyer confirms receipt" },
43
43
  { name: "completed", role: "Funds released to merchant" },
44
- { name: "refunded", role: "Return & refund path" },
45
- { name: "cancelled", role: "Pre-ship cancellation" },
44
+ { name: "returned", role: "Buyer ships goods back — triggers refund Allocator (R-M1-11 compliant)" },
45
+ { name: "cancelled", role: "Pre-ship cancellation — triggers refund Allocator" },
46
46
  ];
47
47
  const RETAIL_GUARDS = [
48
48
  { template_id: "buy_guard_inventory", host: "service", purpose: "Verify inventory and buyer address on purchase" },
@@ -64,19 +64,47 @@ const RETAIL_BUILD_NOTES = [
64
64
  "Refund path must support return-and-exchange flow",
65
65
  "Compensation fund covers return/exchange disputes",
66
66
  ];
67
+ const RETAIL_D2C_MACHINE_SHAPE = [
68
+ { name: "ordered", role: "Entry: order created (funds escrowed in Allocation)" },
69
+ { name: "shipped", role: "Merchant ships goods" },
70
+ { name: "delivered", role: "Goods delivered to buyer" },
71
+ { name: "completed", role: "Buyer confirms receipt — withdraw_guard releases funds" },
72
+ { name: "cancelled", role: "Pre-ship cancellation — refund_guard refunds buyer" },
73
+ ];
74
+ const RETAIL_D2C_GUARDS = [
75
+ { template_id: "withdraw_guard_delivery", host: "service", purpose: "Release funds to merchant + processor on order completion (delivery confirmation)" },
76
+ { template_id: "refund_guard_cancellation", host: "service", purpose: "Refund 100% to buyer on order cancellation" },
77
+ ];
78
+ const RETAIL_D2C_ALLOCATOR = {
79
+ recipient: "entity",
80
+ count: 2,
81
+ mode: "rate",
82
+ description: "Merchant 97% + Processor 3% (rate-based split, no platform commission)",
83
+ };
84
+ const RETAIL_D2C_KEY_RISK = "No platform arbitration — disputes rely on optional Arbitration or off-chain chargeback";
85
+ const RETAIL_D2C_BUILD_NOTES = [
86
+ "Allocation escrow replaces platform custody — funds locked in contract until Guard releases",
87
+ "withdraw_guard enforces delivery gate — merchant must reach 'completed' state to receive payment",
88
+ "refund_guard ensures 100% refund on cancellation — no merchant approval needed",
89
+ "No buy_guard needed — D2C doesn't gate purchases (open storefront)",
90
+ "Arbitration is optional — add when dispute volume justifies the cost",
91
+ "Service ↔ Guard circular dependency: create Service (unpublished) → create Guards → update Service (publish)",
92
+ ];
67
93
  const SUPPORTED_INDUSTRY_SET = new Set([
68
- "freelance", "rental", "education", "travel", "subscription", "retail",
94
+ "freelance", "rental", "education", "travel", "subscription", "retail", "retail_d2c",
69
95
  ]);
70
96
  function fetchTemplate(name) {
71
- const traits = getIndustryTraits(name) ?? GENERAL_TRAITS;
97
+ const traitsLookupName = name === "retail_d2c" ? "retail" : name;
98
+ const traits = getIndustryTraits(traitsLookupName) ?? GENERAL_TRAITS;
72
99
  const isSupported = SUPPORTED_INDUSTRY_SET.has(name);
100
+ const industryLookupName = name === "retail_d2c" ? "retail" : name;
73
101
  const risk_checks = isSupported
74
- ? getIndustryRiskChecks(name)
102
+ ? getIndustryRiskChecks(industryLookupName)
75
103
  : [];
76
104
  const needs = isSupported
77
- ? getIndustryNeeds(name)
105
+ ? getIndustryNeeds(industryLookupName)
78
106
  : [];
79
- const flywheel = getFlywheelForIndustry(name) ?? GENERAL_FLYWHEEL;
107
+ const flywheel = getFlywheelForIndustry(traitsLookupName) ?? GENERAL_FLYWHEEL;
80
108
  let machine_shape;
81
109
  let guards;
82
110
  let allocator;
@@ -89,6 +117,13 @@ function fetchTemplate(name) {
89
117
  key_risk = RETAIL_KEY_RISK;
90
118
  build_notes = RETAIL_BUILD_NOTES;
91
119
  }
120
+ else if (name === "retail_d2c") {
121
+ machine_shape = RETAIL_D2C_MACHINE_SHAPE;
122
+ guards = RETAIL_D2C_GUARDS;
123
+ allocator = RETAIL_D2C_ALLOCATOR;
124
+ key_risk = RETAIL_D2C_KEY_RISK;
125
+ build_notes = RETAIL_D2C_BUILD_NOTES;
126
+ }
92
127
  else if (name === "general") {
93
128
  const sm = getScenarioMode("general");
94
129
  machine_shape = GENERAL_MACHINE_SHAPE;
@@ -113,7 +148,7 @@ function fetchTemplate(name) {
113
148
  export const BUILTIN_MODES = [
114
149
  {
115
150
  name: "freelance",
116
- display_name: "Freelance 自由职业",
151
+ display_name: "Freelance",
117
152
  version: "v1",
118
153
  source: "builtin",
119
154
  ...fetchTemplate("freelance"),
@@ -131,28 +166,32 @@ export const BUILTIN_MODES = [
131
166
  machine: { wip_required: true, wip_hash_algorithm: "sha256", acceptance_gate: true },
132
167
  },
133
168
  expected_benefits: [
134
- { metric: "纠纷率降低", expected_value: "40%", evidence: "WIP 哈希 + 里程碑分账强制交付证据" },
135
- { metric: "交付确认效率", expected_value: "提升 50%", evidence: "acceptance gate 自动化验收" },
136
- { metric: "提供方回款保障", expected_value: "100%", evidence: "accepted 节点后资金自动释放给提供方" },
169
+ { metric: "Dispute rate reduction", expected_value: "40%", evidence: "WIP hash + milestone allocation enforces delivery evidence" },
170
+ { metric: "Delivery confirmation efficiency", expected_value: "+50%", evidence: "acceptance gate automates acceptance workflow" },
171
+ { metric: "Provider payment assurance", expected_value: "100%", evidence: "Funds auto-release to provider after accepted node" },
137
172
  ],
138
173
  risk_appetite: "balanced",
139
174
  risk_constraints: {
140
175
  require_arbitration: true,
141
176
  require_compensation_fund: false,
142
177
  require_wip_evidence: true,
143
- other_constraints: ["setting_locked_time ≥ 7d 以锁定合作期规则"],
178
+ other_constraints: [
179
+ "setting_locked_time >= 7d to lock engagement-period rules",
180
+ "ISSUE-P1-4: 48h auto-accept requires off-chain keeper (WoWok Guard does not support time-based triggers). Deploy a keeper service that polls Progress objects in 'delivered' state and calls adminUnhold (permission 224) after 48h timeout. See keeper template in docs.",
181
+ ],
144
182
  },
145
183
  applicable_conditions: {
146
184
  business_scale: "small",
147
185
  min_daily_orders: 1,
148
- other_conditions: ["适合中长期项目交付", "需里程碑分阶段验收"],
186
+ other_conditions: ["Suitable for mid-to-long-term project delivery", "Requires milestone-based phased acceptance"],
149
187
  },
150
188
  similar_industries: ["rental", "education"],
151
189
  novel_capabilities: ["allocation.distribute_milestone"],
190
+ disabled_builtin_constraints: ["require_compensation_fund"],
152
191
  },
153
192
  {
154
193
  name: "rental",
155
- display_name: "Rental 租赁",
194
+ display_name: "Rental",
156
195
  version: "v1",
157
196
  source: "builtin",
158
197
  ...fetchTemplate("rental"),
@@ -170,9 +209,9 @@ export const BUILTIN_MODES = [
170
209
  machine: { wip_required: true, wip_stages: ["handover_out", "returned"], inspection_gate: true },
171
210
  },
172
211
  expected_benefits: [
173
- { metric: "押金纠纷率", expected_value: "降低 60%", evidence: "pre-rental WIP 强制记录物品原始状态" },
174
- { metric: "损坏定责准确率", expected_value: "提升 70%", evidence: "前后 WIP 哈希对比,杜绝无据扣款" },
175
- { metric: "信任评分", expected_value: "提升 25%", evidence: "compensation_fund 覆盖损坏风险" },
212
+ { metric: "Deposit dispute rate", expected_value: "-60%", evidence: "pre-rental WIP mandatorily records item's original state" },
213
+ { metric: "Damage liability accuracy", expected_value: "+70%", evidence: "pre/post WIP hash comparison eliminates unfounded deductions" },
214
+ { metric: "Trust score", expected_value: "+25%", evidence: "compensation_fund covers damage risk" },
176
215
  ],
177
216
  risk_appetite: "conservative",
178
217
  risk_constraints: {
@@ -180,19 +219,20 @@ export const BUILTIN_MODES = [
180
219
  require_compensation_fund: true,
181
220
  require_wip_evidence: true,
182
221
  max_single_transaction: 10000,
183
- other_constraints: ["押金必须 escrow 托管(不可直转)", "lock_duration ≥ 7d 防止商家随意提取"],
222
+ compensation_fund_coverage_ratio: 10,
223
+ other_constraints: ["Deposit must be escrowed (no direct transfer)", "lock_duration >= 7d to prevent arbitrary merchant withdrawal"],
184
224
  },
185
225
  applicable_conditions: {
186
226
  business_scale: "small",
187
227
  min_daily_orders: 1,
188
- other_conditions: ["需物理物品交接", "有物流或线下交付环节"],
228
+ other_conditions: ["Requires physical item handover", "Has logistics or offline delivery leg"],
189
229
  },
190
230
  similar_industries: ["retail", "travel"],
191
231
  novel_capabilities: [],
192
232
  },
193
233
  {
194
234
  name: "education",
195
- display_name: "Education 教育",
235
+ display_name: "Education",
196
236
  version: "v1",
197
237
  source: "builtin",
198
238
  ...fetchTemplate("education"),
@@ -218,28 +258,29 @@ export const BUILTIN_MODES = [
218
258
  service: { setting_locked_time: "120d", anti_runaway: true },
219
259
  },
220
260
  expected_benefits: [
221
- { metric: "退费纠纷率", expected_value: "降低 50%", evidence: "per-session release 按课时释放学费" },
222
- { metric: "机构跑路风险", expected_value: "消除", evidence: "资金按课时释放,未交付部分可退" },
223
- { metric: "出勤可追溯", expected_value: "100%", evidence: "attendance_guard 每课时签名" },
261
+ { metric: "Refund dispute rate", expected_value: "-50%", evidence: "per-session release distributes tuition by class" },
262
+ { metric: "Institution runaway risk", expected_value: "eliminated", evidence: "Funds release per session; undelivered portion is refundable" },
263
+ { metric: "Attendance traceability", expected_value: "100%", evidence: "attendance_guard signs each session" },
224
264
  ],
225
265
  risk_appetite: "conservative",
226
266
  risk_constraints: {
227
267
  require_arbitration: true,
228
268
  require_compensation_fund: true,
229
269
  require_wip_evidence: false,
230
- other_constraints: ["setting_locked_time 覆盖整个学期(≥90d)", "长周期需关注 >90d 进度"],
270
+ other_constraints: ["setting_locked_time covers the entire term (>=90d)", "Long-cycle projects must monitor >90d progress"],
231
271
  },
232
272
  applicable_conditions: {
233
273
  business_scale: "medium",
234
274
  min_daily_orders: 1,
235
- other_conditions: ["长周期交付", "需分课时验收", "监管强度 medium"],
275
+ other_conditions: ["Long-cycle delivery", "Requires per-session acceptance", "Regulatory intensity: medium"],
236
276
  },
237
277
  similar_industries: ["freelance", "subscription"],
238
278
  novel_capabilities: ["allocation.distribute_milestone"],
279
+ disabled_builtin_constraints: ["require_wip_evidence"],
239
280
  },
240
281
  {
241
282
  name: "travel",
242
- display_name: "Travel 旅游",
283
+ display_name: "Travel",
243
284
  version: "v1",
244
285
  source: "builtin",
245
286
  ...fetchTemplate("travel"),
@@ -266,28 +307,28 @@ export const BUILTIN_MODES = [
266
307
  service: { supply_chain_suborders: true, segment_guard_required: true },
267
308
  },
268
309
  expected_benefits: [
269
- { metric: "资金透明度", expected_value: "100%", evidence: "multi-tier allocation 按段分账至酒店/导游/司机" },
270
- { metric: "行程变更纠纷", expected_value: "降低 45%", evidence: "segment WIP 每段验收" },
271
- { metric: "违约赔付保障", expected_value: "提升 60%", evidence: "compensation_fund 覆盖行程违约" },
310
+ { metric: "Fund transparency", expected_value: "100%", evidence: "multi-tier allocation splits per segment to hotel/guide/driver" },
311
+ { metric: "Itinerary change disputes", expected_value: "-45%", evidence: "segment WIP accepts each leg" },
312
+ { metric: "Breach compensation assurance", expected_value: "+60%", evidence: "compensation_fund covers itinerary breach" },
272
313
  ],
273
314
  risk_appetite: "balanced",
274
315
  risk_constraints: {
275
316
  require_arbitration: true,
276
317
  require_compensation_fund: true,
277
318
  require_wip_evidence: true,
278
- other_constraints: ["多级分账需 guard chaining 校验", "deposit 20% + final 80% 两段付款"],
319
+ other_constraints: ["Multi-tier allocation requires guard chaining validation", "deposit 20% + final 80% two-stage payment"],
279
320
  },
280
321
  applicable_conditions: {
281
322
  business_scale: "medium",
282
323
  min_daily_orders: 1,
283
- other_conditions: ["多段行程组合", "需酒店/导游/司机多方分账"],
324
+ other_conditions: ["Multi-segment itinerary combination", "Requires hotel/guide/driver multi-party allocation"],
284
325
  },
285
326
  similar_industries: ["rental", "education"],
286
327
  novel_capabilities: [],
287
328
  },
288
329
  {
289
330
  name: "subscription",
290
- display_name: "Subscription 订阅",
331
+ display_name: "Subscription",
291
332
  version: "v1",
292
333
  source: "builtin",
293
334
  ...fetchTemplate("subscription"),
@@ -310,28 +351,30 @@ export const BUILTIN_MODES = [
310
351
  service: { creator_data_subscription: true, periodic_billing: true },
311
352
  },
312
353
  expected_benefits: [
313
- { metric: "续费率", expected_value: "提升 25%", evidence: "loyalty reward + 透明订阅机制" },
314
- { metric: "退订纠纷", expected_value: "消除", evidence: "cancel anytime + no auto-renew trap" },
315
- { metric: "创作者留存", expected_value: "提升 30%", evidence: "deliver_guard_wip 防止内容断更" },
354
+ { metric: "Renewal rate", expected_value: "+25%", evidence: "loyalty reward + transparent subscription mechanism" },
355
+ { metric: "Cancellation disputes", expected_value: "eliminated", evidence: "cancel anytime + no auto-renew trap" },
356
+ { metric: "Creator retention", expected_value: "+30%", evidence: "deliver_guard_wip prevents content dropout" },
316
357
  ],
317
358
  risk_appetite: "aggressive",
318
359
  risk_constraints: {
319
360
  require_arbitration: false,
320
361
  require_compensation_fund: false,
321
362
  require_wip_evidence: false,
322
- other_constraints: ["禁止 dead-end 节点(防止锁定)", "charge_guard 每期需用户确认"],
363
+ compensation_fund_coverage_ratio: 3,
364
+ other_constraints: ["Forbid dead-end nodes (prevent lock-in)", "charge_guard requires user confirmation each period"],
323
365
  },
324
366
  applicable_conditions: {
325
367
  business_scale: "small",
326
368
  min_daily_orders: 5,
327
- other_conditions: ["纯数字交付", "周期性内容或 SaaS 服务"],
369
+ other_conditions: ["Pure-digital delivery", "Periodic content or SaaS service"],
328
370
  },
329
371
  similar_industries: ["freelance", "education"],
330
372
  novel_capabilities: [],
373
+ disabled_builtin_constraints: ["require_arbitration", "require_compensation_fund", "require_wip_evidence"],
331
374
  },
332
375
  {
333
376
  name: "retail",
334
- display_name: "Retail 零售",
377
+ display_name: "Retail",
335
378
  version: "v1",
336
379
  source: "builtin",
337
380
  ...fetchTemplate("retail"),
@@ -354,28 +397,76 @@ export const BUILTIN_MODES = [
354
397
  service: { logistics_mode: "standard", first_order_discount: true },
355
398
  },
356
399
  expected_benefits: [
357
- { metric: "退货纠纷率", expected_value: "降低 35%", evidence: "logistics WIP + refund path 保障" },
358
- { metric: "复购率", expected_value: "提升 20%", evidence: "spend cashback reward" },
359
- { metric: "商品真实性可追溯", expected_value: "100%", evidence: "WIP 验证商品/物流信息" },
400
+ { metric: "Return dispute rate", expected_value: "-35%", evidence: "logistics WIP + refund path assurance" },
401
+ { metric: "Repurchase rate", expected_value: "+20%", evidence: "spend cashback reward" },
402
+ { metric: "Product authenticity traceability", expected_value: "100%", evidence: "WIP verifies product/logistics info" },
360
403
  ],
361
404
  risk_appetite: "conservative",
362
405
  risk_constraints: {
363
406
  require_arbitration: true,
364
407
  require_compensation_fund: true,
365
408
  require_wip_evidence: false,
366
- other_constraints: ["refund_window ≥ 7d", "confirm_gate 仅买家可确认收货"],
409
+ compensation_fund_coverage_ratio: 5,
410
+ other_constraints: ["refund_window >= 7d", "confirm_gate: only buyer can confirm receipt"],
367
411
  },
368
412
  applicable_conditions: {
369
413
  business_scale: "medium",
370
414
  min_daily_orders: 10,
371
- other_conditions: ["有物流发货环节", "高频小额交易"],
415
+ other_conditions: ["Has logistics shipping leg", "High-frequency small-ticket transactions"],
372
416
  },
373
417
  similar_industries: ["rental", "subscription"],
374
418
  novel_capabilities: [],
419
+ disabled_builtin_constraints: ["require_wip_evidence"],
420
+ },
421
+ {
422
+ name: "retail_d2c",
423
+ display_name: "Retail D2C (Direct-to-Consumer)",
424
+ version: "v1",
425
+ source: "builtin",
426
+ ...fetchTemplate("retail_d2c"),
427
+ capabilities_used: [
428
+ "permission.index_create", "permission.role_assign",
429
+ "guard.validate_withdraw", "guard.validate_refund",
430
+ "machine.node_topology",
431
+ "allocation.distribute",
432
+ "service.publish", "progress.advance",
433
+ "contact.im_create",
434
+ ],
435
+ config_overrides: {
436
+ machine: {
437
+ wip_required: false,
438
+ confirm_gate: true,
439
+ refund_requires_approval: false,
440
+ },
441
+ service: { logistics_mode: "merchant_managed", multi_recipient_allocation: true },
442
+ },
443
+ expected_benefits: [
444
+ { metric: "Merchant revenue share", expected_value: "97%", evidence: "No platform commission — only 3% processing fee" },
445
+ { metric: "Fund safety", expected_value: "contract-grade", evidence: "Allocation escrow + Guard verification replaces platform custody" },
446
+ { metric: "Delivery reliability", expected_value: "high", evidence: "withdraw_guard enforces delivery confirmation before payment" },
447
+ ],
448
+ risk_appetite: "balanced",
449
+ risk_constraints: {
450
+ require_arbitration: false,
451
+ require_compensation_fund: false,
452
+ require_wip_evidence: false,
453
+ other_constraints: [
454
+ "Allocation escrow required (withdraw_guard + refund_guard)",
455
+ "Service ↔ Guard circular dependency requires 3-step creation pattern",
456
+ ],
457
+ },
458
+ applicable_conditions: {
459
+ business_scale: "small",
460
+ min_daily_orders: 1,
461
+ other_conditions: ["Independent storefront (no marketplace)", "Merchant-managed logistics", "Allocation escrow model"],
462
+ },
463
+ similar_industries: ["retail", "subscription"],
464
+ novel_capabilities: ["Allocation escrow as platform-custody alternative", "Multi-recipient allocation (merchant + processor)"],
465
+ disabled_builtin_constraints: ["require_arbitration", "require_compensation_fund", "require_wip_evidence"],
375
466
  },
376
467
  {
377
468
  name: "general",
378
- display_name: "General 通用",
469
+ display_name: "General",
379
470
  version: "v1",
380
471
  source: "builtin",
381
472
  ...fetchTemplate("general"),
@@ -388,8 +479,8 @@ export const BUILTIN_MODES = [
388
479
  "progress.advance",
389
480
  ],
390
481
  expected_benefits: [
391
- { metric: "灵活性", expected_value: "100%", evidence: "用户自定义所有信任机制参数" },
392
- { metric: "降级安全", expected_value: "可用", evidence: "任意时刻可切换至 general 兜底" },
482
+ { metric: "Flexibility", expected_value: "100%", evidence: "User customizes all trust mechanism parameters" },
483
+ { metric: "Degraded safety", expected_value: "usable", evidence: "Can fall back to general at any time" },
393
484
  ],
394
485
  risk_appetite: "balanced",
395
486
  risk_constraints: {
@@ -399,9 +490,10 @@ export const BUILTIN_MODES = [
399
490
  },
400
491
  applicable_conditions: {
401
492
  business_scale: "small",
402
- other_conditions: ["降级兜底模式", "未被其他行业覆盖的混合场景"],
493
+ other_conditions: ["Fallback degraded mode", "Hybrid scenarios not covered by other industries"],
403
494
  },
404
495
  similar_industries: [],
405
496
  novel_capabilities: [],
497
+ disabled_builtin_constraints: ["require_arbitration", "require_compensation_fund", "require_wip_evidence"],
406
498
  },
407
499
  ];
@@ -6,6 +6,8 @@ export declare class IndustryModeRegistry {
6
6
  private aliases;
7
7
  private evaluator;
8
8
  private initialized;
9
+ private persistence;
10
+ private userModesLoaded;
9
11
  static Instance(): IndustryModeRegistry;
10
12
  private constructor();
11
13
  registerMode(mode: IndustryMode, aliases?: string[]): boolean;
@@ -15,16 +17,19 @@ export declare class IndustryModeRegistry {
15
17
  hasMode(name: string): boolean;
16
18
  evaluateMode(name: string, intent: string, context: ProjectContext): ModeEvaluation;
17
19
  evaluateMigration(sourceName: string, targetName: string): ModeMigrationEvaluation;
18
- registerUserMode(mode: UserDefinedMode, userId: string): boolean;
19
- deriveMode(sourceMode: string, modifications: Partial<UserDefinedMode>, userId: string, newName: string, newDisplayName?: string): UserDefinedMode | undefined;
20
- evolveMode(modeName: string, updates: Partial<UserDefinedMode>, userId: string, changeDescription: string, bumpVersion?: boolean): UserDefinedMode | undefined;
21
- listUserModes(userId: string): UserDefinedMode[];
22
- getUserMode(modeName: string, userId: string): UserDefinedMode | undefined;
23
- unregisterUserMode(modeName: string, userId: string): boolean;
20
+ registerUserMode(mode: UserDefinedMode, userId: string): Promise<boolean>;
21
+ deriveMode(sourceMode: string, modifications: Partial<UserDefinedMode>, userId: string, newName: string, newDisplayName?: string): Promise<UserDefinedMode | undefined>;
22
+ evolveMode(modeName: string, updates: Partial<UserDefinedMode>, userId: string, changeDescription: string, bumpVersion?: boolean): Promise<UserDefinedMode | undefined>;
23
+ listUserModes(userId: string): Promise<UserDefinedMode[]>;
24
+ getUserMode(modeName: string, userId: string): Promise<UserDefinedMode | undefined>;
25
+ unregisterUserMode(modeName: string, userId: string): Promise<boolean>;
24
26
  private userModeKey;
27
+ private ensureUserModesLoaded;
28
+ private persistUserMode;
29
+ private unpersistUserMode;
25
30
  private bumpPatchVersion;
26
- applyTemplate(name: string, intent: string, context: ProjectContext): Blueprint;
27
- applyUserMode(modeName: string, userId: string, intent: string, context: ProjectContext): Blueprint;
31
+ applyTemplate(name: string, intent: string, context: ProjectContext): Promise<Blueprint>;
32
+ applyUserMode(modeName: string, userId: string, intent: string, context: ProjectContext): Promise<Blueprint>;
28
33
  private doApplyTemplate;
29
34
  validateBlueprint(objects: BlueprintObject[], edges: BlueprintEdge[], mode: IndustryMode): {
30
35
  errors: string[];
@@ -41,8 +46,10 @@ export declare class IndustryModeRegistry {
41
46
  private buildSteps;
42
47
  private defaultScenarios;
43
48
  private recordCapabilitiesUsed;
49
+ private deriveGuardShortName;
50
+ private getFirstServiceGuardName;
44
51
  private makeObject;
45
52
  private registerBuiltinModes;
46
53
  }
47
54
  export declare function getIndustryModeRegistry(): IndustryModeRegistry;
48
- export declare const INDUSTRY_MODE_REGISTRY_VERSION = 2.1;
55
+ export declare const INDUSTRY_MODE_REGISTRY_VERSION = 2.2;