@wowok/agent-mcp 3.3.7 → 3.3.8

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 (173) hide show
  1. package/dist/chain-semantics/fund-flow.js +1 -1
  2. package/dist/chain-semantics/guard-verbs.js +1 -1
  3. package/dist/chain-semantics/object-graph.js +1 -1
  4. package/dist/communication/message-cursors.d.ts +35 -0
  5. package/dist/communication/message-cursors.js +1 -0
  6. package/dist/communication/wts-attestation.d.ts +5 -0
  7. package/dist/communication/wts-attestation.js +1 -1
  8. package/dist/composition/audit.js +1 -1
  9. package/dist/composition/compile.d.ts +2 -2
  10. package/dist/composition/compile.js +1 -1
  11. package/dist/composition/inflight.d.ts +7 -0
  12. package/dist/composition/inflight.js +1 -1
  13. package/dist/composition/materialize.d.ts +4 -1
  14. package/dist/composition/materialize.js +1 -1
  15. package/dist/config/index.d.ts +1 -0
  16. package/dist/config/index.js +1 -1
  17. package/dist/config/store-policy.d.ts +14 -0
  18. package/dist/config/store-policy.js +1 -0
  19. package/dist/config/store-policy.spec.d.ts +1 -0
  20. package/dist/config/store-policy.spec.js +1 -0
  21. package/dist/customer/industry-risks.js +1 -1
  22. package/dist/customer/user-preferences.js +1 -1
  23. package/dist/evaluation/builtins/graph-service.spec.js +1 -1
  24. package/dist/evaluation/engine.js +1 -1
  25. package/dist/experience/realtime-feedback.js +1 -1
  26. package/dist/extensions/business-modules.d.ts +1 -1
  27. package/dist/extensions/business-modules.js +1 -1
  28. package/dist/extensions/industry-pack.js +1 -1
  29. package/dist/extensions/modes.js +1 -1
  30. package/dist/graph/onchain/analyze.js +1 -1
  31. package/dist/graph/onchain/expand.js +1 -1
  32. package/dist/graph/onchain/exposure.js +1 -1
  33. package/dist/graph/onchain/facts.d.ts +1 -0
  34. package/dist/graph/onchain/facts.js +1 -1
  35. package/dist/graph/onchain/facts.spec.js +1 -1
  36. package/dist/harness/recover.js +1 -1
  37. package/dist/knowledge/acquisition-flywheel.js +1 -1
  38. package/dist/knowledge/allocation-ledger.d.ts +1 -0
  39. package/dist/knowledge/allocation-ledger.js +1 -1
  40. package/dist/knowledge/allocator-rail-verifier.d.ts +6 -2
  41. package/dist/knowledge/allocator-rail-verifier.js +1 -1
  42. package/dist/knowledge/arbitration-ledger.js +1 -1
  43. package/dist/knowledge/audit-rules.d.ts +37 -0
  44. package/dist/knowledge/audit-rules.js +1 -1
  45. package/dist/knowledge/baselines/rules/plan.json +32 -2
  46. package/dist/knowledge/builtin-templates.d.ts +13 -1
  47. package/dist/knowledge/builtin-templates.js +1 -1
  48. package/dist/knowledge/commission-landing.d.ts +26 -0
  49. package/dist/knowledge/commission-landing.js +1 -0
  50. package/dist/knowledge/discount-threshold.js +1 -1
  51. package/dist/knowledge/fund-layer.d.ts +7 -0
  52. package/dist/knowledge/fund-layer.js +1 -1
  53. package/dist/knowledge/getting-started.js +1 -1
  54. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  55. package/dist/knowledge/guard-design-patterns.js +1 -1
  56. package/dist/knowledge/guard-puzzle.js +1 -1
  57. package/dist/knowledge/guard-render.d.ts +7 -0
  58. package/dist/knowledge/guard-render.js +1 -1
  59. package/dist/knowledge/guard-risk.js +1 -1
  60. package/dist/knowledge/guard-templates.d.ts +1 -1
  61. package/dist/knowledge/guard-templates.js +1 -1
  62. package/dist/knowledge/guard-translation.js +1 -1
  63. package/dist/knowledge/index.js +1 -1
  64. package/dist/knowledge/industry-generalizer.js +1 -1
  65. package/dist/knowledge/industry-registry.d.ts +1 -1
  66. package/dist/knowledge/industry-registry.js +1 -1
  67. package/dist/knowledge/industry-strategy.js +1 -1
  68. package/dist/knowledge/jsonrpc-enum.js +1 -1
  69. package/dist/knowledge/machine-fork-watch.d.ts +9 -0
  70. package/dist/knowledge/machine-fork-watch.js +1 -0
  71. package/dist/knowledge/migration-preflight.js +1 -1
  72. package/dist/knowledge/projection.spec.js +1 -1
  73. package/dist/knowledge/scenario-modes.d.ts +8 -2
  74. package/dist/knowledge/scenario-modes.js +1 -1
  75. package/dist/knowledge/semantic-ir.d.ts +24 -5
  76. package/dist/knowledge/semantic-ir.js +1 -1
  77. package/dist/knowledge/service-ledger.js +1 -1
  78. package/dist/knowledge/strategy-manuals.js +1 -1
  79. package/dist/knowledge/template-index.js +1 -1
  80. package/dist/knowledge/template-loader.d.ts +11 -0
  81. package/dist/knowledge/template-loader.js +1 -1
  82. package/dist/knowledge/template-registry.js +1 -1
  83. package/dist/knowledge/template-scanner.d.ts +4 -2
  84. package/dist/knowledge/template-scanner.js +1 -1
  85. package/dist/knowledge/template-validation.js +1 -1
  86. package/dist/knowledge/tools-reference.js +1 -1
  87. package/dist/monitor/MonitorLoop.js +1 -1
  88. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  89. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  90. package/dist/playbooks/service-build/merchant-guide.d.ts +12 -6
  91. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  92. package/dist/playbooks/service-build/migration-planner.d.ts +10 -2
  93. package/dist/playbooks/service-build/migration-planner.js +1 -1
  94. package/dist/playbooks/service-build/mode-actions.d.ts +1 -0
  95. package/dist/playbooks/service-build/mode-actions.js +1 -1
  96. package/dist/playbooks/service-build/object-panorama.js +1 -1
  97. package/dist/playbooks/service-build/participation-radar.js +1 -1
  98. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  99. package/dist/playbooks/service-build/service-panorama.js +1 -1
  100. package/dist/playbooks/service-build/service-quote.js +1 -1
  101. package/dist/playbooks/service-build/service-quote.spec.js +1 -1
  102. package/dist/review/index.js +1 -1
  103. package/dist/safety/confirm-gate.js +1 -1
  104. package/dist/schema/benchmark-migration/index.d.ts +72 -1
  105. package/dist/schema/benchmark-migration/index.js +1 -1
  106. package/dist/schema/call/allocation.d.ts +3 -0
  107. package/dist/schema/call/allocation.js +1 -1
  108. package/dist/schema/call/base.d.ts +24 -0
  109. package/dist/schema/call/bridge.d.ts +6 -0
  110. package/dist/schema/call/error-codes.d.ts +1 -1
  111. package/dist/schema/call/error-codes.js +1 -1
  112. package/dist/schema/call/order.js +1 -1
  113. package/dist/schema/call/semantic.js +1 -1
  114. package/dist/schema/call/service.js +1 -1
  115. package/dist/schema/common/index.js +1 -1
  116. package/dist/schema/config/index.d.ts +24 -0
  117. package/dist/schema/config/index.js +1 -1
  118. package/dist/schema/goal/index.d.ts +14 -0
  119. package/dist/schema/goal/planning.d.ts +26 -0
  120. package/dist/schema/goal/planning.js +1 -1
  121. package/dist/schema/industry-pack/index.d.ts +9 -1
  122. package/dist/schema/industry-pack/modes.d.ts +9 -1
  123. package/dist/schema/industry-pack/modes.js +1 -1
  124. package/dist/schema/local/index.d.ts +60 -0
  125. package/dist/schema/local/index.js +1 -1
  126. package/dist/schema/messenger/index.d.ts +278 -1
  127. package/dist/schema/messenger/index.js +1 -1
  128. package/dist/schema/operations.d.ts +1 -0
  129. package/dist/schema/query/bi.d.ts +38 -0
  130. package/dist/schema/query/bi.js +1 -1
  131. package/dist/schema/query/index.d.ts +3 -0
  132. package/dist/schema/query/index.js +1 -1
  133. package/dist/schema/schema-version.js +1 -1
  134. package/dist/schema/service-clone/index.d.ts +17 -0
  135. package/dist/schema/service-clone/index.js +1 -1
  136. package/dist/schema-query-impl/index.js +1 -1
  137. package/dist/schemas/account_operation.output.json +6 -0
  138. package/dist/schemas/benchmark_migration_operation.output.json +254 -2
  139. package/dist/schemas/benchmark_migration_operation.schema.json +87 -5
  140. package/dist/schemas/bridge_operation.output.json +6 -0
  141. package/dist/schemas/config_operation.output.json +95 -0
  142. package/dist/schemas/config_operation.schema.json +16 -1
  143. package/dist/schemas/goal_operation.schema.json +22 -0
  144. package/dist/schemas/index.json +1 -1
  145. package/dist/schemas/industry_pack_operation.output.json +4 -0
  146. package/dist/schemas/industry_pack_operation.schema.json +40 -3
  147. package/dist/schemas/local_cache_operation.output.json +6 -0
  148. package/dist/schemas/local_history_operation.output.json +6 -0
  149. package/dist/schemas/local_info_operation.output.json +6 -0
  150. package/dist/schemas/local_mark_operation.output.json +6 -0
  151. package/dist/schemas/messenger_operation.output.json +609 -1
  152. package/dist/schemas/messenger_operation.schema.json +96 -1
  153. package/dist/schemas/onchain_operations.output.json +6 -0
  154. package/dist/schemas/onchain_operations.schema.json +334 -7
  155. package/dist/schemas/onchain_operations_allocation.schema.json +10 -1
  156. package/dist/schemas/onchain_operations_guard.schema.json +318 -0
  157. package/dist/schemas/onchain_operations_order.schema.json +1 -1
  158. package/dist/schemas/onchain_operations_service.schema.json +5 -5
  159. package/dist/schemas/query_toolkit.output.json +271 -8
  160. package/dist/schemas/service_clone_operation.output.json +79 -0
  161. package/dist/tools/handlers/benchmark-migration.d.ts +14 -0
  162. package/dist/tools/handlers/benchmark-migration.js +1 -1
  163. package/dist/tools/handlers/config.js +1 -1
  164. package/dist/tools/handlers/messenger.js +1 -1
  165. package/dist/tools/handlers/onchain.d.ts +19 -1
  166. package/dist/tools/handlers/onchain.js +1 -1
  167. package/dist/tools/handlers/query.d.ts +1 -0
  168. package/dist/tools/handlers/query.js +1 -1
  169. package/dist/tools/handlers/service-clone.d.ts +18 -0
  170. package/dist/tools/handlers/service-clone.js +1 -1
  171. package/dist/tools/registry/business.js +1 -1
  172. package/dist/tools/wrap.js +1 -1
  173. package/package.json +2 -2
