@wowok/agent-mcp 3.3.3 → 3.3.6

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 (202) hide show
  1. package/dist/chain-semantics/eval-order.d.ts +17 -0
  2. package/dist/chain-semantics/eval-order.js +1 -0
  3. package/dist/chain-semantics/freeze-map.js +1 -1
  4. package/dist/chain-semantics/fund-flow.js +1 -1
  5. package/dist/chain-semantics/index.d.ts +1 -0
  6. package/dist/chain-semantics/index.js +1 -1
  7. package/dist/chain-semantics/object-graph.js +1 -1
  8. package/dist/composition/audit.js +1 -1
  9. package/dist/composition/compile.d.ts +4 -1
  10. package/dist/composition/compile.js +1 -1
  11. package/dist/data/api/api.spec.d.ts +1 -0
  12. package/dist/data/api/api.spec.js +1 -0
  13. package/dist/data/api/cli.d.ts +1 -0
  14. package/dist/data/api/cli.js +1 -0
  15. package/dist/data/api/head.d.ts +16 -0
  16. package/dist/data/api/head.js +1 -0
  17. package/dist/data/api/head.spec.d.ts +1 -0
  18. package/dist/data/api/head.spec.js +1 -0
  19. package/dist/data/api/index.d.ts +2 -0
  20. package/dist/data/api/index.js +1 -0
  21. package/dist/data/api/match.d.ts +69 -0
  22. package/dist/data/api/match.js +1 -0
  23. package/dist/data/api/match.spec.d.ts +1 -0
  24. package/dist/data/api/match.spec.js +1 -0
  25. package/dist/data/api/server.d.ts +12 -0
  26. package/dist/data/api/server.js +1 -0
  27. package/dist/data/projection/cli.d.ts +1 -0
  28. package/dist/data/projection/cli.js +1 -0
  29. package/dist/data/projection/edges.d.ts +8 -0
  30. package/dist/data/projection/edges.js +1 -0
  31. package/dist/data/projection/edges.spec.d.ts +1 -0
  32. package/dist/data/projection/edges.spec.js +1 -0
  33. package/dist/data/projection/facets.d.ts +18 -0
  34. package/dist/data/projection/facets.js +1 -0
  35. package/dist/data/projection/facets.spec.d.ts +1 -0
  36. package/dist/data/projection/facets.spec.js +1 -0
  37. package/dist/data/projection/facts.d.ts +40 -0
  38. package/dist/data/projection/facts.js +1 -0
  39. package/dist/data/projection/index.d.ts +6 -0
  40. package/dist/data/projection/index.js +1 -0
  41. package/dist/data/projection/project.d.ts +10 -0
  42. package/dist/data/projection/project.js +1 -0
  43. package/dist/data/projection/projection.spec.d.ts +1 -0
  44. package/dist/data/projection/projection.spec.js +1 -0
  45. package/dist/data/projection/schema.d.ts +1 -0
  46. package/dist/data/projection/schema.js +1 -0
  47. package/dist/data/projection/store.d.ts +49 -0
  48. package/dist/data/projection/store.js +1 -0
  49. package/dist/data/projection/types.d.ts +137 -0
  50. package/dist/data/projection/types.js +1 -0
  51. package/dist/data/sync/cdc.d.ts +34 -0
  52. package/dist/data/sync/cdc.js +1 -0
  53. package/dist/data/sync/cdc.spec.d.ts +1 -0
  54. package/dist/data/sync/cdc.spec.js +1 -0
  55. package/dist/data/sync/graphql-source.d.ts +16 -0
  56. package/dist/data/sync/graphql-source.js +1 -0
  57. package/dist/data/sync/index.d.ts +5 -0
  58. package/dist/data/sync/index.js +1 -0
  59. package/dist/data/sync/reconciler.d.ts +14 -0
  60. package/dist/data/sync/reconciler.js +1 -0
  61. package/dist/data/sync/reconciler.spec.d.ts +1 -0
  62. package/dist/data/sync/reconciler.spec.js +1 -0
  63. package/dist/data/sync/schema.d.ts +1 -0
  64. package/dist/data/sync/schema.js +1 -0
  65. package/dist/data/sync/store.d.ts +19 -0
  66. package/dist/data/sync/store.js +1 -0
  67. package/dist/data/sync/sync.spec.d.ts +1 -0
  68. package/dist/data/sync/sync.spec.js +1 -0
  69. package/dist/data/sync/synchronizer.d.ts +10 -0
  70. package/dist/data/sync/synchronizer.js +1 -0
  71. package/dist/data/sync/types.d.ts +162 -0
  72. package/dist/data/sync/types.js +1 -0
  73. package/dist/evaluation/builtins/demand-match.js +1 -1
  74. package/dist/evaluation/builtins/graph-service.spec.js +1 -1
  75. package/dist/evaluation/capability.d.ts +1 -0
  76. package/dist/evaluation/engine.js +1 -1
  77. package/dist/evaluation/extract.d.ts +7 -1
  78. package/dist/evaluation/extract.js +1 -1
  79. package/dist/evaluation/match-policy.d.ts +118 -0
  80. package/dist/evaluation/match-policy.js +1 -0
  81. package/dist/evaluation/match-policy.spec.d.ts +1 -0
  82. package/dist/evaluation/match-policy.spec.js +1 -0
  83. package/dist/evaluation/node-game.d.ts +3 -0
  84. package/dist/evaluation/node-game.js +1 -1
  85. package/dist/experience/realtime-feedback.js +1 -1
  86. package/dist/graph/onchain/expand.js +1 -1
  87. package/dist/graph/onchain/exposure.js +1 -1
  88. package/dist/harness/recover.js +1 -1
  89. package/dist/knowledge/arbitration-ledger.js +1 -1
  90. package/dist/knowledge/baselines/rules/plan.json +16 -1
  91. package/dist/knowledge/builtin-templates.d.ts +1 -1
  92. package/dist/knowledge/builtin-templates.js +1 -1
  93. package/dist/knowledge/getting-started.js +1 -1
  94. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  95. package/dist/knowledge/guard-design-patterns.js +1 -1
  96. package/dist/knowledge/guard-ledger.js +1 -1
  97. package/dist/knowledge/guard-puzzle.js +1 -1
  98. package/dist/knowledge/guard-render.js +1 -1
  99. package/dist/knowledge/guard-risk.js +1 -1
  100. package/dist/knowledge/guard-templates.d.ts +1 -1
  101. package/dist/knowledge/guard-templates.js +1 -1
  102. package/dist/knowledge/guard-translation.js +1 -1
  103. package/dist/knowledge/index.js +1 -1
  104. package/dist/knowledge/industry-registry.js +1 -1
  105. package/dist/knowledge/jsonrpc-enum.d.ts +26 -10
  106. package/dist/knowledge/jsonrpc-enum.js +1 -1
  107. package/dist/knowledge/projection.d.ts +54 -0
  108. package/dist/knowledge/projection.js +1 -0
  109. package/dist/knowledge/projection.spec.d.ts +1 -0
  110. package/dist/knowledge/projection.spec.js +1 -0
  111. package/dist/knowledge/recipient-constraint.d.ts +9 -0
  112. package/dist/knowledge/recipient-constraint.js +1 -1
  113. package/dist/knowledge/scenario-modes.d.ts +1 -0
  114. package/dist/knowledge/service-ledger.d.ts +1 -1
  115. package/dist/knowledge/service-ledger.js +1 -1
  116. package/dist/knowledge/template-loader.d.ts +1 -0
  117. package/dist/knowledge/template-loader.js +1 -1
  118. package/dist/knowledge/template-registry.js +1 -1
  119. package/dist/knowledge/template-scanner.js +1 -1
  120. package/dist/monitor/MonitorLoop.js +1 -1
  121. package/dist/participation/node-action-advisor.js +1 -1
  122. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  123. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  124. package/dist/playbooks/service-build/object-panorama.js +1 -1
  125. package/dist/playbooks/service-build/participation-radar.js +1 -1
  126. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  127. package/dist/playbooks/service-build/service-panorama.js +1 -1
  128. package/dist/playbooks/service-build/service-quote.js +1 -1
  129. package/dist/playbooks/service-build/service-quote.spec.js +1 -1
  130. package/dist/review/index.js +1 -1
  131. package/dist/role/profiles.js +1 -1
  132. package/dist/safety/confirm-gate.js +1 -1
  133. package/dist/schema/call/allocation.js +1 -1
  134. package/dist/schema/call/base.d.ts +25 -0
  135. package/dist/schema/call/base.js +1 -1
  136. package/dist/schema/call/bridge.d.ts +1 -0
  137. package/dist/schema/call/error-codes.d.ts +1 -1
  138. package/dist/schema/call/error-codes.js +1 -1
  139. package/dist/schema/call/handler.js +1 -1
  140. package/dist/schema/call/order.d.ts +12 -0
  141. package/dist/schema/call/order.js +1 -1
  142. package/dist/schema/call/progress.js +1 -1
  143. package/dist/schema/call/proof.js +1 -1
  144. package/dist/schema/call/semantic.js +1 -1
  145. package/dist/schema/call/service.js +1 -1
  146. package/dist/schema/common/index.js +1 -1
  147. package/dist/schema/evaluation/index.d.ts +189 -0
  148. package/dist/schema/evaluation/index.js +1 -1
  149. package/dist/schema/local/index.d.ts +10 -0
  150. package/dist/schema/local/index.js +1 -1
  151. package/dist/schema/operations.d.ts +4 -0
  152. package/dist/schema/query/bi.d.ts +8 -0
  153. package/dist/schema/query/bi.js +1 -1
  154. package/dist/schema/query/index.d.ts +147 -0
  155. package/dist/schema/query/index.js +1 -1
  156. package/dist/schema/schema-version.js +1 -1
  157. package/dist/schema-query-impl/index.js +1 -1
  158. package/dist/schemas/account_operation.output.json +2 -1
  159. package/dist/schemas/bridge_operation.output.json +2 -1
  160. package/dist/schemas/evaluation_operation.output.json +384 -2
  161. package/dist/schemas/evaluation_operation.schema.json +202 -4
  162. package/dist/schemas/index.json +1 -1
  163. package/dist/schemas/keeper_operation.output.json +1 -1
  164. package/dist/schemas/local_cache_operation.output.json +2 -1
  165. package/dist/schemas/local_history_operation.output.json +2 -1
  166. package/dist/schemas/local_info_operation.output.json +2 -1
  167. package/dist/schemas/local_mark_operation.output.json +2 -1
  168. package/dist/schemas/messenger_operation.output.json +1 -1
  169. package/dist/schemas/monitor_events.output.json +1 -1
  170. package/dist/schemas/monitor_subscription.output.json +1 -1
  171. package/dist/schemas/onchain_events.output.json +1 -1
  172. package/dist/schemas/onchain_operations.output.json +35 -4
  173. package/dist/schemas/onchain_operations.schema.json +687 -103
  174. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  175. package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
  176. package/dist/schemas/onchain_operations_guard.schema.json +660 -94
  177. package/dist/schemas/onchain_operations_order.schema.json +19 -1
  178. package/dist/schemas/onchain_operations_progress.schema.json +2 -2
  179. package/dist/schemas/onchain_operations_service.schema.json +4 -4
  180. package/dist/schemas/onchain_table_data.output.json +2 -2
  181. package/dist/schemas/query_toolkit.output.json +316 -1
  182. package/dist/schemas/query_toolkit.schema.json +1 -1
  183. package/dist/schemas/wowok_buildin_info.output.json +259 -0
  184. package/dist/schemas/wowok_buildin_info.schema.json +121 -0
  185. package/dist/tools/build-fingerprint.d.ts +28 -0
  186. package/dist/tools/build-fingerprint.js +1 -0
  187. package/dist/tools/handlers/benchmark-migration.d.ts +4 -2
  188. package/dist/tools/handlers/benchmark-migration.js +1 -1
  189. package/dist/tools/handlers/config.js +1 -1
  190. package/dist/tools/handlers/evaluation.js +1 -1
  191. package/dist/tools/handlers/evaluation.spec.js +1 -1
  192. package/dist/tools/handlers/onchain.d.ts +7 -0
  193. package/dist/tools/handlers/onchain.js +1 -1
  194. package/dist/tools/handlers/query.js +1 -1
  195. package/dist/tools/handlers/review-chain.d.ts +9 -13
  196. package/dist/tools/handlers/review-chain.js +1 -1
  197. package/dist/tools/index.js +1 -1
  198. package/dist/tools/registry/business.js +1 -1
  199. package/dist/tools/upgrade-check.d.ts +1 -0
  200. package/dist/tools/upgrade-check.js +1 -1
  201. package/dist/tools/wrap.js +1 -1
  202. package/package.json +7 -2
