@wowok/agent-mcp 3.3.8 → 3.4.0
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/chain-semantics/field-capability.js +1 -1
- package/dist/chain-semantics/freeze-map.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/guard-verbs.js +1 -1
- package/dist/chain-semantics/object-graph.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/compile.d.ts +3 -2
- package/dist/composition/compile.js +1 -1
- package/dist/composition/inflight.d.ts +6 -0
- package/dist/composition/inflight.js +1 -1
- package/dist/composition/materialize.d.ts +4 -0
- package/dist/composition/materialize.js +1 -1
- package/dist/composition/param-disclosure.d.ts +61 -0
- package/dist/composition/param-disclosure.js +1 -0
- package/dist/composition/plan.d.ts +11 -1
- package/dist/composition/plan.js +1 -1
- package/dist/customer/account-events.js +1 -1
- package/dist/data/api/api.spec.js +1 -1
- package/dist/data/api/cli.js +1 -1
- package/dist/data/api/server.d.ts +1 -0
- package/dist/data/api/server.js +1 -1
- package/dist/data/projection/store.d.ts +2 -1
- package/dist/data/projection/store.js +1 -1
- package/dist/data/projection/types.d.ts +10 -0
- package/dist/data/sync/cdc.js +1 -1
- package/dist/data/sync/cdc.spec.js +1 -1
- package/dist/data/sync/store.d.ts +5 -0
- package/dist/data/sync/store.js +1 -1
- package/dist/data/sync/types.d.ts +2 -0
- package/dist/evaluation/builtins/graph-service.spec.js +1 -1
- package/dist/evaluation/engine.js +1 -1
- package/dist/evaluation/guard-scan.js +1 -1
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/business-modules.js +1 -1
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/exposure.js +1 -1
- package/dist/harness/recover.js +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/allocation-templates.js +1 -1
- package/dist/knowledge/allocator-rail-verifier.js +1 -1
- package/dist/knowledge/arb-fund-facts.d.ts +1 -0
- package/dist/knowledge/arb-fund-facts.js +1 -1
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/arbitration-risk.d.ts +1 -0
- package/dist/knowledge/arbitration-risk.js +1 -1
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/rules/allocation.json +6 -6
- package/dist/knowledge/baselines/rules/arb.json +2 -2
- package/dist/knowledge/baselines/rules/guard.json +11 -11
- package/dist/knowledge/baselines/rules/order.json +1 -1
- package/dist/knowledge/baselines/rules/plan.json +1 -1
- package/dist/knowledge/baselines/semantic-facts.js +1 -1
- package/dist/knowledge/builtin-templates.d.ts +14 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/catalog-facts.d.ts +4 -0
- package/dist/knowledge/catalog-facts.js +1 -0
- package/dist/knowledge/commission-landing.js +1 -1
- package/dist/knowledge/component-schema.d.ts +64 -0
- package/dist/knowledge/component-schema.js +1 -0
- package/dist/knowledge/entity-recipient-guard.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/fee-param-bindings.d.ts +26 -0
- package/dist/knowledge/fee-param-bindings.js +1 -0
- package/dist/knowledge/fund-layer.js +1 -1
- package/dist/knowledge/getting-started.d.ts +2 -2
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-anchor-reach.js +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-ledger.js +1 -1
- package/dist/knowledge/guard-lint.d.ts +1 -0
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.js +1 -1
- package/dist/knowledge/jsonrpc-enum.d.ts +14 -3
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/knob-docs.d.ts +5 -0
- package/dist/knowledge/knob-docs.js +1 -0
- package/dist/knowledge/machine-templates.js +1 -1
- package/dist/knowledge/machine-topology.js +1 -1
- package/dist/knowledge/machine-translation.js +1 -1
- package/dist/knowledge/onchain-constants.d.ts +2 -0
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/param-schema.d.ts +70 -0
- package/dist/knowledge/param-schema.js +1 -0
- package/dist/knowledge/param-tiers.d.ts +25 -0
- package/dist/knowledge/param-tiers.js +1 -0
- package/dist/knowledge/passport-ledger.d.ts +1 -1
- package/dist/knowledge/passport-ledger.js +1 -1
- package/dist/knowledge/pattern-resolutions.d.ts +106 -0
- package/dist/knowledge/pattern-resolutions.js +1 -0
- package/dist/knowledge/projection.spec.js +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/scenario-modes.d.ts +1 -0
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/scenario-topology.js +1 -1
- package/dist/knowledge/service-allocation-semantics.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-templates.js +1 -1
- package/dist/knowledge/strategy-manuals.d.ts +1 -1
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/template-loader.d.ts +101 -1
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-nav.d.ts +7 -0
- package/dist/knowledge/template-nav.js +1 -0
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +33 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/template-test-profiles.d.ts +17 -0
- package/dist/knowledge/template-test-profiles.js +1 -0
- package/dist/knowledge/template-validation.d.ts +1 -0
- package/dist/knowledge/template-validation.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/treasury-templates.js +1 -1
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/time-window.d.ts +37 -0
- package/dist/participation/time-window.js +1 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.d.ts +1 -0
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +4 -1
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.d.ts +1 -0
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +1 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/playbooks/service-build/service-quote.spec.js +1 -1
- package/dist/playbooks/service-build/workflow-design-assessment.js +1 -1
- package/dist/relationship/registry.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/runtime/instance-registry.d.ts +7 -1
- package/dist/runtime/instance-registry.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +2 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +8 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +2 -0
- package/dist/schema/call/error-codes.d.ts +1 -1
- package/dist/schema/call/error-codes.js +1 -1
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +3 -3
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +8 -0
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/planning.d.ts +1 -0
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +29 -0
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/local/index.d.ts +20 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +2 -0
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +1 -1
- package/dist/schema/operations.js +1 -1
- package/dist/schema/query/bi.d.ts +106 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +5 -5
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/watch/index.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +4 -2
- package/dist/schemas/benchmark_migration_operation.output.json +3 -3
- package/dist/schemas/benchmark_migration_operation.schema.json +16 -2
- package/dist/schemas/bridge_operation.output.json +4 -2
- package/dist/schemas/bridge_operation.schema.json +5 -5
- package/dist/schemas/evaluation_operation.output.json +16 -0
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/industry_pack_operation.output.json +150 -1
- package/dist/schemas/industry_pack_operation.schema.json +9 -3
- package/dist/schemas/keeper_operation.output.json +2 -2
- package/dist/schemas/local_cache_operation.output.json +4 -2
- package/dist/schemas/local_history_operation.output.json +4 -2
- package/dist/schemas/local_info_operation.output.json +4 -2
- package/dist/schemas/local_mark_operation.output.json +4 -2
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/messenger_operation.output.json +13 -2
- package/dist/schemas/messenger_operation.schema.json +41 -34
- package/dist/schemas/monitor_events.output.json +2 -2
- package/dist/schemas/monitor_subscription.output.json +2 -2
- package/dist/schemas/onchain_events.output.json +14 -14
- package/dist/schemas/onchain_operations.output.json +13 -10
- package/dist/schemas/onchain_operations.schema.json +124 -99
- package/dist/schemas/onchain_operations_allocation.schema.json +7 -6
- package/dist/schemas/onchain_operations_arbitration.schema.json +7 -6
- package/dist/schemas/onchain_operations_contact.schema.json +4 -3
- package/dist/schemas/onchain_operations_demand.schema.json +4 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +4 -3
- package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +7 -6
- package/dist/schemas/onchain_operations_machine.schema.json +9 -7
- package/dist/schemas/onchain_operations_order.schema.json +6 -4
- package/dist/schemas/onchain_operations_payment.schema.json +2 -2
- package/dist/schemas/onchain_operations_permission.schema.json +19 -15
- package/dist/schemas/onchain_operations_personal.schema.json +17 -14
- package/dist/schemas/onchain_operations_progress.schema.json +6 -4
- package/dist/schemas/onchain_operations_proof.schema.json +4 -3
- package/dist/schemas/onchain_operations_repository.schema.json +9 -7
- package/dist/schemas/onchain_operations_reward.schema.json +5 -4
- package/dist/schemas/onchain_operations_service.schema.json +15 -12
- package/dist/schemas/onchain_operations_treasury.schema.json +4 -3
- package/dist/schemas/onchain_table_data.output.json +18 -13
- package/dist/schemas/onchain_table_data.schema.json +13 -13
- package/dist/schemas/query_toolkit.output.json +301 -33
- package/dist/schemas/query_toolkit.schema.json +6 -6
- package/dist/schemas/watch_operation.output.json +3 -3
- package/dist/schemas/workflow_operation.schema.json +3 -2
- package/dist/schemas/wowok_buildin_info.schema.json +1 -1
- package/dist/task/playbook.js +1 -1
- package/dist/tools/handlers/benchmark-migration.d.ts +1 -0
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/evaluation.spec.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +4 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/sanitize-output.js +1 -1
- package/dist/tools/sanitize-output.spec.js +1 -1
- package/dist/tools/types.d.ts +1 -0
- package/dist/tools/upgrade-check.d.ts +22 -0
- package/dist/tools/upgrade-check.js +1 -1
- package/dist/tools/wrap.d.ts +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
const SYM_NODE='progress.current',SYM_CLAIMED='order.claimed_by\x20some';function slotValue(a,b){if(b===undefined)return{'value':undefined,'isSubmission':![]};const c=a['find'](d=>d['identifier']===b);if(!c)return{'value':undefined,'isSubmission':![]};return{'value':c['value'],'isSubmission':c['b_submission']===!![]};}function classifyQueryLhs(a){if(a===SYM_NODE)return{'kind':'node'};if(a===SYM_CLAIMED)return{'kind':'claimed'};return{'kind':'unknown'};}function resolveValue(a,b){if(!b||b['type']!=='identifier')return{'known':![]};const c=slotValue(a,b['identifier']);if(c['isSubmission'])return{'known':![]};if(c['value']===undefined)return{'known':![]};return{'known':!![],'value':c['value']};}function evaluate(a,b,d){if(!b||typeof b['type']!=='string')return undefined;switch(b['type']){case'logic_and':{const e=Array['isArray'](b['nodes'])?b['nodes']:[];let f=![];for(const g of e){const h=evaluate(a,g,d);if(h===![])return![];if(h===undefined)f=!![];}return f?undefined:!![];}case'logic_or':{const i=Array['isArray'](b['nodes'])?b['nodes']:[];let j=![];for(const k of i){const l=evaluate(a,k,d);if(l===!![])return!![];if(l===undefined)j=!![];}return j?undefined:![];}case'logic_not':{const m=evaluate(a,b['node'],d);if(m===undefined)return undefined;return!m;}case'logic_equal':{const n=Array['isArray'](b['nodes'])?b['nodes']:[];if(n['length']<0x2)return undefined;const o=classifyQueryLhs(n[0x0]?.['query']),p=resolveValue(a,n[0x1]),q=o['kind']==='unknown'?classifyQueryLhs(n[0x1]?.['query']):o,r=!p['known']&&n[0x1]?.['query']!==undefined?resolveValue(a,n[0x0]):p;if(q['kind']==='node'){if(!r['known']||typeof r['value']!=='string')return undefined;return d['node']===r['value'];}if(q['kind']==='claimed'){if(!r['known']||typeof r['value']!=='boolean')return undefined;return d['claimed']===r['value'];}return undefined;}default:return undefined;}}function satisfiable(a,b,c){return evaluate(a,b,c)!==![];}function findDeadLiterals(a,b,c,d){if(!a||typeof a['type']!=='string')return;if(a['type']==='logic_and'&&Array['isArray'](a['nodes'])){const e=new Map();for(const f of a['nodes']){const g=resolvableEquality(f,b);if(g)e['set'](g['symbol'],g['value']);}for(const h of a['nodes']){const i=resolvableEquality(h,b);if(i){const k=e['get'](i['symbol']);if(k!==undefined&&k!==i['value']){d['push']({'code':'RAIL_DEAD_LITERAL','level':'critical','detail':deadLiteralDetail(c,i['symbol'],k,i['value'])});return;}continue;}const j=findClash(h,b,e);if(j){d['push']({'code':'RAIL_DEAD_LITERAL','level':'critical','detail':deadLiteralDetail(c,j['symbol'],j['pinned'],j['value'])});return;}}for(const l of a['nodes'])findDeadLiterals(l,b,c,d);return;}if(Array['isArray'](a['nodes'])){for(const m of a['nodes'])findDeadLiterals(m,b,c,d);}if(a['node'])findDeadLiterals(a['node'],b,c,d);}function resolvableEquality(c,d){if(!c||c['type']!=='logic_equal'||!Array['isArray'](c['nodes']))return undefined;for(const [e,f]of[[c['nodes'][0x0],c['nodes'][0x1]],[c['nodes'][0x1],c['nodes'][0x0]]]){if(!e||typeof e['query']!=='string')continue;const g=classifyQueryLhs(e['query']);if(g['kind']==='unknown')continue;const h=resolveValue(d,f);if(!h['known'])continue;return{'symbol':g['kind']==='node'?SYM_NODE:SYM_CLAIMED,'value':h['value']};}return undefined;}function findClash(a,b,c){if(!a||typeof a['type']!=='string')return undefined;if(a['type']==='logic_not')return undefined;const d=resolvableEquality(a,b);if(d){const e=c['get'](d['symbol']);if(e!==undefined&&e!==d['value'])return{'symbol':d['symbol'],'pinned':e,'value':d['value']};return undefined;}if(Array['isArray'](a['nodes']))for(const f of a['nodes']){const g=findClash(f,b,c);if(g)return g;}if(a['node'])return findClash(a['node'],b,c);return undefined;}function deadLiteralDetail(a,b,c,d){return'allocator\x20guard\x20\x27'+a+'\x27:\x20one\x20conjunction\x20scope\x20carries\x20'+b+'\x20'+('==\x20'+JSON['stringify'](c)+'\x20and\x20ALSO\x20'+b+'\x20==\x20'+JSON['stringify'](d)+'\x20—\x20the\x20second\x20')+'literal\x20contradicts\x20the\x20first\x20and\x20is\x20a\x20DEAD\x20literal\x20(azx7-mn-261014\x20CR-azx7-01:\x20a\x20pinned\x20'+'node\x20equality\x20made\x20the\x20sibling\x20closed_cancel/item_lost\x20legs\x20unreachable,\x20stranding\x20the\x20'+'escrow\x20at\x20every\x20other\x20terminal).\x20Hoist\x20the\x20node\x20predicate\x20to\x20ONE\x20top-level\x20n-ary\x20logic_or\x20'+'instead\x20of\x20AND-prepending\x20a\x20single-node\x20gate.';}function hasArbitrationEvidenceLeg(a){if(!a||typeof a!=='object')return![];const b=a;if(typeof b['query']==='string'){const d=b['query'];return d['startsWith']('arb.')||d['startsWith']('order.dispute');}if(Array['isArray'](b['nodes'])){for(const e of b['nodes'])if(hasArbitrationEvidenceLeg(e))return!![];}if(b['node']&&hasArbitrationEvidenceLeg(b['node']))return!![];return![];}export function verifyAllocatorRails(a,b,c){const d=[];if(a['length']===0x0)return d;if(c?.['arbitrationBound']===!![]){const j=a['filter'](k=>k['track']==='refund'&&k['root']!==undefined&&!hasArbitrationEvidenceLeg(k['root']))['map'](k=>k['key']);j['length']>0x0&&d['push']({'code':'RAIL_RULING_WINDOW','level':'info','detail':'refund\x20rail(s)\x20['+j['join'](',\x20')+']\x20carry\x20no\x20arbitration-side\x20evidence\x20leg\x20'+'(arb.*\x20/\x20order.dispute*)\x20—\x20the\x20\x22ruled\x20but\x20unclaimed\x22\x20window\x20stays\x20open:\x20after\x20a\x20'+'buyer-favored\x20ruling\x20awards\x20compensation\x20but\x20BEFORE\x20the\x20claim/conclude\x20stamps\x20'+'order.claimed_by,\x20the\x20claimed_by-none\x20refund\x20route\x20can\x20still\x20drain\x20the\x20escrow\x20'+'(dual-track\x20overlap\x20is\x20a\x20LEGITIMATE\x20chain-allowed\x20commercial\x20shape,\x20order.move\x20'+'merchant\x27s-choice\x20note\x20—\x20disclosure,\x20not\x20a\x20violation).\x20To\x20close\x20it,\x20gate\x20the\x20rail\x20'+'on\x20ruling\x20evidence\x20(arb.indemnity\x20legs)\x20—\x20buildable\x20ONLY\x20when\x20this\x20rail\x20is\x20reachable\x20'+'exclusively\x20from\x20dispute-state\x20nodes,\x20or\x20sequence\x20the\x20edge\x20behind\x20the\x20claimed_by\x20stamp\x20'+'(tpl_forward_arb_ruling_won/dismissed\x204R-03b\x20form).\x20See\x20pattern.arb_status_escrow_holdback.'});}if(b['length']===0x0)return d;const e=b['filter'](k=>k['semanticRole']==='cancelled'||k['semanticRole']==='final'),f=b['map'](k=>({'node':k['name'],'claimed':!![]}));for(const k of a){if(k['root']===undefined)continue;const l=k['table'];findDeadLiterals(k['root'],l,k['key'],d);}for(const m of e){const n={'node':m['name'],'claimed':![]},o=a['some'](p=>satisfiable(p['table'],p['root'],n));!o&&d['push']({'code':'RAIL_TERMINAL_UNCOVERED','level':'critical','detail':'terminal\x20node\x20\x27'+m['name']+'\x27\x20(role\x20'+m['semanticRole']+')\x20has\x20NO\x20allocator\x20rail\x20'+'satisfiable\x20at\x20claimed_by=none\x20—\x20a\x20normal\x20(unclaimed)\x20order\x20reaching\x20this\x20'+'terminal\x20strands\x20its\x20escrow\x20forever\x20(azx7-mn-261014\x20CR-azx7-01:\x20refund\x20'+'rejected\x20abort\x207\x20at\x20closed_cancel/item_lost;\x20crs-mn-261014\x20F-30:\x20double-'+'negated\x20claimed_by\x20leg\x20bricked\x20the\x20refund\x20at\x20returned).\x20Guards/allocators\x20'+'freeze\x20at\x20publish\x20—\x20fix\x20the\x20rail\x20polarity/node-set\x20BEFORE\x20publishing.'});}const h=a['some'](p=>f['some'](q=>satisfiable(p['table'],p['root'],q)));!h&&d['push']({'code':'RAIL_AWARD_EXIT_MISSING','level':'critical','detail':'no\x20allocator\x20rail\x20is\x20satisfiable\x20at\x20claimed_by=some\x20on\x20ANY\x20machine\x20node\x20—\x20an\x20'+'arbitration-paid\x20order\x20has\x20NO\x20escrow\x20exit\x20(escrow-exit\x20invariant,\x20az-mn-261007).\x20'+'Pair\x20the\x20refund\x20rail\x20with\x20a\x20merchant-recovery\x20allocator\x20asserting\x20order.claimed_by\x20'+'some\x20==\x20true\x20(query\x201570)\x20on\x20the\x20post-delivery\x20node\x20set.\x20R2-05\x20DISMISSAL-STAMP\x20CAUTION\x20'+'(alg26-tn-261026\x20O11):\x20a\x20concluded\x20DISMISSAL\x20(indemnity=0)\x20ALSO\x20stamps\x20order.claimed_by\x20'+'(service.move:1703-1711\x20—\x20permissionless\x20keeper\x20conclude;\x20on\x20protocol\x20>=\x20154\x20the\x20ruled-zero\x20'+'seal\x20closes\x20claimed_by-none\x20refund\x20rails\x20BY\x20DESIGN,\x20F-BS-54/56).\x20A\x20recover\x20rail\x20discriminated\x20'+'ONLY\x20on\x20the\x20bare\x20order\x20stamp\x20routes\x20to\x20its\x20STATIC\x20recipient\x20regardless\x20of\x20the\x20ruling\x20direction\x20—\x20'+'under\x20a\x20dismissal\x20that\x20static\x20recipient\x20can\x20be\x20the\x20LOSING\x20party\x20(O11:\x20assignee\x20took\x200.15\x20after\x20'+'losing).\x20Split\x20the\x20recover\x20rail\x20by\x20arb\x20outcome\x20or\x20bind\x20its\x20recipient\x20to\x20the\x20winning\x20side\x20—\x20'+'discriminate\x20on\x20the\x20arb-side\x20award\x20(indemnity\x20>\x200\x20/\x20award-claimed\x20polarity),\x20never\x20the\x20bare\x20'+'order\x20stamp:\x20\x27claimed_by\x20some\x20⇒\x20recover-safe\x27\x20holds\x20ONLY\x20when\x20indemnity\x20>\x200.'});const i=a['filter'](p=>p['root']!==undefined);for(const p of f){const q=i['some'](u=>u['track']==='refund'&&satisfiable(u['table'],u['root'],p));if(!q)continue;const r=a['some'](u=>claimedTrueLegPasses(u,p));r&&d['push']({'code':'RAIL_POLARITY_COLLISION','level':'critical','detail':'at\x20node\x20\x27'+p['node']+'\x27\x20with\x20claimed_by=some,\x20BOTH\x20a\x20refund-track\x20rail\x20and\x20an\x20'+'award-polarity\x20rail\x20(claimed_by\x20some\x20==\x20true)\x20are\x20satisfiable\x20—\x20the\x20pairing\x20'+'can\x20double-pay\x20the\x20same\x20escrow\x20(crs-mn-261014\x20F-30:\x20the\x20double-negated\x20refund\x20'+'leg\x20passed\x20only\x20AFTER\x20the\x20award\x20paid;\x20dry-run\x20simulated\x20the\x20escrow\x20draining\x20'+'on\x20top\x20of\x20a\x20paid\x20ruling).\x20The\x20refund\x20leg\x20must\x20be\x20logic_equal[query\x20'+'\x27order.claimed_by\x20some\x27,\x20Bool\x20false]\x20—\x20never\x20logic_not(query)==false.'});}return d;}function claimedTrueLegPasses(a,b){const c=a['table'],d={'node':b['node'],'claimed':!![]};return satisfiable(c,a['root'],d)&&!satisfiable(c,a['root'],{'node':b['node'],'claimed':![]});}
|
|
1
|
+
const SYM_NODE='progress.current',SYM_CLAIMED='order.claimed_by\x20some';function slotValue(a,b){if(b===undefined)return{'value':undefined,'isSubmission':![]};const c=a['find'](d=>d['identifier']===b);if(!c)return{'value':undefined,'isSubmission':![]};return{'value':c['value'],'isSubmission':c['b_submission']===!![]};}function classifyQueryLhs(a){if(a===SYM_NODE)return{'kind':'node'};if(a===SYM_CLAIMED)return{'kind':'claimed'};return{'kind':'unknown'};}function resolveValue(a,b){if(!b||b['type']!=='identifier')return{'known':![]};const c=slotValue(a,b['identifier']);if(c['isSubmission'])return{'known':![]};if(c['value']===undefined)return{'known':![]};return{'known':!![],'value':c['value']};}function evaluate(a,b,d){if(!b||typeof b['type']!=='string')return undefined;switch(b['type']){case'logic_and':{const e=Array['isArray'](b['nodes'])?b['nodes']:[];let f=![];for(const g of e){const h=evaluate(a,g,d);if(h===![])return![];if(h===undefined)f=!![];}return f?undefined:!![];}case'logic_or':{const i=Array['isArray'](b['nodes'])?b['nodes']:[];let j=![];for(const k of i){const l=evaluate(a,k,d);if(l===!![])return!![];if(l===undefined)j=!![];}return j?undefined:![];}case'logic_not':{const m=evaluate(a,b['node'],d);if(m===undefined)return undefined;return!m;}case'logic_equal':{const n=Array['isArray'](b['nodes'])?b['nodes']:[];if(n['length']<0x2)return undefined;const o=classifyQueryLhs(n[0x0]?.['query']),p=resolveValue(a,n[0x1]),q=o['kind']==='unknown'?classifyQueryLhs(n[0x1]?.['query']):o,r=!p['known']&&n[0x1]?.['query']!==undefined?resolveValue(a,n[0x0]):p;if(q['kind']==='node'){if(!r['known']||typeof r['value']!=='string')return undefined;return d['node']===r['value'];}if(q['kind']==='claimed'){if(!r['known']||typeof r['value']!=='boolean')return undefined;return d['claimed']===r['value'];}return undefined;}default:return undefined;}}function satisfiable(a,b,c){return evaluate(a,b,c)!==![];}function findDeadLiterals(a,b,c,d){if(!a||typeof a['type']!=='string')return;if(a['type']==='logic_and'&&Array['isArray'](a['nodes'])){const e=new Map();for(const f of a['nodes']){const g=resolvableEquality(f,b);if(g)e['set'](g['symbol'],g['value']);}for(const h of a['nodes']){const i=resolvableEquality(h,b);if(i){const k=e['get'](i['symbol']);if(k!==undefined&&k!==i['value']){d['push']({'code':'RAIL_DEAD_LITERAL','level':'critical','detail':deadLiteralDetail(c,i['symbol'],k,i['value'])});return;}continue;}const j=findClash(h,b,e);if(j){d['push']({'code':'RAIL_DEAD_LITERAL','level':'critical','detail':deadLiteralDetail(c,j['symbol'],j['pinned'],j['value'])});return;}}for(const l of a['nodes'])findDeadLiterals(l,b,c,d);return;}if(Array['isArray'](a['nodes'])){for(const m of a['nodes'])findDeadLiterals(m,b,c,d);}if(a['node'])findDeadLiterals(a['node'],b,c,d);}function resolvableEquality(c,d){if(!c||c['type']!=='logic_equal'||!Array['isArray'](c['nodes']))return undefined;for(const [e,f]of[[c['nodes'][0x0],c['nodes'][0x1]],[c['nodes'][0x1],c['nodes'][0x0]]]){if(!e||typeof e['query']!=='string')continue;const g=classifyQueryLhs(e['query']);if(g['kind']==='unknown')continue;const h=resolveValue(d,f);if(!h['known'])continue;return{'symbol':g['kind']==='node'?SYM_NODE:SYM_CLAIMED,'value':h['value']};}return undefined;}function findClash(a,b,c){if(!a||typeof a['type']!=='string')return undefined;if(a['type']==='logic_not')return undefined;const d=resolvableEquality(a,b);if(d){const e=c['get'](d['symbol']);if(e!==undefined&&e!==d['value'])return{'symbol':d['symbol'],'pinned':e,'value':d['value']};return undefined;}if(Array['isArray'](a['nodes']))for(const f of a['nodes']){const g=findClash(f,b,c);if(g)return g;}if(a['node'])return findClash(a['node'],b,c);return undefined;}function deadLiteralDetail(a,b,c,d){return'allocator\x20guard\x20\x27'+a+'\x27:\x20one\x20conjunction\x20scope\x20carries\x20'+b+'\x20'+('==\x20'+JSON['stringify'](c)+'\x20and\x20ALSO\x20'+b+'\x20==\x20'+JSON['stringify'](d)+'\x20—\x20the\x20second\x20')+'literal\x20contradicts\x20the\x20first\x20and\x20is\x20a\x20DEAD\x20literal\x20(azx7-mn-261014\x20CR-azx7-01:\x20a\x20pinned\x20'+'node\x20equality\x20made\x20the\x20sibling\x20closed_cancel/item_lost\x20legs\x20unreachable,\x20stranding\x20the\x20'+'escrow\x20at\x20every\x20other\x20terminal).\x20Hoist\x20the\x20node\x20predicate\x20to\x20ONE\x20top-level\x20n-ary\x20logic_or\x20'+'instead\x20of\x20AND-prepending\x20a\x20single-node\x20gate.';}function hasArbitrationEvidenceLeg(a){if(!a||typeof a!=='object')return![];const b=a;if(typeof b['query']==='string'){const d=b['query'];return d['startsWith']('arb.')||d['startsWith']('order.dispute');}if(Array['isArray'](b['nodes'])){for(const e of b['nodes'])if(hasArbitrationEvidenceLeg(e))return!![];}if(b['node']&&hasArbitrationEvidenceLeg(b['node']))return!![];return![];}export function verifyAllocatorRails(a,b,c){const d=[];if(a['length']===0x0)return d;if(c?.['arbitrationBound']===!![]){const j=a['filter'](k=>k['track']==='refund'&&k['root']!==undefined&&!hasArbitrationEvidenceLeg(k['root']))['map'](k=>k['key']);j['length']>0x0&&d['push']({'code':'RAIL_RULING_WINDOW','level':'info','detail':'refund\x20rail(s)\x20['+j['join'](',\x20')+']\x20carry\x20no\x20arbitration-side\x20evidence\x20leg\x20'+'(arb.*\x20/\x20order.dispute*)\x20—\x20the\x20\x22ruled\x20but\x20unclaimed\x22\x20window\x20stays\x20open:\x20after\x20a\x20'+'buyer-favored\x20ruling\x20awards\x20compensation\x20but\x20BEFORE\x20the\x20claim/conclude\x20stamps\x20'+'order.claimed_by,\x20the\x20claimed_by-none\x20refund\x20route\x20can\x20still\x20drain\x20the\x20escrow\x20'+'(dual-track\x20overlap\x20is\x20a\x20LEGITIMATE\x20chain-allowed\x20commercial\x20shape\x20—\x20disclosure,\x20not\x20a\x20violation).\x20To\x20close\x20it,\x20gate\x20the\x20rail\x20'+'on\x20ruling\x20evidence\x20(arb.indemnity\x20legs)\x20—\x20buildable\x20ONLY\x20when\x20this\x20rail\x20is\x20reachable\x20'+'exclusively\x20from\x20dispute-state\x20nodes,\x20or\x20sequence\x20the\x20edge\x20behind\x20the\x20claimed_by\x20stamp\x20'+'(tpl_forward_arb_ruling_won/dismissed\x204R-03b\x20form).\x20See\x20pattern.arb_status_escrow_holdback.'});}if(b['length']===0x0)return d;const e=b['filter'](k=>k['semanticRole']==='cancelled'||k['semanticRole']==='final'),f=b['map'](k=>({'node':k['name'],'claimed':!![]}));for(const k of a){if(k['root']===undefined)continue;const l=k['table'];findDeadLiterals(k['root'],l,k['key'],d);}for(const m of e){const n={'node':m['name'],'claimed':![]},o=a['some'](p=>satisfiable(p['table'],p['root'],n));!o&&d['push']({'code':'RAIL_TERMINAL_UNCOVERED','level':'critical','detail':'terminal\x20node\x20\x27'+m['name']+'\x27\x20(role\x20'+m['semanticRole']+')\x20has\x20NO\x20allocator\x20rail\x20'+'satisfiable\x20at\x20claimed_by=none\x20—\x20a\x20normal\x20(unclaimed)\x20order\x20reaching\x20this\x20'+'terminal\x20strands\x20its\x20escrow\x20forever\x20(azx7-mn-261014\x20CR-azx7-01:\x20refund\x20'+'rejected\x20abort\x207\x20at\x20closed_cancel/item_lost;\x20crs-mn-261014\x20F-30:\x20double-'+'negated\x20claimed_by\x20leg\x20bricked\x20the\x20refund\x20at\x20returned).\x20Guards/allocators\x20'+'freeze\x20at\x20publish\x20—\x20fix\x20the\x20rail\x20polarity/node-set\x20BEFORE\x20publishing.'});}const h=a['some'](p=>f['some'](q=>satisfiable(p['table'],p['root'],q)));!h&&d['push']({'code':'RAIL_AWARD_EXIT_MISSING','level':'critical','detail':'no\x20allocator\x20rail\x20is\x20satisfiable\x20at\x20claimed_by=some\x20on\x20ANY\x20machine\x20node\x20—\x20an\x20'+'arbitration-paid\x20order\x20has\x20NO\x20escrow\x20exit\x20(escrow-exit\x20invariant,\x20az-mn-261007).\x20'+'Pair\x20the\x20refund\x20rail\x20with\x20a\x20merchant-recovery\x20allocator\x20asserting\x20order.claimed_by\x20'+'some\x20==\x20true\x20(query\x201570)\x20on\x20the\x20post-delivery\x20node\x20set.\x20R2-05\x20DISMISSAL-STAMP\x20CAUTION\x20'+'(alg26-tn-261026\x20O11):\x20a\x20concluded\x20DISMISSAL\x20(indemnity=0)\x20ALSO\x20stamps\x20order.claimed_by\x20'+'(permissionless\x20keeper\x20conclude;\x20on\x20protocol\x20>=\x20154\x20the\x20ruled-zero\x20'+'seal\x20closes\x20claimed_by-none\x20refund\x20rails\x20BY\x20DESIGN,\x20F-BS-54/56).\x20A\x20recover\x20rail\x20discriminated\x20'+'ONLY\x20on\x20the\x20bare\x20order\x20stamp\x20routes\x20to\x20its\x20STATIC\x20recipient\x20regardless\x20of\x20the\x20ruling\x20direction\x20—\x20'+'under\x20a\x20dismissal\x20that\x20static\x20recipient\x20can\x20be\x20the\x20LOSING\x20party\x20(O11:\x20assignee\x20took\x200.15\x20after\x20'+'losing).\x20Split\x20the\x20recover\x20rail\x20by\x20arb\x20outcome\x20or\x20bind\x20its\x20recipient\x20to\x20the\x20winning\x20side\x20—\x20'+'discriminate\x20on\x20the\x20arb-side\x20award\x20(indemnity\x20>\x200\x20/\x20award-claimed\x20polarity),\x20never\x20the\x20bare\x20'+'order\x20stamp:\x20\x27claimed_by\x20some\x20⇒\x20recover-safe\x27\x20holds\x20ONLY\x20when\x20indemnity\x20>\x200.'});const i=a['filter'](p=>p['root']!==undefined);for(const p of f){const q=i['some'](u=>u['track']==='refund'&&satisfiable(u['table'],u['root'],p));if(!q)continue;const r=a['some'](u=>claimedTrueLegPasses(u,p));r&&d['push']({'code':'RAIL_POLARITY_COLLISION','level':'critical','detail':'at\x20node\x20\x27'+p['node']+'\x27\x20with\x20claimed_by=some,\x20BOTH\x20a\x20refund-track\x20rail\x20and\x20an\x20'+'award-polarity\x20rail\x20(claimed_by\x20some\x20==\x20true)\x20are\x20satisfiable\x20—\x20the\x20pairing\x20'+'can\x20double-pay\x20the\x20same\x20escrow\x20(crs-mn-261014\x20F-30:\x20the\x20double-negated\x20refund\x20'+'leg\x20passed\x20only\x20AFTER\x20the\x20award\x20paid;\x20dry-run\x20simulated\x20the\x20escrow\x20draining\x20'+'on\x20top\x20of\x20a\x20paid\x20ruling).\x20The\x20refund\x20leg\x20must\x20be\x20logic_equal[query\x20'+'\x27order.claimed_by\x20some\x27,\x20Bool\x20false]\x20—\x20never\x20logic_not(query)==false.'});}return d;}function claimedTrueLegPasses(a,b){const c=a['table'],d={'node':b['node'],'claimed':!![]};return satisfiable(c,a['root'],d)&&!satisfiable(c,a['root'],{'node':b['node'],'claimed':![]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{batchQueryObjectsByIds}from'../graph/onchain/sdk-batch.js';const PAYMENT_HISTORY_CAP=0x5;function asBigIntOrUndefined(a){try{if(typeof a==='bigint')return a;if(typeof a==='number'&&Number['isFinite'](a))return BigInt(Math['trunc'](a));if(typeof a==='string'&&a['trim']()!=='')return BigInt(a);}catch{}return undefined;}function asMsOrUndefined(a){if(typeof a==='number'&&Number['isFinite'](a))return a;if(typeof a==='string'&&/^\d+$/['test'](a['trim']()))return Number(a['trim']());return undefined;}function pickData(a){return a?.['data']??a;}function pickAddr(a){return a?.['object']??a?.['data']?.['object']??a?.['id'];}function rawVersion(a){const b=a?.['version']??a?.['data']?.['version'];return b===undefined||b===null||String(b)===''?undefined:String(b);}const READ_CONSISTENCY='live\x20read\x20(cache\x20bypassed);\x20a\x20read\x20issued\x20in\x20the\x20same\x20second\x20as\x20a\x20committing\x20transaction\x20can\x20trail\x20the\x20committed\x20effect\x20by\x20one\x20checkpoint\x20—\x20if\x20any\x20field\x20contradicts\x20a\x20transaction\x20just\x20submitted,\x20re-query\x20once\x20(compare\x20object_versions\x20across\x20the\x20two\x20reads)\x20before\x20concluding';export async function buildOrderFundFacts(b){const c=b['noCache']??!![];let d,e,f,g,h,i;if(b['arbRef']){const I=await batchQueryObjectsByIds([b['arbRef']],b['network'],c),J=I['find'](L=>pickData(L)?.['type']==='Arb'||pickData(L)?.['order']),K=pickData(J);i=rawVersion(J),K?.['order']&&typeof K['order']==='string'&&(d=K['order'],e=pickAddr(J),f=typeof K['status']==='number'?K['status']:undefined,g=K['indemnity']?.['amount']??null,h=K['time']);}if(!d&&b['orderRef'])d=b['orderRef'];if(!d)return undefined;const j=await batchQueryObjectsByIds([d],b['network'],c),k=pickData(j[0x0]);if(!k||k['amount']===undefined)return undefined;const l=rawVersion(j[0x0]),m=[];if(typeof k['allocation']==='string'&&k['allocation'])m['push'](k['allocation']);if(typeof k['progress']==='string'&&k['progress'])m['push'](k['progress']);const n=m['length']>0x0?await batchQueryObjectsByIds(m,b['network'],c):[],q=new Map();for(const L of n){const M=pickAddr(L);if(M)q['set'](M['toLowerCase'](),L);}const r=k['allocation']?q['get'](String(k['allocation'])['toLowerCase']()):undefined,s=pickData(r),u=k['progress']?q['get'](String(k['progress'])['toLowerCase']()):undefined,v=pickData(u),x=rawVersion(r),y=rawVersion(u),z=[],A=Array['isArray'](s?.['payment'])?s['payment']['slice'](-PAYMENT_HISTORY_CAP):[];if(A['length']>0x0){const N=await batchQueryObjectsByIds(A,b['network'],c),O=new Map();for(const P of N){const Q=pickAddr(P);if(Q)O['set'](Q['toLowerCase'](),P);}for(const R of A){const S=pickData(O['get'](String(R)['toLowerCase']()));if(!S)continue;z['push']({'payment':R,'amount':String(S['amount']??'0'),'time':S['time']??'',...S['info']?.['remark']?{'remark':String(S['info']['remark'])}:{}});}}const B=asBigIntOrUndefined(k['amount'])??0x0n,C=s?asBigIntOrUndefined(s['balance']):undefined,D=C!==undefined?B-C:undefined,E=asMsOrUndefined(h),F=[];if(E!==undefined)for(const T of z){const U=asMsOrUndefined(T['time']);U!==undefined&&U>E&&F['push']({'payment':T['payment'],'amount':T['amount'],'time':T['time']});}const G={...e?{'arb_case':e}:{},...f!==undefined?{'arb_status':f}:{},...g!==undefined?{'arb_indemnity':g}:{},'order':d,'order_amount':String(k['amount']),'claimed_by':typeof k['claimed_by']==='string'?k['claimed_by']:null,'progress_node':typeof v?.['current']==='string'&&v['current']!==''?v['current']:null,'allocation':typeof k['allocation']==='string'&&k['allocation']?k['allocation']:null,'allocation_balance':C!==undefined?String(C):null,'escrow_deficit':D!==undefined?String(D):null,'withdraw_history':z,'escrow_payouts_after_case':F,'object_versions':{...i?{'arb_case':i}:{},...l?{'order':l}:{},...x?{'allocation':x}:{},...y?{'progress':y}:{}},'read_consistency':READ_CONSISTENCY,...k['time']!==undefined?{'order_time':k['time']}:{},...h!==undefined?{'case_time':h}:{}},H=['ORDER\x20FUND\x20FACTS\x20(raw\x20units,\x20live\x20read):'];H['push']('-\x20freshness:\x20'+READ_CONSISTENCY),H['push']('-\x20order\x20'+d+':\x20amount='+G['order_amount']);G['allocation']?H['push']('-\x20escrow\x20allocation\x20'+G['allocation']+':\x20balance='+G['allocation_balance']+'\x20(deficit\x20vs\x20amount:\x20'+G['escrow_deficit']+')'):H['push']('-\x20escrow\x20allocation:\x20none\x20(zero-amount\x20order\x20carries\x20no\x20escrow)');H['push']('-\x20compensation\x20claimed_by:\x20'+(G['claimed_by']??'null\x20(unclaimed)')),H['push']('-\x20workflow\x20node:\x20'+(G['progress_node']??'(none)'));if(z['length']>0x0){H['push']('-\x20escrow\x20payouts\x20so\x20far\x20('+z['length']+(A['length']===PAYMENT_HISTORY_CAP?'+':'')+'):');for(const V of z){H['push']('\x20\x20*\x20'+V['amount']+'\x20at\x20'+V['time']+(V['remark']?'\x20—\x20'+V['remark']:'')+'\x20['+V['payment']+']');}}
|
|
1
|
+
import{batchQueryObjectsByIds}from'../graph/onchain/sdk-batch.js';const PAYMENT_HISTORY_CAP=0x5;function asBigIntOrUndefined(a){try{if(typeof a==='bigint')return a;if(typeof a==='number'&&Number['isFinite'](a))return BigInt(Math['trunc'](a));if(typeof a==='string'&&a['trim']()!=='')return BigInt(a);}catch{}return undefined;}function asMsOrUndefined(a){if(typeof a==='number'&&Number['isFinite'](a))return a;if(typeof a==='string'&&/^\d+$/['test'](a['trim']()))return Number(a['trim']());return undefined;}function pickData(a){return a?.['data']??a;}function pickAddr(a){return a?.['object']??a?.['data']?.['object']??a?.['id'];}function releasedTo(a,b){const c=Array['isArray'](a?.['record'])?a['record']:[];if(c['length']===0x0)return undefined;const d=b['toLowerCase']();let e=![],f=![];for(const g of c){const h=typeof g==='string'?g:g?.['recipient']??g?.['to'];if(typeof h!=='string'||h['trim']()==='')return undefined;if(h['toLowerCase']()===d)e=!![];else f=!![];}if(e&&f)return'mixed';return e?'order':'other';}function rawVersion(a){const b=a?.['version']??a?.['data']?.['version'];return b===undefined||b===null||String(b)===''?undefined:String(b);}const READ_CONSISTENCY='live\x20read\x20(cache\x20bypassed);\x20a\x20read\x20issued\x20in\x20the\x20same\x20second\x20as\x20a\x20committing\x20transaction\x20can\x20trail\x20the\x20committed\x20effect\x20by\x20one\x20checkpoint\x20—\x20if\x20any\x20field\x20contradicts\x20a\x20transaction\x20just\x20submitted,\x20re-query\x20once\x20(compare\x20object_versions\x20across\x20the\x20two\x20reads)\x20before\x20concluding';export async function buildOrderFundFacts(b){const c=b['noCache']??!![];let d,e,f,g,h,i;if(b['arbRef']){const I=await batchQueryObjectsByIds([b['arbRef']],b['network'],c),J=I['find'](L=>pickData(L)?.['type']==='Arb'||pickData(L)?.['order']),K=pickData(J);i=rawVersion(J),K?.['order']&&typeof K['order']==='string'&&(d=K['order'],e=pickAddr(J),f=typeof K['status']==='number'?K['status']:undefined,g=K['indemnity']?.['amount']??null,h=K['time']);}if(!d&&b['orderRef'])d=b['orderRef'];if(!d)return undefined;const j=await batchQueryObjectsByIds([d],b['network'],c),k=pickData(j[0x0]);if(!k||k['amount']===undefined)return undefined;const l=rawVersion(j[0x0]),m=[];if(typeof k['allocation']==='string'&&k['allocation'])m['push'](k['allocation']);if(typeof k['progress']==='string'&&k['progress'])m['push'](k['progress']);const n=m['length']>0x0?await batchQueryObjectsByIds(m,b['network'],c):[],q=new Map();for(const L of n){const M=pickAddr(L);if(M)q['set'](M['toLowerCase'](),L);}const r=k['allocation']?q['get'](String(k['allocation'])['toLowerCase']()):undefined,s=pickData(r),u=k['progress']?q['get'](String(k['progress'])['toLowerCase']()):undefined,v=pickData(u),x=rawVersion(r),y=rawVersion(u),z=[],A=Array['isArray'](s?.['payment'])?s['payment']['slice'](-PAYMENT_HISTORY_CAP):[];if(A['length']>0x0){const N=await batchQueryObjectsByIds(A,b['network'],c),O=new Map();for(const P of N){const Q=pickAddr(P);if(Q)O['set'](Q['toLowerCase'](),P);}for(const R of A){const S=pickData(O['get'](String(R)['toLowerCase']()));if(!S)continue;z['push']({'payment':R,'amount':String(S['amount']??'0'),'time':S['time']??'',...S['info']?.['remark']?{'remark':String(S['info']['remark'])}:{},...releasedTo(S,String(d))?{'released_to':releasedTo(S,String(d))}:{}});}}const B=asBigIntOrUndefined(k['amount'])??0x0n,C=s?asBigIntOrUndefined(s['balance']):undefined,D=C!==undefined?B-C:undefined,E=asMsOrUndefined(h),F=[];if(E!==undefined)for(const T of z){const U=asMsOrUndefined(T['time']);U!==undefined&&U>E&&F['push']({'payment':T['payment'],'amount':T['amount'],'time':T['time']});}const G={...e?{'arb_case':e}:{},...f!==undefined?{'arb_status':f}:{},...g!==undefined?{'arb_indemnity':g}:{},'order':d,'order_amount':String(k['amount']),'claimed_by':typeof k['claimed_by']==='string'?k['claimed_by']:null,'progress_node':typeof v?.['current']==='string'&&v['current']!==''?v['current']:null,'allocation':typeof k['allocation']==='string'&&k['allocation']?k['allocation']:null,'allocation_balance':C!==undefined?String(C):null,'escrow_deficit':D!==undefined?String(D):null,'withdraw_history':z,'escrow_payouts_after_case':F,'object_versions':{...i?{'arb_case':i}:{},...l?{'order':l}:{},...x?{'allocation':x}:{},...y?{'progress':y}:{}},'read_consistency':READ_CONSISTENCY,...k['time']!==undefined?{'order_time':k['time']}:{},...h!==undefined?{'case_time':h}:{}},H=['ORDER\x20FUND\x20FACTS\x20(raw\x20units,\x20live\x20read):'];H['push']('-\x20freshness:\x20'+READ_CONSISTENCY),H['push']('-\x20order\x20'+d+':\x20amount='+G['order_amount']);G['allocation']?H['push']('-\x20escrow\x20allocation\x20'+G['allocation']+':\x20balance='+G['allocation_balance']+'\x20(deficit\x20vs\x20amount:\x20'+G['escrow_deficit']+')'):H['push']('-\x20escrow\x20allocation:\x20none\x20(zero-amount\x20order\x20carries\x20no\x20escrow)');H['push']('-\x20compensation\x20claimed_by:\x20'+(G['claimed_by']??'null\x20(unclaimed)')),H['push']('-\x20workflow\x20node:\x20'+(G['progress_node']??'(none)'));if(z['length']>0x0){H['push']('-\x20escrow\x20payouts\x20so\x20far\x20('+z['length']+(A['length']===PAYMENT_HISTORY_CAP?'+':'')+'):');for(const V of z){const W=V['released_to']==='order'?'\x20→\x20order\x20(buyer-side\x20refund)':V['released_to']==='other'?'\x20→\x20NOT\x20the\x20order\x20(merchant/Entity\x20side)':V['released_to']==='mixed'?'\x20→\x20split\x20order\x20+\x20other\x20recipients':'';H['push']('\x20\x20*\x20'+V['amount']+'\x20at\x20'+V['time']+W+(V['remark']?'\x20—\x20'+V['remark']:'')+'\x20['+V['payment']+']');}}if(D!==undefined&&D>0x0n){const X=z['some'](a0=>a0['released_to']===undefined),Y=z['length']>0x0&&z['every'](a0=>a0['released_to']==='order'),Z=z['some'](a0=>a0['released_to']==='other'||a0['released_to']==='mixed');if(Y)H['push']('NET\x20GUIDANCE:\x20the\x20escrow\x20has\x20already\x20paid\x20out\x20'+D+'\x20raw\x20units\x20to\x20the\x20ORDER\x20(buyer-side\x20refund\x20rail,\x20'+'per\x20payout\x20records)\x20—\x20net\x20the\x20indemnity\x20against\x20the\x20refunded\x20principal;\x20compensate\x20the\x20delta,\x20not\x20the\x20full\x20loss.');else Z?H['push']('NET\x20GUIDANCE:\x20the\x20escrow\x20paid\x20out\x20'+D+'\x20raw\x20units\x20but\x20at\x20least\x20one\x20payout\x20went\x20to\x20NON-order\x20recipients\x20'+'(merchant/Entity\x20side\x20—\x20settlement\x20or\x20recover).\x20The\x20buyer\x20received\x20nothing\x20from\x20those;\x20their\x20loss\x20is\x20the\x20FULL\x20'+'price\x20and\x20the\x20indemnity\x20must\x20NOT\x20be\x20reduced\x20by\x20this\x20deficit.'):H['push']('NET\x20GUIDANCE:\x20the\x20escrow\x20has\x20already\x20paid\x20out\x20'+D+'\x20raw\x20units\x20more\x20than\x20it\x20holds'+((X?'\x20(payout\x20polarity\x20unknown\x20for\x20at\x20least\x20one\x20payout\x20—\x20records\x20unreadable)':'')+'.\x20')+'Polarity\x20decides\x20the\x20netting:\x20refunded\x20TO\x20THE\x20ORDER\x20(buyer\x20rail)\x20→\x20net\x20the\x20indemnity\x20against\x20the\x20refunded\x20principal,\x20'+'compensate\x20the\x20delta;\x20released\x20to\x20the\x20MERCHANT\x20side\x20→\x20the\x20buyer\x27s\x20loss\x20is\x20the\x20full\x20price,\x20do\x20NOT\x20reduce\x20the\x20award.\x20'+'Read\x20the\x20Payment\x20records\x20before\x20deciding.');}return G['claimed_by']&&H['push']('NOTE:\x20claimed_by\x20is\x20set\x20—\x20the\x20order\x20has\x20already\x20marked\x20a\x20compensation\x20claim;\x20a\x20further\x20ruling\x20pays\x20on\x20top\x20of\x20any\x20escrow\x20payout.'),F['length']>0x0&&H['push']('ESCROW\x20MOVED\x20DURING\x20THE\x20CASE:\x20'+F['length']+'\x20payout(s)\x20landed\x20after\x20the\x20case\x20was\x20filed\x20'+('(first:\x20'+F[0x0]['amount']+'\x20raw\x20at\x20'+F[0x0]['time']+').\x20')+'Reconcile\x20each\x20with\x20the\x20ruling\x20direction\x20—\x20a\x20sweep\x20that\x20contradicts\x20the\x20award\x20(e.g.\x20a\x20merchant\x20recover\x20on\x20a\x20'+'buyer-favorable\x20ruling)\x20belongs\x20in\x20the\x20ruling\x20text\x20and\x20the\x20parties\x27\x20statements,\x20never\x20in\x20a\x20silent\x20pass.'),H['push']('DUAL-TRACK\x20REMINDER:\x20the\x20escrow\x20track\x20(refund\x20/\x20recover\x20allocators)\x20and\x20this\x20arbitration\x20are\x20INDEPENDENT\x20'+'commercial\x20routes\x20—\x20the\x20protocol\x20deliberately\x20does\x20not\x20couple\x20them,\x20and\x20neither\x20blocks\x20the\x20other.\x20Both\x20are\x20'+'observable\x20here:\x20re-read\x20these\x20facts\x20before\x20you\x20finalize\x20the\x20ruling\x20and\x20again\x20before\x20the\x20indemnity\x20is\x20claimed;\x20'+'an\x20escrow\x20movement\x20that\x20lands\x20after\x20the\x20award\x20is\x20visible\x20in\x20the\x20payout\x20history\x20above.'),{'structured':G,'text':H['join']('\x0a')};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ARB_STATUS_CODE={'Principal_confirming':0x0,'Arbitrator_confirming':0x1,'Voting':0x2,'Arbitrated':0x3,'Objectionable':0x4,'Finished':0x5,'Withdrawn':0x6};export const ARB_TERMINAL_STATUSES=['Finished','Withdrawn'];export const ARB_STATUS_ALIASES={'created':'Principal_confirming','voting':'Voting','feedback':'Arbitrator_confirming','confirmed':'Arbitrated','completed':'Finished','reset':'Objectionable','disputed':'Withdrawn'};export const ARBITRATION_PERMISSIONS=[{'index':0x15e,'name':'ARBITRATION_NEW','description':'Create\x20new\x20Arbitration\x20object','governed_operations':['create\x20a\x20new\x20arbitration\x20service']},{'index':0x15f,'name':'ARBITRATION_DESCRIPTION','description':'Modify\x20Arbitration\x20description','governed_operations':['modify\x20the\x20arbitration\x20description']},{'index':0x160,'name':'ARBITRATION_ENDPOINT','description':'Reserved\x20placeholder\x20—\x20not\x20used\x20on-chain\x20(SDK\x20commented\x20out)','governed_operations':[],'is_reserved':!![]},{'index':0x161,'name':'ARBITRATION_LOCATION','description':'Set\x20Arbitration\x20location','governed_operations':['set\x20the\x20arbitration\x20location']},{'index':0x162,'name':'ARBITRATION_VOTING_GUARD','description':'Manage\x20voting_guard\x20list\x20(add\x20/\x20remove\x20/\x20clear)\x20—\x20controls\x20vote\x20weight','governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list']},{'index':0x163,'name':'ARBITRATION_USAGE_GUARD','description':'Set\x20/\x20clear\x20usage_guard\x20—\x20controls\x20who\x20can\x20file\x20disputes','governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard']},{'index':0x164,'name':'ARBITRATION_PAUSE','description':'Pause\x20/\x20resume\x20Arbitration\x20(bPaused\x20default\x20true)','governed_operations':['pause/resume\x20the\x20arbitration\x20service']},{'index':0x165,'name':'ARBITRATION_FEE','description':'Set\x20dispute\x20application\x20fee\x20(u64)','governed_operations':['set\x20the\x20dispute\x20application\x20fee']},{'index':0x166,'name':'ARBITRATION_VOTE','description':'Cast\x20a\x20vote.\x20With\x20an\x20EMPTY\x20voting_guard\x20this\x20is\x20an\x20equal-weight\x20vote\x20(1\x20person\x201\x20vote)\x20—\x20'+'NOT\x20permissionless:\x20plain\x20voting\x20asserts\x20permission\x20358\x20on\x20the\x20arbitration\x27s\x20bound\x20Permission,\x20'+'whose\x20admin\x20ALWAYS\x20passes\x20the\x20assert\x20(a\x20fresh\x20Permission\x20seeds\x20its\x20creator\x20as\x20the\x20sole\x20admin;\x20'+'the\x20table\x20starts\x20empty).\x20So\x20only\x20the\x20arb-side\x20admin\x20and\x20explicit\x20358\x20grantees\x20can\x20vote\x20—\x20the\x20'+'disputing\x20customer\x20must\x20be\x20GRANTED\x20358\x20first,\x20or\x20voting\x20collapses\x20to\x20admin-only\x20(E-13,\x20test/6)','governed_operations':['cast\x20a\x20vote\x20(empty\x20voting_guard\x20=\x201\x20person\x201\x20vote,\x20permission\x20358\x20still\x20required)','cast\x20a\x20weighted\x20vote\x20via\x20voting_guard\x20(weights\x20resolved\x20per\x20guard)']},{'index':0x167,'name':'ARBITRATION_ARBITRATION','description':'Make\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)','governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)']},{'index':0x168,'name':'ARBITRATION_FEEDBACK','description':'Provide\x20feedback\x20on\x20Arb\x20case','governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case']},{'index':0x169,'name':'ARBITRATION_CONFIRM','description':'Confirm\x20materials\x20submitted\x20by\x20principal\x20(starts\x20voting\x20phase)','governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)']},{'index':0x16a,'name':'ARBITRATION_VOTING_DEADLINE_CHANGE','description':'Change\x20voting\x20deadline\x20for\x20an\x20Arb\x20case','governed_operations':['change\x20the\x20voting\x20deadline\x20for\x20an\x20Arb\x20case']},{'index':0x16b,'name':'ARBITRATION_RESET','description':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials,\x20restart\x20lifecycle','governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)']},{'index':0x16c,'name':'ARBITRATION_ARB_WITHDRAW','description':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance']},{'index':0x16d,'name':'ARBITRATION_FEES_ALLOC','description':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object']},{'index':0x16e,'name':'ARBITRATION_FEES_TRANSFER','description':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object']},{'index':0x16f,'name':'ARBITRATION_OWNER_RECEIVE','description':'Owner\x20receive\x20(unwrap\x20received\x20Coin/Object\x20and\x20send\x20to\x20Permission\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects']},{'index':0x170,'name':'ARBITRATION_UM','description':'Set\x20/\x20clear\x20User\x20Manager\x20(Contact\x20object)','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact']}];export const DUAL_GUARD_MATRIX=[{'voting_guard_empty':!![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote','scenario':'Open\x20dispute\x20+\x20open\x20voting\x20(1\x20person\x201\x20vote)'},{'voting_guard_empty':!![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote','scenario':'Restricted\x20dispute\x20+\x20open\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote_weighted_by_guard','scenario':'Open\x20dispute\x20+\x20weighted\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote_weighted_by_guard','scenario':'Restricted\x20dispute\x20+\x20weighted\x20voting\x20(most\x20controlled)'}];export const ARBITRATION_SCENES=[{'id':'arbitration_create','name':'Create\x20new\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x15e,'permission_name':'ARBITRATION_NEW','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['create\x20a\x20new\x20arbitration\x20service'],'common_patterns':['Pre-publish\x20config:\x20create\x20Arbitration\x20+\x20Permission\x20together','bPaused\x20defaults\x20to\x20true\x20—\x20must\x20call\x20pause(false)\x20to\x20enable','Generic\x20T:\x20choose\x20Coin\x20type\x20(e.g.\x200x2::wow::WOW)\x20at\x20creation','object-linker\x20binding\x20(core):\x20permission\x20+\x20arbitration\x20linked\x20by\x20an\x20affiliation\x20core\x20binding'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_dispute','name':'File\x20dispute\x20against\x20an\x20Order\x20(creates\x20Arb\x20case)','operation_category':'dispute','permission_index':0x0,'permission_name':'(order\x20op\x20permission\x20—\x20no\x20ARBITRATION_*\x20index)','required_arb_status':[],'resulting_arb_status':'Arbitrator_confirming','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['file\x20a\x20dispute\x20against\x20an\x20Order\x20(creates\x20the\x20Arb\x20case)'],'common_patterns':['Fee\x20gate:\x20coin::value(&fee)\x20>=\x20self.fee,\x20else\x20E_FEE_NOT_ENOUGH','Order\x20op\x20permission\x20check\x20required\x20(caller\x20must\x20hold\x20the\x20matching\x20order\x20operation\x20permission)','Creates\x20independent\x20Arb<T>\x20object\x20with\x20its\x20own\x20lifecycle','If\x20usage_guard\x20is\x20Some\x20→\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','Order.dispute\x20list:\x20appends\x20new\x20Arb\x20(max\x2010\x20per\x20Order)','One-shot\x20filing:\x20the\x20Arb\x20is\x20created\x20directly\x20in\x20Arbitrator_confirming\x20status\x20—\x20proposition\x20and\x20description\x20are\x20final\x20at\x20filing;\x20edits\x20require\x20the\x20arbitrator\x20to\x20reset\x20the\x20case\x20back\x20to\x20Principal_confirming\x20first.\x20Assemble\x20the\x20complete\x20proposition\x20before\x20calling\x20dispute.'],'recommended_templates':['T-AB-01','T-AB-03','T-AB-04']},{'id':'arbitration_vote','name':'Vote\x20on\x20Arb\x20propositions','operation_category':'voting','permission_index':0x166,'permission_name':'ARBITRATION_VOTE','required_arb_status':['Voting'],'requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['open\x20a\x20vote\x20(1\x20person\x201\x20vote)','cast\x20a\x20weighted\x20vote\x20(weights\x20resolved\x20from\x20the\x20voting\x20guard)'],'common_patterns':['Open\x20vote:\x20voting_guard\x20empty\x20→\x20plain\x20vote\x20(passport\x20variant\x20supported);\x20equal\x20weight\x20'+'(1\x20person\x201\x20vote)\x20but\x20permission\x20358\x20still\x20gates\x20every\x20NON-admin\x20voter\x20—\x20the\x20bound\x20'+'Permission\x27s\x20admin\x20(its\x20creator,\x20by\x20default)\x20always\x20passes,\x20so\x20grant\x20358\x20to\x20the\x20disputing\x20'+'parties\x20or\x20voting\x20collapses\x20to\x20admin-only\x20(E-13)','Weighted\x20vote:\x20voting_guard\x20non-empty\x20→\x20vote\x20weight\x20resolved\x20per\x20voting\x20guard','votes:\x20u8\x20array\x20—\x20index\x20into\x20proposition\x20list\x20(0..N-1)','Mismatch:\x20vote()\x20with\x20non-empty\x20voting_guard\x20→\x20E_VOTING_GUARD_USED','Guard\x20not\x20in\x20list:\x20E_VOTING_GUARD_NOT_FOUND','E-15:\x20the\x20voting_deadline\x20IS\x20the\x20dispute-resolution\x20delay\x20window\x20—\x20the\x20ruling\x20(arbitration)\x20'+'aborts\x20with\x20E_VOTING_DEADLINE_NOT_PASSED\x20until\x20the\x20deadline\x20elapses.\x20Size\x20the\x20window\x20to\x20the\x20'+'business\x20expectation\x20(e.g.\x2010\x20minutes\x20for\x20tests,\x20days\x20for\x20production)'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_confirm','name':'Confirm\x20principal\x20materials\x20and\x20start\x20voting\x20phase','operation_category':'ruling','permission_index':0x169,'permission_name':'ARBITRATION_CONFIRM','required_arb_status':['Arbitrator_confirming'],'resulting_arb_status':'Voting','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)'],'common_patterns':['Transitions\x20Arb\x20from\x20Arbitrator_confirming\x20→\x20Voting','voting_deadline:\x20u64\x20timestamp_ms\x20(null\x20=\x20no\x20deadline)','Once\x20in\x20Voting,\x20only\x20vote\x20/\x20voting_deadline_change\x20/\x20reset\x20allowed'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_feedback','name':'Provide\x20feedback\x20on\x20Arb\x20case','operation_category':'ruling','permission_index':0x168,'permission_name':'ARBITRATION_FEEDBACK','required_arb_status':['Principal_confirming','Arbitrator_confirming','Voting','Arbitrated','Objectionable'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case'],'common_patterns':['Feedback\x20is\x20informational\x20—\x20does\x20not\x20change\x20Arb\x20status','Used\x20by\x20principal\x20/\x20arbitrator\x20/\x20voters\x20to\x20attach\x20notes','No\x20state\x20transition;\x20supplements\x20the\x20case\x20record'],'recommended_templates':['T-AB-01','T-AB-07']},{'id':'arbitration_ruling','name':'Make\x20definitive\x20arbitration\x20ruling\x20with\x20indemnity','operation_category':'ruling','permission_index':0x167,'permission_name':'ARBITRATION_ARBITRATION','required_arb_status':['Voting'],'resulting_arb_status':'Arbitrated','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)'],'common_patterns':['Ruling\x20produces:\x20feedback\x20(string)\x20+\x20indemnity\x20(u64)','indemnity\x20is\x20compensation\x20amount\x20—\x20paid\x20through\x20the\x20order\x20compensation\x20flow','compensation\x20is\x20package-internal\x20—\x20only\x20the\x20order\x20lifecycle\x20can\x20trigger\x20it','Once\x20Arbitrated,\x20case\x20enters\x20Objectionable\x20window\x20(reset\x20possible)','E-16:\x20the\x20indemnity\x20is\x20paid\x20from\x20the\x20SERVICE\x27s\x20merchant-prepaid\x20compensation_fund\x20pool,\x20'+'NOT\x20from\x20the\x20order\x20escrow.\x20If\x20the\x20pool\x20is\x20smaller\x20than\x20the\x20indemnity,\x20arb_claim_compensation\x20'+'aborts\x20with\x20code\x2027\x20(E_COMPENSATION_NOT_MATCH)\x20—\x20the\x20ruling\x20stands\x20but\x20is\x20unpayable\x20until\x20the\x20'+'merchant\x20tops\x20up\x20(the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim)','E-17/E-17b:\x20the\x20ruling\x20does\x20NOT\x20propagate\x20to\x20the\x20Machine/Allocation\x20escrow,\x20so\x20a\x20settlement\x20'+'forward\x20can\x20still\x20FIRE\x20after\x20a\x20claim.\x20Where\x20the\x20SEAL\x20actually\x20lives\x20(corrected\x20per\x20rex2-261024\x20'+'C-02\x20+\x20order.move\x20source):\x20the\x20escrow\x27s\x20Order-side\x20receive\x20has\x20deliberately\x20NO\x20claimed_by\x20gate\x20'+'(order.move\x20NOTE\x20—\x20principal\x20restitution\x20and\x20damages\x20are\x20two\x20INDEPENDENT\x20tracks;\x20gating\x20receive\x20'+'would\x20strand\x20the\x20principal\x20inside\x20the\x20order.\x20rex2\x20T9\x20live-proven:\x20claim\x20first,\x20then\x20owner_receive\x20'+'extracted\x20the\x20full\x20principal).\x20The\x20mutual\x20exclusion\x20lives\x20at\x20the\x20ALLOCATOR-GUARD\x20layer\x20instead:\x20'+'the\x20merchant\x27s\x20rail\x20pairing\x20—\x20refund\x20rail\x20gated\x20order.claimed_by\x20none\x20+\x20paired\x20recover\x20rail\x20'+'gated\x20claimed_by\x20some\x20(D-BUG-2,\x20template-shipped\x20refund_gate/recover_gate)\x20—\x20is\x20what\x20closes\x20the\x20'+'buyer\x20refund\x20leg\x20once\x20claimed_by\x20is\x20set.\x20That\x20pairing\x20is\x20a\x20MERCHANT\x20choice:\x20a\x20service\x20without\x20it\x20'+'can\x20stack\x20refund\x20+\x20compensation\x20in\x20both\x20directions\x20(rex2\x20T6/T9\x20live\x20double\x20payout,\x20297M\x20>\x20250M\x20'+'principal),\x20which\x20is\x20why\x20the\x20client\x20keeps\x20the\x20acknowledge_dual_payout\x20gate\x20(keeper\x20posture\x20拍板⑧\x20'+'dm-mtw-261027:\x20the\x20flag\x20stays\x20a\x20HUMAN\x20netting\x20decision\x20—\x20an\x20automated\x20keeper\x20refused\x20with\x20'+'dual_payout_unconfirmed\x20must\x20stop\x20and\x20escalate,\x20never\x20self-ack;\x20every\x20refusal\x20envelope\x20carries\x20the\x20'+'KEEPER\x20DIRECTIVE\x20verbatim).\x20claim\x20mechanics:\x20'+'compensate()\x20sets\x20claimed_by\x20when\x20an\x20award\x20is\x20CLAIMED\x20—\x20and\x20since\x20BF-14\x20a\x20zero-award\x20claim\x20aborts\x20'+'E_ZERO_INDEMNITY_CLAIM\x20inside\x20arbitration\x20finalization\x20BEFORE\x20any\x20state\x20change,\x20so\x20a\x20plain\x20dismissal\x20leaves\x20'+'the\x20flag\x20unset\x20and\x20refund\x20rails\x20live.\x20RULED-ZERO\x20SEAL\x20(F-BS-54/56,\x20protocol\x20154\x20'+'enable_arb_dismissal_conclusion_gate):\x20the\x20arbitration\x20conclusion\x20operation\x20stamps\x20claimed_by\x20on\x20a\x20CONCLUDED\x20DISMISSAL\x20'+'(amount-insensitive,\x20BKN-P1\x20decision\x20option\x20a)\x20—\x20on\x20protocol\x20>=\x20154\x20a\x20ruled-zero\x20closes\x20the\x20'+'claimed_by-none\x20refund\x20rails\x20at\x20ruling\x20time\x20and\x20the\x20recover\x20rail\x20becomes\x20the\x20only\x20escrow\x20exit\x20'+'(principal\x20exits\x20to\x20the\x20MERCHANT,\x20not\x20the\x20buyer).\x20On\x20a\x20PRE-154\x20network,\x20or\x20when\x20no\x20keeper\x20runs\x20'+'the\x20arbitration\x20conclusion\x20operation,\x20a\x20ruled-zero\x20does\x20NOT\x20seal:\x20the\x20buyer\x20can\x20lose\x20the\x20arbitration\x20and\x20still\x20walk\x20the\x20'+'refund\x20rail\x20—\x20probe\x20the\x20protocol\x20feature\x20before\x20relying\x20on\x20it.\x20STRANDING\x20IS\x20A\x20SERVICE-SHAPE\x20BUG,\x20'+'NOT\x20A\x20CHAIN\x20RULE:\x20gating\x20a\x20refund\x20rail\x20on\x20claimed_by\x20none\x20while\x20shipping\x20NO\x20recover\x20rail\x20leaves\x20a\x20'+'claimed\x20order\x20with\x20no\x20escrow\x20exit\x20(h1b-tn-261024\x20O11\x20live:\x201.0\x20WOW\x20stranded\x20after\x20a\x20zero-payout\x20'+'dismissal).\x20The\x20compile-time\x20rail\x20verifier\x20blocks\x20that\x20shape\x20pre-publish\x20'+'(RAIL_AWARD_EXIT_MISSING).\x20The\x20pairing\x20guarantees\x20no\x20stranding,\x20not\x20no-misallocation:\x20'+'award-amount\x20polarity\x20is\x20not\x20expressible\x20on\x20the\x20refund\x20track\x20(long-term:\x20N-9\x20order-authority\x20'+'model\x20window)'],'recommended_templates':['T-AB-01','T-AB-05']},{'id':'arbitration_reset','name':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials','operation_category':'ruling','permission_index':0x16b,'permission_name':'ARBITRATION_RESET','required_arb_status':['Objectionable','Arbitrator_confirming'],'resulting_arb_status':'Principal_confirming','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)'],'common_patterns':['Resets\x20Arb\x20from\x20Objectionable/Arbitrator_confirming\x20→\x20Principal_confirming','Used\x20when\x20principal\x20objects\x20to\x20ruling\x20and\x20resubmits\x20materials','Feedback\x20required\x20(string\x20explaining\x20reset\x20reason)','Restart\x20full\x20lifecycle:\x20Principal_confirming\x20→\x20...\x20→\x20Finished'],'recommended_templates':['T-AB-07']},{'id':'arbitration_arb_withdraw','name':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','operation_category':'fund','permission_index':0x16c,'permission_name':'ARBITRATION_ARB_WITHDRAW','required_arb_status':['Finished','Arbitrated'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance'],'common_patterns':['Moves\x20fees\x20from\x20the\x20Arb\x20object\x20into\x20Arbitration.balance\x20(clock-checked)','Finished:\x20withdraw\x20immediately','Arbitrated:\x20must\x20wait\x20WITHDRAW_DURATION_TIME\x20(30d)\x20past\x20indemnity.time\x20—\x20silence\x20=\x20acceptance','Objectionable:\x20NEVER\x20withdrawable\x20(protocol\x20141)\x20—\x20the\x20fee\x20stays\x20escrowed\x20until\x20the\x20objection\x20cycle\x20is\x20closed\x20by\x20the\x20principal\x20re-confirming','Increases\x20Arbitration.balance\x20—\x20funds\x20available\x20for\x20fee\x20allocation/transfer'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_alloc','name':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','operation_category':'fund','permission_index':0x16d,'permission_name':'ARBITRATION_FEES_ALLOC','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object'],'common_patterns':['Destination:\x20Allocation\x20object\x20(parameterized\x20fund\x20distribution)','payment_remark\x20+\x20payment_index:\x20bookkeeping\x20for\x20Payment\x20object','May\x20create\x20new\x20Payment\x20object\x20if\x20newPayment\x20name\x20provided','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_transfer','name':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','operation_category':'fund','permission_index':0x16e,'permission_name':'ARBITRATION_FEES_TRANSFER','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object'],'common_patterns':['Destination:\x20Treasury\x20object\x20(general\x20fund\x20pool)','Same\x20bookkeeping\x20as\x20fee\x20allocation\x20(remark\x20+\x20index\x20+\x20newPayment)','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance','Choose\x20Allocation\x20vs\x20Treasury\x20by\x20distribution\x20need'],'recommended_templates':['T-AB-06']},{'id':'arbitration_voting_guard_config','name':'Configure\x20voting_guard\x20list\x20(add\x20/\x20set\x20/\x20remove\x20/\x20clear)','operation_category':'guard','permission_index':0x162,'permission_name':'ARBITRATION_VOTING_GUARD','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list'],'common_patterns':['Max\x2050\x20guards:\x20MAX_VOTING_GUARD_COUNT=50\x20(off-by-one-safe:\x20len<50\x20allows\x20add)','GuardIdentifier(u8):\x20dynamic\x20weight\x20from\x20Passport\x20submission\x20value','FixedValue(u32):\x20static\x20weight\x20(e.g.\x20100\x20votes\x20per\x20holder)','Add\x20same\x20guard\x20twice\x20→\x20updates\x20vote_weight\x20(no\x20duplicate)','op=\x27set\x27\x20=\x20clear\x20then\x20add;\x20op=\x27add\x27\x20=\x20append;\x20op=\x27remove\x27\x20=\x20by\x20address'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_usage_guard_config','name':'Configure\x20usage_guard\x20(set\x20/\x20clear)','operation_category':'guard','permission_index':0x163,'permission_name':'ARBITRATION_USAGE_GUARD','requires_voting_guard':'not_applicable','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard'],'common_patterns':['Single\x20guard\x20(Option<address>)\x20—\x20not\x20a\x20list','Some(guard):\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','None:\x20dispute\x20can\x20use\x20either\x20variant\x20(no\x20passport\x20needed)','object-linker\x20affiliation\x20change:\x20updates\x20link\x20when\x20guard\x20changes'],'recommended_templates':['T-AB-04']},{'id':'arbitration_pause','name':'Pause\x20/\x20resume\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x164,'permission_name':'ARBITRATION_PAUSE','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['pause/resume\x20the\x20arbitration\x20service'],'common_patterns':['bPaused\x20default\x20true\x20—\x20new\x20Arbitration\x20cannot\x20accept\x20disputes','pause(false)\x20to\x20enable,\x20pause(true)\x20to\x20disable','Paused\x20Arbitration\x20rejects\x20dispute\x20(E_PAUSED)','Does\x20not\x20affect\x20already-open\x20Arb\x20cases'],'recommended_templates':['T-AB-01']},{'id':'arbitration_service_statement','name':'Service\x20(defendant)\x20appends\x20a\x20text\x20statement\x20to\x20the\x20case\x20record','operation_category':'dispute','permission_index':0x141,'permission_name':'SERVICE_ARB_STATEMENT','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['append\x20the\x20seller\x27s\x20text\x20statement\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20the\x20service\x20(ArbStatementEvent)'],'common_patterns':['Defendant-side\x20voice\x20WITHOUT\x20holding\x20the\x20order\x20—\x20the\x20arb/arbitration\x20function\x20family\x20is\x20order-anchored;\x20this\x20entry\x20is\x20service-anchored','PRIMARY\x20evidence\x20channel\x20is\x20Messenger:\x20submit\x20encrypted\x20WTS\x20records\x20of\x20the\x20exchange\x20with\x20the\x20order\x20customer\x20first','This\x20statement\x20is\x20the\x20SECONDARY\x20channel:\x20declare\x20facts\x20or\x20report\x20customer\x20behavior\x20(absence,\x20non-cooperation)\x20on\x20the\x20case\x20record','Event-only:\x20nothing\x20on\x20the\x20Arb\x20object\x20is\x20mutated;\x20the\x20record\x20cannot\x20be\x20rewritten\x20or\x20deleted\x20by\x20any\x20party','Text\x20length\x20cap\x20identical\x20to\x20description/objection\x20(DESCRIPTION\x20bound,\x204000)'],'recommended_templates':[]}];export const ARBITRATION_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return ARBITRATION_SCENES['filter'](b=>b['operation_category']===a);}export function findSceneById(a){return ARBITRATION_SCENES['find'](b=>b['id']===a);}export function findSceneByPermissionIndex(a){return ARBITRATION_SCENES['find'](b=>b['permission_index']===a);}export function getPermissionByIndex(a){return ARBITRATION_PERMISSIONS['find'](b=>b['index']===a);}export function getPermissionByName(a){return ARBITRATION_PERMISSIONS['find'](b=>b['name']===a);}export function isReservedIndex(a){const b=getPermissionByIndex(a);return!!b?.['is_reserved'];}export function isUsedPermissionIndex(a){const b=getPermissionByIndex(a);return!!b&&!b['is_reserved'];}export function getActivePermissionCount(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved'])['length'];}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[{'keywords':['create','new'],'sceneId':'arbitration_create'},{'keywords':['dispute','file','complaint'],'sceneId':'arbitration_dispute'},{'keywords':['vote','voting','decide'],'sceneId':'arbitration_vote'},{'keywords':['confirm','materials'],'sceneId':'arbitration_confirm'},{'keywords':['feedback','opinion'],'sceneId':'arbitration_feedback'},{'keywords':['ruling','arbitration','verdict'],'sceneId':'arbitration_ruling'},{'keywords':['reset','resubmit'],'sceneId':'arbitration_reset'},{'keywords':['arb_withdraw','withdraw','withdraw\x20fees'],'sceneId':'arbitration_arb_withdraw'},{'keywords':['allocate','allocate\x20fees','fees\x20allocation'],'sceneId':'arbitration_fees_alloc'},{'keywords':['fees_transfer','transfer','transfer\x20in'],'sceneId':'arbitration_fees_transfer'},{'keywords':['voting_guard','voting\x20guard'],'sceneId':'arbitration_voting_guard_config'},{'keywords':['usage_guard','usage\x20guard'],'sceneId':'arbitration_usage_guard_config'},{'keywords':['pause','enable'],'sceneId':'arbitration_pause'}];for(const {keywords:d,sceneId:e}of c){if(d['some'](f=>b['includes'](f['toLowerCase']()))){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getDualGuardMatrixEntry(a,b){return DUAL_GUARD_MATRIX['find'](c=>c['voting_guard_empty']===a&&c['usage_guard_empty']===b);}export function isValidArbStatusTransition(a,b){const c={'Principal_confirming':['Arbitrator_confirming'],'Arbitrator_confirming':['Voting','Principal_confirming'],'Voting':['Arbitrated'],'Arbitrated':['Objectionable','Finished','Withdrawn'],'Objectionable':['Principal_confirming'],'Finished':['Withdrawn'],'Withdrawn':[]};return c[a]?.['includes'](b)??![];}export function isTerminalArbStatus(a){return ARB_TERMINAL_STATUSES['includes'](a);}export function getScenesProducingStatus(a){return ARBITRATION_SCENES['filter'](b=>b['resulting_arb_status']===a);}export function getScenesRequiringStatus(a){return ARBITRATION_SCENES['filter'](b=>b['required_arb_status']?.['includes'](a));}export function getArbitrationScenesCount(){return ARBITRATION_SCENES['length'];}export function getAllArbitrationPermissions(){return[...ARBITRATION_PERMISSIONS];}export function getActiveArbitrationPermissions(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved']);}
|
|
1
|
+
export const ARB_STATUS_CODE={'Principal_confirming':0x0,'Arbitrator_confirming':0x1,'Voting':0x2,'Arbitrated':0x3,'Objectionable':0x4,'Finished':0x5,'Withdrawn':0x6};export const ARB_TERMINAL_STATUSES=['Finished','Withdrawn'];export const ARB_STATUS_ALIASES={'created':'Principal_confirming','voting':'Voting','feedback':'Arbitrator_confirming','confirmed':'Arbitrated','completed':'Finished','reset':'Objectionable','disputed':'Withdrawn'};export const ARBITRATION_PERMISSIONS=[{'index':0x15e,'name':'ARBITRATION_NEW','description':'Create\x20new\x20Arbitration\x20object','governed_operations':['create\x20a\x20new\x20arbitration\x20service']},{'index':0x15f,'name':'ARBITRATION_DESCRIPTION','description':'Modify\x20Arbitration\x20description','governed_operations':['modify\x20the\x20arbitration\x20description']},{'index':0x160,'name':'ARBITRATION_ENDPOINT','description':'Reserved\x20placeholder\x20—\x20not\x20used\x20on-chain\x20(SDK\x20commented\x20out)','governed_operations':[],'is_reserved':!![]},{'index':0x161,'name':'ARBITRATION_LOCATION','description':'Set\x20Arbitration\x20location','governed_operations':['set\x20the\x20arbitration\x20location']},{'index':0x162,'name':'ARBITRATION_VOTING_GUARD','description':'Manage\x20voting_guard\x20list\x20(add\x20/\x20remove\x20/\x20clear)\x20—\x20controls\x20vote\x20weight','governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list']},{'index':0x163,'name':'ARBITRATION_USAGE_GUARD','description':'Set\x20/\x20clear\x20usage_guard\x20—\x20controls\x20who\x20can\x20file\x20disputes','governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard']},{'index':0x164,'name':'ARBITRATION_PAUSE','description':'Pause\x20/\x20resume\x20Arbitration\x20(bPaused\x20default\x20true)','governed_operations':['pause/resume\x20the\x20arbitration\x20service']},{'index':0x165,'name':'ARBITRATION_FEE','description':'Set\x20dispute\x20application\x20fee\x20(u64)','governed_operations':['set\x20the\x20dispute\x20application\x20fee']},{'index':0x166,'name':'ARBITRATION_VOTE','description':'Cast\x20a\x20vote.\x20With\x20an\x20EMPTY\x20voting_guard\x20this\x20is\x20an\x20equal-weight\x20vote\x20(1\x20person\x201\x20vote)\x20—\x20'+'NOT\x20permissionless:\x20plain\x20voting\x20asserts\x20permission\x20358\x20on\x20the\x20arbitration\x27s\x20bound\x20Permission,\x20'+'whose\x20admin\x20ALWAYS\x20passes\x20the\x20assert\x20(a\x20fresh\x20Permission\x20seeds\x20its\x20creator\x20as\x20the\x20sole\x20admin;\x20'+'the\x20table\x20starts\x20empty).\x20So\x20only\x20the\x20arb-side\x20admin\x20and\x20explicit\x20358\x20grantees\x20can\x20vote\x20—\x20the\x20'+'disputing\x20customer\x20must\x20be\x20GRANTED\x20358\x20first,\x20or\x20voting\x20collapses\x20to\x20admin-only\x20(E-13,\x20test/6)','governed_operations':['cast\x20a\x20vote\x20(empty\x20voting_guard\x20=\x201\x20person\x201\x20vote,\x20permission\x20358\x20still\x20required)','cast\x20a\x20weighted\x20vote\x20via\x20voting_guard\x20(weights\x20resolved\x20per\x20guard)']},{'index':0x167,'name':'ARBITRATION_ARBITRATION','description':'Make\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)','governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)']},{'index':0x168,'name':'ARBITRATION_FEEDBACK','description':'Provide\x20feedback\x20on\x20Arb\x20case','governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case']},{'index':0x169,'name':'ARBITRATION_CONFIRM','description':'Confirm\x20materials\x20submitted\x20by\x20principal\x20(starts\x20voting\x20phase)','governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)']},{'index':0x16a,'name':'ARBITRATION_VOTING_DEADLINE_CHANGE','description':'Change\x20voting\x20deadline\x20for\x20an\x20Arb\x20case','governed_operations':['change\x20the\x20voting\x20deadline\x20for\x20an\x20Arb\x20case']},{'index':0x16b,'name':'ARBITRATION_RESET','description':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials,\x20restart\x20lifecycle','governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)']},{'index':0x16c,'name':'ARBITRATION_ARB_WITHDRAW','description':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance']},{'index':0x16d,'name':'ARBITRATION_FEES_ALLOC','description':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object']},{'index':0x16e,'name':'ARBITRATION_FEES_TRANSFER','description':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object']},{'index':0x16f,'name':'ARBITRATION_OWNER_RECEIVE','description':'Owner\x20receive\x20(unwrap\x20received\x20Coin/Object\x20and\x20send\x20to\x20Permission\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects']},{'index':0x170,'name':'ARBITRATION_UM','description':'Set\x20/\x20clear\x20User\x20Manager\x20(Contact\x20object)','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact']}];export const DUAL_GUARD_MATRIX=[{'voting_guard_empty':!![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote','scenario':'Open\x20dispute\x20+\x20open\x20voting\x20(1\x20person\x201\x20vote)'},{'voting_guard_empty':!![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote','scenario':'Restricted\x20dispute\x20+\x20open\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote_weighted_by_guard','scenario':'Open\x20dispute\x20+\x20weighted\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote_weighted_by_guard','scenario':'Restricted\x20dispute\x20+\x20weighted\x20voting\x20(most\x20controlled)'}];export const ARBITRATION_SCENES=[{'id':'arbitration_create','name':'Create\x20new\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x15e,'permission_name':'ARBITRATION_NEW','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['create\x20a\x20new\x20arbitration\x20service'],'common_patterns':['Pre-publish\x20config:\x20create\x20Arbitration\x20+\x20Permission\x20together','bPaused\x20defaults\x20to\x20true\x20—\x20must\x20call\x20pause(false)\x20to\x20enable','Generic\x20T:\x20choose\x20Coin\x20type\x20(e.g.\x200x2::wow::WOW)\x20at\x20creation','object-linker\x20binding\x20(core):\x20permission\x20+\x20arbitration\x20linked\x20by\x20an\x20affiliation\x20core\x20binding'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_dispute','name':'File\x20dispute\x20against\x20an\x20Order\x20(creates\x20Arb\x20case)','operation_category':'dispute','permission_index':0x0,'permission_name':'(order\x20op\x20permission\x20—\x20no\x20ARBITRATION_*\x20index)','required_arb_status':[],'resulting_arb_status':'Arbitrator_confirming','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['file\x20a\x20dispute\x20against\x20an\x20Order\x20(creates\x20the\x20Arb\x20case)'],'common_patterns':['Fee\x20gate:\x20coin::value(&fee)\x20>=\x20self.fee,\x20else\x20E_FEE_NOT_ENOUGH','Order\x20op\x20permission\x20check\x20required\x20(caller\x20must\x20hold\x20the\x20matching\x20order\x20operation\x20permission)','Creates\x20independent\x20Arb<T>\x20object\x20with\x20its\x20own\x20lifecycle','If\x20usage_guard\x20is\x20Some\x20→\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','Order.dispute\x20list:\x20appends\x20new\x20Arb\x20(max\x2010\x20per\x20Order)','One-shot\x20filing:\x20the\x20Arb\x20is\x20created\x20directly\x20in\x20Arbitrator_confirming\x20status\x20—\x20proposition\x20and\x20description\x20are\x20final\x20at\x20filing;\x20edits\x20require\x20the\x20arbitrator\x20to\x20reset\x20the\x20case\x20back\x20to\x20Principal_confirming\x20first.\x20Assemble\x20the\x20complete\x20proposition\x20before\x20calling\x20dispute.'],'recommended_templates':['T-AB-01','T-AB-03','T-AB-04']},{'id':'arbitration_vote','name':'Vote\x20on\x20Arb\x20propositions','operation_category':'voting','permission_index':0x166,'permission_name':'ARBITRATION_VOTE','required_arb_status':['Voting'],'requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['open\x20a\x20vote\x20(1\x20person\x201\x20vote)','cast\x20a\x20weighted\x20vote\x20(weights\x20resolved\x20from\x20the\x20voting\x20guard)'],'common_patterns':['Open\x20vote:\x20voting_guard\x20empty\x20→\x20plain\x20vote\x20(passport\x20variant\x20supported);\x20equal\x20weight\x20'+'(1\x20person\x201\x20vote)\x20but\x20permission\x20358\x20still\x20gates\x20every\x20NON-admin\x20voter\x20—\x20the\x20bound\x20'+'Permission\x27s\x20admin\x20(its\x20creator,\x20by\x20default)\x20always\x20passes,\x20so\x20grant\x20358\x20to\x20the\x20disputing\x20'+'parties\x20or\x20voting\x20collapses\x20to\x20admin-only\x20(E-13)','Weighted\x20vote:\x20voting_guard\x20non-empty\x20→\x20vote\x20weight\x20resolved\x20per\x20voting\x20guard','votes:\x20u8\x20array\x20—\x20index\x20into\x20proposition\x20list\x20(0..N-1)','Mismatch:\x20vote()\x20with\x20non-empty\x20voting_guard\x20→\x20E_VOTING_GUARD_USED','Guard\x20not\x20in\x20list:\x20E_VOTING_GUARD_NOT_FOUND','E-15:\x20the\x20voting_deadline\x20IS\x20the\x20dispute-resolution\x20delay\x20window\x20—\x20the\x20ruling\x20(arbitration)\x20'+'aborts\x20with\x20E_VOTING_DEADLINE_NOT_PASSED\x20until\x20the\x20deadline\x20elapses.\x20Size\x20the\x20window\x20to\x20the\x20'+'business\x20expectation\x20(e.g.\x2010\x20minutes\x20for\x20tests,\x20days\x20for\x20production)'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_confirm','name':'Confirm\x20principal\x20materials\x20and\x20start\x20voting\x20phase','operation_category':'ruling','permission_index':0x169,'permission_name':'ARBITRATION_CONFIRM','required_arb_status':['Arbitrator_confirming'],'resulting_arb_status':'Voting','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)'],'common_patterns':['Transitions\x20Arb\x20from\x20Arbitrator_confirming\x20→\x20Voting','voting_deadline:\x20u64\x20timestamp_ms\x20(null\x20=\x20no\x20deadline)','Once\x20in\x20Voting,\x20only\x20vote\x20/\x20voting_deadline_change\x20/\x20reset\x20allowed'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_feedback','name':'Provide\x20feedback\x20on\x20Arb\x20case','operation_category':'ruling','permission_index':0x168,'permission_name':'ARBITRATION_FEEDBACK','required_arb_status':['Principal_confirming','Arbitrator_confirming','Voting','Arbitrated','Objectionable'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case'],'common_patterns':['Feedback\x20is\x20informational\x20—\x20does\x20not\x20change\x20Arb\x20status','Used\x20by\x20principal\x20/\x20arbitrator\x20/\x20voters\x20to\x20attach\x20notes','No\x20state\x20transition;\x20supplements\x20the\x20case\x20record'],'recommended_templates':['T-AB-01','T-AB-07']},{'id':'arbitration_ruling','name':'Make\x20definitive\x20arbitration\x20ruling\x20with\x20indemnity','operation_category':'ruling','permission_index':0x167,'permission_name':'ARBITRATION_ARBITRATION','required_arb_status':['Voting'],'resulting_arb_status':'Arbitrated','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)'],'common_patterns':['Ruling\x20produces:\x20feedback\x20(string)\x20+\x20indemnity\x20(u64)','indemnity\x20is\x20compensation\x20amount\x20—\x20paid\x20through\x20the\x20order\x20compensation\x20flow','compensation\x20is\x20package-internal\x20—\x20only\x20the\x20order\x20lifecycle\x20can\x20trigger\x20it','Once\x20Arbitrated,\x20case\x20enters\x20Objectionable\x20window\x20(reset\x20possible)','E-16:\x20the\x20indemnity\x20is\x20paid\x20from\x20the\x20SERVICE\x27s\x20merchant-prepaid\x20compensation_fund\x20pool,\x20'+'NOT\x20from\x20the\x20order\x20escrow.\x20If\x20the\x20pool\x20is\x20smaller\x20than\x20the\x20indemnity,\x20arb_claim_compensation\x20'+'aborts\x20with\x20code\x2027\x20(E_COMPENSATION_NOT_MATCH)\x20—\x20the\x20ruling\x20stands\x20but\x20is\x20unpayable\x20until\x20the\x20'+'merchant\x20tops\x20up\x20(the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim)','E-17/E-17b:\x20the\x20ruling\x20does\x20NOT\x20propagate\x20to\x20the\x20Machine/Allocation\x20escrow,\x20so\x20a\x20settlement\x20'+'forward\x20can\x20still\x20FIRE\x20after\x20a\x20claim.\x20Where\x20the\x20SEAL\x20actually\x20lives\x20(corrected\x20per\x20rex2-261024\x20'+'C-02):\x20the\x20escrow\x27s\x20Order-side\x20receive\x20has\x20deliberately\x20NO\x20claimed_by\x20gate\x20'+'(on-chain\x20note\x20—\x20principal\x20restitution\x20and\x20damages\x20are\x20two\x20INDEPENDENT\x20tracks;\x20gating\x20receive\x20'+'would\x20strand\x20the\x20principal\x20inside\x20the\x20order.\x20rex2\x20T9\x20live-proven:\x20claim\x20first,\x20then\x20owner_receive\x20'+'extracted\x20the\x20full\x20principal).\x20The\x20mutual\x20exclusion\x20lives\x20at\x20the\x20ALLOCATOR-GUARD\x20layer\x20instead:\x20'+'the\x20merchant\x27s\x20rail\x20pairing\x20—\x20refund\x20rail\x20gated\x20order.claimed_by\x20none\x20+\x20paired\x20recover\x20rail\x20'+'gated\x20claimed_by\x20some\x20(D-BUG-2,\x20template-shipped\x20refund_gate/recover_gate)\x20—\x20is\x20what\x20closes\x20the\x20'+'buyer\x20refund\x20leg\x20once\x20claimed_by\x20is\x20set.\x20That\x20pairing\x20is\x20a\x20MERCHANT\x20choice:\x20a\x20service\x20without\x20it\x20'+'can\x20stack\x20refund\x20+\x20compensation\x20in\x20both\x20directions\x20(rex2\x20T6/T9\x20live\x20double\x20payout,\x20297M\x20>\x20250M\x20'+'principal),\x20which\x20is\x20why\x20the\x20client\x20keeps\x20the\x20acknowledge_dual_payout\x20gate\x20(keeper\x20posture\x20拍板⑧\x20'+'dm-mtw-261027:\x20the\x20flag\x20stays\x20a\x20HUMAN\x20netting\x20decision\x20—\x20an\x20automated\x20keeper\x20refused\x20with\x20'+'dual_payout_unconfirmed\x20must\x20stop\x20and\x20escalate,\x20never\x20self-ack;\x20every\x20refusal\x20envelope\x20carries\x20the\x20'+'KEEPER\x20DIRECTIVE\x20verbatim).\x20claim\x20mechanics:\x20'+'compensate()\x20sets\x20claimed_by\x20when\x20an\x20award\x20is\x20CLAIMED\x20—\x20and\x20since\x20BF-14\x20a\x20zero-award\x20claim\x20aborts\x20'+'E_ZERO_INDEMNITY_CLAIM\x20inside\x20arbitration\x20finalization\x20BEFORE\x20any\x20state\x20change,\x20so\x20a\x20plain\x20dismissal\x20leaves\x20'+'the\x20flag\x20unset\x20and\x20refund\x20rails\x20live.\x20RULED-ZERO\x20SEAL\x20(F-BS-54/56,\x20protocol\x20154\x20'+'enable_arb_dismissal_conclusion_gate):\x20the\x20arbitration\x20conclusion\x20operation\x20stamps\x20claimed_by\x20on\x20a\x20CONCLUDED\x20DISMISSAL\x20'+'(amount-insensitive,\x20BKN-P1\x20decision\x20option\x20a)\x20—\x20on\x20protocol\x20>=\x20154\x20a\x20ruled-zero\x20closes\x20the\x20'+'claimed_by-none\x20refund\x20rails\x20at\x20ruling\x20time\x20and\x20the\x20recover\x20rail\x20becomes\x20the\x20only\x20escrow\x20exit\x20'+'(principal\x20exits\x20to\x20the\x20MERCHANT,\x20not\x20the\x20buyer).\x20On\x20a\x20PRE-154\x20network,\x20or\x20when\x20no\x20keeper\x20runs\x20'+'the\x20arbitration\x20conclusion\x20operation,\x20a\x20ruled-zero\x20does\x20NOT\x20seal:\x20the\x20buyer\x20can\x20lose\x20the\x20arbitration\x20and\x20still\x20walk\x20the\x20'+'refund\x20rail\x20—\x20probe\x20the\x20protocol\x20feature\x20before\x20relying\x20on\x20it.\x20STRANDING\x20IS\x20A\x20SERVICE-SHAPE\x20BUG,\x20'+'NOT\x20A\x20CHAIN\x20RULE:\x20gating\x20a\x20refund\x20rail\x20on\x20claimed_by\x20none\x20while\x20shipping\x20NO\x20recover\x20rail\x20leaves\x20a\x20'+'claimed\x20order\x20with\x20no\x20escrow\x20exit\x20(h1b-tn-261024\x20O11\x20live:\x201.0\x20WOW\x20stranded\x20after\x20a\x20zero-payout\x20'+'dismissal).\x20The\x20compile-time\x20rail\x20verifier\x20blocks\x20that\x20shape\x20pre-publish\x20'+'(RAIL_AWARD_EXIT_MISSING).\x20The\x20pairing\x20guarantees\x20no\x20stranding,\x20not\x20no-misallocation:\x20'+'award-amount\x20polarity\x20is\x20not\x20expressible\x20on\x20the\x20refund\x20track\x20(long-term:\x20N-9\x20order-authority\x20'+'model\x20window)'],'recommended_templates':['T-AB-01','T-AB-05']},{'id':'arbitration_reset','name':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials','operation_category':'ruling','permission_index':0x16b,'permission_name':'ARBITRATION_RESET','required_arb_status':['Objectionable','Arbitrator_confirming'],'resulting_arb_status':'Principal_confirming','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)'],'common_patterns':['Resets\x20Arb\x20from\x20Objectionable/Arbitrator_confirming\x20→\x20Principal_confirming','Used\x20when\x20principal\x20objects\x20to\x20ruling\x20and\x20resubmits\x20materials','Feedback\x20required\x20(string\x20explaining\x20reset\x20reason)','Restart\x20full\x20lifecycle:\x20Principal_confirming\x20→\x20...\x20→\x20Finished'],'recommended_templates':['T-AB-07']},{'id':'arbitration_arb_withdraw','name':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','operation_category':'fund','permission_index':0x16c,'permission_name':'ARBITRATION_ARB_WITHDRAW','required_arb_status':['Finished','Arbitrated'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance'],'common_patterns':['Moves\x20fees\x20from\x20the\x20Arb\x20object\x20into\x20Arbitration.balance\x20(clock-checked)','Finished:\x20withdraw\x20immediately','Arbitrated:\x20must\x20wait\x20WITHDRAW_DURATION_TIME\x20(30d)\x20past\x20indemnity.time\x20—\x20silence\x20=\x20acceptance','Objectionable:\x20NEVER\x20withdrawable\x20(protocol\x20141)\x20—\x20the\x20fee\x20stays\x20escrowed\x20until\x20the\x20objection\x20cycle\x20is\x20closed\x20by\x20the\x20principal\x20re-confirming','Increases\x20Arbitration.balance\x20—\x20funds\x20available\x20for\x20fee\x20allocation/transfer'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_alloc','name':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','operation_category':'fund','permission_index':0x16d,'permission_name':'ARBITRATION_FEES_ALLOC','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object'],'common_patterns':['Destination:\x20Allocation\x20object\x20(parameterized\x20fund\x20distribution)','payment_remark\x20+\x20payment_index:\x20bookkeeping\x20for\x20Payment\x20object','May\x20create\x20new\x20Payment\x20object\x20if\x20newPayment\x20name\x20provided','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_transfer','name':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','operation_category':'fund','permission_index':0x16e,'permission_name':'ARBITRATION_FEES_TRANSFER','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object'],'common_patterns':['Destination:\x20Treasury\x20object\x20(general\x20fund\x20pool)','Same\x20bookkeeping\x20as\x20fee\x20allocation\x20(remark\x20+\x20index\x20+\x20newPayment)','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance','Choose\x20Allocation\x20vs\x20Treasury\x20by\x20distribution\x20need'],'recommended_templates':['T-AB-06']},{'id':'arbitration_voting_guard_config','name':'Configure\x20voting_guard\x20list\x20(add\x20/\x20set\x20/\x20remove\x20/\x20clear)','operation_category':'guard','permission_index':0x162,'permission_name':'ARBITRATION_VOTING_GUARD','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list'],'common_patterns':['Max\x2050\x20guards:\x20MAX_VOTING_GUARD_COUNT=50\x20(off-by-one-safe:\x20len<50\x20allows\x20add)','GuardIdentifier(u8):\x20dynamic\x20weight\x20from\x20Passport\x20submission\x20value','FixedValue(u32):\x20static\x20weight\x20(e.g.\x20100\x20votes\x20per\x20holder)','Add\x20same\x20guard\x20twice\x20→\x20updates\x20vote_weight\x20(no\x20duplicate)','op=\x27set\x27\x20=\x20clear\x20then\x20add;\x20op=\x27add\x27\x20=\x20append;\x20op=\x27remove\x27\x20=\x20by\x20address'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_usage_guard_config','name':'Configure\x20usage_guard\x20(set\x20/\x20clear)','operation_category':'guard','permission_index':0x163,'permission_name':'ARBITRATION_USAGE_GUARD','requires_voting_guard':'not_applicable','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard'],'common_patterns':['Single\x20guard\x20(Option<address>)\x20—\x20not\x20a\x20list','Some(guard):\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','None:\x20dispute\x20can\x20use\x20either\x20variant\x20(no\x20passport\x20needed)','object-linker\x20affiliation\x20change:\x20updates\x20link\x20when\x20guard\x20changes'],'recommended_templates':['T-AB-04']},{'id':'arbitration_pause','name':'Pause\x20/\x20resume\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x164,'permission_name':'ARBITRATION_PAUSE','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['pause/resume\x20the\x20arbitration\x20service'],'common_patterns':['bPaused\x20default\x20true\x20—\x20new\x20Arbitration\x20cannot\x20accept\x20disputes','pause(false)\x20to\x20enable,\x20pause(true)\x20to\x20disable','Paused\x20Arbitration\x20rejects\x20dispute\x20(E_PAUSED)','Does\x20not\x20affect\x20already-open\x20Arb\x20cases'],'recommended_templates':['T-AB-01']},{'id':'arbitration_service_statement','name':'Service\x20(defendant)\x20appends\x20a\x20text\x20statement\x20to\x20the\x20case\x20record','operation_category':'dispute','permission_index':0x141,'permission_name':'SERVICE_ARB_STATEMENT','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['append\x20the\x20seller\x27s\x20text\x20statement\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20the\x20service\x20(ArbStatementEvent)'],'common_patterns':['Defendant-side\x20voice\x20WITHOUT\x20holding\x20the\x20order\x20—\x20the\x20arb/arbitration\x20function\x20family\x20is\x20order-anchored;\x20this\x20entry\x20is\x20service-anchored','PRIMARY\x20evidence\x20channel\x20is\x20Messenger:\x20submit\x20encrypted\x20WTS\x20records\x20of\x20the\x20exchange\x20with\x20the\x20order\x20customer\x20first','This\x20statement\x20is\x20the\x20SECONDARY\x20channel:\x20declare\x20facts\x20or\x20report\x20customer\x20behavior\x20(absence,\x20non-cooperation)\x20on\x20the\x20case\x20record','Event-only:\x20nothing\x20on\x20the\x20Arb\x20object\x20is\x20mutated;\x20the\x20record\x20cannot\x20be\x20rewritten\x20or\x20deleted\x20by\x20any\x20party','Text\x20length\x20cap\x20identical\x20to\x20description/objection\x20(DESCRIPTION\x20bound,\x204000)'],'recommended_templates':[]}];export const ARBITRATION_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return ARBITRATION_SCENES['filter'](b=>b['operation_category']===a);}export function findSceneById(a){return ARBITRATION_SCENES['find'](b=>b['id']===a);}export function findSceneByPermissionIndex(a){return ARBITRATION_SCENES['find'](b=>b['permission_index']===a);}export function getPermissionByIndex(a){return ARBITRATION_PERMISSIONS['find'](b=>b['index']===a);}export function getPermissionByName(a){return ARBITRATION_PERMISSIONS['find'](b=>b['name']===a);}export function isReservedIndex(a){const b=getPermissionByIndex(a);return!!b?.['is_reserved'];}export function isUsedPermissionIndex(a){const b=getPermissionByIndex(a);return!!b&&!b['is_reserved'];}export function getActivePermissionCount(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved'])['length'];}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[{'keywords':['create','new'],'sceneId':'arbitration_create'},{'keywords':['dispute','file','complaint'],'sceneId':'arbitration_dispute'},{'keywords':['vote','voting','decide'],'sceneId':'arbitration_vote'},{'keywords':['confirm','materials'],'sceneId':'arbitration_confirm'},{'keywords':['feedback','opinion'],'sceneId':'arbitration_feedback'},{'keywords':['ruling','arbitration','verdict'],'sceneId':'arbitration_ruling'},{'keywords':['reset','resubmit'],'sceneId':'arbitration_reset'},{'keywords':['arb_withdraw','withdraw','withdraw\x20fees'],'sceneId':'arbitration_arb_withdraw'},{'keywords':['allocate','allocate\x20fees','fees\x20allocation'],'sceneId':'arbitration_fees_alloc'},{'keywords':['fees_transfer','transfer','transfer\x20in'],'sceneId':'arbitration_fees_transfer'},{'keywords':['voting_guard','voting\x20guard'],'sceneId':'arbitration_voting_guard_config'},{'keywords':['usage_guard','usage\x20guard'],'sceneId':'arbitration_usage_guard_config'},{'keywords':['pause','enable'],'sceneId':'arbitration_pause'}];for(const {keywords:d,sceneId:e}of c){if(d['some'](f=>b['includes'](f['toLowerCase']()))){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getDualGuardMatrixEntry(a,b){return DUAL_GUARD_MATRIX['find'](c=>c['voting_guard_empty']===a&&c['usage_guard_empty']===b);}export function isValidArbStatusTransition(a,b){const c={'Principal_confirming':['Arbitrator_confirming'],'Arbitrator_confirming':['Voting','Principal_confirming'],'Voting':['Arbitrated'],'Arbitrated':['Objectionable','Finished','Withdrawn'],'Objectionable':['Principal_confirming'],'Finished':['Withdrawn'],'Withdrawn':[]};return c[a]?.['includes'](b)??![];}export function isTerminalArbStatus(a){return ARB_TERMINAL_STATUSES['includes'](a);}export function getScenesProducingStatus(a){return ARBITRATION_SCENES['filter'](b=>b['resulting_arb_status']===a);}export function getScenesRequiringStatus(a){return ARBITRATION_SCENES['filter'](b=>b['required_arb_status']?.['includes'](a));}export function getArbitrationScenesCount(){return ARBITRATION_SCENES['length'];}export function getAllArbitrationPermissions(){return[...ARBITRATION_PERMISSIONS];}export function getActiveArbitrationPermissions(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved']);}
|
|
@@ -110,4 +110,5 @@ export interface ArbitrationRiskAssessment {
|
|
|
110
110
|
stakeholder_advice: Partial<Record<ArbitrationStakeholder, string[]>>;
|
|
111
111
|
needs_human_review: boolean;
|
|
112
112
|
}
|
|
113
|
+
export declare function disputeFeeReconciliation(venueFee: unknown, attachedFee: unknown): string;
|
|
113
114
|
export declare function assessArbitrationRisks(ctx: RiskCheckContext): ArbitrationRiskAssessment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MAX_VOTING_GUARD_COUNT}from'@wowok/wowok';import{getJudgmentDoc,factoryRulePack}from'../config/judgment.js';import{evaluateRuleBook}from'../config/rule-engine.js';import{isTerminalArbStatus,isValidArbStatusTransition}from'./arbitration-ledger.js';const U8_MAX=0xff,U32_MAX=0xffffffff;export function arbitrationRiskFacts(a){const b=a['voting_guard'],c=!!b&&(b['op']==='add'||b['op']==='set'),d=c?b['op']==='set'?b['guards']['length']:(a['current_voting_guard_count']??0x0)+b['guards']['length']:undefined;let e,f;if(c)for(const F of b['guards']){const G=F??{},H=G['vote_weight'];if(!H||typeof H!=='object')continue;if('GuardIdentifier'in H&&H['GuardIdentifier']!==undefined&&Number(H['GuardIdentifier'])>U8_MAX){e=Number(H['GuardIdentifier']);break;}if('FixedValue'in H&&H['FixedValue']!==undefined&&Number(H['FixedValue'])>U32_MAX){f=Number(H['FixedValue']);break;}}let h=![],i,j,k;if(c){const I=b['guards'];if(I['length']>=0x2){const J=I['filter'](K=>{const L=K?.['vote_weight'];return!!L&&typeof L==='object'&&'FixedValue'in L&&L['FixedValue']!==undefined;})['map'](K=>Number(K['vote_weight']['FixedValue']));if(J['length']>0x0){const K=J['reduce']((M,N)=>M+N,0x0),L=Math['max'](...J);K>0x0&&L/K>0.5&&(h=!![],i=L,j=K,k=(L/K*0x64)['toFixed'](0x1));}}}let l=![],m,n;if(a['dispute']&&a['current_arbitration_fee']!==undefined)try{const M=BigInt(a['current_arbitration_fee']),N=a['dispute']['fee'],O=typeof N==='object'&&N!==null&&'balance'in N?BigInt(N['balance']??0x0):BigInt(0x0);m=O['toString'](),n=M['toString'](),l=O<M;}catch{}const o=!!a['dispute'],p=a['confirm']?.['voting_deadline']??a['voting_deadline_change']?.['voting_deadline'],q=a['current_timestamp_ms'],r=p!==undefined&&p!==null&&q!==undefined&&p<q,s=a['vote']?.['voting_guard'],t=a['current_voting_guard_addresses'],u=!t||t['length']===0x0,v=!!a['vote'],x=a['current_arb_status'],y=a['expected_arb_status'],z=!!x&&!!y&&x!==y&&!isValidArbStatusTransition(x,y),A=!!x&&isTerminalArbStatus(x),B=A&&!a['arb_withdraw']&&!!(a['vote']||a['confirm']||a['arbitration']||a['reset']||a['feedback']),C=a['reset']?String(a['reset']['arb']):undefined;let D,E;if(a['fees_transfer']){const P=a['fees_transfer']['to']??{};D='allocation'in P?'Allocation\x20'+P['allocation']:'Treasury\x20'+P['treasury'],E=String(a['fees_transfer']['payment_remark']);}return{'voting_guard_add_set':c,'voting_guard_new_count':d,'max_voting_guard_count':MAX_VOTING_GUARD_COUNT,'voting_guard_count_exceeded':d!==undefined&&d>MAX_VOTING_GUARD_COUNT,'weight_guard_identifier_over':e!==undefined,'weight_guard_identifier_value':e,'weight_fixed_over':f!==undefined,'weight_fixed_value':f,'weight_collusion_dominant':h,'weight_max':i,'weight_total':j,'weight_ratio_pct':k,'dispute_present':o,'dispute_fee_insufficient':l,'dispute_fee_provided':m,'arbitration_fee_required':n,'current_bPaused':a['current_bPaused'],'voting_deadline_selected':p??undefined,'current_timestamp_ms':q,'voting_deadline_in_past':r,'vote_voting_guard':s,'voting_guard_list_empty':u,'vote_present':v,'vote_guard_registered':!u&&s!==undefined?t['includes'](s):![],'registered_voting_guards':!u?t['join'](','):undefined,'builder':a['builder'],'arbitration_op_present':!!a['arbitration'],'current_arb_status':x,'expected_arb_status':y,'arb_transition_invalid':z,'arb_status_terminal':A,'arb_terminal_op_blocked':B,'reset_present':!!a['reset'],'reset_arb':C,'fees_transfer_present':!!a['fees_transfer'],'fees_transfer_dest':D,'fees_transfer_remark':E,'dispute_order':a['dispute']?String(a['dispute']['order']):undefined};}function arbitrationRuleBook(){const a=getJudgmentDoc()['rules']['domains']['arbitration'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27arbitration\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}function findingToArbitrationRisk(a){return{'id':a['rule_id'],'level':a['level'],'category':a['dimension']??'structural','title':a['title'],'description':a['description'],'affected_stakeholders':a['stakeholders']??[],'scenario':a['scenario']??'','mitigation':a['mitigation']??'','evidence':a['evidence'],...a['exposure']!=null?{'exposure':a['exposure']}:{}};}export const ARBITRATION_RISK_VERSION='1.0.0';export function getAllRiskRules(){const a=factoryRulePack('arbitration');if(!a)return[];return a['rules']['map'](b=>({'id':b['rule_id'],'category':b['dimension']??'structural','trigger':b['trigger']??'','check':c=>{const {findings:d}=evaluateRuleBook([b],arbitrationRiskFacts(c));return d['length']>0x0?findingToArbitrationRisk(d[0x0]):null;}}));}export function assessArbitrationRisks(a){const {findings:b}=evaluateRuleBook(arbitrationRuleBook(),arbitrationRiskFacts(a)),c=b['map'](findingToArbitrationRisk),d=c['length']===0x0?'low':c['some'](g=>g['level']==='critical')?'critical':c['some'](g=>g['level']==='high')?'high':c['some'](g=>g['level']==='medium')?'medium':'low',e={};for(const g of c){e[g['category']]=(e[g['category']]??0x0)+0x1;}const f={};for(const h of c){for(const i of h['affected_stakeholders']){if(!f[i])f[i]=[];f[i]['push'](h['id']+':\x20'+h['mitigation']);}}return{'summary':'Assessed\x20'+c['length']+'\x20risk(s)\x20across\x20'+Object['keys'](e)['length']+'\x20categories','risks':c,'overall_risk':d,'risks_by_category':e,'stakeholder_advice':f,'needs_human_review':c['some'](j=>j['level']==='critical'||j['level']==='high')};}
|
|
1
|
+
import{MAX_VOTING_GUARD_COUNT}from'@wowok/wowok';import{getJudgmentDoc,factoryRulePack}from'../config/judgment.js';import{evaluateRuleBook}from'../config/rule-engine.js';import{isTerminalArbStatus,isValidArbStatusTransition}from'./arbitration-ledger.js';const U8_MAX=0xff,U32_MAX=0xffffffff;export function arbitrationRiskFacts(a){const b=a['voting_guard'],c=!!b&&(b['op']==='add'||b['op']==='set'),d=c?b['op']==='set'?b['guards']['length']:(a['current_voting_guard_count']??0x0)+b['guards']['length']:undefined;let e,f;if(c)for(const F of b['guards']){const G=F??{},H=G['vote_weight'];if(!H||typeof H!=='object')continue;if('GuardIdentifier'in H&&H['GuardIdentifier']!==undefined&&Number(H['GuardIdentifier'])>U8_MAX){e=Number(H['GuardIdentifier']);break;}if('FixedValue'in H&&H['FixedValue']!==undefined&&Number(H['FixedValue'])>U32_MAX){f=Number(H['FixedValue']);break;}}let h=![],i,j,k;if(c){const I=b['guards'];if(I['length']>=0x2){const J=I['filter'](K=>{const L=K?.['vote_weight'];return!!L&&typeof L==='object'&&'FixedValue'in L&&L['FixedValue']!==undefined;})['map'](K=>Number(K['vote_weight']['FixedValue']));if(J['length']>0x0){const K=J['reduce']((M,N)=>M+N,0x0),L=Math['max'](...J);K>0x0&&L/K>0.5&&(h=!![],i=L,j=K,k=(L/K*0x64)['toFixed'](0x1));}}}let l=![],m,n;if(a['dispute']&&a['current_arbitration_fee']!==undefined)try{const M=BigInt(a['current_arbitration_fee']),N=a['dispute']['fee'],O=typeof N==='object'&&N!==null&&'balance'in N?BigInt(N['balance']??0x0):BigInt(0x0);m=O['toString'](),n=M['toString'](),l=O<M;}catch{}const o=!!a['dispute'],p=a['confirm']?.['voting_deadline']??a['voting_deadline_change']?.['voting_deadline'],q=a['current_timestamp_ms'],r=p!==undefined&&p!==null&&q!==undefined&&p<q,s=a['vote']?.['voting_guard'],t=a['current_voting_guard_addresses'],u=!t||t['length']===0x0,v=!!a['vote'],x=a['current_arb_status'],y=a['expected_arb_status'],z=!!x&&!!y&&x!==y&&!isValidArbStatusTransition(x,y),A=!!x&&isTerminalArbStatus(x),B=A&&!a['arb_withdraw']&&!!(a['vote']||a['confirm']||a['arbitration']||a['reset']||a['feedback']),C=a['reset']?String(a['reset']['arb']):undefined;let D,E;if(a['fees_transfer']){const P=a['fees_transfer']['to']??{};D='allocation'in P?'Allocation\x20'+P['allocation']:'Treasury\x20'+P['treasury'],E=String(a['fees_transfer']['payment_remark']);}return{'voting_guard_add_set':c,'voting_guard_new_count':d,'max_voting_guard_count':MAX_VOTING_GUARD_COUNT,'voting_guard_count_exceeded':d!==undefined&&d>MAX_VOTING_GUARD_COUNT,'weight_guard_identifier_over':e!==undefined,'weight_guard_identifier_value':e,'weight_fixed_over':f!==undefined,'weight_fixed_value':f,'weight_collusion_dominant':h,'weight_max':i,'weight_total':j,'weight_ratio_pct':k,'dispute_present':o,'dispute_fee_insufficient':l,'dispute_fee_provided':m,'arbitration_fee_required':n,'current_bPaused':a['current_bPaused'],'voting_deadline_selected':p??undefined,'current_timestamp_ms':q,'voting_deadline_in_past':r,'vote_voting_guard':s,'voting_guard_list_empty':u,'vote_present':v,'vote_guard_registered':!u&&s!==undefined?t['includes'](s):![],'registered_voting_guards':!u?t['join'](','):undefined,'builder':a['builder'],'arbitration_op_present':!!a['arbitration'],'current_arb_status':x,'expected_arb_status':y,'arb_transition_invalid':z,'arb_status_terminal':A,'arb_terminal_op_blocked':B,'reset_present':!!a['reset'],'reset_arb':C,'fees_transfer_present':!!a['fees_transfer'],'fees_transfer_dest':D,'fees_transfer_remark':E,'dispute_order':a['dispute']?String(a['dispute']['order']):undefined};}function arbitrationRuleBook(){const a=getJudgmentDoc()['rules']['domains']['arbitration'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27arbitration\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}function findingToArbitrationRisk(a){return{'id':a['rule_id'],'level':a['level'],'category':a['dimension']??'structural','title':a['title'],'description':a['description'],'affected_stakeholders':a['stakeholders']??[],'scenario':a['scenario']??'','mitigation':a['mitigation']??'','evidence':a['evidence'],...a['exposure']!=null?{'exposure':a['exposure']}:{}};}export const ARBITRATION_RISK_VERSION='1.0.0';export function getAllRiskRules(){const a=factoryRulePack('arbitration');if(!a)return[];return a['rules']['map'](b=>({'id':b['rule_id'],'category':b['dimension']??'structural','trigger':b['trigger']??'','check':c=>{const {findings:d}=evaluateRuleBook([b],arbitrationRiskFacts(c));return d['length']>0x0?findingToArbitrationRisk(d[0x0]):null;}}));}export function disputeFeeReconciliation(a,b){const c=g=>{try{if(typeof g==='bigint')return g;if(typeof g==='number'&&Number['isFinite'](g)&&g>=0x0)return BigInt(Math['floor'](g));if(typeof g==='string'&&/^-?\d+$/['test'](g['trim']()))return BigInt(g['trim']());}catch{}return null;},d=c(a),e=c(b),f='The\x20case\x20escrows\x20the\x20ARBITRATION\x20VENUE\x27s\x20configured\x20fee\x20(self.fee),\x20not\x20the\x20amount\x20'+'attached\x20to\x20dispute.fee\x20—\x20any\x20residue\x20above\x20the\x20venue\x20fee\x20is\x20refunded\x20to\x20the\x20filer\x20'+'in\x20the\x20SAME\x20transaction\x20(dispute_imp\x20refunds\x20the\x20remainder\x20at\x20filing).\x20To\x20make\x20a\x20fee\x20'+'real,\x20the\x20venue\x20must\x20set\x20it\x20first:\x20{operation_type:\x27arbitration\x27,\x20data:{object:\x27<venue>\x27,\x20fee:<amount>}}\x20'+'(arbitrator\x20permission\x20357).\x20Verify\x20the\x20created\x20Arb\x20case\x27s\x20fee\x20field.';if(d!==null&&e!==null){if(d===0x0n)return'DISPUTE\x20FEE\x20RECONCILIATION:\x20this\x20venue\x20charges\x20NO\x20dispute\x20fee\x20(fee\x20=\x200)\x20—\x20the\x20coin\x20you\x20'+('attached\x20('+e+')\x20is\x20refunded\x20to\x20your\x20account\x20IN\x20THIS\x20TRANSACTION\x20and\x20the\x20case\x20escrows\x200.\x20'+f);if(e>d)return'DISPUTE\x20FEE\x20RECONCILIATION:\x20the\x20case\x20escrows\x20the\x20venue\x20fee\x20('+d+');\x20the\x20excess\x20you\x20'+'attached\x20('+(e-d)+'\x20of\x20'+e+')\x20is\x20refunded\x20to\x20your\x20account\x20IN\x20THIS\x20'+'TRANSACTION.\x20'+f;if(e===d)return'DISPUTE\x20FEE\x20RECONCILIATION:\x20the\x20full\x20attached\x20amount\x20('+e+')\x20equals\x20the\x20venue\x20fee\x20—\x20'+'it\x20is\x20escrowed\x20into\x20the\x20case\x20in\x20this\x20transaction.';return'DISPUTE\x20FEE\x20RECONCILIATION:\x20the\x20attached\x20amount\x20('+e+')\x20is\x20BELOW\x20the\x20venue\x20fee\x20('+d+')\x20—\x20on-chain\x20this\x20aborts\x20with\x20E_FEE_NOT_ENOUGH.\x20'+f;}return'DISPUTE\x20FEE\x20MECHANISM:\x20'+f;}export function assessArbitrationRisks(a){const {findings:b}=evaluateRuleBook(arbitrationRuleBook(),arbitrationRiskFacts(a)),c=b['map'](findingToArbitrationRisk),d=c['length']===0x0?'low':c['some'](g=>g['level']==='critical')?'critical':c['some'](g=>g['level']==='high')?'high':c['some'](g=>g['level']==='medium')?'medium':'low',e={};for(const g of c){e[g['category']]=(e[g['category']]??0x0)+0x1;}const f={};for(const h of c){for(const i of h['affected_stakeholders']){if(!f[i])f[i]=[];f[i]['push'](h['id']+':\x20'+h['mitigation']);}}return{'summary':'Assessed\x20'+c['length']+'\x20risk(s)\x20across\x20'+Object['keys'](e)['length']+'\x20categories','risks':c,'overall_risk':d,'risks_by_category':e,'stakeholder_advice':f,'needs_human_review':c['some'](j=>j['level']==='critical'||j['level']==='high')};}
|