@wowok/agent-mcp 2.7.0 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/customer-advice.js +1 -130
  4. package/dist/customer/index.js +1 -11
  5. package/dist/customer/industry-risks.js +1 -438
  6. package/dist/customer/info-puzzle.js +1 -681
  7. package/dist/customer/order-monitor.js +1 -328
  8. package/dist/customer/order-strategy.js +1 -373
  9. package/dist/customer/post-purchase.js +1 -351
  10. package/dist/customer/preorder-compare.js +1 -34
  11. package/dist/customer/reminder-system.js +1 -316
  12. package/dist/customer/risk-assessment.d.ts +5 -1
  13. package/dist/customer/risk-assessment.js +1 -397
  14. package/dist/customer/types.js +1 -13
  15. package/dist/customer/user-preferences.js +1 -460
  16. package/dist/evaluation/arbitration-game.d.ts +23 -0
  17. package/dist/evaluation/arbitration-game.js +1 -0
  18. package/dist/evaluation/builtins/demand-match.d.ts +15 -0
  19. package/dist/evaluation/builtins/demand-match.js +1 -0
  20. package/dist/evaluation/builtins/index.d.ts +3 -0
  21. package/dist/evaluation/builtins/index.js +1 -0
  22. package/dist/evaluation/builtins/service-risk.d.ts +6 -0
  23. package/dist/evaluation/builtins/service-risk.js +1 -0
  24. package/dist/evaluation/capability.d.ts +50 -0
  25. package/dist/evaluation/capability.js +1 -0
  26. package/dist/evaluation/composer.d.ts +13 -0
  27. package/dist/evaluation/composer.js +1 -0
  28. package/dist/evaluation/engine.d.ts +18 -0
  29. package/dist/evaluation/engine.js +1 -0
  30. package/dist/evaluation/extract.d.ts +30 -0
  31. package/dist/evaluation/extract.js +1 -0
  32. package/dist/evaluation/game-strategy.d.ts +27 -0
  33. package/dist/evaluation/game-strategy.js +1 -0
  34. package/dist/evaluation/gap.d.ts +2 -0
  35. package/dist/evaluation/gap.js +1 -0
  36. package/dist/evaluation/index.d.ts +12 -0
  37. package/dist/evaluation/index.js +1 -0
  38. package/dist/evaluation/node-game.d.ts +62 -0
  39. package/dist/evaluation/node-game.js +1 -0
  40. package/dist/evaluation/region.d.ts +10 -0
  41. package/dist/evaluation/region.js +1 -0
  42. package/dist/evaluation/types.d.ts +77 -0
  43. package/dist/evaluation/types.js +1 -0
  44. package/dist/evaluation/user-injection.d.ts +6 -0
  45. package/dist/evaluation/user-injection.js +1 -0
  46. package/dist/examples/education-contact-create.json +40 -0
  47. package/dist/examples/freelance-contact-create.json +40 -0
  48. package/dist/examples/insurance-machine-create.json +1 -1
  49. package/dist/examples/insurance-service-allocators.json +1 -1
  50. package/dist/examples/machine-publish.json +1 -1
  51. package/dist/examples/rental-ziroom-service-create.json +1 -1
  52. package/dist/examples/retail-adv-guard-messenger-proof-create.json +1 -1
  53. package/dist/examples/retail-myshop-service-create.json +1 -1
  54. package/dist/examples/retail-myshop-service-customer-required.json +1 -1
  55. package/dist/examples/subscription-contact-create.json +40 -0
  56. package/dist/examples/threebody-machine-create.json +1 -1
  57. package/dist/examples/travel-machine-create.json +1 -1
  58. package/dist/examples/travel-service-create.json +1 -1
  59. package/dist/experience/experience-reuse.js +1 -103
  60. package/dist/experience/index.js +1 -5
  61. package/dist/experience/intent-distill.js +1 -83
  62. package/dist/experience/realtime-feedback.js +1 -94
  63. package/dist/experience/types.js +1 -1
  64. package/dist/experience/user-profile.js +1 -171
  65. package/dist/extensions/business-modules.js +1 -287
  66. package/dist/extensions/capability-manifest.js +1 -781
  67. package/dist/extensions/constraint-registry.js +1 -198
  68. package/dist/extensions/index.js +1 -6
  69. package/dist/extensions/metric-registry.js +1 -257
  70. package/dist/extensions/mode-evaluator.js +1 -170
  71. package/dist/extensions/modes.js +1 -499
  72. package/dist/extensions/registry.js +1 -717
  73. package/dist/extensions/types.js +1 -1
  74. package/dist/harness/auto-escalation.js +1 -68
  75. package/dist/harness/checkpoint.js +1 -129
  76. package/dist/harness/index.js +1 -78
  77. package/dist/harness/plan.js +1 -276
  78. package/dist/harness/recover.js +1 -139
  79. package/dist/harness/types.js +1 -1
  80. package/dist/harness/verify.js +1 -237
  81. package/dist/index.js +1 -273
  82. package/dist/intent/enrich.d.ts +1 -0
  83. package/dist/intent/enrich.js +1 -0
  84. package/dist/intent/index.d.ts +23 -0
  85. package/dist/intent/index.js +1 -0
  86. package/dist/intent/matcher.d.ts +2 -0
  87. package/dist/intent/matcher.js +1 -0
  88. package/dist/intent/store.d.ts +19 -0
  89. package/dist/intent/store.js +1 -0
  90. package/dist/intent/types.d.ts +33 -0
  91. package/dist/intent/types.js +1 -0
  92. package/dist/knowledge/acquisition-flywheel.js +1 -192
  93. package/dist/knowledge/allocation-confirm.js +1 -534
  94. package/dist/knowledge/allocation-context.js +1 -249
  95. package/dist/knowledge/allocation-ledger.js +1 -463
  96. package/dist/knowledge/allocation-puzzle.js +1 -298
  97. package/dist/knowledge/allocation-risk.js +1 -568
  98. package/dist/knowledge/allocation-templates.js +1 -970
  99. package/dist/knowledge/allocation-translation.js +1 -585
  100. package/dist/knowledge/arb-risk.js +1 -210
  101. package/dist/knowledge/arbitration-confirm.js +1 -559
  102. package/dist/knowledge/arbitration-context.js +1 -505
  103. package/dist/knowledge/arbitration-ledger.js +1 -521
  104. package/dist/knowledge/arbitration-puzzle.js +1 -304
  105. package/dist/knowledge/arbitration-risk.js +1 -433
  106. package/dist/knowledge/arbitration-templates.js +1 -276
  107. package/dist/knowledge/arbitration-translation.js +1 -487
  108. package/dist/knowledge/arbitration-trust.js +1 -117
  109. package/dist/knowledge/audit-rules.js +1 -141
  110. package/dist/knowledge/bridge-risk.js +1 -263
  111. package/dist/knowledge/contact-risk.js +1 -200
  112. package/dist/knowledge/contact-templates.d.ts +27 -0
  113. package/dist/knowledge/contact-templates.js +1 -0
  114. package/dist/knowledge/demand-confirm.js +1 -206
  115. package/dist/knowledge/demand-matching.js +1 -132
  116. package/dist/knowledge/demand-risk.js +1 -240
  117. package/dist/knowledge/demand-translation.js +1 -354
  118. package/dist/knowledge/deployment-scanner.js +1 -823
  119. package/dist/knowledge/dynamic-pricing.js +1 -87
  120. package/dist/knowledge/examples-scanner-cli.js +1 -26
  121. package/dist/knowledge/examples-scanner.js +1 -825
  122. package/dist/knowledge/flywheel-loop.js +1 -404
  123. package/dist/knowledge/fund-layer.js +1 -973
  124. package/dist/knowledge/glossary.js +1 -211
  125. package/dist/knowledge/guard-confirm.js +1 -406
  126. package/dist/knowledge/guard-context.js +1 -287
  127. package/dist/knowledge/guard-design-patterns.js +1 -360
  128. package/dist/knowledge/guard-ledger.js +1 -260
  129. package/dist/knowledge/guard-lint.js +1 -670
  130. package/dist/knowledge/guard-migration.js +1 -228
  131. package/dist/knowledge/guard-puzzle.js +1 -805
  132. package/dist/knowledge/guard-render.js +1 -700
  133. package/dist/knowledge/guard-risk.js +1 -1879
  134. package/dist/knowledge/guard-submission-prompt.js +1 -171
  135. package/dist/knowledge/guard-templates.js +1 -1105
  136. package/dist/knowledge/guard-translation.js +1 -1119
  137. package/dist/knowledge/index.js +1 -436
  138. package/dist/knowledge/industry-evolution.js +1 -323
  139. package/dist/knowledge/industry-generalizer.js +1 -381
  140. package/dist/knowledge/industry-registry.js +1 -174
  141. package/dist/knowledge/intent-metrics.d.ts +4 -3
  142. package/dist/knowledge/intent-metrics.js +1 -566
  143. package/dist/knowledge/machine-confirm.js +1 -559
  144. package/dist/knowledge/machine-context.js +1 -833
  145. package/dist/knowledge/machine-ledger.js +1 -338
  146. package/dist/knowledge/machine-puzzle.js +1 -494
  147. package/dist/knowledge/machine-render.js +1 -565
  148. package/dist/knowledge/machine-risk.js +1 -670
  149. package/dist/knowledge/machine-templates.js +1 -1597
  150. package/dist/knowledge/machine-topology.js +1 -234
  151. package/dist/knowledge/machine-translation.js +1 -513
  152. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  153. package/dist/knowledge/mcp-schema-audit.d.ts +1 -1
  154. package/dist/knowledge/mcp-schema-audit.js +1 -773
  155. package/dist/knowledge/onchain-constants.js +1 -35
  156. package/dist/knowledge/order-confirm.js +1 -573
  157. package/dist/knowledge/order-context.js +1 -390
  158. package/dist/knowledge/order-ledger.js +1 -341
  159. package/dist/knowledge/order-puzzle.js +1 -255
  160. package/dist/knowledge/order-risk.js +1 -653
  161. package/dist/knowledge/order-templates.js +1 -368
  162. package/dist/knowledge/order-translation.js +1 -550
  163. package/dist/knowledge/overrides-loader.js +1 -65
  164. package/dist/knowledge/passport-confirm.js +1 -531
  165. package/dist/knowledge/passport-context.js +1 -306
  166. package/dist/knowledge/passport-ledger.js +1 -282
  167. package/dist/knowledge/passport-puzzle.js +1 -333
  168. package/dist/knowledge/passport-risk.js +1 -450
  169. package/dist/knowledge/passport-templates.js +1 -568
  170. package/dist/knowledge/passport-translation.js +1 -516
  171. package/dist/knowledge/payment-risk.js +1 -249
  172. package/dist/knowledge/permission-confirm.js +1 -426
  173. package/dist/knowledge/permission-context.js +1 -224
  174. package/dist/knowledge/permission-ledger.js +1 -403
  175. package/dist/knowledge/permission-puzzle.js +1 -173
  176. package/dist/knowledge/permission-risk.js +1 -411
  177. package/dist/knowledge/permission-templates.js +1 -234
  178. package/dist/knowledge/permission-translation.js +1 -350
  179. package/dist/knowledge/personal-risk.js +1 -212
  180. package/dist/knowledge/process-model.js +1 -160
  181. package/dist/knowledge/progress-confirm.js +1 -456
  182. package/dist/knowledge/progress-context.js +1 -452
  183. package/dist/knowledge/progress-ledger.js +1 -330
  184. package/dist/knowledge/progress-puzzle.js +1 -219
  185. package/dist/knowledge/progress-risk.js +1 -461
  186. package/dist/knowledge/progress-templates.js +1 -228
  187. package/dist/knowledge/progress-translation.js +1 -405
  188. package/dist/knowledge/proof-confirm.js +1 -187
  189. package/dist/knowledge/proof-risk.js +1 -207
  190. package/dist/knowledge/proof-translation.js +1 -283
  191. package/dist/knowledge/registrar-risk.js +1 -217
  192. package/dist/knowledge/repository-confirm.js +1 -286
  193. package/dist/knowledge/repository-risk.js +1 -373
  194. package/dist/knowledge/repository-translation.js +1 -445
  195. package/dist/knowledge/reputation-rules.js +1 -99
  196. package/dist/knowledge/resource-risk.js +1 -157
  197. package/dist/knowledge/reward-confirm.js +1 -526
  198. package/dist/knowledge/reward-context.js +1 -504
  199. package/dist/knowledge/reward-ledger.js +1 -502
  200. package/dist/knowledge/reward-puzzle.js +1 -300
  201. package/dist/knowledge/reward-risk.js +1 -627
  202. package/dist/knowledge/reward-templates.js +1 -197
  203. package/dist/knowledge/reward-translation.js +1 -501
  204. package/dist/knowledge/safety-rules.js +1 -404
  205. package/dist/knowledge/scenario-modes.js +1 -321
  206. package/dist/knowledge/service-confirm.js +1 -807
  207. package/dist/knowledge/service-context.js +1 -403
  208. package/dist/knowledge/service-ledger.js +1 -609
  209. package/dist/knowledge/service-puzzle.js +1 -236
  210. package/dist/knowledge/service-risk.js +1 -615
  211. package/dist/knowledge/service-templates.js +1 -456
  212. package/dist/knowledge/service-translation.js +1 -622
  213. package/dist/knowledge/template-registry.d.ts +1 -1
  214. package/dist/knowledge/template-registry.js +1 -341
  215. package/dist/knowledge/tool-constraints.js +1 -195
  216. package/dist/knowledge/tools-reference.js +1 -155
  217. package/dist/knowledge/treasury-confirm.js +1 -512
  218. package/dist/knowledge/treasury-context.js +1 -363
  219. package/dist/knowledge/treasury-ledger.js +1 -300
  220. package/dist/knowledge/treasury-puzzle.js +1 -216
  221. package/dist/knowledge/treasury-risk.js +1 -440
  222. package/dist/knowledge/treasury-templates.js +1 -358
  223. package/dist/knowledge/treasury-translation.js +1 -498
  224. package/dist/knowledge/trust-metrics.js +1 -198
  225. package/dist/knowledge/util-risk.js +1 -135
  226. package/dist/loop-engineering/aggregate.js +1 -132
  227. package/dist/loop-engineering/context-collect.js +1 -83
  228. package/dist/loop-engineering/diagnose.js +1 -273
  229. package/dist/loop-engineering/improve.js +1 -405
  230. package/dist/loop-engineering/index.js +1 -4
  231. package/dist/loop-engineering/pipeline.js +1 -56
  232. package/dist/mode-market/index.js +1 -3
  233. package/dist/mode-market/registry.js +1 -124
  234. package/dist/mode-market/review.js +1 -214
  235. package/dist/mode-market/submission.js +1 -85
  236. package/dist/participation/collaborator-interest.d.ts +23 -0
  237. package/dist/participation/collaborator-interest.js +1 -0
  238. package/dist/participation/customer-interest.d.ts +25 -0
  239. package/dist/participation/customer-interest.js +1 -0
  240. package/dist/participation/merchant-interest.js +1 -100
  241. package/dist/participation/radar-core.d.ts +13 -3
  242. package/dist/participation/radar-core.js +1 -269
  243. package/dist/participation/supplier-interest.d.ts +25 -0
  244. package/dist/participation/supplier-interest.js +1 -0
  245. package/dist/persona/analyzer.d.ts +16 -0
  246. package/dist/persona/analyzer.js +1 -0
  247. package/dist/persona/bridge.d.ts +5 -0
  248. package/dist/persona/bridge.js +1 -0
  249. package/dist/persona/defaults.d.ts +4 -0
  250. package/dist/persona/defaults.js +1 -0
  251. package/dist/persona/experience-bridge.d.ts +3 -0
  252. package/dist/persona/experience-bridge.js +1 -0
  253. package/dist/persona/index.d.ts +18 -0
  254. package/dist/persona/index.js +1 -0
  255. package/dist/persona/model.d.ts +7 -0
  256. package/dist/persona/model.js +1 -0
  257. package/dist/persona/store.d.ts +19 -0
  258. package/dist/persona/store.js +1 -0
  259. package/dist/persona/types.d.ts +45 -0
  260. package/dist/persona/types.js +1 -0
  261. package/dist/project/business-puzzle.js +1 -383
  262. package/dist/project/context-assembly.js +1 -254
  263. package/dist/project/deployment-bridge.js +1 -120
  264. package/dist/project/deployment-doc.js +1 -1126
  265. package/dist/project/edit-planner.js +1 -1342
  266. package/dist/project/evaluation.js +1 -2011
  267. package/dist/project/game-theory.js +1 -177
  268. package/dist/project/graph-builder.js +1 -656
  269. package/dist/project/graph.js +1 -340
  270. package/dist/project/handlers.d.ts +5 -0
  271. package/dist/project/handlers.js +1 -1762
  272. package/dist/project/index.d.ts +1 -0
  273. package/dist/project/index.js +1 -301
  274. package/dist/project/intent-analyzer.js +1 -149
  275. package/dist/project/machine-nodes.js +1 -36
  276. package/dist/project/merchant-guide.js +1 -264
  277. package/dist/project/migration.js +1 -125
  278. package/dist/project/mode-actions.js +1 -309
  279. package/dist/project/namespace.js +1 -206
  280. package/dist/project/participation-radar.js +1 -428
  281. package/dist/project/pipeline-actions.js +1 -109
  282. package/dist/project/project-store.js +1 -422
  283. package/dist/project/query.js +1 -153
  284. package/dist/project/reverse-mapping.d.ts +34 -0
  285. package/dist/project/reverse-mapping.js +1 -0
  286. package/dist/project/risk-aggregator.js +1 -295
  287. package/dist/project/rollback-policy.js +1 -290
  288. package/dist/project/semantic-assembler.js +1 -345
  289. package/dist/project/semantic-graph.js +1 -245
  290. package/dist/project/stage-gate.js +1 -369
  291. package/dist/project/substep-trace.js +1 -332
  292. package/dist/project/task-tracker.js +1 -78
  293. package/dist/role/derivation.d.ts +18 -0
  294. package/dist/role/derivation.js +1 -0
  295. package/dist/role/index.d.ts +5 -0
  296. package/dist/role/index.js +1 -0
  297. package/dist/role/model.d.ts +8 -0
  298. package/dist/role/model.js +1 -0
  299. package/dist/role/resolution.d.ts +11 -0
  300. package/dist/role/resolution.js +1 -0
  301. package/dist/role/types.d.ts +11 -0
  302. package/dist/role/types.js +1 -0
  303. package/dist/rules.d.ts +2 -0
  304. package/dist/rules.js +1 -9
  305. package/dist/safety/confirm-gate.js +1 -88
  306. package/dist/safety/index.js +1 -3
  307. package/dist/safety/preview.js +1 -52
  308. package/dist/schema/call/allocation.js +1 -34
  309. package/dist/schema/call/arbitration.js +1 -113
  310. package/dist/schema/call/base.d.ts +15 -15
  311. package/dist/schema/call/base.js +1 -370
  312. package/dist/schema/call/bridge-handler.js +1 -265
  313. package/dist/schema/call/bridge.d.ts +7 -7
  314. package/dist/schema/call/bridge.js +1 -458
  315. package/dist/schema/call/contact.js +1 -37
  316. package/dist/schema/call/demand.js +1 -47
  317. package/dist/schema/call/guard.js +1 -161
  318. package/dist/schema/call/handler.js +1 -322
  319. package/dist/schema/call/index.js +1 -20
  320. package/dist/schema/call/machine.js +1 -193
  321. package/dist/schema/call/order.js +1 -35
  322. package/dist/schema/call/payment.js +1 -37
  323. package/dist/schema/call/permission-handler.js +1 -54
  324. package/dist/schema/call/permission.js +1 -105
  325. package/dist/schema/call/personal.js +1 -78
  326. package/dist/schema/call/progress.js +1 -47
  327. package/dist/schema/call/proof.js +1 -33
  328. package/dist/schema/call/repository.js +1 -77
  329. package/dist/schema/call/reward.js +1 -30
  330. package/dist/schema/call/semantic.js +1 -1657
  331. package/dist/schema/call/service.js +1 -178
  332. package/dist/schema/call/treasury.js +1 -71
  333. package/dist/schema/common/index.js +1 -407
  334. package/dist/schema/config/index.js +1 -68
  335. package/dist/schema/evaluation/index.d.ts +4436 -0
  336. package/dist/schema/evaluation/index.js +1 -0
  337. package/dist/schema/index.d.ts +4 -0
  338. package/dist/schema/index.js +1 -13
  339. package/dist/schema/intent-radar/index.d.ts +284 -0
  340. package/dist/schema/intent-radar/index.js +1 -0
  341. package/dist/schema/local/index.d.ts +21 -21
  342. package/dist/schema/local/index.js +1 -927
  343. package/dist/schema/local/wip.js +1 -187
  344. package/dist/schema/messenger/index.d.ts +7 -7
  345. package/dist/schema/messenger/index.js +1 -475
  346. package/dist/schema/operations.d.ts +7 -7
  347. package/dist/schema/operations.js +1 -520
  348. package/dist/schema/persona/index.d.ts +1985 -0
  349. package/dist/schema/persona/index.js +1 -0
  350. package/dist/schema/project/index.d.ts +96 -50
  351. package/dist/schema/project/index.js +1 -2057
  352. package/dist/schema/query/index.d.ts +423 -7
  353. package/dist/schema/query/index.js +1 -1640
  354. package/dist/schema/schema-query/index.js +1 -104
  355. package/dist/schema/schema-version.js +1 -76
  356. package/dist/schema/sync-layer4.d.ts +1 -1
  357. package/dist/schema/sync-layer4.js +1 -282
  358. package/dist/schema/task-status.d.ts +168 -0
  359. package/dist/schema/task-status.js +1 -0
  360. package/dist/schema/trust/index.js +1 -314
  361. package/dist/schema/utils/guard-parser.js +1 -419
  362. package/dist/schema/utils/guard-query-utils.js +1 -46
  363. package/dist/schema/utils/node-parser.js +1 -369
  364. package/dist/schema/utils/object-type-utils.js +1 -35
  365. package/dist/schema/utils/permission-index-utils.js +1 -7
  366. package/dist/schema/utils/permission-machine-check.js +1 -121
  367. package/dist/schema/utils/skills-recommendation.js +1 -77
  368. package/dist/schema-query/index.js +1 -810
  369. package/dist/schemas/account_operation.output.json +5 -2
  370. package/dist/schemas/bridge_operation.output.json +5 -2
  371. package/dist/schemas/evaluation_operation.output.json +782 -0
  372. package/dist/schemas/evaluation_operation.schema.json +990 -0
  373. package/dist/schemas/index.json +25 -1
  374. package/dist/schemas/intent_radar.output.json +232 -0
  375. package/dist/schemas/intent_radar.schema.json +138 -0
  376. package/dist/schemas/local_info_operation.output.json +5 -2
  377. package/dist/schemas/local_mark_operation.output.json +5 -2
  378. package/dist/schemas/messenger_operation.output.json +5 -2
  379. package/dist/schemas/onchain_events.output.json +5 -2
  380. package/dist/schemas/onchain_operations.output.json +5 -2
  381. package/dist/schemas/onchain_operations.schema.json +6 -6
  382. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  383. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  384. package/dist/schemas/onchain_operations_service.schema.json +3 -3
  385. package/dist/schemas/onchain_table_data.output.json +6 -3
  386. package/dist/schemas/persona_operation.output.json +392 -0
  387. package/dist/schemas/persona_operation.schema.json +250 -0
  388. package/dist/schemas/project_operation.output.json +28 -8
  389. package/dist/schemas/query_task_status.output.json +115 -0
  390. package/dist/schemas/query_task_status.schema.json +24 -0
  391. package/dist/schemas/query_toolkit.output.json +9 -6
  392. package/dist/schemas/trust_score.schema.json +1 -1
  393. package/dist/schemas/wowok_buildin_info.output.json +132 -0
  394. package/dist/schemas/wowok_buildin_info.schema.json +14 -0
  395. package/dist/telemetry/index.js +1 -112
  396. package/dist/telemetry/redact.js +1 -23
  397. package/dist/telemetry/storage.js +1 -80
  398. package/dist/tools/handlers/bridge.js +1 -1
  399. package/dist/tools/handlers/config.js +1 -74
  400. package/dist/tools/handlers/evaluation.d.ts +2 -0
  401. package/dist/tools/handlers/evaluation.js +1 -0
  402. package/dist/tools/handlers/file-export.js +1 -90
  403. package/dist/tools/handlers/intent-radar.d.ts +2 -0
  404. package/dist/tools/handlers/intent-radar.js +1 -0
  405. package/dist/tools/handlers/local.js +1 -53
  406. package/dist/tools/handlers/messenger.js +1 -188
  407. package/dist/tools/handlers/onchain.js +1 -1082
  408. package/dist/tools/handlers/persona.d.ts +4 -0
  409. package/dist/tools/handlers/persona.js +1 -0
  410. package/dist/tools/handlers/project.js +1 -211
  411. package/dist/tools/handlers/query.js +1 -434
  412. package/dist/tools/handlers/schema-query.js +1 -176
  413. package/dist/tools/handlers/task-status.d.ts +0 -168
  414. package/dist/tools/handlers/task-status.js +1 -55
  415. package/dist/tools/handlers/trust.js +1 -380
  416. package/dist/tools/handlers/wip.js +1 -90
  417. package/dist/tools/index.js +1 -1306
  418. package/dist/tools/retry.js +1 -85
  419. package/dist/tools/rules-hook.js +1 -23
  420. package/dist/tools/shared.js +1 -130
  421. package/dist/tools/types.js +1 -1
  422. package/dist/tools/upgrade-check.d.ts +19 -0
  423. package/dist/tools/upgrade-check.js +1 -0
  424. package/dist/tools/wip-deploy-assist.d.ts +1 -1
  425. package/dist/tools/wip-deploy-assist.js +1 -278
  426. package/dist/tools/wrap.js +1 -500
  427. package/package.json +5 -3
