@wowok/agent-mcp 3.4.0 → 3.4.1

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 (405) hide show
  1. package/README.md +8 -0
  2. package/dist/chain-semantics/composition-truth.d.ts +102 -0
  3. package/dist/chain-semantics/composition-truth.js +1 -0
  4. package/dist/chain-semantics/eval-order.js +1 -1
  5. package/dist/chain-semantics/fund-flow.js +1 -1
  6. package/dist/chain-semantics/index.d.ts +1 -0
  7. package/dist/chain-semantics/index.js +1 -1
  8. package/dist/composition/audit.js +1 -1
  9. package/dist/composition/blueprint-view.d.ts +3 -3
  10. package/dist/composition/blueprint-view.js +1 -1
  11. package/dist/composition/compile.d.ts +24 -3
  12. package/dist/composition/compile.js +1 -1
  13. package/dist/composition/emit-phases.d.ts +206 -0
  14. package/dist/composition/emit-phases.js +1 -0
  15. package/dist/composition/generate.d.ts +40 -0
  16. package/dist/composition/generate.js +1 -0
  17. package/dist/composition/guard-fill.d.ts +44 -0
  18. package/dist/composition/guard-fill.js +1 -0
  19. package/dist/composition/inflight.d.ts +20 -2
  20. package/dist/composition/inflight.js +1 -1
  21. package/dist/composition/input-normalize.d.ts +15 -0
  22. package/dist/composition/input-normalize.js +1 -0
  23. package/dist/composition/materialize.d.ts +18 -13
  24. package/dist/composition/materialize.js +1 -1
  25. package/dist/composition/mode-gates.d.ts +35 -0
  26. package/dist/composition/mode-gates.js +1 -0
  27. package/dist/composition/param-disclosure.js +1 -1
  28. package/dist/composition/plan-retry-ledger.d.ts +21 -0
  29. package/dist/composition/plan-retry-ledger.js +1 -0
  30. package/dist/composition/plan.d.ts +7 -2
  31. package/dist/composition/plan.js +1 -1
  32. package/dist/composition/product-card.d.ts +94 -0
  33. package/dist/composition/product-card.js +1 -0
  34. package/dist/composition/supply-chain-emit.d.ts +46 -0
  35. package/dist/composition/supply-chain-emit.js +1 -0
  36. package/dist/config/config-audit.spec.js +1 -1
  37. package/dist/config/config-warnings.d.ts +2 -0
  38. package/dist/config/config-warnings.js +1 -0
  39. package/dist/config/exposure.d.ts +2 -2
  40. package/dist/config/judgment.d.ts +31 -5
  41. package/dist/config/judgment.js +1 -1
  42. package/dist/config/judgment.spec.js +1 -1
  43. package/dist/config/match-policy-file.d.ts +34 -0
  44. package/dist/config/match-policy-file.js +1 -0
  45. package/dist/config/match-policy-file.spec.d.ts +1 -0
  46. package/dist/config/match-policy-file.spec.js +1 -0
  47. package/dist/config/rule-engine.d.ts +5 -5
  48. package/dist/config/rule-engine.js +1 -1
  49. package/dist/config/runtime.d.ts +0 -1
  50. package/dist/config/runtime.js +1 -1
  51. package/dist/config/severity.d.ts +0 -2
  52. package/dist/config/severity.js +1 -1
  53. package/dist/config/store-policy.spec.js +1 -1
  54. package/dist/config/template-params.d.ts +42 -0
  55. package/dist/config/template-params.js +1 -0
  56. package/dist/config/template-params.spec.d.ts +1 -0
  57. package/dist/config/template-params.spec.js +1 -0
  58. package/dist/data/api/api.spec.js +1 -1
  59. package/dist/data/api/server.js +1 -1
  60. package/dist/data/projection/store.d.ts +2 -1
  61. package/dist/data/projection/store.js +1 -1
  62. package/dist/data/projection/types.d.ts +22 -0
  63. package/dist/data/sync/cdc.d.ts +1 -2
  64. package/dist/data/sync/cdc.js +1 -1
  65. package/dist/evaluation/acceptance.d.ts +8 -0
  66. package/dist/evaluation/acceptance.js +1 -1
  67. package/dist/evaluation/builtins/demand-match.js +1 -1
  68. package/dist/evaluation/builtins/graph-service.spec.js +1 -1
  69. package/dist/evaluation/capability.d.ts +2 -0
  70. package/dist/evaluation/category-match-rules.d.ts +0 -1
  71. package/dist/evaluation/category-match-rules.js +1 -1
  72. package/dist/evaluation/composer.d.ts +25 -0
  73. package/dist/evaluation/composer.js +1 -1
  74. package/dist/evaluation/engine.js +1 -1
  75. package/dist/evaluation/extract.d.ts +7 -0
  76. package/dist/evaluation/extract.js +1 -1
  77. package/dist/evaluation/game-strategy.d.ts +0 -3
  78. package/dist/evaluation/game-strategy.js +1 -1
  79. package/dist/evaluation/match-operation.d.ts +9 -0
  80. package/dist/evaluation/match-operation.js +1 -1
  81. package/dist/evaluation/match-policy-resolver.d.ts +9 -0
  82. package/dist/evaluation/match-policy-resolver.js +1 -0
  83. package/dist/evaluation/match-policy.d.ts +3 -1
  84. package/dist/evaluation/match-policy.js +1 -1
  85. package/dist/evaluation/region.d.ts +0 -6
  86. package/dist/evaluation/region.js +1 -1
  87. package/dist/evaluation/standards.d.ts +2 -1
  88. package/dist/evaluation/standards.js +1 -1
  89. package/dist/evaluation/structured-lines.d.ts +8 -0
  90. package/dist/evaluation/structured-lines.js +1 -0
  91. package/dist/evaluation/types.d.ts +6 -0
  92. package/dist/experience/realtime-feedback.js +1 -1
  93. package/dist/extensions/capability-manifest.d.ts +1 -0
  94. package/dist/extensions/capability-manifest.js +1 -1
  95. package/dist/extensions/capability.d.ts +91 -0
  96. package/dist/extensions/capability.js +1 -0
  97. package/dist/extensions/industry-audit.spec.js +1 -1
  98. package/dist/extensions/industry-pack.d.ts +13 -0
  99. package/dist/extensions/industry-pack.js +1 -1
  100. package/dist/extensions/modes.js +1 -1
  101. package/dist/extensions/registry.d.ts +0 -2
  102. package/dist/extensions/registry.js +1 -1
  103. package/dist/goal/GoalEngine.js +1 -1
  104. package/dist/graph/onchain/analyze.js +1 -1
  105. package/dist/graph/onchain/expand.js +1 -1
  106. package/dist/graph/onchain/exposure.js +1 -1
  107. package/dist/graph/onchain/facts.js +1 -1
  108. package/dist/graph/onchain/order-status.d.ts +0 -1
  109. package/dist/graph/onchain/order-status.js +1 -1
  110. package/dist/harness/recover.js +1 -1
  111. package/dist/harness/verify.d.ts +0 -3
  112. package/dist/harness/verify.js +1 -1
  113. package/dist/intent/types.d.ts +0 -1
  114. package/dist/intent/types.js +1 -1
  115. package/dist/keeper/detectors.js +1 -1
  116. package/dist/keeper/types.d.ts +0 -1
  117. package/dist/keeper/types.js +1 -1
  118. package/dist/knowledge/allocation-risk.d.ts +1 -0
  119. package/dist/knowledge/allocation-risk.js +1 -1
  120. package/dist/knowledge/allocator-rail-verifier.d.ts +6 -1
  121. package/dist/knowledge/allocator-rail-verifier.js +1 -1
  122. package/dist/knowledge/arbitration-ledger.js +1 -1
  123. package/dist/knowledge/arbitration-puzzle.js +1 -1
  124. package/dist/knowledge/audit-rules.d.ts +2 -2
  125. package/dist/knowledge/audit-rules.js +1 -1
  126. package/dist/knowledge/baselines/judgment-baselines.json +21 -2
  127. package/dist/knowledge/baselines/rules/oracle.json +120 -0
  128. package/dist/knowledge/baselines/rules/plan.json +384 -17
  129. package/dist/knowledge/baselines/rules/progress.json +20 -2
  130. package/dist/knowledge/builtin-templates.d.ts +12 -1
  131. package/dist/knowledge/builtin-templates.js +1 -1
  132. package/dist/knowledge/component-schema.js +1 -1
  133. package/dist/knowledge/contact-templates.d.ts +0 -1
  134. package/dist/knowledge/contact-templates.js +1 -1
  135. package/dist/knowledge/dynamic-pricing.js +1 -1
  136. package/dist/knowledge/fee-param-bindings.js +1 -1
  137. package/dist/knowledge/fund-layer.d.ts +1 -0
  138. package/dist/knowledge/fund-layer.js +1 -1
  139. package/dist/knowledge/game-scenarios.js +1 -1
  140. package/dist/knowledge/getting-started.js +1 -1
  141. package/dist/knowledge/guard-binding-table.d.ts +52 -0
  142. package/dist/knowledge/guard-binding-table.js +1 -0
  143. package/dist/knowledge/guard-binding-verifier.d.ts +30 -0
  144. package/dist/knowledge/guard-binding-verifier.js +1 -0
  145. package/dist/knowledge/guard-bindings.js +1 -1
  146. package/dist/knowledge/guard-blueprint.d.ts +68 -0
  147. package/dist/knowledge/guard-blueprint.js +1 -0
  148. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  149. package/dist/knowledge/guard-design-patterns.js +1 -1
  150. package/dist/knowledge/guard-field-cognition.js +1 -1
  151. package/dist/knowledge/guard-host-context.d.ts +24 -0
  152. package/dist/knowledge/guard-host-context.js +1 -0
  153. package/dist/knowledge/guard-lint.js +1 -1
  154. package/dist/knowledge/guard-node-gates.d.ts +3 -0
  155. package/dist/knowledge/guard-node-gates.js +1 -1
  156. package/dist/knowledge/guard-puzzle.js +1 -1
  157. package/dist/knowledge/guard-render.js +1 -1
  158. package/dist/knowledge/guard-risk.js +1 -1
  159. package/dist/knowledge/guard-submission-prompt.d.ts +11 -0
  160. package/dist/knowledge/guard-submission-prompt.js +1 -1
  161. package/dist/knowledge/guard-templates.d.ts +1 -1
  162. package/dist/knowledge/guard-templates.js +1 -1
  163. package/dist/knowledge/guard-translation.js +1 -1
  164. package/dist/knowledge/index.d.ts +1 -1
  165. package/dist/knowledge/index.js +1 -1
  166. package/dist/knowledge/industry-generalizer.d.ts +6 -1
  167. package/dist/knowledge/industry-generalizer.js +1 -1
  168. package/dist/knowledge/industry-registry.js +1 -1
  169. package/dist/knowledge/jsonrpc-enum.d.ts +38 -0
  170. package/dist/knowledge/jsonrpc-enum.js +1 -1
  171. package/dist/knowledge/machine-topology.js +1 -1
  172. package/dist/knowledge/machine-translation.js +1 -1
  173. package/dist/knowledge/object-dependency.d.ts +31 -0
  174. package/dist/knowledge/object-dependency.js +1 -0
  175. package/dist/knowledge/onchain-constants.d.ts +2 -0
  176. package/dist/knowledge/onchain-constants.js +1 -1
  177. package/dist/knowledge/param-schema.d.ts +23 -0
  178. package/dist/knowledge/param-schema.js +1 -1
  179. package/dist/knowledge/param-tiers.js +1 -1
  180. package/dist/knowledge/passport-ledger.js +1 -1
  181. package/dist/knowledge/path-oracle/coverage.d.ts +16 -0
  182. package/dist/knowledge/path-oracle/coverage.js +1 -0
  183. package/dist/knowledge/path-oracle/index.d.ts +5 -0
  184. package/dist/knowledge/path-oracle/index.js +1 -0
  185. package/dist/knowledge/path-oracle/products/food-delivery.d.ts +2 -0
  186. package/dist/knowledge/path-oracle/products/food-delivery.js +1 -0
  187. package/dist/knowledge/path-oracle/schema.d.ts +188 -0
  188. package/dist/knowledge/path-oracle/schema.js +1 -0
  189. package/dist/knowledge/pattern-resolutions.d.ts +2 -0
  190. package/dist/knowledge/pattern-resolutions.js +1 -1
  191. package/dist/knowledge/progress-ledger.js +1 -1
  192. package/dist/knowledge/progress-risk.js +1 -1
  193. package/dist/knowledge/projection.spec.js +1 -1
  194. package/dist/knowledge/protocol-facts.js +1 -1
  195. package/dist/knowledge/requirement-families.d.ts +13 -0
  196. package/dist/knowledge/requirement-families.js +1 -0
  197. package/dist/knowledge/reward-ledger.js +1 -1
  198. package/dist/knowledge/scenario-modes.d.ts +1 -0
  199. package/dist/knowledge/scenario-modes.js +1 -1
  200. package/dist/knowledge/semantic-ir.d.ts +4 -0
  201. package/dist/knowledge/semantic-ir.js +1 -1
  202. package/dist/knowledge/service-ledger.d.ts +1 -1
  203. package/dist/knowledge/service-ledger.js +1 -1
  204. package/dist/knowledge/sku-name-gate.d.ts +17 -0
  205. package/dist/knowledge/sku-name-gate.js +1 -0
  206. package/dist/knowledge/supply-chain.d.ts +9 -0
  207. package/dist/knowledge/supply-chain.js +1 -1
  208. package/dist/knowledge/template-loader.d.ts +14 -6
  209. package/dist/knowledge/template-loader.js +1 -1
  210. package/dist/knowledge/template-nav.d.ts +3 -1
  211. package/dist/knowledge/template-nav.js +1 -1
  212. package/dist/knowledge/template-prose.d.ts +1 -1
  213. package/dist/knowledge/template-registry.js +1 -1
  214. package/dist/knowledge/template-scanner.d.ts +62 -0
  215. package/dist/knowledge/template-scanner.js +1 -1
  216. package/dist/knowledge/template-test-profiles.js +1 -1
  217. package/dist/knowledge/tools-reference.js +1 -1
  218. package/dist/knowledge/workflow-guidance.d.ts +5 -0
  219. package/dist/knowledge/workflow-guidance.js +1 -1
  220. package/dist/monitor/MonitorLoop.js +1 -1
  221. package/dist/participation/radar-core.js +1 -1
  222. package/dist/participation/time-window.js +1 -1
  223. package/dist/persona/address-format.d.ts +0 -1
  224. package/dist/persona/address-format.js +1 -1
  225. package/dist/persona/bridge.js +1 -1
  226. package/dist/persona/index.d.ts +0 -2
  227. package/dist/persona/index.js +1 -1
  228. package/dist/persona/model.js +1 -1
  229. package/dist/persona/persona-audit.spec.js +1 -1
  230. package/dist/persona/types.d.ts +6 -0
  231. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  232. package/dist/playbooks/service-build/game-theory.d.ts +2 -2
  233. package/dist/playbooks/service-build/intent-analyzer.js +1 -1
  234. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  235. package/dist/playbooks/service-build/merchant-guide.d.ts +50 -23
  236. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  237. package/dist/playbooks/service-build/migration-planner.d.ts +2 -0
  238. package/dist/playbooks/service-build/migration-planner.js +1 -1
  239. package/dist/playbooks/service-build/mode-actions.js +1 -1
  240. package/dist/playbooks/service-build/object-panorama.d.ts +8 -0
  241. package/dist/playbooks/service-build/object-panorama.js +1 -1
  242. package/dist/playbooks/service-build/participation-radar.js +1 -1
  243. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  244. package/dist/playbooks/service-build/reverse-mapping.d.ts +6 -0
  245. package/dist/playbooks/service-build/reverse-mapping.js +1 -1
  246. package/dist/playbooks/service-build/service-panorama.d.ts +1 -0
  247. package/dist/playbooks/service-build/service-panorama.js +1 -1
  248. package/dist/playbooks/service-build/service-quote.js +1 -1
  249. package/dist/playbooks/service-build/service-quote.spec.js +1 -1
  250. package/dist/playbooks/service-build/workflow-design-assessment.d.ts +10 -1
  251. package/dist/playbooks/service-build/workflow-design-assessment.js +1 -1
  252. package/dist/review/index.js +1 -1
  253. package/dist/review/repository.js +1 -1
  254. package/dist/safety/confirm-gate.js +1 -1
  255. package/dist/schema/benchmark-migration/index.d.ts +104 -0
  256. package/dist/schema/benchmark-migration/index.js +1 -1
  257. package/dist/schema/call/allocation.d.ts +15 -6
  258. package/dist/schema/call/allocation.js +1 -1
  259. package/dist/schema/call/base.d.ts +256 -0
  260. package/dist/schema/call/base.js +1 -1
  261. package/dist/schema/call/bridge.d.ts +32 -6
  262. package/dist/schema/call/demand.d.ts +15 -6
  263. package/dist/schema/call/demand.js +1 -1
  264. package/dist/schema/call/guard.d.ts +8 -8
  265. package/dist/schema/call/guard.js +1 -1
  266. package/dist/schema/call/handler.d.ts +3 -0
  267. package/dist/schema/call/handler.js +1 -1
  268. package/dist/schema/call/machine.d.ts +32 -8
  269. package/dist/schema/call/machine.js +1 -1
  270. package/dist/schema/call/order.d.ts +26 -8
  271. package/dist/schema/call/order.js +1 -1
  272. package/dist/schema/call/payment.d.ts +20 -8
  273. package/dist/schema/call/payment.js +1 -1
  274. package/dist/schema/call/permission-handler.js +1 -1
  275. package/dist/schema/call/permission.d.ts +330 -114
  276. package/dist/schema/call/permission.js +1 -1
  277. package/dist/schema/call/personal.d.ts +10 -4
  278. package/dist/schema/call/personal.js +1 -1
  279. package/dist/schema/call/progress.d.ts +16 -4
  280. package/dist/schema/call/reward.d.ts +10 -4
  281. package/dist/schema/call/reward.js +1 -1
  282. package/dist/schema/call/semantic.d.ts +1 -0
  283. package/dist/schema/call/semantic.js +1 -1
  284. package/dist/schema/call/service.d.ts +128 -40
  285. package/dist/schema/call/service.js +1 -1
  286. package/dist/schema/call/treasury.d.ts +15 -6
  287. package/dist/schema/call/treasury.js +1 -1
  288. package/dist/schema/common/index.js +1 -1
  289. package/dist/schema/config/index.d.ts +61 -0
  290. package/dist/schema/config/index.js +1 -1
  291. package/dist/schema/envelope-unify.d.ts +4 -0
  292. package/dist/schema/envelope-unify.js +1 -0
  293. package/dist/schema/evaluation/index.d.ts +216 -19
  294. package/dist/schema/evaluation/index.js +1 -1
  295. package/dist/schema/goal/index.d.ts +47 -0
  296. package/dist/schema/goal/planning.d.ts +115 -1
  297. package/dist/schema/goal/planning.js +1 -1
  298. package/dist/schema/industry-pack/index.d.ts +137 -6
  299. package/dist/schema/industry-pack/index.js +1 -1
  300. package/dist/schema/industry-pack/modes.d.ts +6 -6
  301. package/dist/schema/keeper/index.d.ts +26 -0
  302. package/dist/schema/local/index.d.ts +137 -0
  303. package/dist/schema/local/index.js +1 -1
  304. package/dist/schema/local/wip.d.ts +6 -0
  305. package/dist/schema/local/wip.js +1 -1
  306. package/dist/schema/messenger/index.d.ts +26 -0
  307. package/dist/schema/operations.d.ts +342 -83
  308. package/dist/schema/operations.js +1 -1
  309. package/dist/schema/persona/index.d.ts +2907 -640
  310. package/dist/schema/persona/index.js +1 -1
  311. package/dist/schema/query/bi.d.ts +145 -4
  312. package/dist/schema/query/bi.js +1 -1
  313. package/dist/schema/query/index.d.ts +266 -73
  314. package/dist/schema/query/index.js +1 -1
  315. package/dist/schema/schema-query/index.d.ts +1 -1
  316. package/dist/schema/schema-query/index.js +1 -1
  317. package/dist/schema/schema-version.js +1 -1
  318. package/dist/schema/utils/permission-machine-check.d.ts +2 -0
  319. package/dist/schema/utils/permission-machine-check.js +1 -1
  320. package/dist/schema/watch/index.d.ts +16 -0
  321. package/dist/schema/watch/index.js +1 -1
  322. package/dist/schema/workflow/index.d.ts +2 -2
  323. package/dist/schema/workflow/index.js +1 -1
  324. package/dist/schema-query-impl/index.d.ts +1 -1
  325. package/dist/schema-query-impl/index.js +1 -1
  326. package/dist/schemas/account_operation.output.json +94 -0
  327. package/dist/schemas/benchmark_migration_operation.output.json +338 -9
  328. package/dist/schemas/benchmark_migration_operation.schema.json +26 -1
  329. package/dist/schemas/bridge_operation.output.json +94 -0
  330. package/dist/schemas/config_operation.output.json +352 -0
  331. package/dist/schemas/config_operation.schema.json +20 -2
  332. package/dist/schemas/evaluation_operation.output.json +570 -4
  333. package/dist/schemas/evaluation_operation.schema.json +194 -3
  334. package/dist/schemas/goal_operation.schema.json +183 -0
  335. package/dist/schemas/index.json +1 -1
  336. package/dist/schemas/industry_pack_operation.output.json +621 -0
  337. package/dist/schemas/industry_pack_operation.schema.json +20 -2
  338. package/dist/schemas/keeper_operation.output.json +94 -0
  339. package/dist/schemas/local_cache_operation.output.json +94 -0
  340. package/dist/schemas/local_history_operation.output.json +94 -0
  341. package/dist/schemas/local_info_operation.output.json +94 -0
  342. package/dist/schemas/local_mark_operation.output.json +94 -0
  343. package/dist/schemas/messenger_operation.output.json +94 -0
  344. package/dist/schemas/monitor_events.output.json +94 -0
  345. package/dist/schemas/monitor_subscription.output.json +94 -0
  346. package/dist/schemas/onchain_events.output.json +94 -0
  347. package/dist/schemas/onchain_operations.output.json +313 -1
  348. package/dist/schemas/onchain_operations.schema.json +1248 -664
  349. package/dist/schemas/onchain_operations_allocation.schema.json +30 -15
  350. package/dist/schemas/onchain_operations_arbitration.schema.json +9 -2
  351. package/dist/schemas/onchain_operations_contact.schema.json +8 -1
  352. package/dist/schemas/onchain_operations_demand.schema.json +29 -14
  353. package/dist/schemas/onchain_operations_gen_passport.schema.json +8 -1
  354. package/dist/schemas/onchain_operations_guard.schema.json +290 -105
  355. package/dist/schemas/onchain_operations_machine.schema.json +49 -34
  356. package/dist/schemas/onchain_operations_order.schema.json +63 -40
  357. package/dist/schemas/onchain_operations_payment.schema.json +26 -11
  358. package/dist/schemas/onchain_operations_permission.schema.json +362 -235
  359. package/dist/schemas/onchain_operations_personal.schema.json +27 -15
  360. package/dist/schemas/onchain_operations_progress.schema.json +45 -30
  361. package/dist/schemas/onchain_operations_proof.schema.json +8 -1
  362. package/dist/schemas/onchain_operations_repository.schema.json +8 -1
  363. package/dist/schemas/onchain_operations_reward.schema.json +32 -17
  364. package/dist/schemas/onchain_operations_service.schema.json +221 -124
  365. package/dist/schemas/onchain_operations_treasury.schema.json +32 -17
  366. package/dist/schemas/onchain_table_data.output.json +258 -6
  367. package/dist/schemas/onchain_table_data.schema.json +92 -52
  368. package/dist/schemas/persona_operation.output.json +7752 -0
  369. package/dist/schemas/persona_operation.schema.json +1232 -4
  370. package/dist/schemas/query_toolkit.output.json +756 -116
  371. package/dist/schemas/query_toolkit.schema.json +138 -7
  372. package/dist/schemas/schema_query.schema.json +1 -1
  373. package/dist/schemas/watch_operation.output.json +83 -0
  374. package/dist/schemas/wip_file.output.json +8 -0
  375. package/dist/schemas/workflow_operation.schema.json +2 -2
  376. package/dist/tools/handlers/benchmark-migration.d.ts +11 -3
  377. package/dist/tools/handlers/benchmark-migration.js +1 -1
  378. package/dist/tools/handlers/config.js +1 -1
  379. package/dist/tools/handlers/evaluation.js +1 -1
  380. package/dist/tools/handlers/evaluation.spec.js +1 -1
  381. package/dist/tools/handlers/industry-pack.js +1 -1
  382. package/dist/tools/handlers/onchain.d.ts +20 -0
  383. package/dist/tools/handlers/onchain.js +1 -1
  384. package/dist/tools/handlers/persona.js +1 -1
  385. package/dist/tools/handlers/query.d.ts +8 -0
  386. package/dist/tools/handlers/query.js +1 -1
  387. package/dist/tools/handlers/winner-derivation.d.ts +20 -0
  388. package/dist/tools/handlers/winner-derivation.js +1 -0
  389. package/dist/tools/handlers/wip-upload.js +1 -1
  390. package/dist/tools/index.d.ts +1 -0
  391. package/dist/tools/index.js +1 -1
  392. package/dist/tools/registry/business.js +1 -1
  393. package/dist/tools/registry/config.js +1 -1
  394. package/dist/tools/registry/evaluation.js +1 -1
  395. package/dist/tools/registry/identity.js +1 -1
  396. package/dist/tools/registry/query.js +1 -1
  397. package/dist/tools/transport-integrity.d.ts +7 -0
  398. package/dist/tools/transport-integrity.js +1 -0
  399. package/dist/tools/upgrade-check.js +1 -1
  400. package/dist/tools/wrap.d.ts +5 -0
  401. package/dist/tools/wrap.js +1 -1
  402. package/package.json +2 -2
  403. package/dist/extensions/business-modules.d.ts +0 -54
  404. package/dist/extensions/business-modules.js +0 -1
  405. package/dist/schemas/guard-templates.json +0 -379
