@wowok/agent-mcp 3.2.9 → 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/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.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/facts.spec.js +1 -1
- package/dist/graph/onchain/field-manifest.js +1 -1
- package/dist/harness/recover.js +1 -1
- package/dist/intent/types.d.ts +1 -1
- package/dist/intent/types.js +1 -1
- package/dist/keeper/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 +15 -5
- package/dist/knowledge/baselines/rules/machine.json +9 -6
- package/dist/knowledge/baselines/rules/plan.json +12 -12
- 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/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-render.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/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/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.js +1 -1
- package/dist/knowledge/tool-constraints.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/normalize.d.ts +1 -1
- package/dist/monitor/normalize.js +1 -1
- package/dist/monitor/types.d.ts +1 -1
- package/dist/monitor/types.js +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.js +1 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.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/schema/benchmark-migration/index.d.ts +5 -1
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/arbitration.d.ts +4 -4
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +39 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +1 -0
- package/dist/schema/call/contact.d.ts +4 -4
- package/dist/schema/call/demand.d.ts +4 -4
- package/dist/schema/call/error-codes.d.ts +1 -1
- package/dist/schema/call/error-codes.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +12 -4
- package/dist/schema/call/order.d.ts +4 -4
- package/dist/schema/call/permission.d.ts +4 -4
- package/dist/schema/call/progress.d.ts +4 -4
- package/dist/schema/call/receipt.d.ts +8 -0
- package/dist/schema/call/receipt.js +1 -1
- package/dist/schema/call/repository.d.ts +4 -4
- package/dist/schema/call/reward.d.ts +24 -4
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +6 -4
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/call/treasury.d.ts +4 -4
- package/dist/schema/common/index.d.ts +2 -2
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/goal/index.d.ts +5 -1
- package/dist/schema/goal/planning.d.ts +10 -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 +10 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/operations.d.ts +35 -22
- package/dist/schema/operations.js +1 -1
- package/dist/schema/query/bi.d.ts +16 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +52 -48
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +1 -0
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +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 +1 -0
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/benchmark_migration_operation.schema.json +27 -3
- package/dist/schemas/bridge_operation.output.json +1 -0
- package/dist/schemas/goal_operation.schema.json +26 -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 +1 -0
- package/dist/schemas/local_history_operation.output.json +1 -0
- package/dist/schemas/local_info_operation.output.json +1 -0
- package/dist/schemas/local_mark_operation.output.json +1 -0
- 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 +40 -0
- package/dist/schemas/onchain_operations.schema.json +573 -104
- package/dist/schemas/onchain_operations_allocation.schema.json +2 -2
- package/dist/schemas/onchain_operations_arbitration.schema.json +11 -7
- package/dist/schemas/onchain_operations_contact.schema.json +9 -5
- package/dist/schemas/onchain_operations_demand.schema.json +9 -5
- package/dist/schemas/onchain_operations_guard.schema.json +342 -4
- package/dist/schemas/onchain_operations_machine.schema.json +17 -5
- package/dist/schemas/onchain_operations_order.schema.json +9 -5
- package/dist/schemas/onchain_operations_permission.schema.json +9 -5
- package/dist/schemas/onchain_operations_progress.schema.json +9 -5
- package/dist/schemas/onchain_operations_repository.schema.json +9 -5
- package/dist/schemas/onchain_operations_reward.schema.json +89 -9
- package/dist/schemas/onchain_operations_service.schema.json +18 -11
- package/dist/schemas/onchain_operations_treasury.schema.json +9 -5
- package/dist/schemas/query_toolkit.output.json +237 -14
- package/dist/schemas/schema_query.schema.json +3 -2
- package/dist/tools/handlers/benchmark-migration.d.ts +45 -1
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.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/onchain.d.ts +12 -0
- package/dist/tools/handlers/onchain.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/registry/agent.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
export const GUARD_FIELD_COGNITION_VERSION='1.1.0';const NUMBER='number\x20(numeric\x20value\x20type)',U64='u64\x20exactly\x20(common::TYPE_U64)',ADDRESS='address\x20or\x20address-compatible\x20object\x20id';export const GUARD_FIELD_SITES=[{'object':'Treasury','field':'external_withdraw_guard[]\x20(AmountFromWithdrawGuard)','mode':'gate+source','extraction':[{'name':'identifier\x20(amount)','meaning':'Exact\x20withdraw\x20amount\x20moved\x20out\x20of\x20the\x20treasury\x20balance','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER,'configCheck':'configuring\x20the\x20external-withdraw\x20guard:\x20the\x20amount\x20slot\x20must\x20carry\x20a\x20declared\x20submission\x20value\x20type\x20and\x20it\x20must\x20be\x20numeric\x20(E_IDENTIFIER_NOT_NUMBER_TYPE)','runtimeFallback':'falls\x20back\x20to\x20the\x20fixed\x20table\x20value\x20when\x20no\x20submission\x20is\x20supplied;\x20if\x20neither\x20exists\x20the\x20tx\x20aborts\x20(E_SUBMISSION_ID_NOT_FOUND)','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20chooses\x20the\x20amount;\x20only\x20the\x20balance\x20check\x20(E_WITHDRAW_BALANCE_INSUFFICIENT)\x20bounds\x20it','fixed\x20origin\x20=\x20same\x20amount\x20every\x20withdrawal;\x20safe\x20default\x20for\x20allowance-style\x20guards','query\x20origin\x20is\x20impossible\x20for\x20this\x20slot\x20—\x20a\x20query\x20can\x20only\x20gate,\x20never\x20supply\x20the\x20amount']},{'name':'store_from_id\x20(optional)','meaning':'Secondary\x20slot\x20decoded\x20as\x20address;\x20recorded\x20in\x20Treasury\x20history\x20Record\x20for\x20traceability','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20on\x20the\x20recorded\x20slot\x20(E_STORE_FROM_ID_NOT_COMPATIBLE)','runtimeFallback':'None\x20->\x20Record.store_from_id\x20=\x20none','riskNotes':['Bookkeeping\x20only;\x20never\x20used\x20as\x20the\x20withdrawal\x20recipient']}],'gateBehavior':'the\x20passport\x20verification\x20against\x20this\x20guard\x20must\x20pass\x20AND\x20the\x20guard\x20address\x20must\x20be\x20registered\x20in\x20the\x20external-withdraw\x20guard\x20list\x20(E_EXTERNAL_WITHDRAW_GUARD_NOT_FOUND)','setterChecklist':['Decide\x20who\x20builds\x20passports\x20against\x20this\x20guard\x20—\x20that\x20party\x20controls\x20a\x20submission-origin\x20amount','Prefer\x20a\x20fixed\x20amount\x20for\x20allowance\x20guards;\x20reserve\x20submission\x20amounts\x20for\x20flows\x20where\x20the\x20passport\x20builder\x20is\x20trusted\x20or\x20the\x20amount\x20is\x20re-verified\x20inside\x20the\x20guard\x20expression\x20(e.g.\x20compare\x20against\x20order.amount\x20via\x20query\x201561)','The\x20RECIPIENT\x20is\x20tx-supplied,\x20not\x20from\x20the\x20guard\x20—\x20constrain\x20it\x20inside\x20the\x20guard\x20expression\x20(e.g.\x20compare\x20a\x20submitted\x20address\x20against\x20an\x20expected\x20one)\x20if\x20destination\x20matters','Check\x20the\x20guard\x27s\x20dependency-eligibility\x20status\x20only\x20matters\x20if\x20this\x20guard\x20will\x20rely\x20on\x20others\x20(relies\x20<=\x204,\x20added\x20first)'],'auditorChecklist':['For\x20each\x20registered\x20guard:\x20classify\x20amount\x20slot\x20as\x20fixed\x20or\x20submission\x20(read\x20b_submission\x20in\x20the\x20table)','If\x20submission:\x20who\x20can\x20hold/build\x20a\x20passport\x20with\x20this\x20guard?\x20Can\x20a\x20stranger\x20drain\x20the\x20treasury\x20up\x20to\x20its\x20balance?','Does\x20the\x20guard\x20expression\x20bind\x20the\x20submission\x20to\x20on-chain\x20state\x20(order,\x20repository\x20data)\x20or\x20is\x20it\x20free-form?','Is\x20the\x20withdrawal\x20recipient\x20constrained\x20anywhere?']},{'object':'Treasury','field':'external_deposit_guard[]\x20(AmountFromDepositGuard)','mode':'gate+source','extraction':[{'name':'identifier\x20(amount,\x20Option)','meaning':'When\x20Some:\x20exact\x20deposit\x20amount\x20split\x20from\x20the\x20coin\x20(remainder\x20returned\x20to\x20caller).\x20When\x20None:\x20whole\x20coin\x20deposited','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER,'configCheck':'same\x20as\x20withdraw:\x20value\x20type\x20must\x20be\x20numeric\x20when\x20Some','runtimeFallback':'None\x20->\x20entire\x20coin\x20deposited;\x20Some\x20->\x20coin::split\x20to\x20`value`,\x20remainder\x20transferred\x20back\x20to\x20sender','riskNotes':['A\x20submission-origin\x20amount\x20below\x20the\x20coin\x20total\x20silently\x20returns\x20the\x20difference\x20to\x20the\x20caller\x20—\x20intended\x20for\x20partial\x20deposits','Deposits\x20cannot\x20steal\x20funds;\x20the\x20risk\x20direction\x20is\x20mis-recorded\x20history\x20only']},{'name':'store_from_id\x20(optional)','meaning':'Address\x20slot\x20recorded\x20on\x20the\x20deposit\x20Record','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check','runtimeFallback':'None\x20->\x20none','riskNotes':['Traceability\x20only']}],'gateBehavior':'passport\x20verification\x20against\x20the\x20guard\x20must\x20pass\x20+\x20guard\x20must\x20be\x20registered\x20(E_EXTERNAL_DEPOSIT_GUARD_NOT_FOUND)','setterChecklist':['None\x20identifier\x20=\x20whole-coin\x20deposit;\x20Some\x20=\x20exact-amount\x20deposit\x20with\x20refund\x20of\x20the\x20remainder'],'auditorChecklist':['Confirm\x20the\x20amount\x20slot\x20origin\x20matches\x20the\x20intended\x20deposit\x20UX\x20(whole\x20vs\x20exact)']},{'object':'Reward','field':'guards[]\x20(RewardGuard)','mode':'gate+source','extraction':[{'name':'recipient\x20(Recipient::GuardIdentifier)','meaning':'Claim\x20payout\x20destination\x20address','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'recipient\x20must\x20be\x20a\x20valid\x20address\x20(E_RECIPIENT_IDENTIFIER_NOT_ADDRESS)','runtimeFallback':'Entity/Signer\x20variants\x20bypass\x20extraction\x20entirely','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20redirects\x20the\x20payout\x20to\x20any\x20address\x20it\x20names']},{'name':'amount\x20(Amount::GuardU64Identifier)','meaning':'Claim\x20size\x20paid\x20from\x20the\x20Reward\x20balance','allowedOrigins':['submission','fixed'],'typeConstraint':U64,'configCheck':'submission\x20value\x20type\x20must\x20be\x20u64\x20(E_AMOUNT_NOT_U64)','runtimeFallback':'Fixed(u64)\x20variant\x20bypasses\x20extraction','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20decides\x20the\x20claim\x20size;\x20only\x20balance\x20and\x20per-recipient\x20record\x20bound\x20it']},{'name':'store_from_id\x20(optional)','meaning':'Address\x20slot\x20recorded\x20in\x20the\x20per-recipient\x20claim\x20Record','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20(E_STORE_FROM_ID_NOT_COMPATIBLE)','runtimeFallback':'None\x20->\x20none\x20(an\x20unstamped\x20record\x20matches\x20NO\x20store_from_id\x20predicate\x20—\x20pin\x20the\x20slot\x20for\x20any\x20per-order\x20replay\x20gate)','riskNotes':['Traceability\x20+\x20replay\x20gate:\x20without\x20a\x20pinned\x20slot\x20a\x20per-order\x20dedup\x20leg\x20cannot\x20bind\x20to\x20a\x20real\x20order\x20id\x20—\x20pin\x20store_from_id\x20for\x20per-order\x20replay\x20protection;\x20slot-less\x20guards\x20can\x20only\x20dedup\x20lifetime-once\x20via\x20record\x20count/exists\x20with\x20an\x20empty\x20where']}],'gateBehavior':'claim:\x20passport\x20verification\x20against\x20the\x20guard\x20must\x20pass\x20+\x20expiration_time\x20check\x20+\x20guard\x20registered\x20(E_GUARD_NOT_FOUND);\x20guard_not_added_expiration_time\x20freezes\x20the\x20guard\x20set','setterChecklist':['Recipient+amount\x20both\x20submission\x20=\x20the\x20passport\x20builder\x20fully\x20controls\x20who\x20gets\x20paid\x20how\x20much\x20—\x20acceptable\x20only\x20for\x20self-service\x20claim\x20flows\x20where\x20the\x20builder\x20IS\x20the\x20beneficiary','expiration_time\x20on\x20the\x20RewardGuard\x20bounds\x20the\x20window\x20(E_GUARD_EXPIRED)'],'auditorChecklist':['For\x20each\x20guard:\x20are\x20recipient/amount\x20fixed\x20or\x20submission?','If\x20submission:\x20does\x20the\x20guard\x20expression\x20bind\x20them\x20to\x20repository\x20data\x20(1167)\x20or\x20an\x20order\x20so\x20the\x20claim\x20is\x20justified?','Is\x20there\x20a\x20per-recipient\x20cap?\x20(Only\x20the\x20historical\x20record\x20total\x20accumulates;\x20there\x20is\x20no\x20per-claim\x20limit.)']},{'object':'Repository','field':'policies[].write_guard[]\x20(PolicyGuard)','mode':'gate+source','extraction':[{'name':'id_from_submission\x20(Option<u8>)','meaning':'Data-record\x20key\x20(address)\x20extracted\x20from\x20the\x20guard\x20instead\x20of\x20caller-supplied','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20(E_INVALID_ID_IN_GUARD_TABLE)','runtimeFallback':'None\x20->\x20id\x20comes\x20from\x20the\x20caller\x20vector\x20or\x20is\x20auto-generated\x20(clock/signer)','riskNotes':['Policy-level\x20conflicts:\x20id_from\x20=\x20Clock/Signer\x20FORBIDS\x20id_from_submission\x20(E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN);\x20id_from\x20=\x20None\x20REQUIRES\x20a\x20non-empty\x20write_guard\x20(E_POLICY_WRITE_GUARD_REQUIRED)']},{'name':'data_from_submission\x20(Option<u8>)','meaning':'Data\x20payload\x20extracted\x20from\x20the\x20guard\x20instead\x20of\x20caller-supplied','allowedOrigins':['submission','fixed'],'typeConstraint':'any\x20repository-supported\x20value\x20type\x20(first\x20byte\x20=\x20value_type)','configCheck':'identifier\x20presence\x20check\x20(E_INVALID_DATA_IN_GUARD_TABLE)','runtimeFallback':'None\x20->\x20data\x20comes\x20from\x20the\x20caller\x20vector','riskNotes':['Entry-point\x20routing\x20differs:\x20the\x20guarded\x20auto-id\x20write\x20consumes\x20data_from_submission;\x20the\x20guarded\x20manual\x20write\x20REJECTS\x20both\x20extraction\x20slots\x20(E_GUARD_SPECIFIED_ID_FROM_SUBMISSION);\x20the\x20mixed\x20guarded\x20write\x20mixes\x20per-guard\x20extraction\x20with\x20caller\x20vectors','Setting\x20an\x20extraction\x20slot\x20on\x20a\x20guard\x20that\x20is\x20only\x20ever\x20used\x20via\x20the\x20guarded\x20manual\x20write\x20silently\x20means\x20\x27unused\x20config\x27\x20—\x20route\x20must\x20match']}],'gateBehavior':'write\x20path\x20must\x20find\x20the\x20guard\x20in\x20the\x20policy\x20(E_GUARD_SPECIFIED_NOT_IN_POLICY)\x20and\x20pass\x20the\x20passport\x20verification\x20or\x20the\x20permission-based\x20verification\x20(impack\x20membership)','setterChecklist':['Match\x20the\x20policy\x20id_from\x20with\x20the\x20guard\x20slots\x20(see\x20conflicts\x20above)','Pick\x20the\x20write\x20entry\x20point\x20first,\x20then\x20decide\x20which\x20extraction\x20slots\x20that\x20entry\x20point\x20actually\x20honors'],'auditorChecklist':['For\x20each\x20write_guard:\x20which\x20entry\x20points\x20can\x20reach\x20it\x20and\x20which\x20slots\x20do\x20those\x20entry\x20points\x20consume?','A\x20policy\x20with\x20write_guard\x20but\x20id_from=None\x20and\x20no\x20extraction\x20slots\x20still\x20gates\x20writes\x20—\x20verify\x20the\x20guard\x20expression\x20actually\x20restricts\x20who\x20can\x20write']},{'object':'Repository','field':'policies[].quote_guard\x20(Option<address>)','mode':'source','extraction':[{'name':'repository.data\x20(query\x201167\x20params:\x20key,\x20id)','meaning':'Read\x20authorization\x20for\x20private\x20repository\x20data\x20inside\x20guard\x20expressions','allowedOrigins':['query'],'typeConstraint':'(String\x20key,\x20Address\x20id)\x20pair','configCheck':'setting\x20the\x20policy\x20quote\x20guard:\x20the\x20guard\x20must\x20be\x20dependency-eligible\x20(relies\x20empty\x20+\x20immutable\x20+\x20rep\x20true,\x20E_NEED_DEPENDENT_GUARD)','runtimeFallback':'None\x20->\x20every\x20repository\x20data-row\x20read\x20aborts\x20for\x20a\x20key\x20protected\x20by\x20a\x20quote_guard\x20the\x20passport\x20does\x20not\x20carry\x20(IMPACK_GUARD_NOT_FOUND):\x20the\x201167\x20fetch\x20and\x20the\x201173/1174/1176\x20predicate\x20queries\x20check\x20the\x20queried\x20key;\x20the\x201177\x20keys-where\x20scan\x20refuses\x20outright\x20when\x20any\x20protected\x20key\x20is\x20uncovered','riskNotes':['The\x20reference\x20gate\x20spans\x20ALL\x20data-row\x20reads,\x20not\x20just\x20the\x20plain\x20fetch:\x20count/sum/find\x20predicates\x20and\x20the\x20keys-where\x20scan\x20hit\x20the\x20same\x20gate,\x20so\x20range/sum\x20probing\x20of\x20a\x20protected\x20value\x20is\x20refused\x20too','The\x20gate\x20runs\x20inside\x20the\x20native\x20verifier\x20against\x20the\x20impack-list\x20snapshot\x20taken\x20before\x20verify()','rep\x20flag\x20comes\x20from\x20the\x20native\x20parse\x20at\x20guard\x20creation\x20—\x20a\x20guard\x20that\x20fails\x20rep\x20cannot\x20serve\x20as\x20quote_guard']}],'gateBehavior':'No\x20direct\x20gate\x20—\x20this\x20guard\x20authorizes\x20DATA\x20READS\x20performed\x20by\x20other\x20guards','setterChecklist':['Only\x20a\x20fresh,\x20immutable,\x20reliance-free\x20guard\x20(meets\x20the\x20dependency-eligibility\x20shape)\x20qualifies','Register\x20it\x20on\x20the\x20same\x20Repository\x20whose\x20data\x20will\x20be\x20quoted'],'auditorChecklist':['Which\x20guards\x20rely\x20on\x20/\x20are\x20bundled\x20with\x20this\x20quote_guard\x20in\x20passports?\x20(impack\x20membership\x20decides)','Is\x20the\x20quoted\x20(key,id)\x20scoped\x20narrowly\x20enough,\x20or\x20does\x20one\x20quote_guard\x20open\x20the\x20whole\x20policy?']},{'object':'Arbitration','field':'voting_guard[]\x20(VotingGuard)','mode':'gate+source','extraction':[{'name':'vote_weight\x20(VoteValue::GuardIdentifier)','meaning':'Voter\x27s\x20weighted\x20voting\x20power','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER+',\x20value\x20<=\x20u32\x20max\x20(E_GUARD_IDENTIFIER_NUMBER_INVALID)','configCheck':'value\x20type\x20must\x20be\x20numeric\x20(E_GUARD_IDENTIFIER_NOT_NUMBER)','runtimeFallback':'FixedValue\x20variant\x20bypasses\x20extraction','riskNotes':['submission\x20origin\x20=\x20the\x20passport\x20builder\x20assigns\x20its\x20own\x20voting\x20weight\x20—\x20dangerous\x20unless\x20the\x20guard\x20expression\x20derives\x20the\x20weight\x20from\x20trusted\x20state\x20(e.g.\x20repository\x20holdings\x20via\x201167)']}],'gateBehavior':'voting\x20through\x20the\x20voting\x20guard:\x20passport\x20verification\x20must\x20pass\x20+\x20guard\x20registered\x20(E_VOTING_GUARD_NOT_FOUND)','setterChecklist':['Empty\x20voting_guard\x20=\x20open\x20voting\x20(everybody);\x20non-empty\x20=\x20only\x20listed\x20guards\x20may\x20vote','FixedValue\x20for\x20equal-weight\x20votes;\x20GuardIdentifier\x20only\x20when\x20the\x20expression\x20can\x20justify\x20the\x20weight'],'auditorChecklist':['If\x20GuardIdentifier:\x20can\x20a\x20voter\x20self-assign\x20a\x20maximal\x20weight\x20by\x20building\x20the\x20passport\x20alone?']},{'object':'Arbitration','field':'usage_guard\x20(Option<address>)','mode':'gate','extraction':[],'gateBehavior':'passport-guarded\x20dispute\x20filing:\x20the\x20passport\x20verification\x20must\x20pass;\x20dispute()\x20without\x20a\x20passport\x20aborts\x20when\x20usage_guard\x20is\x20set\x20(E_NEED_PASSPORT).\x20Set\x20=\x20guarded\x20entry\x20to\x20filing\x20disputes','setterChecklist':['Set\x20to\x20restrict\x20who\x20can\x20open\x20disputes;\x20none\x20=\x20anyone\x20can\x20dispute'],'auditorChecklist':['Check\x20whether\x20disputing\x20requires\x20passing\x20this\x20guard\x20and\x20who\x20can\x20pass\x20it']},{'object':'Service','field':'buy_guard\x20(Option<address>)','mode':'gate','extraction':[],'gateBehavior':'passport-guarded\x20purchase:\x20the\x20passport\x20verification\x20must\x20pass;\x20buy()\x20without\x20a\x20passport\x20aborts\x20when\x20set\x20(E_BUY_GUARD_PASSPORT_REQUIRED)','setterChecklist':['Pure\x20purchase\x20gate:\x20membership/whitelist/KYC\x20style;\x20no\x20slots\x20are\x20extracted'],'auditorChecklist':['Who\x20can\x20pass\x20it;\x20does\x20it\x20gate\x20every\x20sale\x20item\x20equally\x20(it\x20is\x20service-wide,\x20not\x20per-sale)']},{'object':'Demand','field':'guards[]\x20(ServiceGuard)','mode':'gate+source','extraction':[{'name':'service_identifier\x20(Option<u8>)','meaning':'Presented\x20Service\x20address;\x20overrides\x20the\x20caller-supplied\x20service\x20when\x20presenting','allowedOrigins':['submission','fixed'],'typeConstraint':'address\x20slot\x20whose\x20object\x20type\x20must\x20be\x20Service\x20(submission\x20object\x20type\x20validated\x20at\x20guard_add)','configCheck':'object\x20type\x20check\x20against\x20the\x20guard\x20validated\x20table\x20(E_GUARD_IDS_TYPE_ERROR\x20at\x20verify)','runtimeFallback':'None\x20->\x20caller\x20names\x20the\x20presented\x20service\x20directly','riskNotes':['fixed\x20origin\x20hard-pins\x20which\x20Service\x20may\x20answer\x20this\x20Demand\x20through\x20this\x20guard','submission\x20origin\x20lets\x20the\x20passport\x20builder\x20pick\x20any\x20Service\x20—\x20verify\x20the\x20guard\x20expression\x20restricts\x20it']}],'gateBehavior':'presenting\x20with\x20a\x20passport:\x20passport\x20verification\x20must\x20pass\x20+\x20guard\x20registered\x20(E_GUARD_NOT_FOUND)','setterChecklist':['Set\x20service_identifier\x20to\x20pin\x20the\x20answering\x20service;\x20leave\x20None\x20for\x20open\x20presentation'],'auditorChecklist':['Origin\x20of\x20service_identifier;\x20if\x20submission,\x20who\x20can\x20present\x20what']},{'object':'Machine','field':'node.pair.forward.guard\x20(ForwardGuard)','mode':'gate+source','extraction':[{'name':'retained_submission\x20(vector<u8>\x20identifiers)','meaning':'Submission\x20values\x20retained\x20into\x20Progress\x20Holder.retained_submission\x20(e.g.\x20sub-order\x20/\x20procured-service\x20evidence)\x20when\x20the\x20forward\x20executes','allowedOrigins':['submission'],'typeConstraint':'identifiers\x20must\x20exist\x20as\x20submission\x20slots\x20(existence\x20check,\x20E_RETAINED_SUBMISSION_ERROR)','configCheck':'configuring\x20the\x20guarded\x20forward\x20validates\x20the\x20identifiers\x20against\x20the\x20guard\x20table','runtimeFallback':'empty\x20list\x20->\x20gate\x20only,\x20nothing\x20retained;\x20non-empty\x20->\x20the\x20submitted\x20values\x20are\x20copied\x20into\x20the\x20session\x20history','riskNotes':['This\x20is\x20the\x20mechanism\x20that\x20carries\x20sub-order\x20data\x20from\x20an\x20operator\x27s\x20passport\x20into\x20the\x20order\x27s\x20Progress\x20history\x20—\x20downstream\x20analyzers\x20read\x20it\x20(queries\x201266-1268,\x201279)']}],'gateBehavior':'progress\x20node\x20advancement\x20with\x20a\x20passport:\x20guard\x20is\x20the\x20optional\x20pre/post\x20verification\x20layer\x20for\x20advancing\x20a\x20node;\x20namedOperator/permissionIndex\x20can\x20be\x20replaced\x20by\x20a\x20guard','setterChecklist':['Choose\x20which\x20submission\x20slots\x20are\x20worth\x20retaining\x20as\x20durable\x20evidence','Remember\x20the\x20order\x20of\x20verification:\x20dependent\x20guards\x20must\x20be\x20added\x20to\x20the\x20passport\x20first'],'auditorChecklist':['For\x20each\x20guarded\x20forward:\x20does\x20the\x20retained\x20data\x20actually\x20prove\x20the\x20transition\x20claim\x20(sub-order\x20id,\x20amount)?']},{'object':'Allocation','field':'allocators[].guard\x20(Allocator)','mode':'gate+source','extraction':[{'name':'sharing\x20Recipient::GuardIdentifier','meaning':'Payout\x20recipient\x20address\x20for\x20that\x20sharing\x20line','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'recipient\x20must\x20be\x20a\x20valid\x20address\x20(ERECIPIENT_IDENTIFIER_NOT_ADDRESS)','runtimeFallback':'Entity/Signer\x20sharing\x20variants\x20bypass\x20extraction','riskNotes':['submission\x20origin\x20=\x20the\x20passport\x20builder\x20decides\x20the\x20split\x20destination\x20at\x20alloc()\x20time\x20—\x20the\x20ALC1\x20audit\x20treats\x20an\x20unbound\x20recipient\x20as\x20a\x20redirect\x20risk','for_object\x20anchor\x20(protocol\x20139):\x20when\x20the\x20Allocation\x27s\x20payment_info.for_object\x20is\x20Some,\x20alloc()\x20enforces\x20submitted\x20address\x20==\x20for_object\x20and\x20aborts\x20with\x20ERECIPIENT_NOT_FOR_OBJECT\x20(15)\x20on\x20mismatch\x20—\x20the\x20anchor\x20is\x20mechanism-enforced,\x20not\x20advisory','for_object\x20=\x20None\x20carries\x20NO\x20anchor:\x20nothing\x20is\x20enforced\x20on-chain\x20and\x20the\x20recipient\x20semantics\x20are\x20entirely\x20the\x20creator\x27s\x20business\x20(Allocation\x20is\x20a\x20generic\x20component;\x20only\x20host\x20flows\x20that\x20declare\x20a\x20binding\x20get\x20the\x20anchor)']}],'gateBehavior':'alloc:\x20the\x20passed\x20guard\x20address\x20must\x20equal\x20the\x20registered\x20allocator\x20guard;\x20the\x20passport\x20verification\x20must\x20pass;\x20AllocationEvent\x20records\x20which\x20guard\x20ran','setterChecklist':['Bind\x20recipient\x20slots\x20inside\x20the\x20guard\x20expression\x20(signer\x20==\x20authorized\x20party,\x20state\x20==\x20expected\x20scope)\x20exactly\x20as\x20ALC1\x20expects','A\x20submission\x20slot\x20with\x20NO\x20scope\x20binding\x20=\x20HIGH\x20severity\x20finding','When\x20setting\x20payment_info:\x20for_object\x20=\x20Some\x20turns\x20it\x20into\x20an\x20enforced\x20anchor\x20—\x20every\x20GuardIdentifier\x20recipient\x20submission\x20must\x20equal\x20that\x20address\x20or\x20alloc()\x20aborts\x20(code\x2015);\x20verify\x20the\x20anchor\x20matches\x20the\x20intended\x20recipient\x20flow\x20BEFORE\x20create\x20(payment_info\x20is\x20immutable\x20after\x20create)','for_object\x20=\x20None\x20is\x20legal:\x20no\x20on-chain\x20anchor,\x20recipient\x20routing\x20is\x20then\x20purely\x20the\x20creator\x27s\x20design\x20—\x20flag\x20this\x20explicitly\x20in\x20the\x20plan\x20so\x20the\x20user\x20decides'],'auditorChecklist':['Cross-scenario\x20settlement\x20residual:\x20a\x20guard\x20bound\x20to\x20one\x20host\x20but\x20reusable\x20across\x20unrelated\x20callers\x20of\x20other\x20hosts','Every\x20submission\x20recipient\x20slot\x20must\x20have\x20a\x20scope\x20binding\x20(guard\x20expression\x20or\x20payment_info.for_object\x20anchor)\x20—\x20otherwise\x20funds\x20can\x20be\x20redirected','Check\x20payment_info.for_object:\x20Some\x20=\x20confirmed\x20enforced\x20anchor\x20(compare\x20against\x20intended\x20recipients);\x20None\x20=\x20trust-on-creator,\x20no\x20on-chain\x20enforcement\x20of\x20the\x20GuardIdentifier\x20destination']},{'object':'Payment','field':'info.for_guard\x20(PaymentInfo)','mode':'source','extraction':[{'name':'for_guard','meaning':'Provenance:\x20records\x20which\x20guard\x20context\x20produced\x20this\x20payment;\x20creates\x20an\x20object-linker\x20affiliation','allowedOrigins':['fixed'],'typeConstraint':'guard\x20address\x20(set\x20when\x20the\x20payment\x20info\x20is\x20created\x20with\x20a\x20guard\x20attached\x20—\x20the\x20payment_info_with_guard\x20variants)','configCheck':'n/a\x20—\x20plain\x20address\x20copy','runtimeFallback':'None\x20->\x20no\x20provenance','riskNotes':['Not\x20a\x20gate,\x20not\x20a\x20submission\x20slot\x20—\x20pure\x20traceability\x20(queries\x201057/1058,\x201108/1109)']}],'gateBehavior':'None','setterChecklist':['Attach\x20for_guard\x20when\x20the\x20payment\x20originates\x20from\x20a\x20guarded\x20flow'],'auditorChecklist':['Use\x20it\x20to\x20trace\x20payment\x20history\x20back\x20to\x20the\x20guarding\x20decision']},{'object':'Permission','field':'table\x20keys\x20(guard\x20addresses\x20as\x20permission\x20subjects)','mode':'gate','extraction':[],'gateBehavior':'A\x20guard\x20ADDRESS\x20can\x20be\x20granted\x20permission\x20indexes\x20like\x20a\x20user.\x20A\x20passport-asserted\x20operation\x20collects\x20the\x20passport\x20impack\x20guard\x20list\x20and\x20checks\x20permission\x20indexes\x20against\x20it:\x20a\x20passing\x20guard\x20can\x20therefore\x20carry\x20authorization\x20for\x20the\x20whole\x20transaction','setterChecklist':['Granting\x20an\x20index\x20to\x20a\x20guard\x20address\x20delegates\x20that\x20authority\x20to\x20anyone\x20who\x20can\x20pass\x20the\x20guard\x20—\x20treat\x20like\x20a\x20role\x20grant'],'auditorChecklist':['List\x20permission\x20subjects\x20that\x20are\x20guard\x20addresses;\x20evaluate\x20who\x20can\x20pass\x20those\x20guards\x20(they\x20inherit\x20the\x20permission)']}];export const VALUE_ORIGIN_SEMANTICS={'fixed':'Value\x20baked\x20into\x20the\x20guard\x20table\x20(b_submission=false).\x20Deterministic\x20on\x20every\x20use;\x20frozen\x20after\x20create;\x20used\x20as\x20the\x20fallback\x20when\x20no\x20submission\x20is\x20supplied.','submission':'Value\x20supplied\x20by\x20the\x20passport\x20builder\x20at\x20guard_add\x20time\x20(b_submission=true),\x20type-checked\x20against\x20the\x20table.\x20Whoever\x20builds\x20the\x20passport\x20controls\x20the\x20value\x20—\x20always\x20ask\x20who\x20that\x20is.','query':'Value\x20that\x20exists\x20only\x20inside\x20the\x20guard\x20input\x20expression\x20(native\x20query\x20opcodes\x201xxx).\x20It\x20constrains\x20verification\x20(state\x20coupling)\x20but\x20is\x20never\x20extractable;\x20extraction\x20slots\x20must\x20be\x20fixed\x20or\x20submission.'};export const GUARD_PASSPORT_DOCTRINE=['Slot\x20value\x20resolution\x20order:\x20passport\x20submission\x20value\x20->\x20fixed\x20guard\x20table\x20value\x20->\x20abort\x20(E_SUBMISSION_ID_NOT_FOUND).\x20A\x20slot\x20with\x20no\x20submission\x20and\x20no\x20fixed\x20value\x20aborts\x20the\x20host\x20call.','A\x20guard\x20only\x20participates\x20if\x20its\x20passport\x20verification\x20passes,\x20and\x20it\x20must\x20be\x20marked\x20impack\x20when\x20the\x20host\x20extracts\x20data\x20from\x20it\x20(result_for_permission\x20returns\x20impack\x20guards\x20only).','The\x20impack\x20list\x20is\x20snapshotted\x20before\x20verify()\x20runs;\x20repository\x20quote_guard\x20membership\x20is\x20checked\x20against\x20this\x20snapshot\x20inside\x20the\x20native\x20verifier\x20—\x20and\x20the\x20same\x20gate\x20now\x20covers\x20every\x20data-row\x20read\x20(1167\x20fetch,\x201173/1174/1176\x20predicate\x20queries,\x201177\x20keys-where),\x20not\x20just\x20the\x20plain\x20fetch.','relies:\x20a\x20guard\x20may\x20depend\x20on\x20at\x20most\x204\x20other\x20guards\x20(MAX_DEPENDED_COUNT),\x20dependent\x20guards\x20must\x20be\x20added\x20to\x20the\x20passport\x20first,\x20and\x20the\x20combine\x20logic\x20is\x20relies_logic_and\x20(AND\x20default,\x20OR\x20optional).','Dependency\x20eligibility\x20of\x20a\x20guard\x20=\x20relies\x20empty\x20AND\x20immutable\x20AND\x20rep\x20—\x20the\x20only\x20shape\x20accepted\x20as\x20a\x20repository\x20quote_guard\x20or\x20as\x20a\x20relied-upon\x20guard.','Guards\x20are\x20frozen\x20on\x20create\x20(immutable=true);\x20changing\x20a\x20fixed\x20value\x20means\x20deploying\x20a\x20new\x20guard\x20and\x20re-registering\x20it\x20on\x20every\x20host\x20object.','Type\x20checks\x20happen\x20at\x20config\x20time\x20(submission\x20value\x20type\x20/\x20address\x20format\x20/\x20address\x20compatibility)\x20and\x20at\x20passport\x20build\x20time\x20(the\x20first\x20type\x20byte\x20of\x20each\x20submitted\x20value\x20is\x20compared\x20against\x20the\x20table);\x20runtime\x20aborts\x20are\x20the\x20last\x20resort.','Allocation\x20for_object\x20anchor\x20(protocol\x20139):\x20the\x20Allocation\x27s\x20payment_info.for_object,\x20when\x20Some,\x20is\x20enforced\x20inside\x20alloc()\x20—\x20every\x20Recipient::GuardIdentifier\x20submission\x20must\x20equal\x20that\x20address\x20(abort\x20ERECIPIENT_NOT_FOR_OBJECT\x2015).\x20When\x20None,\x20no\x20anchor\x20exists\x20and\x20the\x20GuardIdentifier\x20destination\x20is\x20whoever\x20builds\x20the\x20passport\x27s\x20choice:\x20entirely\x20the\x20creator\x27s\x20business.\x20Allocation\x20is\x20a\x20generic\x20component\x20—\x20the\x20anchor\x20is\x20opt-in\x20per\x20instance,\x20not\x20a\x20host-flow\x20constant.'];export function guardSitesFor(a){return GUARD_FIELD_SITES['filter'](b=>b['object']['toLowerCase']()===a['toLowerCase']());}export function guardCognitionDoctrine(){return['Classify\x20the\x20mode\x20first:\x20pure\x20gate\x20(authorization\x20only),\x20pure\x20source\x20(data\x20only),\x20or\x20gate+source\x20(most\x20money\x20fields).','For\x20every\x20extracted\x20slot,\x20name\x20its\x20origin\x20(fixed\x20/\x20submission\x20/\x20query)\x20before\x20judging\x20safety.','For\x20submission\x20slots,\x20identify\x20the\x20passport\x20builder:\x20that\x20party\x20chooses\x20the\x20value.\x20Trace\x20what\x20constrains\x20it\x20(guard\x20expression,\x20host-side\x20balance/authorization\x20checks).','For\x20fixed\x20slots,\x20remember\x20immutability:\x20the\x20value\x20is\x20policy,\x20changed\x20only\x20by\x20re-issuing\x20the\x20guard.','For\x20query-coupled\x20guards,\x20map\x20each\x20query\x20id\x20to\x20its\x20data\x20dependency\x20(which\x20object,\x20which\x20field)\x20—\x20the\x20guard\x20is\x20only\x20as\x20fresh\x20as\x20the\x20queried\x20state.','Check\x20config-time\x20invariants:\x20type\x20of\x20each\x20slot,\x20registration\x20limits\x20(treasury\x20100\x20deposit\x20/\x20200\x20withdraw\x20/\x20reward\x20200\x20/\x20arbitration\x2050\x20/\x20repository\x2010\x20write\x20guards\x20per\x20policy),\x20relies\x20<=\x204,\x20submission\x20size\x20<=\x20256\x20bytes.','Report\x20any\x20submission\x20slot\x20that\x20decides\x20money\x20destination\x20or\x20amount\x20without\x20a\x20scope\x20binding\x20as\x20a\x20HIGH-severity\x20redirect\x20risk.'];}export const REPOSITORY_WRITE_ROUTE_MATRIX=[{'route':'auto_id_write','purpose':'Unguarded\x20auto-id\x20write:\x20policy\x20has\x20NO\x20write\x20guards\x20and\x20id_from\x20is\x20Clock/Signer.','idSource':'clock','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'policy-write-guard-must-be-empty','abortsOnUnhonoredSlots':![],'removeRoute':'auto_id_remove'},{'route':'auto_id_write_guarded','purpose':'Guarded\x20auto-id\x20write:\x20id\x20auto-generated;\x20the\x20guard\x20authorizes\x20AND\x20may\x20supply\x20the\x20data\x20payload\x20via\x20data_from_submission.','idSource':'clock','dataSource':'submission-if-set-else-caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':!![],'guardRequirement':'specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':![],'removeRoute':'auto_id_remove_guarded'},{'route':'manual_id_write','purpose':'Unguarded\x20manual\x20write:\x20caller\x20supplies\x20id\x20AND\x20data;\x20policy\x20must\x20have\x20no\x20write\x20guards.','idSource':'caller','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'policy-write-guard-must-be-empty','abortsOnUnhonoredSlots':![],'removeRoute':'manual_id_remove'},{'route':'manual_id_write_guarded','purpose':'Guarded\x20manual\x20write:\x20caller\x20supplies\x20id\x20AND\x20data;\x20the\x20guard\x20authorizes\x20only.\x20Extraction\x20slots\x20must\x20be\x20None.','idSource':'caller','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':!![],'removeRoute':'manual_id_remove_guarded'},{'route':'mixed_id_write_guarded','purpose':'Mixed\x20write:\x20per\x20specified\x20guard,\x20id\x20comes\x20from\x20id_from_submission\x20(else\x20caller\x20vector)\x20and\x20data\x20from\x20data_from_submission\x20(else\x20caller\x20vector).\x20Requires\x20policy\x20id_from\x20==\x20NONE.','idSource':'submission-if-set-else-caller','dataSource':'submission-if-set-else-caller','honorsIdFromSubmission':!![],'honorsDataFromSubmission':!![],'guardRequirement':'each-specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':![],'removeRoute':'mixed_id_remove_guarded'},{'route':'mixed_id_remove_guarded','purpose':'Mixed\x20removal:\x20deletes\x20the\x20record\x20whose\x20id\x20is\x20extracted\x20from\x20id_from_submission.\x20Requires\x20the\x20slot\x20to\x20be\x20SET.','idSource':'submission-if-set-else-caller','dataSource':'none','honorsIdFromSubmission':!![],'honorsDataFromSubmission':![],'guardRequirement':'each-specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':!![]}];export function repositoryRouteSlotConflicts(a){const b=[],{idFrom:c,writeGuardCount:d,idFromSubmissionSet:e,dataFromSubmissionSet:f,intendedRoute:g}=a;return c==='none'&&d===0x0&&b['push']('E_POLICY_WRITE_GUARD_REQUIRED:\x20id_from=NONE\x20with\x20an\x20empty\x20write_guard\x20lets\x20anyone\x20mutate\x20the\x20policy\x20data'),c!=='none'&&e&&b['push']('E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN:\x20id\x20is\x20auto-generated\x20(clock/signer);\x20id_from_submission\x20can\x20never\x20fire'),(g==='manual_id_write_guarded'||g==='manual_id_remove_guarded')&&((e||f)&&b['push']('E_GUARD_SPECIFIED_ID_FROM_SUBMISSION:\x20the\x20chosen\x20route\x20rejects\x20every\x20extraction\x20slot;\x20use\x20the\x20mixed\x20guarded\x20write\x20or\x20the\x20guarded\x20auto-id\x20write\x20instead')),g==='auto_id_write_guarded'&&e&&b['push']('id_from_submission\x20is\x20never\x20consumed\x20by\x20the\x20guarded\x20auto-id\x20write\x20(id\x20is\x20auto-generated);\x20the\x20slot\x20is\x20dead\x20config'),g==='mixed_id_write_guarded'&&c!=='none'&&b['push']('E_POLICY_ID_FROM_NONE:\x20the\x20mixed\x20guarded\x20write\x20requires\x20policy\x20id_from=NONE'),g==='mixed_id_remove_guarded'&&!e&&b['push']('E_GUARD_NOT_SPECIFIED_ID_FROM_SUBMISSION:\x20mixed\x20removal\x20has\x20no\x20id\x20source;\x20set\x20id_from_submission\x20or\x20use\x20the\x20guarded\x20manual\x20removal\x20route'),b;}
|
|
1
|
+
export const GUARD_FIELD_COGNITION_VERSION='1.1.0';const NUMBER='number\x20(numeric\x20value\x20type)',U64='u64\x20exactly\x20(common::TYPE_U64)',ADDRESS='address\x20or\x20address-compatible\x20object\x20id';export const GUARD_FIELD_SITES=[{'object':'Treasury','field':'external_withdraw_guard[]\x20(AmountFromWithdrawGuard)','mode':'gate+source','extraction':[{'name':'identifier\x20(amount)','meaning':'Exact\x20withdraw\x20amount\x20moved\x20out\x20of\x20the\x20treasury\x20balance','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER,'configCheck':'configuring\x20the\x20external-withdraw\x20guard:\x20the\x20amount\x20slot\x20must\x20carry\x20a\x20declared\x20submission\x20value\x20type\x20and\x20it\x20must\x20be\x20numeric\x20(E_IDENTIFIER_NOT_NUMBER_TYPE)','runtimeFallback':'falls\x20back\x20to\x20the\x20fixed\x20table\x20value\x20when\x20no\x20submission\x20is\x20supplied;\x20if\x20neither\x20exists\x20the\x20tx\x20aborts\x20(E_SUBMISSION_ID_NOT_FOUND)','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20chooses\x20the\x20amount;\x20only\x20the\x20balance\x20check\x20(E_WITHDRAW_BALANCE_INSUFFICIENT)\x20bounds\x20it','fixed\x20origin\x20=\x20same\x20amount\x20every\x20withdrawal;\x20safe\x20default\x20for\x20allowance-style\x20guards','query\x20origin\x20is\x20impossible\x20for\x20this\x20slot\x20—\x20a\x20query\x20can\x20only\x20gate,\x20never\x20supply\x20the\x20amount']},{'name':'store_from_id\x20(optional)','meaning':'Secondary\x20slot\x20decoded\x20as\x20address;\x20recorded\x20in\x20Treasury\x20history\x20Record\x20for\x20traceability','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20on\x20the\x20recorded\x20slot\x20(E_STORE_FROM_ID_NOT_COMPATIBLE)','runtimeFallback':'None\x20->\x20Record.store_from_id\x20=\x20none','riskNotes':['Bookkeeping\x20only;\x20never\x20used\x20as\x20the\x20withdrawal\x20recipient']}],'gateBehavior':'the\x20passport\x20verification\x20against\x20this\x20guard\x20must\x20pass\x20AND\x20the\x20guard\x20address\x20must\x20be\x20registered\x20in\x20the\x20external-withdraw\x20guard\x20list\x20(E_EXTERNAL_WITHDRAW_GUARD_NOT_FOUND)','setterChecklist':['Decide\x20who\x20builds\x20passports\x20against\x20this\x20guard\x20—\x20that\x20party\x20controls\x20a\x20submission-origin\x20amount','Prefer\x20a\x20fixed\x20amount\x20for\x20allowance\x20guards;\x20reserve\x20submission\x20amounts\x20for\x20flows\x20where\x20the\x20passport\x20builder\x20is\x20trusted\x20or\x20the\x20amount\x20is\x20re-verified\x20inside\x20the\x20guard\x20expression\x20(e.g.\x20compare\x20against\x20order.amount\x20via\x20query\x201561)','The\x20RECIPIENT\x20is\x20tx-supplied,\x20not\x20from\x20the\x20guard\x20—\x20constrain\x20it\x20inside\x20the\x20guard\x20expression\x20(e.g.\x20compare\x20a\x20submitted\x20address\x20against\x20an\x20expected\x20one)\x20if\x20destination\x20matters','Check\x20the\x20guard\x27s\x20dependency-eligibility\x20status\x20only\x20matters\x20if\x20this\x20guard\x20will\x20rely\x20on\x20others\x20(relies\x20<=\x204,\x20added\x20first)'],'auditorChecklist':['For\x20each\x20registered\x20guard:\x20classify\x20amount\x20slot\x20as\x20fixed\x20or\x20submission\x20(read\x20b_submission\x20in\x20the\x20table)','If\x20submission:\x20who\x20can\x20hold/build\x20a\x20passport\x20with\x20this\x20guard?\x20Can\x20a\x20stranger\x20drain\x20the\x20treasury\x20up\x20to\x20its\x20balance?','Does\x20the\x20guard\x20expression\x20bind\x20the\x20submission\x20to\x20on-chain\x20state\x20(order,\x20repository\x20data)\x20or\x20is\x20it\x20free-form?','Is\x20the\x20withdrawal\x20recipient\x20constrained\x20anywhere?']},{'object':'Treasury','field':'external_deposit_guard[]\x20(AmountFromDepositGuard)','mode':'gate+source','extraction':[{'name':'identifier\x20(amount,\x20Option)','meaning':'When\x20Some:\x20exact\x20deposit\x20amount\x20split\x20from\x20the\x20coin\x20(remainder\x20returned\x20to\x20caller).\x20When\x20None:\x20whole\x20coin\x20deposited','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER,'configCheck':'same\x20as\x20withdraw:\x20value\x20type\x20must\x20be\x20numeric\x20when\x20Some','runtimeFallback':'None\x20->\x20entire\x20coin\x20deposited;\x20Some\x20->\x20coin::split\x20to\x20`value`,\x20remainder\x20transferred\x20back\x20to\x20sender','riskNotes':['A\x20submission-origin\x20amount\x20below\x20the\x20coin\x20total\x20silently\x20returns\x20the\x20difference\x20to\x20the\x20caller\x20—\x20intended\x20for\x20partial\x20deposits','Deposits\x20cannot\x20steal\x20funds;\x20the\x20risk\x20direction\x20is\x20mis-recorded\x20history\x20only']},{'name':'store_from_id\x20(optional)','meaning':'Address\x20slot\x20recorded\x20on\x20the\x20deposit\x20Record','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check','runtimeFallback':'None\x20->\x20none','riskNotes':['Traceability\x20only']}],'gateBehavior':'passport\x20verification\x20against\x20the\x20guard\x20must\x20pass\x20+\x20guard\x20must\x20be\x20registered\x20(E_EXTERNAL_DEPOSIT_GUARD_NOT_FOUND)','setterChecklist':['None\x20identifier\x20=\x20whole-coin\x20deposit;\x20Some\x20=\x20exact-amount\x20deposit\x20with\x20refund\x20of\x20the\x20remainder'],'auditorChecklist':['Confirm\x20the\x20amount\x20slot\x20origin\x20matches\x20the\x20intended\x20deposit\x20UX\x20(whole\x20vs\x20exact)']},{'object':'Reward','field':'guards[]\x20(RewardGuard)','mode':'gate+source','extraction':[{'name':'recipient\x20(Recipient::GuardIdentifier)','meaning':'Claim\x20payout\x20destination\x20address','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'recipient\x20must\x20be\x20a\x20valid\x20address\x20(E_RECIPIENT_IDENTIFIER_NOT_ADDRESS)','runtimeFallback':'Entity/Signer\x20variants\x20bypass\x20extraction\x20entirely','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20redirects\x20the\x20payout\x20to\x20any\x20address\x20it\x20names']},{'name':'amount\x20(Amount::GuardU64Identifier)','meaning':'Claim\x20size\x20paid\x20from\x20the\x20Reward\x20balance','allowedOrigins':['submission','fixed'],'typeConstraint':U64,'configCheck':'submission\x20value\x20type\x20must\x20be\x20u64\x20(E_AMOUNT_NOT_U64)','runtimeFallback':'Fixed(u64)\x20variant\x20bypasses\x20extraction','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20decides\x20the\x20claim\x20size;\x20only\x20balance\x20and\x20per-recipient\x20record\x20bound\x20it']},{'name':'store_from_id\x20(optional)','meaning':'Address\x20slot\x20recorded\x20in\x20the\x20per-recipient\x20claim\x20Record','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20(E_STORE_FROM_ID_NOT_COMPATIBLE)','runtimeFallback':'None\x20->\x20none\x20(an\x20unstamped\x20record\x20matches\x20NO\x20store_from_id\x20predicate\x20—\x20pin\x20the\x20slot\x20for\x20any\x20per-order\x20replay\x20gate)','riskNotes':['Traceability\x20+\x20replay\x20gate:\x20without\x20a\x20pinned\x20slot\x20a\x20per-order\x20dedup\x20leg\x20cannot\x20bind\x20to\x20a\x20real\x20order\x20id\x20—\x20pin\x20store_from_id\x20for\x20per-order\x20replay\x20protection;\x20slot-less\x20guards\x20can\x20only\x20dedup\x20lifetime-once\x20via\x20record\x20count/exists\x20with\x20an\x20empty\x20where']}],'gateBehavior':'claim:\x20passport\x20verification\x20against\x20the\x20guard\x20must\x20pass\x20+\x20expiration_time\x20check\x20+\x20guard\x20registered\x20(E_GUARD_NOT_FOUND);\x20guard_not_added_expiration_time\x20freezes\x20the\x20guard\x20set\x20AND\x20blocks\x20balance\x20withdrawal\x20until\x20it\x20elapses','setterChecklist':['Recipient+amount\x20both\x20submission\x20=\x20the\x20passport\x20builder\x20fully\x20controls\x20who\x20gets\x20paid\x20how\x20much\x20—\x20acceptable\x20only\x20for\x20self-service\x20claim\x20flows\x20where\x20the\x20builder\x20IS\x20the\x20beneficiary','expiration_time\x20on\x20the\x20RewardGuard\x20bounds\x20the\x20window\x20(E_GUARD_EXPIRED)'],'auditorChecklist':['For\x20each\x20guard:\x20are\x20recipient/amount\x20fixed\x20or\x20submission?','If\x20submission:\x20does\x20the\x20guard\x20expression\x20bind\x20them\x20to\x20repository\x20data\x20(1167)\x20or\x20an\x20order\x20so\x20the\x20claim\x20is\x20justified?','Is\x20there\x20a\x20per-recipient\x20cap?\x20(Only\x20the\x20historical\x20record\x20total\x20accumulates;\x20there\x20is\x20no\x20per-claim\x20limit.)']},{'object':'Repository','field':'policies[].write_guard[]\x20(PolicyGuard)','mode':'gate+source','extraction':[{'name':'id_from_submission\x20(Option<u8>)','meaning':'Data-record\x20key\x20(address)\x20extracted\x20from\x20the\x20guard\x20instead\x20of\x20caller-supplied','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20(E_INVALID_ID_IN_GUARD_TABLE)','runtimeFallback':'None\x20->\x20id\x20comes\x20from\x20the\x20caller\x20vector\x20or\x20is\x20auto-generated\x20(clock/signer)','riskNotes':['Policy-level\x20conflicts:\x20id_from\x20=\x20Clock/Signer\x20FORBIDS\x20id_from_submission\x20(E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN);\x20id_from\x20=\x20None\x20REQUIRES\x20a\x20non-empty\x20write_guard\x20(E_POLICY_WRITE_GUARD_REQUIRED)']},{'name':'data_from_submission\x20(Option<u8>)','meaning':'Data\x20payload\x20extracted\x20from\x20the\x20guard\x20instead\x20of\x20caller-supplied','allowedOrigins':['submission','fixed'],'typeConstraint':'any\x20repository-supported\x20value\x20type\x20(first\x20byte\x20=\x20value_type)','configCheck':'identifier\x20presence\x20check\x20(E_INVALID_DATA_IN_GUARD_TABLE)','runtimeFallback':'None\x20->\x20data\x20comes\x20from\x20the\x20caller\x20vector','riskNotes':['Entry-point\x20routing\x20differs:\x20the\x20guarded\x20auto-id\x20write\x20consumes\x20data_from_submission;\x20the\x20guarded\x20manual\x20write\x20REJECTS\x20both\x20extraction\x20slots\x20(E_GUARD_SPECIFIED_ID_FROM_SUBMISSION);\x20the\x20mixed\x20guarded\x20write\x20mixes\x20per-guard\x20extraction\x20with\x20caller\x20vectors','Setting\x20an\x20extraction\x20slot\x20on\x20a\x20guard\x20that\x20is\x20only\x20ever\x20used\x20via\x20the\x20guarded\x20manual\x20write\x20silently\x20means\x20\x27unused\x20config\x27\x20—\x20route\x20must\x20match']}],'gateBehavior':'write\x20path\x20must\x20find\x20the\x20guard\x20in\x20the\x20policy\x20(E_GUARD_SPECIFIED_NOT_IN_POLICY)\x20and\x20pass\x20the\x20passport\x20verification\x20or\x20the\x20permission-based\x20verification\x20(impack\x20membership)','setterChecklist':['Match\x20the\x20policy\x20id_from\x20with\x20the\x20guard\x20slots\x20(see\x20conflicts\x20above)','Pick\x20the\x20write\x20entry\x20point\x20first,\x20then\x20decide\x20which\x20extraction\x20slots\x20that\x20entry\x20point\x20actually\x20honors'],'auditorChecklist':['For\x20each\x20write_guard:\x20which\x20entry\x20points\x20can\x20reach\x20it\x20and\x20which\x20slots\x20do\x20those\x20entry\x20points\x20consume?','A\x20policy\x20with\x20write_guard\x20but\x20id_from=None\x20and\x20no\x20extraction\x20slots\x20still\x20gates\x20writes\x20—\x20verify\x20the\x20guard\x20expression\x20actually\x20restricts\x20who\x20can\x20write']},{'object':'Repository','field':'policies[].quote_guard\x20(Option<address>)','mode':'source','extraction':[{'name':'repository.data\x20(query\x201167\x20params:\x20key,\x20id)','meaning':'Read\x20authorization\x20for\x20private\x20repository\x20data\x20inside\x20guard\x20expressions','allowedOrigins':['query'],'typeConstraint':'(String\x20key,\x20Address\x20id)\x20pair','configCheck':'setting\x20the\x20policy\x20quote\x20guard:\x20the\x20guard\x20must\x20be\x20dependency-eligible\x20(relies\x20empty\x20+\x20immutable\x20+\x20rep\x20true,\x20E_NEED_DEPENDENT_GUARD)','runtimeFallback':'None\x20->\x20every\x20repository\x20data-row\x20read\x20aborts\x20for\x20a\x20key\x20protected\x20by\x20a\x20quote_guard\x20the\x20passport\x20does\x20not\x20carry\x20(IMPACK_GUARD_NOT_FOUND):\x20the\x201167\x20fetch\x20and\x20the\x201173/1174/1176\x20predicate\x20queries\x20check\x20the\x20queried\x20key;\x20the\x201177\x20keys-where\x20scan\x20refuses\x20outright\x20when\x20any\x20protected\x20key\x20is\x20uncovered','riskNotes':['The\x20reference\x20gate\x20spans\x20ALL\x20data-row\x20reads,\x20not\x20just\x20the\x20plain\x20fetch:\x20count/sum/find\x20predicates\x20and\x20the\x20keys-where\x20scan\x20hit\x20the\x20same\x20gate,\x20so\x20range/sum\x20probing\x20of\x20a\x20protected\x20value\x20is\x20refused\x20too','The\x20gate\x20runs\x20inside\x20the\x20native\x20verifier\x20against\x20the\x20impack-list\x20snapshot\x20taken\x20before\x20verify()','rep\x20flag\x20comes\x20from\x20the\x20native\x20parse\x20at\x20guard\x20creation\x20—\x20a\x20guard\x20that\x20fails\x20rep\x20cannot\x20serve\x20as\x20quote_guard']}],'gateBehavior':'No\x20direct\x20gate\x20—\x20this\x20guard\x20authorizes\x20DATA\x20READS\x20performed\x20by\x20other\x20guards','setterChecklist':['Only\x20a\x20fresh,\x20immutable,\x20reliance-free\x20guard\x20(meets\x20the\x20dependency-eligibility\x20shape)\x20qualifies','Register\x20it\x20on\x20the\x20same\x20Repository\x20whose\x20data\x20will\x20be\x20quoted'],'auditorChecklist':['Which\x20guards\x20rely\x20on\x20/\x20are\x20bundled\x20with\x20this\x20quote_guard\x20in\x20passports?\x20(impack\x20membership\x20decides)','Is\x20the\x20quoted\x20(key,id)\x20scoped\x20narrowly\x20enough,\x20or\x20does\x20one\x20quote_guard\x20open\x20the\x20whole\x20policy?']},{'object':'Arbitration','field':'voting_guard[]\x20(VotingGuard)','mode':'gate+source','extraction':[{'name':'vote_weight\x20(VoteValue::GuardIdentifier)','meaning':'Voter\x27s\x20weighted\x20voting\x20power','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER+',\x20value\x20<=\x20u32\x20max\x20(E_GUARD_IDENTIFIER_NUMBER_INVALID)','configCheck':'value\x20type\x20must\x20be\x20numeric\x20(E_GUARD_IDENTIFIER_NOT_NUMBER)','runtimeFallback':'FixedValue\x20variant\x20bypasses\x20extraction','riskNotes':['submission\x20origin\x20=\x20the\x20passport\x20builder\x20assigns\x20its\x20own\x20voting\x20weight\x20—\x20dangerous\x20unless\x20the\x20guard\x20expression\x20derives\x20the\x20weight\x20from\x20trusted\x20state\x20(e.g.\x20repository\x20holdings\x20via\x201167)']}],'gateBehavior':'voting\x20through\x20the\x20voting\x20guard:\x20passport\x20verification\x20must\x20pass\x20+\x20guard\x20registered\x20(E_VOTING_GUARD_NOT_FOUND)','setterChecklist':['Empty\x20voting_guard\x20=\x20open\x20voting\x20(everybody);\x20non-empty\x20=\x20only\x20listed\x20guards\x20may\x20vote','FixedValue\x20for\x20equal-weight\x20votes;\x20GuardIdentifier\x20only\x20when\x20the\x20expression\x20can\x20justify\x20the\x20weight'],'auditorChecklist':['If\x20GuardIdentifier:\x20can\x20a\x20voter\x20self-assign\x20a\x20maximal\x20weight\x20by\x20building\x20the\x20passport\x20alone?']},{'object':'Arbitration','field':'usage_guard\x20(Option<address>)','mode':'gate','extraction':[],'gateBehavior':'passport-guarded\x20dispute\x20filing:\x20the\x20passport\x20verification\x20must\x20pass;\x20dispute()\x20without\x20a\x20passport\x20aborts\x20when\x20usage_guard\x20is\x20set\x20(E_NEED_PASSPORT).\x20Set\x20=\x20guarded\x20entry\x20to\x20filing\x20disputes','setterChecklist':['Set\x20to\x20restrict\x20who\x20can\x20open\x20disputes;\x20none\x20=\x20anyone\x20can\x20dispute'],'auditorChecklist':['Check\x20whether\x20disputing\x20requires\x20passing\x20this\x20guard\x20and\x20who\x20can\x20pass\x20it']},{'object':'Service','field':'buy_guard\x20(Option<address>)','mode':'gate','extraction':[],'gateBehavior':'passport-guarded\x20purchase:\x20the\x20passport\x20verification\x20must\x20pass;\x20buy()\x20without\x20a\x20passport\x20aborts\x20when\x20set\x20(E_BUY_GUARD_PASSPORT_REQUIRED)','setterChecklist':['Pure\x20purchase\x20gate:\x20membership/whitelist/KYC\x20style;\x20no\x20slots\x20are\x20extracted'],'auditorChecklist':['Who\x20can\x20pass\x20it;\x20does\x20it\x20gate\x20every\x20sale\x20item\x20equally\x20(it\x20is\x20service-wide,\x20not\x20per-sale)']},{'object':'Demand','field':'guards[]\x20(ServiceGuard)','mode':'gate+source','extraction':[{'name':'service_identifier\x20(Option<u8>)','meaning':'Presented\x20Service\x20address;\x20overrides\x20the\x20caller-supplied\x20service\x20when\x20presenting','allowedOrigins':['submission','fixed'],'typeConstraint':'address\x20slot\x20whose\x20object\x20type\x20must\x20be\x20Service\x20(submission\x20object\x20type\x20validated\x20at\x20guard_add)','configCheck':'object\x20type\x20check\x20against\x20the\x20guard\x20validated\x20table\x20(E_GUARD_IDS_TYPE_ERROR\x20at\x20verify)','runtimeFallback':'None\x20->\x20caller\x20names\x20the\x20presented\x20service\x20directly','riskNotes':['fixed\x20origin\x20hard-pins\x20which\x20Service\x20may\x20answer\x20this\x20Demand\x20through\x20this\x20guard','submission\x20origin\x20lets\x20the\x20passport\x20builder\x20pick\x20any\x20Service\x20—\x20verify\x20the\x20guard\x20expression\x20restricts\x20it']}],'gateBehavior':'presenting\x20with\x20a\x20passport:\x20passport\x20verification\x20must\x20pass\x20+\x20guard\x20registered\x20(E_GUARD_NOT_FOUND)','setterChecklist':['Set\x20service_identifier\x20to\x20pin\x20the\x20answering\x20service;\x20leave\x20None\x20for\x20open\x20presentation'],'auditorChecklist':['Origin\x20of\x20service_identifier;\x20if\x20submission,\x20who\x20can\x20present\x20what']},{'object':'Machine','field':'node.pair.forward.guard\x20(ForwardGuard)','mode':'gate+source','extraction':[{'name':'retained_submission\x20(vector<u8>\x20identifiers)','meaning':'Submission\x20values\x20retained\x20into\x20Progress\x20Holder.retained_submission\x20(e.g.\x20sub-order\x20/\x20procured-service\x20evidence)\x20when\x20the\x20forward\x20executes','allowedOrigins':['submission'],'typeConstraint':'identifiers\x20must\x20exist\x20as\x20submission\x20slots\x20(existence\x20check,\x20E_RETAINED_SUBMISSION_ERROR)','configCheck':'configuring\x20the\x20guarded\x20forward\x20validates\x20the\x20identifiers\x20against\x20the\x20guard\x20table','runtimeFallback':'empty\x20list\x20->\x20gate\x20only,\x20nothing\x20retained;\x20non-empty\x20->\x20the\x20submitted\x20values\x20are\x20copied\x20into\x20the\x20session\x20history','riskNotes':['This\x20is\x20the\x20mechanism\x20that\x20carries\x20sub-order\x20data\x20from\x20an\x20operator\x27s\x20passport\x20into\x20the\x20order\x27s\x20Progress\x20history\x20—\x20downstream\x20analyzers\x20read\x20it\x20(ACTIVE-SESSION\x20queries\x201266-1268\x20+\x201279\x20count;\x20HISTORY-side\x20value\x20read\x20=\x201281\x20progress.history.session.forward.retained_submission.value,\x20which\x20stays\x20readable\x20after\x20the\x20session\x20migrates\x20into\x20history)']}],'gateBehavior':'progress\x20node\x20advancement\x20with\x20a\x20passport:\x20guard\x20is\x20the\x20optional\x20pre/post\x20verification\x20layer\x20for\x20advancing\x20a\x20node;\x20namedOperator/permissionIndex\x20can\x20be\x20replaced\x20by\x20a\x20guard','setterChecklist':['Choose\x20which\x20submission\x20slots\x20are\x20worth\x20retaining\x20as\x20durable\x20evidence','Remember\x20the\x20order\x20of\x20verification:\x20dependent\x20guards\x20must\x20be\x20added\x20to\x20the\x20passport\x20first'],'auditorChecklist':['For\x20each\x20guarded\x20forward:\x20does\x20the\x20retained\x20data\x20actually\x20prove\x20the\x20transition\x20claim\x20(sub-order\x20id,\x20amount)?']},{'object':'Allocation','field':'allocators[].guard\x20(Allocator)','mode':'gate+source','extraction':[{'name':'sharing\x20Recipient::GuardIdentifier','meaning':'Payout\x20recipient\x20address\x20for\x20that\x20sharing\x20line','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'recipient\x20must\x20be\x20a\x20valid\x20address\x20(ERECIPIENT_IDENTIFIER_NOT_ADDRESS)','runtimeFallback':'Entity/Signer\x20sharing\x20variants\x20bypass\x20extraction','riskNotes':['submission\x20origin\x20=\x20the\x20passport\x20builder\x20decides\x20the\x20split\x20destination\x20at\x20alloc()\x20time\x20—\x20the\x20ALC1\x20audit\x20treats\x20an\x20unbound\x20recipient\x20as\x20a\x20redirect\x20risk','for_object\x20anchor\x20(protocol\x20139):\x20when\x20the\x20Allocation\x27s\x20payment_info.for_object\x20is\x20Some,\x20alloc()\x20enforces\x20submitted\x20address\x20==\x20for_object\x20and\x20aborts\x20with\x20ERECIPIENT_NOT_FOR_OBJECT\x20(15)\x20on\x20mismatch\x20—\x20the\x20anchor\x20is\x20mechanism-enforced,\x20not\x20advisory','for_object\x20=\x20None\x20carries\x20NO\x20anchor:\x20nothing\x20is\x20enforced\x20on-chain\x20and\x20the\x20recipient\x20semantics\x20are\x20entirely\x20the\x20creator\x27s\x20business\x20(Allocation\x20is\x20a\x20generic\x20component;\x20only\x20host\x20flows\x20that\x20declare\x20a\x20binding\x20get\x20the\x20anchor)']}],'gateBehavior':'alloc:\x20the\x20passed\x20guard\x20address\x20must\x20equal\x20the\x20registered\x20allocator\x20guard;\x20the\x20passport\x20verification\x20must\x20pass;\x20AllocationEvent\x20records\x20which\x20guard\x20ran','setterChecklist':['Bind\x20recipient\x20slots\x20inside\x20the\x20guard\x20expression\x20(signer\x20==\x20authorized\x20party,\x20state\x20==\x20expected\x20scope)\x20exactly\x20as\x20ALC1\x20expects','A\x20submission\x20slot\x20with\x20NO\x20scope\x20binding\x20=\x20HIGH\x20severity\x20finding','When\x20setting\x20payment_info:\x20for_object\x20=\x20Some\x20turns\x20it\x20into\x20an\x20enforced\x20anchor\x20—\x20every\x20GuardIdentifier\x20recipient\x20submission\x20must\x20equal\x20that\x20address\x20or\x20alloc()\x20aborts\x20(code\x2015);\x20verify\x20the\x20anchor\x20matches\x20the\x20intended\x20recipient\x20flow\x20BEFORE\x20create\x20(payment_info\x20is\x20immutable\x20after\x20create)','for_object\x20=\x20None\x20is\x20legal:\x20no\x20on-chain\x20anchor,\x20recipient\x20routing\x20is\x20then\x20purely\x20the\x20creator\x27s\x20design\x20—\x20flag\x20this\x20explicitly\x20in\x20the\x20plan\x20so\x20the\x20user\x20decides'],'auditorChecklist':['Cross-scenario\x20settlement\x20residual:\x20a\x20guard\x20bound\x20to\x20one\x20host\x20but\x20reusable\x20across\x20unrelated\x20callers\x20of\x20other\x20hosts','Every\x20submission\x20recipient\x20slot\x20must\x20have\x20a\x20scope\x20binding\x20(guard\x20expression\x20or\x20payment_info.for_object\x20anchor)\x20—\x20otherwise\x20funds\x20can\x20be\x20redirected','Check\x20payment_info.for_object:\x20Some\x20=\x20confirmed\x20enforced\x20anchor\x20(compare\x20against\x20intended\x20recipients);\x20None\x20=\x20trust-on-creator,\x20no\x20on-chain\x20enforcement\x20of\x20the\x20GuardIdentifier\x20destination']},{'object':'Payment','field':'info.for_guard\x20(PaymentInfo)','mode':'source','extraction':[{'name':'for_guard','meaning':'Provenance:\x20records\x20which\x20guard\x20context\x20produced\x20this\x20payment;\x20creates\x20an\x20object-linker\x20affiliation','allowedOrigins':['fixed'],'typeConstraint':'guard\x20address\x20(set\x20when\x20the\x20payment\x20info\x20is\x20created\x20with\x20a\x20guard\x20attached\x20—\x20the\x20payment_info_with_guard\x20variants)','configCheck':'n/a\x20—\x20plain\x20address\x20copy','runtimeFallback':'None\x20->\x20no\x20provenance','riskNotes':['Not\x20a\x20gate,\x20not\x20a\x20submission\x20slot\x20—\x20pure\x20traceability\x20(queries\x201057/1058,\x201108/1109)']}],'gateBehavior':'None','setterChecklist':['Attach\x20for_guard\x20when\x20the\x20payment\x20originates\x20from\x20a\x20guarded\x20flow'],'auditorChecklist':['Use\x20it\x20to\x20trace\x20payment\x20history\x20back\x20to\x20the\x20guarding\x20decision']},{'object':'Permission','field':'table\x20keys\x20(guard\x20addresses\x20as\x20permission\x20subjects)','mode':'gate','extraction':[],'gateBehavior':'A\x20guard\x20ADDRESS\x20can\x20be\x20granted\x20permission\x20indexes\x20like\x20a\x20user.\x20A\x20passport-asserted\x20operation\x20collects\x20the\x20passport\x20impack\x20guard\x20list\x20and\x20checks\x20permission\x20indexes\x20against\x20it:\x20a\x20passing\x20guard\x20can\x20therefore\x20carry\x20authorization\x20for\x20the\x20whole\x20transaction','setterChecklist':['Granting\x20an\x20index\x20to\x20a\x20guard\x20address\x20delegates\x20that\x20authority\x20to\x20anyone\x20who\x20can\x20pass\x20the\x20guard\x20—\x20treat\x20like\x20a\x20role\x20grant'],'auditorChecklist':['List\x20permission\x20subjects\x20that\x20are\x20guard\x20addresses;\x20evaluate\x20who\x20can\x20pass\x20those\x20guards\x20(they\x20inherit\x20the\x20permission)']}];export const VALUE_ORIGIN_SEMANTICS={'fixed':'Value\x20baked\x20into\x20the\x20guard\x20table\x20(b_submission=false).\x20Deterministic\x20on\x20every\x20use;\x20frozen\x20after\x20create;\x20used\x20as\x20the\x20fallback\x20when\x20no\x20submission\x20is\x20supplied.','submission':'Value\x20supplied\x20by\x20the\x20passport\x20builder\x20at\x20guard_add\x20time\x20(b_submission=true),\x20type-checked\x20against\x20the\x20table.\x20Whoever\x20builds\x20the\x20passport\x20controls\x20the\x20value\x20—\x20always\x20ask\x20who\x20that\x20is.','query':'Value\x20that\x20exists\x20only\x20inside\x20the\x20guard\x20input\x20expression\x20(native\x20query\x20opcodes\x201xxx).\x20It\x20constrains\x20verification\x20(state\x20coupling)\x20but\x20is\x20never\x20extractable;\x20extraction\x20slots\x20must\x20be\x20fixed\x20or\x20submission.'};export const GUARD_PASSPORT_DOCTRINE=['Slot\x20value\x20resolution\x20order:\x20passport\x20submission\x20value\x20->\x20fixed\x20guard\x20table\x20value\x20->\x20abort\x20(E_SUBMISSION_ID_NOT_FOUND).\x20A\x20slot\x20with\x20no\x20submission\x20and\x20no\x20fixed\x20value\x20aborts\x20the\x20host\x20call.','A\x20guard\x20only\x20participates\x20if\x20its\x20passport\x20verification\x20passes,\x20and\x20it\x20must\x20be\x20marked\x20impack\x20when\x20the\x20host\x20extracts\x20data\x20from\x20it\x20(result_for_permission\x20returns\x20impack\x20guards\x20only).','The\x20impack\x20list\x20is\x20snapshotted\x20before\x20verify()\x20runs;\x20repository\x20quote_guard\x20membership\x20is\x20checked\x20against\x20this\x20snapshot\x20inside\x20the\x20native\x20verifier\x20—\x20and\x20the\x20same\x20gate\x20now\x20covers\x20every\x20data-row\x20read\x20(1167\x20fetch,\x201173/1174/1176\x20predicate\x20queries,\x201177\x20keys-where),\x20not\x20just\x20the\x20plain\x20fetch.','relies:\x20a\x20guard\x20may\x20depend\x20on\x20at\x20most\x204\x20other\x20guards\x20(MAX_DEPENDED_COUNT),\x20dependent\x20guards\x20must\x20be\x20added\x20to\x20the\x20passport\x20first,\x20and\x20the\x20combine\x20logic\x20is\x20relies_logic_and\x20(AND\x20default,\x20OR\x20optional).','Dependency\x20eligibility\x20of\x20a\x20guard\x20=\x20relies\x20empty\x20AND\x20immutable\x20AND\x20rep\x20—\x20the\x20only\x20shape\x20accepted\x20as\x20a\x20repository\x20quote_guard\x20or\x20as\x20a\x20relied-upon\x20guard.','Guards\x20are\x20frozen\x20on\x20create\x20(immutable=true);\x20changing\x20a\x20fixed\x20value\x20means\x20deploying\x20a\x20new\x20guard\x20and\x20re-registering\x20it\x20on\x20every\x20host\x20object.','Type\x20checks\x20happen\x20at\x20config\x20time\x20(submission\x20value\x20type\x20/\x20address\x20format\x20/\x20address\x20compatibility)\x20and\x20at\x20passport\x20build\x20time\x20(the\x20first\x20type\x20byte\x20of\x20each\x20submitted\x20value\x20is\x20compared\x20against\x20the\x20table);\x20runtime\x20aborts\x20are\x20the\x20last\x20resort.','Allocation\x20for_object\x20anchor\x20(protocol\x20139):\x20the\x20Allocation\x27s\x20payment_info.for_object,\x20when\x20Some,\x20is\x20enforced\x20inside\x20alloc()\x20—\x20every\x20Recipient::GuardIdentifier\x20submission\x20must\x20equal\x20that\x20address\x20(abort\x20ERECIPIENT_NOT_FOR_OBJECT\x2015).\x20When\x20None,\x20no\x20anchor\x20exists\x20and\x20the\x20GuardIdentifier\x20destination\x20is\x20whoever\x20builds\x20the\x20passport\x27s\x20choice:\x20entirely\x20the\x20creator\x27s\x20business.\x20Allocation\x20is\x20a\x20generic\x20component\x20—\x20the\x20anchor\x20is\x20opt-in\x20per\x20instance,\x20not\x20a\x20host-flow\x20constant.'];export function guardSitesFor(a){return GUARD_FIELD_SITES['filter'](b=>b['object']['toLowerCase']()===a['toLowerCase']());}export function guardCognitionDoctrine(){return['Classify\x20the\x20mode\x20first:\x20pure\x20gate\x20(authorization\x20only),\x20pure\x20source\x20(data\x20only),\x20or\x20gate+source\x20(most\x20money\x20fields).','For\x20every\x20extracted\x20slot,\x20name\x20its\x20origin\x20(fixed\x20/\x20submission\x20/\x20query)\x20before\x20judging\x20safety.','For\x20submission\x20slots,\x20identify\x20the\x20passport\x20builder:\x20that\x20party\x20chooses\x20the\x20value.\x20Trace\x20what\x20constrains\x20it\x20(guard\x20expression,\x20host-side\x20balance/authorization\x20checks).','For\x20fixed\x20slots,\x20remember\x20immutability:\x20the\x20value\x20is\x20policy,\x20changed\x20only\x20by\x20re-issuing\x20the\x20guard.','For\x20query-coupled\x20guards,\x20map\x20each\x20query\x20id\x20to\x20its\x20data\x20dependency\x20(which\x20object,\x20which\x20field)\x20—\x20the\x20guard\x20is\x20only\x20as\x20fresh\x20as\x20the\x20queried\x20state.','Check\x20config-time\x20invariants:\x20type\x20of\x20each\x20slot,\x20registration\x20limits\x20(treasury\x20100\x20deposit\x20/\x20200\x20withdraw\x20/\x20reward\x20200\x20/\x20arbitration\x2050\x20/\x20repository\x2010\x20write\x20guards\x20per\x20policy),\x20relies\x20<=\x204,\x20submission\x20size\x20<=\x20256\x20bytes.','Report\x20any\x20submission\x20slot\x20that\x20decides\x20money\x20destination\x20or\x20amount\x20without\x20a\x20scope\x20binding\x20as\x20a\x20HIGH-severity\x20redirect\x20risk.'];}export const REPOSITORY_WRITE_ROUTE_MATRIX=[{'route':'auto_id_write','purpose':'Unguarded\x20auto-id\x20write:\x20policy\x20has\x20NO\x20write\x20guards\x20and\x20id_from\x20is\x20Clock/Signer.','idSource':'clock','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'policy-write-guard-must-be-empty','abortsOnUnhonoredSlots':![],'removeRoute':'auto_id_remove'},{'route':'auto_id_write_guarded','purpose':'Guarded\x20auto-id\x20write:\x20id\x20auto-generated;\x20the\x20guard\x20authorizes\x20AND\x20may\x20supply\x20the\x20data\x20payload\x20via\x20data_from_submission.','idSource':'clock','dataSource':'submission-if-set-else-caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':!![],'guardRequirement':'specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':![],'removeRoute':'auto_id_remove_guarded'},{'route':'manual_id_write','purpose':'Unguarded\x20manual\x20write:\x20caller\x20supplies\x20id\x20AND\x20data;\x20policy\x20must\x20have\x20no\x20write\x20guards.','idSource':'caller','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'policy-write-guard-must-be-empty','abortsOnUnhonoredSlots':![],'removeRoute':'manual_id_remove'},{'route':'manual_id_write_guarded','purpose':'Guarded\x20manual\x20write:\x20caller\x20supplies\x20id\x20AND\x20data;\x20the\x20guard\x20authorizes\x20only.\x20Extraction\x20slots\x20must\x20be\x20None.','idSource':'caller','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':!![],'removeRoute':'manual_id_remove_guarded'},{'route':'mixed_id_write_guarded','purpose':'Mixed\x20write:\x20per\x20specified\x20guard,\x20id\x20comes\x20from\x20id_from_submission\x20(else\x20caller\x20vector)\x20and\x20data\x20from\x20data_from_submission\x20(else\x20caller\x20vector).\x20Requires\x20policy\x20id_from\x20==\x20NONE.','idSource':'submission-if-set-else-caller','dataSource':'submission-if-set-else-caller','honorsIdFromSubmission':!![],'honorsDataFromSubmission':!![],'guardRequirement':'each-specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':![],'removeRoute':'mixed_id_remove_guarded'},{'route':'mixed_id_remove_guarded','purpose':'Mixed\x20removal:\x20deletes\x20the\x20record\x20whose\x20id\x20is\x20extracted\x20from\x20id_from_submission.\x20Requires\x20the\x20slot\x20to\x20be\x20SET.','idSource':'submission-if-set-else-caller','dataSource':'none','honorsIdFromSubmission':!![],'honorsDataFromSubmission':![],'guardRequirement':'each-specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':!![]}];export function repositoryRouteSlotConflicts(a){const b=[],{idFrom:c,writeGuardCount:d,idFromSubmissionSet:e,dataFromSubmissionSet:f,intendedRoute:g}=a;return c==='none'&&d===0x0&&b['push']('E_POLICY_WRITE_GUARD_REQUIRED:\x20id_from=NONE\x20with\x20an\x20empty\x20write_guard\x20lets\x20anyone\x20mutate\x20the\x20policy\x20data'),c!=='none'&&e&&b['push']('E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN:\x20id\x20is\x20auto-generated\x20(clock/signer);\x20id_from_submission\x20can\x20never\x20fire'),(g==='manual_id_write_guarded'||g==='manual_id_remove_guarded')&&((e||f)&&b['push']('E_GUARD_SPECIFIED_ID_FROM_SUBMISSION:\x20the\x20chosen\x20route\x20rejects\x20every\x20extraction\x20slot;\x20use\x20the\x20mixed\x20guarded\x20write\x20or\x20the\x20guarded\x20auto-id\x20write\x20instead')),g==='auto_id_write_guarded'&&e&&b['push']('id_from_submission\x20is\x20never\x20consumed\x20by\x20the\x20guarded\x20auto-id\x20write\x20(id\x20is\x20auto-generated);\x20the\x20slot\x20is\x20dead\x20config'),g==='mixed_id_write_guarded'&&c!=='none'&&b['push']('E_POLICY_ID_FROM_NONE:\x20the\x20mixed\x20guarded\x20write\x20requires\x20policy\x20id_from=NONE'),g==='mixed_id_remove_guarded'&&!e&&b['push']('E_GUARD_NOT_SPECIFIED_ID_FROM_SUBMISSION:\x20mixed\x20removal\x20has\x20no\x20id\x20source;\x20set\x20id_from_submission\x20or\x20use\x20the\x20guarded\x20manual\x20removal\x20route'),b;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function walkGuardTree(a,b){const c=[a];while(c['length']>0x0){const d=c['pop']();if(!d||typeof d!=='object')continue;b(d);if(Array['isArray'](d['nodes']))c['push'](...d['nodes']);if(d['node'])c['push'](d['node']);if(d['nodeLeft'])c['push'](d['nodeLeft']);if(d['nodeRight'])c['push'](d['nodeRight']);if(Array['isArray'](d['parameters']))c['push'](...d['parameters']);if(d['historyIdx'])c['push'](d['historyIdx']);if(d['sessionIdx'])c['push'](d['sessionIdx']);if(d['forwardIdx'])c['push'](d['forwardIdx']);if(d['where'])c['push'](d['where']);if(d['find'])c['push'](d['find']);if(d['objectLeft'])c['push'](d['objectLeft']);if(d['objectRight'])c['push'](d['objectRight']);if(d['recipient'])c['push'](d['recipient']);}}export const GUARD_UNARY_CHILD_TYPES=new Set(['logic_not','value_type','vec_length','calc_string_length','convert_number_address','convert_address_number','convert_number_string','convert_string_number','convert_safe_u8','convert_safe_u16','convert_safe_u32','convert_safe_u64','convert_safe_u128','convert_safe_u256']);export function validateGuardTreeShape(a,b='/root'){const c=[],d=f=>[['node',f['node']],['nodeLeft',f['nodeLeft']],['nodeRight',f['nodeRight']],['historyIdx',f['historyIdx']],['sessionIdx',f['sessionIdx']],['forwardIdx',f['forwardIdx']]],e=(f,g)=>{if(f===undefined||f===null)return;if(Array['isArray'](f)){f['forEach']((j,k)=>e(j,g+'/'+k));return;}if(typeof f!=='object'){c['push']({'path':g,'message':'expected\x20a\x20Guard\x20node\x20object,\x20found\x20'+typeof f});return;}const h=f;if(typeof h['type']!=='string'||h['type']['length']===0x0){c['push']({'path':g,'message':'Guard\x20node\x20is\x20missing\x20its\x20string\x20\x27type\x27\x20(keys:\x20'+(Object['keys'](h)['join'](',\x20')||'none')+')'});return;}if(GUARD_UNARY_CHILD_TYPES['has'](h['type'])){if(h['node']===undefined||h['node']===null){const i=Array['isArray'](h['nodes'])?'\x20—\x20\x27nodes\x27\x20was\x20used,\x20but\x20this\x20operator\x20takes\x20a\x20single\x20\x27node\x27\x20child':'';c['push']({'path':g+'/node','message':'\x27'+h['type']+'\x27\x20requires\x20its\x20\x27node\x27\x20child'+i});}}for(const [j,k]of d(h))e(k,g+'/'+j);if(Array['isArray'](h['nodes']))e(h['nodes'],g+'/nodes');if(Array['isArray'](h['parameters']))e(h['parameters'],g+'/parameters');};return e(a,b),c;}function categorizeNodeType(a){if(a['startsWith']('logic_'))return'decision';if(a==='context')return'context';if(a==='identifier')return'leaf';if(a==='query')return'query';if(a['startsWith']('calc_')||a['startsWith']('convert_'))return'computation';if(a['startsWith']('vec_'))return'computation';if(a['startsWith']('query_reward_')||a['startsWith']('query_progress_'))return'query';return'computation';}function shortNodeLabel(a){const b=a['type'];switch(b){case'logic_and':return'AND';case'logic_or':return'OR';case'logic_not':return'NOT';case'logic_equal':return'==';case'logic_as_u256_equal':return'==#';case'logic_as_u256_greater':return'>';case'logic_as_u256_greater_or_equal':return'>=';case'logic_as_u256_lesser':return'<';case'logic_as_u256_lesser_or_equal':return'<=';case'logic_string_contains':return'contains';case'logic_string_nocase_contains':return'contains~';case'logic_string_nocase_equal':return'==~';case'calc_number_add':return'+';case'calc_number_subtract':return'-';case'calc_number_multiply':return'*';case'calc_number_divide':return'/';case'calc_number_mod':return'%';case'calc_string_length':return'len';case'calc_string_contains':return'contains';case'calc_string_nocase_contains':return'contains~';case'calc_string_nocase_equal':return'==~';case'calc_string_indexof':return'indexOf';case'calc_string_nocase_indexof':return'indexOf~';case'convert_number_address':return'→Addr';case'convert_address_number':return'→Num';case'convert_number_string':return'→Str';case'convert_string_number':return'→Num';case'convert_safe_u8':return'→U8';case'convert_safe_u16':return'→U16';case'convert_safe_u32':return'→U32';case'convert_safe_u64':return'→U64';case'convert_safe_u128':return'→U128';case'convert_safe_u256':return'→U256';case'value_type':return'typeOf';case'vec_length':return'len';case'vec_contains_bool':return'∈?';case'vec_contains_address':return'∈?';case'vec_contains_string':return'∈?';case'vec_contains_string_nocase':return'∈?~';case'vec_contains_number':return'∈?';case'vec_indexof_bool':return'idx';case'vec_indexof_address':return'idx';case'vec_indexof_string':return'idx';case'vec_indexof_string_nocase':return'idx~';case'vec_indexof_number':return'idx';case'query':return'Q:'+(typeof a['query']==='number'?'#'+a['query']:a['query']);case'query_reward_record_count':return'reward.count';case'query_reward_record_exists':return'reward.exists';case'query_reward_record_find':return'reward.find';case'query_progress_history_find':return'history.find';case'query_progress_history_session_find':return'session.find';case'query_progress_history_session_forward_find':return'forward.find';case'query_progress_history_session_count':return'session.count';case'query_progress_history_session_forward_count':return'forward.count';case'query_progress_history_session_forward_retained_submission_count':return'retained.count';case'query_repository_data_count_where':return'repo.count';case'query_repository_data_sum_where':return'repo.sum';case'query_repository_data_find_where':return'repo.find';case'query_repository_data_keys_where':return'repo.keys.where';case'query_repository_policies_keys':return'repo.keys';case'identifier':return'id['+(a['identifier']??'?')+']';case'context':return a['context']??'ctx';default:return b;}}let nodeIdCounter=0x0;function makeNodeId(a){return nodeIdCounter++,a+'_'+nodeIdCounter;}function sanitizeMermaidLabel(a){if(/[<>"\[\]{}()|&]/['test'](a))return'\x22'+a['replace'](/"/g,'\x27')+'\x22';return a;}const GUARD_NODE_COLORS={'control':{'fill':'#3b82f6','stroke':'#1e40af'},'decision':{'fill':'#f59e0b','stroke':'#92400e'},'computation':{'fill':'#8b5cf6','stroke':'#6d28d9'},'query':{'fill':'#06b6d4','stroke':'#0e7490'},'leaf':{'fill':'#6b7280','stroke':'#374151'},'context':{'fill':'#10b981','stroke':'#065f46'}};function colorCategoryForNodeType(a){if(a==='logic_and'||a==='logic_or')return'control';if(a==='logic_not'||a['startsWith']('logic_'))return'decision';if(a['startsWith']('calc_')||a['startsWith']('convert_')||a['startsWith']('vec_'))return'computation';if(a==='query'||a['startsWith']('query_'))return'query';if(a==='identifier')return'leaf';if(a==='context')return'context';return'computation';}export function renderGuardMermaid(a,b){const c=b?.['colored']!==![];nodeIdCounter=0x0;const d=['flowchart\x20TD'];c&&(d['push']('\x20\x20%%\x20Color\x20Legend\x20(BehaviorTree.CPP-inspired\x20semantic\x20roles):'),d['push']('\x20\x20%%\x20\x20\x20blue\x20\x20\x20#3b82f6\x20-\x20control\x20\x20\x20\x20\x20(logic_and,\x20logic_or)'),d['push']('\x20\x20%%\x20\x20\x20amber\x20\x20#f59e0b\x20-\x20decision\x20\x20\x20\x20(logic_not,\x20comparisons)'),d['push']('\x20\x20%%\x20\x20\x20purple\x20#8b5cf6\x20-\x20computation\x20(calc_*,\x20convert_*,\x20vec_*)'),d['push']('\x20\x20%%\x20\x20\x20cyan\x20\x20\x20#06b6d4\x20-\x20query\x20\x20\x20\x20\x20\x20\x20(query,\x20query_*)'),d['push']('\x20\x20%%\x20\x20\x20gray\x20\x20\x20#6b7280\x20-\x20leaf\x20\x20\x20\x20\x20\x20\x20\x20(identifier)'),d['push']('\x20\x20%%\x20\x20\x20green\x20\x20#10b981\x20-\x20context\x20\x20\x20\x20\x20(Signer,\x20Clock,\x20Guard)'),d['push']('\x20\x20%%\x20Node\x20shapes:\x20{}=decision,\x20[]=computation/query,\x20([])=leaf,\x20{{}}=context'));const e=[],f=[],g=[];function h(i,j,k){const l=makeNodeId('n');if(!i||typeof i!=='object'||typeof i['type']!=='string')return e['push'](l+'([where\x20filter])'),j&&f['push'](k?'\x20\x20'+j+'\x20-->\x20'+l+':\x20'+sanitizeMermaidLabel(k):'\x20\x20'+j+'\x20-->\x20'+l),l;const m=categorizeNodeType(i['type']),n=shortNodeLabel(i);let o='[',p=']';switch(m){case'decision':o='{',p='}';break;case'context':o='{{',p='}}';break;case'leaf':o='([',p='])';break;case'query':case'computation':default:o='[',p=']';break;}e['push'](''+l+o+sanitizeMermaidLabel(n)+p),g['push']({'id':l,'type':i['type']});j&&(k?f['push']('\x20\x20'+j+'\x20-->\x20'+l+':\x20'+sanitizeMermaidLabel(k)):f['push']('\x20\x20'+j+'\x20-->\x20'+l));i['nodes']&&Array['isArray'](i['nodes'])&&i['nodes']['forEach']((q,r)=>{h(q,l,'['+r+']');});i['node']&&h(i['node'],l,'child');i['nodeLeft']&&h(i['nodeLeft'],l,'left');i['nodeRight']&&h(i['nodeRight'],l,'right');i['parameters']&&Array['isArray'](i['parameters'])&&i['parameters']['forEach']((q,r)=>{h(q,l,'param['+r+']');});if(i['historyIdx'])h(i['historyIdx'],l,'historyIdx');if(i['sessionIdx'])h(i['sessionIdx'],l,'sessionIdx');if(i['forwardIdx'])h(i['forwardIdx'],l,'forwardIdx');if(i['where'])h(i['where'],l,'where');if(i['find'])h(i['find'],l,'find');if(i['objectLeft'])h(i['objectLeft'],l,'objLeft');if(i['objectRight'])h(i['objectRight'],l,'objRight');if(i['recipient'])h(i['recipient'],l,'recipient');return l;}h(a),d['push'](...e['map'](i=>'\x20\x20'+i)),d['push'](...f);if(c){d['push'](''),d['push']('\x20\x20%%\x20Node\x20colors\x20(BehaviorTree.CPP-inspired\x20semantic\x20roles)');for(const {id:i,type:j}of g){const k=colorCategoryForNodeType(j),l=GUARD_NODE_COLORS[k];d['push']('\x20\x20style\x20'+i+'\x20fill:'+l['fill']+',stroke:'+l['stroke']+',color:#fff');}}return d['join']('\x0a');}export function renderGuardTreeIndented(a){const {root:b,table:c,guardName:d,guardAddress:e,rely:f}=a,h=[];function i(k){const l=k['type'];if(l==='identifier'){const m=c?.['find'](o=>o['identifier']===k['identifier']),n=m?.['name']?'\x20\x22'+m['name']+'\x22':'';return'identifier['+(k['identifier']??'?')+']'+n;}if(l==='context')return'context('+(k['context']??'?')+')';if(l==='query'){const o=k['object']?.['convert_witness'],p=k['object']?.['identifier'],q=o!==undefined?',\x20witness='+o:'',r=p!==undefined?',\x20id['+p+']':'',s=k['parameters']&&k['parameters']['length']>0x0?',\x20params=['+k['parameters']['map'](u=>shortNodeLabel(u))['join'](',\x20')+']':'';return'query('+(typeof k['query']==='number'?'#'+k['query']:k['query'])+r+q+s+')';}return shortNodeLabel(k);}function j(k,l,m){const n='\x20\x20'['repeat'](l),o=l===0x0?'-\x20':'-\x20',p=m?m+':\x20':'',q=!k['nodes']&&!k['node']&&!k['nodeLeft']&&!k['nodeRight']&&!k['parameters']?.['length']&&!k['historyIdx']&&!k['sessionIdx']&&!k['forwardIdx']&&!k['where']&&!k['find']&&!k['objectLeft']&&!k['objectRight']&&!k['recipient'];q?h['push'](''+n+o+p+i(k)):h['push'](''+n+o+p+k['type']);k['nodes']&&Array['isArray'](k['nodes'])&&k['nodes']['forEach']((r,s)=>j(r,l+0x1,'child['+s+']'));k['node']&&j(k['node'],l+0x1,'child');k['nodeLeft']&&j(k['nodeLeft'],l+0x1,'left');k['nodeRight']&&j(k['nodeRight'],l+0x1,'right');k['parameters']&&Array['isArray'](k['parameters'])&&k['parameters']['forEach']((r,s)=>j(r,l+0x1,'param['+s+']'));if(k['historyIdx'])j(k['historyIdx'],l+0x1,'historyIdx');if(k['sessionIdx'])j(k['sessionIdx'],l+0x1,'sessionIdx');if(k['forwardIdx'])j(k['forwardIdx'],l+0x1,'forwardIdx');if(k['where'])j(k['where'],l+0x1,'where');if(k['find'])j(k['find'],l+0x1,'find');if(k['objectLeft'])j(k['objectLeft'],l+0x1,'objLeft');if(k['objectRight'])j(k['objectRight'],l+0x1,'objRight');if(k['recipient'])j(k['recipient'],l+0x1,'recipient');}h['push']('#\x20Guard\x20Tree\x20Definition'),h['push']('');d&&h['push']('**Guard:**\x20'+d);e&&h['push']('**Address:**\x20'+e);c&&h['push']('**Table\x20Entries:**\x20'+c['length']);f&&f['guards']['length']>0x0&&h['push']('**Rely:**\x20'+f['guards']['length']+'\x20guard(s)'+(f['logic_or']?'\x20(logic_or)':'\x20(logic_and)'));h['push'](''),h['push']('##\x20Root'),j(b,0x0);if(c&&c['length']>0x0){h['push'](''),h['push']('##\x20Table'),h['push'](''),h['push']('|\x20identifier\x20|\x20b_submission\x20|\x20value_type\x20|\x20value\x20|\x20name\x20|'),h['push']('|------------|-------------|------------|-------|------|');for(const k of c){const l=k['value']===undefined?'-':String(k['value']),m=l['replace'](/\|/g,'\x5c|')['replace'](/\n/g,'\x20'),n=k['name']??'-';h['push']('|\x20'+k['identifier']+'\x20|\x20'+k['b_submission']+'\x20|\x20'+k['value_type']+'\x20|\x20'+m+'\x20|\x20'+n+'\x20|');}h['push'](''),h['push']('##\x20Table\x20JSON'),h['push'](''),h['push']('```json'),h['push'](JSON['stringify'](c,null,0x2)),h['push']('```');}if(f&&f['guards']['length']>0x0){h['push'](''),h['push']('##\x20Rely'),h['push'](''),h['push']('Logic:\x20'+(f['logic_or']?'OR':'AND'));for(const o of f['guards']){h['push']('-\x20'+o);}}return h['push'](''),h['push']('##\x20JSON\x20Definition'),h['push'](''),h['push']('```json'),h['push'](JSON['stringify']({'root':b,'table':c,'guardName':d,'guardAddress':e,'rely':f},null,0x2)),h['push']('```'),h['join']('\x0a');}export function parseGuardTreeIndented(a){const b=[],c=a['matchAll'](/```json\s*\n([\s\S]*?)```/g);let d=null;for(const k of c){d=k[0x1];}if(d)try{const l=JSON['parse'](d['trim']());if(l&&typeof l==='object'){if('root'in l&&l['root']&&typeof l['root']==='object'&&'type'in l['root'])return{'success':!![],'data':l['root'],'errors':[]};if('type'in l)return{'success':!![],'data':l,'errors':[]};}}catch(m){b['push']('JSON\x20code\x20block\x20parse\x20error:\x20'+m['message']);}const f=a['split']('\x0a')['filter'](n=>n['trim']()['startsWith']('-\x20'));if(f['length']===0x0)return{'success':![],'errors':['No\x20outline\x20entries\x20found.\x20Use\x20\x27-\x20\x27\x20prefixed\x20lines\x20or\x20a\x20JSON\x20code\x20block.']};const g=[];let h=null;function i(n){const o=n['match'](/^(\s*)- /);return o?o[0x1]['length']/0x2:0x0;}function j(n){const o=n['replace'](/^\s*- /,'')['trim'](),p=o['match'](/^([^:]+):\s*(.*)$/),q=p?p[0x1]['trim']():undefined,r=p?p[0x2]['trim']():o,s=r['match'](/^identifier\[(\d+)\](?:\s+"(.+)")?$/);if(s)return{'label':q,'node':{'type':'identifier','identifier':parseInt(s[0x1],0xa)}};const t=r['match'](/^context\((\w+)\)$/);if(t)return{'label':q,'node':{'type':'context','context':t[0x1]}};const u=r['match'](/^query\((.+?)\)$/);if(u){const v=u[0x1],w=v['split'](',')['map'](A=>A['trim']()),x=w[0x0]['replace'](/^#/,''),y=/^\d+$/['test'](x),z={'type':'query','query':y?parseInt(x,0xa):x};for(const A of w['slice'](0x1)){const B=A['match'](/^id\[(\d+)\]$/);B&&(z['object']={'identifier':parseInt(B[0x1],0xa)});const C=A['match'](/^witness=(\d+)$/);C&&(z['object']={...z['object']||{},'convert_witness':parseInt(C[0x1],0xa)});}return{'label':q,'node':z};}return{'label':q,'node':{'type':r}};}for(const n of f){const o=i(n),{label:p,node:q}=j(n);if(o===0x0)h=q,g['length']=0x0,g['push']({'node':q,'depth':o});else{while(g['length']>0x0&&g[g['length']-0x1]['depth']>=o){g['pop']();}const r=g[g['length']-0x1];if(!r){b['push']('Orphaned\x20node\x20at\x20depth\x20'+o+':\x20'+n);continue;}if(p){const s=p['match'](/^child\[(\d+)\]$/),t=p['match'](/^param\[(\d+)\]$/);if(s){if(!r['node']['nodes'])r['node']['nodes']=[];r['node']['nodes']['push'](q);}else{if(t){if(!r['node']['parameters'])r['node']['parameters']=[];r['node']['parameters']['push'](q);}else{if(p==='child')r['node']['node']=q;else{if(p==='left')r['node']['nodeLeft']=q;else{if(p==='right')r['node']['nodeRight']=q;else{if(p==='historyIdx')r['node']['historyIdx']=q;else{if(p==='sessionIdx')r['node']['sessionIdx']=q;else{if(p==='forwardIdx')r['node']['forwardIdx']=q;else{if(p==='where')r['node']['where']=q;else{if(p==='find')r['node']['find']=q;else{if(p==='objLeft')r['node']['objectLeft']=q;else{if(p==='objRight')r['node']['objectRight']=q;else p==='recipient'&&(r['node']['recipient']=q);}}}}}}}}}}}}g['push']({'node':q,'depth':o});}}if(!h)return{'success':![],'errors':['No\x20root\x20node\x20found\x20in\x20outline.']};return{'success':!![],'data':h,'errors':b};}export function renderGuardAscii(a){const {root:b,table:c,guardName:d,guardAddress:e,rely:f}=a,h=[];if(d)h['push']('Guard:\x20'+d);if(e)h['push']('Address:\x20'+e);if(d||e)h['push']('');function i(m){const n=m['type'],o=shortNodeLabel(m);if(n==='identifier'){const p=c?.['find'](u=>u['identifier']===m['identifier']),q=p?'\x20['+(typeof p['value_type']==='string'?p['value_type']:'type='+p['value_type'])+']':'',r=p&&p['value']!==undefined&&!p['b_submission']?',\x20value='+String(p['value']):'',s=p?.['b_submission']?'\x20(submission)':'';return''+o+q+r+s;}if(n==='context')return o+'\x20['+(m['context']??'?')+']';if(n==='query'){const u=m['object']?.['convert_witness'],v=u!==undefined?',\x20witness='+u:'';return''+o+v;}return o;}function j(m){const n=[];m['nodes']&&Array['isArray'](m['nodes'])&&m['nodes']['forEach']((o,p)=>n['push']({'node':o,'label':'child['+p+']'}));if(m['node'])n['push']({'node':m['node'],'label':'child'});if(m['nodeLeft'])n['push']({'node':m['nodeLeft'],'label':'left'});if(m['nodeRight'])n['push']({'node':m['nodeRight'],'label':'right'});m['parameters']&&Array['isArray'](m['parameters'])&&m['parameters']['forEach']((o,p)=>n['push']({'node':o,'label':'param['+p+']'}));if(m['historyIdx'])n['push']({'node':m['historyIdx'],'label':'historyIdx'});if(m['sessionIdx'])n['push']({'node':m['sessionIdx'],'label':'sessionIdx'});if(m['forwardIdx'])n['push']({'node':m['forwardIdx'],'label':'forwardIdx'});if(m['where'])n['push']({'node':m['where'],'label':'where'});if(m['find'])n['push']({'node':m['find'],'label':'find'});if(m['objectLeft'])n['push']({'node':m['objectLeft'],'label':'objLeft'});if(m['objectRight'])n['push']({'node':m['objectRight'],'label':'objRight'});if(m['recipient'])n['push']({'node':m['recipient'],'label':'recipient'});return n;}function k(m,n,o,p){const q=o?'└─\x20':'├─\x20',r=p?p+':\x20':'';h['push'](''+n+q+r+i(m));const s=j(m),t=n+(o?'\x20\x20\x20':'│\x20\x20');s['forEach']((u,v)=>{k(u['node'],t,v===s['length']-0x1,u['label']);});}h['push'](i(b));const l=j(b);l['forEach']((m,n)=>{k(m['node'],'',n===l['length']-0x1,m['label']);});if(c&&c['length']>0x0){h['push'](''),h['push']('Table:');for(const m of c){const n=typeof m['value_type']==='string'?m['value_type']:'type='+m['value_type'],o=m['value']!==undefined&&!m['b_submission']?',\x20value='+String(m['value']):'',p=m['b_submission']?'\x20(submission)':'',q=m['name']?'\x20\x22'+m['name']+'\x22':'';h['push']('\x20\x20id['+m['identifier']+']'+q+':\x20'+n+o+p);}}if(f&&f['guards']['length']>0x0){h['push'](''),h['push']('Rely\x20('+(f['logic_or']?'OR':'AND')+'):');for(const r of f['guards']){h['push']('\x20\x20-\x20'+r);}}return h['join']('\x0a');}export function renderGuardMarkmap(a){const {root:b,table:c,guardName:d,guardAddress:e,rely:f}=a,h=[],i=d?'Guard:\x20'+d:'Guard';h['push']('#\x20'+i);if(e)h['push']('');if(e)h['push']('**Address:**\x20'+e);h['push']('');function j(m,n){return'#'['repeat'](Math['min'](m+0x1,0x6))+'\x20'+n;}function k(m){const n=m['type'],o=shortNodeLabel(m);if(n==='identifier'){const p=c?.['find'](u=>u['identifier']===m['identifier']),q=p?'\x20['+(typeof p['value_type']==='string'?p['value_type']:'type='+p['value_type'])+']':'',r=p&&p['value']!==undefined&&!p['b_submission']?',\x20value='+String(p['value']):'',s=p?.['b_submission']?'\x20(submission)':'';return''+o+q+r+s;}if(n==='context')return o+'\x20['+(m['context']??'?')+']';if(n==='query'){const u=m['object']?.['convert_witness'],v=u!==undefined?',\x20witness='+u:'';return''+o+v;}return o;}function l(m,n,o){const p=o?o+':\x20':'';h['push'](j(n,''+p+k(m)));m['nodes']&&Array['isArray'](m['nodes'])&&m['nodes']['forEach']((q,r)=>l(q,n+0x1,'child['+r+']'));if(m['node'])l(m['node'],n+0x1,'child');if(m['nodeLeft'])l(m['nodeLeft'],n+0x1,'left');if(m['nodeRight'])l(m['nodeRight'],n+0x1,'right');m['parameters']&&Array['isArray'](m['parameters'])&&m['parameters']['forEach']((q,r)=>l(q,n+0x1,'param['+r+']'));if(m['historyIdx'])l(m['historyIdx'],n+0x1,'historyIdx');if(m['sessionIdx'])l(m['sessionIdx'],n+0x1,'sessionIdx');if(m['forwardIdx'])l(m['forwardIdx'],n+0x1,'forwardIdx');if(m['where'])l(m['where'],n+0x1,'where');if(m['find'])l(m['find'],n+0x1,'find');if(m['objectLeft'])l(m['objectLeft'],n+0x1,'objLeft');if(m['objectRight'])l(m['objectRight'],n+0x1,'objRight');if(m['recipient'])l(m['recipient'],n+0x1,'recipient');}h['push'](j(0x1,'Root')),l(b,0x2);if(c&&c['length']>0x0){h['push'](''),h['push']('##\x20Table');for(const m of c){const n=typeof m['value_type']==='string'?m['value_type']:'type='+m['value_type'],o=m['value']!==undefined&&!m['b_submission']?',\x20value='+String(m['value']):'',p=m['b_submission']?'\x20(submission)':'',q=m['name']?'\x20\x22'+m['name']+'\x22':'';h['push']('-\x20id['+m['identifier']+']'+q+':\x20'+n+o+p);}}if(f&&f['guards']['length']>0x0){h['push'](''),h['push']('##\x20Rely\x20('+(f['logic_or']?'OR':'AND')+')');for(const r of f['guards']){h['push']('-\x20'+r);}}return h['join']('\x0a');}export function parseGuardTableJSON(a){const b=a['match'](/##\s*Table JSON[^\n]*\n\s*```json\s*\n([\s\S]*?)```/i);if(!b)return null;try{const c=JSON['parse'](b[0x1]['trim']());if(!Array['isArray'](c))return null;return c['filter'](d=>{return d&&typeof d==='object'&&typeof d['identifier']==='number'&&typeof d['b_submission']==='boolean';})['map'](d=>({'identifier':d['identifier'],'name':d['name'],'value_type':d['value_type'],'b_submission':d['b_submission'],'value':d['value']}));}catch{return null;}}
|
|
1
|
+
export function walkGuardTree(a,b){const c=[a];while(c['length']>0x0){const d=c['pop']();if(!d||typeof d!=='object')continue;b(d);if(Array['isArray'](d['nodes']))c['push'](...d['nodes']);if(d['node'])c['push'](d['node']);if(d['nodeLeft'])c['push'](d['nodeLeft']);if(d['nodeRight'])c['push'](d['nodeRight']);if(Array['isArray'](d['parameters']))c['push'](...d['parameters']);if(d['historyIdx'])c['push'](d['historyIdx']);if(d['sessionIdx'])c['push'](d['sessionIdx']);if(d['forwardIdx'])c['push'](d['forwardIdx']);if(d['where'])c['push'](d['where']);if(d['find'])c['push'](d['find']);if(d['objectLeft'])c['push'](d['objectLeft']);if(d['objectRight'])c['push'](d['objectRight']);if(d['recipient'])c['push'](d['recipient']);}}export const GUARD_UNARY_CHILD_TYPES=new Set(['logic_not','value_type','vec_length','calc_string_length','convert_number_address','convert_address_number','convert_number_string','convert_string_number','convert_safe_u8','convert_safe_u16','convert_safe_u32','convert_safe_u64','convert_safe_u128','convert_safe_u256']);export function validateGuardTreeShape(a,b='/root'){const c=[],d=f=>[['node',f['node']],['nodeLeft',f['nodeLeft']],['nodeRight',f['nodeRight']],['historyIdx',f['historyIdx']],['sessionIdx',f['sessionIdx']],['forwardIdx',f['forwardIdx']]],e=(f,g)=>{if(f===undefined||f===null)return;if(Array['isArray'](f)){f['forEach']((j,k)=>e(j,g+'/'+k));return;}if(typeof f!=='object'){c['push']({'path':g,'message':'expected\x20a\x20Guard\x20node\x20object,\x20found\x20'+typeof f});return;}const h=f;if(typeof h['type']!=='string'||h['type']['length']===0x0){c['push']({'path':g,'message':'Guard\x20node\x20is\x20missing\x20its\x20string\x20\x27type\x27\x20(keys:\x20'+(Object['keys'](h)['join'](',\x20')||'none')+')'});return;}if(GUARD_UNARY_CHILD_TYPES['has'](h['type'])){if(h['node']===undefined||h['node']===null){const i=Array['isArray'](h['nodes'])?'\x20—\x20\x27nodes\x27\x20was\x20used,\x20but\x20this\x20operator\x20takes\x20a\x20single\x20\x27node\x27\x20child':'';c['push']({'path':g+'/node','message':'\x27'+h['type']+'\x27\x20requires\x20its\x20\x27node\x27\x20child'+i});}}for(const [j,k]of d(h))e(k,g+'/'+j);if(Array['isArray'](h['nodes']))e(h['nodes'],g+'/nodes');if(Array['isArray'](h['parameters']))e(h['parameters'],g+'/parameters');};return e(a,b),c;}function categorizeNodeType(a){if(a['startsWith']('logic_'))return'decision';if(a==='context')return'context';if(a==='identifier')return'leaf';if(a==='query')return'query';if(a['startsWith']('calc_')||a['startsWith']('convert_'))return'computation';if(a['startsWith']('vec_'))return'computation';if(a['startsWith']('query_reward_')||a['startsWith']('query_progress_'))return'query';return'computation';}function shortNodeLabel(a){const b=a['type'];switch(b){case'logic_and':return'AND';case'logic_or':return'OR';case'logic_not':return'NOT';case'logic_equal':return'==';case'logic_as_u256_equal':return'==#';case'logic_as_u256_greater':return'>';case'logic_as_u256_greater_or_equal':return'>=';case'logic_as_u256_lesser':return'<';case'logic_as_u256_lesser_or_equal':return'<=';case'logic_string_contains':return'contains';case'logic_string_nocase_contains':return'contains~';case'logic_string_nocase_equal':return'==~';case'calc_number_add':return'+';case'calc_number_subtract':return'-';case'calc_number_multiply':return'*';case'calc_number_divide':return'/';case'calc_number_mod':return'%';case'calc_string_length':return'len';case'calc_string_contains':return'contains';case'calc_string_nocase_contains':return'contains~';case'calc_string_nocase_equal':return'==~';case'calc_string_indexof':return'indexOf';case'calc_string_nocase_indexof':return'indexOf~';case'convert_number_address':return'→Addr';case'convert_address_number':return'→Num';case'convert_number_string':return'→Str';case'convert_string_number':return'→Num';case'convert_safe_u8':return'→U8';case'convert_safe_u16':return'→U16';case'convert_safe_u32':return'→U32';case'convert_safe_u64':return'→U64';case'convert_safe_u128':return'→U128';case'convert_safe_u256':return'→U256';case'value_type':return'typeOf';case'vec_length':return'len';case'vec_contains_bool':return'∈?';case'vec_contains_address':return'∈?';case'vec_contains_string':return'∈?';case'vec_contains_string_nocase':return'∈?~';case'vec_contains_number':return'∈?';case'vec_indexof_bool':return'idx';case'vec_indexof_address':return'idx';case'vec_indexof_string':return'idx';case'vec_indexof_string_nocase':return'idx~';case'vec_indexof_number':return'idx';case'query':return'Q:'+(typeof a['query']==='number'?'#'+a['query']:a['query']);case'query_reward_record_count':return'reward.count';case'query_reward_record_exists':return'reward.exists';case'query_reward_record_find':return'reward.find';case'query_progress_history_find':return'history.find';case'query_progress_history_time':return'history.time';case'query_progress_history_session_find':return'session.find';case'query_progress_history_session_forward_find':return'forward.find';case'query_progress_history_session_count':return'session.count';case'query_progress_history_session_forward_count':return'forward.count';case'query_progress_history_session_forward_retained_submission_count':return'retained.count';case'query_repository_data_count_where':return'repo.count';case'query_repository_data_sum_where':return'repo.sum';case'query_repository_data_find_where':return'repo.find';case'query_repository_data_keys_where':return'repo.keys.where';case'query_repository_policies_keys':return'repo.keys';case'identifier':return'id['+(a['identifier']??'?')+']';case'context':return a['context']??'ctx';default:return b;}}let nodeIdCounter=0x0;function makeNodeId(a){return nodeIdCounter++,a+'_'+nodeIdCounter;}function sanitizeMermaidLabel(a){if(/[<>"\[\]{}()|&]/['test'](a))return'\x22'+a['replace'](/"/g,'\x27')+'\x22';return a;}const GUARD_NODE_COLORS={'control':{'fill':'#3b82f6','stroke':'#1e40af'},'decision':{'fill':'#f59e0b','stroke':'#92400e'},'computation':{'fill':'#8b5cf6','stroke':'#6d28d9'},'query':{'fill':'#06b6d4','stroke':'#0e7490'},'leaf':{'fill':'#6b7280','stroke':'#374151'},'context':{'fill':'#10b981','stroke':'#065f46'}};function colorCategoryForNodeType(a){if(a==='logic_and'||a==='logic_or')return'control';if(a==='logic_not'||a['startsWith']('logic_'))return'decision';if(a['startsWith']('calc_')||a['startsWith']('convert_')||a['startsWith']('vec_'))return'computation';if(a==='query'||a['startsWith']('query_'))return'query';if(a==='identifier')return'leaf';if(a==='context')return'context';return'computation';}export function renderGuardMermaid(a,b){const c=b?.['colored']!==![];nodeIdCounter=0x0;const d=['flowchart\x20TD'];c&&(d['push']('\x20\x20%%\x20Color\x20Legend\x20(BehaviorTree.CPP-inspired\x20semantic\x20roles):'),d['push']('\x20\x20%%\x20\x20\x20blue\x20\x20\x20#3b82f6\x20-\x20control\x20\x20\x20\x20\x20(logic_and,\x20logic_or)'),d['push']('\x20\x20%%\x20\x20\x20amber\x20\x20#f59e0b\x20-\x20decision\x20\x20\x20\x20(logic_not,\x20comparisons)'),d['push']('\x20\x20%%\x20\x20\x20purple\x20#8b5cf6\x20-\x20computation\x20(calc_*,\x20convert_*,\x20vec_*)'),d['push']('\x20\x20%%\x20\x20\x20cyan\x20\x20\x20#06b6d4\x20-\x20query\x20\x20\x20\x20\x20\x20\x20(query,\x20query_*)'),d['push']('\x20\x20%%\x20\x20\x20gray\x20\x20\x20#6b7280\x20-\x20leaf\x20\x20\x20\x20\x20\x20\x20\x20(identifier)'),d['push']('\x20\x20%%\x20\x20\x20green\x20\x20#10b981\x20-\x20context\x20\x20\x20\x20\x20(Signer,\x20Clock,\x20Guard)'),d['push']('\x20\x20%%\x20Node\x20shapes:\x20{}=decision,\x20[]=computation/query,\x20([])=leaf,\x20{{}}=context'));const e=[],f=[],g=[];function h(i,j,k){const l=makeNodeId('n');if(!i||typeof i!=='object'||typeof i['type']!=='string')return e['push'](l+'([where\x20filter])'),j&&f['push'](k?'\x20\x20'+j+'\x20-->\x20'+l+':\x20'+sanitizeMermaidLabel(k):'\x20\x20'+j+'\x20-->\x20'+l),l;const m=categorizeNodeType(i['type']),n=shortNodeLabel(i);let o='[',p=']';switch(m){case'decision':o='{',p='}';break;case'context':o='{{',p='}}';break;case'leaf':o='([',p='])';break;case'query':case'computation':default:o='[',p=']';break;}e['push'](''+l+o+sanitizeMermaidLabel(n)+p),g['push']({'id':l,'type':i['type']});j&&(k?f['push']('\x20\x20'+j+'\x20-->\x20'+l+':\x20'+sanitizeMermaidLabel(k)):f['push']('\x20\x20'+j+'\x20-->\x20'+l));i['nodes']&&Array['isArray'](i['nodes'])&&i['nodes']['forEach']((q,r)=>{h(q,l,'['+r+']');});i['node']&&h(i['node'],l,'child');i['nodeLeft']&&h(i['nodeLeft'],l,'left');i['nodeRight']&&h(i['nodeRight'],l,'right');i['parameters']&&Array['isArray'](i['parameters'])&&i['parameters']['forEach']((q,r)=>{h(q,l,'param['+r+']');});if(i['historyIdx'])h(i['historyIdx'],l,'historyIdx');if(i['sessionIdx'])h(i['sessionIdx'],l,'sessionIdx');if(i['forwardIdx'])h(i['forwardIdx'],l,'forwardIdx');if(i['where'])h(i['where'],l,'where');if(i['find'])h(i['find'],l,'find');if(i['objectLeft'])h(i['objectLeft'],l,'objLeft');if(i['objectRight'])h(i['objectRight'],l,'objRight');if(i['recipient'])h(i['recipient'],l,'recipient');return l;}h(a),d['push'](...e['map'](i=>'\x20\x20'+i)),d['push'](...f);if(c){d['push'](''),d['push']('\x20\x20%%\x20Node\x20colors\x20(BehaviorTree.CPP-inspired\x20semantic\x20roles)');for(const {id:i,type:j}of g){const k=colorCategoryForNodeType(j),l=GUARD_NODE_COLORS[k];d['push']('\x20\x20style\x20'+i+'\x20fill:'+l['fill']+',stroke:'+l['stroke']+',color:#fff');}}return d['join']('\x0a');}export function renderGuardTreeIndented(a){const {root:b,table:c,guardName:d,guardAddress:e,rely:f}=a,h=[];function i(k){const l=k['type'];if(l==='identifier'){const m=c?.['find'](o=>o['identifier']===k['identifier']),n=m?.['name']?'\x20\x22'+m['name']+'\x22':'';return'identifier['+(k['identifier']??'?')+']'+n;}if(l==='context')return'context('+(k['context']??'?')+')';if(l==='query'){const o=k['object']?.['convert_witness'],p=k['object']?.['identifier'],q=o!==undefined?',\x20witness='+o:'',r=p!==undefined?',\x20id['+p+']':'',s=k['parameters']&&k['parameters']['length']>0x0?',\x20params=['+k['parameters']['map'](u=>shortNodeLabel(u))['join'](',\x20')+']':'';return'query('+(typeof k['query']==='number'?'#'+k['query']:k['query'])+r+q+s+')';}return shortNodeLabel(k);}function j(k,l,m){const n='\x20\x20'['repeat'](l),o=l===0x0?'-\x20':'-\x20',p=m?m+':\x20':'',q=!k['nodes']&&!k['node']&&!k['nodeLeft']&&!k['nodeRight']&&!k['parameters']?.['length']&&!k['historyIdx']&&!k['sessionIdx']&&!k['forwardIdx']&&!k['where']&&!k['find']&&!k['objectLeft']&&!k['objectRight']&&!k['recipient'];q?h['push'](''+n+o+p+i(k)):h['push'](''+n+o+p+k['type']);k['nodes']&&Array['isArray'](k['nodes'])&&k['nodes']['forEach']((r,s)=>j(r,l+0x1,'child['+s+']'));k['node']&&j(k['node'],l+0x1,'child');k['nodeLeft']&&j(k['nodeLeft'],l+0x1,'left');k['nodeRight']&&j(k['nodeRight'],l+0x1,'right');k['parameters']&&Array['isArray'](k['parameters'])&&k['parameters']['forEach']((r,s)=>j(r,l+0x1,'param['+s+']'));if(k['historyIdx'])j(k['historyIdx'],l+0x1,'historyIdx');if(k['sessionIdx'])j(k['sessionIdx'],l+0x1,'sessionIdx');if(k['forwardIdx'])j(k['forwardIdx'],l+0x1,'forwardIdx');if(k['where'])j(k['where'],l+0x1,'where');if(k['find'])j(k['find'],l+0x1,'find');if(k['objectLeft'])j(k['objectLeft'],l+0x1,'objLeft');if(k['objectRight'])j(k['objectRight'],l+0x1,'objRight');if(k['recipient'])j(k['recipient'],l+0x1,'recipient');}h['push']('#\x20Guard\x20Tree\x20Definition'),h['push']('');d&&h['push']('**Guard:**\x20'+d);e&&h['push']('**Address:**\x20'+e);c&&h['push']('**Table\x20Entries:**\x20'+c['length']);f&&f['guards']['length']>0x0&&h['push']('**Rely:**\x20'+f['guards']['length']+'\x20guard(s)'+(f['logic_or']?'\x20(logic_or)':'\x20(logic_and)'));h['push'](''),h['push']('##\x20Root'),j(b,0x0);if(c&&c['length']>0x0){h['push'](''),h['push']('##\x20Table'),h['push'](''),h['push']('|\x20identifier\x20|\x20b_submission\x20|\x20value_type\x20|\x20value\x20|\x20name\x20|'),h['push']('|------------|-------------|------------|-------|------|');for(const k of c){const l=k['value']===undefined?'-':String(k['value']),m=l['replace'](/\|/g,'\x5c|')['replace'](/\n/g,'\x20'),n=k['name']??'-';h['push']('|\x20'+k['identifier']+'\x20|\x20'+k['b_submission']+'\x20|\x20'+k['value_type']+'\x20|\x20'+m+'\x20|\x20'+n+'\x20|');}h['push'](''),h['push']('##\x20Table\x20JSON'),h['push'](''),h['push']('```json'),h['push'](JSON['stringify'](c,null,0x2)),h['push']('```');}if(f&&f['guards']['length']>0x0){h['push'](''),h['push']('##\x20Rely'),h['push'](''),h['push']('Logic:\x20'+(f['logic_or']?'OR':'AND'));for(const o of f['guards']){h['push']('-\x20'+o);}}return h['push'](''),h['push']('##\x20JSON\x20Definition'),h['push'](''),h['push']('```json'),h['push'](JSON['stringify']({'root':b,'table':c,'guardName':d,'guardAddress':e,'rely':f},null,0x2)),h['push']('```'),h['join']('\x0a');}export function parseGuardTreeIndented(a){const b=[],c=a['matchAll'](/```json\s*\n([\s\S]*?)```/g);let d=null;for(const k of c){d=k[0x1];}if(d)try{const l=JSON['parse'](d['trim']());if(l&&typeof l==='object'){if('root'in l&&l['root']&&typeof l['root']==='object'&&'type'in l['root'])return{'success':!![],'data':l['root'],'errors':[]};if('type'in l)return{'success':!![],'data':l,'errors':[]};}}catch(m){b['push']('JSON\x20code\x20block\x20parse\x20error:\x20'+m['message']);}const f=a['split']('\x0a')['filter'](n=>n['trim']()['startsWith']('-\x20'));if(f['length']===0x0)return{'success':![],'errors':['No\x20outline\x20entries\x20found.\x20Use\x20\x27-\x20\x27\x20prefixed\x20lines\x20or\x20a\x20JSON\x20code\x20block.']};const g=[];let h=null;function i(n){const o=n['match'](/^(\s*)- /);return o?o[0x1]['length']/0x2:0x0;}function j(n){const o=n['replace'](/^\s*- /,'')['trim'](),p=o['match'](/^([^:]+):\s*(.*)$/),q=p?p[0x1]['trim']():undefined,r=p?p[0x2]['trim']():o,s=r['match'](/^identifier\[(\d+)\](?:\s+"(.+)")?$/);if(s)return{'label':q,'node':{'type':'identifier','identifier':parseInt(s[0x1],0xa)}};const t=r['match'](/^context\((\w+)\)$/);if(t)return{'label':q,'node':{'type':'context','context':t[0x1]}};const u=r['match'](/^query\((.+?)\)$/);if(u){const v=u[0x1],w=v['split'](',')['map'](A=>A['trim']()),x=w[0x0]['replace'](/^#/,''),y=/^\d+$/['test'](x),z={'type':'query','query':y?parseInt(x,0xa):x};for(const A of w['slice'](0x1)){const B=A['match'](/^id\[(\d+)\]$/);B&&(z['object']={'identifier':parseInt(B[0x1],0xa)});const C=A['match'](/^witness=(\d+)$/);C&&(z['object']={...z['object']||{},'convert_witness':parseInt(C[0x1],0xa)});}return{'label':q,'node':z};}return{'label':q,'node':{'type':r}};}for(const n of f){const o=i(n),{label:p,node:q}=j(n);if(o===0x0)h=q,g['length']=0x0,g['push']({'node':q,'depth':o});else{while(g['length']>0x0&&g[g['length']-0x1]['depth']>=o){g['pop']();}const r=g[g['length']-0x1];if(!r){b['push']('Orphaned\x20node\x20at\x20depth\x20'+o+':\x20'+n);continue;}if(p){const s=p['match'](/^child\[(\d+)\]$/),t=p['match'](/^param\[(\d+)\]$/);if(s){if(!r['node']['nodes'])r['node']['nodes']=[];r['node']['nodes']['push'](q);}else{if(t){if(!r['node']['parameters'])r['node']['parameters']=[];r['node']['parameters']['push'](q);}else{if(p==='child')r['node']['node']=q;else{if(p==='left')r['node']['nodeLeft']=q;else{if(p==='right')r['node']['nodeRight']=q;else{if(p==='historyIdx')r['node']['historyIdx']=q;else{if(p==='sessionIdx')r['node']['sessionIdx']=q;else{if(p==='forwardIdx')r['node']['forwardIdx']=q;else{if(p==='where')r['node']['where']=q;else{if(p==='find')r['node']['find']=q;else{if(p==='objLeft')r['node']['objectLeft']=q;else{if(p==='objRight')r['node']['objectRight']=q;else p==='recipient'&&(r['node']['recipient']=q);}}}}}}}}}}}}g['push']({'node':q,'depth':o});}}if(!h)return{'success':![],'errors':['No\x20root\x20node\x20found\x20in\x20outline.']};return{'success':!![],'data':h,'errors':b};}export function renderGuardAscii(a){const {root:b,table:c,guardName:d,guardAddress:e,rely:f}=a,h=[];if(d)h['push']('Guard:\x20'+d);if(e)h['push']('Address:\x20'+e);if(d||e)h['push']('');function i(m){const n=m['type'],o=shortNodeLabel(m);if(n==='identifier'){const p=c?.['find'](u=>u['identifier']===m['identifier']),q=p?'\x20['+(typeof p['value_type']==='string'?p['value_type']:'type='+p['value_type'])+']':'',r=p&&p['value']!==undefined&&!p['b_submission']?',\x20value='+String(p['value']):'',s=p?.['b_submission']?'\x20(submission)':'';return''+o+q+r+s;}if(n==='context')return o+'\x20['+(m['context']??'?')+']';if(n==='query'){const u=m['object']?.['convert_witness'],v=u!==undefined?',\x20witness='+u:'';return''+o+v;}return o;}function j(m){const n=[];m['nodes']&&Array['isArray'](m['nodes'])&&m['nodes']['forEach']((o,p)=>n['push']({'node':o,'label':'child['+p+']'}));if(m['node'])n['push']({'node':m['node'],'label':'child'});if(m['nodeLeft'])n['push']({'node':m['nodeLeft'],'label':'left'});if(m['nodeRight'])n['push']({'node':m['nodeRight'],'label':'right'});m['parameters']&&Array['isArray'](m['parameters'])&&m['parameters']['forEach']((o,p)=>n['push']({'node':o,'label':'param['+p+']'}));if(m['historyIdx'])n['push']({'node':m['historyIdx'],'label':'historyIdx'});if(m['sessionIdx'])n['push']({'node':m['sessionIdx'],'label':'sessionIdx'});if(m['forwardIdx'])n['push']({'node':m['forwardIdx'],'label':'forwardIdx'});if(m['where'])n['push']({'node':m['where'],'label':'where'});if(m['find'])n['push']({'node':m['find'],'label':'find'});if(m['objectLeft'])n['push']({'node':m['objectLeft'],'label':'objLeft'});if(m['objectRight'])n['push']({'node':m['objectRight'],'label':'objRight'});if(m['recipient'])n['push']({'node':m['recipient'],'label':'recipient'});return n;}function k(m,n,o,p){const q=o?'└─\x20':'├─\x20',r=p?p+':\x20':'';h['push'](''+n+q+r+i(m));const s=j(m),t=n+(o?'\x20\x20\x20':'│\x20\x20');s['forEach']((u,v)=>{k(u['node'],t,v===s['length']-0x1,u['label']);});}h['push'](i(b));const l=j(b);l['forEach']((m,n)=>{k(m['node'],'',n===l['length']-0x1,m['label']);});if(c&&c['length']>0x0){h['push'](''),h['push']('Table:');for(const m of c){const n=typeof m['value_type']==='string'?m['value_type']:'type='+m['value_type'],o=m['value']!==undefined&&!m['b_submission']?',\x20value='+String(m['value']):'',p=m['b_submission']?'\x20(submission)':'',q=m['name']?'\x20\x22'+m['name']+'\x22':'';h['push']('\x20\x20id['+m['identifier']+']'+q+':\x20'+n+o+p);}}if(f&&f['guards']['length']>0x0){h['push'](''),h['push']('Rely\x20('+(f['logic_or']?'OR':'AND')+'):');for(const r of f['guards']){h['push']('\x20\x20-\x20'+r);}}return h['join']('\x0a');}export function renderGuardMarkmap(a){const {root:b,table:c,guardName:d,guardAddress:e,rely:f}=a,h=[],i=d?'Guard:\x20'+d:'Guard';h['push']('#\x20'+i);if(e)h['push']('');if(e)h['push']('**Address:**\x20'+e);h['push']('');function j(m,n){return'#'['repeat'](Math['min'](m+0x1,0x6))+'\x20'+n;}function k(m){const n=m['type'],o=shortNodeLabel(m);if(n==='identifier'){const p=c?.['find'](u=>u['identifier']===m['identifier']),q=p?'\x20['+(typeof p['value_type']==='string'?p['value_type']:'type='+p['value_type'])+']':'',r=p&&p['value']!==undefined&&!p['b_submission']?',\x20value='+String(p['value']):'',s=p?.['b_submission']?'\x20(submission)':'';return''+o+q+r+s;}if(n==='context')return o+'\x20['+(m['context']??'?')+']';if(n==='query'){const u=m['object']?.['convert_witness'],v=u!==undefined?',\x20witness='+u:'';return''+o+v;}return o;}function l(m,n,o){const p=o?o+':\x20':'';h['push'](j(n,''+p+k(m)));m['nodes']&&Array['isArray'](m['nodes'])&&m['nodes']['forEach']((q,r)=>l(q,n+0x1,'child['+r+']'));if(m['node'])l(m['node'],n+0x1,'child');if(m['nodeLeft'])l(m['nodeLeft'],n+0x1,'left');if(m['nodeRight'])l(m['nodeRight'],n+0x1,'right');m['parameters']&&Array['isArray'](m['parameters'])&&m['parameters']['forEach']((q,r)=>l(q,n+0x1,'param['+r+']'));if(m['historyIdx'])l(m['historyIdx'],n+0x1,'historyIdx');if(m['sessionIdx'])l(m['sessionIdx'],n+0x1,'sessionIdx');if(m['forwardIdx'])l(m['forwardIdx'],n+0x1,'forwardIdx');if(m['where'])l(m['where'],n+0x1,'where');if(m['find'])l(m['find'],n+0x1,'find');if(m['objectLeft'])l(m['objectLeft'],n+0x1,'objLeft');if(m['objectRight'])l(m['objectRight'],n+0x1,'objRight');if(m['recipient'])l(m['recipient'],n+0x1,'recipient');}h['push'](j(0x1,'Root')),l(b,0x2);if(c&&c['length']>0x0){h['push'](''),h['push']('##\x20Table');for(const m of c){const n=typeof m['value_type']==='string'?m['value_type']:'type='+m['value_type'],o=m['value']!==undefined&&!m['b_submission']?',\x20value='+String(m['value']):'',p=m['b_submission']?'\x20(submission)':'',q=m['name']?'\x20\x22'+m['name']+'\x22':'';h['push']('-\x20id['+m['identifier']+']'+q+':\x20'+n+o+p);}}if(f&&f['guards']['length']>0x0){h['push'](''),h['push']('##\x20Rely\x20('+(f['logic_or']?'OR':'AND')+')');for(const r of f['guards']){h['push']('-\x20'+r);}}return h['join']('\x0a');}export function parseGuardTableJSON(a){const b=a['match'](/##\s*Table JSON[^\n]*\n\s*```json\s*\n([\s\S]*?)```/i);if(!b)return null;try{const c=JSON['parse'](b[0x1]['trim']());if(!Array['isArray'](c))return null;return c['filter'](d=>{return d&&typeof d==='object'&&typeof d['identifier']==='number'&&typeof d['b_submission']==='boolean';})['map'](d=>({'identifier':d['identifier'],'name':d['name'],'value_type':d['value_type'],'b_submission':d['b_submission'],'value':d['value']}));}catch{return null;}}
|