@wowok/agent-mcp 3.3.1 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/dist/chain-semantics/field-capability.js +1 -1
  2. package/dist/chain-semantics/freeze-map.js +1 -1
  3. package/dist/chain-semantics/fund-flow.js +1 -1
  4. package/dist/chain-semantics/guard-verbs.js +1 -1
  5. package/dist/chain-semantics/object-graph.js +1 -1
  6. package/dist/composition/audit.d.ts +5 -0
  7. package/dist/composition/audit.js +1 -1
  8. package/dist/composition/blueprint-view.d.ts +0 -1
  9. package/dist/composition/blueprint-view.js +1 -1
  10. package/dist/composition/compile.d.ts +5 -3
  11. package/dist/composition/compile.js +1 -1
  12. package/dist/composition/inflight.d.ts +32 -4
  13. package/dist/composition/inflight.js +1 -1
  14. package/dist/config/judgment.d.ts +111 -1
  15. package/dist/config/judgment.js +1 -1
  16. package/dist/customer/industry-risks.js +1 -1
  17. package/dist/customer/user-preferences.js +1 -1
  18. package/dist/evaluation/arbitration-game.d.ts +4 -0
  19. package/dist/evaluation/arbitration-game.js +1 -1
  20. package/dist/evaluation/builtins/graph-service.js +1 -1
  21. package/dist/evaluation/builtins/graph-service.spec.js +1 -1
  22. package/dist/evaluation/game-strategy.d.ts +6 -0
  23. package/dist/evaluation/game-strategy.js +1 -1
  24. package/dist/evaluation/node-game.d.ts +4 -0
  25. package/dist/evaluation/node-game.js +1 -1
  26. package/dist/evaluation/value-risk.d.ts +8 -0
  27. package/dist/evaluation/value-risk.js +1 -0
  28. package/dist/experience/realtime-feedback.js +1 -1
  29. package/dist/extensions/business-modules.d.ts +7 -2
  30. package/dist/extensions/business-modules.js +1 -1
  31. package/dist/extensions/industry-audit.spec.js +1 -1
  32. package/dist/extensions/industry-pack.d.ts +3 -2
  33. package/dist/extensions/industry-pack.js +1 -1
  34. package/dist/extensions/modes.js +1 -1
  35. package/dist/graph/onchain/analyze.js +1 -1
  36. package/dist/graph/onchain/analyze.spec.js +1 -1
  37. package/dist/graph/onchain/expand.js +1 -1
  38. package/dist/graph/onchain/exposure.js +1 -1
  39. package/dist/graph/onchain/facet-projection.js +1 -1
  40. package/dist/graph/onchain/facet-projection.spec.js +1 -1
  41. package/dist/graph/onchain/facts.d.ts +20 -0
  42. package/dist/graph/onchain/facts.js +1 -1
  43. package/dist/graph/onchain/facts.spec.js +1 -1
  44. package/dist/graph/onchain/object-held-receipts.d.ts +20 -0
  45. package/dist/graph/onchain/object-held-receipts.js +1 -0
  46. package/dist/graph/onchain/object-held-receipts.spec.d.ts +1 -0
  47. package/dist/graph/onchain/object-held-receipts.spec.js +1 -0
  48. package/dist/graph/onchain/project-relationship.js +1 -1
  49. package/dist/graph/onchain/sdk-batch.d.ts +1 -0
  50. package/dist/graph/onchain/sdk-batch.js +1 -1
  51. package/dist/harness/index.d.ts +1 -0
  52. package/dist/harness/recover.d.ts +2 -1
  53. package/dist/harness/recover.js +1 -1
  54. package/dist/knowledge/acquisition-flywheel.js +1 -1
  55. package/dist/knowledge/allocation-ledger.d.ts +3 -1
  56. package/dist/knowledge/allocation-ledger.js +1 -1
  57. package/dist/knowledge/allocation-puzzle.d.ts +1 -0
  58. package/dist/knowledge/allocation-puzzle.js +1 -1
  59. package/dist/knowledge/allocation-risk.d.ts +1 -1
  60. package/dist/knowledge/allocation-risk.js +1 -1
  61. package/dist/knowledge/arb-fund-facts.d.ts +12 -0
  62. package/dist/knowledge/arb-fund-facts.js +1 -1
  63. package/dist/knowledge/audit-rules.d.ts +4 -3
  64. package/dist/knowledge/audit-rules.js +1 -1
  65. package/dist/knowledge/baselines/judgment-baselines.json +502 -81
  66. package/dist/knowledge/baselines/rules/allocation.json +0 -14
  67. package/dist/knowledge/baselines/rules/graph.json +4 -4
  68. package/dist/knowledge/baselines/rules/plan.json +81 -5
  69. package/dist/knowledge/baselines/rules/reward.json +1 -1
  70. package/dist/knowledge/builtin-templates.d.ts +9 -1
  71. package/dist/knowledge/builtin-templates.js +1 -1
  72. package/dist/knowledge/discount-threshold.js +1 -1
  73. package/dist/knowledge/event-semantics.js +1 -1
  74. package/dist/knowledge/game-scenarios.d.ts +21 -0
  75. package/dist/knowledge/game-scenarios.js +1 -0
  76. package/dist/knowledge/getting-started.js +1 -1
  77. package/dist/knowledge/guard-bindings.js +1 -1
  78. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  79. package/dist/knowledge/guard-design-patterns.js +1 -1
  80. package/dist/knowledge/guard-field-cognition.js +1 -1
  81. package/dist/knowledge/guard-leg-map.d.ts +5 -0
  82. package/dist/knowledge/guard-leg-map.js +1 -0
  83. package/dist/knowledge/guard-lint.js +1 -1
  84. package/dist/knowledge/guard-puzzle.js +1 -1
  85. package/dist/knowledge/guard-render.js +1 -1
  86. package/dist/knowledge/guard-risk.js +1 -1
  87. package/dist/knowledge/guard-submission-brief.d.ts +5 -0
  88. package/dist/knowledge/guard-submission-brief.js +1 -1
  89. package/dist/knowledge/guard-submission-prompt.d.ts +2 -1
  90. package/dist/knowledge/guard-submission-prompt.js +1 -1
  91. package/dist/knowledge/guard-templates.d.ts +1 -1
  92. package/dist/knowledge/guard-templates.js +1 -1
  93. package/dist/knowledge/guard-translation.js +1 -1
  94. package/dist/knowledge/index.js +1 -1
  95. package/dist/knowledge/industry-generalizer.js +1 -1
  96. package/dist/knowledge/industry-registry.js +1 -1
  97. package/dist/knowledge/industry-strategy.js +1 -1
  98. package/dist/knowledge/jsonrpc-enum.js +1 -1
  99. package/dist/knowledge/onchain-constants.d.ts +4 -2
  100. package/dist/knowledge/onchain-constants.js +1 -1
  101. package/dist/knowledge/order-ledger.d.ts +1 -1
  102. package/dist/knowledge/order-ledger.js +1 -1
  103. package/dist/knowledge/order-puzzle.d.ts +3 -0
  104. package/dist/knowledge/order-risk.d.ts +1 -1
  105. package/dist/knowledge/passport-ledger.d.ts +12 -0
  106. package/dist/knowledge/passport-ledger.js +1 -1
  107. package/dist/knowledge/payment-tracker.js +1 -1
  108. package/dist/knowledge/protocol-facts.d.ts +1 -0
  109. package/dist/knowledge/protocol-facts.js +1 -1
  110. package/dist/knowledge/repository-write-semantics.d.ts +1 -1
  111. package/dist/knowledge/repository-write-semantics.js +1 -1
  112. package/dist/knowledge/reward-ledger.js +1 -1
  113. package/dist/knowledge/reward-puzzle.d.ts +1 -1
  114. package/dist/knowledge/reward-risk.d.ts +1 -1
  115. package/dist/knowledge/scenario-modes.d.ts +2 -2
  116. package/dist/knowledge/scenario-modes.js +1 -1
  117. package/dist/knowledge/scenario-topology.js +1 -1
  118. package/dist/knowledge/service-ledger.d.ts +14 -0
  119. package/dist/knowledge/service-ledger.js +1 -1
  120. package/dist/knowledge/strategy-manuals.js +1 -1
  121. package/dist/knowledge/template-index.d.ts +19 -0
  122. package/dist/knowledge/template-index.js +1 -0
  123. package/dist/knowledge/template-loader.d.ts +36 -0
  124. package/dist/knowledge/template-loader.js +1 -1
  125. package/dist/knowledge/template-registry.js +1 -1
  126. package/dist/knowledge/template-scanner.d.ts +11 -0
  127. package/dist/knowledge/template-scanner.js +1 -1
  128. package/dist/knowledge/tool-constraints.js +1 -1
  129. package/dist/knowledge/workflow-guidance.d.ts +2 -0
  130. package/dist/knowledge/workflow-guidance.js +1 -1
  131. package/dist/monitor/MonitorLoop.js +1 -1
  132. package/dist/participation/allocation-advice.d.ts +8 -1
  133. package/dist/participation/allocation-advice.js +1 -1
  134. package/dist/participation/game-context.d.ts +25 -0
  135. package/dist/participation/game-context.js +1 -0
  136. package/dist/participation/node-action-advisor.d.ts +64 -0
  137. package/dist/participation/node-action-advisor.js +1 -0
  138. package/dist/participation/radar-core.d.ts +1 -0
  139. package/dist/participation/radar-core.js +1 -1
  140. package/dist/persona/defaults.js +1 -1
  141. package/dist/persona/topology-focus.js +1 -1
  142. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  143. package/dist/playbooks/service-build/game-theory.d.ts +4 -1
  144. package/dist/playbooks/service-build/game-theory.js +1 -1
  145. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  146. package/dist/playbooks/service-build/merchant-guide.d.ts +26 -1
  147. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  148. package/dist/playbooks/service-build/migration-planner.d.ts +2 -2
  149. package/dist/playbooks/service-build/migration-planner.js +1 -1
  150. package/dist/playbooks/service-build/object-panorama.d.ts +13 -1
  151. package/dist/playbooks/service-build/object-panorama.js +1 -1
  152. package/dist/playbooks/service-build/participation-radar.js +1 -1
  153. package/dist/playbooks/service-build/pipeline-actions.d.ts +4 -1
  154. package/dist/playbooks/service-build/pipeline-actions.js +1 -1
  155. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  156. package/dist/playbooks/service-build/service-panorama.d.ts +12 -0
  157. package/dist/playbooks/service-build/service-panorama.js +1 -1
  158. package/dist/playbooks/service-build/service-quote.js +1 -1
  159. package/dist/playbooks/service-build/service-quote.spec.js +1 -1
  160. package/dist/relationship/derivation.d.ts +1 -1
  161. package/dist/review/index.js +1 -1
  162. package/dist/review/repository.js +1 -1
  163. package/dist/role/intent.d.ts +23 -0
  164. package/dist/role/intent.js +1 -0
  165. package/dist/safety/confirm-gate.js +1 -1
  166. package/dist/schema/benchmark-migration/index.d.ts +39 -0
  167. package/dist/schema/benchmark-migration/index.js +1 -1
  168. package/dist/schema/call/allocation.d.ts +49 -3
  169. package/dist/schema/call/allocation.js +1 -1
  170. package/dist/schema/call/arbitration.js +1 -1
  171. package/dist/schema/call/base.d.ts +52 -0
  172. package/dist/schema/call/base.js +1 -1
  173. package/dist/schema/call/bridge.d.ts +3 -0
  174. package/dist/schema/call/contact.js +1 -1
  175. package/dist/schema/call/error-codes.d.ts +1 -1
  176. package/dist/schema/call/error-codes.js +1 -1
  177. package/dist/schema/call/guard.js +1 -1
  178. package/dist/schema/call/handler.js +1 -1
  179. package/dist/schema/call/machine.d.ts +10 -0
  180. package/dist/schema/call/machine.js +1 -1
  181. package/dist/schema/call/order.d.ts +2 -0
  182. package/dist/schema/call/order.js +1 -1
  183. package/dist/schema/call/progress.d.ts +6 -3
  184. package/dist/schema/call/progress.js +1 -1
  185. package/dist/schema/call/repository.d.ts +4 -0
  186. package/dist/schema/call/repository.js +1 -1
  187. package/dist/schema/call/reward.d.ts +2 -2
  188. package/dist/schema/call/reward.js +1 -1
  189. package/dist/schema/call/semantic.d.ts +6 -0
  190. package/dist/schema/call/semantic.js +1 -1
  191. package/dist/schema/call/service.d.ts +42 -4
  192. package/dist/schema/call/service.js +1 -1
  193. package/dist/schema/common/index.js +1 -1
  194. package/dist/schema/goal/index.d.ts +54 -0
  195. package/dist/schema/goal/planning.d.ts +86 -0
  196. package/dist/schema/goal/planning.js +1 -1
  197. package/dist/schema/keeper/index.d.ts +2 -0
  198. package/dist/schema/local/index.d.ts +72 -0
  199. package/dist/schema/local/index.js +1 -1
  200. package/dist/schema/messenger/index.d.ts +2 -0
  201. package/dist/schema/operations.d.ts +46 -5
  202. package/dist/schema/operations.js +1 -1
  203. package/dist/schema/persona/index.d.ts +484 -0
  204. package/dist/schema/query/bi.d.ts +4 -0
  205. package/dist/schema/query/bi.js +1 -1
  206. package/dist/schema/query/index.d.ts +84 -60
  207. package/dist/schema/query/index.js +1 -1
  208. package/dist/schema/schema-version.d.ts +1 -1
  209. package/dist/schema/schema-version.js +1 -1
  210. package/dist/schema-query-impl/index.js +1 -1
  211. package/dist/schemas/account_operation.output.json +41 -10
  212. package/dist/schemas/account_operation.schema.json +1 -1
  213. package/dist/schemas/benchmark_migration_operation.output.json +8 -5
  214. package/dist/schemas/benchmark_migration_operation.schema.json +91 -3
  215. package/dist/schemas/bridge_operation.output.json +13 -7
  216. package/dist/schemas/goal_operation.schema.json +94 -0
  217. package/dist/schemas/index.json +1 -1
  218. package/dist/schemas/keeper_operation.output.json +12 -7
  219. package/dist/schemas/local_cache_operation.output.json +34 -7
  220. package/dist/schemas/local_cache_operation.schema.json +16 -1
  221. package/dist/schemas/local_history_operation.output.json +13 -7
  222. package/dist/schemas/local_info_operation.output.json +13 -7
  223. package/dist/schemas/local_info_operation.schema.json +5 -1
  224. package/dist/schemas/local_mark_operation.output.json +13 -7
  225. package/dist/schemas/messenger_operation.output.json +12 -7
  226. package/dist/schemas/monitor_events.output.json +12 -7
  227. package/dist/schemas/monitor_subscription.output.json +12 -7
  228. package/dist/schemas/onchain_events.output.json +67 -18
  229. package/dist/schemas/onchain_events.schema.json +4 -0
  230. package/dist/schemas/onchain_operations.output.json +81 -24
  231. package/dist/schemas/onchain_operations.schema.json +531 -126
  232. package/dist/schemas/onchain_operations_allocation.schema.json +294 -6
  233. package/dist/schemas/onchain_operations_arbitration.schema.json +3 -3
  234. package/dist/schemas/onchain_operations_contact.schema.json +2 -2
  235. package/dist/schemas/onchain_operations_demand.schema.json +3 -3
  236. package/dist/schemas/onchain_operations_gen_passport.schema.json +1 -1
  237. package/dist/schemas/onchain_operations_guard.schema.json +99 -63
  238. package/dist/schemas/onchain_operations_machine.schema.json +10 -1
  239. package/dist/schemas/onchain_operations_order.schema.json +8 -4
  240. package/dist/schemas/onchain_operations_progress.schema.json +8 -4
  241. package/dist/schemas/onchain_operations_proof.schema.json +1 -1
  242. package/dist/schemas/onchain_operations_repository.schema.json +6 -2
  243. package/dist/schemas/onchain_operations_reward.schema.json +8 -8
  244. package/dist/schemas/onchain_operations_service.schema.json +81 -21
  245. package/dist/schemas/onchain_operations_treasury.schema.json +7 -7
  246. package/dist/schemas/onchain_table_data.output.json +16 -7
  247. package/dist/schemas/persona_operation.output.json +1387 -0
  248. package/dist/schemas/persona_operation.schema.json +219 -0
  249. package/dist/schemas/query_toolkit.output.json +115 -64
  250. package/dist/schemas/query_toolkit.schema.json +8 -0
  251. package/dist/schemas/workflow_operation.schema.json +1 -1
  252. package/dist/tools/handlers/benchmark-migration.js +1 -1
  253. package/dist/tools/handlers/bridge.js +1 -1
  254. package/dist/tools/handlers/config.js +1 -1
  255. package/dist/tools/handlers/dispatch-expectations.js +1 -1
  256. package/dist/tools/handlers/file-export.js +1 -1
  257. package/dist/tools/handlers/industry-pack.d.ts +1 -0
  258. package/dist/tools/handlers/industry-pack.js +1 -1
  259. package/dist/tools/handlers/local.js +1 -1
  260. package/dist/tools/handlers/messenger.js +1 -1
  261. package/dist/tools/handlers/onchain-name-registration.d.ts +11 -0
  262. package/dist/tools/handlers/onchain-name-registration.js +1 -1
  263. package/dist/tools/handlers/onchain.d.ts +28 -0
  264. package/dist/tools/handlers/onchain.js +1 -1
  265. package/dist/tools/handlers/query.js +1 -1
  266. package/dist/tools/handlers/review-chain.d.ts +1 -1
  267. package/dist/tools/handlers/review-chain.js +1 -1
  268. package/dist/tools/handlers/schema-query.js +1 -1
  269. package/dist/tools/handlers/workflow.js +1 -1
  270. package/dist/tools/move-fn-index.gen.js +1 -1
  271. package/dist/tools/registry/agent.js +1 -1
  272. package/dist/tools/registry/local.js +1 -1
  273. package/dist/tools/registry/onchain.js +1 -1
  274. package/dist/tools/registry/query.js +1 -1
  275. package/dist/tools/wip-deploy-assist.js +1 -1
  276. package/dist/tools/wrap.js +1 -1
  277. package/package.json +3 -3