@@ -1 +1 @@
1
- import{WowClient,WowGraphQLClient,getFullnodeUrl,getGraphqlUrl,normalizeWowAddress,wowTypedKindFromMoveType}from'@wowok/wowok';import{canonicalChainIdentifier,GraphQLSnapshotSource}from'./graphql-source.js';const CDC_PAGE_QUERY='\x0aquery\x20CdcPage($after:\x20UInt53!,\x20$before:\x20UInt53!,\x20$cursor:\x20String)\x20{\x0a\x20\x20\x20\x20transactions(\x0a\x20\x20\x20\x20\x20\x20\x20\x20filter:\x20{\x20afterCheckpoint:\x20$after,\x20beforeCheckpoint:\x20$before\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20first:\x2050\x0a\x20\x20\x20\x20\x20\x20\x20\x20after:\x20$cursor\x0a\x20\x20\x20\x20)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20pageInfo\x20{\x20hasNextPage\x20endCursor\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20nodes\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20digest\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20effects\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20checkpoint\x20{\x20sequenceNumber\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20objectChanges\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20nodes\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20address\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20idCreated\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20idDeleted\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20outputState\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20version\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20asMoveObject\x20{\x20contents\x20{\x20type\x20{\x20repr\x20}\x20}\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20}\x0a}',MAX_TX_PAGES=0xc8;function stalledLagCheckpoints(){const a=process['env']['WOWOK_CDC_STALLED_LAG_CHECKPOINTS'];if(a===undefined||a['trim']()==='')return 0x186a0n;const b=Number(a);if(!Number['isInteger'](b)||b<0x0)throw new Error('Invalid\x20WOWOK_CDC_STALLED_LAG_CHECKPOINTS:\x20'+a);return BigInt(b);}export class GraphQLCdcSource{['graphql'];['snapshot'];['rpc'];['network'];['expectedChainId'];constructor(a,b,c,d,e){this['graphql']=a,this['snapshot']=b,this['rpc']=c,this['network']=d,this['expectedChainId']=e;}static['forNetwork'](a,b){const c=getGraphqlUrl(a);if(!c)throw new Error('No\x20GraphQL\x20endpoint\x20configured\x20for\x20'+a);return new GraphQLCdcSource(new WowGraphQLClient({'url':c,'network':a}),GraphQLSnapshotSource['forNetwork'](a,b),new WowClient({'url':getFullnodeUrl(a),'network':a}),a,b);}async['head'](){const [a,b,c]=await Promise['all']([this['graphql']['core']['getChainIdentifier'](),this['rpc']['getChainIdentifier'](),this['rpc']['getLatestCheckpointSequenceNumber']()]),d=canonicalChainIdentifier(a['chainIdentifier']),e=canonicalChainIdentifier(b),f=canonicalChainIdentifier(this['expectedChainId']);if(d!==e||e!==f)throw new Error('CHAIN_IDENTITY_MISMATCH');return{'chainId':e,'checkpoint':c};}async['readChanges'](a,b,c){const d=BigInt(a),e=BigInt(b);if(e<=d)return{'facts':[],'deletedIds':[],'observedThrough':a,'pages':0x0};const f=canonicalChainIdentifier(this['expectedChainId']),g=new Set(),h=new Set();let i=null,j=0x0,k=a;do{const m=await this['graphql']['query']({'query':CDC_PAGE_QUERY,'variables':{'after':Number(d),'before':Number(e),'cursor':i}});if(m['errors']?.['length'])throw new Error('CDC\x20GraphQL\x20error:\x20'+JSON['stringify'](m['errors'])['slice'](0x0,0x1f4));const n=m['data']?.['transactions'];if(!n)throw new Error('CDC\x20GraphQL\x20returned\x20no\x20transactions\x20connection');for(const o of n['nodes']??[]){const p=o?.['effects']?.['checkpoint']?.['sequenceNumber'];if(p===undefined||p===null)continue;const q=BigInt(p);if(q<=d||q>=e)throw new Error('CDC_INTERVAL_VIOLATION:\x20tx\x20checkpoint\x20'+p+'\x20outside\x20('+d+',\x20'+e+')');if(q>BigInt(k))k=String(q);for(const r of o?.['effects']?.['objectChanges']?.['nodes']??[]){const s=normalizeWowAddress(r['address']);if(r['idDeleted']){h['add'](s);continue;}const t=r['outputState']?.['asMoveObject']?.['contents']?.['type']?.['repr'];if(!t)continue;if(wowTypedKindFromMoveType(t)!==c)continue;g['add'](s);}}j+=0x1,i=n['pageInfo']?.['hasNextPage']?n['pageInfo']['endCursor']:null;}while(i!==null&&j<MAX_TX_PAGES);if(i!==null)throw new Error('CDC_PAGE_CAP:\x20exceeded\x20'+MAX_TX_PAGES+'\x20pages\x20for\x20('+a+',\x20'+b+')');for(const u of h)g['delete'](u);const l=await this['snapshot']['hydrateFacts']([...g],f,k);return{'facts':l,'deletedIds':[...h],'observedThrough':k,'pages':j};}}export class CdcSynchronizer{['projection'];['source'];['cursors'];constructor(a,b,c){this['projection']=a,this['source']=b,this['cursors']=c;}async['run'](a){if(!a['expectedChainId'])throw new Error('expectedChainId\x20is\x20required');if(!a['kind'])throw new Error('kind\x20is\x20required');const b=a['maxSpan']??0x1f4;if(!Number['isInteger'](b)||b<0x1)throw new Error('Invalid\x20maxSpan:\x20'+b);if(a['stalledLag']!==undefined&&(!Number['isInteger'](a['stalledLag'])||a['stalledLag']<0x0))throw new Error('Invalid\x20stalledLag:\x20'+a['stalledLag']);const c=a['stalledLag']===undefined?stalledLagCheckpoints():BigInt(a['stalledLag']);return this['cursors']['withCdcLock'](a['expectedChainId'],a['kind'],()=>this['poll'](a,b,c));}async['poll'](a,b,c){const d=a['expectedChainId'],e=await this['source']['head']();if(e['chainId']!==d)throw new Error('CHAIN_IDENTITY_MISMATCH:\x20source\x20reported\x20'+e['chainId']);const f=await this['cursors']['cdcCheckpoint'](d,a['kind']),g={'applied':0x0,'duplicate':0x0,'stale':0x0,'quarantined':0x0,'conflict':0x0,'tombstoned':0x0,'skipped_facts':0x0};if(f===null)return await this['cursors']['setCdcCheckpoint'](d,a['kind'],e['checkpoint']),{'chainId':d,'kind':a['kind'],'anchored':!![],'reanchored_from':null,'from':null,'to':e['checkpoint'],'head':e['checkpoint'],'pages':0x0,...g};const h=BigInt(f),i=BigInt(e['checkpoint']);if(i<=h)return{'chainId':d,'kind':a['kind'],'anchored':![],'reanchored_from':null,'from':f,'to':f,'head':e['checkpoint'],'pages':0x0,...g};if(c>0x0n&&i-h>c)return await this['cursors']['setCdcCheckpoint'](d,a['kind'],e['checkpoint']),{'chainId':d,'kind':a['kind'],'anchored':![],'reanchored_from':f,'from':f,'to':e['checkpoint'],'head':e['checkpoint'],'pages':0x0,...g};const j=i<h+BigInt(b)?i:h+BigInt(b),k=await this['source']['readChanges'](f,(j+0x1n)['toString'](),a['kind']);for(const m of k['facts']){const n=m;if(!n['object_id']){g['skipped_facts']+=0x1;continue;}const o=await this['projection']['apply'](m);o['status']in g&&(g[o['status']]+=0x1);}for(const p of k['deletedIds']){await this['projection']['markTombstoneIfKind'](d,p,a['kind'])&&(g['tombstoned']+=0x1);}const l=k['observedThrough'];return BigInt(l)>h&&await this['cursors']['setCdcCheckpoint'](d,a['kind'],l),{'chainId':d,'kind':a['kind'],'anchored':![],'reanchored_from':null,'from':f,'to':BigInt(l)>h?l:f,'head':e['checkpoint'],'pages':k['pages'],...g};}}
1
+ import{WowClient,WowGraphQLClient,getFullnodeUrl,getGraphqlUrl,normalizeWowAddress,wowTypedKindFromMoveType}from'@wowok/wowok';import{canonicalChainIdentifier,GraphQLSnapshotSource}from'./graphql-source.js';const CDC_PAGE_QUERY='\x0aquery\x20CdcPage($after:\x20UInt53!,\x20$before:\x20UInt53!,\x20$cursor:\x20String)\x20{\x0a\x20\x20\x20\x20transactions(\x0a\x20\x20\x20\x20\x20\x20\x20\x20filter:\x20{\x20afterCheckpoint:\x20$after,\x20beforeCheckpoint:\x20$before\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20first:\x2050\x0a\x20\x20\x20\x20\x20\x20\x20\x20after:\x20$cursor\x0a\x20\x20\x20\x20)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20pageInfo\x20{\x20hasNextPage\x20endCursor\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20nodes\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20digest\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20effects\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20checkpoint\x20{\x20sequenceNumber\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20objectChanges\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20nodes\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20address\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20idCreated\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20idDeleted\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20outputState\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20version\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20asMoveObject\x20{\x20contents\x20{\x20type\x20{\x20repr\x20}\x20}\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20}\x0a}',MAX_TX_PAGES=0xc8;function stalledLagCheckpoints(){const a=process['env']['WOWOK_CDC_STALLED_LAG_CHECKPOINTS'];if(a===undefined||a['trim']()==='')return 0x186a0n;const b=Number(a);if(!Number['isInteger'](b)||b<0x0)throw new Error('Invalid\x20WOWOK_CDC_STALLED_LAG_CHECKPOINTS:\x20'+a);return BigInt(b);}export class GraphQLCdcSource{['graphql'];['snapshot'];['rpc'];['expectedChainId'];constructor(a,b,c,d){this['graphql']=a,this['snapshot']=b,this['rpc']=c,this['expectedChainId']=d;}static['forNetwork'](a,b){const c=getGraphqlUrl(a);if(!c)throw new Error('No\x20GraphQL\x20endpoint\x20configured\x20for\x20'+a);return new GraphQLCdcSource(new WowGraphQLClient({'url':c,'network':a}),GraphQLSnapshotSource['forNetwork'](a,b),new WowClient({'url':getFullnodeUrl(a),'network':a}),b);}async['head'](){const [a,b,c]=await Promise['all']([this['graphql']['core']['getChainIdentifier'](),this['rpc']['getChainIdentifier'](),this['rpc']['getLatestCheckpointSequenceNumber']()]),d=canonicalChainIdentifier(a['chainIdentifier']),e=canonicalChainIdentifier(b),f=canonicalChainIdentifier(this['expectedChainId']);if(d!==e||e!==f)throw new Error('CHAIN_IDENTITY_MISMATCH');return{'chainId':e,'checkpoint':c};}async['readChanges'](a,b,c){const d=BigInt(a),e=BigInt(b);if(e<=d)return{'facts':[],'deletedIds':[],'observedThrough':a,'pages':0x0};const f=canonicalChainIdentifier(this['expectedChainId']),g=new Set(),h=new Set();let i=null,j=0x0,k=a;do{const m=await this['graphql']['query']({'query':CDC_PAGE_QUERY,'variables':{'after':Number(d),'before':Number(e),'cursor':i}});if(m['errors']?.['length'])throw new Error('CDC\x20GraphQL\x20error:\x20'+JSON['stringify'](m['errors'])['slice'](0x0,0x1f4));const n=m['data']?.['transactions'];if(!n)throw new Error('CDC\x20GraphQL\x20returned\x20no\x20transactions\x20connection');for(const o of n['nodes']??[]){const p=o?.['effects']?.['checkpoint']?.['sequenceNumber'];if(p===undefined||p===null)continue;const q=BigInt(p);if(q<=d||q>=e)throw new Error('CDC_INTERVAL_VIOLATION:\x20tx\x20checkpoint\x20'+p+'\x20outside\x20('+d+',\x20'+e+')');if(q>BigInt(k))k=String(q);for(const r of o?.['effects']?.['objectChanges']?.['nodes']??[]){const s=normalizeWowAddress(r['address']);if(r['idDeleted']){h['add'](s);continue;}const t=r['outputState']?.['asMoveObject']?.['contents']?.['type']?.['repr'];if(!t)continue;if(wowTypedKindFromMoveType(t)!==c)continue;g['add'](s);}}j+=0x1,i=n['pageInfo']?.['hasNextPage']?n['pageInfo']['endCursor']:null;}while(i!==null&&j<MAX_TX_PAGES);if(i!==null)throw new Error('CDC_PAGE_CAP:\x20exceeded\x20'+MAX_TX_PAGES+'\x20pages\x20for\x20('+a+',\x20'+b+')');for(const u of h)g['delete'](u);const l=await this['snapshot']['hydrateFacts']([...g],f,k);return{'facts':l,'deletedIds':[...h],'observedThrough':k,'pages':j};}}export class CdcSynchronizer{['projection'];['source'];['cursors'];constructor(a,b,c){this['projection']=a,this['source']=b,this['cursors']=c;}async['run'](a){if(!a['expectedChainId'])throw new Error('expectedChainId\x20is\x20required');if(!a['kind'])throw new Error('kind\x20is\x20required');const b=a['maxSpan']??0x1f4;if(!Number['isInteger'](b)||b<0x1)throw new Error('Invalid\x20maxSpan:\x20'+b);if(a['stalledLag']!==undefined&&(!Number['isInteger'](a['stalledLag'])||a['stalledLag']<0x0))throw new Error('Invalid\x20stalledLag:\x20'+a['stalledLag']);const c=a['stalledLag']===undefined?stalledLagCheckpoints():BigInt(a['stalledLag']);return this['cursors']['withCdcLock'](a['expectedChainId'],a['kind'],()=>this['poll'](a,b,c));}async['poll'](a,b,c){const d=a['expectedChainId'],e=await this['source']['head']();if(e['chainId']!==d)throw new Error('CHAIN_IDENTITY_MISMATCH:\x20source\x20reported\x20'+e['chainId']);const f=await this['cursors']['cdcCheckpoint'](d,a['kind']),g={'applied':0x0,'duplicate':0x0,'stale':0x0,'quarantined':0x0,'conflict':0x0,'tombstoned':0x0,'skipped_facts':0x0};if(f===null)return await this['cursors']['setCdcCheckpoint'](d,a['kind'],e['checkpoint']),{'chainId':d,'kind':a['kind'],'anchored':!![],'reanchored_from':null,'from':null,'to':e['checkpoint'],'head':e['checkpoint'],'pages':0x0,...g};const h=BigInt(f),i=BigInt(e['checkpoint']);if(i<=h)return{'chainId':d,'kind':a['kind'],'anchored':![],'reanchored_from':null,'from':f,'to':f,'head':e['checkpoint'],'pages':0x0,...g};if(c>0x0n&&i-h>c)return await this['cursors']['setCdcCheckpoint'](d,a['kind'],e['checkpoint']),{'chainId':d,'kind':a['kind'],'anchored':![],'reanchored_from':f,'from':f,'to':e['checkpoint'],'head':e['checkpoint'],'pages':0x0,...g};const j=i<h+BigInt(b)?i:h+BigInt(b),k=await this['source']['readChanges'](f,(j+0x1n)['toString'](),a['kind']);for(const m of k['facts']){const n=m;if(!n['object_id']){g['skipped_facts']+=0x1;continue;}const o=await this['projection']['apply'](m);o['status']in g&&(g[o['status']]+=0x1);}for(const p of k['deletedIds']){await this['projection']['markTombstoneIfKind'](d,p,a['kind'])&&(g['tombstoned']+=0x1);}const l=k['observedThrough'];return BigInt(l)>h&&await this['cursors']['setCdcCheckpoint'](d,a['kind'],l),{'chainId':d,'kind':a['kind'],'anchored':![],'reanchored_from':null,'from':f,'to':BigInt(l)>h?l:f,'head':e['checkpoint'],'pages':k['pages'],...g};}}
@@ -2,17 +2,25 @@ import type { EvaluationRule } from "./types.js";
2
2
  export declare const PRESENTER_HISTORY_KEY = "presenter_history";