@@ -1 +1 @@
1
- import{describe,it,expect,beforeAll,afterAll}from'vitest';import*as a278a from'node:fs';import*as a278b from'node:os';import*as a278c from'node:path';import{projectionUpsert,projectionServe,projectionStats,__projectionSetWriteClock}from'./projection.js';const SCRATCH_DB=a278c['join'](a278b['tmpdir'](),'wowok-projection-spec-'+process['pid']+'-'+Date['now']()+'.db'),PREV_DB=process['env']['WOWOK_PROJECTION_DB'],PREV_TTL=process['env']['WOWOK_PROJECTION_TTL_MS'];beforeAll(()=>{process['env']['WOWOK_PROJECTION_DB']=SCRATCH_DB,process['env']['WOWOK_PROJECTION_TTL_MS']='120000',__projectionSetWriteClock(0x0);}),afterAll(()=>{if(PREV_DB===undefined)delete process['env']['WOWOK_PROJECTION_DB'];else process['env']['WOWOK_PROJECTION_DB']=PREV_DB;if(PREV_TTL===undefined)delete process['env']['WOWOK_PROJECTION_TTL_MS'];else process['env']['WOWOK_PROJECTION_TTL_MS']=PREV_TTL;__projectionSetWriteClock(undefined);try{a278a['rmSync'](SCRATCH_DB,{'force':!![]}),a278a['rmSync'](SCRATCH_DB+'-wal',{'force':!![]}),a278a['rmSync'](SCRATCH_DB+'-shm',{'force':!![]});}catch{}});function svcRow(a,b={}){const {payloadJson:c,...d}=b;return{'object_id':a,'payload':JSON['stringify']({'object':a,...c??{}}),...d};}describe('projection\x20cache\x20(K5\x20doc\x2017\x20B-tier)',()=>{it('returns\x20undefined\x20without\x20a\x20watermark\x20(never\x20fabricates\x20coverage)',()=>{const a=projectionServe('chain-empty-proj','Service',{},0xc8);expect(a)['toBeUndefined'](),expect(projectionStats('chain-empty-proj')['every'](b=>b['rows']===0x0))['toBe'](!![]);}),it('serves\x20a\x20fresh\x20projection\x20with\x20SQL\x20filters\x20and\x20pre-filter\x20totals',()=>{const a='chain-proj-serve',b=[svcRow('0xa1',{'name':'Alpha\x20Music','location':'Shanghai,\x20CN','coin_type':'0x2::wow::WOW','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa1','name':'Alpha\x20Music','location':'Shanghai,\x20CN'}}),svcRow('0xa2',{'name':'Beta\x20Design','location':'Beijing,\x20CN','coin_type':'0x2::wow::WOW','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa2','name':'Beta\x20Design','location':'Beijing,\x20CN'}}),svcRow('0xa3',{'name':'Gamma\x20Food','location':'Shanghai,\x20CN','coin_type':'0x2::sui::SUI','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa3','name':'Gamma\x20Food','location':'Shanghai,\x20CN'}})];projectionUpsert(a,'Service',b,{'hasMore':![],'maxObjects':0xc8});const c=projectionServe(a,'Service',{},0xc8);expect(c)['toBeDefined'](),expect(c['items'])['toHaveLength'](0x3),expect(c['meta']['total_rows'])['toBe'](0x3),expect(c['meta']['watermark']['has_more'])['toBe'](0x0),expect(c['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa2','0xa3']);const d=projectionServe(a,'Service',{'coin_type':'0x2::wow::WOW'},0xc8);expect(d['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa2']),expect(d['meta']['total_rows'])['toBe'](0x3);const e=projectionServe(a,'Service',{'name_contains':'beta'},0xc8);expect(e['items']['map'](h=>h['object']))['toEqual'](['0xa2']);const f=projectionServe(a,'Service',{'location_any':['shanghai']},0xc8);expect(f['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa3']);const g=projectionServe(a,'Service',{'location_any':['paris']},0xc8);expect(g['items'])['toHaveLength'](0x0),expect(g['meta']['total_rows'])['toBe'](0x3),expect(projectionStats(a)['find'](h=>h['kind']==='Service')?.['rows'])['toBe'](0x3),expect(projectionStats(a)['find'](h=>h['kind']==='Service')?.['refreshed_at'])['toBeGreaterThan'](0x0);}),it('upserts\x20cumulatively:\x20rows\x20update\x20in\x20place\x20and\x20accumulate\x20across\x20windows',()=>{const a='chain-proj-cumulative';projectionUpsert(a,'Demand',[{'object_id':'0xd1','payload':JSON['stringify']({'object':'0xd1','description':'v1'})}],{'hasMore':!![],'maxObjects':0xc8}),projectionUpsert(a,'Demand',[{'object_id':'0xd1','payload':JSON['stringify']({'object':'0xd1','description':'v2'})},{'object_id':'0xd2','payload':JSON['stringify']({'object':'0xd2','description':'new'})}],{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Demand',{},0xc8);expect(b['items'])['toHaveLength'](0x2);const c=b['items']['find'](d=>d['object']==='0xd1');expect(c?.['description'])['toBe']('v2'),expect(b['meta']['watermark']['has_more'])['toBe'](0x0);}),it('declines\x20to\x20serve\x20when\x20stale\x20by\x20TTL',async()=>{const a='chain-proj-stale-ttl',b=process['env']['WOWOK_PROJECTION_TTL_MS'];process['env']['WOWOK_PROJECTION_TTL_MS']='20';try{projectionUpsert(a,'Service',[svcRow('0xs1')],{'hasMore':![],'maxObjects':0xc8}),expect(projectionServe(a,'Service',{},0xc8))['toBeDefined'](),await new Promise(c=>setTimeout(c,0x28)),expect(projectionServe(a,'Service',{},0xc8))['toBeUndefined']();}finally{process['env']['WOWOK_PROJECTION_TTL_MS']=b;}}),it('declines\x20to\x20serve\x20when\x20a\x20local\x20on-chain\x20write\x20postdates\x20the\x20watermark',()=>{const a='chain-proj-stale-write';projectionUpsert(a,'Service',[svcRow('0xs2')],{'hasMore':![],'maxObjects':0xc8}),__projectionSetWriteClock(Date['now']()+0x1);try{expect(projectionServe(a,'Service',{},0xc8))['toBeUndefined']();}finally{__projectionSetWriteClock(0x0);}}),it('filters\x20arb\x20payloads\x20post-SQL\x20for\x20parity\x20with\x20the\x20legacy\x20post-hydration\x20filter',()=>{const a='chain-proj-arb';projectionUpsert(a,'Arb',[{'object_id':'0xb1','payload':JSON['stringify']({'object':'0xb1','arbitration':'0xarb1','order':'0xo1','status':0x2})},{'object_id':'0xb2','payload':JSON['stringify']({'object':'0xb2','arbitration':'0xarb1','order':'0xo2','status':0x5})},{'object_id':'0xb3','payload':JSON['stringify']({'object':'0xb3','arbitration':'0xarb2','order':'0xo1','status':0x2})}],{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Arb',{'arbitration':'0xarb1'},0xc8);expect(b['items']['map'](f=>f['object'])['sort']())['toEqual'](['0xb1','0xb2']),expect(b['meta']['total_rows'])['toBe'](0x3);const c=projectionServe(a,'Arb',{'order':'0xo1'},0xc8);expect(c['items']['map'](f=>f['object'])['sort']())['toEqual'](['0xb1','0xb3']);const d=projectionServe(a,'Arb',{'status':[0x5]},0xc8);expect(d['items']['map'](f=>f['object']))['toEqual'](['0xb2']);const e=projectionServe(a,'Arb',{'arbitration':'0xarb2','status':[0x5]},0xc8);expect(e['items'])['toHaveLength'](0x0);}),it('respects\x20the\x20limit\x20on\x20the\x20SQL\x20path',()=>{const a='chain-proj-limit';projectionUpsert(a,'Demand',Array['from']({'length':0x5},(c,d)=>({'object_id':'0xL'+d,'payload':JSON['stringify']({'object':'0xL'+d})})),{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Demand',{},0x3);expect(b['items'])['toHaveLength'](0x3),expect(b['meta']['total_rows'])['toBe'](0x5);});});
1
+ import{describe,it,expect,beforeAll,afterAll}from'vitest';import*as a283a from'node:fs';import*as a283b from'node:os';import*as a283c from'node:path';import{projectionUpsert,projectionServe,projectionStats,__projectionSetWriteClock}from'./projection.js';const SCRATCH_DB=a283c['join'](a283b['tmpdir'](),'wowok-projection-spec-'+process['pid']+'-'+Date['now']()+'.db'),PREV_DB=process['env']['WOWOK_PROJECTION_DB'],PREV_TTL=process['env']['WOWOK_PROJECTION_TTL_MS'];beforeAll(()=>{process['env']['WOWOK_PROJECTION_DB']=SCRATCH_DB,process['env']['WOWOK_PROJECTION_TTL_MS']='120000',__projectionSetWriteClock(0x0);}),afterAll(()=>{if(PREV_DB===undefined)delete process['env']['WOWOK_PROJECTION_DB'];else process['env']['WOWOK_PROJECTION_DB']=PREV_DB;if(PREV_TTL===undefined)delete process['env']['WOWOK_PROJECTION_TTL_MS'];else process['env']['WOWOK_PROJECTION_TTL_MS']=PREV_TTL;__projectionSetWriteClock(undefined);try{a283a['rmSync'](SCRATCH_DB,{'force':!![]}),a283a['rmSync'](SCRATCH_DB+'-wal',{'force':!![]}),a283a['rmSync'](SCRATCH_DB+'-shm',{'force':!![]});}catch{}});function svcRow(a,b={}){const {payloadJson:c,...d}=b;return{'object_id':a,'payload':JSON['stringify']({'object':a,...c??{}}),...d};}describe('projection\x20cache\x20(K5\x20doc\x2017\x20B-tier)',()=>{it('returns\x20undefined\x20without\x20a\x20watermark\x20(never\x20fabricates\x20coverage)',()=>{const a=projectionServe('chain-empty-proj','Service',{},0xc8);expect(a)['toBeUndefined'](),expect(projectionStats('chain-empty-proj')['every'](b=>b['rows']===0x0))['toBe'](!![]);}),it('serves\x20a\x20fresh\x20projection\x20with\x20SQL\x20filters\x20and\x20pre-filter\x20totals',()=>{const a='chain-proj-serve',b=[svcRow('0xa1',{'name':'Alpha\x20Music','location':'Shanghai,\x20CN','coin_type':'0x2::wow::WOW','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa1','name':'Alpha\x20Music','location':'Shanghai,\x20CN'}}),svcRow('0xa2',{'name':'Beta\x20Design','location':'Beijing,\x20CN','coin_type':'0x2::wow::WOW','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa2','name':'Beta\x20Design','location':'Beijing,\x20CN'}}),svcRow('0xa3',{'name':'Gamma\x20Food','location':'Shanghai,\x20CN','coin_type':'0x2::sui::SUI','published':0x1,'paused':0x0,'payloadJson':{'object':'0xa3','name':'Gamma\x20Food','location':'Shanghai,\x20CN'}})];projectionUpsert(a,'Service',b,{'hasMore':![],'maxObjects':0xc8});const c=projectionServe(a,'Service',{},0xc8);expect(c)['toBeDefined'](),expect(c['items'])['toHaveLength'](0x3),expect(c['meta']['total_rows'])['toBe'](0x3),expect(c['meta']['watermark']['has_more'])['toBe'](0x0),expect(c['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa2','0xa3']);const d=projectionServe(a,'Service',{'coin_type':'0x2::wow::WOW'},0xc8);expect(d['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa2']),expect(d['meta']['total_rows'])['toBe'](0x3);const e=projectionServe(a,'Service',{'name_contains':'beta'},0xc8);expect(e['items']['map'](h=>h['object']))['toEqual'](['0xa2']);const f=projectionServe(a,'Service',{'location_any':['shanghai']},0xc8);expect(f['items']['map'](h=>h['object'])['sort']())['toEqual'](['0xa1','0xa3']);const g=projectionServe(a,'Service',{'location_any':['paris']},0xc8);expect(g['items'])['toHaveLength'](0x0),expect(g['meta']['total_rows'])['toBe'](0x3),expect(projectionStats(a)['find'](h=>h['kind']==='Service')?.['rows'])['toBe'](0x3),expect(projectionStats(a)['find'](h=>h['kind']==='Service')?.['refreshed_at'])['toBeGreaterThan'](0x0);}),it('upserts\x20cumulatively:\x20rows\x20update\x20in\x20place\x20and\x20accumulate\x20across\x20windows',()=>{const a='chain-proj-cumulative';projectionUpsert(a,'Demand',[{'object_id':'0xd1','payload':JSON['stringify']({'object':'0xd1','description':'v1'})}],{'hasMore':!![],'maxObjects':0xc8}),projectionUpsert(a,'Demand',[{'object_id':'0xd1','payload':JSON['stringify']({'object':'0xd1','description':'v2'})},{'object_id':'0xd2','payload':JSON['stringify']({'object':'0xd2','description':'new'})}],{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Demand',{},0xc8);expect(b['items'])['toHaveLength'](0x2);const c=b['items']['find'](d=>d['object']==='0xd1');expect(c?.['description'])['toBe']('v2'),expect(b['meta']['watermark']['has_more'])['toBe'](0x0);}),it('declines\x20to\x20serve\x20when\x20stale\x20by\x20TTL',async()=>{const a='chain-proj-stale-ttl',b=process['env']['WOWOK_PROJECTION_TTL_MS'];process['env']['WOWOK_PROJECTION_TTL_MS']='20';try{projectionUpsert(a,'Service',[svcRow('0xs1')],{'hasMore':![],'maxObjects':0xc8}),expect(projectionServe(a,'Service',{},0xc8))['toBeDefined'](),await new Promise(c=>setTimeout(c,0x28)),expect(projectionServe(a,'Service',{},0xc8))['toBeUndefined']();}finally{process['env']['WOWOK_PROJECTION_TTL_MS']=b;}}),it('declines\x20to\x20serve\x20when\x20a\x20local\x20on-chain\x20write\x20postdates\x20the\x20watermark',()=>{const a='chain-proj-stale-write';projectionUpsert(a,'Service',[svcRow('0xs2')],{'hasMore':![],'maxObjects':0xc8}),__projectionSetWriteClock(Date['now']()+0x1);try{expect(projectionServe(a,'Service',{},0xc8))['toBeUndefined']();}finally{__projectionSetWriteClock(0x0);}}),it('filters\x20arb\x20payloads\x20post-SQL\x20for\x20parity\x20with\x20the\x20legacy\x20post-hydration\x20filter',()=>{const a='chain-proj-arb';projectionUpsert(a,'Arb',[{'object_id':'0xb1','payload':JSON['stringify']({'object':'0xb1','arbitration':'0xarb1','order':'0xo1','status':0x2})},{'object_id':'0xb2','payload':JSON['stringify']({'object':'0xb2','arbitration':'0xarb1','order':'0xo2','status':0x5})},{'object_id':'0xb3','payload':JSON['stringify']({'object':'0xb3','arbitration':'0xarb2','order':'0xo1','status':0x2})}],{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Arb',{'arbitration':'0xarb1'},0xc8);expect(b['items']['map'](f=>f['object'])['sort']())['toEqual'](['0xb1','0xb2']),expect(b['meta']['total_rows'])['toBe'](0x3);const c=projectionServe(a,'Arb',{'order':'0xo1'},0xc8);expect(c['items']['map'](f=>f['object'])['sort']())['toEqual'](['0xb1','0xb3']);const d=projectionServe(a,'Arb',{'status':[0x5]},0xc8);expect(d['items']['map'](f=>f['object']))['toEqual'](['0xb2']);const e=projectionServe(a,'Arb',{'arbitration':'0xarb2','status':[0x5]},0xc8);expect(e['items'])['toHaveLength'](0x0);}),it('respects\x20the\x20limit\x20on\x20the\x20SQL\x20path',()=>{const a='chain-proj-limit';projectionUpsert(a,'Demand',Array['from']({'length':0x5},(c,d)=>({'object_id':'0xL'+d,'payload':JSON['stringify']({'object':'0xL'+d})})),{'hasMore':![],'maxObjects':0xc8});const b=projectionServe(a,'Demand',{},0x3);expect(b['items'])['toHaveLength'](0x3),expect(b['meta']['total_rows'])['toBe'](0x5);});});
@@ -1,4 +1,4 @@
1
- export type IndustryModeName = "freelance" | "rental" | "education" | "travel" | "subscription" | "retail" | "licensing" | "crowdfunding" | "general";
1
+ export type IndustryModeName = "freelance" | "rental" | "education" | "travel" | "subscription" | "retail" | "licensing" | "crowdfunding" | "delivery" | "group_buy" | "general";
2
2
  export interface ScenarioTraits {
3
3
  has_logistics: boolean;
4
4
  communication_heavy: boolean;
@@ -14,6 +14,7 @@ export interface ModeAllocatorRow {
14
14
  mode: "amount" | "rate" | "surplus";
15
15
  value?: string | number;
16
16
  value_from?: string;
17
+ value_from_complement?: string;
17
18
  fix?: string | number;
18
19
  fix_from?: string;
19
20
  guard_key?: string;
@@ -39,6 +40,9 @@ export interface ModeGuardRef {
39
40
  description?: string;
40
41
  id_from?: string;
41
42
  value_type?: string;
43
+ id_from_submission?: string;
44
+ data_from_submission?: number;
45
+ write_once?: boolean;
42
46
  };
43
47
  params?: Record<string, unknown>;
44
48
  }
@@ -46,6 +50,7 @@ export interface ModeMachineNode {
46
50
  name: string;
47
51
  role: string;
48
52
  operator?: "merchant" | "order_payer";
53
+ named_operator?: string;
49
54
  semantic_role?: "draft" | "active" | "delivered" | "final" | "cancelled";
50
55
  optional?: boolean;
51
56
  threshold?: number;
@@ -55,6 +60,7 @@ export interface ModeMachineEdge {
55
60
  prev: string;
56
61
  forward?: string;
57
62
  operator?: "merchant" | "order_payer";
63
+ named_operator?: string;
58
64
  permission_index?: number;
59
65
  guard_key?: string;
60
66
  }
@@ -89,4 +95,4 @@ export declare function getScenarioMode(name: IndustryModeName): ScenarioMode |
89
95
  export declare function listScenarioModes(): ScenarioMode[];
90
96
  export declare function getShippedModes(): ScenarioMode[];
91
97
  export declare function getModeCompositions(name: IndustryModeName): ModeComposition[];
92
- export declare const SCENARIO_MODES_VERSION = 9;
98
+ export declare const SCENARIO_MODES_VERSION = 10;
@@ -1 +1 @@
1
- export const BUYER_ACTION_NODE_RE=/^(reviewed|return_requested|guest_cancelled|withdrawn|charging|cancelled|closed_cancel)$/i;export function unannotatedBuyerActionNodes(a){return a['filter'](b=>!b['operator']&&BUYER_ACTION_NODE_RE['test'](b['name']))['map'](b=>b['name']);}export const SCENARIO_MODES=[{'name':'freelance','phase':0x1,'industry':'Design\x20/\x20dev\x20/\x20consulting\x20/\x20writing','trust_pattern':'Milestone\x20allocation,\x20acceptance\x20gate','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'freelance/enterprise-talent-market','key_risk':'Customer\x20never\x20accepts\x20delivery\x20—\x20provider\x20cannot\x20get\x20paid','build_notes':['Use\x20Service\x20`setting_lock_duration`\x20to\x20lock\x20rules\x20for\x20the\x20engagement\x20duration','WIP\x20hash\x20on\x20every\x20milestone\x20deliverable\x20is\x20mandatory\x20—\x20protects\x20provider\x20in\x20disputes','Acceptance\x20gate\x20is\x20the\x20trust\x20pivot\x20—\x20both\x20parties\x20must\x20agree\x20on\x20criteria\x20per\x20milestone','Milestones\x20map\x20to\x20deliverable-Guarded\x20forwards;\x20each\x20accepted\x20milestone\x20releases\x20its\x20escrowed\x20slice\x20(allocation.distribute_milestone)','Scope\x20changes\x20are\x20recorded\x20as\x20WTS\x20change-requests\x20at\x20kickoff/throughout\x20—\x20never\x20silent','R-M1-11:\x20no\x20\x27refunded\x27/\x27disputed\x27/\x27arb\x27/\x27cancelled\x27\x20nodes\x20—\x20refunds\x20route\x20via\x20Allocator\x20(to\x20OrderHolder)\x20triggered\x20by\x20\x27closed_cancel\x27,\x20disputes\x20via\x20Arbitration','Payment\x20exception\x20compensation\x20for\x20delivery\x20delays\x20—\x20provider\x20Treasury\x20auto-compensates\x20customer\x20(§2.13)','Project-Catalog\x20orders\x20have\x20NO\x20milestones\x20(single\x20funded\x20order\x20+\x20steps\x20timeline);\x20milestones\x20here\x20model\x20fixed-price\x20CONTRACTS.\x20For\x20catalog-style\x20listings\x20(tiered\x20pricing\x20+\x20add-ons\x20+\x20buyer\x20requirements)\x20use\x20the\x20freelance/catalog-tiers\x20template\x20instead','Time-bound\x20catalog\x20rules\x20(24h\x20instant\x20cancel,\x2048h\x20requirements\x20timeout,\x2014-day\x20auto-accept)\x20need\x20a\x20time\x20Guard\x20PLUS\x20an\x20off-chain\x20keeper\x20per\x20window\x20-\x20Guards\x20take\x20an\x20immutable\x20duration\x20constant']},{'name':'rental','phase':0x1,'industry':'Equipment\x20/\x20vehicle\x20/\x20property\x20rental','trust_pattern':'Deposit\x20escrow,\x20return\x20inspection','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'rental/institutional-longstay','key_risk':'Owner\x20claims\x20damage\x20without\x20pre-rental\x20WIP\x20—\x20customer\x20loses\x20deposit\x20unfairly','build_notes':['Pre-rental\x20WIP\x20is\x20non-negotiable\x20—\x20without\x20it,\x20damage\x20claims\x20fail','Deposit\x20must\x20be\x20escrowed,\x20not\x20direct-transferred\x20—\x20enables\x20fair\x20deduction','Inspection\x20gate\x20prevents\x20customer\x20from\x20denying\x20damage','Overdue\x20handling\x20uses\x20a\x20time-lock\x20Guard\x20(clock)\x20—\x20the\x20Guard\x20only\x20ALLOWS\x20the\x20overdue\x20transition;\x20automatic\x20advancement\x20needs\x20an\x20off-chain\x20keeper\x20(see\x20DESIGN-REVIEW\x20C-3)','Extensions\x20are\x20modeled\x20as\x20separate\x20sub-orders\x20(REUSE\x20pattern),\x20not\x20as\x20machine\x20cycles\x20—\x20an\x20in-order\x20loop\x20replays\x20its\x20forwards\x27\x20fund\x20rails\x20every\x20lap','R-M1-11:\x20no\x20\x27deposit_refunded\x27/\x27deposit_deducted\x27/\x27refunded\x27\x20nodes\x20—\x20deposit\x20refund/deduction\x20flows\x20through\x20Allocator\x20triggered\x20by\x20return_approved/damage_confirmed\x20business\x20states','Payment\x20exception\x20compensation\x20for\x20return\x20delays\x20—\x20Treasury\x20withdraws\x20scene-bound\x20Payment\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/usage\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'education','phase':0x2,'industry':'Courses\x20/\x20training\x20/\x20tutoring','trust_pattern':'Periodic\x20release\x20per\x20session,\x20attendance\x20Guard','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'education/live-class-cohort','key_risk':'Tutoring\x20institutions\x20run\x20away\x20with\x20prepaid\x20tuition','build_notes':['Use\x20Service\x20`setting_lock_duration`\x20to\x20lock\x20rules\x20for\x20the\x20entire\x20term\x20(regulatory\x20compliance,\x20>=90d)','Attendance\x20Guard\x20needs\x20WIP\x20hash\x20for\x20session\x20content\x20commitment;\x20attendance\x20evidence\x20lives\x20in\x20the\x20class\x20Repository','Per-session\x20release\x20requires\x20threshold-based\x20trigger\x20—\x20each\x20attended\x20session\x20releases\x201/N','session_1..session_3\x20are\x20representative\x20—\x20configure\x20the\x20real\x20session\x20count\x20(session_N)\x20at\x20build\x20time;\x20each\x20session\x20=\x20one\x20attendance-Guarded\x20forward','Pause/deferral\x20is\x20a\x20terminal\x20node\x20+\x20new\x20sub-order\x20(REUSE\x20pattern)\x20—\x20never\x20a\x20loop\x20back\x20into\x20the\x20session\x20chain\x20(a\x20loop\x20replays\x20the\x20session\x20forwards\x27\x20fund\x20rails\x20every\x20lap;\x20if\x20a\x20loop\x20is\x20unavoidable\x20it\x20must\x20keep\x20a\x20cycle-breaking\x20exit)','Supply\x20chain\x20sub-orders\x20for\x20course\x20module\x20progressive\x20unlock\x20—\x20each\x20module\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20previous\x20module\x20completion\x20(§2.12)','Repository\x20for\x20learning\x20progress\x20collaboration\x20data\x20—\x20progress\x20as\x20key,\x20session\x20data\x20as\x20value\x20(§2.10)']},{'name':'travel','phase':0x2,'industry':'Custom\x20tours\x20/\x20multi-segment\x20trips','trust_pattern':'Multi-tier\x20allocation\x20per\x20segment','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'travel/destination-experience','key_risk':'Paid\x20in\x20full\x20then\x20service\x20shrinks\x20—\x20multi-tier\x20transparency\x20prevents\x20this','build_notes':['Multi-tier\x20Allocation\x20is\x20WoWok\x27s\x20unique\x20advantage\x20over\x20traditional\x20travel\x20platforms','segment_guard\x20needs\x20standardized\x20WIP\x20templates\x20per\x20segment\x20type\x20(hotel,\x20transport,\x20activity)','Multi-tier\x20waterfall\x20needs\x20guard\x20chaining\x20validation','Weather/force-majeure\x20branches\x20enter\x20reschedule\x20(terminal)\x20or\x20partial-refund\x20interrupted\x20terminal\x20—\x20never\x20loop\x20back\x20into\x20the\x20segment\x20chain\x20(a\x20loop\x20replays\x20the\x20segment\x20forwards\x27\x20fund\x20rails\x20every\x20lap;\x20if\x20a\x20loop\x20is\x20unavoidable\x20it\x20must\x20keep\x20a\x20cycle-breaking\x20exit)','Supplier\x20sub-orders\x20each\x20carry\x20their\x20own\x20machine\x20—\x20hotel/guide/driver\x20fulfill\x20independently\x20(§2.12)','Supply\x20chain\x20sub-orders\x20—\x20each\x20tour\x20segment\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20main\x20tour\x20order\x20(§2.12)','Payment\x20exception\x20compensation\x20for\x20flight/segment\x20delays\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/travel\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'subscription','phase':0x3,'industry':'SaaS\x20/\x20content\x20membership\x20/\x20periodic\x20service','trust_pattern':'Periodic\x20charge,\x20cancel\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'subscription/creator-membership','key_risk':'Auto-renew\x20trap\x20and\x20platform-takes-30%\x20—\x20WoWok\x20native\x20solution','build_notes':['Pure\x20digital\x20—\x20native\x20WoWok\x20soil','charge_guard\x20needs\x20periodic\x20trigger\x20(off-chain\x20scheduler\x20+\x20on-chain\x20Guard)','Renewal\x20is\x20an\x20explicit\x20buyer-side\x20forward\x20(or\x20a\x20Guard-gated\x20auto-renew\x20WITH\x20WTS\x20notice)\x20—\x20never\x20silent','Cancellation\x20is\x20frictionless\x20and\x20next-period\x20effective;\x20pro-rata\x20refund\x20for\x20unearned\x20periods','Forbid\x20dead-end\x20nodes\x20(prevent\x20lock-in);\x20every\x20state\x20must\x20have\x20a\x20forward\x20or\x20be\x20an\x20intended\x20terminal','Targets\x20indie\x20creators,\x20niche\x20SaaS,\x20paid\x20newsletters','Repository\x20quote_guard\x20for\x20creator\x20data\x20subscription\x20revenue\x20—\x20creators\x20publish\x20paid\x20data,\x20users\x20pay\x20to\x20access\x20(§2.11)']},{'name':'retail','phase':0x1,'industry':'Goods\x20retail\x20/\x20marketplace\x20/\x20e-commerce','trust_pattern':'Escrow\x20+\x20confirm-on-receipt\x20release','traits':{'has_logistics':!![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'retail/scale-marketplace','key_risk':'Products\x20don\x27t\x20match\x20description\x20—\x20no\x20refund\x20path\x20for\x20returns','build_notes':['Logistics\x20WIP\x20(tracking\x20number)\x20is\x20essential\x20—\x20shipping\x20evidence\x20protects\x20both\x20parties\x20in\x20return\x20disputes','Confirm\x20gate\x20prevents\x20merchant\x20from\x20self-confirming\x20receipt','Refund\x20path\x20must\x20support\x20return-and-exchange\x20flow;\x20refund_window\x20>=\x207d','Return\x20request\x20is\x20time-lock\x20gated\x20—\x20after\x20the\x20window\x20closes,\x20returns\x20need\x20merchant\x20permission\x20or\x20arbitration','Compensation\x20fund\x20covers\x20return/exchange\x20disputes','R-M1-11:\x20no\x20\x27refunded\x27\x20node\x20—\x20refunds\x20route\x20via\x20Allocator\x20triggered\x20by\x20returned/cancelled\x20business\x20states;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'licensing','phase':0x1,'industry':'IP\x20/\x20royalty\x20licensing\x20/\x20metered\x20asset\x20licenses','trust_pattern':'Terms\x20hash-anchored,\x20on-chain\x20royalty\x20split,\x20territory/term\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':!![]},'default_template':'licensing/royalty-stream-auction','key_risk':'Buyer\x20trusts\x20the\x20seller\x27s\x20royalty/usage\x20reporting\x20—\x20without\x20an\x20on-chain\x20meter\x20the\x20accounting\x20honesty\x20is\x20only\x20as\x20good\x20as\x20the\x20attestation\x20and\x20the\x20compensation\x20backstop','build_notes':['Anchor\x20the\x20license\x20terms\x20(territory,\x20term,\x20media,\x20caps,\x20exclusivity)\x20as\x20a\x20WIP\x20hash\x20—\x20the\x20granted\x20rights\x20must\x20be\x20provable\x20in\x20a\x20dispute,\x20not\x20prose','Royalty\x20/\x20purchase-proceeds\x20split\x20is\x20an\x20Allocation\x20Rate\x20plan\x20(bps\x20summing\x20to\x2010000\x20across\x20rights-holders\x20+\x20platform);\x20the\x20split\x20is\x20frozen\x20at\x20publish\x20and\x20auditable\x20by\x20every\x20recipient','Recurring\x20royalty:\x20the\x20Allocation\x20pool\x20is\x20re-fillable\x20(order_renew\x20top-ups)\x20and\x20a\x20guard-keyed\x20periodic\x20alloc\x20with\x20a\x20period-N\x20once-key\x20(identifier\x20255)\x20releases\x20each\x20period\x20—\x20payroll-style\x20repeat\x20runs\x20stay\x20possible\x20without\x20the\x20once-slot','Territory\x20is\x20enforced\x20by\x20a\x20Service\x20buy_guard\x20running\x20pattern.identity_check_allowlist\x20(allowlist\x20as\x20an\x20Address-vector\x20table\x20constant);\x20term\x20/\x20inspection\x20window\x20is\x20a\x20tpl_time_lock_progress\x20forward\x20guard\x20(Clock\x20>=\x20entry_time\x20+\x20duration)','Time-lock\x20duration\x20is\x20an\x20IMMUTABLE\x20table\x20constant\x20fixed\x20at\x20publish\x20—\x20an\x20expired\x20window\x20only\x20BLOCKS\x20the\x20forward,\x20it\x20never\x20auto-refunds;\x20automatic\x20advancement\x20on\x20timeout\x20needs\x20an\x20off-chain\x20keeper','🔴\x20AUCTION\x20GAP:\x20there\x20is\x20NO\x20on-chain\x20ascending-auction\x20/\x20bid-ledger\x20/\x20highest-bidder\x20primitive.\x20Model\x20a\x20competitive\x20sale\x20as:\x20winner\x20resolved\x20OFF-CHAIN\x20(prose),\x20then\x20the\x20winner\x20calls\x20buy\x20like\x20any\x20buyer\x20—\x20optionally\x20gate\x20buy\x20with\x20an\x20allowlist\x20guard\x20carrying\x20the\x20attested\x20winner\x20address.\x20Never\x20claim\x20the\x20chain\x20runs\x20the\x20auction','🔴\x20METERED-CAPS\x20GAP:\x20there\x20is\x20NO\x20usage\x20oracle/meter.\x20A\x20\x27limited\x20to\x20N\x20streams/sales\x27\x20cap\x20can\x20only\x20be\x20an\x20ATTESTED\x20Repository\x20counter\x20that\x20a\x20forward\x20guard\x20reads\x20via\x20the\x20repository.data\x20count-where\x20query\x20—\x20the\x20count\x20is\x20only\x20as\x20trustworthy\x20as\x20its\x20write-guard\x20(self/attested),\x20never\x20an\x20oracle\x20feed.\x20Disclose\x20this\x20honestly;\x20never\x20present\x20a\x20cap\x20as\x20chain-enforced\x20metering','R-M1-11:\x20no\x20\x27refunded\x27/\x27cancelled\x27\x20fund\x20terminals\x20—\x20refunds\x20route\x20via\x20the\x20Allocator\x20triggered\x20by\x20a\x20business\x20state\x20(e.g.\x20inspection_failed);\x20disputes\x20go\x20to\x20Arbitration']},{'name':'crowdfunding','phase':0x1,'industry':'All-or-nothing\x20threshold\x20campaigns\x20/\x20flexible\x20keep-it-all\x20fundraising','trust_pattern':'Per-contributor\x20escrow\x20(unpooled)\x20+\x20on-chain\x20aggregate\x20threshold\x20+\x20deadline\x20two-leg\x20release/refund','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'crowdfunding/all-or-nothing-threshold','key_risk':'The\x20funding\x20threshold\x20is\x20an\x20aggregate\x20read\x20over\x20a\x20shared\x20campaign\x20ledger\x20—\x20each\x20contribution\x20row\x20is\x20writer-bound\x20to\x20its\x20funder,\x20but\x20the\x20aggregate\x20is\x20a\x20read-only\x20sum\x20of\x20declared\x20rows,\x20not\x20an\x20independent\x20re-computation\x20of\x20every\x20escrow;\x20roster\x20completeness\x20is\x20keeper-attested.\x20Funders\x20also\x20trust\x20eventual\x20project\x20delivery,\x20backed\x20only\x20by\x20compensation_fund\x20+\x20arbitration','build_notes':['Per-contributor\x20escrow,\x20NEVER\x20pooled:\x20each\x20funder\x27s\x20Order\x20holds\x20its\x20OWN\x20Allocation\x20with\x20payment_info.for_object\x20bound\x20to\x20that\x20Order\x20—\x20because\x20the\x20money\x20is\x20never\x20balance::join-ed\x20into\x20one\x20pot,\x20attribution\x20survives\x20and\x20each\x20contribution\x20is\x20refundable\x20to\x20its\x20own\x20funder','Threshold\x20gate\x20=\x20an\x20on-chain\x20aggregate:\x20a\x20shared\x20campaign\x20Repository\x20holds\x20one\x20numeric\x20row\x20per\x20contribution\x20(keyed\x20by\x20the\x20contribution,\x20tagged\x20with\x20a\x20campaign\x20id);\x20the\x20settlement\x20Guard\x20reads\x20it\x20back\x20with\x20the\x20repository.data\x20sum-where\x20query\x20(1174\x20→\x20U256,\x20overflow-safe)\x20and\x20compares\x20against\x20the\x20threshold\x20constant','Write-side\x20binding\x20is\x20MANDATORY:\x20contribution\x20rows\x20are\x20written\x20under\x20pattern.repository_write_authorization\x20with\x20an\x20identity\x20leaf\x20(order.owner\x20==\x20Signer\x20/\x20order.agent\x20has\x20Signer)\x20so\x20a\x20funder\x20can\x20only\x20record\x20their\x20OWN\x20contribution\x20—\x20existence-is-not-trust\x20(R-X1-17),\x20an\x20unbound\x20write_guard\x20makes\x20the\x20aggregate\x20forgeable','Deadline\x20=\x20a\x20time-lock:\x20both\x20settlement\x20legs\x20require\x20Clock\x20>=\x20deadline\x20via\x20pattern.time_lock_progress\x20(query\x201280,\x20node-ENTRY\x20anchored);\x20BEFORE\x20the\x20deadline\x20a\x20funder\x20may\x20withdraw\x20(buyer-self-service\x20withdrawn\x20rail:\x20removes\x20their\x20writer-bound\x20row\x20+\x20full\x20refund\x20—\x20A12\x20fix,\x20was\x20wrongly\x20\x27no\x20early\x20withdrawal\x27);\x20AFTER\x20the\x20deadline\x20funds\x20are\x20committed\x20to\x20the\x20threshold\x20outcome','Two-leg\x20escrow\x20exit\x20(D-BUG-2\x20polarity):\x20release\x20leg\x20(→\x20project\x20Entity)\x20gated\x20logic_and[sum_where\x20>=\x20threshold,\x20clock\x20>=\x20deadline];\x20refund\x20leg\x20(→\x20for_object,\x20the\x20funder\x27s\x20own\x20Order)\x20gated\x20logic_and[sum_where\x20<\x20threshold,\x20clock\x20>=\x20deadline]\x20—\x20mutually\x20exclusive\x20on\x20the\x20aggregate\x20comparison,\x20so\x20exactly\x20one\x20is\x20satisfiable\x20once\x20the\x20deadline\x20passes','Keeper\x20batch\x20settlement:\x20on\x20a\x20missed\x20campaign\x20a\x20keeper\x20enumerates\x20every\x20contributor\x20via\x20repository.data\x20find-where\x20(1176\x20→\x20VectorAddress)\x20/\x20keys-where\x20(1177\x20→\x20VectorString)\x20and\x20advances\x20each\x20funder\x27s\x20refund\x20leg\x20in\x20one\x20PTB\x20(or\x20N\x20PTBs)\x20—\x20an\x20ops\x20efficiency,\x20not\x20a\x20chain\x20capability','🔴\x20AGGREGATE\x20TRUST\x20BOUNDARY:\x20the\x20sum\x20is\x20only\x20as\x20honest\x20as\x20the\x20writer-bound\x20rows;\x20it\x20is\x20NOT\x20independently\x20re-derivable\x20on-chain\x20without\x20reading\x20every\x20escrow\x20balance.\x20Disclose\x20this\x20honestly\x20(L-04);\x20never\x20present\x20the\x20threshold\x20as\x20a\x20chain-verified\x20total-custody\x20proof','🔴\x20L-01\x20NON-INVESTMENT:\x20crowdfunding\x20copy\x20must\x20never\x20promise\x20investment\x20returns,\x20yield,\x20or\x20token-price\x20appreciation\x20—\x20it\x20is\x20a\x20threshold\x20purchase/preorder/donation,\x20not\x20a\x20security','🔴\x20L-05\x20KYC/AML:\x20pooled\x20fundraising\x20is\x20high\x20regulatory\x20intensity\x20—\x20cross-border\x20funds\x20and\x20reward\x20tiers\x20may\x20trigger\x20securities/money-transmission\x20rules;\x20flag\x20for\x20compliance,\x20do\x20not\x20automate\x20around\x20them','R-M1-11:\x20no\x20\x27refunded\x27/\x27cancelled\x27\x20fund\x20terminals\x20—\x20the\x20refund\x20leg\x20routes\x20via\x20the\x20Allocator\x20triggered\x20by\x20the\x20missed-threshold\x20business\x20state\x20at\x20deadline;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'general','phase':0x1,'industry':'Anything\x20not\x20covered\x20/\x20hybrid','trust_pattern':'User-defined\x20from\x20scratch','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':null,'key_risk':'No\x20safety\x20net\x20—\x20user\x20must\x20design\x20all\x20trust\x20mechanisms\x20manually','build_notes':['Escape\x20hatch:\x20any\x20user\x20can\x20switch\x20to\x20general\x20mode\x20at\x20any\x20time','Already-created\x20objects\x20under\x20a\x20previous\x20mode\x20remain\x20on-chain\x20(REUSE\x20pattern)','wowok-machine\x20/\x20wowok-guard\x20/\x20wowok-provider\x20become\x20primary\x20references']}];export function matchScenarioMode(a){const b=a['toLowerCase'](),c=inferScenarioTraits(a),e=SCENARIO_MODES['map'](h=>{let i=0x0,j=0x0;for(const k of Object['keys'](c)){j+=0x1;if(h['traits'][k]===c[k])i+=0x1;}if(h['name']!=='general'){const l=MODE_KEYWORDS[h['name']]??[];for(const m of l){if(b['includes'](m))i+=0.5;}}return{'mode':h,'score':i,'total':j};});let f=e[0x0];for(const h of e){if(h['score']>f['score'])f=h;}const g=f['total']>0x0?Math['min'](0x1,f['score']/f['total']):0x0;return{'mode':f['mode'],'confidence':g};}const MODE_KEYWORDS={'freelance':['freelance','design','develop','consult','write','consulting'],'rental':['rent','rental','lease','borrow','equipment','vehicle','property'],'education':['course','training','tutor','teach','education','class'],'travel':['tour','travel','trip','itinerary','vacation'],'subscription':['subscribe','subscription','membership','saas','newsletter','recurring'],'retail':['retail','shop','store','marketplace','sell\x20goods','ecommerce','e-commerce'],'licensing':['license','licensing','royalty','royalties','ip','intellectual\x20property','music\x20rights','sync','beat','franchise','rights'],'crowdfunding':['crowdfunding','crowdfund','fundraising','pledge','backer','kickstarter','campaign','all-or-nothing','threshold\x20goal','presale\x20campaign','raise\x20funds']};export function inferScenarioTraits(a){const b=a['toLowerCase']();return{'has_logistics':/ship|delivery|equipment|vehicle|physical|goods/['test'](b),'communication_heavy':/consult|discuss|back-and-forth|custom|bespoke|negotiate/['test'](b),'pure_digital':/digital|file|download|online|software|code|design|content/['test'](b),'long_cycle':/month|long-term|engagement|project|semester|period/['test'](b),'deposit_required':/deposit|escrow|prepay|tuition|reserve/['test'](b),'multi_tier_allocation':/tier|segment|multi-|agency|hotel|guide|driver/['test'](b)};}export const MODE_COMPOSITIONS=[{'modes':['freelance','subscription'],'use_case':'Retainer\x20consulting\x20(monthly\x20+\x20milestone)','conflict_resolution':'Allocator:\x20split\x20into\x20retainer\x20(subscription)\x20+\x20milestone\x20(freelance)'},{'modes':['rental','education'],'use_case':'Equipment\x20training\x20rental','conflict_resolution':'Machine:\x20extend\x20rental\x20nodes\x20with\x20attendance\x20gates'},{'modes':['travel','rental'],'use_case':'Tour\x20with\x20equipment','conflict_resolution':'Allocator:\x20segment\x20allocation\x20+\x20deposit\x20escrow\x20side-by-side'}];export function getScenarioMode(a){return SCENARIO_MODES['find'](b=>b['name']===a);}export function listScenarioModes(){return SCENARIO_MODES;}export function getShippedModes(){return SCENARIO_MODES['filter'](a=>a['phase']===0x1);}export function getModeCompositions(a){return MODE_COMPOSITIONS['filter'](b=>b['modes']['includes'](a));}export const SCENARIO_MODES_VERSION=0x9;
1
+ export const BUYER_ACTION_NODE_RE=/^(reviewed|return_requested|guest_cancelled|withdrawn|charging|cancelled|closed_cancel)$/i;export function unannotatedBuyerActionNodes(a){return a['filter'](b=>!b['operator']&&BUYER_ACTION_NODE_RE['test'](b['name']))['map'](b=>b['name']);}export const SCENARIO_MODES=[{'name':'freelance','phase':0x1,'industry':'Design\x20/\x20dev\x20/\x20consulting\x20/\x20writing','trust_pattern':'Milestone\x20allocation,\x20acceptance\x20gate','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'freelance/enterprise-talent-market','key_risk':'Customer\x20never\x20accepts\x20delivery\x20—\x20provider\x20cannot\x20get\x20paid','build_notes':['Use\x20Service\x20`setting_lock_duration`\x20to\x20lock\x20rules\x20for\x20the\x20engagement\x20duration','WIP\x20hash\x20on\x20every\x20milestone\x20deliverable\x20is\x20mandatory\x20—\x20protects\x20provider\x20in\x20disputes','Acceptance\x20gate\x20is\x20the\x20trust\x20pivot\x20—\x20both\x20parties\x20must\x20agree\x20on\x20criteria\x20per\x20milestone','Milestones\x20map\x20to\x20deliverable-Guarded\x20forwards;\x20each\x20accepted\x20milestone\x20releases\x20its\x20escrowed\x20slice\x20(allocation.distribute_milestone)','Scope\x20changes\x20are\x20recorded\x20as\x20WTS\x20change-requests\x20at\x20kickoff/throughout\x20—\x20never\x20silent','R-M1-11:\x20no\x20\x27refunded\x27/\x27disputed\x27/\x27arb\x27/\x27cancelled\x27\x20nodes\x20—\x20refunds\x20route\x20via\x20Allocator\x20(to\x20OrderHolder)\x20triggered\x20by\x20\x27closed_cancel\x27,\x20disputes\x20via\x20Arbitration','Payment\x20exception\x20compensation\x20for\x20delivery\x20delays\x20—\x20provider\x20Treasury\x20auto-compensates\x20customer\x20(§2.13)','Project-Catalog\x20orders\x20have\x20NO\x20milestones\x20(single\x20funded\x20order\x20+\x20steps\x20timeline);\x20milestones\x20here\x20model\x20fixed-price\x20CONTRACTS.\x20For\x20catalog-style\x20listings\x20(tiered\x20pricing\x20+\x20add-ons\x20+\x20buyer\x20requirements)\x20use\x20the\x20freelance/catalog-tiers\x20template\x20instead','Time-bound\x20catalog\x20rules\x20(24h\x20instant\x20cancel,\x2048h\x20requirements\x20timeout,\x2014-day\x20auto-accept)\x20need\x20a\x20time\x20Guard\x20PLUS\x20an\x20off-chain\x20keeper\x20per\x20window\x20-\x20Guards\x20take\x20an\x20immutable\x20duration\x20constant']},{'name':'rental','phase':0x1,'industry':'Equipment\x20/\x20vehicle\x20/\x20property\x20rental','trust_pattern':'Deposit\x20escrow,\x20return\x20inspection','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'rental/institutional-longstay','key_risk':'Owner\x20claims\x20damage\x20without\x20pre-rental\x20WIP\x20—\x20customer\x20loses\x20deposit\x20unfairly','build_notes':['Pre-rental\x20WIP\x20is\x20non-negotiable\x20—\x20without\x20it,\x20damage\x20claims\x20fail','Deposit\x20must\x20be\x20escrowed,\x20not\x20direct-transferred\x20—\x20enables\x20fair\x20deduction','Inspection\x20gate\x20prevents\x20customer\x20from\x20denying\x20damage','Overdue\x20handling\x20uses\x20a\x20time-lock\x20Guard\x20(clock)\x20—\x20the\x20Guard\x20only\x20ALLOWS\x20the\x20overdue\x20transition;\x20automatic\x20advancement\x20needs\x20an\x20off-chain\x20keeper\x20(see\x20DESIGN-REVIEW\x20C-3)','Extensions\x20are\x20modeled\x20as\x20separate\x20sub-orders\x20(REUSE\x20pattern),\x20not\x20as\x20machine\x20cycles\x20—\x20an\x20in-order\x20loop\x20replays\x20its\x20forwards\x27\x20fund\x20rails\x20every\x20lap','R-M1-11:\x20no\x20\x27deposit_refunded\x27/\x27deposit_deducted\x27/\x27refunded\x27\x20nodes\x20—\x20deposit\x20refund/deduction\x20flows\x20through\x20Allocator\x20triggered\x20by\x20return_approved/damage_confirmed\x20business\x20states','Payment\x20exception\x20compensation\x20for\x20return\x20delays\x20—\x20Treasury\x20withdraws\x20scene-bound\x20Payment\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/usage\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'education','phase':0x2,'industry':'Courses\x20/\x20training\x20/\x20tutoring','trust_pattern':'Periodic\x20release\x20per\x20session,\x20attendance\x20Guard','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'education/live-class-cohort','key_risk':'Tutoring\x20institutions\x20run\x20away\x20with\x20prepaid\x20tuition','build_notes':['Use\x20Service\x20`setting_lock_duration`\x20to\x20lock\x20rules\x20for\x20the\x20entire\x20term\x20(regulatory\x20compliance,\x20>=90d)','Attendance\x20Guard\x20needs\x20WIP\x20hash\x20for\x20session\x20content\x20commitment;\x20attendance\x20evidence\x20lives\x20in\x20the\x20class\x20Repository','Per-session\x20release\x20requires\x20threshold-based\x20trigger\x20—\x20each\x20attended\x20session\x20releases\x201/N','session_1..session_3\x20are\x20representative\x20—\x20configure\x20the\x20real\x20session\x20count\x20(session_N)\x20at\x20build\x20time;\x20each\x20session\x20=\x20one\x20attendance-Guarded\x20forward','Pause/deferral\x20is\x20a\x20terminal\x20node\x20+\x20new\x20sub-order\x20(REUSE\x20pattern)\x20—\x20never\x20a\x20loop\x20back\x20into\x20the\x20session\x20chain\x20(a\x20loop\x20replays\x20the\x20session\x20forwards\x27\x20fund\x20rails\x20every\x20lap;\x20if\x20a\x20loop\x20is\x20unavoidable\x20it\x20must\x20keep\x20a\x20cycle-breaking\x20exit)','Supply\x20chain\x20sub-orders\x20for\x20course\x20module\x20progressive\x20unlock\x20—\x20each\x20module\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20previous\x20module\x20completion\x20(§2.12)','Repository\x20for\x20learning\x20progress\x20collaboration\x20data\x20—\x20progress\x20as\x20key,\x20session\x20data\x20as\x20value\x20(§2.10)']},{'name':'travel','phase':0x2,'industry':'Custom\x20tours\x20/\x20multi-segment\x20trips','trust_pattern':'Multi-tier\x20allocation\x20per\x20segment','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'travel/destination-experience','key_risk':'Paid\x20in\x20full\x20then\x20service\x20shrinks\x20—\x20multi-tier\x20transparency\x20prevents\x20this','build_notes':['Multi-tier\x20Allocation\x20is\x20WoWok\x27s\x20unique\x20advantage\x20over\x20traditional\x20travel\x20platforms','segment_guard\x20needs\x20standardized\x20WIP\x20templates\x20per\x20segment\x20type\x20(hotel,\x20transport,\x20activity)','Multi-tier\x20waterfall\x20needs\x20guard\x20chaining\x20validation','Weather/force-majeure\x20branches\x20enter\x20reschedule\x20(terminal)\x20or\x20partial-refund\x20interrupted\x20terminal\x20—\x20never\x20loop\x20back\x20into\x20the\x20segment\x20chain\x20(a\x20loop\x20replays\x20the\x20segment\x20forwards\x27\x20fund\x20rails\x20every\x20lap;\x20if\x20a\x20loop\x20is\x20unavoidable\x20it\x20must\x20keep\x20a\x20cycle-breaking\x20exit)','Supplier\x20sub-orders\x20each\x20carry\x20their\x20own\x20machine\x20—\x20hotel/guide/driver\x20fulfill\x20independently\x20(§2.12)','Supply\x20chain\x20sub-orders\x20—\x20each\x20tour\x20segment\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20main\x20tour\x20order\x20(§2.12)','Payment\x20exception\x20compensation\x20for\x20flight/segment\x20delays\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/travel\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'subscription','phase':0x3,'industry':'SaaS\x20/\x20content\x20membership\x20/\x20periodic\x20service','trust_pattern':'Periodic\x20charge,\x20cancel\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'subscription/creator-membership','key_risk':'Auto-renew\x20trap\x20and\x20platform-takes-30%\x20—\x20WoWok\x20native\x20solution','build_notes':['Pure\x20digital\x20—\x20native\x20WoWok\x20soil','charge_guard\x20needs\x20periodic\x20trigger\x20(off-chain\x20scheduler\x20+\x20on-chain\x20Guard)','Renewal\x20is\x20an\x20explicit\x20buyer-side\x20forward\x20(or\x20a\x20Guard-gated\x20auto-renew\x20WITH\x20WTS\x20notice)\x20—\x20never\x20silent','Cancellation\x20is\x20frictionless\x20and\x20next-period\x20effective;\x20pro-rata\x20refund\x20for\x20unearned\x20periods','Forbid\x20dead-end\x20nodes\x20(prevent\x20lock-in);\x20every\x20state\x20must\x20have\x20a\x20forward\x20or\x20be\x20an\x20intended\x20terminal','Targets\x20indie\x20creators,\x20niche\x20SaaS,\x20paid\x20newsletters','Repository\x20quote_guard\x20for\x20creator\x20data\x20subscription\x20revenue\x20—\x20creators\x20publish\x20paid\x20data,\x20users\x20pay\x20to\x20access\x20(§2.11)']},{'name':'retail','phase':0x1,'industry':'Goods\x20retail\x20/\x20marketplace\x20/\x20e-commerce','trust_pattern':'Escrow\x20+\x20confirm-on-receipt\x20release','traits':{'has_logistics':!![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'retail/scale-marketplace','key_risk':'Products\x20don\x27t\x20match\x20description\x20—\x20no\x20refund\x20path\x20for\x20returns','build_notes':['Logistics\x20WIP\x20(tracking\x20number)\x20is\x20essential\x20—\x20shipping\x20evidence\x20protects\x20both\x20parties\x20in\x20return\x20disputes','Confirm\x20gate\x20prevents\x20merchant\x20from\x20self-confirming\x20receipt','Refund\x20path\x20must\x20support\x20return-and-exchange\x20flow;\x20refund_window\x20>=\x207d','Return\x20request\x20is\x20time-lock\x20gated\x20—\x20after\x20the\x20window\x20closes,\x20returns\x20need\x20merchant\x20permission\x20or\x20arbitration','Compensation\x20fund\x20covers\x20return/exchange\x20disputes','R-M1-11:\x20no\x20\x27refunded\x27\x20node\x20—\x20refunds\x20route\x20via\x20Allocator\x20triggered\x20by\x20returned/cancelled\x20business\x20states;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'licensing','phase':0x1,'industry':'IP\x20/\x20royalty\x20licensing\x20/\x20metered\x20asset\x20licenses','trust_pattern':'Terms\x20hash-anchored,\x20on-chain\x20royalty\x20split,\x20territory/term\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':!![]},'default_template':'licensing/royalty-stream-auction','key_risk':'Buyer\x20trusts\x20the\x20seller\x27s\x20royalty/usage\x20reporting\x20—\x20without\x20an\x20on-chain\x20meter\x20the\x20accounting\x20honesty\x20is\x20only\x20as\x20good\x20as\x20the\x20attestation\x20and\x20the\x20compensation\x20backstop','build_notes':['Anchor\x20the\x20license\x20terms\x20(territory,\x20term,\x20media,\x20caps,\x20exclusivity)\x20as\x20a\x20WIP\x20hash\x20—\x20the\x20granted\x20rights\x20must\x20be\x20provable\x20in\x20a\x20dispute,\x20not\x20prose','Royalty\x20/\x20purchase-proceeds\x20split\x20is\x20an\x20Allocation\x20Rate\x20plan\x20(bps\x20summing\x20to\x2010000\x20across\x20rights-holders\x20+\x20platform);\x20the\x20split\x20is\x20frozen\x20at\x20publish\x20and\x20auditable\x20by\x20every\x20recipient','Recurring\x20royalty:\x20the\x20Allocation\x20pool\x20is\x20re-fillable\x20(order_renew\x20top-ups)\x20and\x20a\x20guard-keyed\x20periodic\x20alloc\x20with\x20a\x20period-N\x20once-key\x20(identifier\x20255)\x20releases\x20each\x20period\x20—\x20payroll-style\x20repeat\x20runs\x20stay\x20possible\x20without\x20the\x20once-slot','Territory\x20is\x20enforced\x20by\x20a\x20Service\x20buy_guard\x20running\x20pattern.identity_check_allowlist\x20(allowlist\x20as\x20an\x20Address-vector\x20table\x20constant);\x20term\x20/\x20inspection\x20window\x20is\x20a\x20tpl_time_lock_progress\x20forward\x20guard\x20(Clock\x20>=\x20entry_time\x20+\x20duration)','Time-lock\x20duration\x20is\x20an\x20IMMUTABLE\x20table\x20constant\x20fixed\x20at\x20publish\x20—\x20an\x20expired\x20window\x20only\x20BLOCKS\x20the\x20forward,\x20it\x20never\x20auto-refunds;\x20automatic\x20advancement\x20on\x20timeout\x20needs\x20an\x20off-chain\x20keeper','🔴\x20AUCTION\x20GAP:\x20there\x20is\x20NO\x20on-chain\x20ascending-auction\x20/\x20bid-ledger\x20/\x20highest-bidder\x20primitive.\x20Model\x20a\x20competitive\x20sale\x20as:\x20winner\x20resolved\x20OFF-CHAIN\x20(prose),\x20then\x20the\x20winner\x20calls\x20buy\x20like\x20any\x20buyer\x20—\x20optionally\x20gate\x20buy\x20with\x20an\x20allowlist\x20guard\x20carrying\x20the\x20attested\x20winner\x20address.\x20Never\x20claim\x20the\x20chain\x20runs\x20the\x20auction','🔴\x20METERED-CAPS\x20GAP:\x20there\x20is\x20NO\x20usage\x20oracle/meter.\x20A\x20\x27limited\x20to\x20N\x20streams/sales\x27\x20cap\x20can\x20only\x20be\x20an\x20ATTESTED\x20Repository\x20counter\x20that\x20a\x20forward\x20guard\x20reads\x20via\x20the\x20repository.data\x20count-where\x20query\x20—\x20the\x20count\x20is\x20only\x20as\x20trustworthy\x20as\x20its\x20write-guard\x20(self/attested),\x20never\x20an\x20oracle\x20feed.\x20Disclose\x20this\x20honestly;\x20never\x20present\x20a\x20cap\x20as\x20chain-enforced\x20metering','R-M1-11:\x20no\x20\x27refunded\x27/\x27cancelled\x27\x20fund\x20terminals\x20—\x20refunds\x20route\x20via\x20the\x20Allocator\x20triggered\x20by\x20a\x20business\x20state\x20(e.g.\x20inspection_failed);\x20disputes\x20go\x20to\x20Arbitration']},{'name':'crowdfunding','phase':0x1,'industry':'All-or-nothing\x20threshold\x20campaigns\x20/\x20flexible\x20keep-it-all\x20fundraising','trust_pattern':'Per-contributor\x20escrow\x20(unpooled)\x20+\x20on-chain\x20aggregate\x20threshold\x20+\x20deadline\x20two-leg\x20release/refund','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'crowdfunding/all-or-nothing-threshold','key_risk':'The\x20funding\x20threshold\x20is\x20an\x20aggregate\x20read\x20over\x20a\x20shared\x20campaign\x20ledger\x20—\x20each\x20contribution\x20row\x20is\x20writer-bound\x20to\x20its\x20funder,\x20but\x20the\x20aggregate\x20is\x20a\x20read-only\x20sum\x20of\x20declared\x20rows,\x20not\x20an\x20independent\x20re-computation\x20of\x20every\x20escrow;\x20roster\x20completeness\x20is\x20keeper-attested.\x20Funders\x20also\x20trust\x20eventual\x20project\x20delivery,\x20backed\x20only\x20by\x20compensation_fund\x20+\x20arbitration','build_notes':['Per-contributor\x20escrow,\x20NEVER\x20pooled:\x20each\x20funder\x27s\x20Order\x20holds\x20its\x20OWN\x20Allocation\x20with\x20payment_info.for_object\x20bound\x20to\x20that\x20Order\x20—\x20because\x20the\x20money\x20is\x20never\x20balance::join-ed\x20into\x20one\x20pot,\x20attribution\x20survives\x20and\x20each\x20contribution\x20is\x20refundable\x20to\x20its\x20own\x20funder','Threshold\x20gate\x20=\x20an\x20on-chain\x20aggregate:\x20a\x20shared\x20campaign\x20Repository\x20holds\x20one\x20numeric\x20row\x20per\x20contribution\x20(keyed\x20by\x20the\x20contribution,\x20tagged\x20with\x20a\x20campaign\x20id);\x20the\x20settlement\x20Guard\x20reads\x20it\x20back\x20with\x20the\x20repository.data\x20sum-where\x20query\x20(1174\x20→\x20U256,\x20overflow-safe)\x20and\x20compares\x20against\x20the\x20threshold\x20constant','Write-side\x20binding\x20is\x20MANDATORY:\x20contribution\x20rows\x20are\x20written\x20under\x20pattern.repository_write_authorization\x20with\x20an\x20identity\x20leaf\x20(order.owner\x20==\x20Signer\x20/\x20order.agent\x20has\x20Signer)\x20so\x20a\x20funder\x20can\x20only\x20record\x20their\x20OWN\x20contribution\x20—\x20existence-is-not-trust\x20(R-X1-17),\x20an\x20unbound\x20write_guard\x20makes\x20the\x20aggregate\x20forgeable','Deadline\x20=\x20a\x20time-lock:\x20both\x20settlement\x20legs\x20require\x20Clock\x20>=\x20deadline\x20via\x20pattern.time_lock_progress\x20(query\x201280,\x20node-ENTRY\x20anchored);\x20BEFORE\x20the\x20deadline\x20a\x20funder\x20may\x20withdraw\x20(buyer-self-service\x20withdrawn\x20rail:\x20removes\x20their\x20writer-bound\x20row\x20+\x20full\x20refund\x20—\x20A12\x20fix,\x20was\x20wrongly\x20\x27no\x20early\x20withdrawal\x27);\x20AFTER\x20the\x20deadline\x20funds\x20are\x20committed\x20to\x20the\x20threshold\x20outcome','Two-leg\x20escrow\x20exit\x20(D-BUG-2\x20polarity):\x20release\x20leg\x20(→\x20project\x20Entity)\x20gated\x20logic_and[sum_where\x20>=\x20threshold,\x20clock\x20>=\x20deadline];\x20refund\x20leg\x20(→\x20for_object,\x20the\x20funder\x27s\x20own\x20Order)\x20gated\x20logic_and[sum_where\x20<\x20threshold,\x20clock\x20>=\x20deadline]\x20—\x20mutually\x20exclusive\x20on\x20the\x20aggregate\x20comparison,\x20so\x20exactly\x20one\x20is\x20satisfiable\x20once\x20the\x20deadline\x20passes','Keeper\x20batch\x20settlement:\x20on\x20a\x20missed\x20campaign\x20a\x20keeper\x20enumerates\x20every\x20contributor\x20via\x20repository.data\x20find-where\x20(1176\x20→\x20VectorAddress)\x20/\x20keys-where\x20(1177\x20→\x20VectorString)\x20and\x20advances\x20each\x20funder\x27s\x20refund\x20leg\x20in\x20one\x20PTB\x20(or\x20N\x20PTBs)\x20—\x20an\x20ops\x20efficiency,\x20not\x20a\x20chain\x20capability','🔴\x20AGGREGATE\x20TRUST\x20BOUNDARY:\x20the\x20sum\x20is\x20only\x20as\x20honest\x20as\x20the\x20writer-bound\x20rows;\x20it\x20is\x20NOT\x20independently\x20re-derivable\x20on-chain\x20without\x20reading\x20every\x20escrow\x20balance.\x20Disclose\x20this\x20honestly\x20(L-04);\x20never\x20present\x20the\x20threshold\x20as\x20a\x20chain-verified\x20total-custody\x20proof','🔴\x20L-01\x20NON-INVESTMENT:\x20crowdfunding\x20copy\x20must\x20never\x20promise\x20investment\x20returns,\x20yield,\x20or\x20token-price\x20appreciation\x20—\x20it\x20is\x20a\x20threshold\x20purchase/preorder/donation,\x20not\x20a\x20security','🔴\x20L-05\x20KYC/AML:\x20pooled\x20fundraising\x20is\x20high\x20regulatory\x20intensity\x20—\x20cross-border\x20funds\x20and\x20reward\x20tiers\x20may\x20trigger\x20securities/money-transmission\x20rules;\x20flag\x20for\x20compliance,\x20do\x20not\x20automate\x20around\x20them','R-M1-11:\x20no\x20\x27refunded\x27/\x27cancelled\x27\x20fund\x20terminals\x20—\x20the\x20refund\x20leg\x20routes\x20via\x20the\x20Allocator\x20triggered\x20by\x20the\x20missed-threshold\x20business\x20state\x20at\x20deadline;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'delivery','phase':0x1,'industry':'Restaurant\x20food-delivery\x20/\x20on-demand\x20errand\x20(local\x20fulfillment)','trust_pattern':'Escrow-through-delivery\x20+\x20roster-authorized\x20per-order\x20rider\x20+\x20serial\x20claim\x20window','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'delivery/restaurant-marketplace','key_risk':'Per-order\x20dispatched\x20riders\x20have\x20no\x20on-chain\x20identity\x20—\x20the\x20named-operator\x20roster\x20is\x20their\x20ONLY\x20authorized\x20forward\x20and\x20the\x20roster\x20writer\x20is\x20the\x20de-facto\x20rider\x20admitter\x20(undisclosed,\x20a\x20silent\x20centralization);\x20handover\x20records\x20are\x20unwitnessable\x20by\x20the\x20buyer;\x20rider\x20pay\x20is\x20the\x20platform\x27s\x20off-chain\x20payroll\x20BY\x20DESIGN\x20(T-06\x20correction,\x20sso-tn-261027-7f3a91:\x20a\x20Signer\x20allocator\x20leg\x20CAN\x20pay\x20a\x20per-order\x20rider\x20directly\x20—\x20allocation.move:625-630\x20bypasses\x20the\x20for_object\x20lock\x20that\x20binds\x20only\x20GuardIdentifier\x20submissions)','build_notes':['Hours-scale\x20windows,\x20not\x20retail\x20DAYS:\x20auto-confirm\x201-2h,\x20claim\x20window\x2024h,\x20settlement\x2024h\x20—\x20food\x20is\x20perishable;\x20anchor\x20every\x20relative\x20gate\x20on\x20progress.history.time\x20(query\x201280,\x20find=last),\x20never\x201272\x20current_time','Dispatch\x20is\x20OFF-CHAIN\x20(K-4):\x20the\x20chain\x20has\x20no\x20dispatch/scheduling\x20primitive\x20—\x20the\x20rider\x27s\x20only\x20chain\x20footprint\x20is\x20the\x20per-order\x20namedOperator\x20roster\x20(permission\x20index\x20221);\x20the\x20roster\x27s\x20write\x20power\x20is\x20the\x20rider-admission\x20power\x20and\x20MUST\x20be\x20disclosed\x20(NAMED_OPERATOR_ROSTER_UNDISCLOSED)','Riders\x20are\x20paid\x20by\x20the\x20platform\x20in\x20this\x20shape\x20(T-06\x20correction,\x20sso-tn-261027-7f3a91):\x20a\x20GuardIdentifier\x20leg\x20pays\x20the\x20order\x27s\x20own\x20CoinWrapper\x20(allocation.move:621),\x20so\x20a\x20slot\x20leg\x20is\x20unfundable\x20for\x20a\x20person\x20—\x20but\x20a\x20Signer\x20leg\x20IS\x20an\x20on-chain\x20payee\x20shape\x20for\x20the\x20rostered\x20rider\x20(allocation.move:625-630,\x20proven\x20live);\x20the\x20shipped\x20default\x20routes\x20pay\x20through\x20the\x20commission\x20leg\x20as\x20off-chain\x20payroll\x20instead','Serial\x20claim\x20window\x20(TPL-09):\x20settlement\x20departs\x20a\x20mandatory\x20claim_window\x20node\x20so\x20no\x20release\x20can\x20fire\x20while\x20a\x20dispute\x20could\x20still\x20be\x20filed\x20(FACT-ALLOC-03);\x20assert\x20settle_hours\x20>=\x20claim_window_hours\x20at\x20generation','Fee-graded\x20cancellation:\x20a\x20pre-acceptance\x20cancel\x20refunds\x20in\x20full,\x20a\x20post-acceptance\x20kill\x20pays\x20a\x20prep\x20fee\x20—\x20distinct\x20closed_cancel\x20/\x20closed_kill\x20terminals\x20so\x20fee\x20and\x20full\x20refund\x20never\x20share\x20a\x20rail','Transit\x20loss\x20has\x20a\x20buyer\x20rail:\x20an\x20identity-only\x20ReportTransitLoss\x20declaration\x20into\x20the\x20dispute\x20waypoint\x20(no\x20window\x20mid-transit\x20—\x20the\x20anchor\x20row\x20does\x20not\x20exist\x20yet,\x20F-TPL-01\x20trap);\x20the\x20remedy\x20route\x20is\x20arbitration\x20into\x20the\x20full-refund\x20rail,\x20disclosed']},{'name':'group_buy','phase':0x1,'industry':'Community\x20group-buying\x20(leader\x20consolidation\x20+\x20neighborhood\x20pickup)','trust_pattern':'Shared\x20ABSOLUTE\x20batch\x20cutoff\x20+\x20batch\x20consolidation\x20+\x20threshold-gated\x20release\x20(challenger:\x20per-backer\x20unpooled\x20escrow)','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'group_buy/platform-supplied-pickup','key_risk':'The\x20buyer\x20pre-pays\x20against\x20a\x20batch\x20that\x20may\x20never\x20form,\x20and\x20the\x20challenger\x27s\x20supply\x20chain\x20is\x20OFF-CHAIN\x20(undiligence-able\x20before\x20purchase\x20—\x20the\x20trust\x20gap\x20and\x20the\x20main\x20arbitration\x20evidence\x20source);\x20the\x20batch\x20cutoff\x20must\x20be\x20ONE\x20shared\x20absolute\x20timestamp\x20(keeper-written\x20Repository\x20row),\x20never\x20a\x20per-order\x20entry+duration\x20lock;\x20multi-level\x20commission\x20schemes\x20are\x20NOT\x20expressible\x20(single-layer\x20commission\x20only)','build_notes':['The\x20batch\x20cutoff\x20is\x20a\x20SHARED\x20ABSOLUTE\x20timestamp\x20(pattern.time_lock_absolute):\x20one\x20clock\x20for\x20every\x20buyer\x20in\x20the\x20batch,\x20keeper-written\x20per\x20batch\x20into\x20a\x20Repository\x20row\x20—\x20chain\x20Clock\x20is\x20block-driven,\x20so\x20a\x20real-world\x20calendar\x20cutoff\x20(23:00\x20daily)\x20needs\x20pattern.time_source_repository_oracle;\x20a\x20per-order\x20entry+duration\x20lock\x20gives\x20every\x20buyer\x20a\x20DIFFERENT\x20cutoff\x20and\x20is\x20not\x20a\x20batch','Supply-chain\x20suborder\x20commitment\x20(leader):\x20the\x20supplier\x27s\x20sub-service\x20address\x20is\x20a\x20FIXED\x20promise\x20in\x20the\x20ConsolidateBatch\x20guard\x20table\x20(b_submission\x20false,\x20value_type\x20Address)\x20—\x20the\x20whole\x20procurement\x20graph\x20is\x20enumerable\x20and\x20diligence-able\x20BEFORE\x20any\x20buyer\x20pays\x20(the\x20structural\x20trust\x20advantage);\x20the\x20challenger\x20(leader-sourced)\x20has\x20NO\x20such\x20commitment\x20—\x20disclose\x20it\x20as\x20the\x20structural\x20trust\x20gap','Threshold\x20mode\x20reuses\x20the\x20crowdfunding\x20construction\x20wholesale:\x20unpooled\x20per-backer\x20escrow\x20(for_object\x20=\x20the\x20backer\x27s\x20own\x20order),\x20ORDER-keyed\x20contribution\x20rows,\x20the\x20escrow-bound\x20aggregate\x20(per-row\x20min(row,\x20order.amount))\x20and\x20the\x20live-escrow\x20+\x20claimed_by-false\x20legs\x20—\x20the\x20three\x20CROWDFUNDING_*\x20blockers\x20apply\x20automatically','Pickup-point\x20topology:\x20staffed\x20points\x20ride\x20the\x20named-operator\x20leader\x20rail\x20(ShelveAtPoint\x20+\x20HandOverByPoint);\x20AUTOMATED\x20lockers\x20drop\x20both\x20(a\x20locker\x20cannot\x20sign\x20—\x20the\x20buyer\x27s\x20own\x20Collect\x20signature\x20is\x20the\x20stronger\x20handover\x20proof);\x20the\x20unclaimed-goods\x20exit\x20window\x20is\x20mandatory\x20(goods\x20never\x20picked\x20up\x20must\x20refund\x20at\x20a\x20bounded\x20deadline)','Leader\x20commission\x20is\x20a\x20single-layer\x20rate\x20leg\x20paid\x20to\x20the\x20platform\x20Entity\x20with\x20OFF-CHAIN\x20pass-through\x20(a\x20per-order\x20third\x20party\x20has\x20no\x20on-chain\x20payee\x20shape\x20—\x20for_object\x20lock,\x20allocation.move:621);\x20multi-level/regional\x20commission\x20is\x20NOT\x20expressible\x20—\x20disclose','Delay\x20compensation\x20pays\x20from\x20the\x20compensation_fund,\x20NEVER\x20from\x20the\x20buyer\x27s\x20escrow\x20(Order\x20binds\x20<=\x201\x20allocator);\x20the\x20fund\x20must\x20be\x20pre-locked\x20to\x203x\x20the\x20largest\x20order\x20(B2)\x20or\x20higher\x20tiers\x20are\x20silently\x20unsellable']},{'name':'general','phase':0x1,'industry':'Anything\x20not\x20covered\x20/\x20hybrid','trust_pattern':'User-defined\x20from\x20scratch','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':null,'key_risk':'No\x20safety\x20net\x20—\x20user\x20must\x20design\x20all\x20trust\x20mechanisms\x20manually','build_notes':['Escape\x20hatch:\x20any\x20user\x20can\x20switch\x20to\x20general\x20mode\x20at\x20any\x20time','Already-created\x20objects\x20under\x20a\x20previous\x20mode\x20remain\x20on-chain\x20(REUSE\x20pattern)','wowok-machine\x20/\x20wowok-guard\x20/\x20wowok-provider\x20become\x20primary\x20references']}];export function matchScenarioMode(a){const b=a['toLowerCase'](),c=inferScenarioTraits(a),e=SCENARIO_MODES['map'](h=>{let i=0x0,j=0x0;for(const k of Object['keys'](c)){j+=0x1;if(h['traits'][k]===c[k])i+=0x1;}if(h['name']!=='general'){const l=MODE_KEYWORDS[h['name']]??[];for(const m of l){if(b['includes'](m))i+=0.5;}}return{'mode':h,'score':i,'total':j};});let f=e[0x0];for(const h of e){if(h['score']>f['score'])f=h;}const g=f['total']>0x0?Math['min'](0x1,f['score']/f['total']):0x0;return{'mode':f['mode'],'confidence':g};}const MODE_KEYWORDS={'freelance':['freelance','design','develop','consult','write','consulting'],'rental':['rent','rental','lease','borrow','equipment','vehicle','property'],'education':['course','training','tutor','teach','education','class'],'travel':['tour','travel','trip','itinerary','vacation'],'subscription':['subscribe','subscription','membership','saas','newsletter','recurring'],'retail':['retail','shop','store','marketplace','sell\x20goods','ecommerce','e-commerce'],'licensing':['license','licensing','royalty','royalties','ip','intellectual\x20property','music\x20rights','sync','beat','franchise','rights'],'crowdfunding':['crowdfunding','crowdfund','fundraising','pledge','backer','kickstarter','campaign','all-or-nothing','threshold\x20goal','presale\x20campaign','raise\x20funds'],'delivery':['delivery','food\x20delivery','takeout','takeaway','errand','on-demand','rider','courier\x20delivery','waimai','last\x20mile'],'group_buy':['group\x20buy','group-buy','groupbuy','community\x20group','team\x20purchase','batch\x20cutoff','neighborhood\x20pickup','pickup\x20point','tuangou']};export function inferScenarioTraits(a){const b=a['toLowerCase']();return{'has_logistics':/ship|delivery|equipment|vehicle|physical|goods/['test'](b),'communication_heavy':/consult|discuss|back-and-forth|custom|bespoke|negotiate/['test'](b),'pure_digital':/digital|file|download|online|software|code|design|content/['test'](b),'long_cycle':/month|long-term|engagement|project|semester|period/['test'](b),'deposit_required':/deposit|escrow|prepay|tuition|reserve/['test'](b),'multi_tier_allocation':/tier|segment|multi-|agency|hotel|guide|driver/['test'](b)};}export const MODE_COMPOSITIONS=[{'modes':['freelance','subscription'],'use_case':'Retainer\x20consulting\x20(monthly\x20+\x20milestone)','conflict_resolution':'Allocator:\x20split\x20into\x20retainer\x20(subscription)\x20+\x20milestone\x20(freelance)'},{'modes':['rental','education'],'use_case':'Equipment\x20training\x20rental','conflict_resolution':'Machine:\x20extend\x20rental\x20nodes\x20with\x20attendance\x20gates'},{'modes':['travel','rental'],'use_case':'Tour\x20with\x20equipment','conflict_resolution':'Allocator:\x20segment\x20allocation\x20+\x20deposit\x20escrow\x20side-by-side'}];export function getScenarioMode(a){return SCENARIO_MODES['find'](b=>b['name']===a);}export function listScenarioModes(){return SCENARIO_MODES;}export function getShippedModes(){return SCENARIO_MODES['filter'](a=>a['phase']===0x1);}export function getModeCompositions(a){return MODE_COMPOSITIONS['filter'](b=>b['modes']['includes'](a));}export const SCENARIO_MODES_VERSION=0xa;
@@ -1,12 +1,13 @@
1
1
  import { z } from "zod";
2
2
  import { type DomainPriorMatch, type TraitInferenceResult } from "./industry-generalizer.js";
3
- import type { IndustryTraits } from "./industry-registry.js";
4
- export declare const SEMANTIC_IR_SCHEMA_VERSION: 1;
3
+ import { type IndustryTraits } from "./industry-registry.js";
4
+ export declare const SEMANTIC_IR_SCHEMA_VERSION: 2;
5
+ export declare const SEMANTIC_IR_ACCEPTED_INPUT_VERSIONS: readonly [1, 2];
5
6
  export declare const TRAIT_KEYS: Array<keyof IndustryTraits>;
6
- export declare const SEMANTIC_CLAIM_KEYS: readonly ["reward_pool_amount"];
7
+ export declare const SEMANTIC_CLAIM_KEYS: readonly ["reward_pool_amount", "funding_threshold_amount", "min_order_price_amount"];
7
8
  export type SemanticClaimKey = (typeof SEMANTIC_CLAIM_KEYS)[number];
8
9
  export declare const SemanticIRInputSchema: z.ZodObject<{
9
- schema_version: z.ZodLiteral<1>;
10
+ schema_version: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
10
11
  locale: z.ZodString;
11
12
  traits: z.ZodOptional<z.ZodArray<z.ZodObject<{
12
13
  trait: z.ZodString;
@@ -37,6 +38,13 @@ export declare const SemanticIRInputSchema: z.ZodObject<{
37
38
  }, z.core.$strict>>;
38
39
  quote: z.ZodOptional<z.ZodString>;
39
40
  }, z.core.$strict>>>;
41
+ discovery: z.ZodOptional<z.ZodObject<{
42
+ industry: z.ZodOptional<z.ZodString>;
43
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
+ product_ref: z.ZodOptional<z.ZodString>;
45
+ english_summary: z.ZodOptional<z.ZodString>;
46
+ confidence: z.ZodOptional<z.ZodNumber>;
47
+ }, z.core.$strict>>;
40
48
  provenance: z.ZodObject<{
41
49
  source: z.ZodEnum<{
42
50
  human: "human";
@@ -77,12 +85,20 @@ export interface SemanticIRClaim {
77
85
  };
78
86
  quote?: string;
79
87
  }
88
+ export interface SemanticIRDiscovery {
89
+ industry?: string;
90
+ tags: string[];
91
+ product_ref?: string;
92
+ english_summary?: string;
93
+ confidence?: number;
94
+ }
80
95
  export interface CanonicalSemanticIR {
81
96
  schema_version: typeof SEMANTIC_IR_SCHEMA_VERSION;
82
97
  locale: string;
83
98
  traits: SemanticIRTraitEvidence[];
84
99
  domains: SemanticIRDomainEvidence[];
85
100
  claims: SemanticIRClaim[];
101
+ discovery: SemanticIRDiscovery;
86
102
  provenance: {
87
103
  source: "caller_llm" | "human";
88
104
  model?: string;
@@ -96,7 +112,10 @@ export interface NormalizedSemanticIR {
96
112
  issues: string[];
97
113
  }
98
114
  export declare function semanticIrDigest(ir: CanonicalSemanticIR): string;
99
- export declare function normalizeSemanticIR(raw: unknown): NormalizedSemanticIR;
115
+ export declare function normalizeSemanticIR(raw: unknown, options?: {
116
+ source_text?: string;
117
+ }): NormalizedSemanticIR;
118
+ export declare function discoverySignal(ir: CanonicalSemanticIR): SemanticIRDiscovery | undefined;
100
119
  export declare function claimNumber(ir: CanonicalSemanticIR, key: SemanticClaimKey): number | undefined;
101
120
  export interface SemanticIRConflict {
102
121
  trait: string;
@@ -1 +1 @@
1
- import{createHash}from'node:crypto';import{z}from'zod';import{BOOLEAN_TRAIT_KEYS,DOMAIN_PRIORS,ENUM_TRAIT_SCALES,EVIDENCE_THRESHOLD}from'./industry-generalizer.js';export const SEMANTIC_IR_SCHEMA_VERSION=0x1;export const TRAIT_KEYS=[...BOOLEAN_TRAIT_KEYS,...Object['keys'](ENUM_TRAIT_SCALES)];export const SEMANTIC_CLAIM_KEYS=['reward_pool_amount'];const SpanSchema=z['object']({'start':z['number']()['int']()['nonnegative'](),'end':z['number']()['int']()['nonnegative']()})['strict'](),TraitEvidenceSchema=z['object']({'trait':z['string']()['max'](0x40),'value':z['union']([z['boolean'](),z['string']()['max'](0x20)]),'confidence':z['number'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),DomainEvidenceSchema=z['object']({'domain':z['string']()['max'](0x40),'confidence':z['number']()['optional'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),ClaimEvidenceSchema=z['object']({'key':z['string']()['max'](0x40),'value':z['number'](),'confidence':z['number']()['optional'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),ProvenanceSchema=z['object']({'source':z['enum'](['caller_llm','human']),'model':z['string']()['max'](0x78)['optional'](),'prompt_version':z['string']()['max'](0x3c)['optional'](),'generated_at':z['number']()['int']()['nonnegative']()['optional']()})['strict']();export const SemanticIRInputSchema=z['object']({'schema_version':z['literal'](SEMANTIC_IR_SCHEMA_VERSION),'locale':z['string']()['min'](0x2)['max'](0x23),'traits':z['array'](TraitEvidenceSchema)['max'](0x14)['optional'](),'domains':z['array'](DomainEvidenceSchema)['max'](0xa)['optional'](),'claims':z['array'](ClaimEvidenceSchema)['max'](0xa)['optional'](),'provenance':ProvenanceSchema})['strict']();export function semanticIrDigest(a){return createHash('sha256')['update'](JSON['stringify'](a))['digest']('hex');}function traitOrder(a){return TRAIT_KEYS['indexOf'](a);}export function normalizeSemanticIR(a){const b=SemanticIRInputSchema['safeParse'](a);if(!b['success']){const q=b['error']['issues']['map'](r=>(r['path']['length']>0x0?r['path']['join']('.'):'(root)')+':\x20'+r['message'])['join'](';\x20');throw new Error('semantic_ir\x20rejected:\x20'+q);}const e=[],f=[];for(const r of b['data']['traits']??[]){if(!TRAIT_KEYS['includes'](r['trait'])){e['push']('unknown\x20trait\x20\x27'+r['trait']+'\x27\x20ignored\x20(vocabulary:\x20'+TRAIT_KEYS['join'](',\x20')+')');continue;}const s=r['trait'],t=BOOLEAN_TRAIT_KEYS['includes'](s);if(t){if(typeof r['value']!=='boolean'){e['push']('trait\x20\x27'+s+'\x27\x20is\x20boolean;\x20value\x20\x27'+String(r['value'])+'\x27\x20ignored');continue;}}else{const x=ENUM_TRAIT_SCALES[s];if(!x||typeof r['value']!=='string'||!x['includes'](r['value'])){e['push']('trait\x20\x27'+s+'\x27\x20expects\x20one\x20of\x20['+(x??[])['join'](',\x20')+'];\x20'+('value\x20\x27'+String(r['value'])+'\x27\x20ignored'));continue;}}if(!Number['isFinite'](r['confidence'])){e['push']('trait\x20\x27'+s+'\x27\x20confidence\x20is\x20not\x20finite;\x20evidence\x20ignored');continue;}const u=Math['max'](0x0,Math['min'](0x1,r['confidence']));u!==r['confidence']&&e['push']('trait\x20\x27'+s+'\x27\x20confidence\x20'+r['confidence']+'\x20clamped\x20to\x20'+u);u<EVIDENCE_THRESHOLD&&e['push']('trait\x20\x27'+s+'\x27\x20confidence\x20'+u+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));let v;r['span']&&(r['span']['end']<r['span']['start']?e['push']('trait\x20\x27'+s+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped'):v={'start':r['span']['start'],'end':r['span']['end']});const w={'trait':s,'value':r['value'],'confidence':u};if(v)w['span']=v;if(r['quote']!==undefined)w['quote']=r['quote'];f['push'](w);}f['sort']((y,A)=>{const B=traitOrder(y['trait'])-traitOrder(A['trait']);if(B!==0x0)return B;if(A['confidence']!==y['confidence'])return A['confidence']-y['confidence'];return JSON['stringify'](y['value'])['localeCompare'](JSON['stringify'](A['value']));});const g=[],h=new Map();for(const y of f){const A=h['get'](y['trait']);if(!A){h['set'](y['trait'],y),g['push'](y);continue;}A['value']!==y['value']&&e['push']('conflicting\x20evidence\x20for\x20\x27'+y['trait']+'\x27:\x20'+('kept\x20\x27'+String(A['value'])+'\x27\x20(confidence\x20'+A['confidence']+')\x20over\x20')+('\x27'+String(y['value'])+'\x27\x20(confidence\x20'+y['confidence']+')'));}const i=[];for(const B of b['data']['domains']??[]){if(!DOMAIN_PRIORS['some'](F=>F['domain']===B['domain'])){e['push']('unknown\x20domain\x20\x27'+B['domain']+'\x27\x20ignored\x20(vocabulary:\x20'+DOMAIN_PRIORS['map'](F=>F['domain'])['join'](',\x20')+')');continue;}const C=B['confidence']??0x1;if(!Number['isFinite'](C)){e['push']('domain\x20\x27'+B['domain']+'\x27\x20confidence\x20is\x20not\x20finite;\x20evidence\x20ignored');continue;}const D=Math['max'](0x0,Math['min'](0x1,C));D!==C&&e['push']('domain\x20\x27'+B['domain']+'\x27\x20confidence\x20'+C+'\x20clamped\x20to\x20'+D);D<EVIDENCE_THRESHOLD&&e['push']('domain\x20\x27'+B['domain']+'\x27\x20confidence\x20'+D+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));const E={'domain':B['domain'],'confidence':D};if(B['span']&&B['span']['end']>=B['span']['start'])E['span']={'start':B['span']['start'],'end':B['span']['end']};else{if(B['span'])e['push']('domain\x20\x27'+B['domain']+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped');}if(B['quote']!==undefined)E['quote']=B['quote'];i['push'](E);}i['sort']((F,G)=>{if(G['confidence']!==F['confidence'])return G['confidence']-F['confidence'];return F['domain']['localeCompare'](G['domain']);});const j=[],k=new Set();for(const F of i){if(k['has'](F['domain']))continue;k['add'](F['domain']),j['push'](F);}const l=[];for(const G of b['data']['claims']??[]){if(!SEMANTIC_CLAIM_KEYS['includes'](G['key'])){e['push']('unknown\x20claim\x20\x27'+G['key']+'\x27\x20ignored\x20(vocabulary:\x20'+SEMANTIC_CLAIM_KEYS['join'](',\x20')+')');continue;}const H=G['key'];if(!Number['isFinite'](G['value'])){e['push']('claim\x20\x27'+H+'\x27\x20value\x20is\x20not\x20finite;\x20ignored');continue;}if(G['value']<0x0){e['push']('claim\x20\x27'+H+'\x27\x20value\x20'+G['value']+'\x20is\x20negative;\x20ignored');continue;}const I=G['confidence']??0x1;if(!Number['isFinite'](I)){e['push']('claim\x20\x27'+H+'\x27\x20confidence\x20is\x20not\x20finite;\x20claim\x20ignored');continue;}const J=Math['max'](0x0,Math['min'](0x1,I));J!==I&&e['push']('claim\x20\x27'+H+'\x27\x20confidence\x20'+I+'\x20clamped\x20to\x20'+J);J<EVIDENCE_THRESHOLD&&e['push']('claim\x20\x27'+H+'\x27\x20confidence\x20'+J+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));const K={'key':H,'value':G['value'],'confidence':J};G['span']&&(G['span']['end']<G['span']['start']?e['push']('claim\x20\x27'+H+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped'):K['span']={'start':G['span']['start'],'end':G['span']['end']});if(G['quote']!==undefined)K['quote']=G['quote'];l['push'](K);}l['sort']((L,M)=>{if(L['key']!==M['key'])return L['key']<M['key']?-0x1:0x1;return M['confidence']-L['confidence'];});const m=[],n=new Map();for(const L of l){const M=n['get'](L['key']);if(!M){n['set'](L['key'],L),m['push'](L);continue;}M['value']!==L['value']&&e['push']('conflicting\x20evidence\x20for\x20claim\x20\x27'+L['key']+'\x27:\x20'+('kept\x20'+M['value']+'\x20(confidence\x20'+M['confidence']+')\x20over\x20')+(L['value']+'\x20(confidence\x20'+L['confidence']+')'));}g['length']===0x0&&j['length']===0x0&&m['length']===0x0&&e['push']('semantic_ir\x20carries\x20no\x20usable\x20evidence;\x20keyword\x20inference\x20is\x20the\x20only\x20signal');const o={'source':b['data']['provenance']['source']};if(b['data']['provenance']['model']!==undefined)o['model']=b['data']['provenance']['model'];b['data']['provenance']['prompt_version']!==undefined&&(o['prompt_version']=b['data']['provenance']['prompt_version']);b['data']['provenance']['generated_at']!==undefined&&(o['generated_at']=b['data']['provenance']['generated_at']);const p={'schema_version':SEMANTIC_IR_SCHEMA_VERSION,'locale':b['data']['locale'],'traits':g,'domains':j,'claims':m,'provenance':o};return{'ir':p,'digest':semanticIrDigest(p),'issues':e};}export function claimNumber(a,b){const c=a['claims']['find'](d=>d['key']===b&&d['confidence']>=EVIDENCE_THRESHOLD);return c?.['value'];}export function mergeSemanticIR(a,b){const c={...a['traits']},d={...a['trait_confidence']},e=[];for(const h of b['traits']){if(h['confidence']<EVIDENCE_THRESHOLD)continue;const i=a['trait_confidence'][h['trait']],j=a['traits'][h['trait']];i!==undefined&&j!==h['value']?(e['push']({'trait':h['trait'],'keyword_value':j,'keyword_confidence':i,'ir_value':h['value'],'ir_confidence':h['confidence']}),d[h['trait']]=h['confidence']):d[h['trait']]=Math['max'](i??0x0,h['confidence']),c[h['trait']]=h['value'];}const f=Object['values'](d)['filter'](k=>(k??0x0)>=EVIDENCE_THRESHOLD)['length'],g=Math['min'](0x1,Math['max'](a['confidence'],f/TRAIT_KEYS['length']));return{'traits':c,'confidence':g,'matched_keywords':[...a['matched_keywords']],'trait_confidence':d,'conflicts':e};}export function domainPriorsFromIR(a){const b=[];for(const c of a['domains']){if(c['confidence']<EVIDENCE_THRESHOLD)continue;const e=DOMAIN_PRIORS['find'](f=>f['domain']===c['domain']);if(!e)continue;b['push']({'domain':e['domain'],'matched_keywords':[],'industries':[...e['industries']],'boost':e['boost'],'source':'semantic_ir'});}return b;}export function mergeDomainPriors(a,b){const c=new Map();for(const d of a){c['set'](d['domain'],{...d,'source':d['source']??'keyword'});}for(const e of b){const f=c['get'](e['domain']);if(!f){c['set'](e['domain'],e);continue;}c['set'](e['domain'],{...f,'matched_keywords':[...new Set([...f['matched_keywords'],...e['matched_keywords']])],'industries':[...new Set([...f['industries'],...e['industries']])],'boost':Math['max'](f['boost'],e['boost']),'source':'both'});}return Array['from'](c['values']());}
1
+ import{createHash}from'node:crypto';import{z}from'zod';import{DISCOVERY_PRODUCT_REFS,DISCOVERY_TAG_VOCABULARY,isDiscoveryTag}from'./builtin-templates.js';import{BOOLEAN_TRAIT_KEYS,DOMAIN_PRIORS,ENUM_TRAIT_SCALES,EVIDENCE_THRESHOLD}from'./industry-generalizer.js';import{isRegisteredIndustry,resolveIndustryName}from'./industry-registry.js';export const SEMANTIC_IR_SCHEMA_VERSION=0x2;export const SEMANTIC_IR_ACCEPTED_INPUT_VERSIONS=[0x1,0x2];export const TRAIT_KEYS=[...BOOLEAN_TRAIT_KEYS,...Object['keys'](ENUM_TRAIT_SCALES)];export const SEMANTIC_CLAIM_KEYS=['reward_pool_amount','funding_threshold_amount','min_order_price_amount'];const SpanSchema=z['object']({'start':z['number']()['int']()['nonnegative'](),'end':z['number']()['int']()['nonnegative']()})['strict'](),TraitEvidenceSchema=z['object']({'trait':z['string']()['max'](0x40),'value':z['union']([z['boolean'](),z['string']()['max'](0x20)]),'confidence':z['number'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),DomainEvidenceSchema=z['object']({'domain':z['string']()['max'](0x40),'confidence':z['number']()['optional'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),ClaimEvidenceSchema=z['object']({'key':z['string']()['max'](0x40),'value':z['number'](),'confidence':z['number']()['optional'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),ProvenanceSchema=z['object']({'source':z['enum'](['caller_llm','human']),'model':z['string']()['max'](0x78)['optional'](),'prompt_version':z['string']()['max'](0x3c)['optional'](),'generated_at':z['number']()['int']()['nonnegative']()['optional']()})['strict'](),DiscoveryEvidenceSchema=z['object']({'industry':z['string']()['max'](0x40)['optional'](),'tags':z['array'](z['string']()['max'](0x40))['max'](0x14)['optional'](),'product_ref':z['string']()['max'](0x40)['optional'](),'english_summary':z['string']()['max'](0x258)['optional'](),'confidence':z['number']()['optional']()})['strict']();export const SemanticIRInputSchema=z['object']({'schema_version':z['union']([z['literal'](0x1),z['literal'](0x2)]),'locale':z['string']()['min'](0x2)['max'](0x23),'traits':z['array'](TraitEvidenceSchema)['max'](0x14)['optional'](),'domains':z['array'](DomainEvidenceSchema)['max'](0xa)['optional'](),'claims':z['array'](ClaimEvidenceSchema)['max'](0xa)['optional'](),'discovery':DiscoveryEvidenceSchema['optional'](),'provenance':ProvenanceSchema})['strict']();export function semanticIrDigest(a){return createHash('sha256')['update'](JSON['stringify'](a))['digest']('hex');}function traitOrder(a){return TRAIT_KEYS['indexOf'](a);}function vocabularyPreview(a,b=0xc){const c=a['slice'](0x0,b)['join'](',\x20');return a['length']>b?c+',\x20…\x20('+a['length']+'\x20total)':c;}function normalizeDiscovery(a,b){const c=new Set();for(const h of a?.['tags']??[]){const i=h['trim']()['toLowerCase']();if(!i)continue;if(!isDiscoveryTag(i)){b['push']('unknown\x20discovery\x20tag\x20\x27'+h+'\x27\x20ignored\x20(vocabulary:\x20'+vocabularyPreview(DISCOVERY_TAG_VOCABULARY)+')');continue;}c['add'](i);}let d;if(a?.['industry']!==undefined){const j=resolveIndustryName(a['industry']);!j||!isRegisteredIndustry(j)?b['push']('unknown\x20discovery\x20industry\x20\x27'+a['industry']+'\x27\x20ignored\x20(not\x20a\x20registered\x20industry)'):d=j;}let e;if(a?.['product_ref']!==undefined){const k=a['product_ref']['trim']()['toLowerCase']();!DISCOVERY_PRODUCT_REFS['includes'](k)?b['push']('unknown\x20discovery\x20product_ref\x20\x27'+a['product_ref']+'\x27\x20ignored\x20'+('(builtin\x20benchmark\x20products:\x20'+vocabularyPreview(DISCOVERY_PRODUCT_REFS)+')')):e=k;}const f=a?.['english_summary']?.['trim'](),g={'tags':[...c]['sort']()};if(d)g['industry']=d;if(e)g['product_ref']=e;if(f)g['english_summary']=f;if(a?.['confidence']!==undefined){if(!Number['isFinite'](a['confidence']))b['push']('discovery\x20confidence\x20is\x20not\x20finite;\x20discovery\x20evidence\x20ignored\x20at\x20match\x20time');else{const l=Math['max'](0x0,Math['min'](0x1,a['confidence']));l!==a['confidence']&&b['push']('discovery\x20confidence\x20'+a['confidence']+'\x20clamped\x20to\x20'+l),l<EVIDENCE_THRESHOLD&&b['push']('discovery\x20confidence\x20'+l+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied')),g['confidence']=l;}}return g;}function anchorEvidence(a,b,c,d){if(a===undefined)return{'span':c['span'],'quote':c['quote']};if(c['quote']!==undefined){const e=a['indexOf'](c['quote']);if(e<0x0)return d['push'](b+'\x20quote\x20was\x20not\x20found\x20verbatim\x20in\x20the\x20source\x20text;\x20evidence\x20dropped'),undefined;const f={'start':e,'end':e+c['quote']['length']};return c['span']&&(c['span']['start']!==f['start']||c['span']['end']!==f['end'])&&d['push'](b+'\x20span\x20re-anchored\x20to\x20the\x20quoted\x20text\x20('+f['start']+'-'+f['end']+')'),{'span':f,'quote':c['quote']};}if(c['span']){if(c['span']['end']>a['length'])return d['push'](b+'\x20span\x20ends\x20past\x20the\x20source\x20text\x20('+c['span']['end']+'\x20>\x20'+a['length']+');\x20evidence\x20dropped'),undefined;if(!a['slice'](c['span']['start'],c['span']['end'])['trim']())return d['push'](b+'\x20span\x20covers\x20no\x20text;\x20evidence\x20dropped'),undefined;return{'span':c['span']};}return{};}export function normalizeSemanticIR(a,b={}){const e=SemanticIRInputSchema['safeParse'](a);if(!e['success']){const x=e['error']['issues']['map'](y=>(y['path']['length']>0x0?y['path']['join']('.'):'(root)')+':\x20'+y['message'])['join'](';\x20');throw new Error('semantic_ir\x20rejected:\x20'+x);}const f=[],g=[];for(const y of e['data']['traits']??[]){if(!TRAIT_KEYS['includes'](y['trait'])){f['push']('unknown\x20trait\x20\x27'+y['trait']+'\x27\x20ignored\x20(vocabulary:\x20'+TRAIT_KEYS['join'](',\x20')+')');continue;}const A=y['trait'],B=BOOLEAN_TRAIT_KEYS['includes'](A);if(B){if(typeof y['value']!=='boolean'){f['push']('trait\x20\x27'+A+'\x27\x20is\x20boolean;\x20value\x20\x27'+String(y['value'])+'\x27\x20ignored');continue;}}else{const F=ENUM_TRAIT_SCALES[A];if(!F||typeof y['value']!=='string'||!F['includes'](y['value'])){f['push']('trait\x20\x27'+A+'\x27\x20expects\x20one\x20of\x20['+(F??[])['join'](',\x20')+'];\x20'+('value\x20\x27'+String(y['value'])+'\x27\x20ignored'));continue;}}if(!Number['isFinite'](y['confidence'])){f['push']('trait\x20\x27'+A+'\x27\x20confidence\x20is\x20not\x20finite;\x20evidence\x20ignored');continue;}const C=Math['max'](0x0,Math['min'](0x1,y['confidence']));C!==y['confidence']&&f['push']('trait\x20\x27'+A+'\x27\x20confidence\x20'+y['confidence']+'\x20clamped\x20to\x20'+C);C<EVIDENCE_THRESHOLD&&f['push']('trait\x20\x27'+A+'\x27\x20confidence\x20'+C+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));let D;y['span']&&(y['span']['end']<y['span']['start']?f['push']('trait\x20\x27'+A+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped'):D={'start':y['span']['start'],'end':y['span']['end']});const E={'trait':A,'value':y['value'],'confidence':C};if(D)E['span']=D;if(y['quote']!==undefined)E['quote']=y['quote'];g['push'](E);}g['sort']((G,H)=>{const I=traitOrder(G['trait'])-traitOrder(H['trait']);if(I!==0x0)return I;if(H['confidence']!==G['confidence'])return H['confidence']-G['confidence'];return JSON['stringify'](G['value'])['localeCompare'](JSON['stringify'](H['value']));});const h=[],i=new Map();for(const G of g){const H=i['get'](G['trait']);if(!H){i['set'](G['trait'],G),h['push'](G);continue;}H['value']!==G['value']&&f['push']('conflicting\x20evidence\x20for\x20\x27'+G['trait']+'\x27:\x20'+('kept\x20\x27'+String(H['value'])+'\x27\x20(confidence\x20'+H['confidence']+')\x20over\x20')+('\x27'+String(G['value'])+'\x27\x20(confidence\x20'+G['confidence']+')'));}const j=[];for(const I of e['data']['domains']??[]){if(!DOMAIN_PRIORS['some'](M=>M['domain']===I['domain'])){f['push']('unknown\x20domain\x20\x27'+I['domain']+'\x27\x20ignored\x20(vocabulary:\x20'+DOMAIN_PRIORS['map'](M=>M['domain'])['join'](',\x20')+')');continue;}const J=I['confidence']??0x1;if(!Number['isFinite'](J)){f['push']('domain\x20\x27'+I['domain']+'\x27\x20confidence\x20is\x20not\x20finite;\x20evidence\x20ignored');continue;}const K=Math['max'](0x0,Math['min'](0x1,J));K!==J&&f['push']('domain\x20\x27'+I['domain']+'\x27\x20confidence\x20'+J+'\x20clamped\x20to\x20'+K);K<EVIDENCE_THRESHOLD&&f['push']('domain\x20\x27'+I['domain']+'\x27\x20confidence\x20'+K+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));const L={'domain':I['domain'],'confidence':K};if(I['span']&&I['span']['end']>=I['span']['start'])L['span']={'start':I['span']['start'],'end':I['span']['end']};else{if(I['span'])f['push']('domain\x20\x27'+I['domain']+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped');}if(I['quote']!==undefined)L['quote']=I['quote'];j['push'](L);}j['sort']((M,N)=>{if(N['confidence']!==M['confidence'])return N['confidence']-M['confidence'];return M['domain']['localeCompare'](N['domain']);});const k=[],l=new Set();for(const M of j){if(l['has'](M['domain']))continue;l['add'](M['domain']),k['push'](M);}const m=[];for(const N of e['data']['claims']??[]){if(!SEMANTIC_CLAIM_KEYS['includes'](N['key'])){f['push']('unknown\x20claim\x20\x27'+N['key']+'\x27\x20ignored\x20(vocabulary:\x20'+SEMANTIC_CLAIM_KEYS['join'](',\x20')+')');continue;}const O=N['key'];if(!Number['isFinite'](N['value'])){f['push']('claim\x20\x27'+O+'\x27\x20value\x20is\x20not\x20finite;\x20ignored');continue;}if(N['value']<0x0){f['push']('claim\x20\x27'+O+'\x27\x20value\x20'+N['value']+'\x20is\x20negative;\x20ignored');continue;}const P=N['confidence']??0x1;if(!Number['isFinite'](P)){f['push']('claim\x20\x27'+O+'\x27\x20confidence\x20is\x20not\x20finite;\x20claim\x20ignored');continue;}const Q=Math['max'](0x0,Math['min'](0x1,P));Q!==P&&f['push']('claim\x20\x27'+O+'\x27\x20confidence\x20'+P+'\x20clamped\x20to\x20'+Q);Q<EVIDENCE_THRESHOLD&&f['push']('claim\x20\x27'+O+'\x27\x20confidence\x20'+Q+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));const R={'key':O,'value':N['value'],'confidence':Q};N['span']&&(N['span']['end']<N['span']['start']?f['push']('claim\x20\x27'+O+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped'):R['span']={'start':N['span']['start'],'end':N['span']['end']});if(N['quote']!==undefined)R['quote']=N['quote'];m['push'](R);}m['sort']((S,T)=>{if(S['key']!==T['key'])return S['key']<T['key']?-0x1:0x1;return T['confidence']-S['confidence'];});const n=[],o=new Map();for(const S of m){const T=o['get'](S['key']);if(!T){o['set'](S['key'],S),n['push'](S);continue;}T['value']!==S['value']&&f['push']('conflicting\x20evidence\x20for\x20claim\x20\x27'+S['key']+'\x27:\x20'+('kept\x20'+T['value']+'\x20(confidence\x20'+T['confidence']+')\x20over\x20')+(S['value']+'\x20(confidence\x20'+S['confidence']+')'));}const p=b['source_text']&&b['source_text']['trim']()?b['source_text']:undefined,q=[];for(const U of h){const V=anchorEvidence(p,'trait\x20\x27'+U['trait']+'\x27',U,f);if(!V)continue;if(V['span'])U['span']=V['span'];else delete U['span'];if(V['quote']!==undefined)U['quote']=V['quote'];q['push'](U);}const r=[];for(const W of k){const X=anchorEvidence(p,'domain\x20\x27'+W['domain']+'\x27',W,f);if(!X)continue;if(X['span'])W['span']=X['span'];else delete W['span'];if(X['quote']!==undefined)W['quote']=X['quote'];r['push'](W);}const s=[];for(const Y of n){const Z=anchorEvidence(p,'claim\x20\x27'+Y['key']+'\x27',Y,f);if(!Z)continue;if(Z['span'])Y['span']=Z['span'];else delete Y['span'];if(Z['quote']!==undefined)Y['quote']=Z['quote'];s['push'](Y);}const t=normalizeDiscovery(e['data']['discovery'],f),u=t['industry']!==undefined||t['product_ref']!==undefined||t['english_summary']!==undefined||t['tags']['length']>0x0;q['length']===0x0&&r['length']===0x0&&s['length']===0x0&&!u&&f['push']('semantic_ir\x20carries\x20no\x20usable\x20evidence;\x20keyword\x20inference\x20is\x20the\x20only\x20signal');const v={'source':e['data']['provenance']['source']};if(e['data']['provenance']['model']!==undefined)v['model']=e['data']['provenance']['model'];e['data']['provenance']['prompt_version']!==undefined&&(v['prompt_version']=e['data']['provenance']['prompt_version']);e['data']['provenance']['generated_at']!==undefined&&(v['generated_at']=e['data']['provenance']['generated_at']);const w={'schema_version':SEMANTIC_IR_SCHEMA_VERSION,'locale':e['data']['locale'],'traits':q,'domains':r,'claims':s,'discovery':t,'provenance':v};return{'ir':w,'digest':semanticIrDigest(w),'issues':f};}export function discoverySignal(a){const b=a['discovery'];if((b['confidence']??0x1)<EVIDENCE_THRESHOLD)return undefined;if(b['industry']===undefined&&b['product_ref']===undefined&&b['english_summary']===undefined&&b['tags']['length']===0x0)return undefined;return b;}export function claimNumber(a,b){const c=a['claims']['find'](d=>d['key']===b&&d['confidence']>=EVIDENCE_THRESHOLD);return c?.['value'];}export function mergeSemanticIR(a,b){const c={...a['traits']},d={...a['trait_confidence']},e=[];for(const h of b['traits']){if(h['confidence']<EVIDENCE_THRESHOLD)continue;const i=a['trait_confidence'][h['trait']],j=a['traits'][h['trait']];i!==undefined&&j!==h['value']?(e['push']({'trait':h['trait'],'keyword_value':j,'keyword_confidence':i,'ir_value':h['value'],'ir_confidence':h['confidence']}),d[h['trait']]=h['confidence']):d[h['trait']]=Math['max'](i??0x0,h['confidence']),c[h['trait']]=h['value'];}const f=Object['values'](d)['filter'](k=>(k??0x0)>=EVIDENCE_THRESHOLD)['length'],g=Math['min'](0x1,Math['max'](a['confidence'],f/TRAIT_KEYS['length']));return{'traits':c,'confidence':g,'matched_keywords':[...a['matched_keywords']],'trait_confidence':d,'conflicts':e};}export function domainPriorsFromIR(a){const b=[];for(const c of a['domains']){if(c['confidence']<EVIDENCE_THRESHOLD)continue;const e=DOMAIN_PRIORS['find'](f=>f['domain']===c['domain']);if(!e)continue;b['push']({'domain':e['domain'],'matched_keywords':[],'industries':[...e['industries']],'boost':e['boost'],'source':'semantic_ir'});}return b;}export function mergeDomainPriors(a,b){const c=new Map();for(const d of a){c['set'](d['domain'],{...d,'source':d['source']??'keyword'});}for(const e of b){const f=c['get'](e['domain']);if(!f){c['set'](e['domain'],e);continue;}c['set'](e['domain'],{...f,'matched_keywords':[...new Set([...f['matched_keywords'],...e['matched_keywords']])],'industries':[...new Set([...f['industries'],...e['industries']])],'boost':Math['max'](f['boost'],e['boost']),'source':'both'});}return Array['from'](c['values']());}
@@ -1 +1 @@
1
- export const SERVICE_PERMISSIONS=[{'index':0x12c,'name':'SERVICE_NEW','description':'Create\x20new\x20Service','governed_operation':'create\x20a\x20new\x20Service','post_publish_mutability':'na'},{'index':0x12d,'name':'SERVICE_DESCRIPTION','description':'Modify\x20Service\x20description','governed_operation':'modify\x20the\x20Service\x20description','post_publish_mutability':'mutable'},{'index':0x12f,'name':'SERVICE_LOCATION','description':'Set\x20Service\x20location/URL','governed_operation':'set\x20the\x20Service\x20location/URL','post_publish_mutability':'mutable'},{'index':0x130,'name':'SERVICE_REPOSITORY','description':'Add/remove\x20Repository\x20references','governed_operation':'add/remove/clear\x20Repository\x20references','post_publish_mutability':'mutable'},{'index':0x131,'name':'SERVICE_SALES','description':'Add/set/remove/clear\x20sales\x20items;\x20opt\x20SKUs\x20into\x20refund\x20restocking\x20(per-SKU\x20restock\x20flag\x20and\x20order\x20restock)','governed_operation':'add/set/remove/clear\x20sales\x20items;\x20restock\x20flags\x20+\x20order\x20restock','post_publish_mutability':'mutable'},{'index':0x132,'name':'SERVICE_MACHINE','description':'Bind/unbind\x20Machine\x20workflow\x20template','governed_operation':'bind/unbind\x20the\x20Machine\x20workflow\x20template','post_publish_mutability':'immutable'},{'index':0x133,'name':'SERVICE_BUY_GUARD','description':'Set/clear\x20buy\x20Guard\x20(post-publish\x20mutable)','governed_operation':'set/clear\x20the\x20buy_guard\x20check','post_publish_mutability':'mutable'},{'index':0x134,'name':'SERVICE_ARBITRATION','description':'Add/remove\x20Arbitration\x20references','governed_operation':'add/remove/clear\x20Arbitration\x20references','post_publish_mutability':'immutable'},{'index':0x135,'name':'SERVICE_CUSTOMER_INFO_REQUIRED','description':'Set\x20customer\x20required\x20info\x20fields','governed_operation':'set\x20customer\x20required\x20info\x20fields','post_publish_mutability':'mutable'},{'index':0x136,'name':'SERVICE_PAUSE','description':'Pause/resume\x20Service\x20(block\x20new\x20orders)','governed_operation':'pause/resume\x20the\x20Service','post_publish_mutability':'mutable'},{'index':0x137,'name':'SERVICE_PUBLISH','description':'Publish\x20Service\x20(IRREVERSIBLE)','governed_operation':'publish\x20the\x20Service\x20(irreversible)','post_publish_mutability':'one_shot'},{'index':0x138,'name':'SERVICE_DISCOUNT','description':'Issue/discount_destroy\x20discount\x20coupons','governed_operation':'issue/destroy\x20discount\x20coupons','post_publish_mutability':'mutable'},{'index':0x139,'name':'SERVICE_ORDER_ALLOCATOR','description':'Set\x20order\x20allocator\x20strategy','governed_operation':'set\x20the\x20order_allocators\x20strategy','post_publish_mutability':'immutable'},{'index':0x13a,'name':'SERVICE_COMPENSATION_FUND_WITHDRAW','description':'Withdraw\x20compensation\x20fund\x20(time-locked)','governed_operation':'withdraw\x20from\x20the\x20compensation_fund\x20(time-locked)','post_publish_mutability':'locked_by_duration'},{'index':0x13b,'name':'SERVICE_COMPENSATION_FUND_DEPOSIT','description':'Deposit\x20to\x20compensation\x20fund','governed_operation':'deposit\x20to\x20the\x20compensation_fund','post_publish_mutability':'mutable'},{'index':0x13c,'name':'SERVICE_COMPENSATION_FUND_RECEIVE','description':'Receive\x20compensation\x20fund\x20(arbitration\x20payout)','governed_operation':'receive\x20the\x20compensation_fund\x20payout\x20(arbitration\x20payout)','post_publish_mutability':'mutable'},{'index':0x13d,'name':'SERVICE_COMPENSATION_LOCK_DURATION_ADD','description':'Extend\x20setting_lock_duration\x20(only-increase)','governed_operation':'extend\x20setting_lock_duration\x20(only-increase)','post_publish_mutability':'mutable'},{'index':0x13e,'name':'SERVICE_REWARD','description':'Add/remove\x20Reward\x20references\x20(remove/clear\x20time-locked)','governed_operation':'add/remove/clear\x20Reward\x20references','post_publish_mutability':'locked_by_duration'},{'index':0x13f,'name':'SERVICE_OWNER_RECEIVE','description':'Receive\x20Payment/objects\x20to\x20owner','governed_operation':'receive\x20Payments/objects\x20to\x20owner','post_publish_mutability':'mutable'},{'index':0x140,'name':'SERVICE_UM','description':'Bind/unbind\x20Contact\x20as\x20UM','governed_operation':'bind/unbind\x20Contact\x20as\x20UM','post_publish_mutability':'mutable'},{'index':0x141,'name':'SERVICE_ARB_STATEMENT','description':'Append\x20seller\x20statement\x20to\x20an\x20Arb\x20case\x20(event-only)','governed_operation':'append\x20seller\x20text\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20this\x20service\x20(ArbStatementEvent;\x20no\x20Arb\x20state\x20change)','post_publish_mutability':'mutable'}];export const SERVICE_LISTING_REFUND_GATES={'price_floor':{'rule':'A\x20sale\x20listed\x20at\x20price\x200\x20is\x20REFUSED\x20at\x20construction\x20time\x20(aborts\x20E_PRICE_BELOW_FLOOR\x20=\x2044)\x20—\x20applies\x20to\x20every\x20sale-minting\x20path\x20(sales\x20add\x20/\x20sales\x20set\x20/\x20replace).\x20The\x20SDK\x20refuses\x20it\x20locally\x20in\x20the\x20sale\x20builder.','rationale':'A\x20zero-priced\x20listing\x20plus\x20an\x20allocation-free\x200-amount\x20order\x20produced\x20stores\x20whose\x20entire\x20economics\x20live\x20outside\x20the\x20chain.\x20Repricing\x20an\x20EXISTING\x20sale\x20down\x20to\x20zero\x20stays\x20legal\x20and\x20is\x20caught\x20at\x20buy\x20time\x20by\x20the\x20zero-total\x20order\x20gate.'},'restock':{'rule':'Refund\x20restocking\x20is\x20opt-in\x20per\x20SKU:\x20the\x20merchant\x20marks\x20an\x20ALIVE\x20sale\x20with\x20the\x20restock\x20flag\x20(305),\x20then\x20a\x20refunded\x20order\x27s\x20purchased\x20units\x20can\x20be\x20put\x20back\x20on\x20shelf\x20(305).\x20Two-pass\x20on-chain\x20(validate\x20every\x20line,\x20then\x20apply)\x20—\x20ALL\x20lines\x20restock\x20or\x20NOTHING\x20mutates.\x20Unflagged\x20or\x20delisted\x20lines\x20abort\x20E_RESTOCK_NOT_FLAGGED\x20=\x2046\x20/\x20E_SALE_ITEM_NOT_FOUND.\x20Quantities\x20come\x20from\x20the\x20order\x27s\x20purchase\x20rows.\x20ONCE-PER-ORDER:\x20the\x20restock\x20operation\x20stamps\x20the\x20order\x20with\x20a\x20RestockStamp\x20dynamic\x20field\x20and\x20a\x20second\x20call\x20for\x20the\x20same\x20order\x20aborts\x20E_RESTOCK_ALREADY_APPLIED\x20=\x2049\x20(a\x20replay\x20would\x20stack\x20the\x20purchased\x20units\x20again,\x20an\x20unbounded\x20+quantity).\x20OWNERSHIP-BOUND:\x20only\x20an\x20order\x20whose\x20service\x20field\x20is\x20THIS\x20service\x20restocks\x20here\x20—\x20a\x20foreign\x20order\x20aborts\x20E_ORDER_SERVICE_NOT_MATCH\x20=\x2026.\x20The\x20applied\x20state\x20is\x20readable\x20via\x20the\x20public\x20restock_applied\x20flag.','events':'StockRestockedEvent\x20per\x20line\x20(service,\x20order,\x20item,\x20quantity,\x20time).'},'dismissal_conclusion':{'rule':'The\x20dismissal\x20conclusion\x20stamps\x20a\x20CONCLUDED,\x20DEFENDANT-FAVORED\x20ruling\x20onto\x20the\x20order\x20(claimed_by\x20=\x20case\x20address)\x20—\x20the\x20mirror\x20of\x20the\x20compensation\x20claim.\x20Requires:\x20order\x20belongs\x20to\x20this\x20service,\x20arbitration\x20on\x20the\x20merchant\x20allowlist,\x20no\x20self-judging\x20(E_ARBITRATION_PERMISSION_CONFLICT),\x20case\x20concluded\x20(Arbitrated/Withdrawn)\x20AND\x20indemnity\x20none/0\x20(E_CASE_NOT_DISMISSAL_CONCLUSION\x20=\x2048).\x20Permissionless\x20keeper\x20surface;\x20writes\x20a\x20flag,\x20moves\x20no\x20funds.','closes':'A\x20dismissal\x20ruling\x20would\x20otherwise\x20never\x20stamp\x20claimed_by\x20(the\x20zero-indemnity\x20claim\x20gate\x20refuses\x20the\x20claim\x20path),\x20so\x20a\x20buyer\x20who\x20LOST\x20the\x20case\x20kept\x20every\x20`claimed_by\x20none`\x20refund\x20rail\x20open\x20forever.'}};export const SERVICE_ORDER_FLOW_STAGES=[{'stage':0x1,'name':'pre_check','preconditions':['Service.bPublished\x20==\x20true\x20(else\x20E_NOT_PUBLISHED,\x20service:7)','Service.bPaused\x20==\x20false\x20(else\x20E_PAUSED,\x20service:19)','buy_guard\x20(if\x20set)\x20added\x20to\x20guards[]\x20list\x20for\x20verification'],'side_effects':[],'always_executed':!![]},{'stage':0x2,'name':'wip_verify','preconditions':['buy.items\x20non-empty','Each\x20item.name\x20matches\x20a\x20sale\x20in\x20Service.sales\x20(else\x20E_SALE_ITEM_NOT_FOUND,\x20service:32)','sale.suspension\x20==\x20false\x20(else\x20E_SALE_SUSPENDED)'],'side_effects':['If\x20buyer\x20passes\x20empty\x20wip_hash,\x20SDK\x20auto-fills\x20with\x20sale.wip_hash','verifiedWipUrls\x20Set\x20avoids\x20re-verifying\x20same\x20WIP\x20URL\x20across\x20items','verify_wip()\x20fetches\x20WIP\x20file\x20and\x20compares\x20hash\x20(else\x20E_WIP_HASH_NOT_MATCH)'],'always_executed':!![]},{'stage':0x3,'name':'quote','preconditions':['All\x20items\x20have\x20valid\x20sale\x20+\x20wip_hash\x20match','stock\x20>=\x20purchase\x20quantity\x20(else\x20E_STOCK_NOT_ENOUGH,\x20service:16)','discount\x20object\x20(if\x20used)\x20is\x20valid\x20and\x20within\x20its\x20[time_start,\x20time_end]\x20window\x20(else\x20E_DISCOUNT_TIME_INVALID)'],'side_effects':['The\x20quote\x20step\x20computes\x20the\x20total\x20price\x20(with\x20discount\x20if\x20applicable)','⚠️\x20Stock\x20is\x20deducted\x20(split)\x20—\x20side\x20effect\x20is\x20NOT\x20auto-rolled-back\x20on\x20later\x20failure','The\x20on-chain\x20quote\x20call\x20executes\x20(the\x20discount\x20path\x20validates\x20the\x20Clock\x20time-window\x20check)'],'always_executed':!![]},{'stage':0x4,'name':'create_order','preconditions':['Quote\x20object\x20from\x20stage\x203','Registrar\x20+\x20Clock\x20objects\x20available'],'side_effects':['The\x20atomic\x20on-chain\x20buy\x20call\x20executes\x20(passport-gated\x20variant\x20supported)','Order\x20object\x20created\x20(builder=customer,\x20service=Service.id)','Order.id\x20recorded\x20for\x20stages\x205-7'],'always_executed':!![]},{'stage':0x5,'name':'create_allocation','preconditions':['Service.order_allocators\x20is\x20Some\x20(configured)','Order\x20from\x20stage\x204','CoinParam\x20for\x20total_pay\x20matches\x20Service<T>\x20type'],'side_effects':['The\x20on-chain\x20allocation\x20call\x20executes','Allocation\x20object\x20created\x20(guard-selected\x20fund\x20distribution)','Order.allocation\x20=\x20Allocation\x20address'],'always_executed':!![]},{'stage':0x6,'name':'create_progress','preconditions':['Service.machine\x20is\x20Some\x20(machine\x20bound)','Order\x20from\x20stage\x204','Machine\x20from\x20Service.machine'],'side_effects':['The\x20on-chain\x20progress-creation\x20call\x20executes','Progress\x20object\x20created\x20(Progress.machine\x20=\x20Service.machine,\x20Progress.task\x20=\x20Order.id)'],'always_executed':![]},{'stage':0x7,'name':'post_actions','preconditions':['Order/Allocation/Progress\x20objects\x20from\x20stages\x204-6'],'side_effects':['Attach\x20agents\x20to\x20the\x20order\x20(if\x20order_new.agents\x20provided)','order_required_info_update\x20(if\x20order_required_info\x20provided)','Transfer\x20Order\x20ownership\x20(if\x20transfer\x20provided\x20—\x20sets\x20new\x20Order\x20owner)','namedNewOrder\x20/\x20namedNewAllocation\x20/\x20namedNewProgress\x20(local\x20naming)'],'always_executed':![]},{'stage':0x8,'name':'return_result','preconditions':['All\x20preceding\x20stages\x20succeeded'],'side_effects':['Returns\x20BuyResult\x20{\x20order,\x20allocation?,\x20progress?\x20}','Caller\x20proceeds\x20to\x20sign\x20+\x20submit\x20transaction'],'always_executed':!![]}];export const SERVICE_CROSS_OBJECT_BINDINGS=[{'object':'Machine','field':'machine','required':![],'locked_after_publish':!![],'notes':'Workflow\x20template;\x20post-publish\x20immutable\x20(F-S-20).\x20Progress.machine\x20inherits\x20this\x20value.'},{'object':'Guard','field':'buy_guard','required':![],'locked_after_publish':![],'notes':'Buyer\x20eligibility\x20guard;\x20post-publish\x20STILL\x20MUTABLE\x20(unusual\x20—\x20see\x20F-S-26)'},{'object':'Allocation','field':'order_allocators','required':!![],'locked_after_publish':!![],'notes':'Order\x20fund\x20distribution\x20strategy;\x20publish\x20prerequisite\x20(F-S-18).\x20Post-publish\x20immutable\x20(F-S-22).'},{'object':'Arbitration','field':'arbitrations','required':![],'locked_after_publish':![],'notes':'Dispute\x20handlers;\x20required\x20if\x20compensation_fund\x20>\x200\x20(F-S-19).\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-21).'},{'object':'Repository','field':'repositories','required':![],'locked_after_publish':![],'notes':'Shared\x20data\x20stores;\x20mutable\x20post-publish'},{'object':'Reward','field':'rewards','required':![],'locked_after_publish':![],'notes':'Marketing\x20incentives;\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-24)'},{'object':'Contact','field':'um','required':![],'locked_after_publish':![],'notes':'User\x20Manager\x20(Contact\x20object);\x20mutable\x20post-publish'},{'object':'Treasury','field':'(indirect\x20via\x20order_allocators.sharing.who=Entity)','required':![],'locked_after_publish':![],'notes':'Treasury\x20is\x20referenced\x20by\x20Allocation.sharing.who,\x20not\x20by\x20Service\x20directly'}];export const SERVICE_SCENES=[{'id':'service_retail','name':'Retail\x20e-commerce\x20Service','category':'retail','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL','set\x20customer\x20required\x20info\x20fields'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','pause/resume\x20the\x20Service\x20(310)','add/set/remove/clear\x20sales\x20items\x20(305)','set\x20the\x20order_allocators\x20strategy\x20(313)','set/clear\x20the\x20buy_guard\x20check\x20(307)','issue/destroy\x20discount\x20coupons\x20(312)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)'],'common_patterns':['Multi-tier\x20pricing\x20via\x20sales[]\x20(Standard/Premium/Enterprise)','WIP\x20hash\x20per\x20sale\x20item\x20for\x20tamper-proof\x20product\x20info','buy_guard\x20for\x20KYC\x20whitelist\x20during\x20pre-sale,\x20then\x20null\x20for\x20public\x20sale','compensation_fund\x20deposited\x20before\x20publish\x20+\x20arbitrations\x20configured'],'recommended_templates':['T-S-01','T-S-06']},{'id':'service_rental','name':'Rental\x20Service\x20(short/long-term)','category':'rental','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','bind\x20the\x20Machine\x20workflow\x20(306)\x20—\x20for\x20rental\x20workflow','add\x20Arbitration\x20references\x20(308)\x20—\x20for\x20deposit\x20disputes'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20recommended\x20(rental\x20workflow\x20with\x20deposit/return\x20stages)','arbitrations\x20recommended\x20(deposit\x20refund\x20disputes)'],'common_patterns':['Machine\x20workflow\x20with\x20\x27Deposit\x20→\x20Use\x20→\x20Return\x20→\x20Refund\x27\x20nodes','compensation_fund\x20holds\x20deposit\x20guarantees','buy_guard\x20verifies\x20renter\x20identity/KYC','stock=1\x20per\x20rental\x20item\x20(unique\x20items)'],'recommended_templates':['T-S-02','T-S-04']},{'id':'service_subscription','name':'Subscription\x20Service\x20(recurring)','category':'subscription','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','issue\x20discount\x20coupons\x20(312)\x20—\x20promotional\x20rates','add\x20Reward\x20references\x20(318)\x20—\x20loyalty\x20rewards'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Tiered\x20plans\x20(Free/Pro/Enterprise)\x20as\x20sales[]','Discount\x20coupons\x20for\x20trial\x20periods','Rewards\x20for\x20long-term\x20subscribers','Renewal\x20handled\x20by\x20repeat\x20orders\x20(no\x20native\x20recurring\x20billing)'],'recommended_templates':['T-S-03']},{'id':'service_workflow','name':'Workflow-bound\x20Service\x20(machine-bound)','category':'workflow','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['bind\x20the\x20Machine\x20workflow\x20(306)','publish\x20the\x20Service\x20(311)','set\x20the\x20order_allocators\x20strategy\x20(313)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20must\x20be\x20published\x20before\x20binding','machine\x20recommended\x20for\x20any\x20multi-stage\x20service\x20delivery'],'common_patterns':['Machine\x20defines\x20Pay\x20→\x20Confirm\x20→\x20Deliver\x20→\x20Sign-off\x20nodes','Progress\x20created\x20per\x20order\x20(stage\x206\x20of\x20buy\x20flow)','Named\x20operators\x20assigned\x20per\x20Forward\x20in\x20Machine','Service.paused\x20does\x20NOT\x20affect\x20already-created\x20Progress\x20(existing\x20orders\x20continue)'],'recommended_templates':['T-S-04']},{'id':'service_arbitration','name':'Arbitration-bound\x20Service\x20(dispute-ready)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)','deposit\x20to\x20the\x20compensation_fund\x20(315)','extend\x20setting_lock_duration\x20(317)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)','Arbitration\x20objects\x20must\x20be\x20created\x20before\x20binding','compensation_fund_add\x20before\x20publish\x20recommended\x20(else\x20post-publish\x20deposit\x20still\x20possible)'],'common_patterns':['2-3\x20Arbitration\x20objects\x20(different\x20arb\x20committees\x20for\x20different\x20dispute\x20types)','compensation_fund\x20deposited\x20as\x20%\x20of\x20expected\x20order\x20volume','setting_lock_duration\x20extended\x20by\x20owner\x20to\x20build\x20customer\x20trust','Arbitration\x20compensation\x20payout\x20triggered\x20by\x20the\x20arbitration\x20result\x20(not\x20by\x20Service\x20directly)'],'recommended_templates':['T-S-05','T-S-06']},{'id':'service_compensation_fund','name':'Compensation\x20Fund\x20Service\x20(embedded\x20balance)','category':'compensation_fund','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['deposit\x20to\x20the\x20compensation_fund\x20(315)','withdraw\x20from\x20the\x20compensation_fund\x20(314)\x20—\x20time-locked\x20after\x20publish','receive\x20the\x20compensation_fund\x20payout\x20(316)\x20—\x20arbitration\x20payout\x20(always\x20mutable)','extend\x20setting_lock_duration\x20(317)\x20—\x20extend\x20lock'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['compensation_fund\x20>\x200\x20→\x20arbitrations\x20non-empty\x20(F-S-19)','compensation_fund\x20coin\x20type\x20must\x20match\x20Service<T>\x20type\x20parameter'],'common_patterns':['Fund\x20inflow:\x20compensation_fund_add\x20(315)\x20—\x20always\x20mutable','Fund\x20outflow:\x20compensation_fund_withdraw\x20(314)\x20—\x20requires\x20bPaused\x20+\x20lock_duration\x20expired','Fund\x20receive:\x20compensation_fund_receive\x20(316)\x20—\x20arbitration\x20payout,\x20always\x20mutable','Fund\x20consumer:\x20arbitration\x20compensation\x20payout\x20(driven\x20by\x20arb\x20result)','Distinct\x20from\x20Treasury:\x20Service-internal,\x20arbitration-bound,\x20lock-protected'],'recommended_templates':['T-S-06']},{'id':'service_reward','name':'Reward-attached\x20Service\x20(marketing)','category':'reward','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add/remove/clear\x20Reward\x20references\x20(318)\x20—\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish','issue/destroy\x20discount\x20coupons\x20(312)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Rewards\x20added\x20post-publish\x20(always\x20allowed;\x20remove/clear\x20is\x20time-locked\x20after\x20publish)','Reward\x20objects\x20must\x20exist\x20before\x20binding\x20(queryObjectsWithType\x20validation)','MAX_REWARD_COUNT\x20=\x2020\x20per\x20Service','Reward\x20remove/clear\x20requires\x20Service\x20paused\x20+\x20setting_lock_duration\x20elapsed\x20(protects\x20customer\x20expectations)'],'recommended_templates':['T-S-08']},{'id':'service_arbitration_binding','name':'Arbitration\x20Binding\x20Service\x20(post-publish\x20immutable)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','remove\x20an\x20Arbitration\x20reference\x20(308)\x20—\x20pre-publish\x20only','clear\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['MAX_ARBITRATION_COUNT\x20=\x2020\x20per\x20Service\x20(F-S-04)','Each\x20Arbitration\x20object\x20must\x20be\x20valid\x20(queryObjectsWithType\x20validation)','Arbitration\x20bound\x20=\x20locked\x20post-publish\x20(F-S-21).\x20To\x20change:\x20create\x20new\x20Service.'],'common_patterns':['Pre-publish:\x20set\x201-3\x20Arbitration\x20objects\x20for\x20different\x20dispute\x20scopes','Post-publish:\x20immutable\x20—\x20clone\x20Service\x20if\x20change\x20needed','⚠️\x20Data\x20inconsistency:\x20dynamic-pricing.ts\x20marks\x20arbitrations\x20as\x20mutable,\x20but\x20SDK\x20blocks\x20it\x20(F-S-21)'],'recommended_templates':['T-S-05']},{'id':'service_buy_guard','name':'Buy\x20Guard\x20Service\x20(post-publish\x20mutable\x20guard)','category':'buy_guard','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['bind\x20the\x20buy_guard\x20Guard\x20(307)','clear\x20the\x20buy_guard\x20Guard\x20(307)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Pre-sale\x20phase:\x20buy_guard\x20=\x20whitelist\x20Guard\x20(KYC\x20verified\x20buyers\x20only)','Public\x20sale:\x20buy_guard\x20=\x20null\x20(anyone\x20can\x20buy)','Restricted\x20phase:\x20buy_guard\x20=\x20KYC\x20Guard\x20(compliance)','⚠️\x20buy_guard\x20is\x20the\x20ONLY\x20publish-locked-field\x20exception\x20—\x20still\x20mutable\x20post-publish','buy_guard\x20verification\x20happens\x20at\x20Stage\x201\x20of\x20buy\x20flow\x20(pre_check)'],'recommended_templates':['T-S-01']},{'id':'service_order_allocator','name':'Order\x20Allocator\x20Service\x20(fund\x20distribution\x20config)','category':'order_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)\x20—\x20requires\x20order_allocators\x20(F-S-18)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','Allocators.sharing.who\x20can\x20reference\x20Treasury\x20addresses\x20(indirect\x20Treasury\x20binding)','MAX_SHARING_COUNT\x20=\x20100\x20per\x20allocator'],'common_patterns':['Multi-party\x20split:\x20merchant\x2080%\x20/\x20platform\x2010%\x20/\x20logistics\x2010%','Threshold-based:\x20different\x20allocators\x20for\x20different\x20order\x20sizes','Guard-bound\x20allocator:\x20allocation\x20execution\x20requires\x20Guard\x20verification','Post-publish\x20immutable\x20—\x20clone\x20Service\x20to\x20change\x20allocation\x20strategy'],'recommended_templates':['T-S-08']},{'id':'service_dynamic_pricing','name':'Dynamic\x20Pricing\x20Service\x20(discount-driven)','category':'dynamic_pricing','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['issue\x20discount\x20coupons\x20(312)','add/set\x20sales\x20items\x20(305)\x20—\x20adjust\x20base\x20prices','remove\x20sales\x20items\x20(305)\x20—\x20remove\x20deprecated\x20SKUs'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Discount\x20types:\x200=rates\x20(basis\x20points,\x20per\x2010000),\x201=minus\x20(direct\x20deduction)','MAX_DISCOUNT_COUNT_ONCE\x20=\x201000\x20per\x20issue\x20call','MAX_DISCOUNT_RECEIVER_ONCE\x20=\x201000\x20receivers\x20per\x20call','MAX_DISCOUNT_TOTAL_COUNT\x20=\x2020000\x20total\x20coupons','discount_destroy:\x20holder-only\x20(no\x20SERVICE_DISCOUNT\x20permission\x20needed)','discount_send:\x20holder-only\x20transfer\x20of\x20owned\x20transferable:true\x20coupons\x20to\x20another\x20address\x20(no\x20permission\x20needed)'],'recommended_templates':['T-S-07']},{'id':'service_multi_allocator','name':'Multi-Allocator\x20Service\x20(tiered\x20fund\x20distribution)','category':'multi_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set','Each\x20allocator\x20has\x20its\x20own\x20Guard\x20+\x20sharing\x20+\x20threshold','Each\x20allocator\x20is\x20bound\x20to\x20a\x20DIFFERENT\x20guard\x20—\x20the\x20caller\x27s\x20submitted\x20guard\x20selects\x20which\x20path\x20fires'],'common_patterns':['Tier\x201\x20(small\x20orders):\x20single-recipient\x20allocator\x20(low\x20fee)','Tier\x202\x20(medium\x20orders):\x20two-recipient\x20split\x20(merchant\x20+\x20platform)','Tier\x203\x20(large\x20orders):\x20three-recipient\x20split\x20(merchant\x20+\x20platform\x20+\x20logistics)','Each\x20tier\x20can\x20have\x20its\x20own\x20Guard\x20for\x20execution\x20authorization'],'recommended_templates':['T-S-08']}];export const SERVICE_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return SERVICE_SCENES['filter'](b=>b['category']===a);}export function findSceneById(a){return SERVICE_SCENES['find'](b=>b['id']===a);}export function getServicePermissionByIndex(a){return SERVICE_PERMISSIONS['find'](b=>b['index']===a);}export function isServicePermission(a){return getServicePermissionByIndex(a)!==undefined;}export function getPermissionsByMutability(a){return SERVICE_PERMISSIONS['filter'](b=>b['post_publish_mutability']===a);}export function getImmutablePostPublishPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='immutable'||a['post_publish_mutability']==='one_shot');}export function getLockedByDurationPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='locked_by_duration');}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['retail','retail'],['ecommerce','retail'],['rental','rental'],['rent','rental'],['short-term\x20rental','rental'],['long-term\x20rental','rental'],['subscription','subscription'],['subscribe','subscription'],['workflow','workflow'],['machine-bound','workflow'],['arbitration','arbitration'],['dispute','arbitration'],['compensation','compensation_fund'],['compensation_fund','compensation_fund'],['reward','reward'],['marketing','reward'],['buy_guard','buy_guard'],['kyc','buy_guard'],['whitelist','buy_guard'],['allocator','order_allocator'],['discount','dynamic_pricing'],['coupon','dynamic_pricing'],['multi-allocator','multi_allocator'],['tiered','multi_allocator']];for(const [d,e]of c){if(b['includes'](d)){const f=getScenesByCategory(e);if(f['length']>0x0)return f[0x0];}}if(b['includes']('service'))return findSceneById('service_retail');return undefined;}export function getAllServiceScenes(){return[...SERVICE_SCENES];}export function getServiceScenesCount(){return SERVICE_SCENES['length'];}export function getServicePermissionsCount(){return SERVICE_PERMISSIONS['length'];}export function getOrderFlowStage(a){return SERVICE_ORDER_FLOW_STAGES['find'](b=>b['stage']===a);}export function getCrossObjectBindings(){return[...SERVICE_CROSS_OBJECT_BINDINGS];}
1
+ export const SERVICE_PERMISSIONS=[{'index':0x12c,'name':'SERVICE_NEW','description':'Create\x20new\x20Service','governed_operation':'create\x20a\x20new\x20Service','post_publish_mutability':'na'},{'index':0x12d,'name':'SERVICE_DESCRIPTION','description':'Modify\x20Service\x20description','governed_operation':'modify\x20the\x20Service\x20description','post_publish_mutability':'mutable'},{'index':0x12f,'name':'SERVICE_LOCATION','description':'Set\x20Service\x20location/URL','governed_operation':'set\x20the\x20Service\x20location/URL','post_publish_mutability':'mutable'},{'index':0x130,'name':'SERVICE_REPOSITORY','description':'Add/remove\x20Repository\x20references','governed_operation':'add/remove/clear\x20Repository\x20references','post_publish_mutability':'mutable'},{'index':0x131,'name':'SERVICE_SALES','description':'Add/set/remove/clear\x20sales\x20items;\x20opt\x20SKUs\x20into\x20refund\x20restocking\x20(per-SKU\x20restock\x20flag\x20and\x20order\x20restock)','governed_operation':'add/set/remove/clear\x20sales\x20items;\x20restock\x20flags\x20+\x20order\x20restock','post_publish_mutability':'mutable'},{'index':0x132,'name':'SERVICE_MACHINE','description':'Bind/unbind\x20Machine\x20workflow\x20template','governed_operation':'bind/unbind\x20the\x20Machine\x20workflow\x20template','post_publish_mutability':'immutable'},{'index':0x133,'name':'SERVICE_BUY_GUARD','description':'Set/clear\x20buy\x20Guard\x20(post-publish\x20mutable)','governed_operation':'set/clear\x20the\x20buy_guard\x20check','post_publish_mutability':'mutable'},{'index':0x134,'name':'SERVICE_ARBITRATION','description':'Add/remove\x20Arbitration\x20references','governed_operation':'add/remove/clear\x20Arbitration\x20references','post_publish_mutability':'immutable'},{'index':0x135,'name':'SERVICE_CUSTOMER_INFO_REQUIRED','description':'Set\x20customer\x20required\x20info\x20fields','governed_operation':'set\x20customer\x20required\x20info\x20fields','post_publish_mutability':'mutable'},{'index':0x136,'name':'SERVICE_PAUSE','description':'Pause/resume\x20Service\x20(block\x20new\x20orders)','governed_operation':'pause/resume\x20the\x20Service','post_publish_mutability':'mutable'},{'index':0x137,'name':'SERVICE_PUBLISH','description':'Publish\x20Service\x20(IRREVERSIBLE)','governed_operation':'publish\x20the\x20Service\x20(irreversible)','post_publish_mutability':'one_shot'},{'index':0x138,'name':'SERVICE_DISCOUNT','description':'Issue/discount_destroy\x20discount\x20coupons','governed_operation':'issue/destroy\x20discount\x20coupons','post_publish_mutability':'mutable'},{'index':0x139,'name':'SERVICE_ORDER_ALLOCATOR','description':'Set\x20order\x20allocator\x20strategy','governed_operation':'set\x20the\x20order_allocators\x20strategy','post_publish_mutability':'immutable'},{'index':0x13a,'name':'SERVICE_COMPENSATION_FUND_WITHDRAW','description':'Withdraw\x20compensation\x20fund\x20(time-locked)','governed_operation':'withdraw\x20from\x20the\x20compensation_fund\x20(time-locked)','post_publish_mutability':'locked_by_duration'},{'index':0x13b,'name':'SERVICE_COMPENSATION_FUND_DEPOSIT','description':'Deposit\x20to\x20compensation\x20fund','governed_operation':'deposit\x20to\x20the\x20compensation_fund','post_publish_mutability':'mutable'},{'index':0x13c,'name':'SERVICE_COMPENSATION_FUND_RECEIVE','description':'Receive\x20compensation\x20fund\x20(arbitration\x20payout)','governed_operation':'receive\x20the\x20compensation_fund\x20payout\x20(arbitration\x20payout)','post_publish_mutability':'mutable'},{'index':0x13d,'name':'SERVICE_COMPENSATION_LOCK_DURATION_ADD','description':'Extend\x20setting_lock_duration\x20(only-increase)','governed_operation':'extend\x20setting_lock_duration\x20(only-increase)','post_publish_mutability':'mutable'},{'index':0x13e,'name':'SERVICE_REWARD','description':'Add/remove\x20Reward\x20references\x20(remove/clear\x20time-locked)','governed_operation':'add/remove/clear\x20Reward\x20references','post_publish_mutability':'locked_by_duration'},{'index':0x13f,'name':'SERVICE_OWNER_RECEIVE','description':'Receive\x20Payment/objects\x20to\x20owner','governed_operation':'receive\x20Payments/objects\x20to\x20owner','post_publish_mutability':'mutable'},{'index':0x140,'name':'SERVICE_UM','description':'Bind/unbind\x20Contact\x20as\x20UM','governed_operation':'bind/unbind\x20Contact\x20as\x20UM','post_publish_mutability':'mutable'},{'index':0x141,'name':'SERVICE_ARB_STATEMENT','description':'Append\x20seller\x20statement\x20to\x20an\x20Arb\x20case\x20(event-only)','governed_operation':'append\x20seller\x20text\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20this\x20service\x20(ArbStatementEvent;\x20no\x20Arb\x20state\x20change)','post_publish_mutability':'mutable'}];export const SERVICE_LISTING_REFUND_GATES={'price_floor':{'rule':'A\x20sale\x20listed\x20at\x20price\x200\x20is\x20REFUSED\x20at\x20construction\x20time\x20(aborts\x20E_PRICE_BELOW_FLOOR\x20=\x2044)\x20—\x20applies\x20to\x20every\x20sale-minting\x20path\x20(sales\x20add\x20/\x20sales\x20set\x20/\x20replace).\x20The\x20SDK\x20refuses\x20it\x20locally\x20in\x20the\x20sale\x20builder.','rationale':'A\x20zero-priced\x20listing\x20plus\x20an\x20allocation-free\x200-amount\x20order\x20produced\x20stores\x20whose\x20entire\x20economics\x20live\x20outside\x20the\x20chain.\x20Repricing\x20an\x20EXISTING\x20sale\x20down\x20to\x20zero\x20stays\x20legal\x20and\x20is\x20caught\x20at\x20buy\x20time\x20by\x20the\x20zero-total\x20order\x20gate.'},'restock':{'rule':'Refund\x20restocking\x20is\x20opt-in\x20per\x20SKU:\x20the\x20merchant\x20marks\x20an\x20ALIVE\x20sale\x20with\x20the\x20restock\x20flag\x20(305),\x20then\x20a\x20refunded\x20order\x27s\x20purchased\x20units\x20can\x20be\x20put\x20back\x20on\x20shelf\x20(305).\x20Two-pass\x20on-chain\x20(validate\x20every\x20line,\x20then\x20apply)\x20—\x20ALL\x20lines\x20restock\x20or\x20NOTHING\x20mutates.\x20Unflagged\x20or\x20delisted\x20lines\x20abort\x20E_RESTOCK_NOT_FLAGGED\x20=\x2046\x20/\x20E_SALE_ITEM_NOT_FOUND.\x20Quantities\x20come\x20from\x20the\x20order\x27s\x20purchase\x20rows.\x20ONCE-PER-ORDER:\x20the\x20restock\x20operation\x20stamps\x20the\x20order\x20with\x20a\x20RestockStamp\x20dynamic\x20field\x20and\x20a\x20second\x20call\x20for\x20the\x20same\x20order\x20aborts\x20E_RESTOCK_ALREADY_APPLIED\x20=\x2049\x20(a\x20replay\x20would\x20stack\x20the\x20purchased\x20units\x20again,\x20an\x20unbounded\x20+quantity).\x20OWNERSHIP-BOUND:\x20only\x20an\x20order\x20whose\x20service\x20field\x20is\x20THIS\x20service\x20restocks\x20here\x20—\x20a\x20foreign\x20order\x20aborts\x20E_ORDER_SERVICE_NOT_MATCH\x20=\x2026.\x20The\x20applied\x20state\x20is\x20readable\x20via\x20the\x20public\x20restock_applied\x20flag.','events':'StockRestockedEvent\x20per\x20line\x20(service,\x20order,\x20item,\x20quantity,\x20time).'},'dismissal_conclusion':{'rule':'The\x20dismissal\x20conclusion\x20stamps\x20a\x20CONCLUDED,\x20DEFENDANT-FAVORED\x20ruling\x20onto\x20the\x20order\x20(claimed_by\x20=\x20case\x20address)\x20—\x20the\x20mirror\x20of\x20the\x20compensation\x20claim.\x20Requires:\x20order\x20belongs\x20to\x20this\x20service,\x20arbitration\x20on\x20the\x20merchant\x20allowlist,\x20no\x20self-judging\x20(E_ARBITRATION_PERMISSION_CONFLICT),\x20case\x20concluded\x20(Arbitrated/Withdrawn)\x20AND\x20indemnity\x20none/0\x20(E_CASE_NOT_DISMISSAL_CONCLUSION\x20=\x2048).\x20Permissionless\x20keeper\x20surface;\x20writes\x20a\x20flag,\x20moves\x20no\x20funds.','closes':'A\x20dismissal\x20ruling\x20would\x20otherwise\x20never\x20stamp\x20claimed_by\x20(the\x20zero-indemnity\x20claim\x20gate\x20refuses\x20the\x20claim\x20path),\x20so\x20a\x20buyer\x20who\x20LOST\x20the\x20case\x20kept\x20every\x20`claimed_by\x20none`\x20refund\x20rail\x20open\x20forever.'}};export const SERVICE_ORDER_FLOW_STAGES=[{'stage':0x1,'name':'pre_check','preconditions':['Service.bPublished\x20==\x20true\x20(else\x20E_NOT_PUBLISHED,\x20service:7)','Service.bPaused\x20==\x20false\x20(else\x20E_PAUSED,\x20service:19)','buy_guard\x20(if\x20set)\x20added\x20to\x20guards[]\x20list\x20for\x20verification'],'side_effects':[],'always_executed':!![]},{'stage':0x2,'name':'wip_verify','preconditions':['buy.items\x20non-empty','Each\x20item.name\x20matches\x20a\x20sale\x20in\x20Service.sales\x20(else\x20E_SALE_ITEM_NOT_FOUND,\x20service:32)','sale.suspension\x20==\x20false\x20(else\x20E_SALE_SUSPENDED)'],'side_effects':['If\x20buyer\x20passes\x20empty\x20wip_hash,\x20SDK\x20auto-fills\x20with\x20sale.wip_hash','verifiedWipUrls\x20Set\x20avoids\x20re-verifying\x20same\x20WIP\x20URL\x20across\x20items','verify_wip()\x20fetches\x20WIP\x20file\x20and\x20compares\x20hash\x20(else\x20E_WIP_HASH_NOT_MATCH)'],'always_executed':!![]},{'stage':0x3,'name':'quote','preconditions':['All\x20items\x20have\x20valid\x20sale\x20+\x20wip_hash\x20match','stock\x20>=\x20purchase\x20quantity\x20(else\x20E_STOCK_NOT_ENOUGH,\x20service:16)','discount\x20object\x20(if\x20used)\x20is\x20valid\x20and\x20within\x20its\x20[time_start,\x20time_end]\x20window\x20(else\x20E_DISCOUNT_TIME_INVALID)'],'side_effects':['The\x20quote\x20step\x20computes\x20the\x20total\x20price\x20(with\x20discount\x20if\x20applicable)','⚠️\x20Stock\x20is\x20deducted\x20(split)\x20—\x20side\x20effect\x20is\x20NOT\x20auto-rolled-back\x20on\x20later\x20failure','The\x20on-chain\x20quote\x20call\x20executes\x20(the\x20discount\x20path\x20validates\x20the\x20Clock\x20time-window\x20check)'],'always_executed':!![]},{'stage':0x4,'name':'create_order','preconditions':['Quote\x20object\x20from\x20stage\x203','Registrar\x20+\x20Clock\x20objects\x20available'],'side_effects':['The\x20atomic\x20on-chain\x20buy\x20call\x20executes\x20(passport-gated\x20variant\x20supported)','Order\x20object\x20created\x20(builder=customer,\x20service=Service.id)','Order.id\x20recorded\x20for\x20stages\x205-7'],'always_executed':!![]},{'stage':0x5,'name':'create_allocation','preconditions':['Service.order_allocators\x20is\x20Some\x20(configured)','Order\x20from\x20stage\x204','CoinParam\x20for\x20total_pay\x20matches\x20Service<T>\x20type'],'side_effects':['The\x20on-chain\x20allocation\x20call\x20executes','Allocation\x20object\x20created\x20(guard-selected\x20fund\x20distribution)','Order.allocation\x20=\x20Allocation\x20address'],'always_executed':!![]},{'stage':0x6,'name':'create_progress','preconditions':['Service.machine\x20is\x20Some\x20(machine\x20bound)','Order\x20from\x20stage\x204','Machine\x20from\x20Service.machine'],'side_effects':['The\x20on-chain\x20progress-creation\x20call\x20executes','Progress\x20object\x20created\x20(Progress.machine\x20=\x20Service.machine,\x20Progress.task\x20=\x20Order.id)'],'always_executed':![]},{'stage':0x7,'name':'post_actions','preconditions':['Order/Allocation/Progress\x20objects\x20from\x20stages\x204-6'],'side_effects':['Attach\x20agents\x20to\x20the\x20order\x20(if\x20order_new.agents\x20provided)','order_required_info_update\x20(if\x20order_required_info\x20provided)','Transfer\x20Order\x20ownership\x20(if\x20transfer\x20provided\x20—\x20sets\x20new\x20Order\x20owner)','namedNewOrder\x20/\x20namedNewAllocation\x20/\x20namedNewProgress\x20(local\x20naming)'],'always_executed':![]},{'stage':0x8,'name':'return_result','preconditions':['All\x20preceding\x20stages\x20succeeded'],'side_effects':['Returns\x20BuyResult\x20{\x20order,\x20allocation?,\x20progress?\x20}','Caller\x20proceeds\x20to\x20sign\x20+\x20submit\x20transaction'],'always_executed':!![]}];export const SERVICE_CROSS_OBJECT_BINDINGS=[{'object':'Machine','field':'machine','required':![],'locked_after_publish':!![],'notes':'Workflow\x20template;\x20post-publish\x20immutable\x20(F-S-20).\x20Progress.machine\x20inherits\x20this\x20value.'},{'object':'Guard','field':'buy_guard','required':![],'locked_after_publish':![],'notes':'Buyer\x20eligibility\x20guard;\x20post-publish\x20STILL\x20MUTABLE\x20(unusual\x20—\x20see\x20F-S-26)'},{'object':'Allocation','field':'order_allocators','required':!![],'locked_after_publish':!![],'notes':'Order\x20fund\x20distribution\x20strategy;\x20publish\x20prerequisite\x20(F-S-18).\x20Post-publish\x20immutable\x20(F-S-22).'},{'object':'Arbitration','field':'arbitrations','required':![],'locked_after_publish':![],'notes':'Dispute\x20handlers;\x20required\x20if\x20compensation_fund\x20>\x200\x20(F-S-19).\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-21).'},{'object':'Repository','field':'repositories','required':![],'locked_after_publish':![],'notes':'Shared\x20data\x20stores;\x20mutable\x20post-publish'},{'object':'Reward','field':'rewards','required':![],'locked_after_publish':![],'notes':'Marketing\x20incentives;\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-24)'},{'object':'Contact','field':'um','required':![],'locked_after_publish':![],'notes':'User\x20Manager\x20(Contact\x20object);\x20mutable\x20post-publish'},{'object':'Treasury','field':'(indirect\x20via\x20order_allocators.sharing.who=Entity)','required':![],'locked_after_publish':![],'notes':'Treasury\x20is\x20referenced\x20by\x20Allocation.sharing.who,\x20not\x20by\x20Service\x20directly'}];export const SERVICE_SCENES=[{'id':'service_retail','name':'Retail\x20e-commerce\x20Service','category':'retail','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL','set\x20customer\x20required\x20info\x20fields'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','pause/resume\x20the\x20Service\x20(310)','add/set/remove/clear\x20sales\x20items\x20(305)','set\x20the\x20order_allocators\x20strategy\x20(313)','set/clear\x20the\x20buy_guard\x20check\x20(307)','issue/destroy\x20discount\x20coupons\x20(312)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)'],'common_patterns':['Multi-tier\x20pricing\x20via\x20sales[]\x20(Standard/Premium/Enterprise)','WIP\x20hash\x20per\x20sale\x20item\x20for\x20tamper-proof\x20product\x20info','buy_guard\x20for\x20KYC\x20whitelist\x20during\x20pre-sale,\x20then\x20null\x20for\x20public\x20sale','compensation_fund\x20deposited\x20before\x20publish\x20+\x20arbitrations\x20configured'],'recommended_templates':['T-S-01','T-S-06']},{'id':'service_rental','name':'Rental\x20Service\x20(short/long-term)','category':'rental','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','bind\x20the\x20Machine\x20workflow\x20(306)\x20—\x20for\x20rental\x20workflow','add\x20Arbitration\x20references\x20(308)\x20—\x20for\x20deposit\x20disputes'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20recommended\x20(rental\x20workflow\x20with\x20deposit/return\x20stages)','arbitrations\x20recommended\x20(deposit\x20refund\x20disputes)'],'common_patterns':['Machine\x20workflow\x20with\x20\x27Deposit\x20→\x20Use\x20→\x20Return\x20→\x20Refund\x27\x20nodes','compensation_fund\x20holds\x20deposit\x20guarantees','buy_guard\x20verifies\x20renter\x20identity/KYC','stock=1\x20per\x20rental\x20item\x20(unique\x20items)'],'recommended_templates':['T-S-02','T-S-04']},{'id':'service_subscription','name':'Subscription\x20Service\x20(recurring)','category':'subscription','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','issue\x20discount\x20coupons\x20(312)\x20—\x20promotional\x20rates','add\x20Reward\x20references\x20(318)\x20—\x20loyalty\x20rewards'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Tiered\x20plans\x20(Free/Pro/Enterprise)\x20as\x20sales[]','Discount\x20coupons\x20for\x20trial\x20periods','Rewards\x20for\x20long-term\x20subscribers','Renewal\x20handled\x20by\x20repeat\x20orders\x20(no\x20native\x20recurring\x20billing)'],'recommended_templates':['T-S-03']},{'id':'service_workflow','name':'Workflow-bound\x20Service\x20(machine-bound)','category':'workflow','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['bind\x20the\x20Machine\x20workflow\x20(306)','publish\x20the\x20Service\x20(311)','set\x20the\x20order_allocators\x20strategy\x20(313)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20must\x20be\x20published\x20before\x20binding','machine\x20recommended\x20for\x20any\x20multi-stage\x20service\x20delivery'],'common_patterns':['Machine\x20defines\x20Pay\x20→\x20Confirm\x20→\x20Deliver\x20→\x20Sign-off\x20nodes','Progress\x20created\x20per\x20order\x20(stage\x206\x20of\x20buy\x20flow)','Named\x20operators\x20assigned\x20per\x20Forward\x20in\x20Machine','Service.paused\x20does\x20NOT\x20affect\x20already-created\x20Progress\x20(existing\x20orders\x20continue)'],'recommended_templates':['T-S-04']},{'id':'service_arbitration','name':'Arbitration-bound\x20Service\x20(dispute-ready)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)','deposit\x20to\x20the\x20compensation_fund\x20(315)','extend\x20setting_lock_duration\x20(317)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)','Arbitration\x20objects\x20must\x20be\x20created\x20before\x20binding','compensation_fund_add\x20before\x20publish\x20recommended\x20(else\x20post-publish\x20deposit\x20still\x20possible)'],'common_patterns':['2-3\x20Arbitration\x20objects\x20(different\x20arb\x20committees\x20for\x20different\x20dispute\x20types)','compensation_fund\x20deposited\x20as\x20%\x20of\x20expected\x20order\x20volume','setting_lock_duration\x20extended\x20by\x20owner\x20to\x20build\x20customer\x20trust','Arbitration\x20compensation\x20payout\x20triggered\x20by\x20the\x20arbitration\x20result\x20(not\x20by\x20Service\x20directly)'],'recommended_templates':['T-S-05','T-S-06']},{'id':'service_compensation_fund','name':'Compensation\x20Fund\x20Service\x20(embedded\x20balance)','category':'compensation_fund','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['deposit\x20to\x20the\x20compensation_fund\x20(315)','withdraw\x20from\x20the\x20compensation_fund\x20(314)\x20—\x20time-locked\x20after\x20publish','receive\x20the\x20compensation_fund\x20payout\x20(316)\x20—\x20arbitration\x20payout\x20(always\x20mutable)','extend\x20setting_lock_duration\x20(317)\x20—\x20extend\x20lock'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['compensation_fund\x20>\x200\x20→\x20arbitrations\x20non-empty\x20(F-S-19)','compensation_fund\x20coin\x20type\x20must\x20match\x20Service<T>\x20type\x20parameter'],'common_patterns':['Fund\x20inflow:\x20compensation_fund_add\x20(315)\x20—\x20always\x20mutable','Fund\x20outflow:\x20compensation_fund_withdraw\x20(314)\x20—\x20requires\x20bPaused\x20+\x20lock_duration\x20expired','Fund\x20receive:\x20compensation_fund_receive\x20(316)\x20—\x20arbitration\x20payout,\x20always\x20mutable','Fund\x20consumer:\x20arbitration\x20compensation\x20payout\x20(driven\x20by\x20arb\x20result)','Distinct\x20from\x20Treasury:\x20Service-internal,\x20arbitration-bound,\x20lock-protected'],'recommended_templates':['T-S-06']},{'id':'service_reward','name':'Reward-attached\x20Service\x20(marketing)','category':'reward','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add/remove/clear\x20Reward\x20references\x20(318)\x20—\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish','issue/destroy\x20discount\x20coupons\x20(312)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Rewards\x20added\x20post-publish\x20(always\x20allowed;\x20remove/clear\x20is\x20time-locked\x20after\x20publish)','Reward\x20objects\x20must\x20exist\x20before\x20binding\x20(queryObjectsWithType\x20validation)','MAX_REWARD_COUNT\x20=\x2020\x20per\x20Service','Reward\x20remove/clear\x20requires\x20Service\x20paused\x20+\x20setting_lock_duration\x20elapsed\x20(protects\x20customer\x20expectations)'],'recommended_templates':['T-S-08']},{'id':'service_arbitration_binding','name':'Arbitration\x20Binding\x20Service\x20(post-publish\x20immutable)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','remove\x20an\x20Arbitration\x20reference\x20(308)\x20—\x20pre-publish\x20only','clear\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['MAX_ARBITRATION_COUNT\x20=\x2020\x20per\x20Service\x20(F-S-04)','Each\x20Arbitration\x20object\x20must\x20be\x20valid\x20(queryObjectsWithType\x20validation)','Arbitration\x20bound\x20=\x20locked\x20post-publish\x20(F-S-21).\x20To\x20change:\x20create\x20new\x20Service.'],'common_patterns':['Pre-publish:\x20set\x201-3\x20Arbitration\x20objects\x20for\x20different\x20dispute\x20scopes','Post-publish:\x20immutable\x20—\x20clone\x20Service\x20if\x20change\x20needed','⚠️\x20Data\x20inconsistency:\x20dynamic-pricing.ts\x20marks\x20arbitrations\x20as\x20mutable,\x20but\x20SDK\x20blocks\x20it\x20(F-S-21)'],'recommended_templates':['T-S-05']},{'id':'service_buy_guard','name':'Buy\x20Guard\x20Service\x20(post-publish\x20mutable\x20guard)','category':'buy_guard','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['bind\x20the\x20buy_guard\x20Guard\x20(307)','clear\x20the\x20buy_guard\x20Guard\x20(307)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Pre-sale\x20phase:\x20buy_guard\x20=\x20whitelist\x20Guard\x20(KYC\x20verified\x20buyers\x20only)','Public\x20sale:\x20buy_guard\x20=\x20null\x20(anyone\x20can\x20buy)','Restricted\x20phase:\x20buy_guard\x20=\x20KYC\x20Guard\x20(compliance)','⚠️\x20buy_guard\x20is\x20the\x20ONLY\x20publish-locked-field\x20exception\x20—\x20still\x20mutable\x20post-publish','buy_guard\x20verification\x20happens\x20at\x20Stage\x201\x20of\x20buy\x20flow\x20(pre_check)'],'recommended_templates':['T-S-01']},{'id':'service_order_allocator','name':'Order\x20Allocator\x20Service\x20(fund\x20distribution\x20config)','category':'order_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)\x20—\x20requires\x20order_allocators\x20(F-S-18)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','Allocators.sharing.who\x20can\x20reference\x20Treasury\x20addresses\x20(indirect\x20Treasury\x20binding)','MAX_SHARING_COUNT\x20=\x20100\x20per\x20allocator'],'common_patterns':['Multi-party\x20split:\x20merchant\x2080%\x20/\x20platform\x2010%\x20/\x20logistics\x2010%','Threshold-based:\x20different\x20allocators\x20for\x20different\x20order\x20sizes','Guard-bound\x20allocator:\x20allocation\x20execution\x20requires\x20Guard\x20verification','Post-publish\x20immutable\x20—\x20clone\x20Service\x20to\x20change\x20allocation\x20strategy'],'recommended_templates':['T-S-08']},{'id':'service_dynamic_pricing','name':'Dynamic\x20Pricing\x20Service\x20(discount-driven)','category':'dynamic_pricing','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['issue\x20discount\x20coupons\x20(312)','add/set\x20sales\x20items\x20(305)\x20—\x20adjust\x20base\x20prices','remove\x20sales\x20items\x20(305)\x20—\x20remove\x20deprecated\x20SKUs'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Discount\x20types:\x200=rates\x20(basis\x20points,\x20per\x2010000),\x201=minus\x20(direct\x20deduction)','MAX_DISCOUNT_COUNT_ONCE\x20=\x201000\x20per\x20issue\x20call','MAX_DISCOUNT_RECEIVER_ONCE\x20=\x201000\x20receivers\x20per\x20call','MAX_DISCOUNT_TOTAL_COUNT\x20=\x2020000\x20total\x20coupons','discount_destroy:\x20holder-only\x20(no\x20SERVICE_DISCOUNT\x20permission\x20needed)','discount_send:\x20holder-only\x20transfer\x20of\x20owned\x20transferable:true\x20coupons\x20to\x20another\x20address\x20(no\x20permission\x20needed);\x20KB-02\x20semantics:\x20issuance\x20=\x20discount\x20(mint)\x20then\x20discount_send\x20(transfer)\x20—\x20holding\x20IS\x20the\x20credential\x20(only\x20the\x20holder\x27s\x20signature\x20spends\x20it),\x20one\x20coupon\x20one\x20burn\x20(single-use,\x20transfer\x20does\x20not\x20reset\x20it),\x20refunds\x20settle\x20the\x20post-coupon\x20amount\x20only;\x20a\x20coupon\x20held\x20by\x20another\x20address\x20cannot\x20be\x20applied\x20to\x20a\x20buy\x20—\x20have\x20the\x20owner\x20discount_send\x20it\x20to\x20the\x20buyer\x20first'],'recommended_templates':['T-S-07']},{'id':'service_multi_allocator','name':'Multi-Allocator\x20Service\x20(tiered\x20fund\x20distribution)','category':'multi_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set','Each\x20allocator\x20has\x20its\x20own\x20Guard\x20+\x20sharing\x20+\x20threshold','Each\x20allocator\x20is\x20bound\x20to\x20a\x20DIFFERENT\x20guard\x20—\x20the\x20caller\x27s\x20submitted\x20guard\x20selects\x20which\x20path\x20fires'],'common_patterns':['Tier\x201\x20(small\x20orders):\x20single-recipient\x20allocator\x20(low\x20fee)','Tier\x202\x20(medium\x20orders):\x20two-recipient\x20split\x20(merchant\x20+\x20platform)','Tier\x203\x20(large\x20orders):\x20three-recipient\x20split\x20(merchant\x20+\x20platform\x20+\x20logistics)','Each\x20tier\x20can\x20have\x20its\x20own\x20Guard\x20for\x20execution\x20authorization'],'recommended_templates':['T-S-08']}];export const SERVICE_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return SERVICE_SCENES['filter'](b=>b['category']===a);}export function findSceneById(a){return SERVICE_SCENES['find'](b=>b['id']===a);}export function getServicePermissionByIndex(a){return SERVICE_PERMISSIONS['find'](b=>b['index']===a);}export function isServicePermission(a){return getServicePermissionByIndex(a)!==undefined;}export function getPermissionsByMutability(a){return SERVICE_PERMISSIONS['filter'](b=>b['post_publish_mutability']===a);}export function getImmutablePostPublishPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='immutable'||a['post_publish_mutability']==='one_shot');}export function getLockedByDurationPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='locked_by_duration');}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['retail','retail'],['ecommerce','retail'],['rental','rental'],['rent','rental'],['short-term\x20rental','rental'],['long-term\x20rental','rental'],['subscription','subscription'],['subscribe','subscription'],['workflow','workflow'],['machine-bound','workflow'],['arbitration','arbitration'],['dispute','arbitration'],['compensation','compensation_fund'],['compensation_fund','compensation_fund'],['reward','reward'],['marketing','reward'],['buy_guard','buy_guard'],['kyc','buy_guard'],['whitelist','buy_guard'],['allocator','order_allocator'],['discount','dynamic_pricing'],['coupon','dynamic_pricing'],['multi-allocator','multi_allocator'],['tiered','multi_allocator']];for(const [d,e]of c){if(b['includes'](d)){const f=getScenesByCategory(e);if(f['length']>0x0)return f[0x0];}}if(b['includes']('service'))return findSceneById('service_retail');return undefined;}export function getAllServiceScenes(){return[...SERVICE_SCENES];}export function getServiceScenesCount(){return SERVICE_SCENES['length'];}export function getServicePermissionsCount(){return SERVICE_PERMISSIONS['length'];}export function getOrderFlowStage(a){return SERVICE_ORDER_FLOW_STAGES['find'](b=>b['stage']===a);}export function getCrossObjectBindings(){return[...SERVICE_CROSS_OBJECT_BINDINGS];}