@@ -1 +1 @@
1
- import{fillGuardTemplate}from'../knowledge/guard-templates.js';import{SV2_UNARMED_PRESCRIPTION}from'../knowledge/protocol-facts.js';import{verifyAllocatorRails}from'../knowledge/allocator-rail-verifier.js';import{rootHasRewardRecordGate}from'../knowledge/template-scanner.js';import{refsOf}from'./plan.js';const P=a=>a;export const TASK_BINDING_SLOT=0xfe;function safeId(a){return a['replace'](/[^a-zA-Z0-9_]/g,'_');}function ref(a){return{'$ref':a};}const MODE_MAP={'amount':'Amount','rate':'Rate','surplus':'Surplus'};export function compileTemplate(a,b,d={}){const h=d['nameBase']??a['id']['replace'](/\//g,'_'),i=d['merchantPermissionIndex']??0x3e8,j=[],k=[],l=new Set();for(const a4 of a['conditional_guards']??[]){const a5=b[a4['param']]??a['fee_params'][a4['param']];if(a5!==a4['emit_value'])l['add'](a4['guard_key']);}const o=new Map();for(const a6 of a['conditional_guards']??[]){o['set'](a6['param'],(o['get'](a6['param'])??0x0)+0x1);}const p=new Set((a['conditional_guards']??[])['filter'](a7=>(o['get'](a7['param'])??0x0)>0x1)['map'](a7=>a7['guard_key'])),q=new Set([...l]['filter'](a7=>p['has'](a7))),s=q['size']>0x0?a['machine_shape']['map'](a7=>({...a7,'from':(a7['from']??[])['filter'](a8=>typeof a8==='string'||a8['guard_key']===undefined||!q['has'](a8['guard_key']))})):a['machine_shape'],t=q['size']>0x0?(a['allocator']['rows']??[])['filter'](a7=>a7['guard_key']===undefined||!q['has'](a7['guard_key'])):a['allocator']['rows']??[],u=[];for(const [a7,a8]of Object['entries'](d['guardResolutions']??{})){if(a8?.['kind']==='omit')u['push'](a7);}const v=new Set();if(u['length']>0x0){const a9=new Set(s['flatMap'](ab=>(ab['from']??[])['map'](ac=>typeof ac==='string'?undefined:ac['guard_key'])['filter'](ac=>typeof ac==='string'))),aa=new Set(t['map'](ab=>ab['guard_key'])['filter'](ab=>typeof ab==='string'));for(const ab of u){const ac=a['guards']['find']((ae,af)=>(ae['key']??ae['template_id']+'#'+af)===ab);if(ac===undefined)continue;const ad=[];if(a9['has'](ab))ad['push']('a\x20machine\x20forward\x20edge\x20(guard_key)');if(aa['has'](ab))ad['push']('an\x20allocator\x20rail\x20row\x20(guard_key)');if(ac['policy']!==undefined)ad['push']('a\x20Repository\x20write-policy\x20credential\x20(policy)');if(ac['host']==='service'&&ab==='buy')ad['push']('the\x20Service\x20buy\x20gate\x20(buy_guard)');ad['length']>0x0?j['push']({'code':'GUARD_OMIT_UNSUPPORTED','detail':'guard_resolutions[\x27'+ab+'\x27]\x20=\x20{kind:\x27omit\x27}\x20refused:\x20this\x20design\x20is\x20bound\x20to\x20'+ad['join']('\x20and\x20')+'\x20—\x20'+'omitting\x20it\x20would\x20orphan\x20the\x20binding\x20(open\x20rail\x20/\x20open\x20write\x20/\x20ungated\x20purchase).\x20'+'Fold\x20the\x20design\x27s\x20intent\x20into\x20the\x20bound\x20site\x20instead,\x20or\x20keep\x20the\x20guard\x20resolved.'}):v['add'](ab);}}const w=a['guards']['map']((ae,af)=>({'key':ae['key']??ae['template_id']+'#'+af,'template_id':ae['template_id'],'host':ae['host'],'purpose':ae['purpose'],'policy':ae['policy']}))['filter'](ae=>!l['has'](ae['key'])&&!v['has'](ae['key'])),x=new Map(w['map'](ae=>[ae['key'],ae])),y=new Map(),z=[],A=w['map'](ae=>ae['key']);for(const ae of Object['keys'](d['guardResolutions']??{})){if(v['has'](ae))continue;!x['has'](ae)&&j['push']({'code':'GUARD_RESOLUTION_UNKNOWN','detail':'guard_resolutions\x20key\x20\x27'+ae+'\x27\x20matches\x20no\x20guard\x20spec\x20key\x20declared\x20by\x20\x27'+h+'\x27.\x20'+('Legal\x20keys:\x20'+(A['length']>0x0?A['join'](',\x20'):'(none\x20—\x20this\x20template\x20declares\x20no\x20keyed\x20guards)')+'.\x20')+'An\x20unknown\x20key\x20was\x20previously\x20dropped\x20silently,\x20leaving\x20the\x20intended\x20guard\x20pending\x20while\x20the\x20build\x20looked\x20resolved.'});}for(const af of w){const ag='guard_'+safeId(af['key']),ah=d['guardResolutions']?.[af['key']];let ai=af['purpose'],aj,ak;if(ah?.['kind']==='inline')aj=ah['table'],ak=ah['root'],ai=ah['description']??af['purpose'];else{const al=ah?.['kind']==='template'?ah['template_id']:af['template_id']['startsWith']('tpl_')?af['template_id']:undefined;if(al!==undefined){const am={'service_name':h+'_service',...a['fee_params'],...b,...ah?.['kind']==='template'?ah['params']:{}},an=fillGuardTemplate(al,am);!an['ok']?j['push']({'code':'GUARD_TEMPLATE_PARAMS','detail':'guard\x20\x27'+af['key']+'\x27\x20('+al+'):\x20'+an['error']}):(aj=an['table'],ak=an['root']);}}aj!==undefined?(y['set'](af['key'],{'stepId':ag,'description':ai,'table':aj,'root':ak}),af['step_id']=ag):z['push'](af);}const B=new Set(s['flatMap'](ao=>(ao['from']??[])['map'](ap=>typeof ap==='string'?undefined:ap['guard_key'])['filter'](ap=>typeof ap==='string')));for(const ao of t){typeof ao['guard_key']==='string'&&ao['recipient']==='guard_identifier'&&ao['recipient_key']==='254'&&B['add'](ao['guard_key']);}const C=new Set();for(const ap of w){if(!B['has'](ap['key']))continue;const aq=y['get'](ap['key']);if(aq===undefined)continue;const ar=aq['table']['some'](as=>as['identifier']===TASK_BINDING_SLOT);if(ar)continue;y['set'](ap['key'],{...aq,'table':[...aq['table'],{'identifier':TASK_BINDING_SLOT,'b_submission':!![],'value_type':'Address','name':'task_binding\x20order\x20anchor\x20(protocol\x20slot\x20254;\x20written\x20by\x20order\x20creation)'}]}),C['add'](ap['key']);}const D=as=>y['get'](as)!==undefined&&refsOf({'table':y['get'](as)['table'],'root':y['get'](as)['root']})['has']('service'),E=as=>{const at=y['get'](as),au=x['get'](as)?.['purpose'];return{'op':'create','id':at['stepId'],'object':'guard','params':P({'description':at['description'],'table':at['table'],'root':at['root']}),'notes':C['has'](as)?(au??'Guard')+'\x20[kernel:\x20protocol\x20slot\x20254\x20(task\x20binding)\x20auto-declared]':au};};k['push']({'op':'create','id':'permission','object':'permission','params':{'name':h+'_permission'}});const F=a['arbitration_mode']!==undefined&&a['arbitration_mode']!=='none';F&&k['push']({'op':'create','id':'permission_arb','object':'permission','params':{'name':h+'_arb_permission'},'notes':'MUST\x20be\x20created\x20by\x20a\x20different\x20account\x20than\x20the\x20service\x20permission\x20'+'(E_ARBITRATION_PERMISSION_CONFLICT=33):\x20dispute\x20neutrality.'});k['push']({'op':'create','id':'contact','object':'contact','params':{'name':h+'_contact'},'notes':'R8:\x20customer-service\x20channel;\x20mandatory\x20when\x20customer_required\x20is\x20set.'});const G=new Set(['wip_provenance','subscription_with_proof']),H=Array['isArray'](b['adopted_module_ids'])?b['adopted_module_ids']['filter'](as=>typeof as==='string'):[],I=w['some'](as=>as['host']==='repository'||as['template_id']==='pattern.repository_data_check'||as['template_id']==='pattern.repository_write_authorization')||H['some'](as=>G['has'](as)),J=b['review_mode'],K=J==='review'||J==='review_reward'||J==='none'?J:undefined,L=K??a['review_mode']??'none',M=h+'_review_reward',N=as=>{const at=new Set(),au=av=>{if(Array['isArray'](av)){for(const ax of av)au(ax);return;}if(typeof av!=='object'||av===null)return;const aw=av;if(typeof aw['type']==='string'&&aw['type']['startsWith']('query_reward_record')){const ay=aw['object'];if(ay!==undefined&&typeof ay['identifier']==='number')at['add'](ay['identifier']);}for(const az of Object['values'](aw))au(az);};return au(as),at;},O=L==='review_reward'?w['find'](as=>as['host']==='reward'):undefined;if(L==='review_reward'&&O?.['step_id']!==undefined){const as=y['get'](O['key']);if(as!==undefined){const at=N(as['root']);y['set'](O['key'],{...as,'table':as['table']['map'](au=>{const av=au;if(av['b_submission']===!![]||!at['has'](av['identifier']))return au;return{...av,'value':{'$late':{'by':'local_name','mark':M}}};})});}k['push']({'op':'create','id':'reward_review','object':'reward','params':P({'name':M,'description':'Review\x20incentive\x20pool\x20(sale-time\x20planned;\x20terms\x20disclosed\x20at\x20quote/buy):\x20claim\x20gated\x20by\x20guard\x20\x27'+O['key']+'\x27.'}),'notes':'REVIEW-COMPONENT:\x20the\x20funded\x20reward\x20must\x20be\x20perceivable\x20by\x20the\x20buyer\x20BEFORE\x20ordering\x20—\x20the\x20full\x20terms\x20ride\x20the\x20quote/buy\x20surface\x20(REVIEW-COMPONENT-PLAN\x20§四).\x20'+'[ZR-08:\x20created\x20BEFORE\x20its\x20claim\x20guard\x20—\x20the\x20guard\x27s\x20Reward-address\x20row\x20freezes\x20at\x20creation\x20and\x20binds\x20this\x20pool\x20by\x20local\x20name]'});}const Q=[];for(const [au]of y){D(au)?Q['push'](au):k['push'](E(au));}if(I){const av=Array['isArray'](b['repository_policies'])?b['repository_policies']['filter'](ay=>typeof ay==='object'&&ay!==null):[],aw=[...av],ax=new Set(av['map'](ay=>ay['name']));for(const ay of w){if(ay['host']!=='repository'||ay['step_id']===undefined)continue;const az='host:\x22repository\x22\x20guard\x20\x27'+ay['key']+'\x27\x20(step\x20\x27'+ay['step_id']+'\x27)';if(ay['policy']===undefined){j['push']({'code':'REPO_GUARD_POLICY_MISSING','detail':az+'\x20declares\x20no\x20policy\x20on\x20the\x20guards[]\x20entry.\x20Its\x20Repository\x20policy\x20'+'(name\x20/\x20id_from\x20/\x20value_type)\x20is\x20business\x20data\x20the\x20kernel\x20must\x20not\x20fabricate,\x20'+'and\x20an\x20unbound\x20repository\x20guard\x20is\x20an\x20orphan\x20create\x20that\x20leaves\x20the\x20Repository\x20'+'open\x20to\x20any\x20writer.\x20Add\x20policy:{name,\x20id_from,\x20value_type}\x20to\x20the\x20spec,\x20or\x20bind\x20'+'the\x20guard\x20through\x20repository_policies\x20inputs\x20with\x20this\x20guard\x27s\x20own\x20write_guard\x20shape.'});continue;}if(D(ay['key'])){j['push']({'code':'REPO_GUARD_POLICY_MISSING','detail':az+'\x20refs\x20the\x20service,\x20so\x20it\x20is\x20created\x20AFTER\x20the\x20service\x20draft\x20—\x20but\x20the\x20'+'Repository\x20freezes\x20its\x20policies\x20at\x20creation,\x20which\x20happens\x20before.\x20Resolve\x20this\x20'+'guard\x20without\x20a\x20service\x20reference\x20(the\x20writers\x20are\x20asserted\x20by\x20identity,\x20not\x20by\x20'+'service\x20pin),\x20or\x20bind\x20the\x20policy\x20manually\x20via\x20repository_policies\x20inputs.'});continue;}const aA=ay['policy']['name']??ay['key'];if(ax['has'](aA))continue;aw['push']({'name':aA,'description':ay['policy']['description']??ay['purpose'],'write_guard':[{'guard':ref(ay['step_id'])}],'id_from':ay['policy']['id_from']??'signer','value_type':ay['policy']['value_type']??'String'});}k['push']({'op':'create','id':'repository','object':'repository','params':P({'name':h+'_evidence',...aw['length']>0x0?{'policies':aw}:{}}),'notes':'Evidence\x20rows\x20(tracking\x20hash,\x20receipts,\x20WTS\x20proofs).\x20[HOST-GRAPH-01:\x20created\x20after\x20wave-A\x20guards;\x20write_guard\x20policies\x20synthesized\x20from\x20resolved\x20host:\x22repository\x22\x20specs]'});}const R=new Set(s['map'](aB=>aB['name'])),S=[];for(const aB of s){if(aB['from']===undefined||aB['from']['length']===0x0){j['push']({'code':'MACHINE_EDGES_MISSING','detail':'machine_shape\x20node\x20\x27'+aB['name']+'\x27\x20declares\x20no\x20\x27from\x27\x20edges.\x20Edges\x20are\x20data\x20'+'(REPORT\x20#10\x20A-2:\x20a\x20missing\x20paid->closed_cancel\x20edge\x20bricks\x20the\x20shop\x20at\x20publish).\x20'+'Annotate\x20the\x20node\x20with\x20from:\x20[...]\x20(use\x20prev:\x20\x22\x22\x20for\x20the\x20entry\x20edge).'});continue;}const aC=[],aD=new Map(),aE=new Map();for(const aG of aB['from']){const aH=typeof aG==='string'?{'prev':aG}:aG;if(aH['prev']!==''&&!R['has'](aH['prev'])){j['push']({'code':'EDGE_UNKNOWN_PREV','detail':'node\x20\x27'+aB['name']+'\x27\x20edge\x20prev\x20\x27'+aH['prev']+'\x27\x20is\x20not\x20a\x20machine_shape\x20node'});continue;}const aI=aH['operator']??aB['operator']??(aH['prev']===''?'order_payer':'merchant'),aJ={'name':aH['forward']??(aH['prev']===''?'enter_'+aB['name']:aH['prev']+'_to_'+aB['name']),'weight':0x1,...aI==='order_payer'?{'namedOperator':''}:{'permissionIndex':aH['permission_index']??i}};if(aH['guard_key']!==undefined){const aN=x['get'](aH['guard_key']);if(aN===undefined)j['push']({'code':'GUARD_KEY_UNKNOWN','detail':'edge\x20\x27'+aH['prev']+'\x27->\x27'+aB['name']+'\x27\x20binds\x20unknown\x20guard_key\x20\x27'+aH['guard_key']+'\x27'});else{for(const aO of aN['purpose']['matchAll'](/progress\.current\s*==\s*([a-z0-9_]+)/g)){const aP=aO[0x1];R['has'](aP)&&aP!==aH['prev']&&j['push']({'code':'FORWARD_GUARD_PINNED_TO_NON_PREV','detail':'edge\x20\x27'+aH['prev']+'\x27->\x27'+aB['name']+'\x27\x20guard\x20\x27'+aN['key']+'\x27\x20pins\x20progress.current\x20==\x20\x27'+aP+'\x27,\x20but\x20a\x20'+('forward\x20guard\x20evaluates\x20BEFORE\x20the\x20advance\x20(progress.current\x20==\x20prev\x20\x27'+aH['prev']+'\x27),\x20so\x20the\x20pin\x20')+'can\x20never\x20pass\x20—\x20dead\x20rail\x20(bkng\x20F22).\x20Keep\x20the\x20pin\x20on\x20the\x20allocator\x20row\x20(evaluated\x20at\x20alloc,\x20'+'current\x20=\x20the\x20reached\x20node);\x20put\x20only\x20time/identity\x20legs\x20on\x20the\x20forward.'});}aN['template_id']==='pattern.identity_check_order_holder'&&aI!=='order_payer'&&j['push']({'code':'FORWARD_GUARD_IDENTITY_PERM_CONFLICT','detail':'edge\x20\x27'+aH['prev']+'\x27->\x27'+aB['name']+'\x27\x20guard\x20\x27'+aN['key']+'\x27\x20is\x20an\x20order-holder\x20(buyer)\x20identity\x20'+'check\x20but\x20the\x20forward\x20rides\x20a\x20permissionIndex\x20rail\x20(merchant-side\x20slot).\x20The\x20identity\x20layer\x20'+'runs\x20BEFORE\x20the\x20guard,\x20and\x20the\x20two\x20signer\x20sets\x20are\x20disjoint\x20—\x20nobody\x20can\x20pass\x20both\x20(bkng\x20F23).\x20'+'Use\x20operator\x20\x27order_payer\x27\x20(namedOperator\x20\x22\x22\x20—\x20the\x20buyer\x20self-advance)\x20for\x20this\x20edge.'}),aN['step_id']!==undefined&&(D(aN['key'])?j['push']({'code':'GUARD_CYCLE','detail':'edge\x20\x27'+aH['prev']+'\x27->\x27'+aB['name']+'\x27\x20binds\x20guard\x20\x27'+aN['key']+'\x27\x20which\x20itself\x20'+'refs\x20the\x20service\x20(created\x20after\x20the\x20machine)\x20—\x20an\x20F-05\x20cycle.\x20Rebind\x20or\x20split\x20the\x20guard.'}):aJ['guard']=ref(aN['step_id']));}}const aK=aD['get'](aH['prev']);aK!==undefined?aK['push'](aJ):aD['set'](aH['prev'],[aJ]);const aL=aE['get'](aH['prev']),aM=aI==='order_payer'?'namedOperator:':'permissionIndex:'+(aH['permission_index']??i);aL!==undefined?aL['add'](aM):aE['set'](aH['prev'],new Set([aM]));}const aF=aB['threshold']??0x0;for(const [aQ,aR]of aD){aF>aR['length']&&j['push']({'code':'PAIR_THRESHOLD_UNREACHABLE','detail':'node\x20\x27'+aB['name']+'\x27\x20pair\x20from\x20\x27'+(aQ===''?'(entry)':aQ)+'\x27\x20declares\x20threshold\x20'+aF+'\x20'+('but\x20the\x20pair\x20merges\x20only\x20'+aR['length']+'\x20forward(s)\x20at\x20weight\x201\x20each\x20—\x20the\x20pair\x20can\x20never\x20')+'migrate\x20and\x20the\x20publish\x20aborts.\x20Add\x20one\x20distinct-operator\x20forward\x20per\x20required\x20signature,\x20or\x20'+'lower\x20the\x20threshold\x20to\x20the\x20forward\x20count.'});if(aF>=0x2){const aS=aE['get'](aQ)?.['size']??0x0;aS<0x2&&j['push']({'code':'PAIR_THRESHOLD_SINGLE_OPERATOR','detail':'node\x20\x27'+aB['name']+'\x27\x20pair\x20from\x20\x27'+(aQ===''?'(entry)':aQ)+'\x27\x20declares\x20threshold\x20'+aF+'\x20'+'but\x20every\x20forward\x20rides\x20the\x20SAME\x20operator\x20rail\x20—\x20one\x20party\x20can\x20tap\x20all\x20of\x20them\x20and\x20the\x20'+'declared\x20dual\x20confirmation\x20silently\x20dissolves\x20(each\x20forward\x20locks\x20to\x20its\x20first\x20operator).\x20'+'Give\x20each\x20required\x20signature\x20its\x20own\x20rail\x20(e.g.\x20permission_index\x201001\x20+\x20operator\x20\x27order_payer\x27).'});}aC['push']({'prev_node':aQ,'threshold':aF,'forwards':aR});}S['push']({'name':aB['name'],...aB['semantic_role']!==undefined?{'role':aB['semantic_role']}:{},...aB['optional']===!![]?{'optional':!![]}:{},'pairs':aC});}k['push']({'op':'create','id':'machine','object':'machine','params':P({'name':h+'_machine','nodes':S})}),k['push']({'op':'publish','id':'machine_publish','target':ref('machine'),'preflight':[{'check':'machine_publish','status':'pending'},{'check':'TASKBIND-01','status':'pending'}]});const T=typeof b['currency']==='string'?b['currency']:'0x2::wow::WOW',U=w['find'](aT=>aT['host']==='service'&&aT['key']==='buy');k['push']({'op':'create','id':'service','object':'service','params':P({'name':h+'_service','type_parameter':T,'permission':ref('permission'),'machine':ref('machine'),'um':ref('contact'),'description':a['id']+'\x20—\x20compiled\x20by\x20composition/compile',...I?{'repositories':[ref('repository')]}:{},...U?.['step_id']!==undefined?{'buy_guard':ref(U['step_id'])}:{},...Array['isArray'](b['customer_required'])?{'customer_required':b['customer_required']}:{}}),'notes':'Draft\x20only:\x20machine/order_allocators\x20are\x20L1-frozen\x20at\x20publish;\x20allocators\x20attach\x20in\x20the\x20configure\x20step.'});for(const aT of Q)k['push'](E(aT));const V=t['length']>0x0?t:[{'track':'settlement','recipient':a['allocator']['recipient']==='fixed'?'entity':a['allocator']['recipient'],'recipient_key':a['allocator']['recipient_key'],'mode':a['allocator']['mode'],'value':a['allocator']['mode']==='rate'?0x2710:a['allocator']['mode']==='surplus'?'0':undefined}],W=[],X=new Map();for(const aU of V){if(aU['guard_key']!==undefined){let aV=X['get'](aU['guard_key']);aV===undefined&&(aV={'key':aU['guard_key'],'rows':[]},X['set'](aU['guard_key'],aV),W['push'](aV)),aV['rows']['push'](aU);}else W['push']({'rows':[aU]});}const Y=[];for(const aW of W){const aX=[];let aY;for(const b0 of aW['rows']){let b1=b0['value'];b1===undefined&&b0['value_from']!==undefined&&(b1=b[b0['value_from']]??a['fee_params'][b0['value_from']]);if(b1===undefined&&b0['mode']!=='surplus'){j['push']({'code':'ALLOCATOR_VALUE_MISSING','detail':'allocator\x20row\x20('+b0['track']+'/'+b0['recipient']+')\x20has\x20neither\x20value\x20nor\x20a\x20resolvable\x20value_from'});continue;}(b0['fix']!==undefined||b0['fix_from']!==undefined)&&j['push']({'code':'ALLOCATOR_FIX_UNSUPPORTED','detail':'allocator\x20row\x20('+b0['track']+'/'+b0['recipient']+')\x20declares\x20fix/fix_from\x20—\x20the\x20chain\x20has\x20no\x20holdback\x20'+'parameter:\x20fix\x20is\x20computed\x20on-chain\x20as\x20the\x20sum\x20of\x20the\x20Amount\x20legs\x20and\x20those\x20legs\x20are\x20PAID\x20'+'(allocation.move:399,540),\x20and\x20the\x20allocator-registration\x20call\x20surface\x20(guard,\x20sharing,\x20max)\x20has\x20no\x20fix\x20'+'argument,\x20so\x20this\x20value\x20never\x20reaches\x20the\x20chain.\x20To\x20keep\x20funds\x20in\x20the\x20pool,\x20do\x20not\x20distribute\x20them\x20'+'(a\x20separate\x20Allocation\x20object,\x20or\x20a\x20later\x20guard-gated\x20allocator);\x20to\x20combine\x20fixed\x20fees\x20with\x20a\x20'+'proportional\x20split,\x20use\x20explicit\x20Amount\x20legs\x20plus\x20Rate\x20legs\x20summing\x2010000.'});aY??=b0['note'];let b2;if(b0['recipient']==='entity')b2={'Entity':{'$late':{'by':'local_name','mark':b0['recipient_key']??'merchant'}}};else{if(b0['recipient']==='guard_identifier'){const b3=Number(b0['recipient_key']??0x0);b2={'GuardIdentifier':b3};const b4=aW['key']!==undefined?y['get'](aW['key']):undefined;if(b4!==undefined){const b5=b4['table']['find'](b6=>b6['identifier']===b3);(b5===undefined||b5['b_submission']!==!![]||b5['value_type']!=='Address')&&j['push']({'code':'GUARD_SLOT_UNKNOWN','detail':'allocator\x20leg\x20{GuardIdentifier:\x20'+b3+'}\x20on\x20guard\x20\x27'+aW['key']+'\x27\x20of\x20\x27'+h+'\x27:\x20the\x20bound\x20'+('Guard\x20table\x20has\x20no\x20slot\x20'+b3+'\x20Address\x20submission\x20row\x20(b_submission:\x20true).\x20On\x20chain\x20the\x20leg\x20')+('reads\x20slot\x20'+b3+'\x20as\x20its\x20payee\x20and\x20asserts\x20it\x20equals\x20the\x20paying\x20order\x20')+'(payment_info.for_object)\x20—\x20an\x20undeclared\x20or\x20STATIC\x20slot\x20aborts\x20at\x20alloc\x20time\x20with\x20code\x2015\x20'+'(ERECIPIENT_NOT_FOR_OBJECT,\x20allocation.move:500-520)\x20and\x20the\x20leg\x27s\x20funds\x20stranded\x20'+'(az3/abnb7\x20mainnet\x20261013:\x20static\x20GuardIdentifier\x20legs\x20bricked\x20every\x20refund\x20rail).\x20'+'Guard/allocators/forwards\x20are\x20all\x20publish-frozen.\x20Anchor\x20the\x20leg\x20on\x20the\x20protocol\x20slot\x20'+'(254\x20—\x20auto-written\x20with\x20the\x20paying\x20order\x20id\x20at\x20order\x20creation)\x20or\x20declare\x20'+('{identifier:\x20'+b3+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20Guard\x20table.')});}}else b2='Signer';}aX['push']({'who':b2,'sharing':String(b1??'0'),'mode':MODE_MAP[b0['mode']]});}if(aX['length']===0x0)continue;const aZ=aW['key']!==undefined?x['get'](aW['key'])?.['step_id']:undefined;aW['key']!==undefined&&!x['has'](aW['key'])&&j['push']({'code':'GUARD_KEY_UNKNOWN','detail':'allocator\x20row\x20('+aW['rows'][0x0]['track']+')\x20binds\x20unknown\x20guard_key\x20\x27'+aW['key']+'\x27'}),Y['push']({...aZ!==undefined?{'guard':ref(aZ)}:{},...aW['key']!==undefined?{'guard_key':aW['key']}:{},'track':aW['rows'][0x0]['track'],'sharing':aX,...aY!==undefined?{'note':aY}:{}});}const Z=W['map'](b6=>{if(b6['key']===undefined)return undefined;const b7=y['get'](b6['key']);return{'key':b6['key'],'track':b6['rows'][0x0]['track'],'table':b7?.['table']??[],'root':b7?.['root']};})['filter'](b6=>b6!==undefined);if(Z['length']>0x0){const b6=verifyAllocatorRails(Z,s['map'](b7=>({'name':b7['name'],'semanticRole':b7['semantic_role']})));for(const b7 of b6){j['push']({'code':b7['code'],'detail':b7['detail']});}}k['push']({'op':'configure','id':'service_allocators','target':ref('service'),'method':'order_allocators','params':P({'description':a['allocator']['description'],'threshold':Number(a['fee_params']['threshold']??a['fee_params']['monthly_rent_amount']??0x0)||0x0,'allocators':Y}),'requires':['machine_publish']});Array['isArray'](b['sales'])&&b['sales']['length']>0x0&&k['push']({'op':'configure','id':'service_sales','target':ref('service'),'method':'sales','params':{'op':'add','sales':b['sales']}});if(L!=='none'){const b8=s['some'](be=>/review/i['test'](be['name']));L==='review'&&!b8&&j['push']({'code':'REVIEW_NODE_MISSING','detail':'review_mode\x20\x27'+L+'\x27\x20declares\x20the\x20buyer\x20review\x20reputation\x20rail,\x20but\x20machine_shape\x20has\x20no\x20'+'\x27reviewed\x27\x20node.\x20Add\x20a\x20buyer-advanced\x20review\x20node\x20(operator\x20order_payer)\x20with\x20an\x20EXIT\x20edge\x20back\x20to\x20the\x20'+'settlement\x20rail\x20(R-DEAD-END:\x20a\x20zero-exit\x20review\x20node\x20strands\x20the\x20escrow),\x20or\x20anchor\x20the\x20claim\x20on\x20the\x20'+'delivered\x20terminal\x20via\x20a\x20host:\x22reward\x22\x20guard\x20(review_mode\x20\x22review_reward\x22\x20variant).'});const b9=w['find'](be=>be['host']==='reward'),ba=s['find'](be=>/review/i['test'](be['name']))?.['name'];let bb,bc;if(ba!==undefined){const be=[];for(const bh of s){for(const bi of bh['from']??[]){const bj=typeof bi==='string'?{'prev':bi,'guard_key':undefined}:bi;be['push']({'prev':bj['prev'],'guard_key':bj['guard_key'],'target':bh['name']});}}const bf=be['find'](bk=>bk['target']===ba&&bk['guard_key']!==undefined)?.['guard_key']??be['find'](bk=>bk['prev']===ba&&bk['guard_key']!==undefined)?.['guard_key'],bg=bf!==undefined?x['get'](bf):undefined;bb=bg?.['step_id'],bc=bf;}bb===undefined&&b9?.['step_id']!==undefined&&(bb=b9['step_id'],bc=b9['key']);const bd=L==='review_reward'&&b9?.['step_id']!==undefined&&bb!==undefined;bd&&k['push']({'op':'create','id':'guard_review_decision','object':'guard','params':P({'description':'Merchant\x20review-decision\x20write\x20credential:\x20only\x20the\x20service\x20provider\x20(permission\x20owner\x20or\x20admin)\x20may\x20write\x20U64\x20decision\x20rows\x20(row\x20id\x20=\x20order\x20address,\x20value\x20=\x20approved\x20payout)\x20under\x20the\x20review\x20repository\x27s\x20\x27review_decision\x27\x20policy.','table':[{'identifier':0x0,'b_submission':!![],'value_type':'Address','name':'order_being_approved'},{'identifier':0x1,'b_submission':![],'value_type':'Address','value':ref('service'),'name':'this_service'},{'identifier':0x2,'b_submission':!![],'value_type':'Address','name':'service_permission'}],'root':{'type':'logic_and','nodes':[{'type':'logic_equal','nodes':[{'type':'query','query':'order.service','object':{'identifier':0x0},'parameters':[]},{'type':'identifier','identifier':0x1}]},{'type':'logic_equal','nodes':[{'type':'query','query':'service.permission','object':{'identifier':0x1},'parameters':[]},{'type':'identifier','identifier':0x2}]},{'type':'logic_or','nodes':[{'type':'logic_equal','nodes':[{'type':'query','query':'permission.owner','object':{'identifier':0x2},'parameters':[]},{'type':'context','context':'Signer'}]},{'type':'query','query':'permission.admin\x20has','object':{'identifier':0x2},'parameters':[{'type':'context','context':'Signer'}]}]}]}}),'notes':'REVIEW-DECISION\x20write\x20credential\x20(allocator\x20dynamic-permission\x20shape,\x20service\x20pinned\x20by\x20plan\x20ref\x20—\x20survives\x20permission\x20rotation).\x20The\x20decision\x20write\x20itself:\x20repository.data_add\x20'+'{name:\x27review_decision\x27,\x20items:[{write_guard:\x27<this\x20guard>\x27,\x20data:[{id:<order\x20address>,\x20data:<approved\x20payout\x20U64>}]}]}\x20with\x20a\x20passport\x20submission\x20carrying\x20the\x20order\x20and\x20the\x20permission.'});if(bb!==undefined){const bk=b['buyer_review_enabled']===!![];k['push']({'op':'create','id':'repository_review','object':'repository','params':P({'name':h+'_review','description':'Structured\x20buyer\x20reputation\x20rows\x20(AR-1:\x20emitted\x20by\x20the\x20build\x20plan\x20—\x20no\x20manual\x20setup).','policies':[{'name':'review','description':'One\x20row\x20per\x20buyer\x20(id_from=Signer;\x20rewrite\x20=\x20own-record\x20overwrite).\x20Writes\x20require\x20the\x20review\x20credential\x20(guard\x20key\x20\x27'+bc+'\x27).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','write_guard':[{'guard':ref(bb)}],'id_from':'signer','value_type':'String'},...bk?[{'name':'buyer_review','description':'Merchant-side\x20structured\x20feedback\x20on\x20the\x20order/buyer\x20(D-R7\x20bidirectional\x20reputation,\x20opt-in).\x20One\x20row\x20per\x20writer\x20(id_from=Signer;\x20rewrite\x20=\x20own-record\x20overwrite).\x20NO\x20write\x20guard\x20by\x20design:\x20merchant\x20authority\x20is\x20verified\x20at\x20READ\x20time\x20(the\x20writer\x20must\x20control\x20the\x20order\x27s\x20service\x20—\x20graph\x20ControlIndex).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','id_from':'signer','value_type':'String'}]:[],...bd?[{'name':'review_decision','description':'Merchant\x20approval\x20ledger\x20for\x20the\x20review\x20bounty\x20(professional\x20form):\x20one\x20U64\x20row\x20per\x20order\x20(id_from=None;\x20row\x20id\x20=\x20the\x20order\x20address;\x20value\x20=\x20approved\x20payout\x20in\x20smallest\x20units).\x20A\x20row\x20whose\x20value\x20>=\x20the\x20promised\x20payout\x20IS\x20the\x20approval\x20the\x20claim\x20guard\x27s\x20decision\x20leg\x20reads\x20(tpl_repository_review_decision_gate).\x20Writes\x20REQUIRE\x20the\x20merchant\x20decision\x20credential\x20(guard\x20step\x20\x27guard_review_decision\x27);\x20buyers\x20hold\x20no\x20write\x20path.','write_guard':[{'guard':ref('guard_review_decision')}],'id_from':'none','value_type':'U64'}]:[]]}),'notes':'REVIEW-COMPONENT\x20AR-1:\x20the\x20review\x20TEXT\x20still\x20rides\x20the\x20forward\x20message\x20(D-R1\x20dual\x20carrier);\x20this\x20repository\x20carries\x20ONLY\x20the\x20structured\x20row.\x20Buyers\x20resolve\x20this\x20object\x20by\x20name\x20(workspace/onchain_objects)\x20—\x20never\x20guess\x20an\x20address.'+(bd?'\x20[review_decision\x20policy\x20frozen\x20AFTER\x20its\x20write\x20credential\x20—\x20the\x20guard\x20exists\x20before\x20this\x20create\x20(HOST-GRAPH-01\x20discipline).]':'')}),k['push']({'op':'configure','id':'service_review_repository','target':ref('service'),'method':'repositories','params':P({'op':'add','objects':[ref('repository_review')]}),'requires':['service','repository_review']});}if(L==='review_reward'){const bl=b9;if(bl===undefined||bl['step_id']===undefined)j['push']({'code':'REVIEW_REWARD_GUARD_MISSING','detail':'review_mode\x20\x27review_reward\x27\x20promises\x20a\x20claim\x20reward,\x20but\x20no\x20RESOLVED\x20host:\x22reward\x22\x20guard\x20spec\x20'+'exists\x20to\x20gate\x20the\x20claim.\x20Mount\x20a\x20reward\x20claim\x20guard\x20(e.g.\x20pattern.progress_state_check\x20anchored\x20'+'on\x20the\x20review\x20node\x20or\x20the\x20delivered\x20terminal\x20+\x20review\x20evidence\x20hash)\x20and\x20keep\x20it\x20resolvable\x20—\x20'+'an\x20unguarded\x20incentive\x20promise\x20must\x20not\x20publish\x20(INV-4).\x20The\x20root\x20must\x20also\x20carry\x20the\x20BKN-P2\x20'+'positive-amount\x20leg\x20(order.amount\x20>=\x201)\x20so\x20zero-total\x20orders\x20can\x20never\x20claim.'});else{const bm=b['reward_funding'],bn=y['get'](bl['key']);bn!==undefined&&!rootHasRewardRecordGate(bn['root'])&&j['push']({'code':'REVIEW_REWARD_UNARMED','detail':'review_reward\x20claim\x20guard\x20\x27'+bl['key']+'\x27\x20carries\x20no\x20record-gate:\x20Reward.claim\x20has\x20no\x20order\x20binding\x20of\x20its\x20own\x20'+'(OFN-C1),\x20so\x20a\x20funded\x20pool\x20behind\x20this\x20guard\x20is\x20a\x20replay-drain\x20target.\x20'+SV2_UNARMED_PRESCRIPTION+'\x20—\x20wrapped\x20in\x20'+'logic_and\x20with\x20the\x20identity\x20leg\x20(Signer\x20==\x20order.owner),\x20the\x20BKN-P2\x20positive-amount\x20'+'leg\x20(order.amount\x20>=\x201\x20—\x20zero-total\x20orders\x20must\x20never\x20claim)\x20and\x20the\x20existing\x20checks\x20'+'(see\x20tpl_reward_one_time_claim\x20v55\x20notes;\x20guard-risk\x20R-X1-14\x20audits\x20the\x20built\x20guard).\x20'+'Professional\x20approval\x20form:\x20this\x20plan\x20already\x20emits\x20the\x20decision\x20channel\x20(guard\x20step\x20'+'\x27guard_review_decision\x27\x20+\x20the\x20repository\x27s\x20\x27review_decision\x27\x20policy)\x20—\x20compose\x20the\x20'+'decision\x20leg\x20from\x20tpl_repository_review_decision_gate\x20into\x20the\x20root\x20'+'(find_where\x20over\x20\x27review_decision\x27\x20with\x20vec_contains_address\x20pinning\x20the\x20submitted\x20'+'order)\x20so\x20the\x20bounty\x20pays\x20only\x20merchant-approved\x20orders.\x20'+'Until\x20armed,\x20do\x20not\x20fund\x20the\x20pool.'});let bo;if(bn!==undefined&&rootHasRewardRecordGate(bn['root']))for(const bp of bn['table']){const bq=bp;if(bq['b_submission']===!![]&&String(bq['value_type']??'')['toLowerCase']()==='address'&&(String(bq['object_type']??'')==='Order'||/order/i['test'](String(bq['name']??'')))){bo=bq['identifier'];break;}}k['push']({'op':'configure','id':'reward_review_guard_add','target':ref('reward_review'),'method':'guard_add','params':P({'guard':ref(bl['step_id']),'recipient':{'Signer':'signer'},...bo!==undefined?{'store_from_id':bo}:{}}),'requires':['reward_review'],'notes':'RECIPIENT\x20(crs-mn-261015\x20F-12):\x20recipient\x20is\x20pinned\x20to\x20{Signer:\x27signer\x27}\x20—\x20the\x20claim\x20entry\x20'+'requires\x20recipient\x20==\x20the\x20transaction\x20sender\x20(E_CLAIM_RECIPIENT_NOT_SIGNER\x20otherwise);\x20a\x20GuardIdentifier\x20recipient\x20'+'resolves\x20to\x20the\x20submitted\x20Order\x20and\x20can\x20never\x20be\x20paid.\x20Fill\x20amount\x20=\x20the\x20per-claim\x20bounty\x20'+'(smallest\x20units)\x20when\x20executing.'+(bo!==undefined?'\x20SV-2\x20entry\x20stamp:\x20store_from_id\x20pins\x20the\x20per-order\x20stamp\x20slot\x20(the\x20submitted\x20Order\x20'+'address)\x20so\x20claim\x20records\x20key\x20per\x20order\x20—\x20once\x20per\x20buyer\x20per\x20order\x20(azx7-mn-261014\x20T8).':'')}),k['push']({'op':'configure','id':'service_rewards','target':ref('service'),'method':'rewards','params':P({'op':'add','objects':[ref('reward_review')]}),'requires':['service']}),typeof bm==='string'||typeof bm==='number'?k['push']({'op':'configure','id':'reward_review_coin_add','target':ref('reward_review'),'method':'coin_add','params':{'coin':String(bm)},'requires':['reward_review']}):j['push']({'code':'REVIEW_REWARD_UNFUNDED','detail':'review_mode\x20\x27review_reward\x27\x20without\x20a\x20\x27reward_funding\x27\x20input\x20(INV-4\x20R-REWARD-FUNDED):\x20the\x20incentive\x20'+'is\x20a\x20marketing\x20promise\x20that\x20must\x20be\x20FUNDED\x20when\x20the\x20Service\x20is\x20built\x20(sale-time\x20planning\x20—\x20pool\x20>=\x20'+'expected\x20orders\x20x\x20per-order\x20reward,\x20benchmark\x20fee_param\x20review_reward_pool).\x20Pass\x20reward_funding\x20'+'(smallest-unit\x20string)\x20to\x20fund\x20the\x20Reward\x20object,\x20or\x20drop\x20to\x20review_mode\x20\x22review\x22.'});}}}if(F){k['push']({'op':'create','id':'arbitration','object':'arbitration','params':P({'name':h+'_arbitration','permission':ref('permission_arb'),'type_parameter':T}),'notes':'Independent\x20venue\x20(R2).\x20New\x20arbitrations\x20default\x20bPaused=true\x20—\x20unpause\x20is\x20a\x20separate\x20operator\x20step.'}),k['push']({'op':'configure','id':'service_arbitrations','target':ref('service'),'method':'arbitrations','params':P({'op':'add','objects':[ref('arbitration')]})});const br=b['compensation_fund'];(typeof br==='string'||typeof br==='number')&&k['push']({'op':'configure','id':'service_compensation','target':ref('service'),'method':'compensation_fund_add','params':{'balance':String(br)}});}k['push']({'op':'publish','id':'service_publish','target':ref('service'),'preflight':[{'check':'service_publish','status':'pending'},{'check':'FUND-EXIT-01','status':'pending'},{'check':'PLAN-ALLOC-01','status':'pending'},{'check':'TASKBIND-02','status':'pending'}]});const a0=new Set(t['map'](bs=>bs['guard_key'])['filter'](bs=>typeof bs==='string')),a1=/^0x[0-9a-fA-F]{20,64}$/,a2=bs=>{const bt=y['get'](bs);if(bt===undefined)return undefined;for(const bu of bt['table']){const bv=bu;if(bv['b_submission']===!![]||bv['value_type']!=='Address')continue;const bw=bv['value'];if(typeof bw==='string'&&a1['test'](bw))return String(bv['identifier']??'?');}return undefined;};for(const bs of y['keys']()){if(!B['has'](bs)&&!a0['has'](bs))continue;const bt=a2(bs);bt!==undefined&&j['push']({'code':'GUARD_FOREIGN_SERVICE','detail':'guard\x20\x27'+bs+'\x27\x20pins\x20an\x20on-chain\x20address\x20literal\x20(table\x20slot\x20'+bt+')\x20while\x20bound\x20into\x20this\x20build.\x20'+'The\x20plan\x27s\x20Service\x20is\x20created\x20BY\x20this\x20plan\x20and\x20cannot\x20equal\x20a\x20pre-existing\x20address,\x20so\x20the\x20pin\x20names\x20a\x20foreign\x20or\x20'+'stale\x20object:\x20each\x20object\x20is\x20well-formed\x20alone,\x20but\x20the\x20cross-object\x20identity\x20assert\x20aborts\x20every\x20guarded\x20forward\x20'+'(klook\x20B11\x20class),\x20and\x20Guard\x20+\x20machine\x20are\x20both\x20create/publish-frozen\x20—\x20unrepairable.\x20'+'Bind\x20by\x20plan\x20reference\x20({\x22$ref\x22:\x22service\x22})\x20or\x20by\x20the\x20P16\x20circular\x20service\x20NAME\x20instead.'});}const a3=z['flatMap'](bu=>{const bv=a0['has'](bu['key'])?'allocator':B['has'](bu['key'])?'machine_edge':bu['host']==='service'&&bu['key']==='buy'?'service_buy':undefined;return bv?[{'key':bu['key'],'template_id':bu['template_id'],'host':bu['host'],'site':bv,'purpose':bu['purpose']}]:[];});return{'plan':{'version':0x1,'intent':d['intent']??'compile\x20'+a['id'],'templateId':a['id'],'inputs':b,'steps':k,...a3['length']>0x0?{'pending_guards':a3}:{}},'guardSpecs':w,'unresolved':z,'blockers':j,'omitted':[...v]};}
1
+ import{fillGuardTemplate,getTemplateById}from'../knowledge/guard-templates.js';import{GUARD_DESIGN_PATTERNS}from'../knowledge/guard-design-patterns.js';import{SV2_UNARMED_PRESCRIPTION,TWO_TX_RENEW_RECIPE}from'../knowledge/protocol-facts.js';import{verifyAllocatorRails}from'../knowledge/allocator-rail-verifier.js';import{TASK_BINDING_SLOT}from'../knowledge/onchain-constants.js';import{rootHasRewardRecordGate,afterSalesRailRegex as a11a,afterSalesRailNodeMatches}from'../knowledge/template-scanner.js';import{refsOf}from'./plan.js';const P=a=>a;function offTaskSlotIdentityLegs(a){const b=new Set(['order.owner','order.agent\x20has']),c=new Set(),d=[],e=f=>{if(f===null||typeof f!=='object')return;const g=f;if(g['type']==='logic_equal'&&Array['isArray'](g['nodes'])){const i=g['nodes']['filter'](j=>j!==null&&typeof j==='object'&&j['type']==='identifier'&&typeof j['identifier']==='number');if(i['some'](j=>j['identifier']===TASK_BINDING_SLOT)){for(const j of i)c['add'](j['identifier']);}}const h=g['object'];if(typeof g['query']==='string'&&b['has'](g['query'])&&h!==null&&typeof h==='object'&&typeof h['identifier']==='number'){const l=h['identifier'];if(l!==TASK_BINDING_SLOT)d['push']({'query':g['query'],'identifier':l});}if(Array['isArray'](g['nodes'])){for(const m of g['nodes'])e(m);}if(g['node']!==undefined&&typeof g['node']==='object')e(g['node']);};return e(a),d['filter'](f=>!c['has'](f['identifier']));}function safeId(a){return a['replace'](/[^a-zA-Z0-9_]/g,'_');}function ref(a){return{'$ref':a};}const MODE_MAP={'amount':'Amount','rate':'Rate','surplus':'Surplus'};export function compileTemplate(a,b,d={}){const h=d['nameBase']??a['id']['replace'](/\//g,'_'),i=d['merchantPermissionIndex']??0x3e8,j=[],k=[],l=new Set();for(const al of a['conditional_guards']??[]){const am=b[al['param']]??a['fee_params'][al['param']];if(am!==al['emit_value'])l['add'](al['guard_key']);}const p=new Map();for(const an of a['conditional_guards']??[]){p['set'](an['param'],(p['get'](an['param'])??0x0)+0x1);}const q=new Set((a['conditional_guards']??[])['filter'](ao=>(p['get'](ao['param'])??0x0)>0x1)['map'](ao=>ao['guard_key'])),s=new Set([...l]['filter'](ao=>q['has'](ao))),t=s['size']>0x0?a['machine_shape']['map'](ao=>({...ao,'from':(ao['from']??[])['filter'](ap=>typeof ap==='string'||ap['guard_key']===undefined||!s['has'](ap['guard_key']))})):a['machine_shape'],u=s['size']>0x0?(a['allocator']['rows']??[])['filter'](ao=>ao['guard_key']===undefined||!s['has'](ao['guard_key'])):a['allocator']['rows']??[],v=[];for(const [ao,ap]of Object['entries'](d['guardResolutions']??{})){if(ap?.['kind']==='omit')v['push'](ao);}const w=new Set();if(v['length']>0x0){const aq=new Set(t['flatMap'](as=>(as['from']??[])['map'](at=>typeof at==='string'?undefined:at['guard_key'])['filter'](at=>typeof at==='string'))),ar=new Set(u['map'](as=>as['guard_key'])['filter'](as=>typeof as==='string'));for(const as of v){const at=a['guards']['find']((av,aw)=>(av['key']??av['template_id']+'#'+aw)===as);if(at===undefined)continue;const au=[];if(aq['has'](as))au['push']('a\x20machine\x20forward\x20edge\x20(guard_key)');if(ar['has'](as))au['push']('an\x20allocator\x20rail\x20row\x20(guard_key)');if(at['policy']!==undefined)au['push']('a\x20Repository\x20write-policy\x20credential\x20(policy)');if(at['host']==='service'&&as==='buy')au['push']('the\x20Service\x20buy\x20gate\x20(buy_guard)');au['length']>0x0?j['push']({'code':'GUARD_OMIT_UNSUPPORTED','detail':'guard_resolutions[\x27'+as+'\x27]\x20=\x20{kind:\x27omit\x27}\x20refused:\x20this\x20design\x20is\x20bound\x20to\x20'+au['join']('\x20and\x20')+'\x20—\x20'+'omitting\x20it\x20would\x20orphan\x20the\x20binding\x20(open\x20rail\x20/\x20open\x20write\x20/\x20ungated\x20purchase).\x20'+'Fold\x20the\x20design\x27s\x20intent\x20into\x20the\x20bound\x20site\x20instead,\x20or\x20keep\x20the\x20guard\x20resolved.'}):w['add'](as);}}const x=a['guards']['map']((av,aw)=>({'key':av['key']??av['template_id']+'#'+aw,'template_id':av['template_id'],'host':av['host'],'purpose':av['purpose'],'policy':av['policy']}))['filter'](av=>!l['has'](av['key'])&&!w['has'](av['key'])),y=new Map(x['map'](av=>[av['key'],av])),z=new Set(['wip_provenance','subscription_with_proof']),A=Array['isArray'](b['adopted_module_ids'])?b['adopted_module_ids']['filter'](av=>typeof av==='string'):[],B=x['some'](av=>av['host']==='repository'||av['template_id']==='pattern.repository_data_check'||av['template_id']==='pattern.repository_write_authorization')||A['some'](av=>z['has'](av)),C=new Map(),D=[],E=x['map'](av=>av['key']);for(const av of Object['keys'](d['guardResolutions']??{})){if(w['has'](av))continue;!y['has'](av)&&j['push']({'code':'GUARD_RESOLUTION_UNKNOWN','detail':'guard_resolutions\x20key\x20\x27'+av+'\x27\x20matches\x20no\x20guard\x20spec\x20key\x20declared\x20by\x20\x27'+h+'\x27.\x20'+('Legal\x20keys:\x20'+(E['length']>0x0?E['join'](',\x20'):'(none\x20—\x20this\x20template\x20declares\x20no\x20keyed\x20guards)')+'.\x20')+'An\x20unknown\x20key\x20was\x20previously\x20dropped\x20silently,\x20leaving\x20the\x20intended\x20guard\x20pending\x20while\x20the\x20build\x20looked\x20resolved.'});}for(const aw of x){const ax='guard_'+safeId(aw['key']),ay=d['guardResolutions']?.[aw['key']];let az=aw['purpose'],aA,aB;if(ay?.['kind']==='inline')aA=ay['table'],aB=ay['root'],az=ay['description']??aw['purpose'];else{const aC=ay?.['kind']==='template'?ay['template_id']:aw['template_id']['startsWith']('tpl_')?aw['template_id']:undefined;if(aC!==undefined){const aD={'service_name':h+'_service',...B?{'repository_name':h+'_evidence'}:{},...a['fee_params'],...b,...ay?.['kind']==='template'?ay['params']:{}},aE=fillGuardTemplate(aC,aD);!aE['ok']?j['push']({'code':'GUARD_TEMPLATE_PARAMS','detail':'guard\x20\x27'+aw['key']+'\x27\x20('+aC+'):\x20'+aE['error']}):(aA=aE['table'],aB=aE['root']);}}aA!==undefined?(C['set'](aw['key'],{'stepId':ax,'description':az,'table':aA,'root':aB}),aw['step_id']=ax):(!aw['template_id']['startsWith']('tpl_')&&getTemplateById(aw['template_id'])===undefined&&!GUARD_DESIGN_PATTERNS['some'](aF=>aF['id']===aw['template_id'])&&j['push']({'code':'GUARD_PATTERN_UNKNOWN','detail':'guard\x20\x27'+aw['key']+'\x27\x20of\x20\x27'+h+'\x27\x20references\x20design\x20\x27'+aw['template_id']+'\x27,\x20which\x20exists\x20in\x20neither\x20the\x20Guard\x20design-pattern\x20catalog\x20nor\x20the\x20guard-template\x20registry\x20—\x20'+'no\x20resolution\x20path\x20can\x20ever\x20fill\x20it\x20(guide\x20confirm,\x20guard_resolutions\x20and\x20module\x20plumbing\x20all\x20key\x20off\x20real\x20ids).\x20'+'Keeping\x20it\x20as\x20a\x20pending\x20design\x20would\x20leave\x20its\x20bound\x20path\x20UNGUARDED\x20behind\x20a\x20plausible\x20pending\x20label\x20'+'(bs-mn-261022\x20TPL-01:\x20nine\x20such\x20specs\x20compiled\x20into\x20a\x20machine\x20with\x20no\x20guards\x20on\x20the\x20grant-lifecycle\x20forwards).\x20'+'Correct\x20the\x20template\x27s\x20guard\x20spec\x20id\x20to\x20a\x20known\x20pattern,\x20or\x20resolve\x20this\x20spec\x20explicitly\x20(guard_resolutions\x20with\x20kind\x20\x27inline\x27).'}),D['push'](aw));}const F=new Set(t['flatMap'](aF=>(aF['from']??[])['map'](aG=>typeof aG==='string'?undefined:aG['guard_key'])['filter'](aG=>typeof aG==='string')));for(const aF of u){typeof aF['guard_key']==='string'&&aF['recipient']==='guard_identifier'&&aF['recipient_key']===String(TASK_BINDING_SLOT)&&F['add'](aF['guard_key']);}const G=new Set();for(const aG of x){if(!F['has'](aG['key']))continue;const aH=C['get'](aG['key']);if(aH===undefined)continue;const aI=aH['table']['some'](aJ=>aJ['identifier']===TASK_BINDING_SLOT);if(aI)continue;C['set'](aG['key'],{...aH,'table':[...aH['table'],{'identifier':TASK_BINDING_SLOT,'b_submission':!![],'value_type':'Address','name':'task_binding\x20order\x20anchor\x20(protocol\x20slot\x20254;\x20written\x20by\x20order\x20creation)'}]}),G['add'](aG['key']);}const H=aJ=>C['get'](aJ)!==undefined&&refsOf({'table':C['get'](aJ)['table'],'root':C['get'](aJ)['root']})['has']('service'),I=aJ=>{const aK=C['get'](aJ),aL=y['get'](aJ)?.['purpose'];return{'op':'create','id':aK['stepId'],'object':'guard','params':P({'description':aK['description'],'table':aK['table'],'root':aK['root']}),'notes':G['has'](aJ)?(aL??'Guard')+'\x20[kernel:\x20protocol\x20slot\x20254\x20(task\x20binding)\x20auto-declared]':aL};};k['push']({'op':'create','id':'permission','object':'permission','params':{'name':h+'_permission'}});const J=a['arbitration_mode']!==undefined&&a['arbitration_mode']!=='none';J&&k['push']({'op':'create','id':'permission_arb','object':'permission','params':{'name':h+'_arb_permission'},'notes':'MUST\x20be\x20created\x20by\x20a\x20different\x20account\x20than\x20the\x20service\x20permission\x20'+'(E_ARBITRATION_PERMISSION_CONFLICT=33):\x20dispute\x20neutrality.'});k['push']({'op':'create','id':'contact','object':'contact','params':{'name':h+'_contact'},'notes':'R8:\x20customer-service\x20channel;\x20mandatory\x20when\x20customer_required\x20is\x20set.'});const K=b['review_mode'],L=K==='review'||K==='review_reward'||K==='none'?K:undefined,M=L??a['review_mode']??'none',N=h+'_review_reward',O=b['after_sales_mode'],Q=O==='return'||O==='exchange'||O==='warranty'||O==='none'?O:undefined,R=Q??a['after_sales_mode']??'none',S=b['acceptance_mode'],T=S==='milestone'||S==='contest'||S==='bounty'||S==='agent'||S==='none'?S:undefined,U=T??a['acceptance_mode']??'none',V=U==='contest'||U==='bounty'||U==='agent',W=b['installment_mode'],X=W==='deposit_balance'||W==='milestone_n'||W==='none'?W:undefined,Y=X??a['installment_mode']??'none',Z=b['affiliate_mode'],a0=Z==='commission'||Z==='none'?Z:undefined,a1=a0??a['affiliate_mode']??'none',a2=b['crowdfunding_mode'],a3=a2==='threshold'||a2==='flexible'||a2==='none'?a2:undefined,a4=a3??a['crowdfunding_mode']??'none',a5=aJ=>{const aK=new Set(),aL=aM=>{if(Array['isArray'](aM)){for(const aO of aM)aL(aO);return;}if(typeof aM!=='object'||aM===null)return;const aN=aM;if(typeof aN['type']==='string'&&aN['type']['startsWith']('query_reward_record')){const aP=aN['object'];if(aP!==undefined&&typeof aP['identifier']==='number')aK['add'](aP['identifier']);}for(const aQ of Object['values'](aN))aL(aQ);};return aL(aJ),aK;},a6=M==='review_reward'?x['find'](aJ=>aJ['host']==='reward'):undefined;if(M==='review_reward'&&a6?.['step_id']!==undefined){const aJ=C['get'](a6['key']);if(aJ!==undefined){const aK=a5(aJ['root']);C['set'](a6['key'],{...aJ,'table':aJ['table']['map'](aL=>{const aM=aL;if(aM['b_submission']===!![]||!aK['has'](aM['identifier']))return aL;return{...aM,'value':{'$late':{'by':'local_name','mark':N}}};})});}k['push']({'op':'create','id':'reward_review','object':'reward','params':P({'name':N,'description':'Review\x20incentive\x20pool\x20(sale-time\x20planned;\x20terms\x20disclosed\x20at\x20quote/buy):\x20claim\x20gated\x20by\x20guard\x20\x27'+a6['key']+'\x27.'}),'notes':'REVIEW-COMPONENT:\x20the\x20funded\x20reward\x20must\x20be\x20perceivable\x20by\x20the\x20buyer\x20BEFORE\x20ordering\x20—\x20the\x20full\x20terms\x20ride\x20the\x20quote/buy\x20surface\x20(REVIEW-COMPONENT-PLAN\x20§四).\x20'+'[ZR-08:\x20created\x20BEFORE\x20its\x20claim\x20guard\x20—\x20the\x20guard\x27s\x20Reward-address\x20row\x20freezes\x20at\x20creation\x20and\x20binds\x20this\x20pool\x20by\x20local\x20name]'});}const a7=[];for(const [aL]of C){H(aL)?a7['push'](aL):k['push'](I(aL));}if(B){const aM=Array['isArray'](b['repository_policies'])?b['repository_policies']['filter'](aP=>typeof aP==='object'&&aP!==null):[],aN=[...aM],aO=new Set(aM['map'](aP=>aP['name']));for(const aP of x){if(aP['host']!=='repository'||aP['step_id']===undefined)continue;const aQ='host:\x22repository\x22\x20guard\x20\x27'+aP['key']+'\x27\x20(step\x20\x27'+aP['step_id']+'\x27)';if(aP['policy']===undefined){j['push']({'code':'REPO_GUARD_POLICY_MISSING','detail':aQ+'\x20declares\x20no\x20policy\x20on\x20the\x20guards[]\x20entry.\x20Its\x20Repository\x20policy\x20'+'(name\x20/\x20id_from\x20/\x20value_type)\x20is\x20business\x20data\x20the\x20kernel\x20must\x20not\x20fabricate,\x20'+'and\x20an\x20unbound\x20repository\x20guard\x20is\x20an\x20orphan\x20create\x20that\x20leaves\x20the\x20Repository\x20'+'open\x20to\x20any\x20writer.\x20Add\x20policy:{name,\x20id_from,\x20value_type}\x20to\x20the\x20spec,\x20or\x20bind\x20'+'the\x20guard\x20through\x20repository_policies\x20inputs\x20with\x20this\x20guard\x27s\x20own\x20write_guard\x20shape.'});continue;}if(H(aP['key'])){j['push']({'code':'REPO_GUARD_POLICY_MISSING','detail':aQ+'\x20refs\x20the\x20service,\x20so\x20it\x20is\x20created\x20AFTER\x20the\x20service\x20draft\x20—\x20but\x20the\x20'+'Repository\x20freezes\x20its\x20policies\x20at\x20creation,\x20which\x20happens\x20before.\x20Resolve\x20this\x20'+'guard\x20without\x20a\x20service\x20reference\x20(the\x20writers\x20are\x20asserted\x20by\x20identity,\x20not\x20by\x20'+'service\x20pin),\x20or\x20bind\x20the\x20policy\x20manually\x20via\x20repository_policies\x20inputs.'});continue;}const aR=aP['policy']['name']??aP['key'];if(aO['has'](aR))continue;aN['push']({'name':aR,'description':aP['policy']['description']??aP['purpose'],'write_guard':[{'guard':ref(aP['step_id'])}],'id_from':aP['policy']['id_from']??'signer','value_type':aP['policy']['value_type']??'String','write_once':aP['policy']['write_once']??![]});}k['push']({'op':'create','id':'repository','object':'repository','params':P({'name':h+'_evidence',...aN['length']>0x0?{'policies':aN}:{}}),'notes':'Evidence\x20rows\x20(tracking\x20hash,\x20receipts,\x20WTS\x20proofs).\x20[HOST-GRAPH-01:\x20created\x20after\x20wave-A\x20guards;\x20write_guard\x20policies\x20synthesized\x20from\x20resolved\x20host:\x22repository\x22\x20specs]'});}const a8=new Set(t['map'](aS=>aS['name'])),a9=[];for(const aS of t){if(aS['from']===undefined||aS['from']['length']===0x0){j['push']({'code':'MACHINE_EDGES_MISSING','detail':'machine_shape\x20node\x20\x27'+aS['name']+'\x27\x20declares\x20no\x20\x27from\x27\x20edges.\x20Edges\x20are\x20data\x20'+'(REPORT\x20#10\x20A-2:\x20a\x20missing\x20paid->closed_cancel\x20edge\x20bricks\x20the\x20shop\x20at\x20publish).\x20'+'Annotate\x20the\x20node\x20with\x20from:\x20[...]\x20(use\x20prev:\x20\x22\x22\x20for\x20the\x20entry\x20edge).'});continue;}const aT=[],aU=new Map(),aV=new Map();for(const aX of aS['from']){const aY=typeof aX==='string'?{'prev':aX}:aX;if(aY['prev']!==''&&!a8['has'](aY['prev'])){j['push']({'code':'EDGE_UNKNOWN_PREV','detail':'node\x20\x27'+aS['name']+'\x27\x20edge\x20prev\x20\x27'+aY['prev']+'\x27\x20is\x20not\x20a\x20machine_shape\x20node'});continue;}const aZ=aY['operator']??aS['operator']??(aY['prev']===''?'order_payer':'merchant'),b0={'name':aY['forward']??(aY['prev']===''?'enter_'+aS['name']:aY['prev']+'_to_'+aS['name']),'weight':0x1,...aZ==='order_payer'?{'namedOperator':''}:{'permissionIndex':aY['permission_index']??i}};if(aY['guard_key']!==undefined){const b4=y['get'](aY['guard_key']);if(b4===undefined)j['push']({'code':'GUARD_KEY_UNKNOWN','detail':'edge\x20\x27'+aY['prev']+'\x27->\x27'+aS['name']+'\x27\x20binds\x20unknown\x20guard_key\x20\x27'+aY['guard_key']+'\x27'});else{for(const b5 of b4['purpose']['matchAll'](/progress\.current\s*==\s*([a-z0-9_]+)/g)){const b6=b5[0x1];a8['has'](b6)&&b6!==aY['prev']&&j['push']({'code':'FORWARD_GUARD_PINNED_TO_NON_PREV','detail':'edge\x20\x27'+aY['prev']+'\x27->\x27'+aS['name']+'\x27\x20guard\x20\x27'+b4['key']+'\x27\x20pins\x20progress.current\x20==\x20\x27'+b6+'\x27,\x20but\x20a\x20'+('forward\x20guard\x20evaluates\x20BEFORE\x20the\x20advance\x20(progress.current\x20==\x20prev\x20\x27'+aY['prev']+'\x27),\x20so\x20the\x20pin\x20')+'can\x20never\x20pass\x20—\x20dead\x20rail\x20(bkng\x20F22).\x20Keep\x20the\x20pin\x20on\x20the\x20allocator\x20row\x20(evaluated\x20at\x20alloc,\x20'+'current\x20=\x20the\x20reached\x20node);\x20put\x20only\x20time/identity\x20legs\x20on\x20the\x20forward.'});}b4['template_id']==='pattern.identity_check_order_holder'&&aZ!=='order_payer'&&j['push']({'code':'FORWARD_GUARD_IDENTITY_PERM_CONFLICT','detail':'edge\x20\x27'+aY['prev']+'\x27->\x27'+aS['name']+'\x27\x20guard\x20\x27'+b4['key']+'\x27\x20is\x20an\x20order-holder\x20(buyer)\x20identity\x20'+'check\x20but\x20the\x20forward\x20rides\x20a\x20permissionIndex\x20rail\x20(merchant-side\x20slot).\x20The\x20identity\x20layer\x20'+'runs\x20BEFORE\x20the\x20guard,\x20and\x20the\x20two\x20signer\x20sets\x20are\x20disjoint\x20—\x20nobody\x20can\x20pass\x20both\x20(bkng\x20F23).\x20'+'Use\x20operator\x20\x27order_payer\x27\x20(namedOperator\x20\x22\x22\x20—\x20the\x20buyer\x20self-advance)\x20for\x20this\x20edge.'});{const b7=C['get'](b4['key']);if(b7!==undefined){const b8=b7['table']['some'](ba=>ba['identifier']===TASK_BINDING_SLOT),b9=offTaskSlotIdentityLegs(b7['root'])['filter'](ba=>{if(!b8)return![];const bb=b7['table']['find'](bc=>bc['identifier']===ba['identifier']);return bb!==undefined&&bb['b_submission']===!![];});for(const ba of b9){j['push']({'code':'GUARD_IDENTITY_SLOT_NOT_TASKBOUND','detail':'edge\x20\x27'+aY['prev']+'\x27->\x27'+aS['name']+'\x27\x20guard\x20\x27'+b4['key']+'\x27\x20reads\x20'+ba['query']+'\x20off\x20free\x20'+('submission\x20slot\x20'+ba['identifier']+'\x20—\x20hijackable\x20(rex-mn-261021\x20T10):\x20the\x20caller\x20fills\x20free\x20')+'slots,\x20so\x20an\x20attacker\x20submits\x20their\x20OWN\x20order\x20there\x20(signer\x20==\x20order.owner\x20passes\x20against\x20'+('their\x20own\x20order)\x20and\x20advances\x20the\x20VICTIM\x27s\x20order\x20carried\x20by\x20slot\x20'+TASK_BINDING_SLOT+';\x20with\x20')+'namedOperator\x20\x22\x22\x20the\x20permission\x20layer\x20passes\x20for\x20anyone\x20(progress.move:242-256),\x20so\x20this\x20'+('guard\x20is\x20the\x20only\x20identity\x20leg.\x20Anchor\x20the\x20'+ba['query']+'\x20query\x20on\x20identifier\x20')+(TASK_BINDING_SLOT+'\x20(the\x20task-binding\x20order\x20anchor\x20—\x20the\x20order\x20the\x20forward\x20actually\x20mutates).')});}}}b4['step_id']!==undefined&&(H(b4['key'])?j['push']({'code':'GUARD_CYCLE','detail':'edge\x20\x27'+aY['prev']+'\x27->\x27'+aS['name']+'\x27\x20binds\x20guard\x20\x27'+b4['key']+'\x27\x20which\x20itself\x20'+'refs\x20the\x20service\x20(created\x20after\x20the\x20machine)\x20—\x20an\x20F-05\x20cycle.\x20Rebind\x20or\x20split\x20the\x20guard.'}):b0['guard']=ref(b4['step_id']));}}const b1=aU['get'](aY['prev']);b1!==undefined?b1['push'](b0):aU['set'](aY['prev'],[b0]);const b2=aV['get'](aY['prev']),b3=aZ==='order_payer'?'namedOperator:':'permissionIndex:'+(aY['permission_index']??i);b2!==undefined?b2['add'](b3):aV['set'](aY['prev'],new Set([b3]));}const aW=aS['threshold']??0x0;for(const [bb,bc]of aU){aW>bc['length']&&j['push']({'code':'PAIR_THRESHOLD_UNREACHABLE','detail':'node\x20\x27'+aS['name']+'\x27\x20pair\x20from\x20\x27'+(bb===''?'(entry)':bb)+'\x27\x20declares\x20threshold\x20'+aW+'\x20'+('but\x20the\x20pair\x20merges\x20only\x20'+bc['length']+'\x20forward(s)\x20at\x20weight\x201\x20each\x20—\x20the\x20pair\x20can\x20never\x20')+'migrate\x20and\x20the\x20publish\x20aborts.\x20Add\x20one\x20distinct-operator\x20forward\x20per\x20required\x20signature,\x20or\x20'+'lower\x20the\x20threshold\x20to\x20the\x20forward\x20count.'});if(aW>=0x2){const bd=aV['get'](bb)?.['size']??0x0;bd<0x2&&j['push']({'code':'PAIR_THRESHOLD_SINGLE_OPERATOR','detail':'node\x20\x27'+aS['name']+'\x27\x20pair\x20from\x20\x27'+(bb===''?'(entry)':bb)+'\x27\x20declares\x20threshold\x20'+aW+'\x20'+'but\x20every\x20forward\x20rides\x20the\x20SAME\x20operator\x20rail\x20—\x20one\x20party\x20can\x20tap\x20all\x20of\x20them\x20and\x20the\x20'+'declared\x20dual\x20confirmation\x20silently\x20dissolves\x20(each\x20forward\x20locks\x20to\x20its\x20first\x20operator).\x20'+'Give\x20each\x20required\x20signature\x20its\x20own\x20rail\x20(e.g.\x20permission_index\x201001\x20+\x20operator\x20\x27order_payer\x27).'});}aT['push']({'prev_node':bb,'threshold':aW,'forwards':bc});}a9['push']({'name':aS['name'],...aS['semantic_role']!==undefined?{'role':aS['semantic_role']}:{},...aS['optional']===!![]?{'optional':!![]}:{},'pairs':aT});}k['push']({'op':'create','id':'machine','object':'machine','params':P({'name':h+'_machine','nodes':a9})}),k['push']({'op':'publish','id':'machine_publish','target':ref('machine'),'preflight':[{'check':'machine_publish','status':'pending'},{'check':'TASKBIND-01','status':'pending'}]});const aa=typeof b['currency']==='string'?b['currency']:'0x2::wow::WOW',ab=x['find'](be=>be['host']==='service'&&be['key']==='buy');k['push']({'op':'create','id':'service','object':'service','params':P({'name':h+'_service','type_parameter':aa,'permission':ref('permission'),'machine':ref('machine'),'um':ref('contact'),'description':a['id']+'\x20—\x20compiled\x20by\x20composition/compile',...B?{'repositories':[ref('repository')]}:{},...ab?.['step_id']!==undefined?{'buy_guard':ref(ab['step_id'])}:{},...Array['isArray'](b['customer_required'])?{'customer_required':b['customer_required']}:{}}),'notes':'Draft\x20only:\x20machine/order_allocators\x20are\x20L1-frozen\x20at\x20publish;\x20allocators\x20attach\x20in\x20the\x20configure\x20step.'});for(const be of a7)k['push'](I(be));const ac=u['length']>0x0?u:[{'track':'settlement','recipient':a['allocator']['recipient']==='fixed'?'entity':a['allocator']['recipient'],'recipient_key':a['allocator']['recipient_key'],'mode':a['allocator']['mode'],'value':a['allocator']['mode']==='rate'?0x2710:a['allocator']['mode']==='surplus'?'0':undefined}],ad=[],ae=new Map();for(const bf of ac){if(bf['guard_key']!==undefined){let bg=ae['get'](bf['guard_key']);bg===undefined&&(bg={'key':bf['guard_key'],'rows':[]},ae['set'](bf['guard_key'],bg),ad['push'](bg)),bg['rows']['push'](bf);}else ad['push']({'rows':[bf]});}const af=[];for(const bh of ad){const bi=[];let bj;for(const bl of bh['rows']){let bm=bl['value'];bm===undefined&&bl['value_from']!==undefined&&(bm=b[bl['value_from']]??a['fee_params'][bl['value_from']]);if(bm===undefined&&bl['mode']!=='surplus'){j['push']({'code':'ALLOCATOR_VALUE_MISSING','detail':'allocator\x20row\x20('+bl['track']+'/'+bl['recipient']+')\x20has\x20neither\x20value\x20nor\x20a\x20resolvable\x20value_from'});continue;}(bl['fix']!==undefined||bl['fix_from']!==undefined)&&j['push']({'code':'ALLOCATOR_FIX_UNSUPPORTED','detail':'allocator\x20row\x20('+bl['track']+'/'+bl['recipient']+')\x20declares\x20fix/fix_from\x20—\x20the\x20chain\x20has\x20no\x20holdback\x20'+'parameter:\x20fix\x20is\x20computed\x20on-chain\x20as\x20the\x20sum\x20of\x20the\x20Amount\x20legs\x20and\x20those\x20legs\x20are\x20PAID\x20'+'(allocation.move:399,540),\x20and\x20the\x20allocator-registration\x20call\x20surface\x20(guard,\x20sharing,\x20max)\x20has\x20no\x20fix\x20'+'argument,\x20so\x20this\x20value\x20never\x20reaches\x20the\x20chain.\x20To\x20keep\x20funds\x20in\x20the\x20pool,\x20do\x20not\x20distribute\x20them\x20'+'(a\x20separate\x20Allocation\x20object,\x20or\x20a\x20later\x20guard-gated\x20allocator);\x20to\x20combine\x20fixed\x20fees\x20with\x20a\x20'+'proportional\x20split,\x20use\x20explicit\x20Amount\x20legs\x20plus\x20Rate\x20legs\x20summing\x2010000.'});bj??=bl['note'];let bn;if(bl['recipient']==='entity')bn={'Entity':{'$late':{'by':'local_name','mark':bl['recipient_key']??'merchant'}}};else{if(bl['recipient']==='guard_identifier'){const bo=Number(bl['recipient_key']??0x0);bn={'GuardIdentifier':bo};const bp=bh['key']!==undefined?C['get'](bh['key']):undefined;if(bp!==undefined){const bq=bp['table']['find'](br=>br['identifier']===bo);(bq===undefined||bq['b_submission']!==!![]||bq['value_type']!=='Address')&&j['push']({'code':'GUARD_SLOT_UNKNOWN','detail':'allocator\x20leg\x20{GuardIdentifier:\x20'+bo+'}\x20on\x20guard\x20\x27'+bh['key']+'\x27\x20of\x20\x27'+h+'\x27:\x20the\x20bound\x20'+('Guard\x20table\x20has\x20no\x20slot\x20'+bo+'\x20Address\x20submission\x20row\x20(b_submission:\x20true).\x20On\x20chain\x20the\x20leg\x20')+('reads\x20slot\x20'+bo+'\x20as\x20its\x20payee\x20and\x20asserts\x20it\x20equals\x20the\x20paying\x20order\x20')+'(payment_info.for_object)\x20—\x20an\x20undeclared\x20or\x20STATIC\x20slot\x20aborts\x20at\x20alloc\x20time\x20with\x20code\x2015\x20'+'(ERECIPIENT_NOT_FOR_OBJECT,\x20allocation.move:500-520)\x20and\x20the\x20leg\x27s\x20funds\x20stranded\x20'+'(az3/abnb7\x20mainnet\x20261013:\x20static\x20GuardIdentifier\x20legs\x20bricked\x20every\x20refund\x20rail).\x20'+'Guard/allocators/forwards\x20are\x20all\x20publish-frozen.\x20Declare\x20'+('{identifier:\x20'+bo+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20Guard\x20table\x20')+'(templates\x20anchor\x20refund\x20rails\x20on\x20user\x20slot\x200\x20and\x20submit\x20the\x20Order\x20address\x20there).\x20Protocol\x20'+'slot\x20254\x20is\x20the\x20task-binding/once\x20slot:\x20naming\x20it\x20as\x20the\x20payee\x20arms\x20once-per-order,\x20so\x20a\x20'+'second\x20fire\x20aborts\x20E_ONCE_TRIGGERED\x20(16).'});}}else bn='Signer';}bi['push']({'who':bn,'sharing':String(bm??'0'),'mode':MODE_MAP[bl['mode']]});}if(bi['length']===0x0)continue;const bk=bh['key']!==undefined?y['get'](bh['key'])?.['step_id']:undefined;bh['key']!==undefined&&!y['has'](bh['key'])&&j['push']({'code':'GUARD_KEY_UNKNOWN','detail':'allocator\x20row\x20('+bh['rows'][0x0]['track']+')\x20binds\x20unknown\x20guard_key\x20\x27'+bh['key']+'\x27'}),af['push']({...bk!==undefined?{'guard':ref(bk)}:{},...bh['key']!==undefined?{'guard_key':bh['key']}:{},'track':bh['rows'][0x0]['track'],'sharing':bi,...bj!==undefined?{'note':bj}:{}});}const ag=ad['map'](br=>{if(br['key']===undefined)return undefined;const bs=C['get'](br['key']);return{'key':br['key'],'track':br['rows'][0x0]['track'],'table':bs?.['table']??[],'root':bs?.['root']};})['filter'](br=>br!==undefined);if(ag['length']>0x0){const br=verifyAllocatorRails(ag,t['map'](bu=>({'name':bu['name'],'semanticRole':bu['semantic_role']}))),bs=ad['map'](bu=>bu['key'])['filter'](bu=>bu!==undefined&&!C['has'](bu)),bt=bs['length']>0x0?'\x20UNRESOLVED\x20ALLOCATOR\x20GUARD\x20REFS\x20(likely\x20the\x20real\x20cause\x20—\x20these\x20guard_keys\x20match\x20no\x20resolved\x20guard,\x20e.g.\x20a\x20name\x20typo):\x20'+bs['join'](',\x20')+'.':'';for(const bu of br){j['push']({'code':bu['code'],'detail':bu['detail']+bt});}}k['push']({'op':'configure','id':'service_allocators','target':ref('service'),'method':'order_allocators','params':P({'description':a['allocator']['description'],'threshold':Number(a['fee_params']['threshold']??a['fee_params']['monthly_rent_amount']??0x0)||0x0,'allocators':af}),'requires':['machine_publish']});Array['isArray'](b['sales'])&&b['sales']['length']>0x0&&k['push']({'op':'configure','id':'service_sales','target':ref('service'),'method':'sales','params':{'op':'add','sales':b['sales']}});if(R!=='none'){const bv=a11a(R),bw=t['some'](bx=>afterSalesRailNodeMatches(R,bx['name']));!bw&&j['push']({'code':'AFTER_SALES_RAIL_MISSING','detail':'after_sales_mode\x20\x27'+R+'\x27\x20declares\x20a\x20buyer\x20after-sales\x20remedy,\x20but\x20machine_shape\x20has\x20no\x20'+('backing\x20rail\x20(no\x20node\x20matching\x20'+bv+').\x20Add\x20the\x20'+R+'\x20node\x20family\x20')+'(e.g.\x20return_requested\x20->\x20returned\x20for\x20\x27return\x27)\x20with\x20its\x20claimed_by\x20polarity\x20pair\x20—\x20refund\x20leg\x20'+'some==false,\x20merchant-recovery\x20leg\x20some==true\x20(INV-C1)\x20—\x20anchored\x20on\x20the\x20delivered\x20ENTRY\x20time\x20'+'(INV-C2,\x20TIME-ANCHOR-01),\x20and\x20de-conflicted\x20against\x20the\x20settlement\x20rail\x20so\x20the\x20two\x20never\x20both\x20pay\x20'+'(INV-C3,\x20DUAL-RAIL-01).\x20Or\x20set\x20after_sales_mode\x20\x27none\x27\x20if\x20this\x20shop\x20ships\x20no\x20such\x20remedy.'});}if(U!=='none'){V&&a['arbitration_mode']!=='third_party'&&j['push']({'code':'ACCEPTANCE_JUDGE_NOT_INDEPENDENT','detail':'acceptance_mode\x20\x27'+U+'\x27\x20is\x20a\x20judge-decided\x20acceptance\x20(a\x20third\x20party\x20rules\x20on\x20'+('release),\x20but\x20arbitration_mode\x20is\x20\x27'+(a['arbitration_mode']??'none')+'\x27,\x20not\x20\x27third_party\x27.\x20')+'The\x20party\x20owing\x20the\x20payout\x20must\x20not\x20also\x20decide\x20whether\x20it\x20is\x20owed\x20(merchant\x20self-adjudication,\x20'+'INV-A3).\x20Set\x20arbitration_mode\x20\x27third_party\x27\x20so\x20an\x20independent\x20venue/judge\x20Permission\x20rules\x20'+'(R2;\x20enforced\x20at\x20publish\x20by\x20controller-disjointness),\x20or\x20use\x20acceptance_mode\x20\x27milestone\x27\x20if\x20the\x20'+'buyer\x20genuinely\x20self-adjudicates.'});const bx=a['fee_params']['revision_rounds_max'],by=typeof bx==='number'||typeof bx==='string'&&bx['trim']()!==''&&/^\d+$/['test'](bx['trim']());if(by){const bz=x['some'](bA=>bA['host']==='repository'||/repository/i['test'](bA['template_id']));!bz&&j['push']({'code':'ACCEPTANCE_REVISION_UNBOUNDED','detail':'acceptance_mode\x20\x27'+U+'\x27\x20declares\x20a\x20bounded\x20revision\x20loop\x20'+('(fee_params.revision_rounds_max\x20=\x20'+String(bx)+'),\x20but\x20no\x20counter-backed\x20Repository\x20')+'guard\x20exists.\x20progress.move\x20caps\x20EDGE\x20count\x20(MAX_FORWARD\x20/\x20MAX_NODE_PAIR),\x20never\x20VISIT\x20count,\x20'+'so\x20a\x20finite\x20cap\x20in\x20fee_params\x20alone\x20is\x20a\x20promise\x20the\x20chain\x20cannot\x20keep\x20(INV-A1).\x20Either\x20declare\x20'+'revision_rounds_max\x20\x27unlimited\x27\x20(the\x20honest\x20form\x20—\x20the\x20revision\x20loop\x20is\x20then\x20genuinely\x20'+'unbounded)\x20or\x20mount\x20a\x20counter-backed\x20Repository\x20guard\x20(pattern.repository_data_check\x20reading\x20a\x20'+'per-order\x20revision\x20tally\x20written\x20via\x20pattern.repository_write_authorization)\x20that\x20gates\x20the\x20'+'redelivery\x20forward\x20once\x20the\x20tally\x20reaches\x20the\x20cap.'});}}if(Y!=='none'){const bA=/(due|owed|owing|unpaid|awaiting|pending)/i,bB=/(paid|captured|funded|settled)/i,bC=/(deposit|down_?pay|balance_due|balance_owed|awaiting|installment|milestone)/i,bD=/(refund|cancel|exit|forfeit|kill|void|abandon|release|expire|lapse)/i,bE=[];for(const bH of t){const bI=bH['name'];for(const bJ of bH['from']??[]){typeof bJ==='string'?bE['push']({'prev':bJ,'target':bI}):bE['push']({'prev':bJ['prev'],'target':bI,'guardKey':bJ['guard_key']});}}const bF=bE['filter'](bK=>bA['test'](bK['prev'])&&bB['test'](bK['target'])&&(bK['guardKey']===undefined||bK['guardKey']['trim']()===''));bF['length']>0x0&&j['push']({'code':'INSTALLMENT_FUNDING_UNGATED','detail':'installment_mode\x20\x27'+Y+'\x27\x20captures\x20a\x20later\x20payment,\x20but\x20the\x20funding\x20forward(s)\x20'+bF['map'](bK=>'\x27'+bK['prev']+'\x27\x20→\x20\x27'+bK['target']+'\x27')['join'](',\x20')+'\x20carry\x20NO\x20guard_key.\x20A\x20bare\x20advance\x20records\x20the\x20balance\x20as\x20paid\x20WITHOUT\x20the\x20capture\x20landing\x20in\x20the\x20'+'Allocation\x20—\x20a\x20zero-value\x20advance\x20(INV-B1,\x20H4).\x20Bind\x20a\x20fund-gate\x20Guard\x20on\x20each\x20capture\x20forward\x20'+'(constant\x20=\x20order\x20address,\x20convert_witness\x20OrderAllocation(109),\x20allocation.balance\x20query\x201051\x20>=\x20the\x20'+'capture\x20amount).\x20PRE-STATE\x20CONSTRAINT\x20(esound-mn-261021\x20B-1,\x20mainnet-verified):\x20guards\x20read\x20the\x20'+'COMMITTED\x20pre-transaction\x20balance\x20—\x20funding\x20that\x20lands\x20in\x20the\x20SAME\x20PTB\x20(the\x20one-PTB\x20order_renew\x20'+'payment\x20half)\x20is\x20INVISIBLE\x20to\x20the\x20forward\x27s\x20guard,\x20so\x20a\x20balance-gated\x20capture\x20advanced\x20by\x20'+('order_renew\x20ALWAYS\x20aborts.\x20'+TWO_TX_RENEW_RECIPE+'\x20Pair\x20the\x20balance\x20gate\x20with\x20the\x20once\x20slot\x20')+'(H5\x20—\x20the\x20fund\x20gate\x20is\x20a\x20STATE\x20READ,\x20not\x20a\x20once)\x20so\x20a\x20replay\x20cannot\x20re-capture.'});const bG=[];for(const bK of t){if(!bC['test'](bK['name']))continue;const bL=bE['filter'](bN=>bN['prev']===bK['name']),bM=bL['some'](bN=>bD['test'](bN['target']));if(!bM)bG['push'](bK['name']);}bG['length']>0x0&&j['push']({'code':'INSTALLMENT_DEPOSIT_STRANDED','detail':'installment_mode\x20\x27'+Y+'\x27\x20holds\x20a\x20buyer\x20payment\x20at\x20state(s)\x20'+bG['map'](bN=>'\x27'+bN+'\x27')['join'](',\x20')+'\x20with\x20NO\x20deposit-exit\x20rail\x20(no\x20outgoing\x20refund\x20/\x20cancel\x20/\x20forfeit\x20/\x20expire\x20edge).\x20There\x20is\x20no\x20on-chain\x20'+'obligation\x20to\x20pay\x20the\x20balance\x20(INV-B2,\x20H1),\x20so\x20a\x20buyer\x20who\x20walks\x20away\x20strands\x20the\x20already-paid\x20portion\x20'+'at\x20that\x20node\x20permanently\x20(Machine\x20+\x20Allocator\x20immutable,\x20IMMUT-001).\x20Add\x20a\x20deposit-exit\x20rail\x20from\x20each\x20'+'held\x20state\x20—\x20a\x20refund/cancel\x20forward\x20into\x20an\x20exit\x20node\x20whose\x20allocator\x20returns\x20the\x20held\x20funds\x20to\x20the\x20'+'order\x20payer\x20(GuardIdentifier(0))\x20or\x20applies\x20the\x20declared\x20deposit_exit_policy\x20(full\x20refund\x20vs\x20a\x20kill\x20fee\x20'+'compensating\x20the\x20merchant\x20for\x20the\x20reserved\x20capacity).'});}if(a1!=='none'){const bN=/(commission|affiliate|referr|attribut|partner_?payout)/i,bO=t['some'](bS=>bN['test'](bS['name'])),bP=ac['some'](bS=>bN['test'](bS['value_from']??'')||bN['test'](bS['recipient_key']??''));!bO&&!bP&&j['push']({'code':'AFFILIATE_RAIL_MISSING','detail':'affiliate_mode\x20\x27'+a1+'\x27\x20declares\x20a\x20referral/affiliate\x20commission\x20overlay,\x20but\x20machine_shape\x20has\x20no\x20'+'commission-family\x20node\x20and\x20the\x20allocator\x20has\x20no\x20commission\x20row\x20—\x20a\x20declared\x20partner\x20payout\x20with\x20no\x20rail\x20to\x20'+'walk\x20it\x20is\x20a\x20false\x20promise\x20at\x20quote\x20time\x20(INV-D3).\x20Add\x20an\x20INDEPENDENT\x20commission\x20leg:\x20a\x20Rate\x20row\x20off\x20a\x20'+'dedicated\x20commission\x20pool\x20(never\x20a\x20Surplus/Rate\x20drain\x20of\x20the\x20buyer\x27s\x20goods\x20escrow\x20—\x20防抢池)\x20to\x20an\x20explicit\x20'+'non-empty\x20partner\x20Entity,\x20gated\x20by\x20a\x20window-anchored\x20claim\x20guard\x20(INV-D1\x20rides\x20TIME-ANCHOR-01)\x20so\x20the\x20'+'commission\x20is\x20claimable\x20only\x20after\x20the\x20attribution/refund\x20window\x20closes.'});const bQ=/(post-?lock|锁后|clawback|不可追偿|不可撤销|unrecoverable|irrevocab|no\s*(?:revers|recov|clawback)|cannot be reversed|once released|released commission)/i,bR=(a['build_notes']??[])['some'](bS=>bQ['test'](bS));!bR&&j['push']({'code':'AFFILIATE_CLAWBACK_UNDISCLOSED','detail':'affiliate_mode\x20\x27'+a1+'\x27\x20declares\x20a\x20commission\x20but\x20no\x20build_note\x20discloses\x20the\x20post-lock\x20no-clawback\x20'+'truth\x20(INV-D2).\x20SOLE\x20TRUTH:\x20Allocation\x20distribute\x20is\x20a\x20ONE-WAY\x20outflow\x20(no\x20debit/clawback\x20primitive,\x20§11.0\x20G2),\x20'+'so\x20once\x20a\x20commission\x20is\x20RELEASED\x20it\x20CANNOT\x20be\x20reversed\x20on\x20chain\x20—\x20a\x20refund/chargeback\x20after\x20release\x20leaves\x20the\x20'+'affiliate\x20commission\x20unrecoverable.\x20Add\x20a\x20build_note\x20stating\x20this\x20honestly\x20(e.g.\x20\x22post-lock:\x20a\x20released\x20'+'affiliate\x20commission\x20is\x20unrecoverable\x20/\x20不可追偿\x20—\x20refunds\x20after\x20the\x20attribution\x20window\x20do\x20NOT\x20claw\x20back\x20the\x20'+'partner\x20payout\x22).\x20L-04/D-5:\x20never\x20imply\x20a\x20recovery\x20capability\x20the\x20chain\x20does\x20not\x20have.'});}if(a4!=='none'){const bS=/(releas|settle|funded|disburs|project)/i,bT=/(refund|missed|unmet|return|reimburse)/i,bU=t['some'](c7=>bS['test'](c7['name'])),bV=ac['some'](c7=>c7['track']==='settlement'&&(bS['test'](c7['guard_key']??'')||bS['test'](c7['recipient_key']??''))),bW=t['some'](c7=>bT['test'](c7['name'])),bX=ac['some'](c7=>c7['track']==='refund'||bT['test'](c7['guard_key']??''));!bU&&!bV&&j['push']({'code':'CROWDFUNDING_THRESHOLD_GATE_MISSING','detail':'crowdfunding_mode\x20\x27'+a4+'\x27\x20declares\x20a\x20campaign\x20but\x20machine_shape\x20has\x20no\x20release/settlement\x20'+'node\x20and\x20the\x20allocator\x20has\x20no\x20settlement\x20row\x20to\x20the\x20project\x20Entity\x20—\x20the\x20escrowed\x20contributions\x20would\x20'+'strand\x20at\x20the\x20deadline\x20with\x20no\x20exit\x20rail\x20(INV-E1).\x20Add\x20a\x20release\x20leg\x20(Rate\x2010000\x20to\x20a\x20NON-EMPTY\x20project\x20'+'Entity,\x20gated\x20at\x20the\x20campaign-deadline\x20settlement\x20terminal)\x20and,\x20for\x20a\x20threshold\x20campaign,\x20its\x20D-BUG-2\x20'+'refund\x20twin.'});a4==='threshold'&&!bW&&!bX&&j['push']({'code':'CROWDFUNDING_THRESHOLD_GATE_MISSING','detail':'crowdfunding_mode\x20\x27threshold\x27\x20declares\x20an\x20all-or-nothing\x20campaign\x20but\x20there\x20is\x20NO\x20refund-family\x20node/row\x20—\x20'+'a\x20missed\x20goal\x20would\x20strand\x20every\x20contribution\x20instead\x20of\x20returning\x20it\x20(INV-E1\x20/\x20D-BUG-2).\x20Add\x20the\x20refund\x20'+'leg\x20(per-contributor,\x20order-anchored\x20user\x20slot\x200\x20—\x20the\x20submitted\x20Order,\x20never\x20slot\x20254,\x20claimed_by\x20some==false)\x20as\x20the\x20mutually-exclusive\x20twin\x20of\x20the\x20'+'release\x20leg:\x20aggregate\x20>=\x20goal\x20→\x20release;\x20aggregate\x20<\x20goal\x20→\x20refund.'});if(a4==='threshold'){const c7=x['some'](c8=>(c8['host']==='repository'||/repository_write/i['test'](c8['template_id']))&&(c8['policy']?.['id_from']??'')['toLowerCase']()==='signer');!c7&&j['push']({'code':'CROWDFUNDING_AGGREGATE_UNBOUND','detail':'crowdfunding_mode\x20\x27threshold\x27\x20gates\x20release\x20on\x20an\x20aggregate\x20funding\x20total,\x20but\x20no\x20host:\x22repository\x22\x20'+'write\x20policy\x20is\x20writer-bound\x20(id_from\x20signer)\x20—\x20the\x20sum-where\x20(1174)\x20total\x20would\x20be\x20forgeable,\x20so\x20'+'anyone\x20could\x20inflate\x20the\x20aggregate\x20and\x20fake\x20a\x20\x27goal\x20met\x27\x20(INV-E2\x20/\x20R-X1-17:\x20existence-is-not-trust).\x20'+'Bind\x20the\x20contribution\x20Repository\x20write_guard\x20to\x20the\x20contributing\x20backer\x20'+'(pattern.repository_write_authorization,\x20id_from\x20signer,\x20an\x20identity\x20leaf\x20order.owner==Signer).'});}const bY=a['build_notes']??[],bZ=/(attest|keeper|aggregate trust|read-?only sum|not a chain-?verified|只读求和|聚合值|独立重算)/i,c0=/(not investment|non-?investment|不构成投资|收益承诺|no (?:investment )?return|never promise)/i,c1=/(kyc|aml|securities|money-?transmission|regulatory|跨境|合规)/i,c2=/(no-?refund|non-?refundable|keep-?it-?all|不退|不提供退款|不设达标)/i,c3=bY['some'](c8=>c0['test'](c8)),c4=bY['some'](c8=>c1['test'](c8)),c5=a4==='threshold'?bY['some'](c8=>bZ['test'](c8)):!![],c6=a4==='flexible'?bY['some'](c8=>c2['test'](c8)):!![];if(!c5||!c3||!c4||!c6){const c8=[!c5?'the\x20aggregate-trust\x20boundary\x20(the\x20funding\x20total\x20is\x20a\x20keeper-attested\x20Repository\x20sum,\x20NOT\x20a\x20chain-verified\x20money\x20oracle)':null,!c3?'the\x20L-01\x20non-investment\x20statement\x20(never\x20promise\x20returns\x20/\x20promote\x20coin\x20price;\x20不构成投资建议或收益承诺)':null,!c4?'the\x20L-05\x20KYC/AML\x20+\x20cross-border\x20regulatory\x20caution\x20(HIGH\x20intensity)':null,!c6?'the\x20flexible\x20keep-it-all\x20NO-REFUND\x20posture\x20(contributions\x20non-refundable\x20once\x20the\x20deadline\x20passes;\x20不提供退款)':null]['filter'](Boolean);j['push']({'code':'CROWDFUNDING_DISCLOSURE_MISSING','detail':'crowdfunding_mode\x20\x27'+a4+'\x27\x20declares\x20a\x20campaign\x20but\x20no\x20build_note\x20carries:\x20'+c8['join'](';\x20')+'\x20'+'(INV-E3\x20/\x20L-04\x20/\x20L-01\x20/\x20L-05).\x20Add\x20these\x20as\x20honest\x20build_notes\x20—\x20never\x20present\x20an\x20attested\x20aggregate\x20as\x20a\x20'+'chain-verified\x20custody\x20proof,\x20never\x20imply\x20investment\x20returns,\x20and\x20flag\x20the\x20compliance\x20surface.'});}}if(M!=='none'){const c9=t['some'](cf=>/review/i['test'](cf['name']));M==='review'&&!c9&&j['push']({'code':'REVIEW_NODE_MISSING','detail':'review_mode\x20\x27'+M+'\x27\x20declares\x20the\x20buyer\x20review\x20reputation\x20rail,\x20but\x20machine_shape\x20has\x20no\x20'+'\x27reviewed\x27\x20node.\x20Add\x20a\x20buyer-advanced\x20review\x20node\x20(operator\x20order_payer)\x20with\x20an\x20EXIT\x20edge\x20back\x20to\x20the\x20'+'settlement\x20rail\x20(R-DEAD-END:\x20a\x20zero-exit\x20review\x20node\x20strands\x20the\x20escrow),\x20or\x20anchor\x20the\x20claim\x20on\x20the\x20'+'delivered\x20terminal\x20via\x20a\x20host:\x22reward\x22\x20guard\x20(review_mode\x20\x22review_reward\x22\x20variant).'});const ca=x['find'](cf=>cf['host']==='reward'),cb=t['find'](cf=>/review/i['test'](cf['name']))?.['name'];let cc,cd;if(cb!==undefined){const cf=[];for(const ci of t){for(const cj of ci['from']??[]){const ck=typeof cj==='string'?{'prev':cj,'guard_key':undefined}:cj;cf['push']({'prev':ck['prev'],'guard_key':ck['guard_key'],'target':ci['name']});}}const cg=cf['find'](cl=>cl['target']===cb&&cl['guard_key']!==undefined)?.['guard_key']??cf['find'](cl=>cl['prev']===cb&&cl['guard_key']!==undefined)?.['guard_key'],ch=cg!==undefined?y['get'](cg):undefined;cc=ch?.['step_id'],cd=cg;}cc===undefined&&ca?.['step_id']!==undefined&&(cc=ca['step_id'],cd=ca['key']);const ce=M==='review_reward'&&ca?.['step_id']!==undefined&&cc!==undefined;ce&&k['push']({'op':'create','id':'guard_review_decision','object':'guard','params':P({'description':'Merchant\x20review-decision\x20write\x20credential:\x20only\x20the\x20service\x20provider\x20(permission\x20owner\x20or\x20admin)\x20may\x20write\x20U64\x20decision\x20rows\x20(row\x20id\x20=\x20order\x20address,\x20value\x20=\x20approved\x20payout)\x20under\x20the\x20review\x20repository\x27s\x20\x27review_decision\x27\x20policy.','table':[{'identifier':0x0,'b_submission':!![],'value_type':'Address','name':'order_being_approved'},{'identifier':0x1,'b_submission':![],'value_type':'Address','value':ref('service'),'name':'this_service'},{'identifier':0x2,'b_submission':!![],'value_type':'Address','name':'service_permission'}],'root':{'type':'logic_and','nodes':[{'type':'logic_equal','nodes':[{'type':'query','query':'order.service','object':{'identifier':0x0},'parameters':[]},{'type':'identifier','identifier':0x1}]},{'type':'logic_equal','nodes':[{'type':'query','query':'service.permission','object':{'identifier':0x1},'parameters':[]},{'type':'identifier','identifier':0x2}]},{'type':'logic_or','nodes':[{'type':'logic_equal','nodes':[{'type':'query','query':'permission.owner','object':{'identifier':0x2},'parameters':[]},{'type':'context','context':'Signer'}]},{'type':'query','query':'permission.admin\x20has','object':{'identifier':0x2},'parameters':[{'type':'context','context':'Signer'}]}]}]}}),'notes':'REVIEW-DECISION\x20write\x20credential\x20(allocator\x20dynamic-permission\x20shape,\x20service\x20pinned\x20by\x20plan\x20ref\x20—\x20survives\x20permission\x20rotation).\x20The\x20decision\x20write\x20itself:\x20repository.data_add\x20'+'{name:\x27review_decision\x27,\x20items:[{write_guard:\x27<this\x20guard>\x27,\x20data:[{id:<order\x20address>,\x20data:<approved\x20payout\x20U64>}]}]}\x20with\x20a\x20passport\x20submission\x20carrying\x20the\x20order\x20and\x20the\x20permission.'});if(cc!==undefined){const cl=b['buyer_review_enabled']===!![];k['push']({'op':'create','id':'repository_review','object':'repository','params':P({'name':h+'_review','description':'Structured\x20buyer\x20reputation\x20rows\x20(AR-1:\x20emitted\x20by\x20the\x20build\x20plan\x20—\x20no\x20manual\x20setup).','policies':[{'name':'review','description':'One\x20immutable\x20row\x20per\x20buyer\x20(id_from=Signer;\x20write-once\x20—\x20a\x20rewrite\x20attempt\x20aborts\x20on-chain,\x20K3(a)).\x20Writes\x20require\x20the\x20review\x20credential\x20(guard\x20key\x20\x27'+cd+'\x27).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','write_guard':[{'guard':ref(cc)}],'id_from':'signer','value_type':'String','write_once':!![]},{'name':'rating','description':'Order-keyed\x20numeric\x20rating\x20(F-62):\x20one\x20U64\x20row\x20per\x20ORDER\x20(id_from=None;\x20row\x20id\x20=\x20the\x20order\x20address;\x20value\x20=\x20stars,\x20e.g.\x201..5;\x20write-once\x20—\x20a\x20rewrite\x20attempt\x20aborts\x20on-chain,\x20K3(a)).\x20Writes\x20require\x20the\x20same\x20review\x20credential\x20as\x20the\x20\x27review\x27\x20text\x20policy\x20—\x20a\x20verified\x20completed-order\x20buyer.\x20This\x20—\x20not\x20the\x20Signer-keyed\x20\x27review\x27\x20String\x20row\x20—\x20is\x20the\x20row\x20a\x20reward\x20good-review\x20leg\x20must\x20query\x20(query\x20repository.data:\x20the\x20policy-name\x20String\x20row\x20+\x20the\x20order-address\x20identifier\x20row,\x20compared\x20against\x20the\x20rating\x20floor).\x20The\x20text\x20row\x20is\x20display;\x20this\x20row\x20is\x20payout\x20authority.','write_guard':[{'guard':ref(cc)}],'id_from':'none','value_type':'U64','write_once':!![]},...cl?[{'name':'buyer_review','description':'Merchant-side\x20structured\x20feedback\x20on\x20the\x20order/buyer\x20(D-R7\x20bidirectional\x20reputation,\x20opt-in).\x20One\x20immutable\x20row\x20per\x20writer\x20(id_from=Signer;\x20write-once\x20—\x20a\x20rewrite\x20attempt\x20aborts\x20on-chain,\x20K3(a)).\x20NO\x20write\x20guard\x20by\x20design:\x20merchant\x20authority\x20is\x20verified\x20at\x20READ\x20time\x20(the\x20writer\x20must\x20control\x20the\x20order\x27s\x20service\x20—\x20graph\x20ControlIndex).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','id_from':'signer','value_type':'String','write_once':!![]}]:[],...ce?[{'name':'review_decision','description':'Merchant\x20approval\x20ledger\x20for\x20the\x20review\x20bounty\x20(professional\x20form):\x20one\x20U64\x20row\x20per\x20order\x20(id_from=None;\x20row\x20id\x20=\x20the\x20order\x20address;\x20value\x20=\x20approved\x20payout\x20in\x20smallest\x20units).\x20A\x20row\x20whose\x20value\x20>=\x20the\x20promised\x20payout\x20IS\x20the\x20approval\x20the\x20claim\x20guard\x27s\x20decision\x20leg\x20reads\x20(tpl_repository_review_decision_gate).\x20Writes\x20REQUIRE\x20the\x20merchant\x20decision\x20credential\x20(guard\x20step\x20\x27guard_review_decision\x27);\x20buyers\x20hold\x20no\x20write\x20path.','write_guard':[{'guard':ref('guard_review_decision')}],'id_from':'none','value_type':'U64'}]:[]]}),'notes':'REVIEW-COMPONENT\x20AR-1:\x20the\x20review\x20TEXT\x20still\x20rides\x20the\x20forward\x20message\x20(D-R1\x20dual\x20carrier);\x20this\x20repository\x20carries\x20ONLY\x20the\x20structured\x20row.\x20The\x20buyer\x20writes\x20BOTH\x20rows\x20at\x20review\x20time:\x20\x27review\x27\x20(text\x20JSON,\x20id\x20=\x20own\x20address)\x20AND\x20\x27rating\x27\x20(U64\x20stars,\x20id\x20=\x20the\x20ORDER\x20address\x20—\x20repository.data_add\x20{name:\x27rating\x27,\x20items:[{data:[{id:<order\x20address>,\x20data:<stars>}]}]},\x20same\x20passport\x20as\x20the\x20forward).\x20The\x20\x27rating\x27\x20row\x20is\x20what\x20a\x20reward\x20good-review\x20leg\x20reads\x20(F-62):\x20a\x20good-review\x20bounty\x20claim\x20guard\x20must\x20query\x20this\x20order-keyed\x20U64\x20row,\x20never\x20the\x20Signer-keyed\x20text\x20row.\x20Buyers\x20resolve\x20this\x20object\x20by\x20name\x20(workspace/onchain_objects)\x20—\x20never\x20guess\x20an\x20address.'+(ce?'\x20[review_decision\x20policy\x20frozen\x20AFTER\x20its\x20write\x20credential\x20—\x20the\x20guard\x20exists\x20before\x20this\x20create\x20(HOST-GRAPH-01\x20discipline).]':'')}),k['push']({'op':'configure','id':'service_review_repository','target':ref('service'),'method':'repositories','params':P({'op':'add','objects':[ref('repository_review')]}),'requires':['service','repository_review']});}if(M==='review_reward'){const cm=ca;if(cm===undefined||cm['step_id']===undefined)j['push']({'code':'REVIEW_REWARD_GUARD_MISSING','detail':'review_mode\x20\x27review_reward\x27\x20promises\x20a\x20claim\x20reward,\x20but\x20no\x20RESOLVED\x20host:\x22reward\x22\x20guard\x20spec\x20'+'exists\x20to\x20gate\x20the\x20claim.\x20Mount\x20a\x20reward\x20claim\x20guard\x20(e.g.\x20pattern.progress_state_check\x20anchored\x20'+'on\x20the\x20review\x20node\x20or\x20the\x20delivered\x20terminal\x20+\x20review\x20evidence\x20hash)\x20and\x20keep\x20it\x20resolvable\x20—\x20'+'an\x20unguarded\x20incentive\x20promise\x20must\x20not\x20publish\x20(INV-4).\x20The\x20root\x20must\x20also\x20carry\x20the\x20BKN-P2\x20'+'positive-amount\x20leg\x20(order.amount\x20>=\x201)\x20so\x20zero-total\x20orders\x20can\x20never\x20claim.'});else{const cn=b['reward_funding'],co=C['get'](cm['key']);co!==undefined&&!rootHasRewardRecordGate(co['root'])&&j['push']({'code':'REVIEW_REWARD_UNARMED','detail':'review_reward\x20claim\x20guard\x20\x27'+cm['key']+'\x27\x20carries\x20no\x20record-gate:\x20Reward.claim\x20has\x20no\x20order\x20binding\x20of\x20its\x20own\x20'+'(OFN-C1),\x20so\x20a\x20funded\x20pool\x20behind\x20this\x20guard\x20is\x20a\x20replay-drain\x20target.\x20'+SV2_UNARMED_PRESCRIPTION+'\x20—\x20wrapped\x20in\x20'+'logic_and\x20with\x20the\x20identity\x20leg\x20(Signer\x20==\x20order.owner),\x20the\x20BKN-P2\x20positive-amount\x20'+'leg\x20(order.amount\x20>=\x201\x20—\x20zero-total\x20orders\x20must\x20never\x20claim)\x20and\x20the\x20existing\x20checks\x20'+'(see\x20tpl_reward_one_time_claim\x20v55\x20notes;\x20guard-risk\x20R-X1-14\x20audits\x20the\x20built\x20guard).\x20'+'Professional\x20approval\x20form:\x20this\x20plan\x20already\x20emits\x20the\x20decision\x20channel\x20(guard\x20step\x20'+'\x27guard_review_decision\x27\x20+\x20the\x20repository\x27s\x20\x27review_decision\x27\x20policy)\x20—\x20compose\x20the\x20'+'decision\x20leg\x20from\x20tpl_repository_review_decision_gate\x20into\x20the\x20root\x20'+'(find_where\x20over\x20\x27review_decision\x27\x20with\x20vec_contains_address\x20pinning\x20the\x20submitted\x20'+'order)\x20so\x20the\x20bounty\x20pays\x20only\x20merchant-approved\x20orders.\x20'+'Until\x20armed,\x20do\x20not\x20fund\x20the\x20pool.'});let cp;if(co!==undefined&&rootHasRewardRecordGate(co['root']))for(const cq of co['table']){const cr=cq;if(cr['b_submission']===!![]&&String(cr['value_type']??'')['toLowerCase']()==='address'&&(String(cr['object_type']??'')==='Order'||/order/i['test'](String(cr['name']??'')))){cp=cr['identifier'];break;}}k['push']({'op':'configure','id':'reward_review_guard_add','target':ref('reward_review'),'method':'guard_add','params':P({'guard':ref(cm['step_id']),'recipient':{'Signer':'signer'},...cp!==undefined?{'store_from_id':cp}:{}}),'requires':['reward_review'],'notes':'RECIPIENT\x20(crs-mn-261015\x20F-12):\x20recipient\x20is\x20pinned\x20to\x20{Signer:\x27signer\x27}\x20—\x20the\x20claim\x20entry\x20'+'requires\x20recipient\x20==\x20the\x20transaction\x20sender\x20(E_CLAIM_RECIPIENT_NOT_SIGNER\x20otherwise);\x20a\x20GuardIdentifier\x20recipient\x20'+'resolves\x20to\x20the\x20submitted\x20Order\x20and\x20can\x20never\x20be\x20paid.\x20Fill\x20amount\x20=\x20the\x20per-claim\x20bounty\x20'+'(smallest\x20units)\x20when\x20executing.'+(cp!==undefined?'\x20SV-2\x20entry\x20stamp:\x20store_from_id\x20pins\x20the\x20per-order\x20stamp\x20slot\x20(the\x20submitted\x20Order\x20'+'address)\x20so\x20claim\x20records\x20key\x20per\x20order\x20—\x20once\x20per\x20buyer\x20per\x20order\x20(azx7-mn-261014\x20T8).':'')}),k['push']({'op':'configure','id':'service_rewards','target':ref('service'),'method':'rewards','params':P({'op':'add','objects':[ref('reward_review')]}),'requires':['service']}),typeof cn==='string'||typeof cn==='number'?k['push']({'op':'configure','id':'reward_review_coin_add','target':ref('reward_review'),'method':'coin_add','params':{'coin':String(cn)},'requires':['reward_review']}):j['push']({'code':'REVIEW_REWARD_UNFUNDED','detail':'review_mode\x20\x27review_reward\x27\x20without\x20a\x20\x27reward_funding\x27\x20input\x20(INV-4\x20R-REWARD-FUNDED):\x20the\x20incentive\x20'+'is\x20a\x20marketing\x20promise\x20that\x20must\x20be\x20FUNDED\x20when\x20the\x20Service\x20is\x20built\x20(sale-time\x20planning\x20—\x20pool\x20>=\x20'+'expected\x20orders\x20x\x20per-order\x20reward,\x20benchmark\x20fee_param\x20review_reward_pool).\x20Pass\x20reward_funding\x20'+'(smallest-unit\x20string)\x20to\x20fund\x20the\x20Reward\x20object,\x20or\x20drop\x20to\x20review_mode\x20\x22review\x22.'});}}}if(J){k['push']({'op':'create','id':'arbitration','object':'arbitration','params':P({'name':h+'_arbitration','permission':ref('permission_arb'),'type_parameter':aa}),'notes':'Independent\x20venue\x20(R2).\x20New\x20arbitrations\x20default\x20bPaused=true\x20—\x20unpause\x20is\x20a\x20separate\x20operator\x20step.'}),k['push']({'op':'configure','id':'service_arbitrations','target':ref('service'),'method':'arbitrations','params':P({'op':'add','objects':[ref('arbitration')]})});const cs=b['compensation_fund'];(typeof cs==='string'||typeof cs==='number')&&k['push']({'op':'configure','id':'service_compensation','target':ref('service'),'method':'compensation_fund_add','params':{'balance':String(cs)}});}k['push']({'op':'publish','id':'service_publish','target':ref('service'),'preflight':[{'check':'service_publish','status':'pending'},{'check':'FUND-EXIT-01','status':'pending'},{'check':'PLAN-ALLOC-01','status':'pending'},{'check':'TASKBIND-02','status':'pending'}]});const ah=new Set(u['map'](ct=>ct['guard_key'])['filter'](ct=>typeof ct==='string')),ai=/^0x[0-9a-fA-F]{20,64}$/,aj=ct=>{const cu=C['get'](ct);if(cu===undefined)return undefined;for(const cv of cu['table']){const cw=cv;if(cw['b_submission']===!![]||cw['value_type']!=='Address')continue;const cx=cw['value'];if(typeof cx==='string'&&ai['test'](cx))return String(cw['identifier']??'?');}return undefined;};for(const ct of C['keys']()){if(!F['has'](ct)&&!ah['has'](ct))continue;const cu=aj(ct);cu!==undefined&&j['push']({'code':'GUARD_FOREIGN_SERVICE','detail':'guard\x20\x27'+ct+'\x27\x20pins\x20an\x20on-chain\x20address\x20literal\x20(table\x20slot\x20'+cu+')\x20while\x20bound\x20into\x20this\x20build.\x20'+'The\x20plan\x27s\x20Service\x20is\x20created\x20BY\x20this\x20plan\x20and\x20cannot\x20equal\x20a\x20pre-existing\x20address,\x20so\x20the\x20pin\x20names\x20a\x20foreign\x20or\x20'+'stale\x20object:\x20each\x20object\x20is\x20well-formed\x20alone,\x20but\x20the\x20cross-object\x20identity\x20assert\x20aborts\x20every\x20guarded\x20forward\x20'+'(klook\x20B11\x20class),\x20and\x20Guard\x20+\x20machine\x20are\x20both\x20create/publish-frozen\x20—\x20unrepairable.\x20'+'Bind\x20by\x20plan\x20reference\x20({\x22$ref\x22:\x22service\x22})\x20or\x20by\x20the\x20P16\x20circular\x20service\x20NAME\x20instead.'});}const ak=D['flatMap'](cv=>{const cw=ah['has'](cv['key'])?'allocator':F['has'](cv['key'])?'machine_edge':cv['host']==='service'&&cv['key']==='buy'?'service_buy':undefined;return cw?[{'key':cv['key'],'template_id':cv['template_id'],'host':cv['host'],'site':cw,'purpose':cv['purpose']}]:[];});return{'plan':{'version':0x1,'intent':d['intent']??'compile\x20'+a['id'],'templateId':a['id'],'inputs':b,'steps':k,...ak['length']>0x0?{'pending_guards':ak}:{}},'guardSpecs':x,'unresolved':D,'blockers':j,'omitted':[...w]};}
@@ -2,20 +2,47 @@ export interface InFlightRecord {
2
2
  marker_id: string;
3
3
  op: string;
4
4
  service?: string;
5
+ allocation?: string;
5
6
  buyer?: string;
6
7
  items_count?: number;
7
8
  params_hash: string;
8
9
  started_at: number;
9
10
  digests: string[];
10
- status: "in_flight" | "landed";
11
+ status: "in_flight";
11
12
  }
12
13
  export declare function beginInFlight(op: string, data: unknown, env?: {
13
14
  account?: string;
14
15
  network?: string;
15
- }): string;
16
+ dry_run?: boolean;
17
+ }, submission?: unknown, startedAtMs?: number): string;
18
+ export declare function parkUnknownOutcomeMarker(op: string, data: unknown, env?: {
19
+ account?: string;
20
+ dry_run?: boolean;
21
+ }, submission?: unknown): void;
22
+ export declare function markerOpFor(op: string, data: unknown): string;
16
23
  export declare function recordInFlightOutcome(markerId: string, result: unknown): void;
17
- export declare function describeLastInFlight(op: string): string | undefined;
18
- export declare function lastInFlightMarker(op: string): InFlightRecord | undefined;
24
+ interface LandedTombstone {
25
+ op: string;
26
+ digest: string;
27
+ at: number;
28
+ }
29
+ export declare function recentLandedTombstone(): LandedTombstone | undefined;
30
+ export declare function clearInFlightMarkers(): number;
31
+ interface ReturnedDigest {
32
+ digest: string;
33
+ op: string;
34
+ at: number;
35
+ }
36
+ export declare function noteReturnedDigest(digest: string, op: string): void;
37
+ export declare function priorReturnOfDigest(digest: string | undefined): ReturnedDigest | undefined;
38
+ export declare function attachInFlightDigest(op: string, paramsHash: string | undefined, digest: string): void;
39
+ export declare function inFlightParamsHash(data: unknown, submission?: unknown, account?: unknown): string;
40
+ export declare function describeLastInFlight(op: string, paramsHash?: string): string | undefined;
41
+ export declare function lastInFlightMarker(op: string, paramsHash?: string): InFlightRecord | undefined;
42
+ export declare function pendingInFlightResend(op: string, data: unknown, submission?: unknown, env?: {
43
+ account?: string;
44
+ dry_run?: boolean;
45
+ }): string | undefined;
19
46
  export interface OrderLandedEvent {
20
47
  order?: string;
21
48
  progress?: string | null;
@@ -25,3 +52,4 @@ export interface OrderLandedEvent {
25
52
  digest?: string;
26
53
  }
27
54
  export declare function matchOrderLandedEvent(marker: InFlightRecord, ev: OrderLandedEvent): string | undefined;
55
+ export {};
@@ -1 +1 @@
1
- const MAX_RECORDS=0x32,MAX_AGE_MS=0x2*0x3c*0x3c*0x3e8,records=new Map();let seq=0x0;function hash(a){let b=0x1505;for(let c=0x0;c<a['length'];c++)b=(b<<0x5)+b+a['charCodeAt'](c)>>>0x0;return b['toString'](0x10);}function prune(){const a=Date['now']();for(const [b,c]of records){if(a-c['started_at']>MAX_AGE_MS)records['delete'](b);}while(records['size']>MAX_RECORDS){const d=records['keys']()['next']()['value'];if(d===undefined)break;records['delete'](d);}}function addr(a){return typeof a==='string'&&a['startsWith']('0x')?a:undefined;}export function beginInFlight(a,b,c){const d=b,e=d?.['order_new']?.['buy'],f=addr(d?.['object'])??addr(e?.['service']),g={'marker_id':'ifl_'+Date['now']()['toString'](0x10)+'_'+(seq++)['toString'](0x10),'op':a,'service':f,'buyer':addr(c?.['account']),'items_count':Array['isArray'](e?.['items'])?e['items']['length']:undefined,'params_hash':hash(JSON['stringify'](b??{})),'started_at':Date['now'](),'digests':[],'status':'in_flight'};return records['set'](g['marker_id'],g),prune(),g['marker_id'];}export function recordInFlightOutcome(a,b){const c=records['get'](a);if(!c)return;const d=b?.['digest'];typeof d==='string'&&d&&(c['digests']['push'](d),c['status']='landed');}export function describeLastInFlight(a){let b;for(const d of records['values']())if(d['op']===a)b=d;if(!b)return undefined;const c=[b['service']?'service='+b['service']:undefined,b['buyer']?'buyer='+b['buyer']:undefined,b['items_count']!==undefined?'items='+b['items_count']:undefined]['filter'](Boolean)['join']('\x20');if(b['status']==='landed'&&b['digests']['length']>0x0)return'IN-FLIGHT\x20MARKER\x20'+b['marker_id']+':\x20op='+b['op']+'\x20'+c+'\x20landed\x20with\x20digest\x20'+b['digests'][0x0]+'\x20'+('('+new Date(b['started_at'])['toISOString']()+').\x20The\x20execution\x20DID\x20reach\x20the\x20chain\x20—\x20adopt\x20the\x20')+'resulting\x20object;\x20resubmitting\x20the\x20same\x20call\x20creates\x20a\x20second\x20one.';return'IN-FLIGHT\x20MARKER\x20'+b['marker_id']+':\x20op='+b['op']+'\x20'+c+'\x20started\x20'+new Date(b['started_at'])['toISOString']()+'\x20'+'—\x20this\x20operation\x20is\x20observability-non-atomic:\x20a\x20transport\x20drop\x20after\x20submit\x20leaves\x20the\x20commit\x20state\x20'+'open.\x20Before\x20resubmitting,\x20first\x20verify\x20whether\x20an\x20order\x20with\x20this\x20exact\x20signature\x20already\x20landed\x20'+'(query\x20the\x20sender\x27s\x20recent\x20on-chain\x20objects\x20or\x20onchain_events\x20for\x20this\x20service);\x20adopt\x20it\x20if\x20present,\x20'+'resubmit\x20only\x20if\x20confirmed\x20absent.';}export function lastInFlightMarker(a){let b;for(const c of records['values']())if(c['op']===a)b=c;return b;}export function matchOrderLandedEvent(a,b){const c=a['started_at']-0x2*0x3c*0x3e8,d=Number(b?.['time']);if(Number['isFinite'](d)&&d<c)return undefined;const e=!!(a['service']&&b?.['service']&&b['service']===a['service']),f=!!(a['buyer']&&b?.['sender']&&b['sender']['toLowerCase']()===a['buyer']['toLowerCase']());if(!e&&!f)return undefined;if(a['buyer']&&b?.['sender']&&!f)return undefined;const g=b?.['digest']??'unknown';return'AUTO-VERIFIED\x20ON-CHAIN:\x20this\x20order\x20DID\x20land\x20despite\x20the\x20error\x20above\x20—\x20order='+(b?.['order']??'?')+((b?.['progress']?'\x20progress='+b['progress']:'')+'\x20digest='+g+'.\x20ADOPT\x20this\x20order\x20object;\x20')+'resubmitting\x20the\x20same\x20call\x20would\x20escrow\x20a\x20SECOND\x20time.';}
1
+ const MAX_RECORDS=0x32,MAX_AGE_MS=0x2*0x3c*0x3c*0x3e8,records=new Map();let seq=0x0;function hash(a){let b=0x1505;for(let c=0x0;c<a['length'];c++)b=(b<<0x5)+b+a['charCodeAt'](c)>>>0x0;return b['toString'](0x10);}function prune(){const a=Date['now']();for(const [b,c]of records){if(a-c['started_at']>MAX_AGE_MS)records['delete'](b);}while(records['size']>MAX_RECORDS){const d=records['keys']()['next']()['value'];if(d===undefined)break;records['delete'](d);}}function addr(a){return typeof a==='string'&&a['startsWith']('0x')?a:undefined;}export function beginInFlight(a,b,c,d,e){if(c?.['dry_run']===!![])return'';const f=b,g=f?.['order_new']?.['buy'],h=f?.['alloc_by_guard']!=null,i={'marker_id':'ifl_'+Date['now']()['toString'](0x10)+'_'+(seq++)['toString'](0x10),'op':a,'service':h?undefined:addr(f?.['object'])??addr(g?.['service']),'allocation':h?addr(f?.['object']):undefined,'buyer':addr(c?.['account']),'items_count':Array['isArray'](g?.['items'])?g['items']['length']:undefined,'params_hash':inFlightParamsHash(b,d,c?.['account']),'started_at':e??Date['now'](),'digests':[],'status':'in_flight'};return records['set'](i['marker_id'],i),prune(),i['marker_id'];}const UNKNOWN_OUTCOME_BACKDATE_MS=0x3c*0x3e8;export function parkUnknownOutcomeMarker(a,b,c,d){if(c?.['dry_run']===!![])return;if(lastInFlightMarker(a,inFlightParamsHash(b,d,c?.['account'])))return;beginInFlight(a,b,c,d,Date['now']()-UNKNOWN_OUTCOME_BACKDATE_MS);}export function markerOpFor(a,b){const c=b;if(c?.['order_new']!=null)return'order_new';if(c?.['alloc_by_guard']!=null)return'alloc_by_guard';return a;}export function recordInFlightOutcome(a,b){const c=records['get'](a);if(!c)return;const d=b?.['digest'];typeof d==='string'&&d&&(recordLandedTombstone(c['op'],d),records['delete'](a));}const MAX_TOMBSTONES=0xa,TOMBSTONE_MAX_AGE_MS=0xa*0x3c*0x3e8,tombstones=[];function recordLandedTombstone(a,b){tombstones['push']({'op':a,'digest':b,'at':Date['now']()});while(tombstones['length']>MAX_TOMBSTONES)tombstones['shift']();}export function recentLandedTombstone(){const a=Date['now']();while(tombstones['length']>0x0&&a-tombstones[0x0]['at']>TOMBSTONE_MAX_AGE_MS)tombstones['shift']();return tombstones['length']>0x0?tombstones[tombstones['length']-0x1]:undefined;}export function clearInFlightMarkers(){const a=records['size']+tombstones['length'];return records['clear'](),tombstones['length']=0x0,a;}const MAX_RETURNED_DIGESTS=0x200,returnedDigests=[];export function noteReturnedDigest(a,b){if(!a||a['startsWith']('dry_run:'))return;if(returnedDigests['some'](c=>c['digest']===a))return;returnedDigests['push']({'digest':a,'op':b,'at':Date['now']()});while(returnedDigests['length']>MAX_RETURNED_DIGESTS)returnedDigests['shift']();}export function priorReturnOfDigest(a){if(!a)return undefined;for(let b=returnedDigests['length']-0x1;b>=0x0;b--){if(returnedDigests[b]['digest']===a)return returnedDigests[b];}return undefined;}export function attachInFlightDigest(a,b,c){const d=lastInFlightMarker(a,b);if(!d)return;if(!d['digests']['includes'](c))d['digests']['push'](c);}export function inFlightParamsHash(a,b,c){const d=typeof c==='string'?c['trim']()['toLowerCase']():'';return hash(JSON['stringify'](a??{})+'\x00'+JSON['stringify'](b??null)+'\x00'+d);}export function describeLastInFlight(a,b){let c;for(const f of records['values']()){if(f['op']!==a)continue;if(b!==undefined&&f['params_hash']!==b)continue;c=f;}if(!c)return undefined;const d=[c['service']?'service='+c['service']:undefined,c['allocation']?'allocation='+c['allocation']:undefined,c['buyer']?'buyer='+c['buyer']:undefined,c['items_count']!==undefined?'items='+c['items_count']:undefined]['filter'](Boolean)['join']('\x20'),e=c['digests']['length']>0x0?'\x0aReported\x20submission\x20digest(s):\x20'+c['digests']['join'](',\x20')+'\x20—\x20verify\x20THE\x20DIGEST\x20FIRST\x20'+'(onchain_transaction\x20by\x20digest):\x20an\x20executed\x20status\x20means\x20the\x20operation\x20LANDED\x20—\x20adopt\x20the\x20'+'created\x20object(s)\x20and\x20stop;\x20a\x20failure\x20status\x20is\x20FINAL\x20(its\x20bytes\x20are\x20consumed\x20—\x20fix\x20the\x20cause\x20'+'and\x20build\x20a\x20fresh\x20transaction);\x20a\x20digest\x20that\x20does\x20not\x20resolve\x20means\x20nothing\x20landed\x20and\x20a\x20'+'resubmit\x20is\x20safe.':'';return'IN-FLIGHT\x20MARKER\x20'+c['marker_id']+':\x20op='+c['op']+'\x20'+d+'\x20started\x20'+new Date(c['started_at'])['toISOString']()+'\x20'+'—\x20this\x20operation\x20is\x20observability-non-atomic:\x20a\x20transport\x20drop\x20after\x20submit\x20leaves\x20the\x20commit\x20state\x20'+'open.\x20Before\x20resubmitting,\x20first\x20verify\x20whether\x20an\x20order\x20with\x20this\x20exact\x20signature\x20already\x20landed\x20'+'(query\x20the\x20sender\x27s\x20recent\x20on-chain\x20objects\x20or\x20onchain_events\x20for\x20this\x20service);\x20adopt\x20it\x20if\x20present,\x20'+'resubmit\x20only\x20if\x20confirmed\x20absent.'+e;}export function lastInFlightMarker(a,b){let c;for(const d of records['values']()){if(d['op']!==a)continue;if(b!==undefined&&d['params_hash']!==b)continue;c=d;}return c;}const RESEND_INTERCEPT_WINDOW_MS=0x78*0x3e8;export function pendingInFlightResend(a,b,c,d){if(d?.['dry_run']===!![])return undefined;const e=lastInFlightMarker(a,inFlightParamsHash(b,c,d?.['account']));if(!e)return undefined;if(Date['now']()-e['started_at']>=RESEND_INTERCEPT_WINDOW_MS)return undefined;const f=e['allocation']??e['service']??'the\x20object\x20referenced\x20by\x20this\x20call',g=new Date(e['started_at']+RESEND_INTERCEPT_WINDOW_MS)['toISOString'](),h=e['allocation']?'query\x20the\x20Allocation\x20object\x20and\x20the\x20Payment\x20object(s)\x20it\x20produced\x20'+'(onchain_objects\x20/\x20onchain_events\x20for\x20this\x20allocation)':'query\x20the\x20object(s)\x20this\x20exact\x20call\x20creates\x20or\x20mutates,\x20and\x20the\x20signing\x20'+'account\x27s\x20recent\x20events\x20(query_toolkit\x20onchain_objects\x20/\x20onchain_events\x20for\x20the\x20sender)';return'THIS\x20EXACT\x20CALL\x20WAS\x20SUBMITTED\x20MOMENTS\x20AGO\x20AND\x20ITS\x20OUTCOME\x20WAS\x20NEVER\x20OBSERVED\x20'+('(in-flight\x20marker\x20'+e['marker_id']+',\x20started\x20'+new Date(e['started_at'])['toISOString']()+',\x20')+('op='+e['op']+',\x20'+f+').\x20The\x20call\x20is\x20observability-non-atomic:\x20a\x20transport\x20drop\x20after\x20submit\x20')+'leaves\x20the\x20commit\x20state\x20open,\x20and\x20resubmitting\x20the\x20same\x20payload\x20without\x20checking\x20may\x20move\x20the\x20funds\x20'+'a\x20second\x20time.\x20Before\x20doing\x20anything\x20else,\x20verify\x20whether\x20the\x20previous\x20submission\x20already\x20landed:\x20'+(h+'\x20—\x20if\x20a\x20result\x20already\x20landed,\x20adopt\x20it\x20and\x20stop;\x20')+'only\x20resubmit\x20once\x20you\x20have\x20confirmed\x20on-chain\x20that\x20nothing\x20landed.\x20'+'Scope\x20of\x20this\x20check:\x20it\x20holds\x20ONLY\x20this\x20exact\x20payload\x20(data\x20+\x20submission\x20envelope\x20together),\x20and\x20'+('only\x20until\x20'+g+'\x20('+Math['round'](RESEND_INTERCEPT_WINDOW_MS/0x3e8)+'s\x20from\x20the\x20marker\x20start)\x20—\x20')+'past\x20that\x20moment\x20the\x20identical\x20call\x20goes\x20through\x20unchanged.\x20A\x20changed\x20payload\x20(different\x20amounts,\x20'+'recipients,\x20targets,\x20or\x20a\x20corrected\x20submission\x20envelope)\x20is\x20never\x20affected:\x20fixing\x20the\x20envelope\x20and\x20'+'retrying\x20right\x20away\x20is\x20always\x20allowed.';}export function matchOrderLandedEvent(a,b){const c=a['started_at']-0xf*0x3e8,d=Number(b?.['time']);if(Number['isFinite'](d)&&d<c)return undefined;if(priorReturnOfDigest(b?.['digest']))return undefined;const e=!!(a['service']&&b?.['service']&&b['service']===a['service']),f=!!(a['buyer']&&b?.['sender']&&b['sender']['toLowerCase']()===a['buyer']['toLowerCase']());if(!e&&!f)return undefined;if(a['buyer']&&b?.['sender']&&!f)return undefined;const g=b?.['digest']??'unknown';return'AUTO-VERIFIED\x20ON-CHAIN:\x20this\x20order\x20DID\x20land\x20despite\x20the\x20error\x20above\x20—\x20order='+(b?.['order']??'?')+((b?.['progress']?'\x20progress='+b['progress']:'')+'\x20digest='+g+'.\x20ADOPT\x20this\x20order\x20object;\x20')+'resubmitting\x20the\x20same\x20call\x20would\x20escrow\x20a\x20SECOND\x20time.';}
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { type RuleDomainPack } from "./rule-engine.js";
3
3
  export declare const EXPECTED_JUDGMENT_VERSION = 1;
4
- export declare const JUDGMENT_SECTION_NAMES: readonly ["evaluation", "game", "match", "monitor", "mode", "scorecard", "rules"];
4
+ export declare const JUDGMENT_SECTION_NAMES: readonly ["evaluation", "game", "match", "monitor", "mode", "scorecard", "rules", "role_intent"];
5
5
  export type JudgmentSectionName = (typeof JUDGMENT_SECTION_NAMES)[number];
6
6
  export declare const DimensionStandardSchema: z.ZodObject<{
7
7
  label: z.ZodString;
@@ -369,6 +369,50 @@ export declare const ScorecardSectionInputSchema: z.ZodObject<{
369
369
  }, z.core.$strict>>>;
370
370
  shop_evidence_metrics: z.ZodOptional<z.ZodArray<z.ZodString>>;
371
371
  }, z.core.$strict>;
372
+ export declare const RoleIntentSectionSchema: z.ZodObject<{
373
+ comment: z.ZodOptional<z.ZodString>;
374
+ roles: z.ZodRecord<z.ZodString, z.ZodObject<{
375
+ comment: z.ZodOptional<z.ZodString>;
376
+ intents: z.ZodArray<z.ZodObject<{
377
+ id: z.ZodString;
378
+ weight: z.ZodNumber;
379
+ }, z.core.$strict>>;
380
+ horizon: z.ZodOptional<z.ZodNumber>;
381
+ risk_appetite: z.ZodOptional<z.ZodEnum<{
382
+ conservative: "conservative";
383
+ balanced: "balanced";
384
+ aggressive: "aggressive";
385
+ }>>;
386
+ red_lines: z.ZodOptional<z.ZodArray<z.ZodString>>;
387
+ strategy_leaning: z.ZodOptional<z.ZodEnum<{
388
+ cooperative: "cooperative";
389
+ opportunistic: "opportunistic";
390
+ confrontational: "confrontational";
391
+ }>>;
392
+ }, z.core.$strict>>;
393
+ }, z.core.$strict>;
394
+ export declare const RoleIntentSectionInputSchema: z.ZodObject<{
395
+ comment: z.ZodOptional<z.ZodString>;
396
+ roles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
397
+ comment: z.ZodOptional<z.ZodOptional<z.ZodString>>;
398
+ intents: z.ZodOptional<z.ZodArray<z.ZodObject<{
399
+ id: z.ZodString;
400
+ weight: z.ZodNumber;
401
+ }, z.core.$strict>>>;
402
+ horizon: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
403
+ risk_appetite: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
404
+ conservative: "conservative";
405
+ balanced: "balanced";
406
+ aggressive: "aggressive";
407
+ }>>>;
408
+ red_lines: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
409
+ strategy_leaning: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
410
+ cooperative: "cooperative";
411
+ opportunistic: "opportunistic";
412
+ confrontational: "confrontational";
413
+ }>>>;
414
+ }, z.core.$strict>>>;
415
+ }, z.core.$strict>;
372
416
  export declare const RulesSectionSchema: z.ZodObject<{
373
417
  comment: z.ZodOptional<z.ZodString>;
374
418
  domains: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -717,6 +761,28 @@ export declare const JudgmentDocSchema: z.ZodObject<{
717
761
  }>>>;
718
762
  }, z.core.$strict>>;