@@ -1,103 +1 @@
1
- import { extractSignals } from "./intent-distill.js";
2
- const MAX_HISTORY = 200;
3
- const history = [];
4
- export function recordSignature(sig) {
5
- try {
6
- history.push(sig);
7
- if (history.length > MAX_HISTORY) {
8
- history.shift();
9
- }
10
- }
11
- catch {
12
- }
13
- }
14
- export function findMatches(intent, operation_type, data, limit = 3) {
15
- try {
16
- const currentSignals = extractSignals(operation_type, data);
17
- const now = Date.now();
18
- const scored = history
19
- .map((sig) => {
20
- const relevance = computeRelevance(sig, intent, currentSignals, now);
21
- return { signature: sig, relevance };
22
- })
23
- .filter((s) => s.relevance > 0.3)
24
- .sort((a, b) => b.relevance - a.relevance)
25
- .slice(0, limit);
26
- return scored.map((s) => formatMatch(s.signature, s.relevance));
27
- }
28
- catch {
29
- return [];
30
- }
31
- }
32
- function computeRelevance(sig, currentIntent, currentSignals, now) {
33
- let score = 0;
34
- if (sig.intent === currentIntent) {
35
- score += 0.5;
36
- }
37
- else if (sig.intent.startsWith(currentIntent.split("_")[0])) {
38
- score += 0.2;
39
- }
40
- const sigKeys = Object.keys(sig.signals);
41
- if (sigKeys.length > 0) {
42
- const overlap = sigKeys.filter((k) => {
43
- const sigVal = JSON.stringify(sig.signals[k]);
44
- const curVal = JSON.stringify(currentSignals[k]);
45
- return sigVal === curVal;
46
- }).length;
47
- score += (overlap / sigKeys.length) * 0.3;
48
- }
49
- const ageDays = (now - sig.timestamp) / (1000 * 60 * 60 * 24);
50
- const decay = Math.exp(-ageDays / 30);
51
- score *= decay;
52
- return Math.min(1, score);
53
- }
54
- function formatMatch(sig, relevance) {
55
- const advice = buildAdvice(sig);
56
- const avoid = buildAvoid(sig);
57
- return {
58
- signature: sig,
59
- relevance,
60
- advice,
61
- avoid,
62
- };
63
- }
64
- function buildAdvice(sig) {
65
- if (sig.outcome === "success") {
66
- if (sig.recovery_path && sig.recovery_path.length > 0) {
67
- return `Last ${sig.intent} succeeded (after ${sig.recovery_path.length} recovery steps), you can follow the same path.`;
68
- }
69
- return `Last ${sig.intent} succeeded, parameter configuration is valid.`;
70
- }
71
- if (sig.outcome === "failed" && sig.error_code) {
72
- return `Last ${sig.intent} failed (${sig.error_code}), please check the relevant parameters.`;
73
- }
74
- return `Last ${sig.intent} partially succeeded, check result completeness.`;
75
- }
76
- function buildAvoid(sig) {
77
- const avoid = [];
78
- if (sig.outcome !== "success" && sig.error_code) {
79
- avoid.push(`Avoid triggering ${sig.error_code} error`);
80
- }
81
- if (sig.recovery_path && sig.recovery_path.length > 0) {
82
- avoid.push(`Note: last time required ${sig.recovery_path.length} recovery steps to succeed`);
83
- }
84
- return avoid;
85
- }
86
- export function getHistory(intent) {
87
- if (intent) {
88
- return history.filter((h) => h.intent === intent);
89
- }
90
- return [...history];
91
- }
92
- export function clearHistory() {
93
- history.length = 0;
94
- }
95
- export function getHistoryStats() {
96
- const byOutcome = {};
97
- const byIntent = {};
98
- for (const h of history) {
99
- byOutcome[h.outcome] = (byOutcome[h.outcome] ?? 0) + 1;
100
- byIntent[h.intent] = (byIntent[h.intent] ?? 0) + 1;
101
- }
102
- return { total: history.length, by_outcome: byOutcome, by_intent: byIntent };
103
- }
1
+ import{extractSignals}from'./intent-distill.js';const MAX_HISTORY=0xc8,history=[];export function recordSignature(a){try{history['push'](a),history['length']>MAX_HISTORY&&history['shift']();}catch{}}export function findMatches(a,b,c,d=0x3){try{const e=extractSignals(b,c),f=Date['now'](),g=history['map'](h=>{const i=computeRelevance(h,a,e,f);return{'signature':h,'relevance':i};})['filter'](h=>h['relevance']>0.3)['sort']((h,i)=>i['relevance']-h['relevance'])['slice'](0x0,d);return g['map'](h=>formatMatch(h['signature'],h['relevance']));}catch{return[];}}function computeRelevance(a,b,c,d){let e=0x0;if(a['intent']===b)e+=0.5;else a['intent']['startsWith'](b['split']('_')[0x0])&&(e+=0.2);const f=Object['keys'](a['signals']);if(f['length']>0x0){const i=f['filter'](j=>{const l=JSON['stringify'](a['signals'][j]),m=JSON['stringify'](c[j]);return l===m;})['length'];e+=i/f['length']*0.3;}const g=(d-a['timestamp'])/(0x3e8*0x3c*0x3c*0x18),h=Math['exp'](-g/0x1e);return e*=h,Math['min'](0x1,e);}function formatMatch(a,b){const c=buildAdvice(a),d=buildAvoid(a);return{'signature':a,'relevance':b,'advice':c,'avoid':d};}function buildAdvice(a){if(a['outcome']==='success'){if(a['recovery_path']&&a['recovery_path']['length']>0x0)return'Last\x20'+a['intent']+'\x20succeeded\x20(after\x20'+a['recovery_path']['length']+'\x20recovery\x20steps),\x20you\x20can\x20follow\x20the\x20same\x20path.';return'Last\x20'+a['intent']+'\x20succeeded,\x20parameter\x20configuration\x20is\x20valid.';}if(a['outcome']==='failed'&&a['error_code'])return'Last\x20'+a['intent']+'\x20failed\x20('+a['error_code']+'),\x20please\x20check\x20the\x20relevant\x20parameters.';return'Last\x20'+a['intent']+'\x20partially\x20succeeded,\x20check\x20result\x20completeness.';}function buildAvoid(a){const b=[];return a['outcome']!=='success'&&a['error_code']&&b['push']('Avoid\x20triggering\x20'+a['error_code']+'\x20error'),a['recovery_path']&&a['recovery_path']['length']>0x0&&b['push']('Note:\x20last\x20time\x20required\x20'+a['recovery_path']['length']+'\x20recovery\x20steps\x20to\x20succeed'),b;}export function getHistory(a){if(a)return history['filter'](b=>b['intent']===a);return[...history];}export function clearHistory(){history['length']=0x0;}export function getHistoryStats(){const a={},b={};for(const c of history){a[c['outcome']]=(a[c['outcome']]??0x0)+0x1,b[c['intent']]=(b[c['intent']]??0x0)+0x1;}return{'total':history['length'],'by_outcome':a,'by_intent':b};}
@@ -1,5 +1 @@
1
- import { distillIntent, extractSignals, } from "./intent-distill.js";
2
- import { getProfile, updateFromOperation, resetProfile, getProfileStats, } from "./user-profile.js";
3
- import { findMatches, recordSignature, getHistory, clearHistory, getHistoryStats, } from "./experience-reuse.js";
4
- import { getExperienceFeedback, recordOperationOutcome, EXPERIENCE_LAYER_VERSION, } from "./realtime-feedback.js";
5
- export { distillIntent, extractSignals, getProfile, updateFromOperation, resetProfile, getProfileStats, findMatches, recordSignature, getHistory, clearHistory, getHistoryStats, getExperienceFeedback, recordOperationOutcome, EXPERIENCE_LAYER_VERSION, };
1
+ import{distillIntent,extractSignals}from'./intent-distill.js';import{getProfile,updateFromOperation,resetProfile,getProfileStats}from'./user-profile.js';import{findMatches,recordSignature,getHistory,clearHistory,getHistoryStats}from'./experience-reuse.js';import{getExperienceFeedback,recordOperationOutcome,EXPERIENCE_LAYER_VERSION}from'./realtime-feedback.js';export{distillIntent,extractSignals,getProfile,updateFromOperation,resetProfile,getProfileStats,findMatches,recordSignature,getHistory,clearHistory,getHistoryStats,getExperienceFeedback,recordOperationOutcome,EXPERIENCE_LAYER_VERSION};
@@ -1,83 +1 @@
1
- const URGENCY_RULES = [
2
- { operation_type: "payment", urgency: "critical" },
3
- { operation_type: "service", signals: (d) => d?.publish === true, urgency: "critical" },
4
- { operation_type: "arbitration", signals: (d) => d?.arb === true || d?.arb_operation === "raise", urgency: "critical" },
5
- { operation_type: "reward", urgency: "high" },
6
- { operation_type: "allocation", urgency: "high" },
7
- { operation_type: "treasury", urgency: "high" },
8
- { operation_type: "order", urgency: "high" },
9
- { operation_type: "service", urgency: "normal" },
10
- { operation_type: "machine", urgency: "normal" },
11
- { operation_type: "guard", urgency: "normal" },
12
- { operation_type: "permission", urgency: "normal" },
13
- { operation_type: "progress", urgency: "normal" },
14
- { operation_type: "repository", urgency: "normal" },
15
- { operation_type: "personal", urgency: "normal" },
16
- { operation_type: "contact", urgency: "normal" },
17
- { operation_type: "demand", urgency: "normal" },
18
- { operation_type: "query_toolkit", urgency: "low" },
19
- { operation_type: "onchain_events", urgency: "low" },
20
- { operation_type: "onchain_table_data", urgency: "low" },
21
- { operation_type: "account_balance", urgency: "low" },
22
- { operation_type: "mark_query", urgency: "low" },
23
- { operation_type: "local_info", urgency: "low" },
24
- ];
25
- const SCENARIO_RULES = [
26
- { signals: (d) => typeof d?.description === "string" && /freelance|freelancer|design|development|outsourcing/i.test(d.description), scenario: "freelance" },
27
- { signals: (d) => typeof d?.description === "string" && /rental|rent|lease/i.test(d.description), scenario: "rental" },
28
- { signals: (d) => typeof d?.description === "string" && /course|education|training/i.test(d.description), scenario: "education" },
29
- { signals: (d) => typeof d?.description === "string" && /travel|tour|trip/i.test(d.description), scenario: "travel" },
30
- { signals: (d) => typeof d?.description === "string" && /subscri|subscription|membership/i.test(d.description), scenario: "subscription" },
31
- { signals: (d) => typeof d?.namedNew?.name === "string" && /shop|store|retail/i.test(d.namedNew.name), scenario: "retail" },
32
- ];
33
- const SECONDARY_INTENT_RULES = [
34
- { signals: (d) => d?.publish === true, intent: "immutable_commit" },
35
- { signals: (d) => d?.amount?.amount !== undefined && BigInt(d.amount.amount) > 100000000000n, intent: "large_amount" },
36
- { signals: (d) => d?.replaceExistName === true, intent: "force_claim_name" },
37
- { signals: (d) => d?.arb !== undefined, intent: "dispute_resolution" },
38
- { signals: (d) => d?.onChain === true, intent: "public_identity" },
39
- ];
40
- export function distillIntent(operation_type, data, baseIntent) {
41
- const urgencyRules = URGENCY_RULES.filter((r) => r.operation_type === operation_type);
42
- const signaled = urgencyRules.find((r) => r.signals && r.signals(data));
43
- const urgency = (signaled ?? urgencyRules.find((r) => !r.signals))?.urgency ?? "normal";
44
- const scenarioRule = SCENARIO_RULES.find((r) => r.signals(data));
45
- const scenario = scenarioRule?.scenario;
46
- const secondary_intents = SECONDARY_INTENT_RULES
47
- .filter((r) => r.signals(data))
48
- .map((r) => r.intent);
49
- let confidence = 0.8;
50
- if (scenario)
51
- confidence = Math.min(1, confidence + 0.1);
52
- if (secondary_intents.length > 0)
53
- confidence = Math.min(1, confidence + 0.05);
54
- if (baseIntent === operation_type)
55
- confidence -= 0.15;
56
- return {
57
- primary_intent: baseIntent,
58
- secondary_intents,
59
- confidence: Math.max(0, confidence),
60
- urgency,
61
- scenario,
62
- };
63
- }
64
- export function extractSignals(operation_type, data) {
65
- const signals = {};
66
- if (!data || typeof data !== "object")
67
- return signals;
68
- const keys = ["publish", "amount", "price", "arb", "service", "machine", "order", "reward", "guard", "permission", "replaceExistName", "onChain", "type_parameter"];
69
- for (const k of keys) {
70
- if (data[k] !== undefined) {
71
- signals[k] = data[k];
72
- }
73
- }
74
- if (operation_type === "service") {
75
- if (data.namedNew?.name)
76
- signals.name = data.namedNew.name;
77
- }
78
- if (operation_type === "payment" || operation_type === "reward") {
79
- if (data.amount?.amount)
80
- signals.amount_value = data.amount.amount;
81
- }
82
- return signals;
83
- }
1
+ const URGENCY_RULES=[{'operation_type':'payment','urgency':'critical'},{'operation_type':'service','signals':a=>a?.['publish']===!![],'urgency':'critical'},{'operation_type':'arbitration','signals':a=>a?.['arb']===!![]||a?.['arb_operation']==='raise','urgency':'critical'},{'operation_type':'reward','urgency':'high'},{'operation_type':'allocation','urgency':'high'},{'operation_type':'treasury','urgency':'high'},{'operation_type':'order','urgency':'high'},{'operation_type':'service','urgency':'normal'},{'operation_type':'machine','urgency':'normal'},{'operation_type':'guard','urgency':'normal'},{'operation_type':'permission','urgency':'normal'},{'operation_type':'progress','urgency':'normal'},{'operation_type':'repository','urgency':'normal'},{'operation_type':'personal','urgency':'normal'},{'operation_type':'contact','urgency':'normal'},{'operation_type':'demand','urgency':'normal'},{'operation_type':'query_toolkit','urgency':'low'},{'operation_type':'onchain_events','urgency':'low'},{'operation_type':'onchain_table_data','urgency':'low'},{'operation_type':'account_balance','urgency':'low'},{'operation_type':'mark_query','urgency':'low'},{'operation_type':'local_info','urgency':'low'}],SCENARIO_RULES=[{'signals':a=>typeof a?.['description']==='string'&&/freelance|freelancer|design|development|outsourcing/i['test'](a['description']),'scenario':'freelance'},{'signals':a=>typeof a?.['description']==='string'&&/rental|rent|lease/i['test'](a['description']),'scenario':'rental'},{'signals':a=>typeof a?.['description']==='string'&&/course|education|training/i['test'](a['description']),'scenario':'education'},{'signals':a=>typeof a?.['description']==='string'&&/travel|tour|trip/i['test'](a['description']),'scenario':'travel'},{'signals':a=>typeof a?.['description']==='string'&&/subscri|subscription|membership/i['test'](a['description']),'scenario':'subscription'},{'signals':a=>typeof a?.['namedNew']?.['name']==='string'&&/shop|store|retail/i['test'](a['namedNew']['name']),'scenario':'retail'}],SECONDARY_INTENT_RULES=[{'signals':a=>a?.['publish']===!![],'intent':'immutable_commit'},{'signals':a=>a?.['amount']?.['amount']!==undefined&&BigInt(a['amount']['amount'])>0x174876e800n,'intent':'large_amount'},{'signals':a=>a?.['replaceExistName']===!![],'intent':'force_claim_name'},{'signals':a=>a?.['arb']!==undefined,'intent':'dispute_resolution'},{'signals':a=>a?.['onChain']===!![],'intent':'public_identity'}];export function distillIntent(a,b,c){const d=URGENCY_RULES['filter'](k=>k['operation_type']===a),e=d['find'](k=>k['signals']&&k['signals'](b)),f=(e??d['find'](k=>!k['signals']))?.['urgency']??'normal',g=SCENARIO_RULES['find'](k=>k['signals'](b)),h=g?.['scenario'],i=SECONDARY_INTENT_RULES['filter'](k=>k['signals'](b))['map'](k=>k['intent']);let j=0.8;if(h)j=Math['min'](0x1,j+0.1);if(i['length']>0x0)j=Math['min'](0x1,j+0.05);if(c===a)j-=0.15;return{'primary_intent':c,'secondary_intents':i,'confidence':Math['max'](0x0,j),'urgency':f,'scenario':h};}export function extractSignals(a,b){const c={};if(!b||typeof b!=='object')return c;const d=['publish','amount','price','arb','service','machine','order','reward','guard','permission','replaceExistName','onChain','type_parameter'];for(const e of d){b[e]!==undefined&&(c[e]=b[e]);}if(a==='service'){if(b['namedNew']?.['name'])c['name']=b['namedNew']['name'];}if(a==='payment'||a==='reward'){if(b['amount']?.['amount'])c['amount_value']=b['amount']['amount'];}return c;}
@@ -1,94 +1 @@
1
- import { distillIntent, extractSignals } from "./intent-distill.js";
2
- import { getProfile, updateFromOperation } from "./user-profile.js";
3
- import { findMatches, recordSignature } from "./experience-reuse.js";
4
- import { EXPERIENCE_LAYER_VERSION } from "./types.js";
5
- import { isEnabled as isRuntimeEnabled } from "../config/index.js";
6
- import { recordIndustrySignal } from "../knowledge/flywheel-loop.js";
7
- export { EXPERIENCE_LAYER_VERSION };
8
- export function getExperienceFeedback(operation_type, data, baseIntent) {
9
- try {
10
- const distilled = distillIntent(operation_type, data, baseIntent);
11
- const matches = findMatches(distilled.primary_intent, operation_type, data, 3);
12
- if (matches.length === 0)
13
- return undefined;
14
- const topMatch = matches[0];
15
- const profile = getProfile();
16
- return formatFeedback(topMatch, matches, distilled.scenario, profile);
17
- }
18
- catch {
19
- return undefined;
20
- }
21
- }
22
- export function recordOperationOutcome(operation_type, data, baseIntent, outcome, errorCode, referencedObjects = []) {
23
- try {
24
- const distilled = distillIntent(operation_type, data, baseIntent);
25
- const signals = extractSignals(operation_type, data);
26
- recordSignature({
27
- intent: distilled.primary_intent,
28
- scenario: distilled.scenario,
29
- signals,
30
- timestamp: Date.now(),
31
- outcome,
32
- error_code: errorCode,
33
- });
34
- updateFromOperation(distilled.primary_intent, distilled.scenario, outcome, errorCode, referencedObjects);
35
- try {
36
- if (isRuntimeEnabled("industry_evolution")) {
37
- const industryHint = (typeof data?.industry === "string" && data.industry.trim())
38
- ? data.industry.trim()
39
- : undefined;
40
- if (industryHint) {
41
- const signalOutcome = outcome === "success"
42
- ? { success: true }
43
- : { success: false, error_code: errorCode };
44
- recordIndustrySignal(industryHint, { type: operation_type, data }, signalOutcome);
45
- }
46
- }
47
- }
48
- catch {
49
- }
50
- }
51
- catch {
52
- }
53
- }
54
- function formatFeedback(topMatch, allMatches, scenario, profile) {
55
- const advice = buildAdviceText(topMatch, allMatches, profile);
56
- const avoid = collectAvoidList(allMatches, profile);
57
- const relevance = topMatch.relevance;
58
- const matchedScenario = scenario ?? topMatch.signature.scenario;
59
- const feedback = {};
60
- if (advice)
61
- feedback.advice = advice;
62
- if (avoid.length > 0)
63
- feedback.avoid = avoid;
64
- if (relevance > 0)
65
- feedback.relevance = Math.round(relevance * 100) / 100;
66
- if (matchedScenario)
67
- feedback.matched_scenario = matchedScenario;
68
- return feedback;
69
- }
70
- function buildAdviceText(topMatch, allMatches, profile) {
71
- const parts = [];
72
- if (topMatch.signature.outcome === "success") {
73
- parts.push(`Historically, ${topMatch.signature.intent} operation succeeded`);
74
- }
75
- else if (topMatch.signature.outcome === "failed") {
76
- parts.push(`Historically, ${topMatch.signature.intent} operation failed (${topMatch.signature.error_code ?? "unknown error"}), pay special attention to parameters`);
77
- }
78
- if (profile.expertise_tier === "novice" && allMatches.length > 0) {
79
- parts.push("It is recommended to carefully check parameters before executing");
80
- }
81
- return parts.join("; ") || topMatch.advice;
82
- }
83
- function collectAvoidList(matches, profile) {
84
- const avoid = new Set();
85
- for (const m of matches) {
86
- for (const a of m.avoid) {
87
- avoid.add(a);
88
- }
89
- }
90
- for (const p of profile.frequent_pitfalls) {
91
- avoid.add(`You often make mistakes at the ${p} step, please be especially careful`);
92
- }
93
- return Array.from(avoid).slice(0, 5);
94
- }
1
+ import{distillIntent,extractSignals}from'./intent-distill.js';import{getProfile,updateFromOperation}from'./user-profile.js';import{findMatches,recordSignature}from'./experience-reuse.js';import{EXPERIENCE_LAYER_VERSION}from'./types.js';import{isEnabled as a32a}from'../config/index.js';import{recordIndustrySignal}from'../knowledge/flywheel-loop.js';export{EXPERIENCE_LAYER_VERSION};export function getExperienceFeedback(a,b,c){try{const d=distillIntent(a,b,c),e=findMatches(d['primary_intent'],a,b,0x3);if(e['length']===0x0)return undefined;const f=e[0x0],g=getProfile();return formatFeedback(f,e,d['scenario'],g);}catch{return undefined;}}export function recordOperationOutcome(a,b,c,d,e,f=[]){try{const g=distillIntent(a,b,c),h=extractSignals(a,b);recordSignature({'intent':g['primary_intent'],'scenario':g['scenario'],'signals':h,'timestamp':Date['now'](),'outcome':d,'error_code':e}),updateFromOperation(g['primary_intent'],g['scenario'],d,e,f);try{if(a32a('industry_evolution')){const i=typeof b?.['industry']==='string'&&b['industry']['trim']()?b['industry']['trim']():undefined;if(i){const j=d==='success'?{'success':!![]}:{'success':![],'error_code':e};recordIndustrySignal(i,{'type':a,'data':b},j);}}}catch{}}catch{}}function formatFeedback(a,b,c,d){const e=buildAdviceText(a,b,d),f=collectAvoidList(b,d),g=a['relevance'],h=c??a['signature']['scenario'],i={};if(e)i['advice']=e;if(f['length']>0x0)i['avoid']=f;if(g>0x0)i['relevance']=Math['round'](g*0x64)/0x64;if(h)i['matched_scenario']=h;return i;}function buildAdviceText(a,b,c){const d=[];if(a['signature']['outcome']==='success')d['push']('Historically,\x20'+a['signature']['intent']+'\x20operation\x20succeeded');else a['signature']['outcome']==='failed'&&d['push']('Historically,\x20'+a['signature']['intent']+'\x20operation\x20failed\x20('+(a['signature']['error_code']??'unknown\x20error')+'),\x20pay\x20special\x20attention\x20to\x20parameters');return c['expertise_tier']==='novice'&&b['length']>0x0&&d['push']('It\x20is\x20recommended\x20to\x20carefully\x20check\x20parameters\x20before\x20executing'),d['join'](';\x20')||a['advice'];}function collectAvoidList(b,c){const d=new Set();for(const e of b){for(const f of e['avoid']){d['add'](f);}}for(const g of c['frequent_pitfalls']){d['add']('You\x20often\x20make\x20mistakes\x20at\x20the\x20'+g+'\x20step,\x20please\x20be\x20especially\x20careful');}return Array['from'](d)['slice'](0x0,0x5);}
@@ -1 +1 @@
1
- export const EXPERIENCE_LAYER_VERSION = 1;
1
+ export const EXPERIENCE_LAYER_VERSION=0x1;
@@ -1,171 +1 @@
1
- let currentProfile = {
2
- expertise_tier: "novice",
3
- preferred_industries: [],
4
- risk_appetite: "balanced",
5
- frequent_pitfalls: [],
6
- reused_objects: [],
7
- preferred_confirmation: "standard",
8
- total_operations: 0,
9
- success_rate: 1.0,
10
- last_updated: 0,
11
- };
12
- let buyerSignals = {
13
- purchase_count: 0,
14
- avg_purchase_price_ratio: 1.0,
15
- discount_usage_count: 0,
16
- referral_usage_count: 0,
17
- dispute_count: 0,
18
- };
19
- let scenarioCounts = new Map();
20
- let pitfallCounts = new Map();
21
- let objectRefs = new Map();
22
- let successCount = 0;
23
- let totalCount = 0;
24
- export function getProfile() {
25
- return { ...currentProfile, buyer_signals: { ...buyerSignals } };
26
- }
27
- export function recordPurchaseOutcome(input) {
28
- try {
29
- buyerSignals.purchase_count++;
30
- if (input.used_discount)
31
- buyerSignals.discount_usage_count++;
32
- if (input.used_referral)
33
- buyerSignals.referral_usage_count++;
34
- if (input.has_dispute)
35
- buyerSignals.dispute_count++;
36
- if (input.avg_market_price && input.avg_market_price > 0n) {
37
- const ratio = Number((input.price * 100n) / input.avg_market_price) / 100;
38
- const prevAvg = buyerSignals.avg_purchase_price_ratio;
39
- const n = buyerSignals.purchase_count;
40
- buyerSignals.avg_purchase_price_ratio = (prevAvg * (n - 1) + ratio) / n;
41
- }
42
- recomputeBuyerInferences();
43
- }
44
- catch {
45
- }
46
- }
47
- function recomputeBuyerInferences() {
48
- const n = buyerSignals.purchase_count;
49
- if (n >= 3) {
50
- const avgRatio = buyerSignals.avg_purchase_price_ratio;
51
- if (avgRatio < 0.9) {
52
- buyerSignals.inferred_price_sensitivity = "high";
53
- }
54
- else if (avgRatio > 1.1) {
55
- buyerSignals.inferred_price_sensitivity = "low";
56
- }
57
- else {
58
- buyerSignals.inferred_price_sensitivity = "medium";
59
- }
60
- }
61
- if (n >= 2) {
62
- const signalCount = buyerSignals.discount_usage_count + buyerSignals.referral_usage_count;
63
- const ratio = signalCount / n;
64
- buyerSignals.inferred_bargain_hunting = Math.min(1, ratio);
65
- }
66
- }
67
- export function getBuyerSignals() {
68
- return { ...buyerSignals };
69
- }
70
- export function updateFromOperation(intent, scenario, outcome, errorCode, referencedObjects) {
71
- try {
72
- totalCount++;
73
- if (outcome === "success")
74
- successCount++;
75
- if (scenario) {
76
- scenarioCounts.set(scenario, (scenarioCounts.get(scenario) ?? 0) + 1);
77
- }
78
- if (outcome !== "success" && errorCode) {
79
- pitfallCounts.set(errorCode, (pitfallCounts.get(errorCode) ?? 0) + 1);
80
- }
81
- for (const obj of referencedObjects) {
82
- objectRefs.set(obj, (objectRefs.get(obj) ?? 0) + 1);
83
- }
84
- currentProfile = recomputeProfile();
85
- }
86
- catch {
87
- }
88
- }
89
- function recomputeProfile() {
90
- const total = totalCount;
91
- const successRate = total > 0 ? successCount / total : 1.0;
92
- let tier = "novice";
93
- if (total >= 50 && successRate >= 0.9)
94
- tier = "expert";
95
- else if (total >= 10 && successRate >= 0.7)
96
- tier = "advanced";
97
- const topScenarios = Array.from(scenarioCounts.entries())
98
- .sort((a, b) => b[1] - a[1])
99
- .slice(0, 3)
100
- .map(([s]) => s);
101
- let riskAppetite = "balanced";
102
- if (total > 20 && successRate < 0.6)
103
- riskAppetite = "aggressive";
104
- else if (total > 20 && successRate > 0.95)
105
- riskAppetite = "conservative";
106
- const topPitfalls = Array.from(pitfallCounts.entries())
107
- .filter(([, count]) => count >= 2)
108
- .sort((a, b) => b[1] - a[1])
109
- .slice(0, 3)
110
- .map(([code]) => code);
111
- const topObjects = Array.from(objectRefs.entries())
112
- .filter(([, count]) => count >= 2)
113
- .sort((a, b) => b[1] - a[1])
114
- .slice(0, 5)
115
- .map(([obj]) => obj);
116
- let preferredConfirmation = "standard";
117
- if (tier === "expert")
118
- preferredConfirmation = "minimal";
119
- else if (tier === "novice")
120
- preferredConfirmation = "verbose";
121
- return {
122
- expertise_tier: tier,
123
- preferred_industries: topScenarios,
124
- risk_appetite: riskAppetite,
125
- frequent_pitfalls: topPitfalls,
126
- reused_objects: topObjects,
127
- preferred_confirmation: preferredConfirmation,
128
- total_operations: total,
129
- success_rate: successRate,
130
- last_updated: Date.now(),
131
- };
132
- }
133
- export function resetProfile() {
134
- currentProfile = {
135
- expertise_tier: "novice",
136
- preferred_industries: [],
137
- risk_appetite: "balanced",
138
- frequent_pitfalls: [],
139
- reused_objects: [],
140
- preferred_confirmation: "verbose",
141
- total_operations: 0,
142
- success_rate: 1.0,
143
- last_updated: 0,
144
- };
145
- scenarioCounts = new Map();
146
- pitfallCounts = new Map();
147
- objectRefs = new Map();
148
- successCount = 0;
149
- totalCount = 0;
150
- buyerSignals = {
151
- purchase_count: 0,
152
- avg_purchase_price_ratio: 1.0,
153
- discount_usage_count: 0,
154
- referral_usage_count: 0,
155
- dispute_count: 0,
156
- };
157
- }
158
- export function getProfileStats() {
159
- return {
160
- total_operations: totalCount,
161
- success_rate: totalCount > 0 ? successCount / totalCount : 1.0,
162
- top_scenarios: Array.from(scenarioCounts.entries())
163
- .sort((a, b) => b[1] - a[1])
164
- .slice(0, 5)
165
- .map(([scenario, count]) => ({ scenario, count })),
166
- top_pitfalls: Array.from(pitfallCounts.entries())
167
- .sort((a, b) => b[1] - a[1])
168
- .slice(0, 5)
169
- .map(([error_code, count]) => ({ error_code, count })),
170
- };
171
- }
1
+ let currentProfile={'expertise_tier':'novice','preferred_industries':[],'risk_appetite':'balanced','frequent_pitfalls':[],'reused_objects':[],'preferred_confirmation':'standard','total_operations':0x0,'success_rate':0x1,'last_updated':0x0},buyerSignals={'purchase_count':0x0,'avg_purchase_price_ratio':0x1,'discount_usage_count':0x0,'referral_usage_count':0x0,'dispute_count':0x0},scenarioCounts=new Map(),pitfallCounts=new Map(),objectRefs=new Map(),successCount=0x0,totalCount=0x0;export function getProfile(){return{...currentProfile,'buyer_signals':{...buyerSignals}};}export function recordPurchaseOutcome(a){try{buyerSignals['purchase_count']++;if(a['used_discount'])buyerSignals['discount_usage_count']++;if(a['used_referral'])buyerSignals['referral_usage_count']++;if(a['has_dispute'])buyerSignals['dispute_count']++;if(a['avg_market_price']&&a['avg_market_price']>0x0n){const b=Number(a['price']*0x64n/a['avg_market_price'])/0x64,c=buyerSignals['avg_purchase_price_ratio'],d=buyerSignals['purchase_count'];buyerSignals['avg_purchase_price_ratio']=(c*(d-0x1)+b)/d;}recomputeBuyerInferences();}catch{}}function recomputeBuyerInferences(){const a=buyerSignals['purchase_count'];if(a>=0x3){const b=buyerSignals['avg_purchase_price_ratio'];if(b<0.9)buyerSignals['inferred_price_sensitivity']='high';else b>1.1?buyerSignals['inferred_price_sensitivity']='low':buyerSignals['inferred_price_sensitivity']='medium';}if(a>=0x2){const c=buyerSignals['discount_usage_count']+buyerSignals['referral_usage_count'],d=c/a;buyerSignals['inferred_bargain_hunting']=Math['min'](0x1,d);}}export function getBuyerSignals(){return{...buyerSignals};}export function updateFromOperation(a,b,c,d,e){try{totalCount++;if(c==='success')successCount++;b&&scenarioCounts['set'](b,(scenarioCounts['get'](b)??0x0)+0x1);c!=='success'&&d&&pitfallCounts['set'](d,(pitfallCounts['get'](d)??0x0)+0x1);for(const f of e){objectRefs['set'](f,(objectRefs['get'](f)??0x0)+0x1);}currentProfile=recomputeProfile();}catch{}}function recomputeProfile(){const a=totalCount,b=a>0x0?successCount/a:0x1;let c='novice';if(a>=0x32&&b>=0.9)c='expert';else{if(a>=0xa&&b>=0.7)c='advanced';}const d=Array['from'](scenarioCounts['entries']())['sort']((i,j)=>j[0x1]-i[0x1])['slice'](0x0,0x3)['map'](([i])=>i);let e='balanced';if(a>0x14&&b<0.6)e='aggressive';else{if(a>0x14&&b>0.95)e='conservative';}const f=Array['from'](pitfallCounts['entries']())['filter'](([,i])=>i>=0x2)['sort']((i,j)=>j[0x1]-i[0x1])['slice'](0x0,0x3)['map'](([i])=>i),g=Array['from'](objectRefs['entries']())['filter'](([,i])=>i>=0x2)['sort']((i,j)=>j[0x1]-i[0x1])['slice'](0x0,0x5)['map'](([i])=>i);let h='standard';if(c==='expert')h='minimal';else{if(c==='novice')h='verbose';}return{'expertise_tier':c,'preferred_industries':d,'risk_appetite':e,'frequent_pitfalls':f,'reused_objects':g,'preferred_confirmation':h,'total_operations':a,'success_rate':b,'last_updated':Date['now']()};}export function resetProfile(){currentProfile={'expertise_tier':'novice','preferred_industries':[],'risk_appetite':'balanced','frequent_pitfalls':[],'reused_objects':[],'preferred_confirmation':'verbose','total_operations':0x0,'success_rate':0x1,'last_updated':0x0},scenarioCounts=new Map(),pitfallCounts=new Map(),objectRefs=new Map(),successCount=0x0,totalCount=0x0,buyerSignals={'purchase_count':0x0,'avg_purchase_price_ratio':0x1,'discount_usage_count':0x0,'referral_usage_count':0x0,'dispute_count':0x0};}export function getProfileStats(){return{'total_operations':totalCount,'success_rate':totalCount>0x0?successCount/totalCount:0x1,'top_scenarios':Array['from'](scenarioCounts['entries']())['sort']((c,d)=>d[0x1]-c[0x1])['slice'](0x0,0x5)['map'](([a,b])=>({'scenario':a,'count':b})),'top_pitfalls':Array['from'](pitfallCounts['entries']())['sort']((c,d)=>d[0x1]-c[0x1])['slice'](0x0,0x5)['map'](([a,b])=>({'error_code':a,'count':b}))};}