@wowok/agent-mcp 3.1.0 → 3.1.3

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 (337) hide show
  1. package/dist/config/runtime.js +1 -1
  2. package/dist/customer/index.d.ts +3 -9
  3. package/dist/customer/index.js +1 -1
  4. package/dist/customer/industry-risks.d.ts +3 -17
  5. package/dist/customer/industry-risks.js +1 -1
  6. package/dist/customer/types.d.ts +1 -165
  7. package/dist/customer/types.js +1 -1
  8. package/dist/customer/user-preferences.d.ts +0 -49
  9. package/dist/customer/user-preferences.js +1 -1
  10. package/dist/evaluation/arbitration-game.js +1 -1
  11. package/dist/evaluation/architecture.spec.d.ts +1 -0
  12. package/dist/evaluation/architecture.spec.js +1 -0
  13. package/dist/evaluation/builtins/graph-service.d.ts +16 -0
  14. package/dist/evaluation/builtins/graph-service.js +1 -0
  15. package/dist/evaluation/builtins/graph-service.spec.d.ts +1 -0
  16. package/dist/evaluation/builtins/graph-service.spec.js +1 -0
  17. package/dist/evaluation/builtins/index.d.ts +1 -1
  18. package/dist/evaluation/builtins/index.js +1 -1
  19. package/dist/evaluation/builtins/purity.spec.d.ts +1 -0
  20. package/dist/evaluation/builtins/purity.spec.js +1 -0
  21. package/dist/evaluation/engine.js +1 -1
  22. package/dist/evaluation/facets/catalog.d.ts +19 -0
  23. package/dist/evaluation/facets/catalog.js +1 -0
  24. package/dist/evaluation/guard-scan.d.ts +10 -0
  25. package/dist/evaluation/guard-scan.js +1 -0
  26. package/dist/evaluation/location-match.js +1 -1
  27. package/dist/evaluation/standards.d.ts +31 -0
  28. package/dist/evaluation/standards.js +1 -0
  29. package/dist/evaluation/standards.spec.d.ts +1 -0
  30. package/dist/evaluation/standards.spec.js +1 -0
  31. package/dist/evaluation/types.d.ts +9 -0
  32. package/dist/experience/realtime-feedback.js +1 -1
  33. package/dist/extensions/index.d.ts +1 -1
  34. package/dist/extensions/index.js +1 -1
  35. package/dist/extensions/industry-layers.d.ts +6 -5
  36. package/dist/extensions/industry-layers.js +1 -1
  37. package/dist/extensions/industry-pack.js +1 -1
  38. package/dist/goal/GoalClassifier.js +1 -1
  39. package/dist/graph/onchain/analyze.d.ts +16 -3
  40. package/dist/graph/onchain/analyze.js +1 -1
  41. package/dist/graph/onchain/analyze.spec.js +1 -1
  42. package/dist/graph/onchain/dataplane.d.ts +1 -1
  43. package/dist/graph/onchain/dataplane.js +1 -1
  44. package/dist/graph/onchain/edge-batch.spec.d.ts +1 -0
  45. package/dist/graph/onchain/edge-batch.spec.js +1 -0
  46. package/dist/graph/onchain/edge-schema.d.ts +11 -3
  47. package/dist/graph/onchain/edge-schema.js +1 -1
  48. package/dist/graph/onchain/entity-profile.spec.d.ts +1 -0
  49. package/dist/graph/onchain/entity-profile.spec.js +1 -0
  50. package/dist/graph/onchain/event-history.spec.d.ts +1 -0
  51. package/dist/graph/onchain/event-history.spec.js +1 -0
  52. package/dist/graph/onchain/expand.js +1 -1
  53. package/dist/graph/onchain/extract-deep.spec.d.ts +1 -0
  54. package/dist/graph/onchain/extract-deep.spec.js +1 -0
  55. package/dist/graph/onchain/extract.d.ts +11 -3
  56. package/dist/graph/onchain/extract.js +1 -1
  57. package/dist/graph/onchain/facet-projection.d.ts +99 -0
  58. package/dist/graph/onchain/facet-projection.js +1 -0
  59. package/dist/graph/onchain/facet-projection.spec.d.ts +1 -0
  60. package/dist/graph/onchain/facet-projection.spec.js +1 -0
  61. package/dist/graph/onchain/facts.d.ts +103 -0
  62. package/dist/graph/onchain/facts.js +1 -0
  63. package/dist/graph/onchain/facts.spec.d.ts +1 -0
  64. package/dist/graph/onchain/facts.spec.js +1 -0
  65. package/dist/graph/onchain/field-manifest.d.ts +29 -0
  66. package/dist/graph/onchain/field-manifest.js +1 -0
  67. package/dist/graph/onchain/field-manifest.spec.d.ts +1 -0
  68. package/dist/graph/onchain/field-manifest.spec.js +1 -0
  69. package/dist/graph/onchain/fixtures.d.ts +80 -0
  70. package/dist/graph/onchain/fixtures.js +1 -0
  71. package/dist/graph/onchain/fixtures.spec.d.ts +1 -0
  72. package/dist/graph/onchain/fixtures.spec.js +1 -0
  73. package/dist/graph/onchain/index.d.ts +8 -2
  74. package/dist/graph/onchain/index.js +1 -1
  75. package/dist/graph/onchain/interest.js +1 -1
  76. package/dist/graph/onchain/label-lint.spec.d.ts +1 -0
  77. package/dist/graph/onchain/label-lint.spec.js +1 -0
  78. package/dist/graph/onchain/names.d.ts +23 -0
  79. package/dist/graph/onchain/names.js +1 -0
  80. package/dist/graph/onchain/names.spec.d.ts +1 -0
  81. package/dist/graph/onchain/names.spec.js +1 -0
  82. package/dist/graph/onchain/onchain.spec.js +1 -1
  83. package/dist/graph/onchain/proposal-graph.d.ts +11 -0
  84. package/dist/graph/onchain/proposal-graph.js +1 -0
  85. package/dist/graph/onchain/proposal-graph.spec.d.ts +1 -0
  86. package/dist/graph/onchain/proposal-graph.spec.js +1 -0
  87. package/dist/graph/onchain/sdk-batch.d.ts +5 -1
  88. package/dist/graph/onchain/sdk-batch.js +1 -1
  89. package/dist/graph/onchain/sdk-dataplane.js +1 -1
  90. package/dist/graph/onchain/strategy.d.ts +16 -0
  91. package/dist/graph/onchain/strategy.js +1 -1
  92. package/dist/graph/onchain/strategy.spec.js +1 -1
  93. package/dist/graph/onchain/table-ledger.spec.d.ts +1 -0
  94. package/dist/graph/onchain/table-ledger.spec.js +1 -0
  95. package/dist/graph/onchain/types.d.ts +51 -11
  96. package/dist/graph/onchain/viewport.d.ts +1 -0
  97. package/dist/graph/onchain/viewport.js +1 -1
  98. package/dist/harness/index.d.ts +1 -5
  99. package/dist/harness/index.js +1 -1
  100. package/dist/harness/verify.d.ts +6 -1
  101. package/dist/harness/verify.js +1 -1
  102. package/dist/index.js +1 -1
  103. package/dist/knowledge/allocation-ledger.d.ts +2 -0
  104. package/dist/knowledge/allocation-ledger.js +1 -1
  105. package/dist/knowledge/allocation-puzzle.js +1 -1
  106. package/dist/knowledge/allocation-risk.d.ts +2 -3
  107. package/dist/knowledge/allocation-risk.js +1 -1
  108. package/dist/knowledge/arb-risk.d.ts +0 -1
  109. package/dist/knowledge/arb-risk.js +1 -1
  110. package/dist/knowledge/arbitration-risk.d.ts +0 -2
  111. package/dist/knowledge/arbitration-risk.js +1 -1
  112. package/dist/knowledge/baselines/evaluation-baselines.json +79 -0
  113. package/dist/knowledge/baselines/guard-lint-baseline.spec.d.ts +1 -0
  114. package/dist/knowledge/baselines/guard-lint-baseline.spec.js +1 -0
  115. package/dist/knowledge/baselines/risk-baselines.spec.d.ts +1 -0
  116. package/dist/knowledge/baselines/risk-baselines.spec.js +1 -0
  117. package/dist/knowledge/baselines/risk-cases.d.ts +8 -0
  118. package/dist/knowledge/baselines/risk-cases.js +1 -0
  119. package/dist/knowledge/bridge-risk.d.ts +0 -1
  120. package/dist/knowledge/bridge-risk.js +1 -1
  121. package/dist/knowledge/contact-risk.d.ts +0 -1
  122. package/dist/knowledge/contact-risk.js +1 -1
  123. package/dist/knowledge/contract-invariants.d.ts +1 -0
  124. package/dist/knowledge/contract-invariants.js +1 -1
  125. package/dist/knowledge/demand-risk.d.ts +0 -1
  126. package/dist/knowledge/demand-risk.js +1 -1
  127. package/dist/knowledge/getting-started.js +1 -1
  128. package/dist/knowledge/guard-design-patterns.js +1 -1
  129. package/dist/knowledge/guard-eval.d.ts +15 -0
  130. package/dist/knowledge/guard-eval.js +1 -0
  131. package/dist/knowledge/guard-eval.spec.d.ts +1 -0
  132. package/dist/knowledge/guard-eval.spec.js +1 -0
  133. package/dist/knowledge/guard-field-cognition.d.ts +48 -0
  134. package/dist/knowledge/guard-field-cognition.js +1 -0
  135. package/dist/knowledge/guard-lint.d.ts +1 -1
  136. package/dist/knowledge/guard-lint.js +1 -1
  137. package/dist/knowledge/guard-risk.d.ts +4 -19
  138. package/dist/knowledge/guard-risk.js +1 -1
  139. package/dist/knowledge/index.d.ts +42 -43
  140. package/dist/knowledge/index.js +1 -1
  141. package/dist/knowledge/industry-registry.js +1 -1
  142. package/dist/knowledge/industry-rule-node.d.ts +7 -0
  143. package/dist/knowledge/industry-rule-node.js +1 -0
  144. package/dist/knowledge/industry-strategy.js +1 -1
  145. package/dist/knowledge/jsonrpc-enum.js +1 -1
  146. package/dist/knowledge/machine-risk.d.ts +0 -6
  147. package/dist/knowledge/machine-risk.js +1 -1
  148. package/dist/knowledge/order-risk.d.ts +1 -9
  149. package/dist/knowledge/order-risk.js +1 -1
  150. package/dist/knowledge/payment-risk.d.ts +0 -1
  151. package/dist/knowledge/payment-risk.js +1 -1
  152. package/dist/knowledge/permission-risk.d.ts +0 -3
  153. package/dist/knowledge/permission-risk.js +1 -1
  154. package/dist/knowledge/personal-risk.d.ts +0 -1
  155. package/dist/knowledge/personal-risk.js +1 -1
  156. package/dist/knowledge/progress-risk.d.ts +0 -2
  157. package/dist/knowledge/progress-risk.js +1 -1
  158. package/dist/knowledge/proof-risk.d.ts +0 -1
  159. package/dist/knowledge/proof-risk.js +1 -1
  160. package/dist/knowledge/puzzle-projections.d.ts +11 -0
  161. package/dist/knowledge/puzzle-projections.js +1 -0
  162. package/dist/knowledge/recipient-constraint.d.ts +6 -1
  163. package/dist/knowledge/recipient-constraint.js +1 -1
  164. package/dist/knowledge/registrar-risk.d.ts +0 -1
  165. package/dist/knowledge/registrar-risk.js +1 -1
  166. package/dist/knowledge/repository-risk.d.ts +0 -1
  167. package/dist/knowledge/repository-risk.js +1 -1
  168. package/dist/knowledge/resource-risk.d.ts +0 -1
  169. package/dist/knowledge/resource-risk.js +1 -1
  170. package/dist/knowledge/reward-risk.d.ts +1 -5
  171. package/dist/knowledge/reward-risk.js +1 -1
  172. package/dist/knowledge/rule-node-analyzers.d.ts +43 -0
  173. package/dist/knowledge/rule-node-analyzers.js +1 -0
  174. package/dist/knowledge/rule-node-analyzers.spec.d.ts +1 -0
  175. package/dist/knowledge/rule-node-analyzers.spec.js +1 -0
  176. package/dist/knowledge/rule-outcome.d.ts +5 -0
  177. package/dist/knowledge/rule-outcome.js +1 -0
  178. package/dist/knowledge/safety-rules.js +1 -1
  179. package/dist/knowledge/scenario-topology.js +1 -1
  180. package/dist/knowledge/service-allocator-audit-node.d.ts +3 -0
  181. package/dist/knowledge/service-allocator-audit-node.js +1 -0
  182. package/dist/knowledge/service-risk-node.js +1 -1
  183. package/dist/knowledge/service-risk.d.ts +0 -3
  184. package/dist/knowledge/service-risk.js +1 -1
  185. package/dist/knowledge/template-registry.js +1 -1
  186. package/dist/knowledge/tools-reference.js +1 -1
  187. package/dist/knowledge/treasury-risk.d.ts +2 -3
  188. package/dist/knowledge/treasury-risk.js +1 -1
  189. package/dist/knowledge/util-risk.d.ts +0 -1
  190. package/dist/knowledge/util-risk.js +1 -1
  191. package/dist/knowledge/workflow-guidance.d.ts +2 -0
  192. package/dist/knowledge/workflow-guidance.js +1 -1
  193. package/dist/monitor/MonitorLoop.js +1 -1
  194. package/dist/persona/bridge.js +1 -1
  195. package/dist/persona/facet-profile.d.ts +33 -0
  196. package/dist/persona/facet-profile.js +1 -0
  197. package/dist/persona/model.d.ts +2 -1
  198. package/dist/persona/model.js +1 -1
  199. package/dist/persona/strategy-intent.js +1 -1
  200. package/dist/persona/topology-focus.d.ts +2 -2
  201. package/dist/persona/topology-focus.js +1 -1
  202. package/dist/persona/types.d.ts +12 -0
  203. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  204. package/dist/playbooks/service-build/facet-money.d.ts +22 -0
  205. package/dist/playbooks/service-build/facet-money.js +1 -0
  206. package/dist/playbooks/service-build/facet-money.spec.d.ts +1 -0
  207. package/dist/playbooks/service-build/facet-money.spec.js +1 -0
  208. package/dist/playbooks/service-build/intent-analyzer.js +1 -1
  209. package/dist/playbooks/service-build/machine-panorama.d.ts +3 -0
  210. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  211. package/dist/playbooks/service-build/object-panorama.d.ts +27 -27
  212. package/dist/playbooks/service-build/object-panorama.js +1 -1
  213. package/dist/playbooks/service-build/pipeline-actions.d.ts +2 -2
  214. package/dist/playbooks/service-build/pipeline-actions.js +1 -1
  215. package/dist/playbooks/service-build/risk-aggregator.d.ts +2 -1
  216. package/dist/playbooks/service-build/risk-aggregator.js +1 -1
  217. package/dist/playbooks/service-build/service-panorama.d.ts +4 -9
  218. package/dist/playbooks/service-build/service-panorama.js +1 -1
  219. package/dist/playbooks/service-build/topology-evaluation.spec.d.ts +1 -0
  220. package/dist/playbooks/service-build/topology-evaluation.spec.js +1 -0
  221. package/dist/playbooks/service-build/topology-query.d.ts +13 -2
  222. package/dist/playbooks/service-build/topology-query.js +1 -1
  223. package/dist/review/arb.d.ts +0 -2
  224. package/dist/review/arb.js +1 -1
  225. package/dist/review/order.d.ts +0 -1
  226. package/dist/review/order.js +1 -1
  227. package/dist/role/profiles.js +1 -1
  228. package/dist/rules.d.ts +1 -2
  229. package/dist/rules.js +1 -1
  230. package/dist/safety/confirm-gate.js +1 -1
  231. package/dist/safety/preview.js +1 -1
  232. package/dist/schema/call/base.d.ts +3372 -668
  233. package/dist/schema/call/base.js +1 -1
  234. package/dist/schema/call/handler.js +1 -1
  235. package/dist/schema/call/receipt.d.ts +28 -0
  236. package/dist/schema/call/receipt.js +1 -0
  237. package/dist/schema/call/semantic-customer-advice.spec.d.ts +1 -0
  238. package/dist/schema/call/semantic-customer-advice.spec.js +1 -0
  239. package/dist/schema/call/semantic.d.ts +5 -2
  240. package/dist/schema/call/semantic.js +1 -1
  241. package/dist/schema/call/treasury.js +1 -1
  242. package/dist/schema/common/index.js +1 -1
  243. package/dist/schema/evaluation/index.d.ts +289 -211
  244. package/dist/schema/evaluation/index.js +1 -1
  245. package/dist/schema/goal/index.d.ts +1 -1
  246. package/dist/schema/goal/planning.d.ts +2 -2
  247. package/dist/schema/index.d.ts +0 -1
  248. package/dist/schema/index.js +1 -1
  249. package/dist/schema/industry-pack/index.d.ts +1 -1
  250. package/dist/schema/keeper/index.d.ts +1 -1
  251. package/dist/schema/local/index.js +1 -1
  252. package/dist/schema/operations.d.ts +28 -10
  253. package/dist/schema/operations.js +1 -1
  254. package/dist/schema/persona/index.d.ts +24 -24
  255. package/dist/schema/query/bi.d.ts +629 -14
  256. package/dist/schema/query/bi.js +1 -1
  257. package/dist/schema/query/index.d.ts +9 -9
  258. package/dist/schema/query/index.js +1 -1
  259. package/dist/schema/schema-version.js +1 -1
  260. package/dist/schema/workspace/index.d.ts +2 -2
  261. package/dist/schema-query-impl/index.js +1 -1
  262. package/dist/schemas/account_operation.output.json +10 -10
  263. package/dist/schemas/account_operation.schema.json +3 -3
  264. package/dist/schemas/bridge_operation.output.json +10 -10
  265. package/dist/schemas/evaluation_operation.output.json +697 -169
  266. package/dist/schemas/evaluation_operation.schema.json +5 -434
  267. package/dist/schemas/index.json +1 -7
  268. package/dist/schemas/keeper_operation.output.json +10 -10
  269. package/dist/schemas/local_history_operation.output.json +10 -10
  270. package/dist/schemas/local_info_operation.output.json +10 -10
  271. package/dist/schemas/local_mark_operation.output.json +10 -10
  272. package/dist/schemas/messenger_operation.output.json +10 -10
  273. package/dist/schemas/monitor_events.output.json +10 -10
  274. package/dist/schemas/monitor_subscription.output.json +10 -10
  275. package/dist/schemas/onchain_events.output.json +11 -11
  276. package/dist/schemas/onchain_operations.output.json +6369 -3736
  277. package/dist/schemas/onchain_operations.schema.json +48 -48
  278. package/dist/schemas/onchain_operations_allocation.schema.json +5 -5
  279. package/dist/schemas/onchain_operations_arbitration.schema.json +3 -3
  280. package/dist/schemas/onchain_operations_contact.schema.json +2 -2
  281. package/dist/schemas/onchain_operations_demand.schema.json +2 -2
  282. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  283. package/dist/schemas/onchain_operations_order.schema.json +2 -2
  284. package/dist/schemas/onchain_operations_payment.schema.json +2 -2
  285. package/dist/schemas/onchain_operations_permission.schema.json +2 -2
  286. package/dist/schemas/onchain_operations_progress.schema.json +2 -2
  287. package/dist/schemas/onchain_operations_repository.schema.json +2 -2
  288. package/dist/schemas/onchain_operations_reward.schema.json +6 -6
  289. package/dist/schemas/onchain_operations_service.schema.json +8 -8
  290. package/dist/schemas/onchain_operations_treasury.schema.json +10 -10
  291. package/dist/schemas/onchain_table_data.output.json +78 -84
  292. package/dist/schemas/query_toolkit.output.json +1087 -254
  293. package/dist/schemas/query_toolkit.schema.json +65 -3
  294. package/dist/strategy/collectors.js +1 -1
  295. package/dist/strategy/metrics.js +1 -1
  296. package/dist/task/playbook.js +1 -1
  297. package/dist/tools/handlers/bridge.js +1 -1
  298. package/dist/tools/handlers/config.js +1 -1
  299. package/dist/tools/handlers/dispatch-expectations.d.ts +3 -0
  300. package/dist/tools/handlers/dispatch-expectations.js +1 -0
  301. package/dist/tools/handlers/evaluation.js +1 -1
  302. package/dist/tools/handlers/evaluation.spec.js +1 -1
  303. package/dist/tools/handlers/onchain.js +1 -1
  304. package/dist/tools/handlers/query.js +1 -1
  305. package/dist/tools/index.js +1 -1
  306. package/dist/tools/registry/evaluation.d.ts +2 -0
  307. package/dist/tools/registry/evaluation.js +1 -0
  308. package/dist/tools/registry/monitor.js +1 -1
  309. package/dist/tools/registry/query.js +1 -1
  310. package/dist/tools/shared.d.ts +0 -1
  311. package/dist/tools/shared.js +1 -1
  312. package/dist/tools/wrap.js +1 -1
  313. package/package.json +4 -3
  314. package/dist/customer/customer-advice.d.ts +0 -32
  315. package/dist/customer/customer-advice.js +0 -1
  316. package/dist/customer/info-puzzle.d.ts +0 -146
  317. package/dist/customer/info-puzzle.js +0 -1
  318. package/dist/customer/order-strategy.d.ts +0 -17
  319. package/dist/customer/order-strategy.js +0 -1
  320. package/dist/customer/preorder-compare.d.ts +0 -24
  321. package/dist/customer/preorder-compare.js +0 -1
  322. package/dist/customer/reminder-system.d.ts +0 -42
  323. package/dist/customer/reminder-system.js +0 -1
  324. package/dist/customer/risk-assessment.d.ts +0 -13
  325. package/dist/customer/risk-assessment.js +0 -1
  326. package/dist/evaluation/builtins/service-risk.d.ts +0 -7
  327. package/dist/evaluation/builtins/service-risk.js +0 -1
  328. package/dist/knowledge/trust-metrics.d.ts +0 -66
  329. package/dist/knowledge/trust-metrics.js +0 -1
  330. package/dist/schema/trust/index.d.ts +0 -334
  331. package/dist/schema/trust/index.js +0 -1
  332. package/dist/schemas/trust_score.output.json +0 -847
  333. package/dist/schemas/trust_score.schema.json +0 -364
  334. package/dist/tools/handlers/trust.d.ts +0 -16
  335. package/dist/tools/handlers/trust.js +0 -1
  336. package/dist/tools/registry/trust.d.ts +0 -2
  337. package/dist/tools/registry/trust.js +0 -1