719
763
  }, z.core.$strict>;
764
+ role_intent: z.ZodObject<{
765
+ comment: z.ZodOptional<z.ZodString>;
766
+ roles: z.ZodRecord<z.ZodString, z.ZodObject<{
767
+ comment: z.ZodOptional<z.ZodString>;
768
+ intents: z.ZodArray<z.ZodObject<{
769
+ id: z.ZodString;
770
+ weight: z.ZodNumber;
771
+ }, z.core.$strict>>;
772
+ horizon: z.ZodOptional<z.ZodNumber>;
773
+ risk_appetite: z.ZodOptional<z.ZodEnum<{
774
+ conservative: "conservative";
775
+ balanced: "balanced";
776
+ aggressive: "aggressive";
777
+ }>>;
778
+ red_lines: z.ZodOptional<z.ZodArray<z.ZodString>>;
779
+ strategy_leaning: z.ZodOptional<z.ZodEnum<{
780
+ cooperative: "cooperative";
781
+ opportunistic: "opportunistic";
782
+ confrontational: "confrontational";
783
+ }>>;
784
+ }, z.core.$strict>>;
785
+ }, z.core.$strict>;
720
786
  }, z.core.$strict>;
721
787
  export declare const JudgmentDocInputSchema: z.ZodObject<{
722
788
  version: z.ZodNumber;
@@ -936,6 +1002,28 @@ export declare const JudgmentDocInputSchema: z.ZodObject<{
936
1002
  }>>>;
937
1003
  }, z.core.$strict>>>;
