@wowok/agent-mcp 3.2.6 → 3.2.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/field-capability.js +1 -1
- package/dist/chain-semantics/freeze-map.js +1 -1
- package/dist/chain-semantics/object-graph.js +1 -1
- package/dist/communication/wts-attestation.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/compile.d.ts +3 -2
- package/dist/composition/compile.js +1 -1
- package/dist/composition/inflight.d.ts +17 -0
- package/dist/composition/inflight.js +1 -0
- package/dist/config/config-audit.spec.js +1 -1
- package/dist/customer/account-events.js +1 -1
- package/dist/customer/order-monitor.js +1 -1
- package/dist/evaluation/builtins/graph-service.spec.js +1 -1
- package/dist/evaluation/engine.js +1 -1
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/constraint-registry.d.ts +6 -1
- package/dist/extensions/constraint-registry.js +1 -1
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/industry-pack.d.ts +5 -0
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/mode-evaluator.d.ts +3 -2
- package/dist/extensions/mode-evaluator.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/graph/onchain/analyze.js +1 -1
- package/dist/graph/onchain/analyze.spec.js +1 -1
- package/dist/graph/onchain/anti-cheat.d.ts +32 -2
- package/dist/graph/onchain/anti-cheat.js +1 -1
- package/dist/graph/onchain/anti-cheat.spec.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/exposure.js +1 -1
- package/dist/graph/onchain/extract.js +1 -1
- package/dist/graph/onchain/graph-policy.spec.js +1 -1
- package/dist/graph/onchain/index.d.ts +2 -2
- package/dist/graph/onchain/index.js +1 -1
- package/dist/graph/onchain/project-relationship.js +1 -1
- package/dist/graph/onchain/table-ledger.spec.js +1 -1
- package/dist/graph/onchain/types.d.ts +3 -0
- package/dist/harness/recover.js +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/arbitration-venue-order.d.ts +25 -0
- package/dist/knowledge/arbitration-venue-order.js +1 -0
- package/dist/knowledge/audit-rules.d.ts +10 -0
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/risk-baselines.spec.js +1 -1
- package/dist/knowledge/baselines/rules/graph.json +81 -0
- package/dist/knowledge/baselines/rules/machine.json +3 -3
- package/dist/knowledge/baselines/rules/plan.json +80 -2
- package/dist/knowledge/builtin-templates.d.ts +17 -2
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/discount-threshold.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-bindings.js +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-field-cognition.js +1 -1
- package/dist/knowledge/guard-ledger.js +1 -1
- package/dist/knowledge/guard-lint.d.ts +1 -0
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-node-gates.d.ts +4 -0
- package/dist/knowledge/guard-node-gates.js +1 -0
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-submission-prompt.d.ts +1 -0
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +2 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.d.ts +2 -2
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/machine-topology.d.ts +6 -0
- package/dist/knowledge/machine-topology.js +1 -1
- package/dist/knowledge/reputation-rules.d.ts +3 -9
- package/dist/knowledge/reputation-rules.js +1 -1
- package/dist/knowledge/safety-rules.d.ts +10 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/settlement-semantics.d.ts +1 -0
- package/dist/knowledge/settlement-semantics.js +1 -0
- package/dist/knowledge/template-loader.d.ts +22 -0
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +14 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +1 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/allocation-advice.js +1 -1
- package/dist/participation/customer-interest.js +1 -1
- package/dist/participation/radar-core.d.ts +6 -1
- package/dist/participation/radar-core.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 +38 -15
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.d.ts +7 -0
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/pipeline-actions.d.ts +1 -1
- package/dist/playbooks/service-build/pipeline-actions.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/risk-aggregator.d.ts +1 -1
- package/dist/playbooks/service-build/risk-aggregator.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/relationship/derivation.d.ts +1 -0
- package/dist/review/index.js +1 -1
- package/dist/runtime/instance-registry.d.ts +8 -0
- package/dist/runtime/instance-registry.js +1 -0
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +14 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +109 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +14 -0
- package/dist/schema/call/contact.js +1 -1
- package/dist/schema/call/error-codes.d.ts +1 -1
- package/dist/schema/call/error-codes.js +1 -1
- package/dist/schema/call/guard.d.ts +7 -0
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +7 -0
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/payment.js +1 -1
- package/dist/schema/call/permission-handler.js +1 -1
- package/dist/schema/call/progress.d.ts +46 -0
- package/dist/schema/call/progress.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +8 -8
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/goal/index.d.ts +11 -0
- package/dist/schema/goal/planning.d.ts +32 -1
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +40 -0
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/keeper/index.d.ts +13 -0
- package/dist/schema/local/index.d.ts +75 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +17 -0
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +39 -2
- package/dist/schema/operations.js +1 -1
- package/dist/schema/query/bi.d.ts +64 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +94 -0
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.d.ts +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/utils/permission-machine-check.js +1 -1
- package/dist/schema/workspace/index.d.ts +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +45 -0
- package/dist/schemas/benchmark_migration_operation.output.json +24 -4
- package/dist/schemas/benchmark_migration_operation.schema.json +70 -0
- package/dist/schemas/bridge_operation.output.json +45 -0
- package/dist/schemas/goal_operation.schema.json +78 -0
- package/dist/schemas/guard2file.output.json +6 -1
- package/dist/schemas/guard2file.schema.json +9 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/industry_pack_operation.output.json +91 -0
- package/dist/schemas/industry_pack_operation.schema.json +19 -1
- package/dist/schemas/keeper_operation.output.json +44 -0
- package/dist/schemas/local_cache_operation.output.json +45 -0
- package/dist/schemas/local_history_operation.output.json +45 -0
- package/dist/schemas/local_info_operation.output.json +45 -0
- package/dist/schemas/local_mark_operation.output.json +45 -0
- package/dist/schemas/machineNode2file.output.json +6 -1
- package/dist/schemas/machineNode2file.schema.json +9 -0
- package/dist/schemas/messenger_operation.output.json +52 -0
- package/dist/schemas/monitor_events.output.json +44 -0
- package/dist/schemas/monitor_subscription.output.json +44 -0
- package/dist/schemas/onchain_events.output.json +44 -0
- package/dist/schemas/onchain_operations.output.json +133 -0
- package/dist/schemas/onchain_operations.schema.json +73 -16
- package/dist/schemas/onchain_operations_arbitration.schema.json +2 -1
- package/dist/schemas/onchain_operations_contact.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +2 -2
- package/dist/schemas/onchain_operations_machine.schema.json +2 -2
- package/dist/schemas/onchain_operations_payment.schema.json +1 -1
- package/dist/schemas/onchain_operations_progress.schema.json +57 -0
- package/dist/schemas/onchain_operations_service.schema.json +7 -8
- package/dist/schemas/onchain_table_data.output.json +81 -13
- package/dist/schemas/onchain_table_data.schema.json +21 -21
- package/dist/schemas/query_toolkit.output.json +218 -9
- package/dist/schemas/query_toolkit.schema.json +50 -26
- package/dist/schemas/wowok_buildin_info.output.json +80 -1
- package/dist/schemas/wowok_buildin_info.schema.json +1 -1
- package/dist/tools/handlers/benchmark-migration.d.ts +1 -0
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/file-export.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/review-chain.d.ts +22 -0
- package/dist/tools/handlers/review-chain.js +1 -0
- package/dist/tools/registry/agent.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/config.js +1 -1
- package/dist/tools/registry/evaluation.js +1 -1
- package/dist/tools/registry/files.js +1 -1
- package/dist/tools/registry/identity.js +1 -1
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/registry/messenger.js +1 -1
- package/dist/tools/registry/monitor.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/runtime-health.d.ts +10 -0
- package/dist/tools/runtime-health.js +1 -0
- package/dist/tools/upgrade-check.d.ts +10 -1
- package/dist/tools/upgrade-check.js +1 -1
- package/dist/tools/wrap.d.ts +3 -0
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
export const FIELD_CAPABILITY={'Order.dispute':{'writeBy':['order.dispute\x20(package,\x20via\x20the\x20Service-bound\x20dispute\x20filing\x20flow)'],'readBy':['order.dispute\x20count/contains\x20check\x20(MAX_DISPUTE_COUNT\x20gate,\x20order.move:101-102)','guard-query:\x20order.dispute\x20count\x20/\x20has'],'enforcedBy':['filing\x20is\x20allowlist-gated:\x20the\x20Service-bound\x20dispute\x20entry\x20points\x20enforce\x20the\x20arbitrator\x20allowlist\x20(39),\x20the\x20neutrality\x20rule\x20(33)\x20and\x20the\x20order\x20binding\x20(26)\x20BEFORE\x20the\x20case\x20is\x20minted;\x20the\x20Service-blind\x20arbitration-module\x20dispute\x20entries\x20abort\x20E_DISPUTE_DEPRECATED\x20(arbitration\x2010)'],'writeOnly':![],'notes':'A-11\x20CLOSED:\x20filing-time\x20enforcement\x20replaced\x20the\x20old\x20abort-only-at-compensation\x20surface;\x20an\x20off-allowlist\x20venue\x20can\x20no\x20longer\x20be\x20filed\x20against\x20at\x20all.','findings':['A-10','A-11'],'source':{'file':'order.move','line':0x45,'pattern':'dispute:\x20vector<address>'}},'Order.required_info':{'writeBy':['owner-only\x20order\x20field\x20update\x20(order.move:77-80)'],'readBy':['guard-query:\x20order.required_info\x20some\x20/\x20value'],'enforcedBy':[],'writeOnly':!![],'notes':'buy\x20path\x20never\x20reads\x20customer_required/required_info\x20(A-1).\x20Owner-write-only\x20field.','findings':['A-1','A-10'],'source':{'file':'order.move','line':0x49,'pattern':'required_info:\x20Option<address>'}},'Order.claimed_by':{'writeBy':['order.compensate\x20(package,\x20order.move:94-97)'],'readBy':['the\x20not-yet-claimed\x20assert\x20on\x20the\x20compensate/dispute\x20path','guard-query:\x20order.claimed_by\x20some\x20/\x20value'],'enforcedBy':['blocks\x20second\x20compensate/dispute'],'writeOnly':![],'notes':'NOT\x20read\x20by\x20allocation.alloc\x20—\x20refund\x20rail\x20must\x20self-check\x20via\x20refund\x20guard\x20(DUAL-RAIL-01).\x20Deliberate\x20design,\x20order.move:199-220.','findings':['A-3'],'source':{'file':'order.move','line':0x48,'pattern':'claimed_by:\x20Option<address>'}},'Order.time':{'writeBy':['order.new\x20(clock::timestamp_ms\x20at\x20creation)'],'readBy':['guard-query:\x20order.time'],'enforcedBy':['template-declared\x20time\x20anchors'],'writeOnly':![],'notes':'Stable\x20anchor\x20for\x20window\x20guards\x20—\x20unlike\x20Progress.current_time\x20it\x20is\x20path-INDEPENDENT.','source':{'file':'order.move','line':0x4a,'pattern':'time:\x20u64'}},'Service.customer_required':{'writeBy':['service\x20settings\x20(pre-publish)'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'notes':'A-1:\x20declared\x20but\x20never\x20enforced\x20on\x20buy.\x20Fix\x20=\x20body-level\x20assert\x20in\x20order\x20creation\x20(protocol\x20upgrade).','findings':['A-1'],'source':{'file':'service.move','line':0xcd,'pattern':'customer_required:\x20vector<String>'}},'Service.repositories':{'writeBy':['service\x20settings'],'readBy':['guard-query:\x20service.repository\x20count\x20/\x20has'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'service.move','line':0xc8,'pattern':'repositories:\x20vector<address>'}},'Service.rewards':{'writeBy':['service\x20settings'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'service.move','line':0xd3,'pattern':'rewards:\x20vector<address>'}},'Service.order_allocators':{'writeBy':['service\x20settings\x20(pre-publish\x20replace;\x20post-publish\x20append-only)'],'readBy':['buy\x20path\x20(order-bound\x20Allocation\x20creation)','guard-query'],'enforcedBy':['publish\x20requires\x20non-empty\x20(E_NO_ALLOCATOR,\x20service.move:689-700)'],'writeOnly':![],'notes':'Replacement\x20frozen\x20at\x20publish\x20(E_ALREADY_PUBLISHED\x20on\x20the\x20pre-publish\x20replacement\x20path).\x20Append-only\x20additions\x20remain\x20possible\x20via\x20the\x20allocator-append\x20mutation\x20—\x20prefix\x20allocators\x20+\x20threshold\x20frozen,\x20EALLOCATORS_NOT_EXTENSION=20\x20on\x20violation\x20(J1).\x20Zero\x20allocator\x20rows\x20=\x20no\x20settlement\x20and\x20no\x20refund\x20rail\x20(B-1).','findings':['B-1','A-2'],'source':{'file':'service.move','line':0xd2,'pattern':'order_allocators:\x20Option<Allocators>'}},'Sale.wip':{'writeBy':['service\x20sales\x20mutation'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'notes':'wip_hash\x20IS\x20enforced\x20at\x20quote\x20(E_WIP_HASH_NOT_MATCH);\x20wip\x20url\x20itself\x20is\x20not.\x20No\x20on-chain\x20escrow\x20of\x20wip\x20content\x20(A-15).','findings':['A-10','A-15'],'source':{'file':'service.move','line':0x6b,'pattern':'wip:\x20String'}},'Machine.consensus_repositories':{'writeBy':['machine\x20settings\x20(pre-publish)'],'readBy':['guard-query:\x20machine.consensus_repository\x20count\x20/\x20has'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'machine.move','line':
|
|
1
|
+
export const FIELD_CAPABILITY={'Order.dispute':{'writeBy':['order.dispute\x20(package,\x20via\x20the\x20Service-bound\x20dispute\x20filing\x20flow)'],'readBy':['order.dispute\x20count/contains\x20check\x20(MAX_DISPUTE_COUNT\x20gate,\x20order.move:101-102)','guard-query:\x20order.dispute\x20count\x20/\x20has'],'enforcedBy':['filing\x20is\x20allowlist-gated:\x20the\x20Service-bound\x20dispute\x20entry\x20points\x20enforce\x20the\x20arbitrator\x20allowlist\x20(39),\x20the\x20neutrality\x20rule\x20(33)\x20and\x20the\x20order\x20binding\x20(26)\x20BEFORE\x20the\x20case\x20is\x20minted;\x20the\x20Service-blind\x20arbitration-module\x20dispute\x20entries\x20abort\x20E_DISPUTE_DEPRECATED\x20(arbitration\x2010)'],'writeOnly':![],'notes':'A-11\x20CLOSED:\x20filing-time\x20enforcement\x20replaced\x20the\x20old\x20abort-only-at-compensation\x20surface;\x20an\x20off-allowlist\x20venue\x20can\x20no\x20longer\x20be\x20filed\x20against\x20at\x20all.','findings':['A-10','A-11'],'source':{'file':'order.move','line':0x45,'pattern':'dispute:\x20vector<address>'}},'Order.required_info':{'writeBy':['owner-only\x20order\x20field\x20update\x20(order.move:77-80)'],'readBy':['guard-query:\x20order.required_info\x20some\x20/\x20value'],'enforcedBy':[],'writeOnly':!![],'notes':'buy\x20path\x20never\x20reads\x20customer_required/required_info\x20(A-1).\x20Owner-write-only\x20field.','findings':['A-1','A-10'],'source':{'file':'order.move','line':0x49,'pattern':'required_info:\x20Option<address>'}},'Order.claimed_by':{'writeBy':['order.compensate\x20(package,\x20order.move:94-97)'],'readBy':['the\x20not-yet-claimed\x20assert\x20on\x20the\x20compensate/dispute\x20path','guard-query:\x20order.claimed_by\x20some\x20/\x20value'],'enforcedBy':['blocks\x20second\x20compensate/dispute'],'writeOnly':![],'notes':'NOT\x20read\x20by\x20allocation.alloc\x20—\x20refund\x20rail\x20must\x20self-check\x20via\x20refund\x20guard\x20(DUAL-RAIL-01).\x20Deliberate\x20design,\x20order.move:199-220.','findings':['A-3'],'source':{'file':'order.move','line':0x48,'pattern':'claimed_by:\x20Option<address>'}},'Order.time':{'writeBy':['order.new\x20(clock::timestamp_ms\x20at\x20creation)'],'readBy':['guard-query:\x20order.time'],'enforcedBy':['template-declared\x20time\x20anchors'],'writeOnly':![],'notes':'Stable\x20anchor\x20for\x20window\x20guards\x20—\x20unlike\x20Progress.current_time\x20it\x20is\x20path-INDEPENDENT.','source':{'file':'order.move','line':0x4a,'pattern':'time:\x20u64'}},'Service.customer_required':{'writeBy':['service\x20settings\x20(pre-publish)'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'notes':'A-1:\x20declared\x20but\x20never\x20enforced\x20on\x20buy.\x20Fix\x20=\x20body-level\x20assert\x20in\x20order\x20creation\x20(protocol\x20upgrade).','findings':['A-1'],'source':{'file':'service.move','line':0xcd,'pattern':'customer_required:\x20vector<String>'}},'Service.repositories':{'writeBy':['service\x20settings'],'readBy':['guard-query:\x20service.repository\x20count\x20/\x20has'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'service.move','line':0xc8,'pattern':'repositories:\x20vector<address>'}},'Service.rewards':{'writeBy':['service\x20settings'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'service.move','line':0xd3,'pattern':'rewards:\x20vector<address>'}},'Service.order_allocators':{'writeBy':['service\x20settings\x20(pre-publish\x20replace;\x20post-publish\x20append-only)'],'readBy':['buy\x20path\x20(order-bound\x20Allocation\x20creation)','guard-query'],'enforcedBy':['publish\x20requires\x20non-empty\x20(E_NO_ALLOCATOR,\x20service.move:689-700)'],'writeOnly':![],'notes':'Replacement\x20frozen\x20at\x20publish\x20(E_ALREADY_PUBLISHED\x20on\x20the\x20pre-publish\x20replacement\x20path).\x20Append-only\x20additions\x20remain\x20possible\x20via\x20the\x20allocator-append\x20mutation\x20—\x20prefix\x20allocators\x20+\x20threshold\x20frozen,\x20EALLOCATORS_NOT_EXTENSION=20\x20on\x20violation\x20(J1).\x20Zero\x20allocator\x20rows\x20=\x20no\x20settlement\x20and\x20no\x20refund\x20rail\x20(B-1).','findings':['B-1','A-2'],'source':{'file':'service.move','line':0xd2,'pattern':'order_allocators:\x20Option<Allocators>'}},'Sale.wip':{'writeBy':['service\x20sales\x20mutation'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'notes':'wip_hash\x20IS\x20enforced\x20at\x20quote\x20(E_WIP_HASH_NOT_MATCH);\x20wip\x20url\x20itself\x20is\x20not.\x20No\x20on-chain\x20escrow\x20of\x20wip\x20content\x20(A-15).','findings':['A-10','A-15'],'source':{'file':'service.move','line':0x6b,'pattern':'wip:\x20String'}},'Machine.consensus_repositories':{'writeBy':['machine\x20settings\x20(pre-publish)'],'readBy':['guard-query:\x20machine.consensus_repository\x20count\x20/\x20has'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'machine.move','line':0x148,'pattern':'consensus_repositories:\x20vector<address>'}},'Machine.nodes':{'writeBy':['machine\x20graph\x20mutation\x20(pre-publish)'],'readBy':['progress\x20node-advance','guard-query'],'enforcedBy':['publish\x20freeze\x20—\x20publishing\x20blocks\x20all\x20later\x20graph\x20changes'],'writeOnly':![],'notes':'Missing\x20edge\x20after\x20publish\x20=\x20permanent\x20brick\x20(A-2);\x20L1\x20must\x20dry-run\x20terminal\x20reachability\x20pre-publish.','findings':['A-2'],'source':{'file':'machine.move','line':0x147,'pattern':'nodes:\x20ParentLinkedTable<String,\x20vector<NodePair>>'}},'Progress.current_time':{'writeBy':['progress\x20node\x20entry\x20(timestamp\x20refreshed\x20on\x20every\x20advance,\x20progress.move:458)'],'readBy':['guard-query:\x20progress.current_time'],'enforcedBy':['window\x20guards\x20anchored\x20on\x20it'],'writeOnly':![],'notes':'PATH-DEPENDENT:\x20=\x20time\x20of\x20entering\x20CURRENT\x20node.\x20Routing\x20through\x20extra\x20nodes\x20(e.g.\x20reviewed)\x20postpones\x20settlement\x20windows\x20(E-10).\x20TIME-ANCHOR-01\x20checks\x20anchor\x20invariance\x20across\x20paths.','findings':['E-10','D-14'],'source':{'file':'progress.move','line':0x55,'pattern':'current_time:\x20u64'}},'Discount.benchmark':{'writeBy':['service.discounts\x20(creation)'],'readBy':['quote\x20price\x20calc\x20(discount\x20application)'],'enforcedBy':[],'writeOnly':![],'notes':'A-4:\x20below-benchmark\x20coupon\x20does\x20NOT\x20change\x20price\x20but\x20IS\x20still\x20burned\x20(a\x20discounted\x20quote\x20sets\x20discount:some\x20and\x20the\x20buy\x20path\x20destroys\x20the\x20coupon\x20unconditionally).','findings':['A-4'],'source':{'file':'service.move','line':0x85,'pattern':'benchmark:\x20Option<u64>'}},'Allocation.payment_info.for_object':{'writeBy':['buy\x20path\x20(set\x20to\x20the\x20Order\x20anchor\x20at\x20Allocation\x20creation)'],'readBy':['allocation.alloc\x20(ENO_PAYMENT_INFO\x20assert)'],'enforcedBy':['alloc\x20aborts\x20when\x20absent'],'writeOnly':![],'notes':'None\x20+\x20GuardIdentifier\x20recipient\x20=\x20CRITICAL\x20(funds\x20unrouteable)\x20—\x20template_scan\x20R-RECIPIENT-03\x20territory.','source':{'file':'allocation.move','line':0x194,'pattern':'payment_info:\x20Option<PaymentInfo>'}},'Treasury.inflow':{'writeBy':['treasury\x20deposit\x20paths'],'readBy':['guard-query','direct\x20field\x20accessor\x20treasury.inflow'],'enforcedBy':[],'writeOnly':![],'notes':'owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow\x20—\x20never\x20re-derive\x20inflow\x20from\x20events\x20(treasury.move:86-88).','source':{'file':'treasury.move','line':0x4f,'pattern':'inflow:\x20u128'}},'Contact.permission':{'writeBy':['contact\x20settings'],'readBy':[],'enforcedBy':[],'writeOnly':![],'notes':'Never\x20consulted\x20anywhere\x20—\x20the\x20contact\x20status-change\x20call\x20(contact.move:33-43)\x20ignores\x20it\x20(A-16).\x20Not\x20part\x20of\x20the\x20A-10\x20guard-query\x20cluster:\x20it\x20has\x20no\x20reader\x20at\x20all.','findings':['A-16'],'source':{'file':'contact.move','line':0x1e,'pattern':'permission:\x20address'}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const FREEZE_MAP={'service_publish':{'object':'Service<T>','trigger':'service.publish','frozen':['order_allocators:\x20full\x20replacement\x20blocked\x20(E_ALREADY_PUBLISHED);\x20append-only\x20additions\x20remain\x20possible\x20via\x20the\x20allocator-append\x20mutation\x20(prefix/threshold\x20frozen\x20—\x20EALLOCATORS_NOT_EXTENSION=20)','all\x20settings\x20paths\x20(every\x20mutation\x20aborts\x20once\x20published)'],'preconditions':['order_allocators\x20must\x20be\x20non-empty\x20(E_NO_ALLOCATOR)','compensation_fund\x20>\x200\x20implies\x20arbitrations\x20non-empty'],'consequence':'Wrong/missing\x20allocator\x20or\x20unreachable\x20business-terminal\x20node\x20=\x20permanent\x20brick;\x20the\x20only\x20remedy\x20is\x20a\x20new\x20Service\x20(A-2).','findings':['A-2'],'sources':[{'file':'service.move','line':0x315,'pattern':'E_ALREADY_PUBLISHED'},{'file':'service.move','line':0x2f6,'pattern':'E_NO_ALLOCATOR'}]},'machine_publish':{'object':'Machine','trigger':'machine.publish','frozen':['entire\x20graph:\x20nodes/pairs/forwards\x20(publish\x20blocks\x20every\x20later\x20graph\x20mutation)'],'preconditions':['publishability\x20checks:\x20E_NO_ENTRY_EDGE(19)\x20E_EDGE_SOURCE_NOT_FOUND(20)\x20E_FORWARD_NO_IDENTITY(21)\x20E_UNREACHABLE_THRESHOLD(22)'],'consequence':'A\x20missing\x20paid->closed_cancel\x20edge\x20can\x20never\x20be\x20added\x20later\x20(A-2/F-2).','findings':['A-2'],'sources':[{'file':'machine.move','line':
|
|
1
|
+
export const FREEZE_MAP={'service_publish':{'object':'Service<T>','trigger':'service.publish','frozen':['order_allocators:\x20full\x20replacement\x20blocked\x20(E_ALREADY_PUBLISHED);\x20append-only\x20additions\x20remain\x20possible\x20via\x20the\x20allocator-append\x20mutation\x20(prefix/threshold\x20frozen\x20—\x20EALLOCATORS_NOT_EXTENSION=20)','all\x20settings\x20paths\x20(every\x20mutation\x20aborts\x20once\x20published)'],'preconditions':['order_allocators\x20must\x20be\x20non-empty\x20(E_NO_ALLOCATOR)','compensation_fund\x20>\x200\x20implies\x20arbitrations\x20non-empty'],'consequence':'Wrong/missing\x20allocator\x20or\x20unreachable\x20business-terminal\x20node\x20=\x20permanent\x20brick;\x20the\x20only\x20remedy\x20is\x20a\x20new\x20Service\x20(A-2).','findings':['A-2'],'sources':[{'file':'service.move','line':0x315,'pattern':'E_ALREADY_PUBLISHED'},{'file':'service.move','line':0x2f6,'pattern':'E_NO_ALLOCATOR'}]},'machine_publish':{'object':'Machine','trigger':'machine.publish','frozen':['entire\x20graph:\x20nodes/pairs/forwards\x20(publish\x20blocks\x20every\x20later\x20graph\x20mutation)'],'preconditions':['publishability\x20checks:\x20E_NO_ENTRY_EDGE(19)\x20E_EDGE_SOURCE_NOT_FOUND(20)\x20E_FORWARD_NO_IDENTITY(21)\x20E_UNREACHABLE_THRESHOLD(22)'],'consequence':'A\x20missing\x20paid->closed_cancel\x20edge\x20can\x20never\x20be\x20added\x20later\x20(A-2/F-2).','findings':['A-2'],'sources':[{'file':'machine.move','line':0x14f,'pattern':'assert_not_published'},{'file':'machine.move','line':0x33,'pattern':'E_NO_ENTRY_EDGE'}]},'forward_construction':{'object':'machine.Forward','trigger':'machine\x20forward\x20construction,\x20guarded\x20or\x20plain\x20(pre-publish)','frozen':[],'preconditions':['permissionIndex\x20>=\x201000\x20(USER_DEFINED_PERM_INDEX,\x20machine.move:91,117)\x20—\x20template\x20perm\x202/3\x20aborts\x20on\x20chain\x20(B-8)','retained_submission\x20must\x20be\x20a\x20subset\x20of\x20the\x20guard\x27s\x20submissions\x20(E_RETAINED_SUBMISSION_ERROR,\x20machine.move:103)','one\x20of\x20namedOperator\x20|\x20permissionIndex\x20|\x20guard\x20must\x20be\x20set\x20(E_PERMISSION_NOT_DEFINED)'],'consequence':'Bad\x20forwards\x20fail\x20at\x20build\x20time\x20—\x20but\x20only\x20if\x20the\x20tool\x20layer\x20surfaces\x20the\x20abort\x20reason.','findings':['B-8'],'sources':[{'file':'machine.move','line':0x5b,'pattern':'USER_DEFINED_PERM_INDEX'},{'file':'machine.move','line':0x67,'pattern':'E_RETAINED_SUBMISSION_ERROR'}]},'repository_no_freeze':{'object':'Repository','trigger':'(none\x20—\x20no\x20publish\x20concept)','frozen':[],'preconditions':['policies\x20mutable\x20post-share\x20via\x20the\x20permission-guarded\x20policy\x20add/set/remove/clear\x20calls\x20(repository.move:695-776)'],'consequence':'Write-policy\x20mistakes\x20are\x20repairable\x20—\x20unlike\x20Machine/Service\x20publish.','sources':[{'file':'repository.move','line':0x2b7,'pattern':'public\x20fun\x20policy_add'}]},'discount_creation':{'object':'Discount','trigger':'service.discounts\x20(creation)','frozen':['all\x20fields\x20including\x20transferable\x20and\x20benchmark'],'preconditions':['discount_type\x20in\x20{0\x20rates,\x201\x20minus};\x20rates\x20requires\x20off\x20<=\x2010000','time_end\x20>=\x20time_start\x20(default\x20now)'],'consequence':'Non-transferable\x20coupon\x20can\x20never\x20be\x20re-homed;\x20benchmark\x20errors\x20burn\x20buyer\x20coupons\x20(A-4).','findings':['A-4'],'sources':[{'file':'service.move','line':0x8d,'pattern':'fun\x20discounts'}]}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const OBJECT_GRAPH={'Sale':{'module':'service','ownership':'value','references':{},'valueFields':{'name':'String','price':'u64','stock':'u64','suspension':'bool','wip':'String\x20//\x20write-only\x20(A-10)','wip_hash':'String\x20//\x20enforced\x20at\x20quote\x20(E_WIP_HASH_NOT_MATCH)'},'notes':'Value\x20type\x20embedded\x20in\x20Service.sales;\x20no\x20independent\x20identity.','source':{'file':'service.move','line':0x66,'pattern':'public\x20struct\x20Sale\x20has\x20store,\x20drop,\x20copy'},'findings':['A-10','A-15']},'Permission':{'module':'permission','ownership':'shared','references':{'um':'Contact?'},'valueFields':{'owner':'address','admin':'vector<address>','description':'String','remark':'vector<PermissionRemark>','table':'ParentLinkedTable<address,\x20vector<u16>>\x20//\x20entity/guard\x20->\x20perm\x20indexes'},'notes':'USER_DEFINED_PERM_INDEX_START=1000\x20enforced\x20at\x20construction;\x20the\x20permission\x20check\x20grants\x20all\x20indexes\x20to\x20admins.','source':{'file':'permission.move','line':0x21,'pattern':'public\x20struct\x20Permission\x20has\x20key'}},'Guard':{'module':'guard','ownership':'shared','references':{'relies':'address[]\x20//\x20any\x20object'},'valueFields':{'description':'String','table':'vector<TableItem>','validated':'vector<TableItemType>','input':'vector<u8>','relies_logic_and':'bool','immutable':'bool','rep':'bool'},'notes':'rep=false\x20means\x20the\x20queried\x20object/first\x20param\x20failed\x20the\x201167\x20query\x20validation.','source':{'file':'guard.move','line':0x6d,'pattern':'public\x20struct\x20Guard\x20has\x20key'}},'Machine':{'module':'machine','ownership':'shared','references':{'consensus_repositories':'Repository[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','nodes':'ParentLinkedTable<String,\x20vector<NodePair>>','bPaused':'bool','bPublished':'bool'},'notes':'Forward\x20=\x20{namedOperator?\x20|\x20permissionIndex?\x20(pre-check,\x20namedOperator\x20first)}\x20+\x20guard?\x20(post-check).\x20permissionIndex>=1000\x20at\x20construction;\x20retained_submission\x20must\x20be\x20subset\x20of\x20guard\x20submissions.','source':{'file':'machine.move','line':0x13b,'pattern':'public\x20struct\x20Machine\x20has\x20key'}},'Service<T>':{'module':'service','typeParam':'T','ownership':'shared','references':{'repositories':'Repository[]','buy_guard':'Guard?','machine':'Machine?','arbitrations':'Arbitration<T>[]','order_allocators':'Guard\x20(via\x20Allocators.allocators[].guard)','rewards':'Reward<T>[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','sales':'vector<Sale>','bPublished':'bool','bPaused':'bool','customer_required':'vector<String>','compensation_fund':'Balance<T>','paused_time':'Option<u64>','setting_lock_duration':'u64'},'notes':'customer_required\x20is\x20write-only,\x20buy\x20path\x20never\x20enforces\x20it\x20(A-1).\x20compensation_fund\x20pays\x20arbitrator\x20indemnity\x20directly\x20to\x20order\x20owner.','source':{'file':'service.move','line':0xc3,'pattern':'public\x20struct\x20Service<phantom\x20T>\x20has\x20key'},'findings':['A-1','A-4','A-9','A-10','A-15']},'Order':{'module':'order','ownership':'shared','references':{'service':'Service<T>','machine':'Machine?','progress':'Progress?','allocation':'Allocation<T>?','discount':'Discount?','claimed_by':'Arb<T>?','required_info':'Contact|Proof?','dispute':'Arb<T>[]','agent':'address[]'},'valueFields':{'items':'vector<SaleItem>','amount':'u64','owner':'address','time':'u64\x20//\x20order\x20creation'},'notes':'claimed_by\x20written\x20by\x20compensate;\x20NOT\x20read\x20by\x20allocation.alloc\x20(dual-rail,\x20A-3\x20deliberate).\x20required_info\x20writable\x20by\x20owner\x20only,\x20enforced\x20nowhere\x20(A-1).','source':{'file':'order.move','line':0x3c,'pattern':'public\x20struct\x20Order\x20has\x20key'},'findings':['A-1','A-3','A-10']},'Progress':{'module':'progress','ownership':'shared','references':{'machine':'Machine','task':'Order?','context_repositories':'Repository[]'},'valueFields':{'current':'String','namedOperator':'vector<NamedOperator>','session':'vector<Session>','history':'ParentTableVec<History>','current_time':'u64\x20//\x20TIME\x20OF\x20ENTERING\x20CURRENT\x20NODE,\x20path-dependent\x20(E-10)'},'notes':'current_time\x20refreshes\x20on\x20every\x20node\x20transition;\x20window\x20guards\x20anchored\x20on\x20it\x20are\x20path-dependent.','source':{'file':'progress.move','line':0x4c,'pattern':'public\x20struct\x20Progress\x20has\x20key'},'findings':['E-10','D-14','A-6']},'Allocation<T>':{'module':'allocation','typeParam':'T','ownership':'shared','references':{'allocators.allocators[].guard':'Guard','payment':'Payment<T>[]','payment_info.for_object':'Order\x20(anchor)'},'valueFields':{'balance':'Balance<T>','allocators':'Allocators','payment_info':'Option<PaymentInfo>'},'notes':'alloc\x20runs\x20EVERY\x20allocator\x20whose\x20guard\x20matches;\x20each\x20consumes\x20a\x20once-slot\x20keyed\x20by\x20allocator\x20index;\x20evaluated\x20in\x20vector\x20order\x20against\x20shrinking\x20pool.','source':{'file':'allocation.move','line':0x190,'pattern':'public\x20struct\x20Allocation<phantom\x20T>\x20has\x20key'},'findings':['A-3']},'Payment<T>':{'module':'payment','typeParam':'T','ownership':'shared','references':{'info.for_object':'object?','info.for_guard':'Guard?','from_object':'object?'},'valueFields':{'amount':'u64','time':'u64','info':'PaymentInfo','signer':'address','record':'vector<Revenue>'},'source':{'file':'payment.move','line':0x5c,'pattern':'public\x20struct\x20Payment<phantom\x20T>\x20has\x20key'}},'CoinWrapper<T>':{'module':'payment','typeParam':'T','ownership':'owned','references':{'payment':'Payment<T>'},'valueFields':{'balance':'Balance<T>'},'notes':'Transferred\x20to\x20each\x20recipient;\x20unwrap\x20yields\x20Coin<T>.','source':{'file':'payment.move','line':0x27,'pattern':'public\x20struct\x20CoinWrapper<phantom\x20T>\x20has\x20key,\x20store'}},'Arbitration<T>':{'module':'arbitration','typeParam':'T','ownership':'shared','references':{'voting_guard[].guard':'Guard','usage_guard':'Guard?','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','fee':'u64','balance':'Balance<T>','bPaused':'bool'},'notes':'Independent\x20arbitrator\x20=\x20independent\x20account\x20+\x20independent\x20Permission.\x20Empty\x20voting_guard\x20=\x20open\x20voting.','source':{'file':'arbitration.move','line':0x2f,'pattern':'public\x20struct\x20Arbitration<phantom\x20T>\x20has\x20key'}},'Arb<T>':{'module':'arb','typeParam':'T','ownership':'shared','references':{'order':'Order','arbitration':'Arbitration<T>'},'valueFields':{'voted':'vector<Voted>','proposition':'vector<Proposition>','fee':'Balance<T>','feedback':'String','indemnity':'Option<Indemnity>','voting_deadline':'Option<u64>','objection':'String','status':'u8\x20//\x200..6\x20Principal_confirming..Withdrawn','compensation_time':'Option<u64>','time':'u64'},'source':{'file':'arb.move','line':0x86,'pattern':'public\x20struct\x20Arb<phantom\x20T>\x20has\x20key'}},'Repository':{'module':'repository','ownership':'shared','references':{'policies[].write_guard[].guard':'Guard','policies[].quote_guard':'Guard?','rewards':'Reward<T>[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','policies':'vector<PolicyRule>','data':'ParentTable<DataKey,\x20vector<u8>>'},'notes':'Policies\x20mutable\x20post-share\x20via\x20the\x20permission-guarded\x20policy\x20add/set/remove/clear\x20calls\x20(repository.move:695-776).\x20The\x20passport-based\x20id-data\x20removal\x20call\x20always\x20aborts\x20(A-8).','source':{'file':'repository.move','line':0x1e2,'pattern':'public\x20struct\x20Repository\x20has\x20key'},'findings':['A-8','A-10']},'Demand':{'module':'demand','ownership':'shared','references':{'rewards':'Reward<T>[]','guards[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','presenters':'ParentTable<address,\x20ServiceInfo>'},'source':{'file':'demand.move','line':0x49,'pattern':'public\x20struct\x20Demand\x20has\x20key'}},'Reward<T>':{'module':'reward','typeParam':'T','ownership':'shared','references':{'guards[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','balance':'Balance<T>','guard_not_added_expiration_time':'Option<u64>','record':'ParentTable<address,\x20RecipientRecord>'},'source':{'file':'reward.move','line':0x80,'pattern':'public\x20struct\x20Reward<phantom\x20T>\x20has\x20key'}},'Treasury<T>':{'module':'treasury','typeParam':'T','ownership':'shared','references':{'external_deposit_guard[].guard':'Guard','external_withdraw_guard[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'balance':'Balance<T>','history':'ParentTable<address,\x20Record>','inflow':'u128','outflow':'u128'},'notes':'owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow;\x20read\x20inflow\x20field,\x20never\x20re-derive\x20from\x20events.','source':{'file':'treasury.move','line':0x48,'pattern':'public\x20struct\x20Treasury<phantom\x20T>\x20has\x20key'}},'Contact':{'module':'contact','ownership':'shared','references':{'permission':'Permission'},'valueFields':{'description':'String','location':'String','ims':'vector<Im>'},'notes':'The\x20contact\x20status-change\x20call\x20has\x20NO\x20permission\x20check;\x20the\x20permission\x20field\x20is\x20never\x20consulted\x20by\x20it\x20(A-16).','source':{'file':'contact.move','line':0x19,'pattern':'public\x20struct\x20Contact\x20has\x20key'},'findings':['A-16']},'Proof':{'module':'proof','ownership':'owned','references':{'about':'object?'},'valueFields':{'description':'String','proof':'String','item_count':'Option<u64>','server_pubkey':'String','server_signature':'String','signer':'address','proof_type':'u64','time':'u64'},'notes':'No\x20share_object\x20in\x20module;\x20owned\x20by\x20creator.\x20Carrier\x20for\x20WTS\x20evidence\x20anchors.','source':{'file':'proof.move','line':0xd,'pattern':'public\x20struct\x20Proof\x20has\x20key'}},'Discount':{'module':'service','ownership':'owned','references':{'service':'Service<T>'},'valueFields':{'name':'String','discount_type':'u8\x20//\x200=rates\x201=minus','benchmark':'Option<u64>','off':'u64','time_start':'u64','time_end':'u64','transferable':'bool'},'notes':'Transferred\x20to\x20buyer.\x20Burned\x20unconditionally\x20at\x20buy\x20even\x20when\x20benchmark\x20unmet\x20(A-4).','source':{'file':'service.move','line':0x81,'pattern':'public\x20struct\x20Discount\x20has\x20key'},'findings':['A-4']},'Passport':{'module':'passport','ownership':'owned','references':{'guard[].guard':'Guard','guard[].relies':'address[]','impack':'address[]'},'valueFields':{'result':'bool','tx_hash':'vector<u8>','time':'u64','signer':'address','has_verified':'bool'},'notes':'No\x20share_object\x20in\x20module;\x20carried\x20by\x20signer,\x20mutated\x20across\x20guard\x20checks.','source':{'file':'passport.move','line':0x28,'pattern':'public\x20struct\x20Passport\x20has\x20key'}},'EntityOrders':{'module':'entity_order','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<OrderRoleItem>>'},'notes':'Reverse\x20index\x20entity->orders.\x20FIFO\x20eviction\x20at\x205200\x20entries\x20(entity_order.move:72-78)\x20—\x20silent.','source':{'file':'entity_order.move','line':0x1e,'pattern':'public\x20struct\x20EntityOrders\x20has\x20key'},'findings':['A-13']},'EntityPermission':{'module':'entity_permission','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<PermissionItem>>'},'source':{'file':'entity_permission.move','line':0x1e,'pattern':'public\x20struct\x20EntityPermission\x20has\x20key'}},'EntityContact':{'module':'entity_contact','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<ContactItem>>'},'source':{'file':'entity_contact.move','line':0x18,'pattern':'public\x20struct\x20EntityContact\x20has\x20key'}},'ObjectLinkerCore':{'module':'object_linker','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<CoreLink>>\x20//\x20target\x20->\x20core\x20who[],\x20lossless'},'source':{'file':'object_linker.move','line':0x25,'pattern':'public\x20struct\x20ObjectLinkerCore\x20has\x20key'}},'ObjectLinkerTx':{'module':'object_linker','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20TxBuffer>\x20//\x20target\x20->\x20recent\x20tx\x20who[],\x20lossy\x20FIFO'},'source':{'file':'object_linker.move','line':0x2b,'pattern':'public\x20struct\x20ObjectLinkerTx\x20has\x20key'}},'Registrar':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20Votes>\x20//\x20who\x20->\x20likes/dislikes/favors'},'source':{'file':'registrar.move','line':0xb4,'pattern':'public\x20struct\x20Registrar\x20has\x20key'}},'Entity':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20AddressInfo>'},'source':{'file':'registrar.move','line':0xb9,'pattern':'public\x20struct\x20Entity\x20has\x20key'}},'Messenger':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<String,\x20PubKeyData>'},'notes':'DEAD:\x20struct\x20declared\x20but\x20share_object\x20commented\x20out\x20(registrar.move:209-212).\x20No\x20on-chain\x20Messenger\x20(A-16).','source':{'file':'registrar.move','line':0x278,'pattern':'public\x20struct\x20Messenger\x20has\x20key'},'findings':['A-16']},'Resource':{'module':'resource','ownership':'shared','references':{},'valueFields':{'table':'ParentTable<address,\x20AddressTag>'},'source':{'file':'resource.move','line':0x11,'pattern':'public\x20struct\x20Resource\x20has\x20key'}}};
|
|
1
|
+
export const OBJECT_GRAPH={'Sale':{'module':'service','ownership':'value','references':{},'valueFields':{'name':'String','price':'u64','stock':'u64','suspension':'bool','wip':'String\x20//\x20write-only\x20(A-10)','wip_hash':'String\x20//\x20enforced\x20at\x20quote\x20(E_WIP_HASH_NOT_MATCH)'},'notes':'Value\x20type\x20embedded\x20in\x20Service.sales;\x20no\x20independent\x20identity.','source':{'file':'service.move','line':0x66,'pattern':'public\x20struct\x20Sale\x20has\x20store,\x20drop,\x20copy'},'findings':['A-10','A-15']},'Permission':{'module':'permission','ownership':'shared','references':{'um':'Contact?'},'valueFields':{'owner':'address','admin':'vector<address>','description':'String','remark':'vector<PermissionRemark>','table':'ParentLinkedTable<address,\x20vector<u16>>\x20//\x20entity/guard\x20->\x20perm\x20indexes'},'notes':'USER_DEFINED_PERM_INDEX_START=1000\x20enforced\x20at\x20construction;\x20the\x20permission\x20check\x20grants\x20all\x20indexes\x20to\x20admins.','source':{'file':'permission.move','line':0x21,'pattern':'public\x20struct\x20Permission\x20has\x20key'}},'Guard':{'module':'guard','ownership':'shared','references':{'relies':'address[]\x20//\x20any\x20object'},'valueFields':{'description':'String','table':'vector<TableItem>','validated':'vector<TableItemType>','input':'vector<u8>','relies_logic_and':'bool','immutable':'bool','rep':'bool'},'notes':'rep=false\x20means\x20the\x20queried\x20object/first\x20param\x20failed\x20the\x201167\x20query\x20validation.','source':{'file':'guard.move','line':0x6d,'pattern':'public\x20struct\x20Guard\x20has\x20key'}},'Machine':{'module':'machine','ownership':'shared','references':{'consensus_repositories':'Repository[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','nodes':'ParentLinkedTable<String,\x20vector<NodePair>>','bPaused':'bool','bPublished':'bool'},'notes':'Forward\x20=\x20{namedOperator?\x20|\x20permissionIndex?\x20(pre-check,\x20namedOperator\x20first)}\x20+\x20guard?\x20(post-check).\x20permissionIndex>=1000\x20at\x20construction;\x20retained_submission\x20must\x20be\x20subset\x20of\x20guard\x20submissions.\x20namedOperator\x20\x27\x27\x20(empty)\x20=\x20order\x20holder\x20—\x20the\x20open-subscription\x20buyer\x20self-advance\x20standard;\x20\x27\x27\x20may\x20coexist\x20with\x20permissionIndex\x20on\x20one\x20forward\x20(order\x20holder\x20OR\x20permission\x20entity).','source':{'file':'machine.move','line':0x144,'pattern':'public\x20struct\x20Machine\x20has\x20key'}},'Service<T>':{'module':'service','typeParam':'T','ownership':'shared','references':{'repositories':'Repository[]','buy_guard':'Guard?','machine':'Machine?','arbitrations':'Arbitration<T>[]','order_allocators':'Guard\x20(via\x20Allocators.allocators[].guard)','rewards':'Reward<T>[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','sales':'vector<Sale>','bPublished':'bool','bPaused':'bool','customer_required':'vector<String>','compensation_fund':'Balance<T>','paused_time':'Option<u64>','setting_lock_duration':'u64'},'notes':'customer_required\x20is\x20write-only,\x20buy\x20path\x20never\x20enforces\x20it\x20(A-1).\x20compensation_fund\x20pays\x20arbitrator\x20indemnity\x20directly\x20to\x20order\x20owner.','source':{'file':'service.move','line':0xc3,'pattern':'public\x20struct\x20Service<phantom\x20T>\x20has\x20key'},'findings':['A-1','A-4','A-9','A-10','A-15']},'Order':{'module':'order','ownership':'shared','references':{'service':'Service<T>','machine':'Machine?','progress':'Progress?','allocation':'Allocation<T>?','discount':'Discount?','claimed_by':'Arb<T>?','required_info':'Contact|Proof?','dispute':'Arb<T>[]','agent':'address[]'},'valueFields':{'items':'vector<SaleItem>','amount':'u64','owner':'address','time':'u64\x20//\x20order\x20creation'},'notes':'claimed_by\x20written\x20by\x20compensate;\x20NOT\x20read\x20by\x20allocation.alloc\x20(dual-rail,\x20A-3\x20deliberate).\x20required_info\x20writable\x20by\x20owner\x20only,\x20enforced\x20nowhere\x20(A-1).','source':{'file':'order.move','line':0x3c,'pattern':'public\x20struct\x20Order\x20has\x20key'},'findings':['A-1','A-3','A-10']},'Progress':{'module':'progress','ownership':'shared','references':{'machine':'Machine','task':'Order?','context_repositories':'Repository[]'},'valueFields':{'current':'String','namedOperator':'vector<NamedOperator>','session':'vector<Session>','history':'ParentTableVec<History>','current_time':'u64\x20//\x20TIME\x20OF\x20ENTERING\x20CURRENT\x20NODE,\x20path-dependent\x20(E-10)'},'notes':'current_time\x20refreshes\x20on\x20every\x20node\x20transition;\x20window\x20guards\x20anchored\x20on\x20it\x20are\x20path-dependent.','source':{'file':'progress.move','line':0x4c,'pattern':'public\x20struct\x20Progress\x20has\x20key'},'findings':['E-10','D-14','A-6']},'Allocation<T>':{'module':'allocation','typeParam':'T','ownership':'shared','references':{'allocators.allocators[].guard':'Guard','payment':'Payment<T>[]','payment_info.for_object':'Order\x20(anchor)'},'valueFields':{'balance':'Balance<T>','allocators':'Allocators','payment_info':'Option<PaymentInfo>'},'notes':'alloc\x20runs\x20EVERY\x20allocator\x20whose\x20guard\x20matches;\x20each\x20consumes\x20a\x20once-slot\x20keyed\x20by\x20allocator\x20index;\x20evaluated\x20in\x20vector\x20order\x20against\x20shrinking\x20pool.','source':{'file':'allocation.move','line':0x190,'pattern':'public\x20struct\x20Allocation<phantom\x20T>\x20has\x20key'},'findings':['A-3']},'Payment<T>':{'module':'payment','typeParam':'T','ownership':'shared','references':{'info.for_object':'object?','info.for_guard':'Guard?','from_object':'object?'},'valueFields':{'amount':'u64','time':'u64','info':'PaymentInfo','signer':'address','record':'vector<Revenue>'},'source':{'file':'payment.move','line':0x5c,'pattern':'public\x20struct\x20Payment<phantom\x20T>\x20has\x20key'}},'CoinWrapper<T>':{'module':'payment','typeParam':'T','ownership':'owned','references':{'payment':'Payment<T>'},'valueFields':{'balance':'Balance<T>'},'notes':'Transferred\x20to\x20each\x20recipient;\x20unwrap\x20yields\x20Coin<T>.','source':{'file':'payment.move','line':0x27,'pattern':'public\x20struct\x20CoinWrapper<phantom\x20T>\x20has\x20key,\x20store'}},'Arbitration<T>':{'module':'arbitration','typeParam':'T','ownership':'shared','references':{'voting_guard[].guard':'Guard','usage_guard':'Guard?','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','fee':'u64','balance':'Balance<T>','bPaused':'bool'},'notes':'Independent\x20arbitrator\x20=\x20independent\x20account\x20+\x20independent\x20Permission.\x20Empty\x20voting_guard\x20=\x20open\x20voting.','source':{'file':'arbitration.move','line':0x2f,'pattern':'public\x20struct\x20Arbitration<phantom\x20T>\x20has\x20key'}},'Arb<T>':{'module':'arb','typeParam':'T','ownership':'shared','references':{'order':'Order','arbitration':'Arbitration<T>'},'valueFields':{'voted':'vector<Voted>','proposition':'vector<Proposition>','fee':'Balance<T>','feedback':'String','indemnity':'Option<Indemnity>','voting_deadline':'Option<u64>','objection':'String','status':'u8\x20//\x200..6\x20Principal_confirming..Withdrawn','compensation_time':'Option<u64>','time':'u64'},'source':{'file':'arb.move','line':0x86,'pattern':'public\x20struct\x20Arb<phantom\x20T>\x20has\x20key'}},'Repository':{'module':'repository','ownership':'shared','references':{'policies[].write_guard[].guard':'Guard','policies[].quote_guard':'Guard?','rewards':'Reward<T>[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','policies':'vector<PolicyRule>','data':'ParentTable<DataKey,\x20vector<u8>>'},'notes':'Policies\x20mutable\x20post-share\x20via\x20the\x20permission-guarded\x20policy\x20add/set/remove/clear\x20calls\x20(repository.move:695-776).\x20The\x20passport-based\x20id-data\x20removal\x20call\x20always\x20aborts\x20(A-8).','source':{'file':'repository.move','line':0x1e2,'pattern':'public\x20struct\x20Repository\x20has\x20key'},'findings':['A-8','A-10']},'Demand':{'module':'demand','ownership':'shared','references':{'rewards':'Reward<T>[]','guards[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','presenters':'ParentTable<address,\x20ServiceInfo>'},'source':{'file':'demand.move','line':0x49,'pattern':'public\x20struct\x20Demand\x20has\x20key'}},'Reward<T>':{'module':'reward','typeParam':'T','ownership':'shared','references':{'guards[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','balance':'Balance<T>','guard_not_added_expiration_time':'Option<u64>','record':'ParentTable<address,\x20RecipientRecord>'},'source':{'file':'reward.move','line':0x80,'pattern':'public\x20struct\x20Reward<phantom\x20T>\x20has\x20key'}},'Treasury<T>':{'module':'treasury','typeParam':'T','ownership':'shared','references':{'external_deposit_guard[].guard':'Guard','external_withdraw_guard[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'balance':'Balance<T>','history':'ParentTable<address,\x20Record>','inflow':'u128','outflow':'u128'},'notes':'owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow;\x20read\x20inflow\x20field,\x20never\x20re-derive\x20from\x20events.','source':{'file':'treasury.move','line':0x48,'pattern':'public\x20struct\x20Treasury<phantom\x20T>\x20has\x20key'}},'Contact':{'module':'contact','ownership':'shared','references':{'permission':'Permission'},'valueFields':{'description':'String','location':'String','ims':'vector<Im>'},'notes':'The\x20contact\x20status-change\x20call\x20has\x20NO\x20permission\x20check;\x20the\x20permission\x20field\x20is\x20never\x20consulted\x20by\x20it\x20(A-16).','source':{'file':'contact.move','line':0x19,'pattern':'public\x20struct\x20Contact\x20has\x20key'},'findings':['A-16']},'Proof':{'module':'proof','ownership':'owned','references':{'about':'object?'},'valueFields':{'description':'String','proof':'String','item_count':'Option<u64>','server_pubkey':'String','server_signature':'String','signer':'address','proof_type':'u64','time':'u64'},'notes':'No\x20share_object\x20in\x20module;\x20owned\x20by\x20creator.\x20Carrier\x20for\x20WTS\x20evidence\x20anchors.','source':{'file':'proof.move','line':0xd,'pattern':'public\x20struct\x20Proof\x20has\x20key'}},'Discount':{'module':'service','ownership':'owned','references':{'service':'Service<T>'},'valueFields':{'name':'String','discount_type':'u8\x20//\x200=rates\x201=minus','benchmark':'Option<u64>','off':'u64','time_start':'u64','time_end':'u64','transferable':'bool'},'notes':'Transferred\x20to\x20buyer.\x20Burned\x20unconditionally\x20at\x20buy\x20even\x20when\x20benchmark\x20unmet\x20(A-4).','source':{'file':'service.move','line':0x81,'pattern':'public\x20struct\x20Discount\x20has\x20key'},'findings':['A-4']},'Passport':{'module':'passport','ownership':'owned','references':{'guard[].guard':'Guard','guard[].relies':'address[]','impack':'address[]'},'valueFields':{'result':'bool','tx_hash':'vector<u8>','time':'u64','signer':'address','has_verified':'bool'},'notes':'No\x20share_object\x20in\x20module;\x20carried\x20by\x20signer,\x20mutated\x20across\x20guard\x20checks.','source':{'file':'passport.move','line':0x28,'pattern':'public\x20struct\x20Passport\x20has\x20key'}},'EntityOrders':{'module':'entity_order','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<OrderRoleItem>>'},'notes':'Reverse\x20index\x20entity->orders.\x20FIFO\x20eviction\x20at\x205200\x20entries\x20(entity_order.move:72-78)\x20—\x20silent.','source':{'file':'entity_order.move','line':0x1e,'pattern':'public\x20struct\x20EntityOrders\x20has\x20key'},'findings':['A-13']},'EntityPermission':{'module':'entity_permission','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<PermissionItem>>'},'source':{'file':'entity_permission.move','line':0x1e,'pattern':'public\x20struct\x20EntityPermission\x20has\x20key'}},'EntityContact':{'module':'entity_contact','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<ContactItem>>'},'source':{'file':'entity_contact.move','line':0x18,'pattern':'public\x20struct\x20EntityContact\x20has\x20key'}},'ObjectLinkerCore':{'module':'object_linker','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<CoreLink>>\x20//\x20target\x20->\x20core\x20who[],\x20lossless'},'source':{'file':'object_linker.move','line':0x25,'pattern':'public\x20struct\x20ObjectLinkerCore\x20has\x20key'}},'ObjectLinkerTx':{'module':'object_linker','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20TxBuffer>\x20//\x20target\x20->\x20recent\x20tx\x20who[],\x20lossy\x20FIFO'},'source':{'file':'object_linker.move','line':0x2b,'pattern':'public\x20struct\x20ObjectLinkerTx\x20has\x20key'}},'Registrar':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20Votes>\x20//\x20who\x20->\x20likes/dislikes/favors'},'source':{'file':'registrar.move','line':0xb4,'pattern':'public\x20struct\x20Registrar\x20has\x20key'}},'Entity':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20AddressInfo>'},'source':{'file':'registrar.move','line':0xb9,'pattern':'public\x20struct\x20Entity\x20has\x20key'}},'Messenger':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<String,\x20PubKeyData>'},'notes':'DEAD:\x20struct\x20declared\x20but\x20share_object\x20commented\x20out\x20(registrar.move:209-212).\x20No\x20on-chain\x20Messenger\x20(A-16).','source':{'file':'registrar.move','line':0x278,'pattern':'public\x20struct\x20Messenger\x20has\x20key'},'findings':['A-16']},'Resource':{'module':'resource','ownership':'shared','references':{},'valueFields':{'table':'ParentTable<address,\x20AddressTag>'},'source':{'file':'resource.move','line':0x11,'pattern':'public\x20struct\x20Resource\x20has\x20key'}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile}from'node:fs/promises';import{verifyFalcon512Signature}from'@wowok/wowok/w/messenger/crypto.js';function resolveServerPublicKey(a,b){const c=Array['isArray'](b?.['serverPublicKeys'])?b['serverPublicKeys']:undefined,d=a?.['serverPublicKeyIndex'];if(c&&typeof d==='number'&&d>=0x0&&d<c['length']){const f=c[d],g=typeof f==='string'?f:f?.['publicKey'];if(typeof g==='string'&&g)return g;}const e=a?.['serverPublicKey'];return typeof e==='string'&&e?e:null;}export function attestWtsDocument(a){const b=a,c=b?.['meta'],d=Array['isArray'](b?.['payload']?.['messages'])?b['payload']['messages']:undefined;if(!c||!d)return undefined;const e=[];let f=0x0;for(const m of d){const n=m??{},o=typeof n['leafIndex']==='number'?n['leafIndex']:undefined,p=resolveServerPublicKey(n,c),q=n['serverSignature'];let r;if(typeof q!=='string'||!q)r='unsigned';else{if(!p)r='no_public_key';else{const s=n['prevRoot']+':'+n['merkleRoot']+':'+n['timestamp']+':'+p;r=verifyFalcon512Signature(p,s,q)?'verified':'invalid_signature';}}if(r==='verified')f++;e['push']({'leaf_index':o,'status':r,'server_public_key':p??undefined});}const g=(Array['isArray'](c['serverPublicKeys'])?c['serverPublicKeys']:[])['map'](t=>typeof t==='string'?t:t?.['publicKey'])['filter'](t=>typeof t==='string'&&!!t),h=f===d['length']&&d['length']>0x0,i=e['filter'](t=>t['status']==='invalid_signature')['length'],j=d['length']-f,k=e['filter'](t=>t['status']==='no_public_key')['length'];let l;if(d['length']===0x0)l='WTS\x20packet\x20contains\x20no\x20messages\x20—\x20nothing\x20to\x20attest.';else{if(i>0x0)l='ATTENTION:\x20'+i+'\x20of\x20'+d['length']+'\x20message(s)\x20carry\x20a\x20server\x20signature\x20that\x20does\x20NOT\x20verify\x20—\x20this\x20packet\x20has\x20been\x20altered\x20or\x20signed\x20by\x20a\x20key\x20that\x20is\x20not\x20the\x20messenger\x20server\x27s.\x20Do\x20NOT\x20present\x20it\x20as\x20evidence.';else h?l='Server-attested:\x20all\x20'+d['length']+'\x20message(s)\x20carry\x20a\x20Falcon512\x20signature\x20that\x20verifies\x20against\x20the\x20packet\x27s\x20own\x20server\x20public\x20key.\x20'+'CAVEAT:\x20that\x20key\x20is\x20declared\x20inside\x20this\x20packet\x20(meta.serverPublicKeys)\x20—\x20the\x20signatures\x20prove\x20the\x20packet\x20is\x20SELF-CONSISTENT\x20under\x20a\x20key\x20its\x20'+'author\x20chose,\x20not\x20that\x20this\x20is\x20the\x20messenger\x20service\x27s\x20key.\x20verify_wts\x20closes\x20this\x20gap\x20by\x20cross-checking\x20every\x20key\x20against\x20the\x20server\x27s\x20OFFICIAL\x20'+'key\x20history\x20(rotation-aware:\x20any\x20historical\x20official\x20key\x20whose\x20window\x20covers\x20the\x20message\x27s\x20server\x20timestamp\x20verifies
|
|
1
|
+
import{readFile}from'node:fs/promises';import{verifyFalcon512Signature}from'@wowok/wowok/w/messenger/crypto.js';function resolveServerPublicKey(a,b){const c=Array['isArray'](b?.['serverPublicKeys'])?b['serverPublicKeys']:undefined,d=a?.['serverPublicKeyIndex'];if(c&&typeof d==='number'&&d>=0x0&&d<c['length']){const f=c[d],g=typeof f==='string'?f:f?.['publicKey'];if(typeof g==='string'&&g)return g;}const e=a?.['serverPublicKey'];return typeof e==='string'&&e?e:null;}export function attestWtsDocument(a){const b=a,c=b?.['meta'],d=Array['isArray'](b?.['payload']?.['messages'])?b['payload']['messages']:undefined;if(!c||!d)return undefined;const e=[];let f=0x0;for(const m of d){const n=m??{},o=typeof n['leafIndex']==='number'?n['leafIndex']:undefined,p=resolveServerPublicKey(n,c),q=n['serverSignature'];let r;if(typeof q!=='string'||!q)r='unsigned';else{if(!p)r='no_public_key';else{const s=n['prevRoot']+':'+n['merkleRoot']+':'+n['timestamp']+':'+p;r=verifyFalcon512Signature(p,s,q)?'verified':'invalid_signature';}}if(r==='verified')f++;e['push']({'leaf_index':o,'status':r,'server_public_key':p??undefined});}const g=(Array['isArray'](c['serverPublicKeys'])?c['serverPublicKeys']:[])['map'](t=>typeof t==='string'?t:t?.['publicKey'])['filter'](t=>typeof t==='string'&&!!t),h=f===d['length']&&d['length']>0x0,i=e['filter'](t=>t['status']==='invalid_signature')['length'],j=d['length']-f,k=e['filter'](t=>t['status']==='no_public_key')['length'];let l;if(d['length']===0x0)l='WTS\x20packet\x20contains\x20no\x20messages\x20—\x20nothing\x20to\x20attest.';else{if(i>0x0)l='ATTENTION:\x20'+i+'\x20of\x20'+d['length']+'\x20message(s)\x20carry\x20a\x20server\x20signature\x20that\x20does\x20NOT\x20verify\x20—\x20this\x20packet\x20has\x20been\x20altered\x20or\x20signed\x20by\x20a\x20key\x20that\x20is\x20not\x20the\x20messenger\x20server\x27s.\x20Do\x20NOT\x20present\x20it\x20as\x20evidence.';else h?l='Server-attested:\x20all\x20'+d['length']+'\x20message(s)\x20carry\x20a\x20Falcon512\x20signature\x20that\x20verifies\x20against\x20the\x20packet\x27s\x20own\x20server\x20public\x20key.\x20'+'CAVEAT:\x20that\x20key\x20is\x20declared\x20inside\x20this\x20packet\x20(meta.serverPublicKeys)\x20—\x20the\x20signatures\x20prove\x20the\x20packet\x20is\x20SELF-CONSISTENT\x20under\x20a\x20key\x20its\x20'+'author\x20chose,\x20not\x20that\x20this\x20is\x20the\x20messenger\x20service\x27s\x20key.\x20verify_wts\x20closes\x20this\x20gap\x20by\x20cross-checking\x20every\x20key\x20against\x20the\x20server\x27s\x20OFFICIAL\x20'+'key\x20history\x20(rotation-aware:\x20any\x20historical\x20official\x20key\x20whose\x20window\x20covers\x20the\x20message\x27s\x20server\x20timestamp\x20verifies;\x20keys\x20are\x20scored\x20in\x20their\x20'+'home\x20NETWORK\x20partition\x20only);\x20serverKeysOfficial:true\x20in\x20its\x20result\x20is\x20what\x20makes\x20the\x20packet\x20evidence-grade\x20—\x20for\x20the\x20partition\x20named\x20in\x20'+'serverKeysOfficialNetwork.\x20This\x20MCP\x20recount\x20is\x20file-only\x20and\x20stays\x20independent\x20of\x20that\x20check.\x20Anchor\x20it\x20(an\x20on-chain\x20'+'Proof\x20of\x20the\x20last\x20Merkle\x20root)\x20before\x20treating\x20it\x20as\x20third-party-proof\x20evidence.':l='NOT\x20server-attested:\x20'+j+'\x20of\x20'+d['length']+'\x20message(s)\x20carry\x20no\x20verifying\x20server\x20signature'+(k>0x0?'\x20('+k+'\x20of\x20them\x20reference\x20a\x20server\x20key\x20the\x20packet\x20never\x20supplies,\x20so\x20their\x20signature\x20cannot\x20be\x20checked\x20at\x20all)':'')+'.\x20'+'verify_wts\x20REJECTS\x20such\x20packets\x20(valid:false)\x20—\x20its\x20digest\x20covers\x20the\x20payload\x20with\x20no\x20key,\x20so\x20anyone\x20who\x20edits\x20the\x20content\x20can\x20recompute\x20it,\x20'+'and\x20nothing\x20in\x20the\x20packet\x20can\x20substitute\x20for\x20the\x20server\x27s\x20own\x20signature.\x20Treat\x20these\x20messages\x20as\x20the\x20file\x20author\x27s\x20ASSERTION,\x20not\x20as\x20evidence\x20issued\x20by\x20the\x20'+'messenger\x20server,\x20and\x20do\x20not\x20present\x20them\x20as\x20proof\x20to\x20a\x20counterparty\x20or\x20an\x20arbitrator.';}return{'total_messages':d['length'],'attested_count':f,'unattested_count':d['length']-f,'fully_attested':h,'messages':e,'server_public_keys':g,'packet_signed':!!c['signature'],'verdict':l};}export async function attestWtsFile(a){if(typeof a!=='string'||!a)return undefined;try{if(/^https?:\/\//i['test'](a))return undefined;const b=await readFile(a,'utf8');return attestWtsDocument(JSON['parse'](b));}catch{return undefined;}}export function checkWtsProofAnchor(a,b){const c=a,d=Array['isArray'](c?.['payload']?.['messages'])?c['payload']['messages']:[],e=(b['proof']??'')['toLowerCase'](),f=d['filter'](o=>typeof o?.['merkleRoot']==='string'&&o['merkleRoot']['toLowerCase']()===e&&e!=='')['map'](o=>typeof o['leafIndex']==='number'?o['leafIndex']:-0x1),g=[...(Array['isArray'](c?.['meta']?.['serverPublicKeys'])?c['meta']['serverPublicKeys']:[])['map'](o=>typeof o==='string'?o:o?.['publicKey']),...d['map'](o=>o?.['serverPublicKey'])]['filter'](o=>typeof o==='string'&&!!o)['map'](o=>o['toLowerCase']()),h=(b['server_pubkey']??'')['toLowerCase'](),i=!!h&&g['includes'](h),j=typeof b['time']==='string'?Number(b['time']):b['time'],k=c?.['meta']?.['created'],l=typeof k==='number'?k:Date['parse'](String(k??'')),m=Number['isFinite'](j)&&Number['isFinite'](l)?j<=l:null;let n;if(!e)n='Proof\x20carries\x20no\x20root\x20—\x20nothing\x20to\x20anchor.';else f['length']===0x0?n='Proof\x20root\x20'+e['slice'](0x0,0x12)+'…\x20does\x20NOT\x20appear\x20among\x20this\x20packet\x27s\x20'+d['length']+'\x20message\x20root(s)\x20—\x20the\x20packet\x20does\x20not\x20contain\x20what\x20this\x20Proof\x20froze.':n='ANCHORED:\x20the\x20packet\x27s\x20leaf/leaves\x20['+f['join'](',\x20')+']\x20match\x20the\x20root\x20frozen\x20on\x20chain\x20by\x20Proof\x20'+(b['address']??'?')+'\x20(signer\x20'+(b['signer']??'?')+',\x20'+(m===null?'time\x20not\x20comparable':m?'before\x20the\x20packet\x20was\x20written':'AFTER\x20the\x20packet\x27s\x20own\x20creation\x20stamp\x20—\x20the\x20anchor\x20postdates\x20the\x20content\x20it\x20attests')+').\x20'+(i?'The\x20Proof\x27s\x20server\x20key\x20is\x20the\x20same\x20key\x20the\x20packet\x20attests\x20under,\x20so\x20this\x20segment\x20cannot\x20have\x20been\x20re-fabricated\x20after\x20anchoring.':'WARNING:\x20the\x20Proof\x27s\x20server\x20key\x20differs\x20from\x20the\x20key(s)\x20the\x20packet\x20declares\x20—\x20the\x20anchor\x20and\x20the\x20packet\x20do\x20not\x20share\x20an\x20issuer.');return{'root_matched':f['length']>0x0,'matched_leaf_indices':f,'key_matched':i,'anchored_before_packet':m,'verdict':n};}export async function readWtsDocument(a){if(typeof a!=='string'||!a)return undefined;if(/^https?:\/\//i['test'](a))return undefined;try{return JSON['parse'](await readFile(a,'utf8'));}catch{return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getJudgmentDoc}from'../config/judgment.js';import{evaluateRuleBook}from'../config/rule-engine.js';import{isPathDependentTimeQuery}from'../chain-semantics/index.js';import{createsOf,isRef,refsOf,validatePlan}from'./plan.js';function collectQueries(a,b=[]){if(Array['isArray'](a)){for(const c of a)collectQueries(c,b);}else{if(typeof a==='object'&&a!==null){const d=a;d['type']==='query'&&typeof d['query']==='string'&&b['push']({'query':d['query']});for(const e of Object['values'](d))collectQueries(e,b);}}return b;}function acceptedProgressNodes(a,b){const c=new Map();if(Array['isArray'](b))for(const g of b){if(typeof g==='object'&&g!==null){const h=g;typeof h['identifier']==='number'&&typeof h['value']==='string'&&c['set'](h['identifier'],h['value']);}}const d=i=>{if(typeof i!=='object'||i===null)return undefined;const j=i;if(j['type']==='constant'&&typeof j['value']==='string')return j['value'];if(j['type']==='identifier'&&typeof j['identifier']==='number')return c['get'](j['identifier']);return undefined;},e=[],f=i=>{if(Array['isArray'](i)){for(const
|
|
1
|
+
import{getJudgmentDoc}from'../config/judgment.js';import{evaluateRuleBook}from'../config/rule-engine.js';import{isPathDependentTimeQuery}from'../chain-semantics/index.js';import{MAX_INDEMNITY_MULTIPLE}from'../knowledge/onchain-constants.js';import{numericAmount}from'../knowledge/audit-rules.js';import{createsOf,isRef,refsOf,validatePlan}from'./plan.js';function collectQueries(a,b=[]){if(Array['isArray'](a)){for(const c of a)collectQueries(c,b);}else{if(typeof a==='object'&&a!==null){const d=a;d['type']==='query'&&typeof d['query']==='string'&&b['push']({'query':d['query']});for(const e of Object['values'](d))collectQueries(e,b);}}return b;}function acceptedProgressNodes(a,b){const c=new Map();if(Array['isArray'](b))for(const g of b){if(typeof g==='object'&&g!==null){const h=g;typeof h['identifier']==='number'&&typeof h['value']==='string'&&c['set'](h['identifier'],h['value']);}}const d=i=>{if(typeof i!=='object'||i===null)return undefined;const j=i;if(j['type']==='constant'&&typeof j['value']==='string')return j['value'];if(j['type']==='identifier'&&typeof j['identifier']==='number')return c['get'](j['identifier']);return undefined;},e=[],f=i=>{if(Array['isArray'](i)){for(const n of i)f(n);return;}if(typeof i!=='object'||i===null)return;const j=i,k=Array['isArray'](j['nodes'])?j['nodes']:undefined,l=k?.[0x0]??j['left'],m=k?.[0x1]??j['right'];if(typeof j['type']==='string'&&j['type']['startsWith']('logic')&&typeof l==='object'&&l!==null&&l['type']==='query'&&l['query']==='progress.current'){const o=d(m);if(o!==undefined)e['push'](o);}for(const p of Object['values'](j))f(p);};return f(a),e;}function guardProjection(a){const b=a['params']['root']??a['params']['logic'],c=collectQueries(b)['map'](d=>d['query']);return{'stepId':a['id'],'queries':c,'acceptedNodes':acceptedProgressNodes(b,a['params']['table']),'table':Array['isArray'](a['params']['table'])?a['params']['table']:[]};}function allocatorRows(a){const b=[],c=d=>{if(typeof d==='object'&&d!==null&&!Array['isArray'](d)){const e=d;if(Array['isArray'](e['allocators']))d=e['allocators'];}if(!Array['isArray'](d))return;for(const f of d){if(typeof f!=='object'||f===null)continue;const g=f,h=g['guard'],i=g['guard_key'],j=Array['isArray'](g['sharing'])?g['sharing']:[],k=j['map'](l=>typeof l==='object'&&l!==null?l['who']:undefined)['map'](l=>typeof l==='object'&&l!==null?l['GuardIdentifier']:undefined)['filter'](l=>typeof l==='number');b['push']({'track':typeof g['track']==='string'?g['track']:'settlement','guardStep':isRef(h)?h['$ref']:undefined,'guardKey':typeof i==='string'?i:undefined,'identifierLegs':k});}};for(const d of a['steps']){if(d['op']==='create'&&d['object']==='service')c(d['params']['order_allocators']);if(d['op']==='configure'&&d['method']==='order_allocators')c(d['params']['allocators']);}return b;}function machineProjection(a){const b=createsOf(a,'machine')[0x0];if(b===undefined)return undefined;const c=b['params']['nodes'];if(!Array['isArray'](c))return{'nodes':[],'edges':[],'terminals':[],'forwardGuardRefs':[]};const d=[],e=[],f=[];for(const j of c){if(typeof j!=='object'||j===null)continue;const k=j,l=typeof k['name']==='string'?k['name']:undefined;if(l===undefined)continue;d['push'](l);const m=Array['isArray'](k['pairs'])?k['pairs']:[];for(const n of m){const o=n,q=o?.['prev_node'];if(typeof q==='string')e['push']({'prev':q,'next':l});const r=Array['isArray'](o?.['forwards'])?o['forwards']:[];for(const s of r){const t=s?.['guard'];if(isRef(t))f['push'](t['$ref']);}}}const h=b['params']['pairs'];if(Array['isArray'](h))for(const u of h){const v=u;typeof v?.['prev_node']==='string'&&typeof v?.['next_node']==='string'&&e['push']({'prev':v['prev_node'],'next':v['next_node']});}const i=new Set(e['map'](w=>w['prev'])['filter'](w=>w!==''));return{'nodes':d,'edges':e,'terminals':d['filter'](w=>!i['has'](w)),'forwardGuardRefs':f};}function pathCountCap2(a,b){const c=new Map();for(const g of a){const h=c['get'](g['prev'])??[];h['push'](g['next']),c['set'](g['prev'],h);}let d=0x0;const f=(i,j)=>{if(d>=0x2)return;if(i===b){d+=0x1;return;}if(j['has'](i))return;const k=new Set(j)['add'](i);for(const l of c['get'](i)??[])f(l,k);};for(const i of c['get']('')??[])f(i,new Set());return d;}const WRITE_ONLY_ENFORCEMENT_SOURCES=[{'object':'service','param':'customer_required','coverQuery':'order.required_info','extract':a=>Array['isArray'](a['params']['customer_required'])&&a['params']['customer_required']['length']>0x0},{'object':'service','param':'sales[].wip','coverQuery':'service.sale.wip','extract':a=>Array['isArray'](a['params']['sales'])&&a['params']['sales']['some'](b=>typeof b==='object'&&b!==null&&typeof b['wip']==='string'&&b['wip']['length']>0x0)}];export function planFacts(a){const b=new Map(createsOf(a,'guard')['map'](J=>[J['id'],guardProjection(J)])),c=allocatorRows(a),d=machineProjection(a),e=createsOf(a,'service')['length']>0x0,f=createsOf(a,'repository')['length']>0x0,h=new Set();for(const J of c){const K=J['guardStep']===undefined?undefined:b['get'](J['guardStep']);for(const L of K?.['acceptedNodes']??[])h['add'](L);}const i=d?.['terminals']??[],j=i['find'](M=>!h['has'](M)),k=a['pending_guards']??[],l=k['filter'](M=>M['site']==='allocator')['length'],m=k['find'](M=>M['site']==='allocator'||M['site']==='machine_edge')?.['key'],o=k['find'](M=>M['site']==='service_buy')?.['key'],p=d?.['nodes']['find'](M=>/return/i['test'](M)),q=a['steps']['some'](M=>{if(M['op']==='configure'&&M['method']==='arbitrations'){const N=M['params']['objects'];return Array['isArray'](N)&&N['length']>0x0;}if(M['op']==='create'&&M['object']==='service'){const O=M['params']['arbitrations'];return Array['isArray'](O)&&O['length']>0x0;}return![];});let t,u=![];for(const M of a['steps']){if(M['op']==='configure'&&M['method']==='compensation_fund_add'){u=!![];const N=numericAmount(M['params']['balance']);if(N!==undefined)t=(t??0x0)+N;}}let v;const w=O=>{if(!Array['isArray'](O))return;for(const P of O){const Q=numericAmount(P?.['price']);if(Q!==undefined&&Q>0x0)v=Math['max'](v??0x0,Q);}};for(const O of a['steps']){if(O['op']==='create'&&O['object']==='service')w(O['params']['sales']);if(O['op']==='configure'&&O['method']==='sales')w(O['params']['sales']);}const x=t!==undefined&&v!==undefined,y=c['filter'](P=>P['track']==='refund'),z=y['map'](P=>P['guardStep']===undefined?undefined:b['get'](P['guardStep']))['find'](P=>P!==undefined&&!P['queries']['some'](Q=>Q['startsWith']('order.claimed_by')))?.['stepId'];let A,B=![];for(const P of b['values']()){if(P['queries']['some'](isPathDependentTimeQuery)){A??=P['stepId'];if(d!==undefined)for(const Q of P['acceptedNodes']){if(pathCountCap2(d['edges'],Q)>=0x2){B=!![],A=P['stepId'];break;}}}if(B)break;}const C=[...b['values']()]['flatMap'](R=>R['queries']);let D;for(const R of WRITE_ONLY_ENFORCEMENT_SOURCES){for(const S of createsOf(a,R['object'])){if(R['extract'](S)&&!C['some'](T=>T['startsWith'](R['coverQuery']))){D=R['param'];break;}}if(D!==undefined)break;}const E=new Set();for(const T of a['steps']){if(T['op']==='create'&&T['object']==='guard')continue;const U=refsOf(T['op']==='publish'?T['target']:T['params']);for(const V of U)E['add'](V);if(T['op']==='configure'){for(const W of refsOf(T['target']))E['add'](W);}}const F=[...b['keys']()]['find'](X=>!E['has'](X)),G=[...b['values']()]['find'](X=>!f&&X['queries']['some'](Y=>Y['startsWith']('repository.')))?.['stepId'];let H;if(e&&d!==undefined)for(const X of d['forwardGuardRefs']){const Y=b['get'](X);if(Y===undefined)continue;const Z=Y['table']['some'](a0=>a0['identifier']===0xfe&&a0['b_submission']===!![]);if(!Z){H=X;break;}}let I;for(const a0 of c){if(a0['guardStep']===undefined||a0['identifierLegs']['length']===0x0)continue;const a1=b['get'](a0['guardStep']);if(a1===undefined)continue;for(const a2 of a0['identifierLegs']){const a3=a1['table']['find'](a4=>a4['identifier']===a2);if(a3===undefined||a3['b_submission']!==!![]||a3['value_type']!=='Address'){I='slot\x20'+a2+'\x20of\x20guard\x20\x27'+a0['guardStep']+'\x27';break;}}if(I!==undefined)break;}return{'has_service':e,'has_machine':d!==undefined,'has_repository':f,'allocator_row_count':c['length'],'refund_row_count':y['length'],'terminal_count':i['length'],'terminal_nodes_display':i['join'](',\x20'),'pending_allocator_guard_count':l,...j===undefined?{}:{'first_uncovered_terminal':j},...z===undefined?{}:{'first_refund_guard_missing_claimed_by':z},...A===undefined?{}:{'first_path_dependent_anchor':A},'path_sensitive':B,...D===undefined?{}:{'first_write_only_unenforced_field':D},...F===undefined?{}:{'first_orphan_guard':F},...G===undefined?{}:{'first_repo_query_without_repository':G},...H===undefined?{}:{'first_edge_guard_missing_254':H},...I===undefined?{}:{'first_alloc_slot_missing':I},...m===undefined?{}:{'first_pending_fund_guard':m},...o===undefined?{}:{'first_pending_buy_guard':o},'has_return_rail':p!==undefined,...p===undefined?{}:{'return_rail_node':p},'has_arbitration_binding':q,'fund_topup_present':u,...t===undefined?{}:{'fund_topup_amount':t},...x?{'fund_ceiling_breach':t<MAX_INDEMNITY_MULTIPLE*v,'fund_ceiling_basis':MAX_INDEMNITY_MULTIPLE+'x\x20the\x20highest\x20SKU\x20price'}:{},'fund_ceiling_unverifiable':u&&!x};}function planRuleBook(){const a=getJudgmentDoc()['rules']['domains']['plan'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27plan\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}export function auditPlan(a){const b=validatePlan(a),c=planFacts(a),{findings:d}=evaluateRuleBook(planRuleBook(),c),e=b['length']>0x0||d['some'](g=>g['level']==='critical'||g['level']==='high');return{'issues':b,'findings':d,'facts':c,'blocking':e};}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IndustryTemplate } from "../knowledge/template-loader.js";
|
|
2
2
|
import type { JsonValue, Plan } from "./plan.js";
|
|
3
|
-
export type CompilableTemplate = Pick<IndustryTemplate, "id" | "machine_shape" | "guards" | "allocator" | "fee_params" | "arbitration_mode">;
|
|
3
|
+
export type CompilableTemplate = Pick<IndustryTemplate, "id" | "machine_shape" | "guards" | "allocator" | "fee_params" | "arbitration_mode" | "conditional_guards" | "review_mode">;
|
|
4
4
|
export interface GuardSpec {
|
|
5
5
|
key: string;
|
|
6
6
|
template_id: string;
|
|
@@ -18,7 +18,8 @@ export type GuardResolution = {
|
|
|
18
18
|
table: unknown[];
|
|
19
19
|
root: unknown;
|
|
20
20
|
};
|
|
21
|
-
export type CompileBlockerCode = "MACHINE_EDGES_MISSING" | "EDGE_UNKNOWN_PREV" | "GUARD_CYCLE" | "GUARD_KEY_UNKNOWN" | "GUARD_TEMPLATE_PARAMS" | "ALLOCATOR_VALUE_MISSING" | "ALLOCATOR_FIX_UNSUPPORTED";
|
|
21
|
+
export type CompileBlockerCode = "MACHINE_EDGES_MISSING" | "EDGE_UNKNOWN_PREV" | "GUARD_CYCLE" | "GUARD_KEY_UNKNOWN" | "GUARD_TEMPLATE_PARAMS" | "GUARD_RESOLUTION_UNKNOWN" | "GUARD_SLOT_UNKNOWN" | "GUARD_FOREIGN_SERVICE" | "ALLOCATOR_VALUE_MISSING" | "ALLOCATOR_FIX_UNSUPPORTED" | "REVIEW_NODE_MISSING" | "REVIEW_REWARD_GUARD_MISSING" | "REVIEW_REWARD_UNFUNDED" | "REVIEW_REWARD_UNARMED";
|
|
22
|
+
export declare const TASK_BINDING_SLOT = 254;
|
|
22
23
|
export interface CompileBlocker {
|
|
23
24
|
code: CompileBlockerCode;
|
|
24
25
|
detail: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fillGuardTemplate}from'../knowledge/guard-templates.js';import{refsOf}from'./plan.js';const P=a=>a;function safeId(a){return a['replace'](/[^a-zA-Z0-9_]/g,'_');}function ref(a){return{'$ref':a};}const MODE_MAP={'amount':'Amount','rate':'Rate','surplus':'Surplus'};export function compileTemplate(a,b,c={}){const d=c['nameBase']??a['id']['replace'](/\//g,'_'),e=c['merchantPermissionIndex']??0x3e8,f=[],h=[],i=a['guards']['map']((C,D)=>({'key':C['key']??C['template_id']+'#'+D,'template_id':C['template_id'],'host':C['host'],'purpose':C['purpose']})),j=new Map(i['map'](C=>[C['key'],C])),k=new Map(),l=[];for(const C of i){const D='guard_'+safeId(C['key']),E=c['guardResolutions']?.[C['key']];let F=C['purpose'],G,H;if(E?.['kind']==='inline')G=E['table'],H=E['root'],F=E['description']??C['purpose'];else{const I=E?.['kind']==='template'?E['template_id']:C['template_id']['startsWith']('tpl_')?C['template_id']:undefined;if(I!==undefined){const J={...a['fee_params'],...b,...E?.['kind']==='template'?E['params']:{}},K=fillGuardTemplate(I,J);!K['ok']?f['push']({'code':'GUARD_TEMPLATE_PARAMS','detail':'guard\x20\x27'+C['key']+'\x27\x20('+I+'):\x20'+K['error']}):(G=K['table'],H=K['root']);}}G!==undefined?(k['set'](C['key'],{'stepId':D,'description':F,'table':G,'root':H}),C['step_id']=D):l['push'](C);}const m=L=>k['get'](L)!==undefined&&refsOf({'table':k['get'](L)['table'],'root':k['get'](L)['root']})['has']('service'),n=L=>{const M=k['get'](L);return{'op':'create','id':M['stepId'],'object':'guard','params':P({'description':M['description'],'table':M['table'],'root':M['root']}),'notes':j['get'](L)?.['purpose']};};h['push']({'op':'create','id':'permission','object':'permission','params':{'name':d+'_permission'}});const o=a['arbitration_mode']!==undefined&&a['arbitration_mode']!=='none';o&&h['push']({'op':'create','id':'permission_arb','object':'permission','params':{'name':d+'_arb_permission'},'notes':'MUST\x20be\x20created\x20by\x20a\x20different\x20account\x20than\x20the\x20service\x20permission\x20'+'(E_ARBITRATION_PERMISSION_CONFLICT=33):\x20dispute\x20neutrality.'});h['push']({'op':'create','id':'contact','object':'contact','params':{'name':d+'_contact'},'notes':'R8:\x20customer-service\x20channel;\x20mandatory\x20when\x20customer_required\x20is\x20set.'});const p=i['some'](L=>L['host']==='repository'||L['template_id']==='pattern.repository_data_check'||L['template_id']==='pattern.repository_write_authorization');if(p){const L=b['repository_policies'];h['push']({'op':'create','id':'repository','object':'repository','params':{'name':d+'_evidence',...Array['isArray'](L)?{'policies':L}:{}},'notes':'Evidence\x20rows\x20(tracking\x20hash,\x20receipts,\x20WTS\x20proofs).'});}const q=[];for(const [M]of k){m(M)?q['push'](M):h['push'](n(M));}const r=new Set(a['machine_shape']['map'](N=>N['name'])),s=[];for(const N of a['machine_shape']){if(N['from']===undefined||N['from']['length']===0x0){f['push']({'code':'MACHINE_EDGES_MISSING','detail':'machine_shape\x20node\x20\x27'+N['name']+'\x27\x20declares\x20no\x20\x27from\x27\x20edges.\x20Edges\x20are\x20data\x20'+'(REPORT\x20#10\x20A-2:\x20a\x20missing\x20paid->closed_cancel\x20edge\x20bricks\x20the\x20shop\x20at\x20publish).\x20'+'Annotate\x20the\x20node\x20with\x20from:\x20[...]\x20(use\x20prev:\x20\x22\x22\x20for\x20the\x20entry\x20edge).'});continue;}const O=[],Q=new Map();for(const R of N['from']){const S=typeof R==='string'?{'prev':R}:R;if(S['prev']!==''&&!r['has'](S['prev'])){f['push']({'code':'EDGE_UNKNOWN_PREV','detail':'node\x20\x27'+N['name']+'\x27\x20edge\x20prev\x20\x27'+S['prev']+'\x27\x20is\x20not\x20a\x20machine_shape\x20node'});continue;}const T=S['operator']??N['operator']??(S['prev']===''?'order_payer':'merchant'),U={'name':S['forward']??(S['prev']===''?'enter_'+N['name']:S['prev']+'_to_'+N['name']),'weight':0x1,...T==='order_payer'?{'namedOperator':''}:{'permissionIndex':S['permission_index']??e}};if(S['guard_key']!==undefined){const W=j['get'](S['guard_key']);if(W===undefined)f['push']({'code':'GUARD_KEY_UNKNOWN','detail':'edge\x20\x27'+S['prev']+'\x27->\x27'+N['name']+'\x27\x20binds\x20unknown\x20guard_key\x20\x27'+S['guard_key']+'\x27'});else W['step_id']!==undefined&&(m(W['key'])?f['push']({'code':'GUARD_CYCLE','detail':'edge\x20\x27'+S['prev']+'\x27->\x27'+N['name']+'\x27\x20binds\x20guard\x20\x27'+W['key']+'\x27\x20which\x20itself\x20'+'refs\x20the\x20service\x20(created\x20after\x20the\x20machine)\x20—\x20an\x20F-05\x20cycle.\x20Rebind\x20or\x20split\x20the\x20guard.'}):U['guard']=ref(W['step_id']));}const V=Q['get'](S['prev']);V!==undefined?V['push'](U):Q['set'](S['prev'],[U]);}for(const [X,Y]of Q){O['push']({'prev_node':X,'threshold':0x0,'forwards':Y});}s['push']({'name':N['name'],...N['semantic_role']!==undefined?{'role':N['semantic_role']}:{},'pairs':O});}h['push']({'op':'create','id':'machine','object':'machine','params':P({'name':d+'_machine','nodes':s})}),h['push']({'op':'publish','id':'machine_publish','target':ref('machine'),'preflight':[{'check':'machine_publish','status':'pending'}]});const t=typeof b['currency']==='string'?b['currency']:'0x2::wow::WOW',u=i['find'](Z=>Z['host']==='service'&&Z['key']==='buy');h['push']({'op':'create','id':'service','object':'service','params':P({'name':d+'_service','type_parameter':t,'permission':ref('permission'),'machine':ref('machine'),'um':ref('contact'),'description':a['id']+'\x20—\x20compiled\x20by\x20composition/compile',...p?{'repositories':[ref('repository')]}:{},...u?.['step_id']!==undefined?{'buy_guard':ref(u['step_id'])}:{},...Array['isArray'](b['customer_required'])?{'customer_required':b['customer_required']}:{}}),'notes':'Draft\x20only:\x20machine/order_allocators\x20are\x20L1-frozen\x20at\x20publish;\x20allocators\x20attach\x20in\x20the\x20configure\x20step.'});for(const Z of q)h['push'](n(Z));const v=a['allocator']['rows']!==undefined&&a['allocator']['rows']['length']>0x0?a['allocator']['rows']:[{'track':'settlement','recipient':a['allocator']['recipient']==='fixed'?'entity':a['allocator']['recipient'],'recipient_key':a['allocator']['recipient_key'],'mode':a['allocator']['mode'],'value':a['allocator']['mode']==='rate'?0x2710:a['allocator']['mode']==='surplus'?'0':undefined}],w=[],x=new Map();for(const a0 of v){if(a0['guard_key']!==undefined){let a1=x['get'](a0['guard_key']);a1===undefined&&(a1={'key':a0['guard_key'],'rows':[]},x['set'](a0['guard_key'],a1),w['push'](a1)),a1['rows']['push'](a0);}else w['push']({'rows':[a0]});}const y=[];for(const a2 of w){const a3=[];let a4;for(const a6 of a2['rows']){let a7=a6['value'];a7===undefined&&a6['value_from']!==undefined&&(a7=b[a6['value_from']]??a['fee_params'][a6['value_from']]);if(a7===undefined&&a6['mode']!=='surplus'){f['push']({'code':'ALLOCATOR_VALUE_MISSING','detail':'allocator\x20row\x20('+a6['track']+'/'+a6['recipient']+')\x20has\x20neither\x20value\x20nor\x20a\x20resolvable\x20value_from'});continue;}(a6['fix']!==undefined||a6['fix_from']!==undefined)&&f['push']({'code':'ALLOCATOR_FIX_UNSUPPORTED','detail':'allocator\x20row\x20('+a6['track']+'/'+a6['recipient']+')\x20declares\x20fix/fix_from\x20—\x20the\x20chain\x20has\x20no\x20holdback\x20'+'parameter:\x20fix\x20is\x20computed\x20on-chain\x20as\x20the\x20sum\x20of\x20the\x20Amount\x20legs\x20and\x20those\x20legs\x20are\x20PAID\x20'+'(allocation.move:399,540),\x20and\x20the\x20allocator-registration\x20call\x20surface\x20(guard,\x20sharing,\x20max)\x20has\x20no\x20fix\x20'+'argument,\x20so\x20this\x20value\x20never\x20reaches\x20the\x20chain.\x20To\x20keep\x20funds\x20in\x20the\x20pool,\x20do\x20not\x20distribute\x20them\x20'+'(a\x20separate\x20Allocation\x20object,\x20or\x20a\x20later\x20guard-gated\x20allocator);\x20to\x20combine\x20fixed\x20fees\x20with\x20a\x20'+'proportional\x20split,\x20use\x20explicit\x20Amount\x20legs\x20plus\x20Rate\x20legs\x20summing\x2010000.'});a4??=a6['note'];const a8=a6['recipient']==='entity'?{'Entity':{'$late':{'by':'local_name','mark':a6['recipient_key']??'merchant'}}}:a6['recipient']==='guard_identifier'?{'GuardIdentifier':Number(a6['recipient_key']??0x0)}:'Signer';a3['push']({'who':a8,'sharing':String(a7??'0'),'mode':MODE_MAP[a6['mode']]});}if(a3['length']===0x0)continue;const a5=a2['key']!==undefined?j['get'](a2['key'])?.['step_id']:undefined;a2['key']!==undefined&&!j['has'](a2['key'])&&f['push']({'code':'GUARD_KEY_UNKNOWN','detail':'allocator\x20row\x20('+a2['rows'][0x0]['track']+')\x20binds\x20unknown\x20guard_key\x20\x27'+a2['key']+'\x27'}),y['push']({...a5!==undefined?{'guard':ref(a5)}:{},...a2['key']!==undefined?{'guard_key':a2['key']}:{},'track':a2['rows'][0x0]['track'],'sharing':a3,...a4!==undefined?{'note':a4}:{}});}h['push']({'op':'configure','id':'service_allocators','target':ref('service'),'method':'order_allocators','params':P({'description':a['allocator']['description'],'threshold':0x0,'allocators':y}),'requires':['machine_publish']});Array['isArray'](b['sales'])&&b['sales']['length']>0x0&&h['push']({'op':'configure','id':'service_sales','target':ref('service'),'method':'sales','params':{'op':'add','sales':b['sales']}});if(o){h['push']({'op':'create','id':'arbitration','object':'arbitration','params':P({'name':d+'_arbitration','permission':ref('permission_arb'),'type_parameter':t}),'notes':'Independent\x20venue\x20(R2).\x20New\x20arbitrations\x20default\x20bPaused=true\x20—\x20unpause\x20is\x20a\x20separate\x20operator\x20step.'}),h['push']({'op':'configure','id':'service_arbitrations','target':ref('service'),'method':'arbitrations','params':P({'op':'add','objects':[ref('arbitration')]})});const a9=b['compensation_fund'];(typeof a9==='string'||typeof a9==='number')&&h['push']({'op':'configure','id':'service_compensation','target':ref('service'),'method':'compensation_fund_add','params':{'balance':String(a9)}});}h['push']({'op':'publish','id':'service_publish','target':ref('service'),'preflight':[{'check':'service_publish','status':'pending'},{'check':'FUND-EXIT-01','status':'pending'},{'check':'PLAN-ALLOC-01','status':'pending'}]});const z=new Set((a['allocator']['rows']??[])['map'](aa=>aa['guard_key'])['filter'](aa=>typeof aa==='string')),A=new Set(a['machine_shape']['flatMap'](aa=>(aa['from']??[])['map'](ab=>typeof ab==='string'?undefined:ab['guard_key'])['filter'](ab=>typeof ab==='string'))),B=l['flatMap'](aa=>{const ab=z['has'](aa['key'])?'allocator':A['has'](aa['key'])?'machine_edge':aa['host']==='service'&&aa['key']==='buy'?'service_buy':undefined;return ab?[{'key':aa['key'],'template_id':aa['template_id'],'host':aa['host'],'site':ab,'purpose':aa['purpose']}]:[];});return{'plan':{'version':0x1,'intent':c['intent']??'compile\x20'+a['id'],'templateId':a['id'],'inputs':b,'steps':h,...B['length']>0x0?{'pending_guards':B}:{}},'guardSpecs':i,'unresolved':l,'blockers':f};}
|
|
1
|
+
import{fillGuardTemplate}from'../knowledge/guard-templates.js';import{rootHasRewardRecordGate}from'../knowledge/template-scanner.js';import{refsOf}from'./plan.js';const P=a=>a;export const TASK_BINDING_SLOT=0xfe;function safeId(a){return a['replace'](/[^a-zA-Z0-9_]/g,'_');}function ref(a){return{'$ref':a};}const MODE_MAP={'amount':'Amount','rate':'Rate','surplus':'Surplus'};export function compileTemplate(a,b,d={}){const f=d['nameBase']??a['id']['replace'](/\//g,'_'),h=d['merchantPermissionIndex']??0x3e8,i=[],j=[],k=new Set();for(const T of a['conditional_guards']??[]){const U=b[T['param']]??a['fee_params'][T['param']];if(U!==T['emit_value'])k['add'](T['guard_key']);}const l=new Map();for(const V of a['conditional_guards']??[]){l['set'](V['param'],(l['get'](V['param'])??0x0)+0x1);}const m=new Set((a['conditional_guards']??[])['filter'](W=>(l['get'](W['param'])??0x0)>0x1)['map'](W=>W['guard_key'])),o=new Set([...k]['filter'](W=>m['has'](W))),p=o['size']>0x0?a['machine_shape']['map'](W=>({...W,'from':(W['from']??[])['filter'](X=>typeof X==='string'||X['guard_key']===undefined||!o['has'](X['guard_key']))})):a['machine_shape'],q=o['size']>0x0?(a['allocator']['rows']??[])['filter'](W=>W['guard_key']===undefined||!o['has'](W['guard_key'])):a['allocator']['rows']??[],r=a['guards']['map']((W,X)=>({'key':W['key']??W['template_id']+'#'+X,'template_id':W['template_id'],'host':W['host'],'purpose':W['purpose']}))['filter'](W=>!k['has'](W['key'])),s=new Map(r['map'](W=>[W['key'],W])),t=new Map(),u=[],v=r['map'](W=>W['key']);for(const W of Object['keys'](d['guardResolutions']??{})){!s['has'](W)&&i['push']({'code':'GUARD_RESOLUTION_UNKNOWN','detail':'guard_resolutions\x20key\x20\x27'+W+'\x27\x20matches\x20no\x20guard\x20spec\x20key\x20declared\x20by\x20\x27'+f+'\x27.\x20'+('Legal\x20keys:\x20'+(v['length']>0x0?v['join'](',\x20'):'(none\x20—\x20this\x20template\x20declares\x20no\x20keyed\x20guards)')+'.\x20')+'An\x20unknown\x20key\x20was\x20previously\x20dropped\x20silently,\x20leaving\x20the\x20intended\x20guard\x20pending\x20while\x20the\x20build\x20looked\x20resolved.'});}for(const X of r){const Y='guard_'+safeId(X['key']),Z=d['guardResolutions']?.[X['key']];let a0=X['purpose'],a1,a2;if(Z?.['kind']==='inline')a1=Z['table'],a2=Z['root'],a0=Z['description']??X['purpose'];else{const a3=Z?.['kind']==='template'?Z['template_id']:X['template_id']['startsWith']('tpl_')?X['template_id']:undefined;if(a3!==undefined){const a4={'service_name':f+'_service',...a['fee_params'],...b,...Z?.['kind']==='template'?Z['params']:{}},a5=fillGuardTemplate(a3,a4);!a5['ok']?i['push']({'code':'GUARD_TEMPLATE_PARAMS','detail':'guard\x20\x27'+X['key']+'\x27\x20('+a3+'):\x20'+a5['error']}):(a1=a5['table'],a2=a5['root']);}}a1!==undefined?(t['set'](X['key'],{'stepId':Y,'description':a0,'table':a1,'root':a2}),X['step_id']=Y):u['push'](X);}const w=new Set(p['flatMap'](a6=>(a6['from']??[])['map'](a7=>typeof a7==='string'?undefined:a7['guard_key'])['filter'](a7=>typeof a7==='string'))),x=new Set();for(const a6 of r){if(!w['has'](a6['key']))continue;const a7=t['get'](a6['key']);if(a7===undefined)continue;const a8=a7['table']['some'](a9=>a9['identifier']===TASK_BINDING_SLOT);if(a8)continue;t['set'](a6['key'],{...a7,'table':[...a7['table'],{'identifier':TASK_BINDING_SLOT,'b_submission':!![],'value_type':'Address','name':'task_binding\x20order\x20anchor\x20(protocol\x20slot\x20254;\x20written\x20by\x20order\x20creation)'}]}),x['add'](a6['key']);}const y=a9=>t['get'](a9)!==undefined&&refsOf({'table':t['get'](a9)['table'],'root':t['get'](a9)['root']})['has']('service'),z=a9=>{const aa=t['get'](a9),ab=s['get'](a9)?.['purpose'];return{'op':'create','id':aa['stepId'],'object':'guard','params':P({'description':aa['description'],'table':aa['table'],'root':aa['root']}),'notes':x['has'](a9)?(ab??'Guard')+'\x20[kernel:\x20protocol\x20slot\x20254\x20(task\x20binding)\x20auto-declared]':ab};};j['push']({'op':'create','id':'permission','object':'permission','params':{'name':f+'_permission'}});const A=a['arbitration_mode']!==undefined&&a['arbitration_mode']!=='none';A&&j['push']({'op':'create','id':'permission_arb','object':'permission','params':{'name':f+'_arb_permission'},'notes':'MUST\x20be\x20created\x20by\x20a\x20different\x20account\x20than\x20the\x20service\x20permission\x20'+'(E_ARBITRATION_PERMISSION_CONFLICT=33):\x20dispute\x20neutrality.'});j['push']({'op':'create','id':'contact','object':'contact','params':{'name':f+'_contact'},'notes':'R8:\x20customer-service\x20channel;\x20mandatory\x20when\x20customer_required\x20is\x20set.'});const B=r['some'](a9=>a9['host']==='repository'||a9['template_id']==='pattern.repository_data_check'||a9['template_id']==='pattern.repository_write_authorization');if(B){const a9=b['repository_policies'];j['push']({'op':'create','id':'repository','object':'repository','params':{'name':f+'_evidence',...Array['isArray'](a9)?{'policies':a9}:{}},'notes':'Evidence\x20rows\x20(tracking\x20hash,\x20receipts,\x20WTS\x20proofs).'});}const C=[];for(const [aa]of t){y(aa)?C['push'](aa):j['push'](z(aa));}const D=new Set(p['map'](ab=>ab['name'])),E=[];for(const ab of p){if(ab['from']===undefined||ab['from']['length']===0x0){i['push']({'code':'MACHINE_EDGES_MISSING','detail':'machine_shape\x20node\x20\x27'+ab['name']+'\x27\x20declares\x20no\x20\x27from\x27\x20edges.\x20Edges\x20are\x20data\x20'+'(REPORT\x20#10\x20A-2:\x20a\x20missing\x20paid->closed_cancel\x20edge\x20bricks\x20the\x20shop\x20at\x20publish).\x20'+'Annotate\x20the\x20node\x20with\x20from:\x20[...]\x20(use\x20prev:\x20\x22\x22\x20for\x20the\x20entry\x20edge).'});continue;}const ac=[],ad=new Map();for(const ae of ab['from']){const af=typeof ae==='string'?{'prev':ae}:ae;if(af['prev']!==''&&!D['has'](af['prev'])){i['push']({'code':'EDGE_UNKNOWN_PREV','detail':'node\x20\x27'+ab['name']+'\x27\x20edge\x20prev\x20\x27'+af['prev']+'\x27\x20is\x20not\x20a\x20machine_shape\x20node'});continue;}const ag=af['operator']??ab['operator']??(af['prev']===''?'order_payer':'merchant'),ah={'name':af['forward']??(af['prev']===''?'enter_'+ab['name']:af['prev']+'_to_'+ab['name']),'weight':0x1,...ag==='order_payer'?{'namedOperator':''}:{'permissionIndex':af['permission_index']??h}};if(af['guard_key']!==undefined){const aj=s['get'](af['guard_key']);if(aj===undefined)i['push']({'code':'GUARD_KEY_UNKNOWN','detail':'edge\x20\x27'+af['prev']+'\x27->\x27'+ab['name']+'\x27\x20binds\x20unknown\x20guard_key\x20\x27'+af['guard_key']+'\x27'});else aj['step_id']!==undefined&&(y(aj['key'])?i['push']({'code':'GUARD_CYCLE','detail':'edge\x20\x27'+af['prev']+'\x27->\x27'+ab['name']+'\x27\x20binds\x20guard\x20\x27'+aj['key']+'\x27\x20which\x20itself\x20'+'refs\x20the\x20service\x20(created\x20after\x20the\x20machine)\x20—\x20an\x20F-05\x20cycle.\x20Rebind\x20or\x20split\x20the\x20guard.'}):ah['guard']=ref(aj['step_id']));}const ai=ad['get'](af['prev']);ai!==undefined?ai['push'](ah):ad['set'](af['prev'],[ah]);}for(const [ak,al]of ad){ac['push']({'prev_node':ak,'threshold':0x0,'forwards':al});}E['push']({'name':ab['name'],...ab['semantic_role']!==undefined?{'role':ab['semantic_role']}:{},'pairs':ac});}j['push']({'op':'create','id':'machine','object':'machine','params':P({'name':f+'_machine','nodes':E})}),j['push']({'op':'publish','id':'machine_publish','target':ref('machine'),'preflight':[{'check':'machine_publish','status':'pending'},{'check':'TASKBIND-01','status':'pending'}]});const F=typeof b['currency']==='string'?b['currency']:'0x2::wow::WOW',G=r['find'](am=>am['host']==='service'&&am['key']==='buy');j['push']({'op':'create','id':'service','object':'service','params':P({'name':f+'_service','type_parameter':F,'permission':ref('permission'),'machine':ref('machine'),'um':ref('contact'),'description':a['id']+'\x20—\x20compiled\x20by\x20composition/compile',...B?{'repositories':[ref('repository')]}:{},...G?.['step_id']!==undefined?{'buy_guard':ref(G['step_id'])}:{},...Array['isArray'](b['customer_required'])?{'customer_required':b['customer_required']}:{}}),'notes':'Draft\x20only:\x20machine/order_allocators\x20are\x20L1-frozen\x20at\x20publish;\x20allocators\x20attach\x20in\x20the\x20configure\x20step.'});for(const am of C)j['push'](z(am));const H=q['length']>0x0?q:[{'track':'settlement','recipient':a['allocator']['recipient']==='fixed'?'entity':a['allocator']['recipient'],'recipient_key':a['allocator']['recipient_key'],'mode':a['allocator']['mode'],'value':a['allocator']['mode']==='rate'?0x2710:a['allocator']['mode']==='surplus'?'0':undefined}],I=[],J=new Map();for(const an of H){if(an['guard_key']!==undefined){let ao=J['get'](an['guard_key']);ao===undefined&&(ao={'key':an['guard_key'],'rows':[]},J['set'](an['guard_key'],ao),I['push'](ao)),ao['rows']['push'](an);}else I['push']({'rows':[an]});}const K=[];for(const ap of I){const aq=[];let ar;for(const at of ap['rows']){let au=at['value'];au===undefined&&at['value_from']!==undefined&&(au=b[at['value_from']]??a['fee_params'][at['value_from']]);if(au===undefined&&at['mode']!=='surplus'){i['push']({'code':'ALLOCATOR_VALUE_MISSING','detail':'allocator\x20row\x20('+at['track']+'/'+at['recipient']+')\x20has\x20neither\x20value\x20nor\x20a\x20resolvable\x20value_from'});continue;}(at['fix']!==undefined||at['fix_from']!==undefined)&&i['push']({'code':'ALLOCATOR_FIX_UNSUPPORTED','detail':'allocator\x20row\x20('+at['track']+'/'+at['recipient']+')\x20declares\x20fix/fix_from\x20—\x20the\x20chain\x20has\x20no\x20holdback\x20'+'parameter:\x20fix\x20is\x20computed\x20on-chain\x20as\x20the\x20sum\x20of\x20the\x20Amount\x20legs\x20and\x20those\x20legs\x20are\x20PAID\x20'+'(allocation.move:399,540),\x20and\x20the\x20allocator-registration\x20call\x20surface\x20(guard,\x20sharing,\x20max)\x20has\x20no\x20fix\x20'+'argument,\x20so\x20this\x20value\x20never\x20reaches\x20the\x20chain.\x20To\x20keep\x20funds\x20in\x20the\x20pool,\x20do\x20not\x20distribute\x20them\x20'+'(a\x20separate\x20Allocation\x20object,\x20or\x20a\x20later\x20guard-gated\x20allocator);\x20to\x20combine\x20fixed\x20fees\x20with\x20a\x20'+'proportional\x20split,\x20use\x20explicit\x20Amount\x20legs\x20plus\x20Rate\x20legs\x20summing\x2010000.'});ar??=at['note'];let av;if(at['recipient']==='entity')av={'Entity':{'$late':{'by':'local_name','mark':at['recipient_key']??'merchant'}}};else{if(at['recipient']==='guard_identifier'){const aw=Number(at['recipient_key']??0x0);av={'GuardIdentifier':aw};const ax=ap['key']!==undefined?t['get'](ap['key']):undefined;if(ax!==undefined){const ay=ax['table']['find'](az=>az['identifier']===aw);(ay===undefined||ay['b_submission']!==!![]||ay['value_type']!=='Address')&&i['push']({'code':'GUARD_SLOT_UNKNOWN','detail':'allocator\x20leg\x20{GuardIdentifier:\x20'+aw+'}\x20on\x20guard\x20\x27'+ap['key']+'\x27\x20of\x20\x27'+f+'\x27:\x20the\x20bound\x20'+('Guard\x20table\x20has\x20no\x20slot\x20'+aw+'\x20Address\x20submission\x20row\x20(b_submission:\x20true).\x20On\x20chain\x20the\x20leg\x20')+('reads\x20slot\x20'+aw+'\x20as\x20its\x20payee\x20and\x20asserts\x20it\x20equals\x20the\x20paying\x20order\x20')+'(payment_info.for_object)\x20—\x20an\x20undeclared\x20or\x20static\x20slot\x20aborts\x20at\x20alloc\x20time\x20with\x20the\x20funds\x20'+'stranded,\x20and\x20Guard/allocators/forwards\x20are\x20all\x20publish-frozen.\x20Declare\x20'+('{identifier:\x20'+aw+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20Guard\x20table.')});}}else av='Signer';}aq['push']({'who':av,'sharing':String(au??'0'),'mode':MODE_MAP[at['mode']]});}if(aq['length']===0x0)continue;const as=ap['key']!==undefined?s['get'](ap['key'])?.['step_id']:undefined;ap['key']!==undefined&&!s['has'](ap['key'])&&i['push']({'code':'GUARD_KEY_UNKNOWN','detail':'allocator\x20row\x20('+ap['rows'][0x0]['track']+')\x20binds\x20unknown\x20guard_key\x20\x27'+ap['key']+'\x27'}),K['push']({...as!==undefined?{'guard':ref(as)}:{},...ap['key']!==undefined?{'guard_key':ap['key']}:{},'track':ap['rows'][0x0]['track'],'sharing':aq,...ar!==undefined?{'note':ar}:{}});}j['push']({'op':'configure','id':'service_allocators','target':ref('service'),'method':'order_allocators','params':P({'description':a['allocator']['description'],'threshold':Number(a['fee_params']['threshold']??0x0)||0x0,'allocators':K}),'requires':['machine_publish']});Array['isArray'](b['sales'])&&b['sales']['length']>0x0&&j['push']({'op':'configure','id':'service_sales','target':ref('service'),'method':'sales','params':{'op':'add','sales':b['sales']}});const L=b['review_mode'],M=L==='review'||L==='review_reward'||L==='none'?L:undefined,N=M??a['review_mode']??'none';if(N!=='none'){const az=p['some'](aE=>/review/i['test'](aE['name']));N==='review'&&!az&&i['push']({'code':'REVIEW_NODE_MISSING','detail':'review_mode\x20\x27'+N+'\x27\x20declares\x20the\x20buyer\x20review\x20reputation\x20rail,\x20but\x20machine_shape\x20has\x20no\x20'+'\x27reviewed\x27\x20node.\x20Add\x20a\x20buyer-advanced\x20review\x20node\x20(operator\x20order_payer)\x20with\x20an\x20EXIT\x20edge\x20back\x20to\x20the\x20'+'settlement\x20rail\x20(R-DEAD-END:\x20a\x20zero-exit\x20review\x20node\x20strands\x20the\x20escrow),\x20or\x20anchor\x20the\x20claim\x20on\x20the\x20'+'delivered\x20terminal\x20via\x20a\x20host:\x22reward\x22\x20guard\x20(review_mode\x20\x22review_reward\x22\x20variant).'});const aA=r['find'](aE=>aE['host']==='reward'),aB=p['find'](aE=>/review/i['test'](aE['name']))?.['name'];let aC,aD;if(aB!==undefined){const aE=[];for(const aH of p){for(const aI of aH['from']??[]){const aJ=typeof aI==='string'?{'prev':aI,'guard_key':undefined}:aI;aE['push']({'prev':aJ['prev'],'guard_key':aJ['guard_key'],'target':aH['name']});}}const aF=aE['find'](aK=>aK['target']===aB&&aK['guard_key']!==undefined)?.['guard_key']??aE['find'](aK=>aK['prev']===aB&&aK['guard_key']!==undefined)?.['guard_key'],aG=aF!==undefined?s['get'](aF):undefined;aC=aG?.['step_id'],aD=aF;}aC===undefined&&aA?.['step_id']!==undefined&&(aC=aA['step_id'],aD=aA['key']);if(aC!==undefined){const aK=b['buyer_review_enabled']===!![];j['push']({'op':'create','id':'repository_review','object':'repository','params':P({'name':f+'_review','description':'Structured\x20buyer\x20reputation\x20rows\x20(AR-1:\x20emitted\x20by\x20the\x20build\x20plan\x20—\x20no\x20manual\x20setup).','policies':[{'name':'review','description':'One\x20row\x20per\x20buyer\x20(id_from=Signer;\x20rewrite\x20=\x20own-record\x20overwrite).\x20Writes\x20require\x20the\x20review\x20credential\x20(guard\x20key\x20\x27'+aD+'\x27).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','write_guard':[{'guard':ref(aC)}],'id_from':'signer','value_type':'String'},...aK?[{'name':'buyer_review','description':'Merchant-side\x20structured\x20feedback\x20on\x20the\x20order/buyer\x20(D-R7\x20bidirectional\x20reputation,\x20opt-in).\x20One\x20row\x20per\x20writer\x20(id_from=Signer;\x20rewrite\x20=\x20own-record\x20overwrite).\x20NO\x20write\x20guard\x20by\x20design:\x20merchant\x20authority\x20is\x20verified\x20at\x20READ\x20time\x20(the\x20writer\x20must\x20control\x20the\x20order\x27s\x20service\x20—\x20graph\x20ControlIndex).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','id_from':'signer','value_type':'String'}]:[]]}),'notes':'REVIEW-COMPONENT\x20AR-1:\x20the\x20review\x20TEXT\x20still\x20rides\x20the\x20forward\x20message\x20(D-R1\x20dual\x20carrier);\x20this\x20repository\x20carries\x20ONLY\x20the\x20structured\x20row.\x20Buyers\x20resolve\x20this\x20object\x20by\x20name\x20(workspace/onchain_objects)\x20—\x20never\x20guess\x20an\x20address.'}),j['push']({'op':'configure','id':'service_review_repository','target':ref('service'),'method':'repositories','params':P({'op':'add','objects':[ref('repository_review')]}),'requires':['service','repository_review']});}if(N==='review_reward'){const aL=aA;if(aL===undefined||aL['step_id']===undefined)i['push']({'code':'REVIEW_REWARD_GUARD_MISSING','detail':'review_mode\x20\x27review_reward\x27\x20promises\x20a\x20claim\x20reward,\x20but\x20no\x20RESOLVED\x20host:\x22reward\x22\x20guard\x20spec\x20'+'exists\x20to\x20gate\x20the\x20claim.\x20Mount\x20a\x20reward\x20claim\x20guard\x20(e.g.\x20pattern.progress_state_check\x20anchored\x20'+'on\x20the\x20review\x20node\x20or\x20the\x20delivered\x20terminal\x20+\x20review\x20evidence\x20hash)\x20and\x20keep\x20it\x20resolvable\x20—\x20'+'an\x20unguarded\x20incentive\x20promise\x20must\x20not\x20publish\x20(INV-4).'});else{const aM=b['reward_funding'],aN=t['get'](aL['key']);aN!==undefined&&!rootHasRewardRecordGate(aN['root'])&&i['push']({'code':'REVIEW_REWARD_UNARMED','detail':'review_reward\x20claim\x20guard\x20\x27'+aL['key']+'\x27\x20carries\x20no\x20record-gate:\x20Reward.claim\x20has\x20NO\x20'+'protocol-level\x20idempotency\x20(OFN-C1),\x20so\x20a\x20funded\x20pool\x20behind\x20this\x20guard\x20is\x20a\x20replay-drain\x20target.\x20'+'Add\x20logic_not(query_reward_record_exists(object=<reward>,\x20where={storeFromId:<order\x20identifier>}))\x20'+'to\x20the\x20guard\x20root,\x20wrapped\x20in\x20logic_and\x20with\x20the\x20existing\x20checks\x20(reward.rs\x20record_exists_where;\x20'+'guard-risk\x20R-X1-14\x20audits\x20the\x20built\x20guard).\x20Until\x20armed,\x20do\x20not\x20fund\x20the\x20pool.'}),j['push']({'op':'create','id':'reward_review','object':'reward','params':P({'name':f+'_review_reward','description':'Review\x20incentive\x20pool\x20(sale-time\x20planned;\x20terms\x20disclosed\x20at\x20quote/buy):\x20claim\x20gated\x20by\x20guard\x20\x27'+aL['key']+'\x27.'}),'notes':'REVIEW-COMPONENT:\x20the\x20funded\x20reward\x20must\x20be\x20perceivable\x20by\x20the\x20buyer\x20BEFORE\x20ordering\x20—\x20the\x20full\x20terms\x20ride\x20the\x20quote/buy\x20surface\x20(REVIEW-COMPONENT-PLAN\x20§四).'}),j['push']({'op':'configure','id':'reward_review_guard_add','target':ref('reward_review'),'method':'guard_add','params':P({'guard':ref(aL['step_id'])}),'requires':['reward_review']}),j['push']({'op':'configure','id':'service_rewards','target':ref('service'),'method':'rewards','params':P({'op':'add','objects':[ref('reward_review')]}),'requires':['service']}),typeof aM==='string'||typeof aM==='number'?j['push']({'op':'configure','id':'reward_review_coin_add','target':ref('reward_review'),'method':'coin_add','params':{'coin':String(aM)},'requires':['reward_review']}):i['push']({'code':'REVIEW_REWARD_UNFUNDED','detail':'review_mode\x20\x27review_reward\x27\x20without\x20a\x20\x27reward_funding\x27\x20input\x20(INV-4\x20R-REWARD-FUNDED):\x20the\x20incentive\x20'+'is\x20a\x20marketing\x20promise\x20that\x20must\x20be\x20FUNDED\x20when\x20the\x20Service\x20is\x20built\x20(sale-time\x20planning\x20—\x20pool\x20>=\x20'+'expected\x20orders\x20x\x20per-order\x20reward,\x20benchmark\x20fee_param\x20review_reward_pool).\x20Pass\x20reward_funding\x20'+'(smallest-unit\x20string)\x20to\x20fund\x20the\x20Reward\x20object,\x20or\x20drop\x20to\x20review_mode\x20\x22review\x22.'});}}}if(A){j['push']({'op':'create','id':'arbitration','object':'arbitration','params':P({'name':f+'_arbitration','permission':ref('permission_arb'),'type_parameter':F}),'notes':'Independent\x20venue\x20(R2).\x20New\x20arbitrations\x20default\x20bPaused=true\x20—\x20unpause\x20is\x20a\x20separate\x20operator\x20step.'}),j['push']({'op':'configure','id':'service_arbitrations','target':ref('service'),'method':'arbitrations','params':P({'op':'add','objects':[ref('arbitration')]})});const aO=b['compensation_fund'];(typeof aO==='string'||typeof aO==='number')&&j['push']({'op':'configure','id':'service_compensation','target':ref('service'),'method':'compensation_fund_add','params':{'balance':String(aO)}});}j['push']({'op':'publish','id':'service_publish','target':ref('service'),'preflight':[{'check':'service_publish','status':'pending'},{'check':'FUND-EXIT-01','status':'pending'},{'check':'PLAN-ALLOC-01','status':'pending'},{'check':'TASKBIND-02','status':'pending'}]});const O=new Set(q['map'](aP=>aP['guard_key'])['filter'](aP=>typeof aP==='string')),Q=/^0x[0-9a-fA-F]{20,64}$/,R=aP=>{const aQ=t['get'](aP);if(aQ===undefined)return undefined;for(const aR of aQ['table']){const aS=aR;if(aS['b_submission']===!![]||aS['value_type']!=='Address')continue;const aT=aS['value'];if(typeof aT==='string'&&Q['test'](aT))return String(aS['identifier']??'?');}return undefined;};for(const aP of t['keys']()){if(!w['has'](aP)&&!O['has'](aP))continue;const aQ=R(aP);aQ!==undefined&&i['push']({'code':'GUARD_FOREIGN_SERVICE','detail':'guard\x20\x27'+aP+'\x27\x20pins\x20an\x20on-chain\x20address\x20literal\x20(table\x20slot\x20'+aQ+')\x20while\x20bound\x20into\x20this\x20build.\x20'+'The\x20plan\x27s\x20Service\x20is\x20created\x20BY\x20this\x20plan\x20and\x20cannot\x20equal\x20a\x20pre-existing\x20address,\x20so\x20the\x20pin\x20names\x20a\x20foreign\x20or\x20'+'stale\x20object:\x20each\x20object\x20is\x20well-formed\x20alone,\x20but\x20the\x20cross-object\x20identity\x20assert\x20aborts\x20every\x20guarded\x20forward\x20'+'(klook\x20B11\x20class),\x20and\x20Guard\x20+\x20machine\x20are\x20both\x20create/publish-frozen\x20—\x20unrepairable.\x20'+'Bind\x20by\x20plan\x20reference\x20({\x22$ref\x22:\x22service\x22})\x20or\x20by\x20the\x20P16\x20circular\x20service\x20NAME\x20instead.'});}const S=u['flatMap'](aR=>{const aS=O['has'](aR['key'])?'allocator':w['has'](aR['key'])?'machine_edge':aR['host']==='service'&&aR['key']==='buy'?'service_buy':undefined;return aS?[{'key':aR['key'],'template_id':aR['template_id'],'host':aR['host'],'site':aS,'purpose':aR['purpose']}]:[];});return{'plan':{'version':0x1,'intent':d['intent']??'compile\x20'+a['id'],'templateId':a['id'],'inputs':b,'steps':j,...S['length']>0x0?{'pending_guards':S}:{}},'guardSpecs':r,'unresolved':u,'blockers':i};}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface InFlightRecord {
|
|
2
|
+
marker_id: string;
|
|
3
|
+
op: string;
|
|
4
|
+
service?: string;
|
|
5
|
+
buyer?: string;
|
|
6
|
+
items_count?: number;
|
|
7
|
+
params_hash: string;
|
|
8
|
+
started_at: number;
|
|
9
|
+
digests: string[];
|
|
10
|
+
status: "in_flight" | "landed";
|
|
11
|
+
}
|
|
12
|
+
export declare function beginInFlight(op: string, data: unknown, env?: {
|
|
13
|
+
account?: string;
|
|
14
|
+
network?: string;
|
|
15
|
+
}): string;
|
|
16
|
+
export declare function recordInFlightOutcome(markerId: string, result: unknown): void;
|
|
17
|
+
export declare function describeLastInFlight(op: string): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const MAX_RECORDS=0x32,MAX_AGE_MS=0x2*0x3c*0x3c*0x3e8,records=new Map();let seq=0x0;function hash(a){let b=0x1505;for(let c=0x0;c<a['length'];c++)b=(b<<0x5)+b+a['charCodeAt'](c)>>>0x0;return b['toString'](0x10);}function prune(){const a=Date['now']();for(const [b,c]of records){if(a-c['started_at']>MAX_AGE_MS)records['delete'](b);}while(records['size']>MAX_RECORDS){const d=records['keys']()['next']()['value'];if(d===undefined)break;records['delete'](d);}}function addr(a){return typeof a==='string'&&a['startsWith']('0x')?a:undefined;}export function beginInFlight(a,b,c){const d=b,e=d?.['order_new']?.['buy'],f=addr(d?.['object'])??addr(e?.['service']),g={'marker_id':'ifl_'+Date['now']()['toString'](0x10)+'_'+(seq++)['toString'](0x10),'op':a,'service':f,'buyer':addr(c?.['account']),'items_count':Array['isArray'](e?.['items'])?e['items']['length']:undefined,'params_hash':hash(JSON['stringify'](b??{})),'started_at':Date['now'](),'digests':[],'status':'in_flight'};return records['set'](g['marker_id'],g),prune(),g['marker_id'];}export function recordInFlightOutcome(a,b){const c=records['get'](a);if(!c)return;const d=b?.['digest'];typeof d==='string'&&d&&(c['digests']['push'](d),c['status']='landed');}export function describeLastInFlight(a){let b;for(const d of records['values']())if(d['op']===a)b=d;if(!b)return undefined;const c=[b['service']?'service='+b['service']:undefined,b['buyer']?'buyer='+b['buyer']:undefined,b['items_count']!==undefined?'items='+b['items_count']:undefined]['filter'](Boolean)['join']('\x20');if(b['status']==='landed'&&b['digests']['length']>0x0)return'IN-FLIGHT\x20MARKER\x20'+b['marker_id']+':\x20op='+b['op']+'\x20'+c+'\x20landed\x20with\x20digest\x20'+b['digests'][0x0]+'\x20'+('('+new Date(b['started_at'])['toISOString']()+').\x20The\x20execution\x20DID\x20reach\x20the\x20chain\x20—\x20adopt\x20the\x20')+'resulting\x20object;\x20resubmitting\x20the\x20same\x20call\x20creates\x20a\x20second\x20one.';return'IN-FLIGHT\x20MARKER\x20'+b['marker_id']+':\x20op='+b['op']+'\x20'+c+'\x20started\x20'+new Date(b['started_at'])['toISOString']()+'\x20'+'—\x20this\x20operation\x20is\x20observability-non-atomic:\x20a\x20transport\x20drop\x20after\x20submit\x20leaves\x20the\x20commit\x20state\x20'+'open.\x20Before\x20resubmitting,\x20first\x20verify\x20whether\x20an\x20order\x20with\x20this\x20exact\x20signature\x20already\x20landed\x20'+'(query\x20the\x20sender\x27s\x20recent\x20on-chain\x20objects\x20or\x20onchain_events\x20for\x20this\x20service);\x20adopt\x20it\x20if\x20present,\x20'+'resubmit\x20only\x20if\x20confirmed\x20absent.';}
|