3
3
  export interface PresenterAcceptanceRecord {
4
4
  demand_id?: string;
5
+ presenter?: string;
6
+ presenter_service?: string;
5
7
  acceptance_score: number | null;
6
8
  feedback_time?: number;
7
9
  }
10
+ export declare const COUNTERPARTY_LIKE_THRESHOLD = 60;
8
11
  export interface AcceptanceSummary {
9
12
  score: number | null;
10
13
  rated: number;
11
14
  total: number;
12
15
  average: number | null;
16
+ clamped: number;
13
17
  }
14
18
  export declare function summarizeAcceptance(records: PresenterAcceptanceRecord[]): AcceptanceSummary;
15
19
  export declare function presenterHistoryFromEntities(entities: Record<string, unknown>): PresenterAcceptanceRecord[];
20
+ export declare function applyCounterpartyFeedback<T extends {
21
+ object: string;
22
+ }>(services: T[], records: PresenterAcceptanceRecord[]): T[];
23
+ export declare function recordsForService(records: PresenterAcceptanceRecord[], serviceObject: string | undefined | null): PresenterAcceptanceRecord[];
16
24
  export interface AcceptanceRuleOptions {
17
25
  weight: number;
18
26
  weightOf?: () => number;
@@ -1 +1 @@
1
- export const PRESENTER_HISTORY_KEY='presenter_history';export function summarizeAcceptance(a){const b=a['map'](d=>d['acceptance_score'])['filter'](d=>typeof d==='number'&&Number['isFinite'](d))['map'](d=>Math['max'](0x0,Math['min'](0x64,d)));if(b['length']===0x0)return{'score':null,'rated':0x0,'total':a['length'],'average':null};const c=b['reduce']((d,e)=>d+e,0x0)/b['length'];return{'score':Math['round'](c),'rated':b['length'],'total':a['length'],'average':Math['round'](c*0x64)/0x64};}export function presenterHistoryFromEntities(a){const b=a[PRESENTER_HISTORY_KEY];if(!Array['isArray'](b))return[];return b['filter'](c=>typeof c==='object'&&c!==null&&c['acceptance_score']!==undefined);}export function createAcceptanceRule(a,b){return{'id':'acceptance','description':'Presenter\x20historical\x20acceptance\x20score\x20backflow\x20(demand-side\x20feedback)','dimension':b['dimension']??'acceptance',get 'weight'(){return b['weightOf']?.()??b['weight'];},'evaluation_ids':[a],'evaluate':c=>{const d=b['weightOf']?.()??b['weight'],e=summarizeAcceptance(presenterHistoryFromEntities(c['entities']));if(e['score']===null)return{'score':0x32,'weight':d,'reason':e['total']>0x0?'acceptance:\x20'+e['total']+'\x20presentation(s),\x20none\x20rated\x20(neutral)':'acceptance:\x20no\x20history\x20(neutral)'};const f=b['redFlag']!==undefined&&e['rated']>=b['redFlag']['minRated']&&e['average']!==null&&e['average']<b['redFlag']['below'];return{'score':e['score'],'weight':d,'reason':'acceptance\x20avg\x20'+e['average']+'\x20over\x20'+e['rated']+'\x20rated\x20presentation(s)','red_flag':f||undefined};}};}
1
+ export const PRESENTER_HISTORY_KEY='presenter_history';export const COUNTERPARTY_LIKE_THRESHOLD=0x3c;export function summarizeAcceptance(a){let b=0x0;const c=a['map'](f=>f['acceptance_score'])['filter'](f=>typeof f==='number'&&Number['isFinite'](f)),d=c['map'](f=>{const g=Math['max'](0x0,Math['min'](0x64,f));if(g!==f)b+=0x1;return g;});if(d['length']===0x0)return{'score':null,'rated':0x0,'total':a['length'],'average':null,'clamped':0x0};const e=d['reduce']((f,g)=>f+g,0x0)/d['length'];return{'score':Math['round'](e),'rated':d['length'],'total':a['length'],'average':Math['round'](e*0x64)/0x64,'clamped':b};}function clampNote(a){return a['clamped']>0x0?';\x20'+a['clamped']+'\x20raw\x20score(s)\x20outside\x20the\x20documented\x200-100\x20scale\x20were\x20clamped\x20(the\x20chain\x20does\x20not\x20range-check\x20acceptance_score\x20—\x20raw\x20data\x20degraded)':'';}export function presenterHistoryFromEntities(a){const b=a[PRESENTER_HISTORY_KEY];if(!Array['isArray'](b))return[];return b['filter'](c=>typeof c==='object'&&c!==null&&c['acceptance_score']!==undefined);}export function applyCounterpartyFeedback(a,b){const c=new Map(),d=(e,f)=>{if(typeof e!=='string'||e==='')return;const g=e['toLowerCase'](),h=c['get'](g);if(h)h['push'](f);else c['set'](g,[f]);};for(const e of b){d(e['presenter_service'],e),d(e['presenter'],e);}if(c['size']===0x0)return a;return a['map'](f=>{const g=c['get'](f['object']['toLowerCase']());if(!g||g['length']===0x0)return f;const h=g['map'](j=>j['acceptance_score'])['filter'](j=>typeof j==='number'&&Number['isFinite'](j))['map'](j=>Math['max'](0x0,Math['min'](0x64,j)));if(h['length']===0x0)return f;const i=h['filter'](j=>j>=COUNTERPARTY_LIKE_THRESHOLD)['length'];return{...f,'buyer_feedback':{'total':h['length'],'likes':i}};});}export function recordsForService(a,b){if(typeof b!=='string'||b==='')return[];const c=b['toLowerCase']();return a['filter'](d=>typeof d['presenter_service']==='string'&&d['presenter_service']['toLowerCase']()===c||typeof d['presenter']==='string'&&d['presenter']['toLowerCase']()===c);}export function createAcceptanceRule(a,b){return{'id':'acceptance','description':'Presenter\x20historical\x20acceptance\x20score\x20backflow\x20(demand-side\x20feedback)','dimension':b['dimension']??'acceptance',get 'weight'(){return b['weightOf']?.()??b['weight'];},'evaluation_ids':[a],'evaluate':c=>{const d=b['weightOf']?.()??b['weight'],e=c['entities']?.['service'],f=presenterHistoryFromEntities(c['entities']);let g=e?recordsForService(f,e['object']):f;e&&g['length']===0x0&&!f['some'](k=>typeof k['presenter']==='string'||typeof k['presenter_service']==='string')&&(g=f);const h=summarizeAcceptance(g);if(e&&h['rated']===0x0&&h['total']===0x0){const k=f['filter'](l=>typeof l['presenter']==='string'||typeof l['presenter_service']==='string')['length'];return{'score':0x32,'weight':d,'reason':h['total']===0x0?'acceptance:\x20no\x20history\x20for\x20this\x20candidate\x20(neutral'+(k>0x0?'\x20—\x20'+k+'\x20batch\x20record(s)\x20belong\x20to\x20other\x20presenters,\x20matched\x20'+g['length']:';\x20no\x20history')+')':'acceptance:\x20'+h['total']+'\x20presentation(s)\x20for\x20this\x20candidate,\x20none\x20rated\x20(neutral)'};}if(h['score']===null)return{'score':0x32,'weight':d,'reason':h['total']>0x0?'acceptance:\x20'+h['total']+'\x20presentation(s),\x20none\x20rated\x20(neutral)'+clampNote(h):'acceptance:\x20no\x20history\x20(neutral)'};const i=b['redFlag']!==undefined&&h['rated']>=b['redFlag']['minRated']&&h['average']!==null&&h['average']<b['redFlag']['below'],j=e?'':'\x20(global\x20baseline\x20—\x20no\x20candidate\x20identity\x20in\x20context)';return{'score':h['score'],'weight':d,'reason':'acceptance\x20avg\x20'+h['average']+'\x20over\x20'+h['rated']+'\x20rated\x20presentation(s)'+j+clampNote(h),'red_flag':i||undefined};}};}
@@ -1 +1 @@
1
- import{createAcceptanceRule}from'../acceptance.js';import{requiredCapabilities}from'../capability.js';import{getEvaluationEngine}from'../engine.js';import{extractDemandCapability,extractServiceCapability}from'../extract.js';import{relateRegion}from'../region.js';import{getJudgmentDoc}from'../../config/judgment.js';export const DEMAND_MATCH_EVALUATION='demand_match';function matchParams(){return getJudgmentDoc()['match'];}const dsCaps={'id':'ds_caps','description':'Extract\x20demand\x20+\x20service\x20capability\x20vectors\x20(either\x20may\x20be\x20pre-computed\x20or\x20raw)','evaluation_ids':[DEMAND_MATCH_EVALUATION],'extract':a=>({'demand_cap':a['entities']['demand_cap']??extractDemandCapability(a['entities']['demand']),'service_cap':a['entities']['service_cap']??extractServiceCapability(a['entities']['service'])})},regionRule={'id':'region','description':'Geographic\x20region\x20relation\x20between\x20demand\x20and\x20service','dimension':'region',get 'weight'(){return matchParams()['weights']['region'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'],f=relateRegion(c['region'],e['region']);return{'score':b['region_scores'][f],'weight':b['weights']['region'],'reason':'region\x20'+f};}},industryRule={'id':'industry','description':'Industry\x20scenario\x20match','dimension':'industry',get 'weight'(){return matchParams()['weights']['industry'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'];if(c['industry']==='general'||e['industry']==='general')return{'score':b['neutral_score'],'weight':b['weights']['industry'],'reason':'industry\x20unknown\x20(neutral)'};const f=c['industry']===e['industry']?0x64:0x0;return{'score':f,'weight':b['weights']['industry'],'reason':c['industry']+'\x20vs\x20'+e['industry']};}},priceRule={'id':'price','description':'Service\x20price\x20within\x20demand\x20budget','dimension':'price',get 'weight'(){return matchParams()['weights']['price'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'];if(c['price_max']===undefined||e['price_min']===undefined)return{'score':b['neutral_score'],'weight':b['weights']['price'],'reason':'price\x20unknown\x20(neutral)'};if(e['price_min']<=c['price_max'])return{'score':0x64,'weight':b['weights']['price'],'reason':'within\x20budget'};const f=c['price_max']*BigInt(Math['round'](0x64+b['price_over_budget_tolerance_pct']))/0x64n;if(e['price_min']<=f)return{'score':b['neutral_score'],'weight':b['weights']['price'],'reason':'slightly\x20over\x20budget'};return{'score':0x0,'weight':b['weights']['price'],'reason':'over\x20budget'};}},trustRule={'id':'trust','description':'Service\x20trust\x20score','dimension':'trust',get 'weight'(){return matchParams()['weights']['trust'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['service_cap'],d=c['trust_score'],e=b['trust_bands']['find'](h=>d>=h['min']),f=e?e['score']:0x0,g=c['trust_provenance']==='cold_start_prior'?'trust\x20'+d+'\x20(cold-start\x20prior\x20—\x20no\x20verified\x20reputation\x20yet)':'trust\x20'+d;return{'score':f,'weight':b['weights']['trust'],'reason':g};}},capabilitiesRule={'id':'capabilities','description':'Demand\x20capability\x20requirements\x20covered\x20by\x20the\x20service','dimension':'capabilities',get 'weight'(){return matchParams()['weights']['capabilities'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'],f=requiredCapabilities(c['capabilities']);if(f['length']===0x0)return{'score':b['neutral_score'],'weight':b['weights']['capabilities'],'reason':'no\x20capability\x20requirement\x20(neutral)'};const g=f['filter'](h=>e['capabilities'][h]);return{'score':Math['round'](g['length']/f['length']*0x64),'weight':b['weights']['capabilities'],'matched':g,'mismatched':f['filter'](h=>!e['capabilities'][h]),'reason':g['length']+'/'+f['length']+'\x20required\x20capabilities\x20covered'};}},tagsRule={'id':'tags','description':'Keyword/tag\x20overlap','dimension':'tags',get 'weight'(){return matchParams()['weights']['tags'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'],f=new Set((c['keywords']??[])['map'](i=>i['toLowerCase']())),g=new Set([...e['tags']??[],...e['keywords']??[]]['map'](i=>i['toLowerCase']()));if(f['size']===0x0)return{'score':b['neutral_score'],'weight':b['weights']['tags'],'reason':'no\x20keywords\x20(neutral)'};const h=[...f]['filter'](i=>g['has'](i))['length'];return{'score':Math['round'](h/f['size']*0x64),'weight':b['weights']['tags'],'reason':h+'/'+f['size']+'\x20keywords'};}},acceptanceRule=createAcceptanceRule(DEMAND_MATCH_EVALUATION,{'weight':matchParams()['weights']['acceptance'],'weightOf':()=>matchParams()['weights']['acceptance']});export function registerDemandMatchEvaluation(a=getEvaluationEngine()){a['registerDataSource'](dsCaps);for(const b of[regionRule,industryRule,priceRule,trustRule,capabilitiesRule,tagsRule,acceptanceRule]){a['registerRule'](b);}}export async function matchDemandToServices(a,b,c,d,e){const f=d??matchParams()['top_n'],g=getEvaluationEngine(),h=await Promise['all'](b['map'](async i=>({'service':i,'result':await g['evaluate'](DEMAND_MATCH_EVALUATION,{'demand_cap':a,'service':i,'presenter_history':e??[]},c)})));return h['sort']((i,j)=>j['result']['total']-i['result']['total']||i['service']['object']['localeCompare'](j['service']['object'])),h['slice'](0x0,f);}export async function matchServiceToDemands(a,b,c,d,e){const f=d??matchParams()['top_n'],g=getEvaluationEngine(),h=await Promise['all'](b['map'](async i=>({'demand':i,'result':await g['evaluate'](DEMAND_MATCH_EVALUATION,{'service_cap':a,'demand':i,'presenter_history':e??[]},c)})));return h['sort']((i,j)=>j['result']['total']-i['result']['total']||i['demand']['object']['localeCompare'](j['demand']['object'])),h['slice'](0x0,f);}
1
+ import{createAcceptanceRule,applyCounterpartyFeedback}from'../acceptance.js';import{requiredCapabilities}from'../capability.js';import{getEvaluationEngine}from'../engine.js';import{extractDemandCapability,extractServiceCapability}from'../extract.js';import{relateRegion}from'../region.js';import{findSimilarIndustries}from'../../knowledge/industry-generalizer.js';import{getIndustryProfile}from'../../knowledge/industry-registry.js';import{getJudgmentDoc}from'../../config/judgment.js';export const DEMAND_MATCH_EVALUATION='demand_match';function matchParams(){return getJudgmentDoc()['match'];}const dsCaps={'id':'ds_caps','description':'Extract\x20demand\x20+\x20service\x20capability\x20vectors\x20(either\x20may\x20be\x20pre-computed\x20or\x20raw)','evaluation_ids':[DEMAND_MATCH_EVALUATION],'extract':a=>({'demand_cap':a['entities']['demand_cap']??extractDemandCapability(a['entities']['demand']),'service_cap':a['entities']['service_cap']??extractServiceCapability(a['entities']['service'])})},regionRule={'id':'region','description':'Geographic\x20region\x20relation\x20between\x20demand\x20and\x20service','dimension':'region',get 'weight'(){return matchParams()['weights']['region'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'],f=relateRegion(c['region'],e['region']);return{'score':b['region_scores'][f],'weight':b['weights']['region'],'reason':'region\x20'+f};}},industryRule={'id':'industry','description':'Industry\x20scenario\x20match','dimension':'industry',get 'weight'(){return matchParams()['weights']['industry'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'];if(c['industry']==='general'||e['industry']==='general')return{'score':b['neutral_score'],'weight':b['weights']['industry'],'reason':'industry\x20unknown\x20(neutral)'};if(c['industry']===e['industry'])return{'score':0x64,'weight':b['weights']['industry'],'reason':c['industry']+'\x20exact\x20match'};const f=getIndustryProfile(c['industry'])?.['traits'],g=getIndustryProfile(e['industry'])?.['traits'];if(!f||!g)return{'score':b['neutral_score'],'weight':b['weights']['industry'],'reason':c['industry']+'\x20vs\x20'+e['industry']+'\x20(unregistered\x20industry\x20profile\x20—\x20neutral)'};const h=findSimilarIndustries(f,0x80)['find'](k=>k['industry']===e['industry']),i=h?.['similarity']??0x0,j=i>=0.8?0x55:i>=0.5?b['neutral_score']:0x0;return{'score':j,'weight':b['weights']['industry'],'reason':c['industry']+'\x20vs\x20'+e['industry']+':\x20trait\x20similarity\x20'+i['toFixed'](0x2)};}},priceRule={'id':'price','description':'Service\x20price\x20within\x20demand\x20budget','dimension':'price',get 'weight'(){return matchParams()['weights']['price'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'];if(c['price_max']===undefined||e['price_min']===undefined)return{'score':b['neutral_score'],'weight':b['weights']['price'],'reason':'price\x20unknown\x20(neutral)'};const f=c['price_max'],g=e['price_min'];if(g*0x5n<=f*0x4n)return{'score':0x64,'weight':b['weights']['price'],'reason':'within\x20budget\x20('+g+'\x20≤\x2080%\x20of\x20the\x20'+f+'\x20cap)'};if(g<=f)return{'score':0x55,'weight':b['weights']['price'],'reason':'within\x20budget\x20('+g+'\x20in\x20the\x2080–100%\x20band\x20of\x20the\x20'+f+'\x20cap)'};const h=f*BigInt(Math['round'](0x64+b['price_over_budget_tolerance_pct']))/0x64n;if(g<=h)return{'score':b['neutral_score'],'weight':b['weights']['price'],'reason':'slightly\x20over\x20budget\x20(tolerance\x20band)'};return{'score':0x0,'weight':b['weights']['price'],'reason':'over\x20budget'};}},trustRule={'id':'trust','description':'Service\x20trust\x20score','dimension':'trust',get 'weight'(){return matchParams()['weights']['trust'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['service_cap'],d=c['trust_score'],e=b['trust_bands']['find'](h=>d>=h['min']),f=e?e['score']:0x0,g=c['trust_provenance']==='cold_start_prior'?'trust\x20'+d+'\x20(cold-start\x20prior\x20—\x20no\x20verified\x20reputation\x20yet)':'trust\x20'+d;return{'score':f,'weight':b['weights']['trust'],'reason':g};}},capabilitiesRule={'id':'capabilities','description':'Demand\x20capability\x20requirements\x20covered\x20by\x20the\x20service','dimension':'capabilities',get 'weight'(){return matchParams()['weights']['capabilities'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'],f=requiredCapabilities(c['capabilities']);if(f['length']===0x0)return{'score':b['neutral_score'],'weight':b['weights']['capabilities'],'reason':'no\x20capability\x20requirement\x20(neutral)'};const g=f['filter'](h=>e['capabilities'][h]);return{'score':Math['round'](g['length']/f['length']*0x64),'weight':b['weights']['capabilities'],'matched':g,'mismatched':f['filter'](h=>!e['capabilities'][h]),'reason':g['length']+'/'+f['length']+'\x20required\x20capabilities\x20covered'};}},buyableRule={'id':'buyable','description':'Catalog\x20buyability\x20—\x20the\x20F-RQ-01\x20dead-SKU\x20gate\x20(64-byte\x20on-chain\x20quote\x20limit)','dimension':'buyable',get 'weight'(){return matchParams()['weights']['buyable']??0xf;},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const c=matchParams(),d=a['facts']['service_cap'],e=d['buyable'];if(!e||e['total_skus']===0x0)return{'score':c['neutral_score'],'weight':c['weights']['buyable']??0xf,'reason':'SKU\x20buyability\x20unknown\x20(no\x20catalog\x20read)\x20—\x20neutral'};if(e['purchasable_skus']===0x0)return{'score':0x0,'weight':c['weights']['buyable']??0xf,'reason':'NO\x20purchasable\x20SKU:\x20'+e['dead_skus']+'/'+e['total_skus']+'\x20name(s)\x20exceed\x20the\x20on-chain\x20'+'64-byte\x20buy\x20limit\x20—\x20the\x20Service\x20quotes\x20fine\x20but\x20EVERY\x20order\x20aborts\x20'+'E_NAME_LENGTH_EXCEEDED\x20(abort\x201,\x20F-RQ-01);\x20dead\x20storefront'};return{'score':0x64,'weight':c['weights']['buyable']??0xf,'reason':e['purchasable_skus']+'/'+e['total_skus']+'\x20SKU(s)\x20pass\x20the\x2064-byte\x20buy\x20gate'+(e['dead_skus']>0x0?'\x20('+e['dead_skus']+'\x20dead\x20over-limit\x20SKU(s)\x20excluded)':'')};}},tagsRule={'id':'tags','description':'Keyword/tag\x20overlap','dimension':'tags',get 'weight'(){return matchParams()['weights']['tags'];},'evaluation_ids':[DEMAND_MATCH_EVALUATION],'evaluate':a=>{const b=matchParams(),c=a['facts']['demand_cap'],e=a['facts']['service_cap'],f=new Set((c['keywords']??[])['map'](i=>i['toLowerCase']())),g=new Set([...e['tags']??[],...e['keywords']??[]]['map'](i=>i['toLowerCase']()));if(f['size']===0x0)return{'score':b['neutral_score'],'weight':b['weights']['tags'],'reason':'no\x20keywords\x20(neutral)'};const h=[...f]['filter'](i=>g['has'](i))['length'];return{'score':Math['round'](h/f['size']*0x64),'weight':b['weights']['tags'],'reason':h+'/'+f['size']+'\x20keywords'};}},acceptanceRule=createAcceptanceRule(DEMAND_MATCH_EVALUATION,{'weight':matchParams()['weights']['acceptance'],'weightOf':()=>matchParams()['weights']['acceptance']});export function registerDemandMatchEvaluation(a=getEvaluationEngine()){a['registerDataSource'](dsCaps);for(const b of[regionRule,industryRule,priceRule,trustRule,capabilitiesRule,buyableRule,tagsRule,acceptanceRule]){a['registerRule'](b);}}export async function matchDemandToServices(a,b,c,d,e){const f=d??matchParams()['top_n'],g=applyCounterpartyFeedback(b,e??[]),h=getEvaluationEngine(),i=await Promise['all'](g['map'](async k=>({'service':k,'result':await h['evaluate'](DEMAND_MATCH_EVALUATION,{'demand_cap':a,'service':k,'presenter_history':e??[]},c)}))),j=k=>Number(k['result']['blocked']||k['service']['bPublished']===![]);return i['sort']((k,l)=>j(k)-j(l)||l['result']['total']-k['result']['total']||k['service']['object']['localeCompare'](l['service']['object'])),i['slice'](0x0,f);}export async function matchServiceToDemands(a,b,c,d,e){const f=d??matchParams()['top_n'],g=getEvaluationEngine(),h=await Promise['all'](b['map'](async i=>({'demand':i,'result':await g['evaluate'](DEMAND_MATCH_EVALUATION,{'service_cap':a,'demand':i,'presenter_history':e??[]},c)})));return h['sort']((i,j)=>Number(i['result']['blocked'])-Number(j['result']['blocked'])||j['result']['total']-i['result']['total']||i['demand']['object']['localeCompare'](j['demand']['object'])),h['slice'](0x0,f);}
@@ -1 +1 @@
1
- import{describe,expect,it}from'vitest';import{ENTRYPOINT}from'@wowok/wowok';import{FakeDataPlane}from'../../graph/onchain/dataplane.js';import{expandTopology}from'../../graph/onchain/expand.js';import{FULL,GAP,fullServiceState,gapServiceState,truncatedServiceState}from'../../graph/onchain/fixtures.js';import{buildViewport}from'../../graph/onchain/viewport.js';import{runAnalyzers}from'../../graph/onchain/analyze.js';import{EVALUATION_SERVICE_INTENTS,resolveExpansionStrategy,withEvaluationBundle}from'../../graph/onchain/strategy.js';import{projectEvaluationFacts as a73a}from'../../graph/onchain/facts.js';import{evaluateGraphServiceFacts,GRAPH_RULE_INPUT_FACTS,registerGraphServiceEvaluations}from'./graph-service.js';async function evalState(a,b){registerGraphServiceEvaluations();const c=withEvaluationBundle(resolveExpansionStrategy({'intents':[...EVALUATION_SERVICE_INTENTS]})),d=await expandTopology(new FakeDataPlane(a),{'network':ENTRYPOINT['Mainnet'],'seed':b,'edges':c['edges'],'budget':c['budget']}),e=buildViewport(d,b,'neutral'),f=a73a(e,b,runAnalyzers(e));return{'projected':f,'r':await evaluateGraphServiceFacts(f)};}const scoreOf=(a,b,c)=>a[b]['breakdown']['find'](d=>d['rule_id']===c);describe('graph\x20service\x20evaluation\x20—\x20fully\x20hooked\x20shop\x20(TR-14.1)',()=>{it('scores\x20all\x20nine\x20dimensions\x20from\x20material\x20facts\x20with\x20no\x20default-low\x20deductions',async()=>{const {r:a}=await evalState(fullServiceState(),FULL['svc']);expect(a['unverified'])['toEqual']([]),expect(a['completeness'])['toBe'](0x64);const c=scoreOf(a,'trust','trust_arbitration');expect(c['score'])['toBe'](0x64),expect(c['matched'])['toEqual'](expect['arrayContaining'](['arbitrator\x20roster\x20configured','arbitration\x20fee\x20funded','arbitration\x20active'])),expect(c['reason'])['toContain']('Arbitration\x2020/20'),expect(scoreOf(a,'trust','trust_reviews')['score'])['toBe'](0x28),expect(scoreOf(a,'trust','trust_fulfillment')['score'])['toBe'](0x19);const d=scoreOf(a,'trust','trust_fund_safety');expect(d['score'])['toBe'](0x0),expect(d['mismatched'])['toContain']('compensation\x20fund\x20below\x20the\x20statutory\x203x\x20largest-order\x20exposure\x20ceiling'),expect(scoreOf(a,'trust','trust_transparency')['score'])['toBe'](0x64),expect(a['trust']['total'])['toBe'](0x31);const e=scoreOf(a,'risk','risk_fund');expect(e['score'])['toBeLessThan'](0x64),expect(e['mismatched'])['toContain']('Payout\x20exposure:\x20compensation\x20fund\x20cannot\x20cover\x20a\x20maximum-multiple\x20award\x20on\x20the\x20largest\x20windowed\x20order'),expect(e['mismatched']?.['some'](h=>h['startsWith']('R2:')))['toBe'](![]),expect(e['finding_refs']?.['map'](h=>h['id']))['toContain']('R2:'+FULL['svc']['toLowerCase']());const f=scoreOf(a,'risk','risk_trust');expect(f['score'])['toBeLessThan'](0x64),expect(f['mismatched']?.['some'](h=>h['startsWith']('R1:')))['toBe'](![]),expect(f['mismatched']?.['length'])['toBeGreaterThan'](0x0),expect(f['finding_refs']?.['some'](h=>h['id']['startsWith']('R1:')))['toBe'](!![]);for(const h of[...a['trust']['breakdown'],...a['risk']['breakdown']]){for(const i of h['mismatched']??[])expect(i)['not']['toContain']('::node::');}expect(scoreOf(a,'risk','risk_workflow')['score'])['toBe'](0x64),expect(scoreOf(a,'risk','risk_behavior')['score'])['toBe'](0x64);for(const j of[...a['trust']['breakdown'],...a['risk']['breakdown']]){const k=(j['reason']??'')['toLowerCase']();expect(k)['not']['toContain']('no\x20data'),expect(k)['not']['toContain']('default\x20low');}const g=a['trust']['trace']['filter'](l=>l['kind']==='rule'&&l['detail']['startsWith']('score='));expect(g['map'](l=>l['id']))['toEqual'](expect['arrayContaining'](Object['keys'](GRAPH_RULE_INPUT_FACTS)['filter'](l=>l['startsWith']('trust_'))));}),it('keeps\x20the\x20injection\x20+\x20requirement\x20mechanisms\x20working',async()=>{const {projected:a}=await evalState(fullServiceState(),FULL['svc']),b=await evaluateGraphServiceFacts(a,{'overrides':{'rules':{'trust_arbitration':{'weight':0x28}}}});expect(b['trust']['total'])['toBe'](0x3a);const c=await evaluateGraphServiceFacts(a,{'requirements':[{'rule_id':'trust_fund_safety','condition':'require'}]});expect(c['trust']['blocked'])['toBe'](!![]),expect(c['trust']['red_flags']['length'])['toBeGreaterThan'](0x0);});}),describe('graph\x20service\x20evaluation\x20—\x20configured-empty\x20shell\x20(TR-14.1)',()=>{it('scores\x20verified\x20absence\x20as\x20a\x20configured\x20fact\x20and\x20excludes\x20only\x20the\x20gap\x20dimension',async()=>{const {r:a}=await evalState(gapServiceState(),GAP['svc']),b=scoreOf(a,'trust','trust_arbitration');expect(b['score'])['toBe'](0x0),expect(b['reason'])['toContain']('verified\x20absence'),expect(scoreOf(a,'trust','trust_reviews')['score'])['toBe'](0x32),expect(a['unverified'])['toEqual'](['risk_workflow']),expect(scoreOf(a,'risk','risk_workflow'))['toBeUndefined'](),expect(a['risk']['unverified'])['toEqual'](['risk_workflow']),expect(a['trust']['unverified'])['toEqual'](['risk_workflow']);const c=a['risk']['trace']['find'](d=>d['kind']==='rule'&&d['id']==='risk_workflow');expect(c?.['detail'])['toContain']('not\x20applicable'),expect(scoreOf(a,'trust','trust_transparency')['score'])['toBe'](0x28),expect(scoreOf(a,'trust','trust_fund_safety')['score'])['toBe'](0x0);});}),describe('graph\x20service\x20evaluation\x20—\x20truncated\x20order\x20window\x20(TR-14.1)',()=>{it('excludes\x20the\x20unverifiable\x20dimensions\x20and\x20renormalizes\x20the\x20weighted\x20total',async()=>{const {r:a}=await evalState(truncatedServiceState(),FULL['svc']);expect(a['unverified'])['toEqual'](expect['arrayContaining'](['trust_fulfillment','trust_fund_safety','risk_fund','risk_behavior'])),expect(scoreOf(a,'trust','trust_fulfillment'))['toBeUndefined'](),expect(scoreOf(a,'trust','trust_fund_safety'))['toBeUndefined'](),expect(scoreOf(a,'risk','risk_fund'))['toBeUndefined'](),expect(scoreOf(a,'risk','risk_behavior'))['toBeUndefined'](),expect(a['trust']['total'])['toBe'](0x44);for(const b of['trust_fulfillment','trust_fund_safety']){expect(a['trust']['trace']['find'](c=>c['kind']==='rule'&&c['id']===b)?.['detail'])['toContain']('not\x20applicable');}for(const c of['risk_fund','risk_behavior']){expect(a['risk']['trace']['find'](d=>d['kind']==='rule'&&d['id']===c)?.['detail'])['toContain']('not\x20applicable');}});}),describe('graph\x20service\x20evaluation\x20—\x20scoring\x20report\x20(TR-14.2)',()=>{it('renders\x20a\x20per-dimension\x20report\x20with\x20score,\x20weight,\x20state,\x20confidence\x20and\x20evidence',async()=>{const {projected:a,r:c}=await evalState(fullServiceState(),FULL['svc']),d=new Map(a['facts']['map'](g=>[g['key'],g])),e=[];for(const g of['trust','risk']){const h=c[g];e['push'](g['toUpperCase']()+'\x20'+h['total']+'/100\x20('+h['level']+')\x20—\x20'+h['summary']);for(const i of h['breakdown']){const j=GRAPH_RULE_INPUT_FACTS[i['rule_id']]??[],k=j['map'](o=>o+':state='+(d['get'](o)?.['state']??'missing')),l=j['map'](o=>d['get'](o)?.['provenance']['confidence']??'missing'),n=j['map'](o=>d['get'](o)?.['evidence']??'missing')['join']('\x20');e['push'](i['rule_id']+':\x20score='+i['score']+'\x20weight='+i['weight']+'\x20'+k['join'](',')+'\x20confidence='+[...new Set(l)]['join']('+')+'\x20evidence=\x22'+n+'\x22');}}expect(e)['toHaveLength'](0xb);const f=e['filter'](o=>o['includes']('score='));expect(f)['toHaveLength'](0x9);for(const o of f){expect(o)['toMatch'](/weight=\d+/),expect(o)['toContain']('state=present'),expect(o)['toMatch'](/confidence=(exact|bounded|windowed|derived)/);const p=o['match'](/evidence="(.*)"/);expect(p,o)['not']['toBeNull'](),expect(p[0x1]['length'],o)['toBeGreaterThan'](0x0);}expect(c['trust']['summary'])['toContain']('weakest\x20Fund\x20safety'),expect(c['trust']['summary'])['not']['toContain']('trust_fund_safety'),expect(c['trust']['summary'])['toMatch'](/grade: (strong|fair|weak)/),expect(c['trust']['summary'])['toContain']('Compensation\x20fund');});});
1
+ import{describe,expect,it}from'vitest';import{ENTRYPOINT}from'@wowok/wowok';import{FakeDataPlane}from'../../graph/onchain/dataplane.js';import{expandTopology}from'../../graph/onchain/expand.js';import{FULL,GAP,fullServiceState,gapServiceState,truncatedServiceState}from'../../graph/onchain/fixtures.js';import{buildViewport}from'../../graph/onchain/viewport.js';import{runAnalyzers}from'../../graph/onchain/analyze.js';import{EVALUATION_SERVICE_INTENTS,resolveExpansionStrategy,withEvaluationBundle}from'../../graph/onchain/strategy.js';import{projectEvaluationFacts as a87a}from'../../graph/onchain/facts.js';import{evaluateGraphServiceFacts,GRAPH_RULE_INPUT_FACTS,registerGraphServiceEvaluations}from'./graph-service.js';async function evalState(a,b){registerGraphServiceEvaluations();const c=withEvaluationBundle(resolveExpansionStrategy({'intents':[...EVALUATION_SERVICE_INTENTS]})),d=await expandTopology(new FakeDataPlane(a),{'network':ENTRYPOINT['Mainnet'],'seed':b,'edges':c['edges'],'budget':c['budget']}),e=buildViewport(d,b,'neutral'),f=a87a(e,b,runAnalyzers(e));return{'projected':f,'r':await evaluateGraphServiceFacts(f)};}const scoreOf=(a,b,c)=>a[b]['breakdown']['find'](d=>d['rule_id']===c);describe('graph\x20service\x20evaluation\x20—\x20fully\x20hooked\x20shop\x20(TR-14.1)',()=>{it('scores\x20all\x20nine\x20dimensions\x20from\x20material\x20facts\x20with\x20no\x20default-low\x20deductions',async()=>{const {r:a}=await evalState(fullServiceState(),FULL['svc']);expect(a['unverified'])['toEqual']([]),expect(a['completeness'])['toBe'](0x64);const c=scoreOf(a,'trust','trust_arbitration');expect(c['score'])['toBe'](0x64),expect(c['matched'])['toEqual'](expect['arrayContaining'](['arbitrator\x20roster\x20configured','arbitration\x20fee\x20funded','arbitration\x20active'])),expect(c['reason'])['toContain']('Arbitration\x2020/20'),expect(scoreOf(a,'trust','trust_reviews')['score'])['toBe'](0x28),expect(scoreOf(a,'trust','trust_fulfillment')['score'])['toBe'](0x19);const d=scoreOf(a,'trust','trust_fund_safety');expect(d['score'])['toBe'](0x0),expect(d['mismatched'])['toContain']('compensation\x20fund\x20below\x20the\x20statutory\x203x\x20largest-order\x20exposure\x20ceiling'),expect(scoreOf(a,'trust','trust_transparency')['score'])['toBe'](0x64),expect(a['trust']['total'])['toBe'](0x31);const e=scoreOf(a,'risk','risk_fund');expect(e['score'])['toBeLessThan'](0x64),expect(e['mismatched'])['toContain']('Payout\x20exposure:\x20compensation\x20fund\x20cannot\x20cover\x20a\x20maximum-multiple\x20award\x20on\x20the\x20largest\x20windowed\x20order'),expect(e['mismatched']?.['some'](h=>h['startsWith']('R2:')))['toBe'](![]),expect(e['finding_refs']?.['map'](h=>h['id']))['toContain']('R2:'+FULL['svc']['toLowerCase']());const f=scoreOf(a,'risk','risk_trust');expect(f['score'])['toBeLessThan'](0x64),expect(f['mismatched']?.['some'](h=>h['startsWith']('R1:')))['toBe'](![]),expect(f['mismatched']?.['length'])['toBeGreaterThan'](0x0),expect(f['finding_refs']?.['some'](h=>h['id']['startsWith']('R1:')))['toBe'](!![]);for(const h of[...a['trust']['breakdown'],...a['risk']['breakdown']]){for(const i of h['mismatched']??[])expect(i)['not']['toContain']('::node::');}expect(scoreOf(a,'risk','risk_workflow')['score'])['toBe'](0x64),expect(scoreOf(a,'risk','risk_behavior')['score'])['toBe'](0x64);for(const j of[...a['trust']['breakdown'],...a['risk']['breakdown']]){const k=(j['reason']??'')['toLowerCase']();expect(k)['not']['toContain']('no\x20data'),expect(k)['not']['toContain']('default\x20low');}const g=a['trust']['trace']['filter'](l=>l['kind']==='rule'&&l['detail']['startsWith']('score='));expect(g['map'](l=>l['id']))['toEqual'](expect['arrayContaining'](Object['keys'](GRAPH_RULE_INPUT_FACTS)['filter'](l=>l['startsWith']('trust_'))));}),it('keeps\x20the\x20injection\x20+\x20requirement\x20mechanisms\x20working',async()=>{const {projected:a}=await evalState(fullServiceState(),FULL['svc']),b=await evaluateGraphServiceFacts(a,{'overrides':{'rules':{'trust_arbitration':{'weight':0x28}}}});expect(b['trust']['total'])['toBe'](0x3a);const c=await evaluateGraphServiceFacts(a,{'requirements':[{'rule_id':'trust_fund_safety','condition':'require'}]});expect(c['trust']['blocked'])['toBe'](!![]),expect(c['trust']['red_flags']['length'])['toBeGreaterThan'](0x0);});}),describe('graph\x20service\x20evaluation\x20—\x20configured-empty\x20shell\x20(TR-14.1)',()=>{it('scores\x20verified\x20absence\x20as\x20a\x20configured\x20fact\x20and\x20excludes\x20only\x20the\x20gap\x20dimension',async()=>{const {r:a}=await evalState(gapServiceState(),GAP['svc']),b=scoreOf(a,'trust','trust_arbitration');expect(b['score'])['toBe'](0x0),expect(b['reason'])['toContain']('verified\x20absence'),expect(scoreOf(a,'trust','trust_reviews')['score'])['toBe'](0x32),expect(a['unverified'])['toEqual'](['risk_workflow']),expect(scoreOf(a,'risk','risk_workflow'))['toBeUndefined'](),expect(a['risk']['unverified'])['toEqual'](['risk_workflow']),expect(a['trust']['unverified'])['toEqual'](['risk_workflow']);const c=a['risk']['trace']['find'](d=>d['kind']==='rule'&&d['id']==='risk_workflow');expect(c?.['detail'])['toContain']('not\x20applicable'),expect(scoreOf(a,'trust','trust_transparency')['score'])['toBe'](0x28),expect(scoreOf(a,'trust','trust_fund_safety')['score'])['toBe'](0x0);});}),describe('graph\x20service\x20evaluation\x20—\x20truncated\x20order\x20window\x20(TR-14.1)',()=>{it('excludes\x20the\x20unverifiable\x20dimensions\x20and\x20renormalizes\x20the\x20weighted\x20total',async()=>{const {r:a}=await evalState(truncatedServiceState(),FULL['svc']);expect(a['unverified'])['toEqual'](expect['arrayContaining'](['trust_fulfillment','trust_fund_safety','risk_fund','risk_behavior'])),expect(scoreOf(a,'trust','trust_fulfillment'))['toBeUndefined'](),expect(scoreOf(a,'trust','trust_fund_safety'))['toBeUndefined'](),expect(scoreOf(a,'risk','risk_fund'))['toBeUndefined'](),expect(scoreOf(a,'risk','risk_behavior'))['toBeUndefined'](),expect(a['trust']['total'])['toBe'](0x44);for(const b of['trust_fulfillment','trust_fund_safety']){expect(a['trust']['trace']['find'](c=>c['kind']==='rule'&&c['id']===b)?.['detail'])['toContain']('not\x20applicable');}for(const c of['risk_fund','risk_behavior']){expect(a['risk']['trace']['find'](d=>d['kind']==='rule'&&d['id']===c)?.['detail'])['toContain']('not\x20applicable');}});}),describe('graph\x20service\x20evaluation\x20—\x20scoring\x20report\x20(TR-14.2)',()=>{it('renders\x20a\x20per-dimension\x20report\x20with\x20score,\x20weight,\x20state,\x20confidence\x20and\x20evidence',async()=>{const {projected:a,r:c}=await evalState(fullServiceState(),FULL['svc']),d=new Map(a['facts']['map'](g=>[g['key'],g])),e=[];for(const g of['trust','risk']){const h=c[g];e['push'](g['toUpperCase']()+'\x20'+h['total']+'/100\x20('+h['level']+')\x20—\x20'+h['summary']);for(const i of h['breakdown']){const j=GRAPH_RULE_INPUT_FACTS[i['rule_id']]??[],k=j['map'](o=>o+':state='+(d['get'](o)?.['state']??'missing')),l=j['map'](o=>d['get'](o)?.['provenance']['confidence']??'missing'),n=j['map'](o=>d['get'](o)?.['evidence']??'missing')['join']('\x20');e['push'](i['rule_id']+':\x20score='+i['score']+'\x20weight='+i['weight']+'\x20'+k['join'](',')+'\x20confidence='+[...new Set(l)]['join']('+')+'\x20evidence=\x22'+n+'\x22');}}expect(e)['toHaveLength'](0xb);const f=e['filter'](o=>o['includes']('score='));expect(f)['toHaveLength'](0x9);for(const o of f){expect(o)['toMatch'](/weight=\d+/),expect(o)['toContain']('state=present'),expect(o)['toMatch'](/confidence=(exact|bounded|windowed|derived)/);const p=o['match'](/evidence="(.*)"/);expect(p,o)['not']['toBeNull'](),expect(p[0x1]['length'],o)['toBeGreaterThan'](0x0);}expect(c['trust']['summary'])['toContain']('weakest\x20Fund\x20safety'),expect(c['trust']['summary'])['not']['toContain']('trust_fund_safety'),expect(c['trust']['summary'])['toMatch'](/grade: (strong|fair|weak)/),expect(c['trust']['summary'])['toContain']('Compensation\x20fund');});});
@@ -1,4 +1,5 @@
1
1
  import type { Region } from "./region.js";
2
+ import type { CatalogBuyability } from "../knowledge/sku-name-gate.js";
2
3
  export type IndustryScenario = string;
3
4
  export interface WorkflowCapabilities {
4
5
  has_arbitration: boolean;
@@ -31,6 +32,7 @@ export interface CapabilityVector {
31
32
  capabilities: WorkflowCapabilities;
32
33
  tags: string[];
33
34
  keywords: string[];
35
+ buyable?: CatalogBuyability;
34
36
  }
35
37
  export interface CapabilityGap {
36
38
  dimension: keyof WorkflowCapabilities | "industry" | "region" | "price" | "trust";
@@ -17,7 +17,6 @@ export interface CategoryMatchRules {
17
17
  }
18
18
  export declare const CATEGORY_MATCH_RULES: Record<string, CategoryMatchRules>;
19
19
  export declare function resolveCategoryMatchRules(category?: string): CategoryMatchRules | undefined;
20
- export declare function listCategoryMatchRules(): string[];
21
20
  export declare function registerCategoryMatchRules(rules: CategoryMatchRules, replace?: boolean): boolean;
22
21
  export declare function toSoftWeightInjection(rules: CategoryMatchRules): UserInjection;
23
22
  export interface HardConstraintResult<T> {
@@ -1 +1 @@
1
- export const CATEGORY_MATCH_RULES={'life_service':{'category':'life_service','hard_constraints':[{'field':'bPublished','kind':'truthy','description':'service\x20must\x20be\x20published'},{'field':'bPaused','kind':'falsy','description':'service\x20must\x20not\x20be\x20paused'}],'soft_weights':{'region':0x14,'industry':0xf,'price':0xa,'trust':0x19,'capabilities':0x19,'tags':0x5},'highlight_fields':['service_radius','slot_availability','credential'],'calendar_mode':'slot','geo_mode':'strict','pricing_rules':['time_slot','last_minute']},'retail':{'category':'retail','hard_constraints':[{'field':'bPublished','kind':'truthy','description':'service\x20must\x20be\x20published'},{'field':'bPaused','kind':'falsy','description':'service\x20must\x20not\x20be\x20paused'}],'soft_weights':{'region':0xa,'industry':0xf,'price':0x19,'trust':0xf,'capabilities':0x1e,'tags':0x5},'highlight_fields':['return_policy','logistics_sla','stock'],'calendar_mode':'none','geo_mode':'logistics','pricing_rules':['tiered_quantity','seasonal_float']}};export function resolveCategoryMatchRules(a){if(!a)return undefined;return CATEGORY_MATCH_RULES[a]??CATEGORY_MATCH_RULES[a['toLowerCase']()];}export function listCategoryMatchRules(){return Object['keys'](CATEGORY_MATCH_RULES);}export function registerCategoryMatchRules(a,b=![]){const c=a['category'];if(!c)return![];if(CATEGORY_MATCH_RULES[c]&&!b)return![];return CATEGORY_MATCH_RULES[c]=a,!![];}export function toSoftWeightInjection(a){const b={};for(const [c,d]of Object['entries'](a['soft_weights'])){b[c]={'weight':d};}return{'overrides':{'rules':b}};}export function applyHardConstraints(a,b){const c=[],d=[];for(const e of b){const f=e;let g=!![];for(const h of a['hard_constraints']){const i=f[h['field']];if(i===undefined||i===null)continue;const j=h['kind']==='truthy'?!!i:!i;if(!j){d['push']({'candidate':e,'constraint':h}),g=![];break;}}if(g)c['push'](e);}return{'passed':c,'dropped':d};}
1
+ export const CATEGORY_MATCH_RULES={'life_service':{'category':'life_service','hard_constraints':[{'field':'bPublished','kind':'truthy','description':'service\x20must\x20be\x20published'},{'field':'bPaused','kind':'falsy','description':'service\x20must\x20not\x20be\x20paused'}],'soft_weights':{'region':0x14,'industry':0xf,'price':0xa,'trust':0x19,'capabilities':0x19,'tags':0x5},'highlight_fields':['service_radius','slot_availability','credential'],'calendar_mode':'slot','geo_mode':'strict','pricing_rules':['time_slot','last_minute']},'retail':{'category':'retail','hard_constraints':[{'field':'bPublished','kind':'truthy','description':'service\x20must\x20be\x20published'},{'field':'bPaused','kind':'falsy','description':'service\x20must\x20not\x20be\x20paused'}],'soft_weights':{'region':0xa,'industry':0xf,'price':0x19,'trust':0xf,'capabilities':0x1e,'tags':0x5},'highlight_fields':['return_policy','logistics_sla','stock'],'calendar_mode':'none','geo_mode':'logistics','pricing_rules':['tiered_quantity','seasonal_float']}};export function resolveCategoryMatchRules(a){if(!a)return undefined;return CATEGORY_MATCH_RULES[a]??CATEGORY_MATCH_RULES[a['toLowerCase']()];}export function registerCategoryMatchRules(a,b=![]){const c=a['category'];if(!c)return![];if(CATEGORY_MATCH_RULES[c]&&!b)return![];return CATEGORY_MATCH_RULES[c]=a,!![];}export function toSoftWeightInjection(a){const b={};for(const [c,d]of Object['entries'](a['soft_weights'])){b[c]={'weight':d};}return{'overrides':{'rules':b}};}export function applyHardConstraints(a,b){const c=[],d=[];for(const e of b){const f=e;let g=!![];for(const h of a['hard_constraints']){const i=f[h['field']];if(i===undefined||i===null)continue;const j=h['kind']==='truthy'?!!i:!i;if(!j){d['push']({'candidate':e,'constraint':h}),g=![];break;}}if(g)c['push'](e);}return{'passed':c,'dropped':d};}
@@ -1,4 +1,5 @@
1
1
  import type { CapabilityVector, WorkflowCapabilities } from "./capability.js";
2
+ import type { CapabilityId } from "../extensions/capability.js";
2
3
  export interface CompositePlan {
3
4
  demand: string;
4
5
  services: Array<{
@@ -11,3 +12,27 @@ export interface CompositePlan {
11
12
  summary: string;
12
13
  }
13
14
  export declare function composeServicesForDemand(demand: CapabilityVector, services: CapabilityVector[]): CompositePlan;
15
+ export interface ComposeProbeBlocker {
16
+ code: string;
17
+ detail: string;
18
+ }
19
+ export interface ComposeProbeResult {
20
+ capabilities: CapabilityId[];
21
+ feasible: boolean;
22
+ blockers: ComposeProbeBlocker[];
23
+ risks: string[];
24
+ disclosures: string[];
25
+ cost_delta: {
26
+ gas_objects: number;
27
+ funds: string[];
28
+ };
29
+ provides: Array<keyof WorkflowCapabilities>;
30
+ plan_steps?: number;
31
+ audit_score?: number;
32
+ templates_version: number;
33
+ }
34
+ interface ComposeProbeOptions {
35
+ baseTemplate?: string;
36
+ }
37
+ export declare function composeProbe(capabilityIds: CapabilityId[], opts?: ComposeProbeOptions): ComposeProbeResult;
38
+ export {};
@@ -1 +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')};}
1
+ import{requiredCapabilities}from'./capability.js';import{relateRegion}from'./region.js';import{getCapability}from'../extensions/capability.js';import{compileTemplate}from'../composition/compile.js';import{reflux}from'../composition/reflux.js';import{getBuiltinTemplate,BUILTIN_TEMPLATES_VERSION}from'../knowledge/builtin-templates.js';export function composeServicesForDemand(a,b){const c=requiredCapabilities(a['capabilities']),d=new Set(c),e=[],f=b['filter'](j=>relateRegion(a['region'],j['region'])!=='mismatch'),g=b['filter'](j=>!f['includes'](j));for(const j of[f,g]){while(d['size']>0x0){let l=null;for(const m of j){if(e['some'](o=>o['id']===m['id']))continue;const n=c['filter'](o=>d['has'](o)&&m['capabilities'][o]);(!l||n['length']>l['covered']['length'])&&(l={'id':m['id'],'covered':n});}if(!l||l['covered']['length']===0x0)break;e['push'](l);for(const o of l['covered'])d['delete'](o);}}const h=c['length']===0x0?0x64:Math['round']((c['length']-d['size'])/c['length']*0x64),i=d['size']===0x0?'ready':e['length']>0x0?'needs_supply_chain':'infeasible';return{'demand':a['id'],'services':e,'coverage_score':h,'remaining_missing':[...d],'feasibility':i,'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'+h+'/100;\x20missing:\x20'+([...d]['join'](',\x20')||'none')};}const composeProbeCache=new Map();export function composeProbe(a,c){const d=[...new Set(a)],e=c?.['baseTemplate'],f=BUILTIN_TEMPLATES_VERSION+'|'+d['slice']()['sort']()['join'](',')+'|'+(e??''),g=composeProbeCache['get'](f);if(g)return g;const h=[],i=d['map'](r=>getCapability(r))['filter'](r=>!!r);for(const r of d){!i['some'](s=>s['id']===r)&&h['push']({'code':'COMPOSE-UNKNOWN-CAPABILITY','detail':'\x27'+r+'\x27\x20is\x20not\x20a\x20registered\x20capability\x20—\x20list\x20them\x20via\x20industry_pack_operation\x20action=\x27capability_list\x27'});}for(const s of i){for(const u of s['requires']){!d['includes'](u)&&h['push']({'code':'COMPOSE-REQUIRES-MISSING','detail':'\x27'+s['id']+'\x27\x20requires\x20\x27'+u+'\x27\x20in\x20the\x20same\x20selection'});}for(const v of s['excludes']){d['includes'](v)&&h['push']({'code':'COMPOSE-EXCLUDES-CONFLICT','detail':'\x27'+s['id']+'\x27\x20and\x20\x27'+v+'\x27\x20cannot\x20coexist\x20in\x20one\x20build\x20(mutual\x20exclusion)'});}}const j=[...new Set(i['flatMap'](w=>w['risks']))],k=[...new Set(i['flatMap'](w=>w['disclosures']))],l=[...new Set(i['map'](w=>w['cost']['fund'])['filter'](w=>!!w))],m={'gas_objects':i['reduce']((w,y)=>w+y['cost']['gas_objects'],0x0),'funds':l},n=[...new Set(i['flatMap'](w=>w['provides']))];let o,p;if(e!==undefined){const w=getBuiltinTemplate(e);if(!w)h['push']({'code':'COMPOSE-BASE-TEMPLATE-UNKNOWN','detail':'base\x20template\x20\x27'+e+'\x27\x20is\x20not\x20in\x20the\x20builtin\x20catalog'});else{const y=compileTemplate(w,{},{'nameBase':'compose-probe','buildTimeMs':0x0});for(const A of y['blockers']){h['push']({'code':A['code'],'detail':'base\x20template\x20\x27'+e+'\x27:\x20'+A['detail']});}const z=reflux(y['plan']);for(const B of z['audit']['issues']){h['push']({'code':B['code'],'detail':'base\x20template\x20\x27'+e+'\x27:\x20'+B['detail']});}o=z['plan']['steps']['length'],p=z['audit']['issues']['length']===0x0?0x64:0x0;}}const q={'capabilities':d,'feasible':h['length']===0x0,'blockers':h,'risks':j,'disclosures':k,'cost_delta':m,'provides':n,...o!==undefined?{'plan_steps':o}:{},...p!==undefined?{'audit_score':p}:{},'templates_version':BUILTIN_TEMPLATES_VERSION};return composeProbeCache['set'](f,q),q;}
@@ -1 +1 @@
1
- import{REQUIREMENT_PASS_THRESHOLD,effectiveWeight,isDataSourceEnabled,isRuleEnabled,normalizeInjection}from'./user-injection.js';import{levelFromScore as a79a}from'./standards.js';export function levelFromScore(a){return a79a(a);}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){f['push']({'kind':'rule','id':o['id'],'detail':'not\x20applicable\x20—\x20excluded\x20from\x20weighted\x20aggregation'});continue;}const q=effectiveWeight(o,d);h['push']({'rule_id':o['id'],'dimension':o['dimension'],'score':p['score'],'weight':q,'weight_source':q!==o['weight']?'override':'default','reason':p['reason'],'matched':p['matched'],'mismatched':p['mismatched'],'finding_refs':p['finding_refs'],'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=e['facts']['summary']??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,'criterionScores':e['facts']['criterionScores'],'findings':e['facts']['findings'],'strengths':e['facts']['strengths'],'needsLlm':e['facts']['needsLlm'],'llmPrompt':e['facts']['llmPrompt']};}}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']();}
1
+ import{REQUIREMENT_PASS_THRESHOLD,effectiveWeight,isDataSourceEnabled,isRuleEnabled,normalizeInjection}from'./user-injection.js';import{levelFromScore as a93a}from'./standards.js';export function levelFromScore(a){return a93a(a);}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=[],h=Array['from'](this['dataSources']['values']())['filter'](n=>appliesTo(n['evaluation_ids'],a))['sort']((n,o)=>(n['priority']??0x0)-(o['priority']??0x0));for(const n of h){if(!isDataSourceEnabled(n['id'],d)){f['push']({'kind':'override','id':n['id'],'detail':'data\x20source\x20disabled\x20by\x20user\x20override'});continue;}if(n['isEnabled']&&!n['isEnabled'](e))continue;const o=await n['extract'](e);Object['assign'](e['facts'],o),f['push']({'kind':'data_source','id':n['id'],'detail':'extracted\x20'+Object['keys'](o)['length']+'\x20fact(s)'});}const i=[],j=[];for(const p of this['rules']['values']()){if(!appliesTo(p['evaluation_ids'],a))continue;if(!isRuleEnabled(p['id'],d)){f['push']({'kind':'override','id':p['id'],'detail':'rule\x20disabled\x20by\x20user\x20override'});continue;}if(p['isEnabled']&&!p['isEnabled'](e))continue;const q=p['evaluate'](e);if(!q){f['push']({'kind':'rule','id':p['id'],'detail':'not\x20applicable\x20—\x20excluded\x20from\x20weighted\x20aggregation'});continue;}const r=effectiveWeight(p,d);i['push']({'rule_id':p['id'],'dimension':p['dimension'],'score':q['score'],'weight':r,'weight_source':r!==p['weight']?'override':'default','reason':q['reason'],'matched':q['matched'],'mismatched':q['mismatched'],'finding_refs':q['finding_refs'],'red_flag':q['red_flag']});if(q['red_flag']){const s=q['reason']??p['id']+'\x20triggered\x20a\x20hard\x20block';j['push'](s),g['push']({'flag':s,'basis':'object_defect','rule_id':p['id']});}f['push']({'kind':'rule','id':p['id'],'detail':'score='+q['score']+'\x20weight='+r});}const k=aggregateScore(i);let l=j['length']>0x0;for(const t of d['requirements']??[]){const u=i['find'](v=>v['rule_id']===t['rule_id']);if(t['condition']==='require'){if(!u||u['score']<REQUIREMENT_PASS_THRESHOLD||u['red_flag']){l=!![];const v=t['note']??'Requirement\x20requires\x20rule\x20\x27'+t['rule_id']+'\x27\x20to\x20pass';j['push'](v),g['push']({'flag':v,'basis':'requirement_unmet','rule_id':t['rule_id']});}}else{if(t['condition']==='forbid'){if(u&&u['red_flag']){l=!![];const w=t['note']??'Requirement\x20forbids\x20rule\x20\x27'+t['rule_id']+'\x27\x20from\x20triggering';j['push'](w),g['push']({'flag':w,'basis':'requirement_unmet','rule_id':t['rule_id']});}}}}const m=e['facts']['summary']??buildSummary(a,k,i,j,l);return{'evaluation_id':a,'total':k,'level':levelFromScore(k),'breakdown':i,'red_flags':j,'red_flag_basis':g,'blocked':l,'trace':f,'summary':m,'criterionScores':e['facts']['criterionScores'],'findings':e['facts']['findings'],'strengths':e['facts']['strengths'],'needsLlm':e['facts']['needsLlm'],'llmPrompt':e['facts']['llmPrompt']};}}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']();}
@@ -23,6 +23,12 @@ export interface ServiceExtractInput {
23
23
  bPaused?: boolean;
24
24
  order_allocators?: unknown;
25
25
  owner?: string;
26
+ buyer_feedback?: CounterpartyFeedback;
27
+ }
28
+ export interface CounterpartyFeedback {
29
+ total: number;
30
+ likes: number;
31
+ completed_orders?: number;
26
32
  }
27
33
  export interface DemandExtractInput {
28
34
  object: string;
@@ -33,4 +39,5 @@ export interface DemandExtractInput {
33
39
  owner?: string;
34
40
  }
35
41
  export declare function extractServiceCapability(input: ServiceExtractInput, overrides?: Partial<CapabilityVector>): CapabilityVector;
42
+ export declare function hasOrderBoundPayoutRail(order_allocators: unknown): boolean;
36
43
  export declare function extractDemandCapability(input: DemandExtractInput, overrides?: Partial<CapabilityVector>): CapabilityVector;
@@ -1 +1 @@
1
- import{parseRegion}from'./region.js';import{findSimilarIndustries,inferTraitsFromDescription}from'../knowledge/industry-generalizer.js';import{isRegisteredIndustry}from'../knowledge/industry-registry.js';export 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&&isRegisteredIndustry(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':a['machine']!=null,'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,'trust_provenance':'cold_start_prior','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,'trust_provenance':'cold_start_prior','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);}
1
+ import{parseRegion}from'./region.js';import{findSimilarIndustries,inferTraitsFromDescription,detectDomainPriors}from'../knowledge/industry-generalizer.js';import{isRegisteredIndustry}from'../knowledge/industry-registry.js';import{catalogBuyability}from'../knowledge/sku-name-gate.js';export 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,trait_confidence:f}=inferTraitsFromDescription(b),g=findSimilarIndustries(c,0x3,{'trait_confidence':f}),h=detectDomainPriors(b),i=g['map'](n=>{const o=h['filter'](q=>q['industries']['includes'](n['industry']))['reduce']((q,r)=>q+r['boost'],0x0);return o>0x0?{...n,'similarity':Math['min'](0x1,n['similarity']+o),'domain_prior':!![]}:n;})['sort']((n,o)=>o['similarity']-n['similarity']),j=i[0x0],k=j?.['similarity']??0x0,l=e['length']>0x0&&k>=0.5,m=j&&isRegisteredIndustry(j['industry'])?j['industry']:'general';return{'industry':l?m:'general','industry_confidence':l?Math['max'](d,k):0x0,'tags':l?i['slice'](0x0,0x3)['map'](n=>n['industry']):[],'keywords':e};}export function extractServiceCapability(a,b){const c=a['sales']??[],d=c['map'](p=>toBigInt(p['price']))['filter'](q=>q!==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||hasOrderBoundPayoutRail(a['order_allocators']),'has_milestone_nodes':a['machine']!=null,'has_compensation_fund':f>0x0n,'has_wip_verification':c['some'](p=>!!p['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=a['buyer_feedback'],j=!!i&&Number['isFinite'](i['total'])&&Number['isFinite'](i['likes'])&&i['total']>0x0,k=j?Math['max'](0x0,Math['min'](i['total'],Math['round'](i['likes']))):0x0,l=j?Math['round'](i['total']):0x0,m=0x5,n=j?Math['max'](0x0,Math['min'](0x64,Math['round'](0x32+(k/l*0x64-0x32)*Math['min'](0x1,l/m)))):0x32,o={'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':n,'trust_provenance':j?'verified':'cold_start_prior','reputation_like_ratio':0x1,'arbitration_independent':![],'merchant_history_count':j?i['completed_orders']??Math['round'](i['total']):0x0,'capabilities':h,'tags':g['tags'],'keywords':g['keywords'],'buyable':catalogBuyability(c)};return{...o,...b};}export function hasOrderBoundPayoutRail(b){const c=b,d=Array['isArray'](c?.['allocators'])?c['allocators']:[];for(const e of d){const f=Array['isArray'](e?.['sharing'])?e['sharing']:[];for(const g of f){const h=g?.['who'];if(h&&typeof h==='object'&&'GuardIdentifier'in h)return!![];}}return![];}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,'trust_provenance':'cold_start_prior','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);}
@@ -7,8 +7,6 @@ export interface RoleInterests {
7
7
  avoid: string[];
8
8
  sensitivity: number;
9
9
  }
10
- export declare function outcomeSemantics(): Record<OperationOutcome, string[]>;
11
- export declare function roleInterests(): Record<string, RoleInterests>;
12
10
  export declare function classifyOutcome(consequence?: string): OperationOutcome;
13
11
  export declare function appetiteMultiplier(appetite?: RiskAppetite): number;
14
12
  export declare function interestsOf(role: CommercialRole): RoleInterests;
@@ -25,7 +23,6 @@ export interface OutcomeEvaluation {
25
23
  risks: string[];
26
24
  }
27
25
  export declare function evaluateOutcome(outcome: OperationOutcome, role: CommercialRole, drive?: PersonaDrive): OutcomeEvaluation;
28
- export declare function consistencyScore(outcome: OperationOutcome, role: CommercialRole): number;
29
26
  export interface OutcomeAssessmentOptions {
30
27
  costOfDelay?: string;
31
28
  stake?: string;
@@ -1 +1 @@
1
- import{getJudgmentDoc}from'../config/judgment.js';function gameParams(){return getJudgmentDoc()['game'];}export function outcomeSemantics(){return gameParams()['outcome_semantics'];}export function roleInterests(){return gameParams()['role_interests'];}export function classifyOutcome(a){if(a?.['startsWith']('Completion'))return'completion';if(a?.['startsWith']('Refund'))return'refund';return'advance';}export function appetiteMultiplier(a){const b=gameParams()['appetite_multipliers'];if(a==='conservative')return b['conservative'];if(a==='aggressive')return b['aggressive'];return b['balanced'];}export function interestsOf(a){return gameParams()['role_interests'][a]??{'prefer':[],'avoid':[],'sensitivity':0x1};}function dedupe(a){return Array['from'](new Set(a));}export function resolveInterests(a,b){const c=gameParams(),d=interestsOf(a),e=d['sensitivity']*appetiteMultiplier(b?.['risk_appetite']),f=[...d['prefer']],g=[...d['avoid']];for(const h of b?.['requirements']??[]){const i=h['toLowerCase'](),j=new RegExp(c['forbid_pattern'],'i')['test'](i);for(const k of c['keyword_rules']){if(k['when_forbidden']!==j)continue;k['keywords']['some'](l=>i['includes'](l['toLowerCase']()))&&(k['anchor']==='prefer'?f:g)['push'](k['effect']);}}return{'prefer':dedupe(f),'avoid':dedupe(g),'sensitivity':e};}export function evaluateOutcome(a,b,c){const d=gameParams(),e=d['outcome_semantics'][a]??[],f=resolveInterests(b,c),g=f['sensitivity'],h=[],i=[];for(const m of e){if(f['prefer']['includes'](m))h['push'](m);if(f['avoid']['includes'](m))i['push'](m);}const j=h['length']*d['scoring']['per_gain'],k=Math['round'](i['length']*d['scoring']['per_risk']*g),l=Math['max'](0x0,Math['min'](0x64,d['scoring']['base']+j-k));return{'gain_score':j,'risk_score':k,'net_score':l,'gains':h,'risks':i};}export function consistencyScore(a,b){return evaluateOutcome(a,b)['net_score'];}export function outcomeAssessment(a,b){return{'consistency':a['net_score'],'net':a['net_score'],'gains':[...a['gains']],'risks':[...a['risks']],...b?.['costOfDelay']!==undefined?{'cost_of_delay':b['costOfDelay']}:{},...b?.['stake']!==undefined?{'commercial_stake':b['stake']}:{}};}
1
+ import{getJudgmentDoc}from'../config/judgment.js';function gameParams(){return getJudgmentDoc()['game'];}export function classifyOutcome(a){if(a?.['startsWith']('Completion'))return'completion';if(a?.['startsWith']('Refund'))return'refund';return'advance';}export function appetiteMultiplier(a){const b=gameParams()['appetite_multipliers'];if(a==='conservative')return b['conservative'];if(a==='aggressive')return b['aggressive'];return b['balanced'];}export function interestsOf(a){return gameParams()['role_interests'][a]??{'prefer':[],'avoid':[],'sensitivity':0x1};}function dedupe(a){return Array['from'](new Set(a));}export function resolveInterests(a,b){const c=gameParams(),d=interestsOf(a),e=d['sensitivity']*appetiteMultiplier(b?.['risk_appetite']),f=[...d['prefer']],g=[...d['avoid']];for(const h of b?.['requirements']??[]){const i=h['toLowerCase'](),j=new RegExp(c['forbid_pattern'],'i')['test'](i);for(const k of c['keyword_rules']){if(k['when_forbidden']!==j)continue;k['keywords']['some'](l=>i['includes'](l['toLowerCase']()))&&(k['anchor']==='prefer'?f:g)['push'](k['effect']);}}return{'prefer':dedupe(f),'avoid':dedupe(g),'sensitivity':e};}export function evaluateOutcome(a,b,c){const d=gameParams(),e=d['outcome_semantics'][a]??[],f=resolveInterests(b,c),g=f['sensitivity'],h=[],i=[];for(const m of e){if(f['prefer']['includes'](m))h['push'](m);if(f['avoid']['includes'](m))i['push'](m);}const j=h['length']*d['scoring']['per_gain'],k=Math['round'](i['length']*d['scoring']['per_risk']*g),l=Math['max'](0x0,Math['min'](0x64,d['scoring']['base']+j-k));return{'gain_score':j,'risk_score':k,'net_score':l,'gains':h,'risks':i};}export function outcomeAssessment(a,b){return{'consistency':a['net_score'],'net':a['net_score'],'gains':[...a['gains']],'risks':[...a['risks']],...b?.['costOfDelay']!==undefined?{'cost_of_delay':b['costOfDelay']}:{},...b?.['stake']!==undefined?{'commercial_stake':b['stake']}:{}};}
@@ -8,7 +8,16 @@ export interface OperationBridge {
8
8
  operation_type: "demand" | "service";
9
9
  preconditions: string[];
10
10
  rationale: string;
11
+ state?: {
12
+ demand_object: string;
13
+ presenters_count: number | null;
14
+ };
11
15
  }
12
16
  export declare function nextOperationForServiceMatch(demand: DemandExtractInput, guarded: boolean | null): OperationBridge;
13
17
  export declare function nextOperationForDemandMatch(service: ServiceExtractInput): OperationBridge;
18
+ export interface DemandLiveState {
19
+ object: string;
20
+ presenters_count: number | null;
21
+ }
22
+ export declare function nextOperationForDemandMatchLive(service: ServiceExtractInput, live: DemandLiveState | null): OperationBridge;
14
23
  export declare function nextOperationForServiceOrder(service: ServiceExtractInput): OperationBridge;
@@ -1 +1 @@
1
- export const OP_DEMAND_PRESENT_SERVICE='demand.present';export const OP_DEMAND_PRESENT_SERVICE_WITH_PASSPORT='demand.present_guarded';export const OP_DEMAND_PUBLISH='demand.publish';export const OP_SERVICE_ORDER_NEW='service.order_new';export function nextOperationForServiceMatch(a,b){return{'operation':b===!![]?OP_DEMAND_PRESENT_SERVICE_WITH_PASSPORT:OP_DEMAND_PRESENT_SERVICE,'operation_type':'demand','preconditions':['Demand\x20is\x20still\x20open\x20(not\x20expired)\x20and\x20this\x20supplier\x20has\x20not\x20already\x20presented.','Service\x20is\x20published\x20and\x20not\x20paused.',b===null?'Verify\x20Demand.guards:\x20if\x20non-empty\x20present\x20through\x20one\x20of\x20them\x20(by_guard\x20from\x20Demand.guards);\x20if\x20empty\x20use\x20plain\x20present.':b?'Select\x20a\x20by_guard\x20present\x20in\x20Demand.guards\x20for\x20the\x20guarded\x20present\x20(guard\x20verification\x20runs\x20at\x20present\x20time).':'Demand.guards\x20is\x20empty\x20→\x20plain\x20present\x20is\x20valid.'],'rationale':'Present\x20this\x20service\x20to\x20demand\x20'+a['object']+';\x20the\x20demander\x20then\x20gives\x20feedback\x20(acceptance_score)\x20and\x20selects\x20→\x20Order\x20via\x20'+OP_SERVICE_ORDER_NEW+'\x20(see\x20nextOperationForServiceOrder).'};}export function nextOperationForDemandMatch(a){return{'operation':OP_DEMAND_PUBLISH,'operation_type':'demand','preconditions':['Service\x20is\x20published\x20and\x20not\x20paused\x20(eligible\x20to\x20be\x20presented\x20into\x20the\x20Demand).','This\x20account\x20holds\x20the\x20Demand\x27s\x20Permission\x20(owner)\x20to\x20publish\x20and\x20later\x20score/select\x20presenters.'],'rationale':'Publish\x20a\x20Demand\x20encoding\x20the\x20requirement\x20so\x20'+a['object']+'\x20(and\x20peers)\x20can\x20present\x20(demand.present*);\x20then\x20feedback\x20(acceptance_score)\x20+\x20select\x20forms\x20the\x20Order\x20via\x20'+OP_SERVICE_ORDER_NEW+'\x20(see\x20nextOperationForServiceOrder).'};}export function nextOperationForServiceOrder(a){return{'operation':OP_SERVICE_ORDER_NEW,'operation_type':'service','preconditions':['Service\x20is\x20published\x20and\x20not\x20paused\x20(E1\x20gate\x20of\x20pre-purchase\x20due\x20diligence).','Pin\x20each\x20sale\x20item\x27s\x20wip_hash\x20in\x20the\x20buy\x20items\x20—\x20prevents\x20WIP\x20swap\x20between\x20viewing\x20and\x20ordering.','If\x20Service.buy_guard\x20is\x20non-empty,\x20obtain\x20a\x20valid\x20passport\x20first\x20(buy\x20requires\x20guard\x20validation).','If\x20Service.customer_required\x20is\x20non-empty,\x20deliver\x20the\x20required\x20info\x20to\x20the\x20merchant\x27s\x20IM\x20user\x20address\x20(resolved\x20from\x20the\x20Service\x27s\x20Contact)\x20via\x20Messenger,\x20then\x20record\x20as\x20order_required_info\x20either\x20that\x20IM\x20address\x20or\x20an\x20on-chain\x20WTS\x20Proof\x20address\x20(embeds\x20the\x20IM\x20address\x20+\x20last-message\x20timestamp;\x20costs\x20gas).','If\x20this\x20selection\x20follows\x20a\x20Demand\x20you\x20published\x20with\x20presenters:\x20score\x20the\x20presenters\x20first\x20(demand\x20feedback\x20→\x20acceptance_score)\x20—\x20skipping\x20feedback\x20damages\x20your\x20acceptance_score\x20reputation.','Sufficient\x20balance\x20for\x20the\x20total\x20price\x20plus\x20gas;\x20payment\x20is\x20escrowed\x20in\x20the\x20Order\x20until\x20Allocation\x20settlement.'],'rationale':'Create\x20the\x20Order\x20on\x20the\x20chosen\x20service\x20'+a['object']+'\x20('+OP_SERVICE_ORDER_NEW+')\x20—\x20the\x20transaction-formation\x20step:\x20Order\x20+\x20Progress\x20+\x20Allocation\x20are\x20created\x20atomically,\x20then\x20Progress\x20advances\x20through\x20the\x20Machine\x20and\x20Allocation\x20settles\x20the\x20payment.'};}
1
+ export const OP_DEMAND_PRESENT_SERVICE='demand.present';export const OP_DEMAND_PRESENT_SERVICE_WITH_PASSPORT='demand.present_guarded';export const OP_DEMAND_PUBLISH='demand.publish';export const OP_SERVICE_ORDER_NEW='service.order_new';export function nextOperationForServiceMatch(a,b){return{'operation':b===!![]?OP_DEMAND_PRESENT_SERVICE_WITH_PASSPORT:OP_DEMAND_PRESENT_SERVICE,'operation_type':'demand','preconditions':['Demand\x20is\x20still\x20open\x20(not\x20expired)\x20and\x20this\x20supplier\x20has\x20not\x20already\x20presented.','Service\x20is\x20published\x20and\x20not\x20paused.',b===null?'Verify\x20Demand.guards:\x20if\x20non-empty\x20present\x20through\x20one\x20of\x20them\x20(by_guard\x20from\x20Demand.guards);\x20if\x20empty\x20use\x20plain\x20present.':b?'Select\x20a\x20by_guard\x20present\x20in\x20Demand.guards\x20for\x20the\x20guarded\x20present\x20(guard\x20verification\x20runs\x20at\x20present\x20time).':'Demand.guards\x20is\x20empty\x20→\x20plain\x20present\x20is\x20valid.'],'rationale':'Present\x20this\x20service\x20to\x20demand\x20'+a['object']+';\x20the\x20demander\x20then\x20gives\x20feedback\x20(acceptance_score)\x20and\x20selects\x20→\x20Order\x20via\x20'+OP_SERVICE_ORDER_NEW+'\x20(see\x20nextOperationForServiceOrder).'};}export function nextOperationForDemandMatch(a){return{'operation':OP_DEMAND_PUBLISH,'operation_type':'demand','preconditions':['Service\x20is\x20published\x20and\x20not\x20paused\x20(eligible\x20to\x20be\x20presented\x20into\x20the\x20Demand).','This\x20account\x20holds\x20the\x20Demand\x27s\x20Permission\x20(owner)\x20to\x20publish\x20and\x20later\x20score/select\x20presenters.'],'rationale':'Publish\x20a\x20Demand\x20encoding\x20the\x20requirement\x20so\x20'+a['object']+'\x20(and\x20peers)\x20can\x20present\x20(demand.present*);\x20then\x20feedback\x20(acceptance_score)\x20+\x20select\x20forms\x20the\x20Order\x20via\x20'+OP_SERVICE_ORDER_NEW+'\x20(see\x20nextOperationForServiceOrder).'};}export function nextOperationForDemandMatchLive(a,b){if(!b){const c=nextOperationForDemandMatch(a);return{...c,'preconditions':[...c['preconditions'],'No\x20on-chain\x20Demand\x20reference\x20supplied\x20(demand_object\x20absent)\x20—\x20this\x20bridge\x20ASSUMES\x20the\x20Demand\x20does\x20not\x20exist\x20yet.\x20If\x20one\x20already\x20exists,\x20re-invoke\x20with\x20demand_object\x20so\x20`next`\x20is\x20derived\x20from\x20live\x20state\x20instead\x20of\x20this\x20static\x20template\x20(F-RQ-06\x20ghost-publish\x20guard).']};}if(b['presenters_count']===null)return{'operation':OP_DEMAND_PUBLISH,'operation_type':'demand','preconditions':['Demand\x20'+b['object']+'\x20could\x20NOT\x20be\x20read\x20live\x20—\x20state\x20UNVERIFIED.','VERIFY\x20FIRST\x20(query_toolkit\x20onchain_object\x20/\x20onchain_table_item\x20demand_presenter):\x20is\x20it\x20published?\x20presenters_count?','If\x20already\x20published,\x20do\x20NOT\x20publish\x20again\x20—\x20a\x20second\x20publish\x20creates\x20a\x20duplicate\x20Demand.\x20Published\x20with\x20presenters\x20→\x20demand.feedback\x20then\x20service.order_new;\x20published\x20with\x20zero\x20presenters\x20→\x20await\x20presenters\x20(suppliers\x20present).'],'rationale':'Live\x20read\x20of\x20demand\x20'+b['object']+'\x20failed\x20—\x20falling\x20back\x20to\x20the\x20publish\x20template\x20behind\x20a\x20mandatory\x20verify-first\x20gate\x20(F-RQ-06:\x20never\x20act\x20on\x20a\x20static\x20next\x20while\x20live\x20state\x20is\x20unknown).','state':{'demand_object':b['object'],'presenters_count':null}};if(b['presenters_count']===0x0)return{'operation':'demand.await_presenters','operation_type':'demand','preconditions':['Demand\x20'+b['object']+'\x20is\x20LIVE\x20on-chain\x20(read\x20at\x20match\x20time):\x20presenters_count\x20=\x200.','DO\x20NOT\x20publish\x20again\x20—\x20the\x20Demand\x20already\x20exists;\x20a\x20second\x20publish\x20creates\x20a\x20duplicate\x20(F-RQ-06\x20ghost-publish).','demand.present\x20is\x20the\x20SUPPLIERS\x27\x20move:\x20they\x20present\x20services\x20into\x20this\x20Demand.\x20As\x20the\x20demander:\x20monitor\x20presenters\x20(query_toolkit\x20onchain_table_item\x20demand_presenter)\x20or\x20share\x20the\x20Demand\x20with\x20candidate\x20suppliers.'],'rationale':'Live-state\x20derivation:\x20demand\x20'+b['object']+'\x20is\x20published\x20and\x20awaiting\x20presenters\x20—\x20demand.publish\x20advice\x20is\x20OBSOLETE.\x20The\x20next\x20WRITE\x20unlocks\x20once\x20a\x20supplier\x20presents\x20(then\x20demand.feedback\x20→\x20service.order_new,\x20see\x20the\x20order\x20bridge).','state':{'demand_object':b['object'],'presenters_count':0x0}};return{'operation':'demand.feedback','operation_type':'demand','preconditions':['Demand\x20'+b['object']+'\x20is\x20LIVE\x20on-chain\x20(read\x20at\x20match\x20time):\x20presenters_count\x20=\x20'+b['presenters_count']+'.','Score\x20the\x20presenters\x20via\x20demand.feedback\x20(acceptance_score\x200-255,\x20one\x20presenter\x20per\x20call)\x20—\x20skipping\x20feedback\x20damages\x20YOUR\x20acceptance_score\x20reputation.','Then\x20form\x20the\x20transaction:\x20'+OP_SERVICE_ORDER_NEW+'\x20on\x20the\x20selected\x20service\x20(see\x20the\x20order\x20bridge).'],'rationale':'Live-state\x20derivation:\x20demand\x20'+b['object']+'\x20has\x20'+b['presenters_count']+'\x20presenter(s)\x20—\x20the\x20static\x20demand.publish\x20advice\x20is\x20OBSOLETE\x20(F-RQ-06);\x20the\x20demander\x27s\x20next\x20move\x20is\x20feedback\x20→\x20select\x20→\x20order.','state':{'demand_object':b['object'],'presenters_count':b['presenters_count']}};}export function nextOperationForServiceOrder(a){return{'operation':OP_SERVICE_ORDER_NEW,'operation_type':'service','preconditions':['Service\x20is\x20published\x20and\x20not\x20paused\x20(E1\x20gate\x20of\x20pre-purchase\x20due\x20diligence).','Pin\x20each\x20sale\x20item\x27s\x20wip_hash\x20in\x20the\x20buy\x20items\x20—\x20prevents\x20WIP\x20swap\x20between\x20viewing\x20and\x20ordering.','If\x20Service.buy_guard\x20is\x20non-empty,\x20obtain\x20a\x20valid\x20passport\x20first\x20(buy\x20requires\x20guard\x20validation).','If\x20Service.customer_required\x20is\x20non-empty,\x20deliver\x20the\x20required\x20info\x20to\x20the\x20merchant\x27s\x20IM\x20user\x20address\x20(resolved\x20from\x20the\x20Service\x27s\x20Contact)\x20via\x20Messenger,\x20then\x20record\x20as\x20order_required_info\x20either\x20that\x20IM\x20address\x20or\x20an\x20on-chain\x20WTS\x20Proof\x20address\x20(embeds\x20the\x20IM\x20address\x20+\x20last-message\x20timestamp;\x20costs\x20gas).','If\x20this\x20selection\x20follows\x20a\x20Demand\x20you\x20published\x20with\x20presenters:\x20score\x20the\x20presenters\x20first\x20(demand\x20feedback\x20→\x20acceptance_score)\x20—\x20skipping\x20feedback\x20damages\x20your\x20acceptance_score\x20reputation.','Sufficient\x20balance\x20for\x20the\x20total\x20price\x20plus\x20gas;\x20payment\x20is\x20escrowed\x20in\x20the\x20Order\x20until\x20Allocation\x20settlement.'],'rationale':'Create\x20the\x20Order\x20on\x20the\x20chosen\x20service\x20'+a['object']+'\x20('+OP_SERVICE_ORDER_NEW+')\x20—\x20the\x20transaction-formation\x20step:\x20Order\x20+\x20Progress\x20+\x20Allocation\x20are\x20created\x20atomically,\x20then\x20Progress\x20advances\x20through\x20the\x20Machine\x20and\x20Allocation\x20settles\x20the\x20payment.'};}
@@ -0,0 +1,9 @@
1
+ import { type MatchPolicyDirection } from "../config/match-policy-file.js";
2
+ import { type MatchPolicy, type MatchPolicyInput, type MatchPolicySource } from "./match-policy.js";
3
+ export type { MatchPolicySource, MatchPolicyDirection };
4
+ export interface EffectiveMatchPolicy {
5
+ policy?: MatchPolicy;
6
+ source: MatchPolicySource;
7
+ note?: string;
8
+ }
9
+ export declare function resolveEffectiveMatchPolicy(input: MatchPolicyInput | undefined, direction: MatchPolicyDirection, account?: string): Promise<EffectiveMatchPolicy>;
@@ -0,0 +1 @@
1
+ import{getPersonaStore}from'../persona/store.js';import{getMatchPolicyFile}from'../config/match-policy-file.js';import{resolveMatchPolicy}from'./match-policy.js';function carriedForDirection(a,b){if(a['direction']!==undefined&&a['direction']!==b)return undefined;return a['direction']===undefined?{...a,'direction':b}:a;}async function personaCarriedPolicy(a,b,c){if(b['length']===0x0)return undefined;let d;try{d=getPersonaStore();}catch(f){return c['push']('persona\x20store\x20unavailable\x20('+(f instanceof Error?f['message']:String(f))+')\x20—\x20persona\x20match\x20layers\x20skipped'),undefined;}for(const {scope:g,addr:h,source:i}of b){let j;try{j=await d['get'](g,h);}catch(m){c['push'](g+'\x20persona\x20unreadable\x20('+(m instanceof Error?m['message']:String(m))+')\x20—\x20skipped');continue;}if(!j)continue;const k=j['current']['match']?.[a]??j['long_term']['match']?.[a];if(!k)continue;const l=carriedForDirection(k,a);if(!l){c['push'](g+'\x20persona\x20carries\x20a\x20'+k['direction']+'\x20policy,\x20not\x20'+a+'\x20—\x20skipped');continue;}return{'policy':l,'source':i};}return undefined;}export async function resolveEffectiveMatchPolicy(a,b,c){if(a!==undefined)return{'policy':resolveMatchPolicy(a,b),'source':'request'};const d=[],e=c?[{'scope':'account','addr':c,'source':'account_persona'}]:[],f=await personaCarriedPolicy(b,e,d);if(f)return{'policy':f['policy'],'source':f['source'],...d['length']?{'note':d['join'](';\x20')}:{}};const g=getMatchPolicyFile(),h=g[b];if(h){if(g['error'])d['push']('match-policy.json\x20also\x20reports:\x20'+g['error']);return{'policy':h,'source':'general_file',...d['length']?{'note':d['join'](';\x20')}:{}};}if(g['error'])d['push']('match-policy.json\x20unreadable\x20('+g['error']+')\x20—\x20falling\x20through');const i=await personaCarriedPolicy(b,[{'scope':'system','source':'system_persona'}],d);if(i)return{'policy':i['policy'],'source':i['source'],...d['length']?{'note':d['join'](';\x20')}:{}};return{'source':'factory_defaults',...d['length']?{'note':d['join'](';\x20')}:{}};}
@@ -43,6 +43,7 @@ export interface MatchPolicy {
43
43
  output?: PolicyOutput;
44
44
  }
45
45
  export type MatchPolicyInput = string | MatchPolicy;
46
+ export type MatchPolicySource = "factory_defaults" | "system_persona" | "general_file" | "account_persona" | "request";
46
47
  export declare const POLICY_WEIGHT_RULE_IDS: readonly ["region", "industry", "price", "trust", "capabilities", "tags", "acceptance"];
47
48
  export declare const PRESET_MATCH_POLICIES: Record<string, MatchPolicy>;
48
49
  export declare function resolveMatchPolicy(input: MatchPolicyInput | undefined, direction: "demand_to_supply" | "supply_to_demand"): MatchPolicy | undefined;
@@ -120,6 +121,7 @@ export interface PolicyEffect {
120
121
  version?: number;
121
122
  direction: string;
122
123
  policy_hash: string;
124
+ policy_source: MatchPolicySource;
123
125
  unknown_policy: string;
124
126
  dropped: Array<{
125
127
  object: string;
@@ -139,4 +141,4 @@ export interface PolicyEffect {
139
141
  export declare function buildPolicyEffect(policy: MatchPolicy, gateOutcome: PolicyGateOutcome, weights: {
140
142
  applied: Record<string, number>;
141
143
  ignored: string[];
142
- }, rerank: PolicyRerankSummary, extraIgnored?: string[]): PolicyEffect;
144
+ }, rerank: PolicyRerankSummary, extraIgnored?: string[], policySource?: MatchPolicySource): PolicyEffect;