@@ -1 +1 @@
1
- import{readFileSync,writeFileSync,existsSync,mkdirSync}from'fs';import{dirname,join}from'path';import{getWowMcpDir}from'@wowok/wowok';export const SERVICE_REGISTRY=[{'name':'confirm_gate','description':'Security\x20confirmation\x20gate\x20—\x20prompts\x20user\x20confirmation\x20before\x20amount,\x20default\x20account,\x20publish,\x20or\x20irreversible\x20operations','defaultEnabled':!![],'envVar':'WOWOK_CONFIRM_GATE','remindOnToggle':!![]},{'name':'harness','description':'L4\x20Harness\x20verify/recover\x20loop\x20—\x20automatically\x20validates\x20expected\x20results\x20before\x20and\x20after\x20operations.\x20GLM5:\x20default\x20ON\x20with\x20tiered\x20enforcement\x20(off/lightweight/full).','defaultEnabled':!![],'envVar':'WOWOK_HARNESS_ENABLED','remindOnToggle':!![]},{'name':'semantic_rich','description':'Semantic\x20layer\x20enrichment\x20—\x20attaches\x20extra\x20reminder\x20info\x20such\x20as\x20service_status\x20in\x20responses','defaultEnabled':!![],'envVar':'WOWOK_SEMANTIC_RICH','remindOnToggle':![]},{'name':'experience_layer','description':'Real-time\x20experience\x20layer\x20—\x20intent\x20distillation\x20+\x20user\x20profiling\x20+\x20experience\x20reuse,\x20gets\x20smarter\x20with\x20usage','defaultEnabled':!![],'envVar':'WOWOK_EXPERIENCE_LAYER','remindOnToggle':!![]},{'name':'customer_intelligence','description':'Buyer\x20intelligence\x20(Phase\x203\x20C-3)\x20—\x20attaches\x20risk\x20reminders,\x20preference\x20matching,\x20and\x20blocking\x20alerts\x20in\x20semantic.customer_advice\x20for\x20order/query\x20operations','defaultEnabled':!![],'envVar':'WOWOK_CUSTOMER_INTELLIGENCE','remindOnToggle':!![]},{'name':'order_monitor','description':'In-progress\x20order\x20monitoring\x20(Phase\x203\x20C-3.2)\x20—\x20detects\x20Progress\x20stalls\x20/\x20compensation\x20balance\x20changes\x20/\x20Messenger\x20timeouts;\x20disabled\x20by\x20default,\x20must\x20be\x20actively\x20enabled','defaultEnabled':![],'envVar':'WOWOK_ORDER_MONITOR','remindOnToggle':!![]},{'name':'industry_evolution','description':'Industry\x20specialization\x20evolution\x20(Phase\x204)\x20—\x20AI-Human-WOW\x20flywheel\x20loop:\x20captures\x20industry\x20signals\x20+\x20updates\x20knowledge\x20+\x20injects\x20evolution\x20context','defaultEnabled':!![],'envVar':'WOWOK_INDUSTRY_EVOLUTION','remindOnToggle':!![]}];const SERVICE_MAP=new Map(SERVICE_REGISTRY['map'](a=>[a['name'],a])),runtimeOverrides=new Map();let harnessTierOverride;function configFilePath(){if(process['env']['WOWOK_CONFIG_DIR'])return join(process['env']['WOWOK_CONFIG_DIR'],'runtime-config.json');return join(getWowMcpDir(),'runtime-config.json');}function isPersistEnabled(){const a=process['env']['WOWOK_RUNTIME_CONFIG_PERSIST'];return a==='1'||a==='true';}function loadPersisted(){if(!isPersistEnabled())return null;try{const a=configFilePath();if(!existsSync(a))return null;const b=readFileSync(a,'utf-8'),c=JSON['parse'](b);if(c&&typeof c==='object'&&c['services'])return c;}catch{}return null;}function savePersisted(){if(!isPersistEnabled())return;try{const a=configFilePath(),b=dirname(a);if(!existsSync(b))mkdirSync(b,{'recursive':!![]});const c={'version':0x2,'services':Object['fromEntries'](runtimeOverrides),'harness_tier':harnessTierOverride,'updatedAt':Date['now']()};writeFileSync(a,JSON['stringify'](c,null,0x2),'utf-8');}catch{}}{const persisted=loadPersisted();if(persisted){for(const [name,enabled]of Object['entries'](persisted['services'])){SERVICE_MAP['has'](name)&&runtimeOverrides['set'](name,enabled);}persisted['harness_tier']&&(harnessTierOverride=persisted['harness_tier']);}}export function getHarnessTier(){if(!isEnabled('harness'))return'off';if(harnessTierOverride)return harnessTierOverride;const a=process['env']['WOWOK_HARNESS_TIER'];if(a==='off'||a==='lightweight'||a==='full')return a;return'lightweight';}export function setHarnessTier(a){harnessTierOverride=a,savePersisted();}export function resetHarnessTier(){harnessTierOverride=undefined,savePersisted();}export function isEnabled(a){if(runtimeOverrides['has'](a))return runtimeOverrides['get'](a);const b=SERVICE_MAP['get'](a);if(b){const c=process['env'][b['envVar']];if(c!==undefined){if(c==='0'||c==='false')return![];if(c==='1'||c==='true')return!![];}return b['defaultEnabled'];}return![];}export function setEnabled(a,b){runtimeOverrides['set'](a,b),savePersisted();}export function toggle(a){const b=!isEnabled(a);return setEnabled(a,b),b;}export function reset(a){runtimeOverrides['delete'](a),savePersisted();}export function listServices(){return SERVICE_REGISTRY['map'](a=>{const b=runtimeOverrides['has'](a['name']),c=isEnabled(a['name']);return{'name':a['name'],'enabled':c,'defaultEnabled':a['defaultEnabled'],'description':a['description'],'overridden':b,'envVar':a['envVar'],'reminder':a['remindOnToggle']?buildReminder(a['name'],c):undefined};});}export function getServiceInfo(a){const b=SERVICE_MAP['get'](a);if(!b)return undefined;return{'name':b['name'],'enabled':isEnabled(b['name']),'defaultEnabled':b['defaultEnabled'],'description':b['description'],'overridden':runtimeOverrides['has'](b['name']),'envVar':b['envVar'],'reminder':b['remindOnToggle']?buildReminder(b['name'],isEnabled(b['name'])):undefined};}function buildReminder(a,b){switch(a){case'confirm_gate':return b?'ConfirmGate\x20is\x20ON:\x20prompts\x20confirmation\x20before\x20amount,\x20default\x20account,\x20publish,\x20or\x20irreversible\x20operations.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20confirm_gate.':'ConfirmGate\x20is\x20OFF:\x20operations\x20will\x20execute\x20directly\x20without\x20confirmation.\x20Note\x20the\x20risk\x20of\x20irreversible\x20operations.\x20To\x20re-enable,\x20call\x20config_operation\x20toggle\x20confirm_gate.';case'harness':return b?'Harness\x20is\x20ON\x20(tier:\x20'+getHarnessTier()+'):\x20automatically\x20validates\x20expected\x20results\x20around\x20operations.\x20lightweight=Plan+Verify;\x20full=Plan+Expect+Verify+Recover.\x20To\x20change\x20tier,\x20set\x20WOWOK_HARNESS_TIER\x20or\x20call\x20harness\x20API.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20harness.':'Harness\x20is\x20OFF.\x20GLM5\x20recommends\x20keeping\x20it\x20ON\x20(lightweight\x20tier)\x20for\x20safety.\x20To\x20enable,\x20call\x20config_operation\x20toggle\x20harness.';case'semantic_rich':return undefined;case'experience_layer':return b?'Experience\x20layer\x20is\x20ON:\x20provides\x20suggestions\x20in\x20semantic.experience\x20based\x20on\x20historical\x20operation\x20experience.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20experience_layer.':'Experience\x20layer\x20is\x20OFF:\x20no\x20experience\x20suggestions\x20will\x20be\x20attached.\x20To\x20enable,\x20call\x20config_operation\x20toggle\x20experience_layer.';case'customer_intelligence':return b?'Customer\x20intelligence\x20is\x20ON:\x20order/query\x20operations\x20will\x20attach\x20risk/preference/blocking\x20alerts\x20in\x20semantic.customer_advice.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20customer_intelligence.':'Customer\x20intelligence\x20is\x20OFF:\x20semantic.customer_advice\x20will\x20not\x20be\x20populated.\x20To\x20enable,\x20call\x20config_operation\x20toggle\x20customer_intelligence.';case'order_monitor':return b?'Order\x20monitor\x20is\x20ON:\x20detects\x20Progress\x20stalls,\x20compensation\x20balance\x20changes,\x20and\x20Messenger\x20timeouts.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20order_monitor.':'Order\x20monitor\x20is\x20OFF:\x20will\x20not\x20actively\x20detect\x20order\x20anomalies.\x20To\x20enable\x20(recommended\x20when\x20there\x20are\x20active\x20orders),\x20call\x20config_operation\x20toggle\x20order_monitor.';}}export const RUNTIME_CONFIG_VERSION=0x1;
1
+ import{readFileSync,writeFileSync,existsSync,mkdirSync}from'fs';import{dirname,join}from'path';import{getWowMcpDir}from'@wowok/wowok';export const SERVICE_REGISTRY=[{'name':'confirm_gate','description':'Security\x20confirmation\x20gate\x20—\x20prompts\x20user\x20confirmation\x20before\x20amount,\x20default\x20account,\x20publish,\x20or\x20irreversible\x20operations','defaultEnabled':!![],'envVar':'WOWOK_CONFIRM_GATE','remindOnToggle':!![]},{'name':'harness','description':'L4\x20Harness\x20wrap-level\x20hooks\x20—\x20auto-escalation,\x20pre-publish/pre-sign\x20gates,\x20legacy-tool\x20recovery\x20guidance.\x20GLM5:\x20default\x20ON\x20with\x20tiered\x20enforcement\x20(off/lightweight/full).','defaultEnabled':!![],'envVar':'WOWOK_HARNESS_ENABLED','remindOnToggle':!![]},{'name':'semantic_rich','description':'Semantic\x20layer\x20enrichment\x20—\x20attaches\x20extra\x20reminder\x20info\x20such\x20as\x20service_status\x20in\x20responses','defaultEnabled':!![],'envVar':'WOWOK_SEMANTIC_RICH','remindOnToggle':![]},{'name':'experience_layer','description':'Real-time\x20experience\x20layer\x20—\x20intent\x20distillation\x20+\x20user\x20profiling\x20+\x20experience\x20reuse,\x20gets\x20smarter\x20with\x20usage','defaultEnabled':!![],'envVar':'WOWOK_EXPERIENCE_LAYER','remindOnToggle':!![]},{'name':'customer_intelligence','description':'Buyer\x20intelligence\x20(Phase\x203\x20C-3)\x20—\x20attaches\x20risk\x20reminders,\x20preference\x20matching,\x20and\x20blocking\x20alerts\x20in\x20semantic.customer_advice\x20for\x20order/query\x20operations','defaultEnabled':!![],'envVar':'WOWOK_CUSTOMER_INTELLIGENCE','remindOnToggle':!![]},{'name':'order_monitor','description':'In-progress\x20order\x20monitoring\x20(Phase\x203\x20C-3.2)\x20—\x20detects\x20Progress\x20stalls\x20/\x20compensation\x20balance\x20changes\x20/\x20Messenger\x20timeouts;\x20disabled\x20by\x20default,\x20must\x20be\x20actively\x20enabled','defaultEnabled':![],'envVar':'WOWOK_ORDER_MONITOR','remindOnToggle':!![]},{'name':'industry_evolution','description':'Industry\x20specialization\x20evolution\x20(Phase\x204)\x20—\x20AI-Human-WOW\x20flywheel\x20loop:\x20captures\x20industry\x20signals\x20+\x20updates\x20knowledge\x20+\x20injects\x20evolution\x20context','defaultEnabled':!![],'envVar':'WOWOK_INDUSTRY_EVOLUTION','remindOnToggle':!![]}];const SERVICE_MAP=new Map(SERVICE_REGISTRY['map'](a=>[a['name'],a])),runtimeOverrides=new Map();let harnessTierOverride;function configFilePath(){if(process['env']['WOWOK_CONFIG_DIR'])return join(process['env']['WOWOK_CONFIG_DIR'],'runtime-config.json');return join(getWowMcpDir(),'runtime-config.json');}function isPersistEnabled(){const a=process['env']['WOWOK_RUNTIME_CONFIG_PERSIST'];return a==='1'||a==='true';}function loadPersisted(){if(!isPersistEnabled())return null;try{const a=configFilePath();if(!existsSync(a))return null;const b=readFileSync(a,'utf-8'),c=JSON['parse'](b);if(c&&typeof c==='object'&&c['services'])return c;}catch{}return null;}function savePersisted(){if(!isPersistEnabled())return;try{const a=configFilePath(),b=dirname(a);if(!existsSync(b))mkdirSync(b,{'recursive':!![]});const c={'version':0x2,'services':Object['fromEntries'](runtimeOverrides),'harness_tier':harnessTierOverride,'updatedAt':Date['now']()};writeFileSync(a,JSON['stringify'](c,null,0x2),'utf-8');}catch{}}{const persisted=loadPersisted();if(persisted){for(const [name,enabled]of Object['entries'](persisted['services'])){SERVICE_MAP['has'](name)&&runtimeOverrides['set'](name,enabled);}persisted['harness_tier']&&(harnessTierOverride=persisted['harness_tier']);}}export function getHarnessTier(){if(!isEnabled('harness'))return'off';if(harnessTierOverride)return harnessTierOverride;const a=process['env']['WOWOK_HARNESS_TIER'];if(a==='off'||a==='lightweight'||a==='full')return a;return'lightweight';}export function setHarnessTier(a){harnessTierOverride=a,savePersisted();}export function resetHarnessTier(){harnessTierOverride=undefined,savePersisted();}export function isEnabled(a){if(runtimeOverrides['has'](a))return runtimeOverrides['get'](a);const b=SERVICE_MAP['get'](a);if(b){const c=process['env'][b['envVar']];if(c!==undefined){if(c==='0'||c==='false')return![];if(c==='1'||c==='true')return!![];}return b['defaultEnabled'];}return![];}export function setEnabled(a,b){runtimeOverrides['set'](a,b),savePersisted();}export function toggle(a){const b=!isEnabled(a);return setEnabled(a,b),b;}export function reset(a){runtimeOverrides['delete'](a),savePersisted();}export function listServices(){return SERVICE_REGISTRY['map'](a=>{const b=runtimeOverrides['has'](a['name']),c=isEnabled(a['name']);return{'name':a['name'],'enabled':c,'defaultEnabled':a['defaultEnabled'],'description':a['description'],'overridden':b,'envVar':a['envVar'],'reminder':a['remindOnToggle']?buildReminder(a['name'],c):undefined};});}export function getServiceInfo(a){const b=SERVICE_MAP['get'](a);if(!b)return undefined;return{'name':b['name'],'enabled':isEnabled(b['name']),'defaultEnabled':b['defaultEnabled'],'description':b['description'],'overridden':runtimeOverrides['has'](b['name']),'envVar':b['envVar'],'reminder':b['remindOnToggle']?buildReminder(b['name'],isEnabled(b['name'])):undefined};}function buildReminder(a,b){switch(a){case'confirm_gate':return b?'ConfirmGate\x20is\x20ON:\x20prompts\x20confirmation\x20before\x20amount,\x20default\x20account,\x20publish,\x20or\x20irreversible\x20operations.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20confirm_gate.':'ConfirmGate\x20is\x20OFF:\x20operations\x20will\x20execute\x20directly\x20without\x20confirmation.\x20Note\x20the\x20risk\x20of\x20irreversible\x20operations.\x20To\x20re-enable,\x20call\x20config_operation\x20toggle\x20confirm_gate.';case'harness':return b?'Harness\x20is\x20ON\x20(tier:\x20'+getHarnessTier()+'):\x20wrap-level\x20safety\x20hooks\x20(auto-escalation,\x20pre-publish/pre-sign\x20gates,\x20legacy-tool\x20recovery\x20guidance).\x20lightweight=post-call\x20checks;\x20full=also\x20pre-publish/pre-sign\x20gates.\x20Recovery\x20and\x20diagnosis\x20on\x20tool\x20outputs\x20always\x20run.\x20To\x20change\x20tier,\x20set\x20WOWOK_HARNESS_TIER\x20or\x20call\x20harness\x20API.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20harness.':'Harness\x20is\x20OFF.\x20GLM5\x20recommends\x20keeping\x20it\x20ON\x20(lightweight\x20tier)\x20for\x20safety.\x20To\x20enable,\x20call\x20config_operation\x20toggle\x20harness.';case'semantic_rich':return undefined;case'experience_layer':return b?'Experience\x20layer\x20is\x20ON:\x20provides\x20suggestions\x20in\x20semantic.experience\x20based\x20on\x20historical\x20operation\x20experience.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20experience_layer.':'Experience\x20layer\x20is\x20OFF:\x20no\x20experience\x20suggestions\x20will\x20be\x20attached.\x20To\x20enable,\x20call\x20config_operation\x20toggle\x20experience_layer.';case'customer_intelligence':return b?'Customer\x20intelligence\x20is\x20ON:\x20order/query\x20operations\x20will\x20attach\x20risk/preference/blocking\x20alerts\x20in\x20semantic.customer_advice.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20customer_intelligence.':'Customer\x20intelligence\x20is\x20OFF:\x20semantic.customer_advice\x20will\x20not\x20be\x20populated.\x20To\x20enable,\x20call\x20config_operation\x20toggle\x20customer_intelligence.';case'order_monitor':return b?'Order\x20monitor\x20is\x20ON:\x20detects\x20Progress\x20stalls,\x20compensation\x20balance\x20changes,\x20and\x20Messenger\x20timeouts.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20order_monitor.':'Order\x20monitor\x20is\x20OFF:\x20will\x20not\x20actively\x20detect\x20order\x20anomalies.\x20To\x20enable\x20(recommended\x20when\x20there\x20are\x20active\x20orders),\x20call\x20config_operation\x20toggle\x20order_monitor.';}}export const RUNTIME_CONFIG_VERSION=0x1;
@@ -1,10 +1,4 @@
1
- export { CUSTOMER_INTELLIGENCE_VERSION, RISK_LEVELS, RISK_DIMENSION_MAX, type PuzzleDepth, type ServiceBasics, type WorkflowAnalysis, type FundSafety, type TrustSignals, type MerchantBehavior, type MarketContext, type InfoPuzzle, type RiskDimensionName, type RiskCheck, type RiskDimensionScore, type RiskLevel, type RiskScore, type UserPreferences, type ReminderPriority, type Reminder, type GameScenario, type GameStrategy, type CustomerAdvice, type UserMetricEvaluatorType, type UserMetric, type UserMetricsConfig, type UserMetricResult, type UserMetricsResult, type ServiceNestingEvaluation, } from "./types.js";
2
- export { assembleServiceBasics, assembleWorkflowAnalysis, assembleFundSafety, assembleTrustSignals, assembleMerchantBehavior, assembleMarketContext, assembleInfoPuzzle, assembleUserMetrics, evaluateServiceNesting, type ServiceRawData, type MachineNodeRaw, type ReviewRaw, type EventRaw, type PuzzleRawData, type ServiceNestingRawData, } from "./info-puzzle.js";
3
- export { riskLevelFromScore, riskLevelLabel, riskLevelEmoji, assessRisk, passesRiskThreshold, } from "./risk-assessment.js";
4
- export { getIndustryRiskChecks, getIndustryNeeds, checkIndustryNeeds, assessIndustryRisks, inferIndustry, type IndustryNeedTier, type IndustryNeed, type IndustryRiskCheck, type IndustryRiskResult, } from "./industry-risks.js";
5
- export { getDefaultPreferences, getIndustryTemplate, inferPreferences, matchServiceToPreferences, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, type Industry, type IndustryTemplate, type OrderHistoryEntry, type PreferenceInference, type ServiceForMatching, type PreferenceMatchResult, } from "./user-preferences.js";
1
+ export { CUSTOMER_INTELLIGENCE_VERSION, type IndustryServicePuzzle, type RiskDimensionName, type RiskLevel, type UserPreferences, } from "./types.js";
2
+ export { getIndustryRiskChecks, getIndustryNeeds, type IndustryNeedTier, type IndustryNeed, type IndustryRiskCheck, } from "./industry-risks.js";
3
+ export { getDefaultPreferences, getIndustryTemplate, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, type Industry, type IndustryTemplate, } from "./user-preferences.js";
6
4
  export { monitorOrder, sortAlerts, type AlertSeverity, type AlertCategory, type MonitorAlert, type OrderSnapshot, type OrderHistorySnapshot, type OrderMonitorContext, type MonitorThresholds, } from "./order-monitor.js";
