@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
@@ -0,0 +1,13 @@
1
+ import type { CapabilityVector, WorkflowCapabilities } from "./capability.js";
2
+ export interface CompositePlan {
3
+ demand: string;
4
+ services: Array<{
5
+ id: string;
6
+ covered: Array<keyof WorkflowCapabilities>;
7
+ }>;
8
+ coverage_score: number;
9
+ remaining_missing: Array<keyof WorkflowCapabilities>;
10
+ feasibility: "ready" | "needs_supply_chain" | "infeasible";
11
+ summary: string;
12
+ }
13
+ export declare function composeServicesForDemand(demand: CapabilityVector, services: CapabilityVector[]): CompositePlan;
@@ -0,0 +1 @@
1
+ import{requiredCapabilities}from'./capability.js';import{relateRegion}from'./region.js';export function composeServicesForDemand(a,b){const c=requiredCapabilities(a['capabilities']),d=new Set(c),e=[],f=b['filter'](i=>relateRegion(a['region'],i['region'])!=='mismatch');while(d['size']>0x0){let i=null;for(const j of f){if(e['some'](m=>m['id']===j['id']))continue;const l=c['filter'](m=>d['has'](m)&&j['capabilities'][m]);(!i||l['length']>i['covered']['length'])&&(i={'id':j['id'],'covered':l});}if(!i||i['covered']['length']===0x0)break;e['push'](i);for(const m of i['covered'])d['delete'](m);}const g=c['length']===0x0?0x64:Math['round']((c['length']-d['size'])/c['length']*0x64),h=d['size']===0x0?'ready':e['length']>0x0?'needs_supply_chain':'infeasible';return{'demand':a['id'],'services':e,'coverage_score':g,'remaining_missing':[...d],'feasibility':h,'summary':d['size']===0x0?'Composite\x20of\x20'+e['length']+'\x20service(s)\x20covers\x20all\x20'+c['length']+'\x20requirements':'Composite\x20of\x20'+e['length']+'\x20service(s)\x20covers\x20'+g+'/100;\x20missing:\x20'+([...d]['join'](',\x20')||'none')};}
@@ -0,0 +1,18 @@
1
+ import type { DataSource, EvaluationLevel, EvaluationResult, EvaluationRule, UserInjection } from "./types.js";
2
+ export declare function levelFromScore(score: number): EvaluationLevel;
3
+ export declare class EvaluationEngine {
4
+ private static instance;
5
+ private dataSources;
6
+ private rules;
7
+ static Instance(): EvaluationEngine;
8
+ registerDataSource(ds: DataSource): boolean;
9
+ unregisterDataSource(id: string): boolean;
10
+ registerRule(rule: EvaluationRule): boolean;
11
+ unregisterRule(id: string): boolean;
12
+ getRule(id: string): EvaluationRule | undefined;
13
+ listRules(): EvaluationRule[];
14
+ getDataSource(id: string): DataSource | undefined;
15
+ listDataSources(): DataSource[];
16
+ evaluate(evaluationId: string, entities: Record<string, unknown>, injection?: UserInjection): Promise<EvaluationResult>;
17
+ }
18
+ export declare function getEvaluationEngine(): EvaluationEngine;
@@ -0,0 +1 @@
1
+ import{REQUIREMENT_PASS_THRESHOLD,effectiveWeight,isDataSourceEnabled,isRuleEnabled,normalizeInjection}from'./user-injection.js';const LEVELS=[{'min':0x55,'level':'low'},{'min':0x46,'level':'medium_low'},{'min':0x32,'level':'medium_high'},{'min':0x0,'level':'high'}];export function levelFromScore(a){for(const b of LEVELS){if(a>=b['min'])return b['level'];}return'high';}function appliesTo(a,b){if(!a||a['length']===0x0)return!![];return a['includes'](b);}export class EvaluationEngine{static ['instance']=null;['dataSources']=new Map();['rules']=new Map();static['Instance'](){return!EvaluationEngine['instance']&&(EvaluationEngine['instance']=new EvaluationEngine()),EvaluationEngine['instance'];}['registerDataSource'](a){if(!a['id']||this['dataSources']['has'](a['id']))return![];return this['dataSources']['set'](a['id'],a),!![];}['unregisterDataSource'](a){return this['dataSources']['delete'](a);}['registerRule'](a){if(!a['id']||this['rules']['has'](a['id']))return![];return this['rules']['set'](a['id'],a),!![];}['unregisterRule'](a){return this['rules']['delete'](a);}['getRule'](a){return this['rules']['get'](a);}['listRules'](){return Array['from'](this['rules']['values']());}['getDataSource'](a){return this['dataSources']['get'](a);}['listDataSources'](){return Array['from'](this['dataSources']['values']());}async['evaluate'](a,b,c){const d=normalizeInjection(c),e={'evaluation_id':a,'entities':b,'facts':{},'injection':d,'now':Date['now']()},f=[],g=Array['from'](this['dataSources']['values']())['filter'](m=>appliesTo(m['evaluation_ids'],a))['sort']((m,n)=>(m['priority']??0x0)-(n['priority']??0x0));for(const m of g){if(!isDataSourceEnabled(m['id'],d)){f['push']({'kind':'override','id':m['id'],'detail':'data\x20source\x20disabled\x20by\x20user\x20override'});continue;}if(m['isEnabled']&&!m['isEnabled'](e))continue;const n=await m['extract'](e);Object['assign'](e['facts'],n),f['push']({'kind':'data_source','id':m['id'],'detail':'extracted\x20'+Object['keys'](n)['length']+'\x20fact(s)'});}const h=[],i=[];for(const o of this['rules']['values']()){if(!appliesTo(o['evaluation_ids'],a))continue;if(!isRuleEnabled(o['id'],d)){f['push']({'kind':'override','id':o['id'],'detail':'rule\x20disabled\x20by\x20user\x20override'});continue;}if(o['isEnabled']&&!o['isEnabled'](e))continue;const p=o['evaluate'](e);if(!p)continue;const q=effectiveWeight(o,d);h['push']({'rule_id':o['id'],'dimension':o['dimension'],'score':p['score'],'weight':q,'reason':p['reason'],'matched':p['matched'],'mismatched':p['mismatched'],'red_flag':p['red_flag']}),p['red_flag']&&i['push'](p['reason']??o['id']+'\x20triggered\x20a\x20hard\x20block'),f['push']({'kind':'rule','id':o['id'],'detail':'score='+p['score']+'\x20weight='+q});}const j=aggregateScore(h);let k=i['length']>0x0;for(const r of d['requirements']??[]){const s=h['find'](t=>t['rule_id']===r['rule_id']);if(r['condition']==='require')(!s||s['score']<REQUIREMENT_PASS_THRESHOLD||s['red_flag'])&&(k=!![],i['push'](r['note']??'Requirement\x20requires\x20rule\x20\x27'+r['rule_id']+'\x27\x20to\x20pass'));else r['condition']==='forbid'&&(s&&s['red_flag']&&(k=!![],i['push'](r['note']??'Requirement\x20forbids\x20rule\x20\x27'+r['rule_id']+'\x27\x20from\x20triggering')));}const l=buildSummary(a,j,h,i,k);return{'evaluation_id':a,'total':j,'level':levelFromScore(j),'breakdown':h,'red_flags':i,'blocked':k,'trace':f,'summary':l};}}function aggregateScore(a){if(a['length']===0x0)return 0x0;let c=0x0,d=0x0;for(const e of a){c+=e['score']*e['weight'],d+=e['weight'];}if(d<=0x0)return 0x0;return clamp(Math['round'](c/d),0x0,0x64);}function clamp(a,b,c){return Math['max'](b,Math['min'](c,a));}function buildSummary(a,b,c,d,e){const f=['Evaluation\x20\x27'+a+'\x27:\x20score\x20'+b+'/100'];return e?f['push']('BLOCKED\x20('+d['length']+'\x20red\x20flag(s))'):f['push'](c['length']+'\x20rule(s)\x20evaluated'),f['join']('\x20—\x20');}export function getEvaluationEngine(){return EvaluationEngine['Instance']();}
@@ -0,0 +1,30 @@
1
+ import type { CapabilityVector } from "./capability.js";
2
+ export interface ServiceExtractInput {
3
+ object: string;
4
+ description: string;
5
+ location: string;
6
+ sales?: Array<{
7
+ name?: string;
8
+ price: number | bigint | string;
9
+ wip_hash?: string;
10
+ }>;
11
+ arbitrations?: string[];
12
+ compensation_fund?: number | bigint | string;
13
+ buy_guard?: string | null;
14
+ machine?: string | null;
15
+ um?: string | null;
16
+ bPublished?: boolean;
17
+ bPaused?: boolean;
18
+ order_allocators?: unknown;
19
+ owner?: string;
20
+ }
21
+ export interface DemandExtractInput {
22
+ object: string;
23
+ description: string;
24
+ location: string;
25
+ rewards?: string[];
26
+ um?: string | null;
27
+ owner?: string;
28
+ }
29
+ export declare function extractServiceCapability(input: ServiceExtractInput, overrides?: Partial<CapabilityVector>): CapabilityVector;
30
+ export declare function extractDemandCapability(input: DemandExtractInput, overrides?: Partial<CapabilityVector>): CapabilityVector;
@@ -0,0 +1 @@
1
+ import{parseRegion}from'./region.js';import{findSimilarIndustries,inferTraitsFromDescription}from'../knowledge/industry-generalizer.js';const BUILTIN_SCENARIOS=['freelance','rental','education','travel','subscription','retail'];function enrichFromDescription(a){const b=a?.['trim']();if(!b)return{'industry':'general','industry_confidence':0x0,'tags':[],'keywords':[]};const {traits:c,confidence:d,matched_keywords:e}=inferTraitsFromDescription(b),f=findSimilarIndustries(c,0x3),g=f[0x0],h=g&&BUILTIN_SCENARIOS['includes'](g['industry'])?g['industry']:'general',i=e['length']>0x0||(g?.['similarity']??0x0)>0.2;return{'industry':i?h:'general','industry_confidence':i?Math['max'](d,g?.['similarity']??0x0):0x0,'tags':i?f['slice'](0x0,0x3)['map'](j=>j['industry']):[],'keywords':e};}export function extractServiceCapability(a,b){const c=a['sales']??[],d=c['map'](j=>toBigInt(j['price']))['filter'](j=>j!==undefined),e=a['arbitrations']??[],f=toBigInt(a['compensation_fund'])??0x0n,g=enrichFromDescription(a['description']),h={'has_arbitration':e['length']>0x0,'has_refund_path':e['length']>0x0&&f>0x0n,'has_milestone_nodes':![],'has_compensation_fund':f>0x0n,'has_wip_verification':c['some'](j=>!!j['wip_hash']),'has_messenger':a['um']!=null,'has_buy_guard':a['buy_guard']!=null,'has_dynamic_pricing':![],'is_published':a['bPublished']===!![],'is_paused':a['bPaused']===!![]},i={'id':a['object'],'kind':'service','owner':a['owner']??'','industry':g['industry'],'industry_confidence':g['industry_confidence'],'region':parseRegion(a['location']),'price_min':d['length']>0x0?minBigInt(d):undefined,'price_max':d['length']>0x0?maxBigInt(d):undefined,'token_type':'','ticket_size':'medium','trust_score':0x32,'reputation_like_ratio':0x1,'arbitration_independent':![],'merchant_history_count':0x0,'capabilities':h,'tags':g['tags'],'keywords':g['keywords']};return{...i,...b};}export function extractDemandCapability(a,b){const c=enrichFromDescription(a['description']),d={'id':a['object'],'kind':'demand','owner':a['owner']??'','industry':c['industry'],'industry_confidence':c['industry_confidence'],'region':parseRegion(a['location']),'price_min':undefined,'price_max':undefined,'token_type':'','ticket_size':'medium','trust_score':0x32,'reputation_like_ratio':0x1,'arbitration_independent':![],'merchant_history_count':0x0,'capabilities':{'has_arbitration':![],'has_refund_path':![],'has_milestone_nodes':![],'has_compensation_fund':![],'has_wip_verification':![],'has_messenger':a['um']!=null,'has_buy_guard':![],'has_dynamic_pricing':![],'is_published':!![],'is_paused':![]},'tags':c['tags'],'keywords':c['keywords']};return{...d,...b};}function toBigInt(a){if(a===undefined||a===null)return undefined;try{return BigInt(a);}catch{return undefined;}}function minBigInt(a){return a['reduce']((c,d)=>c<d?c:d);}function maxBigInt(a){return a['reduce']((c,d)=>c>d?c:d);}
@@ -0,0 +1,27 @@
1
+ import type { CommercialRole } from "../role/types.js";
2
+ export type OperationOutcome = "completion" | "refund" | "advance";
3
+ export type RiskAppetite = "conservative" | "balanced" | "aggressive";
4
+ export declare const OUTCOME_SEMANTICS: Record<OperationOutcome, string[]>;
5
+ export interface RoleInterests {
6
+ prefer: string[];
7
+ avoid: string[];
8
+ sensitivity: number;
9
+ }
10
+ export declare const ROLE_INTERESTS: Record<CommercialRole, RoleInterests>;
11
+ export declare function classifyOutcome(consequence?: string): OperationOutcome;
12
+ export declare function appetiteMultiplier(appetite?: RiskAppetite): number;
13
+ export declare function interestsOf(role: CommercialRole): RoleInterests;
14
+ export interface PersonaDrive {
15
+ risk_appetite?: RiskAppetite;
16
+ requirements?: string[];
17
+ }
18
+ export declare function resolveInterests(role: CommercialRole, drive?: PersonaDrive): RoleInterests;
19
+ export interface OutcomeEvaluation {
20
+ gain_score: number;
21
+ risk_score: number;
22
+ net_score: number;
23
+ gains: string[];
24
+ risks: string[];
25
+ }
26
+ export declare function evaluateOutcome(outcome: OperationOutcome, role: CommercialRole, drive?: PersonaDrive): OutcomeEvaluation;
27
+ export declare function consistencyScore(outcome: OperationOutcome, role: CommercialRole): number;
@@ -0,0 +1 @@
1
+ export const OUTCOME_SEMANTICS={'completion':['fund_released_to_merchant','refund_leverage_given_up'],'refund':['fund_returned_to_buyer','arbitration_review_triggered'],'advance':['node_advanced']};export const ROLE_INTERESTS={'customer':{'prefer':['fund_returned_to_buyer'],'avoid':['fund_released_to_merchant','refund_leverage_given_up'],'sensitivity':0x1},'merchant':{'prefer':['fund_released_to_merchant'],'avoid':['fund_returned_to_buyer','arbitration_review_triggered'],'sensitivity':0x1},'collaborator':{'prefer':['node_advanced'],'avoid':[],'sensitivity':0x1},'supplier':{'prefer':['fund_released_to_merchant','node_advanced'],'avoid':['fund_returned_to_buyer'],'sensitivity':0x1},'prospect':{'prefer':['fund_returned_to_buyer'],'avoid':['fund_released_to_merchant','arbitration_review_triggered','refund_leverage_given_up'],'sensitivity':0x1},'arbitrator':{'prefer':[],'avoid':['arbitration_review_triggered'],'sensitivity':0x1},'system':{'prefer':[],'avoid':[],'sensitivity':0x1}};export function classifyOutcome(a){if(a?.['startsWith']('Completion'))return'completion';if(a?.['startsWith']('Refund'))return'refund';return'advance';}export function appetiteMultiplier(a){switch(a){case'conservative':return 1.5;case'aggressive':return 0.6;default:return 0x1;}}export function interestsOf(a){return ROLE_INTERESTS[a]??{'prefer':[],'avoid':[],'sensitivity':0x1};}function dedupe(a){return Array['from'](new Set(a));}export function resolveInterests(a,b){const c=interestsOf(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']('arbitration_review_triggered');if(h['includes']('refund')&&!i)e['push']('fund_returned_to_buyer');if((h['includes']('upfront')||h['includes']('before\x20delivery'))&&i)f['push']('fund_released_to_merchant');if(h['includes']('milestone')&&!i)e['push']('node_advanced');}return{'prefer':dedupe(e),'avoid':dedupe(f),'sensitivity':d};}export function evaluateOutcome(a,b,c){const d=OUTCOME_SEMANTICS[a]??[],e=resolveInterests(b,c),f=e['sensitivity'],g=[],h=[];for(const l of d){if(e['prefer']['includes'](l))g['push'](l);if(e['avoid']['includes'](l))h['push'](l);}const i=g['length']*0x14,j=Math['round'](h['length']*0x19*f),k=Math['max'](0x0,Math['min'](0x64,0x3c+i-j));return{'gain_score':i,'risk_score':j,'net_score':k,'gains':g,'risks':h};}export function consistencyScore(a,b){return evaluateOutcome(a,b)['net_score'];}
@@ -0,0 +1,2 @@
1
+ import type { CapabilityGapReport, CapabilityVector } from "./capability.js";
2
+ export declare function summarizeCapabilityGaps(demand: CapabilityVector, service: CapabilityVector): CapabilityGapReport;
@@ -0,0 +1 @@
1
+ import{requiredCapabilities}from'./capability.js';import{relateRegion}from'./region.js';const IMPACT={'has_arbitration':'critical','has_refund_path':'critical','has_compensation_fund':'major','has_wip_verification':'major','has_milestone_nodes':'minor','has_messenger':'minor','has_buy_guard':'minor','has_dynamic_pricing':'minor'},SUGGEST={'has_arbitration':'bind\x20an\x20independent\x20Arbitration\x20object\x20to\x20the\x20Service','has_refund_path':'configure\x20a\x20refund\x20path\x20(Arbitration\x20+\x20compensation_fund,\x20or\x20a\x20refund\x20Allocator)','has_compensation_fund':'deposit\x20compensation_fund\x20to\x20cover\x20the\x20order\x20amount','has_wip_verification':'set\x20a\x20wip_hash\x20on\x20the\x20sale\x20to\x20prevent\x20tampering','has_milestone_nodes':'add\x20milestone\x20nodes\x20to\x20the\x20Machine\x20workflow','has_messenger':'bind\x20a\x20Contact\x20(um)\x20to\x20enable\x20Messenger','has_buy_guard':'configure\x20a\x20buy_guard\x20for\x20purchase\x20eligibility','has_dynamic_pricing':'configure\x20discount/dynamic\x20pricing'};export function summarizeCapabilityGaps(a,b){const c=[],d=[];for(const h of requiredCapabilities(a['capabilities'])){const i=b['capabilities'][h],j={'dimension':h,'requirement':'requires\x20'+h,'provided':i?'provided':'missing','status':i?'satisfied':'missing','impact':i?'minor':IMPACT[h]??'minor','suggestion':i?'':SUGGEST[h]??''};(i?c:d)['push'](j);}a['industry']!=='general'&&a['industry']!==b['industry']&&d['push']({'dimension':'industry','requirement':a['industry'],'provided':b['industry'],'status':'missing','impact':'major','suggestion':'switch\x20to\x20a\x20service\x20in\x20the\x20\x27'+a['industry']+'\x27\x20industry'});const e=relateRegion(a['region'],b['region']);if(e==='mismatch')d['push']({'dimension':'region','requirement':a['region']['raw'],'provided':b['region']['raw'],'status':'missing','impact':'critical','suggestion':'choose\x20a\x20service\x20in\x20a\x20compatible\x20region'});else e==='overlap'&&d['push']({'dimension':'region','requirement':a['region']['raw'],'provided':b['region']['raw'],'status':'partial','impact':'minor','suggestion':'different\x20city\x20in\x20the\x20same\x20province'});a['price_max']!==undefined&&b['price_min']!==undefined&&b['price_min']>a['price_max']&&d['push']({'dimension':'price','requirement':'≤\x20'+a['price_max'],'provided':''+b['price_min'],'status':'missing','impact':'major','suggestion':'negotiate\x20a\x20lower\x20price\x20or\x20raise\x20the\x20budget'});b['trust_score']<a['trust_score']&&d['push']({'dimension':'trust','requirement':'≥\x20'+a['trust_score'],'provided':''+b['trust_score'],'status':'missing','impact':'major','suggestion':'find\x20a\x20more\x20trustworthy\x20merchant\x20or\x20require\x20more\x20safeguards'});const f=c['length']+d['length'],g=f===0x0?0x64:Math['round'](c['length']/f*0x64);return{'entity_id':b['id'],'satisfied':c,'missing':d,'coverage_score':g,'summary':d['length']===0x0?'Service\x20fully\x20covers\x20the\x20demand\x27s\x20requirements\x20('+g+'/100)':d['length']+'\x20requirement(s)\x20unmet\x20(coverage\x20'+g+'/100):\x20'+d['map'](l=>l['dimension'])['join'](',\x20')};}
@@ -0,0 +1,12 @@
1
+ export * from "./types.js";
2
+ export * from "./user-injection.js";
3
+ export * from "./region.js";
4
+ export * from "./capability.js";
5
+ export * from "./extract.js";
6
+ export * from "./gap.js";
7
+ export * from "./composer.js";
8
+ export * from "./game-strategy.js";
9
+ export * from "./node-game.js";
10
+ export * from "./arbitration-game.js";
11
+ export * from "./builtins/index.js";
12
+ export { EvaluationEngine, getEvaluationEngine, levelFromScore } from "./engine.js";
@@ -0,0 +1 @@
1
+ export*from'./types.js';export*from'./user-injection.js';export*from'./region.js';export*from'./capability.js';export*from'./extract.js';export*from'./gap.js';export*from'./composer.js';export*from'./game-strategy.js';export*from'./node-game.js';export*from'./arbitration-game.js';export*from'./builtins/index.js';export{EvaluationEngine,getEvaluationEngine,levelFromScore}from'./engine.js';
@@ -0,0 +1,62 @@
1
+ import type { ExecutionPath } from "../participation/radar-core.js";
2
+ import type { CommercialRole } from "../role/types.js";
3
+ import { type RiskAppetite } from "./game-strategy.js";
4
+ export interface NodeForwardInput {
5
+ name: string;
6
+ to_node: string;
7
+ execution_path: ExecutionPath;
8
+ guard?: string;
9
+ consequence?: string;
10
+ weight?: number;
11
+ }
12
+ export interface AllocationSummary {
13
+ recipient_slots: number;
14
+ guard_gated_slots: number;
15
+ direct_to_me_slots: number;
16
+ to_payer_slots: number;
17
+ }
18
+ export interface NodeGameInput {
19
+ current_node: string;
20
+ perspective: CommercialRole;
21
+ appetite?: RiskAppetite;
22
+ threshold?: number;
23
+ allocation?: AllocationSummary;
24
+ requirements?: string[];
25
+ order_amount?: string;
26
+ compensation_fund?: string;
27
+ operable: NodeForwardInput[];
28
+ waiting_on: Array<{
29
+ role: string;
30
+ forwards: string[];
31
+ }>;
32
+ }
33
+ export interface NodeGameAction {
34
+ forward: string;
35
+ to_node: string;
36
+ execution_path: ExecutionPath;
37
+ guard?: string;
38
+ favorability: number;
39
+ gain_score: number;
40
+ risk_score: number;
41
+ is_optimal: boolean;
42
+ payoff_note: string;
43
+ risk: "low" | "medium" | "high";
44
+ }
45
+ export interface CooperationInfo {
46
+ threshold: number;
47
+ my_weight: number;
48
+ needed_from_others: number;
49
+ collaborators: string[];
50
+ allocation?: AllocationSummary;
51
+ allocation_note?: string;
52
+ }
53
+ export interface NodeGameAdvice {
54
+ current_node: string;
55
+ perspective: CommercialRole;
56
+ actions: NodeGameAction[];
57
+ cooperation?: CooperationInfo;
58
+ value_at_stake?: string;
59
+ risk_exposure?: string;
60
+ summary: string;
61
+ }
62
+ export declare function evaluateNodeGame(input: NodeGameInput): NodeGameAdvice;
@@ -0,0 +1 @@
1
+ import{classifyOutcome,evaluateOutcome}from'./game-strategy.js';export function evaluateNodeGame(a){const b=a['operable']['map'](c=>{const d=scoreForward(c,a['perspective'],{'risk_appetite':a['appetite'],'requirements':a['requirements']},a['order_amount']);return{'forward':c['name'],'to_node':c['to_node'],'execution_path':c['execution_path'],'guard':c['guard'],'favorability':d['favorability'],'gain_score':d['gain_score'],'risk_score':d['risk_score'],'is_optimal':![],'payoff_note':d['payoff'],'risk':d['risk']};});return b['sort']((c,d)=>d['favorability']-c['favorability']),b['length']>0x0&&(b[0x0]['is_optimal']=!![]),{'current_node':a['current_node'],'perspective':a['perspective'],'actions':b,'cooperation':evaluateCooperation(a),'value_at_stake':a['order_amount'],'risk_exposure':a['compensation_fund'],'summary':buildSummary(a,b)};}function evaluateCooperation(a){if(!a['threshold']||a['threshold']<=0x1)return undefined;const b=a['operable']['reduce']((g,h)=>g+(h['weight']??0x1),0x0),c=a['threshold']-b,d=c>0x0?a['waiting_on']['map'](f=>f['role']):[],e=a['allocation'];return{'threshold':a['threshold'],'my_weight':b,'needed_from_others':Math['max'](0x0,c),'collaborators':d,'allocation':e,'allocation_note':e?describeAllocation(e):undefined};}function describeAllocation(b){const c=['settlement\x20splits\x20across\x20'+b['recipient_slots']+'\x20recipient\x20slot(s)'];if(b['direct_to_me_slots']>0x0)c['push'](b['direct_to_me_slots']+'\x20pay\x20directly\x20to\x20you');if(b['guard_gated_slots']>0x0)c['push'](b['guard_gated_slots']+'\x20are\x20guard-resolved\x20(may\x20pay\x20a\x20cooperating\x20party)');if(b['to_payer_slots']>0x0)c['push'](b['to_payer_slots']+'\x20route\x20back\x20to\x20the\x20payer\x20(refund-oriented)');return c['join'](';\x20')+'.';}function scoreForward(a,b,c,d){const e=classifyOutcome(a['consequence']),g=evaluateOutcome(e,b,c);return{'favorability':g['net_score'],'gain_score':g['gain_score'],'risk_score':g['risk_score'],'payoff':payoffNote(e,b,d),'risk':riskOf(e,b)};}function amountSuffix(a){return a!=null?'\x20('+a+'\x20raw\x20units)':'';}function payoffNote(a,b,c){if(b==='customer'||b==='prospect')switch(a){case'refund':return'funds\x20return\x20to\x20you'+amountSuffix(c)+'\x20(refund/cancel\x20path)';case'completion':return'releases\x20escrowed\x20funds'+amountSuffix(c)+'\x20to\x20the\x20merchant\x20—\x20only\x20confirm\x20if\x20the\x20deliverable\x20matches\x20the\x20agreement';case'advance':return'advances\x20the\x20order\x20to\x20the\x20next\x20node\x20(funds'+amountSuffix(c)+'\x20stay\x20escrowed)';}if(b==='merchant'||b==='collaborator'||b==='supplier')switch(a){case'completion':return'settlement'+amountSuffix(c)+'\x20released\x20to\x20you\x20+\x20shorter\x20fund-settlement\x20cycle';case'refund':return'refund'+amountSuffix(c)+'\x20—\x20downside,\x20recorded\x20on-chain\x20(arb-loss/stall\x20stats)';case'advance':return'advance\x20the\x20workflow\x20to\x20shorten\x20settlement'+amountSuffix(c);}return'neutral\x20for\x20'+b;}function riskOf(a,b){if(b==='customer'||b==='prospect'){if(a==='completion')return'high';if(a==='refund')return'low';return'medium';}if(b==='merchant'||b==='collaborator'||b==='supplier'){if(a==='refund')return'high';return'low';}return'medium';}function buildSummary(a,b){if(b['length']===0x0)return a['waiting_on']['length']>0x0?'Waiting\x20on\x20'+a['waiting_on']['map'](e=>e['role'])['join'](',\x20'):'No\x20operable\x20actions\x20at\x20node\x20\x27'+(a['current_node']||'(entry)')+'\x27';const c=b[0x0];let d='Optimal\x20for\x20'+a['perspective']+':\x20\x27'+c['forward']+'\x27\x20→\x20\x27'+c['to_node']+'\x27\x20('+c['payoff_note']+')';return b['length']>0x1&&(d+='\x20—\x20choosing\x20this\x20closes\x20the\x20other\x20'+(b['length']-0x1)+'\x20option(s)\x20(opportunity\x20competition:\x20your\x20gain\x20may\x20be\x20another\x20role\x27s\x20lost\x20chance).'),d;}
@@ -0,0 +1,10 @@
1
+ export interface Region {
2
+ mode: "remote" | "physical";
3
+ country?: string;
4
+ province?: string;
5
+ city?: string;
6
+ raw: string;
7
+ }
8
+ export type RegionRelation = "exact" | "contains" | "overlap" | "compatible" | "mismatch";
9
+ export declare function parseRegion(raw: string): Region;
10
+ export declare function relateRegion(a: Region, b: Region): RegionRelation;
@@ -0,0 +1 @@
1
+ const REMOTE_KEYWORDS=['remote','online','anywhere'];export function parseRegion(a){const b=a?.['trim']()??'',c=b['toLowerCase'](),d=REMOTE_KEYWORDS['some'](e=>c['includes'](e));if(d)return{'mode':'remote','raw':b};return{'mode':'physical','raw':b};}export function relateRegion(c,d){if(c['mode']==='remote'||d['mode']==='remote')return'compatible';const e=normalizePhysical(c['raw']),f=normalizePhysical(d['raw']);if(!e||!f)return'mismatch';if(e===f)return'exact';if(e['includes'](f)||f['includes'](e))return'contains';if(c['province']&&d['province']&&c['province']===d['province'])return'overlap';return'mismatch';}function normalizePhysical(a){return a['trim']()['toLowerCase']()['replace'](/\s+/g,'');}
@@ -0,0 +1,77 @@
1
+ export interface DataSource {
2
+ id: string;
3
+ description: string;
4
+ evaluation_ids?: string[];
5
+ priority?: number;
6
+ isEnabled?: (ctx: EvaluationContext) => boolean;
7
+ extract(ctx: EvaluationContext): Promise<Record<string, unknown>> | Record<string, unknown>;
8
+ }
9
+ export interface EvaluationRule {
10
+ id: string;
11
+ description: string;
12
+ dimension: string;
13
+ weight: number;
14
+ evaluation_ids?: string[];
15
+ isEnabled?: (ctx: EvaluationContext) => boolean;
16
+ evaluate(ctx: EvaluationContext): RuleContribution | null;
17
+ }
18
+ export interface RuleContribution {
19
+ score: number;
20
+ weight: number;
21
+ reason?: string;
22
+ matched?: string[];
23
+ mismatched?: string[];
24
+ red_flag?: boolean;
25
+ }
26
+ export interface UserRequirement {
27
+ rule_id: string;
28
+ condition: "require" | "forbid";
29
+ note?: string;
30
+ }
31
+ export interface UserInjection {
32
+ intent?: string;
33
+ preferences?: Record<string, unknown>;
34
+ requirements?: UserRequirement[];
35
+ overrides?: {
36
+ rules?: Record<string, {
37
+ enabled?: boolean;
38
+ weight?: number;
39
+ }>;
40
+ data_sources?: Record<string, {
41
+ enabled?: boolean;
42
+ }>;
43
+ };
44
+ }
45
+ export interface EvaluationContext {
46
+ evaluation_id: string;
47
+ entities: Record<string, unknown>;
48
+ facts: Record<string, unknown>;
49
+ injection?: UserInjection;
50
+ now?: number;
51
+ }
52
+ export type EvaluationLevel = "low" | "medium_low" | "medium_high" | "high";
53
+ export interface EvaluationBreakdown {
54
+ rule_id: string;
55
+ dimension: string;
56
+ score: number;
57
+ weight: number;
58
+ reason?: string;
59
+ matched?: string[];
60
+ mismatched?: string[];
61
+ red_flag?: boolean;
62
+ }
63
+ export interface EvaluationTraceEntry {
64
+ kind: "data_source" | "rule" | "override";
65
+ id: string;
66
+ detail: string;
67
+ }
68
+ export interface EvaluationResult {
69
+ evaluation_id: string;
70
+ total: number;
71
+ level: EvaluationLevel;
72
+ breakdown: EvaluationBreakdown[];
73
+ red_flags: string[];
74
+ blocked: boolean;
75
+ trace: EvaluationTraceEntry[];
76
+ summary: string;
77
+ }
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,6 @@
1
+ import type { EvaluationRule, UserInjection } from "./types.js";
2
+ export declare const REQUIREMENT_PASS_THRESHOLD = 60;
3
+ export declare function normalizeInjection(injection?: UserInjection): UserInjection;
4
+ export declare function isRuleEnabled(ruleId: string, injection?: UserInjection): boolean;
5
+ export declare function isDataSourceEnabled(dataSourceId: string, injection?: UserInjection): boolean;
6
+ export declare function effectiveWeight(rule: EvaluationRule, injection?: UserInjection): number;
@@ -0,0 +1 @@
1
+ export const REQUIREMENT_PASS_THRESHOLD=0x3c;export function normalizeInjection(a){return{'intent':a?.['intent'],'preferences':a?.['preferences'],'requirements':a?.['requirements']??[],'overrides':a?.['overrides']??{}};}export function isRuleEnabled(a,b){const c=b?.['overrides']?.['rules']?.[a];if(c&&c['enabled']!==undefined)return c['enabled'];return!![];}export function isDataSourceEnabled(a,b){const c=b?.['overrides']?.['data_sources']?.[a];if(c&&c['enabled']!==undefined)return c['enabled'];return!![];}export function effectiveWeight(a,b){const c=b?.['overrides']?.['rules']?.[a['id']];if(c&&c['weight']!==undefined)return c['weight'];return a['weight'];}
@@ -0,0 +1,40 @@
1
+ {
2
+ "title": "Create Education Contact Object",
3
+ "description": "Create a named Contact object for an education provider, with a Permission reference and an IM entry pointing at the support account",
4
+ "tags": ["contact", "messenger", "ims", "education"],
5
+ "industry": "education",
6
+ "operation_type": "contact",
7
+ "source": "Template-generated from K2 industry defaults (not chain-verified)",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "contact",
13
+ "data": {
14
+ "object": {
15
+ "name": "education_contact",
16
+ "permission": "education_permission",
17
+ "replaceExistName": true
18
+ },
19
+ "description": "Education provider contact — course info, attendance, and refund policy",
20
+ "ims": {
21
+ "op": "add",
22
+ "im": [
23
+ {
24
+ "at": "education_support",
25
+ "description": "Primary support account"
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ "env": {
31
+ "network": "testnet",
32
+ "no_cache": true,
33
+ "confirmed": true
34
+ }
35
+ },
36
+ "notes": [
37
+ "Bind this Contact to the education Service via the service call's 'um' field.",
38
+ "Tuition should be escrowed and released per lesson (1/N) to prevent run-away disputes."
39
+ ]
40
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "title": "Create Freelance Contact Object",
3
+ "description": "Create a named Contact object for a freelance service provider, with a Permission reference and an IM entry pointing at the provider account",
4
+ "tags": ["contact", "messenger", "ims", "freelance"],
5
+ "industry": "freelance",
6
+ "operation_type": "contact",
7
+ "source": "Template-generated from K2 industry defaults (not chain-verified)",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "contact",
13
+ "data": {
14
+ "object": {
15
+ "name": "freelancer_contact",
16
+ "permission": "freelancer_permission",
17
+ "replaceExistName": true
18
+ },
19
+ "description": "Freelance provider contact — reach me for project requirements and delivery milestones",
20
+ "ims": {
21
+ "op": "add",
22
+ "im": [
23
+ {
24
+ "at": "freelancer",
25
+ "description": "Primary provider account"
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ "env": {
31
+ "network": "testnet",
32
+ "no_cache": true,
33
+ "confirmed": true
34
+ }
35
+ },
36
+ "notes": [
37
+ "Bind this Contact to the freelance Service via the service call's 'um' field.",
38
+ "ims.im[].at accepts an account name or a full 0x address."
39
+ ]
40
+ }
@@ -4,7 +4,7 @@
4
4
  "tags": ["machine", "insurance", "claim", "workflow", "draft", "12-step"],
5
5
  "industry": "insurance",
6
6
  "operation_type": "machine",
7
- "source": "docs/examples/Insurance — adapted to the 12-step plan (DRAFT only, schema-validated)",
7
+ "source": "docs/examples/Insurance — adapted to the 12-step plan (DRAFT only, schema-validated, not chain-verified)",
8
8
  "verified": false,
9
9
  "network": "testnet",
10
10
  "call": {
@@ -4,7 +4,7 @@
4
4
  "tags": ["service", "insurance", "order_allocators", "entity-sharing", "12-step"],
5
5
  "industry": "insurance",
6
6
  "operation_type": "service",
7
- "source": "docs/examples/Insurance — adapted to the 12-step plan (allocators only, schema-validated)",
7
+ "source": "docs/examples/Insurance — adapted to the 12-step plan (allocators only, schema-validated, not chain-verified)",
8
8
  "verified": false,
9
9
  "network": "testnet",
10
10
  "call": {
@@ -4,7 +4,7 @@
4
4
  "tags": ["machine", "publish", "freeze", "immutable", "12-step"],
5
5
  "industry": "general",
6
6
  "operation_type": "machine",
7
- "source": "12-step deploy plan (Step 6 Machine publish) — schema-validated",
7
+ "source": "12-step deploy plan (Step 6 Machine publish) — schema-validated, not chain-verified",
8
8
  "verified": false,
9
9
  "network": "testnet",
10
10
  "call": {
@@ -4,7 +4,7 @@
4
4
  "tags": ["service", "rental", "draft", "create", "12-step"],
5
5
  "industry": "rental",
6
6
  "operation_type": "service",
7
- "source": "ziroom testnet deployment 2026-07-29 — adapted to the 12-step plan (DRAFT only, schema-validated)",
7
+ "source": "ziroom testnet deployment 2026-07-29 — adapted to the 12-step plan (DRAFT only, schema-validated, not chain-verified)",
8
8
  "verified": false,
9
9
  "network": "testnet",
10
10
  "call": {
@@ -54,7 +54,7 @@
54
54
  }
55
55
  },
56
56
  "notes": [
57
- "Strict-mode alternative to the broad 'Merkle Root length == 66' Guard (machine_merkle_root_v2). Broad mode trusts submitter honesty; strict mode enforces WHO submitted (谁得利谁举证 — whoever benefits bears the burden of proof) without verifying message content on-chain.",
57
+ "Strict-mode alternative to the broad 'Merkle Root length == 66' Guard (machine_merkle_root_v2). Broad mode trusts submitter honesty; strict mode enforces WHO submitted (whoever benefits bears the burden of proof) without verifying message content on-chain.",
58
58
  "Schema-verified: CallGuard_DataSchema (guard.ts) — namedNew creation form; table items carry no object_type (output-only); root logic_and returns Bool (allowed root type). logic_as_u256_greater compares first node > all subsequent nodes, so proof.time is listed before order.time.",
59
59
  "Query names verified against knowledge/guard-templates.ts (tpl that uses proof.signer/proof.time/order.time): proof.signer (Proof object, Address), proof.time (U64, clock-derived, always > 0), order.time (U64), order.service (Address). context enum is exactly 'Signer' | 'Clock' | 'Guard'.",
60
60
  "Proof generation (provider side, off-chain SDK): messenger submitChainProof(env, peerAddress, description) — about_address = the customer, order id embedded in description; returns proofAddress which is later submitted as identifier 0.",
@@ -4,7 +4,7 @@
4
4
  "tags": ["service", "retail", "ecommerce", "draft", "create", "12-step"],
5
5
  "industry": "retail",
6
6
  "operation_type": "service",
7
- "source": "myshop deployment walkthrough (docs/examples/MyShop) — adapted to the 12-step plan + testnet (DRAFT only, schema-validated)",
7
+ "source": "myshop deployment walkthrough (docs/examples/MyShop) — adapted to the 12-step plan + testnet (DRAFT only, schema-validated, not chain-verified)",
8
8
  "verified": false,
9
9
  "network": "testnet",
10
10
  "call": {
@@ -4,7 +4,7 @@
4
4
  "tags": ["service", "customer_required", "um", "contact", "messenger", "retail", "hard-linkage", "12-step"],
5
5
  "industry": "retail",
6
6
  "operation_type": "service",
7
- "source": "adapted to the 12-step plan + SDK customer_required⟶um hard linkage (schema-validated)",
7
+ "source": "adapted to the 12-step plan + SDK customer_required⟶um hard linkage (schema-validated, not chain-verified)",
8
8
  "verified": false,
9
9
  "network": "testnet",
10
10
  "call": {
@@ -0,0 +1,40 @@
1
+ {
2
+ "title": "Create Subscription Contact Object",
3
+ "description": "Create a named Contact object for a subscription service, with a Permission reference and an IM entry pointing at the support account",
4
+ "tags": ["contact", "messenger", "ims", "subscription"],
5
+ "industry": "subscription",
6
+ "operation_type": "contact",
7
+ "source": "Template-generated from K2 industry defaults (not chain-verified)",
8
+ "verified": false,
9
+ "network": "testnet",
10
+ "call": {
11
+ "tool": "onchain_operations",
12
+ "operation_type": "contact",
13
+ "data": {
14
+ "object": {
15
+ "name": "subscription_contact",
16
+ "permission": "subscription_permission",
17
+ "replaceExistName": true
18
+ },
19
+ "description": "Subscription support contact — manage your plan, pause, or cancel anytime",
20
+ "ims": {
21
+ "op": "add",
22
+ "im": [
23
+ {
24
+ "at": "subscription_support",
25
+ "description": "Primary support account"
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ "env": {
31
+ "network": "testnet",
32
+ "no_cache": true,
33
+ "confirmed": true
34
+ }
35
+ },
36
+ "notes": [
37
+ "Bind this Contact to the subscription Service via the service call's 'um' field.",
38
+ "Subscription billing should use charge_guard_signer (explicit user signature per period)."
39
+ ]
40
+ }
@@ -4,7 +4,7 @@
4
4
  "tags": ["machine", "multisig", "signature", "approval-gate", "permissionIndex", "draft", "12-step"],
5
5
  "industry": "general",
6
6
  "operation_type": "machine",
7
- "source": "docs/examples/ThreeBody_Signature — adapted to the 12-step plan (DRAFT only, schema-validated)",
7
+ "source": "docs/examples/ThreeBody_Signature — adapted to the 12-step plan (DRAFT only, schema-validated, not chain-verified)",
8
8
  "verified": false,
9
9
  "network": "testnet",
10
10
  "call": {
@@ -4,7 +4,7 @@
4
4
  "tags": ["machine", "travel", "workflow", "forward-guard", "multi-node", "draft", "12-step"],
5
5
  "industry": "travel",
6
6
  "operation_type": "machine",
7
- "source": "docs/examples/Travel — adapted to the 12-step plan (DRAFT only, schema-validated)",
7
+ "source": "docs/examples/Travel — adapted to the 12-step plan (DRAFT only, schema-validated, not chain-verified)",
8
8
  "verified": false,
9
9
  "network": "testnet",
10
10
  "call": {
@@ -4,7 +4,7 @@
4
4
  "tags": ["service", "travel", "draft", "create", "12-step"],
5
5
  "industry": "travel",
6
6
  "operation_type": "service",
7
- "source": "docs/examples/Travel — adapted to the 12-step plan (DRAFT only, schema-validated)",
7
+ "source": "docs/examples/Travel — adapted to the 12-step plan (DRAFT only, schema-validated, not chain-verified)",
8
8
  "verified": false,
9
9
  "network": "testnet",
10
10
  "call": {