@wowok/agent-mcp 2.7.1 → 2.7.2

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 (375) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/customer-advice.js +1 -130
  4. package/dist/customer/index.js +1 -11
  5. package/dist/customer/industry-risks.js +1 -438
  6. package/dist/customer/info-puzzle.js +1 -681
  7. package/dist/customer/order-monitor.js +1 -328
  8. package/dist/customer/order-strategy.js +1 -373
  9. package/dist/customer/post-purchase.js +1 -351
  10. package/dist/customer/preorder-compare.js +1 -34
  11. package/dist/customer/reminder-system.js +1 -316
  12. package/dist/customer/risk-assessment.js +1 -397
  13. package/dist/customer/types.js +1 -13
  14. package/dist/customer/user-preferences.js +1 -460
  15. package/dist/evaluation/arbitration-game.d.ts +9 -2
  16. package/dist/evaluation/arbitration-game.js +1 -48
  17. package/dist/evaluation/builtins/demand-match.js +1 -153
  18. package/dist/evaluation/builtins/index.js +1 -10
  19. package/dist/evaluation/builtins/service-risk.js +1 -55
  20. package/dist/evaluation/capability.js +1 -13
  21. package/dist/evaluation/composer.js +1 -40
  22. package/dist/evaluation/engine.js +1 -175
  23. package/dist/evaluation/extract.js +1 -115
  24. package/dist/evaluation/game-strategy.d.ts +27 -0
  25. package/dist/evaluation/game-strategy.js +1 -0
  26. package/dist/evaluation/gap.js +1 -100
  27. package/dist/evaluation/index.d.ts +1 -0
  28. package/dist/evaluation/index.js +1 -11
  29. package/dist/evaluation/node-game.d.ts +31 -3
  30. package/dist/evaluation/node-game.js +1 -57
  31. package/dist/evaluation/region.js +1 -36
  32. package/dist/evaluation/types.d.ts +1 -0
  33. package/dist/evaluation/types.js +1 -1
  34. package/dist/evaluation/user-injection.js +1 -27
  35. package/dist/experience/experience-reuse.js +1 -103
  36. package/dist/experience/index.js +1 -5
  37. package/dist/experience/intent-distill.js +1 -83
  38. package/dist/experience/realtime-feedback.js +1 -94
  39. package/dist/experience/types.js +1 -1
  40. package/dist/experience/user-profile.js +1 -171
  41. package/dist/extensions/business-modules.js +1 -287
  42. package/dist/extensions/capability-manifest.js +1 -781
  43. package/dist/extensions/constraint-registry.js +1 -198
  44. package/dist/extensions/index.js +1 -6
  45. package/dist/extensions/metric-registry.js +1 -257
  46. package/dist/extensions/mode-evaluator.js +1 -170
  47. package/dist/extensions/modes.js +1 -499
  48. package/dist/extensions/registry.js +1 -717
  49. package/dist/extensions/types.js +1 -1
  50. package/dist/harness/auto-escalation.js +1 -68
  51. package/dist/harness/checkpoint.js +1 -129
  52. package/dist/harness/index.js +1 -78
  53. package/dist/harness/plan.js +1 -315
  54. package/dist/harness/recover.js +1 -139
  55. package/dist/harness/types.js +1 -1
  56. package/dist/harness/verify.js +1 -237
  57. package/dist/index.js +1 -273
  58. package/dist/intent/enrich.js +1 -67
  59. package/dist/intent/index.js +1 -60
  60. package/dist/intent/matcher.js +1 -81
  61. package/dist/intent/store.js +1 -55
  62. package/dist/intent/types.js +1 -10
  63. package/dist/knowledge/acquisition-flywheel.js +1 -192
  64. package/dist/knowledge/allocation-confirm.js +1 -534
  65. package/dist/knowledge/allocation-context.js +1 -249
  66. package/dist/knowledge/allocation-ledger.js +1 -463
  67. package/dist/knowledge/allocation-puzzle.js +1 -298
  68. package/dist/knowledge/allocation-risk.js +1 -568
  69. package/dist/knowledge/allocation-templates.js +1 -970
  70. package/dist/knowledge/allocation-translation.js +1 -585
  71. package/dist/knowledge/arb-risk.js +1 -210
  72. package/dist/knowledge/arbitration-confirm.js +1 -559
  73. package/dist/knowledge/arbitration-context.js +1 -505
  74. package/dist/knowledge/arbitration-ledger.js +1 -521
  75. package/dist/knowledge/arbitration-puzzle.js +1 -304
  76. package/dist/knowledge/arbitration-risk.js +1 -423
  77. package/dist/knowledge/arbitration-templates.js +1 -276
  78. package/dist/knowledge/arbitration-translation.js +1 -487
  79. package/dist/knowledge/arbitration-trust.js +1 -117
  80. package/dist/knowledge/audit-rules.js +1 -141
  81. package/dist/knowledge/bridge-risk.js +1 -263
  82. package/dist/knowledge/contact-risk.js +1 -200
  83. package/dist/knowledge/contact-templates.js +1 -60
  84. package/dist/knowledge/demand-confirm.js +1 -206
  85. package/dist/knowledge/demand-matching.js +1 -132
  86. package/dist/knowledge/demand-risk.js +1 -240
  87. package/dist/knowledge/demand-translation.js +1 -354
  88. package/dist/knowledge/deployment-scanner.js +1 -823
  89. package/dist/knowledge/dynamic-pricing.js +1 -87
  90. package/dist/knowledge/examples-scanner-cli.js +1 -26
  91. package/dist/knowledge/examples-scanner.js +1 -843
  92. package/dist/knowledge/flywheel-loop.js +1 -404
  93. package/dist/knowledge/fund-layer.js +1 -973
  94. package/dist/knowledge/glossary.js +1 -211
  95. package/dist/knowledge/guard-confirm.js +1 -406
  96. package/dist/knowledge/guard-context.js +1 -287
  97. package/dist/knowledge/guard-design-patterns.js +1 -360
  98. package/dist/knowledge/guard-ledger.js +1 -260
  99. package/dist/knowledge/guard-lint.js +1 -670
  100. package/dist/knowledge/guard-migration.js +1 -228
  101. package/dist/knowledge/guard-puzzle.js +1 -805
  102. package/dist/knowledge/guard-render.js +1 -700
  103. package/dist/knowledge/guard-risk.js +1 -1879
  104. package/dist/knowledge/guard-submission-prompt.js +1 -171
  105. package/dist/knowledge/guard-templates.js +1 -1105
  106. package/dist/knowledge/guard-translation.js +1 -1119
  107. package/dist/knowledge/index.js +1 -436
  108. package/dist/knowledge/industry-evolution.js +1 -323
  109. package/dist/knowledge/industry-generalizer.js +1 -381
  110. package/dist/knowledge/industry-registry.js +1 -174
  111. package/dist/knowledge/intent-metrics.d.ts +4 -3
  112. package/dist/knowledge/intent-metrics.js +1 -566
  113. package/dist/knowledge/machine-confirm.js +1 -559
  114. package/dist/knowledge/machine-context.js +1 -833
  115. package/dist/knowledge/machine-ledger.js +1 -338
  116. package/dist/knowledge/machine-puzzle.js +1 -494
  117. package/dist/knowledge/machine-render.js +1 -565
  118. package/dist/knowledge/machine-risk.js +1 -669
  119. package/dist/knowledge/machine-templates.js +1 -1597
  120. package/dist/knowledge/machine-topology.js +1 -234
  121. package/dist/knowledge/machine-translation.js +1 -513
  122. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  123. package/dist/knowledge/mcp-schema-audit.js +1 -777
  124. package/dist/knowledge/onchain-constants.js +1 -35
  125. package/dist/knowledge/order-confirm.js +1 -573
  126. package/dist/knowledge/order-context.js +1 -390
  127. package/dist/knowledge/order-ledger.js +1 -341
  128. package/dist/knowledge/order-puzzle.js +1 -255
  129. package/dist/knowledge/order-risk.js +1 -653
  130. package/dist/knowledge/order-templates.js +1 -368
  131. package/dist/knowledge/order-translation.js +1 -550
  132. package/dist/knowledge/overrides-loader.js +1 -65
  133. package/dist/knowledge/passport-confirm.js +1 -531
  134. package/dist/knowledge/passport-context.js +1 -306
  135. package/dist/knowledge/passport-ledger.js +1 -282
  136. package/dist/knowledge/passport-puzzle.js +1 -333
  137. package/dist/knowledge/passport-risk.js +1 -450
  138. package/dist/knowledge/passport-templates.js +1 -568
  139. package/dist/knowledge/passport-translation.js +1 -516
  140. package/dist/knowledge/payment-risk.js +1 -249
  141. package/dist/knowledge/permission-confirm.js +1 -426
  142. package/dist/knowledge/permission-context.js +1 -224
  143. package/dist/knowledge/permission-ledger.js +1 -403
  144. package/dist/knowledge/permission-puzzle.js +1 -173
  145. package/dist/knowledge/permission-risk.js +1 -411
  146. package/dist/knowledge/permission-templates.js +1 -234
  147. package/dist/knowledge/permission-translation.js +1 -350
  148. package/dist/knowledge/personal-risk.js +1 -212
  149. package/dist/knowledge/process-model.js +1 -160
  150. package/dist/knowledge/progress-confirm.js +1 -456
  151. package/dist/knowledge/progress-context.js +1 -452
  152. package/dist/knowledge/progress-ledger.js +1 -330
  153. package/dist/knowledge/progress-puzzle.js +1 -219
  154. package/dist/knowledge/progress-risk.js +1 -461
  155. package/dist/knowledge/progress-templates.js +1 -228
  156. package/dist/knowledge/progress-translation.js +1 -405
  157. package/dist/knowledge/proof-confirm.js +1 -187
  158. package/dist/knowledge/proof-risk.js +1 -207
  159. package/dist/knowledge/proof-translation.js +1 -283
  160. package/dist/knowledge/registrar-risk.js +1 -217
  161. package/dist/knowledge/repository-confirm.js +1 -286
  162. package/dist/knowledge/repository-risk.js +1 -373
  163. package/dist/knowledge/repository-translation.js +1 -445
  164. package/dist/knowledge/reputation-rules.js +1 -99
  165. package/dist/knowledge/resource-risk.js +1 -157
  166. package/dist/knowledge/reward-confirm.js +1 -526
  167. package/dist/knowledge/reward-context.js +1 -504
  168. package/dist/knowledge/reward-ledger.js +1 -502
  169. package/dist/knowledge/reward-puzzle.js +1 -300
  170. package/dist/knowledge/reward-risk.js +1 -627
  171. package/dist/knowledge/reward-templates.js +1 -197
  172. package/dist/knowledge/reward-translation.js +1 -501
  173. package/dist/knowledge/safety-rules.js +1 -404
  174. package/dist/knowledge/scenario-modes.js +1 -321
  175. package/dist/knowledge/service-confirm.js +1 -807
  176. package/dist/knowledge/service-context.js +1 -403
  177. package/dist/knowledge/service-ledger.js +1 -609
  178. package/dist/knowledge/service-puzzle.js +1 -236
  179. package/dist/knowledge/service-risk.js +1 -651
  180. package/dist/knowledge/service-templates.js +1 -456
  181. package/dist/knowledge/service-translation.js +1 -622
  182. package/dist/knowledge/template-registry.js +1 -353
  183. package/dist/knowledge/tool-constraints.js +1 -195
  184. package/dist/knowledge/tools-reference.js +1 -178
  185. package/dist/knowledge/treasury-confirm.js +1 -512
  186. package/dist/knowledge/treasury-context.js +1 -363
  187. package/dist/knowledge/treasury-ledger.js +1 -300
  188. package/dist/knowledge/treasury-puzzle.js +1 -216
  189. package/dist/knowledge/treasury-risk.js +1 -440
  190. package/dist/knowledge/treasury-templates.js +1 -358
  191. package/dist/knowledge/treasury-translation.js +1 -498
  192. package/dist/knowledge/trust-metrics.js +1 -198
  193. package/dist/knowledge/util-risk.js +1 -135
  194. package/dist/loop-engineering/aggregate.js +1 -132
  195. package/dist/loop-engineering/context-collect.js +1 -83
  196. package/dist/loop-engineering/diagnose.js +1 -273
  197. package/dist/loop-engineering/improve.js +1 -405
  198. package/dist/loop-engineering/index.js +1 -4
  199. package/dist/loop-engineering/pipeline.js +1 -56
  200. package/dist/mode-market/index.js +1 -3
  201. package/dist/mode-market/registry.js +1 -124
  202. package/dist/mode-market/review.js +1 -214
  203. package/dist/mode-market/submission.js +1 -85
  204. package/dist/participation/collaborator-interest.d.ts +23 -0
  205. package/dist/participation/collaborator-interest.js +1 -0
  206. package/dist/participation/customer-interest.d.ts +25 -0
  207. package/dist/participation/customer-interest.js +1 -0
  208. package/dist/participation/merchant-interest.js +1 -100
  209. package/dist/participation/radar-core.d.ts +13 -3
  210. package/dist/participation/radar-core.js +1 -269
  211. package/dist/participation/supplier-interest.d.ts +25 -0
  212. package/dist/participation/supplier-interest.js +1 -0
  213. package/dist/persona/analyzer.js +1 -66
  214. package/dist/persona/bridge.js +1 -86
  215. package/dist/persona/defaults.js +1 -195
  216. package/dist/persona/experience-bridge.js +1 -23
  217. package/dist/persona/index.js +1 -71
  218. package/dist/persona/model.js +1 -111
  219. package/dist/persona/store.js +1 -62
  220. package/dist/persona/types.d.ts +3 -1
  221. package/dist/persona/types.js +1 -5
  222. package/dist/project/business-puzzle.js +1 -383
  223. package/dist/project/context-assembly.js +1 -254
  224. package/dist/project/deployment-bridge.js +1 -120
  225. package/dist/project/deployment-doc.js +1 -1126
  226. package/dist/project/edit-planner.js +1 -1342
  227. package/dist/project/evaluation.js +1 -2011
  228. package/dist/project/game-theory.js +1 -177
  229. package/dist/project/graph-builder.js +1 -656
  230. package/dist/project/graph.js +1 -340
  231. package/dist/project/handlers.js +1 -1784
  232. package/dist/project/index.d.ts +1 -0
  233. package/dist/project/index.js +1 -301
  234. package/dist/project/intent-analyzer.js +1 -149
  235. package/dist/project/machine-nodes.js +1 -36
  236. package/dist/project/merchant-guide.js +1 -264
  237. package/dist/project/migration.js +1 -125
  238. package/dist/project/mode-actions.js +1 -309
  239. package/dist/project/namespace.js +1 -206
  240. package/dist/project/participation-radar.js +1 -428
  241. package/dist/project/pipeline-actions.js +1 -109
  242. package/dist/project/project-store.js +1 -422
  243. package/dist/project/query.js +1 -153
  244. package/dist/project/reverse-mapping.d.ts +34 -0
  245. package/dist/project/reverse-mapping.js +1 -0
  246. package/dist/project/risk-aggregator.js +1 -295
  247. package/dist/project/rollback-policy.js +1 -290
  248. package/dist/project/semantic-assembler.js +1 -345
  249. package/dist/project/semantic-graph.js +1 -292
  250. package/dist/project/stage-gate.js +1 -369
  251. package/dist/project/substep-trace.js +1 -332
  252. package/dist/project/task-tracker.js +1 -78
  253. package/dist/role/derivation.d.ts +18 -0
  254. package/dist/role/derivation.js +1 -0
  255. package/dist/role/index.d.ts +5 -0
  256. package/dist/role/index.js +1 -0
  257. package/dist/role/model.d.ts +8 -0
  258. package/dist/role/model.js +1 -0
  259. package/dist/role/resolution.d.ts +11 -0
  260. package/dist/role/resolution.js +1 -0
  261. package/dist/role/types.d.ts +11 -0
  262. package/dist/role/types.js +1 -0
  263. package/dist/rules.js +1 -52
  264. package/dist/safety/confirm-gate.js +1 -88
  265. package/dist/safety/index.js +1 -3
  266. package/dist/safety/preview.js +1 -52
  267. package/dist/schema/call/allocation.js +1 -34
  268. package/dist/schema/call/arbitration.js +1 -113
  269. package/dist/schema/call/base.d.ts +15 -15
  270. package/dist/schema/call/base.js +1 -370
  271. package/dist/schema/call/bridge-handler.js +1 -265
  272. package/dist/schema/call/bridge.d.ts +7 -7
  273. package/dist/schema/call/bridge.js +1 -458
  274. package/dist/schema/call/contact.js +1 -37
  275. package/dist/schema/call/demand.js +1 -47
  276. package/dist/schema/call/guard.js +1 -161
  277. package/dist/schema/call/handler.js +1 -322
  278. package/dist/schema/call/index.js +1 -20
  279. package/dist/schema/call/machine.js +1 -193
  280. package/dist/schema/call/order.js +1 -35
  281. package/dist/schema/call/payment.js +1 -37
  282. package/dist/schema/call/permission-handler.js +1 -54
  283. package/dist/schema/call/permission.js +1 -105
  284. package/dist/schema/call/personal.js +1 -78
  285. package/dist/schema/call/progress.js +1 -47
  286. package/dist/schema/call/proof.js +1 -33
  287. package/dist/schema/call/repository.js +1 -77
  288. package/dist/schema/call/reward.js +1 -30
  289. package/dist/schema/call/semantic.js +1 -1679
  290. package/dist/schema/call/service.js +1 -184
  291. package/dist/schema/call/treasury.js +1 -71
  292. package/dist/schema/common/index.js +1 -407
  293. package/dist/schema/config/index.js +1 -68
  294. package/dist/schema/evaluation/index.d.ts +213 -16
  295. package/dist/schema/evaluation/index.js +1 -356
  296. package/dist/schema/index.js +1 -17
  297. package/dist/schema/intent-radar/index.d.ts +13 -13
  298. package/dist/schema/intent-radar/index.js +1 -89
  299. package/dist/schema/local/index.d.ts +21 -21
  300. package/dist/schema/local/index.js +1 -927
  301. package/dist/schema/local/wip.js +1 -187
  302. package/dist/schema/messenger/index.d.ts +7 -7
  303. package/dist/schema/messenger/index.js +1 -475
  304. package/dist/schema/operations.d.ts +7 -7
  305. package/dist/schema/operations.js +1 -520
  306. package/dist/schema/persona/index.d.ts +54 -54
  307. package/dist/schema/persona/index.js +1 -148
  308. package/dist/schema/project/index.d.ts +94 -48
  309. package/dist/schema/project/index.js +1 -2057
  310. package/dist/schema/query/index.d.ts +423 -7
  311. package/dist/schema/query/index.js +1 -1646
  312. package/dist/schema/schema-query/index.js +1 -104
  313. package/dist/schema/schema-version.js +1 -76
  314. package/dist/schema/sync-layer4.js +1 -286
  315. package/dist/schema/task-status.js +1 -36
  316. package/dist/schema/trust/index.js +1 -314
  317. package/dist/schema/utils/guard-parser.js +1 -419
  318. package/dist/schema/utils/guard-query-utils.js +1 -46
  319. package/dist/schema/utils/node-parser.js +1 -369
  320. package/dist/schema/utils/object-type-utils.js +1 -35
  321. package/dist/schema/utils/permission-index-utils.js +1 -7
  322. package/dist/schema/utils/permission-machine-check.js +1 -121
  323. package/dist/schema/utils/skills-recommendation.js +1 -77
  324. package/dist/schema-query/index.js +1 -810
  325. package/dist/schemas/account_operation.output.json +5 -2
  326. package/dist/schemas/bridge_operation.output.json +5 -2
  327. package/dist/schemas/evaluation_operation.output.json +112 -7
  328. package/dist/schemas/evaluation_operation.schema.json +93 -6
  329. package/dist/schemas/index.json +1 -1
  330. package/dist/schemas/intent_radar.output.json +4 -1
  331. package/dist/schemas/intent_radar.schema.json +4 -1
  332. package/dist/schemas/local_info_operation.output.json +5 -2
  333. package/dist/schemas/local_mark_operation.output.json +5 -2
  334. package/dist/schemas/messenger_operation.output.json +5 -2
  335. package/dist/schemas/onchain_events.output.json +5 -2
  336. package/dist/schemas/onchain_operations.output.json +5 -2
  337. package/dist/schemas/onchain_operations.schema.json +4 -4
  338. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  339. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  340. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  341. package/dist/schemas/onchain_table_data.output.json +6 -3
  342. package/dist/schemas/persona_operation.output.json +4 -1
  343. package/dist/schemas/persona_operation.schema.json +4 -1
  344. package/dist/schemas/project_operation.output.json +28 -8
  345. package/dist/schemas/query_toolkit.output.json +8 -5
  346. package/dist/schemas/wowok_buildin_info.output.json +132 -0
  347. package/dist/schemas/wowok_buildin_info.schema.json +14 -0
  348. package/dist/telemetry/index.js +1 -112
  349. package/dist/telemetry/redact.js +1 -23
  350. package/dist/telemetry/storage.js +1 -80
  351. package/dist/tools/handlers/bridge.js +1 -1
  352. package/dist/tools/handlers/config.js +1 -74
  353. package/dist/tools/handlers/evaluation.js +1 -123
  354. package/dist/tools/handlers/file-export.js +1 -90
  355. package/dist/tools/handlers/intent-radar.js +1 -76
  356. package/dist/tools/handlers/local.js +1 -53
  357. package/dist/tools/handlers/messenger.js +1 -188
  358. package/dist/tools/handlers/onchain.js +1 -1180
  359. package/dist/tools/handlers/persona.js +1 -89
  360. package/dist/tools/handlers/project.js +1 -211
  361. package/dist/tools/handlers/query.js +1 -434
  362. package/dist/tools/handlers/schema-query.js +1 -176
  363. package/dist/tools/handlers/task-status.js +1 -26
  364. package/dist/tools/handlers/trust.js +1 -380
  365. package/dist/tools/handlers/wip.js +1 -90
  366. package/dist/tools/index.js +1 -1382
  367. package/dist/tools/retry.js +1 -85
  368. package/dist/tools/rules-hook.js +1 -23
  369. package/dist/tools/shared.js +1 -130
  370. package/dist/tools/types.js +1 -1
  371. package/dist/tools/upgrade-check.d.ts +19 -0
  372. package/dist/tools/upgrade-check.js +1 -0
  373. package/dist/tools/wip-deploy-assist.js +1 -306
  374. package/dist/tools/wrap.js +1 -500
  375. package/package.json +4 -2