938
1004
  }, z.core.$strict>>;
1005
+ role_intent: z.ZodOptional<z.ZodObject<{
1006
+ comment: z.ZodOptional<z.ZodString>;
1007
+ roles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1008
+ comment: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1009
+ intents: z.ZodOptional<z.ZodArray<z.ZodObject<{
1010
+ id: z.ZodString;
1011
+ weight: z.ZodNumber;
1012
+ }, z.core.$strict>>>;
1013
+ horizon: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
1014
+ risk_appetite: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
1015
+ conservative: "conservative";
1016
+ balanced: "balanced";
1017
+ aggressive: "aggressive";
1018
+ }>>>;
1019
+ red_lines: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1020
+ strategy_leaning: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
1021
+ cooperative: "cooperative";
1022
+ opportunistic: "opportunistic";
1023
+ confrontational: "confrontational";
1024
+ }>>>;
1025
+ }, z.core.$strict>>>;
1026
+ }, z.core.$strict>>;
939
1027
  }, z.core.$strict>;
940
1028
  export type EvaluationSection = z.infer<typeof EvaluationSectionSchema>;
941
1029
  export type DimensionStandard = z.infer<typeof DimensionStandardSchema>;
@@ -1164,6 +1252,28 @@ export declare const JudgmentFragmentSchema: z.ZodObject<{
1164
1252
  }, z.core.$strict>>>;