@@ -1 +1 @@
1
- import{strictParse}from'../../schema/index.js';import{EvaluationOperationInputSchema}from'../../schema/evaluation/index.js';import{evaluateArbGame}from'../../evaluation/arbitration-game.js';import{evaluateNodeGame}from'../../evaluation/node-game.js';import{evaluatePathReasoning}from'../../evaluation/path-reasoning.js';import{assessEvidenceReview,reviewEvidenceList}from'../../knowledge/evidence-review.js';import{expandSearchScope,inferSensitivity,rankByLocation}from'../../evaluation/location-match.js';import{query_objects,ArbStatus}from'@wowok/wowok';import{enumerateServices,enumerateDemands,enumerateArbs}from'../../knowledge/jsonrpc-enum.js';import{fetchObjectLinkerCore,batchQueryObjectsByIds}from'../../graph/onchain/sdk-batch.js';import{summarizeCapabilityGaps}from'../../evaluation/gap.js';import{resolveNetwork}from'./network.js';import{composeServicesForDemand}from'../../evaluation/composer.js';import{matchDemandToServices,matchServiceToDemands}from'../../evaluation/builtins/demand-match.js';import{nextOperationForServiceMatch,nextOperationForDemandMatch,nextOperationForServiceOrder}from'../../evaluation/match-operation.js';import{extractDemandCapability}from'../../evaluation/extract.js';import{assessArbitration}from'../../evaluation/builtins/arbitration-score.js';import{resolveCategoryMatchRules,toSoftWeightInjection,applyHardConstraints}from'../../evaluation/category-match-rules.js';import{computeMarketMetrics,computeOrderFlow}from'../../knowledge/market-metrics.js';import{workflowSubgraphFromRows}from'../../graph/onchain/index.js';import{assessAntiCheat}from'../../knowledge/anti-cheat.js';import{computeJourneyFunnel,attributeReferrals,buildCustomerRelationships}from'../../knowledge/market-operations.js';import{suggestPricing}from'../../knowledge/dynamic-pricing.js';import{runAccountEventWatchers}from'../../customer/account-events.js';import{registerBuiltinEvaluations}from'../../evaluation/builtins/index.js';import{getEffectivePersona,mergeInjections}from'../../persona/index.js';import{buildUserInjection}from'../../evaluation/injection.js';registerBuiltinEvaluations();function arbCaseFromObject(b){const c=typeof b['time']==='number'?b['time']:Number(b['time']??0x0);return{'status':b['status'],'time':Number['isFinite'](c)?c:undefined,'resolved_time':typeof b['indemnity']?.['time']==='number'?b['indemnity']['time']:b['compensation_time']??undefined,'indemnity_amount':b['indemnity']?.['amount'],'objected':b['status']===ArbStatus['Objectionable']||b['objection']!=null&&b['objection']['length']>0x0};}async function arbCasesWithRoles(a,b){const c=a['map'](arbCaseFromObject),d=Array['from'](new Set(a['map'](j=>j['order'])['filter'](Boolean))),e=new Map(),f=[];if(d['length']>0x0){const j=await batchQueryObjectsByIds(d,b);for(const k of j){const l=k;if(!l?.['object'])continue;e['set'](l['object'],l);if(l['service'])f['push'](l['service']);}}const g=new Map(),h=Array['from'](new Set(f));if(h['length']>0x0){const m=await batchQueryObjectsByIds(h,b);for(const n of m){const p=n;if(p?.['object'])g['set'](p['object'],p);}}for(let q=0x0;q<a['length'];q++){const r=e['get'](a[q]['order']);if(!r)continue;c[q]['customer']=r['builder']||undefined;const t=g['get'](r['service']);if(t)c[q]['merchant']=t['permission']||undefined;}return c;}function capabilityFromInput(a){return{'id':a['id'],'kind':a['kind'],'owner':a['owner']??'','industry':a['industry'],'industry_confidence':a['industry_confidence']??0x0,'region':a['region'],'price_min':a['price_min']!==undefined?BigInt(a['price_min']):undefined,'price_max':a['price_max']!==undefined?BigInt(a['price_max']):undefined,'token_type':a['token_type']??'','ticket_size':a['ticket_size']??'medium','trust_score':a['trust_score']??0x32,'reputation_like_ratio':a['reputation_like_ratio']??0x1,'arbitration_independent':a['arbitration_independent']??![],'merchant_history_count':a['merchant_history_count']??0x0,'capabilities':a['capabilities'],'tags':a['tags']??[],'keywords':a['keywords']??[]};}async function resolveInjection(a,b){return mergeInjections(await buildUserInjection(a),b);}function serviceSummaryToExtract(a){const b=a['json']??{},c=f=>typeof f==='string'?f:undefined,d=f=>typeof f==='string'?f:null,e=Array['isArray'](b['sales'])?b['sales']['map'](f=>({'name':typeof f?.['name']==='string'?f['name']:undefined,'price':typeof f?.['price']==='string'?f['price']:f?.['price']!=null?String(f['price']):'0','wip_hash':typeof f?.['wip_hash']==='string'?f['wip_hash']:undefined})):[];return{'object':a['object'],'description':c(b['description'])??'','location':a['location']??c(b['location'])??'','sales':e,'arbitrations':Array['isArray'](b['arbitrations'])?b['arbitrations']['map'](String):[],'compensation_fund':c(b['compensation_fund']),'buy_guard':d(b['buy_guard']),'machine':d(b['machine']),'um':d(b['um']),'bPublished':b['bPublished']===!![],'bPaused':b['bPaused']===!![]};}export async function handleEvaluationOperation(a){const b=strictParse(EvaluationOperationInputSchema,a,'evaluation_operation\x20input');let c;switch(b['action']){case'arb_game':{const e=b['account']?await getEffectivePersona(b['account']):null,f=b['appetite']??e?.['layer']['preferences']?.['risk_appetite'],g=b['requirements']??e?.['layer']['requirements'];c={'action':'arb_game',...evaluateArbGame(b['status'],b['perspective'],{'risk_appetite':f,'requirements':g})};break;}case'node_game':{const h=b['account']?await getEffectivePersona(b['account']):null,i=b['appetite']??h?.['layer']['preferences']?.['risk_appetite'],j=b['requirements']??h?.['layer']['requirements'];c={'action':'node_game',...evaluateNodeGame({'current_node':b['current_node'],'perspective':b['perspective'],'appetite':i,'requirements':j,'threshold':b['threshold'],'allocation':b['allocation'],'order_amount':b['order_amount'],'compensation_fund':b['compensation_fund'],'operable':b['operable'],'waiting_on':b['waiting_on']??[]})};break;}case'capability_gap':{c={'action':'capability_gap','report':summarizeCapabilityGaps(capabilityFromInput(b['demand']),capabilityFromInput(b['service']))};break;}case'compose_service':{c={'action':'compose_service','plan':composeServicesForDemand(capabilityFromInput(b['demand']),b['services']['map'](capabilityFromInput))};break;}case'demand_match':{const k=await matchDemandToServices(capabilityFromInput(b['demand_cap']),b['services'],await resolveInjection(b['account'],b['injection']),0x5,b['presenter_history']);c={'action':'demand_match','matches':k['map'](l=>({'service':l['service'],'result':l['result'],'next':nextOperationForDemandMatch(l['service']),'order':nextOperationForServiceOrder(l['service'])}))};break;}case'service_match':{const l=await matchServiceToDemands(capabilityFromInput(b['service_cap']),b['demands'],await resolveInjection(b['account'],b['injection']),0x5,b['presenter_history']);c={'action':'service_match','matches':l['map'](n=>({'demand':n['demand'],'result':n['result'],'next':nextOperationForServiceMatch(n['demand'],null)}))};break;}case'path_reasoning':{const m=b['account']?await getEffectivePersona(b['account']):null,n=b['appetite']??m?.['layer']['preferences']?.['risk_appetite'],o=b['requirements']??m?.['layer']['requirements'];c={'action':'path_reasoning',...evaluatePathReasoning({'current_node':b['current_node'],'perspective':b['perspective'],'workflow':workflowSubgraphFromRows(b['machine_nodes']),'node_annotations':b['node_annotations'],'appetite':n,'requirements':o,'order_amount':b['order_amount'],'max_depth':b['max_depth']})};break;}case'evidence_review':{b['items']&&b['items']['length']>0x0?c={'action':'evidence_review','list':reviewEvidenceList(b['items'])}:c={'action':'evidence_review','review':assessEvidenceReview({'kind':b['kind'],'hash_committed':b['hash_committed'],'digital_check_passed':b['digital_check_passed'],'contradiction':b['contradiction']})};break;}case'discover_services':{const p=!b['sensitivity']?inferSensitivity(b['description']??''):null,q=b['sensitivity']??p['sensitivity'],r=p?.['signals']??[],s=await resolveNetwork(b['context_network']),t={'raw':b['location'],...b['region']??{}},u=expandSearchScope(q,t),v=await enumerateServices(s,{'max_objects':b['max_objects'],'no_cache':b['no_cache'],'location_any':u['search_terms']}),w=rankByLocation(q,t,v['services']['map'](x=>({'id':x['object'],'name':x['name'],'location':x['location']})));c={'action':'discover_services','sensitivity':q,'inference_signals':r,'services':w['map'](x=>{const y=v['services']['find'](z=>z['object']===x['id']);return{'object':x['id'],'name':y?.['name'],'location':y?.['location'],'relation':x['relation'],'satisfied':x['satisfied'],'score':x['score'],'reason':x['reason']};}),'total_enumerated':v['total_enumerated'],'has_more':v['has_more'],'scope_advice':{'search_terms':u['search_terms'],'ai_enrichment_note':u['ai_enrichment_note']}};break;}case'discover_demands':{const x=await resolveNetwork(b['context_network']),y=await enumerateDemands(x,{'max_objects':b['max_objects'],'no_cache':b['no_cache']}),z=b['location']?.['toLowerCase'](),A=y['demands']['filter'](B=>!z||(B['location']??'')['toLowerCase']()['includes'](z))['map'](B=>({'object':B['object'],'description':B['description']??'','location':B['location']??'','presenters_count':B['presenters_count']??0x0,'permission':B['permission']??''}));c={'action':'discover_demands','demands':A,'total_enumerated':y['total_enumerated'],'has_more':y['has_more']};break;}case'demand_present':{const B=await resolveNetwork(b['context_network']),C=await enumerateDemands(B,{'max_objects':b['max_objects'],'no_cache':b['no_cache']}),D=b['location']?.['toLowerCase'](),E=C['demands']['filter'](I=>!D||(I['location']??'')['toLowerCase']()['includes'](D)),F=new Map(E['map'](I=>[I['object'],(I['guards']?.['length']??0x0)>0x0])),G=E['map'](I=>({'object':I['object'],'description':I['description']??'','location':I['location']??'','rewards':I['rewards']??[],'um':I['um']??null})),H=await matchServiceToDemands(capabilityFromInput(b['service_cap']),G,await resolveInjection(b['account'],b['injection']),b['limit']??0x5);c={'action':'demand_present','matches':H['map'](I=>{const J=F['get'](I['demand']['object'])??![];return{'demand':I['demand'],'result':I['result'],'next':nextOperationForServiceMatch(I['demand'],J)};}),'total_enumerated':C['total_enumerated'],'has_more':C['has_more']};break;}case'market_metrics':{const I=await resolveNetwork(b['context_network']),J=await computeMarketMetrics(I,b['no_cache']),K=await computeOrderFlow(I,{'noCache':b['no_cache'],'maxPages':b['limit']?Math['max'](0x1,Math['ceil'](b['limit']/0x32)):undefined});c={'action':'market_metrics',...J,'order_flow':K};break;}case'anti_cheat':{const L=assessAntiCheat({'service':{'object':b['service']['object'],'arbitrations':b['service']['arbitrations'],'compensation_fund':b['service']['compensation_fund'],'machine':b['service']['machine'],'bPublished':b['service']['bPublished']},'orders':b['orders'],'reviews':b['reviews']});c={'action':'anti_cheat','signals':L};break;}case'market_operations':{if(b['op']==='journey_funnel')c={'action':'market_operations','result':computeJourneyFunnel({'due_diligence':b['due_diligence']??0x0,'orders':b['orders']??0x0,'completed':b['completed']??0x0,'reviews':b['reviews']??0x0})};else{if(b['op']==='referral_attribution')c={'action':'market_operations','result':attributeReferrals(b['referral_orders']??[])};else{if(b['op']==='dynamic_pricing'){const M=b['market_signals'];if(!M)throw new Error('dynamic_pricing\x20op\x20requires\x20market_signals');c={'action':'market_operations','result':suggestPricing({'supplyCount':M['supplyCount'],'demandCount':M['demandCount'],'avgPrice':M['avgPrice'],'myPrice':M['myPrice'],'competitorPrices':M['competitorPrices'],'recentOrderCount':M['recentOrderCount'],'repeatCustomerRate':M['repeatCustomerRate']})};}else c={'action':'market_operations','result':buildCustomerRelationships(b['customer_orders']??[])};}}break;}case'match_discover':{const N=!b['sensitivity']?inferSensitivity(b['description']??''):null,O=b['sensitivity']??N['sensitivity'],P=N?.['signals']??[],Q=await resolveNetwork(b['context_network']),R={'raw':b['location'],...b['region']??{}},S=expandSearchScope(O,R),T=await enumerateServices(Q,{'max_objects':b['max_objects'],'no_cache':b['no_cache'],'location_any':S['search_terms']}),U=new Set(b['required_capabilities']??[]),V=extractDemandCapability({'object':'intent','description':b['description'],'location':b['location'],'owner':b['account']},{'price_max':b['budget']!==undefined?BigInt(b['budget']):undefined,'capabilities':{'has_arbitration':U['has']('has_arbitration'),'has_refund_path':U['has']('has_refund_path'),'has_milestone_nodes':U['has']('has_milestone_nodes'),'has_compensation_fund':U['has']('has_compensation_fund'),'has_wip_verification':U['has']('has_wip_verification'),'has_messenger':U['has']('has_messenger'),'has_buy_guard':U['has']('has_buy_guard'),'has_dynamic_pricing':U['has']('has_dynamic_pricing'),'is_published':!![],'is_paused':![]}}),W=rankByLocation(O,R,T['services']['map'](a7=>({'id':a7['object'],'name':a7['name'],'location':a7['location']}))),X=W['filter'](a7=>a7['satisfied']),Y=T['services']['filter'](a7=>X['some'](a8=>a8['id']===a7['object']))['map'](serviceSummaryToExtract),Z=resolveCategoryMatchRules(b['category']);let a0=Y;const a1=[];if(Z){const a7=applyHardConstraints(Z,Y);a0=a7['passed'];for(const a8 of a7['dropped']){a1['push']({'object':a8['candidate']['object'],'reason':a8['constraint']['description']});}}let a2=await resolveInjection(b['account'],b['injection']);Z&&(a2=mergeInjections(a2,toSoftWeightInjection(Z)));const a3=await matchDemandToServices(V,a0,a2,a0['length'],b['presenter_history']),a4=new Map(a3['map'](a9=>[a9['service']['object'],a9['result']])),a5=new Set(a0['map'](a9=>a9['object'])),a6=X['filter'](a9=>a5['has'](a9['id']))['map'](a9=>{const aa=T['services']['find'](ab=>ab['object']===a9['id']);return{'service':serviceSummaryToExtract(aa),'location':{'relation':a9['relation'],'satisfied':a9['satisfied'],'score':a9['score'],'reason':a9['reason']},'result':a4['get'](a9['id'])};});c={'action':'match_discover','sensitivity':O,'inference_signals':P,'matches':a6,'total_enumerated':T['total_enumerated'],'has_more':T['has_more'],'scope_advice':{'search_terms':S['search_terms'],'ai_enrichment_note':S['ai_enrichment_note']}};break;}case'arbitration_score':{let a9=b['history'];const aa=b['context_network']??'testnet';if((!a9||a9['length']===0x0)&&b['arbitration']['object'])try{const ac=await enumerateArbs(aa,{'arbitration':b['arbitration']['object']});a9=await arbCasesWithRoles(ac['arbs'],aa);}catch{a9=b['history'];}if((!a9||a9['length']===0x0)&&b['arbitration']['object'])try{const ad=await query_objects({'objects':[b['arbitration']['object']],'network':aa}),ae=ad?.['objects']?.[0x0];if(ae?.['permission']){const af=await fetchObjectLinkerCore(ae['permission'],aa),ag=(af?.['items']??[])['map'](ai=>ai['who'])['filter'](ai=>ai!==b['arbitration']['object']),ah=[];for(const ai of ag['slice'](0x0,0xa)){const aj=await enumerateArbs(aa,{'arbitration':ai})['catch'](()=>undefined);aj?.['arbs']?.['length']&&ah['push'](...await arbCasesWithRoles(aj['arbs'],aa));}if(ah['length']>0x0)a9=ah;}}catch{}const ab=await assessArbitration({'arbitration':{'object':b['arbitration']['object'],'fee':b['arbitration']['fee'],'balance':b['arbitration']['balance'],'voting_guard_count':b['arbitration']['voting_guard_count'],'bPaused':b['arbitration']['bPaused'],'location':b['arbitration']['location'],'has_verified_identity':b['arbitration']['has_verified_identity']},'history':a9,'entity_votes':b['entity_votes'],'fee_median':b['fee_median']},await resolveInjection(b['account'],b['injection']));c={'action':'arbitration_score',...ab};break;}case'account_events':{const ak=await runAccountEventWatchers({'account':b['account'],'network':await resolveNetwork(b['context_network']),'reviews':b['reviews']?.['map'](al=>({'reviewer':al['reviewer'],'rating':al['rating'],'tags':al['tags'],'comment':al['comment'],'orderRef':al['orderRef'],'timestamp':al['timestamp'],'verified':al['verified']??![]})),'order_history':b['order_history']},b['categories']);c={'action':'account_events','events':ak};break;}default:throw new Error('Unknown\x20evaluation_operation\x20action');}return{'content':[{'type':'text','text':JSON['stringify']({'result':c})}],'structuredContent':{'result':c}};}
1
+ import{strictParse}from'../../schema/index.js';import{EvaluationOperationInputSchema}from'../../schema/evaluation/index.js';import{evaluateArbGame}from'../../evaluation/arbitration-game.js';import{evaluateNodeGame}from'../../evaluation/node-game.js';import{evaluatePathReasoning}from'../../evaluation/path-reasoning.js';import{assessEvidenceReview,reviewEvidenceList}from'../../knowledge/evidence-review.js';import{expandSearchScope,inferSensitivity,rankByLocation}from'../../evaluation/location-match.js';import{query_objects,ArbStatus,createQueryCoverage,discoveryDataSource,remoteIndexUrl}from'@wowok/wowok';import{enumerateServices,enumerateDemands,enumerateArbs,matchServicesViaIndex}from'../../knowledge/jsonrpc-enum.js';import{KNOWN_CAPABILITIES}from'../../data/api/match.js';import{fetchObjectLinkerCore,batchQueryObjectsByIds}from'../../graph/onchain/sdk-batch.js';import{summarizeCapabilityGaps}from'../../evaluation/gap.js';import{resolveNetwork}from'./network.js';import{composeServicesForDemand}from'../../evaluation/composer.js';import{matchDemandToServices,matchServiceToDemands}from'../../evaluation/builtins/demand-match.js';import{nextOperationForServiceMatch,nextOperationForDemandMatch,nextOperationForServiceOrder}from'../../evaluation/match-operation.js';import{extractDemandCapability}from'../../evaluation/extract.js';import{assessArbitration}from'../../evaluation/builtins/arbitration-score.js';import{resolveCategoryMatchRules,toSoftWeightInjection,applyHardConstraints}from'../../evaluation/category-match-rules.js';import{computeMarketMetrics,computeOrderFlow}from'../../knowledge/market-metrics.js';import{workflowSubgraphFromRows}from'../../graph/onchain/index.js';import{assessAntiCheat}from'../../knowledge/anti-cheat.js';import{computeJourneyFunnel,attributeReferrals,buildCustomerRelationships}from'../../knowledge/market-operations.js';import{suggestPricing}from'../../knowledge/dynamic-pricing.js';import{runAccountEventWatchers}from'../../customer/account-events.js';import{registerBuiltinEvaluations}from'../../evaluation/builtins/index.js';import{getEffectivePersona,mergeInjections}from'../../persona/index.js';import{buildUserInjection}from'../../evaluation/injection.js';import{applyPolicyGates,applyPolicyRerank,buildPolicyEffect,policyToInjection,resolveMatchPolicy}from'../../evaluation/match-policy.js';registerBuiltinEvaluations();function arbCaseFromObject(b){const c=typeof b['time']==='number'?b['time']:Number(b['time']??0x0);return{'status':b['status'],'time':Number['isFinite'](c)?c:undefined,'resolved_time':typeof b['indemnity']?.['time']==='number'?b['indemnity']['time']:b['compensation_time']??undefined,'indemnity_amount':b['indemnity']?.['amount'],'objected':b['status']===ArbStatus['Objectionable']||b['objection']!=null&&b['objection']['length']>0x0};}async function arbCasesWithRoles(a,b){const c=a['map'](arbCaseFromObject),d=Array['from'](new Set(a['map'](j=>j['order'])['filter'](Boolean))),e=new Map(),f=[];if(d['length']>0x0){const j=await batchQueryObjectsByIds(d,b);for(const k of j){const l=k;if(!l?.['object'])continue;e['set'](l['object'],l);if(l['service'])f['push'](l['service']);}}const g=new Map(),h=Array['from'](new Set(f));if(h['length']>0x0){const m=await batchQueryObjectsByIds(h,b);for(const n of m){const p=n;if(p?.['object'])g['set'](p['object'],p);}}for(let q=0x0;q<a['length'];q++){const r=e['get'](a[q]['order']);if(!r)continue;c[q]['customer']=r['builder']||undefined;const t=g['get'](r['service']);if(t)c[q]['merchant']=t['permission']||undefined;}return c;}function capabilityFromInput(a){return{'id':a['id'],'kind':a['kind'],'owner':a['owner']??'','industry':a['industry'],'industry_confidence':a['industry_confidence']??0x0,'region':a['region'],'price_min':a['price_min']!==undefined?BigInt(a['price_min']):undefined,'price_max':a['price_max']!==undefined?BigInt(a['price_max']):undefined,'token_type':a['token_type']??'','ticket_size':a['ticket_size']??'medium','trust_score':a['trust_score']??0x32,'reputation_like_ratio':a['reputation_like_ratio']??0x1,'arbitration_independent':a['arbitration_independent']??![],'merchant_history_count':a['merchant_history_count']??0x0,'capabilities':a['capabilities'],'tags':a['tags']??[],'keywords':a['keywords']??[]};}async function resolveInjection(a,b){return mergeInjections(await buildUserInjection(a),b);}function serviceSummaryToExtract(a){const b=a['json']??{},c=f=>typeof f==='string'?f:undefined,d=f=>typeof f==='string'?f:null,e=Array['isArray'](b['sales'])?b['sales']['map'](f=>{const g=f?.['fields']??f;return{'name':typeof g?.['name']==='string'?g['name']:undefined,'price':typeof g?.['price']==='string'?g['price']:g?.['price']!=null?String(g['price']):'0','wip_hash':typeof g?.['wip_hash']==='string'?g['wip_hash']:undefined};}):[];return{'object':a['object'],'description':c(b['description'])??'','location':a['location']??c(b['location'])??'','sales':e,'arbitrations':Array['isArray'](b['arbitrations'])?b['arbitrations']['map'](String):[],'compensation_fund':c(b['compensation_fund']),'buy_guard':d(b['buy_guard']),'machine':d(b['machine']),'um':d(b['um']),'bPublished':b['bPublished']===!![],'bPaused':b['bPaused']===!![],'owner':c(b['owner'])};}export async function handleEvaluationOperation(a){const b=strictParse(EvaluationOperationInputSchema,a,'evaluation_operation\x20input');let c;switch(b['action']){case'arb_game':{const e=b['account']?await getEffectivePersona(b['account']):null,f=b['appetite']??e?.['layer']['preferences']?.['risk_appetite'],g=b['requirements']??e?.['layer']['requirements'];c={'action':'arb_game',...evaluateArbGame(b['status'],b['perspective'],{'risk_appetite':f,'requirements':g})};break;}case'node_game':{const h=b['account']?await getEffectivePersona(b['account']):null,i=b['appetite']??h?.['layer']['preferences']?.['risk_appetite'],j=b['requirements']??h?.['layer']['requirements'];c={'action':'node_game',...evaluateNodeGame({'current_node':b['current_node'],'perspective':b['perspective'],'appetite':i,'requirements':j,'threshold':b['threshold'],'allocation':b['allocation'],'order_amount':b['order_amount'],'compensation_fund':b['compensation_fund'],'operable':b['operable'],'waiting_on':b['waiting_on']??[]})};break;}case'capability_gap':{c={'action':'capability_gap','report':summarizeCapabilityGaps(capabilityFromInput(b['demand']),capabilityFromInput(b['service']))};break;}case'compose_service':{c={'action':'compose_service','plan':composeServicesForDemand(capabilityFromInput(b['demand']),b['services']['map'](capabilityFromInput))};break;}case'demand_match':{const k=await matchDemandToServices(capabilityFromInput(b['demand_cap']),b['services'],await resolveInjection(b['account'],b['injection']),0x5,b['presenter_history']);c={'action':'demand_match','matches':k['map'](l=>({'service':l['service'],'result':l['result'],'next':nextOperationForDemandMatch(l['service']),'order':nextOperationForServiceOrder(l['service'])}))};break;}case'service_match':{const l=await matchServiceToDemands(capabilityFromInput(b['service_cap']),b['demands'],await resolveInjection(b['account'],b['injection']),0x5,b['presenter_history']);c={'action':'service_match','matches':l['map'](n=>({'demand':n['demand'],'result':n['result'],'next':nextOperationForServiceMatch(n['demand'],null)}))};break;}case'path_reasoning':{const m=b['account']?await getEffectivePersona(b['account']):null,n=b['appetite']??m?.['layer']['preferences']?.['risk_appetite'],o=b['requirements']??m?.['layer']['requirements'];c={'action':'path_reasoning',...evaluatePathReasoning({'current_node':b['current_node'],'perspective':b['perspective'],'workflow':workflowSubgraphFromRows(b['machine_nodes']),'node_annotations':b['node_annotations'],'appetite':n,'requirements':o,'order_amount':b['order_amount'],'max_depth':b['max_depth']})};break;}case'evidence_review':{b['items']&&b['items']['length']>0x0?c={'action':'evidence_review','list':reviewEvidenceList(b['items'])}:c={'action':'evidence_review','review':assessEvidenceReview({'kind':b['kind'],'hash_committed':b['hash_committed'],'digital_check_passed':b['digital_check_passed'],'contradiction':b['contradiction']})};break;}case'discover_services':{const p=!b['sensitivity']?inferSensitivity(b['description']??''):null,q=b['sensitivity']??p['sensitivity'],r=p?.['signals']??[],s=await resolveNetwork(b['context_network']),t={'raw':b['location'],...b['region']??{}},u=expandSearchScope(q,t),v=await enumerateServices(s,{'max_objects':b['max_objects'],'no_cache':b['no_cache'],'location_any':u['search_terms'],'coin_type':b['coin_type'],'name_contains':b['name_contains']}),w=rankByLocation(q,t,v['services']['map'](x=>({'id':x['object'],'name':x['name'],'location':x['location']})));c={'action':'discover_services','sensitivity':q,'inference_signals':r,'services':w['map'](x=>{const y=v['services']['find'](z=>z['object']===x['id']);return{'object':x['id'],'name':y?.['name'],'location':y?.['location'],'relation':x['relation'],'satisfied':x['satisfied'],'score':x['score'],'reason':x['reason']};}),'total_enumerated':v['total_enumerated'],'has_more':v['has_more'],'coverage':v['coverage'],'scope_advice':{'search_terms':u['search_terms'],'ai_enrichment_note':u['ai_enrichment_note']}};break;}case'discover_demands':{const x=await resolveNetwork(b['context_network']),y=await enumerateDemands(x,{'max_objects':b['max_objects'],'no_cache':b['no_cache']}),z=b['location']?.['toLowerCase'](),A=y['demands']['filter'](B=>!z||(B['location']??'')['toLowerCase']()['includes'](z))['map'](B=>({'object':B['object'],'description':B['description']??'','location':B['location']??'','presenters_count':B['presenters_count']??0x0,'permission':B['permission']??''}));c={'action':'discover_demands','demands':A,'total_enumerated':y['total_enumerated'],'has_more':y['has_more'],'coverage':y['coverage']};break;}case'demand_present':{const B=await resolveNetwork(b['context_network']),C=await enumerateDemands(B,{'max_objects':b['max_objects'],'no_cache':b['no_cache']}),D=b['location']?.['toLowerCase'](),E=C['demands']['filter'](I=>!D||(I['location']??'')['toLowerCase']()['includes'](D)),F=new Map(E['map'](I=>[I['object'],(I['guards']?.['length']??0x0)>0x0])),G=E['map'](I=>({'object':I['object'],'description':I['description']??'','location':I['location']??'','rewards':I['rewards']??[],'um':I['um']??null})),H=await matchServiceToDemands(capabilityFromInput(b['service_cap']),G,await resolveInjection(b['account'],b['injection']),b['limit']??0x5);c={'action':'demand_present','matches':H['map'](I=>{const J=F['get'](I['demand']['object'])??![];return{'demand':I['demand'],'result':I['result'],'next':nextOperationForServiceMatch(I['demand'],J)};}),'total_enumerated':C['total_enumerated'],'has_more':C['has_more'],'coverage':C['coverage']};break;}case'market_metrics':{const I=await resolveNetwork(b['context_network']),J=await computeMarketMetrics(I,b['no_cache']),K=await computeOrderFlow(I,{'noCache':b['no_cache'],'maxPages':b['limit']?Math['max'](0x1,Math['ceil'](b['limit']/0x32)):undefined});c={'action':'market_metrics',...J,'order_flow':K};break;}case'anti_cheat':{const L=assessAntiCheat({'service':{'object':b['service']['object'],'arbitrations':b['service']['arbitrations'],'compensation_fund':b['service']['compensation_fund'],'machine':b['service']['machine'],'bPublished':b['service']['bPublished']},'orders':b['orders'],'reviews':b['reviews']});c={'action':'anti_cheat','signals':L};break;}case'market_operations':{if(b['op']==='journey_funnel')c={'action':'market_operations','result':computeJourneyFunnel({'due_diligence':b['due_diligence']??0x0,'orders':b['orders']??0x0,'completed':b['completed']??0x0,'reviews':b['reviews']??0x0})};else{if(b['op']==='referral_attribution')c={'action':'market_operations','result':attributeReferrals(b['referral_orders']??[])};else{if(b['op']==='dynamic_pricing'){const M=b['market_signals'];if(!M)throw new Error('dynamic_pricing\x20op\x20requires\x20market_signals');c={'action':'market_operations','result':suggestPricing({'supplyCount':M['supplyCount'],'demandCount':M['demandCount'],'avgPrice':M['avgPrice'],'myPrice':M['myPrice'],'competitorPrices':M['competitorPrices'],'recentOrderCount':M['recentOrderCount'],'repeatCustomerRate':M['repeatCustomerRate']})};}else c={'action':'market_operations','result':buildCustomerRelationships(b['customer_orders']??[])};}}break;}case'match_discover':{const N=!b['sensitivity']?inferSensitivity(b['description']??''):null,O=b['sensitivity']??N['sensitivity'],P=N?.['signals']??[],Q=await resolveNetwork(b['context_network']),R={'raw':b['location'],...b['region']??{}},S=expandSearchScope(O,R),T=resolveMatchPolicy(b['match_policy'],'demand_to_supply'),U=(b['required_capabilities']??[])['filter'](ag=>KNOWN_CAPABILITIES['includes'](ag)),V=!b['coin_type']&&!b['name_contains'],W=discoveryDataSource();let X,Y=new Map(),Z='legacy_enumeration';const a0=()=>enumerateServices(Q,{'max_objects':b['max_objects'],'no_cache':b['no_cache'],'location_any':S['search_terms'],'coin_type':b['coin_type'],'name_contains':b['name_contains']});if(V&&W!=='legacy'&&remoteIndexUrl())try{const ag=await matchServicesViaIndex(Q,{'q':b['description'],'location':b['location'],'budgetWei':b['budget'],'capabilities':U['length']>0x0?U:undefined,'limit':Math['min'](0x64,b['max_objects']??0x64),'recallLimit':Math['min'](0x3e8,Math['max'](0xc8,b['max_objects']??0xc8))});X={'services':ag['candidates']['map'](ah=>({'object':ah['objectId'],'location':ah['publicFeatures']['location']??'','json':ah['payloadJson']??null})),'total_enumerated':ag['recall']['liveSet']??ag['recall']['gated'],'has_more':ag['truncated'],'coverage':ag['coverage']},Y=new Map(ag['candidates']['map'](ah=>[ah['objectId'],ah])),Z='remote_index';}catch(ah){if(W==='remote')throw ah;X=await a0();const ai=ah?.['code'],aj=typeof ai==='string'&&/^INDEX_[A-Z_]+$/['test'](ai)?ai:'INDEX_UNAVAILABLE';X['coverage']=createQueryCoverage({'mode':X['coverage']['mode'],'totalEnumerated':X['coverage']['total_enumerated'],'truncated':X['coverage']['truncated'],'chainId':X['coverage']['chain_id'],'degradedReasons':[...X['coverage']['degraded_reasons'],'MATCH_INDEX_FALLBACK',aj]});}else X=await a0();const a1=new Set(b['required_capabilities']??[]),a2=extractDemandCapability({'object':'intent','description':b['description'],'location':b['location'],'owner':b['account']},{'price_max':b['budget']!==undefined?BigInt(b['budget']):undefined,'capabilities':{'has_arbitration':a1['has']('has_arbitration'),'has_refund_path':a1['has']('has_refund_path'),'has_milestone_nodes':a1['has']('has_milestone_nodes'),'has_compensation_fund':a1['has']('has_compensation_fund'),'has_wip_verification':a1['has']('has_wip_verification'),'has_messenger':a1['has']('has_messenger'),'has_buy_guard':a1['has']('has_buy_guard'),'has_dynamic_pricing':a1['has']('has_dynamic_pricing'),'is_published':!![],'is_paused':![]}}),a3=rankByLocation(O,R,X['services']['map'](ak=>({'id':ak['object'],'name':ak['name'],'location':ak['location']}))),a4=a3['filter'](ak=>ak['satisfied']),a5=X['services']['filter'](ak=>a4['some'](al=>al['id']===ak['object']))['map'](serviceSummaryToExtract),a6=resolveCategoryMatchRules(b['category']);let a7=a5;const a8=[];if(a6){const ak=applyHardConstraints(a6,a5);a7=ak['passed'];for(const al of ak['dropped']){a8['push']({'object':al['candidate']['object'],'reason':al['constraint']['description']});}}let a9=await resolveInjection(b['account'],b['injection']);a6&&(a9=mergeInjections(a9,toSoftWeightInjection(a6)));let aa,ab;if(T){const am=applyPolicyGates(T,a7,{'budgetWei':b['budget']!==undefined?BigInt(b['budget']):undefined});a7=am['passed'];const an=policyToInjection(T);a9=mergeInjections(a9,an['injection']),ab={'gateOutcome':am,'weights':an};}const ac=await matchDemandToServices(a2,a7,a9,a7['length'],b['presenter_history']),ad=new Map(ac['map'](ao=>[ao['service']['object'],ao['result']])),ae=new Set(a7['map'](ao=>ao['object']));let af=a4['filter'](ao=>ae['has'](ao['id']))['map'](ao=>{const ap=X['services']['find'](ar=>ar['object']===ao['id']),aq=Y['get'](ao['id']);return{'service':serviceSummaryToExtract(ap),'location':{'relation':ao['relation'],'satisfied':ao['satisfied'],'score':ao['score'],'reason':ao['reason']},'result':ad['get'](ao['id']),...aq?{'server_match':{'policy_version':aq['serverEvaluation']['policyVersion'],'total':aq['serverEvaluation']['total'],'breakdown':aq['serverEvaluation']['breakdown'],'unknown_rules':aq['serverEvaluation']['unknownRules'],'red_flags':aq['serverEvaluation']['redFlags'],'channels':aq['channels'],'rrf':aq['rrf']}}:{}};});if(T&&ab){const ao=applyPolicyRerank(af,T);af=ao['matches'],aa=buildPolicyEffect(T,ab['gateOutcome'],ab['weights'],ao);}c={'action':'match_discover','sensitivity':O,'inference_signals':P,'match_route':Z,'matches':af,'total_enumerated':X['total_enumerated'],'has_more':X['has_more'],'coverage':X['coverage'],'scope_advice':{'search_terms':S['search_terms'],'ai_enrichment_note':S['ai_enrichment_note']},...aa?{'policy_effect':aa}:{}};break;}case'arbitration_score':{let ap=b['history'];const aq=b['context_network']??'testnet';if((!ap||ap['length']===0x0)&&b['arbitration']['object'])try{const as=await enumerateArbs(aq,{'arbitration':b['arbitration']['object']});ap=await arbCasesWithRoles(as['arbs'],aq);}catch{ap=b['history'];}if((!ap||ap['length']===0x0)&&b['arbitration']['object'])try{const at=await query_objects({'objects':[b['arbitration']['object']],'network':aq}),au=at?.['objects']?.[0x0];if(au?.['permission']){const av=await fetchObjectLinkerCore(au['permission'],aq),aw=(av?.['items']??[])['map'](ay=>ay['who'])['filter'](ay=>ay!==b['arbitration']['object']),ax=[];for(const ay of aw['slice'](0x0,0xa)){const az=await enumerateArbs(aq,{'arbitration':ay})['catch'](()=>undefined);az?.['arbs']?.['length']&&ax['push'](...await arbCasesWithRoles(az['arbs'],aq));}if(ax['length']>0x0)ap=ax;}}catch{}const ar=await assessArbitration({'arbitration':{'object':b['arbitration']['object'],'fee':b['arbitration']['fee'],'balance':b['arbitration']['balance'],'voting_guard_count':b['arbitration']['voting_guard_count'],'bPaused':b['arbitration']['bPaused'],'location':b['arbitration']['location'],'has_verified_identity':b['arbitration']['has_verified_identity']},'history':ap,'entity_votes':b['entity_votes'],'fee_median':b['fee_median']},await resolveInjection(b['account'],b['injection']));c={'action':'arbitration_score',...ar};break;}case'account_events':{const aA=await runAccountEventWatchers({'account':b['account'],'network':await resolveNetwork(b['context_network']),'reviews':b['reviews']?.['map'](aB=>({'reviewer':aB['reviewer'],'rating':aB['rating'],'tags':aB['tags'],'comment':aB['comment'],'orderRef':aB['orderRef'],'timestamp':aB['timestamp'],'verified':aB['verified']??![]})),'order_history':b['order_history']},b['categories']);c={'action':'account_events','events':aA};break;}default:throw new Error('Unknown\x20evaluation_operation\x20action');}return{'content':[{'type':'text','text':JSON['stringify']({'result':c})}],'structuredContent':{'result':c}};}
@@ -1 +1 @@
1
- import{describe,expect,it}from'vitest';import{handleEvaluationOperation}from'./evaluation.js';function resultOf(a){return a['structuredContent']['result'];}const demandCap={'id':'0xdemand1','kind':'demand','industry':'freelance','region':{'mode':'physical','city':'Shanghai','raw':'Shanghai'},'keywords':['design'],'capabilities':{'has_arbitration':![],'has_refund_path':![],'has_milestone_nodes':![],'has_compensation_fund':![],'has_wip_verification':![],'has_messenger':![],'has_buy_guard':![],'has_dynamic_pricing':![],'is_published':!![],'is_paused':![]}},service={'object':'0xsvc1','description':'freelance\x20logo\x20design','location':'Shanghai','sales':[{'price':'100','wip_hash':'abc'}],'bPublished':!![],'bPaused':![]};describe('evaluation_operation\x20demand_match\x20presenter_history\x20(P2-2)',()=>{it('acceptance\x20rule\x20scores\x20the\x20rated\x20history\x20in\x20the\x20breakdown',async()=>{const a=await handleEvaluationOperation({'action':'demand_match','demand_cap':demandCap,'services':[service],'presenter_history':[{'acceptance_score':0x50},{'acceptance_score':0x5a}]}),c=resultOf(a);expect(c['action'])['toBe']('demand_match');const d=c['matches'][0x0]['result']['breakdown']['find'](e=>e['rule_id']==='acceptance');expect(d)['toBeDefined'](),expect(d['score'])['toBe'](0x55);}),it('omitted\x20history\x20→\x20acceptance\x20stays\x20neutral',async()=>{const a=await handleEvaluationOperation({'action':'demand_match','demand_cap':demandCap,'services':[service]}),c=resultOf(a)['matches'][0x0]['result']['breakdown']['find'](d=>d['rule_id']==='acceptance');expect(c)['toBeDefined'](),expect(c['score'])['toBe'](0x32),expect(c['reason'])['toContain']('neutral');}),it('schema\x20rejects\x20a\x20malformed\x20presenter_history\x20entry',async()=>{await expect(handleEvaluationOperation({'action':'demand_match','demand_cap':demandCap,'services':[service],'presenter_history':[{'acceptance_score':0x50,'bogus':!![]}]}))['rejects']['toThrow']();});}),describe('evaluation_operation\x20demand_match\x20order\x20bridge\x20(N-2\x20/\x2008\x20§7)',()=>{it('each\x20match\x20carries\x20the\x20service.order_new\x20transaction-formation\x20bridge',async()=>{const a=await handleEvaluationOperation({'action':'demand_match','demand_cap':demandCap,'services':[service]}),b=resultOf(a)['matches'][0x0];expect(b['order'])['toBeDefined'](),expect(b['order']['operation'])['toBe']('service.order_new'),expect(b['order']['operation_type'])['toBe']('service'),expect(b['order']['preconditions']['some'](c=>c['includes']('acceptance_score')))['toBe'](!![]),expect(b['order']['rationale'])['toContain']('0xsvc1'),expect(b['next']['operation'])['toBe']('demand.publish'),expect(b['next']['operation_type'])['toBe']('demand'),expect(b['next']['rationale'])['toContain']('service.order_new');});}),describe('evaluation_operation\x20evidence_review\x20list\x20mode\x20(P2-3)',()=>{it('items\x20mode\x20→\x20structured\x20usable/manual/rejected\x20+\x20proof\x20candidates',async()=>{const a=await handleEvaluationOperation({'action':'evidence_review','items':[{'id':'chat.wts','kind':'signature_photo','hash_committed':!![],'digital_check_passed':!![],'proof_ref':'0xproof1'},{'id':'waybill.jpg','kind':'delivery_proof','hash_committed':!![]},{'id':'voice.mp3','kind':'voice_recording','hash_committed':![]}]}),b=resultOf(a);expect(b['action'])['toBe']('evidence_review'),expect(b['list']['items'])['toHaveLength'](0x3),expect(b['list']['usable'])['toHaveLength'](0x1),expect(b['list']['manual'])['toHaveLength'](0x1),expect(b['list']['rejected'])['toHaveLength'](0x1),expect(b['list']['proof_candidates'])['toHaveLength'](0x1),expect(b['list']['proof_candidates'][0x0]['proof_ref'])['toBe']('0xproof1'),expect(b['list']['dispute_hint'])['toContain']('1\x20Proof\x20reference\x20candidate(s)\x20ready');}),it('single-item\x20mode\x20still\x20works\x20(backwards\x20compatible)',async()=>{const a=await handleEvaluationOperation({'action':'evidence_review','kind':'signature_photo','hash_committed':!![],'digital_check_passed':!![]});expect(resultOf(a)['review']['status'])['toBe']('auto_pass');}),it('schema\x20refinement:\x20neither\x20items\x20nor\x20kind+hash_committed\x20→\x20error',async()=>{await expect(handleEvaluationOperation({'action':'evidence_review'}))['rejects']['toThrow']();});});
1
+ import{afterEach,beforeEach,describe,expect,it,vi}from'vitest';import{handleEvaluationOperation}from'./evaluation.js';import{enumerateServices,matchServicesViaIndex,weiToWowDecimal}from'../../knowledge/jsonrpc-enum.js';vi['mock']('../../knowledge/jsonrpc-enum.js',async a=>({...await a(),'enumerateServices':vi['fn'](),'matchServicesViaIndex':vi['fn']()}));function resultOf(a){return a['structuredContent']['result'];}const demandCap={'id':'0xdemand1','kind':'demand','industry':'freelance','region':{'mode':'physical','city':'Shanghai','raw':'Shanghai'},'keywords':['design'],'capabilities':{'has_arbitration':![],'has_refund_path':![],'has_milestone_nodes':![],'has_compensation_fund':![],'has_wip_verification':![],'has_messenger':![],'has_buy_guard':![],'has_dynamic_pricing':![],'is_published':!![],'is_paused':![]}},service={'object':'0xsvc1','description':'freelance\x20logo\x20design','location':'Shanghai','sales':[{'price':'100','wip_hash':'abc'}],'bPublished':!![],'bPaused':![]};describe('evaluation_operation\x20demand_match\x20presenter_history\x20(P2-2)',()=>{it('acceptance\x20rule\x20scores\x20the\x20rated\x20history\x20in\x20the\x20breakdown',async()=>{const a=await handleEvaluationOperation({'action':'demand_match','demand_cap':demandCap,'services':[service],'presenter_history':[{'acceptance_score':0x50},{'acceptance_score':0x5a}]}),c=resultOf(a);expect(c['action'])['toBe']('demand_match');const d=c['matches'][0x0]['result']['breakdown']['find'](e=>e['rule_id']==='acceptance');expect(d)['toBeDefined'](),expect(d['score'])['toBe'](0x55);}),it('omitted\x20history\x20→\x20acceptance\x20stays\x20neutral',async()=>{const a=await handleEvaluationOperation({'action':'demand_match','demand_cap':demandCap,'services':[service]}),c=resultOf(a)['matches'][0x0]['result']['breakdown']['find'](d=>d['rule_id']==='acceptance');expect(c)['toBeDefined'](),expect(c['score'])['toBe'](0x32),expect(c['reason'])['toContain']('neutral');}),it('schema\x20rejects\x20a\x20malformed\x20presenter_history\x20entry',async()=>{await expect(handleEvaluationOperation({'action':'demand_match','demand_cap':demandCap,'services':[service],'presenter_history':[{'acceptance_score':0x50,'bogus':!![]}]}))['rejects']['toThrow']();});}),describe('evaluation_operation\x20demand_match\x20order\x20bridge\x20(N-2\x20/\x2008\x20§7)',()=>{it('each\x20match\x20carries\x20the\x20service.order_new\x20transaction-formation\x20bridge',async()=>{const a=await handleEvaluationOperation({'action':'demand_match','demand_cap':demandCap,'services':[service]}),b=resultOf(a)['matches'][0x0];expect(b['order'])['toBeDefined'](),expect(b['order']['operation'])['toBe']('service.order_new'),expect(b['order']['operation_type'])['toBe']('service'),expect(b['order']['preconditions']['some'](c=>c['includes']('acceptance_score')))['toBe'](!![]),expect(b['order']['rationale'])['toContain']('0xsvc1'),expect(b['next']['operation'])['toBe']('demand.publish'),expect(b['next']['operation_type'])['toBe']('demand'),expect(b['next']['rationale'])['toContain']('service.order_new');});}),describe('evaluation_operation\x20match_discover\x20indexed\x20candidate\x20mapping',()=>{it('scores\x20wrapped\x20sales\x20fields\x20instead\x20of\x20replacing\x20them\x20with\x20zero\x20values',async()=>{vi['mocked'](enumerateServices)['mockResolvedValueOnce']({'services':[{'object':'0xsvc1','name':'Logo\x20design','location':'Shanghai','json':{'description':'freelance\x20logo\x20design','location':'Shanghai','sales':[{'fields':{'name':'logo','price':'100','wip_hash':'abc'}}],'bPublished':!![],'bPaused':![]}}],'total_enumerated':0x1,'has_more':![],'coverage':{'mode':'known_objects','complete':![],'truncated':![],'total_enumerated':0x1,'chain_id':'chain_test','degraded_reasons':[]}});const a=await handleEvaluationOperation({'action':'match_discover','description':'freelance\x20logo\x20design','location':'Shanghai','sensitivity':'strict','budget':'50','required_capabilities':['has_wip_verification'],'context_network':'testnet'}),b=resultOf(a)['matches'][0x0];expect(b['service']['sales'])['toEqual']([{'name':'logo','price':'100','wip_hash':'abc'}]),expect(b['result']['breakdown']['find'](c=>c['rule_id']==='price'))['toMatchObject']({'score':0x0,'reason':'over\x20budget'}),expect(b['result']['breakdown']['find'](c=>c['rule_id']==='capabilities'))['toMatchObject']({'score':0x64,'matched':['has_wip_verification']});});}),describe('evaluation_operation\x20evidence_review\x20list\x20mode\x20(P2-3)',()=>{it('items\x20mode\x20→\x20structured\x20usable/manual/rejected\x20+\x20proof\x20candidates',async()=>{const a=await handleEvaluationOperation({'action':'evidence_review','items':[{'id':'chat.wts','kind':'signature_photo','hash_committed':!![],'digital_check_passed':!![],'proof_ref':'0xproof1'},{'id':'waybill.jpg','kind':'delivery_proof','hash_committed':!![]},{'id':'voice.mp3','kind':'voice_recording','hash_committed':![]}]}),b=resultOf(a);expect(b['action'])['toBe']('evidence_review'),expect(b['list']['items'])['toHaveLength'](0x3),expect(b['list']['usable'])['toHaveLength'](0x1),expect(b['list']['manual'])['toHaveLength'](0x1),expect(b['list']['rejected'])['toHaveLength'](0x1),expect(b['list']['proof_candidates'])['toHaveLength'](0x1),expect(b['list']['proof_candidates'][0x0]['proof_ref'])['toBe']('0xproof1'),expect(b['list']['dispute_hint'])['toContain']('1\x20Proof\x20reference\x20candidate(s)\x20ready');}),it('single-item\x20mode\x20still\x20works\x20(backwards\x20compatible)',async()=>{const a=await handleEvaluationOperation({'action':'evidence_review','kind':'signature_photo','hash_committed':!![],'digital_check_passed':!![]});expect(resultOf(a)['review']['status'])['toBe']('auto_pass');}),it('schema\x20refinement:\x20neither\x20items\x20nor\x20kind+hash_committed\x20→\x20error',async()=>{await expect(handleEvaluationOperation({'action':'evidence_review'}))['rejects']['toThrow']();});});function remoteCandidate(a,b={}){return{'objectId':a,'verifiedKind':'Service','objectVersion':'3','facetVersion':'facets-1','channels':['bm25','structured'],'rrf':0.032786885246,'publicFeatures':{'industry':'freelance','industryConfidence':0.7,'location':'Shanghai','priceMin':'100','priceMax':'100','capabilities':['has_wip_verification'],'published':!![],'paused':![],'keywords':['design']},'serverEvaluation':{'policyVersion':'public-baseline-1','total':87.5,'breakdown':[{'dimension':'text','weight':0x1e,'score':0x64}],'unknownRules':['trust:\x20cold-start\x20prior\x20withheld'],'redFlags':[]},'payloadJson':{'description':'freelance\x20logo\x20design','location':'Shanghai','sales':[{'fields':{'name':'logo','price':'100','wip_hash':'abc'}}],'bPublished':!![],'bPaused':![]},...b};}function remotePage(a){return{'policyVersion':'public-baseline-1','candidates':a,'recall':{'liveSet':a['length']+0x2,'gated':a['length'],'structured':a['length'],'bm25':a['length'],'merged':a['length'],'channelsActive':['structured','bm25']},'truncated':![],'coverage':{'mode':'known_objects','complete':![],'truncated':![],'total_enumerated':a['length'],'chain_id':'chain_test','degraded_reasons':[]}};}function legacyAnswer(){return{'services':[{'object':'0xsvc1','name':'Logo\x20design','location':'Shanghai','json':{'description':'freelance\x20logo\x20design','location':'Shanghai','sales':[{'fields':{'name':'logo','price':'100','wip_hash':'abc'}}],'bPublished':!![],'bPaused':![]}}],'total_enumerated':0x1,'has_more':![],'coverage':{'mode':'event_window','complete':![],'truncated':![],'total_enumerated':0x1,'chain_id':'chain_test','degraded_reasons':['EVENT_BACKED_ENUMERATION']}};}const MATCH_INPUT={'action':'match_discover','description':'freelance\x20logo\x20design','location':'Shanghai','sensitivity':'strict','budget':'100','required_capabilities':['has_wip_verification'],'context_network':'testnet'};describe('evaluation_operation\x20match_discover\x20remote\x20index\x20route\x20(K5-11\x20R3)',()=>{beforeEach(()=>{vi['mocked'](enumerateServices)['mockReset'](),vi['mocked'](matchServicesViaIndex)['mockReset']();}),afterEach(()=>{delete process['env']['WOWOK_DATA_SOURCE'],delete process['env']['WOWOK_INDEX_URL'];}),it('converts\x20wei\x20budgets\x20to\x20WOW\x20decimals\x20for\x20the\x20match\x20API',()=>{expect(weiToWowDecimal('0'))['toBe']('0'),expect(weiToWowDecimal('6000000000'))['toBe']('6'),expect(weiToWowDecimal('7500000000'))['toBe']('7.5'),expect(weiToWowDecimal('123456789'))['toBe']('0.123456789'),expect(weiToWowDecimal('1000000000000'))['toBe']('1000'),expect(()=>weiToWowDecimal('12.5'))['toThrow']();}),it('one-shot\x20remote\x20match:\x20no\x20enumeration,\x20dual\x20breakdown,\x20private\x20re-rank',async()=>{process['env']['WOWOK_DATA_SOURCE']='remote',process['env']['WOWOK_INDEX_URL']='http://index.test',vi['mocked'](matchServicesViaIndex)['mockResolvedValueOnce'](remotePage([remoteCandidate('0xsvc1'),remoteCandidate('0xsvc2',{'payloadJson':{'description':'mural\x20painting','location':'Shanghai','sales':[{'fields':{'name':'mural','price':'90'}}],'bPublished':!![],'bPaused':![]}})]));const a=await handleEvaluationOperation({...MATCH_INPUT}),b=resultOf(a);expect(b['match_route'])['toBe']('remote_index'),expect(enumerateServices)['not']['toHaveBeenCalled'](),expect(vi['mocked'](matchServicesViaIndex)['mock']['calls'][0x0][0x1])['toMatchObject']({'q':'freelance\x20logo\x20design','location':'Shanghai','budgetWei':'100','capabilities':['has_wip_verification']}),expect(b['matches'])['toHaveLength'](0x2),expect(b['total_enumerated'])['toBe'](0x4);const c=b['matches']['find'](e=>e['service']['object']==='0xsvc1');expect(c['server_match'])['toMatchObject']({'policy_version':'public-baseline-1','total':87.5,'channels':['bm25','structured']}),expect(c['server_match']['unknown_rules'])['toEqual'](['trust:\x20cold-start\x20prior\x20withheld']),expect(c['result']['breakdown']['some'](e=>e['rule_id']==='capabilities'))['toBe'](!![]);const d=b['matches']['find'](e=>e['service']['object']==='0xsvc2');expect(d['service']['description'])['toBe']('mural\x20painting'),expect(d['server_match'])['toBeDefined'](),expect(b['coverage']['mode'])['toBe']('known_objects');}),it('auto\x20mode\x20degrades\x20to\x20legacy\x20enumeration\x20with\x20honest\x20coverage',async()=>{process['env']['WOWOK_DATA_SOURCE']='auto',process['env']['WOWOK_INDEX_URL']='http://index.test',vi['mocked'](matchServicesViaIndex)['mockRejectedValueOnce'](Object['assign'](new Error('Remote\x20index\x20returned\x20HTTP\x20503'),{'code':'INDEX_HTTP_ERROR'})),vi['mocked'](enumerateServices)['mockResolvedValueOnce'](legacyAnswer());const a=await handleEvaluationOperation({...MATCH_INPUT}),b=resultOf(a);expect(b['match_route'])['toBe']('legacy_enumeration'),expect(enumerateServices)['toHaveBeenCalledTimes'](0x1),expect(b['coverage']['degraded_reasons'])['toContain']('MATCH_INDEX_FALLBACK'),expect(b['coverage']['degraded_reasons'])['toContain']('INDEX_HTTP_ERROR'),expect(b['matches'])['toHaveLength'](0x1),expect(b['matches'][0x0]['server_match'])['toBeUndefined']();}),it('strict\x20remote\x20mode\x20surfaces\x20the\x20index\x20failure',async()=>{process['env']['WOWOK_DATA_SOURCE']='remote',process['env']['WOWOK_INDEX_URL']='http://index.test',vi['mocked'](matchServicesViaIndex)['mockRejectedValueOnce'](Object['assign'](new Error('Remote\x20index\x20request\x20failed'),{'code':'INDEX_UNAVAILABLE'})),await expect(handleEvaluationOperation({...MATCH_INPUT}))['rejects']['toThrow'](/Remote index request failed/),expect(enumerateServices)['not']['toHaveBeenCalled']();}),it('filters\x20the\x20match\x20API\x20cannot\x20express\x20keep\x20the\x20legacy\x20route',async()=>{process['env']['WOWOK_DATA_SOURCE']='remote',process['env']['WOWOK_INDEX_URL']='http://index.test',vi['mocked'](enumerateServices)['mockResolvedValueOnce'](legacyAnswer());const a=await handleEvaluationOperation({...MATCH_INPUT,'coin_type':'0x2::wow::WOW'}),b=resultOf(a);expect(b['match_route'])['toBe']('legacy_enumeration'),expect(matchServicesViaIndex)['not']['toHaveBeenCalled'](),expect(enumerateServices)['toHaveBeenCalledTimes'](0x1);});}),describe('evaluation_operation\x20match_discover\x20private\x20policy\x20DSL\x20(K5-11\x20R4)',()=>{beforeEach(()=>{vi['mocked'](enumerateServices)['mockReset'](),vi['mocked'](matchServicesViaIndex)['mockReset']();}),afterEach(()=>{delete process['env']['WOWOK_DATA_SOURCE'],delete process['env']['WOWOK_INDEX_URL'];});function a(){return{'services':[{'object':'0xgood','name':'Logo\x20design','location':'Shanghai','json':{'description':'freelance\x20logo\x20design','location':'Shanghai','sales':[{'fields':{'name':'logo','price':'100','wip_hash':'abc'}}],'arbitrations':['0xarb1'],'owner':'0xownerA','bPublished':!![],'bPaused':![]}},{'object':'0xpaused','name':'Paused\x20shop','location':'Shanghai','json':{'description':'freelance\x20logo\x20design','location':'Shanghai','sales':[{'fields':{'name':'logo','price':'100'}}],'owner':'0xownerB','bPublished':!![],'bPaused':!![]}}],'total_enumerated':0x2,'has_more':![],'coverage':{'mode':'event_window','complete':![],'truncated':![],'total_enumerated':0x2,'chain_id':'chain_test','degraded_reasons':['EVENT_BACKED_ENUMERATION']}};}it('preset\x20gate\x20drops\x20the\x20paused\x20candidate\x20and\x20reports\x20it\x20in\x20policy_effect',async()=>{vi['mocked'](enumerateServices)['mockResolvedValueOnce'](a());const b=await handleEvaluationOperation({'action':'match_discover','description':'freelance\x20logo\x20design','location':'Shanghai','sensitivity':'strict','context_network':'testnet','match_policy':'trust_first'}),c=resultOf(b);expect(c['matches']['map'](d=>d['service']['object']))['toEqual'](['0xgood']),expect(c['policy_effect']['policy_id'])['toBe']('trust_first'),expect(c['policy_effect']['privacy'])['toContain']('never\x20leave\x20this\x20device'),expect(c['policy_effect']['dropped']['some'](e=>e['object']==='0xpaused'))['toBe'](!![]),expect(c['policy_effect']['weights_applied']['trust'])['toBe'](0x1e),expect(typeof c['policy_effect']['policy_hash'])['toBe']('string');}),it('a\x20weight-only\x20policy\x20re-anchors\x20the\x20trust\x20dimension\x20(weight_source=override)',async()=>{vi['mocked'](enumerateServices)['mockResolvedValueOnce'](a());const b=await handleEvaluationOperation({'action':'match_discover','description':'freelance\x20logo\x20design','location':'Shanghai','sensitivity':'strict','context_network':'testnet','match_policy':{'policy_id':'custom','weights':{'trust':0x2d}}}),c=resultOf(b),d=c['matches'][0x0]['result']['breakdown']['find'](e=>e['rule_id']==='trust');expect(d['weight'])['toBe'](0x2d),expect(d['weight_source'])['toBe']('override'),expect(c['policy_effect']['weights_applied'])['toEqual']({'trust':0x2d});}),it('the\x20private\x20policy\x20never\x20reaches\x20the\x20remote\x20match\x20request',async()=>{process['env']['WOWOK_DATA_SOURCE']='remote',process['env']['WOWOK_INDEX_URL']='http://index.test',vi['mocked'](matchServicesViaIndex)['mockResolvedValueOnce'](remotePage([remoteCandidate('0xsvc1')])),await handleEvaluationOperation({...MATCH_INPUT,'match_policy':'trust_first'});const b=vi['mocked'](matchServicesViaIndex)['mock']['calls'][0x0][0x1];expect(b['match_policy'])['toBeUndefined'](),expect(b['policy'])['toBeUndefined'](),expect(JSON['stringify'](b))['not']['toContain']('trust_first');}),it('unknown\x20preset\x20id\x20throws\x20with\x20the\x20available\x20list',async()=>{await expect(handleEvaluationOperation({...MATCH_INPUT,'match_policy':'does_not_exist'}))['rejects']['toThrow'](/unknown match_policy preset/);}),it('a\x20supply_to_demand\x20policy\x20is\x20rejected\x20by\x20match_discover',async()=>{await expect(handleEvaluationOperation({...MATCH_INPUT,'match_policy':'supplier_hunting'}))['rejects']['toThrow'](/direction/);});});
@@ -17,6 +17,12 @@ export declare function minCompletionFixedFloor(groups: {
17
17
  guard: string;
18
18
  sum: bigint;
19
19
  }[], nodes: ParsedMachineNode[]): bigint | undefined;
20
+ export declare function arbClaimEscrowEmptyDualPayout(inputs: {
21
+ orderAmount?: number;
22
+ escrowBalance?: number;
23
+ poolValue?: number;
24
+ acknowledged: boolean;
25
+ }): "refuse" | "acknowledged" | null;
20
26
  export declare function gateOrderNewAmountLegCoverage(data: any, network: unknown): Promise<ToolDispatchResult | null>;
21
27
  interface SaleItemOpPreparation {
22
28
  op: string;
@@ -33,6 +39,7 @@ export declare function prepareSaleItemOp(data: any, network: unknown): Promise<
33
39
  } | {
34
40
  prep: SaleItemOpPreparation;
35
41
  } | null>;
42
+ export declare function prepareRestockOrderOp(data: any, network: unknown): Promise<ToolDispatchResult | null>;
36
43
  export declare function emitSaleItemOpReadback(prep: SaleItemOpPreparation, data: any, network: unknown, warnings: string[]): Promise<void>;
37
44
  export declare function prepareSalesAddDuplicateGate(data: any, network: unknown, env?: {
38
45
  confirmed?: boolean;