@wowok/agent-mcp 3.2.7 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chain-semantics/field-capability.js +1 -1
- package/dist/chain-semantics/freeze-map.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/guard-verbs.js +1 -1
- package/dist/chain-semantics/object-graph.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/compile.d.ts +10 -1
- package/dist/composition/compile.js +1 -1
- package/dist/composition/inflight.d.ts +10 -0
- package/dist/composition/inflight.js +1 -1
- package/dist/extensions/business-modules.d.ts +1 -1
- package/dist/extensions/business-modules.js +1 -1
- package/dist/extensions/capability-manifest.js +1 -1
- package/dist/extensions/industry-audit.spec.js +1 -1
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/graph/onchain/edge-schema.js +1 -1
- package/dist/graph/onchain/facts.spec.js +1 -1
- package/dist/graph/onchain/field-manifest.js +1 -1
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.js +1 -1
- package/dist/harness/operation-id.d.ts +1 -0
- package/dist/harness/operation-id.js +1 -0
- package/dist/harness/recover.js +1 -1
- package/dist/index.js +1 -1
- package/dist/intent/types.d.ts +1 -1
- package/dist/intent/types.js +1 -1
- package/dist/keeper/KeeperScan.d.ts +2 -1
- package/dist/keeper/KeeperScan.js +1 -1
- package/dist/keeper/keeper.spec.js +1 -1
- package/dist/keeper/types.d.ts +3 -0
- package/dist/keeper/types.js +1 -1
- package/dist/knowledge/allocator-rail-verifier.d.ts +34 -0
- package/dist/knowledge/allocator-rail-verifier.js +1 -0
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/arbitration-templates.js +1 -1
- package/dist/knowledge/arbitration-venue-order.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +19 -1
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/rules/alloc_audit.json +1 -1
- package/dist/knowledge/baselines/rules/arb.json +1 -1
- package/dist/knowledge/baselines/rules/guard.json +106 -1
- package/dist/knowledge/baselines/rules/machine.json +9 -6
- package/dist/knowledge/baselines/rules/plan.json +40 -17
- package/dist/knowledge/baselines/semantic-facts.js +1 -1
- package/dist/knowledge/builtin-templates.d.ts +1 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/contract-invariants.js +1 -1
- package/dist/knowledge/discount-threshold.d.ts +11 -0
- package/dist/knowledge/discount-threshold.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/fund-layer.js +1 -1
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-anchor-reach.d.ts +1 -1
- package/dist/knowledge/guard-anchor-reach.js +1 -1
- package/dist/knowledge/guard-bindings.js +1 -1
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-field-cognition.js +1 -1
- package/dist/knowledge/guard-ledger.js +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.d.ts +1 -0
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-submission-brief.d.ts +6 -0
- package/dist/knowledge/guard-submission-brief.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +2 -2
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-puzzle.d.ts +1 -1
- package/dist/knowledge/machine-puzzle.js +1 -1
- package/dist/knowledge/machine-risk.js +1 -1
- package/dist/knowledge/machine-templates.js +1 -1
- package/dist/knowledge/machine-topology.d.ts +8 -0
- package/dist/knowledge/machine-topology.js +1 -1
- package/dist/knowledge/machine-translation.js +1 -1
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/permission-ledger.js +1 -1
- package/dist/knowledge/protocol-facts.d.ts +16 -0
- package/dist/knowledge/protocol-facts.js +1 -0
- package/dist/knowledge/recipient-constraint.js +1 -1
- package/dist/knowledge/reward-ledger.d.ts +2 -1
- package/dist/knowledge/reward-ledger.js +1 -1
- package/dist/knowledge/reward-templates.js +1 -1
- package/dist/knowledge/safety-rules.d.ts +0 -2
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/scenario-modes.d.ts +7 -0
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/template-loader.d.ts +13 -1
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +2 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/tool-constraints.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +7 -3
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/normalize.d.ts +1 -1
- package/dist/monitor/normalize.js +1 -1
- package/dist/monitor/types.d.ts +1 -1
- package/dist/monitor/types.js +1 -1
- package/dist/participation/radar-core.d.ts +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/game-theory.d.ts +1 -0
- package/dist/playbooks/service-build/game-theory.js +1 -1
- package/dist/playbooks/service-build/intent-analyzer.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +8 -0
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/object-panorama.d.ts +28 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.d.ts +2 -0
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/reverse-mapping-nk4.spec.js +1 -1
- package/dist/playbooks/service-build/reverse-mapping.js +1 -1
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/playbooks/service-build/service-quote.spec.js +1 -1
- package/dist/relationship/registry.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/role/profiles.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/safety/preview.d.ts +1 -0
- package/dist/safety/preview.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +19 -1
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.d.ts +1 -1
- package/dist/schema/call/arbitration.d.ts +8 -8
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +52 -5
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +3 -0
- package/dist/schema/call/contact.d.ts +5 -5
- package/dist/schema/call/demand.d.ts +5 -5
- 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 +3 -3
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +13 -5
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +5 -5
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/permission.d.ts +5 -5
- package/dist/schema/call/personal.d.ts +4 -4
- package/dist/schema/call/progress.d.ts +5 -5
- package/dist/schema/call/progress.js +1 -1
- package/dist/schema/call/proof.js +1 -1
- package/dist/schema/call/receipt.d.ts +8 -0
- package/dist/schema/call/receipt.js +1 -1
- package/dist/schema/call/repository.d.ts +9 -9
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/reward.d.ts +25 -5
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +10 -5
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/call/treasury.d.ts +5 -5
- package/dist/schema/common/index.d.ts +6 -6
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/goal/index.d.ts +17 -1
- package/dist/schema/goal/planning.d.ts +28 -2
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +3 -0
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/intent-radar/index.d.ts +9 -0
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/local/index.d.ts +31 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +57 -43
- package/dist/schema/operations.js +1 -1
- package/dist/schema/query/bi.d.ts +22 -6
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +164 -102
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +2 -0
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/utils/permission-machine-check.d.ts +2 -0
- package/dist/schema/utils/permission-machine-check.js +1 -1
- package/dist/schema/workflow/index.d.ts +1 -1
- package/dist/schema-query-impl/index.d.ts +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +3 -0
- package/dist/schemas/account_operation.schema.json +4 -4
- package/dist/schemas/benchmark_migration_operation.output.json +42 -0
- package/dist/schemas/benchmark_migration_operation.schema.json +40 -3
- package/dist/schemas/bridge_operation.output.json +3 -0
- package/dist/schemas/goal_operation.schema.json +52 -2
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/industry_pack_operation.output.json +8 -0
- package/dist/schemas/industry_pack_operation.schema.json +9 -0
- package/dist/schemas/intent_radar.output.json +8 -2
- package/dist/schemas/intent_radar.schema.json +4 -1
- package/dist/schemas/local_cache_operation.output.json +3 -0
- package/dist/schemas/local_history_operation.output.json +3 -0
- package/dist/schemas/local_info_operation.output.json +3 -0
- package/dist/schemas/local_mark_operation.output.json +3 -0
- package/dist/schemas/messenger_operation.schema.json +4 -4
- package/dist/schemas/monitor_events.schema.json +3 -1
- package/dist/schemas/onchain_events.output.json +275 -11
- package/dist/schemas/onchain_events.schema.json +25 -1
- package/dist/schemas/onchain_operations.output.json +47 -5
- package/dist/schemas/onchain_operations.schema.json +664 -179
- package/dist/schemas/onchain_operations_allocation.schema.json +7 -7
- package/dist/schemas/onchain_operations_arbitration.schema.json +21 -15
- package/dist/schemas/onchain_operations_contact.schema.json +15 -10
- package/dist/schemas/onchain_operations_demand.schema.json +15 -10
- package/dist/schemas/onchain_operations_gen_passport.schema.json +5 -5
- package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +346 -8
- package/dist/schemas/onchain_operations_machine.schema.json +24 -11
- package/dist/schemas/onchain_operations_order.schema.json +17 -12
- package/dist/schemas/onchain_operations_permission.schema.json +10 -5
- package/dist/schemas/onchain_operations_personal.schema.json +2 -2
- package/dist/schemas/onchain_operations_progress.schema.json +17 -12
- package/dist/schemas/onchain_operations_proof.schema.json +6 -6
- package/dist/schemas/onchain_operations_repository.schema.json +19 -14
- package/dist/schemas/onchain_operations_reward.schema.json +96 -15
- package/dist/schemas/onchain_operations_service.schema.json +33 -21
- package/dist/schemas/onchain_operations_treasury.schema.json +15 -10
- package/dist/schemas/onchain_table_data.output.json +7 -7
- package/dist/schemas/query_toolkit.output.json +268 -44
- package/dist/schemas/query_toolkit.schema.json +1 -1
- package/dist/schemas/schema_query.schema.json +7 -2
- package/dist/schemas/workflow_operation.schema.json +5 -5
- package/dist/schemas/wowok_buildin_info.output.json +140 -3
- package/dist/schemas/wowok_buildin_info.schema.json +2 -2
- package/dist/tools/handlers/benchmark-migration.d.ts +66 -1
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/dispatch-expectations.d.ts +0 -1
- package/dist/tools/handlers/dispatch-expectations.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/intent-radar.js +1 -1
- package/dist/tools/handlers/keeper.d.ts +1 -1
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +12 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.d.ts +1 -0
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/review-chain.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/move-fn-index.gen.js +1 -1
- package/dist/tools/registry/agent.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/files.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/upgrade-check.d.ts +23 -0
- package/dist/tools/upgrade-check.js +1 -1
- package/dist/tools/wip-deploy-assist.d.ts +6 -0
- package/dist/tools/wip-deploy-assist.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# WoWok Agent (MCP Server)
|
|
2
2
|
Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Skills: [https://github.com/wowok-ai/skills](https://github.com/wowok-ai/skills)
|
|
5
5
|
|
|
6
|
-
Docs: [https://github.com/wowok-ai/docs/](https://github.com/wowok-ai/docs
|
|
6
|
+
Docs: [https://github.com/wowok-ai/docs/](https://github.com/wowok-ai/docs)
|
|
7
7
|
|
|
8
8
|
## Quick Start
|
|
9
9
|
|
|
@@ -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:
|
|
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:119-123)','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':0x48,'pattern':'dispute:\x20vector<address>'}},'Order.required_info':{'writeBy':['owner-only\x20order\x20field\x20update\x20(order.move:79-82)','owner-only\x20controlled\x20Proof\x20bind\x20(order.move:93-100,\x20E_REQUIRED_INFO_PROOF_NOT_BOUND\x20on\x20mismatch)'],'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.\x20The\x20controlled\x20bind\x20makes\x20the\x20TARGET\x20verifiable\x20(about==order,\x20creator==owner);\x20the\x20FIELD\x20stays\x20attestation-only\x20—\x20presence\x20gates\x20only.','findings':['A-1','A-10'],'source':{'file':'order.move','line':0x4c,'pattern':'required_info:\x20Option<address>'}},'Order.claimed_by':{'writeBy':['order.compensate\x20(package,\x20order.move:114-117)'],'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:238-259.','findings':['A-3'],'source':{'file':'order.move','line':0x4b,'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':0x4d,'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':0x14e,'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':0x14d,'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':
|
|
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':0x328,'pattern':'E_ALREADY_PUBLISHED'},{'file':'service.move','line':0x2fe,'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':0x155,'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':0x61,'pattern':'USER_DEFINED_PERM_INDEX'},{'file':'machine.move','line':0x6d,'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:718-799)'],'consequence':'Write-policy\x20mistakes\x20are\x20repairable\x20—\x20unlike\x20Machine/Service\x20publish.','sources':[{'file':'repository.move','line':0x2c3,'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 FUND_FLOWS={'buy_entry':{'kind':'entry','summary':'Buyer\x20pays:\x20coin\x20split\x20->\x20Order\x20+\x20Allocation\x20escrow\x20anchored\x20to\x20the\x20order.','path':['service\x20buy\x20(creates\x20Order,\x20service.move:459)','order-bound\x20Allocation\x20creation\x20(splits\x20coin,\x20sets\x20payment_info.for_object=order,\x20service.move:408)'],'invariants':['Allocation.balance\x20==\x20order\x20amount\x20at\x20creation','quote.ctx\x20binds\x20quote\x20to\x20tx\x20digest;\x20stock\x20deducted\x20in\x20same\x20tx\x20as\x20buy'],'sources':[{'file':'service.move','line':0x1cb,'pattern':'buy2_imp'},{'file':'service.move','line':0x198,'pattern':'order_allocation'}]},'exit_alloc':{'kind':'exit','summary':'Escrow\x20exit\x201\x20(settlement\x20/\x20refund):\x20guard-matched\x20allocators\x20distribute\x20the\x20pool.','path':['allocation.alloc\x20(allocation.move:408)','per\x20matched\x20allocator:\x20once-slot\x20(OnceKey{guard,\x20allocator\x20index,\x20key})\x20consumed','Payment<T>\x20created;\x20CoinWrapper<T>\x20transferred\x20to\x20each\x20recipient','recipient\x20unwraps\x20via\x20payment.unwrap\x20/\x20order.owner_receive'],'invariants':['balance\x20>=\x20allocators.threshold\x20(EINSUFFICIENT_BALANCE)','balance\x20>\x200\x20(EZERO_DISTRIBUTION)\x20—\x20replay\x20on\x20drained\x20pool\x20aborts','payment_info\x20must\x20be\x20some\x20(ENO_PAYMENT_INFO)','every\x20allocator\x20with\x20matching\x20guard\x20RUNS,\x20in\x20vector\x20order,\x20against\x20the\x20shrinking\x20pool','once-slot\x20per\x20allocator\x20index\x20makes\x20replay\x20of\x20the\x20same\x20guard\x20abort'],'findings':['A-3'],'sources':[{'file':'allocation.move','line':0x198,'pattern':'public\x20fun\x20alloc<T>'},{'file':'allocation.move','line':0x19f,'pattern':'EZERO_DISTRIBUTION'}]},'exit_compensation':{'kind':'exit','summary':'Escrow\x20exit\x202\x20(arbitration\x20indemnity):\x20service\x20compensation_fund\x20pays\x20order\x20owner\x20directly.','path':['service\x20compensation\x20claim\x20(service.move:494;\x20arbitrations\x20whitelist\x20+\x20E33\x20conflict\x20check\x20at\x20:503-505)','arbitration.compensate\x20->\x20order.compensate\x20writes\x20claimed_by','compensation_fund\x20split\x20->\x20public_transfer\x20to\x20order.owner\x20(service.move:512)'],'invariants':['order\x20must\x20not\x20be\x20already\x20claimed\x20(E_ORDER_ALREADY_CLAIMED)','claiming\x20arbitration\x20must\x20be\x20in\x20service.arbitrations\x20whitelist'],'sources':[{'file':'service.move','line':0x1ee,'pattern':'compensation_claim'},{'file':'service.move','line':0x200,'pattern':'order::owner(order)'},{'file':'order.move','line':
|
|
1
|
+
export const FUND_FLOWS={'buy_entry':{'kind':'entry','summary':'Buyer\x20pays:\x20coin\x20split\x20->\x20Order\x20+\x20Allocation\x20escrow\x20anchored\x20to\x20the\x20order.','path':['service\x20buy\x20(creates\x20Order,\x20service.move:459)','order-bound\x20Allocation\x20creation\x20(splits\x20coin,\x20sets\x20payment_info.for_object=order,\x20service.move:408)'],'invariants':['Allocation.balance\x20==\x20order\x20amount\x20at\x20creation','quote.ctx\x20binds\x20quote\x20to\x20tx\x20digest;\x20stock\x20deducted\x20in\x20same\x20tx\x20as\x20buy'],'sources':[{'file':'service.move','line':0x1cb,'pattern':'buy2_imp'},{'file':'service.move','line':0x198,'pattern':'order_allocation'}]},'exit_alloc':{'kind':'exit','summary':'Escrow\x20exit\x201\x20(settlement\x20/\x20refund):\x20guard-matched\x20allocators\x20distribute\x20the\x20pool.','path':['allocation.alloc\x20(allocation.move:408)','per\x20matched\x20allocator:\x20once-slot\x20(OnceKey{guard,\x20allocator\x20index,\x20key})\x20consumed','Payment<T>\x20created;\x20CoinWrapper<T>\x20transferred\x20to\x20each\x20recipient','recipient\x20unwraps\x20via\x20payment.unwrap\x20/\x20order.owner_receive'],'invariants':['balance\x20>=\x20allocators.threshold\x20(EINSUFFICIENT_BALANCE)','balance\x20>\x200\x20(EZERO_DISTRIBUTION)\x20—\x20replay\x20on\x20drained\x20pool\x20aborts','payment_info\x20must\x20be\x20some\x20(ENO_PAYMENT_INFO)','every\x20allocator\x20with\x20matching\x20guard\x20RUNS,\x20in\x20vector\x20order,\x20against\x20the\x20shrinking\x20pool','once-slot\x20per\x20allocator\x20index\x20makes\x20replay\x20of\x20the\x20same\x20guard\x20abort'],'findings':['A-3'],'sources':[{'file':'allocation.move','line':0x198,'pattern':'public\x20fun\x20alloc<T>'},{'file':'allocation.move','line':0x19f,'pattern':'EZERO_DISTRIBUTION'}]},'exit_compensation':{'kind':'exit','summary':'Escrow\x20exit\x202\x20(arbitration\x20indemnity):\x20service\x20compensation_fund\x20pays\x20order\x20owner\x20directly.','path':['service\x20compensation\x20claim\x20(service.move:494;\x20arbitrations\x20whitelist\x20+\x20E33\x20conflict\x20check\x20at\x20:503-505)','arbitration.compensate\x20->\x20order.compensate\x20writes\x20claimed_by','compensation_fund\x20split\x20->\x20public_transfer\x20to\x20order.owner\x20(service.move:512)'],'invariants':['order\x20must\x20not\x20be\x20already\x20claimed\x20(E_ORDER_ALREADY_CLAIMED)','claiming\x20arbitration\x20must\x20be\x20in\x20service.arbitrations\x20whitelist'],'sources':[{'file':'service.move','line':0x1ee,'pattern':'compensation_claim'},{'file':'service.move','line':0x200,'pattern':'order::owner(order)'},{'file':'order.move','line':0x72,'pattern':'public(package)\x20fun\x20compensate'}]},'dual_rail_fact':{'kind':'fact','summary':'A-3\x20dual\x20rail:\x20alloc\x20never\x20reads\x20claimed_by;\x20compensate\x20never\x20touches\x20the\x20escrow\x20balance.','path':['order.move:238-259\x20(deliberate:\x20refund-of-principal\x20+\x20damages\x20in\x20one\x20case\x20is\x20legal)'],'invariants':['Double-pay\x20prevention\x20is\x20delegated\x20to\x20template\x20convention:\x20refund\x20guard\x20MUST\x20assert\x20claimed_by\x20is\x20none','Tool\x20layer\x20MUST\x20enforce\x20this\x20convention\x20via\x20rule\x20DUAL-RAIL-01\x20—\x20the\x20chain\x20will\x20not'],'findings':['A-3'],'sources':[{'file':'order.move','line':0xee,'pattern':'claimed_by'}]},'buyer_receive':{'kind':'exit','summary':'Buyer\x20claims\x20inbound\x20funds:\x20order.owner_receive\x20unwraps\x20Payment\x20and\x20transfers\x20coin\x20to\x20owner.','path':['order.owner_receive\x20(order.move:260-270,\x20public_transfer\x20to\x20self.owner)'],'invariants':['only\x20order.owner\x20receives'],'sources':[{'file':'order.move','line':0x104,'pattern':'owner_receive'}]},'reward_claim':{'kind':'exit','summary':'Reward\x20pool\x20exit\x201\x20(incentive):\x20guard+passport\x20gated\x20claim\x20transfers\x20coin\x20to\x20recipient.','path':['reward.claim\x20(reward.move:181)\x20->\x20coin\x20to\x20recipient\x20(reward.move:268)'],'invariants':['passport\x20must\x20satisfy\x20the\x20matched\x20RewardGuard'],'sources':[{'file':'reward.move','line':0xb5,'pattern':'public\x20fun\x20claim<T>'}]},'reward_withdraw':{'kind':'exit','summary':'Reward\x20pool\x20exit\x202\x20(balance\x20recovery,\x20ETS-B):\x20permission-gated\x20withdraw\x20leaves\x20inside\x20a\x20Payment\x20object\x20receipt.','path':['reward.withdraw[_and_unwrap]\x20(reward.move:546/:553),\x20precheck\x20E_GUARD_LOCKED_TIME\x20(reward.move:373)','the\x20escrowed\x20coin\x20is\x20wrapped\x20and\x20delivered\x20to\x20the\x20recipient;\x20the\x20reward\x20source\x20is\x20recorded\x20in\x20the\x20payment\x27s\x20source\x20set;\x20payment.create\x20mints\x20the\x20receipt\x20(reward.move:395)','unwrap=true\x20(single\x20PTB):\x20the\x20receipt\x20is\x20unwrapped\x20to\x20the\x20transaction\x20sender\x20in\x20the\x20same\x20transaction\x20(reward.move:419)'],'invariants':['permission\x20index\x20158\x20(REWARD_WITHDRAW)\x20on\x20the\x20Reward\x27s\x20Permission\x20object','blocked\x20while\x20guard_not_added_expiration_time\x20is\x20Some\x20and\x20in\x20the\x20future\x20(E_GUARD_LOCKED_TIME)','claim\x20replay\x20protection\x20(once-slots)\x20is\x20untouched\x20—\x20withdraw\x20never\x20reads\x20recipient\x20records'],'sources':[{'file':'reward.move','line':0x222,'pattern':'public\x20fun\x20withdraw<T>'}]},'treasury_flows':{'kind':'internal','summary':'Treasury:\x20deposit/withdraw/guard-driven\x20external\x20flows;\x20owner_receive\x20bypasses\x20outflow\x20counter.','path':['treasury.deposit\x20/\x20withdraw\x20(external_*_guard\x20driven\x20variants)','treasury.owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow'],'invariants':['inflow\x20and\x20outflow\x20are\x20u128\x20accumulators;\x20conservation\x20audit\x20must\x20read\x20fields,\x20not\x20events'],'sources':[{'file':'treasury.move','line':0x48,'pattern':'public\x20struct\x20Treasury<phantom\x20T>\x20has\x20key'}]},'discount_burn':{'kind':'fact','summary':'A-4:\x20coupon\x20burned\x20unconditionally\x20at\x20buy,\x20even\x20when\x20benchmark\x20unmet\x20(price\x20unchanged).','path':['the\x20discounted\x20quote\x20sets\x20quote.discount=some\x20unconditionally\x20(service.move:351)','the\x20buy\x20path\x20destroys\x20the\x20coupon\x20unconditionally\x20(service.move:469)'],'invariants':['Fix\x20(protocol\x20upgrade,\x20body-level):\x20the\x20discounted\x20quote\x20returns\x20discount:none\x20below\x20benchmark'],'findings':['A-4'],'sources':[{'file':'service.move','line':0x15f,'pattern':'discount'},{'file':'service.move','line':0x1d5,'pattern':'discount_destroy'}]},'conservation_gap':{'kind':'fact','summary':'No\x20on-chain\x20conservation\x20check:\x20accumulator_*\x20are\x20private\x20and\x20sender==@0x0\x20is\x20unreachable.','path':[],'invariants':['Conservation\x20(sum\x20in\x20==\x20sum\x20out\x20+\x20balances)\x20MUST\x20be\x20audited\x20by\x20the\x20tool\x20layer\x20post-materialization\x20(A-14)'],'findings':['A-14'],'sources':[{'file':'service.move','line':0xcf,'pattern':'compensation_fund:\x20Balance<T>'}]}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const GUARD_QUERY_SOURCE='ts-sdk/packages/wowok/src/w/call/guard-ins.ts#GUARDQUERY';export const NATIVE_VALIDATION={'entry':'the\x20native\x20guard-data\x20validation\x20call\x20(guard.move:15),\x20invoked\x20at\x20guard.move:271','semantics':['Query\x20on\x20absent\x20object\x20/\x20unset\x20Option\x20/\x20missing\x20collection\x20entry\x20aborts\x20with\x20VM\x20error\x20(e.g.\x20W_FIELD_NOT_FOUND)\x20—\x20the\x20Guard\x20does\x20NOT\x20silently\x20return\x200.\x20Safe\x20failure\x20mode,\x20NOT\x20a\x20null-bypass\x20risk.','Guard.rep\x20flag:\x20false\x20means\x20the\x20queried\x20object\x20or\x20first\x20parameter\x20failed\x20validation.','Empty-value\x20table\x20constant\x20crashes\x20with\x20MovePrimitiveRuntimeError\x20(A-5):\x20vector::borrow(&item.value,0)\x20without\x20length\x20check.'],'sources':[{'file':'guard.move','line':0xf,'pattern':'native\x20fun\x20validate_guard_data'},{'file':'guard.move','line':0x10f,'pattern':'validate_guard_data(&table_data,\x20input)'},{'file':'guard.move','line':0x76,'pattern':'rep:\x20bool'}]};export const PATH_DEPENDENT_TIME_QUERIES=[{'queryPrefix':'progress.current_time','semantics':'Time\x20of\x20ENTERING\x20the\x20current\x20node\x20(progress.move:458),\x20not\x20of\x20any\x20business\x20event.\x20A\x20buyer\x20leaving\x20a\x20review\x20(detour\x20via\x20reviewed\x20node)\x20postpones\x20merchant\x20settlement\x20windows.','findings':['E-10','D-14'],'sources':[{'file':'progress.move','line':0x55,'pattern':'current_time:\x20u64'}]},{'queryPrefix':'progress.session.forward.time','semantics':'Per-forward\x20last-op\x20time\x20inside\x20the\x20current\x20session;\x20also\x20path-local.','findings':['E-10'],'sources':[{'file':'progress.move','line':0x2d,'pattern':'time:\x20u64'}]}];export const STABLE_TIME_QUERIES=[{'queryPrefix':'order.time','semantics':'Order\x20creation\x20time\x20(order.move:
|
|
1
|
+
export const GUARD_QUERY_SOURCE='ts-sdk/packages/wowok/src/w/call/guard-ins.ts#GUARDQUERY';export const NATIVE_VALIDATION={'entry':'the\x20native\x20guard-data\x20validation\x20call\x20(guard.move:15),\x20invoked\x20at\x20guard.move:271','semantics':['Query\x20on\x20absent\x20object\x20/\x20unset\x20Option\x20/\x20missing\x20collection\x20entry\x20aborts\x20with\x20VM\x20error\x20(e.g.\x20W_FIELD_NOT_FOUND)\x20—\x20the\x20Guard\x20does\x20NOT\x20silently\x20return\x200.\x20Safe\x20failure\x20mode,\x20NOT\x20a\x20null-bypass\x20risk.','Guard.rep\x20flag:\x20false\x20means\x20the\x20queried\x20object\x20or\x20first\x20parameter\x20failed\x20validation.','Empty-value\x20table\x20constant\x20crashes\x20with\x20MovePrimitiveRuntimeError\x20(A-5):\x20vector::borrow(&item.value,0)\x20without\x20length\x20check.'],'sources':[{'file':'guard.move','line':0xf,'pattern':'native\x20fun\x20validate_guard_data'},{'file':'guard.move','line':0x10f,'pattern':'validate_guard_data(&table_data,\x20input)'},{'file':'guard.move','line':0x76,'pattern':'rep:\x20bool'}]};export const PATH_DEPENDENT_TIME_QUERIES=[{'queryPrefix':'progress.current_time','semantics':'Time\x20of\x20ENTERING\x20the\x20current\x20node\x20(progress.move:458),\x20not\x20of\x20any\x20business\x20event.\x20A\x20buyer\x20leaving\x20a\x20review\x20(detour\x20via\x20reviewed\x20node)\x20postpones\x20merchant\x20settlement\x20windows.','findings':['E-10','D-14'],'sources':[{'file':'progress.move','line':0x55,'pattern':'current_time:\x20u64'}]},{'queryPrefix':'progress.session.forward.time','semantics':'Per-forward\x20last-op\x20time\x20inside\x20the\x20current\x20session;\x20also\x20path-local.','findings':['E-10'],'sources':[{'file':'progress.move','line':0x2d,'pattern':'time:\x20u64'}]}];export const STABLE_TIME_QUERIES=[{'queryPrefix':'order.time','semantics':'Order\x20creation\x20time\x20(order.move:151).\x20Never\x20moves.\x20Preferred\x20anchor\x20for\x20settlement/refund\x20windows.'}];export const WRITE_ONLY_QUERY_PREFIXES=[{'queryPrefix':'order.required_info','field':'Order.required_info','findings':['A-1','A-10']},{'queryPrefix':'order.claimed_by','field':'Order.claimed_by','findings':['A-3']},{'queryPrefix':'service.repository','field':'Service.repositories','findings':['A-10']},{'queryPrefix':'service.reward','field':'Service.rewards','findings':['A-10']},{'queryPrefix':'service.sale.wip','field':'Sale.wip','findings':['A-10','A-15']},{'queryPrefix':'machine.consensus_repository','field':'Machine.consensus_repositories','findings':['A-10']}];
|
|
@@ -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.\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
|
+
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':0x14a,'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;\x20the\x20FIELD\x20stays\x20attestation-only\x20(A-1:\x20buy\x20never\x20requires\x20it),\x20but\x20a\x20controlled\x20Proof\x20bind\x20entry\x20(MOV-PROTOCOL-1212\x2011)\x20now\x20chain-enforces\x20proof-about==order\x20&&\x20proof-creator==owner\x20at\x20write\x20time\x20(rejection\x20aborts,\x20nothing\x20written).','source':{'file':'order.move','line':0x3f,'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':0x96,'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':0xa9,'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{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
|
+
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;}const REPO_WHERE_QUERY_TYPES=new Set(['query_repository_data_count_where','query_repository_data_sum_where','query_repository_data_find_where']);function collectRepoWhereQueries(a,b=[]){if(Array['isArray'](a)){for(const c of a)collectRepoWhereQueries(c,b);}else{if(typeof a==='object'&&a!==null){const d=a;typeof d['type']==='string'&&REPO_WHERE_QUERY_TYPES['has'](d['type'])&&b['push'](d);for(const e of Object['values'](d))collectRepoWhereQueries(e,b);}}return b;}function staticStringOperand(a,b){if(typeof a!=='object'||a===null)return undefined;const c=a;if(typeof c['identifier']==='number'){const d=b['find'](e=>typeof e==='object'&&e!==null&&e['identifier']===c['identifier']);if(d===undefined||d['b_submission']===!![])return undefined;return typeof d['value']==='string'?d['value']:undefined;}return typeof c['value']==='string'?c['value']:undefined;}function isPlanLocalObjectOperand(a,b){if(typeof a!=='object'||a===null)return![];const c=a;if(typeof c['identifier']!=='number')return![];const d=b['find'](f=>typeof f==='object'&&f!==null&&f['identifier']===c['identifier']);if(d===undefined||d['b_submission']===!![])return![];const e=d['value'];if(typeof e==='object'&&e!==null)return!![];return typeof e==='string'&&e['startsWith']('$');}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':[],'optionalNodes':[],'forwardGuardRefs':[]};const d=[],e=[],f=[],h=[];for(const k of c){if(typeof k!=='object'||k===null)continue;const l=k,m=typeof l['name']==='string'?l['name']:undefined;if(m===undefined)continue;d['push'](m);if(l['optional']===!![])f['push'](m);const n=Array['isArray'](l['pairs'])?l['pairs']:[];for(const o of n){const q=o,r=q?.['prev_node'];if(typeof r==='string')e['push']({'prev':r,'next':m});const s=Array['isArray'](q?.['forwards'])?q['forwards']:[];for(const t of s){const u=t?.['guard'];if(isRef(u))h['push'](u['$ref']);}}}const i=b['params']['pairs'];if(Array['isArray'](i))for(const v of i){const w=v;typeof w?.['prev_node']==='string'&&typeof w?.['next_node']==='string'&&e['push']({'prev':w['prev_node'],'next':w['next_node']});}const j=new Set(e['map'](x=>x['prev'])['filter'](x=>x!==''));return{'nodes':d,'edges':e,'terminals':d['filter'](x=>!j['has'](x)),'optionalNodes':f,'forwardGuardRefs':h};}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'](P=>[P['id'],guardProjection(P)])),c=allocatorRows(a),d=machineProjection(a),e=createsOf(a,'service')['length']>0x0,f=createsOf(a,'repository')['length']>0x0,h=new Set();for(const P of c){const Q=P['guardStep']===undefined?undefined:b['get'](P['guardStep']);for(const R of Q?.['acceptedNodes']??[])h['add'](R);}const i=new Set(d?.['optionalNodes']??[]),j=(d?.['terminals']??[])['filter'](S=>!i['has'](S)),k=j['find'](S=>!h['has'](S)),l=a['pending_guards']??[],m=l['filter'](S=>S['site']==='allocator')['length'],o=l['filter'](S=>S['site']==='allocator'||S['site']==='machine_edge'),q=l['filter'](S=>S['site']==='service_buy'),t=o[0x0]?.['key'],u=q[0x0]?.['key'],v=d?.['nodes']['find'](S=>/return/i['test'](S)),w=a['steps']['some'](S=>{if(S['op']==='configure'&&S['method']==='arbitrations'){const T=S['params']['objects'];return Array['isArray'](T)&&T['length']>0x0;}if(S['op']==='create'&&S['object']==='service'){const U=S['params']['arbitrations'];return Array['isArray'](U)&&U['length']>0x0;}return![];});let x,y=![];for(const S of a['steps']){if(S['op']==='configure'&&S['method']==='compensation_fund_add'){y=!![];const T=numericAmount(S['params']['balance']);if(T!==undefined)x=(x??0x0)+T;}}let z;const A=U=>{if(!Array['isArray'](U))return;for(const V of U){const W=numericAmount(V?.['price']);if(W!==undefined&&W>0x0)z=Math['max'](z??0x0,W);}};for(const U of a['steps']){if(U['op']==='create'&&U['object']==='service')A(U['params']['sales']);if(U['op']==='configure'&&U['method']==='sales')A(U['params']['sales']);}const B=x!==undefined&&z!==undefined,C=c['filter'](V=>V['track']==='refund'),D=C['map'](V=>V['guardStep']===undefined?undefined:b['get'](V['guardStep']))['find'](V=>V!==undefined&&!V['queries']['some'](W=>W['startsWith']('order.claimed_by')))?.['stepId'];let E,F=![];for(const V of b['values']()){if(V['queries']['some'](isPathDependentTimeQuery)){E??=V['stepId'];if(d!==undefined)for(const W of V['acceptedNodes']){if(pathCountCap2(d['edges'],W)>=0x2){F=!![],E=V['stepId'];break;}}}if(F)break;}const G=[...b['values']()]['flatMap'](X=>X['queries']);let H;for(const X of WRITE_ONLY_ENFORCEMENT_SOURCES){for(const Y of createsOf(a,X['object'])){if(X['extract'](Y)&&!G['some'](Z=>Z['startsWith'](X['coverQuery']))){H=X['param'];break;}}if(H!==undefined)break;}const I=new Set();for(const Z of a['steps']){if(Z['op']==='create'&&Z['object']==='guard')continue;const a0=refsOf(Z['op']==='publish'?Z['target']:Z['params']);for(const a1 of a0)I['add'](a1);if(Z['op']==='configure'){for(const a2 of refsOf(Z['target']))I['add'](a2);}}const J=[...b['keys']()]['find'](a3=>!I['has'](a3)),K=[...b['values']()]['find'](a3=>!f&&a3['queries']['some'](a4=>a4['startsWith']('repository.')))?.['stepId'];let L;if(e&&d!==undefined)for(const a3 of d['forwardGuardRefs']){const a4=b['get'](a3);if(a4===undefined)continue;const a5=a4['table']['some'](a6=>a6['identifier']===0xfe&&a6['b_submission']===!![]);if(!a5){L=a3;break;}}let M;for(const a6 of c){if(a6['guardStep']===undefined||a6['identifierLegs']['length']===0x0)continue;const a7=b['get'](a6['guardStep']);if(a7===undefined)continue;for(const a8 of a6['identifierLegs']){const a9=a7['table']['find'](aa=>aa['identifier']===a8);if(a9===undefined||a9['b_submission']!==!![]||a9['value_type']!=='Address'){M='slot\x20'+a8+'\x20of\x20guard\x20\x27'+a6['guardStep']+'\x27';break;}}if(M!==undefined)break;}const N=new Set();for(const aa of createsOf(a,'repository')){const ab=aa['params']['policies'];if(!Array['isArray'](ab))continue;for(const ac of ab){const ad=ac?.['name'];if(typeof ad==='string')N['add'](ad);}}const O=[];if(N['size']>0x0)for(const ae of createsOf(a,'guard')){const af=Array['isArray'](ae['params']['table'])?ae['params']['table']:[];for(const ag of collectRepoWhereQueries(ae['params']['root']??ae['params']['logic'])){const ah=staticStringOperand(ag['key'],af);if(ah===undefined)continue;if(!isPlanLocalObjectOperand(ag['object'],af))continue;!N['has'](ah)&&O['push']('\x27'+ah+'\x27\x20in\x20guard\x20\x27'+ae['id']+'\x27');}}return{'has_service':e,'has_machine':d!==undefined,'has_repository':f,'allocator_row_count':c['length'],'refund_row_count':C['length'],'terminal_count':j['length'],'terminal_nodes_display':j['join'](',\x20'),'pending_allocator_guard_count':m,'pending_guard_total':l['length'],...k===undefined?{}:{'first_uncovered_terminal':k},...D===undefined?{}:{'first_refund_guard_missing_claimed_by':D},...E===undefined?{}:{'first_path_dependent_anchor':E},'path_sensitive':F,...H===undefined?{}:{'first_write_only_unenforced_field':H},...J===undefined?{}:{'first_orphan_guard':J},...K===undefined?{}:{'first_repo_query_without_repository':K},...L===undefined?{}:{'first_edge_guard_missing_254':L},...M===undefined?{}:{'first_alloc_slot_missing':M},...t===undefined?{}:{'first_pending_fund_guard':t,'pending_fund_guard_count':o['length'],'pending_fund_guard_keys_display':o['map'](ai=>ai['key'])['join'](',\x20')},...u===undefined?{}:{'first_pending_buy_guard':u,'pending_buy_guard_count':q['length'],'pending_buy_guard_keys_display':q['map'](ai=>ai['key'])['join'](',\x20')},'has_return_rail':v!==undefined,...v===undefined?{}:{'return_rail_node':v},'has_arbitration_binding':w,'fund_topup_present':y,...x===undefined?{}:{'fund_topup_amount':x},...B?{'fund_ceiling_breach':x<MAX_INDEMNITY_MULTIPLE*z,'fund_ceiling_basis':MAX_INDEMNITY_MULTIPLE+'x\x20the\x20highest\x20SKU\x20price'}:{},'fund_ceiling_unverifiable':y&&!B,...N['size']>0x0?{'repo_policy_keys_display':[...N]['join'](',\x20'),...O['length']>0x0?{'repo_gate_key_unbacked_count':O['length'],'first_repo_gate_key_unbacked':O[0x0],'repo_gate_key_unbacked_display':O['join'](',\x20')}:{}}:{}};}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};}
|
|
@@ -6,6 +6,12 @@ export interface GuardSpec {
|
|
|
6
6
|
template_id: string;
|
|
7
7
|
host: "service" | "machine" | "reward" | "repository" | "arbitration";
|
|
8
8
|
purpose: string;
|
|
9
|
+
policy?: {
|
|
10
|
+
name?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
id_from?: string;
|
|
13
|
+
value_type?: string;
|
|
14
|
+
};
|
|
9
15
|
step_id?: string;
|
|
10
16
|
}
|
|
11
17
|
export type GuardResolution = {
|
|
@@ -17,8 +23,10 @@ export type GuardResolution = {
|
|
|
17
23
|
description?: string;
|
|
18
24
|
table: unknown[];
|
|
19
25
|
root: unknown;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "omit";
|
|
20
28
|
};
|
|
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";
|
|
29
|
+
export type CompileBlockerCode = "MACHINE_EDGES_MISSING" | "EDGE_UNKNOWN_PREV" | "GUARD_CYCLE" | "GUARD_KEY_UNKNOWN" | "GUARD_TEMPLATE_PARAMS" | "GUARD_RESOLUTION_UNKNOWN" | "GUARD_OMIT_UNSUPPORTED" | "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" | "REPO_GUARD_POLICY_MISSING" | "RAIL_TERMINAL_UNCOVERED" | "RAIL_AWARD_EXIT_MISSING" | "RAIL_POLARITY_COLLISION" | "RAIL_DEAD_LITERAL" | "FORWARD_GUARD_PINNED_TO_NON_PREV" | "FORWARD_GUARD_IDENTITY_PERM_CONFLICT" | "PAIR_THRESHOLD_UNREACHABLE" | "PAIR_THRESHOLD_SINGLE_OPERATOR";
|
|
22
30
|
export declare const TASK_BINDING_SLOT = 254;
|
|
23
31
|
export interface CompileBlocker {
|
|
24
32
|
code: CompileBlockerCode;
|
|
@@ -35,5 +43,6 @@ export interface CompileResult {
|
|
|
35
43
|
guardSpecs: GuardSpec[];
|
|
36
44
|
unresolved: GuardSpec[];
|
|
37
45
|
blockers: CompileBlocker[];
|
|
46
|
+
omitted: string[];
|
|
38
47
|
}
|
|
39
48
|
export declare function compileTemplate(template: CompilableTemplate, inputs: Record<string, JsonValue>, options?: CompileOptions): CompileResult;
|
|
@@ -1 +1 @@
|
|
|
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};}
|
|
1
|
+
import{fillGuardTemplate}from'../knowledge/guard-templates.js';import{SV2_UNARMED_PRESCRIPTION}from'../knowledge/protocol-facts.js';import{verifyAllocatorRails}from'../knowledge/allocator-rail-verifier.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 h=d['nameBase']??a['id']['replace'](/\//g,'_'),i=d['merchantPermissionIndex']??0x3e8,j=[],k=[],l=new Set();for(const a4 of a['conditional_guards']??[]){const a5=b[a4['param']]??a['fee_params'][a4['param']];if(a5!==a4['emit_value'])l['add'](a4['guard_key']);}const o=new Map();for(const a6 of a['conditional_guards']??[]){o['set'](a6['param'],(o['get'](a6['param'])??0x0)+0x1);}const p=new Set((a['conditional_guards']??[])['filter'](a7=>(o['get'](a7['param'])??0x0)>0x1)['map'](a7=>a7['guard_key'])),q=new Set([...l]['filter'](a7=>p['has'](a7))),s=q['size']>0x0?a['machine_shape']['map'](a7=>({...a7,'from':(a7['from']??[])['filter'](a8=>typeof a8==='string'||a8['guard_key']===undefined||!q['has'](a8['guard_key']))})):a['machine_shape'],t=q['size']>0x0?(a['allocator']['rows']??[])['filter'](a7=>a7['guard_key']===undefined||!q['has'](a7['guard_key'])):a['allocator']['rows']??[],u=[];for(const [a7,a8]of Object['entries'](d['guardResolutions']??{})){if(a8?.['kind']==='omit')u['push'](a7);}const v=new Set();if(u['length']>0x0){const a9=new Set(s['flatMap'](ab=>(ab['from']??[])['map'](ac=>typeof ac==='string'?undefined:ac['guard_key'])['filter'](ac=>typeof ac==='string'))),aa=new Set(t['map'](ab=>ab['guard_key'])['filter'](ab=>typeof ab==='string'));for(const ab of u){const ac=a['guards']['find']((ae,af)=>(ae['key']??ae['template_id']+'#'+af)===ab);if(ac===undefined)continue;const ad=[];if(a9['has'](ab))ad['push']('a\x20machine\x20forward\x20edge\x20(guard_key)');if(aa['has'](ab))ad['push']('an\x20allocator\x20rail\x20row\x20(guard_key)');if(ac['policy']!==undefined)ad['push']('a\x20Repository\x20write-policy\x20credential\x20(policy)');if(ac['host']==='service'&&ab==='buy')ad['push']('the\x20Service\x20buy\x20gate\x20(buy_guard)');ad['length']>0x0?j['push']({'code':'GUARD_OMIT_UNSUPPORTED','detail':'guard_resolutions[\x27'+ab+'\x27]\x20=\x20{kind:\x27omit\x27}\x20refused:\x20this\x20design\x20is\x20bound\x20to\x20'+ad['join']('\x20and\x20')+'\x20—\x20'+'omitting\x20it\x20would\x20orphan\x20the\x20binding\x20(open\x20rail\x20/\x20open\x20write\x20/\x20ungated\x20purchase).\x20'+'Fold\x20the\x20design\x27s\x20intent\x20into\x20the\x20bound\x20site\x20instead,\x20or\x20keep\x20the\x20guard\x20resolved.'}):v['add'](ab);}}const w=a['guards']['map']((ae,af)=>({'key':ae['key']??ae['template_id']+'#'+af,'template_id':ae['template_id'],'host':ae['host'],'purpose':ae['purpose'],'policy':ae['policy']}))['filter'](ae=>!l['has'](ae['key'])&&!v['has'](ae['key'])),x=new Map(w['map'](ae=>[ae['key'],ae])),y=new Map(),z=[],A=w['map'](ae=>ae['key']);for(const ae of Object['keys'](d['guardResolutions']??{})){if(v['has'](ae))continue;!x['has'](ae)&&j['push']({'code':'GUARD_RESOLUTION_UNKNOWN','detail':'guard_resolutions\x20key\x20\x27'+ae+'\x27\x20matches\x20no\x20guard\x20spec\x20key\x20declared\x20by\x20\x27'+h+'\x27.\x20'+('Legal\x20keys:\x20'+(A['length']>0x0?A['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 af of w){const ag='guard_'+safeId(af['key']),ah=d['guardResolutions']?.[af['key']];let ai=af['purpose'],aj,ak;if(ah?.['kind']==='inline')aj=ah['table'],ak=ah['root'],ai=ah['description']??af['purpose'];else{const al=ah?.['kind']==='template'?ah['template_id']:af['template_id']['startsWith']('tpl_')?af['template_id']:undefined;if(al!==undefined){const am={'service_name':h+'_service',...a['fee_params'],...b,...ah?.['kind']==='template'?ah['params']:{}},an=fillGuardTemplate(al,am);!an['ok']?j['push']({'code':'GUARD_TEMPLATE_PARAMS','detail':'guard\x20\x27'+af['key']+'\x27\x20('+al+'):\x20'+an['error']}):(aj=an['table'],ak=an['root']);}}aj!==undefined?(y['set'](af['key'],{'stepId':ag,'description':ai,'table':aj,'root':ak}),af['step_id']=ag):z['push'](af);}const B=new Set(s['flatMap'](ao=>(ao['from']??[])['map'](ap=>typeof ap==='string'?undefined:ap['guard_key'])['filter'](ap=>typeof ap==='string')));for(const ao of t){typeof ao['guard_key']==='string'&&ao['recipient']==='guard_identifier'&&ao['recipient_key']==='254'&&B['add'](ao['guard_key']);}const C=new Set();for(const ap of w){if(!B['has'](ap['key']))continue;const aq=y['get'](ap['key']);if(aq===undefined)continue;const ar=aq['table']['some'](as=>as['identifier']===TASK_BINDING_SLOT);if(ar)continue;y['set'](ap['key'],{...aq,'table':[...aq['table'],{'identifier':TASK_BINDING_SLOT,'b_submission':!![],'value_type':'Address','name':'task_binding\x20order\x20anchor\x20(protocol\x20slot\x20254;\x20written\x20by\x20order\x20creation)'}]}),C['add'](ap['key']);}const D=as=>y['get'](as)!==undefined&&refsOf({'table':y['get'](as)['table'],'root':y['get'](as)['root']})['has']('service'),E=as=>{const at=y['get'](as),au=x['get'](as)?.['purpose'];return{'op':'create','id':at['stepId'],'object':'guard','params':P({'description':at['description'],'table':at['table'],'root':at['root']}),'notes':C['has'](as)?(au??'Guard')+'\x20[kernel:\x20protocol\x20slot\x20254\x20(task\x20binding)\x20auto-declared]':au};};k['push']({'op':'create','id':'permission','object':'permission','params':{'name':h+'_permission'}});const F=a['arbitration_mode']!==undefined&&a['arbitration_mode']!=='none';F&&k['push']({'op':'create','id':'permission_arb','object':'permission','params':{'name':h+'_arb_permission'},'notes':'MUST\x20be\x20created\x20by\x20a\x20different\x20account\x20than\x20the\x20service\x20permission\x20'+'(E_ARBITRATION_PERMISSION_CONFLICT=33):\x20dispute\x20neutrality.'});k['push']({'op':'create','id':'contact','object':'contact','params':{'name':h+'_contact'},'notes':'R8:\x20customer-service\x20channel;\x20mandatory\x20when\x20customer_required\x20is\x20set.'});const G=new Set(['wip_provenance','subscription_with_proof']),H=Array['isArray'](b['adopted_module_ids'])?b['adopted_module_ids']['filter'](as=>typeof as==='string'):[],I=w['some'](as=>as['host']==='repository'||as['template_id']==='pattern.repository_data_check'||as['template_id']==='pattern.repository_write_authorization')||H['some'](as=>G['has'](as)),J=b['review_mode'],K=J==='review'||J==='review_reward'||J==='none'?J:undefined,L=K??a['review_mode']??'none',M=h+'_review_reward',N=as=>{const at=new Set(),au=av=>{if(Array['isArray'](av)){for(const ax of av)au(ax);return;}if(typeof av!=='object'||av===null)return;const aw=av;if(typeof aw['type']==='string'&&aw['type']['startsWith']('query_reward_record')){const ay=aw['object'];if(ay!==undefined&&typeof ay['identifier']==='number')at['add'](ay['identifier']);}for(const az of Object['values'](aw))au(az);};return au(as),at;},O=L==='review_reward'?w['find'](as=>as['host']==='reward'):undefined;if(L==='review_reward'&&O?.['step_id']!==undefined){const as=y['get'](O['key']);if(as!==undefined){const at=N(as['root']);y['set'](O['key'],{...as,'table':as['table']['map'](au=>{const av=au;if(av['b_submission']===!![]||!at['has'](av['identifier']))return au;return{...av,'value':{'$late':{'by':'local_name','mark':M}}};})});}k['push']({'op':'create','id':'reward_review','object':'reward','params':P({'name':M,'description':'Review\x20incentive\x20pool\x20(sale-time\x20planned;\x20terms\x20disclosed\x20at\x20quote/buy):\x20claim\x20gated\x20by\x20guard\x20\x27'+O['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§四).\x20'+'[ZR-08:\x20created\x20BEFORE\x20its\x20claim\x20guard\x20—\x20the\x20guard\x27s\x20Reward-address\x20row\x20freezes\x20at\x20creation\x20and\x20binds\x20this\x20pool\x20by\x20local\x20name]'});}const Q=[];for(const [au]of y){D(au)?Q['push'](au):k['push'](E(au));}if(I){const av=Array['isArray'](b['repository_policies'])?b['repository_policies']['filter'](ay=>typeof ay==='object'&&ay!==null):[],aw=[...av],ax=new Set(av['map'](ay=>ay['name']));for(const ay of w){if(ay['host']!=='repository'||ay['step_id']===undefined)continue;const az='host:\x22repository\x22\x20guard\x20\x27'+ay['key']+'\x27\x20(step\x20\x27'+ay['step_id']+'\x27)';if(ay['policy']===undefined){j['push']({'code':'REPO_GUARD_POLICY_MISSING','detail':az+'\x20declares\x20no\x20policy\x20on\x20the\x20guards[]\x20entry.\x20Its\x20Repository\x20policy\x20'+'(name\x20/\x20id_from\x20/\x20value_type)\x20is\x20business\x20data\x20the\x20kernel\x20must\x20not\x20fabricate,\x20'+'and\x20an\x20unbound\x20repository\x20guard\x20is\x20an\x20orphan\x20create\x20that\x20leaves\x20the\x20Repository\x20'+'open\x20to\x20any\x20writer.\x20Add\x20policy:{name,\x20id_from,\x20value_type}\x20to\x20the\x20spec,\x20or\x20bind\x20'+'the\x20guard\x20through\x20repository_policies\x20inputs\x20with\x20this\x20guard\x27s\x20own\x20write_guard\x20shape.'});continue;}if(D(ay['key'])){j['push']({'code':'REPO_GUARD_POLICY_MISSING','detail':az+'\x20refs\x20the\x20service,\x20so\x20it\x20is\x20created\x20AFTER\x20the\x20service\x20draft\x20—\x20but\x20the\x20'+'Repository\x20freezes\x20its\x20policies\x20at\x20creation,\x20which\x20happens\x20before.\x20Resolve\x20this\x20'+'guard\x20without\x20a\x20service\x20reference\x20(the\x20writers\x20are\x20asserted\x20by\x20identity,\x20not\x20by\x20'+'service\x20pin),\x20or\x20bind\x20the\x20policy\x20manually\x20via\x20repository_policies\x20inputs.'});continue;}const aA=ay['policy']['name']??ay['key'];if(ax['has'](aA))continue;aw['push']({'name':aA,'description':ay['policy']['description']??ay['purpose'],'write_guard':[{'guard':ref(ay['step_id'])}],'id_from':ay['policy']['id_from']??'signer','value_type':ay['policy']['value_type']??'String'});}k['push']({'op':'create','id':'repository','object':'repository','params':P({'name':h+'_evidence',...aw['length']>0x0?{'policies':aw}:{}}),'notes':'Evidence\x20rows\x20(tracking\x20hash,\x20receipts,\x20WTS\x20proofs).\x20[HOST-GRAPH-01:\x20created\x20after\x20wave-A\x20guards;\x20write_guard\x20policies\x20synthesized\x20from\x20resolved\x20host:\x22repository\x22\x20specs]'});}const R=new Set(s['map'](aB=>aB['name'])),S=[];for(const aB of s){if(aB['from']===undefined||aB['from']['length']===0x0){j['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(),aE=new Map();for(const aG of aB['from']){const aH=typeof aG==='string'?{'prev':aG}:aG;if(aH['prev']!==''&&!R['has'](aH['prev'])){j['push']({'code':'EDGE_UNKNOWN_PREV','detail':'node\x20\x27'+aB['name']+'\x27\x20edge\x20prev\x20\x27'+aH['prev']+'\x27\x20is\x20not\x20a\x20machine_shape\x20node'});continue;}const aI=aH['operator']??aB['operator']??(aH['prev']===''?'order_payer':'merchant'),aJ={'name':aH['forward']??(aH['prev']===''?'enter_'+aB['name']:aH['prev']+'_to_'+aB['name']),'weight':0x1,...aI==='order_payer'?{'namedOperator':''}:{'permissionIndex':aH['permission_index']??i}};if(aH['guard_key']!==undefined){const aN=x['get'](aH['guard_key']);if(aN===undefined)j['push']({'code':'GUARD_KEY_UNKNOWN','detail':'edge\x20\x27'+aH['prev']+'\x27->\x27'+aB['name']+'\x27\x20binds\x20unknown\x20guard_key\x20\x27'+aH['guard_key']+'\x27'});else{for(const aO of aN['purpose']['matchAll'](/progress\.current\s*==\s*([a-z0-9_]+)/g)){const aP=aO[0x1];R['has'](aP)&&aP!==aH['prev']&&j['push']({'code':'FORWARD_GUARD_PINNED_TO_NON_PREV','detail':'edge\x20\x27'+aH['prev']+'\x27->\x27'+aB['name']+'\x27\x20guard\x20\x27'+aN['key']+'\x27\x20pins\x20progress.current\x20==\x20\x27'+aP+'\x27,\x20but\x20a\x20'+('forward\x20guard\x20evaluates\x20BEFORE\x20the\x20advance\x20(progress.current\x20==\x20prev\x20\x27'+aH['prev']+'\x27),\x20so\x20the\x20pin\x20')+'can\x20never\x20pass\x20—\x20dead\x20rail\x20(bkng\x20F22).\x20Keep\x20the\x20pin\x20on\x20the\x20allocator\x20row\x20(evaluated\x20at\x20alloc,\x20'+'current\x20=\x20the\x20reached\x20node);\x20put\x20only\x20time/identity\x20legs\x20on\x20the\x20forward.'});}aN['template_id']==='pattern.identity_check_order_holder'&&aI!=='order_payer'&&j['push']({'code':'FORWARD_GUARD_IDENTITY_PERM_CONFLICT','detail':'edge\x20\x27'+aH['prev']+'\x27->\x27'+aB['name']+'\x27\x20guard\x20\x27'+aN['key']+'\x27\x20is\x20an\x20order-holder\x20(buyer)\x20identity\x20'+'check\x20but\x20the\x20forward\x20rides\x20a\x20permissionIndex\x20rail\x20(merchant-side\x20slot).\x20The\x20identity\x20layer\x20'+'runs\x20BEFORE\x20the\x20guard,\x20and\x20the\x20two\x20signer\x20sets\x20are\x20disjoint\x20—\x20nobody\x20can\x20pass\x20both\x20(bkng\x20F23).\x20'+'Use\x20operator\x20\x27order_payer\x27\x20(namedOperator\x20\x22\x22\x20—\x20the\x20buyer\x20self-advance)\x20for\x20this\x20edge.'}),aN['step_id']!==undefined&&(D(aN['key'])?j['push']({'code':'GUARD_CYCLE','detail':'edge\x20\x27'+aH['prev']+'\x27->\x27'+aB['name']+'\x27\x20binds\x20guard\x20\x27'+aN['key']+'\x27\x20which\x20itself\x20'+'refs\x20the\x20service\x20(created\x20after\x20the\x20machine)\x20—\x20an\x20F-05\x20cycle.\x20Rebind\x20or\x20split\x20the\x20guard.'}):aJ['guard']=ref(aN['step_id']));}}const aK=aD['get'](aH['prev']);aK!==undefined?aK['push'](aJ):aD['set'](aH['prev'],[aJ]);const aL=aE['get'](aH['prev']),aM=aI==='order_payer'?'namedOperator:':'permissionIndex:'+(aH['permission_index']??i);aL!==undefined?aL['add'](aM):aE['set'](aH['prev'],new Set([aM]));}const aF=aB['threshold']??0x0;for(const [aQ,aR]of aD){aF>aR['length']&&j['push']({'code':'PAIR_THRESHOLD_UNREACHABLE','detail':'node\x20\x27'+aB['name']+'\x27\x20pair\x20from\x20\x27'+(aQ===''?'(entry)':aQ)+'\x27\x20declares\x20threshold\x20'+aF+'\x20'+('but\x20the\x20pair\x20merges\x20only\x20'+aR['length']+'\x20forward(s)\x20at\x20weight\x201\x20each\x20—\x20the\x20pair\x20can\x20never\x20')+'migrate\x20and\x20the\x20publish\x20aborts.\x20Add\x20one\x20distinct-operator\x20forward\x20per\x20required\x20signature,\x20or\x20'+'lower\x20the\x20threshold\x20to\x20the\x20forward\x20count.'});if(aF>=0x2){const aS=aE['get'](aQ)?.['size']??0x0;aS<0x2&&j['push']({'code':'PAIR_THRESHOLD_SINGLE_OPERATOR','detail':'node\x20\x27'+aB['name']+'\x27\x20pair\x20from\x20\x27'+(aQ===''?'(entry)':aQ)+'\x27\x20declares\x20threshold\x20'+aF+'\x20'+'but\x20every\x20forward\x20rides\x20the\x20SAME\x20operator\x20rail\x20—\x20one\x20party\x20can\x20tap\x20all\x20of\x20them\x20and\x20the\x20'+'declared\x20dual\x20confirmation\x20silently\x20dissolves\x20(each\x20forward\x20locks\x20to\x20its\x20first\x20operator).\x20'+'Give\x20each\x20required\x20signature\x20its\x20own\x20rail\x20(e.g.\x20permission_index\x201001\x20+\x20operator\x20\x27order_payer\x27).'});}aC['push']({'prev_node':aQ,'threshold':aF,'forwards':aR});}S['push']({'name':aB['name'],...aB['semantic_role']!==undefined?{'role':aB['semantic_role']}:{},...aB['optional']===!![]?{'optional':!![]}:{},'pairs':aC});}k['push']({'op':'create','id':'machine','object':'machine','params':P({'name':h+'_machine','nodes':S})}),k['push']({'op':'publish','id':'machine_publish','target':ref('machine'),'preflight':[{'check':'machine_publish','status':'pending'},{'check':'TASKBIND-01','status':'pending'}]});const T=typeof b['currency']==='string'?b['currency']:'0x2::wow::WOW',U=w['find'](aT=>aT['host']==='service'&&aT['key']==='buy');k['push']({'op':'create','id':'service','object':'service','params':P({'name':h+'_service','type_parameter':T,'permission':ref('permission'),'machine':ref('machine'),'um':ref('contact'),'description':a['id']+'\x20—\x20compiled\x20by\x20composition/compile',...I?{'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 aT of Q)k['push'](E(aT));const V=t['length']>0x0?t:[{'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 aU of V){if(aU['guard_key']!==undefined){let aV=X['get'](aU['guard_key']);aV===undefined&&(aV={'key':aU['guard_key'],'rows':[]},X['set'](aU['guard_key'],aV),W['push'](aV)),aV['rows']['push'](aU);}else W['push']({'rows':[aU]});}const Y=[];for(const aW of W){const aX=[];let aY;for(const b0 of aW['rows']){let b1=b0['value'];b1===undefined&&b0['value_from']!==undefined&&(b1=b[b0['value_from']]??a['fee_params'][b0['value_from']]);if(b1===undefined&&b0['mode']!=='surplus'){j['push']({'code':'ALLOCATOR_VALUE_MISSING','detail':'allocator\x20row\x20('+b0['track']+'/'+b0['recipient']+')\x20has\x20neither\x20value\x20nor\x20a\x20resolvable\x20value_from'});continue;}(b0['fix']!==undefined||b0['fix_from']!==undefined)&&j['push']({'code':'ALLOCATOR_FIX_UNSUPPORTED','detail':'allocator\x20row\x20('+b0['track']+'/'+b0['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.'});aY??=b0['note'];let b2;if(b0['recipient']==='entity')b2={'Entity':{'$late':{'by':'local_name','mark':b0['recipient_key']??'merchant'}}};else{if(b0['recipient']==='guard_identifier'){const b3=Number(b0['recipient_key']??0x0);b2={'GuardIdentifier':b3};const b4=aW['key']!==undefined?y['get'](aW['key']):undefined;if(b4!==undefined){const b5=b4['table']['find'](b6=>b6['identifier']===b3);(b5===undefined||b5['b_submission']!==!![]||b5['value_type']!=='Address')&&j['push']({'code':'GUARD_SLOT_UNKNOWN','detail':'allocator\x20leg\x20{GuardIdentifier:\x20'+b3+'}\x20on\x20guard\x20\x27'+aW['key']+'\x27\x20of\x20\x27'+h+'\x27:\x20the\x20bound\x20'+('Guard\x20table\x20has\x20no\x20slot\x20'+b3+'\x20Address\x20submission\x20row\x20(b_submission:\x20true).\x20On\x20chain\x20the\x20leg\x20')+('reads\x20slot\x20'+b3+'\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\x20code\x2015\x20'+'(ERECIPIENT_NOT_FOR_OBJECT,\x20allocation.move:500-520)\x20and\x20the\x20leg\x27s\x20funds\x20stranded\x20'+'(az3/abnb7\x20mainnet\x20261013:\x20static\x20GuardIdentifier\x20legs\x20bricked\x20every\x20refund\x20rail).\x20'+'Guard/allocators/forwards\x20are\x20all\x20publish-frozen.\x20Anchor\x20the\x20leg\x20on\x20the\x20protocol\x20slot\x20'+'(254\x20—\x20auto-written\x20with\x20the\x20paying\x20order\x20id\x20at\x20order\x20creation)\x20or\x20declare\x20'+('{identifier:\x20'+b3+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20Guard\x20table.')});}}else b2='Signer';}aX['push']({'who':b2,'sharing':String(b1??'0'),'mode':MODE_MAP[b0['mode']]});}if(aX['length']===0x0)continue;const aZ=aW['key']!==undefined?x['get'](aW['key'])?.['step_id']:undefined;aW['key']!==undefined&&!x['has'](aW['key'])&&j['push']({'code':'GUARD_KEY_UNKNOWN','detail':'allocator\x20row\x20('+aW['rows'][0x0]['track']+')\x20binds\x20unknown\x20guard_key\x20\x27'+aW['key']+'\x27'}),Y['push']({...aZ!==undefined?{'guard':ref(aZ)}:{},...aW['key']!==undefined?{'guard_key':aW['key']}:{},'track':aW['rows'][0x0]['track'],'sharing':aX,...aY!==undefined?{'note':aY}:{}});}const Z=W['map'](b6=>{if(b6['key']===undefined)return undefined;const b7=y['get'](b6['key']);return{'key':b6['key'],'track':b6['rows'][0x0]['track'],'table':b7?.['table']??[],'root':b7?.['root']};})['filter'](b6=>b6!==undefined);if(Z['length']>0x0){const b6=verifyAllocatorRails(Z,s['map'](b7=>({'name':b7['name'],'semanticRole':b7['semantic_role']})));for(const b7 of b6){j['push']({'code':b7['code'],'detail':b7['detail']});}}k['push']({'op':'configure','id':'service_allocators','target':ref('service'),'method':'order_allocators','params':P({'description':a['allocator']['description'],'threshold':Number(a['fee_params']['threshold']??a['fee_params']['monthly_rent_amount']??0x0)||0x0,'allocators':Y}),'requires':['machine_publish']});Array['isArray'](b['sales'])&&b['sales']['length']>0x0&&k['push']({'op':'configure','id':'service_sales','target':ref('service'),'method':'sales','params':{'op':'add','sales':b['sales']}});if(L!=='none'){const b8=s['some'](be=>/review/i['test'](be['name']));L==='review'&&!b8&&j['push']({'code':'REVIEW_NODE_MISSING','detail':'review_mode\x20\x27'+L+'\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 b9=w['find'](be=>be['host']==='reward'),ba=s['find'](be=>/review/i['test'](be['name']))?.['name'];let bb,bc;if(ba!==undefined){const be=[];for(const bh of s){for(const bi of bh['from']??[]){const bj=typeof bi==='string'?{'prev':bi,'guard_key':undefined}:bi;be['push']({'prev':bj['prev'],'guard_key':bj['guard_key'],'target':bh['name']});}}const bf=be['find'](bk=>bk['target']===ba&&bk['guard_key']!==undefined)?.['guard_key']??be['find'](bk=>bk['prev']===ba&&bk['guard_key']!==undefined)?.['guard_key'],bg=bf!==undefined?x['get'](bf):undefined;bb=bg?.['step_id'],bc=bf;}bb===undefined&&b9?.['step_id']!==undefined&&(bb=b9['step_id'],bc=b9['key']);const bd=L==='review_reward'&&b9?.['step_id']!==undefined&&bb!==undefined;bd&&k['push']({'op':'create','id':'guard_review_decision','object':'guard','params':P({'description':'Merchant\x20review-decision\x20write\x20credential:\x20only\x20the\x20service\x20provider\x20(permission\x20owner\x20or\x20admin)\x20may\x20write\x20U64\x20decision\x20rows\x20(row\x20id\x20=\x20order\x20address,\x20value\x20=\x20approved\x20payout)\x20under\x20the\x20review\x20repository\x27s\x20\x27review_decision\x27\x20policy.','table':[{'identifier':0x0,'b_submission':!![],'value_type':'Address','name':'order_being_approved'},{'identifier':0x1,'b_submission':![],'value_type':'Address','value':ref('service'),'name':'this_service'},{'identifier':0x2,'b_submission':!![],'value_type':'Address','name':'service_permission'}],'root':{'type':'logic_and','nodes':[{'type':'logic_equal','nodes':[{'type':'query','query':'order.service','object':{'identifier':0x0},'parameters':[]},{'type':'identifier','identifier':0x1}]},{'type':'logic_equal','nodes':[{'type':'query','query':'service.permission','object':{'identifier':0x1},'parameters':[]},{'type':'identifier','identifier':0x2}]},{'type':'logic_or','nodes':[{'type':'logic_equal','nodes':[{'type':'query','query':'permission.owner','object':{'identifier':0x2},'parameters':[]},{'type':'context','context':'Signer'}]},{'type':'query','query':'permission.admin\x20has','object':{'identifier':0x2},'parameters':[{'type':'context','context':'Signer'}]}]}]}}),'notes':'REVIEW-DECISION\x20write\x20credential\x20(allocator\x20dynamic-permission\x20shape,\x20service\x20pinned\x20by\x20plan\x20ref\x20—\x20survives\x20permission\x20rotation).\x20The\x20decision\x20write\x20itself:\x20repository.data_add\x20'+'{name:\x27review_decision\x27,\x20items:[{write_guard:\x27<this\x20guard>\x27,\x20data:[{id:<order\x20address>,\x20data:<approved\x20payout\x20U64>}]}]}\x20with\x20a\x20passport\x20submission\x20carrying\x20the\x20order\x20and\x20the\x20permission.'});if(bb!==undefined){const bk=b['buyer_review_enabled']===!![];k['push']({'op':'create','id':'repository_review','object':'repository','params':P({'name':h+'_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'+bc+'\x27).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','write_guard':[{'guard':ref(bb)}],'id_from':'signer','value_type':'String'},...bk?[{'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'}]:[],...bd?[{'name':'review_decision','description':'Merchant\x20approval\x20ledger\x20for\x20the\x20review\x20bounty\x20(professional\x20form):\x20one\x20U64\x20row\x20per\x20order\x20(id_from=None;\x20row\x20id\x20=\x20the\x20order\x20address;\x20value\x20=\x20approved\x20payout\x20in\x20smallest\x20units).\x20A\x20row\x20whose\x20value\x20>=\x20the\x20promised\x20payout\x20IS\x20the\x20approval\x20the\x20claim\x20guard\x27s\x20decision\x20leg\x20reads\x20(tpl_repository_review_decision_gate).\x20Writes\x20REQUIRE\x20the\x20merchant\x20decision\x20credential\x20(guard\x20step\x20\x27guard_review_decision\x27);\x20buyers\x20hold\x20no\x20write\x20path.','write_guard':[{'guard':ref('guard_review_decision')}],'id_from':'none','value_type':'U64'}]:[]]}),'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.'+(bd?'\x20[review_decision\x20policy\x20frozen\x20AFTER\x20its\x20write\x20credential\x20—\x20the\x20guard\x20exists\x20before\x20this\x20create\x20(HOST-GRAPH-01\x20discipline).]':'')}),k['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(L==='review_reward'){const bl=b9;if(bl===undefined||bl['step_id']===undefined)j['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).\x20The\x20root\x20must\x20also\x20carry\x20the\x20BKN-P2\x20'+'positive-amount\x20leg\x20(order.amount\x20>=\x201)\x20so\x20zero-total\x20orders\x20can\x20never\x20claim.'});else{const bm=b['reward_funding'],bn=y['get'](bl['key']);bn!==undefined&&!rootHasRewardRecordGate(bn['root'])&&j['push']({'code':'REVIEW_REWARD_UNARMED','detail':'review_reward\x20claim\x20guard\x20\x27'+bl['key']+'\x27\x20carries\x20no\x20record-gate:\x20Reward.claim\x20has\x20no\x20order\x20binding\x20of\x20its\x20own\x20'+'(OFN-C1),\x20so\x20a\x20funded\x20pool\x20behind\x20this\x20guard\x20is\x20a\x20replay-drain\x20target.\x20'+SV2_UNARMED_PRESCRIPTION+'\x20—\x20wrapped\x20in\x20'+'logic_and\x20with\x20the\x20identity\x20leg\x20(Signer\x20==\x20order.owner),\x20the\x20BKN-P2\x20positive-amount\x20'+'leg\x20(order.amount\x20>=\x201\x20—\x20zero-total\x20orders\x20must\x20never\x20claim)\x20and\x20the\x20existing\x20checks\x20'+'(see\x20tpl_reward_one_time_claim\x20v55\x20notes;\x20guard-risk\x20R-X1-14\x20audits\x20the\x20built\x20guard).\x20'+'Professional\x20approval\x20form:\x20this\x20plan\x20already\x20emits\x20the\x20decision\x20channel\x20(guard\x20step\x20'+'\x27guard_review_decision\x27\x20+\x20the\x20repository\x27s\x20\x27review_decision\x27\x20policy)\x20—\x20compose\x20the\x20'+'decision\x20leg\x20from\x20tpl_repository_review_decision_gate\x20into\x20the\x20root\x20'+'(find_where\x20over\x20\x27review_decision\x27\x20with\x20vec_contains_address\x20pinning\x20the\x20submitted\x20'+'order)\x20so\x20the\x20bounty\x20pays\x20only\x20merchant-approved\x20orders.\x20'+'Until\x20armed,\x20do\x20not\x20fund\x20the\x20pool.'});let bo;if(bn!==undefined&&rootHasRewardRecordGate(bn['root']))for(const bp of bn['table']){const bq=bp;if(bq['b_submission']===!![]&&String(bq['value_type']??'')['toLowerCase']()==='address'&&(String(bq['object_type']??'')==='Order'||/order/i['test'](String(bq['name']??'')))){bo=bq['identifier'];break;}}k['push']({'op':'configure','id':'reward_review_guard_add','target':ref('reward_review'),'method':'guard_add','params':P({'guard':ref(bl['step_id']),'recipient':{'Signer':'signer'},...bo!==undefined?{'store_from_id':bo}:{}}),'requires':['reward_review'],'notes':'RECIPIENT\x20(crs-mn-261015\x20F-12):\x20recipient\x20is\x20pinned\x20to\x20{Signer:\x27signer\x27}\x20—\x20the\x20claim\x20entry\x20'+'requires\x20recipient\x20==\x20the\x20transaction\x20sender\x20(E_CLAIM_RECIPIENT_NOT_SIGNER\x20otherwise);\x20a\x20GuardIdentifier\x20recipient\x20'+'resolves\x20to\x20the\x20submitted\x20Order\x20and\x20can\x20never\x20be\x20paid.\x20Fill\x20amount\x20=\x20the\x20per-claim\x20bounty\x20'+'(smallest\x20units)\x20when\x20executing.'+(bo!==undefined?'\x20SV-2\x20entry\x20stamp:\x20store_from_id\x20pins\x20the\x20per-order\x20stamp\x20slot\x20(the\x20submitted\x20Order\x20'+'address)\x20so\x20claim\x20records\x20key\x20per\x20order\x20—\x20once\x20per\x20buyer\x20per\x20order\x20(azx7-mn-261014\x20T8).':'')}),k['push']({'op':'configure','id':'service_rewards','target':ref('service'),'method':'rewards','params':P({'op':'add','objects':[ref('reward_review')]}),'requires':['service']}),typeof bm==='string'||typeof bm==='number'?k['push']({'op':'configure','id':'reward_review_coin_add','target':ref('reward_review'),'method':'coin_add','params':{'coin':String(bm)},'requires':['reward_review']}):j['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(F){k['push']({'op':'create','id':'arbitration','object':'arbitration','params':P({'name':h+'_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.'}),k['push']({'op':'configure','id':'service_arbitrations','target':ref('service'),'method':'arbitrations','params':P({'op':'add','objects':[ref('arbitration')]})});const br=b['compensation_fund'];(typeof br==='string'||typeof br==='number')&&k['push']({'op':'configure','id':'service_compensation','target':ref('service'),'method':'compensation_fund_add','params':{'balance':String(br)}});}k['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 a0=new Set(t['map'](bs=>bs['guard_key'])['filter'](bs=>typeof bs==='string')),a1=/^0x[0-9a-fA-F]{20,64}$/,a2=bs=>{const bt=y['get'](bs);if(bt===undefined)return undefined;for(const bu of bt['table']){const bv=bu;if(bv['b_submission']===!![]||bv['value_type']!=='Address')continue;const bw=bv['value'];if(typeof bw==='string'&&a1['test'](bw))return String(bv['identifier']??'?');}return undefined;};for(const bs of y['keys']()){if(!B['has'](bs)&&!a0['has'](bs))continue;const bt=a2(bs);bt!==undefined&&j['push']({'code':'GUARD_FOREIGN_SERVICE','detail':'guard\x20\x27'+bs+'\x27\x20pins\x20an\x20on-chain\x20address\x20literal\x20(table\x20slot\x20'+bt+')\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 a3=z['flatMap'](bu=>{const bv=a0['has'](bu['key'])?'allocator':B['has'](bu['key'])?'machine_edge':bu['host']==='service'&&bu['key']==='buy'?'service_buy':undefined;return bv?[{'key':bu['key'],'template_id':bu['template_id'],'host':bu['host'],'site':bv,'purpose':bu['purpose']}]:[];});return{'plan':{'version':0x1,'intent':d['intent']??'compile\x20'+a['id'],'templateId':a['id'],'inputs':b,'steps':k,...a3['length']>0x0?{'pending_guards':a3}:{}},'guardSpecs':w,'unresolved':z,'blockers':j,'omitted':[...v]};}
|
|
@@ -15,3 +15,13 @@ export declare function beginInFlight(op: string, data: unknown, env?: {
|
|
|
15
15
|
}): string;
|
|
16
16
|
export declare function recordInFlightOutcome(markerId: string, result: unknown): void;
|
|
17
17
|
export declare function describeLastInFlight(op: string): string | undefined;
|
|
18
|
+
export declare function lastInFlightMarker(op: string): InFlightRecord | undefined;
|
|
19
|
+
export interface OrderLandedEvent {
|
|
20
|
+
order?: string;
|
|
21
|
+
progress?: string | null;
|
|
22
|
+
service?: string;
|
|
23
|
+
sender?: string;
|
|
24
|
+
time?: string | number;
|
|
25
|
+
digest?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function matchOrderLandedEvent(marker: InFlightRecord, ev: OrderLandedEvent): string | undefined;
|