1165
1253
  shop_evidence_metrics: z.ZodOptional<z.ZodArray<z.ZodString>>;
1166
1254
  }, z.core.$strict>>;
1255
+ role_intent: z.ZodOptional<z.ZodObject<{
1256
+ comment: z.ZodOptional<z.ZodString>;
1257
+ roles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1258
+ comment: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1259
+ intents: z.ZodOptional<z.ZodArray<z.ZodObject<{
1260
+ id: z.ZodString;
1261
+ weight: z.ZodNumber;
1262
+ }, z.core.$strict>>>;
1263
+ horizon: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
1264
+ risk_appetite: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
1265
+ conservative: "conservative";
1266
+ balanced: "balanced";
1267
+ aggressive: "aggressive";
1268
+ }>>>;
1269
+ red_lines: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1270
+ strategy_leaning: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
1271
+ cooperative: "cooperative";
1272
+ opportunistic: "opportunistic";
1273
+ confrontational: "confrontational";
1274
+ }>>>;
1275
+ }, z.core.$strict>>>;
1276
+ }, z.core.$strict>>;
1167
1277
  version: z.ZodOptional<z.ZodNumber>;
1168
1278
  }, z.core.$strict>;
1169
1279
  export type JudgmentLayerFragment = z.infer<typeof JudgmentFragmentSchema>;