@wowok/agent-mcp 3.0.3 → 3.0.5
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.
- package/dist/evaluation/path-reasoning.d.ts +4 -2
- package/dist/evaluation/path-reasoning.js +1 -1
- package/dist/extensions/constraint-registry.d.ts +2 -2
- package/dist/extensions/constraint-registry.js +1 -1
- package/dist/extensions/custom-registry-file.d.ts +22 -0
- package/dist/extensions/custom-registry-file.js +1 -0
- package/dist/extensions/index.d.ts +2 -1
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/industry-pack.d.ts +7 -0
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/metric-registry.d.ts +2 -2
- package/dist/extensions/metric-registry.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/extensions/registry.d.ts +2 -2
- package/dist/extensions/registry.js +1 -1
- package/dist/extensions/types.d.ts +4 -0
- package/dist/goal/GoalEngine.d.ts +13 -1
- package/dist/goal/GoalEngine.js +1 -1
- package/dist/goal/next-steps.d.ts +12 -0
- package/dist/goal/next-steps.js +1 -0
- package/dist/goal/pursue.d.ts +18 -0
- package/dist/goal/pursue.js +1 -0
- package/dist/goal/types.d.ts +72 -0
- package/dist/goal/types.js +1 -1
- package/dist/graph/onchain/analyze.d.ts +44 -0
- package/dist/graph/onchain/analyze.js +1 -0
- package/dist/graph/onchain/analyze.spec.d.ts +1 -0
- package/dist/graph/onchain/analyze.spec.js +1 -0
- package/dist/graph/onchain/anti-cheat.d.ts +39 -0
- package/dist/graph/onchain/anti-cheat.js +1 -0
- package/dist/graph/onchain/anti-cheat.spec.d.ts +1 -0
- package/dist/graph/onchain/anti-cheat.spec.js +1 -0
- package/dist/graph/onchain/dataplane.d.ts +44 -0
- package/dist/graph/onchain/dataplane.js +1 -0
- package/dist/graph/onchain/edge-schema.d.ts +60 -0
- package/dist/graph/onchain/edge-schema.js +1 -0
- package/dist/graph/onchain/expand.d.ts +4 -0
- package/dist/graph/onchain/expand.js +1 -0
- package/dist/graph/onchain/extract.d.ts +21 -0
- package/dist/graph/onchain/extract.js +1 -0
- package/dist/graph/onchain/index.d.ts +17 -0
- package/dist/graph/onchain/index.js +1 -0
- package/dist/graph/onchain/interest.d.ts +10 -0
- package/dist/graph/onchain/interest.js +1 -0
- package/dist/graph/onchain/interest.spec.d.ts +1 -0
- package/dist/graph/onchain/interest.spec.js +1 -0
- package/dist/graph/onchain/onchain.spec.d.ts +1 -0
- package/dist/graph/onchain/onchain.spec.js +1 -0
- package/dist/graph/onchain/order-status.d.ts +53 -0
- package/dist/graph/onchain/order-status.js +1 -0
- package/dist/graph/onchain/project-relationship.d.ts +3 -0
- package/dist/graph/onchain/project-relationship.js +1 -0
- package/dist/graph/onchain/sdk-batch.d.ts +117 -0
- package/dist/graph/onchain/sdk-batch.js +1 -0
- package/dist/graph/onchain/sdk-dataplane.d.ts +40 -0
- package/dist/graph/onchain/sdk-dataplane.js +1 -0
- package/dist/graph/onchain/strategy.d.ts +54 -0
- package/dist/graph/onchain/strategy.js +1 -0
- package/dist/graph/onchain/strategy.spec.d.ts +1 -0
- package/dist/graph/onchain/strategy.spec.js +1 -0
- package/dist/graph/onchain/types.d.ts +238 -0
- package/dist/graph/onchain/types.js +1 -0
- package/dist/graph/onchain/viewport.d.ts +5 -0
- package/dist/graph/onchain/viewport.js +1 -0
- package/dist/harness/recover.js +1 -1
- package/dist/index.js +1 -1
- package/dist/intent/enrich.js +1 -1
- package/dist/keeper/detectors.d.ts +1 -1
- package/dist/keeper/detectors.js +1 -1
- package/dist/knowledge/account-marks.js +1 -1
- package/dist/knowledge/anti-cheat.d.ts +2 -37
- package/dist/knowledge/anti-cheat.js +1 -1
- package/dist/knowledge/contract-invariants.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/getting-started.d.ts +37 -0
- package/dist/knowledge/getting-started.js +1 -0
- package/dist/knowledge/goal-completion.js +1 -1
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-render.d.ts +1 -0
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-submission-brief.d.ts +83 -0
- package/dist/knowledge/guard-submission-brief.js +1 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +13 -0
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/index.d.ts +6 -4
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.d.ts +91 -0
- package/dist/knowledge/industry-strategy.js +1 -0
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/market-metrics.d.ts +14 -3
- package/dist/knowledge/market-metrics.js +1 -1
- package/dist/knowledge/migration-preflight.js +1 -1
- package/dist/knowledge/operation-dictionary.d.ts +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/scenario-topology.d.ts +6 -1
- package/dist/knowledge/scenario-topology.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk-node.d.ts +3 -0
- package/dist/knowledge/service-risk-node.js +1 -0
- package/dist/knowledge/service-risk.d.ts +2 -0
- package/dist/knowledge/service-risk.js +1 -1
- package/dist/knowledge/service-templates.d.ts +2 -0
- package/dist/knowledge/service-templates.js +1 -1
- package/dist/knowledge/strategy-manuals.d.ts +17 -0
- package/dist/knowledge/strategy-manuals.js +1 -0
- package/dist/knowledge/supply-chain.d.ts +3 -1
- package/dist/knowledge/supply-chain.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +3 -118
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/knowledge/workspace-lists.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/ScopeResolver.js +1 -1
- package/dist/participation/radar-core.d.ts +15 -15
- package/dist/participation/radar-core.js +1 -1
- package/dist/persona/analyzer.d.ts +2 -1
- package/dist/persona/bridge.d.ts +5 -1
- package/dist/persona/bridge.js +1 -1
- package/dist/persona/defaults.js +1 -1
- package/dist/persona/distill-goal.d.ts +7 -1
- package/dist/persona/distill-goal.js +1 -1
- package/dist/persona/index.d.ts +13 -3
- package/dist/persona/index.js +1 -1
- package/dist/persona/model.d.ts +12 -2
- package/dist/persona/model.js +1 -1
- package/dist/persona/overrides.d.ts +1 -0
- package/dist/persona/overrides.js +1 -1
- package/dist/persona/topology-focus.d.ts +29 -0
- package/dist/persona/topology-focus.js +1 -0
- package/dist/persona/types.d.ts +81 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/context-assembly.js +1 -1
- package/dist/playbooks/service-build/machine-nodes.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.d.ts +1 -0
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +4 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/topology-query.d.ts +14 -0
- package/dist/playbooks/service-build/topology-query.js +1 -0
- package/dist/role/index.d.ts +1 -0
- package/dist/role/index.js +1 -1
- package/dist/role/profiles.d.ts +26 -0
- package/dist/role/profiles.js +1 -0
- package/dist/safety/confirm-gate.d.ts +4 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/allocation.d.ts +11 -6
- package/dist/schema/call/arbitration.d.ts +5 -0
- package/dist/schema/call/base.d.ts +5 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +26 -1
- package/dist/schema/call/contact.d.ts +5 -0
- package/dist/schema/call/demand.d.ts +5 -0
- package/dist/schema/call/guard.d.ts +35 -20
- package/dist/schema/call/machine.d.ts +10 -0
- package/dist/schema/call/order.d.ts +5 -0
- package/dist/schema/call/payment.d.ts +5 -0
- package/dist/schema/call/permission.d.ts +5 -0
- package/dist/schema/call/personal.d.ts +5 -0
- package/dist/schema/call/progress.d.ts +5 -0
- package/dist/schema/call/proof.d.ts +10 -0
- package/dist/schema/call/repository.d.ts +5 -0
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/reward.d.ts +5 -0
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +9 -4
- package/dist/schema/call/treasury.d.ts +5 -0
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/employee/index.d.ts +7 -7
- package/dist/schema/evaluation/index.d.ts +22 -9
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +37 -1
- package/dist/schema/goal/index.js +1 -1
- package/dist/schema/goal/planning.d.ts +1 -1
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +7 -0
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/interaction/index.d.ts +34 -0
- package/dist/schema/interaction/index.js +1 -0
- package/dist/schema/local/index.d.ts +8 -4
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +324 -64
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +236 -11
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +15743 -0
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/query/bi.d.ts +869 -2
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +163 -41
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +16 -0
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/strategy-review/index.d.ts +137 -0
- package/dist/schema/strategy-review/index.js +1 -0
- package/dist/schema/trust/index.d.ts +6 -6
- package/dist/schema/workflow/index.d.ts +2 -2
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +8 -4
- package/dist/schemas/account_operation.schema.json +6 -2
- package/dist/schemas/ask_user.output.json +54 -0
- package/dist/schemas/ask_user.schema.json +78 -0
- package/dist/schemas/bridge_operation.schema.json +50 -5
- package/dist/schemas/evaluation_operation.output.json +24 -0
- package/dist/schemas/goal_operation.schema.json +124 -0
- package/dist/schemas/guard2file.schema.json +10 -1
- package/dist/schemas/index.json +13 -1
- package/dist/schemas/industry_pack_operation.output.json +39 -0
- package/dist/schemas/local_mark_operation.schema.json +2 -2
- package/dist/schemas/machineNode2file.schema.json +10 -1
- package/dist/schemas/messenger_operation.output.json +678 -200
- package/dist/schemas/messenger_operation.schema.json +74 -239
- package/dist/schemas/onchain_events.output.json +2 -2
- package/dist/schemas/onchain_operations.schema.json +183 -21
- package/dist/schemas/onchain_operations_allocation.schema.json +10 -1
- package/dist/schemas/onchain_operations_arbitration.schema.json +10 -1
- package/dist/schemas/onchain_operations_contact.schema.json +10 -1
- package/dist/schemas/onchain_operations_demand.schema.json +10 -1
- package/dist/schemas/onchain_operations_gen_passport.schema.json +10 -1
- package/dist/schemas/onchain_operations_gen_proof.schema.json +10 -1
- package/dist/schemas/onchain_operations_guard.schema.json +10 -1
- package/dist/schemas/onchain_operations_machine.schema.json +10 -1
- package/dist/schemas/onchain_operations_order.schema.json +10 -1
- package/dist/schemas/onchain_operations_payment.schema.json +10 -1
- package/dist/schemas/onchain_operations_permission.schema.json +10 -1
- package/dist/schemas/onchain_operations_personal.schema.json +10 -1
- package/dist/schemas/onchain_operations_progress.schema.json +10 -1
- package/dist/schemas/onchain_operations_proof.schema.json +10 -1
- package/dist/schemas/onchain_operations_repository.schema.json +13 -4
- package/dist/schemas/onchain_operations_reward.schema.json +10 -1
- package/dist/schemas/onchain_operations_service.schema.json +10 -1
- package/dist/schemas/onchain_operations_treasury.schema.json +10 -1
- package/dist/schemas/onchain_table_data.output.json +184 -0
- package/dist/schemas/onchain_table_data.schema.json +43 -43
- package/dist/schemas/persona_operation.output.json +37778 -262
- package/dist/schemas/persona_operation.schema.json +5960 -1
- package/dist/schemas/query_toolkit.output.json +1580 -2
- package/dist/schemas/query_toolkit.schema.json +194 -32
- package/dist/schemas/schema_query.schema.json +25 -1
- package/dist/schemas/strategy_review_operation.output.json +532 -0
- package/dist/schemas/strategy_review_operation.schema.json +66 -0
- package/dist/schemas/wowok_buildin_info.output.json +188 -6
- package/dist/schemas/wowok_buildin_info.schema.json +14 -0
- package/dist/strategy/collectors.d.ts +66 -0
- package/dist/strategy/collectors.js +1 -0
- package/dist/strategy/collectors.spec.d.ts +1 -0
- package/dist/strategy/collectors.spec.js +1 -0
- package/dist/strategy/index.d.ts +5 -0
- package/dist/strategy/index.js +1 -0
- package/dist/strategy/metrics.d.ts +20 -0
- package/dist/strategy/metrics.js +1 -0
- package/dist/strategy/review.d.ts +48 -0
- package/dist/strategy/review.js +1 -0
- package/dist/strategy/scorecard.d.ts +32 -0
- package/dist/strategy/scorecard.js +1 -0
- package/dist/strategy/store.d.ts +26 -0
- package/dist/strategy/store.js +1 -0
- package/dist/tools/handlers/ask-user.d.ts +3 -0
- package/dist/tools/handlers/ask-user.js +1 -0
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/goal.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/permission.js +1 -1
- package/dist/tools/handlers/persona.js +1 -1
- package/dist/tools/handlers/query.d.ts +6 -0
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/strategy-review.d.ts +2 -0
- package/dist/tools/handlers/strategy-review.js +1 -0
- package/dist/tools/handlers/watch.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.d.ts +5 -2
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/agent.js +1 -1
- package/dist/tools/registry/bridge.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/interaction.d.ts +2 -0
- package/dist/tools/registry/interaction.js +1 -0
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/registry/messenger.js +1 -1
- package/dist/tools/registry/monitor.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/shared.d.ts +2 -1
- package/dist/tools/shared.js +1 -1
- package/dist/tools/types.d.ts +7 -1
- package/dist/tools/wrap.d.ts +3 -3
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatMist,GasTokenType,MAINNET_BRIDGE_CONFIG,formatUnits,isFundApprovalExempt}from'@wowok/wowok';export const DEFAULT_VALUE_WARNINGS={'defaultAccount':'Using\x20default\x20account\x20(env.account=\x22\x22)','mainnet':'Operating\x20on\x20mainnet\x20—\x20irreversible','replaceExistName':'replaceExistName=true\x20will\x20unbind\x20the\x20existing\x20name\x20(breaking\x20refs)','defaultToken':'Using\x20default\x20token\x200x2::wow::WOW'};export const DEFAULT_AMOUNT_THRESHOLD=BigInt(0x174876e800);export function getAmountThreshold(){const a=process['env']['WOWOK_AMOUNT_THRESHOLD'];if(!a)return DEFAULT_AMOUNT_THRESHOLD;try{return BigInt(a);}catch{return DEFAULT_AMOUNT_THRESHOLD;}}export function formatAmount(a){return formatMist(a);}function bestEffortTokenType(a){return a?.['object']?.['type_parameter']??a?.['type_parameter'];}function describeAmount(a,b){if(!b||b===GasTokenType)return formatMist(a);return a+'\x20raw\x20smallest\x20units\x20of\x20'+b;}export function collectDefaultWarnings(a,b){const c=[],d=a?.['account'];(d===undefined||d==='')&&c['push'](DEFAULT_VALUE_WARNINGS['defaultAccount']);const e=a?.['network'];e&&/mainnet/i['test'](String(e))&&c['push'](DEFAULT_VALUE_WARNINGS['mainnet']);const f=b?.['namedNew']??b?.['object'];return f&&typeof f==='object'&&f['replaceExistName']===!![]&&c['push'](DEFAULT_VALUE_WARNINGS['replaceExistName']),c;}export const BRIDGE_FUND_OPERATION_TYPES=['cross_chain_wow_to_evm','cross_chain_evm_to_wow','claim_wow_to_evm','resume_transfer','withdraw'];function describeBridgeAmount(a,b,c){if(b==='WOW'||!b&&c==='wow_to_evm')return formatMist(a);const d=MAINNET_BRIDGE_CONFIG?.['tokens']?.['find'](f=>f['symbol']?.['toUpperCase']()===b?.['toUpperCase']()),e=d?c==='wow_to_evm'?d['wowDecimals']:d['evmDecimals']:undefined;if(e===undefined)return a+'\x20raw\x20smallest\x20units\x20of\x20'+(b??'the\x20bridge\x20token');try{return formatUnits(BigInt(a),e)+'\x20'+b;}catch{return a+'\x20raw\x20smallest\x20units\x20of\x20'+b;}}export const CONFIRMATION_RULES=[{'id':'bridge_fund_movement','when':(a,b,c)=>BRIDGE_FUND_OPERATION_TYPES['includes'](a),'level':'irreversible','preview':(a,b,c)=>{const d=typeof b?.['amount']==='string'?b['amount']:undefined,e=typeof b?.['token']==='string'?b['token']:undefined,f=b?.['withdrawTo']??b?.['recipientWowAddress']??b?.['to']??(a==='claim_wow_to_evm'||a==='resume_transfer'?b?.['transferId']:undefined),g=a==='cross_chain_wow_to_evm'?'wow_to_evm':'evm_side';return{'level':'irreversible','operation':a,'irreversible':!![],'network':c?.['network']??'mainnet','account':c?.['account']??'','amount':d!==undefined?{'value':d,'token':e??(g==='wow_to_evm'?GasTokenType:'ETH'),'human_readable':describeBridgeAmount(d,e,g),'recipient':f}:undefined,'warnings':[...collectDefaultWarnings(c,b),a==='withdraw'?'EVM\x20withdrawal\x20from\x20activeEvmAccount\x20—\x20funds\x20move\x20to\x20an\x20external\x20EVM\x20address;\x20irreversible.':'Cross-chain\x20bridge\x20transfer\x20—\x20funds\x20leave\x20the\x20source\x20chain;\x20recovery\x20(if\x20any)\x20requires\x20the\x20opposite-side\x20claim\x20or\x20resume_transfer,\x20never\x20a\x20rollback.']};},'bypass_on_explicit_intent':[]},{'id':'irreversible_fund_or_verdict','when':(a,b,c)=>{const d=c?.['network'],e=bestEffortTokenType(b)??GasTokenType;if(a==='payment'&&Array['isArray'](b?.['revenue'])&&b['revenue']['length']>0x0){const f=b['revenue']['map'](g=>g?.['amount']?.['balance'])['filter'](g=>typeof g==='string'||typeof g==='number');if(f['length']===b['revenue']['length']&&f['every'](g=>isFundApprovalExempt(d,e,String(g))))return![];return!![];}if(a==='treasury'&&b?.['withdraw']){const g=extractAmount(b);if(g!==null&&isFundApprovalExempt(d,e,g))return![];return!![];}if(a==='payment')return!![];if(a==='arbitration'&&b?.['arbitration']!==undefined)return!![];if(b?.['receive']!==undefined||b?.['owner_receive']!==undefined||b?.['received_coins']!==undefined||b?.['compensation_fund_receive']!==undefined)return!![];if(b?.['alloc_by_guard']!==undefined)return!![];if(a==='reward'&&b?.['claim']!==undefined)return!![];if(a==='service'&&b?.['compensation_fund_withdraw']!==undefined)return!![];if(a==='order'&&b?.['arb_claim_compensation']!==undefined)return!![];if(a==='arbitration'&&(b?.['arb_withdraw']!==undefined||b?.['fees_transfer']!==undefined))return!![];if(a==='treasury'){if(b?.['withdraw'])return!![];return![];}return![];},'level':'irreversible','preview':(a,b,c)=>{let d;if(a==='payment'&&Array['isArray'](b?.['revenue'])&&b['revenue']['length']>0x0){const f=b['revenue']['find'](g=>typeof g?.['amount']?.['balance']==='string'||typeof g?.['amount']?.['balance']==='number');if(f){const g=String(f['amount']['balance']);d={'value':g,'human_readable':describeAmount(g,bestEffortTokenType(b))};}else d={'value':'','human_readable':'entire\x20Coin\x20object(s)\x20(amount\x20resolved\x20by\x20the\x20fund\x20layer)'};}const e=[];return a==='reward'&&b?.['claim']!==undefined&&e['push']('Reward\x20claim\x20—\x20Guard-verified\x20payout\x20splits\x20the\x20pool\x20balance\x20and\x20transfers\x20coins\x20to\x20the\x20claimer;\x20the\x20exact\x20amount\x20is\x20determined\x20by\x20the\x20Reward\x27s\x20guard\x20config.'),a==='service'&&b?.['compensation_fund_withdraw']!==undefined&&e['push']('Compensation\x20fund\x20withdraw\x20—\x20withdraws\x20the\x20ENTIRE\x20compensation_fund\x20into\x20a\x20new\x20Payment\x20owned\x20by\x20\x27'+(b['compensation_fund_withdraw']?.['receipt']??'(recipient)')+'\x27.'),a==='order'&&b?.['arb_claim_compensation']!==undefined&&e['push']('Order\x20compensation\x20claim\x20—\x20splits\x20the\x20Service\x27s\x20compensation_fund\x20and\x20transfers\x20the\x20awarded\x20coins\x20to\x20the\x20caller;\x20irreversible.'),a==='arbitration'&&b?.['arb_withdraw']!==undefined&&e['push']('Arb\x20fee\x20withdraw\x20—\x20sweeps\x20the\x20Arb\x27s\x20fee\x20balance\x20into\x20the\x20Arbitration\x20object\x27s\x20balance.'),a==='arbitration'&&b?.['fees_transfer']!==undefined&&e['push']('Arbitration\x20fees\x20transfer\x20—\x20withdraws\x20the\x20ENTIRE\x20Arbitration\x20balance\x20into\x20a\x20new\x20Payment\x20for\x20the\x20target\x20Allocation/Treasury;\x20irreversible.'),{'level':'irreversible','operation':a,'irreversible':!![],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),...e],'amount':a==='payment'&&d?{...d,'token':bestEffortTokenType(b)??GasTokenType,'recipient':b?.['revenue']?.[0x0]?.['recipient']}:undefined};},'bypass_on_explicit_intent':[]},{'id':'publish_immutable','when':(a,b,c)=>{if(a==='service'&&(b?.['publish']===!![]||b?.['bPublished']===!![]))return!![];if(a==='machine'&&b?.['publish']===!![])return!![];return![];},'level':'publish','preview':(a,b,c)=>({'level':'publish','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':a==='service'?['machine','order_allocators']:['nodes','pairs','forwards'],'warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['force\x20publish','publish\x20now']},{'id':'amount_sensitive','when':(a,b,c)=>{const d=extractAmount(b);if(d!==null){if(isFundApprovalExempt(c?.['network'],bestEffortTokenType(b)??GasTokenType,d))return![];return!![];}if(a==='service'&&b?.['order_new'])return!![];if(a==='treasury'&&b?.['deposit']?.['coin']?.['coin'])return!![];if(a==='reward'&&b?.['coin_add']?.['coin'])return!![];if(a==='allocation'&&b?.['coin']?.['coin'])return!![];return![];},'level':'amount','preview':(a,b,c)=>{const d=extractAmount(b),e=bestEffortTokenType(b);return{'level':'amount','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','amount':d?{'value':d,'token':e??GasTokenType,'human_readable':describeAmount(d,e)}:{'value':'','token':e??GasTokenType,'human_readable':'entire\x20Coin\x20object\x20(amount\x20resolved\x20on-chain)'},'warnings':collectDefaultWarnings(c,b)};},'bypass_on_explicit_intent':[]},{'id':'default_values','when':(a,b,c)=>{return collectDefaultWarnings(c,b)['length']>0x0;},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['use\x20default\x20account','default\x20account\x20is\x20fine','use\x20the\x20default\x20account','default\x20account\x20works\x20fine']},{'id':'guard_create_immutable','when':(a,b,c)=>{if(a==='guard')return!![];return![];},'level':'irreversible','preview':(a,b,c)=>{const d=b?.['table']??[],e=b?.['root'],f=b?.['rely'],g=typeof e==='object'&&e!==null&&'type'in e?e['type']:typeof e==='object'&&e!==null&&'type'in e&&e['type']==='file'?'file':'unknown',h=['table','root'];if(f)h['push']('rely');return{'level':'irreversible','operation':a,'object':b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':h,'irreversible':!![],'warnings':[...collectDefaultWarnings(c,b),'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation','Table\x20entries:\x20'+d['length']+'\x20(max\x20256)','Root\x20node\x20type:\x20'+g+'\x20(must\x20return\x20Bool)',...f?['Rely\x20dependencies:\x20'+(f['guards']?.['length']??0x0)+'\x20(max\x204,\x20AND/OR\x20logic)']:[],'To\x20modify\x20later:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind']};},'bypass_on_explicit_intent':[]},{'id':'guard_gen_passport_test','when':(a,b,c)=>{if(a==='gen_passport')return!![];return![];},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['guard'],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),'gen_passport\x20will\x20consume\x20gas\x20for\x20static\x20testing']}),'bypass_on_explicit_intent':['test\x20guard','testing\x20guard','gen\x20passport','generate\x20passport']},{'id':'progress_advance','when':(a,b,c)=>{if(a!=='progress')return![];return b?.['operate']?.['op']==='next'||b?.['owner_receive']!==undefined;},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['object'],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),'Advancing\x20the\x20progress\x20node\x20may\x20release\x20funds\x20per\x20the\x20machine\x20allocation']}),'bypass_on_explicit_intent':[]}];export function resolveOverrideId(a,b){if(a==='publish_immutable'){if(b==='service')return'service.publish';if(b==='machine')return'machine.publish';return undefined;}if(a==='progress_advance')return'node.advance';return undefined;}export function extractAmount(a){if(!a)return null;const b=e=>{if(typeof e==='number')return String(e);if(typeof e==='string'&&e!=='')return e;return null;},d=[a?.['balance'],a?.['amount'],a?.['compensation_fund_add']?.['balance'],a?.['coin_add']?.['balance'],a?.['coin']?.['balance'],a?.['order_new']?.['buy']?.['total_pay']?.['balance'],a?.['dispute']?.['fee']?.['balance'],a?.['fee'],a?.['arbitration']?.['indemnity'],a?.['revenue']?.[0x0]?.['amount']?.['balance'],a?.['deposit']?.['coin']?.['balance'],a?.['withdraw']?.['amount']?.['fixed']];for(const e of d){const f=b(e);if(f!==null)return f;}if(Array['isArray'](a?.['guard_add']))for(const h of a['guard_add']){if(h?.['amount']?.['type']==='Fixed'){const i=b(h['amount']['value']);if(i!==null)return i;}}for(const j of[a?.['allocators'],a?.['order_allocators']]){if(!j||typeof j!=='object')continue;const k=b(j['threshold']);if(k!==null)return k;for(const l of Array['isArray'](j['allocators'])?j['allocators']:[]){if(Array['isArray'](l?.['sharing']))for(const n of l['sharing']){if(n?.['mode']==='Amount'){const o=b(n['sharing']);if(o!==null)return o;}}const m=b(l?.['max']);if(m!==null)return m;}}return null;}export const OBJECT_REUSE_RULES=[{'rule_id':'REUSE-001','object_type':'permission','recommendation':'strongly_recommended','reason':'Centralized\x20permission\x20control\x20across\x20all\x20services','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Permission\x20to\x20reuse?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-002','object_type':'machine','recommendation':'recommended','reason':'Save\x20design\x20time\x20for\x20similar\x20processes','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Machine\x20whose\x20workflow\x20fits?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-003','object_type':'guard','recommendation':'recommended','reason':'Avoid\x20redundant\x20validation\x20rules','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Guard\x20with\x20matching\x20validation\x20logic?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-004','object_type':'contact','recommendation':'recommended','reason':'Single\x20point\x20of\x20customer-service\x20management','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Contact\x20for\x20customer\x20service?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-005','object_type':'arbitration','recommendation':'always_reuse','reason':'Customers\x20choose\x20from\x20established\x20arbiters;\x20creating\x20a\x20new\x20Arbitration\x20is\x20an\x20operator-level\x20decision','ask_user':'Which\x20existing\x20Arbitration\x20service\x20should\x20disputes\x20route\x20to?\x20Provide\x20the\x20name\x20or\x20ID.'}];export const CREATE_VS_MODIFY_PATTERN={'reuse_form':'string','create_form':'object','resolution_api':'GetObjectExisted','note':'String\x20reference\x20=\x20REUSE\x20(name\x20resolution\x20failure\x20is\x20a\x20hard\x20error);\x20object\x20shape\x20=\x20CREATE\x20(always).'};export const IMMUTABILITY_RULES=[{'rule_id':'IMMUT-001','object_type':'machine','trigger':'publish','immutable_fields':['nodes','pairs','forwards'],'message':'Machine\x20topology\x20is\x20immutable\x20after\x20publish\x20—\x20verify\x20all\x20nodes/forwards\x20via\x20machineNode2file\x20BEFORE\x20publishing'},{'rule_id':'IMMUT-002','object_type':'service','trigger':'publish','immutable_fields':['machine','order_allocators','arbitrations'],'mutable_after':['sales'],'message':'Service.machine,\x20order_allocators\x20and\x20arbitrations\x20are\x20frozen\x20after\x20publish;\x20sales\x20remains\x20fully\x20modifiable\x20(L3)\x20without\x20pause'},{'rule_id':'IMMUT-003','object_type':'guard','trigger':'create','immutable_fields':['table','root','rely'],'message':'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation.\x20To\x20change:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind'}];export const OPERATION_TYPE_CLASSIFICATION={'LOCAL_ONLY':['account_operation','local_mark_operation','local_info_operation','config_operation'],'ONCHAIN':['onchain_operations','wip_file','bridge_operation','messenger_operation'],'QUERY':['query_toolkit','onchain_table_data','onchain_events','guard2file','machineNode2file','schema_query','wowok_buildin_info','trust_score'],'ENCRYPTED':['messenger_operation']};export const OPERATION_CLASS_META={'LOCAL_ONLY':{'gas':![],'confirmation_required':![],'note':'Local\x20state\x20only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ONCHAIN':{'gas':!![],'confirmation_required':!![],'note':'On-chain\x20write\x20—\x20gas\x20consumed,\x20explicit\x20user\x20confirmation\x20REQUIRED\x20before\x20execution'},'QUERY':{'gas':![],'confirmation_required':![],'note':'Read-only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ENCRYPTED':{'gas':![],'confirmation_required':![],'note':'Local\x20encryption\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'}};export function classifyTool(a){if(OPERATION_TYPE_CLASSIFICATION['ENCRYPTED']['includes'](a))return'ENCRYPTED';for(const b of['LOCAL_ONLY','ONCHAIN','QUERY']){if(OPERATION_TYPE_CLASSIFICATION[b]['includes'](a))return b;}return undefined;}export const NAMING_CONVENTIONS={'scheme':'<projectPrefix>_<type>_<purpose>_<version>','parts':{'project_prefix':{'example':'shopFunny_','purpose':'Prevents\x20cross-project\x20collisions'},'type_prefix':{'example':'machine_\x20/\x20guard_\x20/\x20service_','purpose':'Clarifies\x20object\x20type'},'purpose_suffix':{'example':'serviceWithdraw','purpose':'Describes\x20function'},'version_suffix':{'example':'_v2','purpose':'Enables\x20iteration\x20without\x20replaceExistName'}},'entry_id':{'pattern':'^<object_type>:<name>$','example':'service:myshop_service'},'replace_exist_name':{'default':![],'false_effect':'Throws\x20error\x20if\x20name\x20is\x20in\x20use\x20—\x20safe\x20default','true_effect':'Existing\x20object/account\x20with\x20the\x20same\x20name\x20is\x20suspended/unbound\x20to\x20free\x20the\x20name','account_default_forbidden':'replaceExistName:true\x20on\x20the\x20default\x20account\x20(name=\x27\x27)\x20is\x20FORBIDDEN\x20—\x20use\x20suspend()\x20explicitly','recommendation':'DISCOURAGED\x20—\x20prefer\x20versioned\x20names\x20(_v1,\x20_v2)\x20for\x20production'},'recommendations':['Always\x20provide\x20tags\x20on\x20object\x20creation\x20for\x20filtering\x20and\x20management','Use\x20names\x20as\x20primary\x20identifiers;\x20use\x20short\x20address\x20form\x20(0x1234...def)\x20only\x20for\x20display','All\x20cross-object\x20references\x20(Guard\x20tables,\x20Service\x20bindings,\x20Machine\x20forwards)\x20use\x20NAMES\x20—\x20resolved\x20per-network\x20at\x20build\x20time']};export function checkObjectReuseRules(a){const b=[];for(const c of a){if(!c['is_new'])continue;const d=OBJECT_REUSE_RULES['find'](e=>e['object_type']===c['object_type']);if(!d)continue;(d['recommendation']==='always_reuse'||d['recommendation']==='strongly_recommended')&&b['push']({'rule_id':d['rule_id'],'severity':d['recommendation']==='always_reuse'?'warn':'info','message':'Creating\x20NEW\x20'+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20—\x20reuse\x20is\x20'+d['recommendation']+':\x20'+d['reason']+'.\x20'+d['ask_user']});}return b;}export function checkImmutabilityRules(a){const b=[];for(const c of a){const d=IMMUTABILITY_RULES['find'](e=>e['object_type']===c['object_type']&&e['trigger']===c['trigger']);if(!d)continue;b['push']({'rule_id':d['rule_id'],'severity':'warn','message':''+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20'+c['trigger']+':\x20'+d['message']+'.\x20Immutable:\x20['+d['immutable_fields']['join'](',\x20')+']'+(d['mutable_after']?'.\x20Still\x20mutable:\x20['+d['mutable_after']['join'](',\x20')+']':'')});}return b;}export const SAFETY_RULES_VERSION=0x2;
|
|
1
|
+
import{formatMist,GasTokenType,MAINNET_BRIDGE_CONFIG,formatUnits,isFundApprovalExempt}from'@wowok/wowok';export const DEFAULT_VALUE_WARNINGS={'defaultAccount':'Using\x20default\x20account\x20(env.account=\x22\x22)','mainnet':'Operating\x20on\x20mainnet\x20—\x20irreversible','replaceExistName':'replaceExistName=true\x20will\x20unbind\x20the\x20existing\x20name\x20(breaking\x20refs)','defaultToken':'Using\x20default\x20token\x200x2::wow::WOW'};export const DEFAULT_AMOUNT_THRESHOLD=BigInt(0x174876e800);export function getAmountThreshold(){const a=process['env']['WOWOK_AMOUNT_THRESHOLD'];if(!a)return DEFAULT_AMOUNT_THRESHOLD;try{return BigInt(a);}catch{return DEFAULT_AMOUNT_THRESHOLD;}}export function formatAmount(a){return formatMist(a);}function bestEffortTokenType(a){return a?.['object']?.['type_parameter']??a?.['type_parameter'];}function describeAmount(a,b){if(!b||b===GasTokenType)try{return formatMist(a);}catch{return a+'\x20raw\x20smallest\x20units\x20of\x20'+GasTokenType;}return a+'\x20raw\x20smallest\x20units\x20of\x20'+b;}export function collectDefaultWarnings(a,b){const c=[],d=a?.['account'];(d===undefined||d==='')&&c['push'](DEFAULT_VALUE_WARNINGS['defaultAccount']);const e=a?.['network'];e&&/mainnet/i['test'](String(e))&&c['push'](DEFAULT_VALUE_WARNINGS['mainnet']);const f=b?.['namedNew']??b?.['object'];return f&&typeof f==='object'&&f['replaceExistName']===!![]&&c['push'](DEFAULT_VALUE_WARNINGS['replaceExistName']),c;}export const BRIDGE_FUND_OPERATION_TYPES=['cross_chain_wow_to_evm','cross_chain_evm_to_wow','claim_wow_to_evm','resume_transfer','withdraw'];function describeBridgeAmount(a,b,c){if(b==='WOW'||!b&&c==='wow_to_evm')return formatMist(a);const d=MAINNET_BRIDGE_CONFIG?.['tokens']?.['find'](f=>f['symbol']?.['toUpperCase']()===b?.['toUpperCase']()),e=d?c==='wow_to_evm'?d['wowDecimals']:d['evmDecimals']:undefined;if(e===undefined)return a+'\x20raw\x20smallest\x20units\x20of\x20'+(b??'the\x20bridge\x20token');try{return formatUnits(BigInt(a),e)+'\x20'+b;}catch{return a+'\x20raw\x20smallest\x20units\x20of\x20'+b;}}export const CONFIRMATION_RULES=[{'id':'bridge_fund_movement','when':(a,b,c)=>BRIDGE_FUND_OPERATION_TYPES['includes'](a),'level':'irreversible','preview':(a,b,c)=>{const d=typeof b?.['amount']==='string'?b['amount']:undefined,e=typeof b?.['token']==='string'?b['token']:undefined,f=b?.['withdrawTo']??b?.['recipientWowAddress']??b?.['to']??(a==='claim_wow_to_evm'||a==='resume_transfer'?b?.['transferId']:undefined),g=a==='cross_chain_wow_to_evm'?'wow_to_evm':'evm_side';return{'level':'irreversible','operation':a,'irreversible':!![],'network':c?.['network']??'mainnet','account':c?.['account']??'','amount':d!==undefined?{'value':d,'token':e??(g==='wow_to_evm'?GasTokenType:'ETH'),'human_readable':describeBridgeAmount(d,e,g),'recipient':f}:undefined,'warnings':[...collectDefaultWarnings(c,b),a==='withdraw'?'EVM\x20withdrawal\x20from\x20activeEvmAccount\x20—\x20funds\x20move\x20to\x20an\x20external\x20EVM\x20address;\x20irreversible.':'Cross-chain\x20bridge\x20transfer\x20—\x20funds\x20leave\x20the\x20source\x20chain;\x20recovery\x20(if\x20any)\x20requires\x20the\x20opposite-side\x20claim\x20or\x20resume_transfer,\x20never\x20a\x20rollback.']};},'bypass_on_explicit_intent':[]},{'id':'irreversible_fund_or_verdict','when':(a,b,c)=>{const d=c?.['network'],e=bestEffortTokenType(b)??GasTokenType;if(a==='payment'&&Array['isArray'](b?.['revenue'])&&b['revenue']['length']>0x0){const f=b['revenue']['map'](g=>g?.['amount']?.['balance'])['filter'](g=>typeof g==='string'||typeof g==='number');if(f['length']===b['revenue']['length']&&f['every'](g=>isFundApprovalExempt(d,e,String(g))))return![];return!![];}if(a==='treasury'&&b?.['withdraw']){const g=extractAmount(b);if(g!==null&&isFundApprovalExempt(d,e,g))return![];return!![];}if(a==='payment')return!![];if(a==='arbitration'&&b?.['arbitration']!==undefined)return!![];if(b?.['receive']!==undefined||b?.['owner_receive']!==undefined||b?.['received_coins']!==undefined||b?.['compensation_fund_receive']!==undefined)return!![];if(b?.['alloc_by_guard']!==undefined)return!![];if(a==='reward'&&b?.['claim']!==undefined)return!![];if(a==='service'&&b?.['compensation_fund_withdraw']!==undefined)return!![];if(a==='order'&&b?.['arb_claim_compensation']!==undefined)return!![];if(a==='arbitration'&&(b?.['arb_withdraw']!==undefined||b?.['fees_transfer']!==undefined))return!![];if(a==='treasury'){if(b?.['withdraw'])return!![];return![];}return![];},'level':'irreversible','preview':(a,b,c)=>{let d;if(a==='payment'&&Array['isArray'](b?.['revenue'])&&b['revenue']['length']>0x0){const f=b['revenue']['find'](g=>typeof g?.['amount']?.['balance']==='string'||typeof g?.['amount']?.['balance']==='number');if(f){const g=String(f['amount']['balance']);d={'value':g,'human_readable':describeAmount(g,bestEffortTokenType(b))};}else d={'value':'','human_readable':'entire\x20Coin\x20object(s)\x20(amount\x20resolved\x20by\x20the\x20fund\x20layer)'};}const e=[];return a==='reward'&&b?.['claim']!==undefined&&e['push']('Reward\x20claim\x20—\x20Guard-verified\x20payout\x20splits\x20the\x20pool\x20balance\x20and\x20transfers\x20coins\x20to\x20the\x20claimer;\x20the\x20exact\x20amount\x20is\x20determined\x20by\x20the\x20Reward\x27s\x20guard\x20config.'),a==='service'&&b?.['compensation_fund_withdraw']!==undefined&&e['push']('Compensation\x20fund\x20withdraw\x20—\x20withdraws\x20the\x20ENTIRE\x20compensation_fund\x20into\x20a\x20new\x20Payment\x20owned\x20by\x20\x27'+(b['compensation_fund_withdraw']?.['receipt']??'(recipient)')+'\x27.'),a==='order'&&b?.['arb_claim_compensation']!==undefined&&e['push']('Order\x20compensation\x20claim\x20—\x20splits\x20the\x20Service\x27s\x20compensation_fund\x20and\x20transfers\x20the\x20awarded\x20coins\x20to\x20the\x20caller;\x20irreversible.'),a==='arbitration'&&b?.['arb_withdraw']!==undefined&&e['push']('Arb\x20fee\x20withdraw\x20—\x20sweeps\x20the\x20Arb\x27s\x20fee\x20balance\x20into\x20the\x20Arbitration\x20object\x27s\x20balance.'),a==='arbitration'&&b?.['fees_transfer']!==undefined&&e['push']('Arbitration\x20fees\x20transfer\x20—\x20withdraws\x20the\x20ENTIRE\x20Arbitration\x20balance\x20into\x20a\x20new\x20Payment\x20for\x20the\x20target\x20Allocation/Treasury;\x20irreversible.'),{'level':'irreversible','operation':a,'irreversible':!![],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),...e],'amount':a==='payment'&&d?{...d,'token':bestEffortTokenType(b)??GasTokenType,'recipient':b?.['revenue']?.[0x0]?.['recipient']}:undefined};},'bypass_on_explicit_intent':[]},{'id':'publish_immutable','when':(a,b,c)=>{if(a==='service'&&(b?.['publish']===!![]||b?.['bPublished']===!![]))return!![];if(a==='machine'&&b?.['publish']===!![])return!![];return![];},'level':'publish','preview':(a,b,c)=>({'level':'publish','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':a==='service'?['machine','order_allocators']:['nodes','pairs','forwards'],'warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['force\x20publish','publish\x20now']},{'id':'amount_sensitive','when':(a,b,c)=>{const d=extractAmount(b);if(d!==null){if(isFundApprovalExempt(c?.['network'],bestEffortTokenType(b)??GasTokenType,d))return![];return!![];}if(a==='service'&&b?.['order_new'])return!![];if(a==='treasury'&&b?.['deposit']?.['coin']?.['coin'])return!![];if(a==='reward'&&b?.['coin_add']?.['coin'])return!![];if(a==='allocation'&&b?.['coin']?.['coin'])return!![];return![];},'level':'amount','preview':(a,b,c)=>{const d=extractAmount(b),e=bestEffortTokenType(b);return{'level':'amount','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','amount':d?{'value':d,'token':e??GasTokenType,'human_readable':describeAmount(d,e)}:{'value':'','token':e??GasTokenType,'human_readable':'entire\x20Coin\x20object\x20(amount\x20resolved\x20on-chain)'},'warnings':collectDefaultWarnings(c,b)};},'bypass_on_explicit_intent':[]},{'id':'default_values','when':(a,b,c)=>{return collectDefaultWarnings(c,b)['length']>0x0;},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['use\x20default\x20account','default\x20account\x20is\x20fine','use\x20the\x20default\x20account','default\x20account\x20works\x20fine']},{'id':'guard_create_immutable','when':(a,b,c)=>{if(a==='guard')return!![];return![];},'level':'irreversible','preview':(a,b,c)=>{const d=b?.['table']??[],e=b?.['root'],f=b?.['rely'],g=typeof e==='object'&&e!==null&&'type'in e?e['type']:typeof e==='object'&&e!==null&&'type'in e&&e['type']==='file'?'file':'unknown',h=['table','root'];if(f)h['push']('rely');return{'level':'irreversible','operation':a,'object':b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':h,'irreversible':!![],'warnings':[...collectDefaultWarnings(c,b),'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation','Table\x20entries:\x20'+d['length']+'\x20(max\x20256)','Root\x20node\x20type:\x20'+g+'\x20(must\x20return\x20Bool)',...f?['Rely\x20dependencies:\x20'+(f['guards']?.['length']??0x0)+'\x20(max\x204,\x20AND/OR\x20logic)']:[],'To\x20modify\x20later:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind']};},'bypass_on_explicit_intent':[]},{'id':'guard_gen_passport_test','when':(a,b,c)=>{if(a==='gen_passport')return!![];return![];},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['guard'],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),'gen_passport\x20will\x20consume\x20gas\x20for\x20static\x20testing']}),'bypass_on_explicit_intent':['test\x20guard','testing\x20guard','gen\x20passport','generate\x20passport']},{'id':'progress_advance','when':(a,b,c)=>{if(a!=='progress')return![];return b?.['operate']?.['op']==='next'||b?.['owner_receive']!==undefined;},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['object'],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),'Advancing\x20the\x20progress\x20node\x20may\x20release\x20funds\x20per\x20the\x20machine\x20allocation']}),'bypass_on_explicit_intent':[]}];export function resolveOverrideId(a,b){if(a==='publish_immutable'){if(b==='service')return'service.publish';if(b==='machine')return'machine.publish';return undefined;}if(a==='progress_advance')return'node.advance';if(a==='default_values')return'confirm.default_values';if(a==='guard_gen_passport_test')return'confirm.gen_passport_test';return undefined;}export function extractAmount(a){if(!a)return null;const b=e=>{if(typeof e==='number')return String(e);if(typeof e==='string'&&e!=='')return e;return null;},d=[a?.['balance'],a?.['amount'],a?.['compensation_fund_add']?.['balance'],a?.['coin_add']?.['balance'],a?.['coin']?.['balance'],a?.['order_new']?.['buy']?.['total_pay']?.['balance'],a?.['dispute']?.['fee']?.['balance'],a?.['fee'],a?.['arbitration']?.['indemnity'],a?.['revenue']?.[0x0]?.['amount']?.['balance'],a?.['deposit']?.['coin']?.['balance'],a?.['withdraw']?.['amount']?.['fixed']];for(const e of d){const f=b(e);if(f!==null)return f;}if(Array['isArray'](a?.['guard_add']))for(const h of a['guard_add']){if(h?.['amount']?.['type']==='Fixed'){const i=b(h['amount']['value']);if(i!==null)return i;}}for(const j of[a?.['allocators'],a?.['order_allocators']]){if(!j||typeof j!=='object')continue;const k=b(j['threshold']);if(k!==null)return k;for(const l of Array['isArray'](j['allocators'])?j['allocators']:[]){if(Array['isArray'](l?.['sharing']))for(const n of l['sharing']){if(n?.['mode']==='Amount'){const o=b(n['sharing']);if(o!==null)return o;}}const m=b(l?.['max']);if(m!==null)return m;}}return null;}export const OBJECT_REUSE_RULES=[{'rule_id':'REUSE-001','object_type':'permission','recommendation':'strongly_recommended','reason':'Centralized\x20permission\x20control\x20across\x20all\x20services','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Permission\x20to\x20reuse?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-002','object_type':'machine','recommendation':'recommended','reason':'Save\x20design\x20time\x20for\x20similar\x20processes','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Machine\x20whose\x20workflow\x20fits?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-003','object_type':'guard','recommendation':'recommended','reason':'Avoid\x20redundant\x20validation\x20rules','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Guard\x20with\x20matching\x20validation\x20logic?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-004','object_type':'contact','recommendation':'recommended','reason':'Single\x20point\x20of\x20customer-service\x20management','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Contact\x20for\x20customer\x20service?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-005','object_type':'arbitration','recommendation':'always_reuse','reason':'Customers\x20choose\x20from\x20established\x20arbiters;\x20creating\x20a\x20new\x20Arbitration\x20is\x20an\x20operator-level\x20decision','ask_user':'Which\x20existing\x20Arbitration\x20service\x20should\x20disputes\x20route\x20to?\x20Provide\x20the\x20name\x20or\x20ID.'}];export const CREATE_VS_MODIFY_PATTERN={'reuse_form':'string','create_form':'object','resolution_api':'GetObjectExisted','note':'String\x20reference\x20=\x20REUSE\x20(name\x20resolution\x20failure\x20is\x20a\x20hard\x20error);\x20object\x20shape\x20=\x20CREATE\x20(always).'};export const IMMUTABILITY_RULES=[{'rule_id':'IMMUT-001','object_type':'machine','trigger':'publish','immutable_fields':['nodes','pairs','forwards'],'message':'Machine\x20topology\x20is\x20immutable\x20after\x20publish\x20—\x20verify\x20all\x20nodes/forwards\x20via\x20machineNode2file\x20BEFORE\x20publishing'},{'rule_id':'IMMUT-002','object_type':'service','trigger':'publish','immutable_fields':['machine','order_allocators','arbitrations'],'mutable_after':['sales'],'message':'Service.machine,\x20order_allocators\x20and\x20arbitrations\x20are\x20frozen\x20after\x20publish;\x20sales\x20remains\x20fully\x20modifiable\x20(L3)\x20without\x20pause'},{'rule_id':'IMMUT-003','object_type':'guard','trigger':'create','immutable_fields':['table','root','rely'],'message':'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation.\x20To\x20change:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind'}];export const OPERATION_TYPE_CLASSIFICATION={'LOCAL_ONLY':['account_operation','local_mark_operation','local_info_operation','config_operation'],'ONCHAIN':['onchain_operations','wip_file','bridge_operation','messenger_operation'],'QUERY':['query_toolkit','onchain_table_data','onchain_events','guard2file','machineNode2file','schema_query','wowok_buildin_info','trust_score'],'ENCRYPTED':['messenger_operation']};export const OPERATION_CLASS_META={'LOCAL_ONLY':{'gas':![],'confirmation_required':![],'note':'Local\x20state\x20only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ONCHAIN':{'gas':!![],'confirmation_required':!![],'note':'On-chain\x20write\x20—\x20gas\x20consumed,\x20explicit\x20user\x20confirmation\x20REQUIRED\x20before\x20execution'},'QUERY':{'gas':![],'confirmation_required':![],'note':'Read-only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ENCRYPTED':{'gas':![],'confirmation_required':![],'note':'Local\x20encryption\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'}};export function classifyTool(a){if(OPERATION_TYPE_CLASSIFICATION['ENCRYPTED']['includes'](a))return'ENCRYPTED';for(const b of['LOCAL_ONLY','ONCHAIN','QUERY']){if(OPERATION_TYPE_CLASSIFICATION[b]['includes'](a))return b;}return undefined;}export const NAMING_CONVENTIONS={'scheme':'<projectPrefix>_<type>_<purpose>_<version>','parts':{'project_prefix':{'example':'shopFunny_','purpose':'Prevents\x20cross-project\x20collisions'},'type_prefix':{'example':'machine_\x20/\x20guard_\x20/\x20service_','purpose':'Clarifies\x20object\x20type'},'purpose_suffix':{'example':'serviceWithdraw','purpose':'Describes\x20function'},'version_suffix':{'example':'_v2','purpose':'Enables\x20iteration\x20without\x20replaceExistName'}},'entry_id':{'pattern':'^<object_type>:<name>$','example':'service:myshop_service'},'replace_exist_name':{'default':![],'false_effect':'Throws\x20error\x20if\x20name\x20is\x20in\x20use\x20—\x20safe\x20default','true_effect':'Existing\x20object/account\x20with\x20the\x20same\x20name\x20is\x20suspended/unbound\x20to\x20free\x20the\x20name','account_default_forbidden':'replaceExistName:true\x20on\x20the\x20default\x20account\x20(name=\x27\x27)\x20is\x20FORBIDDEN\x20—\x20use\x20suspend()\x20explicitly','recommendation':'DISCOURAGED\x20—\x20prefer\x20versioned\x20names\x20(_v1,\x20_v2)\x20for\x20production'},'recommendations':['Always\x20provide\x20tags\x20on\x20object\x20creation\x20for\x20filtering\x20and\x20management','Use\x20names\x20as\x20primary\x20identifiers;\x20use\x20short\x20address\x20form\x20(0x1234...def)\x20only\x20for\x20display','All\x20cross-object\x20references\x20(Guard\x20tables,\x20Service\x20bindings,\x20Machine\x20forwards)\x20use\x20NAMES\x20—\x20resolved\x20per-network\x20at\x20build\x20time']};export function checkObjectReuseRules(a){const b=[];for(const c of a){if(!c['is_new'])continue;const d=OBJECT_REUSE_RULES['find'](e=>e['object_type']===c['object_type']);if(!d)continue;(d['recommendation']==='always_reuse'||d['recommendation']==='strongly_recommended')&&b['push']({'rule_id':d['rule_id'],'severity':d['recommendation']==='always_reuse'?'warn':'info','message':'Creating\x20NEW\x20'+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20—\x20reuse\x20is\x20'+d['recommendation']+':\x20'+d['reason']+'.\x20'+d['ask_user']});}return b;}export function checkImmutabilityRules(a){const b=[];for(const c of a){const d=IMMUTABILITY_RULES['find'](e=>e['object_type']===c['object_type']&&e['trigger']===c['trigger']);if(!d)continue;b['push']({'rule_id':d['rule_id'],'severity':'warn','message':''+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20'+c['trigger']+':\x20'+d['message']+'.\x20Immutable:\x20['+d['immutable_fields']['join'](',\x20')+']'+(d['mutable_after']?'.\x20Still\x20mutable:\x20['+d['mutable_after']['join'](',\x20')+']':'')});}return b;}export const SAFETY_RULES_VERSION=0x2;
|
|
@@ -9,7 +9,9 @@ export interface BridgeField {
|
|
|
9
9
|
}
|
|
10
10
|
export interface ScenarioBridge {
|
|
11
11
|
id: string;
|
|
12
|
+
code: string;
|
|
12
13
|
name: string;
|
|
14
|
+
edge_refs: string[];
|
|
13
15
|
participants: BridgeParticipant[];
|
|
14
16
|
bridge_fields: BridgeField[];
|
|
15
17
|
move_anchor: string;
|
|
@@ -35,9 +37,12 @@ export interface ScenarioChain {
|
|
|
35
37
|
}
|
|
36
38
|
export declare const SCENARIO_BRIDGE_REGISTRY: ScenarioBridge[];
|
|
37
39
|
export declare const SCENARIO_CHAINS: ScenarioChain[];
|
|
38
|
-
export declare const SCENARIO_TOPOLOGY_VERSION = "1.
|
|
40
|
+
export declare const SCENARIO_TOPOLOGY_VERSION = "1.1.0";
|
|
39
41
|
export declare function getBridgeById(id: string): ScenarioBridge | undefined;
|
|
42
|
+
export declare function getBridgeByCode(code: string): ScenarioBridge | undefined;
|
|
40
43
|
export declare function getBridgesByObject(objectType: string): ScenarioBridge[];
|
|
44
|
+
export declare function getBridgesForEdge(schemaId: string): ScenarioBridge[];
|
|
45
|
+
export declare function detectBridgesForEdges(schemaIds: Iterable<string>): ScenarioBridge[];
|
|
41
46
|
export declare function getChainById(id: string): ScenarioChain | undefined;
|
|
42
47
|
export declare function summarizeBridge(b: ScenarioBridge): string;
|
|
43
48
|
export declare function detectBridgesForObjects(objectTypes: string[]): ScenarioBridge[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SCENARIO_BRIDGE_REGISTRY=[{'id':'bridge.supply_match','name':'Supply-Demand\x20Match','participants':[{'object':'Demand','role':'need\x20expression\x20(what\x20is\x20wanted)'},{'object':'Service','role':'capability\x20offering\x20(what\x20can\x20be\x20delivered)'},{'object':'Guard','role':'presentation\x20qualification\x20(who\x20may\x20present\x20what)'}],'bridge_fields':[{'object':'Demand','field':'guards:\x20vector<ServiceGuard>\x20{\x20guard,\x20service_identifier\x20}','meaning':'presenters\x20must\x20pass\x20the\x20guard;\x20service_identifier\x20resolves\x20WHICH\x20service\x20they\x20present\x20for'},{'object':'Demand','field':'present_service_with_passport(service:&Service<T>)','meaning':'a\x20Service\x20object\x20is\x20supplied\x20AT\x20the\x20presentation\x20—\x20the\x20demand\x20does\x20not\x20store\x20services;\x20suppliers\x20bring\x20them'}],'move_anchor':'demand.move\x20L124-150\x20(present_with_passport_imp:\x20result_for_guard\x20+\x20submission_get(service_identifier))','scenario':{'from':'Demand\x20scenario\x20(need\x20expression)','to':'Service\x20scenario\x20(product\x20listing)','merged':'Matchmaking\x20(discovery\x20+\x20qualification\x20+\x20choice)'},'capability_gained':'Choice\x20among\x20qualified\x20offers:\x20the\x20demander\x20compares\x20presented\x20Services\x20(acceptance_score\x20accumulates\x20per\x20presenter)\x20'+'—\x20a\x20capability\x20neither\x20a\x20bare\x20Demand\x20(no\x20offers)\x20nor\x20a\x20bare\x20Service\x20(no\x20buyer\x20context)\x20possesses.','value_flow':'No\x20funds\x20move\x20yet\x20—\x20this\x20bridge\x20prices\x20ATTENTION:\x20acceptance_score\x20on\x20the\x20presenter\x27s\x20entity\x20is\x20the\x20reputation\x20currency.','prerequisites':['Demand\x20not\x20yet\x20paused\x20(demand.move)','Presenter\x20passes\x20the\x20Demand\x27s\x20guard\x20(E_NEED_PASSPORT\x20when\x20guards\x20exist\x20and\x20no\x20passport\x20is\x20given)'],'examples':['Procurement\x20tender:\x20a\x20company\x20posts\x20a\x20Demand;\x20certified\x20suppliers\x20present\x20their\x20Services;\x20the\x20best\x20acceptance_score\x20wins\x20the\x20order.','Local\x20services\x20marketplace:\x20\x27repair\x20my\x20roof\x27\x20demand\x20meets\x20licensed\x20roofer\x20services.']},{'id':'bridge.purchase','name':'Purchase\x20(Quote\x20→\x20Order)','participants':[{'object':'Service','role':'published\x20offering\x20(sales,\x20wip,\x20price)'},{'object':'Quote','role':'buyer\x27s\x20item\x20selection\x20+\x20computed\x20total'},{'object':'Discount','role':'transferable\x20price\x20reduction\x20bound\x20to\x20the\x20service'},{'object':'Guard','role':'buy\x20qualification\x20(buy_guard)'},{'object':'Order','role':'the\x20created\x20agreement'}],'bridge_fields':[{'object':'Service','field':'buy_guard:\x20Option<address>','meaning':'who\x20may\x20buy\x20(qualification);\x20buy()\x20refuses\x20when\x20a\x20guard\x20exists\x20and\x20no\x20passport\x20proves\x20it'},{'object':'Discount','field':'service:\x20address\x20(+\x20time\x20window,\x20benchmark,\x20transferable)','meaning':'the\x20discount\x20object\x20itself\x20carries\x20WHICH\x20service\x20it\x20applies\x20to\x20—\x20it\x20travels\x20wallet-to-wallet\x20but\x20stays\x20bound\x20to\x20the\x20service'},{'object':'Order','field':'machine:\x20Option<address>\x20(copied\x20from\x20Service\x20at\x20order::new)','meaning':'the\x20fulfillment\x20workflow\x20is\x20PRE-BINDED\x20at\x20purchase\x20time\x20—\x20the\x20order\x20reserves\x20its\x20own\x20execution\x20path'}],'move_anchor':'service.move\x20L278-321\x20(buy\x20/\x20buy_with_passport\x20/\x20buy_imp\x20→\x20order::new),\x20order.move\x20L103-114','scenario':{'from':'Service\x20scenario\x20(offering)','to':'Order\x20scenario\x20(agreement\x20+\x20escrow\x20intent)','merged':'Transaction\x20(commitment\x20with\x20reserved\x20fulfillment)'},'capability_gained':'A\x20binding\x20agreement\x20that\x20reserves\x20its\x20own\x20execution\x20path:\x20the\x20Order\x20snapshot\x20copies\x20the\x20Service\x27s\x20machine\x20reference\x20'+'at\x20creation,\x20so\x20later\x20Service\x20edits\x20cannot\x20retroactively\x20change\x20how\x20THIS\x20order\x20is\x20fulfilled.','value_flow':'Amount\x20is\x20recorded\x20(order.amount)\x20but\x20coins\x20are\x20not\x20yet\x20moved\x20—\x20payment\x20happens\x20at\x20the\x20allocation\x20bridge.','prerequisites':['Service\x20published\x20(bPublished)\x20and\x20not\x20paused\x20(E_NOT_PUBLISHED\x20/\x20E_PAUSED)','Quote\x20signed\x20by\x20the\x20tx\x20digest\x20(E_INVALID_QUOTE)\x20—\x20prevents\x20quote\x20replay\x20across\x20transactions','buy_guard\x20passed\x20when\x20present\x20(E_BUY_GUARD_PASSPORT_REQUIRED)'],'examples':['Standard\x20e-commerce\x20checkout:\x20quote\x20items,\x20apply\x20a\x20transferred\x20Discount,\x20create\x20the\x20Order.','Gated\x20purchase:\x20only\x20KYC-passed\x20wallets\x20(buy_guard)\x20can\x20order\x20a\x20licensed\x20service.']},{'id':'bridge.escrow_split','name':'Escrow\x20&\x20Split\x20(Order\x20→\x20Allocation\x20→\x20Payment)','participants':[{'object':'Service','role':'payout\x20rules\x20owner\x20(order_allocators)'},{'object':'Order','role':'escrowed\x20amount\x20+\x20single\x20allocation\x20slot'},{'object':'Allocation','role':'guard-gated\x20distributor'},{'object':'Payment','role':'the\x20actual\x20value\x20transfer\x20with\x20provenance'}],'bridge_fields':[{'object':'Service','field':'order_allocators:\x20Option<Allocators>','meaning':'who\x20may\x20run\x20the\x20split\x20and\x20under\x20which\x20guards\x20—\x20the\x20merchant\x27s\x20payout\x20policy,\x20pre-registered\x20on\x20the\x20Service'},{'object':'Order','field':'allocation:\x20Option<address>\x20(on_allocation,\x20single-shot)','meaning':'the\x20order\x20can\x20be\x20split\x20exactly\x20once\x20—\x20the\x20escrow-to-payout\x20transition\x20is\x20one-way\x20and\x20auditable'},{'object':'Payment','field':'info.for_object\x20/\x20from_object','meaning':'every\x20payout\x20carries\x20the\x20source\x20object\x20address\x20—\x20money\x20always\x20answers\x20\x27which\x20business\x20object\x20paid\x20me\x27'}],'move_anchor':'service.move\x20L291-303\x20(order_allocation:\x20E_ORDER_SERVICE_NOT_MATCH\x20→\x20allocation::new_with_coin\x20→\x20payment_info(order)),\x20allocation.move\x20L202+\x20(alloc)','scenario':{'from':'Order\x20scenario\x20(agreement\x20+\x20funds)','to':'Payment\x20scenario\x20(value\x20transfer)','merged':'Settlement\x20(escrowed\x20funds\x20split\x20by\x20declared\x20policy)'},'capability_gained':'Trustless\x20settlement:\x20the\x20buyer\x20pays\x20into\x20the\x20order\x20amount,\x20and\x20the\x20split\x20executes\x20only\x20under\x20the\x20merchant\x27s\x20'+'pre-registered\x20allocator\x20guards\x20—\x20neither\x20side\x20can\x20redirect\x20the\x20other\x27s\x20share;\x20the\x20Payment\x27s\x20from_object\x20makes\x20'+'every\x20revenue\x20line\x20item\x20auditable\x20back\x20to\x20its\x20order.','value_flow':'Buyer\x20coin\x20→\x20Allocation\x20balance\x20→\x20(guard-gated\x20alloc)\x20→\x20Payment\x20recipients\x20(Entity\x20/\x20Signer\x20/\x20GuardIdentifier).','prerequisites':['Coin\x20≥\x20order.amount\x20(E_COIN_NOT_ENOUGH),\x20excess\x20refunded\x20to\x20the\x20sender\x20in\x20the\x20same\x20tx','The\x20calling\x20Service\x20IS\x20the\x20order\x27s\x20service\x20(E_ORDER_SERVICE_NOT_MATCH)','Rate\x20shares\x20must\x20complete\x2010000\x20basis\x20points\x20unless\x20a\x20Surplus\x20entry\x20exists\x20(allocation.move\x20L173-177)'],'examples':['Multi-vendor\x20order:\x20one\x20payment\x20split\x20across\x20goods\x20supplier,\x20logistics\x20operator,\x20and\x20platform\x20surplus.','Payroll-style\x20settlement:\x20order\x20revenue\x20split\x20to\x20staff\x20entities\x20by\x20Rate\x20with\x20the\x20owner\x20taking\x20Surplus.']},{'id':'bridge.fulfillment','name':'Fulfillment\x20(Order\x20×\x20Machine\x20→\x20Progress)','participants':[{'object':'Service','role':'workflow\x20owner\x20(machine\x20field)'},{'object':'Order','role':'the\x20work\x20item\x20to\x20execute'},{'object':'Machine','role':'workflow\x20template\x20(nodes\x20+\x20forwards)'},{'object':'Progress','role':'per-order\x20workflow\x20instance'},{'object':'Permission','role':'who\x20may\x20advance\x20which\x20edge'}],'bridge_fields':[{'object':'Service','field':'machine:\x20Option<address>','meaning':'the\x20workflow\x20template\x20the\x20service\x20promises\x20to\x20execute\x20—\x20locked\x20at\x20publish\x20(bPublished)'},{'object':'Progress','field':'order\x20namespace\x20+\x20order_owner_set([buyer])','meaning':'the\x20buyer\x20becomes\x20the\x20Progress\x27s\x20order-owner\x20namespace:\x20operators\x20advance\x20THEIR\x20copy,\x20the\x20buyer\x27s\x20own\x20Progress\x20view\x20aggregates'},{'object':'Machine','field':'Forward\x20{\x20namedOperator\x20|\x20permissionIndex\x20|\x20guard\x20}','meaning':'each\x20edge\x20declares\x20its\x20operator\x20—\x20internal\x20staff,\x20permission\x20entity,\x20or\x20guard-proven\x20external\x20party'}],'move_anchor':'service.move\x20L305-313\x20(order_progress:\x20E_MACHINE_NOT_MATCH\x20→\x20progress::new_imp\x20→\x20order::on_progress),\x20progress.move\x20L462+','scenario':{'from':'Order\x20scenario\x20(agreement)','to':'Machine\x20scenario\x20(process\x20template)','merged':'Execution\x20(per-order\x20workflow\x20with\x20multi-party\x20advancement)'},'capability_gained':'Coordinated\x20execution:\x20the\x20SAME\x20template\x20runs\x20independently\x20per\x20order,\x20with\x20each\x20edge\x20potentially\x20operated\x20by\x20a\x20'+'different\x20party\x20(employee\x20/\x20supplier\x20/\x20buyer)\x20under\x20permission\x20or\x20guard\x20checks\x20—\x20process\x20outsourcing\x20with\x20on-chain\x20accountability.','prerequisites':['The\x20supplied\x20machine\x20IS\x20the\x20service\x27s\x20machine\x20(E_MACHINE_NOT_MATCH)','Each\x20forward\x27s\x20weight\x20counts\x20at\x20most\x20once\x20per\x20session\x20(E_NOT_THE_HOLDER\x20on\x20re-execution)','Edge\x20guard\x20(when\x20present)\x20requires\x20submitted\x20evidence\x20—\x20retained\x20submissions\x20persist\x20into\x20the\x20session\x20history'],'examples':['Custom\x20manufacturing:\x20paid\x20→\x20machining\x20→\x20QC\x20→\x20shipped,\x20where\x20QC\x20is\x20advanced\x20by\x20an\x20independent\x20inspector\x20(namedOperator).','Multi-supplier\x20sub-orders:\x20the\x20machine\x27s\x20nodes\x20hand\x20off\x20between\x20the\x20merchant\x20and\x20subcontracted\x20suppliers.']},{'id':'bridge.dispute','name':'Dispute\x20&\x20Compensation\x20(Service\x20×\x20Arbitration\x20×\x20Order\x20→\x20Arb)','participants':[{'object':'Service','role':'pre-registered\x20arbitrations\x20+\x20compensation\x20fund'},{'object':'Arbitration','role':'voting\x20rules\x20+\x20usage\x20gate'},{'object':'Order','role':'the\x20disputed\x20agreement\x20(single\x20claim)'},{'object':'Arb','role':'the\x20case\x20(7-state\x20lifecycle)'}],'bridge_fields':[{'object':'Service','field':'arbitrations:\x20vector<address>\x20+\x20compensation_fund:\x20Balance<T>','meaning':'the\x20merchant\x20pre-commits\x20BOTH\x20who\x20judges\x20(independent\x20permission)\x20AND\x20the\x20money\x20that\x20backs\x20the\x20verdict'},{'object':'Service','field':'arbitration_add_imp\x20fairness\x20check','meaning':'E_ARBITRATION_PERMISSION_CONFLICT:\x20an\x20Arbitration\x20sharing\x20the\x20Service\x27s\x20own\x20Permission\x20is\x20REJECTED\x20—\x20fairness\x20is\x20enforced\x20as\x20a\x20RELATIONAL\x20constraint,\x20not\x20a\x20promise'},{'object':'Order','field':'dispute:\x20vector<address>\x20+\x20claimed_by:\x20Option<address>','meaning':'disputes\x20append\x20to\x20the\x20order;\x20compensation\x20claims\x20it\x20exactly\x20once\x20(E_ORDER_ALREADY_CLAIMED)\x20—\x20the\x20payout\x20is\x20single-shot\x20by\x20construction'}],'move_anchor':'arbitration.move\x20L264-276\x20(dispute\x20/\x20dispute_with_passport),\x20service.move\x20L336+\x20(compensation_claim),\x20arb.move\x20(7-state\x20lifecycle)','scenario':{'from':'Fulfillment\x20scenario\x20(execution\x20with\x20possible\x20disagreement)','to':'Arbitration\x20scenario\x20(independent\x20judgment)','merged':'Remedy\x20(wrong\x20execution\x20→\x20compensated\x20loss)'},'capability_gained':'Credible\x20remedy:\x20the\x20loser\x20of\x20a\x20bad\x20transaction\x20is\x20made\x20whole\x20from\x20a\x20fund\x20the\x20merchant\x20could\x20not\x20pre-empty,\x20'+'judged\x20by\x20parties\x20the\x20merchant\x20cannot\x20appoint\x20unilaterally\x20—\x20trustlessness\x20expressed\x20as\x20a\x20field-level\x20topology\x20constraint.','value_flow':'compensation_fund\x20(Service)\x20→\x20indemnity\x20(Arb)\x20→\x20compensation\x20claim\x20to\x20the\x20winning\x20party\x20(single\x20claim\x20per\x20order).','prerequisites':['Disputant\x20passes\x20the\x20Arbitration\x27s\x20usage_guard\x20when\x20set\x20(E_NEED_PASSPORT)','Voters\x20pass\x20voting\x20guards;\x20vote\x20weight\x20from\x20FixedValue\x20or\x20GuardIdentifier\x20submission','Voting\x20deadline\x20elapsed\x20before\x20finish;\x20objection\x20windows\x20respected\x20(arb.move\x20state\x20machine)'],'examples':['Delivery\x20dispute:\x20buyer\x20proves\x20non-delivery\x20via\x20WTS\x20evidence;\x20independent\x20arbitrators\x20vote;\x20compensation\x20pays\x20from\x20the\x20fund.','SLA\x20breach:\x20machine\x20timestamps\x20prove\x20late\x20delivery;\x20weighted\x20voters\x20set\x20the\x20indemnity.']},{'id':'bridge.data_service','name':'Data\x20Service\x20(Service\x20×\x20Repository)','participants':[{'object':'Service','role':'the\x20offering\x20that\x20includes\x20data\x20deliverables'},{'object':'Repository','role':'on-chain\x20database\x20(policies,\x20rows)'},{'object':'Guard','role':'write/quote\x20qualification\x20per\x20policy'}],'bridge_fields':[{'object':'Service','field':'repositories:\x20vector<address>\x20(max\x20100)','meaning':'databases\x20the\x20service\x20commits\x20to\x20maintain\x20—\x20the\x20deliverable\x20IS\x20the\x20data'},{'object':'Repository','field':'PolicyGuard\x20{\x20id_from_submission,\x20data_from_submission\x20}','meaning':'writes\x20are\x20guard-qualified:\x20WHO\x20(row\x20key)\x20may\x20write\x20WHAT\x20(the\x20submitted\x20data\x20itself)'}],'move_anchor':'service.move\x20L182\x20(repositories\x20field),\x20repository.move\x20L83-103\x20(policy_guard)\x20/\x20L346+\x20(guarded\x20writes)','scenario':{'from':'Service\x20scenario\x20(offering)','to':'Repository\x20scenario\x20(on-chain\x20database)','merged':'Data\x20products\x20(paid,\x20qualified,\x20auditable\x20data\x20maintenance)'},'capability_gained':'Verifiable\x20data\x20work:\x20a\x20subscription\x20where\x20the\x20provider\x27s\x20every\x20write\x20is\x20qualified\x20by\x20guards\x20and\x20attributable\x20to\x20'+'the\x20paid\x20service\x20—\x20data\x20quality\x20becomes\x20an\x20enforceable\x20contract\x20term,\x20not\x20a\x20promise.','prerequisites':['Writer\x20passes\x20the\x20policy\x27s\x20write\x20guards','Row\x20key\x20resolves\x20via\x20id_from_submission\x20(or\x20PolicyRule.id_from\x20static\x20override)'],'examples':['Market-data\x20feed\x20service:\x20subscribers\x20pay;\x20the\x20provider\x20writes\x20rows\x20under\x20a\x20write\x20guard\x20proving\x20oracle\x20provenance.','Review\x20platform:\x20reviewers\x20pass\x20reputation\x20guards;\x20their\x20submissions\x20become\x20the\x20product\x20others\x20pay\x20to\x20read\x20(quote_guard).']},{'id':'bridge.qualification','name':'Qualification\x20(Guard\x20×\x20every\x20gated\x20scenario)','participants':[{'object':'Guard','role':'the\x20proof\x20machine'},{'object':'Passport','role':'per-tx\x20proof\x20carrier'},{'object':'gated\x20objects','role':'Service(buy)\x20/\x20Demand(present)\x20/\x20Arbitration(vote,\x20dispute)\x20/\x20Machine(forward)\x20/\x20Repository(write)\x20/\x20Treasury(external\x20flows)'}],'bridge_fields':[{'object':'gated\x20object','field':'*_guard\x20/\x20guards\x20fields\x20(buy_guard,\x20usage_guard,\x20voting_guard,\x20forward\x20guard,\x20policy\x20write\x20guards,\x20external\x20guards)','meaning':'the\x20object\x20declares\x20WHICH\x20guard\x20governs\x20its\x20gate\x20—\x20preset\x20slots\x20(guard-bindings.ts)\x20define\x20what\x20the\x20guard\x27s\x20submissions\x20MEAN\x20for\x20that\x20object'}],'move_anchor':'passport.move\x20(result_for_guard\x20/\x20submission_get),\x20guard.rs\x20(native\x20DSL:\x20Signer/Clock/Query\x20×\x20logic\x20tree)','scenario':{'from':'Proof\x20scenario\x20(evidence\x20+\x20verification)','to':'any\x20gated\x20business\x20scenario','merged':'Programmable\x20trust\x20(rules-as-code\x20participation)'},'capability_gained':'Unforgeable\x20participation\x20rules:\x20KYC,\x20stake,\x20membership,\x20time\x20windows,\x20oracle\x20facts\x20—\x20expressed\x20once\x20in\x20a\x20Guard\x20and\x20'+'reused\x20across\x20every\x20gate\x20that\x20binds\x20it;\x20the\x20same\x20guard\x20can\x20gate\x20buying,\x20presenting,\x20voting,\x20and\x20writing\x20consistently.','prerequisites':['Guard\x20DSL\x20type\x20compatibility\x20(e.g.\x20RewardIdentifier\x20needs\x20address-typed\x20submissions)','Passport\x20carries\x20the\x20guard\x27s\x20required\x20submissions\x20in\x20the\x20same\x20tx'],'examples':['One\x20KYC\x20guard\x20reused\x20by\x20five\x20services\x27\x20buy_gates\x20—\x20one\x20proof,\x20five\x20doors.','Stake-weighted\x20voting\x20guard:\x20the\x20same\x20guard\x20governs\x20both\x20arbitration\x20ballots\x20and\x20treasury\x20withdrawals.']},{'id':'bridge.communication','name':'Communication\x20(um:\x20Contact\x20×\x20every\x20business\x20object)','participants':[{'object':'Contact','role':'bound\x20IM\x20channel\x20(ims\x20members)'},{'object':'business\x20objects','role':'Service\x20/\x20Order\x20context\x20/\x20Demand\x20/\x20Arbitration\x20/\x20Treasury\x20/\x20Reward\x20/\x20Repository\x20/\x20Machine'}],'bridge_fields':[{'object':'business\x20object','field':'um:\x20Option<address>','meaning':'each\x20object\x20can\x20bind\x20ONE\x20Contact\x20—\x20its\x20dedicated\x20negotiation/coordination\x20channel;\x20affiliation\x20registered\x20in\x20object_linker'},{'object':'Contact','field':'ims:\x20vector<Im{at,\x20status,\x20description}>','meaning':'channel\x20membership\x20with\x20per-member\x20status\x20—\x20the\x20roster\x20of\x20who\x20talks\x20about\x20THIS\x20object\x27s\x20business'}],'move_anchor':'contact.move\x20(ims\x20/\x20im_add\x20/\x20im_remove),\x20per-object\x20um_set_imp\x20/\x20um_none_imp\x20(e.g.\x20reward.move\x20L237,\x20treasury.move\x20L85)','scenario':{'from':'Business\x20scenario\x20(any\x20object\x20lifecycle)','to':'Encrypted\x20IM\x20scenario\x20(WTS\x20evidence,\x20negotiation)','merged':'Contextual\x20communication\x20(talk\x20WITH\x20evidence\x20about\x20the\x20exact\x20business)'},'capability_gained':'Every\x20business\x20object\x20can\x20grow\x20its\x20own\x20communication\x20channel:\x20pre-order\x20negotiation,\x20in-flight\x20coordination,\x20and\x20'+'dispute\x20evidence\x20collection\x20happen\x20IN\x20the\x20context\x20of\x20the\x20exact\x20object\x20they\x20concern\x20—\x20messages\x20become\x20evidence\x20'+'(WTS)\x20tied\x20to\x20the\x20on-chain\x20thing.','prerequisites':['um\x20binding\x20is\x20single\x20(one\x20Contact\x20per\x20object;\x20um_set\x20replaces\x20with\x20affiliation_change)','IM\x20membership\x20managed\x20by\x20the\x20Contact\x20owner'],'examples':['Order-level\x20channel:\x20buyer,\x20merchant,\x20and\x20the\x20assigned\x20operator\x20coordinate\x20delivery\x20in\x20the\x20order\x27s\x20um.','Arbitration\x20evidence\x20room:\x20disputants\x20and\x20arbitrators\x20exchange\x20WTS-signed\x20evidence\x20in\x20the\x20arbitration\x27s\x20um.']},{'id':'bridge.governance','name':'Governance\x20(permission\x20×\x20every\x20object)','participants':[{'object':'Permission','role':'owner/admins/entities\x20+\x20per-index\x20operation\x20rights'},{'object':'business\x20objects','role':'every\x20w::\x20object\x20(permission\x20field)'},{'object':'EntityPermission','role':'reverse\x20index:\x20entity\x20→\x20memberships'}],'bridge_fields':[{'object':'business\x20object','field':'permission:\x20address','meaning':'ALL\x20admin\x20operations\x20on\x20the\x20object\x20route\x20through\x20this\x20one\x20table\x20—\x20a\x20single\x20governance\x20backbone\x20across\x20the\x20whole\x20topology'},{'object':'Permission','field':'tables:\x20entity\x20→\x20perm\x20indices\x20(0..USER_DEFINED)','meaning':'fine-grained\x20operation\x20rights\x20per\x20entity;\x20object\x20functions\x20assert\x20their\x20own\x20index\x20(e.g.\x20reward\x20new=150)'}],'move_anchor':'permission.move\x20L465\x20(assert_permission_with_sender\x20per\x20index),\x20entity_permission.move\x20(0xaa8\x20reverse\x20index)','scenario':{'from':'Operation\x20scenario\x20(any\x20mutating\x20call)','to':'Permission\x20scenario\x20(roles\x20+\x20indices)','merged':'Delegated\x20administration\x20(staff\x20act\x20within\x20bounded\x20rights)'},'capability_gained':'Organizational\x20scale:\x20one\x20merchant\x20operates\x20hundreds\x20of\x20objects\x20through\x20shared\x20Permissions;\x20staff\x20gain\x20scoped\x20rights\x20'+'(per-operation\x20indices)\x20—\x20the\x20topology\x20stays\x20governable\x20as\x20it\x20grows,\x20and\x20EntityPermission\x20makes\x20any\x20address\x27s\x20'+'role\x20discoverable\x20(the\x20account-side\x20entry\x20into\x20the\x20topology).','prerequisites':['Caller\x20passes\x20assert_permission_with_sender\x20at\x20the\x20operation\x27s\x20index','Zero-index\x20entities\x20have\x20membership\x20but\x20no\x20operation\x20rights\x20(fact\x20preserved\x20by\x20design)'],'examples':['Customer\x20service\x20staff\x20hold\x20index\x20225\x20(progress\x20owner_receive)\x20without\x20any\x20treasury\x20rights.','A\x20merchant\x27s\x20entire\x20object\x20fleet\x20re-governed\x20by\x20swapping\x20one\x20Permission\x20(permission_set\x20+\x20affiliation_change).']},{'id':'bridge.incentive','name':'Incentive\x20(Reward\x20×\x20Guard\x20×\x20employing\x20object)','participants':[{'object':'Reward','role':'guarded\x20fund\x20pool'},{'object':'Guard','role':'claim\x20qualification\x20+\x20dynamic\x20recipient/amount'},{'object':'Service','role':'rewards:\x20vector<address>\x20—\x20marketing\x20attach\x20point'},{'object':'employee\x20entities','role':'claimants\x20(KPI-qualified)'}],'bridge_fields':[{'object':'Service','field':'rewards:\x20vector<address>\x20(max\x2020)','meaning':'marketing/incentive\x20pools\x20attached\x20to\x20the\x20offering'},{'object':'Reward','field':'RewardGuard\x20{\x20guard,\x20recipient,\x20amount,\x20expiration_time,\x20store_from_id\x20}','meaning':'claim\x20rules\x20—\x20preset\x20slots\x20read\x20payee/amount/deadline\x20from\x20guard\x20submissions\x20(see\x20guard-bindings.ts)'}],'move_anchor':'service.move\x20L193\x20(rewards),\x20reward.move\x20guard_add_imp\x20L242\x20/\x20claim\x20L147+','scenario':{'from':'Employment/operation\x20scenario\x20(work\x20done)','to':'Reward\x20scenario\x20(guarded\x20payout)','merged':'Incentive\x20alignment\x20(KPI\x20→\x20acceptance\x20→\x20reward\x20claim)'},'capability_gained':'Performance-contingent\x20compensation:\x20staff\x20claim\x20rewards\x20by\x20proving\x20work\x20(guard\x20evidence:\x20reaction\x20time,\x20node\x20'+'completion,\x20acceptance\x20records)\x20—\x20the\x20employment\x20tension\x20(fixed\x20pay\x20vs\x20outcome)\x20is\x20bridged\x20by\x20making\x20the\x20payout\x20'+'itself\x20evidence-gated.','value_flow':'Deposited\x20coins\x20→\x20balance\x20→\x20guard-gated\x20claim\x20(the\x20ONLY\x20balance\x20exit\x20—\x20R-R-7-01\x20requires\x20an\x20owner\x20escape\x20guard).','prerequisites':['Claim\x20within\x20expiration\x20window\x20(clock\x20≤\x20expiration_time)','Claim\x20amount\x20≤\x20balance;\x20recipient\x20resolved\x20by\x20the\x20guard\x20submission\x20(Entity\x20/\x20Signer\x20/\x20GuardIdentifier)'],'examples':['Staff\x20KPI\x20reward:\x20guard\x20verifies\x20node\x20reaction-time\x20submissions;\x20employee\x20claims\x20a\x20GuardU64Identifier\x20amount.','Referral\x20marketing:\x20purchasers\x20submit\x20receipt\x20proofs;\x20campaign\x20guard\x20pays\x20cashback\x20to\x20the\x20submitted\x20address.']},{'id':'bridge.evidence','name':'Evidence\x20(Proof\x20/\x20retained\x20submissions\x20×\x20Progress\x20&\x20Arb)','participants':[{'object':'Proof','role':'frozen\x20signed\x20fact\x20(WTS,\x20oracle\x20attestation)'},{'object':'Machine\x20Forward','role':'retained_submission\x20requirement'},{'object':'Progress','role':'session\x20history\x20storage'},{'object':'Arb','role':'proposition/vote\x20context'}],'bridge_fields':[{'object':'Machine\x20Forward','field':'retained_submission:\x20vector<u8>','meaning':'the\x20edge\x20cannot\x20be\x20crossed\x20without\x20submitting\x20these\x20slots\x20—\x20and\x20the\x20values\x20persist\x20into\x20the\x20session\x20history'},{'object':'Order','field':'required_info:\x20Option<address>\x20(im\x20or\x20proof)','meaning':'the\x20buyer\x20attaches\x20context\x20(IM\x20thread\x20or\x20proof\x20object)\x20the\x20merchant\x20needs\x20to\x20fulfill'}],'move_anchor':'progress.move\x20L471-474\x20(submissions_get\x20→\x20session\x20history),\x20proof.move\x20(frozen,\x20signer-anchored),\x20order.move\x20L77-80','scenario':{'from':'Execution\x20scenario\x20(workflow\x20edges)','to':'Attestation\x20scenario\x20(signed\x20facts)','merged':'Accountable\x20execution\x20(every\x20step\x20provable\x20after\x20the\x20fact)'},'capability_gained':'An\x20audit-grade\x20trail\x20for\x20INTANGIBLE\x20work:\x20what\x20the\x20operator\x20submitted\x20to\x20cross\x20each\x20edge\x20is\x20on-chain\x20forever\x20—\x20'+'later\x20disputes,\x20KPI\x20assessments,\x20and\x20reputation\x20scores\x20read\x20the\x20same\x20trail,\x20so\x20execution\x20quality\x20becomes\x20evidence.','prerequisites':['retained_submission\x20ids\x20must\x20be\x20submission\x20slots\x20of\x20the\x20forward\x27s\x20guard\x20(E_RETAINED_SUBMISSION_ERROR)','Proof\x20objects\x20are\x20immutable\x20once\x20frozen\x20(create\x20→\x20freeze_object)'],'examples':['QC\x20step\x20requires\x20a\x20signed\x20inspection\x20proof;\x20the\x20proof\x20lands\x20in\x20the\x20session\x20history\x20with\x20the\x20advancing\x20tx.','Buyer\x20attaches\x20a\x20WTS\x20message\x20thread\x20as\x20order\x20required_info;\x20the\x20merchant\x20fulfills\x20against\x20it.']},{'id':'bridge.fund_object','name':'Fund-as-Object\x20(CoinWrapper\x20×\x20owner_receive\x20×\x20any\x20object)','participants':[{'object':'Payment\x20/\x20CoinWrapper<K>','role':'value\x20wrapped\x20as\x20a\x20transferable\x20object\x20(any\x20token\x20K)'},{'object':'receiving\x20objects','role':'Reward\x20/\x20Treasury\x20/\x20Service\x20/\x20Arbitration\x20/\x20Repository\x20/\x20Contact\x20...'},{'object':'Permission\x20owner','role':'the\x20extraction\x20target'}],'bridge_fields':[{'object':'receiving\x20object','field':'receive\x20(join\x20into\x20balance)\x20vs\x20owner_receive\x20(extract\x20received\x20objects\x20to\x20Permission\x20owner)','meaning':'two\x20DIFFERENT\x20doors:\x20receive\x20turns\x20an\x20arrived\x20payment\x20into\x20claimable\x20balance;\x20owner_receive\x20forwards\x20arrived\x20objects\x20(any\x20K,\x20incl.\x20NFT-like)\x20to\x20the\x20owner\x20without\x20touching\x20balance'},{'object':'CoinWrapper','field':'payment:\x20address','meaning':'the\x20wrapper\x20remembers\x20WHICH\x20payment\x20object\x20it\x20came\x20from\x20—\x20provenance\x20survives\x20the\x20transfer'}],'move_anchor':'reward.move\x20L298-316\x20(receive\x20vs\x20owner_receive_imp),\x20treasury.move\x20L346-354,\x20payment.move\x20L40-64\x20(unwrap\x20family)','scenario':{'from':'Transfer\x20scenario\x20(objects\x20move\x20between\x20wallets/objects)','to':'Accounting\x20scenario\x20(balance\x20vs\x20custody)','merged':'Universal\x20value\x20custody\x20(any\x20asset\x20class,\x20any\x20token,\x20one\x20idiom)'},'capability_gained':'Objects\x20can\x20safely\x20RECEIVE\x20value\x20they\x20were\x20not\x20typed\x20for:\x20a\x20Reward<WOW>\x20can\x20custody\x20a\x20USDT\x20CoinWrapper\x20or\x20an\x20NFT\x20'+'via\x20owner_receive\x20—\x20cross-asset\x20custody\x20with\x20a\x20single,\x20uniform\x20extraction\x20rule\x20(to\x20the\x20Permission\x20owner).','value_flow':'CoinWrapper<K>\x20→\x20object\x20custody\x20→\x20owner_receive\x20→\x20Permission\x20owner\x20(NEVER\x20into\x20the\x20object\x27s\x20own\x20balance).','prerequisites':['owner_receive\x20requires\x20the\x20object\x27s\x20Permission\x20+\x20Receiving<K>\x20argument\x20(version+digest)','unwrap_with_check\x20asserts\x20the\x20wrapper\x27s\x20payment\x20provenance\x20(EPAYMENT_NOT_MATCH)'],'examples':['A\x20customer\x20sends\x20an\x20NFT\x20coupon\x20to\x20a\x20Service;\x20the\x20merchant\x20extracts\x20it\x20via\x20service.owner_receive.','A\x20mixed-token\x20gift\x20lands\x20on\x20a\x20Reward;\x20owner_receive\x20forwards\x20it\x20without\x20polluting\x20the\x20WOW\x20claimable\x20balance.']}];export const SCENARIO_CHAINS=[{'id':'chain.standard_ecommerce','name':'Standard\x20E-commerce','steps':[{'bridge':'bridge.qualification','note':'buy_guard\x20gates\x20who\x20may\x20purchase'},{'bridge':'bridge.purchase','note':'quote\x20+\x20discount\x20→\x20order\x20(machine\x20pre-bound)'},{'bridge':'bridge.communication','note':'um\x20channel\x20for\x20delivery\x20coordination'},{'bridge':'bridge.fulfillment','note':'progress\x20runs\x20the\x20machine;\x20evidence\x20retained\x20per\x20edge'},{'bridge':'bridge.escrow_split','note':'allocation\x20splits\x20escrow\x20to\x20suppliers\x20+\x20surplus'},{'bridge':'bridge.incentive','note':'optional:\x20staff\x20KPI\x20rewards\x20for\x20fast\x20fulfillment'}],'application_capability':'A\x20complete\x20store:\x20gated\x20checkout,\x20coordinated\x20delivery,\x20evidence-backed\x20fulfillment,\x20and\x20trustless\x20split\x20payout.','objects_touched':['Guard','Service','Discount','Order','Contact','Machine','Progress','Allocation','Payment','Reward','Permission','Passport']},{'id':'chain.procurement_tender','name':'Procurement\x20Tender','steps':[{'bridge':'bridge.supply_match','note':'demand\x20published;\x20qualified\x20services\x20present'},{'bridge':'bridge.qualification','note':'presentation\x20guards\x20filter\x20suppliers'},{'bridge':'bridge.purchase','note':'winning\x20offer\x20becomes\x20the\x20order'},{'bridge':'bridge.fulfillment','note':'multi-supplier\x20machine\x20handoffs'},{'bridge':'bridge.escrow_split','note':'allocation\x20pays\x20suppliers\x20+\x20surplus\x20to\x20demander?'},{'bridge':'bridge.dispute','note':'if\x20delivery\x20fails:\x20independent\x20arbitration\x20+\x20compensation'}],'application_capability':'A\x20full\x20tender\x20lifecycle:\x20need\x20→\x20competing\x20offers\x20→\x20award\x20→\x20delivery\x20→\x20settlement\x20with\x20credible\x20remedy.','objects_touched':['Demand','Guard','Service','Order','Machine','Progress','Allocation','Arbitration','Arb','Payment','Permission']},{'id':'chain.data_subscription','name':'Data\x20Subscription\x20Service','steps':[{'bridge':'bridge.data_service','note':'service\x20commits\x20to\x20repository\x20maintenance'},{'bridge':'bridge.qualification','note':'subscription\x20gate\x20(buy_guard)'},{'bridge':'bridge.purchase','note':'recurring\x20orders\x20or\x20one-off'},{'bridge':'bridge.escrow_split','note':'subscription\x20revenue\x20to\x20data\x20suppliers'},{'bridge':'bridge.communication','note':'um\x20for\x20data\x20requests\x20/\x20clarifications'},{'bridge':'bridge.dispute','note':'stale-data\x20compensation\x20via\x20arbitration'}],'application_capability':'Data\x20as\x20a\x20product:\x20paid,\x20guard-qualified\x20writes,\x20auditable\x20quality,\x20and\x20compensation\x20for\x20staleness.','objects_touched':['Repository','Guard','Service','Order','Allocation','Payment','Contact','Arbitration','Arb']},{'id':'chain.collaborative_operations','name':'Collaborative\x20Operations\x20(staff\x20+\x20outsourced\x20process)','steps':[{'bridge':'bridge.governance','note':'permission\x20entities\x20=\x20staff\x20with\x20scoped\x20indices'},{'bridge':'bridge.fulfillment','note':'machine\x20edges\x20operated\x20by\x20named\x20operators\x20/\x20permission\x20entities'},{'bridge':'bridge.evidence','note':'each\x20advance\x20retains\x20submissions'},{'bridge':'bridge.incentive','note':'KPI\x20guards\x20→\x20reward\x20claims'},{'bridge':'bridge.communication','note':'per-object\x20um\x20channels'}],'application_capability':'An\x20operating\x20company\x20on-chain:\x20internal\x20staff,\x20external\x20operators,\x20audited\x20execution,\x20aligned\x20pay.','objects_touched':['Permission','Machine','Progress','Guard','Reward','Contact','Proof']}];export const SCENARIO_TOPOLOGY_VERSION='1.0.0';export function getBridgeById(a){return SCENARIO_BRIDGE_REGISTRY['find'](c=>c['id']===a);}export function getBridgesByObject(a){return SCENARIO_BRIDGE_REGISTRY['filter'](c=>c['participants']['some'](d=>d['object']===a)||c['bridge_fields']['some'](d=>d['object']===a));}export function getChainById(a){return SCENARIO_CHAINS['find'](b=>b['id']===a);}export function summarizeBridge(a){const c=a['participants']['map'](d=>d['object'])['join']('\x20×\x20');return'['+a['name']+']\x20'+c+'\x20→\x20'+a['scenario']['merged']+':\x20'+a['capability_gained']['split']('.\x20')[0x0]+'.';}export function detectBridgesForObjects(a){const b=new Set(a['map'](c=>c['toLowerCase']()));return SCENARIO_BRIDGE_REGISTRY['filter'](c=>c['bridge_fields']['some'](d=>b['has'](d['object']['toLowerCase']()))&&c['participants']['filter'](d=>b['has'](d['object']['toLowerCase']()))['length']>=0x2);}
|
|
1
|
+
import{EDGE_SCHEMA_BY_ID}from'../graph/onchain/index.js';export const SCENARIO_BRIDGE_REGISTRY=[{'id':'bridge.supply_match','code':'b03','edge_refs':['demand.guard','demand.presenter'],'name':'Supply-Demand\x20Match','participants':[{'object':'Demand','role':'need\x20expression\x20(what\x20is\x20wanted)'},{'object':'Service','role':'capability\x20offering\x20(what\x20can\x20be\x20delivered)'},{'object':'Guard','role':'presentation\x20qualification\x20(who\x20may\x20present\x20what)'}],'bridge_fields':[{'object':'Demand','field':'guards:\x20vector<ServiceGuard>\x20{\x20guard,\x20service_identifier\x20}','meaning':'presenters\x20must\x20pass\x20the\x20guard;\x20service_identifier\x20resolves\x20WHICH\x20service\x20they\x20present\x20for'},{'object':'Demand','field':'present_service_with_passport(service:&Service<T>)','meaning':'a\x20Service\x20object\x20is\x20supplied\x20AT\x20the\x20presentation\x20—\x20the\x20demand\x20does\x20not\x20store\x20services;\x20suppliers\x20bring\x20them'}],'move_anchor':'demand.move\x20L124-150\x20(present_with_passport_imp:\x20result_for_guard\x20+\x20submission_get(service_identifier))','scenario':{'from':'Demand\x20scenario\x20(need\x20expression)','to':'Service\x20scenario\x20(product\x20listing)','merged':'Matchmaking\x20(discovery\x20+\x20qualification\x20+\x20choice)'},'capability_gained':'Choice\x20among\x20qualified\x20offers:\x20the\x20demander\x20compares\x20presented\x20Services\x20(acceptance_score\x20accumulates\x20per\x20presenter)\x20'+'—\x20a\x20capability\x20neither\x20a\x20bare\x20Demand\x20(no\x20offers)\x20nor\x20a\x20bare\x20Service\x20(no\x20buyer\x20context)\x20possesses.','value_flow':'No\x20funds\x20move\x20yet\x20—\x20this\x20bridge\x20prices\x20ATTENTION:\x20acceptance_score\x20on\x20the\x20presenter\x27s\x20entity\x20is\x20the\x20reputation\x20currency.','prerequisites':['Demand\x20not\x20yet\x20paused\x20(demand.move)','Presenter\x20passes\x20the\x20Demand\x27s\x20guard\x20(E_NEED_PASSPORT\x20when\x20guards\x20exist\x20and\x20no\x20passport\x20is\x20given)'],'examples':['Procurement\x20tender:\x20a\x20company\x20posts\x20a\x20Demand;\x20certified\x20suppliers\x20present\x20their\x20Services;\x20the\x20best\x20acceptance_score\x20wins\x20the\x20order.','Local\x20services\x20marketplace:\x20\x27repair\x20my\x20roof\x27\x20demand\x20meets\x20licensed\x20roofer\x20services.']},{'id':'bridge.purchase','code':'b01','edge_refs':['service.buy_guard','order.service','order.machine','order.discount','order.builder','eoa.order','service.order'],'name':'Purchase\x20(Quote\x20→\x20Order)','participants':[{'object':'Service','role':'published\x20offering\x20(sales,\x20wip,\x20price)'},{'object':'Quote','role':'buyer\x27s\x20item\x20selection\x20+\x20computed\x20total'},{'object':'Discount','role':'transferable\x20price\x20reduction\x20bound\x20to\x20the\x20service'},{'object':'Guard','role':'buy\x20qualification\x20(buy_guard)'},{'object':'Order','role':'the\x20created\x20agreement'}],'bridge_fields':[{'object':'Service','field':'buy_guard:\x20Option<address>','meaning':'who\x20may\x20buy\x20(qualification);\x20buy()\x20refuses\x20when\x20a\x20guard\x20exists\x20and\x20no\x20passport\x20proves\x20it'},{'object':'Discount','field':'service:\x20address\x20(+\x20time\x20window,\x20benchmark,\x20transferable)','meaning':'the\x20discount\x20object\x20itself\x20carries\x20WHICH\x20service\x20it\x20applies\x20to\x20—\x20it\x20travels\x20wallet-to-wallet\x20but\x20stays\x20bound\x20to\x20the\x20service'},{'object':'Order','field':'machine:\x20Option<address>\x20(copied\x20from\x20Service\x20at\x20order::new)','meaning':'the\x20fulfillment\x20workflow\x20is\x20PRE-BINDED\x20at\x20purchase\x20time\x20—\x20the\x20order\x20reserves\x20its\x20own\x20execution\x20path'}],'move_anchor':'service.move\x20L278-321\x20(buy\x20/\x20buy_with_passport\x20/\x20buy_imp\x20→\x20order::new),\x20order.move\x20L103-114','scenario':{'from':'Service\x20scenario\x20(offering)','to':'Order\x20scenario\x20(agreement\x20+\x20escrow\x20intent)','merged':'Transaction\x20(commitment\x20with\x20reserved\x20fulfillment)'},'capability_gained':'A\x20binding\x20agreement\x20that\x20reserves\x20its\x20own\x20execution\x20path:\x20the\x20Order\x20snapshot\x20copies\x20the\x20Service\x27s\x20machine\x20reference\x20'+'at\x20creation,\x20so\x20later\x20Service\x20edits\x20cannot\x20retroactively\x20change\x20how\x20THIS\x20order\x20is\x20fulfilled.','value_flow':'Amount\x20is\x20recorded\x20(order.amount)\x20but\x20coins\x20are\x20not\x20yet\x20moved\x20—\x20payment\x20happens\x20at\x20the\x20allocation\x20bridge.','prerequisites':['Service\x20published\x20(bPublished)\x20and\x20not\x20paused\x20(E_NOT_PUBLISHED\x20/\x20E_PAUSED)','Quote\x20signed\x20by\x20the\x20tx\x20digest\x20(E_INVALID_QUOTE)\x20—\x20prevents\x20quote\x20replay\x20across\x20transactions','buy_guard\x20passed\x20when\x20present\x20(E_BUY_GUARD_PASSPORT_REQUIRED)'],'examples':['Standard\x20e-commerce\x20checkout:\x20quote\x20items,\x20apply\x20a\x20transferred\x20Discount,\x20create\x20the\x20Order.','Gated\x20purchase:\x20only\x20KYC-passed\x20wallets\x20(buy_guard)\x20can\x20order\x20a\x20licensed\x20service.']},{'id':'bridge.escrow_split','code':'b05','edge_refs':['service.order_allocator_guard','order.allocation','allocation.guard','wf.forward_guard','payment.recipient','payment.from_object','payment.for_object','payment.for_guard'],'name':'Escrow\x20&\x20Split\x20(Order\x20→\x20Allocation\x20→\x20Payment)','participants':[{'object':'Service','role':'payout\x20rules\x20owner\x20(order_allocators)'},{'object':'Order','role':'escrowed\x20amount\x20+\x20single\x20allocation\x20slot'},{'object':'Allocation','role':'guard-gated\x20distributor'},{'object':'Payment','role':'the\x20actual\x20value\x20transfer\x20with\x20provenance'}],'bridge_fields':[{'object':'Service','field':'order_allocators:\x20Option<Allocators>','meaning':'who\x20may\x20run\x20the\x20split\x20and\x20under\x20which\x20guards\x20—\x20the\x20merchant\x27s\x20payout\x20policy,\x20pre-registered\x20on\x20the\x20Service'},{'object':'Order','field':'allocation:\x20Option<address>\x20(on_allocation,\x20single-shot)','meaning':'the\x20order\x20can\x20be\x20split\x20exactly\x20once\x20—\x20the\x20escrow-to-payout\x20transition\x20is\x20one-way\x20and\x20auditable'},{'object':'Payment','field':'info.for_object\x20/\x20from_object','meaning':'every\x20payout\x20carries\x20the\x20source\x20object\x20address\x20—\x20money\x20always\x20answers\x20\x27which\x20business\x20object\x20paid\x20me\x27'}],'move_anchor':'service.move\x20L291-303\x20(order_allocation:\x20E_ORDER_SERVICE_NOT_MATCH\x20→\x20allocation::new_with_coin\x20→\x20payment_info(order)),\x20allocation.move\x20L202+\x20(alloc)','scenario':{'from':'Order\x20scenario\x20(agreement\x20+\x20funds)','to':'Payment\x20scenario\x20(value\x20transfer)','merged':'Settlement\x20(escrowed\x20funds\x20split\x20by\x20declared\x20policy)'},'capability_gained':'Trustless\x20settlement:\x20the\x20buyer\x20pays\x20into\x20the\x20order\x20amount,\x20and\x20the\x20split\x20executes\x20only\x20under\x20the\x20merchant\x27s\x20'+'pre-registered\x20allocator\x20guards\x20—\x20neither\x20side\x20can\x20redirect\x20the\x20other\x27s\x20share;\x20the\x20Payment\x27s\x20from_object\x20makes\x20'+'every\x20revenue\x20line\x20item\x20auditable\x20back\x20to\x20its\x20order.','value_flow':'Buyer\x20coin\x20→\x20Allocation\x20balance\x20→\x20(guard-gated\x20alloc)\x20→\x20Payment\x20recipients\x20(Entity\x20/\x20Signer\x20/\x20GuardIdentifier).','prerequisites':['Coin\x20≥\x20order.amount\x20(E_COIN_NOT_ENOUGH),\x20excess\x20refunded\x20to\x20the\x20sender\x20in\x20the\x20same\x20tx','The\x20calling\x20Service\x20IS\x20the\x20order\x27s\x20service\x20(E_ORDER_SERVICE_NOT_MATCH)','Rate\x20shares\x20must\x20complete\x2010000\x20basis\x20points\x20unless\x20a\x20Surplus\x20entry\x20exists\x20(allocation.move\x20L173-177)'],'examples':['Multi-vendor\x20order:\x20one\x20payment\x20split\x20across\x20goods\x20supplier,\x20logistics\x20operator,\x20and\x20platform\x20surplus.','Payroll-style\x20settlement:\x20order\x20revenue\x20split\x20to\x20staff\x20entities\x20by\x20Rate\x20with\x20the\x20owner\x20taking\x20Surplus.']},{'id':'bridge.fulfillment','code':'b04','edge_refs':['service.machine','order.machine','order.progress','progress.machine','progress.task','progress.named_operator','machine.node','wf.transition','wf.forward_guard','permission.entity'],'name':'Fulfillment\x20(Order\x20×\x20Machine\x20→\x20Progress)','participants':[{'object':'Service','role':'workflow\x20owner\x20(machine\x20field)'},{'object':'Order','role':'the\x20work\x20item\x20to\x20execute'},{'object':'Machine','role':'workflow\x20template\x20(nodes\x20+\x20forwards)'},{'object':'Progress','role':'per-order\x20workflow\x20instance'},{'object':'Permission','role':'who\x20may\x20advance\x20which\x20edge'}],'bridge_fields':[{'object':'Service','field':'machine:\x20Option<address>','meaning':'the\x20workflow\x20template\x20the\x20service\x20promises\x20to\x20execute\x20—\x20locked\x20at\x20publish\x20(bPublished)'},{'object':'Progress','field':'order\x20namespace\x20+\x20order_owner_set([buyer])','meaning':'the\x20buyer\x20becomes\x20the\x20Progress\x27s\x20order-owner\x20namespace:\x20operators\x20advance\x20THEIR\x20copy,\x20the\x20buyer\x27s\x20own\x20Progress\x20view\x20aggregates'},{'object':'Machine','field':'Forward\x20{\x20namedOperator\x20|\x20permissionIndex\x20|\x20guard\x20}','meaning':'each\x20edge\x20declares\x20its\x20operator\x20—\x20internal\x20staff,\x20permission\x20entity,\x20or\x20guard-proven\x20external\x20party'}],'move_anchor':'service.move\x20L305-313\x20(order_progress:\x20E_MACHINE_NOT_MATCH\x20→\x20progress::new_imp\x20→\x20order::on_progress),\x20progress.move\x20L462+','scenario':{'from':'Order\x20scenario\x20(agreement)','to':'Machine\x20scenario\x20(process\x20template)','merged':'Execution\x20(per-order\x20workflow\x20with\x20multi-party\x20advancement)'},'capability_gained':'Coordinated\x20execution:\x20the\x20SAME\x20template\x20runs\x20independently\x20per\x20order,\x20with\x20each\x20edge\x20potentially\x20operated\x20by\x20a\x20'+'different\x20party\x20(employee\x20/\x20supplier\x20/\x20buyer)\x20under\x20permission\x20or\x20guard\x20checks\x20—\x20process\x20outsourcing\x20with\x20on-chain\x20accountability.','prerequisites':['The\x20supplied\x20machine\x20IS\x20the\x20service\x27s\x20machine\x20(E_MACHINE_NOT_MATCH)','Each\x20forward\x27s\x20weight\x20counts\x20at\x20most\x20once\x20per\x20session\x20(E_NOT_THE_HOLDER\x20on\x20re-execution)','Edge\x20guard\x20(when\x20present)\x20requires\x20submitted\x20evidence\x20—\x20retained\x20submissions\x20persist\x20into\x20the\x20session\x20history'],'examples':['Custom\x20manufacturing:\x20paid\x20→\x20machining\x20→\x20QC\x20→\x20shipped,\x20where\x20QC\x20is\x20advanced\x20by\x20an\x20independent\x20inspector\x20(namedOperator).','Multi-supplier\x20sub-orders:\x20the\x20machine\x27s\x20nodes\x20hand\x20off\x20between\x20the\x20merchant\x20and\x20subcontracted\x20suppliers.']},{'id':'bridge.dispute','code':'b06','edge_refs':['service.permission','service.arbitration','arbitration.permission','arbitration.voting_guard','arbitration.usage_guard','order.dispute','order.claimed_by','arb.order','arb.arbitration_service','arb.voter'],'name':'Dispute\x20&\x20Compensation\x20(Service\x20×\x20Arbitration\x20×\x20Order\x20→\x20Arb)','participants':[{'object':'Service','role':'pre-registered\x20arbitrations\x20+\x20compensation\x20fund'},{'object':'Arbitration','role':'voting\x20rules\x20+\x20usage\x20gate'},{'object':'Order','role':'the\x20disputed\x20agreement\x20(single\x20claim)'},{'object':'Arb','role':'the\x20case\x20(7-state\x20lifecycle)'}],'bridge_fields':[{'object':'Service','field':'arbitrations:\x20vector<address>\x20+\x20compensation_fund:\x20Balance<T>','meaning':'the\x20merchant\x20pre-commits\x20BOTH\x20who\x20judges\x20(independent\x20permission)\x20AND\x20the\x20money\x20that\x20backs\x20the\x20verdict'},{'object':'Service','field':'arbitration_add_imp\x20fairness\x20check','meaning':'E_ARBITRATION_PERMISSION_CONFLICT:\x20an\x20Arbitration\x20sharing\x20the\x20Service\x27s\x20own\x20Permission\x20is\x20REJECTED\x20—\x20fairness\x20is\x20enforced\x20as\x20a\x20RELATIONAL\x20constraint,\x20not\x20a\x20promise'},{'object':'Order','field':'dispute:\x20vector<address>\x20+\x20claimed_by:\x20Option<address>','meaning':'disputes\x20append\x20to\x20the\x20order;\x20compensation\x20claims\x20it\x20exactly\x20once\x20(E_ORDER_ALREADY_CLAIMED)\x20—\x20the\x20payout\x20is\x20single-shot\x20by\x20construction'}],'move_anchor':'arbitration.move\x20L264-276\x20(dispute\x20/\x20dispute_with_passport),\x20service.move\x20L336+\x20(compensation_claim),\x20arb.move\x20(7-state\x20lifecycle)','scenario':{'from':'Fulfillment\x20scenario\x20(execution\x20with\x20possible\x20disagreement)','to':'Arbitration\x20scenario\x20(independent\x20judgment)','merged':'Remedy\x20(wrong\x20execution\x20→\x20compensated\x20loss)'},'capability_gained':'Credible\x20remedy:\x20the\x20loser\x20of\x20a\x20bad\x20transaction\x20is\x20made\x20whole\x20from\x20a\x20fund\x20the\x20merchant\x20could\x20not\x20pre-empty,\x20'+'judged\x20by\x20parties\x20the\x20merchant\x20cannot\x20appoint\x20unilaterally\x20—\x20trustlessness\x20expressed\x20as\x20a\x20field-level\x20topology\x20constraint.','value_flow':'compensation_fund\x20(Service)\x20→\x20indemnity\x20(Arb)\x20→\x20compensation\x20claim\x20to\x20the\x20winning\x20party\x20(single\x20claim\x20per\x20order).','prerequisites':['Disputant\x20passes\x20the\x20Arbitration\x27s\x20usage_guard\x20when\x20set\x20(E_NEED_PASSPORT)','Voters\x20pass\x20voting\x20guards;\x20vote\x20weight\x20from\x20FixedValue\x20or\x20GuardIdentifier\x20submission','Voting\x20deadline\x20elapsed\x20before\x20finish;\x20objection\x20windows\x20respected\x20(arb.move\x20state\x20machine)'],'examples':['Delivery\x20dispute:\x20buyer\x20proves\x20non-delivery\x20via\x20WTS\x20evidence;\x20independent\x20arbitrators\x20vote;\x20compensation\x20pays\x20from\x20the\x20fund.','SLA\x20breach:\x20machine\x20timestamps\x20prove\x20late\x20delivery;\x20weighted\x20voters\x20set\x20the\x20indemnity.']},{'id':'bridge.data_service','code':'b02','edge_refs':['service.repository','repository.permission','repository.policy_guard'],'name':'Data\x20Service\x20(Service\x20×\x20Repository)','participants':[{'object':'Service','role':'the\x20offering\x20that\x20includes\x20data\x20deliverables'},{'object':'Repository','role':'on-chain\x20database\x20(policies,\x20rows)'},{'object':'Guard','role':'write/quote\x20qualification\x20per\x20policy'}],'bridge_fields':[{'object':'Service','field':'repositories:\x20vector<address>\x20(max\x20100)','meaning':'databases\x20the\x20service\x20commits\x20to\x20maintain\x20—\x20the\x20deliverable\x20IS\x20the\x20data'},{'object':'Repository','field':'PolicyGuard\x20{\x20id_from_submission,\x20data_from_submission\x20}','meaning':'writes\x20are\x20guard-qualified:\x20WHO\x20(row\x20key)\x20may\x20write\x20WHAT\x20(the\x20submitted\x20data\x20itself)'}],'move_anchor':'service.move\x20L182\x20(repositories\x20field),\x20repository.move\x20L83-103\x20(policy_guard)\x20/\x20L346+\x20(guarded\x20writes)','scenario':{'from':'Service\x20scenario\x20(offering)','to':'Repository\x20scenario\x20(on-chain\x20database)','merged':'Data\x20products\x20(paid,\x20qualified,\x20auditable\x20data\x20maintenance)'},'capability_gained':'Verifiable\x20data\x20work:\x20a\x20subscription\x20where\x20the\x20provider\x27s\x20every\x20write\x20is\x20qualified\x20by\x20guards\x20and\x20attributable\x20to\x20'+'the\x20paid\x20service\x20—\x20data\x20quality\x20becomes\x20an\x20enforceable\x20contract\x20term,\x20not\x20a\x20promise.','prerequisites':['Writer\x20passes\x20the\x20policy\x27s\x20write\x20guards','Row\x20key\x20resolves\x20via\x20id_from_submission\x20(or\x20PolicyRule.id_from\x20static\x20override)'],'examples':['Market-data\x20feed\x20service:\x20subscribers\x20pay;\x20the\x20provider\x20writes\x20rows\x20under\x20a\x20write\x20guard\x20proving\x20oracle\x20provenance.','Review\x20platform:\x20reviewers\x20pass\x20reputation\x20guards;\x20their\x20submissions\x20become\x20the\x20product\x20others\x20pay\x20to\x20read\x20(quote_guard).']},{'id':'bridge.qualification','code':'b10','edge_refs':['service.buy_guard','demand.guard','arbitration.voting_guard','arbitration.usage_guard','wf.forward_guard','repository.policy_guard','treasury.external_guard','guard.relies','passport.guard'],'name':'Qualification\x20(Guard\x20×\x20every\x20gated\x20scenario)','participants':[{'object':'Guard','role':'the\x20proof\x20machine'},{'object':'Passport','role':'per-tx\x20proof\x20carrier'},{'object':'gated\x20objects','role':'Service(buy)\x20/\x20Demand(present)\x20/\x20Arbitration(vote,\x20dispute)\x20/\x20Machine(forward)\x20/\x20Repository(write)\x20/\x20Treasury(external\x20flows)'}],'bridge_fields':[{'object':'gated\x20object','field':'*_guard\x20/\x20guards\x20fields\x20(buy_guard,\x20usage_guard,\x20voting_guard,\x20forward\x20guard,\x20policy\x20write\x20guards,\x20external\x20guards)','meaning':'the\x20object\x20declares\x20WHICH\x20guard\x20governs\x20its\x20gate\x20—\x20preset\x20slots\x20(guard-bindings.ts)\x20define\x20what\x20the\x20guard\x27s\x20submissions\x20MEAN\x20for\x20that\x20object'}],'move_anchor':'passport.move\x20(result_for_guard\x20/\x20submission_get),\x20guard.rs\x20(native\x20DSL:\x20Signer/Clock/Query\x20×\x20logic\x20tree)','scenario':{'from':'Proof\x20scenario\x20(evidence\x20+\x20verification)','to':'any\x20gated\x20business\x20scenario','merged':'Programmable\x20trust\x20(rules-as-code\x20participation)'},'capability_gained':'Unforgeable\x20participation\x20rules:\x20KYC,\x20stake,\x20membership,\x20time\x20windows,\x20oracle\x20facts\x20—\x20expressed\x20once\x20in\x20a\x20Guard\x20and\x20'+'reused\x20across\x20every\x20gate\x20that\x20binds\x20it;\x20the\x20same\x20guard\x20can\x20gate\x20buying,\x20presenting,\x20voting,\x20and\x20writing\x20consistently.','prerequisites':['Guard\x20DSL\x20type\x20compatibility\x20(e.g.\x20RewardIdentifier\x20needs\x20address-typed\x20submissions)','Passport\x20carries\x20the\x20guard\x27s\x20required\x20submissions\x20in\x20the\x20same\x20tx'],'examples':['One\x20KYC\x20guard\x20reused\x20by\x20five\x20services\x27\x20buy_gates\x20—\x20one\x20proof,\x20five\x20doors.','Stake-weighted\x20voting\x20guard:\x20the\x20same\x20guard\x20governs\x20both\x20arbitration\x20ballots\x20and\x20treasury\x20withdrawals.']},{'id':'bridge.communication','code':'b11','edge_refs':['service.um','machine.um','demand.um','arbitration.um','reward.um','contact.permission','eoa.contact'],'name':'Communication\x20(um:\x20Contact\x20×\x20every\x20business\x20object)','participants':[{'object':'Contact','role':'bound\x20IM\x20channel\x20(ims\x20members)'},{'object':'business\x20objects','role':'Service\x20/\x20Order\x20context\x20/\x20Demand\x20/\x20Arbitration\x20/\x20Treasury\x20/\x20Reward\x20/\x20Repository\x20/\x20Machine'}],'bridge_fields':[{'object':'business\x20object','field':'um:\x20Option<address>','meaning':'each\x20object\x20can\x20bind\x20ONE\x20Contact\x20—\x20its\x20dedicated\x20negotiation/coordination\x20channel;\x20affiliation\x20registered\x20in\x20object_linker'},{'object':'Contact','field':'ims:\x20vector<Im{at,\x20status,\x20description}>','meaning':'channel\x20membership\x20with\x20per-member\x20status\x20—\x20the\x20roster\x20of\x20who\x20talks\x20about\x20THIS\x20object\x27s\x20business'}],'move_anchor':'contact.move\x20(ims\x20/\x20im_add\x20/\x20im_remove),\x20per-object\x20um_set_imp\x20/\x20um_none_imp\x20(e.g.\x20reward.move\x20L237,\x20treasury.move\x20L85)','scenario':{'from':'Business\x20scenario\x20(any\x20object\x20lifecycle)','to':'Encrypted\x20IM\x20scenario\x20(WTS\x20evidence,\x20negotiation)','merged':'Contextual\x20communication\x20(talk\x20WITH\x20evidence\x20about\x20the\x20exact\x20business)'},'capability_gained':'Every\x20business\x20object\x20can\x20grow\x20its\x20own\x20communication\x20channel:\x20pre-order\x20negotiation,\x20in-flight\x20coordination,\x20and\x20'+'dispute\x20evidence\x20collection\x20happen\x20IN\x20the\x20context\x20of\x20the\x20exact\x20object\x20they\x20concern\x20—\x20messages\x20become\x20evidence\x20'+'(WTS)\x20tied\x20to\x20the\x20on-chain\x20thing.','prerequisites':['um\x20binding\x20is\x20single\x20(one\x20Contact\x20per\x20object;\x20um_set\x20replaces\x20with\x20affiliation_change)','IM\x20membership\x20managed\x20by\x20the\x20Contact\x20owner'],'examples':['Order-level\x20channel:\x20buyer,\x20merchant,\x20and\x20the\x20assigned\x20operator\x20coordinate\x20delivery\x20in\x20the\x20order\x27s\x20um.','Arbitration\x20evidence\x20room:\x20disputants\x20and\x20arbitrators\x20exchange\x20WTS-signed\x20evidence\x20in\x20the\x20arbitration\x27s\x20um.']},{'id':'bridge.governance','code':'b09','edge_refs':['service.permission','arbitration.permission','demand.permission','machine.permission','reward.permission','repository.permission','contact.permission','treasury.permission','permission.admin','permission.entity','eoa.permission','permission.core_binding','permission.tx_binding'],'name':'Governance\x20(permission\x20×\x20every\x20object)','participants':[{'object':'Permission','role':'owner/admins/entities\x20+\x20per-index\x20operation\x20rights'},{'object':'business\x20objects','role':'every\x20w::\x20object\x20(permission\x20field)'},{'object':'EntityPermission','role':'reverse\x20index:\x20entity\x20→\x20memberships'}],'bridge_fields':[{'object':'business\x20object','field':'permission:\x20address','meaning':'ALL\x20admin\x20operations\x20on\x20the\x20object\x20route\x20through\x20this\x20one\x20table\x20—\x20a\x20single\x20governance\x20backbone\x20across\x20the\x20whole\x20topology'},{'object':'Permission','field':'tables:\x20entity\x20→\x20perm\x20indices\x20(0..USER_DEFINED)','meaning':'fine-grained\x20operation\x20rights\x20per\x20entity;\x20object\x20functions\x20assert\x20their\x20own\x20index\x20(e.g.\x20reward\x20new=150)'}],'move_anchor':'permission.move\x20L465\x20(assert_permission_with_sender\x20per\x20index),\x20entity_permission.move\x20(0xaa8\x20reverse\x20index)','scenario':{'from':'Operation\x20scenario\x20(any\x20mutating\x20call)','to':'Permission\x20scenario\x20(roles\x20+\x20indices)','merged':'Delegated\x20administration\x20(staff\x20act\x20within\x20bounded\x20rights)'},'capability_gained':'Organizational\x20scale:\x20one\x20merchant\x20operates\x20hundreds\x20of\x20objects\x20through\x20shared\x20Permissions;\x20staff\x20gain\x20scoped\x20rights\x20'+'(per-operation\x20indices)\x20—\x20the\x20topology\x20stays\x20governable\x20as\x20it\x20grows,\x20and\x20EntityPermission\x20makes\x20any\x20address\x27s\x20'+'role\x20discoverable\x20(the\x20account-side\x20entry\x20into\x20the\x20topology).','prerequisites':['Caller\x20passes\x20assert_permission_with_sender\x20at\x20the\x20operation\x27s\x20index','Zero-index\x20entities\x20have\x20membership\x20but\x20no\x20operation\x20rights\x20(fact\x20preserved\x20by\x20design)'],'examples':['Customer\x20service\x20staff\x20hold\x20index\x20225\x20(progress\x20owner_receive)\x20without\x20any\x20treasury\x20rights.','A\x20merchant\x27s\x20entire\x20object\x20fleet\x20re-governed\x20by\x20swapping\x20one\x20Permission\x20(permission_set\x20+\x20affiliation_change).']},{'id':'bridge.incentive','code':'b07','edge_refs':['service.reward','demand.reward','repository.reward','reward.guard'],'name':'Incentive\x20(Reward\x20×\x20Guard\x20×\x20employing\x20object)','participants':[{'object':'Reward','role':'guarded\x20fund\x20pool'},{'object':'Guard','role':'claim\x20qualification\x20+\x20dynamic\x20recipient/amount'},{'object':'Service','role':'rewards:\x20vector<address>\x20—\x20marketing\x20attach\x20point'},{'object':'employee\x20entities','role':'claimants\x20(KPI-qualified)'}],'bridge_fields':[{'object':'Service','field':'rewards:\x20vector<address>\x20(max\x2020)','meaning':'marketing/incentive\x20pools\x20attached\x20to\x20the\x20offering'},{'object':'Reward','field':'RewardGuard\x20{\x20guard,\x20recipient,\x20amount,\x20expiration_time,\x20store_from_id\x20}','meaning':'claim\x20rules\x20—\x20preset\x20slots\x20read\x20payee/amount/deadline\x20from\x20guard\x20submissions\x20(see\x20guard-bindings.ts)'}],'move_anchor':'service.move\x20L193\x20(rewards),\x20reward.move\x20guard_add_imp\x20L242\x20/\x20claim\x20L147+','scenario':{'from':'Employment/operation\x20scenario\x20(work\x20done)','to':'Reward\x20scenario\x20(guarded\x20payout)','merged':'Incentive\x20alignment\x20(KPI\x20→\x20acceptance\x20→\x20reward\x20claim)'},'capability_gained':'Performance-contingent\x20compensation:\x20staff\x20claim\x20rewards\x20by\x20proving\x20work\x20(guard\x20evidence:\x20reaction\x20time,\x20node\x20'+'completion,\x20acceptance\x20records)\x20—\x20the\x20employment\x20tension\x20(fixed\x20pay\x20vs\x20outcome)\x20is\x20bridged\x20by\x20making\x20the\x20payout\x20'+'itself\x20evidence-gated.','value_flow':'Deposited\x20coins\x20→\x20balance\x20→\x20guard-gated\x20claim\x20(the\x20ONLY\x20balance\x20exit\x20—\x20R-R-7-01\x20requires\x20an\x20owner\x20escape\x20guard).','prerequisites':['Claim\x20within\x20expiration\x20window\x20(clock\x20≤\x20expiration_time)','Claim\x20amount\x20≤\x20balance;\x20recipient\x20resolved\x20by\x20the\x20guard\x20submission\x20(Entity\x20/\x20Signer\x20/\x20GuardIdentifier)'],'examples':['Staff\x20KPI\x20reward:\x20guard\x20verifies\x20node\x20reaction-time\x20submissions;\x20employee\x20claims\x20a\x20GuardU64Identifier\x20amount.','Referral\x20marketing:\x20purchasers\x20submit\x20receipt\x20proofs;\x20campaign\x20guard\x20pays\x20cashback\x20to\x20the\x20submitted\x20address.']},{'id':'bridge.evidence','code':'b12','edge_refs':['wf.forward_guard','passport.signer','passport.guard','proof.signer','proof.about'],'name':'Evidence\x20(Proof\x20/\x20retained\x20submissions\x20×\x20Progress\x20&\x20Arb)','participants':[{'object':'Proof','role':'frozen\x20signed\x20fact\x20(WTS,\x20oracle\x20attestation)'},{'object':'Machine\x20Forward','role':'retained_submission\x20requirement'},{'object':'Progress','role':'session\x20history\x20storage'},{'object':'Arb','role':'proposition/vote\x20context'}],'bridge_fields':[{'object':'Machine\x20Forward','field':'retained_submission:\x20vector<u8>','meaning':'the\x20edge\x20cannot\x20be\x20crossed\x20without\x20submitting\x20these\x20slots\x20—\x20and\x20the\x20values\x20persist\x20into\x20the\x20session\x20history'},{'object':'Order','field':'required_info:\x20Option<address>\x20(im\x20or\x20proof)','meaning':'the\x20buyer\x20attaches\x20context\x20(IM\x20thread\x20or\x20proof\x20object)\x20the\x20merchant\x20needs\x20to\x20fulfill'}],'move_anchor':'progress.move\x20L471-474\x20(submissions_get\x20→\x20session\x20history),\x20proof.move\x20(frozen,\x20signer-anchored),\x20order.move\x20L77-80','scenario':{'from':'Execution\x20scenario\x20(workflow\x20edges)','to':'Attestation\x20scenario\x20(signed\x20facts)','merged':'Accountable\x20execution\x20(every\x20step\x20provable\x20after\x20the\x20fact)'},'capability_gained':'An\x20audit-grade\x20trail\x20for\x20INTANGIBLE\x20work:\x20what\x20the\x20operator\x20submitted\x20to\x20cross\x20each\x20edge\x20is\x20on-chain\x20forever\x20—\x20'+'later\x20disputes,\x20KPI\x20assessments,\x20and\x20reputation\x20scores\x20read\x20the\x20same\x20trail,\x20so\x20execution\x20quality\x20becomes\x20evidence.','prerequisites':['retained_submission\x20ids\x20must\x20be\x20submission\x20slots\x20of\x20the\x20forward\x27s\x20guard\x20(E_RETAINED_SUBMISSION_ERROR)','Proof\x20objects\x20are\x20immutable\x20once\x20frozen\x20(create\x20→\x20freeze_object)'],'examples':['QC\x20step\x20requires\x20a\x20signed\x20inspection\x20proof;\x20the\x20proof\x20lands\x20in\x20the\x20session\x20history\x20with\x20the\x20advancing\x20tx.','Buyer\x20attaches\x20a\x20WTS\x20message\x20thread\x20as\x20order\x20required_info;\x20the\x20merchant\x20fulfills\x20against\x20it.']},{'id':'bridge.fund_object','code':'b08','edge_refs':['payment.recipient','payment.from_object','payment.for_object'],'name':'Fund-as-Object\x20(CoinWrapper\x20×\x20owner_receive\x20×\x20any\x20object)','participants':[{'object':'Payment\x20/\x20CoinWrapper<K>','role':'value\x20wrapped\x20as\x20a\x20transferable\x20object\x20(any\x20token\x20K)'},{'object':'receiving\x20objects','role':'Reward\x20/\x20Treasury\x20/\x20Service\x20/\x20Arbitration\x20/\x20Repository\x20/\x20Contact\x20...'},{'object':'Permission\x20owner','role':'the\x20extraction\x20target'}],'bridge_fields':[{'object':'receiving\x20object','field':'receive\x20(join\x20into\x20balance)\x20vs\x20owner_receive\x20(extract\x20received\x20objects\x20to\x20Permission\x20owner)','meaning':'two\x20DIFFERENT\x20doors:\x20receive\x20turns\x20an\x20arrived\x20payment\x20into\x20claimable\x20balance;\x20owner_receive\x20forwards\x20arrived\x20objects\x20(any\x20K,\x20incl.\x20NFT-like)\x20to\x20the\x20owner\x20without\x20touching\x20balance'},{'object':'CoinWrapper','field':'payment:\x20address','meaning':'the\x20wrapper\x20remembers\x20WHICH\x20payment\x20object\x20it\x20came\x20from\x20—\x20provenance\x20survives\x20the\x20transfer'}],'move_anchor':'reward.move\x20L298-316\x20(receive\x20vs\x20owner_receive_imp),\x20treasury.move\x20L346-354,\x20payment.move\x20L40-64\x20(unwrap\x20family)','scenario':{'from':'Transfer\x20scenario\x20(objects\x20move\x20between\x20wallets/objects)','to':'Accounting\x20scenario\x20(balance\x20vs\x20custody)','merged':'Universal\x20value\x20custody\x20(any\x20asset\x20class,\x20any\x20token,\x20one\x20idiom)'},'capability_gained':'Objects\x20can\x20safely\x20RECEIVE\x20value\x20they\x20were\x20not\x20typed\x20for:\x20a\x20Reward<WOW>\x20can\x20custody\x20a\x20USDT\x20CoinWrapper\x20or\x20an\x20NFT\x20'+'via\x20owner_receive\x20—\x20cross-asset\x20custody\x20with\x20a\x20single,\x20uniform\x20extraction\x20rule\x20(to\x20the\x20Permission\x20owner).','value_flow':'CoinWrapper<K>\x20→\x20object\x20custody\x20→\x20owner_receive\x20→\x20Permission\x20owner\x20(NEVER\x20into\x20the\x20object\x27s\x20own\x20balance).','prerequisites':['owner_receive\x20requires\x20the\x20object\x27s\x20Permission\x20+\x20Receiving<K>\x20argument\x20(version+digest)','unwrap_with_check\x20asserts\x20the\x20wrapper\x27s\x20payment\x20provenance\x20(EPAYMENT_NOT_MATCH)'],'examples':['A\x20customer\x20sends\x20an\x20NFT\x20coupon\x20to\x20a\x20Service;\x20the\x20merchant\x20extracts\x20it\x20via\x20service.owner_receive.','A\x20mixed-token\x20gift\x20lands\x20on\x20a\x20Reward;\x20owner_receive\x20forwards\x20it\x20without\x20polluting\x20the\x20WOW\x20claimable\x20balance.']}];for(const bridge of SCENARIO_BRIDGE_REGISTRY){for(const ref of bridge['edge_refs']){if(!EDGE_SCHEMA_BY_ID['has'](ref))throw new Error('scenario-topology:\x20bridge\x20'+bridge['id']+'\x20edge_ref\x20\x22'+ref+'\x22\x20is\x20not\x20a\x20registered\x20EdgeSchema\x20id');}}export const SCENARIO_CHAINS=[{'id':'chain.standard_ecommerce','name':'Standard\x20E-commerce','steps':[{'bridge':'bridge.qualification','note':'buy_guard\x20gates\x20who\x20may\x20purchase'},{'bridge':'bridge.purchase','note':'quote\x20+\x20discount\x20→\x20order\x20(machine\x20pre-bound)'},{'bridge':'bridge.communication','note':'um\x20channel\x20for\x20delivery\x20coordination'},{'bridge':'bridge.fulfillment','note':'progress\x20runs\x20the\x20machine;\x20evidence\x20retained\x20per\x20edge'},{'bridge':'bridge.escrow_split','note':'allocation\x20splits\x20escrow\x20to\x20suppliers\x20+\x20surplus'},{'bridge':'bridge.incentive','note':'optional:\x20staff\x20KPI\x20rewards\x20for\x20fast\x20fulfillment'}],'application_capability':'A\x20complete\x20store:\x20gated\x20checkout,\x20coordinated\x20delivery,\x20evidence-backed\x20fulfillment,\x20and\x20trustless\x20split\x20payout.','objects_touched':['Guard','Service','Discount','Order','Contact','Machine','Progress','Allocation','Payment','Reward','Permission','Passport']},{'id':'chain.procurement_tender','name':'Procurement\x20Tender','steps':[{'bridge':'bridge.supply_match','note':'demand\x20published;\x20qualified\x20services\x20present'},{'bridge':'bridge.qualification','note':'presentation\x20guards\x20filter\x20suppliers'},{'bridge':'bridge.purchase','note':'winning\x20offer\x20becomes\x20the\x20order'},{'bridge':'bridge.fulfillment','note':'multi-supplier\x20machine\x20handoffs'},{'bridge':'bridge.escrow_split','note':'allocation\x20pays\x20suppliers\x20+\x20surplus\x20to\x20demander?'},{'bridge':'bridge.dispute','note':'if\x20delivery\x20fails:\x20independent\x20arbitration\x20+\x20compensation'}],'application_capability':'A\x20full\x20tender\x20lifecycle:\x20need\x20→\x20competing\x20offers\x20→\x20award\x20→\x20delivery\x20→\x20settlement\x20with\x20credible\x20remedy.','objects_touched':['Demand','Guard','Service','Order','Machine','Progress','Allocation','Arbitration','Arb','Payment','Permission']},{'id':'chain.data_subscription','name':'Data\x20Subscription\x20Service','steps':[{'bridge':'bridge.data_service','note':'service\x20commits\x20to\x20repository\x20maintenance'},{'bridge':'bridge.qualification','note':'subscription\x20gate\x20(buy_guard)'},{'bridge':'bridge.purchase','note':'recurring\x20orders\x20or\x20one-off'},{'bridge':'bridge.escrow_split','note':'subscription\x20revenue\x20to\x20data\x20suppliers'},{'bridge':'bridge.communication','note':'um\x20for\x20data\x20requests\x20/\x20clarifications'},{'bridge':'bridge.dispute','note':'stale-data\x20compensation\x20via\x20arbitration'}],'application_capability':'Data\x20as\x20a\x20product:\x20paid,\x20guard-qualified\x20writes,\x20auditable\x20quality,\x20and\x20compensation\x20for\x20staleness.','objects_touched':['Repository','Guard','Service','Order','Allocation','Payment','Contact','Arbitration','Arb']},{'id':'chain.collaborative_operations','name':'Collaborative\x20Operations\x20(staff\x20+\x20outsourced\x20process)','steps':[{'bridge':'bridge.governance','note':'permission\x20entities\x20=\x20staff\x20with\x20scoped\x20indices'},{'bridge':'bridge.fulfillment','note':'machine\x20edges\x20operated\x20by\x20named\x20operators\x20/\x20permission\x20entities'},{'bridge':'bridge.evidence','note':'each\x20advance\x20retains\x20submissions'},{'bridge':'bridge.incentive','note':'KPI\x20guards\x20→\x20reward\x20claims'},{'bridge':'bridge.communication','note':'per-object\x20um\x20channels'}],'application_capability':'An\x20operating\x20company\x20on-chain:\x20internal\x20staff,\x20external\x20operators,\x20audited\x20execution,\x20aligned\x20pay.','objects_touched':['Permission','Machine','Progress','Guard','Reward','Contact','Proof']}];export const SCENARIO_TOPOLOGY_VERSION='1.1.0';export function getBridgeById(a){return SCENARIO_BRIDGE_REGISTRY['find'](c=>c['id']===a);}export function getBridgeByCode(a){return SCENARIO_BRIDGE_REGISTRY['find'](c=>c['code']===a);}export function getBridgesByObject(a){return SCENARIO_BRIDGE_REGISTRY['filter'](c=>c['participants']['some'](d=>d['object']===a)||c['bridge_fields']['some'](d=>d['object']===a));}export function getBridgesForEdge(a){return SCENARIO_BRIDGE_REGISTRY['filter'](c=>c['edge_refs']['includes'](a));}export function detectBridgesForEdges(a){const b=new Set(a);return SCENARIO_BRIDGE_REGISTRY['filter'](c=>c['edge_refs']['some'](d=>b['has'](d)));}export function getChainById(a){return SCENARIO_CHAINS['find'](b=>b['id']===a);}export function summarizeBridge(a){const c=a['participants']['map'](d=>d['object'])['join']('\x20×\x20');return'['+a['name']+']\x20'+c+'\x20→\x20'+a['scenario']['merged']+':\x20'+a['capability_gained']['split']('.\x20')[0x0]+'.';}export function detectBridgesForObjects(a){const b=new Set(a['map'](c=>c['toLowerCase']()));return SCENARIO_BRIDGE_REGISTRY['filter'](c=>c['bridge_fields']['some'](d=>b['has'](d['object']['toLowerCase']()))&&c['participants']['filter'](d=>b['has'](d['object']['toLowerCase']()))['length']>=0x2);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SERVICE_PERMISSIONS=[{'index':0x12c,'name':'SERVICE_NEW','description':'Create\x20new\x20Service','governed_operation':'service::new','post_publish_mutability':'na'},{'index':0x12d,'name':'SERVICE_DESCRIPTION','description':'Modify\x20Service\x20description','governed_operation':'service::description_set','post_publish_mutability':'mutable'},{'index':0x12f,'name':'SERVICE_LOCATION','description':'Set\x20Service\x20location/URL','governed_operation':'service::location_set','post_publish_mutability':'mutable'},{'index':0x130,'name':'SERVICE_REPOSITORY','description':'Add/remove\x20Repository\x20references','governed_operation':'service::repository_add/remove/clear','post_publish_mutability':'mutable'},{'index':0x131,'name':'SERVICE_SALES','description':'Add/set/remove/clear\x20sales\x20items','governed_operation':'service::sales_add/set/remove/clear','post_publish_mutability':'mutable'},{'index':0x132,'name':'SERVICE_MACHINE','description':'Bind/unbind\x20Machine\x20workflow\x20template','governed_operation':'service::machine_set/machine_none','post_publish_mutability':'immutable'},{'index':0x133,'name':'SERVICE_BUY_GUARD','description':'Set/clear\x20buy\x20Guard\x20(post-publish\x20mutable)','governed_operation':'service::buy_guard_set/buy_guard_none','post_publish_mutability':'mutable'},{'index':0x134,'name':'SERVICE_ARBITRATION','description':'Add/remove\x20Arbitration\x20references','governed_operation':'service::arbitration_add/remove/clear','post_publish_mutability':'immutable'},{'index':0x135,'name':'SERVICE_CUSTOMER_INFO_REQUIRED','description':'Set\x20customer\x20required\x20info\x20fields','governed_operation':'service::customer_required_set','post_publish_mutability':'mutable'},{'index':0x136,'name':'SERVICE_PAUSE','description':'Pause/resume\x20Service\x20(block\x20new\x20orders)','governed_operation':'service::pause','post_publish_mutability':'mutable'},{'index':0x137,'name':'SERVICE_PUBLISH','description':'Publish\x20Service\x20(IRREVERSIBLE)','governed_operation':'service::publish','post_publish_mutability':'one_shot'},{'index':0x138,'name':'SERVICE_DISCOUNT','description':'Issue/discount_destroy\x20discount\x20coupons','governed_operation':'service::discount','post_publish_mutability':'mutable'},{'index':0x139,'name':'SERVICE_ORDER_ALLOCATOR','description':'Set\x20order\x20allocator\x20strategy','governed_operation':'service::order_allocators_set','post_publish_mutability':'immutable'},{'index':0x13a,'name':'SERVICE_COMPENSATION_FUND_WITHDRAW','description':'Withdraw\x20compensation\x20fund\x20(time-locked)','governed_operation':'service::compensation_fund_withdraw','post_publish_mutability':'locked_by_duration'},{'index':0x13b,'name':'SERVICE_COMPENSATION_FUND_DEPOSIT','description':'Deposit\x20to\x20compensation\x20fund','governed_operation':'service::compensation_fund_add','post_publish_mutability':'mutable'},{'index':0x13c,'name':'SERVICE_COMPENSATION_FUND_RECEIVE','description':'Receive\x20compensation\x20fund\x20(arbitration\x20payout)','governed_operation':'service::compensation_fund_receive','post_publish_mutability':'mutable'},{'index':0x13d,'name':'SERVICE_COMPENSATION_LOCK_DURATION_ADD','description':'Extend\x20setting_lock_duration\x20(only-increase)','governed_operation':'service::setting_lock_duration_add','post_publish_mutability':'mutable'},{'index':0x13e,'name':'SERVICE_REWARD','description':'Add/remove\x20Reward\x20references\x20(remove/clear\x20time-locked)','governed_operation':'service::reward_add/remove/clear','post_publish_mutability':'locked_by_duration'},{'index':0x13f,'name':'SERVICE_OWNER_RECEIVE','description':'Receive\x20Payment/objects\x20to\x20owner','governed_operation':'service::owner_receive','post_publish_mutability':'mutable'},{'index':0x140,'name':'SERVICE_UM','description':'Bind/unbind\x20Contact\x20as\x20UM','governed_operation':'service::um_set/um_none','post_publish_mutability':'mutable'}];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':['quote_imp()\x20computes\x20total\x20price\x20(with\x20discount\x20if\x20applicable)','⚠️\x20Stock\x20is\x20deducted\x20(split)\x20—\x20side\x20effect\x20is\x20NOT\x20auto-rolled-back\x20on\x20later\x20failure','service::quote\x20or\x20service::quote_with_discount\x20MoveCall'],'always_executed':!![]},{'stage':0x4,'name':'create_order','preconditions':['Quote\x20object\x20from\x20stage\x203','Registrar\x20+\x20Clock\x20objects\x20available'],'side_effects':['service::buy\x20or\x20service::buy_with_passport\x20MoveCall','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':['service::order_allocation\x20MoveCall','Allocation\x20object\x20created\x20(first-match-wins\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':['service::order_progress\x20MoveCall','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':['agent_set\x20(if\x20order_new.agents\x20provided)','order_required_info_update\x20(if\x20order_required_info\x20provided)','owner_change\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set','customer_required_set'],'permission_index_operations':['service::publish\x20(311)','service::pause\x20(310)','service::sales_add/set/remove/clear\x20(305)','service::order_allocators_set\x20(313)','service::buy_guard_set\x20(307)','service::discount\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set'],'permission_index_operations':['service::publish\x20(311)','service::sales_add/set\x20(305)','service::machine_set\x20(306)\x20—\x20for\x20rental\x20workflow','service::arbitration_add\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set'],'permission_index_operations':['service::publish\x20(311)','service::sales_add/set\x20(305)','service::discount\x20(312)\x20—\x20promotional\x20rates','service::reward_add\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set'],'permission_index_operations':['service::machine_set\x20(306)\x20—\x20bind\x20workflow','service::publish\x20(311)','service::order_allocators_set\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::arbitration_add\x20(308)','service::compensation_fund_add\x20(315)','service::setting_lock_duration_add\x20(317)','service::publish\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','compensation_claim\x20triggered\x20by\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::compensation_fund_add\x20(315)\x20—\x20deposit','service::compensation_fund_withdraw\x20(314)\x20—\x20withdraw\x20(time-locked\x20after\x20publish)','service::compensation_fund_receive\x20(316)\x20—\x20receive\x20arbitration\x20payout\x20(always\x20mutable)','service::setting_lock_duration_add\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::compensation_claim\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::reward_add/remove/clear\x20(318)\x20—\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish','service::discount\x20(312)','service::publish\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::arbitration_add\x20(308)\x20—\x20pre-publish\x20only','service::arbitration_remove\x20(308)\x20—\x20pre-publish\x20only','service::arbitration_clear\x20(308)\x20—\x20pre-publish\x20only','service::publish\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::buy_guard_set\x20(307)\x20—\x20bind\x20guard','service::buy_guard_none\x20(307)\x20—\x20clear\x20guard','service::publish\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::order_allocators_set\x20(313)\x20—\x20pre-publish\x20only','service::publish\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::discount\x20(312)\x20—\x20issue\x20coupons','service::sales_add/set\x20(305)\x20—\x20adjust\x20base\x20prices','service::sales_remove\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)'],'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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::order_allocators_set\x20(313)\x20—\x20pre-publish\x20only','service::publish\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','First-match-wins:\x20first\x20allocator\x20whose\x20threshold\x20is\x20met\x20handles\x20the\x20order'],'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':'service::new','post_publish_mutability':'na'},{'index':0x12d,'name':'SERVICE_DESCRIPTION','description':'Modify\x20Service\x20description','governed_operation':'service::description_set','post_publish_mutability':'mutable'},{'index':0x12f,'name':'SERVICE_LOCATION','description':'Set\x20Service\x20location/URL','governed_operation':'service::location_set','post_publish_mutability':'mutable'},{'index':0x130,'name':'SERVICE_REPOSITORY','description':'Add/remove\x20Repository\x20references','governed_operation':'service::repository_add/remove/clear','post_publish_mutability':'mutable'},{'index':0x131,'name':'SERVICE_SALES','description':'Add/set/remove/clear\x20sales\x20items','governed_operation':'service::sales_add/set/remove/clear','post_publish_mutability':'mutable'},{'index':0x132,'name':'SERVICE_MACHINE','description':'Bind/unbind\x20Machine\x20workflow\x20template','governed_operation':'service::machine_set/machine_none','post_publish_mutability':'immutable'},{'index':0x133,'name':'SERVICE_BUY_GUARD','description':'Set/clear\x20buy\x20Guard\x20(post-publish\x20mutable)','governed_operation':'service::buy_guard_set/buy_guard_none','post_publish_mutability':'mutable'},{'index':0x134,'name':'SERVICE_ARBITRATION','description':'Add/remove\x20Arbitration\x20references','governed_operation':'service::arbitration_add/remove/clear','post_publish_mutability':'immutable'},{'index':0x135,'name':'SERVICE_CUSTOMER_INFO_REQUIRED','description':'Set\x20customer\x20required\x20info\x20fields','governed_operation':'service::customer_required_set','post_publish_mutability':'mutable'},{'index':0x136,'name':'SERVICE_PAUSE','description':'Pause/resume\x20Service\x20(block\x20new\x20orders)','governed_operation':'service::pause','post_publish_mutability':'mutable'},{'index':0x137,'name':'SERVICE_PUBLISH','description':'Publish\x20Service\x20(IRREVERSIBLE)','governed_operation':'service::publish','post_publish_mutability':'one_shot'},{'index':0x138,'name':'SERVICE_DISCOUNT','description':'Issue/discount_destroy\x20discount\x20coupons','governed_operation':'service::discount','post_publish_mutability':'mutable'},{'index':0x139,'name':'SERVICE_ORDER_ALLOCATOR','description':'Set\x20order\x20allocator\x20strategy','governed_operation':'service::order_allocators_set','post_publish_mutability':'immutable'},{'index':0x13a,'name':'SERVICE_COMPENSATION_FUND_WITHDRAW','description':'Withdraw\x20compensation\x20fund\x20(time-locked)','governed_operation':'service::compensation_fund_withdraw','post_publish_mutability':'locked_by_duration'},{'index':0x13b,'name':'SERVICE_COMPENSATION_FUND_DEPOSIT','description':'Deposit\x20to\x20compensation\x20fund','governed_operation':'service::compensation_fund_add','post_publish_mutability':'mutable'},{'index':0x13c,'name':'SERVICE_COMPENSATION_FUND_RECEIVE','description':'Receive\x20compensation\x20fund\x20(arbitration\x20payout)','governed_operation':'service::compensation_fund_receive','post_publish_mutability':'mutable'},{'index':0x13d,'name':'SERVICE_COMPENSATION_LOCK_DURATION_ADD','description':'Extend\x20setting_lock_duration\x20(only-increase)','governed_operation':'service::setting_lock_duration_add','post_publish_mutability':'mutable'},{'index':0x13e,'name':'SERVICE_REWARD','description':'Add/remove\x20Reward\x20references\x20(remove/clear\x20time-locked)','governed_operation':'service::reward_add/remove/clear','post_publish_mutability':'locked_by_duration'},{'index':0x13f,'name':'SERVICE_OWNER_RECEIVE','description':'Receive\x20Payment/objects\x20to\x20owner','governed_operation':'service::owner_receive','post_publish_mutability':'mutable'},{'index':0x140,'name':'SERVICE_UM','description':'Bind/unbind\x20Contact\x20as\x20UM','governed_operation':'service::um_set/um_none','post_publish_mutability':'mutable'}];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':['quote_imp()\x20computes\x20total\x20price\x20(with\x20discount\x20if\x20applicable)','⚠️\x20Stock\x20is\x20deducted\x20(split)\x20—\x20side\x20effect\x20is\x20NOT\x20auto-rolled-back\x20on\x20later\x20failure','service::quote\x20or\x20service::quote_with_discount\x20MoveCall\x20(quote_with_discount\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':['service::buy\x20or\x20service::buy_with_passport\x20MoveCall','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':['service::order_allocation\x20MoveCall','Allocation\x20object\x20created\x20(first-match-wins\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':['service::order_progress\x20MoveCall','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':['agent_set\x20(if\x20order_new.agents\x20provided)','order_required_info_update\x20(if\x20order_required_info\x20provided)','owner_change\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set','customer_required_set'],'permission_index_operations':['service::publish\x20(311)','service::pause\x20(310)','service::sales_add/set/remove/clear\x20(305)','service::order_allocators_set\x20(313)','service::buy_guard_set\x20(307)','service::discount\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set'],'permission_index_operations':['service::publish\x20(311)','service::sales_add/set\x20(305)','service::machine_set\x20(306)\x20—\x20for\x20rental\x20workflow','service::arbitration_add\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set'],'permission_index_operations':['service::publish\x20(311)','service::sales_add/set\x20(305)','service::discount\x20(312)\x20—\x20promotional\x20rates','service::reward_add\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set'],'permission_index_operations':['service::machine_set\x20(306)\x20—\x20bind\x20workflow','service::publish\x20(311)','service::order_allocators_set\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::arbitration_add\x20(308)','service::compensation_fund_add\x20(315)','service::setting_lock_duration_add\x20(317)','service::publish\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','compensation_claim\x20triggered\x20by\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::compensation_fund_add\x20(315)\x20—\x20deposit','service::compensation_fund_withdraw\x20(314)\x20—\x20withdraw\x20(time-locked\x20after\x20publish)','service::compensation_fund_receive\x20(316)\x20—\x20receive\x20arbitration\x20payout\x20(always\x20mutable)','service::setting_lock_duration_add\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::compensation_claim\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::reward_add/remove/clear\x20(318)\x20—\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish','service::discount\x20(312)','service::publish\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::arbitration_add\x20(308)\x20—\x20pre-publish\x20only','service::arbitration_remove\x20(308)\x20—\x20pre-publish\x20only','service::arbitration_clear\x20(308)\x20—\x20pre-publish\x20only','service::publish\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::buy_guard_set\x20(307)\x20—\x20bind\x20guard','service::buy_guard_none\x20(307)\x20—\x20clear\x20guard','service::publish\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::order_allocators_set\x20(313)\x20—\x20pre-publish\x20only','service::publish\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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::discount\x20(312)\x20—\x20issue\x20coupons','service::sales_add/set\x20(305)\x20—\x20adjust\x20base\x20prices','service::sales_remove\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)'],'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':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::order_allocators_set\x20(313)\x20—\x20pre-publish\x20only','service::publish\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','First-match-wins:\x20first\x20allocator\x20whose\x20threshold\x20is\x20met\x20handles\x20the\x20order'],'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];}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{adaptNodeAnalyzer}from'../graph/onchain/index.js';import{assessServiceStateRisks}from'./service-risk.js';export const SERVICE_RISK_NODE_ANALYZER_ID='SR1';const STAKEHOLDER_ROLE={'owner':'merchant','provider':'merchant','customer':'buyer','arbitrator':'arbitrator','system':'system'},COPY={'R-S-4-05':{'titleZh':()=>'履约状态:Service\x20已暂停(bPaused=true),暂停期间无法下新单','detailZh':a=>'店铺\x20'+a+'\x20当前\x20bPaused=true:商家主动暂停营业,新订单在恢复前无法提交(规则\x20R-S-4-05,证据\x20bPaused=true)。','suggestionZh':'通过\x20Messenger\x20向商家确认恢复营业时间;暂停期间不要打款下单。'},'R-S-4-06':{'titleZh':()=>'履约状态:Service\x20未发布(草稿态),市场不可见且\x20order_new\x20必失败','detailZh':a=>'店铺\x20'+a+'\x20当前\x20bPublished=false:对象仍是草稿,市场不可见,任何下单都会失败(规则\x20R-S-4-06,证据\x20bPublished=false)。','suggestionZh':'等待商家正式发布(发布不可逆,配置届时锁定)后再下单;草稿链接不构成在售承诺。'},'R-S-5-05':{'titleZh':()=>'赔付路径缺失:compensation_fund\x20有余额但未绑定任何\x20Arbitration','detailZh':(a,b)=>'店铺\x20'+a+'\x20的\x20compensation_fund\x20有余额但\x20arbitrations\x20为空:赔付须经争议→仲裁裁决→arb_withdraw\x20才能领取,'+('没有仲裁绑定意味着这笔钱没有可执行的领取路径(规则\x20R-S-5-05,证据\x20'+(b['evidence']??'')+')。'),'suggestionZh':'要求商家先绑定至少一个与店铺\x20Permission\x20不同组的\x20Arbitration\x20再下单;无争议路径的赔付承诺不可执行。'}};export const serviceRiskNodeAnalyzer=adaptNodeAnalyzer({'id':SERVICE_RISK_NODE_ANALYZER_ID,'kind':'risk','objectType':'Service','inspect'(a){const b=a['raw'],c=b?.['data']??b;if(!c)return[];const e={};if(typeof c['bPaused']==='boolean')e['current_bPaused']=c['bPaused'];if(typeof c['bPublished']==='boolean')e['current_bPublished']=c['bPublished'];if(c['compensation_fund']!=null)e['current_compensation_fund_balance']=String(c['compensation_fund']);if(Array['isArray'](c['arbitrations']))e['current_arbitrations_count']=c['arbitrations']['length'];return assessServiceStateRisks(e)['map'](f=>{const g=COPY[f['id']];return{'severity':f['level']==='CRITICAL'||f['level']==='HIGH'?'high':f['level']==='MEDIUM'?'medium':'low','titleZh':g['titleZh'](a['id'],f),'detailZh':g['detailZh'](a['id'],f),'suggestionZh':g['suggestionZh'],'roles':[...new Set(f['affected_stakeholders']['map'](h=>STAKEHOLDER_ROLE[h]))]};});}});
|
|
@@ -93,6 +93,8 @@ export interface ServiceRiskCheckContext {
|
|
|
93
93
|
target_objects_types?: string[];
|
|
94
94
|
}
|
|
95
95
|
export declare const SERVICE_RISK_VERSION = "1.1.0";
|
|
96
|
+
export declare const SERVICE_STATE_RULE_IDS: readonly ["R-S-4-05", "R-S-4-06", "R-S-5-05"];
|
|
97
|
+
export declare function assessServiceStateRisks(ctx: ServiceRiskCheckContext): ServiceRisk[];
|
|
96
98
|
export declare function getAllServiceRiskRules(): ServiceRiskRule[];
|
|
97
99
|
export declare function getServiceRiskRulesCount(): number;
|
|
98
100
|
export declare function getServiceRiskRulesByCategory(category: ServiceRiskCategory): ServiceRiskRule[];
|