@wowok/agent-mcp 3.3.5 → 3.3.7
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/eval-order.d.ts +17 -0
- package/dist/chain-semantics/eval-order.js +1 -0
- 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/index.d.ts +1 -0
- package/dist/chain-semantics/index.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 +2 -1
- package/dist/composition/compile.js +1 -1
- package/dist/composition/materialize.js +1 -1
- package/dist/data/api/api.spec.d.ts +1 -0
- package/dist/data/api/api.spec.js +1 -0
- package/dist/data/api/cli.d.ts +1 -0
- package/dist/data/api/cli.js +1 -0
- package/dist/data/api/head.d.ts +16 -0
- package/dist/data/api/head.js +1 -0
- package/dist/data/api/head.spec.d.ts +1 -0
- package/dist/data/api/head.spec.js +1 -0
- package/dist/data/api/index.d.ts +2 -0
- package/dist/data/api/index.js +1 -0
- package/dist/data/api/match.d.ts +69 -0
- package/dist/data/api/match.js +1 -0
- package/dist/data/api/match.spec.d.ts +1 -0
- package/dist/data/api/match.spec.js +1 -0
- package/dist/data/api/server.d.ts +12 -0
- package/dist/data/api/server.js +1 -0
- package/dist/data/projection/cli.d.ts +1 -0
- package/dist/data/projection/cli.js +1 -0
- package/dist/data/projection/edges.d.ts +8 -0
- package/dist/data/projection/edges.js +1 -0
- package/dist/data/projection/edges.spec.d.ts +1 -0
- package/dist/data/projection/edges.spec.js +1 -0
- package/dist/data/projection/facets.d.ts +18 -0
- package/dist/data/projection/facets.js +1 -0
- package/dist/data/projection/facets.spec.d.ts +1 -0
- package/dist/data/projection/facets.spec.js +1 -0
- package/dist/data/projection/facts.d.ts +40 -0
- package/dist/data/projection/facts.js +1 -0
- package/dist/data/projection/index.d.ts +6 -0
- package/dist/data/projection/index.js +1 -0
- package/dist/data/projection/project.d.ts +10 -0
- package/dist/data/projection/project.js +1 -0
- package/dist/data/projection/projection.spec.d.ts +1 -0
- package/dist/data/projection/projection.spec.js +1 -0
- package/dist/data/projection/schema.d.ts +1 -0
- package/dist/data/projection/schema.js +1 -0
- package/dist/data/projection/store.d.ts +49 -0
- package/dist/data/projection/store.js +1 -0
- package/dist/data/projection/types.d.ts +137 -0
- package/dist/data/projection/types.js +1 -0
- package/dist/data/sync/cdc.d.ts +34 -0
- package/dist/data/sync/cdc.js +1 -0
- package/dist/data/sync/cdc.spec.d.ts +1 -0
- package/dist/data/sync/cdc.spec.js +1 -0
- package/dist/data/sync/graphql-source.d.ts +16 -0
- package/dist/data/sync/graphql-source.js +1 -0
- package/dist/data/sync/index.d.ts +5 -0
- package/dist/data/sync/index.js +1 -0
- package/dist/data/sync/reconciler.d.ts +14 -0
- package/dist/data/sync/reconciler.js +1 -0
- package/dist/data/sync/reconciler.spec.d.ts +1 -0
- package/dist/data/sync/reconciler.spec.js +1 -0
- package/dist/data/sync/schema.d.ts +1 -0
- package/dist/data/sync/schema.js +1 -0
- package/dist/data/sync/store.d.ts +19 -0
- package/dist/data/sync/store.js +1 -0
- package/dist/data/sync/sync.spec.d.ts +1 -0
- package/dist/data/sync/sync.spec.js +1 -0
- package/dist/data/sync/synchronizer.d.ts +10 -0
- package/dist/data/sync/synchronizer.js +1 -0
- package/dist/data/sync/types.d.ts +162 -0
- package/dist/data/sync/types.js +1 -0
- package/dist/evaluation/builtins/demand-match.js +1 -1
- package/dist/evaluation/builtins/graph-service.spec.js +1 -1
- package/dist/evaluation/capability.d.ts +1 -0
- package/dist/evaluation/engine.js +1 -1
- package/dist/evaluation/extract.d.ts +7 -1
- package/dist/evaluation/extract.js +1 -1
- package/dist/evaluation/match-policy.d.ts +142 -0
- package/dist/evaluation/match-policy.js +1 -0
- package/dist/evaluation/match-policy.spec.d.ts +1 -0
- package/dist/evaluation/match-policy.spec.js +1 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/business-modules.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/intent/types.d.ts +1 -1
- package/dist/intent/types.js +1 -1
- package/dist/keeper/detectors.d.ts +3 -0
- package/dist/keeper/detectors.js +1 -1
- package/dist/keeper/keeper.spec.js +1 -1
- package/dist/knowledge/allocator-rail-verifier.js +1 -1
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/rules/plan.json +113 -3
- package/dist/knowledge/builtin-templates.d.ts +6 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-ledger.js +1 -1
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-render.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-generalizer.d.ts +4 -0
- package/dist/knowledge/industry-generalizer.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/jsonrpc-enum.d.ts +26 -10
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/projection.d.ts +54 -0
- package/dist/knowledge/projection.js +1 -0
- package/dist/knowledge/projection.spec.d.ts +1 -0
- package/dist/knowledge/projection.spec.js +1 -0
- package/dist/knowledge/recipient-constraint.d.ts +1 -1
- package/dist/knowledge/recipient-constraint.js +1 -1
- package/dist/knowledge/semantic-ir.d.ts +113 -0
- package/dist/knowledge/semantic-ir.js +1 -0
- package/dist/knowledge/service-ledger.d.ts +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/template-loader.d.ts +34 -0
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-prose.d.ts +50 -0
- package/dist/knowledge/template-prose.js +1 -0
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +1 -1
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/normalize.d.ts +1 -1
- package/dist/monitor/normalize.js +1 -1
- package/dist/monitor/types.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +4 -0
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.d.ts +2 -1
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/mode-actions.d.ts +7 -0
- package/dist/playbooks/service-build/mode-actions.js +1 -1
- package/dist/playbooks/service-build/object-panorama.d.ts +22 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/reverse-mapping-nk4.spec.js +1 -1
- package/dist/playbooks/service-build/reverse-mapping.d.ts +1 -0
- package/dist/playbooks/service-build/reverse-mapping.js +1 -1
- 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/review/index.js +1 -1
- package/dist/role/profiles.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +64 -10
- 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/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/proof.js +1 -1
- package/dist/schema/call/reward.d.ts +10 -0
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +341 -0
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +2 -0
- package/dist/schema/goal/planning.d.ts +3 -0
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +62 -0
- package/dist/schema/industry-pack/modes.d.ts +62 -0
- package/dist/schema/industry-pack/modes.js +1 -1
- package/dist/schema/intent-radar/index.d.ts +3 -0
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/local/index.d.ts +20 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/operations.d.ts +5 -0
- package/dist/schema/query/bi.d.ts +4 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +145 -47
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +2 -0
- package/dist/schemas/benchmark_migration_operation.output.json +42 -0
- package/dist/schemas/benchmark_migration_operation.schema.json +208 -5
- package/dist/schemas/bridge_operation.output.json +2 -0
- package/dist/schemas/evaluation_operation.output.json +624 -2
- package/dist/schemas/evaluation_operation.schema.json +598 -4
- package/dist/schemas/goal_operation.schema.json +18 -10
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/industry_pack_operation.output.json +86 -2
- package/dist/schemas/industry_pack_operation.schema.json +199 -0
- package/dist/schemas/intent_radar.output.json +2 -0
- package/dist/schemas/intent_radar.schema.json +1 -0
- package/dist/schemas/local_cache_operation.output.json +2 -0
- package/dist/schemas/local_history_operation.output.json +2 -0
- package/dist/schemas/local_info_operation.output.json +2 -0
- package/dist/schemas/local_mark_operation.output.json +2 -0
- package/dist/schemas/onchain_events.output.json +281 -11
- package/dist/schemas/onchain_events.schema.json +5 -1
- package/dist/schemas/onchain_operations.output.json +2 -0
- package/dist/schemas/onchain_operations.schema.json +914 -314
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_arbitration.schema.json +1 -1
- package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +660 -94
- package/dist/schemas/onchain_operations_reward.schema.json +35 -1
- package/dist/schemas/onchain_operations_service.schema.json +4 -4
- package/dist/schemas/query_toolkit.output.json +333 -0
- package/dist/tools/handlers/benchmark-migration.d.ts +5 -2
- 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/intent-radar.js +1 -1
- package/dist/tools/handlers/messenger.d.ts +1 -0
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +2 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/wip.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/agent.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/wip-verify-ledger.d.ts +14 -0
- package/dist/tools/wip-verify-ledger.js +1 -0
- package/dist/tools/wrap.d.ts +4 -0
- package/dist/tools/wrap.js +1 -1
- package/package.json +7 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MAX_INDEMNITY_MULTIPLE}from'./onchain-constants.js';import{TWO_TX_RENEW_RECIPE}from'./protocol-facts.js';import{lintForwardAmbiguity,findLoopCycles}from'./machine-topology.js';import{isRenewalLoopEdge}from'../participation/radar-core.js';function numericAmount(a){if(typeof a==='number')return Number['isFinite'](a)?a:undefined;if(typeof a==='string'){const b=a['trim']();if(/^\d+$/['test'](b))return Number(b);}return undefined;}export{numericAmount};export function salesItemsOf(a){if(Array['isArray'](a?.['sales']))return a['sales'];if(Array['isArray'](a?.['sales']?.['sales']))return a['sales']['sales'];return[];}export function allocatorCountOf(a){const b=a?.['order_allocators'];if(Array['isArray'](b))return b['length'];if(Array['isArray'](b?.['allocators']))return b['allocators']['length'];return 0x0;}export function arbitrationRefsOf(b){const c=b?.['arbitrations'];if(Array['isArray'](c))return c['filter'](e=>typeof e==='string');if(Array['isArray'](c?.['objects']))return c['objects']['filter'](e=>typeof e==='string');return[];}export function compensationFundOf(a){if(a?.['compensation_fund_add']?.['balance']!=null)return a['compensation_fund_add']['balance'];if(a?.['compensation_fund']!=null)return a['compensation_fund'];return undefined;}export function serviceNameOf(a){if(typeof a?.['object']==='string')return a['object'];if(typeof a?.['object']?.['name']==='string'&&a['object']['name'])return a['object']['name'];if(typeof a?.['namedNew']?.['name']==='string'&&a['namedNew']['name'])return a['namedNew']['name'];return undefined;}export function typeParameterOf(a){if(typeof a?.['type_parameter']==='string'&&a['type_parameter'])return a['type_parameter'];if(typeof a?.['object']?.['type_parameter']==='string'&&a['object']['type_parameter'])return a['object']['type_parameter'];if(typeof a?.['namedNew']?.['type_parameter']==='string'&&a['namedNew']['type_parameter'])return a['namedNew']['type_parameter'];return undefined;}export const DISPUTE_FAMILY_NODE_REGEX=/(^|_)(disputed?|arbitration|arb)(_|$)/i;export const FUND_TERMINAL_NODE_REGEX=/^(refund|refunded|deposit_refunded|deposit_deducted|cancel|cancelled)$/i;export const ANTI_PATTERN_NODE_REGEX=new RegExp(DISPUTE_FAMILY_NODE_REGEX['source']+'|'+FUND_TERMINAL_NODE_REGEX['source'],'i');export const REMEDY_FAMILY_NODE_REGEX=/(revis|review|rework|refund|cancel|return|claim)/i;export function isRemedyLoopEdge(a,b){return REMEDY_FAMILY_NODE_REGEX['test'](a)||REMEDY_FAMILY_NODE_REGEX['test'](b);}export function classifyLoopCycle(a,b){for(let c=0x0;c<a['length'];c++){if(isRenewalLoopEdge(a[c],a[(c+0x1)%a['length']]))return'renewal';}if(b==='review-loop')return'remedy';if(b==='paid-cycle')return'charge';if(a['some'](d=>REMEDY_FAMILY_NODE_REGEX['test'](d)))return'remedy';return'charge';}export function auditMachineNodes(a,b){const c=[],d=[];if(!Array['isArray'](a)||a['length']===0x0)return d['push']('pre_publish:\x20machine\x20node\x20set\x20unavailable\x20—\x20topology\x20not\x20verifiable;\x20'+'verify\x20via\x20machineNode2file\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)'),{'critical':c,'warnings':d};const e=a;for(const r of e){const s=typeof r?.['name']==='string'?r['name']:'';if(!s)continue;if(DISPUTE_FAMILY_NODE_REGEX['test'](s))c['push']('R-M1-11:\x20machine\x20node\x20\x22'+s+'\x22\x20models\x20dispute\x20flow\x20—\x20'+'disputes\x20must\x20route\x20via\x20the\x20separate\x20Arbitration\x20object\x20(off-Machine);\x20'+'rename\x20the\x20node\x20to\x20the\x20business\x20state\x20that\x20triggers\x20it');else FUND_TERMINAL_NODE_REGEX['test'](s)&&d['push']('R-M1-11:\x20machine\x20node\x20\x22'+s+'\x22\x20uses\x20a\x20bare\x20fund-terminal\x20name\x20—\x20reaching\x20'+'it\x20moves\x20no\x20funds\x20by\x20itself.\x20This\x20is\x20legitimate\x20ONLY\x20when\x20a\x20refund\x20allocator\x20'+'rail\x27s\x20guard\x20anchors\x20to\x20this\x20node\x20(per-node\x20refund\x20tracks);\x20otherwise\x20rename\x20it\x20'+'to\x20the\x20business\x20state\x20(e.g.\x20cancel_requested\x20/\x20closed_cancel)\x20and\x20route\x20the\x20'+'refund\x20via\x20an\x20Allocator\x20triggered\x20by\x20that\x20state.\x20The\x20template\x20scanner\x20verifies\x20'+'the\x20anchoring\x20when\x20a\x20template\x20is\x20present.');}const g=new Set();for(const t of e){const u=typeof t?.['name']==='string'?t['name']:'';if(!u)continue;g['has'](u)&&c['push']('MC-C-04:\x20duplicate\x20machine\x20node\x20name\x20\x22'+u+'\x22\x20—\x20on-chain\x20will\x20reject\x20the\x20publish\x20transaction'),g['add'](u);}const h=e['some'](v=>Array['isArray'](v?.['pairs'])&&v['pairs']['some'](w=>w?.['prev_node']===''));!h&&c['push']('Machine\x20has\x20no\x20entry\x20pair\x20(prev_node=\x22\x22)\x20—\x20Progress\x20can\x20never\x20advance\x20'+'from\x20the\x20initial\x20state;\x20orders\x20are\x20permanently\x20stuck');const i=new Map();for(const v of e){const w=typeof v?.['name']==='string'?v['name']:'';if(!w)continue;if(!i['has'](w))i['set'](w,[]);for(const x of v?.['pairs']??[]){const y=x?.['prev_node'];if(typeof y==='string'&&y!==''){const z=i['get'](y);if(z)z['push'](w);else i['set'](y,[w]);}}}const j=findLoopCycles(i)['map'](A=>({'c':A,'tier':classifyLoopCycle(A['cycle'],b)})),k=j['filter'](A=>A['tier']==='renewal'),l=j['filter'](A=>A['tier']==='remedy'),m=j['filter'](A=>A['tier']==='charge');m['length']>0x0&&c['push']('pre_publish:\x20machine\x20contains\x20charge-bearing\x20loop\x20cycle(s)\x20'+m['map'](A=>'['+A['c']['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20'+'on-chain\x20a\x20revisit\x20is\x20NOT\x20verified\x20to\x20re-fund\x20the\x20Allocation,\x20and\x20this\x20static\x20pass\x20sees\x20only\x20the\x20forward\x27s\x20guard\x20reference\x20'+'(never\x20the\x20guard\x20table),\x20so\x20a\x20per-revisit-fee\x20cycle\x20(retake\x20/\x20session-card\x20shape)\x20is\x20UNPROVABLE\x20here\x20even\x20though\x20the\x20'+'allocation.balance\x20Guard\x20query\x20(1051,\x20witness\x20OrderAllocation\x20109)\x20makes\x20the\x20fee\x20enforceable\x20at\x20the\x20guard\x20layer\x20'+'(zero-value\x20re-delivery\x20cycles,\x20test/11\x20R2-F3\x20/\x20crs\x20P2-3).\x20THREE\x20WAYS\x20OUT\x20—\x20'+'(1)\x20NO-CHARGE\x20revisit\x20(F-06,\x20ctra-mn\x20261019:\x20a\x20delivered->in_progress\x20revision\x20loop\x20is\x20business-correct\x20and\x20was\x20false-CRITICAL\x20here):\x20'+'declare\x20`reentry_kind:\x20\x22review-loop\x22`\x20on\x20this\x20publish\x20payload\x20(AP-3\x20—\x20machine-checkable,\x20no\x20renaming\x20needed)\x20'+'OR\x20rename\x20ANY\x20ONE\x20node\x20of\x20the\x20cycle\x20with\x20a\x20remedy\x20word\x20root\x20the\x20classifier\x20reads\x20—\x20revis*/review*/rework*/refund*/cancel*/return*/claim*\x20'+'(e.g.\x20\x27revising\x27\x20instead\x20of\x20\x27in_progress\x27)\x20—\x20and\x20the\x20cycle\x20reclassifies\x20as\x20remedy\x20tier\x20(warning,\x20not\x20a\x20blocker);\x20'+'(2)\x20GENUINELY\x20charge-bearing\x20with\x20neutral\x20names:\x20declare\x20`reentry_kind:\x20\x22paid-cycle\x22`\x20(keeps\x20this\x20block\x20—\x20'+'it\x20is\x20the\x20declaration\x20of\x20intent)\x20and\x20bind\x20the\x20fund-gate\x20Guard\x20on\x20the\x20loop\x20forward\x20'+'(constant\x20=\x20order\x20address,\x20convert_witness\x20OrderAllocation,\x20allocation.balance\x20>=\x20revisit\x20fee)\x20AND\x20publish\x20through\x20a\x20template\x20'+'carrying\x20that\x20convention\x20—\x20PRE-STATE\x20CONSTRAINT\x20(esound-mn-261021\x20B-1):\x20the\x20gate\x20reads\x20the\x20COMMITTED\x20pre-transaction\x20'+'balance,\x20so\x20the\x20revisit\x20funds\x20must\x20be\x20committed\x20in\x20a\x20PRIOR\x20transaction.\x20'+TWO_TX_RENEW_RECIPE+'\x20'+'Alternatively\x20replace\x20the\x20loop\x20with\x20per-period\x20NEW\x20Orders\x20(REUSE\x20pattern\x20—\x20a\x20fresh\x20order\x20per\x20period\x20instead\x20of\x20an\x20in-order\x20loop\x20that\x20replays\x20its\x20forwards\x20every\x20lap).\x20'+'(3)\x20A\x20funded\x20renewal\x20loop\x20(post-period\x20node\x20back\x20into\x20a\x20charging\x20node,\x20advanced\x20via\x20the\x20one-PTB\x20order_renew\x20call,\x20'+'NO\x20balance\x20gate\x20on\x20the\x20renew\x20forward\x20—\x20see\x20the\x20PRE-STATE\x20CONSTRAINT\x20above)\x20'+'is\x20the\x20only\x20sanctioned\x20charge-bearing\x20cycle\x20shape\x20for\x20in-order\x20renewals.');k['length']>0x0&&d['push']('pre_publish:\x20machine\x20contains\x20renewal\x20loop\x20cycle(s)\x20'+k['map'](A=>'['+A['c']['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20on-chain\x20a\x20revisit\x20'+'is\x20NOT\x20verified\x20to\x20re-fund\x20the\x20Allocation.\x20Every\x20renewal/loop\x20forward\x20MUST\x20carry\x20the\x20new-period\x20'+'payment\x20into\x20the\x20order\x20escrow\x20(use\x20the\x20order\x20call\x27s\x20order_renew\x20field:\x20create\x20the\x20period\x20payment,\x20receive\x20it\x20into\x20the\x20'+'allocation,\x20and\x20advance\x20the\x20progress\x20—\x20all\x20in\x20one\x20transaction),\x20or\x20the\x20loop\x20allows\x20zero-value\x20'+'re-delivery\x20cycles\x20(test/11\x20R2-F3).\x20'+'PRE-STATE\x20CONSTRAINT\x20(esound-mn-261021\x20B-1,\x20mainnet-verified):\x20a\x20guard\x20on\x20the\x20renew\x20forward\x20reading\x20'+'allocation.balance\x20(query\x201051)\x20evaluates\x20the\x20COMMITTED\x20pre-transaction\x20balance\x20—\x20the\x20same-PTB\x20order_renew\x20'+'payment\x20is\x20INVISIBLE\x20to\x20it,\x20so\x20a\x20balance-gated\x20renew\x20forward\x20ALWAYS\x20aborts.\x20NEVER\x20bind\x20a\x20balance\x20gate\x20to\x20a\x20'+'forward\x20that\x20order_renew\x20advances\x20in\x20the\x20same\x20PTB.\x20'+TWO_TX_RENEW_RECIPE+'\x20'+'The\x20zero-value\x20protection\x20rides\x20this\x20routing\x20convention\x20(order_renew\x27s\x20amount).');l['length']>0x0&&d['push']('pre_publish:\x20machine\x20contains\x20remedy\x20loop\x20cycle(s)\x20'+l['map'](A=>'['+A['c']['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20'+'a\x20same-order\x20revisit\x20(revision/review/rework/refund/cancel\x20family)\x20implies\x20NO\x20new\x20charge,\x20so\x20no\x20fund\x20gate\x20is\x20needed\x20on\x20it\x20'+'(the\x20allocation.balance\x20query\x20exists\x20but\x20is\x20irrelevant\x20here).\x20Visible\x20by\x20design\x20(crs\x20P2-3):\x20if\x20the\x20business\x20EVER\x20intends\x20'+'a\x20revisit\x20to\x20cost\x20money,\x20that\x20fee\x20IS\x20enforceable\x20via\x20the\x20balance\x20query\x20(1051)\x20—\x20but\x20that\x20reshapes\x20the\x20cycle\x20into\x20the\x20'+'charge\x20tier\x20above;\x20keep\x20remedy\x20revisits\x20free\x20or\x20restructure\x20as\x20per-period\x20NEW\x20Orders.');for(const A of e){const B=typeof A?.['name']==='string'?A['name']:'?';for(const C of A?.['pairs']??[]){for(const D of C?.['forwards']??[]){const E=D?.['namedOperator']!==undefined&&D?.['namedOperator']!==null,F=D?.['permissionIndex']!==undefined&&D?.['permissionIndex']!==null,G=D?.['guard']!==undefined&&D?.['guard']!==null;!E&&!F&&!G&&d['push']('pre_publish:\x20node\x20\x22'+B+'\x22\x20forward\x20\x22'+String(D?.['name']??'?')+'\x22\x20has\x20no\x20executor\x20binding\x20(namedOperator\x20/\x20permissionIndex\x20/\x20guard)\x20—\x20no\x20one\x20can\x20advance\x20it');}}}const o=lintForwardAmbiguity(a,'pre_publish');c['push'](...o['critical']),d['push'](...o['warnings']);const q=computeTerminalReachability(a);return q['unreachable']['length']>0x0&&d['push']('pre_publish:\x20unreachable\x20machine\x20node(s)\x20'+q['unreachable']['map'](H=>'\x22'+H+'\x22')['join'](',\x20')+'\x20—\x20'+'no\x20path\x20from\x20the\x20entry\x20pair\x20reaches\x20them;\x20dead\x20topology\x20is\x20frozen\x20at\x20publish\x20(IMMUT-001).\x20'+'Wire\x20them\x20into\x20the\x20flow\x20or\x20remove\x20them\x20before\x20publish'),{'critical':c,'warnings':d};}export function computeTerminalReachability(a){const b=[],c=[];if(!Array['isArray'](a)||a['length']===0x0)return{'terminals':b,'unreachable':c};const d=a,e=new Map(),f=[],g=[];for(const j of d){const k=typeof j?.['name']==='string'?j['name']:'';if(!k)continue;f['push'](k);if(!e['has'](k))e['set'](k,[]);let l=![];for(const m of j?.['pairs']??[]){const o=m?.['prev_node'];if(o==='')l=!![];else{if(typeof o==='string'&&o!==''){const q=e['get'](o);if(q)q['push'](k);else e['set'](o,[k]);}}}if(l)g['push'](k);}if(f['length']===0x0||g['length']===0x0)return{'terminals':b,'unreachable':c};const h=new Set(),i=[...g];while(i['length']>0x0){const r=i['pop']();if(h['has'](r))continue;h['add'](r);for(const s of e['get'](r)??[])i['push'](s);}for(const t of f){if(!h['has'](t))c['push'](t);else{if((e['get'](t)??[])['length']===0x0)b['push'](t);}}return{'terminals':b,'unreachable':c};}export const REVIEW_FAMILY_NODE_REGEX=/(^|_)(review|reviews|reviewed|reviewing|evaluated|evaluate|feedback|rating|rated)(_|$)/i;export function lintReviewLockedTerminals(a,b){const c=[],d=[];if(!Array['isArray'](a)||a['length']===0x0)return{'critical':c,'warnings':d};const e=a,h=u=>Array['isArray'](u?.['pairs'])?u['pairs']:Array['isArray'](u?.['value'])?u['value']:[],i=[],j=[],k=[];for(const u of e){const v=typeof u?.['name']==='string'?u['name']:'';if(!v)continue;j['push'](v);let w=![];for(const x of h(u)){const y=x,z=y?.['prev_node'];if(z==='')w=!![];const A=Array['isArray'](y?.['forwards'])?y['forwards']:[],B=[];for(const C of A){const D=C,E=D?.['guard'],F=typeof E==='string'&&E['trim']()!==''?E:E&&typeof E==='object'?E['guard']??E['$ref']:undefined;if(typeof F==='string'&&F['trim']()!=='')B['push'](F);}typeof z==='string'&&z!==''&&i['push']({'from':z,'to':v,'guardRefs':B});}if(w)k['push'](v);}if(j['length']===0x0||k['length']===0x0)return{'critical':c,'warnings':d};const l=computeTerminalReachability(a);if(l['terminals']['length']===0x0)return{'critical':c,'warnings':d};const m=G=>{if(G['guardRefs']['length']===0x0)return![];for(const H of G['guardRefs']){const I=b['get'](H['toLowerCase']());if(!I||I['length']===0x0)return![];const J=I['every'](K=>REVIEW_FAMILY_NODE_REGEX['test'](K));if(!J||I['includes'](G['from']))return![];}return!![];},o=G=>REVIEW_FAMILY_NODE_REGEX['test'](G),q=G=>{const H=new Map();for(const K of i){if(m(K))continue;if(G&&(o(K['from'])||o(K['to'])))continue;const L=H['get'](K['from']);if(L)L['push'](K['to']);else H['set'](K['from'],[K['to']]);}const I=new Set(),J=[...k];while(J['length']>0x0){const M=J['pop']();if(I['has'](M))continue;I['add'](M);for(const N of H['get'](M)??[])J['push'](N);}return I;},r=q(![]),s=q(!![]);for(const G of l['terminals']){if(!r['has'](G))c['push']('REVIEW-LOCK-01:\x20terminal\x20\x22'+G+'\x22\x20is\x20enterable\x20ONLY\x20through\x20forward(s)\x20whose\x20guard\x20pins\x20a\x20'+'review/feedback\x20node\x20the\x20edge\x20itself\x20does\x20not\x20depart\x20from\x20—\x20the\x20rail\x20can\x20never\x20fire\x20(the\x20guard\x20asserts\x20a\x20'+'progress\x20state\x20this\x20transition\x20cannot\x20produce),\x20so\x20a\x20buyer\x20who\x20never\x20reviews\x20strands\x20every\x20order\x27s\x20'+'escrow\x20permanently.\x20Machine\x20topology\x20is\x20immutable\x20after\x20publish\x20(IMMUT-001).\x20Fix\x20BEFORE\x20publish:\x20'+'re-pin\x20the\x20settlement\x20guard\x20to\x20the\x20node\x20the\x20forward\x20actually\x20departs\x20from,\x20and\x20add\x20a\x20time-lock\x20keeper\x20'+'auto-confirm\x20rail\x20(the\x20template\x20deliver_confirm_timeout\x20convention)\x20so\x20settlement\x20never\x20depends\x20on\x20the\x20'+'buyer\x20choosing\x20to\x20review');else!s['has'](G)&&d['push']('REVIEW-LOCK-01:\x20terminal\x20\x22'+G+'\x22\x20is\x20reachable\x20only\x20THROUGH\x20a\x20review/feedback\x20node\x20—\x20a\x20buyer\x20who\x20'+'silently\x20skips\x20reviewing\x20can\x20never\x20let\x20their\x20order\x20reach\x20it.\x20The\x20sanctioned\x20shape\x20keeps\x20the\x20review\x20'+'stop\x20OPTIONAL\x20with\x20an\x20exit\x20edge\x20back\x20to\x20the\x20settlement\x20rail,\x20and\x20a\x20keeper\x20time-lock\x20rail\x20that\x20opens\x20'+'settlement\x20independently\x20(retail\x20deliver_confirm_timeout\x20convention).\x20Verify\x20one\x20of\x20the\x20two\x20exists;\x20'+'if\x20the\x20review\x20node\x20is\x20meant\x20to\x20be\x20keeper-advanceable,\x20this\x20is\x20satisfied\x20and\x20may\x20be\x20ignored');}return{'critical':c,'warnings':d};}export function arbitrationVotingLockDetail(a){if(!Array['isArray'](a))return null;if(a['length']>0x0)return null;return'voting_guard\x20is\x20empty\x20(no\x20guard-weighted\x20voters).\x20Plain\x20votes\x20hard-require\x20the\x20vote\x20permission\x20(358)\x20on\x20the\x20'+'arbitration\x27s\x20own\x20Permission:\x20only\x20that\x20Permission\x27s\x20admin\x20(its\x20creator,\x20by\x20default)\x20and\x20explicit\x20358\x20'+'grantees\x20pass\x20the\x20assert,\x20so\x20without\x20grants\x20the\x20disputing\x20CUSTOMER\x20can\x20never\x20vote\x20and\x20the\x20arb\x20admin\x20is\x20the\x20'+'only\x20possible\x20voter\x20AND\x20the\x20judge\x20—\x20a\x20dispute\x20opened\x20against\x20this\x20service\x20dead-locks\x20when\x20that\x20admin\x20is\x20'+'unresponsive.\x20Configure\x20a\x20public\x20voting_guard\x20on\x20the\x20Arbitration\x20(voting_guard\x20op=\x27set\x27\x20with\x20guard\x20+\x20vote\x20'+'weight\x20—\x20the\x20field\x20stays\x20mutable\x20after\x20publish;\x20the\x20standard\x20shape\x20is\x20tpl_voting_guard_open_vote,\x20the\x20'+'always-true\x20guard\x20at\x20FixedValue\x20weight\x201)\x20or\x20bind\x20an\x20arbitration\x20that\x20already\x20carries\x20one,\x20BEFORE\x20'+'publishing\x20this\x20service';}const TIME_PROFILE_UNIT_MS={'ms':0x1,'msec':0x1,'msecs':0x1,'millisecond':0x1,'milliseconds':0x1,'s':0x3e8,'sec':0x3e8,'secs':0x3e8,'second':0x3e8,'seconds':0x3e8,'m':0xea60,'min':0xea60,'mins':0xea60,'minute':0xea60,'minutes':0xea60,'h':0x36ee80,'hr':0x36ee80,'hrs':0x36ee80,'hour':0x36ee80,'hours':0x36ee80,'d':0x5265c00,'day':0x5265c00,'days':0x5265c00,'w':0x240c8400,'wk':0x240c8400,'wks':0x240c8400,'week':0x240c8400,'weeks':0x240c8400},TIME_PROFILE_DURATION_REGEX=/(\d+(?:\.\d+)?)\s*(ms|milliseconds?|msecs?|minutes?|mins?|seconds?|secs?|hours?|hrs?|days?|weeks?|wks?|min|sec|hr|wk|[smhdw])\b/gi,TIME_PROFILE_ADMISSION_REGEX=/compress(?:ed|ion)|accelerat(?:ed|ion)|shorten(?:ed)?(?:\s+for)?|test\s+(?:value|window|duration|constant)|demo\s+(?:value|window|duration)|for\s+(?:fast\s+|quick\s+)?test(?:ing)?|regression\s+(?:value|window)/i;function timeProfileIsTimeQuery(a){if(typeof a==='number')return a===0x4f7||a===0x4f8||a===0x500;if(typeof a==='string')return/(^|\.)time$|current_time/i['test'](a);return![];}function timeProfileNodeChildren(a){const b=[];for(const c of['nodes','node','nodeLeft','nodeRight','parameters','historyIdx','sessionIdx','forwardIdx','where','find','recipient']){const d=a[c];if(Array['isArray'](d))b['push'](...d);else{if(d&&typeof d==='object')b['push'](d);}}return b;}export function guardTimeProfileDetail(a){const b=typeof a['description']==='string'?a['description']:'',c=TIME_PROFILE_ADMISSION_REGEX['test'](b);let d=0x0;for(const l of b['matchAll'](TIME_PROFILE_DURATION_REGEX)){const n=TIME_PROFILE_UNIT_MS[l[0x2]['toLowerCase']()];if(!n)continue;const o=Number(l[0x1])*n;if(Number['isFinite'](o)&&o>d)d=o;}if(!c&&d===0x0)return null;const e=Array['isArray'](a['table'])?a['table']:[],f=p=>{const q=e['find'](r=>Number(r?.['identifier'])===p);return numericAmount(q?.['value']);},h=p=>{if(!p||typeof p!=='object')return![];const q=p;if(q['type']==='context'&&q['context']==='Clock')return!![];if(q['type']==='query'&&timeProfileIsTimeQuery(q['query']))return!![];if(q['type']==='query_progress_history_time')return!![];return timeProfileNodeChildren(q)['some'](h);},i=[],j=(p,q)=>{if(!p||typeof p!=='object')return;const r=p,s=q||typeof r['type']==='string'&&r['type']['startsWith']('calc_');if(r['type']==='identifier'&&s){const t=f(Number(r['identifier']));if(t!==undefined&&t>0x0)i['push'](t);}for(const u of timeProfileNodeChildren(r))j(u,s);};if(a['root']&&typeof a['root']==='object'&&h(a['root']))j(a['root'],![]);const k=i['find'](p=>p<d/0x64);if(k!==undefined){const p=q=>q>=0x5265c00?q/0x5265c00+'d':q>=0x36ee80?q/0x36ee80+'h':q>=0xea60?q/0xea60+'min':q/0x3e8+'s';return{'level':'critical','detail':'time\x20constant\x20'+p(k)+'\x20is\x20>=100x\x20below\x20the\x20production\x20duration\x20the\x20description\x20itself\x20'+('declares\x20('+p(d)+')\x20—\x20a\x20compressed\x20test\x20value\x20frozen\x20into\x20a\x20production\x20guard.\x20Guards\x20')+'freeze\x20at\x20publish\x20(IMMUT-001),\x20so\x20the\x20window\x20will\x20enforce\x20the\x20compressed\x20value\x20against\x20real\x20orders\x20'+'(klook\x20mainnet\x20261014:\x20\x2724h\x20free\x20cancellation\x27\x20enforced\x20as\x202\x20minutes).\x20Rebuild\x20the\x20guard\x20with\x20the\x20'+'production\x20duration\x20from\x20the\x20template\x20fee_params\x20BEFORE\x20publishing'};}if(c)return{'level':'warning','detail':'description\x20admits\x20compressed/accelerated\x20time\x20constants,\x20but\x20NO\x20time\x20constant\x20in\x20this\x20guard\x27s\x20logic\x20'+'tree\x20is\x20>=100x\x20below\x20the\x20declared\x20production\x20duration\x20—\x20the\x20values\x20look\x20production-scaled.\x20Manual\x20'+'review\x20requested\x20(prose\x20alone\x20no\x20longer\x20blocks\x20publish,\x20BF-07):\x20confirm\x20the\x20tree\x20constants\x20match\x20the\x20'+'production\x20durations\x20in\x20the\x20template\x20fee_params\x20BEFORE\x20publishing\x20—\x20guards\x20freeze\x20at\x20publish\x20'+'(IMMUT-001),\x20so\x20a\x20mis-scaled\x20window\x20(klook\x20mainnet\x20261014:\x20\x2724h\x20free\x20cancellation\x27\x20enforced\x20as\x202\x20'+'minutes)\x20is\x20UNFIXABLE'};return null;}export function rewardRefsOf(a){const b=a?.['rewards'];if(typeof b==='string'&&b['trim']()!=='')return[b];if(Array['isArray'](b))return b['filter'](c=>typeof c==='string'&&c['trim']()!=='');if(Array['isArray'](b?.['objects']))return b['objects']['filter'](c=>typeof c==='string'&&c['trim']()!=='');return[];}export function serviceRewardsUnfundedDetail(b){if(!b||typeof b!=='object')return null;const c=b['data']??b,d=Array['isArray'](c?.['guards'])?c['guards']:[],e=numericAmount(c?.['balance']?.['value']??c?.['balance']);if(e===undefined)return null;let f=0x0;for(const h of d){const i=h?.['amount'];if(i?.['type']!==0x1)continue;const j=numericAmount(i?.['value']?.['value']??i?.['value']);if(j!==undefined&&j>f)f=j;}if(f===0x0)return null;if(e>=f)return null;return'reward\x20pool\x20balance\x20'+e+'\x20cannot\x20cover\x20its\x20largest\x20single-claim\x20promise\x20('+f+').\x20'+'The\x20on-chain\x20publish\x20entry\x20does\x20NOT\x20verify\x20reward\x20funding\x20—\x20a\x20failed\x20reward_fund\x20transfer\x20still\x20'+'publishes\x20(onlyfans\x20mainnet\x20261014\x20shipped\x20a\x20store\x20promising\x20cashback\x20with\x20an\x20empty\x20pool),\x20and\x20the\x20'+'claim\x20aborts\x20once\x20the\x20pool\x20drains.\x20Fund\x20the\x20Reward\x20(reward_fund)\x20up\x20to\x20expected_orders\x20x\x20per-claim\x20'+'amount,\x20or\x20remove\x20the\x20reward\x20binding\x20BEFORE\x20publishing\x20this\x20service';}export const AUDIT_RULES=[{'id':'audit_machine_bound','description':'Service\x20should\x20have\x20a\x20Machine\x20workflow\x20bound\x20before\x20publish','severity':'warning','fields':['machine'],'check':(a,b)=>{if(!a?.['publish'])return!![];return!!a?.['machine'];},'message':()=>'Publishing\x20a\x20service\x20without\x20a\x20Machine\x20workflow.\x20Customers\x20won\x27t\x20have\x20a\x20structured\x20order\x20process.','recommendation':'Create\x20a\x20Machine\x20(workflow\x20template)\x20and\x20bind\x20it\x20to\x20the\x20service\x20before\x20publishing.\x20The\x20machine\x20field\x20becomes\x20IMMUTABLE\x20after\x20publish.'},{'id':'audit_order_allocators','description':'Service\x20should\x20have\x20order_allocators\x20for\x20fund\x20distribution','severity':'warning','fields':['order_allocators'],'check':a=>{if(!a?.['publish'])return!![];return allocatorCountOf(a)>0x0;},'message':()=>'Publishing\x20a\x20service\x20without\x20order_allocators.\x20Order\x20funds\x20cannot\x20be\x20auto-distributed\x20to\x20suppliers.','recommendation':'Configure\x20order_allocators\x20before\x20publishing\x20—\x20this\x20field\x20becomes\x20IMMUTABLE\x20after\x20publish.'},{'id':'audit_buy_guard','description':'Service\x20should\x20have\x20a\x20buy_guard\x20for\x20customer\x20screening','severity':'info','fields':['buy_guard'],'check':a=>!!a?.['buy_guard'],'message':()=>'No\x20buy_guard\x20configured\x20—\x20anyone\x20can\x20purchase\x20this\x20service\x20without\x20verification.','recommendation':'Consider\x20adding\x20a\x20Guard\x20to\x20verify\x20customer\x20eligibility\x20(e.g.,\x20identity,\x20wallet\x20balance,\x20location).'},{'id':'audit_arb_alloc_boundary','description':'Arbitration\x20and\x20Allocator\x20coexist\x20→\x20surface\x20the\x20two-system\x20boundary\x20reminder','severity':'warning','fields':['arbitrations','compensation_fund_add','compensation_fund','order_allocators'],'check':a=>{if(!a?.['publish'])return!![];const b=arbitrationRefsOf(a)['length']>0x0||compensationFundOf(a)!==undefined;return!(b&&allocatorCountOf(a)>0x0);},'message':()=>'Arbitration\x20and\x20Allocator\x20are\x20INDEPENDENT\x20systems\x20by\x20design:\x20a\x20ruling\x20records\x20the\x20case\x20and\x20pays\x20from\x20the\x20service\x20compensation\x20fund\x20—\x20it\x20never\x20moves\x20escrow\x20and\x20never\x20advances\x20the\x20workflow.\x20With\x20both\x20configured,\x20a\x20buyer\x20can\x20receive\x20BOTH\x20the\x20arbitration\x20compensation\x20AND\x20a\x20full\x20escrow\x20refund\x20unless\x20the\x20refund/settlement\x20path\x20is\x20gated.\x20This\x20is\x20a\x20boundary\x20reminder,\x20not\x20a\x20defect\x20—\x20verify\x20the\x20coupling\x20check\x20was\x20done\x20deliberately.','recommendation':'Gate\x20the\x20refund/settlement\x20allocator\x27s\x20Guard\x20on\x20order.claimed_by\x20(read-only\x20cross-system\x20evidence\x20—\x20the\x20sanctioned\x20link),\x20or\x20hold\x20the\x20final\x20settlement\x20forward\x20until\x20the\x20case\x20closes.\x20Do\x20NOT\x20couple\x20the\x20systems\x20the\x20other\x20way\x20(no\x20dispute\x20state\x20on\x20the\x20order\x20flow,\x20no\x20workflow\x20step\x20into\x20arbitration):\x20coupling\x20opens\x20the\x20double-pay\x20path.\x20For\x20per-case\x20fund\x20actions,\x20the\x20deposit-reimbursement\x20pattern\x20(guard-design\x20patterns)\x20is\x20the\x20supported\x20route.'},{'id':'audit_compensation_fund','description':'Service\x20should\x20have\x20a\x20compensation_fund\x20for\x20trust','severity':'warning','fields':['compensation_fund_add','compensation_fund'],'check':a=>compensationFundOf(a)!==undefined,'message':()=>'No\x20compensation_fund\x20configured.\x20Customers\x20have\x20no\x20financial\x20protection\x20if\x20you\x20fail\x20to\x20deliver.','recommendation':'Deposit\x20via\x20compensation_fund_add\x20{balance}\x20to\x20enable\x20arbitration\x20payouts.\x20The\x20fund\x20deters\x20fraud\x20and\x20enables\x20arbitration\x20claims.'},{'id':'audit_arbitrations','description':'Service\x20should\x20have\x20arbitration\x20options\x20for\x20dispute\x20resolution','severity':'info','fields':['arbitrations'],'check':a=>arbitrationRefsOf(a)['length']>0x0,'message':()=>'No\x20arbitration\x20configured.\x20Disputes\x20cannot\x20be\x20resolved\x20through\x20a\x20third\x20party.','recommendation':'Add\x20at\x20least\x20one\x20Arbitration\x20object\x20via\x20arbitrations:{op:\x27add\x27,\x20objects:[...]}\x20to\x20enable\x20on-chain\x20dispute\x20resolution.'},{'id':'audit_arbitration_removal_strands_awards','description':'Removing\x20an\x20authorized\x20venue\x20can\x20strand\x20an\x20award\x20it\x20already\x20ruled\x20on','severity':'error','fields':['arbitrations'],'check':a=>{const b=a?.['arbitrations']?.['remove']??a?.['arbitrations']?.['clear'],c=Array['isArray'](b)?b['length']>0x0:a?.['arbitrations']?.['op']==='clear';if(!c)return!![];if(arbitrationRefsOf(a)['length']>0x0)return!![];return compensationFundOf(a)===undefined;},'message':a=>{const b=a?.['arbitrations']?.['clear']?'every\x20authorized\x20venue':'venue(s)\x20'+(a?.['arbitrations']?.['remove']??[])['join'](',\x20');return'Removing\x20'+b+'\x20while\x20a\x20compensation\x20fund\x20is\x20configured\x20makes\x20any\x20award\x20it\x20already\x20ruled\x20on\x20UNPAYABLE:\x20an\x20on-chain\x20payout\x20now\x20requires\x20the\x20deciding\x20venue\x20to\x20still\x20be\x20on\x20the\x20Service\x27s\x20allowlist,\x20so\x20paying\x20out\x20aborts\x20with\x20E_ARBITRATION_NOT_ALLOWED=39\x20and\x20the\x20escrowed\x20funds\x20stay\x20stranded.';},'recommendation':'Before\x20removing\x20a\x20venue,\x20confirm\x20no\x20case\x20it\x20ruled\x20on\x20is\x20still\x20awaiting\x20compensation\x20payout\x20(query\x20the\x20Arb\x20objects\x20for\x20status\x20Arbitrated,\x20not\x20Finished).\x20Add\x20the\x20replacement\x20venue\x20FIRST,\x20drain\x20the\x20old\x20venue\x27s\x20cases,\x20and\x20only\x20then\x20remove\x20it.\x20A\x20buyer\x20should\x20never\x20be\x20left\x20holding\x20an\x20uncollectable\x20award.'},{'id':'audit_price','description':'Service\x20should\x20have\x20at\x20least\x20one\x20priced\x20sale\x20item','severity':'error','fields':['sales'],'check':a=>{const b=salesItemsOf(a);if(b['length']===0x0)return!![];return b['some'](c=>c?.['price']!==undefined&&c?.['price']!==null);},'message':()=>'Sales\x20list\x20present\x20but\x20no\x20item\x20has\x20a\x20price.\x20Customers\x20cannot\x20place\x20orders\x20without\x20knowing\x20the\x20cost.','recommendation':'Set\x20price\x20on\x20each\x20sales\x20item\x20(smallest-unit\x20string\x20or\x20display\x20form\x20like\x20\x272.5WOW\x27).'},{'id':'audit_compensation_fund_covers_award_ceiling','description':'compensation_fund\x20should\x20cover\x20the\x203x\x20award\x20ceiling\x20of\x20the\x20largest\x20sale\x20(disclosure)','severity':'warning','fields':['compensation_fund_add','compensation_fund','sales'],'check':a=>{if(!a?.['publish'])return!![];const b=compensationFundOf(a);if(b===undefined)return!![];const c=numericAmount(b);if(c===undefined)return!![];if(c===0x0)return![];const e=salesItemsOf(a)['map'](g=>numericAmount(g?.['price']))['filter'](g=>g!==undefined&&g>0x0);if(e['length']===0x0)return!![];const f=e['reduce']((g,h)=>g+h,0x0);return c>=MAX_INDEMNITY_MULTIPLE*f;},'message':()=>'compensation_fund\x20does\x20not\x20cover\x20the\x20award\x20ceiling\x20of\x20the\x20largest\x20sale.\x20An\x20award\x20is\x20hard-capped\x20at\x20'+MAX_INDEMNITY_MULTIPLE+'x\x20'+'the\x20order\x20amount\x20(arb.move\x20MAX_INDEMNITY_MULTIPLE,\x20enforced\x20at\x20ruling\x20time),\x20so\x20a\x20ruling\x20at\x20the\x20ceiling\x20'+'would\x20abort\x20the\x20buyer\x27s\x20claim\x20with\x2027\x20(E_COMPENSATION_NOT_MATCH)\x20—\x20the\x20ruling\x20stands\x20but\x20is\x20unpayable\x20'+'until\x20you\x20deposit,\x20and\x20the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim.\x20Disclosure\x20only:\x20this\x20no\x20longer\x20blocks\x20'+'publish\x20—\x20per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20(the\x20buyer\x27s\x20order\x20is\x20rejected\x20while\x20the\x20fund\x20'+'cannot\x20cover\x203x\x20that\x20order),\x20so\x20under-ceiling\x20funding\x20stops\x20sales\x20instead\x20of\x20stranding\x20awards.','recommendation':'For\x20every\x20order\x20you\x20want\x20to\x20sell,\x20keep\x20the\x20fund\x20at\x20>=\x20'+MAX_INDEMNITY_MULTIPLE+'x\x20THAT\x20order\x20via\x20'+'compensation_fund_add\x20(a\x200.49\x20course\x20needs\x201.47;\x20a\x203.99\x20course\x20needs\x2011.97\x20—\x20no\x20cross-SKU\x20subsidy).\x20'+('Above\x20'+MAX_INDEMNITY_MULTIPLE+'x\x20the\x20current\x20order\x20is\x20optional:\x20it\x20only\x20buys\x20tolerance\x20for\x20several\x20')+'CONCURRENT\x20claims\x20against\x20the\x20one\x20per-Service\x20pool\x20(there\x20is\x20no\x20on-chain\x20concurrency\x20limit),\x20which\x20'+'is\x20a\x20capital-allocation\x20choice.\x20A\x20service\x20with\x20NO\x20fund\x20sells\x20freely\x20—\x20that\x20is\x20the\x20documented\x20'+'no-protection\x20posture\x20(audit_compensation_fund\x20discloses\x20it;\x20buyers\x20see\x20coverage\x20via\x20order\x20monitor).'},{'id':'audit_description','description':'Service\x20should\x20have\x20a\x20description','severity':'warning','fields':['description'],'check':a=>typeof a?.['description']==='string'&&a['description']['length']>0x0,'message':()=>'Service\x20has\x20no\x20description.\x20Customers\x20won\x27t\x20understand\x20what\x20you\x27re\x20offering.','recommendation':'Write\x20a\x20clear\x20description\x20of\x20the\x20service,\x20including\x20deliverables,\x20timelines,\x20and\x20terms.'},{'id':'audit_named_new_name','description':'Service\x20being\x20created\x20should\x20have\x20a\x20name','severity':'warning','check':a=>serviceNameOf(a)!==undefined,'message':()=>'Creating\x20a\x20service\x20without\x20a\x20name\x20makes\x20it\x20hard\x20to\x20reference\x20and\x20organize.','recommendation':'Set\x20object:{name:\x20...}\x20(or\x20namedNew.name)\x20following\x20the\x20convention:\x20<projectPrefix>_<service>_<purpose>.'},{'id':'audit_customer_required_needs_um','description':'customer_required\x20requires\x20a\x20Contact\x20bound\x20via\x20um\x20(SDK-enforced\x20hard\x20link;\x20mirrored\x20here)','severity':'error','fields':['customer_required','um'],'check':a=>{const b=Array['isArray'](a?.['customer_required'])?a['customer_required']:[];if(b['length']===0x0)return!![];return!!a?.['um'];},'message':()=>'customer_required\x20is\x20set\x20but\x20no\x20Contact\x20is\x20bound\x20via\x20um\x20—\x20customers\x20cannot\x20deliver\x20the\x20required\x20private\x20information\x20through\x20end-to-end\x20encrypted\x20Messenger.','recommendation':'Bind\x20um:{Contact\x20name/id}\x20in\x20the\x20same\x20call\x20(SDK\x20order_new\x20will\x20fail\x20the\x20buyer\x20otherwise).'},{'id':'audit_customer_required_is_declared_not_enforced','description':'customer_required\x20has\x20no\x20on-chain\x20enforcement\x20at\x20buy\x20time\x20—\x20a\x20Guard\x20must\x20gate\x20fulfilment','severity':'warning','fields':['customer_required'],'check':a=>{const b=Array['isArray'](a?.['customer_required'])?a['customer_required']:[];return b['length']===0x0;},'message':a=>{const b=Array['isArray'](a?.['customer_required'])?a['customer_required']:[];return'customer_required\x20('+b['length']+'\x20field(s):\x20'+b['join'](',\x20')+')\x20is\x20DECLARATIVE\x20ONLY:\x20the\x20on-chain\x20purchase\x20entry\x20never\x20reads\x20this\x20list,\x20so\x20an\x20order\x20that\x20supplies\x20none\x20of\x20these\x20fields\x20is\x20still\x20created\x20and\x20progresses.\x20Nothing\x20on-chain\x20will\x20stop\x20it.';},'recommendation':'Bind\x20pattern.required_info_evidence_gate\x20(schema_query\x20action=get_guard_design_patterns)\x20on\x20the\x20first\x20forward\x20that\x20needs\x20the\x20information:\x20query\x20\x27order.required_info\x20some\x27\x20(1572)\x20over\x20the\x20Order.\x20The\x20buyer\x20records\x20the\x20credential\x20via\x20order_required_info_update:\x20EITHER\x20the\x20merchant\x27s\x20IM\x20user\x20address\x20resolved\x20from\x20the\x20Service\x27s\x20Contact\x20(zero\x20cost,\x20address\x20record\x20only)\x20OR\x20an\x20on-chain\x20WTS\x20Proof\x20object\x20address\x20(embeds\x20the\x20merchant\x20IM\x20address\x20and\x20the\x20last-message\x20timestamp;\x20costs\x20gas,\x20publicly\x20verifiable).\x20\x27order.required_info\x27\x20(1573)\x20returns\x20the\x20recorded\x20address\x20but\x20aborts\x20while\x20nothing\x20is\x20recorded\x20—\x20gate\x20on\x201572\x20first.\x20When\x20the\x20listing\x20genuinely\x20promises\x20a\x20PER-ORDER\x20credential,\x20prefer\x20the\x20controlled\x20bind\x20entry\x20(order_required_info_bind):\x20the\x20chain\x20verifies\x20the\x20Proof\x20is\x20about\x20THIS\x20order\x20and\x20owner-created\x20at\x20write\x20time\x20and\x20rejects\x20a\x20mismatch\x20—\x20no\x20guard\x20needed\x20to\x20catch\x20a\x20wrong-proof\x20record.\x20BOUNDARY:\x20that\x20binding\x20proves\x20the\x20credential\x20AUTHOR\x20only,\x20never\x20its\x20content\x20or\x20any\x20rating\x20—\x20do\x20not\x20mirror\x20it\x20onto\x20review/reward\x20claims;\x20public\x20reviews\x20are\x20Repository\x20rows\x20whose\x20values\x20are\x20enforced\x20guard-side\x20via\x20data-value\x20probes,\x20not\x20through\x20Proof\x20objects.'},{'id':'audit_dangling_deps','description':'Service\x20dependencies\x20should\x20be\x20fully\x20created','severity':'error','check':(a,b)=>{if(!a?.['publish'])return!![];if(!b?.['graph'])return!![];const c=b['graph']['findDanglingDependencies']()??[];return c['length']===0x0;},'message':()=>'Service\x20references\x20objects\x20that\x20are\x20not\x20yet\x20created.\x20Publishing\x20will\x20lock\x20these\x20references.','recommendation':'Ensure\x20all\x20referenced\x20objects\x20(machine,\x20allocators,\x20guards)\x20are\x20created\x20and\x20finalized\x20before\x20publishing.'},{'id':'audit_type_parameter','description':'Service\x20should\x20have\x20a\x20token\x20type\x20specified','severity':'info','fields':['type_parameter','namedNew'],'check':a=>typeParameterOf(a)!==undefined,'message':()=>'No\x20payment\x20token\x20type\x20specified.\x20Defaulting\x20to\x20WOW\x20(0x2::wow::WOW).','recommendation':'Explicitly\x20set\x20type_parameter\x20(inside\x20object:{...})\x20if\x20you\x20want\x20to\x20accept\x20non-WOW\x20tokens\x20(e.g.,\x20USDT,\x20ETH).'},{'id':'audit_wip_unreachable_url','description':'sale.wip\x20must\x20be\x20a\x20publicly\x20reachable\x20URL\x20(no\x20localhost/LAN/file\x20paths)','severity':'error','fields':['sales'],'check':(a,b)=>{if(typeof b?.['network']==='string'&&/local/i['test'](b['network']))return!![];const c=salesItemsOf(a);if(c['length']===0x0)return!![];return c['every'](e=>{const f=e?.['wip'];if(typeof f!=='string'||f['trim']()==='')return!![];return!/^(https?:\/\/)?(localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0)/i['test'](f)&&!/^https?:\/\/(192\.168\.|10\.|172\.(1[6-9]|2\d|3[01])\.)/i['test'](f)&&!/^file:/i['test'](f);});},'message':a=>{const b=salesItemsOf(a)['map'](c=>String(c?.['wip']??''))['filter'](c=>c!==''&&(/^(https?:\/\/)?(localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0)/i['test'](c)||/^https?:\/\/(192\.168\.|10\.|172\.(1[6-9]|2\d|3[01])\.)/i['test'](c)||/^file:/i['test'](c)));return'sale.wip\x20is\x20NOT\x20publicly\x20reachable\x20('+b['join'](',\x20')+').\x20The\x20URL\x20is\x20stored\x20on-chain\x20and\x20every\x20'+'customer\x20fetches\x20it\x20at\x20order\x20time\x20—\x20order_new\x20aborts\x20100%\x20for\x20anyone\x20outside\x20your\x20machine.\x20'+'Host\x20the\x20file\x20publicly:\x20wip_file\x20upload\x20to\x20the\x20official\x20free\x20host\x20(wip.store.wowok.net)\x20or\x20your\x20own\x20'+'endpoint\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20website)';},'recommendation':'Replace\x20the\x20internal\x20URL\x20with\x20a\x20public\x20one.\x20Internal\x20URLs\x20are\x20sanctioned\x20ONLY\x20on\x20env.network=localnet\x20for\x20testing.'},{'id':'audit_wip_missing_public','description':'On\x20public\x20networks\x20every\x20sale\x20item\x20should\x20carry\x20a\x20product-detail\x20(wip)\x20URL','severity':'info','fields':['sales'],'check':(a,b)=>{const c=b?.['network'];if(typeof c==='string'&&/local/i['test'](c))return!![];const e=salesItemsOf(a);if(e['length']===0x0)return!![];return e['every'](f=>typeof f?.['wip']==='string'&&f['wip']['trim']()!=='');},'message':()=>'One\x20or\x20more\x20sale\x20items\x20have\x20NO\x20product-detail\x20(wip)\x20URL.\x20The\x20listing\x20works,\x20but\x20customers\x20see\x20no\x20detail\x20'+'page\x20and\x20the\x20service\x27s\x20market\x20completeness\x20score\x20is\x20downgraded.\x20Easiest:\x20upload\x20the\x20detail\x20file\x20with\x20the\x20'+'wip_file\x20tool\x20to\x20the\x20official\x20free\x20host\x20(https://wip.store.wowok.net\x20—\x2010\x20files\x20per\x20account,\x20180-day\x20'+'retention,\x2012MB/file)\x20and\x20put\x20the\x20returned\x20URL\x20into\x20sale.wip;\x20or\x20host\x20your\x20own\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20'+'your\x20website).\x20For\x20long-lived\x20mainnet\x20listings\x20prefer\x20your\x20own\x20endpoint\x20so\x20the\x20detail\x20outlives\x20the\x20free\x20'+'retention\x20window','recommendation':'Upload\x20a\x20WIP\x20file\x20via\x20wip_file\x20and\x20set\x20sale.wip\x20on\x20each\x20item\x20before/after\x20publish\x20(sales\x20stays\x20modifiable).'},{'id':'audit_free_cancel_window_anchor','description':'A\x20free-cancellation\x20window\x20must\x20either\x20ride\x20the\x20stay-date\x20Repository\x20rail\x20or\x20be\x20disclosed\x20as\x20anchored\x20on\x20booking\x20time','severity':'warning','fields':['creation_plan'],'check':(a,b)=>{if(!a?.['publish'])return!![];const c=Array['isArray'](a?.['creation_plan']?.['guards'])?a['creation_plan']['guards']:[],e=c['some'](h=>{const i=typeof h?.['key']==='string'?h['key']:'',j=typeof h?.['purpose']==='string'?h['purpose']:'';return/free[._ ]?cancel/i['test'](i)||/cancell?ation/i['test'](j)&&/window|hours?|days?/i['test'](j);});if(!e)return!![];const f=c['some'](h=>{const i=typeof h?.['template_id']==='string'?h['template_id']:'',j=typeof h?.['purpose']==='string'?h['purpose']:'',k=/repository_data_check/i['test'](i)&&/stay[._ ]?date|use[._ ]?date|check[._ ]?in[._ ]?date|arrival/i['test'](j),l=/anchored on (booking|order\.time)|booking time by default/i['test'](j);return k||l;});return f;},'message':()=>'A\x20free-cancellation\x20window\x20is\x20declared\x20WITHOUT\x20a\x20stay-date\x20anchor\x20and\x20WITHOUT\x20a\x20booking-time\x20disclosure.\x20'+'The\x20chain\x20has\x20no\x20use-date\x20primitive\x20(order.time\x20is\x20the\x20BOOKING\x20moment\x20—\x20written\x20once,\x20immutable),\x20so\x20the\x20'+'window\x20enforces\x20as\x20\x27from\x20booking\x27.\x20If\x20your\x20buyer-facing\x20copy\x20promises\x20\x27X\x20hours\x20before\x20arrival/check-in\x27,\x20'+'the\x20promised\x20window\x20has\x20typically\x20ALREADY\x20CLOSED\x20at\x20booking\x20(bkd8\x20BK-02,\x20live\x20mainnet)\x20—\x20a\x20silent\x20policy\x20'+'inversion\x20that\x20mis-sells\x20the\x20listing.\x20TWO\x20WAYS\x20OUT:\x20(1)\x20FAITHFUL\x20WINDOW\x20—\x20ride\x20the\x20STAY-DATE\x20PRESCRIPTION\x20'+'(time_anchors.free_cancel\x20in\x20the\x20travel\x20templates):\x20a\x20batched\x20id_from\x20None(0)\x20\x27stay_date\x27\x20row\x20(u64\x20epoch-ms)\x20'+'written\x20into\x20the\x20order-scoped\x20Repository\x20at\x20buy\x20time,\x20plus\x20a\x20pattern.repository_data_check\x20leg\x20comparing\x20'+'Clock\x20against\x20row\x20+\x20window\x20offset\x20(CLOSING\x20<=);\x20(2)\x20HONEST\x20DEFAULT\x20—\x20keep\x20the\x20booking-time\x20anchor\x20and\x20state\x20'+'\x27free\x20cancellation\x20within\x20X\x20hours\x20of\x20BOOKING\x27\x20in\x20the\x20buyer-facing\x20copy\x20so\x20the\x20promise\x20matches\x20the\x20chain','recommendation':'Either\x20add\x20the\x20stay-date\x20Repository\x20row\x20+\x20repository_data_check\x20leg\x20(faithful\x20pre-use\x20window),\x20or\x20restate\x20the\x20cancellation\x20policy\x20as\x20\x27from\x20booking\x27\x20in\x20all\x20buyer-facing\x20copy.'}];const RULE_INDEX=new Map(AUDIT_RULES['map'](a=>[a['id'],a]));function readSeverityOverrides(){try{const {getJudgmentDoc:a}=require('../config/judgment.js');if(typeof a!=='function')return{};const b=a()?.['rules']?.['domains'];if(!b||typeof b!=='object')return{};const c={};for(const d of Object['values'](b)){const e=d?.['severity_overrides'];if(!e||typeof e!=='object')continue;for(const [f,g]of Object['entries'](e)){if(g==='error'||g==='warning'||g==='info')c[f]=g;}}return c;}catch{return{};}}export function auditService(a,b){const c=[],d=a?.['publish']===!![]&&typeof a?.['object']==='string',e=readSeverityOverrides();for(const f of AUDIT_RULES){try{if(d&&f['fields']&&!f['fields']['some'](g=>a[g]!==undefined))continue;!f['check'](a,b)&&c['push']({'rule_id':f['id'],'severity':e[f['id']]??f['severity'],'message':f['message'](a),'recommendation':f['recommendation']});}catch{}}return c;}export function hasBlockingErrors(a){return a['some'](b=>b['severity']==='error');}export function getErrors(a){return a['filter'](b=>b['severity']==='error');}export function getWarnings(a){return a['filter'](b=>b['severity']==='warning');}export function summarizeFindings(a){if(a['length']===0x0)return'All\x20audit\x20checks\x20passed.';const b=getErrors(a),c=getWarnings(a),d=a['filter'](g=>g['severity']==='info'),e=[];if(b['length']>0x0)e['push'](b['length']+'\x20error(s)');if(c['length']>0x0)e['push'](c['length']+'\x20warning(s)');if(d['length']>0x0)e['push'](d['length']+'\x20info');return'Audit:\x20'+e['join'](',\x20')+'.\x20Review\x20before\x20publishing.';}export const AUDIT_RULES_VERSION=0xb;
|
|
1
|
+
import{MAX_INDEMNITY_MULTIPLE}from'./onchain-constants.js';import{TWO_TX_RENEW_RECIPE}from'./protocol-facts.js';import{lintForwardAmbiguity,findLoopCycles}from'./machine-topology.js';import{isRenewalLoopEdge}from'../participation/radar-core.js';function numericAmount(a){if(typeof a==='number')return Number['isFinite'](a)?a:undefined;if(typeof a==='string'){const b=a['trim']();if(/^\d+$/['test'](b))return Number(b);}return undefined;}export{numericAmount};export function salesItemsOf(a){if(Array['isArray'](a?.['sales']))return a['sales'];if(Array['isArray'](a?.['sales']?.['sales']))return a['sales']['sales'];return[];}export function allocatorCountOf(a){const b=a?.['order_allocators'];if(Array['isArray'](b))return b['length'];if(Array['isArray'](b?.['allocators']))return b['allocators']['length'];return 0x0;}export function arbitrationRefsOf(b){const c=b?.['arbitrations'];if(Array['isArray'](c))return c['filter'](e=>typeof e==='string');if(Array['isArray'](c?.['objects']))return c['objects']['filter'](e=>typeof e==='string');return[];}export function compensationFundOf(a){if(a?.['compensation_fund_add']?.['balance']!=null)return a['compensation_fund_add']['balance'];if(a?.['compensation_fund']!=null)return a['compensation_fund'];return undefined;}export function serviceNameOf(a){if(typeof a?.['object']==='string')return a['object'];if(typeof a?.['object']?.['name']==='string'&&a['object']['name'])return a['object']['name'];if(typeof a?.['namedNew']?.['name']==='string'&&a['namedNew']['name'])return a['namedNew']['name'];return undefined;}export function typeParameterOf(a){if(typeof a?.['type_parameter']==='string'&&a['type_parameter'])return a['type_parameter'];if(typeof a?.['object']?.['type_parameter']==='string'&&a['object']['type_parameter'])return a['object']['type_parameter'];if(typeof a?.['namedNew']?.['type_parameter']==='string'&&a['namedNew']['type_parameter'])return a['namedNew']['type_parameter'];return undefined;}export const DISPUTE_FAMILY_NODE_REGEX=/(^|_)(disputed?|arbitration|arb)(_|$)/i;export const FUND_TERMINAL_NODE_REGEX=/^(refund|refunded|deposit_refunded|deposit_deducted|cancel|cancelled)$/i;export const ANTI_PATTERN_NODE_REGEX=new RegExp(DISPUTE_FAMILY_NODE_REGEX['source']+'|'+FUND_TERMINAL_NODE_REGEX['source'],'i');export const REMEDY_FAMILY_NODE_REGEX=/(revis|review|rework|refund|cancel|return|claim)/i;export function isRemedyLoopEdge(a,b){return REMEDY_FAMILY_NODE_REGEX['test'](a)||REMEDY_FAMILY_NODE_REGEX['test'](b);}export function classifyLoopCycle(a,b){for(let c=0x0;c<a['length'];c++){if(isRenewalLoopEdge(a[c],a[(c+0x1)%a['length']]))return'renewal';}if(b==='review-loop')return'remedy';if(b==='paid-cycle')return'charge';if(a['some'](d=>REMEDY_FAMILY_NODE_REGEX['test'](d)))return'remedy';return'charge';}export function auditMachineNodes(a,b){const c=[],d=[];if(!Array['isArray'](a)||a['length']===0x0)return d['push']('pre_publish:\x20machine\x20node\x20set\x20unavailable\x20—\x20topology\x20not\x20verifiable;\x20'+'verify\x20via\x20machineNode2file\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)'),{'critical':c,'warnings':d};const e=a;for(const t of e){const u=typeof t?.['name']==='string'?t['name']:'';if(!u)continue;if(DISPUTE_FAMILY_NODE_REGEX['test'](u))c['push']('R-M1-11:\x20machine\x20node\x20\x22'+u+'\x22\x20models\x20dispute\x20flow\x20—\x20'+'disputes\x20must\x20route\x20via\x20the\x20separate\x20Arbitration\x20object\x20(off-Machine);\x20'+'rename\x20the\x20node\x20to\x20the\x20business\x20state\x20that\x20triggers\x20it');else FUND_TERMINAL_NODE_REGEX['test'](u)&&d['push']('R-M1-11:\x20machine\x20node\x20\x22'+u+'\x22\x20uses\x20a\x20bare\x20fund-terminal\x20name\x20—\x20reaching\x20'+'it\x20moves\x20no\x20funds\x20by\x20itself.\x20This\x20is\x20legitimate\x20ONLY\x20when\x20a\x20refund\x20allocator\x20'+'rail\x27s\x20guard\x20anchors\x20to\x20this\x20node\x20(per-node\x20refund\x20tracks);\x20otherwise\x20rename\x20it\x20'+'to\x20the\x20business\x20state\x20(e.g.\x20cancel_requested\x20/\x20closed_cancel)\x20and\x20route\x20the\x20'+'refund\x20via\x20an\x20Allocator\x20triggered\x20by\x20that\x20state.\x20The\x20template\x20scanner\x20verifies\x20'+'the\x20anchoring\x20when\x20a\x20template\x20is\x20present.');}const g=new Set();for(const v of e){const w=typeof v?.['name']==='string'?v['name']:'';if(!w)continue;g['has'](w)&&c['push']('MC-C-04:\x20duplicate\x20machine\x20node\x20name\x20\x22'+w+'\x22\x20—\x20on-chain\x20will\x20reject\x20the\x20publish\x20transaction'),g['add'](w);}const h=e['some'](x=>Array['isArray'](x?.['pairs'])&&x['pairs']['some'](y=>y?.['prev_node']===''));!h&&c['push']('Machine\x20has\x20no\x20entry\x20pair\x20(prev_node=\x22\x22)\x20—\x20Progress\x20can\x20never\x20advance\x20'+'from\x20the\x20initial\x20state;\x20orders\x20are\x20permanently\x20stuck');const i=new Map();for(const x of e){const y=typeof x?.['name']==='string'?x['name']:'';if(!y)continue;if(!i['has'](y))i['set'](y,[]);for(const z of x?.['pairs']??[]){const A=z?.['prev_node'];if(typeof A==='string'&&A!==''){const B=i['get'](A);if(B)B['push'](y);else i['set'](A,[y]);}}}const j=findLoopCycles(i)['map'](C=>({'c':C,'tier':classifyLoopCycle(C['cycle'],b)})),k=j['filter'](C=>C['tier']==='renewal'),l=j['filter'](C=>C['tier']==='remedy'),m=j['filter'](C=>C['tier']==='charge');m['length']>0x0&&c['push']('pre_publish:\x20machine\x20contains\x20charge-bearing\x20loop\x20cycle(s)\x20'+m['map'](C=>'['+C['c']['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20'+'on-chain\x20a\x20revisit\x20is\x20NOT\x20verified\x20to\x20re-fund\x20the\x20Allocation,\x20and\x20this\x20static\x20pass\x20sees\x20only\x20the\x20forward\x27s\x20guard\x20reference\x20'+'(never\x20the\x20guard\x20table),\x20so\x20a\x20per-revisit-fee\x20cycle\x20(retake\x20/\x20session-card\x20shape)\x20is\x20UNPROVABLE\x20here\x20even\x20though\x20the\x20'+'allocation.balance\x20Guard\x20query\x20(1051,\x20witness\x20OrderAllocation\x20109)\x20makes\x20the\x20fee\x20enforceable\x20at\x20the\x20guard\x20layer\x20'+'(zero-value\x20re-delivery\x20cycles,\x20test/11\x20R2-F3\x20/\x20crs\x20P2-3).\x20THREE\x20WAYS\x20OUT\x20—\x20'+'(1)\x20NO-CHARGE\x20revisit\x20(F-06,\x20ctra-mn\x20261019:\x20a\x20delivered->in_progress\x20revision\x20loop\x20is\x20business-correct\x20and\x20was\x20false-CRITICAL\x20here):\x20'+'declare\x20`reentry_kind:\x20\x22review-loop\x22`\x20on\x20this\x20publish\x20payload\x20(AP-3\x20—\x20machine-checkable,\x20no\x20renaming\x20needed)\x20'+'OR\x20rename\x20ANY\x20ONE\x20node\x20of\x20the\x20cycle\x20with\x20a\x20remedy\x20word\x20root\x20the\x20classifier\x20reads\x20—\x20revis*/review*/rework*/refund*/cancel*/return*/claim*\x20'+'(e.g.\x20\x27revising\x27\x20instead\x20of\x20\x27in_progress\x27)\x20—\x20and\x20the\x20cycle\x20reclassifies\x20as\x20remedy\x20tier\x20(warning,\x20not\x20a\x20blocker);\x20'+'(2)\x20GENUINELY\x20charge-bearing\x20with\x20neutral\x20names:\x20declare\x20`reentry_kind:\x20\x22paid-cycle\x22`\x20(keeps\x20this\x20block\x20—\x20'+'it\x20is\x20the\x20declaration\x20of\x20intent)\x20and\x20bind\x20the\x20fund-gate\x20Guard\x20on\x20the\x20loop\x20forward\x20'+'(constant\x20=\x20order\x20address,\x20convert_witness\x20OrderAllocation,\x20allocation.balance\x20>=\x20revisit\x20fee)\x20AND\x20publish\x20through\x20a\x20template\x20'+'carrying\x20that\x20convention\x20—\x20PRE-STATE\x20CONSTRAINT\x20(esound-mn-261021\x20B-1):\x20the\x20gate\x20reads\x20the\x20COMMITTED\x20pre-transaction\x20'+'balance,\x20so\x20the\x20revisit\x20funds\x20must\x20be\x20committed\x20in\x20a\x20PRIOR\x20transaction.\x20'+TWO_TX_RENEW_RECIPE+'\x20'+'Alternatively\x20replace\x20the\x20loop\x20with\x20per-period\x20NEW\x20Orders\x20(REUSE\x20pattern\x20—\x20a\x20fresh\x20order\x20per\x20period\x20instead\x20of\x20an\x20in-order\x20loop\x20that\x20replays\x20its\x20forwards\x20every\x20lap).\x20'+'(3)\x20A\x20funded\x20renewal\x20loop\x20(post-period\x20node\x20back\x20into\x20a\x20charging\x20node,\x20advanced\x20via\x20the\x20one-PTB\x20order_renew\x20call,\x20'+'NO\x20balance\x20gate\x20on\x20the\x20renew\x20forward\x20—\x20see\x20the\x20PRE-STATE\x20CONSTRAINT\x20above)\x20'+'is\x20the\x20only\x20sanctioned\x20charge-bearing\x20cycle\x20shape\x20for\x20in-order\x20renewals.');k['length']>0x0&&d['push']('pre_publish:\x20machine\x20contains\x20renewal\x20loop\x20cycle(s)\x20'+k['map'](C=>'['+C['c']['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20on-chain\x20a\x20revisit\x20'+'is\x20NOT\x20verified\x20to\x20re-fund\x20the\x20Allocation.\x20Every\x20renewal/loop\x20forward\x20MUST\x20carry\x20the\x20new-period\x20'+'payment\x20into\x20the\x20order\x20escrow\x20(use\x20the\x20order\x20call\x27s\x20order_renew\x20field:\x20create\x20the\x20period\x20payment,\x20receive\x20it\x20into\x20the\x20'+'allocation,\x20and\x20advance\x20the\x20progress\x20—\x20all\x20in\x20one\x20transaction),\x20or\x20the\x20loop\x20allows\x20zero-value\x20'+'re-delivery\x20cycles\x20(test/11\x20R2-F3).\x20'+'PRE-STATE\x20CONSTRAINT\x20(esound-mn-261021\x20B-1,\x20mainnet-verified):\x20a\x20guard\x20on\x20the\x20renew\x20forward\x20reading\x20'+'allocation.balance\x20(query\x201051)\x20evaluates\x20the\x20COMMITTED\x20pre-transaction\x20balance\x20—\x20the\x20same-PTB\x20order_renew\x20'+'payment\x20is\x20INVISIBLE\x20to\x20it,\x20so\x20a\x20balance-gated\x20renew\x20forward\x20ALWAYS\x20aborts.\x20NEVER\x20bind\x20a\x20balance\x20gate\x20to\x20a\x20'+'forward\x20that\x20order_renew\x20advances\x20in\x20the\x20same\x20PTB.\x20'+TWO_TX_RENEW_RECIPE+'\x20'+'The\x20zero-value\x20protection\x20rides\x20this\x20routing\x20convention\x20(order_renew\x27s\x20amount).');l['length']>0x0&&d['push']('pre_publish:\x20machine\x20contains\x20remedy\x20loop\x20cycle(s)\x20'+l['map'](C=>'['+C['c']['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20'+'a\x20same-order\x20revisit\x20(revision/review/rework/refund/cancel\x20family)\x20implies\x20NO\x20new\x20charge,\x20so\x20no\x20fund\x20gate\x20is\x20needed\x20on\x20it\x20'+'(the\x20allocation.balance\x20query\x20exists\x20but\x20is\x20irrelevant\x20here).\x20Visible\x20by\x20design\x20(crs\x20P2-3):\x20if\x20the\x20business\x20EVER\x20intends\x20'+'a\x20revisit\x20to\x20cost\x20money,\x20that\x20fee\x20IS\x20enforceable\x20via\x20the\x20balance\x20query\x20(1051)\x20—\x20but\x20that\x20reshapes\x20the\x20cycle\x20into\x20the\x20'+'charge\x20tier\x20above;\x20keep\x20remedy\x20revisits\x20free\x20or\x20restructure\x20as\x20per-period\x20NEW\x20Orders.');for(const C of e){const D=typeof C?.['name']==='string'?C['name']:'?';for(const E of C?.['pairs']??[]){for(const F of E?.['forwards']??[]){const G=F?.['namedOperator']!==undefined&&F?.['namedOperator']!==null,H=F?.['permissionIndex']!==undefined&&F?.['permissionIndex']!==null,I=F?.['guard']!==undefined&&F?.['guard']!==null;!G&&!H&&!I&&d['push']('pre_publish:\x20node\x20\x22'+D+'\x22\x20forward\x20\x22'+String(F?.['name']??'?')+'\x22\x20has\x20no\x20executor\x20binding\x20(namedOperator\x20/\x20permissionIndex\x20/\x20guard)\x20—\x20no\x20one\x20can\x20advance\x20it');}}}const o=computeTerminalReachability(a),q=new Map(),r=new Map();for(const J of e){for(const K of J?.['pairs']??[]){const L=K?.['prev_node'];if(typeof L!=='string'||L==='')continue;for(const M of K?.['forwards']??[]){const N=M?.['namedOperator']!=null&&String(M['namedOperator'])!==''?'operator:'+String(M['namedOperator']):M?.['permissionIndex']!=null?'permission:'+String(M['permissionIndex']):null;r['set'](L,(r['get'](L)??0x0)+0x1);if(N!=null){const O=q['get'](L)??new Set();O['add'](N),q['set'](L,O);}}}}for(const [P,Q]of q){(r['get'](P)??0x0)>=0x1&&Q['size']===0x1&&d['push']('pre_publish:\x20LIVE-ACT-02\x20node\x20\x22'+P+'\x22\x20—\x20every\x20outgoing\x20forward\x20binds\x20the\x20SAME\x20single\x20identity\x20('+[...Q]['join'](',\x20')+'):\x20'+'if\x20that\x20actor\x20goes\x20silent\x20the\x20order\x20LATCHES\x20here\x20and\x20the\x20escrow\x20freezes\x20—\x20there\x20is\x20no\x20counterparty\x20or\x20keeper\x20exit\x20'+'(alg26\x20261026\x20O9/O5\x20family:\x20changes_requested\x20with\x20only\x20a\x20contributor\x20resubmit\x20edge;\x20claimed\x20with\x20only\x20a\x20merchant\x20assign\x20edge).\x20'+'Design\x20the\x20exit\x20edge\x20NOW\x20(keeper/auto-close\x20forward\x20with\x20its\x20own\x20identity,\x20or\x20a\x20counterparty-signed\x20cancel/refund\x20edge)\x20—\x20'+'immutable\x20after\x20publish\x20(IMMUT-001).\x20If\x20single-operator-by-design,\x20this\x20warning\x20can\x20be\x20ignored');}const s=lintForwardAmbiguity(a,'pre_publish');return c['push'](...s['critical']),d['push'](...s['warnings']),o['unreachable']['length']>0x0&&d['push']('pre_publish:\x20unreachable\x20machine\x20node(s)\x20'+o['unreachable']['map'](R=>'\x22'+R+'\x22')['join'](',\x20')+'\x20—\x20'+'no\x20path\x20from\x20the\x20entry\x20pair\x20reaches\x20them;\x20dead\x20topology\x20is\x20frozen\x20at\x20publish\x20(IMMUT-001).\x20'+'Wire\x20them\x20into\x20the\x20flow\x20or\x20remove\x20them\x20before\x20publish'),{'critical':c,'warnings':d};}export function computeTerminalReachability(a){const b=[],c=[];if(!Array['isArray'](a)||a['length']===0x0)return{'terminals':b,'unreachable':c};const d=a,e=new Map(),f=[],g=[];for(const j of d){const k=typeof j?.['name']==='string'?j['name']:'';if(!k)continue;f['push'](k);if(!e['has'](k))e['set'](k,[]);let l=![];for(const m of j?.['pairs']??[]){const o=m?.['prev_node'];if(o==='')l=!![];else{if(typeof o==='string'&&o!==''){const q=e['get'](o);if(q)q['push'](k);else e['set'](o,[k]);}}}if(l)g['push'](k);}if(f['length']===0x0||g['length']===0x0)return{'terminals':b,'unreachable':c};const h=new Set(),i=[...g];while(i['length']>0x0){const r=i['pop']();if(h['has'](r))continue;h['add'](r);for(const s of e['get'](r)??[])i['push'](s);}for(const t of f){if(!h['has'](t))c['push'](t);else{if((e['get'](t)??[])['length']===0x0)b['push'](t);}}return{'terminals':b,'unreachable':c};}export const REVIEW_FAMILY_NODE_REGEX=/(^|_)(review|reviews|reviewed|reviewing|evaluated|evaluate|feedback|rating|rated)(_|$)/i;export function lintReviewLockedTerminals(a,b){const c=[],d=[];if(!Array['isArray'](a)||a['length']===0x0)return{'critical':c,'warnings':d};const e=a,h=u=>Array['isArray'](u?.['pairs'])?u['pairs']:Array['isArray'](u?.['value'])?u['value']:[],i=[],j=[],k=[];for(const u of e){const v=typeof u?.['name']==='string'?u['name']:'';if(!v)continue;j['push'](v);let w=![];for(const x of h(u)){const y=x,z=y?.['prev_node'];if(z==='')w=!![];const A=Array['isArray'](y?.['forwards'])?y['forwards']:[],B=[];for(const C of A){const D=C,E=D?.['guard'],F=typeof E==='string'&&E['trim']()!==''?E:E&&typeof E==='object'?E['guard']??E['$ref']:undefined;if(typeof F==='string'&&F['trim']()!=='')B['push'](F);}typeof z==='string'&&z!==''&&i['push']({'from':z,'to':v,'guardRefs':B});}if(w)k['push'](v);}if(j['length']===0x0||k['length']===0x0)return{'critical':c,'warnings':d};const l=computeTerminalReachability(a);if(l['terminals']['length']===0x0)return{'critical':c,'warnings':d};const m=G=>{if(G['guardRefs']['length']===0x0)return![];for(const H of G['guardRefs']){const I=b['get'](H['toLowerCase']());if(!I||I['length']===0x0)return![];const J=I['every'](K=>REVIEW_FAMILY_NODE_REGEX['test'](K));if(!J||I['includes'](G['from']))return![];}return!![];},o=G=>REVIEW_FAMILY_NODE_REGEX['test'](G),q=G=>{const H=new Map();for(const K of i){if(m(K))continue;if(G&&(o(K['from'])||o(K['to'])))continue;const L=H['get'](K['from']);if(L)L['push'](K['to']);else H['set'](K['from'],[K['to']]);}const I=new Set(),J=[...k];while(J['length']>0x0){const M=J['pop']();if(I['has'](M))continue;I['add'](M);for(const N of H['get'](M)??[])J['push'](N);}return I;},r=q(![]),s=q(!![]);for(const G of l['terminals']){if(!r['has'](G))c['push']('REVIEW-LOCK-01:\x20terminal\x20\x22'+G+'\x22\x20is\x20enterable\x20ONLY\x20through\x20forward(s)\x20whose\x20guard\x20pins\x20a\x20'+'review/feedback\x20node\x20the\x20edge\x20itself\x20does\x20not\x20depart\x20from\x20—\x20the\x20rail\x20can\x20never\x20fire\x20(the\x20guard\x20asserts\x20a\x20'+'progress\x20state\x20this\x20transition\x20cannot\x20produce),\x20so\x20a\x20buyer\x20who\x20never\x20reviews\x20strands\x20every\x20order\x27s\x20'+'escrow\x20permanently.\x20Machine\x20topology\x20is\x20immutable\x20after\x20publish\x20(IMMUT-001).\x20Fix\x20BEFORE\x20publish:\x20'+'re-pin\x20the\x20settlement\x20guard\x20to\x20the\x20node\x20the\x20forward\x20actually\x20departs\x20from,\x20and\x20add\x20a\x20time-lock\x20keeper\x20'+'auto-confirm\x20rail\x20(the\x20template\x20deliver_confirm_timeout\x20convention)\x20so\x20settlement\x20never\x20depends\x20on\x20the\x20'+'buyer\x20choosing\x20to\x20review');else!s['has'](G)&&d['push']('REVIEW-LOCK-01:\x20terminal\x20\x22'+G+'\x22\x20is\x20reachable\x20only\x20THROUGH\x20a\x20review/feedback\x20node\x20—\x20a\x20buyer\x20who\x20'+'silently\x20skips\x20reviewing\x20can\x20never\x20let\x20their\x20order\x20reach\x20it.\x20The\x20sanctioned\x20shape\x20keeps\x20the\x20review\x20'+'stop\x20OPTIONAL\x20with\x20an\x20exit\x20edge\x20back\x20to\x20the\x20settlement\x20rail,\x20and\x20a\x20keeper\x20time-lock\x20rail\x20that\x20opens\x20'+'settlement\x20independently\x20(retail\x20deliver_confirm_timeout\x20convention).\x20Verify\x20one\x20of\x20the\x20two\x20exists;\x20'+'if\x20the\x20review\x20node\x20is\x20meant\x20to\x20be\x20keeper-advanceable,\x20this\x20is\x20satisfied\x20and\x20may\x20be\x20ignored');}return{'critical':c,'warnings':d};}export function arbitrationVotingLockDetail(a){if(!Array['isArray'](a))return null;if(a['length']>0x0)return null;return'voting_guard\x20is\x20empty\x20(no\x20guard-weighted\x20voters).\x20Plain\x20votes\x20hard-require\x20the\x20vote\x20permission\x20(358)\x20on\x20the\x20'+'arbitration\x27s\x20own\x20Permission:\x20only\x20that\x20Permission\x27s\x20admin\x20(its\x20creator,\x20by\x20default)\x20and\x20explicit\x20358\x20'+'grantees\x20pass\x20the\x20assert,\x20so\x20without\x20grants\x20the\x20disputing\x20CUSTOMER\x20can\x20never\x20vote\x20and\x20the\x20arb\x20admin\x20is\x20the\x20'+'only\x20possible\x20voter\x20AND\x20the\x20judge\x20—\x20a\x20dispute\x20opened\x20against\x20this\x20service\x20dead-locks\x20when\x20that\x20admin\x20is\x20'+'unresponsive.\x20Configure\x20a\x20public\x20voting_guard\x20on\x20the\x20Arbitration\x20(voting_guard\x20op=\x27set\x27\x20with\x20guard\x20+\x20vote\x20'+'weight\x20—\x20the\x20field\x20stays\x20mutable\x20after\x20publish;\x20the\x20standard\x20shape\x20is\x20tpl_voting_guard_open_vote,\x20the\x20'+'always-true\x20guard\x20at\x20FixedValue\x20weight\x201)\x20or\x20bind\x20an\x20arbitration\x20that\x20already\x20carries\x20one,\x20BEFORE\x20'+'publishing\x20this\x20service';}const TIME_PROFILE_UNIT_MS={'ms':0x1,'msec':0x1,'msecs':0x1,'millisecond':0x1,'milliseconds':0x1,'s':0x3e8,'sec':0x3e8,'secs':0x3e8,'second':0x3e8,'seconds':0x3e8,'m':0xea60,'min':0xea60,'mins':0xea60,'minute':0xea60,'minutes':0xea60,'h':0x36ee80,'hr':0x36ee80,'hrs':0x36ee80,'hour':0x36ee80,'hours':0x36ee80,'d':0x5265c00,'day':0x5265c00,'days':0x5265c00,'w':0x240c8400,'wk':0x240c8400,'wks':0x240c8400,'week':0x240c8400,'weeks':0x240c8400},TIME_PROFILE_DURATION_REGEX=/(\d+(?:\.\d+)?)\s*(ms|milliseconds?|msecs?|minutes?|mins?|seconds?|secs?|hours?|hrs?|days?|weeks?|wks?|min|sec|hr|wk|[smhdw])\b/gi,TIME_PROFILE_ADMISSION_REGEX=/compress(?:ed|ion)|accelerat(?:ed|ion)|shorten(?:ed)?(?:\s+for)?|test\s+(?:value|window|duration|constant)|demo\s+(?:value|window|duration)|for\s+(?:fast\s+|quick\s+)?test(?:ing)?|regression\s+(?:value|window)/i;function timeProfileIsTimeQuery(a){if(typeof a==='number')return a===0x4f7||a===0x4f8||a===0x500;if(typeof a==='string')return/(^|\.)time$|current_time/i['test'](a);return![];}function timeProfileNodeChildren(a){const b=[];for(const c of['nodes','node','nodeLeft','nodeRight','parameters','historyIdx','sessionIdx','forwardIdx','where','find','recipient']){const d=a[c];if(Array['isArray'](d))b['push'](...d);else{if(d&&typeof d==='object')b['push'](d);}}return b;}export function guardTimeProfileDetail(a){const b=typeof a['description']==='string'?a['description']:'',c=TIME_PROFILE_ADMISSION_REGEX['test'](b);let d=0x0;for(const l of b['matchAll'](TIME_PROFILE_DURATION_REGEX)){const n=TIME_PROFILE_UNIT_MS[l[0x2]['toLowerCase']()];if(!n)continue;const o=Number(l[0x1])*n;if(Number['isFinite'](o)&&o>d)d=o;}if(!c&&d===0x0)return null;const e=Array['isArray'](a['table'])?a['table']:[],f=p=>{const q=e['find'](r=>Number(r?.['identifier'])===p);return numericAmount(q?.['value']);},h=p=>{if(!p||typeof p!=='object')return![];const q=p;if(q['type']==='context'&&q['context']==='Clock')return!![];if(q['type']==='query'&&timeProfileIsTimeQuery(q['query']))return!![];if(q['type']==='query_progress_history_time')return!![];return timeProfileNodeChildren(q)['some'](h);},i=[],j=(p,q)=>{if(!p||typeof p!=='object')return;const r=p,s=q||typeof r['type']==='string'&&r['type']['startsWith']('calc_');if(r['type']==='identifier'&&s){const t=f(Number(r['identifier']));if(t!==undefined&&t>0x0)i['push'](t);}for(const u of timeProfileNodeChildren(r))j(u,s);};if(a['root']&&typeof a['root']==='object'&&h(a['root']))j(a['root'],![]);const k=i['find'](p=>p<d/0x64);if(k!==undefined){const p=q=>q>=0x5265c00?q/0x5265c00+'d':q>=0x36ee80?q/0x36ee80+'h':q>=0xea60?q/0xea60+'min':q/0x3e8+'s';return{'level':'critical','detail':'time\x20constant\x20'+p(k)+'\x20is\x20>=100x\x20below\x20the\x20production\x20duration\x20the\x20description\x20itself\x20'+('declares\x20('+p(d)+')\x20—\x20a\x20compressed\x20test\x20value\x20frozen\x20into\x20a\x20production\x20guard.\x20Guards\x20')+'freeze\x20at\x20publish\x20(IMMUT-001),\x20so\x20the\x20window\x20will\x20enforce\x20the\x20compressed\x20value\x20against\x20real\x20orders\x20'+'(klook\x20mainnet\x20261014:\x20\x2724h\x20free\x20cancellation\x27\x20enforced\x20as\x202\x20minutes).\x20Rebuild\x20the\x20guard\x20with\x20the\x20'+'production\x20duration\x20from\x20the\x20template\x20fee_params\x20BEFORE\x20publishing'};}if(c)return{'level':'warning','detail':'description\x20admits\x20compressed/accelerated\x20time\x20constants,\x20but\x20NO\x20time\x20constant\x20in\x20this\x20guard\x27s\x20logic\x20'+'tree\x20is\x20>=100x\x20below\x20the\x20declared\x20production\x20duration\x20—\x20the\x20values\x20look\x20production-scaled.\x20Manual\x20'+'review\x20requested\x20(prose\x20alone\x20no\x20longer\x20blocks\x20publish,\x20BF-07):\x20confirm\x20the\x20tree\x20constants\x20match\x20the\x20'+'production\x20durations\x20in\x20the\x20template\x20fee_params\x20BEFORE\x20publishing\x20—\x20guards\x20freeze\x20at\x20publish\x20'+'(IMMUT-001),\x20so\x20a\x20mis-scaled\x20window\x20(klook\x20mainnet\x20261014:\x20\x2724h\x20free\x20cancellation\x27\x20enforced\x20as\x202\x20'+'minutes)\x20is\x20UNFIXABLE'};return null;}export function rewardRefsOf(a){const b=a?.['rewards'];if(typeof b==='string'&&b['trim']()!=='')return[b];if(Array['isArray'](b))return b['filter'](c=>typeof c==='string'&&c['trim']()!=='');if(Array['isArray'](b?.['objects']))return b['objects']['filter'](c=>typeof c==='string'&&c['trim']()!=='');return[];}export function serviceRewardsUnfundedDetail(b){if(!b||typeof b!=='object')return null;const c=b['data']??b,d=Array['isArray'](c?.['guards'])?c['guards']:[],e=numericAmount(c?.['balance']?.['value']??c?.['balance']);if(e===undefined)return null;let f=0x0;for(const h of d){const i=h?.['amount'];if(i?.['type']!==0x1)continue;const j=numericAmount(i?.['value']?.['value']??i?.['value']);if(j!==undefined&&j>f)f=j;}if(f===0x0)return null;if(e>=f)return null;return'reward\x20pool\x20balance\x20'+e+'\x20cannot\x20cover\x20its\x20largest\x20single-claim\x20promise\x20('+f+').\x20'+'The\x20on-chain\x20publish\x20entry\x20does\x20NOT\x20verify\x20reward\x20funding\x20—\x20a\x20failed\x20reward_fund\x20transfer\x20still\x20'+'publishes\x20(onlyfans\x20mainnet\x20261014\x20shipped\x20a\x20store\x20promising\x20cashback\x20with\x20an\x20empty\x20pool),\x20and\x20the\x20'+'claim\x20aborts\x20once\x20the\x20pool\x20drains.\x20Fund\x20the\x20Reward\x20(reward_fund)\x20up\x20to\x20expected_orders\x20x\x20per-claim\x20'+'amount,\x20or\x20remove\x20the\x20reward\x20binding\x20BEFORE\x20publishing\x20this\x20service';}export const AUDIT_RULES=[{'id':'audit_machine_bound','description':'Service\x20should\x20have\x20a\x20Machine\x20workflow\x20bound\x20before\x20publish','severity':'warning','fields':['machine'],'check':(a,b)=>{if(!a?.['publish'])return!![];return!!a?.['machine'];},'message':()=>'Publishing\x20a\x20service\x20without\x20a\x20Machine\x20workflow.\x20Customers\x20won\x27t\x20have\x20a\x20structured\x20order\x20process.','recommendation':'Create\x20a\x20Machine\x20(workflow\x20template)\x20and\x20bind\x20it\x20to\x20the\x20service\x20before\x20publishing.\x20The\x20machine\x20field\x20becomes\x20IMMUTABLE\x20after\x20publish.'},{'id':'audit_order_allocators','description':'Service\x20should\x20have\x20order_allocators\x20for\x20fund\x20distribution','severity':'warning','fields':['order_allocators'],'check':a=>{if(!a?.['publish'])return!![];return allocatorCountOf(a)>0x0;},'message':()=>'Publishing\x20a\x20service\x20without\x20order_allocators.\x20Order\x20funds\x20cannot\x20be\x20auto-distributed\x20to\x20suppliers.','recommendation':'Configure\x20order_allocators\x20before\x20publishing\x20—\x20this\x20field\x20becomes\x20IMMUTABLE\x20after\x20publish.'},{'id':'audit_buy_guard','description':'Service\x20should\x20have\x20a\x20buy_guard\x20for\x20customer\x20screening','severity':'info','fields':['buy_guard'],'check':a=>!!a?.['buy_guard'],'message':()=>'No\x20buy_guard\x20configured\x20—\x20anyone\x20can\x20purchase\x20this\x20service\x20without\x20verification.','recommendation':'Consider\x20adding\x20a\x20Guard\x20to\x20verify\x20customer\x20eligibility\x20(e.g.,\x20identity,\x20wallet\x20balance,\x20location).'},{'id':'audit_arb_alloc_boundary','description':'Arbitration\x20and\x20Allocator\x20coexist\x20→\x20surface\x20the\x20two-system\x20boundary\x20reminder','severity':'warning','fields':['arbitrations','compensation_fund_add','compensation_fund','order_allocators'],'check':a=>{if(!a?.['publish'])return!![];const b=arbitrationRefsOf(a)['length']>0x0||compensationFundOf(a)!==undefined;return!(b&&allocatorCountOf(a)>0x0);},'message':()=>'Arbitration\x20and\x20Allocator\x20are\x20INDEPENDENT\x20systems\x20by\x20design:\x20a\x20ruling\x20records\x20the\x20case\x20and\x20pays\x20from\x20the\x20service\x20compensation\x20fund\x20—\x20it\x20never\x20moves\x20escrow\x20and\x20never\x20advances\x20the\x20workflow.\x20With\x20both\x20configured,\x20a\x20buyer\x20can\x20receive\x20BOTH\x20the\x20arbitration\x20compensation\x20AND\x20a\x20full\x20escrow\x20refund\x20unless\x20the\x20refund/settlement\x20path\x20is\x20gated.\x20This\x20is\x20a\x20boundary\x20reminder,\x20not\x20a\x20defect\x20—\x20verify\x20the\x20coupling\x20check\x20was\x20done\x20deliberately.','recommendation':'Gate\x20the\x20refund/settlement\x20allocator\x27s\x20Guard\x20on\x20order.claimed_by\x20(read-only\x20cross-system\x20evidence\x20—\x20the\x20sanctioned\x20link),\x20or\x20hold\x20the\x20final\x20settlement\x20forward\x20until\x20the\x20case\x20closes.\x20Do\x20NOT\x20couple\x20the\x20systems\x20the\x20other\x20way\x20(no\x20dispute\x20state\x20on\x20the\x20order\x20flow,\x20no\x20workflow\x20step\x20into\x20arbitration):\x20coupling\x20opens\x20the\x20double-pay\x20path.\x20For\x20per-case\x20fund\x20actions,\x20the\x20deposit-reimbursement\x20pattern\x20(guard-design\x20patterns)\x20is\x20the\x20supported\x20route.'},{'id':'audit_compensation_fund','description':'Service\x20should\x20have\x20a\x20compensation_fund\x20for\x20trust','severity':'warning','fields':['compensation_fund_add','compensation_fund'],'check':a=>compensationFundOf(a)!==undefined,'message':()=>'No\x20compensation_fund\x20configured.\x20Customers\x20have\x20no\x20financial\x20protection\x20if\x20you\x20fail\x20to\x20deliver.','recommendation':'Deposit\x20via\x20compensation_fund_add\x20{balance}\x20to\x20enable\x20arbitration\x20payouts.\x20The\x20fund\x20deters\x20fraud\x20and\x20enables\x20arbitration\x20claims.'},{'id':'audit_arbitrations','description':'Service\x20should\x20have\x20arbitration\x20options\x20for\x20dispute\x20resolution','severity':'info','fields':['arbitrations'],'check':a=>arbitrationRefsOf(a)['length']>0x0,'message':()=>'No\x20arbitration\x20configured.\x20Disputes\x20cannot\x20be\x20resolved\x20through\x20a\x20third\x20party.','recommendation':'Add\x20at\x20least\x20one\x20Arbitration\x20object\x20via\x20arbitrations:{op:\x27add\x27,\x20objects:[...]}\x20to\x20enable\x20on-chain\x20dispute\x20resolution.'},{'id':'audit_arbitration_removal_strands_awards','description':'Removing\x20an\x20authorized\x20venue\x20can\x20strand\x20an\x20award\x20it\x20already\x20ruled\x20on','severity':'error','fields':['arbitrations'],'check':a=>{const b=a?.['arbitrations']?.['remove']??a?.['arbitrations']?.['clear'],c=Array['isArray'](b)?b['length']>0x0:a?.['arbitrations']?.['op']==='clear';if(!c)return!![];if(arbitrationRefsOf(a)['length']>0x0)return!![];return compensationFundOf(a)===undefined;},'message':a=>{const b=a?.['arbitrations']?.['clear']?'every\x20authorized\x20venue':'venue(s)\x20'+(a?.['arbitrations']?.['remove']??[])['join'](',\x20');return'Removing\x20'+b+'\x20while\x20a\x20compensation\x20fund\x20is\x20configured\x20makes\x20any\x20award\x20it\x20already\x20ruled\x20on\x20UNPAYABLE:\x20an\x20on-chain\x20payout\x20now\x20requires\x20the\x20deciding\x20venue\x20to\x20still\x20be\x20on\x20the\x20Service\x27s\x20allowlist,\x20so\x20paying\x20out\x20aborts\x20with\x20E_ARBITRATION_NOT_ALLOWED=39\x20and\x20the\x20escrowed\x20funds\x20stay\x20stranded.';},'recommendation':'Before\x20removing\x20a\x20venue,\x20confirm\x20no\x20case\x20it\x20ruled\x20on\x20is\x20still\x20awaiting\x20compensation\x20payout\x20(query\x20the\x20Arb\x20objects\x20for\x20status\x20Arbitrated,\x20not\x20Finished).\x20Add\x20the\x20replacement\x20venue\x20FIRST,\x20drain\x20the\x20old\x20venue\x27s\x20cases,\x20and\x20only\x20then\x20remove\x20it.\x20A\x20buyer\x20should\x20never\x20be\x20left\x20holding\x20an\x20uncollectable\x20award.'},{'id':'audit_price','description':'Service\x20should\x20have\x20at\x20least\x20one\x20priced\x20sale\x20item','severity':'error','fields':['sales'],'check':a=>{const b=salesItemsOf(a);if(b['length']===0x0)return!![];return b['some'](c=>c?.['price']!==undefined&&c?.['price']!==null);},'message':()=>'Sales\x20list\x20present\x20but\x20no\x20item\x20has\x20a\x20price.\x20Customers\x20cannot\x20place\x20orders\x20without\x20knowing\x20the\x20cost.','recommendation':'Set\x20price\x20on\x20each\x20sales\x20item\x20(smallest-unit\x20string\x20or\x20display\x20form\x20like\x20\x272.5WOW\x27).'},{'id':'audit_compensation_fund_covers_award_ceiling','description':'compensation_fund\x20should\x20cover\x20the\x203x\x20award\x20ceiling\x20of\x20the\x20largest\x20sale\x20(disclosure)','severity':'warning','fields':['compensation_fund_add','compensation_fund','sales'],'check':a=>{if(!a?.['publish'])return!![];const b=compensationFundOf(a);if(b===undefined)return!![];const c=numericAmount(b);if(c===undefined)return!![];if(c===0x0)return![];const e=salesItemsOf(a)['map'](g=>numericAmount(g?.['price']))['filter'](g=>g!==undefined&&g>0x0);if(e['length']===0x0)return!![];const f=e['reduce']((g,h)=>g+h,0x0);return c>=MAX_INDEMNITY_MULTIPLE*f;},'message':()=>'compensation_fund\x20does\x20not\x20cover\x20the\x20award\x20ceiling\x20of\x20the\x20largest\x20sale.\x20An\x20award\x20is\x20hard-capped\x20at\x20'+MAX_INDEMNITY_MULTIPLE+'x\x20'+'the\x20order\x20amount\x20(arb.move\x20MAX_INDEMNITY_MULTIPLE,\x20enforced\x20at\x20ruling\x20time),\x20so\x20a\x20ruling\x20at\x20the\x20ceiling\x20'+'would\x20abort\x20the\x20buyer\x27s\x20claim\x20with\x2027\x20(E_COMPENSATION_NOT_MATCH)\x20—\x20the\x20ruling\x20stands\x20but\x20is\x20unpayable\x20'+'until\x20you\x20deposit,\x20and\x20the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim.\x20Disclosure\x20only:\x20this\x20no\x20longer\x20blocks\x20'+'publish\x20—\x20per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20(the\x20buyer\x27s\x20order\x20is\x20rejected\x20while\x20the\x20fund\x20'+'cannot\x20cover\x203x\x20that\x20order),\x20so\x20under-ceiling\x20funding\x20stops\x20sales\x20instead\x20of\x20stranding\x20awards.','recommendation':'For\x20every\x20order\x20you\x20want\x20to\x20sell,\x20keep\x20the\x20fund\x20at\x20>=\x20'+MAX_INDEMNITY_MULTIPLE+'x\x20THAT\x20order\x20via\x20'+'compensation_fund_add\x20(a\x200.49\x20course\x20needs\x201.47;\x20a\x203.99\x20course\x20needs\x2011.97\x20—\x20no\x20cross-SKU\x20subsidy).\x20'+('Above\x20'+MAX_INDEMNITY_MULTIPLE+'x\x20the\x20current\x20order\x20is\x20optional:\x20it\x20only\x20buys\x20tolerance\x20for\x20several\x20')+'CONCURRENT\x20claims\x20against\x20the\x20one\x20per-Service\x20pool\x20(there\x20is\x20no\x20on-chain\x20concurrency\x20limit),\x20which\x20'+'is\x20a\x20capital-allocation\x20choice.\x20A\x20service\x20with\x20NO\x20fund\x20sells\x20freely\x20—\x20that\x20is\x20the\x20documented\x20'+'no-protection\x20posture\x20(audit_compensation_fund\x20discloses\x20it;\x20buyers\x20see\x20coverage\x20via\x20order\x20monitor).'},{'id':'audit_description','description':'Service\x20should\x20have\x20a\x20description','severity':'warning','fields':['description'],'check':a=>typeof a?.['description']==='string'&&a['description']['length']>0x0,'message':()=>'Service\x20has\x20no\x20description.\x20Customers\x20won\x27t\x20understand\x20what\x20you\x27re\x20offering.','recommendation':'Write\x20a\x20clear\x20description\x20of\x20the\x20service,\x20including\x20deliverables,\x20timelines,\x20and\x20terms.'},{'id':'audit_named_new_name','description':'Service\x20being\x20created\x20should\x20have\x20a\x20name','severity':'warning','check':a=>serviceNameOf(a)!==undefined,'message':()=>'Creating\x20a\x20service\x20without\x20a\x20name\x20makes\x20it\x20hard\x20to\x20reference\x20and\x20organize.','recommendation':'Set\x20object:{name:\x20...}\x20(or\x20namedNew.name)\x20following\x20the\x20convention:\x20<projectPrefix>_<service>_<purpose>.'},{'id':'audit_customer_required_needs_um','description':'customer_required\x20requires\x20a\x20Contact\x20bound\x20via\x20um\x20(SDK-enforced\x20hard\x20link;\x20mirrored\x20here)','severity':'error','fields':['customer_required','um'],'check':a=>{const b=Array['isArray'](a?.['customer_required'])?a['customer_required']:[];if(b['length']===0x0)return!![];return!!a?.['um'];},'message':()=>'customer_required\x20is\x20set\x20but\x20no\x20Contact\x20is\x20bound\x20via\x20um\x20—\x20customers\x20cannot\x20deliver\x20the\x20required\x20private\x20information\x20through\x20end-to-end\x20encrypted\x20Messenger.','recommendation':'Bind\x20um:{Contact\x20name/id}\x20in\x20the\x20same\x20call\x20(SDK\x20order_new\x20will\x20fail\x20the\x20buyer\x20otherwise).'},{'id':'audit_customer_required_is_declared_not_enforced','description':'customer_required\x20has\x20no\x20on-chain\x20enforcement\x20at\x20buy\x20time\x20—\x20a\x20Guard\x20must\x20gate\x20fulfilment','severity':'warning','fields':['customer_required'],'check':a=>{const b=Array['isArray'](a?.['customer_required'])?a['customer_required']:[];return b['length']===0x0;},'message':a=>{const b=Array['isArray'](a?.['customer_required'])?a['customer_required']:[];return'customer_required\x20('+b['length']+'\x20field(s):\x20'+b['join'](',\x20')+')\x20is\x20DECLARATIVE\x20ONLY:\x20the\x20on-chain\x20purchase\x20entry\x20never\x20reads\x20this\x20list,\x20so\x20an\x20order\x20that\x20supplies\x20none\x20of\x20these\x20fields\x20is\x20still\x20created\x20and\x20progresses.\x20Nothing\x20on-chain\x20will\x20stop\x20it.';},'recommendation':'Bind\x20pattern.required_info_evidence_gate\x20(schema_query\x20action=get_guard_design_patterns)\x20on\x20the\x20first\x20forward\x20that\x20needs\x20the\x20information:\x20query\x20\x27order.required_info\x20some\x27\x20(1572)\x20over\x20the\x20Order.\x20The\x20buyer\x20records\x20the\x20credential\x20via\x20order_required_info_update:\x20EITHER\x20the\x20merchant\x27s\x20IM\x20user\x20address\x20resolved\x20from\x20the\x20Service\x27s\x20Contact\x20(zero\x20cost,\x20address\x20record\x20only)\x20OR\x20an\x20on-chain\x20WTS\x20Proof\x20object\x20address\x20(embeds\x20the\x20merchant\x20IM\x20address\x20and\x20the\x20last-message\x20timestamp;\x20costs\x20gas,\x20publicly\x20verifiable).\x20\x27order.required_info\x27\x20(1573)\x20returns\x20the\x20recorded\x20address\x20but\x20aborts\x20while\x20nothing\x20is\x20recorded\x20—\x20gate\x20on\x201572\x20first.\x20When\x20the\x20listing\x20genuinely\x20promises\x20a\x20PER-ORDER\x20credential,\x20prefer\x20the\x20controlled\x20bind\x20entry\x20(order_required_info_bind):\x20the\x20chain\x20verifies\x20the\x20Proof\x20is\x20about\x20THIS\x20order\x20and\x20owner-created\x20at\x20write\x20time\x20and\x20rejects\x20a\x20mismatch\x20—\x20no\x20guard\x20needed\x20to\x20catch\x20a\x20wrong-proof\x20record.\x20BOUNDARY:\x20that\x20binding\x20proves\x20the\x20credential\x20AUTHOR\x20only,\x20never\x20its\x20content\x20or\x20any\x20rating\x20—\x20do\x20not\x20mirror\x20it\x20onto\x20review/reward\x20claims;\x20public\x20reviews\x20are\x20Repository\x20rows\x20whose\x20values\x20are\x20enforced\x20guard-side\x20via\x20data-value\x20probes,\x20not\x20through\x20Proof\x20objects.'},{'id':'audit_dangling_deps','description':'Service\x20dependencies\x20should\x20be\x20fully\x20created','severity':'error','check':(a,b)=>{if(!a?.['publish'])return!![];if(!b?.['graph'])return!![];const c=b['graph']['findDanglingDependencies']()??[];return c['length']===0x0;},'message':()=>'Service\x20references\x20objects\x20that\x20are\x20not\x20yet\x20created.\x20Publishing\x20will\x20lock\x20these\x20references.','recommendation':'Ensure\x20all\x20referenced\x20objects\x20(machine,\x20allocators,\x20guards)\x20are\x20created\x20and\x20finalized\x20before\x20publishing.'},{'id':'audit_type_parameter','description':'Service\x20should\x20have\x20a\x20token\x20type\x20specified','severity':'info','fields':['type_parameter','namedNew'],'check':a=>typeParameterOf(a)!==undefined,'message':()=>'No\x20payment\x20token\x20type\x20specified.\x20Defaulting\x20to\x20WOW\x20(0x2::wow::WOW).','recommendation':'Explicitly\x20set\x20type_parameter\x20(inside\x20object:{...})\x20if\x20you\x20want\x20to\x20accept\x20non-WOW\x20tokens\x20(e.g.,\x20USDT,\x20ETH).'},{'id':'audit_wip_unreachable_url','description':'sale.wip\x20must\x20be\x20a\x20publicly\x20reachable\x20URL\x20(no\x20localhost/LAN/file\x20paths)','severity':'error','fields':['sales'],'check':(a,b)=>{if(typeof b?.['network']==='string'&&/local/i['test'](b['network']))return!![];const c=salesItemsOf(a);if(c['length']===0x0)return!![];return c['every'](e=>{const f=e?.['wip'];if(typeof f!=='string'||f['trim']()==='')return!![];return!/^(https?:\/\/)?(localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0)/i['test'](f)&&!/^https?:\/\/(192\.168\.|10\.|172\.(1[6-9]|2\d|3[01])\.)/i['test'](f)&&!/^file:/i['test'](f);});},'message':a=>{const b=salesItemsOf(a)['map'](c=>String(c?.['wip']??''))['filter'](c=>c!==''&&(/^(https?:\/\/)?(localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0)/i['test'](c)||/^https?:\/\/(192\.168\.|10\.|172\.(1[6-9]|2\d|3[01])\.)/i['test'](c)||/^file:/i['test'](c)));return'sale.wip\x20is\x20NOT\x20publicly\x20reachable\x20('+b['join'](',\x20')+').\x20The\x20URL\x20is\x20stored\x20on-chain\x20and\x20every\x20'+'customer\x20fetches\x20it\x20at\x20order\x20time\x20—\x20order_new\x20aborts\x20100%\x20for\x20anyone\x20outside\x20your\x20machine.\x20'+'Host\x20the\x20file\x20publicly:\x20wip_file\x20upload\x20to\x20the\x20official\x20free\x20host\x20(wip.store.wowok.net)\x20or\x20your\x20own\x20'+'endpoint\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20website)';},'recommendation':'Replace\x20the\x20internal\x20URL\x20with\x20a\x20public\x20one.\x20Internal\x20URLs\x20are\x20sanctioned\x20ONLY\x20on\x20env.network=localnet\x20for\x20testing.'},{'id':'audit_wip_missing_public','description':'On\x20public\x20networks\x20every\x20sale\x20item\x20should\x20carry\x20a\x20product-detail\x20(wip)\x20URL','severity':'info','fields':['sales'],'check':(a,b)=>{const c=b?.['network'];if(typeof c==='string'&&/local/i['test'](c))return!![];const e=salesItemsOf(a);if(e['length']===0x0)return!![];return e['every'](f=>typeof f?.['wip']==='string'&&f['wip']['trim']()!=='');},'message':()=>'One\x20or\x20more\x20sale\x20items\x20have\x20NO\x20product-detail\x20(wip)\x20URL.\x20The\x20listing\x20works,\x20but\x20customers\x20see\x20no\x20detail\x20'+'page\x20and\x20the\x20service\x27s\x20market\x20completeness\x20score\x20is\x20downgraded.\x20Easiest:\x20upload\x20the\x20detail\x20file\x20with\x20the\x20'+'wip_file\x20tool\x20to\x20the\x20official\x20free\x20host\x20(https://wip.store.wowok.net\x20—\x2010\x20files\x20per\x20account,\x20180-day\x20'+'retention,\x2012MB/file)\x20and\x20put\x20the\x20returned\x20URL\x20into\x20sale.wip;\x20or\x20host\x20your\x20own\x20(GitHub\x20Pages\x20/\x20IPFS\x20/\x20'+'your\x20website).\x20For\x20long-lived\x20mainnet\x20listings\x20prefer\x20your\x20own\x20endpoint\x20so\x20the\x20detail\x20outlives\x20the\x20free\x20'+'retention\x20window','recommendation':'Upload\x20a\x20WIP\x20file\x20via\x20wip_file\x20and\x20set\x20sale.wip\x20on\x20each\x20item\x20before/after\x20publish\x20(sales\x20stays\x20modifiable).'},{'id':'audit_free_cancel_window_anchor','description':'A\x20free-cancellation\x20window\x20must\x20either\x20ride\x20the\x20stay-date\x20Repository\x20rail\x20or\x20be\x20disclosed\x20as\x20anchored\x20on\x20booking\x20time','severity':'warning','fields':['creation_plan'],'check':(a,b)=>{if(!a?.['publish'])return!![];const c=Array['isArray'](a?.['creation_plan']?.['guards'])?a['creation_plan']['guards']:[],e=c['some'](h=>{const i=typeof h?.['key']==='string'?h['key']:'',j=typeof h?.['purpose']==='string'?h['purpose']:'';return/free[._ ]?cancel/i['test'](i)||/cancell?ation/i['test'](j)&&/window|hours?|days?/i['test'](j);});if(!e)return!![];const f=c['some'](h=>{const i=typeof h?.['template_id']==='string'?h['template_id']:'',j=typeof h?.['purpose']==='string'?h['purpose']:'',k=/repository_data_check/i['test'](i)&&/stay[._ ]?date|use[._ ]?date|check[._ ]?in[._ ]?date|arrival/i['test'](j),l=/anchored on (booking|order\.time)|booking time by default/i['test'](j);return k||l;});return f;},'message':()=>'A\x20free-cancellation\x20window\x20is\x20declared\x20WITHOUT\x20a\x20stay-date\x20anchor\x20and\x20WITHOUT\x20a\x20booking-time\x20disclosure.\x20'+'The\x20chain\x20has\x20no\x20use-date\x20primitive\x20(order.time\x20is\x20the\x20BOOKING\x20moment\x20—\x20written\x20once,\x20immutable),\x20so\x20the\x20'+'window\x20enforces\x20as\x20\x27from\x20booking\x27.\x20If\x20your\x20buyer-facing\x20copy\x20promises\x20\x27X\x20hours\x20before\x20arrival/check-in\x27,\x20'+'the\x20promised\x20window\x20has\x20typically\x20ALREADY\x20CLOSED\x20at\x20booking\x20(bkd8\x20BK-02,\x20live\x20mainnet)\x20—\x20a\x20silent\x20policy\x20'+'inversion\x20that\x20mis-sells\x20the\x20listing.\x20TWO\x20WAYS\x20OUT:\x20(1)\x20FAITHFUL\x20WINDOW\x20—\x20ride\x20the\x20STAY-DATE\x20PRESCRIPTION\x20'+'(time_anchors.free_cancel\x20in\x20the\x20travel\x20templates):\x20a\x20batched\x20id_from\x20None(0)\x20\x27stay_date\x27\x20row\x20(u64\x20epoch-ms)\x20'+'written\x20into\x20the\x20order-scoped\x20Repository\x20at\x20buy\x20time,\x20plus\x20a\x20pattern.repository_data_check\x20leg\x20comparing\x20'+'Clock\x20against\x20row\x20+\x20window\x20offset\x20(CLOSING\x20<=);\x20(2)\x20HONEST\x20DEFAULT\x20—\x20keep\x20the\x20booking-time\x20anchor\x20and\x20state\x20'+'\x27free\x20cancellation\x20within\x20X\x20hours\x20of\x20BOOKING\x27\x20in\x20the\x20buyer-facing\x20copy\x20so\x20the\x20promise\x20matches\x20the\x20chain','recommendation':'Either\x20add\x20the\x20stay-date\x20Repository\x20row\x20+\x20repository_data_check\x20leg\x20(faithful\x20pre-use\x20window),\x20or\x20restate\x20the\x20cancellation\x20policy\x20as\x20\x27from\x20booking\x27\x20in\x20all\x20buyer-facing\x20copy.'}];const RULE_INDEX=new Map(AUDIT_RULES['map'](a=>[a['id'],a]));function readSeverityOverrides(){try{const {getJudgmentDoc:a}=require('../config/judgment.js');if(typeof a!=='function')return{};const b=a()?.['rules']?.['domains'];if(!b||typeof b!=='object')return{};const c={};for(const d of Object['values'](b)){const e=d?.['severity_overrides'];if(!e||typeof e!=='object')continue;for(const [f,g]of Object['entries'](e)){if(g==='error'||g==='warning'||g==='info')c[f]=g;}}return c;}catch{return{};}}export function auditService(a,b){const c=[],d=a?.['publish']===!![]&&typeof a?.['object']==='string',e=readSeverityOverrides();for(const f of AUDIT_RULES){try{if(d&&f['fields']&&!f['fields']['some'](g=>a[g]!==undefined))continue;!f['check'](a,b)&&c['push']({'rule_id':f['id'],'severity':e[f['id']]??f['severity'],'message':f['message'](a),'recommendation':f['recommendation']});}catch{}}return c;}export function hasBlockingErrors(a){return a['some'](b=>b['severity']==='error');}export function getErrors(a){return a['filter'](b=>b['severity']==='error');}export function getWarnings(a){return a['filter'](b=>b['severity']==='warning');}export function summarizeFindings(a){if(a['length']===0x0)return'All\x20audit\x20checks\x20passed.';const b=getErrors(a),c=getWarnings(a),d=a['filter'](g=>g['severity']==='info'),e=[];if(b['length']>0x0)e['push'](b['length']+'\x20error(s)');if(c['length']>0x0)e['push'](c['length']+'\x20warning(s)');if(d['length']>0x0)e['push'](d['length']+'\x20info');return'Audit:\x20'+e['join'](',\x20')+'.\x20Review\x20before\x20publishing.';}export const AUDIT_RULES_VERSION=0xb;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"refund_row_count": "Allocator rows on the refund track",
|
|
9
9
|
"terminal_count": "Fund-bearing machine terminal nodes (never a non-entry prev_node); v32 optional pure-side-action leaves are exempt — order completion never routes through them and they never gate money (upw F-06, 6939_upwork-261016)",
|
|
10
10
|
"terminal_nodes_display": "Comma-joined fund-bearing terminal node names",
|
|
11
|
-
"first_uncovered_terminal": "First fund-bearing terminal node no allocator guard accepts via progress.current
|
|
11
|
+
"first_uncovered_terminal": "First fund-bearing terminal node no allocator guard accepts — either by pinning the terminal directly (alloc runs as a standalone call on the resting order) or via a node-free allocator guard riding the entry forward (a dual-host settlement key: its edge leg evaluates BEFORE the node move, so a progress.current pin on it would be a NODE-MATCH-01 deadlock and only the node-free shape fires on both hosts) (FUND-EXIT-01; optional leaves exempt)",
|
|
12
12
|
"first_refund_guard_missing_claimed_by": "First refund-track guard step id whose queries never read order.claimed_by (DUAL-RAIL-01, A-3)",
|
|
13
13
|
"first_path_dependent_anchor": "First guard step id using a path-dependent time query (TIME-ANCHOR-01, E-10)",
|
|
14
14
|
"path_sensitive": "The anchored node is reachable by more than one path, so the anchor can shift",
|
|
@@ -37,13 +37,25 @@
|
|
|
37
37
|
"fund_topup_present": "The plan carries a compensation_fund_add step",
|
|
38
38
|
"fund_topup_amount": "Sum of parseable (integer smallest-unit) top-up balances; absent when unparseable",
|
|
39
39
|
"fund_ceiling_breach": "The top-up is below the award ceiling (MAX_INDEMNITY_MULTIPLE x highest SKU price) — judged ONLY when both sides parse (PLAN-K2)",
|
|
40
|
+
"fund_concurrent_orders_coverable": "How many simultaneous ceiling-sized claims the fund can pay: floor(fund / (3x highest SKU)). The buy gate only covers 3x ONE order — concurrent claims beyond this count abort (E_COMPENSATION_NOT_MATCH) until a manual top-up (PLAN-K2, b6-11)",
|
|
40
41
|
"fund_ceiling_basis": "Human-readable basis used for the ceiling judgment",
|
|
41
42
|
"fund_ceiling_unverifiable": "A fund top-up exists but the ceiling could not be judged here (price or amount unparseable) — the publish-patch KL-K2 rule re-checks at the 3x largest-order basis (PLAN-K2 fallback, stated explicitly)",
|
|
43
|
+
"first_arb_exit_node": "First settled/refund-class node with an outgoing edge whose guard queries the arbitration promise family (arb.indemnity / arb.order / arb.status / order.dispute) — a post-settlement arbitration re-route (FUND-ZERO-01 judgment gate)",
|
|
44
|
+
"fund_arb_route_unfunded": "A post-settlement arbitration re-route exists AND the compensation pool is absent or deposits 0 — the ruling payout aborts 27 (E_COMPENSATION_NOT_MATCH), so the promised exit is dead by construction (FUND-ZERO-01)",
|
|
45
|
+
"entry_no_open_exit": "The order-landing node (entry-edge target) exits only through CLOSING time windows (Clock <= anchor legs, no opening leg, no unguarded alternative) — once a window closes nothing can advance the order and the entry escrow is locked (ENTRY-ABANDON-01, gf26 GF2-30)",
|
|
46
|
+
"entry_strand_node": "First stranded entry node name (ENTRY-ABANDON-01 judgment gate)",
|
|
47
|
+
"arb_promise_without_settle_rail": "A machine guard reads the arbitration ruling family while NO $ref-visible allocator row releases money on the ruling (none reads the family, none rides the ruling edge node-free, and the ruling edge's destination has no FUND-EXIT-01-style allocator coverage); guard_key-declared rails are plan-opaque and left to the freeze gate — the verdict moves state, never money (POST-ARB-SETTLE-01, gf26 GF2-31)",
|
|
48
|
+
"arb_promise_node": "First node whose exit edge carries the arbitration-promise guard (POST-ARB-SETTLE-01 judgment gate)",
|
|
49
|
+
"arb_key_plane_opaque": "The machine carries arbitration-promise guards while the allocator rail plane carries guard_key declarations — rails the $ref plane cannot verify, so the POST-ARB-SETTLE-01 verdict rule stays silent there by ruling; this shape is the freeze gate's red line: ARB-KEY-PLANE-01 fires high and preflightPlan refuses the publish until the keys resolve into structured guard steps (user ruling 2026-10-26)",
|
|
50
|
+
"arb_key_plane_node": "First node whose exit edge carries the arbitration-promise guard (ARB-KEY-PLANE-01 judgment gate)",
|
|
42
51
|
"repo_policy_keys_display": "Comma-joined policy names declared by the plan's repository create steps (present only when at least one policy exists — the REPO-GATE-KEY-01 judgment gate)",
|
|
43
52
|
"repo_gate_key_unbacked_count": "Composite where-query scans over a plan-local repository whose static key no declared policy uses (REPO-GATE-KEY-01, ZR-32)",
|
|
44
53
|
"first_repo_gate_key_unbacked": "First unbacked gate key, rendered as 'key' in guard 'step-id'",
|
|
45
54
|
"repo_gate_key_unbacked_display": "Comma-joined list of ALL unbacked gate keys",
|
|
46
|
-
"sales_step_present": "The plan materializes at least one sellable SKU (a service create with a non-empty sales list, or a configure step with method 'sales') — the order entry's existence predicate (PLAN-SALES-01)"
|
|
55
|
+
"sales_step_present": "The plan materializes at least one sellable SKU (a service create with a non-empty sales list, or a configure step with method 'sales') — the order entry's existence predicate (PLAN-SALES-01)",
|
|
56
|
+
"guard_reach_contradiction_count": "Root-AND-chain legs carrying proof-level structural unreachability (ordering interval crossing; == to two different numeric constants or to opposite Bools; == X conjoined with a strict ordering past X; same-binding self-comparison with a strict direction) — the guard predicate is unsatisfiable by construction (GUARD-REACH-01, S3 plane)",
|
|
57
|
+
"first_guard_reach_contradiction": "First contradiction, rendered as: guard 'step-id' (channel): OP X contradicts OP X — unsatisfiable",
|
|
58
|
+
"guard_reach_contradiction_display": "Semicolon-joined list of ALL proof-level unreachability contradictions in the plan's guard roots"
|
|
47
59
|
},
|
|
48
60
|
"rules": [
|
|
49
61
|
{
|
|
@@ -99,6 +111,74 @@
|
|
|
99
111
|
}
|
|
100
112
|
]
|
|
101
113
|
},
|
|
114
|
+
{
|
|
115
|
+
"rule_id": "FUND-ZERO-01",
|
|
116
|
+
"dimension": "fund_flow",
|
|
117
|
+
"trigger": "The machine routes a post-settlement arbitration re-route (an arbitration-promise guard — arb.indemnity / arb.order / arb.status / order.dispute — on an edge leaving a settled/refund-class node) while the compensation pool is never funded. service::compensation_claim pays the ruling from service.compensation_fund (service.move:589-602) and an underfunded pool aborts the payout with code 27 (E_COMPENSATION_NOT_MATCH, claim left unconsumed); the escrow behind a settled/refunded node is structurally drained, so with a zero or absent fund the promised exit is dead by construction (gf26-tn-261026 GF2-02: a 0-fund shop published and the buyer's only remedy had no money behind it).",
|
|
118
|
+
"cases": [
|
|
119
|
+
{
|
|
120
|
+
"when": { "all": [ { "field": "fund_arb_route_unfunded", "op": "truthy" }, { "field": "fund_topup_present", "op": "falsy" } ] },
|
|
121
|
+
"level": "critical",
|
|
122
|
+
"title": "Post-settlement arbitration re-route from '${first_arb_exit_node}' with NO compensation fund",
|
|
123
|
+
"description": "The plan gates an exit edge leaving '${first_arb_exit_node}' on an arbitration ruling. That ruling pays through service::compensation_claim, which draws ONLY from service.compensation_fund — this plan never creates one (no compensation_fund_add step). The escrow is already drained at that node, so the buyer's remedy has zero money behind it: the payout aborts with code 27 even when the ruling is valid.",
|
|
124
|
+
"mitigation": "Add a configure step with method 'compensation_fund_add' and a balance >= the largest single-order exposure (the award ceiling is 3x the order amount, arb.move MAX_INDEMNITY_MULTIPLE), or rebuild without the post-settlement arbitration edge so the remedy does not depend on the fund.",
|
|
125
|
+
"stakeholders": ["merchant", "customer"]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"when": { "all": [ { "field": "fund_arb_route_unfunded", "op": "truthy" }, { "field": "fund_topup_present", "op": "truthy" }, { "field": "fund_topup_amount", "op": "eq", "value": 0 } ] },
|
|
129
|
+
"level": "critical",
|
|
130
|
+
"title": "Post-settlement arbitration re-route from '${first_arb_exit_node}' with a ZERO compensation fund",
|
|
131
|
+
"description": "The plan gates an exit edge leaving '${first_arb_exit_node}' on an arbitration ruling, and its compensation_fund_add step deposits 0 — the fund exists but pays nothing. compensation_claim aborts with code 27 (E_COMPENSATION_NOT_MATCH) on any payout attempt, so the promised exit is still dead by construction.",
|
|
132
|
+
"mitigation": "Raise the compensation_fund_add balance to a real amount (>= the largest single-order exposure; the chain award ceiling is 3x the order amount), or remove the arbitration-gated exit edge.",
|
|
133
|
+
"stakeholders": ["merchant", "customer"]
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"rule_id": "ENTRY-ABANDON-01",
|
|
139
|
+
"dimension": "fund_flow",
|
|
140
|
+
"trigger": "The order-landing node — the target of the machine entry edge (prev_node \"\") — exits only through CLOSING time-window guards (logic_as_u256_lesser_or_equal[Clock, anchor], no opening leg, no unguarded alternative): once a window closes every forward aborts, nothing can advance the order, and the escrow taken at entry is locked by construction (gf26-tn-261026 GF2-30: a 7.65 WOW pledge entered by a second transaction with no abandon-refund edge; machines and guard tables freeze at publish, so the missing recovery edge cannot be added later). Dead-end entries (zero exits) belong to the dead-end scanner, not this rule.",
|
|
141
|
+
"cases": [
|
|
142
|
+
{
|
|
143
|
+
"when": { "field": "entry_no_open_exit", "op": "truthy" },
|
|
144
|
+
"level": "high",
|
|
145
|
+
"title": "Entry node '${entry_strand_node}' has no exit that opens after its window",
|
|
146
|
+
"description": "Every forward leaving '${entry_strand_node}' — the node orders land on at entry — is gated by a closing time window (Clock <= anchor) with no opening leg and no unguarded alternative. Once the window passes the guard aborts forever: the order can never advance, and the escrow collected at entry is locked with no abandon/refund path. This is the GF2-30 live loss shape (7.65 WOW); shipping it bakes the lockup in permanently.",
|
|
147
|
+
"mitigation": "Add a self-healing exit from '${entry_strand_node}' gated on an OPENING window (logic_as_u256_greater_or_equal[Clock, anchor] — the abandon/refund edge that fires when the claim window elapses) targeting a fund-bearing node, so the escrow always keeps an after-window path; or leave one exit unguarded / gated on an any-time condition.",
|
|
148
|
+
"stakeholders": ["merchant", "customer"]
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"rule_id": "POST-ARB-SETTLE-01",
|
|
154
|
+
"dimension": "fund_flow",
|
|
155
|
+
"trigger": "A machine guard reads the arbitration ruling family (arb.indemnity / arb.order / arb.status / order.dispute) while no allocator row releases money on that ruling — none reads the family, none rides the ruling edge node-free, and the ruling edge's destination node is covered by no allocator in the FUND-EXIT-01 dual-shape semantics (pinned by an allocator guard, or node-free-covered by an unconstrained allocator guard mounted on one of its inbound edges — the canonical shape where the ruling re-routes the order into a node the plain refund allocator drains). Judged only on the $ref plane: plans whose allocator rows declare guards by key (guard_key — the template/migration emission) carry a rail plane invisible here and are left to the materialization freeze gate. arb.move rulings only write case state; the payout must exist as a plan rail, so with none the verdict changes state and the escrow never moves (gf26-tn-261026 GF2-31: a ruling that writes status but never releases the money).",
|
|
156
|
+
"cases": [
|
|
157
|
+
{
|
|
158
|
+
"when": { "field": "arb_promise_without_settle_rail", "op": "truthy" },
|
|
159
|
+
"level": "critical",
|
|
160
|
+
"title": "Arbitration promise at '${arb_promise_node}' with no ruling-gated settlement leg",
|
|
161
|
+
"description": "A guard on the forward out of '${arb_promise_node}' reads the arbitration ruling family, promising a ruling-driven outcome — but no allocator row releases money on that ruling: none reads the family, none rides the ruling edge, and the ruling edge's destination node has no allocator coverage (no pin, no node-free refund mount). When the verdict lands the machine changes state and the escrow stays put; the ruling moves nothing. Allocators freeze at publish, so the missing settlement leg cannot be added afterwards.",
|
|
162
|
+
"mitigation": "Add an allocator row that releases money on the ruling: either a guard reading the arbitration family (arb.order == the order, arb.indemnity some == true) with a payout sharing leg, or route the ruling edge into a node already drained by the refund/settlement rail (an allocator guard pins it, or a node-free allocator guard rides one of its inbound edges). Do not keep a state-only promise.",
|
|
163
|
+
"stakeholders": ["merchant", "customer"]
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"rule_id": "ARB-KEY-PLANE-01",
|
|
169
|
+
"dimension": "fund_flow",
|
|
170
|
+
"trigger": "The machine carries arbitration-promise guards (arb.indemnity / arb.order / arb.status / order.dispute) while the allocator rail plane carries guard_key declarations (the template/migration emission shape) — rails the $ref plane cannot verify, so a settle leg hiding in a keyed row is invisible here. The POST-ARB-SETTLE-01 verdict stays silent on this shape by ruling (2026-10-26); this rule is the publish-door red line instead: the materialization freeze gate refuses the publish until the keys resolve into structured guard steps whose settle-rail coverage is plan-verifiable.",
|
|
171
|
+
"cases": [
|
|
172
|
+
{
|
|
173
|
+
"when": { "field": "arb_key_plane_opaque", "op": "truthy" },
|
|
174
|
+
"level": "high",
|
|
175
|
+
"title": "Arbitration promise at '${arb_key_plane_node}' rides an opaque guard_key rail plane",
|
|
176
|
+
"description": "A guard on the forward out of '${arb_key_plane_node}' reads the arbitration ruling family, promising a ruling-driven outcome — but this plan's allocator rails are (at least partly) declared by key (guard_key), so the $ref plane cannot verify that any rail releases money on the ruling: a settle leg hiding in a keyed row is invisible to the audit. The state-only verdict risk of POST-ARB-SETTLE-01 cannot be ruled out here, and a failed settle rail would strand the escrow with the verdict unable to move money — with no way to add the settlement leg after publish. This is a publish-door red line — the freeze gate refuses this shape.",
|
|
177
|
+
"mitigation": "Resolve each guard_key rail into structured guard steps (guardResolutions with kind 'template' or 'inline') before publish, so the settle-rail coverage becomes plan-visible and POST-ARB-SETTLE-01 can judge it; or re-route the ruling edge into a node drained by a $ref-visible allocator row.",
|
|
178
|
+
"stakeholders": ["merchant", "customer"]
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
},
|
|
102
182
|
{
|
|
103
183
|
"rule_id": "UNRESOLVED-GUARD-01",
|
|
104
184
|
"dimension": "composition",
|
|
@@ -169,7 +249,7 @@
|
|
|
169
249
|
"when": { "field": "fund_ceiling_breach", "op": "truthy" },
|
|
170
250
|
"level": "medium",
|
|
171
251
|
"title": "Compensation fund tops up below the award ceiling (${fund_ceiling_basis})",
|
|
172
|
-
"description": "The plan tops the fund up to ${fund_topup_amount} (smallest units), but a ruling at the ceiling would abort the buyer's claim (E_COMPENSATION_NOT_MATCH) and the abort does NOT consume the claim — the buyer holds an unpayable win until a manual top-up, and the shop holds the reputational damage. Disclosure, not a blocker: under-covered ORDERS are refused at buy time (per-order gate), so no buyer enters a knowingly unprotected order.",
|
|
252
|
+
"description": "The plan tops the fund up to ${fund_topup_amount} (smallest units), but a ruling at the ceiling would abort the buyer's claim (E_COMPENSATION_NOT_MATCH) and the abort does NOT consume the claim — the buyer holds an unpayable win until a manual top-up, and the shop holds the reputational damage. Disclosure, not a blocker: under-covered ORDERS are refused at buy time (per-order gate), so no buyer enters a knowingly unprotected order. Concurrency headroom: this pool can pay ${fund_concurrent_orders_coverable} simultaneous ceiling-sized claim(s) — concurrent claims beyond that abort until a manual top-up.",
|
|
173
253
|
"mitigation": "Raise the compensation_fund input toward the ceiling (${fund_ceiling_basis}). Sizing is per-order now: 3x the typical single order keeps any single ruling payable; above that only buys tolerance for CONCURRENT claims against the one per-Service pool.",
|
|
174
254
|
"stakeholders": ["merchant", "customer"]
|
|
175
255
|
},
|
|
@@ -266,6 +346,21 @@
|
|
|
266
346
|
}
|
|
267
347
|
]
|
|
268
348
|
},
|
|
349
|
+
{
|
|
350
|
+
"rule_id": "NODE-MATCH-01",
|
|
351
|
+
"dimension": "fund_flow",
|
|
352
|
+
"trigger": "A guard bound on a machine forward also asserts progress.current == L where L is not that edge's prev node — the machine pins current == prev on every traversal, so the literal is unsatisfiable and the edge (with any money rail behind it) is permanently unreachable after publish (machines and guard tables freeze; ksc-tn-261024 F-02 live: a receiver-return edge pinned to 'return_requested' instead of 'return_shipped' stranded 0.45 WOW). Multi-node OR sets pass as long as prev is a member; entry edges and guards without a progress.current literal are exempt.",
|
|
353
|
+
"cases": [
|
|
354
|
+
{
|
|
355
|
+
"when": { "field": "first_node_mismatched_guard", "op": "present" },
|
|
356
|
+
"level": "critical",
|
|
357
|
+
"title": "Guard ${first_node_mismatched_guard} can never pass",
|
|
358
|
+
"description": "The guard re-checks progress.current against a node the machine has already ruled out on this edge. On chain the guard predicate is permanently false, so the forward aborts guard_rejected forever and any allocator/exit rail keyed to the destination node strands its escrow. Guards and machines freeze at publish — shipping now bakes the deadlock in.",
|
|
359
|
+
"mitigation": "Remove the progress.current literal from the guard (the machine's prev_node already enforces the source node — double-pinning only creates this class of deadlock), or correct the literal to the edge's actual prev node. One guard instance per edge; never reuse a guard across edges with different source nodes.",
|
|
360
|
+
"stakeholders": ["merchant", "customer"]
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
},
|
|
269
364
|
{
|
|
270
365
|
"rule_id": "HOST-GRAPH-01",
|
|
271
366
|
"dimension": "composition",
|
|
@@ -333,6 +428,21 @@
|
|
|
333
428
|
"stakeholders": ["merchant", "customer"]
|
|
334
429
|
}
|
|
335
430
|
]
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"rule_id": "GUARD-REACH-01",
|
|
434
|
+
"dimension": "composition",
|
|
435
|
+
"trigger": "A guard's root AND chain carries a proof-level structural contradiction: an ordering interval crossing (>= 10 conjoined with <= 5, or equal bounds with a strict side like >= X with < X), an equality family contradiction (one channel asserted == to two different numeric constants or to opposite Bool constants, or == X conjoined with > X / < X), or a same-binding self-comparison with a strict direction (X > X / X < X). The predicate is unsatisfiable by construction: the guard can never pass, and every path it gates is permanently unreachable after publish (guards freeze at creation; S3 plane static reachability). Deliberately conservative — only proof-level classes are reported: query-vs-query legs across DIFFERENT bindings (e.g. allocation.balance >= order.amount) and runtime submission values are decided at runtime and are never reported here; OR branches and negation scopes are not conjunctive and are not descended.",
|
|
436
|
+
"cases": [
|
|
437
|
+
{
|
|
438
|
+
"when": { "field": "guard_reach_contradiction_count", "op": "gt", "value": 0 },
|
|
439
|
+
"level": "critical",
|
|
440
|
+
"title": "Guard predicate is self-contradictory: ${first_guard_reach_contradiction}",
|
|
441
|
+
"description": "All contradictions: ${guard_reach_contradiction_display}. Each is a proof, not a heuristic: two legs on the same channel demand impossible bounds at the same constant, so the guard evaluates false on every submission. Any forward, allocator row or claim rail gated by it is dead on arrival — and any escrow that can only leave through that path is stranded. Guards freeze at creation, so nothing can repair the predicate after publish.",
|
|
442
|
+
"mitigation": "Repair the predicate before creation: drop the redundant leg (keep the one that states the business intent — e.g. the window lower bound OR the upper bound, never a crossing pair), or correct the constant so the legs can both hold. If one leg was meant for a DIFFERENT state, split the guard per state instead of conjoining them.",
|
|
443
|
+
"stakeholders": ["merchant", "customer"]
|
|
444
|
+
}
|
|
445
|
+
]
|
|
336
446
|
}
|
|
337
447
|
]
|
|
338
448
|
}
|
|
@@ -14,6 +14,11 @@ export interface ArchetypeTemplate {
|
|
|
14
14
|
fee_params: Record<string, number | string>;
|
|
15
15
|
trust_mechanisms: string[];
|
|
16
16
|
keeper_dependencies: string[];
|
|
17
|
+
keeper_duty?: {
|
|
18
|
+
when: string;
|
|
19
|
+
action: string;
|
|
20
|
+
miss_consequence: string;
|
|
21
|
+
}[];
|
|
17
22
|
recommended_role: "merchant" | "supplier" | "both";
|
|
18
23
|
role_rationale: string;
|
|
19
24
|
differences: string[];
|
|
@@ -45,7 +50,7 @@ export interface ArchetypeTemplate {
|
|
|
45
50
|
affiliate_mode?: "none" | "commission";
|
|
46
51
|
crowdfunding_mode?: "none" | "threshold" | "flexible";
|
|
47
52
|
}
|
|
48
|
-
export declare const BUILTIN_TEMPLATES_VERSION =
|
|
53
|
+
export declare const BUILTIN_TEMPLATES_VERSION = 112;
|
|
49
54
|
export declare const BUILTIN_TEMPLATES: ArchetypeTemplate[];
|
|
50
55
|
export declare const TEMPLATE_KEYWORDS: Record<string, string[]>;
|
|
51
56
|
export declare const TEMPLATE_TAGS: Record<string, string[]>;
|