@@ -1,373 +1 @@
1
- import { CUSTOMER_INTELLIGENCE_VERSION } from "./types.js";
2
- const SCENARIO_SPECS = {
3
- info_asymmetry: {
4
- scenario: "info_asymmetry",
5
- merchant_tactic: "Hides key workflow information; Machine is not public",
6
- user_strategy: "Request machineNode2file export + Guard configuration; ask about key nodes via Messenger",
7
- nash_equilibrium: "Merchant becomes transparent (provides full Machine docs) ↔ User purchases",
8
- fallback: "Abandon purchase",
9
- confidence: (puzzle) => {
10
- if (puzzle.workflow_analysis === undefined)
11
- return 0.9;
12
- if (puzzle.completeness < 0.5)
13
- return 0.9;
14
- return 0.5;
15
- },
16
- rationale: (puzzle) => {
17
- if (puzzle.workflow_analysis === undefined) {
18
- return "Workflow structure analysis missing; severe information asymmetry";
19
- }
20
- if (puzzle.completeness < 0.5) {
21
- return `Information completeness is only ${Math.round(puzzle.completeness * 100)}%; key puzzle pieces missing`;
22
- }
23
- return "Information completeness is acceptable, but still recommend requesting Machine docs";
24
- },
25
- },
26
- fund_safety: {
27
- scenario: "fund_safety",
28
- merchant_tactic: "No compensation fund or insufficient compensation fund",
29
- user_strategy: "Require merchant to top up compensation_fund to 100% of order amount; write into WTS agreement",
30
- nash_equilibrium: "Merchant tops up compensation fund ↔ User purchases",
31
- fallback: "Choose another merchant or require arbitration upfront",
32
- confidence: (puzzle) => {
33
- const fund = puzzle.fund_safety;
34
- if (!fund)
35
- return 0.6;
36
- if (fund.compensation_covers_order === false)
37
- return 0.95;
38
- return 0.4;
39
- },
40
- rationale: (puzzle) => {
41
- const fund = puzzle.fund_safety;
42
- if (!fund)
43
- return "Fund safety analysis missing";
44
- if (fund.compensation_covers_order === false) {
45
- return `Compensation fund covers only ${Math.round(fund.compensation_ratio * 100)}% of order amount`;
46
- }
47
- return "Compensation fund covers the order amount";
48
- },
49
- },
50
- refund_dispute: {
51
- scenario: "refund_dispute",
52
- merchant_tactic: "No refund path or unfair refund Allocator configuration",
53
- user_strategy: "Negotiate refund terms via Messenger + require 100%→Order Allocator",
54
- nash_equilibrium: "Merchant configures refund Allocator ↔ User purchases",
55
- fallback: "Arbitration",
56
- confidence: (puzzle) => {
57
- const wf = puzzle.workflow_analysis;
58
- if (!wf)
59
- return 0.5;
60
- if (wf.has_refund_path === false)
61
- return 0.85;
62
- return 0.4;
63
- },
64
- rationale: (puzzle) => {
65
- const wf = puzzle.workflow_analysis;
66
- if (!wf)
67
- return "Workflow structure missing; cannot confirm refund path";
68
- if (wf.has_refund_path === false)
69
- return "No refund path detected in the workflow";
70
- return "Refund path exists";
71
- },
72
- },
73
- arbitration_fairness: {
74
- scenario: "arbitration_fairness",
75
- merchant_tactic: "Self-built arbitration (owner=service owner)",
76
- user_strategy: "Require third-party arbitration; verify arb owner via query_toolkit",
77
- nash_equilibrium: "Third-party arbitration ↔ User purchases",
78
- fallback: "Do not purchase",
79
- confidence: (puzzle) => {
80
- const trust = puzzle.trust_signals;
81
- if (!trust)
82
- return 0.6;
83
- if (trust.arbitration_independent === false)
84
- return 0.9;
85
- return 0.3;
86
- },
87
- rationale: (puzzle) => {
88
- const trust = puzzle.trust_signals;
89
- if (!trust)
90
- return "Trust signals missing; cannot judge arbitration independence";
91
- if (trust.arbitration_independent === false) {
92
- return "Arbitrator and merchant are the same address; fairness is questionable";
93
- }
94
- return "Arbitration is independent; fairness is assured";
95
- },
96
- },
97
- pricing: {
98
- scenario: "pricing",
99
- merchant_tactic: "Price is 20%+ above market average",
100
- user_strategy: "Cite puzzle.market_context.avg_price in negotiation; request discount or Reward",
101
- nash_equilibrium: "Merchant lowers price or provides Reward ↔ User purchases",
102
- fallback: "Accept current price but request additional benefits",
103
- confidence: (puzzle) => {
104
- const market = puzzle.market_context;
105
- if (!market)
106
- return 0.4;
107
- if (market.price_percentile > 0.8)
108
- return 0.7;
109
- return 0.3;
110
- },
111
- rationale: (puzzle) => {
112
- const market = puzzle.market_context;
113
- if (!market)
114
- return "Market context data missing";
115
- return `Price is at the ${Math.round(market.price_percentile * 100)}th market percentile`;
116
- },
117
- },
118
- delivery_sla: {
119
- scenario: "delivery_sla",
120
- merchant_tactic: "No milestone nodes / no delivery time commitment",
121
- user_strategy: "Require milestone nodes + write time commitment into WTS",
122
- nash_equilibrium: "Merchant configures SLA ↔ User purchases",
123
- fallback: "Accept but agree on timeline in writing via Messenger",
124
- confidence: (puzzle) => {
125
- const wf = puzzle.workflow_analysis;
126
- if (!wf)
127
- return 0.5;
128
- if (wf.has_milestone_nodes === false)
129
- return 0.8;
130
- return 0.3;
131
- },
132
- rationale: (puzzle) => {
133
- const wf = puzzle.workflow_analysis;
134
- if (!wf)
135
- return "Workflow structure missing; cannot assess milestones";
136
- if (wf.has_milestone_nodes === false)
137
- return "No milestone nodes detected";
138
- return "Milestone nodes are configured";
139
- },
140
- },
141
- quality_verification: {
142
- scenario: "quality_verification",
143
- merchant_tactic: "WIP hash not verified",
144
- user_strategy: "Require WIP hash verification; request samples or phased delivery evidence",
145
- nash_equilibrium: "Merchant provides WIP verification ↔ User purchases",
146
- fallback: "Request samples via Messenger",
147
- confidence: (puzzle) => {
148
- const basics = puzzle.service_basics;
149
- if (basics.wip_verified === false)
150
- return 0.85;
151
- return 0.3;
152
- },
153
- rationale: (puzzle) => {
154
- const basics = puzzle.service_basics;
155
- if (basics.wip_verified === false)
156
- return "WIP hash is unverified; deliverables may have been tampered with";
157
- return "WIP hash is verified";
158
- },
159
- },
160
- after_sales: {
161
- scenario: "after_sales",
162
- merchant_tactic: "No Messenger or post-sale support",
163
- user_strategy: "Require Messenger to be configured; require post-sale terms to be written down",
164
- nash_equilibrium: "Merchant provides post-sale channel ↔ User purchases",
165
- fallback: "Use Contact channel as a substitute",
166
- confidence: (puzzle) => {
167
- const trust = puzzle.trust_signals;
168
- if (!trust)
169
- return 0.5;
170
- if (trust.has_messenger === false)
171
- return 0.75;
172
- return 0.3;
173
- },
174
- rationale: (puzzle) => {
175
- const trust = puzzle.trust_signals;
176
- if (!trust)
177
- return "Trust signals missing; cannot confirm Messenger";
178
- if (trust.has_messenger === false)
179
- return "Messenger is not configured; no post-sale channel";
180
- return "Messenger is configured";
181
- },
182
- },
183
- };
184
- export function recommendStrategy(scenario, ctx) {
185
- const spec = SCENARIO_SPECS[scenario];
186
- const { puzzle, prefs } = ctx;
187
- const strategy = {
188
- scenario: spec.scenario,
189
- merchant_tactic: spec.merchant_tactic,
190
- user_strategy: spec.user_strategy,
191
- nash_equilibrium: spec.nash_equilibrium,
192
- };
193
- const confidence = clampConfidence(spec.confidence(puzzle));
194
- const fallback = applyPrefsToFallback(scenario, spec.fallback, prefs);
195
- const rationale = spec.rationale(puzzle);
196
- return {
197
- scenario: spec.scenario,
198
- strategy,
199
- confidence,
200
- fallback,
201
- rationale,
202
- };
203
- }
204
- export function detectScenarios(puzzle) {
205
- const scenarios = [];
206
- if (puzzle.workflow_analysis === undefined || puzzle.completeness < 0.5) {
207
- scenarios.push("info_asymmetry");
208
- }
209
- if (puzzle.fund_safety?.compensation_covers_order === false) {
210
- scenarios.push("fund_safety");
211
- }
212
- if (puzzle.workflow_analysis?.has_refund_path === false) {
213
- scenarios.push("refund_dispute");
214
- }
215
- if (puzzle.trust_signals?.arbitration_independent === false) {
216
- scenarios.push("arbitration_fairness");
217
- }
218
- if (puzzle.market_context && puzzle.market_context.price_percentile > 0.8) {
219
- scenarios.push("pricing");
220
- }
221
- if (puzzle.workflow_analysis?.has_milestone_nodes === false) {
222
- scenarios.push("delivery_sla");
223
- }
224
- if (puzzle.service_basics.wip_verified === false) {
225
- scenarios.push("quality_verification");
226
- }
227
- if (puzzle.trust_signals?.has_messenger === false) {
228
- scenarios.push("after_sales");
229
- }
230
- return scenarios.slice(0, 3);
231
- }
232
- export function flowMigrationStrategy(puzzle) {
233
- const wf = puzzle.workflow_analysis;
234
- if (!wf || wf.machine_published === false) {
235
- return {
236
- strategy: "Machine is not published; strongly recommend requiring the merchant to publish before ordering",
237
- risk: "high",
238
- advice: "An unpublished Machine means the workflow is not yet in effect; after ordering, the order may not advance along the expected path. Suggest asking the merchant via Messenger to publish the Machine before placing the order.",
239
- };
240
- }
241
- if (wf.machine_paused === true) {
242
- return {
243
- strategy: "Machine is paused; confirm the reason before ordering",
244
- risk: "medium",
245
- advice: "The Machine has been paused by the merchant; it may be temporary maintenance or an active delisting. Suggest asking the merchant via Messenger about the reason and confirming the resumption time before ordering.",
246
- };
247
- }
248
- return {
249
- strategy: "Safe to order; workflow is stable",
250
- risk: "low",
251
- advice: "The Machine is published and not paused; the workflow is active and it is safe to order. Still recommend monitoring progress via Progress nodes after ordering.",
252
- };
253
- }
254
- export function repeatGameStrategy(puzzle, history) {
255
- const isLongTerm = history.completed >= 5 &&
256
- (history.completed === 0 || history.disputes / history.completed < 0.2);
257
- if (isLongTerm) {
258
- const disputeRate = history.completed > 0
259
- ? Math.round((history.disputes / history.completed) * 100)
260
- : 0;
261
- return {
262
- strategy: "Long-term trust established; consider bulk ordering / discount negotiation",
263
- is_long_term_partner: true,
264
- advice: `Historical completed orders: ${history.completed}, dispute rate: ${disputeRate}%, trust level is high. ` +
265
- "Consider bulk ordering to negotiate discounts, or negotiate a long-term cooperation agreement. Still recommend keeping WTS evidence for future rights protection.",
266
- };
267
- }
268
- if (history.completed < 5) {
269
- return {
270
- strategy: "First-time cooperation; recommend a small test order before scaling up once trust is established",
271
- is_long_term_partner: false,
272
- advice: `Only ${history.completed} historical order(s); sample is insufficient to judge long-term trust. ` +
273
- "Recommend testing the merchant's fulfillment and communication efficiency with a small order first, " +
274
- "and scaling up once trust is accumulated. Focus on refund path and arbitration configuration.",
275
- };
276
- }
277
- const disputeRate = Math.round((history.disputes / history.completed) * 100);
278
- return {
279
- strategy: "Historical dispute rate is high; recommend ordering with caution and strengthening risk safeguards",
280
- is_long_term_partner: false,
281
- advice: `Among ${history.completed} historical orders, the dispute rate of ${disputeRate}% is high. Recommend requiring the merchant to top up the compensation fund, write terms into the WTS agreement, and strengthen upfront arbitration clauses for this order.`,
282
- };
283
- }
284
- export function rightsProtectionStrategy(puzzle, prefs) {
285
- const required = [];
286
- const negotiable = [];
287
- const red_lines = [];
288
- const hasRefundPath = puzzle.workflow_analysis?.has_refund_path ?? false;
289
- const hasArbPath = puzzle.workflow_analysis?.has_arbitration_path ?? false;
290
- const arbIndependent = puzzle.trust_signals?.arbitration_independent ?? true;
291
- const compensationRatio = puzzle.fund_safety?.compensation_ratio ?? 0;
292
- if (!hasRefundPath) {
293
- required.push("Require the merchant to configure a refund Allocator (100%→Order)");
294
- }
295
- else {
296
- required.push("Confirm the refund path is available");
297
- }
298
- if (!hasArbPath) {
299
- required.push("Require the merchant to bind a third-party arbitration service");
300
- }
301
- else if (!arbIndependent) {
302
- required.push("Require the merchant to switch to third-party arbitration (currently self-built arbitration)");
303
- }
304
- else {
305
- required.push("Confirm the arbitration path is available");
306
- }
307
- if (compensationRatio < 1) {
308
- required.push(`Require the merchant to top up the compensation fund to 100% of the order amount (currently covers ${Math.round(compensationRatio * 100)}%)`);
309
- }
310
- else {
311
- required.push("Confirm the compensation fund is sufficient");
312
- }
313
- if (prefs?.require_arbitration && !hasArbPath) {
314
- required.push("User preference requires mandatory arbitration");
315
- }
316
- if (prefs?.require_compensation_fund && compensationRatio < 1) {
317
- required.push("User preference requires a mandatory compensation fund");
318
- }
319
- negotiable.push("Price (negotiate based on market average)");
320
- negotiable.push("Delivery time (agree in writing via Messenger)");
321
- negotiable.push("Reward or discount (based on puzzle.market_context)");
322
- if (prefs) {
323
- if (prefs.bargain_hunting > 0.5) {
324
- negotiable.push("Additional discount (user has a strong bargain-hunting tendency)");
325
- }
326
- if (prefs.reward_seeking) {
327
- negotiable.push("Reward incentive terms");
328
- }
329
- if (prefs.delivery_speed_priority === "urgent") {
330
- negotiable.push("Expedited delivery commitment");
331
- }
332
- }
333
- if (!hasArbPath && !hasRefundPath) {
334
- red_lines.push("No arbitration and no refund path: the merchant can breach at will, funds are unprotected; recommend not purchasing");
335
- }
336
- if (compensationRatio < 0.5) {
337
- red_lines.push(`Compensation fund coverage is only ${Math.round(compensationRatio * 100)}% (<50%): payout is severely insufficient if the order fails; recommend not purchasing`);
338
- }
339
- if (prefs) {
340
- const trustScore = puzzle.trust_signals?.trust_score ?? 100;
341
- if (trustScore < prefs.min_trust_score) {
342
- red_lines.push(`Composite trust score ${trustScore} is below the user's minimum requirement of ${prefs.min_trust_score}`);
343
- }
344
- }
345
- return {
346
- required_rights: required,
347
- negotiable_rights: negotiable,
348
- red_lines: red_lines,
349
- };
350
- }
351
- function clampConfidence(value) {
352
- if (value < 0)
353
- return 0;
354
- if (value > 1)
355
- return 1;
356
- return value;
357
- }
358
- function applyPrefsToFallback(scenario, defaultFallback, prefs) {
359
- if (!prefs)
360
- return defaultFallback;
361
- if (prefs.risk_appetite === "conservative") {
362
- if (scenario === "arbitration_fairness" || scenario === "fund_safety") {
363
- return "Abandon purchase (conservative user)";
364
- }
365
- }
366
- if (prefs.risk_appetite === "aggressive") {
367
- if (scenario === "pricing") {
368
- return "Accept current price but request additional Reward or discount";
369
- }
370
- }
371
- return defaultFallback;
372
- }
373
- export { CUSTOMER_INTELLIGENCE_VERSION };
1
+ import{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';const SCENARIO_SPECS={'info_asymmetry':{'scenario':'info_asymmetry','merchant_tactic':'Hides\x20key\x20workflow\x20information;\x20Machine\x20is\x20not\x20public','user_strategy':'Request\x20machineNode2file\x20export\x20+\x20Guard\x20configuration;\x20ask\x20about\x20key\x20nodes\x20via\x20Messenger','nash_equilibrium':'Merchant\x20becomes\x20transparent\x20(provides\x20full\x20Machine\x20docs)\x20↔\x20User\x20purchases','fallback':'Abandon\x20purchase','confidence':a=>{if(a['workflow_analysis']===undefined)return 0.9;if(a['completeness']<0.5)return 0.9;return 0.5;},'rationale':a=>{if(a['workflow_analysis']===undefined)return'Workflow\x20structure\x20analysis\x20missing;\x20severe\x20information\x20asymmetry';if(a['completeness']<0.5)return'Information\x20completeness\x20is\x20only\x20'+Math['round'](a['completeness']*0x64)+'%;\x20key\x20puzzle\x20pieces\x20missing';return'Information\x20completeness\x20is\x20acceptable,\x20but\x20still\x20recommend\x20requesting\x20Machine\x20docs';}},'fund_safety':{'scenario':'fund_safety','merchant_tactic':'No\x20compensation\x20fund\x20or\x20insufficient\x20compensation\x20fund','user_strategy':'Require\x20merchant\x20to\x20top\x20up\x20compensation_fund\x20to\x20100%\x20of\x20order\x20amount;\x20write\x20into\x20WTS\x20agreement','nash_equilibrium':'Merchant\x20tops\x20up\x20compensation\x20fund\x20↔\x20User\x20purchases','fallback':'Choose\x20another\x20merchant\x20or\x20require\x20arbitration\x20upfront','confidence':a=>{const b=a['fund_safety'];if(!b)return 0.6;if(b['compensation_covers_order']===![])return 0.95;return 0.4;},'rationale':a=>{const b=a['fund_safety'];if(!b)return'Fund\x20safety\x20analysis\x20missing';if(b['compensation_covers_order']===![])return'Compensation\x20fund\x20covers\x20only\x20'+Math['round'](b['compensation_ratio']*0x64)+'%\x20of\x20order\x20amount';return'Compensation\x20fund\x20covers\x20the\x20order\x20amount';}},'refund_dispute':{'scenario':'refund_dispute','merchant_tactic':'No\x20refund\x20path\x20or\x20unfair\x20refund\x20Allocator\x20configuration','user_strategy':'Negotiate\x20refund\x20terms\x20via\x20Messenger\x20+\x20require\x20100%→Order\x20Allocator','nash_equilibrium':'Merchant\x20configures\x20refund\x20Allocator\x20↔\x20User\x20purchases','fallback':'Arbitration','confidence':a=>{const b=a['workflow_analysis'];if(!b)return 0.5;if(b['has_refund_path']===![])return 0.85;return 0.4;},'rationale':a=>{const b=a['workflow_analysis'];if(!b)return'Workflow\x20structure\x20missing;\x20cannot\x20confirm\x20refund\x20path';if(b['has_refund_path']===![])return'No\x20refund\x20path\x20detected\x20in\x20the\x20workflow';return'Refund\x20path\x20exists';}},'arbitration_fairness':{'scenario':'arbitration_fairness','merchant_tactic':'Self-built\x20arbitration\x20(owner=service\x20owner)','user_strategy':'Require\x20third-party\x20arbitration;\x20verify\x20arb\x20owner\x20via\x20query_toolkit','nash_equilibrium':'Third-party\x20arbitration\x20↔\x20User\x20purchases','fallback':'Do\x20not\x20purchase','confidence':a=>{const b=a['trust_signals'];if(!b)return 0.6;if(b['arbitration_independent']===![])return 0.9;return 0.3;},'rationale':a=>{const b=a['trust_signals'];if(!b)return'Trust\x20signals\x20missing;\x20cannot\x20judge\x20arbitration\x20independence';if(b['arbitration_independent']===![])return'Arbitrator\x20and\x20merchant\x20are\x20the\x20same\x20address;\x20fairness\x20is\x20questionable';return'Arbitration\x20is\x20independent;\x20fairness\x20is\x20assured';}},'pricing':{'scenario':'pricing','merchant_tactic':'Price\x20is\x2020%+\x20above\x20market\x20average','user_strategy':'Cite\x20puzzle.market_context.avg_price\x20in\x20negotiation;\x20request\x20discount\x20or\x20Reward','nash_equilibrium':'Merchant\x20lowers\x20price\x20or\x20provides\x20Reward\x20↔\x20User\x20purchases','fallback':'Accept\x20current\x20price\x20but\x20request\x20additional\x20benefits','confidence':a=>{const b=a['market_context'];if(!b)return 0.4;if(b['price_percentile']>0.8)return 0.7;return 0.3;},'rationale':a=>{const b=a['market_context'];if(!b)return'Market\x20context\x20data\x20missing';return'Price\x20is\x20at\x20the\x20'+Math['round'](b['price_percentile']*0x64)+'th\x20market\x20percentile';}},'delivery_sla':{'scenario':'delivery_sla','merchant_tactic':'No\x20milestone\x20nodes\x20/\x20no\x20delivery\x20time\x20commitment','user_strategy':'Require\x20milestone\x20nodes\x20+\x20write\x20time\x20commitment\x20into\x20WTS','nash_equilibrium':'Merchant\x20configures\x20SLA\x20↔\x20User\x20purchases','fallback':'Accept\x20but\x20agree\x20on\x20timeline\x20in\x20writing\x20via\x20Messenger','confidence':a=>{const b=a['workflow_analysis'];if(!b)return 0.5;if(b['has_milestone_nodes']===![])return 0.8;return 0.3;},'rationale':a=>{const b=a['workflow_analysis'];if(!b)return'Workflow\x20structure\x20missing;\x20cannot\x20assess\x20milestones';if(b['has_milestone_nodes']===![])return'No\x20milestone\x20nodes\x20detected';return'Milestone\x20nodes\x20are\x20configured';}},'quality_verification':{'scenario':'quality_verification','merchant_tactic':'WIP\x20hash\x20not\x20verified','user_strategy':'Require\x20WIP\x20hash\x20verification;\x20request\x20samples\x20or\x20phased\x20delivery\x20evidence','nash_equilibrium':'Merchant\x20provides\x20WIP\x20verification\x20↔\x20User\x20purchases','fallback':'Request\x20samples\x20via\x20Messenger','confidence':a=>{const b=a['service_basics'];if(b['wip_verified']===![])return 0.85;return 0.3;},'rationale':a=>{const b=a['service_basics'];if(b['wip_verified']===![])return'WIP\x20hash\x20is\x20unverified;\x20deliverables\x20may\x20have\x20been\x20tampered\x20with';return'WIP\x20hash\x20is\x20verified';}},'after_sales':{'scenario':'after_sales','merchant_tactic':'No\x20Messenger\x20or\x20post-sale\x20support','user_strategy':'Require\x20Messenger\x20to\x20be\x20configured;\x20require\x20post-sale\x20terms\x20to\x20be\x20written\x20down','nash_equilibrium':'Merchant\x20provides\x20post-sale\x20channel\x20↔\x20User\x20purchases','fallback':'Use\x20Contact\x20channel\x20as\x20a\x20substitute','confidence':a=>{const b=a['trust_signals'];if(!b)return 0.5;if(b['has_messenger']===![])return 0.75;return 0.3;},'rationale':a=>{const b=a['trust_signals'];if(!b)return'Trust\x20signals\x20missing;\x20cannot\x20confirm\x20Messenger';if(b['has_messenger']===![])return'Messenger\x20is\x20not\x20configured;\x20no\x20post-sale\x20channel';return'Messenger\x20is\x20configured';}}};export function recommendStrategy(a,b){const c=SCENARIO_SPECS[a],{puzzle:d,prefs:e}=b,f={'scenario':c['scenario'],'merchant_tactic':c['merchant_tactic'],'user_strategy':c['user_strategy'],'nash_equilibrium':c['nash_equilibrium']},g=clampConfidence(c['confidence'](d)),h=applyPrefsToFallback(a,c['fallback'],e),i=c['rationale'](d);return{'scenario':c['scenario'],'strategy':f,'confidence':g,'fallback':h,'rationale':i};}export function detectScenarios(a){const b=[];return(a['workflow_analysis']===undefined||a['completeness']<0.5)&&b['push']('info_asymmetry'),a['fund_safety']?.['compensation_covers_order']===![]&&b['push']('fund_safety'),a['workflow_analysis']?.['has_refund_path']===![]&&b['push']('refund_dispute'),a['trust_signals']?.['arbitration_independent']===![]&&b['push']('arbitration_fairness'),a['market_context']&&a['market_context']['price_percentile']>0.8&&b['push']('pricing'),a['workflow_analysis']?.['has_milestone_nodes']===![]&&b['push']('delivery_sla'),a['service_basics']['wip_verified']===![]&&b['push']('quality_verification'),a['trust_signals']?.['has_messenger']===![]&&b['push']('after_sales'),b['slice'](0x0,0x3);}export function flowMigrationStrategy(a){const b=a['workflow_analysis'];if(!b||b['machine_published']===![])return{'strategy':'Machine\x20is\x20not\x20published;\x20strongly\x20recommend\x20requiring\x20the\x20merchant\x20to\x20publish\x20before\x20ordering','risk':'high','advice':'An\x20unpublished\x20Machine\x20means\x20the\x20workflow\x20is\x20not\x20yet\x20in\x20effect;\x20after\x20ordering,\x20the\x20order\x20may\x20not\x20advance\x20along\x20the\x20expected\x20path.\x20Suggest\x20asking\x20the\x20merchant\x20via\x20Messenger\x20to\x20publish\x20the\x20Machine\x20before\x20placing\x20the\x20order.'};if(b['machine_paused']===!![])return{'strategy':'Machine\x20is\x20paused;\x20confirm\x20the\x20reason\x20before\x20ordering','risk':'medium','advice':'The\x20Machine\x20has\x20been\x20paused\x20by\x20the\x20merchant;\x20it\x20may\x20be\x20temporary\x20maintenance\x20or\x20an\x20active\x20delisting.\x20Suggest\x20asking\x20the\x20merchant\x20via\x20Messenger\x20about\x20the\x20reason\x20and\x20confirming\x20the\x20resumption\x20time\x20before\x20ordering.'};return{'strategy':'Safe\x20to\x20order;\x20workflow\x20is\x20stable','risk':'low','advice':'The\x20Machine\x20is\x20published\x20and\x20not\x20paused;\x20the\x20workflow\x20is\x20active\x20and\x20it\x20is\x20safe\x20to\x20order.\x20Still\x20recommend\x20monitoring\x20progress\x20via\x20Progress\x20nodes\x20after\x20ordering.'};}export function repeatGameStrategy(a,b){const c=b['completed']>=0x5&&(b['completed']===0x0||b['disputes']/b['completed']<0.2);if(c){const e=b['completed']>0x0?Math['round'](b['disputes']/b['completed']*0x64):0x0;return{'strategy':'Long-term\x20trust\x20established;\x20consider\x20bulk\x20ordering\x20/\x20discount\x20negotiation','is_long_term_partner':!![],'advice':'Historical\x20completed\x20orders:\x20'+b['completed']+',\x20dispute\x20rate:\x20'+e+'%,\x20trust\x20level\x20is\x20high.\x20'+'Consider\x20bulk\x20ordering\x20to\x20negotiate\x20discounts,\x20or\x20negotiate\x20a\x20long-term\x20cooperation\x20agreement.\x20Still\x20recommend\x20keeping\x20WTS\x20evidence\x20for\x20future\x20rights\x20protection.'};}if(b['completed']<0x5)return{'strategy':'First-time\x20cooperation;\x20recommend\x20a\x20small\x20test\x20order\x20before\x20scaling\x20up\x20once\x20trust\x20is\x20established','is_long_term_partner':![],'advice':'Only\x20'+b['completed']+'\x20historical\x20order(s);\x20sample\x20is\x20insufficient\x20to\x20judge\x20long-term\x20trust.\x20'+'Recommend\x20testing\x20the\x20merchant\x27s\x20fulfillment\x20and\x20communication\x20efficiency\x20with\x20a\x20small\x20order\x20first,\x20'+'and\x20scaling\x20up\x20once\x20trust\x20is\x20accumulated.\x20Focus\x20on\x20refund\x20path\x20and\x20arbitration\x20configuration.'};const d=Math['round'](b['disputes']/b['completed']*0x64);return{'strategy':'Historical\x20dispute\x20rate\x20is\x20high;\x20recommend\x20ordering\x20with\x20caution\x20and\x20strengthening\x20risk\x20safeguards','is_long_term_partner':![],'advice':'Among\x20'+b['completed']+'\x20historical\x20orders,\x20the\x20dispute\x20rate\x20of\x20'+d+'%\x20is\x20high.\x20Recommend\x20requiring\x20the\x20merchant\x20to\x20top\x20up\x20the\x20compensation\x20fund,\x20write\x20terms\x20into\x20the\x20WTS\x20agreement,\x20and\x20strengthen\x20upfront\x20arbitration\x20clauses\x20for\x20this\x20order.'};}export function rightsProtectionStrategy(a,b){const c=[],d=[],e=[],f=a['workflow_analysis']?.['has_refund_path']??![],g=a['workflow_analysis']?.['has_arbitration_path']??![],h=a['trust_signals']?.['arbitration_independent']??!![],i=a['fund_safety']?.['compensation_ratio']??0x0;!f?c['push']('Require\x20the\x20merchant\x20to\x20configure\x20a\x20refund\x20Allocator\x20(100%→Order)'):c['push']('Confirm\x20the\x20refund\x20path\x20is\x20available');if(!g)c['push']('Require\x20the\x20merchant\x20to\x20bind\x20a\x20third-party\x20arbitration\x20service');else!h?c['push']('Require\x20the\x20merchant\x20to\x20switch\x20to\x20third-party\x20arbitration\x20(currently\x20self-built\x20arbitration)'):c['push']('Confirm\x20the\x20arbitration\x20path\x20is\x20available');i<0x1?c['push']('Require\x20the\x20merchant\x20to\x20top\x20up\x20the\x20compensation\x20fund\x20to\x20100%\x20of\x20the\x20order\x20amount\x20(currently\x20covers\x20'+Math['round'](i*0x64)+'%)'):c['push']('Confirm\x20the\x20compensation\x20fund\x20is\x20sufficient');b?.['require_arbitration']&&!g&&c['push']('User\x20preference\x20requires\x20mandatory\x20arbitration');b?.['require_compensation_fund']&&i<0x1&&c['push']('User\x20preference\x20requires\x20a\x20mandatory\x20compensation\x20fund');d['push']('Price\x20(negotiate\x20based\x20on\x20market\x20average)'),d['push']('Delivery\x20time\x20(agree\x20in\x20writing\x20via\x20Messenger)'),d['push']('Reward\x20or\x20discount\x20(based\x20on\x20puzzle.market_context)');b&&(b['bargain_hunting']>0.5&&d['push']('Additional\x20discount\x20(user\x20has\x20a\x20strong\x20bargain-hunting\x20tendency)'),b['reward_seeking']&&d['push']('Reward\x20incentive\x20terms'),b['delivery_speed_priority']==='urgent'&&d['push']('Expedited\x20delivery\x20commitment'));!g&&!f&&e['push']('No\x20arbitration\x20and\x20no\x20refund\x20path:\x20the\x20merchant\x20can\x20breach\x20at\x20will,\x20funds\x20are\x20unprotected;\x20recommend\x20not\x20purchasing');i<0.5&&e['push']('Compensation\x20fund\x20coverage\x20is\x20only\x20'+Math['round'](i*0x64)+'%\x20(<50%):\x20payout\x20is\x20severely\x20insufficient\x20if\x20the\x20order\x20fails;\x20recommend\x20not\x20purchasing');if(b){const j=a['trust_signals']?.['trust_score']??0x64;j<b['min_trust_score']&&e['push']('Composite\x20trust\x20score\x20'+j+'\x20is\x20below\x20the\x20user\x27s\x20minimum\x20requirement\x20of\x20'+b['min_trust_score']);}return{'required_rights':c,'negotiable_rights':d,'red_lines':e};}function clampConfidence(a){if(a<0x0)return 0x0;if(a>0x1)return 0x1;return a;}function applyPrefsToFallback(a,b,c){if(!c)return b;if(c['risk_appetite']==='conservative'){if(a==='arbitration_fairness'||a==='fund_safety')return'Abandon\x20purchase\x20(conservative\x20user)';}if(c['risk_appetite']==='aggressive'){if(a==='pricing')return'Accept\x20current\x20price\x20but\x20request\x20additional\x20Reward\x20or\x20discount';}return b;}export{CUSTOMER_INTELLIGENCE_VERSION};