7
- export { recommendStrategy, detectScenarios, type StrategyContext, type StrategyRecommendation, } from "./order-strategy.js";
8
- export { generateReminders, sortAndCapReminders, isBlocking, getBlockingReminders, type ReminderStage, type ReminderContext, } from "./reminder-system.js";
9
- export { assemblePreorderAdvice, type PreorderAdviceInput, type PreorderAdvice, type ConfidenceScore, } from "./customer-advice.js";
10
- export { buildPreorderComparison, type PreorderCompareRow, type PreorderComparison, } from "./preorder-compare.js";
@@ -1 +1 @@
1
- export{CUSTOMER_INTELLIGENCE_VERSION,RISK_LEVELS,RISK_DIMENSION_MAX}from'./types.js';export{assembleServiceBasics,assembleWorkflowAnalysis,assembleFundSafety,assembleTrustSignals,assembleMerchantBehavior,assembleMarketContext,assembleInfoPuzzle,assembleUserMetrics,evaluateServiceNesting}from'./info-puzzle.js';export{riskLevelFromScore,riskLevelLabel,riskLevelEmoji,assessRisk,passesRiskThreshold}from'./risk-assessment.js';export{getIndustryRiskChecks,getIndustryNeeds,checkIndustryNeeds,assessIndustryRisks,inferIndustry}from'./industry-risks.js';export{getDefaultPreferences,getIndustryTemplate,inferPreferences,matchServiceToPreferences,mergePreferences,validatePreferences,SUPPORTED_INDUSTRIES}from'./user-preferences.js';export{monitorOrder,sortAlerts}from'./order-monitor.js';export{recommendStrategy,detectScenarios}from'./order-strategy.js';export{generateReminders,sortAndCapReminders,isBlocking,getBlockingReminders}from'./reminder-system.js';export{assemblePreorderAdvice}from'./customer-advice.js';export{buildPreorderComparison}from'./preorder-compare.js';
1
+ export{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';export{getIndustryRiskChecks,getIndustryNeeds}from'./industry-risks.js';export{getDefaultPreferences,getIndustryTemplate,mergePreferences,validatePreferences,SUPPORTED_INDUSTRIES}from'./user-preferences.js';export{monitorOrder,sortAlerts}from'./order-monitor.js';
@@ -1,4 +1,4 @@
1
- import type { InfoPuzzle, RiskCheck } from "./types.js";
1
+ import type { IndustryServicePuzzle } from "./types.js";
2
2
  import { CUSTOMER_INTELLIGENCE_VERSION } from "./types.js";
3
3
  import type { Industry } from "./user-preferences.js";
4
4
  export type IndustryNeedTier = "common" | "personalized" | "advanced";
@@ -6,7 +6,7 @@ export interface IndustryNeed {
6
6
  id: string;
7
7
  tier: IndustryNeedTier;
8
8
  description: string;
9
- satisfied: (puzzle: InfoPuzzle) => boolean;
9
+ satisfied: (puzzle: IndustryServicePuzzle) => boolean;
10
10
  advice?: string;
11
11
  }
12
12
  export interface IndustryRiskCheck {
@@ -14,27 +14,13 @@ export interface IndustryRiskCheck {
14
14
  industry: Industry;
15
15
  description: string;
16
16
  weight: number;
17
- passed: (puzzle: InfoPuzzle) => boolean;
17
+ passed: (puzzle: IndustryServicePuzzle) => boolean;
18
18
  advice?: string;
19
19
  }
20
- export interface IndustryRiskResult {
21
- industry: Industry;
22
- checks: RiskCheck[];
23
- needs: IndustryNeed[];
24
- unmet_needs: IndustryNeed[];
25
- score_adjustment: number;
26
- summary: string;
27
- }
28
20
  export declare function _setRegistryLookup(fn: ((industry: string) => {
29
21
  risk_checks?: IndustryRiskCheck[];
30
22
  needs?: IndustryNeed[];
31
23
  } | undefined) | null): void;
32
24
  export declare function getIndustryRiskChecks(industry: Industry): IndustryRiskCheck[];
33
25
  export declare function getIndustryNeeds(industry: Industry): IndustryNeed[];
34
- export declare function checkIndustryNeeds(puzzle: InfoPuzzle, industry: Industry): {
35
- met: IndustryNeed[];
36
- unmet: IndustryNeed[];
37
- };
38
- export declare function assessIndustryRisks(puzzle: InfoPuzzle, industry: Industry): IndustryRiskResult;
39
- export declare function inferIndustry(puzzle: InfoPuzzle): Industry | undefined;
40
26
  export { CUSTOMER_INTELLIGENCE_VERSION };
@@ -1 +1 @@
1
- import{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';const hasRefundPath=a=>a['workflow_analysis']?.['has_refund_path']??![],hasArbitrationPath=a=>a['workflow_analysis']?.['has_arbitration_path']??![],hasMilestoneNodes=a=>a['workflow_analysis']?.['has_milestone_nodes']??![],hasMessenger=a=>a['trust_signals']?.['has_messenger']??![],compensationCoversOrder=a=>a['fund_safety']?.['compensation_covers_order']??![],lockDurationSafe=a=>a['fund_safety']?.['lock_duration_safe']??![],userOperableForwards=a=>a['workflow_analysis']?.['user_operable_forwards']??0x0,wipVerified=a=>a['service_basics']['wip_verified']===!![],hasCompensationFund=a=>a['service_basics']['compensation_fund_balance']>0x0n,deadEndCount=a=>a['workflow_analysis']?.['dead_end_nodes']?.['length']??0x0,totalNodes=a=>a['workflow_analysis']?.['total_nodes']??0x0,trustScore=a=>a['trust_signals']?.['trust_score']??0x0,reviewTotal=a=>a['trust_signals']?.['review_total']??0x0,merchantTotalOrders=a=>a['merchant_behavior']?.['total_orders']??0x0,repeatBuyerRate=a=>a['merchant_behavior']?.['repeat_buyer_rate']??0x0,disputeRate=a=>a['merchant_behavior']?.['dispute_rate']??0x1,INDUSTRY_RISK_CHECKS={'freelance':[{'id':'fr_wip_verified','industry':'freelance','dimension':'trust','description':'WIP\x20hash\x20verified\x20(work\x20traceable)','weight':0x1e,'passed':wipVerified,'advice':'⚠️\x20WIP\x20not\x20verified:\x20freelance\x20deliverables\x20cannot\x20be\x20traced.\x20Recommend\x20asking\x20the\x20merchant\x20to\x20provide\x20a\x20WIP\x20hash\x20and\x20write\x20it\x20into\x20WTS.'},{'id':'fr_milestone_nodes','industry':'freelance','dimension':'workflow','description':'Has\x20milestone\x20nodes\x20(phased\x20acceptance)','weight':0x19,'passed':hasMilestoneNodes,'advice':'⚠️\x20No\x20milestone\x20nodes:\x20delivery\x20is\x20completed\x20in\x20one\x20go\x20without\x20intermediate\x20acceptance.\x20Recommend\x20asking\x20the\x20merchant\x20to\x20add\x20phased\x20delivery\x20nodes.'},{'id':'fr_refund_path','industry':'freelance','dimension':'workflow','description':'Has\x20refund\x20path','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20if\x20freelance\x20order\x20delivery\x20is\x20not\x20satisfactory,\x20funds\x20are\x20hard\x20to\x20recover.'},{'id':'fr_response_time','industry':'freelance','dimension':'trust','description':'Messenger\x20configured\x20(communication\x20response\x20guarantee)','weight':0x14,'passed':hasMessenger,'advice':'⚠️\x20Messenger\x20not\x20configured:\x20cannot\x20conduct\x20requirement\x20confirmation\x20and\x20revision\x20communication.'}],'rental':[{'id':'rt_compensation_full','industry':'rental','dimension':'fund','description':'Compensation\x20fully\x20covers\x20order\x20amount','weight':0x1e,'passed':compensationCoversOrder,'advice':'🔴\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20when\x20rental\x20item\x20is\x20damaged.\x20Recommend\x20choosing\x20a\x20merchant\x20with\x20sufficient\x20compensation\x20fund.'},{'id':'rt_lock_duration','industry':'rental','dimension':'fund','description':'Lock\x20duration\x20safe\x20(compensation\x20cannot\x20be\x20withdrawn\x20by\x20merchant\x20at\x20any\x20time)','weight':0x19,'passed':lockDurationSafe,'advice':'⚠️\x20Lock\x20duration\x20not\x20safe:\x20merchant\x20may\x20withdraw\x20compensation\x20at\x20any\x20time,\x20deposit\x20safety\x20not\x20guaranteed.'},{'id':'rt_arbitration','industry':'rental','dimension':'workflow','description':'Arbitration\x20configured\x20(damage\x20dispute\x20resolution)','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20third-party\x20ruling\x20channel\x20for\x20rental\x20damage\x20disputes.'},{'id':'rt_user_operable','industry':'rental','dimension':'workflow','description':'Has\x20user-operable\x20path\x20(return/confirm)','weight':0x14,'passed':a=>userOperableForwards(a)>0x0,'advice':'🔴\x20No\x20user-operable\x20path:\x20return\x20process\x20relies\x20entirely\x20on\x20merchant,\x20may\x20be\x20maliciously\x20delayed.'}],'education':[{'id':'ed_refund_path','industry':'education','dimension':'workflow','description':'Has\x20refund\x20path\x20(refund\x20guarantee)','weight':0x1e,'passed':hasRefundPath,'advice':'🔴\x20No\x20refund\x20path:\x20course\x20refund\x20not\x20guaranteed,\x20recommend\x20asking\x20the\x20merchant\x20to\x20configure\x20a\x20refund\x20Allocator.'},{'id':'ed_compensation','industry':'education','dimension':'fund','description':'Has\x20compensation\x20fund','weight':0x19,'passed':hasCompensationFund,'advice':'⚠️\x20No\x20compensation\x20fund:\x20no\x20automatic\x20compensation\x20source\x20when\x20course\x20service\x20quality\x20is\x20not\x20up\x20to\x20standard.'},{'id':'ed_arbitration','industry':'education','dimension':'workflow','description':'Arbitration\x20configured','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20resolution\x20channel\x20for\x20course\x20quality\x20disputes.'},{'id':'ed_long_cycle_ok','industry':'education','dimension':'workflow','description':'Long\x20cycle\x20acceptable\x20(education\x20industry\x20allows\x20long\x20cycles,\x20over\x2090\x20days\x20needs\x20attention)','weight':0x14,'passed':()=>!![],'advice':'ℹ️\x20Long\x20delivery\x20cycles\x20are\x20normal\x20in\x20education,\x20but\x20if\x20the\x20actual\x20cycle\x20exceeds\x2090\x20days,\x20recommend\x20periodically\x20checking\x20learning\x20progress\x20and\x20lesson\x20consumption.'}],'travel':[{'id':'tr_urgent_delivery','industry':'travel','dimension':'workflow','description':'Urgent\x20delivery\x20configuration\x20(needs\x20milestone\x20nodes\x20for\x20phased\x20acceptance)','weight':0x1e,'passed':hasMilestoneNodes,'advice':'⚠️\x20No\x20milestone\x20nodes:\x20travel\x20itinerary\x20has\x20no\x20phased\x20acceptance,\x20recommend\x20setting\x20nodes\x20by\x20itinerary\x20stage.'},{'id':'tr_compensation_full','industry':'travel','dimension':'fund','description':'Compensation\x20fully\x20covers\x20(breach\x20compensation)','weight':0x19,'passed':compensationCoversOrder,'advice':'🔴\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20when\x20itinerary\x20breaches.'},{'id':'tr_refund_path','industry':'travel','dimension':'workflow','description':'Has\x20refund\x20path\x20(itinerary\x20change/cancellation)','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20funds\x20hard\x20to\x20recover\x20when\x20itinerary\x20changes\x20or\x20cancels\x20due\x20to\x20force\x20majeure.'},{'id':'tr_messenger','industry':'travel','dimension':'trust','description':'Messenger\x20configured\x20(emergency\x20communication)','weight':0x14,'passed':hasMessenger,'advice':'⚠️\x20Messenger\x20not\x20configured:\x20cannot\x20immediately\x20contact\x20merchant\x20during\x20travel\x20emergencies.'}],'subscription':[{'id':'sub_no_lockin','industry':'subscription','dimension':'workflow','description':'No\x20long-term\x20lock-in\x20(no\x20dead-end\x20nodes,\x20can\x20exit)','weight':0x1e,'passed':a=>deadEndCount(a)===0x0,'advice':'🔴\x20Dead-end\x20nodes\x20exist:\x20subscription\x20may\x20be\x20locked\x20and\x20unable\x20to\x20exit,\x20auto-renewal\x20trap\x20exists.'},{'id':'sub_refund_path','industry':'subscription','dimension':'workflow','description':'Has\x20refund\x20path\x20(exit\x20mechanism)','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20remaining\x20cycle\x20fees\x20hard\x20to\x20recover\x20after\x20subscription\x20exit.'},{'id':'sub_user_operable','industry':'subscription','dimension':'workflow','description':'Has\x20user-operable\x20path\x20(pause/downgrade/cancel)','weight':0x19,'passed':a=>userOperableForwards(a)>0x0,'advice':'🔴\x20No\x20user-operable\x20path:\x20subscription\x20status\x20entirely\x20controlled\x20by\x20merchant,\x20cannot\x20pause\x20or\x20cancel\x20independently.'},{'id':'sub_compensation_optional','industry':'subscription','dimension':'fund','description':'Compensation\x20optional\x20(not\x20mandatory\x20for\x20subscription\x20industry)','weight':0x14,'passed':()=>!![],'advice':'ℹ️\x20Compensation\x20is\x20not\x20mandatory\x20for\x20subscription\x20industry;\x20having\x20it\x20is\x20better.'}],'retail':[{'id':'ret_wip_verified','industry':'retail','dimension':'trust','description':'WIP\x20verified\x20(authenticity/logistics\x20traceable)','weight':0x19,'passed':wipVerified,'advice':'⚠️\x20WIP\x20not\x20verified:\x20product\x20traceability\x20info\x20missing,\x20recommend\x20confirming\x20authenticity\x20guarantee.'},{'id':'ret_compensation_full','industry':'retail','dimension':'fund','description':'Compensation\x20fully\x20covers','weight':0x19,'passed':compensationCoversOrder,'advice':'⚠️\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20return/exchange\x20disputes.'},{'id':'ret_refund_path','industry':'retail','dimension':'workflow','description':'Has\x20refund\x20path\x20(return/exchange)','weight':0x19,'passed':hasRefundPath,'advice':'🔴\x20No\x20refund\x20path:\x20return/exchange\x20not\x20guaranteed.'},{'id':'ret_arbitration','industry':'retail','dimension':'workflow','description':'Arbitration\x20configured','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20third-party\x20ruling\x20for\x20return/exchange\x20disputes.'}]};function commonNeeds(){return[{'id':'need_arbitration','tier':'common','description':'Arbitration\x20configured\x20(dispute\x20resolution\x20channel)','satisfied':hasArbitrationPath,'advice':'Arbitration\x20not\x20configured:\x20no\x20third-party\x20resolution\x20channel\x20for\x20disputes.'},{'id':'need_refund_path','tier':'common','description':'Has\x20refund\x20path','satisfied':hasRefundPath,'advice':'No\x20refund\x20path:\x20funds\x20hard\x20to\x20recover\x20when\x20delivery\x20fails.'},{'id':'need_user_operable','tier':'common','description':'Has\x20user-operable\x20Forward','satisfied':a=>userOperableForwards(a)>0x0,'advice':'No\x20user-operable\x20steps\x20in\x20workflow,\x20order\x20progress\x20depends\x20entirely\x20on\x20merchant.'},{'id':'need_messenger','tier':'common','description':'Messenger\x20configured','satisfied':hasMessenger,'advice':'Merchant\x20has\x20no\x20Messenger\x20channel,\x20cannot\x20negotiate\x20or\x20conduct\x20after-sales\x20communication.'}];}const INDUSTRY_NEEDS={'freelance':[...commonNeeds(),{'id':'need_wip_verified','tier':'personalized','description':'WIP\x20verified\x20(work\x20IP\x20traceable)','satisfied':wipVerified,'advice':'WIP\x20not\x20verified:\x20IP\x20ownership\x20and\x20originality\x20of\x20work\x20cannot\x20be\x20traced.'},{'id':'need_milestone_nodes','tier':'personalized','description':'Milestone\x20nodes\x20(phased\x20feedback)','satisfied':hasMilestoneNodes,'advice':'No\x20milestone\x20nodes:\x20lack\x20of\x20phased\x20feedback\x20and\x20revision\x20round\x20control.'},{'id':'need_merchant_history','tier':'advanced','description':'Merchant\x20history\x20≥3\x20orders\x20(fulfillment\x20experience)','satisfied':a=>merchantTotalOrders(a)>=0x3,'advice':'Merchant\x20history\x20orders\x20less\x20than\x203:\x20fulfillment\x20experience\x20is\x20limited.'}],'rental':[...commonNeeds(),{'id':'need_lock_duration_safe','tier':'personalized','description':'Lock\x20duration\x20safe\x20(deposit\x20cannot\x20be\x20withdrawn)','satisfied':lockDurationSafe,'advice':'Lock\x20duration\x20not\x20safe:\x20deposit\x20may\x20be\x20withdrawn\x20by\x20merchant\x20at\x20any\x20time.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20rental\x20item\x20damage.'},{'id':'need_merchant_history','tier':'advanced','description':'Merchant\x20history\x20≥5\x20orders\x20(rental\x20experience)','satisfied':a=>merchantTotalOrders(a)>=0x5,'advice':'Merchant\x20history\x20orders\x20less\x20than\x205:\x20rental\x20service\x20experience\x20limited.'}],'education':[...commonNeeds(),{'id':'need_has_compensation','tier':'personalized','description':'Has\x20compensation\x20fund\x20(course\x20quality\x20guarantee)','satisfied':hasCompensationFund,'advice':'No\x20compensation\x20fund:\x20no\x20compensation\x20source\x20when\x20course\x20quality\x20is\x20not\x20up\x20to\x20standard.'},{'id':'need_long_cycle_ok','tier':'personalized','description':'Long\x20cycle\x20acceptable','satisfied':()=>!![],'advice':'Long\x20cycles\x20are\x20normal\x20in\x20education;\x20recommend\x20tracking\x20lesson\x20consumption\x20and\x20attendance.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20course\x20reputation\x20may\x20be\x20poor.'}],'travel':[...commonNeeds(),{'id':'need_urgent_delivery','tier':'personalized','description':'Urgent\x20delivery\x20configuration\x20(milestone\x20phasing)','satisfied':hasMilestoneNodes,'advice':'No\x20milestone\x20nodes:\x20itinerary\x20has\x20no\x20phased\x20acceptance,\x20urgent\x20delivery\x20guarantee\x20insufficient.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers\x20(breach\x20compensation)','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20itinerary\x20breach.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20travel\x20service\x20reputation\x20may\x20be\x20poor.'}],'subscription':[...commonNeeds(),{'id':'need_no_lockin','tier':'personalized','description':'No\x20long-term\x20lock-in\x20(no\x20dead-end\x20nodes)','satisfied':a=>deadEndCount(a)===0x0,'advice':'Dead-end\x20nodes\x20exist:\x20subscription\x20may\x20be\x20locked,\x20auto-renewal\x20trap\x20exists.'},{'id':'need_low_dispute','tier':'personalized','description':'Low\x20dispute\x20rate\x20(≤15%,\x20stable\x20content\x20quality)','satisfied':a=>disputeRate(a)<=0.15,'advice':'Dispute\x20rate\x20is\x20high:\x20subscription\x20content\x20quality\x20may\x20be\x20unstable.'},{'id':'need_repeat_rate','tier':'advanced','description':'Repeat\x20buyer\x20rate\x20≥20%\x20(strong\x20subscription\x20renewal\x20willingness)','satisfied':a=>repeatBuyerRate(a)>=0.2,'advice':'Repeat\x20buyer\x20rate\x20below\x2020%:\x20subscription\x20renewal\x20willingness\x20is\x20weak,\x20service\x20may\x20not\x20be\x20worth\x20long-term\x20subscription.'}],'retail':[...commonNeeds(),{'id':'need_wip_verified','tier':'personalized','description':'WIP\x20verified\x20(authenticity/logistics\x20traceability)','satisfied':wipVerified,'advice':'WIP\x20not\x20verified:\x20product\x20authenticity\x20and\x20logistics\x20traceability\x20info\x20missing.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20return/exchange\x20disputes.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20product\x20or\x20service\x20reputation\x20may\x20be\x20poor.'}]};let _registryLookup=null;export function _setRegistryLookup(a){_registryLookup=a;}export function getIndustryRiskChecks(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['risk_checks'])return b['risk_checks'];}return INDUSTRY_RISK_CHECKS[a];}export function getIndustryNeeds(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['needs'])return b['needs'];}return INDUSTRY_NEEDS[a];}export function checkIndustryNeeds(a,b){const c=getIndustryNeeds(b),d=[],e=[];for(const f of c){if(f['satisfied'](a))d['push'](f);else e['push'](f);}return{'met':d,'unmet':e};}export function assessIndustryRisks(a,b){const c=INDUSTRY_RISK_CHECKS[b],d=c['reduce']((p,q)=>p+q['weight'],0x0),e=c['map'](p=>{const q=p['passed'](a);return{'id':p['id'],'dimension':p['dimension'],'description':p['description'],'weight':p['weight'],'passed':q,'advice':q?undefined:p['advice']};}),f=e['reduce']((p,q)=>p+(q['passed']?q['weight']:0x0),0x0),g=d>0x0?f/d:0x0,h=Math['round']((g-0.5)*0x14),i=Math['max'](-0xa,Math['min'](0xa,h)),j=getIndustryNeeds(b),{met:k,unmet:l}=checkIndustryNeeds(a,b),m=e['filter'](p=>p['passed'])['length'],n=i>=0x0?'+':'',o=b+'\x20industry\x20risk\x20check:\x20'+m+'\x20checks\x20passed\x20out\x20of\x20'+e['length']+('\x20(pass\x20rate\x20'+Math['round'](g*0x64)+'%);\x20'+k['length']+'\x20needs\x20satisfied\x20out\x20of\x20'+j['length']+';')+('\x20Score\x20adjustment\x20'+n+i+'.');return{'industry':b,'checks':e,'needs':j,'unmet_needs':l,'score_adjustment':i,'summary':o};}export function inferIndustry(a){const b=a['service_basics'];if(b['price_raw']<0x3b9aca00n&&b['has_wip'])return'retail';if(b['compensation_lock_duration']>0x7)return'rental';if(reviewTotal(a)>0x32)return'retail';if(totalNodes(a)>0xa)return'education';return'freelance';}export{CUSTOMER_INTELLIGENCE_VERSION};
1
+ import{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';const hasRefundPath=a=>a['workflow_analysis']?.['has_refund_path']??![],hasArbitrationPath=a=>a['workflow_analysis']?.['has_arbitration_path']??![],hasMilestoneNodes=a=>a['workflow_analysis']?.['has_milestone_nodes']??![],hasMessenger=a=>a['trust_signals']?.['has_messenger']??![],compensationCoversOrder=a=>a['fund_safety']?.['compensation_covers_order']??![],lockDurationSafe=a=>a['fund_safety']?.['lock_duration_safe']??![],userOperableForwards=a=>a['workflow_analysis']?.['user_operable_forwards']??0x0,wipVerified=a=>a['service_basics']['wip_verified']===!![],hasCompensationFund=a=>a['service_basics']['compensation_fund_balance']>0x0n,deadEndCount=a=>a['workflow_analysis']?.['dead_end_nodes']?.['length']??0x0,trustScore=a=>a['trust_signals']?.['trust_score']??0x0,merchantTotalOrders=a=>a['merchant_behavior']?.['total_orders']??0x0,repeatBuyerRate=a=>a['merchant_behavior']?.['repeat_buyer_rate']??0x0,disputeRate=a=>a['merchant_behavior']?.['dispute_rate']??0x1,INDUSTRY_RISK_CHECKS={'freelance':[{'id':'fr_wip_verified','industry':'freelance','dimension':'trust','description':'WIP\x20hash\x20verified\x20(work\x20traceable)','weight':0x1e,'passed':wipVerified,'advice':'⚠️\x20WIP\x20not\x20verified:\x20freelance\x20deliverables\x20cannot\x20be\x20traced.\x20Recommend\x20asking\x20the\x20merchant\x20to\x20provide\x20a\x20WIP\x20hash\x20and\x20write\x20it\x20into\x20WTS.'},{'id':'fr_milestone_nodes','industry':'freelance','dimension':'workflow','description':'Has\x20milestone\x20nodes\x20(phased\x20acceptance)','weight':0x19,'passed':hasMilestoneNodes,'advice':'⚠️\x20No\x20milestone\x20nodes:\x20delivery\x20is\x20completed\x20in\x20one\x20go\x20without\x20intermediate\x20acceptance.\x20Recommend\x20asking\x20the\x20merchant\x20to\x20add\x20phased\x20delivery\x20nodes.'},{'id':'fr_refund_path','industry':'freelance','dimension':'workflow','description':'Has\x20refund\x20path','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20if\x20freelance\x20order\x20delivery\x20is\x20not\x20satisfactory,\x20funds\x20are\x20hard\x20to\x20recover.'},{'id':'fr_response_time','industry':'freelance','dimension':'trust','description':'Messenger\x20configured\x20(communication\x20response\x20guarantee)','weight':0x14,'passed':hasMessenger,'advice':'⚠️\x20Messenger\x20not\x20configured:\x20cannot\x20conduct\x20requirement\x20confirmation\x20and\x20revision\x20communication.'}],'rental':[{'id':'rt_compensation_full','industry':'rental','dimension':'fund','description':'Compensation\x20fully\x20covers\x20order\x20amount','weight':0x1e,'passed':compensationCoversOrder,'advice':'🔴\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20when\x20rental\x20item\x20is\x20damaged.\x20Recommend\x20choosing\x20a\x20merchant\x20with\x20sufficient\x20compensation\x20fund.'},{'id':'rt_lock_duration','industry':'rental','dimension':'fund','description':'Lock\x20duration\x20safe\x20(compensation\x20cannot\x20be\x20withdrawn\x20by\x20merchant\x20at\x20any\x20time)','weight':0x19,'passed':lockDurationSafe,'advice':'⚠️\x20Lock\x20duration\x20not\x20safe:\x20merchant\x20may\x20withdraw\x20compensation\x20at\x20any\x20time,\x20deposit\x20safety\x20not\x20guaranteed.'},{'id':'rt_arbitration','industry':'rental','dimension':'workflow','description':'Arbitration\x20configured\x20(damage\x20dispute\x20resolution)','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20third-party\x20ruling\x20channel\x20for\x20rental\x20damage\x20disputes.'},{'id':'rt_user_operable','industry':'rental','dimension':'workflow','description':'Has\x20user-operable\x20path\x20(return/confirm)','weight':0x14,'passed':a=>userOperableForwards(a)>0x0,'advice':'🔴\x20No\x20user-operable\x20path:\x20return\x20process\x20relies\x20entirely\x20on\x20merchant,\x20may\x20be\x20maliciously\x20delayed.'}],'education':[{'id':'ed_refund_path','industry':'education','dimension':'workflow','description':'Has\x20refund\x20path\x20(refund\x20guarantee)','weight':0x1e,'passed':hasRefundPath,'advice':'🔴\x20No\x20refund\x20path:\x20course\x20refund\x20not\x20guaranteed,\x20recommend\x20asking\x20the\x20merchant\x20to\x20configure\x20a\x20refund\x20Allocator.'},{'id':'ed_compensation','industry':'education','dimension':'fund','description':'Has\x20compensation\x20fund','weight':0x19,'passed':hasCompensationFund,'advice':'⚠️\x20No\x20compensation\x20fund:\x20no\x20automatic\x20compensation\x20source\x20when\x20course\x20service\x20quality\x20is\x20not\x20up\x20to\x20standard.'},{'id':'ed_arbitration','industry':'education','dimension':'workflow','description':'Arbitration\x20configured','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20resolution\x20channel\x20for\x20course\x20quality\x20disputes.'},{'id':'ed_long_cycle_ok','industry':'education','dimension':'workflow','description':'Long\x20cycle\x20acceptable\x20(education\x20industry\x20allows\x20long\x20cycles,\x20over\x2090\x20days\x20needs\x20attention)','weight':0x14,'passed':()=>!![],'advice':'ℹ️\x20Long\x20delivery\x20cycles\x20are\x20normal\x20in\x20education,\x20but\x20if\x20the\x20actual\x20cycle\x20exceeds\x2090\x20days,\x20recommend\x20periodically\x20checking\x20learning\x20progress\x20and\x20lesson\x20consumption.'}],'travel':[{'id':'tr_urgent_delivery','industry':'travel','dimension':'workflow','description':'Urgent\x20delivery\x20configuration\x20(needs\x20milestone\x20nodes\x20for\x20phased\x20acceptance)','weight':0x1e,'passed':hasMilestoneNodes,'advice':'⚠️\x20No\x20milestone\x20nodes:\x20travel\x20itinerary\x20has\x20no\x20phased\x20acceptance,\x20recommend\x20setting\x20nodes\x20by\x20itinerary\x20stage.'},{'id':'tr_compensation_full','industry':'travel','dimension':'fund','description':'Compensation\x20fully\x20covers\x20(breach\x20compensation)','weight':0x19,'passed':compensationCoversOrder,'advice':'🔴\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20when\x20itinerary\x20breaches.'},{'id':'tr_refund_path','industry':'travel','dimension':'workflow','description':'Has\x20refund\x20path\x20(itinerary\x20change/cancellation)','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20funds\x20hard\x20to\x20recover\x20when\x20itinerary\x20changes\x20or\x20cancels\x20due\x20to\x20force\x20majeure.'},{'id':'tr_messenger','industry':'travel','dimension':'trust','description':'Messenger\x20configured\x20(emergency\x20communication)','weight':0x14,'passed':hasMessenger,'advice':'⚠️\x20Messenger\x20not\x20configured:\x20cannot\x20immediately\x20contact\x20merchant\x20during\x20travel\x20emergencies.'}],'subscription':[{'id':'sub_no_lockin','industry':'subscription','dimension':'workflow','description':'No\x20long-term\x20lock-in\x20(no\x20dead-end\x20nodes,\x20can\x20exit)','weight':0x1e,'passed':a=>deadEndCount(a)===0x0,'advice':'🔴\x20Dead-end\x20nodes\x20exist:\x20subscription\x20may\x20be\x20locked\x20and\x20unable\x20to\x20exit,\x20auto-renewal\x20trap\x20exists.'},{'id':'sub_refund_path','industry':'subscription','dimension':'workflow','description':'Has\x20refund\x20path\x20(exit\x20mechanism)','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20remaining\x20cycle\x20fees\x20hard\x20to\x20recover\x20after\x20subscription\x20exit.'},{'id':'sub_user_operable','industry':'subscription','dimension':'workflow','description':'Has\x20user-operable\x20path\x20(pause/downgrade/cancel)','weight':0x19,'passed':a=>userOperableForwards(a)>0x0,'advice':'🔴\x20No\x20user-operable\x20path:\x20subscription\x20status\x20entirely\x20controlled\x20by\x20merchant,\x20cannot\x20pause\x20or\x20cancel\x20independently.'},{'id':'sub_compensation_optional','industry':'subscription','dimension':'fund','description':'Compensation\x20optional\x20(not\x20mandatory\x20for\x20subscription\x20industry)','weight':0x14,'passed':()=>!![],'advice':'ℹ️\x20Compensation\x20is\x20not\x20mandatory\x20for\x20subscription\x20industry;\x20having\x20it\x20is\x20better.'}],'retail':[{'id':'ret_wip_verified','industry':'retail','dimension':'trust','description':'WIP\x20verified\x20(authenticity/logistics\x20traceable)','weight':0x19,'passed':wipVerified,'advice':'⚠️\x20WIP\x20not\x20verified:\x20product\x20traceability\x20info\x20missing,\x20recommend\x20confirming\x20authenticity\x20guarantee.'},{'id':'ret_compensation_full','industry':'retail','dimension':'fund','description':'Compensation\x20fully\x20covers','weight':0x19,'passed':compensationCoversOrder,'advice':'⚠️\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20return/exchange\x20disputes.'},{'id':'ret_refund_path','industry':'retail','dimension':'workflow','description':'Has\x20refund\x20path\x20(return/exchange)','weight':0x19,'passed':hasRefundPath,'advice':'🔴\x20No\x20refund\x20path:\x20return/exchange\x20not\x20guaranteed.'},{'id':'ret_arbitration','industry':'retail','dimension':'workflow','description':'Arbitration\x20configured','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20third-party\x20ruling\x20for\x20return/exchange\x20disputes.'}]};function commonNeeds(){return[{'id':'need_arbitration','tier':'common','description':'Arbitration\x20configured\x20(dispute\x20resolution\x20channel)','satisfied':hasArbitrationPath,'advice':'Arbitration\x20not\x20configured:\x20no\x20third-party\x20resolution\x20channel\x20for\x20disputes.'},{'id':'need_refund_path','tier':'common','description':'Has\x20refund\x20path','satisfied':hasRefundPath,'advice':'No\x20refund\x20path:\x20funds\x20hard\x20to\x20recover\x20when\x20delivery\x20fails.'},{'id':'need_user_operable','tier':'common','description':'Has\x20user-operable\x20Forward','satisfied':a=>userOperableForwards(a)>0x0,'advice':'No\x20user-operable\x20steps\x20in\x20workflow,\x20order\x20progress\x20depends\x20entirely\x20on\x20merchant.'},{'id':'need_messenger','tier':'common','description':'Messenger\x20configured','satisfied':hasMessenger,'advice':'Merchant\x20has\x20no\x20Messenger\x20channel,\x20cannot\x20negotiate\x20or\x20conduct\x20after-sales\x20communication.'}];}const INDUSTRY_NEEDS={'freelance':[...commonNeeds(),{'id':'need_wip_verified','tier':'personalized','description':'WIP\x20verified\x20(work\x20IP\x20traceable)','satisfied':wipVerified,'advice':'WIP\x20not\x20verified:\x20IP\x20ownership\x20and\x20originality\x20of\x20work\x20cannot\x20be\x20traced.'},{'id':'need_milestone_nodes','tier':'personalized','description':'Milestone\x20nodes\x20(phased\x20feedback)','satisfied':hasMilestoneNodes,'advice':'No\x20milestone\x20nodes:\x20lack\x20of\x20phased\x20feedback\x20and\x20revision\x20round\x20control.'},{'id':'need_merchant_history','tier':'advanced','description':'Merchant\x20history\x20≥3\x20orders\x20(fulfillment\x20experience)','satisfied':a=>merchantTotalOrders(a)>=0x3,'advice':'Merchant\x20history\x20orders\x20less\x20than\x203:\x20fulfillment\x20experience\x20is\x20limited.'}],'rental':[...commonNeeds(),{'id':'need_lock_duration_safe','tier':'personalized','description':'Lock\x20duration\x20safe\x20(deposit\x20cannot\x20be\x20withdrawn)','satisfied':lockDurationSafe,'advice':'Lock\x20duration\x20not\x20safe:\x20deposit\x20may\x20be\x20withdrawn\x20by\x20merchant\x20at\x20any\x20time.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20rental\x20item\x20damage.'},{'id':'need_merchant_history','tier':'advanced','description':'Merchant\x20history\x20≥5\x20orders\x20(rental\x20experience)','satisfied':a=>merchantTotalOrders(a)>=0x5,'advice':'Merchant\x20history\x20orders\x20less\x20than\x205:\x20rental\x20service\x20experience\x20limited.'}],'education':[...commonNeeds(),{'id':'need_has_compensation','tier':'personalized','description':'Has\x20compensation\x20fund\x20(course\x20quality\x20guarantee)','satisfied':hasCompensationFund,'advice':'No\x20compensation\x20fund:\x20no\x20compensation\x20source\x20when\x20course\x20quality\x20is\x20not\x20up\x20to\x20standard.'},{'id':'need_long_cycle_ok','tier':'personalized','description':'Long\x20cycle\x20acceptable','satisfied':()=>!![],'advice':'Long\x20cycles\x20are\x20normal\x20in\x20education;\x20recommend\x20tracking\x20lesson\x20consumption\x20and\x20attendance.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20course\x20reputation\x20may\x20be\x20poor.'}],'travel':[...commonNeeds(),{'id':'need_urgent_delivery','tier':'personalized','description':'Urgent\x20delivery\x20configuration\x20(milestone\x20phasing)','satisfied':hasMilestoneNodes,'advice':'No\x20milestone\x20nodes:\x20itinerary\x20has\x20no\x20phased\x20acceptance,\x20urgent\x20delivery\x20guarantee\x20insufficient.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers\x20(breach\x20compensation)','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20itinerary\x20breach.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20travel\x20service\x20reputation\x20may\x20be\x20poor.'}],'subscription':[...commonNeeds(),{'id':'need_no_lockin','tier':'personalized','description':'No\x20long-term\x20lock-in\x20(no\x20dead-end\x20nodes)','satisfied':a=>deadEndCount(a)===0x0,'advice':'Dead-end\x20nodes\x20exist:\x20subscription\x20may\x20be\x20locked,\x20auto-renewal\x20trap\x20exists.'},{'id':'need_low_dispute','tier':'personalized','description':'Low\x20dispute\x20rate\x20(≤15%,\x20stable\x20content\x20quality)','satisfied':a=>disputeRate(a)<=0.15,'advice':'Dispute\x20rate\x20is\x20high:\x20subscription\x20content\x20quality\x20may\x20be\x20unstable.'},{'id':'need_repeat_rate','tier':'advanced','description':'Repeat\x20buyer\x20rate\x20≥20%\x20(strong\x20subscription\x20renewal\x20willingness)','satisfied':a=>repeatBuyerRate(a)>=0.2,'advice':'Repeat\x20buyer\x20rate\x20below\x2020%:\x20subscription\x20renewal\x20willingness\x20is\x20weak,\x20service\x20may\x20not\x20be\x20worth\x20long-term\x20subscription.'}],'retail':[...commonNeeds(),{'id':'need_wip_verified','tier':'personalized','description':'WIP\x20verified\x20(authenticity/logistics\x20traceability)','satisfied':wipVerified,'advice':'WIP\x20not\x20verified:\x20product\x20authenticity\x20and\x20logistics\x20traceability\x20info\x20missing.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20return/exchange\x20disputes.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20product\x20or\x20service\x20reputation\x20may\x20be\x20poor.'}]};let _registryLookup=null;export function _setRegistryLookup(a){_registryLookup=a;}export function getIndustryRiskChecks(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['risk_checks'])return b['risk_checks'];}return INDUSTRY_RISK_CHECKS[a];}export function getIndustryNeeds(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['needs'])return b['needs'];}return INDUSTRY_NEEDS[a];}export{CUSTOMER_INTELLIGENCE_VERSION};
@@ -1,4 +1,3 @@
1
- export type PuzzleDepth = "browse" | "evaluate" | "preorder" | "monitor";
2
1
  export interface ServiceBasics {
3
2
  service_id: string;
4
3
  name: string;
@@ -82,131 +81,16 @@ export interface MerchantBehavior {
82
81
  like_ratio: number;
83
82
  };
84
83
  }
85
- export interface MarketContext {
86
- similar_services_count: number;
87
- avg_price: bigint;
88
- min_price: bigint;
89
- max_price: bigint;
90
- price_percentile: number;
91
- supply_demand_ratio: number;
92
- }
93
- export type UserMetricEvaluatorType = "threshold" | "ratio" | "boolean" | "presence" | "regex_match" | "custom_query";
94
- export interface UserMetric {
95
- name: string;
96
- label: string;
97
- evaluator: UserMetricEvaluatorType;
98
- params: {
99
- path?: string;
100
- threshold?: number | string;
101
- invert?: boolean;
102
- min?: number;
103
- max?: number;
104
- pattern?: string;
105
- query_key?: string;
106
- };
107
- weight: number;
108
- advice_on_fail?: string;
109
- advice_on_pass?: string;
110
- }
111
- export interface UserMetricsConfig {
112
- version: number;
113
- source_file?: string;
114
- metrics: UserMetric[];
115
- adjustment_cap?: number;
116
- }
117
- export interface UserMetricResult {
118
- name: string;
119
- label: string;
120
- passed: boolean;
121
- score: number;
122
- observed_value?: string | number | boolean;
123
- weight: number;
124
- advice?: string;
125
- }
126
- export interface UserMetricsResult {
127
- metrics: UserMetricResult[];
128
- score: number;
129
- adjustment: number;
130
- source_file?: string;
131
- evaluated_at: number;
132
- }
133
- export interface ServiceNestingEvaluation {
134
- depth_reached: number;
135
- truncated: boolean;
136
- bindings: {
137
- machine?: {
138
- object_id: string;
139
- published: boolean;
140
- risk_level: "low" | "medium" | "high" | "critical";
141
- issues: string[];
142
- };
143
- arbitrations: Array<{
144
- object_id: string;
145
- voting_guard_count: number;
146
- fee_balance: string;
147
- paused: boolean;
148
- risk_level: "low" | "medium" | "high" | "critical";
149
- issues: string[];
150
- }>;
151
- rewards: Array<{
152
- object_id: string;
153
- balance: string;
154
- guard_count: number;
155
- risk_level: "low" | "medium" | "high" | "critical";
156
- issues: string[];
157
- }>;
158
- repositories: Array<{
159
- object_id: string;
160
- risk_level: "low" | "medium" | "high" | "critical";
161
- issues: string[];
162
- }>;
163
- };
164
- overall_risk_level: "low" | "medium" | "high" | "critical";
165
- overall_risk_score: number;
166
- total_bindings_evaluated: number;
167
- evaluated_at: number;
168
- }
169
- export interface InfoPuzzle {
84
+ export interface IndustryServicePuzzle {
170
85
  service_id: string;
171
86
  service_basics: ServiceBasics;
172
87
  workflow_analysis?: WorkflowAnalysis;
173
88
  fund_safety?: FundSafety;
174
89
  trust_signals?: TrustSignals;
175
90
  merchant_behavior?: MerchantBehavior;
176
- market_context?: MarketContext;
177
- user_metrics?: UserMetricsResult;
178
- service_nesting?: ServiceNestingEvaluation;
179
- completeness: number;
180
- gaps: string[];
181
- assembled_at: number;
182
91
  }
183
92
  export type RiskDimensionName = "workflow" | "fund" | "trust" | "behavior";
184
- export interface RiskCheck {
185
- id: string;
186
- dimension: RiskDimensionName;
187
- description: string;
188
- weight: number;
189
- passed: boolean;
190
- advice?: string;
191
- }
192
- export interface RiskDimensionScore {
193
- name: RiskDimensionName;
194
- score: number;
195
- max_score: number;
196
- checks: RiskCheck[];
197
- }
198
93
  export type RiskLevel = "low" | "medium_low" | "medium_high" | "high";
199
- export interface RiskScore {
200
- total: number;
201
- base_total: number;
202
- level: RiskLevel;
203
- dimensions: RiskDimensionScore[];
204
- user_metrics_adjustment?: number;
205
- service_nesting_risk?: number;
206
- service_nesting_level?: "low" | "medium" | "high" | "critical";
207
- red_flags: string[];
208
- advice: string[];
209
- }
210
94
  export interface UserPreferences {
211
95
  price_sensitivity: "low" | "medium" | "high";
212
96
  budget_range?: {
@@ -237,52 +121,4 @@ export interface UserPreferences {
237
121
  preferred_tokens: string[];
238
122
  preferred_merchants: string[];
239
123
  }
240
- export type ReminderPriority = "required" | "recommended" | "info" | "reminder";
241
- export interface Reminder {
242
- id: string;
243
- stage: "browse" | "evaluate" | "preorder" | "in_progress" | "complete" | "after_sale";
244
- priority: ReminderPriority;
245
- message: string;
246
- action?: string;
247
- }
248
- export type GameScenario = "info_asymmetry" | "fund_safety" | "refund_dispute" | "arbitration_fairness" | "pricing" | "delivery_sla" | "quality_verification" | "after_sales";
249
- export interface GameStrategy {
250
- scenario: GameScenario;
251
- merchant_tactic: string;
252
- user_strategy: string;
253
- nash_equilibrium: string;
254
- }
255
- export interface CustomerAdvice {
256
- risk_score?: number;
257
- risk_level?: RiskLevel;
258
- recommendations: string[];
259
- reminders: Reminder[];
260
- preference_match?: {
261
- score: number;
262
- matches: string[];
263
- mismatches: string[];
264
- };
265
- }
266
124
  export declare const CUSTOMER_INTELLIGENCE_VERSION = 1;
267
- export declare const RISK_LEVELS: readonly [{
268
- readonly min: 85;
269
- readonly level: "low";
270
- readonly label: "Low risk";
271
- readonly color: "🟢";
272
- }, {
273
- readonly min: 70;
274
- readonly level: "medium_low";
275
- readonly label: "Medium-low risk";
276
- readonly color: "🟡";
277
- }, {
278
- readonly min: 50;
279
- readonly level: "medium_high";
280
- readonly label: "Medium-high risk";
281
- readonly color: "🟠";
282
- }, {
283
- readonly min: 0;
284
- readonly level: "high";
285
- readonly label: "High risk";
286
- readonly color: "🔴";
287
- }];
288
- export declare const RISK_DIMENSION_MAX: Record<RiskDimensionName, number>;
@@ -1 +1 @@
1
- export const CUSTOMER_INTELLIGENCE_VERSION=0x1;export const RISK_LEVELS=[{'min':0x55,'level':'low','label':'Low\x20risk','color':'🟢'},{'min':0x46,'level':'medium_low','label':'Medium-low\x20risk','color':'🟡'},{'min':0x32,'level':'medium_high','label':'Medium-high\x20risk','color':'🟠'},{'min':0x0,'level':'high','label':'High\x20risk','color':'🔴'}];export const RISK_DIMENSION_MAX={'workflow':0x23,'fund':0x19,'trust':0x14,'behavior':0x14};
1
+ export const CUSTOMER_INTELLIGENCE_VERSION=0x1;
@@ -16,55 +16,6 @@ export declare function _setRegistryLookup(fn: ((industry: string) => {
16
16
  preference_template?: IndustryTemplate;
17
17
  } | undefined) | null): void;
18
18
  export declare function getIndustryTemplate(industry: Industry): IndustryTemplate;
19
- export interface OrderHistoryEntry {
20
- service_id: string;
21
- service_owner?: string;
22
- industry?: string;
23
- price: bigint;
24
- avg_market_price: bigint;
25
- used_discount: boolean;
26
- used_referral: boolean;
27
- has_arbitration: boolean;
28
- has_compensation: boolean;
29
- risk_score_at_purchase?: number;
30
- used_messenger: boolean;
31
- messenger_messages?: number;
32
- completed: boolean;
33
- has_dispute: boolean;
34
- timestamp: number;
35
- }
36
- export interface PreferenceInference {
37
- preferences: UserPreferences;
38
- confidence: Record<keyof UserPreferences, number>;
39
- signals: string[];
40
- }
41
- export declare function inferPreferences(history: OrderHistoryEntry[], basePrefs?: UserPreferences): PreferenceInference;
42
- export interface ServiceForMatching {
43
- service_id: string;
44
- price: bigint;
45
- token_type: string;
46
- avg_market_price?: bigint;
47
- estimated_cycle_days?: number;
48
- estimated_response_hours?: number;
49
- merchant_region?: string;
50
- merchant_order_history_count: number;
51
- merchant_age: "established" | "emerging" | "unknown";
52
- has_arbitration: boolean;
53
- has_compensation_fund: boolean;
54
- has_reward_activity: boolean;
55
- has_discount: boolean;
56
- risk_score: number;
57
- trust_score: number;
58
- requires_messenger: boolean;
59
- after_sales_support_level: "full" | "basic" | "minimal";
60
- }
61
- export interface PreferenceMatchResult {
62
- score: number;
63
- matches: string[];
64
- mismatches: string[];
65
- warnings: string[];
66
- }
67
- export declare function matchServiceToPreferences(service: ServiceForMatching, prefs: UserPreferences): PreferenceMatchResult;
68
19
  export declare function mergePreferences(inferred: UserPreferences, manual: Partial<UserPreferences>): UserPreferences;
69
20
  export declare function validatePreferences(prefs: UserPreferences): string[];
70
21
  export { CUSTOMER_INTELLIGENCE_VERSION };
@@ -1 +1 @@
1
- import{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';export const SUPPORTED_INDUSTRIES=['freelance','rental','education','travel','subscription','retail'];const INDUSTRY_TEMPLATES={'freelance':{'max_acceptable_cycle':0x1e,'response_time_expectation':0x4,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'balanced','delivery_speed_priority':'normal','after_sales_expectation':'full'},'rental':{'max_acceptable_cycle':0x7,'response_time_expectation':0x8,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'normal','after_sales_expectation':'full'},'education':{'max_acceptable_cycle':0x5a,'response_time_expectation':0x18,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'flexible','after_sales_expectation':'full'},'travel':{'max_acceptable_cycle':0xe,'response_time_expectation':0x2,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'urgent','after_sales_expectation':'full'},'subscription':{'max_acceptable_cycle':0x1e,'response_time_expectation':0x18,'require_arbitration':![],'require_compensation_fund':![],'risk_appetite':'aggressive','delivery_speed_priority':'normal','after_sales_expectation':'basic'},'retail':{'max_acceptable_cycle':0x7,'response_time_expectation':0x8,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'balanced','delivery_speed_priority':'normal','after_sales_expectation':'full'}},BASE_DEFAULTS={'price_sensitivity':'medium','value_orientation':'balanced','discount_sensitivity':0.3,'delivery_speed_priority':'normal','max_acceptable_cycle':0xe,'response_time_expectation':0x8,'merchant_preference':'neutral','min_order_history':0x3,'bargain_hunting':0.3,'reward_seeking':![],'referral_participation':![],'communication_style':'friendly','transparency_demand':0.5,'after_sales_expectation':'basic','risk_appetite':'balanced','min_trust_score':0x32,'require_arbitration':!![],'require_compensation_fund':!![],'preferred_industries':[],'preferred_tokens':['0x2::wow::WOW'],'preferred_merchants':[]};export function getDefaultPreferences(a){if(!a||!INDUSTRY_TEMPLATES[a])return{...BASE_DEFAULTS};const b=INDUSTRY_TEMPLATES[a];return{...BASE_DEFAULTS,'max_acceptable_cycle':b['max_acceptable_cycle'],'response_time_expectation':b['response_time_expectation'],'require_arbitration':b['require_arbitration'],'require_compensation_fund':b['require_compensation_fund'],'risk_appetite':b['risk_appetite'],'delivery_speed_priority':b['delivery_speed_priority'],'after_sales_expectation':b['after_sales_expectation']};}let _registryLookup=null;export function _setRegistryLookup(a){_registryLookup=a;}export function getIndustryTemplate(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['preference_template'])return{...b['preference_template']};}return{...INDUSTRY_TEMPLATES[a]};}export function inferPreferences(a,b){const c={...b??getDefaultPreferences()},d={},e=[];if(a['length']<0x3)return e['push']('history='+a['length']+'\x20<\x203,\x20keeping\x20default\x20preferences'),{'preferences':c,'confidence':d,'signals':e};const f=a['filter'](r=>r['avg_market_price']>0x0n&&r['price']<r['avg_market_price']*0x5an/0x64n);if(f['length']>=0x3)c['price_sensitivity']='high',c['value_orientation']='budget',d['price_sensitivity']=0.8,d['value_orientation']=0.7,e['push']('Consecutive\x20'+f['length']+'\x20picks\x20of\x20Service\x20priced\x2010%+\x20below\x20average\x20→\x20price_sensitivity=high');else f['length']>=0x1&&(c['price_sensitivity']='medium',d['price_sensitivity']=0.5,e['push'](f['length']+'\x20low-price\x20picks\x20→\x20price_sensitivity=medium'));const g=a['filter'](r=>r['used_discount']);g['length']>=0x2&&(c['discount_sensitivity']=0.8,d['discount_sensitivity']=0.85,e['push']('Used\x20discount\x20'+g['length']+'\x20times\x20→\x20discount_sensitivity=0.8'));a['some'](r=>r['used_referral'])&&(c['referral_participation']=!![],d['referral_participation']=0x1,e['push']('Has\x20used\x20a\x20referral\x20code\x20→\x20referral_participation=true'));(g['length']>=0x2||a['some'](r=>r['used_referral']))&&(c['reward_seeking']=!![],d['reward_seeking']=0.75,e['push']('Reward\x20behavior\x20detected\x20→\x20reward_seeking=true'));const i=g['length']+(a['some'](r=>r['used_referral'])?0x1:0x0);if(i>=0x3)c['bargain_hunting']=0.8,d['bargain_hunting']=0.8;else i>=0x1&&(c['bargain_hunting']=0.5,d['bargain_hunting']=0.6);const j=new Map();for(const r of a){r['industry']&&j['set'](r['industry'],(j['get'](r['industry'])??0x0)+0x1);}const k=Array['from'](j['entries']())['filter'](([,s])=>s>=0x1)['sort']((s,t)=>t[0x1]-s[0x1])['slice'](0x0,0x3)['map'](([s])=>s);k['length']>0x0&&(c['preferred_industries']=k,d['preferred_industries']=Math['min'](0x1,(j['get'](k[0x0])??0x0)/0x5),e['push']('Preferred\x20industries:\x20'+k['join'](',\x20')));const l=a['filter'](s=>s['has_arbitration']);if(l['length']>=0x3&&l['length']===a['length'])c['require_arbitration']=!![],d['require_arbitration']=0.85,e['push']('100%\x20of\x20historical\x20orders\x20picked\x20Services\x20with\x20arbitration\x20→\x20require_arbitration=true\x20(confirmed)');else l['length']<a['length']/0x2&&(c['require_arbitration']=![],d['require_arbitration']=0.5,e['push'](l['length']+'/'+a['length']+'\x20orders\x20had\x20arbitration\x20→\x20require_arbitration=false'));const m=a['filter'](s=>s['has_compensation']);if(m['length']>=0x3&&m['length']===a['length'])c['require_compensation_fund']=!![],d['require_compensation_fund']=0.85,e['push']('100%\x20of\x20historical\x20orders\x20had\x20compensation\x20fund\x20→\x20require_compensation_fund=true\x20(confirmed)');else m['length']<a['length']/0x2&&(c['require_compensation_fund']=![],d['require_compensation_fund']=0.5);const n=a['map'](s=>s['risk_score_at_purchase'])['filter'](t=>typeof t==='number');if(n['length']>=0x5){const s=Math['min'](...n);if(s>=0x46)c['risk_appetite']='conservative',c['min_trust_score']=0x46,d['risk_appetite']=0.8,d['min_trust_score']=0.7,e['push']('Lowest\x20risk\x20score\x20in\x20history\x20'+s+'\x20≥\x2070\x20→\x20risk_appetite=conservative');else s<0x32&&(c['risk_appetite']='aggressive',c['min_trust_score']=Math['max'](0x0,s-0xa),d['risk_appetite']=0.7,e['push']('Lowest\x20risk\x20score\x20in\x20history\x20'+s+'\x20<\x2050\x20→\x20risk_appetite=aggressive'));}const o=a['filter'](t=>t['used_messenger']);if(o['length']>=0x2){const t=o['reduce']((u,v)=>u+(v['messenger_messages']??0x0),0x0)/o['length'];if(t>=0xa)c['communication_style']='formal',d['communication_style']=0.6,e['push']('Average\x20'+t['toFixed'](0x1)+'\x20Messenger\x20messages\x20→\x20communication_style=formal');else t<=0x3&&(c['communication_style']='casual',d['communication_style']=0.5,e['push']('Average\x20'+t['toFixed'](0x1)+'\x20Messenger\x20messages\x20→\x20communication_style=casual'));c['transparency_demand']=Math['min'](0x1,t/0x14),d['transparency_demand']=0.6;}const p=a['filter'](u=>u['has_dispute'])['length'];p>0x0&&(c['transparency_demand']=Math['max'](c['transparency_demand'],0.7),c['after_sales_expectation']='full',d['transparency_demand']=Math['max'](d['transparency_demand']??0x0,0.7),d['after_sales_expectation']=0.7,e['push'](p+'\x20disputes\x20→\x20transparency_demand\x20increased,\x20after_sales=full'));const q=new Map();for(const u of a){u['service_owner']&&q['set'](u['service_owner'],(q['get'](u['service_owner'])??0x0)+0x1);}return c['preferred_merchants']=Array['from'](q['entries']())['filter'](([,v])=>v>=0x2)['sort']((v,w)=>w[0x1]-v[0x1])['slice'](0x0,0x5)['map'](([v])=>v),c['preferred_merchants']['length']>0x0&&(d['preferred_merchants']=0.8,e['push']('Patronized\x20'+c['preferred_merchants']['length']+'\x20merchants\x20≥2\x20times')),{'preferences':c,'confidence':d,'signals':e};}export function matchServiceToPreferences(a,b){const c=[],d=[],e=[];let f=0x0,g=0x0;g+=0x19;if(b['budget_range']){if(a['price']>=b['budget_range']['min']&&a['price']<=b['budget_range']['max'])f+=0x14,c['push']('Price\x20within\x20budget\x20range');else a['price']<b['budget_range']['min']?(f+=0xf,c['push']('Price\x20below\x20budget\x20minimum')):d['push']('Price\x20exceeds\x20budget\x20maximum');}else{if(a['avg_market_price']&&a['avg_market_price']>0x0n){const k=Number(a['price']*0x64n/a['avg_market_price'])/0x64;if(b['price_sensitivity']==='high'){if(k<=0.9)f+=0x19,c['push']('Price\x20is\x20'+((0x1-k)*0x64|0x0)+'%\x20below\x20average\x20(bonus\x20for\x20high-sensitivity\x20user)');else k<=1.1?(f+=0xf,c['push']('Price\x20on\x20par\x20with\x20average')):d['push']('Price\x20is\x20'+((k-0x1)*0x64|0x0)+'%\x20above\x20average\x20(high-sensitivity\x20user)');}else{if(b['price_sensitivity']==='low')f+=0x14,c['push']('Low\x20price\x20sensitivity');else{if(k<=0x1)f+=0x14,c['push']('Price\x20not\x20above\x20average');else k<=1.2?f+=0xc:d['push']('Price\x20significantly\x20above\x20average');}}}else f+=0xc;}g+=0xf;const h=a['estimated_cycle_days']??0x0;if(h>0x0){if(h<=b['max_acceptable_cycle']){f+=0xa,c['push']('Delivery\x20cycle\x20'+h+'\x20days\x20≤\x20expected\x20'+b['max_acceptable_cycle']+'\x20days');if(b['delivery_speed_priority']==='urgent'&&h<=Math['max'](0x1,b['max_acceptable_cycle']/0x3))f+=0x5,c['push']('Urgent\x20delivery\x20need\x20satisfied');else b['delivery_speed_priority']==='urgent'&&e['push']('Urgent\x20delivery\x20need\x20but\x20cycle\x20is\x20long');}else d['push']('Delivery\x20cycle\x20'+h+'\x20days\x20>\x20expected\x20'+b['max_acceptable_cycle']+'\x20days');}else f+=0x7;g+=0xa;if(b['preferred_region']){if(a['merchant_region']&&a['merchant_region']===b['preferred_region'])f+=0xa,c['push']('Merchant\x20region\x20'+a['merchant_region']+'\x20matches\x20preference');else a['merchant_region']?d['push']('Merchant\x20region\x20'+a['merchant_region']+'\x20does\x20not\x20match\x20preference\x20'+b['preferred_region']):f+=0x5;}else f+=0x7;g+=0xa;a['merchant_order_history_count']>=b['min_order_history']?(f+=0x7,c['push']('Merchant\x20history\x20'+a['merchant_order_history_count']+'\x20orders\x20≥\x20required\x20'+b['min_order_history']+'\x20orders')):d['push']('Merchant\x20history\x20'+a['merchant_order_history_count']+'\x20orders\x20<\x20required\x20'+b['min_order_history']+'\x20orders');if(b['merchant_preference']!=='neutral'){if(a['merchant_age']===b['merchant_preference'])f+=0x3,c['push']('Merchant\x20type\x20'+a['merchant_age']+'\x20matches\x20preference');else a['merchant_age']!=='unknown'&&d['push']('Merchant\x20type\x20'+a['merchant_age']+'\x20≠\x20preference\x20'+b['merchant_preference']);}else f+=0x3;g+=0xf;let i=0x0;a['has_reward_activity']&&(i+=0x8,c['push']('Has\x20Reward\x20activity'));a['has_discount']&&(i+=0x7,c['push']('Has\x20discount'));if(b['bargain_hunting']>=0.7&&i===0x0)d['push']('User\x20has\x20high\x20bargain_hunting\x20but\x20no\x20Reward/discount');else{if(b['bargain_hunting']<0.3){if(i===0x0)i=0xa;else i=Math['min'](i,0x5);}else b['bargain_hunting']<0.7&&i===0x0&&(i=0x5);}f+=i,g+=0xa;if(a['after_sales_support_level']===b['after_sales_expectation'])f+=0x5,c['push']('After-sales\x20support\x20'+a['after_sales_support_level']+'\x20matches\x20expectation');else b['after_sales_expectation']==='full'&&a['after_sales_support_level']==='basic'||b['after_sales_expectation']==='full'&&a['after_sales_support_level']==='minimal'||b['after_sales_expectation']==='basic'&&a['after_sales_support_level']==='minimal'?d['push']('After-sales\x20support\x20'+a['after_sales_support_level']+'\x20<\x20expectation\x20'+b['after_sales_expectation']):f+=0x3;if(b['transparency_demand']>=0.7&&a['requires_messenger'])f+=0x5,c['push']('Merchant\x20supports\x20Messenger\x20communication\x20(high\x20transparency\x20demand)');else b['transparency_demand']>=0.7&&!a['requires_messenger']?d['push']('High\x20transparency\x20demand\x20but\x20merchant\x20has\x20no\x20Messenger'):f+=0x3;g+=0xf;a['risk_score']>=b['min_trust_score']?(f+=0x8,c['push']('Risk\x20score\x20'+a['risk_score']+'\x20≥\x20required\x20'+b['min_trust_score'])):d['push']('Risk\x20score\x20'+a['risk_score']+'\x20<\x20required\x20'+b['min_trust_score']);b['require_arbitration']?a['has_arbitration']?(f+=0x4,c['push']('Arbitration\x20configured')):(d['push']('User\x20requires\x20arbitration\x20but\x20Service\x20is\x20not\x20configured'),e['push']('⚠️\x20No\x20arbitration:\x20user\x20preference\x20requires\x20arbitration\x20as\x20mandatory')):f+=0x4;b['require_compensation_fund']?a['has_compensation_fund']?(f+=0x3,c['push']('Has\x20compensation\x20fund')):(d['push']('User\x20requires\x20compensation\x20fund\x20but\x20Service\x20has\x20none'),e['push']('⚠️\x20No\x20compensation\x20fund:\x20user\x20preference\x20requires\x20it\x20as\x20mandatory')):f+=0x3;const j=g>0x0?Math['round'](f/g*0x64):0x0;return{'score':j,'matches':c,'mismatches':d,'warnings':e};}export function mergePreferences(a,b){return{...a,...b};}export function validatePreferences(a){const b=[];return a['budget_range']&&a['budget_range']['min']>a['budget_range']['max']&&b['push']('budget_range.min\x20>\x20budget_range.max'),(a['discount_sensitivity']<0x0||a['discount_sensitivity']>0x1)&&b['push']('discount_sensitivity\x20must\x20be\x20in\x20[0,1]'),(a['bargain_hunting']<0x0||a['bargain_hunting']>0x1)&&b['push']('bargain_hunting\x20must\x20be\x20in\x20[0,1]'),(a['transparency_demand']<0x0||a['transparency_demand']>0x1)&&b['push']('transparency_demand\x20must\x20be\x20in\x20[0,1]'),(a['min_trust_score']<0x0||a['min_trust_score']>0x64)&&b['push']('min_trust_score\x20must\x20be\x20in\x20[0,100]'),a['max_acceptable_cycle']<0x0&&b['push']('max_acceptable_cycle\x20must\x20be\x20≥\x200'),a['response_time_expectation']<0x0&&b['push']('response_time_expectation\x20must\x20be\x20≥\x200'),b;}export{CUSTOMER_INTELLIGENCE_VERSION};
1
+ import{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';export const SUPPORTED_INDUSTRIES=['freelance','rental','education','travel','subscription','retail'];const INDUSTRY_TEMPLATES={'freelance':{'max_acceptable_cycle':0x1e,'response_time_expectation':0x4,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'balanced','delivery_speed_priority':'normal','after_sales_expectation':'full'},'rental':{'max_acceptable_cycle':0x7,'response_time_expectation':0x8,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'normal','after_sales_expectation':'full'},'education':{'max_acceptable_cycle':0x5a,'response_time_expectation':0x18,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'flexible','after_sales_expectation':'full'},'travel':{'max_acceptable_cycle':0xe,'response_time_expectation':0x2,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'urgent','after_sales_expectation':'full'},'subscription':{'max_acceptable_cycle':0x1e,'response_time_expectation':0x18,'require_arbitration':![],'require_compensation_fund':![],'risk_appetite':'aggressive','delivery_speed_priority':'normal','after_sales_expectation':'basic'},'retail':{'max_acceptable_cycle':0x7,'response_time_expectation':0x8,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'balanced','delivery_speed_priority':'normal','after_sales_expectation':'full'}},BASE_DEFAULTS={'price_sensitivity':'medium','value_orientation':'balanced','discount_sensitivity':0.3,'delivery_speed_priority':'normal','max_acceptable_cycle':0xe,'response_time_expectation':0x8,'merchant_preference':'neutral','min_order_history':0x3,'bargain_hunting':0.3,'reward_seeking':![],'referral_participation':![],'communication_style':'friendly','transparency_demand':0.5,'after_sales_expectation':'basic','risk_appetite':'balanced','min_trust_score':0x32,'require_arbitration':!![],'require_compensation_fund':!![],'preferred_industries':[],'preferred_tokens':['0x2::wow::WOW'],'preferred_merchants':[]};export function getDefaultPreferences(a){if(!a||!INDUSTRY_TEMPLATES[a])return{...BASE_DEFAULTS};const b=INDUSTRY_TEMPLATES[a];return{...BASE_DEFAULTS,'max_acceptable_cycle':b['max_acceptable_cycle'],'response_time_expectation':b['response_time_expectation'],'require_arbitration':b['require_arbitration'],'require_compensation_fund':b['require_compensation_fund'],'risk_appetite':b['risk_appetite'],'delivery_speed_priority':b['delivery_speed_priority'],'after_sales_expectation':b['after_sales_expectation']};}let _registryLookup=null;export function _setRegistryLookup(a){_registryLookup=a;}export function getIndustryTemplate(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['preference_template'])return{...b['preference_template']};}return{...INDUSTRY_TEMPLATES[a]};}export function mergePreferences(a,b){return{...a,...b};}export function validatePreferences(a){const b=[];return a['budget_range']&&a['budget_range']['min']>a['budget_range']['max']&&b['push']('budget_range.min\x20>\x20budget_range.max'),(a['discount_sensitivity']<0x0||a['discount_sensitivity']>0x1)&&b['push']('discount_sensitivity\x20must\x20be\x20in\x20[0,1]'),(a['bargain_hunting']<0x0||a['bargain_hunting']>0x1)&&b['push']('bargain_hunting\x20must\x20be\x20in\x20[0,1]'),(a['transparency_demand']<0x0||a['transparency_demand']>0x1)&&b['push']('transparency_demand\x20must\x20be\x20in\x20[0,1]'),(a['min_trust_score']<0x0||a['min_trust_score']>0x64)&&b['push']('min_trust_score\x20must\x20be\x20in\x20[0,100]'),a['max_acceptable_cycle']<0x0&&b['push']('max_acceptable_cycle\x20must\x20be\x20≥\x200'),a['response_time_expectation']<0x0&&b['push']('response_time_expectation\x20must\x20be\x20≥\x200'),b;}export{CUSTOMER_INTELLIGENCE_VERSION};
@@ -1 +1 @@
1
- import{appetiteMultiplier}from'./game-strategy.js';const ARB_ROLE_INTERESTS={'arbitrator':{'prefer':['case_advanced','fees_received','case_closed'],'avoid':['case_extended'],'sensitivity':0x1},'customer':{'prefer':['reversal_chance','case_closed'],'avoid':['adverse_ruling','case_extended'],'sensitivity':0x1},'merchant':{'prefer':['case_closed','fees_received'],'avoid':['adverse_ruling','reversal_chance','case_extended'],'sensitivity':0x1}},ARB_MOVE_SEMANTICS={'Principal_confirming':[{'action':'principal_confirm','perspective':'customer','gain':['case_advanced'],'risk':[],'payoff':'confirm\x20the\x20proposition\x20to\x20move\x20to\x20arbitrator\x20confirmation','base_risk':'low'},{'action':'proposition_change','perspective':'customer','gain':[],'risk':['case_extended'],'payoff':'modify\x20the\x20proposition\x20before\x20confirming\x20(extends\x20the\x20case)','base_risk':'medium'}],'Arbitrator_confirming':[{'action':'confirm','perspective':'arbitrator','gain':['case_advanced'],'risk':[],'payoff':'confirm\x20to\x20open\x20voting','base_risk':'low'},{'action':'reset','perspective':'arbitrator','gain':[],'risk':['case_extended'],'payoff':'reset\x20back\x20to\x20principal\x20confirmation\x20(extends\x20the\x20case)','base_risk':'high'}],'Voting':[{'action':'vote','perspective':'arbitrator','gain':['case_advanced'],'risk':[],'payoff':'vote\x20before\x20the\x20deadline','base_risk':'low'}],'Arbitrated':[{'action':'objection','perspective':'customer','gain':['reversal_chance'],'risk':[],'payoff':'object\x20the\x20ruling\x20(only\x20window\x20to\x20overturn)','base_risk':'medium'},{'action':'accept','perspective':'customer','gain':['case_closed'],'risk':['adverse_ruling'],'payoff':'accept\x20and\x20await\x20compensation','base_risk':'low'}],'Objectionable':[{'action':'reset','perspective':'arbitrator','gain':['case_advanced'],'risk':['case_extended'],'payoff':'reset\x20to\x20re-review\x20(extends\x20the\x20case)','base_risk':'medium'}],'Finished':[{'action':'arb_withdraw','perspective':'all','gain':['fees_received','case_closed'],'risk':[],'payoff':'withdraw\x20fees\x20/\x20compensation','base_risk':'low'}],'Withdrawn':[{'action':'done','perspective':'all','gain':['case_closed'],'risk':[],'payoff':'case\x20closed','base_risk':'low'}]};function dedupe(a){return Array['from'](new Set(a));}function resolveArbInterests(a,b){const c=ARB_ROLE_INTERESTS[a],d=c['sensitivity']*appetiteMultiplier(b?.['risk_appetite']),e=[...c['prefer']],f=[...c['avoid']];for(const g of b?.['requirements']??[]){const h=g['toLowerCase'](),i=/forbid|never|\bno\b/['test'](h);if(h['includes']('arbitration')&&i)f['push']('case_extended');if(h['includes']('refund')&&!i)e['push']('reversal_chance');if(h['includes']('prolong')||h['includes']('delay')||h['includes']('拖延'))f['push']('case_extended');}return{'prefer':dedupe(e),'avoid':dedupe(f),'sensitivity':d};}function scoreMove(a,b,c){const d=resolveArbInterests(b,c),e=a['gain']['filter'](j=>d['prefer']['includes'](j)),f=a['risk']['filter'](j=>d['avoid']['includes'](j)),g=e['length']*0x14,h=Math['round'](f['length']*0x19*d['sensitivity']),i=Math['max'](0x0,Math['min'](0x64,0x3c+g-h));return{'favorability':i,'gain_score':g,'risk_score':h};}export function evaluateArbGame(a,b,c){const d=ARB_MOVE_SEMANTICS[a]??[],e=d['filter'](g=>g['perspective']==='all'||g['perspective']===b),f=e['map'](g=>{const h=scoreMove(g,b,c);return{'action':g['action'],'favorability':h['favorability'],'gain_score':h['gain_score'],'risk_score':h['risk_score'],'is_optimal':![],'payoff_note':g['payoff'],'risk':g['base_risk']};})['sort']((g,h)=>h['favorability']-g['favorability']);return f['length']>0x0&&(f[0x0]['is_optimal']=!![]),{'status':a,'perspective':b,'actions':f,'summary':f['length']===0x0?'No\x20recommended\x20moves\x20for\x20'+b+'\x20in\x20status\x20\x27'+a+'\x27':'Optimal\x20for\x20'+b+'\x20in\x20\x27'+a+'\x27:\x20\x27'+f[0x0]['action']+'\x27\x20('+f[0x0]['payoff_note']+')'};}
1
+ import{appetiteMultiplier}from'./game-strategy.js';const ARB_ROLE_INTERESTS={'arbitrator':{'prefer':['case_advanced','fees_received','case_closed'],'avoid':['case_extended'],'sensitivity':0x1},'customer':{'prefer':['reversal_chance','case_closed'],'avoid':['adverse_ruling','case_extended'],'sensitivity':0x1},'merchant':{'prefer':['case_closed','fees_received'],'avoid':['adverse_ruling','reversal_chance','case_extended'],'sensitivity':0x1}},ARB_MOVE_SEMANTICS={'Principal_confirming':[{'action':'principal_confirm','perspective':'customer','gain':['case_advanced'],'risk':[],'payoff':'confirm\x20the\x20proposition\x20to\x20move\x20to\x20arbitrator\x20confirmation','base_risk':'low'},{'action':'proposition_change','perspective':'customer','gain':[],'risk':['case_extended'],'payoff':'modify\x20the\x20proposition\x20before\x20confirming\x20(extends\x20the\x20case)','base_risk':'medium'}],'Arbitrator_confirming':[{'action':'confirm','perspective':'arbitrator','gain':['case_advanced'],'risk':[],'payoff':'confirm\x20to\x20open\x20voting','base_risk':'low'},{'action':'reset','perspective':'arbitrator','gain':[],'risk':['case_extended'],'payoff':'reset\x20back\x20to\x20principal\x20confirmation\x20(extends\x20the\x20case)','base_risk':'high'}],'Voting':[{'action':'vote','perspective':'arbitrator','gain':['case_advanced'],'risk':[],'payoff':'vote\x20before\x20the\x20deadline','base_risk':'low'}],'Arbitrated':[{'action':'objection','perspective':'customer','gain':['reversal_chance'],'risk':[],'payoff':'object\x20the\x20ruling\x20(only\x20window\x20to\x20overturn)','base_risk':'medium'},{'action':'accept','perspective':'customer','gain':['case_closed'],'risk':['adverse_ruling'],'payoff':'accept\x20and\x20await\x20compensation','base_risk':'low'}],'Objectionable':[{'action':'reset','perspective':'arbitrator','gain':['case_advanced'],'risk':['case_extended'],'payoff':'reset\x20to\x20re-review\x20(extends\x20the\x20case)','base_risk':'medium'}],'Finished':[{'action':'arb_withdraw','perspective':'all','gain':['fees_received','case_closed'],'risk':[],'payoff':'withdraw\x20fees\x20/\x20compensation','base_risk':'low'}],'Withdrawn':[{'action':'done','perspective':'all','gain':['case_closed'],'risk':[],'payoff':'case\x20closed','base_risk':'low'}]};function dedupe(a){return Array['from'](new Set(a));}function resolveArbInterests(a,b){const c=ARB_ROLE_INTERESTS[a],d=c['sensitivity']*appetiteMultiplier(b?.['risk_appetite']),e=[...c['prefer']],f=[...c['avoid']];for(const g of b?.['requirements']??[]){const h=g['toLowerCase'](),i=/forbid|never|\bno\b/['test'](h);if(h['includes']('arbitration')&&i)f['push']('case_extended');if(h['includes']('refund')&&!i)e['push']('reversal_chance');if(h['includes']('prolong')||h['includes']('delay'))f['push']('case_extended');}return{'prefer':dedupe(e),'avoid':dedupe(f),'sensitivity':d};}function scoreMove(a,b,c){const d=resolveArbInterests(b,c),e=a['gain']['filter'](j=>d['prefer']['includes'](j)),f=a['risk']['filter'](j=>d['avoid']['includes'](j)),g=e['length']*0x14,h=Math['round'](f['length']*0x19*d['sensitivity']),i=Math['max'](0x0,Math['min'](0x64,0x3c+g-h));return{'favorability':i,'gain_score':g,'risk_score':h};}export function evaluateArbGame(a,b,c){const d=ARB_MOVE_SEMANTICS[a]??[],e=d['filter'](g=>g['perspective']==='all'||g['perspective']===b),f=e['map'](g=>{const h=scoreMove(g,b,c);return{'action':g['action'],'favorability':h['favorability'],'gain_score':h['gain_score'],'risk_score':h['risk_score'],'is_optimal':![],'payoff_note':g['payoff'],'risk':g['base_risk']};})['sort']((g,h)=>h['favorability']-g['favorability']);return f['length']>0x0&&(f[0x0]['is_optimal']=!![]),{'status':a,'perspective':b,'actions':f,'summary':f['length']===0x0?'No\x20recommended\x20moves\x20for\x20'+b+'\x20in\x20status\x20\x27'+a+'\x27':'Optimal\x20for\x20'+b+'\x20in\x20\x27'+a+'\x27:\x20\x27'+f[0x0]['action']+'\x27\x20('+f[0x0]['payoff_note']+')'};}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import{describe,expect,it}from'vitest';import{dirname,join}from'node:path';import{fileURLToPath}from'node:url';import{ENTRYPOINT}from'@wowok/wowok';import{FakeDataPlane}from'../graph/onchain/dataplane.js';import{expandTopology}from'../graph/onchain/expand.js';import{FULL,fullServiceState}from'../graph/onchain/fixtures.js';import{buildViewport}from'../graph/onchain/viewport.js';import{runAnalyzers}from'../graph/onchain/analyze.js';import{RETENTION_RANK}from'../graph/onchain/analyze.js';import{EVALUATION_SERVICE_INTENTS,resolveExpansionStrategy,withEvaluationBundle}from'../graph/onchain/strategy.js';import{projectEvaluationFacts}from'../graph/onchain/facts.js';import{registerGraphServiceEvaluations}from'./builtins/graph-service.js';import{importSourcesOf,listRuntimeSources,namedSdkImportsOf,onchainIoCalls,SDK_CONSTANT_ALLOWLIST}from'./guard-scan.js';const EVAL_DIR=dirname(fileURLToPath(import.meta.url)),GRAPH_ONCHAIN_DIR=join(EVAL_DIR,'..','graph','onchain'),DATA_PLANE_IMPLS=new Set(['sdk-dataplane.ts','sdk-batch.ts']),CONFIDENCES=new Set(['exact','bounded','windowed','derived']);describe('Task\x2017\x20engine\x20purity\x20architecture\x20guard\x20(TR-17.1)',()=>{it('(a)\x20evaluation/\x20runtime\x20files:\x20relative\x20imports\x20only,\x20no\x20chain-IO\x20entry',async()=>{const a=await import('../playbooks/service-build/topology-query.js');expect(typeof a['evaluateServiceFromGraph'])['toBe']('function');const b=listRuntimeSources(EVAL_DIR);expect(b['length'])['toBeGreaterThan'](0x0);for(const {file:c,text:d}of b){for(const e of importSourcesOf(d)){if(e['startsWith']('.'))continue;if(e['startsWith']('node:'))continue;if(e==='@wowok/wowok'){const f=namedSdkImportsOf(d)['filter'](g=>!SDK_CONSTANT_ALLOWLIST['has'](g));expect(f,c+'\x20imports\x20non-constant\x20SDK\x20symbols:\x20'+f['join'](',\x20'))['toEqual']([]);continue;}throw new Error(c+'\x20imports\x20non-relative\x20module\x20\x22'+e+'\x22\x20—\x20evaluation\x20must\x20stay\x20pure');}expect(onchainIoCalls(d),c+'\x20performs\x20chain\x20IO')['toEqual']([]);}}),it('(b)\x20every\x20projected\x20Fact\x20carries\x20provenance\x20(path/retention/confidence)',async()=>{registerGraphServiceEvaluations();const a=withEvaluationBundle(resolveExpansionStrategy({'intents':[...EVALUATION_SERVICE_INTENTS]})),b=await expandTopology(new FakeDataPlane(fullServiceState()),{'network':ENTRYPOINT['Mainnet'],'seed':FULL['svc'],'budget':a['budget'],'edges':a['edges']}),c=buildViewport(b,FULL['svc'],'neutral'),d=projectEvaluationFacts(c,FULL['svc'],runAnalyzers(c));expect(d['facts']['length'])['toBeGreaterThan'](0x0);for(const e of d['facts']){const f=e['provenance'];expect(f,e['dimension']+'/'+e['key']+'\x20has\x20no\x20provenance')['toBeDefined'](),expect(Array['isArray'](f['path'])&&f['path']['length']>0x0,e['dimension']+'/'+e['key']+'\x20provenance.path\x20empty')['toBe'](!![]),expect(f['path']['every'](g=>typeof g==='string'&&g!==''),e['dimension']+'/'+e['key']+'\x20provenance.path\x20has\x20non-string\x20segments')['toBe'](!![]),expect(RETENTION_RANK[f['retention']],e['dimension']+'/'+e['key']+'\x20unknown\x20retention\x20'+f['retention'])['toBeDefined'](),expect(CONFIDENCES['has'](f['confidence']),e['dimension']+'/'+e['key']+'\x20unknown\x20confidence\x20'+f['confidence'])['toBe'](!![]);}for(const g of d['slots']){expect(typeof g['slot'])['toBe']('string'),expect(['present','empty','gap'])['toContain'](g['state']);}}),it('(c)\x20graph/onchain\x20chain\x20IO\x20lives\x20only\x20in\x20the\x20DataPlane\x20implementations',()=>{const a=listRuntimeSources(GRAPH_ONCHAIN_DIR);expect(a['length'])['toBeGreaterThan'](0x0);const b=a['filter'](({file:c,text:d})=>!DATA_PLANE_IMPLS['has'](c)&&onchainIoCalls(d)['length']>0x0)['map'](({file:c})=>c);expect(b,'evaluation\x20fetch\x20path\x20leaked\x20outside\x20the\x20DataPlane\x20implementations:\x20'+b['join'](',\x20'))['toEqual']([]);}),it('red-light:\x20the\x20scanners\x20flag\x20violation\x20samples',()=>{expect(onchainIoCalls('const\x20p\x20=\x20new\x20SdkDataPlane(net);\x20await\x20query_table({...});'))['toEqual'](expect['arrayContaining'](['SdkDataPlane\x20construction','SDK\x20query\x20call'])),expect(onchainIoCalls('const\x20names\x20=\x20await\x20LocalMark.Instance().get_many_address(x);'))['toEqual'](expect['arrayContaining'](['LocalMark\x20store\x20access'])),expect(namedSdkImportsOf('import\x20{\x20LocalMark\x20}\x20from\x20\x22@wowok/wowok\x22;'))['toEqual'](['LocalMark']),expect(onchainIoCalls('//\x20pulled\x20by\x20the\x20handler\x20via\x20query_arbs\x0aexport\x20const\x20K\x20=\x201;'))['toEqual']([]);});});
@@ -0,0 +1,16 @@
1
+ import { type CoverageSlot, type CoverageVocabulary, type GraphEvaluationFacts } from "../../graph/onchain/facts.js";
2
+ import type { EvaluationResult, UserInjection } from "../types.js";
3
+ export declare const GRAPH_TRUST_EVALUATION = "graph_service_trust";
4
+ export declare const GRAPH_RISK_EVALUATION = "graph_service_risk";
5
+ export declare const GRAPH_RULE_INPUT_FACTS: Readonly<Record<string, readonly string[]>>;
6
+ export declare function registerGraphServiceEvaluations(engine?: import("../engine.js").EvaluationEngine): void;
7
+ export interface GraphServiceEvaluation {
8
+ target: string;
9
+ trust: EvaluationResult;
10
+ risk: EvaluationResult;
11
+ completeness: number;
12
+ coverage: CoverageSlot[];
13
+ unverified: string[];
14
+ vocabulary: CoverageVocabulary;
15
+ }
16
+ export declare function evaluateGraphServiceFacts(projected: GraphEvaluationFacts, injection?: UserInjection): Promise<GraphServiceEvaluation>;